@wix/himalaya-cli 0.1291.0 → 0.1293.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/webview/src/index.d.ts +35 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/webview-page/src/capabilities.generated.d.ts +88 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/webview-page/src/index.d.ts +68 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +14 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/webview-page.mjs +88 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/webview.mjs +43 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/package.json +4 -0
- package/dist/cli.mjs +231 -69
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/himi-json-output.md +1 -0
- package/guides/importable-sdks.md +1 -0
- package/guides/index.json +6 -0
- package/guides/sdk-reference.json +79 -0
- package/guides/webview-page-sdk.md +132 -0
- package/package.json +2 -2
|
Binary file
|
|
@@ -55,6 +55,7 @@ keeps its existing fields and adds the code:
|
|
|
55
55
|
| `serve_unreachable` | A partial-push upload could not reach the publishing service. |
|
|
56
56
|
| `no_serve_plane` | A loopback service answering a partial push is not a himi publishing service. |
|
|
57
57
|
| `upload_http_error` | The upload returned a non-success HTTP status. `status` and the original `body` remain available; server errors never replace this CLI code. |
|
|
58
|
+
| `binary_capability_gap` | The publish was refused (409): it declares a permission-bearing capability (iOS usage string or entitlement, Android permission) the app's last successful `himi dist` was not built with. `missing` names the ids; `dists` lists each platform's last dist that lacks them (`platform`, `jobId`, `missing`). The same code comes from `himi push --only` and `himi patch`. Run `himi dist` first, or re-run with `--allow-binary-gap`. |
|
|
58
59
|
| `claim_failed` | Auto-claim returned a fatal refusal. Existing server fields and `status` remain available. |
|
|
59
60
|
| `invalid_flag_value` | A flag violates the CLI flag grammar. |
|
|
60
61
|
| `invalid_selector` | `--only` is missing a selector or its selector syntax is invalid. |
|
|
@@ -59,6 +59,7 @@ package in one greppable file) or `GET /v1/sdk/<name>` over HTTP; in the CLI,
|
|
|
59
59
|
- `@himalaya/time` — Tier-5 temporal helpers.
|
|
60
60
|
- `@himalaya/ui` — Tier-5 typed binding to the platform's imperative popup capability.
|
|
61
61
|
- `@himalaya/webview` — Tier-5 typed binding for the page ↔ worker message channel of a worker-backed webview screen (Part 2 / RFC 0025 composition).
|
|
62
|
+
- `@himalaya/webview-page` — browser-side SDK for a trusted page hosted by a worker-backed Himalaya WebView.
|
|
62
63
|
- `@himalaya/widget` — Tier-5 logic-bundle widget surface.
|
|
63
64
|
- `@himalaya/wix-llm` — narrow Tier-5 binding for Wix LLM text generation.
|
|
64
65
|
- `@himalaya/wix-platform` — Wix Platform SDK (RFC 0042), worker-facing bindings.
|
package/guides/index.json
CHANGED
|
@@ -89,6 +89,12 @@
|
|
|
89
89
|
"category": "Workers & SDKs",
|
|
90
90
|
"file": "importable-sdks.md"
|
|
91
91
|
},
|
|
92
|
+
{
|
|
93
|
+
"id": "webview-page-sdk",
|
|
94
|
+
"title": "Use native capabilities from a WebView page",
|
|
95
|
+
"category": "Workers & SDKs",
|
|
96
|
+
"file": "webview-page-sdk.md"
|
|
97
|
+
},
|
|
92
98
|
{
|
|
93
99
|
"id": "component-reference",
|
|
94
100
|
"title": "Component reference",
|
|
@@ -4073,6 +4073,85 @@
|
|
|
4073
4073
|
"jsdoc": "/**\n * Register a handler for messages the page posts via `window.HimalayaWorker.post(msg)`.\n * The latest registered handler wins. Call this once during the bundle's setup.\n */",
|
|
4074
4074
|
"decl": "export function onPageMessage(cb: (msg: unknown) => void): void;"
|
|
4075
4075
|
},
|
|
4076
|
+
{
|
|
4077
|
+
"name": "PageCapabilityRequest",
|
|
4078
|
+
"kind": "interface",
|
|
4079
|
+
"jsdoc": "",
|
|
4080
|
+
"decl": "export interface PageCapabilityRequest {\n v: 1;\n id: string;\n capability: string;\n method: string;\n args: unknown[];\n}"
|
|
4081
|
+
},
|
|
4082
|
+
{
|
|
4083
|
+
"name": "PageCapabilityResponse",
|
|
4084
|
+
"kind": "interface",
|
|
4085
|
+
"jsdoc": "",
|
|
4086
|
+
"decl": "export interface PageCapabilityResponse {\n v: 1;\n id: string;\n ok: boolean;\n result?: unknown;\n error?: { message: string; code?: string };\n}"
|
|
4087
|
+
},
|
|
4088
|
+
{
|
|
4089
|
+
"name": "ExposedPageCapability",
|
|
4090
|
+
"kind": "interface",
|
|
4091
|
+
"jsdoc": "",
|
|
4092
|
+
"decl": "export interface ExposedPageCapability {\n module: Record<string, unknown>;\n methods: readonly string[];\n}"
|
|
4093
|
+
},
|
|
4094
|
+
{
|
|
4095
|
+
"name": "exposeCapabilitiesToPage",
|
|
4096
|
+
"kind": "function",
|
|
4097
|
+
"jsdoc": "/**\n * Expose selected typed @himalaya/* modules to the hosting page.\n *\n * The worker author must pass both the imported module and its explicit verb allowlist:\n *\n * import * as health from \"@himalaya/health\";\n * exposeCapabilitiesToPage({\n * health: { module: health, methods: [\"availability\", \"query\"] },\n * });\n *\n * The bundle still has to declare `webview` plus every exposed capability. Importing only\n * selected modules keeps native permissions and `himi dist` additions opt-in.\n */",
|
|
4098
|
+
"decl": "export function exposeCapabilitiesToPage(\n capabilities: Readonly<Record<string, ExposedPageCapability>>,\n): void;"
|
|
4099
|
+
},
|
|
4100
|
+
{
|
|
4101
|
+
"name": "version",
|
|
4102
|
+
"kind": "const",
|
|
4103
|
+
"jsdoc": "",
|
|
4104
|
+
"decl": "export const version = 1;"
|
|
4105
|
+
}
|
|
4106
|
+
]
|
|
4107
|
+
},
|
|
4108
|
+
{
|
|
4109
|
+
"name": "@himalaya/webview-page",
|
|
4110
|
+
"source": "core/sdk/webview-page/src/index.ts",
|
|
4111
|
+
"description": "browser-side SDK for a trusted page hosted by a worker-backed Himalaya WebView.",
|
|
4112
|
+
"api": [
|
|
4113
|
+
{
|
|
4114
|
+
"name": "\"./capabilities.generated.js\"",
|
|
4115
|
+
"kind": "reexport",
|
|
4116
|
+
"jsdoc": "",
|
|
4117
|
+
"decl": "export type { HimalayaPageCapabilities, HimalayaPageSdk } from \"./capabilities.generated.js\";"
|
|
4118
|
+
},
|
|
4119
|
+
{
|
|
4120
|
+
"name": "WebViewPageRequest",
|
|
4121
|
+
"kind": "interface",
|
|
4122
|
+
"jsdoc": "",
|
|
4123
|
+
"decl": "export interface WebViewPageRequest {\n v: 1;\n id: string;\n capability: string;\n method: string;\n args: unknown[];\n}"
|
|
4124
|
+
},
|
|
4125
|
+
{
|
|
4126
|
+
"name": "WebViewPageError",
|
|
4127
|
+
"kind": "interface",
|
|
4128
|
+
"jsdoc": "",
|
|
4129
|
+
"decl": "export interface WebViewPageError {\n message: string;\n code?: string;\n}"
|
|
4130
|
+
},
|
|
4131
|
+
{
|
|
4132
|
+
"name": "WebViewPageResponse",
|
|
4133
|
+
"kind": "interface",
|
|
4134
|
+
"jsdoc": "",
|
|
4135
|
+
"decl": "export interface WebViewPageResponse {\n v: 1;\n id: string;\n ok: boolean;\n result?: unknown;\n error?: WebViewPageError;\n}"
|
|
4136
|
+
},
|
|
4137
|
+
{
|
|
4138
|
+
"name": "call",
|
|
4139
|
+
"kind": "function",
|
|
4140
|
+
"jsdoc": "/** Invoke one method through the companion worker. Primarily useful to generated bindings. */",
|
|
4141
|
+
"decl": "export function call<T>(\n capability: string,\n method: string,\n args: unknown[] = [],\n timeoutMs = 30_000,\n): Promise<T>;"
|
|
4142
|
+
},
|
|
4143
|
+
{
|
|
4144
|
+
"name": "himalaya",
|
|
4145
|
+
"kind": "const",
|
|
4146
|
+
"jsdoc": "/**\n * Typed SDK proxy for every request/response capability in CAPABILITY_REGISTRY.\n * A namespace is usable only when this screen's companion worker explicitly imported and\n * exposed it and the bundle + host both declared it.\n */",
|
|
4147
|
+
"decl": "export const himalaya = new Proxy({ version: 1 as const }, {\n get(target, property) {\n if (property === \"version\") return target.version;\n if (typeof property !== \"string\" || property === \"then\") return undefined;\n return pageMember(property, []);\n },\n}) as HimalayaPageSdk;"
|
|
4148
|
+
},
|
|
4149
|
+
{
|
|
4150
|
+
"name": "health",
|
|
4151
|
+
"kind": "const",
|
|
4152
|
+
"jsdoc": "/** Convenience named export; equivalent to `himalaya.health`. */",
|
|
4153
|
+
"decl": "export const health = himalaya.health;"
|
|
4154
|
+
},
|
|
4076
4155
|
{
|
|
4077
4156
|
"name": "version",
|
|
4078
4157
|
"kind": "const",
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Himalaya SDK for hosted WebView pages
|
|
2
|
+
|
|
3
|
+
Use `@wix/himalaya/webview-page` when a trusted webpage hosted inside Brandy (or another
|
|
4
|
+
worker-backed Himalaya WebView) needs an explicitly selected native capability. The webpage never
|
|
5
|
+
talks directly to native code:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
page → window.HimalayaWorker → companion Tier-5 worker → @himalaya/* → native registry
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The same bundle declaration and host policy that protect an ordinary Tier-5 screen protect the
|
|
12
|
+
page. A namespace present in TypeScript is not authority: the companion worker must import and
|
|
13
|
+
allowlist it, its `logicBundle.declaredCapabilities` must name it, and the binary must serve it.
|
|
14
|
+
|
|
15
|
+
## Page
|
|
16
|
+
|
|
17
|
+
Install the published umbrella package and import its page entry:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { himalaya } from "@wix/himalaya/webview-page";
|
|
21
|
+
|
|
22
|
+
const available = await himalaya.health.availability();
|
|
23
|
+
if (available.available) {
|
|
24
|
+
await himalaya.health.requestPermission({ read: ["steps"], write: ["workouts"] });
|
|
25
|
+
const result = await himalaya.health.query({
|
|
26
|
+
type: "steps",
|
|
27
|
+
from: new Date("2026-10-11T00:00:00Z").toISOString(),
|
|
28
|
+
to: new Date().toISOString(),
|
|
29
|
+
});
|
|
30
|
+
console.log(result.samples);
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The generated `himalaya` type includes every package represented by
|
|
35
|
+
`CAPABILITY_REGISTRY`, including nested APIs such as `himalaya.base44.auth.*`. Calls made in an
|
|
36
|
+
ordinary browser fail immediately with a clear “not inside a worker-backed Himalaya WebView”
|
|
37
|
+
error.
|
|
38
|
+
|
|
39
|
+
## Companion worker
|
|
40
|
+
|
|
41
|
+
Import only what this website is allowed to use and allowlist only the methods it needs:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import * as health from "@himalaya/health";
|
|
45
|
+
import { exposeCapabilitiesToPage } from "@himalaya/webview";
|
|
46
|
+
|
|
47
|
+
exposeCapabilitiesToPage({
|
|
48
|
+
health: {
|
|
49
|
+
module: health,
|
|
50
|
+
methods: ["availability", "requestPermission", "getPermissionStatus", "query", "saveWorkout"],
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Build it like any other Tier-5 bundle. Its descriptor must declare both the transport and the
|
|
56
|
+
selected capabilities:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
logicBundle: {
|
|
60
|
+
url,
|
|
61
|
+
integrity,
|
|
62
|
+
declaredCapabilities: ["webview", "health"],
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Do not build one worker that imports every SDK. Static bundle scanning would correctly conclude
|
|
67
|
+
that the release uses every capability, forcing unrelated permissions and native modules into the
|
|
68
|
+
binary. One app-specific worker imports exactly the app’s selected subset.
|
|
69
|
+
|
|
70
|
+
## Brandy
|
|
71
|
+
|
|
72
|
+
Health has a built-in proof worker, so it needs no custom bundle name:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"webSdk": {
|
|
77
|
+
"capabilities": ["health"],
|
|
78
|
+
"permissionCopy": {
|
|
79
|
+
"health": "Show your activity and save completed workouts."
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
For another subset, add the companion bundle to the app and name it:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"webSdk": {
|
|
90
|
+
"bundle": "customer-page-capabilities",
|
|
91
|
+
"capabilities": ["camera", "share"],
|
|
92
|
+
"permissionCopy": {
|
|
93
|
+
"camera": "Take a photo to attach it to your request."
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Brandy accepts capabilities `himi dist` can add to an extensible shell. Capabilities requiring
|
|
100
|
+
app-specific boot wiring remain refused until that shell supplies the wiring. Base44 is accepted
|
|
101
|
+
only when the same Brandy contract contains a Base44 binding.
|
|
102
|
+
|
|
103
|
+
## Security and current transport boundary
|
|
104
|
+
|
|
105
|
+
- Only the trusted main-frame origin receives `HimalayaWorker`; redirects and cross-origin frames
|
|
106
|
+
cannot use it.
|
|
107
|
+
- The worker accepts JSON-compatible arguments and results, caps argument count, validates request
|
|
108
|
+
identifiers and resolves only own properties on an explicit method allowlist.
|
|
109
|
+
- Errors preserve a typed `code` when the SDK provides one.
|
|
110
|
+
- The page cannot use raw `capability.*` messages: Brandy site descriptors keep
|
|
111
|
+
`capabilitiesRequired: []`; native calls go through the companion worker.
|
|
112
|
+
- v1 is request/response. SDK helpers returning `AsyncIterable`, accepting JavaScript callbacks,
|
|
113
|
+
or depending on worker action names need a page-specific adapter built from their lower-level
|
|
114
|
+
start/next/stop verbs. Do not expose such a helper unchanged.
|
|
115
|
+
|
|
116
|
+
The package source includes complete `health-page.ts` and `health-worker.ts` examples matching the
|
|
117
|
+
snippets above.
|
|
118
|
+
|
|
119
|
+
## Demo app regression page
|
|
120
|
+
|
|
121
|
+
The demo app hosts a page that calls every capability its iOS and Android boots already
|
|
122
|
+
register. Open it with:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
himalaya-demo-app://screen/demo_app_webview_sdk
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The page is served at `/web/webview-sdk.html`. Its companion worker is
|
|
129
|
+
`demo-app-webview-sdk`, which carries the catalog of allowlisted methods and read-only
|
|
130
|
+
probes. Safe probes run on load.
|
|
131
|
+
Verbs that prompt, write, or open system UI stay allowlisted and are not called. Streaming
|
|
132
|
+
helpers that return a live object stay on the worker.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1293.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
|
|
6
6
|
"keywords": [
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"artifactId": "himalaya-cli"
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
|
-
"falconPackageHash": "
|
|
73
|
+
"falconPackageHash": "1e4a8d2ba1f5fab907ed2786c0387721f5289baac64c2650c3240e88"
|
|
74
74
|
}
|