@vibesdotdev/host-mobile 0.0.0-stage → 1.0.0-rc.2
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/LICENSE +18 -0
- package/README.md +68 -2
- package/dist/contracts.d.ts +23 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +96 -0
- package/dist/contracts.js.map +1 -0
- package/dist/docs/plugin.d.ts +10 -0
- package/dist/docs/plugin.d.ts.map +1 -0
- package/dist/docs/plugin.js +17 -0
- package/dist/docs/plugin.js.map +1 -0
- package/dist/docs/runtime-environment-mobile.docs.descriptor.d.ts +20 -0
- package/dist/docs/runtime-environment-mobile.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/runtime-environment-mobile.docs.descriptor.js +135 -0
- package/dist/docs/runtime-environment-mobile.docs.descriptor.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/mobile-environment.impl.d.ts +37 -0
- package/dist/mobile-environment.impl.d.ts.map +1 -0
- package/dist/mobile-environment.impl.js +91 -0
- package/dist/mobile-environment.impl.js.map +1 -0
- package/dist/runtime-environment-mobile.plugin.d.ts +7 -0
- package/dist/runtime-environment-mobile.plugin.d.ts.map +1 -0
- package/dist/runtime-environment-mobile.plugin.js +21 -0
- package/dist/runtime-environment-mobile.plugin.js.map +1 -0
- package/dist/schemas/declaration.d.ts +11 -0
- package/dist/schemas/declaration.d.ts.map +1 -0
- package/dist/schemas/declaration.js +7 -0
- package/dist/schemas/declaration.js.map +1 -0
- package/dist/schemas/failure.d.ts +20 -0
- package/dist/schemas/failure.d.ts.map +1 -0
- package/dist/schemas/failure.js +10 -0
- package/dist/schemas/failure.js.map +1 -0
- package/dist/schemas/host-facts.d.ts +65 -0
- package/dist/schemas/host-facts.d.ts.map +1 -0
- package/dist/schemas/host-facts.js +40 -0
- package/dist/schemas/host-facts.js.map +1 -0
- package/dist/schemas/namespace.d.ts +33 -0
- package/dist/schemas/namespace.d.ts.map +1 -0
- package/dist/schemas/namespace.js +27 -0
- package/dist/schemas/namespace.js.map +1 -0
- package/dist/schemas/options.d.ts +13 -0
- package/dist/schemas/options.d.ts.map +1 -0
- package/dist/schemas/options.js +6 -0
- package/dist/schemas/options.js.map +1 -0
- package/dist/schemas/performance.d.ts +17 -0
- package/dist/schemas/performance.d.ts.map +1 -0
- package/dist/schemas/performance.js +15 -0
- package/dist/schemas/performance.js.map +1 -0
- package/package.json +84 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 VIBES DEV LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
6
|
+
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
12
|
+
portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
15
|
+
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
|
|
16
|
+
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
18
|
+
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,69 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @vibesdotdev/host-mobile
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Vibes runtime environment for a mobile web view: a Tauri 2 app on
|
|
4
|
+
WKWebView (iOS) or Android System WebView. The native host attests facts about
|
|
5
|
+
the renderer: its identity, lifecycle, trusted origin, platform, OS and app
|
|
6
|
+
versions, safe-area insets, biometrics availability, deployment tier and the
|
|
7
|
+
semantic capabilities it offers. This package parses those facts strictly and
|
|
8
|
+
turns them into runtime scope.
|
|
9
|
+
|
|
10
|
+
It is credential-dark. No host token, secret key or private filesystem path
|
|
11
|
+
reaches the web view: `getEnv()` always returns `undefined`, and there is no secret accessor: credentials resolve through `runtime.resolveCredential`, which answers `no-store` here.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
bun add @vibesdotdev/host-mobile @vibesdotdev/kernel
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Use
|
|
20
|
+
|
|
21
|
+
Select the environment through the browser surface, before bootstrap:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { ensureBrowserRuntime } from '@vibesdotdev/surface-sveltekit/surface-browser';
|
|
25
|
+
import { createRuntimeEnvironmentMobilePlugin } from '@vibesdotdev/host-mobile/plugin';
|
|
26
|
+
|
|
27
|
+
await ensureBrowserRuntime({
|
|
28
|
+
environment: async () => createRuntimeEnvironmentMobilePlugin(),
|
|
29
|
+
plugins: [() => import('@vibesdotdev/kernel/client/plugin')]
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The plugin makes one call, `environment`, on the `namespace` option or else
|
|
34
|
+
`globalThis.vibes.mobile`, which your Tauri host injects. The host marks the
|
|
35
|
+
page at document start (`__vibesNativeHost = 'mobile'`) and fires
|
|
36
|
+
`vibes:runtime-host-ready` after injecting; the plugin uses a namespace that
|
|
37
|
+
is already installed at once and otherwise waits for that event, with no poll
|
|
38
|
+
or timer. A page without the marker fails at once with
|
|
39
|
+
`CapabilityError` `UNAVAILABLE`, reason `host-unavailable`.
|
|
40
|
+
|
|
41
|
+
Any unknown key in the facts, at any level, fails the parse.
|
|
42
|
+
|
|
43
|
+
The environment also supplies the host clock the kernel's lifecycle needs:
|
|
44
|
+
monotonic milliseconds from the renderer's browser performance clock
|
|
45
|
+
(`performance.now()`, never `Date.now()`), so `runtime.lifecycle.now()` and
|
|
46
|
+
disposal's finalization budget run on renderer time. The kernel validates the
|
|
47
|
+
readings and owns the lifecycle refusals. A page whose `performance` global
|
|
48
|
+
cannot be read refuses `UNAVAILABLE`, reason `host-unavailable`, at
|
|
49
|
+
construction, value-free.
|
|
50
|
+
|
|
51
|
+
Options are strict: only `namespace` and `workspace` are supported.
|
|
52
|
+
A supplied `workspace` must contain only a nonblank string `root`; the
|
|
53
|
+
kernel schema trims it. Without a workspace the renderer remains unbound.
|
|
54
|
+
Unknown option, declaration, workspace, or nested host-fact fields are rejected.
|
|
55
|
+
Direct construction is available through
|
|
56
|
+
`import { MobileEnvironment } from '@vibesdotdev/host-mobile/environment'`;
|
|
57
|
+
`new MobileEnvironment(facts, declaration)` validates both inputs. Runtime
|
|
58
|
+
consumers resolve `runtime.query('runtime/environment').withId('mobile').resolve()`.
|
|
59
|
+
The canonical kernel tiers are `local`, `dev`, `staging`, and `production`.
|
|
60
|
+
|
|
61
|
+
## Docs
|
|
62
|
+
|
|
63
|
+
Register `@vibesdotdev/host-mobile/docs/plugin` to add the
|
|
64
|
+
`runtime.environment.mobile` topic to runtime docs discovery; it lists every
|
|
65
|
+
fact the host must send. [SPEC.md](SPEC.md) is the full contract.
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type MobileHostFacts } from './schemas/host-facts.ts';
|
|
2
|
+
import { type MobileRuntimeNamespace } from './schemas/namespace.ts';
|
|
3
|
+
export * from './schemas/host-facts.ts';
|
|
4
|
+
export { NATIVE_HOST_MARKER, NATIVE_HOST_READY_EVENT, type MobileRuntimeNamespace } from './schemas/namespace.ts';
|
|
5
|
+
export { MobilePerformanceHolderSchema } from './schemas/performance.ts';
|
|
6
|
+
/**
|
|
7
|
+
* The renderer's browser performance clock (`performance.now()`), captured once
|
|
8
|
+
* as a bound reader so kernel lifecycle readings can never drift to a different
|
|
9
|
+
* page clock. A web view whose `performance` global cannot be read is a broken
|
|
10
|
+
* page: refused `UNAVAILABLE / host-unavailable`, value-free — never `Date.now()`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readMobilePerformanceClock(): () => number;
|
|
13
|
+
/** The namespace the Tauri host injects: `vibes.mobile`, and nothing else. */
|
|
14
|
+
export declare function getGlobalMobileRuntimeNamespace(): MobileRuntimeNamespace | null;
|
|
15
|
+
/**
|
|
16
|
+
* The native namespace, once the host says it is installed. No polling and no
|
|
17
|
+
* timeout: the host marks the page at document start and fires the ready event
|
|
18
|
+
* after injection; a page without the marker has no mobile host
|
|
19
|
+
* (`host-unavailable`).
|
|
20
|
+
*/
|
|
21
|
+
export declare function awaitMobileRuntimeNamespace(): Promise<MobileRuntimeNamespace>;
|
|
22
|
+
export declare function readMobileHostFacts(namespace: MobileRuntimeNamespace): Promise<MobileHostFacts>;
|
|
23
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAOA,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEtF,OAAO,EAIN,KAAK,sBAAsB,EAC3B,MAAM,wBAAwB,CAAC;AAEhC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EACN,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,sBAAsB,EAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAyCzE;;;;;GAKG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,MAAM,CAQzD;AAED,8EAA8E;AAC9E,wBAAgB,+BAA+B,IAAI,sBAAsB,GAAG,IAAI,CAG/E;AAED;;;;;GAKG;AACH,wBAAsB,2BAA2B,IAAI,OAAO,CAAC,sBAAsB,CAAC,CA0BnF;AAED,wBAAsB,mBAAmB,CACxC,SAAS,EAAE,sBAAsB,GAC/B,OAAO,CAAC,eAAe,CAAC,CAE1B"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { CapabilityError, CaughtFailureSchema, valueFreeFailure } from '@vibesdotdev/kernel';
|
|
2
|
+
import { MobileHostFactsSchema } from "./schemas/host-facts.js";
|
|
3
|
+
import { MobileFailureNameSchema } from "./schemas/failure.js";
|
|
4
|
+
import { MobileNamespaceGlobalSchema, MobileMarkedPageSchema, NATIVE_HOST_READY_EVENT } from "./schemas/namespace.js";
|
|
5
|
+
import { MobilePerformanceHolderSchema } from "./schemas/performance.js";
|
|
6
|
+
export * from "./schemas/host-facts.js";
|
|
7
|
+
export { NATIVE_HOST_MARKER, NATIVE_HOST_READY_EVENT } from "./schemas/namespace.js";
|
|
8
|
+
export { MobilePerformanceHolderSchema } from "./schemas/performance.js";
|
|
9
|
+
/**
|
|
10
|
+
* Guard a schema predicate or getter through the kernel's caught-failure
|
|
11
|
+
* boundary: a hostile page global can throw while it is read, and the refusal
|
|
12
|
+
* names only the kernel's value-free facts, never the thrown value.
|
|
13
|
+
*/
|
|
14
|
+
function parseMobileBoundary(schema, value) {
|
|
15
|
+
try {
|
|
16
|
+
return schema.safeParse(value);
|
|
17
|
+
}
|
|
18
|
+
catch (cause) {
|
|
19
|
+
throw hostReadFailed(valueFreeFailure(CaughtFailureSchema.parse(cause)));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The one refusal a caught failure produces at this boundary: the kernel's
|
|
24
|
+
* value-free facts (`valueFreeFailure`) narrowed through
|
|
25
|
+
* `MobileFailureNameSchema` to fixed class-name categories, carried in
|
|
26
|
+
* `details`. The caught failure is never attached as `cause` and its message is
|
|
27
|
+
* never read, so a hostile page value cannot travel on the refusal.
|
|
28
|
+
*/
|
|
29
|
+
function hostReadFailed(failure) {
|
|
30
|
+
return new CapabilityError('The mobile renderer has no readable performance clock.', 'UNAVAILABLE', {
|
|
31
|
+
reason: 'host-unavailable',
|
|
32
|
+
retryable: false,
|
|
33
|
+
cause: failure,
|
|
34
|
+
details: { name: MobileFailureNameSchema.parse(failure.name) }
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/** The value-free refusal for a performance global that is simply absent or malformed. */
|
|
38
|
+
function hostUnavailable() {
|
|
39
|
+
return new CapabilityError('The mobile renderer has no readable performance clock.', 'UNAVAILABLE', {
|
|
40
|
+
reason: 'host-unavailable',
|
|
41
|
+
retryable: false
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The renderer's browser performance clock (`performance.now()`), captured once
|
|
46
|
+
* as a bound reader so kernel lifecycle readings can never drift to a different
|
|
47
|
+
* page clock. A web view whose `performance` global cannot be read is a broken
|
|
48
|
+
* page: refused `UNAVAILABLE / host-unavailable`, value-free — never `Date.now()`.
|
|
49
|
+
*/
|
|
50
|
+
export function readMobilePerformanceClock() {
|
|
51
|
+
const holder = parseMobileBoundary(MobilePerformanceHolderSchema, globalThis);
|
|
52
|
+
if (!holder.success)
|
|
53
|
+
throw hostUnavailable();
|
|
54
|
+
// The schema output is the page's own global object (identity-preserving
|
|
55
|
+
// `z.custom`), never a schema copy: Performance.now requires its original
|
|
56
|
+
// receiver, so the captured method is bound to it.
|
|
57
|
+
const { performance } = holder.data;
|
|
58
|
+
return performance.now.bind(performance);
|
|
59
|
+
}
|
|
60
|
+
/** The namespace the Tauri host injects: `vibes.mobile`, and nothing else. */
|
|
61
|
+
export function getGlobalMobileRuntimeNamespace() {
|
|
62
|
+
const host = MobileNamespaceGlobalSchema.safeParse(globalThis);
|
|
63
|
+
return host.success ? host.data.vibes.mobile : null;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The native namespace, once the host says it is installed. No polling and no
|
|
67
|
+
* timeout: the host marks the page at document start and fires the ready event
|
|
68
|
+
* after injection; a page without the marker has no mobile host
|
|
69
|
+
* (`host-unavailable`).
|
|
70
|
+
*/
|
|
71
|
+
export async function awaitMobileRuntimeNamespace() {
|
|
72
|
+
const immediate = getGlobalMobileRuntimeNamespace();
|
|
73
|
+
if (immediate)
|
|
74
|
+
return immediate;
|
|
75
|
+
const page = MobileMarkedPageSchema.safeParse(globalThis);
|
|
76
|
+
if (!page.success) {
|
|
77
|
+
throw new CapabilityError('This page has no mobile runtime host.', 'UNAVAILABLE', {
|
|
78
|
+
reason: 'host-unavailable',
|
|
79
|
+
retryable: false,
|
|
80
|
+
recoveryHint: 'Select the mobile environment only in builds the Tauri host serves.'
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
await new Promise((resolve) => page.data.addEventListener(NATIVE_HOST_READY_EVENT, () => resolve(), { once: true }));
|
|
84
|
+
const namespace = getGlobalMobileRuntimeNamespace();
|
|
85
|
+
if (!namespace) {
|
|
86
|
+
throw new CapabilityError('The mobile host signalled ready without installing vibes.mobile.', 'UNAVAILABLE', {
|
|
87
|
+
reason: 'host-unavailable',
|
|
88
|
+
retryable: false
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return namespace;
|
|
92
|
+
}
|
|
93
|
+
export async function readMobileHostFacts(namespace) {
|
|
94
|
+
return MobileHostFactsSchema.parse(await namespace.call('environment'));
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AACA,OAAO,EACN,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAEhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAwB,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EACN,2BAA2B,EAC3B,sBAAsB,EACtB,uBAAuB,EAEvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AACzE,cAAc,yBAAyB,CAAC;AACxC,OAAO,EACN,kBAAkB,EAClB,uBAAuB,EAEvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAEzE;;;;GAIG;AACH,SAAS,mBAAmB,CAC3B,MAAS,EAAE,KAAc;IAEzB,IAAI,CAAC;QACJ,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,cAAc,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC;AACF,CAAC;AAED;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,OAAyB;IAChD,OAAO,IAAI,eAAe,CAAC,wDAAwD,EAAE,aAAa,EAAE;QACnG,MAAM,EAAE,kBAAkB;QAC1B,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,EAAE,IAAI,EAAE,uBAAuB,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;KAC9D,CAAC,CAAC;AACJ,CAAC;AAED,0FAA0F;AAC1F,SAAS,eAAe;IACvB,OAAO,IAAI,eAAe,CAAC,wDAAwD,EAAE,aAAa,EAAE;QACnG,MAAM,EAAE,kBAAkB;QAC1B,SAAS,EAAE,KAAK;KAChB,CAAC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B;IACzC,MAAM,MAAM,GAAG,mBAAmB,CAAC,6BAA6B,EAAE,UAAU,CAAC,CAAC;IAC9E,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,MAAM,eAAe,EAAE,CAAC;IAC7C,yEAAyE;IACzE,0EAA0E;IAC1E,mDAAmD;IACnD,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC;IACpC,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAC1C,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,+BAA+B;IAC9C,MAAM,IAAI,GAAG,2BAA2B,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B;IAChD,MAAM,SAAS,GAAG,+BAA+B,EAAE,CAAC;IACpD,IAAI,SAAS;QAAE,OAAO,SAAS,CAAC;IAChC,MAAM,IAAI,GAAG,sBAAsB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC1D,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACnB,MAAM,IAAI,eAAe,CAAC,uCAAuC,EAAE,aAAa,EAAE;YACjF,MAAM,EAAE,kBAAkB;YAC1B,SAAS,EAAE,KAAK;YAChB,YAAY,EAAE,qEAAqE;SACnF,CAAC,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CACnC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CACpF,CAAC;IACF,MAAM,SAAS,GAAG,+BAA+B,EAAE,CAAC;IACpD,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,MAAM,IAAI,eAAe,CACxB,kEAAkE,EAClE,aAAa,EACb;YACC,MAAM,EAAE,kBAAkB;YAC1B,SAAS,EAAE,KAAK;SAChB,CACD,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACxC,SAAiC;IAEjC,OAAO,qBAAqB,CAAC,KAAK,CAAC,MAAM,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docs-only plugin for the mobile runtime environment.
|
|
3
|
+
*
|
|
4
|
+
* Registers the owner `docs/topic` for runtime docs discovery. It does not
|
|
5
|
+
* select or register the environment: that happens before bootstrap through
|
|
6
|
+
* `@vibesdotdev/host-mobile/plugin`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const runtimeEnvironmentMobileDocsPlugin: import("@vibesdotdev/kernel").RuntimePlugin;
|
|
9
|
+
export default runtimeEnvironmentMobileDocsPlugin;
|
|
10
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/docs/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,eAAO,MAAM,kCAAkC,6CAK7C,CAAC;AAEH,eAAe,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docs-only plugin for the mobile runtime environment.
|
|
3
|
+
*
|
|
4
|
+
* Registers the owner `docs/topic` for runtime docs discovery. It does not
|
|
5
|
+
* select or register the environment: that happens before bootstrap through
|
|
6
|
+
* `@vibesdotdev/host-mobile/plugin`.
|
|
7
|
+
*/
|
|
8
|
+
import { createRuntimePlugin } from '@vibesdotdev/kernel';
|
|
9
|
+
import runtimeEnvironmentMobileDocs from "./runtime-environment-mobile.docs.descriptor.js";
|
|
10
|
+
export const runtimeEnvironmentMobileDocsPlugin = createRuntimePlugin({
|
|
11
|
+
id: '@vibesdotdev/host-mobile/docs',
|
|
12
|
+
name: 'Mobile Runtime Environment Docs',
|
|
13
|
+
description: 'Documentation for the mobile web view runtime environment.',
|
|
14
|
+
descriptors: [runtimeEnvironmentMobileDocs]
|
|
15
|
+
});
|
|
16
|
+
export default runtimeEnvironmentMobileDocsPlugin;
|
|
17
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/docs/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,4BAA4B,MAAM,iDAAiD,CAAC;AAE3F,MAAM,CAAC,MAAM,kCAAkC,GAAG,mBAAmB,CAAC;IACrE,EAAE,EAAE,+BAA+B;IACnC,IAAI,EAAE,iCAAiC;IACvC,WAAW,EAAE,4DAA4D;IACzE,WAAW,EAAE,CAAC,4BAA4B,CAAC;CAC3C,CAAC,CAAC;AAEH,eAAe,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Owner-authored `docs/topic` for the mobile web view runtime environment. */
|
|
2
|
+
declare const descriptor: {
|
|
3
|
+
kind: "docs/topic";
|
|
4
|
+
id: string;
|
|
5
|
+
parent: string;
|
|
6
|
+
order: number;
|
|
7
|
+
title: string;
|
|
8
|
+
summary: string;
|
|
9
|
+
tags: string[];
|
|
10
|
+
surfaces: readonly ["cli", "web", "in-app"];
|
|
11
|
+
hardware: readonly ["consumer"];
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
body: {
|
|
14
|
+
type: "markdown";
|
|
15
|
+
sourceType: "raw";
|
|
16
|
+
source: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default descriptor;
|
|
20
|
+
//# sourceMappingURL=runtime-environment-mobile.docs.descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-environment-mobile.docs.descriptor.d.ts","sourceRoot":"","sources":["../../src/docs/runtime-environment-mobile.docs.descriptor.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAsH/E,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;CAgBf,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/** Owner-authored `docs/topic` for the mobile web view runtime environment. */
|
|
2
|
+
const source = `---
|
|
3
|
+
title: Mobile Runtime Environment
|
|
4
|
+
summary: Credential-dark runtime environment for a native-attested mobile web view
|
|
5
|
+
tags: [runtime, environment, mobile, tauri, browser]
|
|
6
|
+
parent: runtime
|
|
7
|
+
order: 7
|
|
8
|
+
id: runtime.environment.mobile
|
|
9
|
+
surfaces: [cli, web, in-app]
|
|
10
|
+
hardware: [consumer]
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Mobile Runtime Environment
|
|
14
|
+
|
|
15
|
+
\`@vibesdotdev/host-mobile\` registers a mobile web view (Tauri 2
|
|
16
|
+
on WKWebView or Android System WebView) as the local \`runtime/environment\`.
|
|
17
|
+
The native host attests renderer facts; this package parses them strictly and
|
|
18
|
+
turns them into runtime scope. No host token, secret key or private filesystem
|
|
19
|
+
path reaches the web view.
|
|
20
|
+
|
|
21
|
+
## Select it before bootstrap
|
|
22
|
+
|
|
23
|
+
\`\`\`ts
|
|
24
|
+
import { ensureBrowserRuntime } from '@vibesdotdev/surface-sveltekit/surface-browser';
|
|
25
|
+
import { createRuntimeEnvironmentMobilePlugin } from '@vibesdotdev/host-mobile/plugin';
|
|
26
|
+
|
|
27
|
+
await ensureBrowserRuntime({
|
|
28
|
+
environment: async () => createRuntimeEnvironmentMobilePlugin(),
|
|
29
|
+
plugins: [() => import('@vibesdotdev/kernel/client/plugin')]
|
|
30
|
+
});
|
|
31
|
+
\`\`\`
|
|
32
|
+
|
|
33
|
+
Registering it as an ordinary feature plugin after bootstrap is a bug: its facts
|
|
34
|
+
would not affect selection.
|
|
35
|
+
|
|
36
|
+
## Host contract
|
|
37
|
+
|
|
38
|
+
The plugin makes one call, \`call('environment')\`, on the \`namespace\`
|
|
39
|
+
option or else \`globalThis.vibes.mobile\`, which the Tauri host injects. The
|
|
40
|
+
host marks the page at document start (\`globalThis.__vibesNativeHost =
|
|
41
|
+
'mobile'\`) and fires \`vibes:runtime-host-ready\` after injecting, so the
|
|
42
|
+
plugin uses a namespace that is already installed at once and otherwise waits
|
|
43
|
+
for that event: no poll, no timer, and no fallback to \`vibes.runtime\` or the
|
|
44
|
+
Tauri \`invoke\` bridge. The reply crosses the host's JSON IPC.
|
|
45
|
+
|
|
46
|
+
| Fact | Type |
|
|
47
|
+
|---|---|
|
|
48
|
+
| \`protocol\` | \`{ major: 1, minor }\` |
|
|
49
|
+
| \`renderer\` | \`{ windowId, frameId, generation, origin }\` |
|
|
50
|
+
| \`lifecycle\` | \`{ phase: 'loading' \\| 'ready' \\| 'backgrounded' \\| 'closing', generation }\` |
|
|
51
|
+
| \`trustedOrigin\` | non-empty string |
|
|
52
|
+
| \`platform\` | \`'ios' \\| 'android' \\| 'unknown'\` |
|
|
53
|
+
| \`osVersion\` | non-empty string |
|
|
54
|
+
| \`appVersion\` | non-empty string |
|
|
55
|
+
| \`safeAreaInsets\` | optional \`{ top, bottom, left, right }\`, each non-negative |
|
|
56
|
+
| \`biometricsAvailable\` | boolean, defaults to \`false\` |
|
|
57
|
+
| \`environmentTier\` | \`'local' \\| 'dev' \\| 'staging' \\| 'production'\` |
|
|
58
|
+
| \`dev\` | boolean: the host runs a development build |
|
|
59
|
+
| \`channelReady\` | boolean |
|
|
60
|
+
| \`capabilities\` | up to 256 semantic runtime kind ids, never native command names |
|
|
61
|
+
|
|
62
|
+
Every object, including the nested ones, is strict: an unknown key such as
|
|
63
|
+
\`renderer.token\` fails the parse.
|
|
64
|
+
|
|
65
|
+
Options are strict: only \`namespace\` and \`workspace\` are supported.
|
|
66
|
+
A supplied \`workspace\` must contain only a nonblank string \`root\`; the
|
|
67
|
+
kernel schema trims it. Without a workspace the renderer remains unbound.
|
|
68
|
+
Unknown option, declaration, workspace, or nested host-fact fields are rejected.
|
|
69
|
+
Direct \`new MobileEnvironment(facts, declaration)\` from
|
|
70
|
+
\`@vibesdotdev/host-mobile/environment\` validates both inputs. Runtime consumers
|
|
71
|
+
resolve \`runtime.query('runtime/environment').withId('mobile').resolve()\`.
|
|
72
|
+
The canonical kernel tiers are \`local\`, \`dev\`, \`staging\`, and \`production\`.
|
|
73
|
+
|
|
74
|
+
## Resulting scope
|
|
75
|
+
|
|
76
|
+
- \`surface: 'browser'\`, \`hardware: 'consumer'\`, \`purpose: 'direct'\`,
|
|
77
|
+
\`lifecycle: 'persistent'\`
|
|
78
|
+
- \`hosting: { mode: 'local', owner: 'consumer', venue: 'user-device' }\`
|
|
79
|
+
- no credential capability: a web view has one actor (a single-principal
|
|
80
|
+
invocation store), so \`requestPrincipal()\` fails
|
|
81
|
+
\`principal-source-undeclared\`
|
|
82
|
+
- \`qualifiers\`: \`dev\`, \`os\` (the platform), \`environmentTier\`,
|
|
83
|
+
\`trustedOrigin\`, \`rendererGeneration\`
|
|
84
|
+
|
|
85
|
+
Device facts (\`osVersion\`, \`appVersion\`, \`safeAreaInsets\`,
|
|
86
|
+
\`biometricsAvailable\`) and the advertised capability ids stay on the
|
|
87
|
+
environment's \`facts\`; the declared scope's qualifier set is closed.
|
|
88
|
+
|
|
89
|
+
\`getEnv()\` always returns \`undefined\`, and there is no secret accessor: credentials resolve through \`runtime.resolveCredential\`, which answers \`no-store\` here.
|
|
90
|
+
|
|
91
|
+
## Host clock
|
|
92
|
+
|
|
93
|
+
The environment supplies the host monotonic clock the kernel's lifecycle
|
|
94
|
+
requires: live milliseconds from the renderer's browser performance clock
|
|
95
|
+
(\`performance.now()\`, captured once at construction so readings cannot drift
|
|
96
|
+
to another clock — never \`Date.now()\`). \`runtime.lifecycle.now()\` and
|
|
97
|
+
disposal's finalization budget read it; the kernel validates the readings and
|
|
98
|
+
owns the lifecycle refusals. A refusal for an unreadable clock is value-free: a
|
|
99
|
+
caught failure reports its fixed class-name category in \`details.name\` and its
|
|
100
|
+
message, stack and thrown value are never read.
|
|
101
|
+
|
|
102
|
+
## Failures
|
|
103
|
+
|
|
104
|
+
| Condition | Result | Remedy |
|
|
105
|
+
|---|---|---|
|
|
106
|
+
| the page carries no native host marker | \`CapabilityError\` \`UNAVAILABLE\` \`host-unavailable\`, at once | Run inside the mobile host, or pass \`namespace\` |
|
|
107
|
+
| the ready event fires without \`vibes.mobile\` | \`UNAVAILABLE\` \`host-unavailable\` | Fix the Tauri host's injection order |
|
|
108
|
+
| the facts fail the strict parse | the zod error propagates; nothing registers | Fix the host's \`environment\` payload; remove any key not in the table above |
|
|
109
|
+
| the page's \`performance\` global is missing, non-callable or unreadable | \`UNAVAILABLE\` \`host-unavailable\` at construction, value-free | Serve the page in a web view with its own performance clock |
|
|
110
|
+
|
|
111
|
+
## Path mechanics
|
|
112
|
+
|
|
113
|
+
This environment deliberately does not implement \`paths/runtime-path\`. A web
|
|
114
|
+
view has no host filesystem authority, and that contract exposes \`homedir()\`
|
|
115
|
+
and \`tmpdir()\`.
|
|
116
|
+
`;
|
|
117
|
+
const descriptor = {
|
|
118
|
+
kind: 'docs/topic',
|
|
119
|
+
id: 'runtime.environment.mobile',
|
|
120
|
+
parent: 'runtime',
|
|
121
|
+
order: 7,
|
|
122
|
+
title: 'Mobile Runtime Environment',
|
|
123
|
+
summary: 'Credential-dark runtime environment for a native-attested mobile web view',
|
|
124
|
+
tags: ['runtime', 'environment', 'mobile', 'tauri', 'browser'],
|
|
125
|
+
surfaces: ['cli', 'web', 'in-app'],
|
|
126
|
+
hardware: ['consumer'],
|
|
127
|
+
enabled: true,
|
|
128
|
+
body: {
|
|
129
|
+
type: 'markdown',
|
|
130
|
+
sourceType: 'raw',
|
|
131
|
+
source
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
export default descriptor;
|
|
135
|
+
//# sourceMappingURL=runtime-environment-mobile.docs.descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-environment-mobile.docs.descriptor.js","sourceRoot":"","sources":["../../src/docs/runtime-environment-mobile.docs.descriptor.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkHd,CAAC;AAEF,MAAM,UAAU,GAAG;IAClB,IAAI,EAAE,YAAqB;IAC3B,EAAE,EAAE,4BAA4B;IAChC,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,4BAA4B;IACnC,OAAO,EAAE,2EAA2E;IACpF,IAAI,EAAE,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;IAC9D,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAU;IAC3C,QAAQ,EAAE,CAAC,UAAU,CAAU;IAC/B,OAAO,EAAE,IAAI;IACb,IAAI,EAAE;QACL,IAAI,EAAE,UAAmB;QACzB,UAAU,EAAE,KAAc;QAC1B,MAAM;KACN;CACD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { MobileHostLifecycleSchema, MobileSafeAreaInsetsSchema, MobileHostFactsSchema, type MobileHostLifecycle, type MobileSafeAreaInsets, type MobileHostFacts, type MobileRuntimeNamespace, getGlobalMobileRuntimeNamespace, awaitMobileRuntimeNamespace, readMobilePerformanceClock, NATIVE_HOST_MARKER, NATIVE_HOST_READY_EVENT, readMobileHostFacts } from './contracts.ts';
|
|
2
|
+
export type { MobileEnvironmentDeclaration } from './schemas/declaration.ts';
|
|
3
|
+
export { createRuntimeEnvironmentMobilePlugin, runtimeEnvironmentMobilePlugin, type RuntimeEnvironmentMobilePluginOptions } from './runtime-environment-mobile.plugin.ts';
|
|
4
|
+
export { default } from './runtime-environment-mobile.plugin.ts';
|
|
5
|
+
export { MobileEnvironmentDeclarationSchema, MobileWorkspaceSchema } from './schemas/declaration.ts';
|
|
6
|
+
export { RuntimeEnvironmentMobilePluginOptionsSchema } from './schemas/options.ts';
|
|
7
|
+
export { MobileRuntimeNamespaceSchema } from './schemas/namespace.ts';
|
|
8
|
+
export { MobilePerformanceHolderSchema } from './schemas/performance.ts';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,yBAAyB,EACzB,0BAA0B,EAC1B,qBAAqB,EACrB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,+BAA+B,EAC/B,2BAA2B,EAC3B,0BAA0B,EAC1B,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EACN,oCAAoC,EACpC,8BAA8B,EAC9B,KAAK,qCAAqC,EAC1C,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AAEjE,OAAO,EACN,kCAAkC,EAClC,qBAAqB,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,2CAA2C,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { MobileHostLifecycleSchema, MobileSafeAreaInsetsSchema, MobileHostFactsSchema, getGlobalMobileRuntimeNamespace, awaitMobileRuntimeNamespace, readMobilePerformanceClock, NATIVE_HOST_MARKER, NATIVE_HOST_READY_EVENT, readMobileHostFacts } from "./contracts.js";
|
|
2
|
+
export { createRuntimeEnvironmentMobilePlugin, runtimeEnvironmentMobilePlugin } from "./runtime-environment-mobile.plugin.js";
|
|
3
|
+
export { default } from "./runtime-environment-mobile.plugin.js";
|
|
4
|
+
export { MobileEnvironmentDeclarationSchema, MobileWorkspaceSchema } from "./schemas/declaration.js";
|
|
5
|
+
export { RuntimeEnvironmentMobilePluginOptionsSchema } from "./schemas/options.js";
|
|
6
|
+
export { MobileRuntimeNamespaceSchema } from "./schemas/namespace.js";
|
|
7
|
+
export { MobilePerformanceHolderSchema } from "./schemas/performance.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,yBAAyB,EACzB,0BAA0B,EAC1B,qBAAqB,EAKrB,+BAA+B,EAC/B,2BAA2B,EAC3B,0BAA0B,EAC1B,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACN,oCAAoC,EACpC,8BAA8B,EAE9B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AAEjE,OAAO,EACN,kCAAkC,EAClC,qBAAqB,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,2CAA2C,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Mobile web view implementation of the runtime/environment contract. */
|
|
2
|
+
import { type EnvironmentIdentity, type RuntimeEnvironmentImplementation, type RuntimeInvocationStore, type RuntimeLoaderImplementation, type RuntimeScope } from '@vibesdotdev/kernel';
|
|
3
|
+
import type { JsonValue } from '@vibesdotdev/kernel/schemas/json';
|
|
4
|
+
import { type MobileHostFacts } from './schemas/host-facts.ts';
|
|
5
|
+
import { type MobileEnvironmentDeclaration } from './schemas/declaration.ts';
|
|
6
|
+
export type { MobileEnvironmentDeclaration } from './schemas/declaration.ts';
|
|
7
|
+
export declare class MobileEnvironment implements RuntimeEnvironmentImplementation {
|
|
8
|
+
readonly id = "mobile";
|
|
9
|
+
readonly description = "Mobile webview renderer environment";
|
|
10
|
+
readonly identity: EnvironmentIdentity;
|
|
11
|
+
readonly scope: RuntimeScope;
|
|
12
|
+
readonly loader: RuntimeLoaderImplementation;
|
|
13
|
+
readonly facts: MobileHostFacts;
|
|
14
|
+
/**
|
|
15
|
+
* The renderer's browser performance clock (`performance.now()`), captured
|
|
16
|
+
* once at construction so the value the kernel reads can never drift to a
|
|
17
|
+
* different page clock. Its readings are monotonic, nonnegative milliseconds
|
|
18
|
+
* since the renderer's time origin — never `Date.now()`.
|
|
19
|
+
*/
|
|
20
|
+
private readonly readPerformanceMs;
|
|
21
|
+
/**
|
|
22
|
+
* `declaration.workspace` is the virtual root the app entry declared for
|
|
23
|
+
* this renderer; the environment declares it in its scope and invents none.
|
|
24
|
+
*/
|
|
25
|
+
constructor(facts: MobileHostFacts | JsonValue, declaration?: MobileEnvironmentDeclaration);
|
|
26
|
+
createInvocationStore(): RuntimeInvocationStore;
|
|
27
|
+
getEnv(_key: string): undefined;
|
|
28
|
+
getPlatform(): string;
|
|
29
|
+
/**
|
|
30
|
+
* Live monotonic milliseconds from the renderer's browser performance clock,
|
|
31
|
+
* for the kernel's lifecycle (`runtime.lifecycle.now()`): finite, nonnegative
|
|
32
|
+
* and nondecreasing, per the `RuntimeEnvironmentImplementation` contract. The
|
|
33
|
+
* kernel validates the value; this host only reads its renderer clock.
|
|
34
|
+
*/
|
|
35
|
+
monotonicNow(): number;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=mobile-environment.impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mobile-environment.impl.d.ts","sourceRoot":"","sources":["../src/mobile-environment.impl.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAE1E,OAAO,EAKN,KAAK,mBAAmB,EACxB,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,YAAY,EACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAGlE,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAEN,KAAK,4BAA4B,EACjC,MAAM,0BAA0B,CAAC;AAElC,YAAY,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAU7E,qBAAa,iBAAkB,YAAW,gCAAgC;IACzE,QAAQ,CAAC,EAAE,YAAY;IACvB,QAAQ,CAAC,WAAW,yCAAyC;IAC7D,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAKpC;IACF,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,MAAM,8BAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAEhC;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAe;IAEjD;;;OAGG;gBACS,KAAK,EAAE,eAAe,GAAG,SAAS,EAAE,WAAW,CAAC,EAAE,4BAA4B;IAyC1F,qBAAqB,IAAI,sBAAsB;IAI/C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS;IAI/B,WAAW,IAAI,MAAM;IAIrB;;;;;OAKG;IACH,YAAY,IAAI,MAAM;CAGtB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/** Mobile web view implementation of the runtime/environment contract. */
|
|
2
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
3
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
4
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
5
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
return path;
|
|
9
|
+
};
|
|
10
|
+
import { createSinglePrincipalInvocationStore, declareRuntimeScope, registerRuntimeEnvironment } from '@vibesdotdev/kernel';
|
|
11
|
+
import { readMobilePerformanceClock } from "./contracts.js";
|
|
12
|
+
import { MobileHostFactsSchema } from "./schemas/host-facts.js";
|
|
13
|
+
import { MobileEnvironmentDeclarationSchema } from "./schemas/declaration.js";
|
|
14
|
+
/** A renderer imports what its bundle ships; it has no filesystem to discover (rc02-rc03 §2.5). */
|
|
15
|
+
const importLoader = {
|
|
16
|
+
importModule: (specifier) => import(__rewriteRelativeImportExtension(/* @vite-ignore */ specifier))
|
|
17
|
+
};
|
|
18
|
+
// Only this module can certify a declaration parsed by the plugin factory.
|
|
19
|
+
const validatedDeclaration = Symbol('validated-mobile-declaration');
|
|
20
|
+
export class MobileEnvironment {
|
|
21
|
+
id = 'mobile';
|
|
22
|
+
description = 'Mobile webview renderer environment';
|
|
23
|
+
identity = {
|
|
24
|
+
esm: true,
|
|
25
|
+
typescript: false,
|
|
26
|
+
nativeLoader: false,
|
|
27
|
+
substrate: 'browser'
|
|
28
|
+
};
|
|
29
|
+
scope;
|
|
30
|
+
loader = importLoader;
|
|
31
|
+
facts;
|
|
32
|
+
/**
|
|
33
|
+
* The renderer's browser performance clock (`performance.now()`), captured
|
|
34
|
+
* once at construction so the value the kernel reads can never drift to a
|
|
35
|
+
* different page clock. Its readings are monotonic, nonnegative milliseconds
|
|
36
|
+
* since the renderer's time origin — never `Date.now()`.
|
|
37
|
+
*/
|
|
38
|
+
readPerformanceMs;
|
|
39
|
+
constructor(facts, declaration = {}, validation) {
|
|
40
|
+
this.facts = MobileHostFactsSchema.parse(facts);
|
|
41
|
+
const declared = validation === validatedDeclaration
|
|
42
|
+
? declaration
|
|
43
|
+
: MobileEnvironmentDeclarationSchema.parse(declaration);
|
|
44
|
+
// A renderer declares no credential capability: identity is the host's
|
|
45
|
+
// one actor (single-principal store). Device facts (OS version, app
|
|
46
|
+
// version, biometrics, native capability ids) stay on `facts`.
|
|
47
|
+
const scope = {
|
|
48
|
+
surface: 'browser',
|
|
49
|
+
hardware: 'consumer',
|
|
50
|
+
purpose: 'direct',
|
|
51
|
+
lifecycle: 'persistent',
|
|
52
|
+
hosting: { mode: 'local', owner: 'consumer', venue: 'user-device' },
|
|
53
|
+
qualifiers: {
|
|
54
|
+
dev: this.facts.dev,
|
|
55
|
+
os: this.facts.platform,
|
|
56
|
+
environmentTier: this.facts.environmentTier,
|
|
57
|
+
trustedOrigin: this.facts.trustedOrigin,
|
|
58
|
+
rendererGeneration: this.facts.renderer.generation
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
if (declared.workspace)
|
|
62
|
+
scope.workspace = declared.workspace;
|
|
63
|
+
this.scope = declareRuntimeScope(scope, 'host-mobile');
|
|
64
|
+
// The renderer clock is captured last: an unreadable performance global
|
|
65
|
+
// refuses here, before the environment could ever be registered.
|
|
66
|
+
this.readPerformanceMs = readMobilePerformanceClock();
|
|
67
|
+
}
|
|
68
|
+
createInvocationStore() {
|
|
69
|
+
return createSinglePrincipalInvocationStore();
|
|
70
|
+
}
|
|
71
|
+
getEnv(_key) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
getPlatform() {
|
|
75
|
+
return this.facts.platform;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Live monotonic milliseconds from the renderer's browser performance clock,
|
|
79
|
+
* for the kernel's lifecycle (`runtime.lifecycle.now()`): finite, nonnegative
|
|
80
|
+
* and nondecreasing, per the `RuntimeEnvironmentImplementation` contract. The
|
|
81
|
+
* kernel validates the value; this host only reads its renderer clock.
|
|
82
|
+
*/
|
|
83
|
+
monotonicNow() {
|
|
84
|
+
return this.readPerformanceMs();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** @internal Called only with the plugin factory's parsed declaration. */
|
|
88
|
+
export async function registerMobileEnvironment(runtime, namespace, declaration) {
|
|
89
|
+
registerRuntimeEnvironment(runtime, new MobileEnvironment(await namespace.call('environment'), declaration, validatedDeclaration));
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=mobile-environment.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mobile-environment.impl.js","sourceRoot":"","sources":["../src/mobile-environment.impl.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Registers the native-attested mobile web view as the local runtime environment. */
|
|
2
|
+
import { type RuntimeEnvironmentMobilePluginOptions } from './schemas/options.ts';
|
|
3
|
+
export type { RuntimeEnvironmentMobilePluginOptions } from './schemas/options.ts';
|
|
4
|
+
export declare function createRuntimeEnvironmentMobilePlugin(options?: RuntimeEnvironmentMobilePluginOptions): import("@vibesdotdev/kernel").RuntimePlugin;
|
|
5
|
+
export declare const runtimeEnvironmentMobilePlugin: import("@vibesdotdev/kernel").RuntimePlugin;
|
|
6
|
+
export default runtimeEnvironmentMobilePlugin;
|
|
7
|
+
//# sourceMappingURL=runtime-environment-mobile.plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-environment-mobile.plugin.d.ts","sourceRoot":"","sources":["../src/runtime-environment-mobile.plugin.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAItF,OAAO,EAEN,KAAK,qCAAqC,EAC1C,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,qCAAqC,EAAE,MAAM,sBAAsB,CAAC;AAElF,wBAAgB,oCAAoC,CACnD,OAAO,GAAE,qCAA0C,+CAenD;AAED,eAAO,MAAM,8BAA8B,6CAAyC,CAAC;AACrF,eAAe,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Registers the native-attested mobile web view as the local runtime environment. */
|
|
2
|
+
import { createRuntimePlugin, environmentKind } from '@vibesdotdev/kernel';
|
|
3
|
+
import { awaitMobileRuntimeNamespace } from "./contracts.js";
|
|
4
|
+
import { RuntimeEnvironmentMobilePluginOptionsSchema } from "./schemas/options.js";
|
|
5
|
+
export function createRuntimeEnvironmentMobilePlugin(options = {}) {
|
|
6
|
+
const { namespace: injectedNamespace, ...declaration } = RuntimeEnvironmentMobilePluginOptionsSchema.parse(options);
|
|
7
|
+
return createRuntimePlugin({
|
|
8
|
+
id: 'runtime-environment-mobile',
|
|
9
|
+
name: 'Runtime Environment — Mobile',
|
|
10
|
+
description: 'Credential-dark mobile webview renderer identity and lifecycle facts.',
|
|
11
|
+
kinds: [environmentKind],
|
|
12
|
+
async onRegister(runtime) {
|
|
13
|
+
const namespace = injectedNamespace ?? (await awaitMobileRuntimeNamespace());
|
|
14
|
+
const { registerMobileEnvironment } = await import("./mobile-environment.impl.js");
|
|
15
|
+
await registerMobileEnvironment(runtime, namespace, declaration);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export const runtimeEnvironmentMobilePlugin = createRuntimeEnvironmentMobilePlugin();
|
|
20
|
+
export default runtimeEnvironmentMobilePlugin;
|
|
21
|
+
//# sourceMappingURL=runtime-environment-mobile.plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-environment-mobile.plugin.js","sourceRoot":"","sources":["../src/runtime-environment-mobile.plugin.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EACN,2CAA2C,EAE3C,MAAM,sBAAsB,CAAC;AAG9B,MAAM,UAAU,oCAAoC,CACnD,UAAiD,EAAE;IAEnD,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,WAAW,EAAE,GACrD,2CAA2C,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5D,OAAO,mBAAmB,CAAC;QAC1B,EAAE,EAAE,4BAA4B;QAChC,IAAI,EAAE,8BAA8B;QACpC,WAAW,EAAE,uEAAuE;QACpF,KAAK,EAAE,CAAC,eAAe,CAAC;QACxB,KAAK,CAAC,UAAU,CAAC,OAAO;YACvB,MAAM,SAAS,GAAG,iBAAiB,IAAI,CAAC,MAAM,2BAA2B,EAAE,CAAC,CAAC;YAC7E,MAAM,EAAE,yBAAyB,EAAE,GAAG,MAAM,MAAM,CAAC,8BAA8B,CAAC,CAAC;YACnF,MAAM,yBAAyB,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;QAClE,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,8BAA8B,GAAG,oCAAoC,EAAE,CAAC;AACrF,eAAe,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
export declare const MobileWorkspaceSchema: z.ZodObject<{
|
|
3
|
+
root: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
|
|
4
|
+
}, z.core.$strict>;
|
|
5
|
+
export declare const MobileEnvironmentDeclarationSchema: z.ZodObject<{
|
|
6
|
+
workspace: z.ZodOptional<z.ZodObject<{
|
|
7
|
+
root: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
|
|
8
|
+
}, z.core.$strict>>;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
export type MobileEnvironmentDeclaration = z.infer<typeof MobileEnvironmentDeclarationSchema>;
|
|
11
|
+
//# sourceMappingURL=declaration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../src/schemas/declaration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,eAAO,MAAM,qBAAqB;;kBAA0D,CAAC;AAC7F,eAAO,MAAM,kCAAkC;;;;kBAE7C,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import { DeclaredWorkspaceSchema } from '@vibesdotdev/kernel/schemas/scope';
|
|
3
|
+
export const MobileWorkspaceSchema = DeclaredWorkspaceSchema.pick({ root: true }).required();
|
|
4
|
+
export const MobileEnvironmentDeclarationSchema = z.strictObject({
|
|
5
|
+
workspace: MobileWorkspaceSchema.optional()
|
|
6
|
+
});
|
|
7
|
+
//# sourceMappingURL=declaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declaration.js","sourceRoot":"","sources":["../../src/schemas/declaration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC7F,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,YAAY,CAAC;IAChE,SAAS,EAAE,qBAAqB,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
/**
|
|
3
|
+
* Fixed public failure categories: even a forged Error subclass name can carry
|
|
4
|
+
* an input value, so a caught failure is reported only through one of these.
|
|
5
|
+
*/
|
|
6
|
+
export declare const MobileFailureNameSchema: z.ZodCatch<z.ZodEnum<{
|
|
7
|
+
Error: "Error";
|
|
8
|
+
NonErrorThrown: "NonErrorThrown";
|
|
9
|
+
UnreadableFailure: "UnreadableFailure";
|
|
10
|
+
CapabilityError: "CapabilityError";
|
|
11
|
+
TypeError: "TypeError";
|
|
12
|
+
RangeError: "RangeError";
|
|
13
|
+
SyntaxError: "SyntaxError";
|
|
14
|
+
ReferenceError: "ReferenceError";
|
|
15
|
+
URIError: "URIError";
|
|
16
|
+
EvalError: "EvalError";
|
|
17
|
+
AggregateError: "AggregateError";
|
|
18
|
+
ZodError: "ZodError";
|
|
19
|
+
}>>;
|
|
20
|
+
//# sourceMappingURL=failure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failure.d.ts","sourceRoot":"","sources":["../../src/schemas/failure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;GAGnB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
/**
|
|
3
|
+
* Fixed public failure categories: even a forged Error subclass name can carry
|
|
4
|
+
* an input value, so a caught failure is reported only through one of these.
|
|
5
|
+
*/
|
|
6
|
+
export const MobileFailureNameSchema = z.enum([
|
|
7
|
+
'Error', 'TypeError', 'RangeError', 'SyntaxError', 'ReferenceError', 'URIError',
|
|
8
|
+
'EvalError', 'AggregateError', 'CapabilityError', 'ZodError', 'UnreadableFailure', 'NonErrorThrown'
|
|
9
|
+
]).catch('Error');
|
|
10
|
+
//# sourceMappingURL=failure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failure.js","sourceRoot":"","sources":["../../src/schemas/failure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC7C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,UAAU;IAC/E,WAAW,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAE,gBAAgB;CACnG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
export declare const MobileHostLifecycleSchema: z.ZodObject<{
|
|
3
|
+
phase: z.ZodEnum<{
|
|
4
|
+
ready: "ready";
|
|
5
|
+
loading: "loading";
|
|
6
|
+
backgrounded: "backgrounded";
|
|
7
|
+
closing: "closing";
|
|
8
|
+
}>;
|
|
9
|
+
generation: z.ZodNumber;
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
export declare const MobileSafeAreaInsetsSchema: z.ZodObject<{
|
|
12
|
+
top: z.ZodNumber;
|
|
13
|
+
bottom: z.ZodNumber;
|
|
14
|
+
left: z.ZodNumber;
|
|
15
|
+
right: z.ZodNumber;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
export declare const MobileHostFactsSchema: z.ZodObject<{
|
|
18
|
+
protocol: z.ZodObject<{
|
|
19
|
+
major: z.ZodLiteral<1>;
|
|
20
|
+
minor: z.ZodNumber;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
renderer: z.ZodObject<{
|
|
23
|
+
windowId: z.ZodString;
|
|
24
|
+
frameId: z.ZodString;
|
|
25
|
+
generation: z.ZodNumber;
|
|
26
|
+
origin: z.ZodString;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
lifecycle: z.ZodObject<{
|
|
29
|
+
phase: z.ZodEnum<{
|
|
30
|
+
ready: "ready";
|
|
31
|
+
loading: "loading";
|
|
32
|
+
backgrounded: "backgrounded";
|
|
33
|
+
closing: "closing";
|
|
34
|
+
}>;
|
|
35
|
+
generation: z.ZodNumber;
|
|
36
|
+
}, z.core.$strict>;
|
|
37
|
+
trustedOrigin: z.ZodString;
|
|
38
|
+
platform: z.ZodEnum<{
|
|
39
|
+
unknown: "unknown";
|
|
40
|
+
ios: "ios";
|
|
41
|
+
android: "android";
|
|
42
|
+
}>;
|
|
43
|
+
osVersion: z.ZodString;
|
|
44
|
+
appVersion: z.ZodString;
|
|
45
|
+
safeAreaInsets: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
top: z.ZodNumber;
|
|
47
|
+
bottom: z.ZodNumber;
|
|
48
|
+
left: z.ZodNumber;
|
|
49
|
+
right: z.ZodNumber;
|
|
50
|
+
}, z.core.$strict>>;
|
|
51
|
+
biometricsAvailable: z.ZodDefault<z.ZodBoolean>;
|
|
52
|
+
environmentTier: z.ZodEnum<{
|
|
53
|
+
local: "local";
|
|
54
|
+
dev: "dev";
|
|
55
|
+
staging: "staging";
|
|
56
|
+
production: "production";
|
|
57
|
+
}>;
|
|
58
|
+
dev: z.ZodBoolean;
|
|
59
|
+
channelReady: z.ZodBoolean;
|
|
60
|
+
capabilities: z.ZodArray<z.ZodString>;
|
|
61
|
+
}, z.core.$strict>;
|
|
62
|
+
export type MobileHostLifecycle = z.infer<typeof MobileHostLifecycleSchema>;
|
|
63
|
+
export type MobileSafeAreaInsets = z.infer<typeof MobileSafeAreaInsetsSchema>;
|
|
64
|
+
export type MobileHostFacts = z.infer<typeof MobileHostFactsSchema>;
|
|
65
|
+
//# sourceMappingURL=host-facts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-facts.d.ts","sourceRoot":"","sources":["../../src/schemas/host-facts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAgB5B,eAAO,MAAM,yBAAyB;;;;;;;;kBAGpC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;kBAKrC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAiBhC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import { RuntimeProtocolVersionSchema, RuntimeRendererIdentitySchema } from '@vibesdotdev/kernel/federation';
|
|
3
|
+
import { EnvironmentTierSchema } from '@vibesdotdev/kernel/schemas/scope';
|
|
4
|
+
/*
|
|
5
|
+
* Runtime's shared federation schemas are non-strict because other consumers
|
|
6
|
+
* parse them too. This package owns the strict parse of host facts, so nested
|
|
7
|
+
* endpoint- or credential-shaped keys fail closed here instead of being
|
|
8
|
+
* silently stripped.
|
|
9
|
+
*/
|
|
10
|
+
const StrictProtocolVersionSchema = z.strictObject(RuntimeProtocolVersionSchema.shape);
|
|
11
|
+
const StrictRendererIdentitySchema = z.strictObject(RuntimeRendererIdentitySchema.shape);
|
|
12
|
+
export const MobileHostLifecycleSchema = z.strictObject({
|
|
13
|
+
phase: z.enum(['loading', 'ready', 'backgrounded', 'closing']),
|
|
14
|
+
generation: z.number().int().positive()
|
|
15
|
+
});
|
|
16
|
+
export const MobileSafeAreaInsetsSchema = z.strictObject({
|
|
17
|
+
top: z.number().nonnegative(),
|
|
18
|
+
bottom: z.number().nonnegative(),
|
|
19
|
+
left: z.number().nonnegative(),
|
|
20
|
+
right: z.number().nonnegative()
|
|
21
|
+
});
|
|
22
|
+
export const MobileHostFactsSchema = z.strictObject({
|
|
23
|
+
protocol: StrictProtocolVersionSchema,
|
|
24
|
+
renderer: StrictRendererIdentitySchema,
|
|
25
|
+
lifecycle: MobileHostLifecycleSchema,
|
|
26
|
+
trustedOrigin: z.string().min(1),
|
|
27
|
+
platform: z.enum(['ios', 'android', 'unknown']),
|
|
28
|
+
osVersion: z.string().min(1),
|
|
29
|
+
appVersion: z.string().min(1),
|
|
30
|
+
safeAreaInsets: MobileSafeAreaInsetsSchema.optional(),
|
|
31
|
+
biometricsAvailable: z.boolean().default(false),
|
|
32
|
+
/** Non-secret deployment selection attested by the native runtime host. */
|
|
33
|
+
environmentTier: EnvironmentTierSchema,
|
|
34
|
+
/** Whether the native host runs a development build. */
|
|
35
|
+
dev: z.boolean(),
|
|
36
|
+
channelReady: z.boolean(),
|
|
37
|
+
/** Semantic runtime kind/capability ids only; never native IPC command names. */
|
|
38
|
+
capabilities: z.array(z.string().min(1)).max(256)
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=host-facts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-facts.js","sourceRoot":"","sources":["../../src/schemas/host-facts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EACN,4BAA4B,EAC5B,6BAA6B,EAC7B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E;;;;;GAKG;AACH,MAAM,2BAA2B,GAAG,CAAC,CAAC,YAAY,CAAC,4BAA4B,CAAC,KAAK,CAAC,CAAC;AACvF,MAAM,4BAA4B,GAAG,CAAC,CAAC,YAAY,CAAC,6BAA6B,CAAC,KAAK,CAAC,CAAC;AAEzF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,YAAY,CAAC;IACvD,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IAC9D,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,YAAY,CAAC;IACxD,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE;IAC7B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE;IAChC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,YAAY,CAAC;IACnD,QAAQ,EAAE,2BAA2B;IACrC,QAAQ,EAAE,4BAA4B;IACtC,SAAS,EAAE,yBAAyB;IACpC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAC/C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,cAAc,EAAE,0BAA0B,CAAC,QAAQ,EAAE;IACrD,mBAAmB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAC/C,2EAA2E;IAC3E,eAAe,EAAE,qBAAqB;IACtC,wDAAwD;IACxD,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE;IAChB,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE;IACzB,iFAAiF;IACjF,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CACjD,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
/** Keep the native object, including its prototype and method receiver. */
|
|
3
|
+
export declare const MobileRuntimeNamespaceSchema: z.ZodCustom<{
|
|
4
|
+
call: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [z.ZodLiteral<"environment">], null>, z.ZodPromise<z.ZodType<import("@vibesdotdev/kernel/bootstrap").JsonValue, import("@vibesdotdev/kernel/bootstrap").JsonValue, z.core.$ZodTypeInternals<import("@vibesdotdev/kernel/bootstrap").JsonValue, import("@vibesdotdev/kernel/bootstrap").JsonValue>>>>;
|
|
5
|
+
}, {
|
|
6
|
+
call: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [z.ZodLiteral<"environment">], null>, z.ZodPromise<z.ZodType<import("@vibesdotdev/kernel/bootstrap").JsonValue, import("@vibesdotdev/kernel/bootstrap").JsonValue, z.core.$ZodTypeInternals<import("@vibesdotdev/kernel/bootstrap").JsonValue, import("@vibesdotdev/kernel/bootstrap").JsonValue>>>>;
|
|
7
|
+
}>;
|
|
8
|
+
export type MobileRuntimeNamespace = z.infer<typeof MobileRuntimeNamespaceSchema>;
|
|
9
|
+
/** Set synchronously by the native host at document start. */
|
|
10
|
+
export declare const NATIVE_HOST_MARKER = "__vibesNativeHost";
|
|
11
|
+
export declare const NATIVE_HOST_READY_EVENT = "vibes:runtime-host-ready";
|
|
12
|
+
export declare const MobileNamespaceGlobalSchema: z.ZodObject<{
|
|
13
|
+
vibes: z.ZodObject<{
|
|
14
|
+
mobile: z.ZodCustom<{
|
|
15
|
+
call: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [z.ZodLiteral<"environment">], null>, z.ZodPromise<z.ZodType<import("@vibesdotdev/kernel/bootstrap").JsonValue, import("@vibesdotdev/kernel/bootstrap").JsonValue, z.core.$ZodTypeInternals<import("@vibesdotdev/kernel/bootstrap").JsonValue, import("@vibesdotdev/kernel/bootstrap").JsonValue>>>>;
|
|
16
|
+
}, {
|
|
17
|
+
call: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [z.ZodLiteral<"environment">], null>, z.ZodPromise<z.ZodType<import("@vibesdotdev/kernel/bootstrap").JsonValue, import("@vibesdotdev/kernel/bootstrap").JsonValue, z.core.$ZodTypeInternals<import("@vibesdotdev/kernel/bootstrap").JsonValue, import("@vibesdotdev/kernel/bootstrap").JsonValue>>>>;
|
|
18
|
+
}>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
/** Keep the page so addEventListener keeps its native receiver. */
|
|
22
|
+
export declare const MobileMarkedPageSchema: z.ZodCustom<{
|
|
23
|
+
__vibesNativeHost: "mobile";
|
|
24
|
+
addEventListener: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [z.ZodLiteral<"vibes:runtime-host-ready">, z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodVoid>, z.ZodObject<{
|
|
25
|
+
once: z.ZodLiteral<true>;
|
|
26
|
+
}, z.core.$strip>], null>, z.ZodVoid>;
|
|
27
|
+
}, {
|
|
28
|
+
__vibesNativeHost: "mobile";
|
|
29
|
+
addEventListener: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [z.ZodLiteral<"vibes:runtime-host-ready">, z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodVoid>, z.ZodObject<{
|
|
30
|
+
once: z.ZodLiteral<true>;
|
|
31
|
+
}, z.core.$strip>], null>, z.ZodVoid>;
|
|
32
|
+
}>;
|
|
33
|
+
//# sourceMappingURL=namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../src/schemas/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAO5B,2EAA2E;AAC3E,eAAO,MAAM,4BAA4B;;;;EAExC,CAAC;AACF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,8DAA8D;AAC9D,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AACtD,eAAO,MAAM,uBAAuB,6BAA6B,CAAC;AAElE,eAAO,MAAM,2BAA2B;;;;;;;;iBAEtC,CAAC;AAcH,mEAAmE;AACnE,eAAO,MAAM,sBAAsB;;;;;;;;;;EAElC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import { JsonValueSchema } from '@vibesdotdev/kernel/schemas/json';
|
|
3
|
+
const NamespaceContractSchema = z.object({
|
|
4
|
+
call: z.function({ input: [z.literal('environment')], output: z.promise(JsonValueSchema) })
|
|
5
|
+
});
|
|
6
|
+
/** Keep the native object, including its prototype and method receiver. */
|
|
7
|
+
export const MobileRuntimeNamespaceSchema = z.custom((value) => NamespaceContractSchema.safeParse(value).success);
|
|
8
|
+
/** Set synchronously by the native host at document start. */
|
|
9
|
+
export const NATIVE_HOST_MARKER = '__vibesNativeHost';
|
|
10
|
+
export const NATIVE_HOST_READY_EVENT = 'vibes:runtime-host-ready';
|
|
11
|
+
export const MobileNamespaceGlobalSchema = z.object({
|
|
12
|
+
vibes: z.object({ mobile: MobileRuntimeNamespaceSchema })
|
|
13
|
+
});
|
|
14
|
+
const MarkedPageContractSchema = z.object({
|
|
15
|
+
[NATIVE_HOST_MARKER]: z.literal('mobile'),
|
|
16
|
+
addEventListener: z.function({
|
|
17
|
+
input: [
|
|
18
|
+
z.literal(NATIVE_HOST_READY_EVENT),
|
|
19
|
+
z.function({ input: [], output: z.void() }),
|
|
20
|
+
z.object({ once: z.literal(true) })
|
|
21
|
+
],
|
|
22
|
+
output: z.void()
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
/** Keep the page so addEventListener keeps its native receiver. */
|
|
26
|
+
export const MobileMarkedPageSchema = z.custom((value) => MarkedPageContractSchema.safeParse(value).success);
|
|
27
|
+
//# sourceMappingURL=namespace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../src/schemas/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;CAC3F,CAAC,CAAC;AAEH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CACnD,CAAC,KAAK,EAAE,EAAE,CAAC,uBAAuB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAC3D,CAAC;AAGF,8DAA8D;AAC9D,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AACtD,MAAM,CAAC,MAAM,uBAAuB,GAAG,0BAA0B,CAAC;AAElE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,4BAA4B,EAAE,CAAC;CACzD,CAAC,CAAC;AAEH,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IACzC,gBAAgB,EAAE,CAAC,CAAC,QAAQ,CAAC;QAC5B,KAAK,EAAE;YACN,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC;YAClC,CAAC,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;YAC3C,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;SACnC;QACD,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE;KAChB,CAAC;CACF,CAAC,CAAC;AAEH,mEAAmE;AACnE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAC7C,CAAC,KAAK,EAAE,EAAE,CAAC,wBAAwB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAC5D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type * as z from 'zod/v4';
|
|
2
|
+
export declare const RuntimeEnvironmentMobilePluginOptionsSchema: z.ZodObject<{
|
|
3
|
+
workspace: z.ZodOptional<z.ZodObject<{
|
|
4
|
+
root: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
|
|
5
|
+
}, z.core.$strict>>;
|
|
6
|
+
namespace: z.ZodOptional<z.ZodCustom<{
|
|
7
|
+
call: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [z.ZodLiteral<"environment">], null>, z.ZodPromise<z.ZodType<import("@vibesdotdev/kernel/bootstrap").JsonValue, import("@vibesdotdev/kernel/bootstrap").JsonValue, z.core.$ZodTypeInternals<import("@vibesdotdev/kernel/bootstrap").JsonValue, import("@vibesdotdev/kernel/bootstrap").JsonValue>>>>;
|
|
8
|
+
}, {
|
|
9
|
+
call: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [z.ZodLiteral<"environment">], null>, z.ZodPromise<z.ZodType<import("@vibesdotdev/kernel/bootstrap").JsonValue, import("@vibesdotdev/kernel/bootstrap").JsonValue, z.core.$ZodTypeInternals<import("@vibesdotdev/kernel/bootstrap").JsonValue, import("@vibesdotdev/kernel/bootstrap").JsonValue>>>>;
|
|
10
|
+
}>>;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
export type RuntimeEnvironmentMobilePluginOptions = z.infer<typeof RuntimeEnvironmentMobilePluginOptionsSchema>;
|
|
13
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/schemas/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,QAAQ,CAAC;AAIjC,eAAO,MAAM,2CAA2C;;;;;;;;;kBAGrD,CAAC;AACJ,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CAC1D,OAAO,2CAA2C,CAClD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MobileEnvironmentDeclarationSchema } from "./declaration.js";
|
|
2
|
+
import { MobileRuntimeNamespaceSchema } from "./namespace.js";
|
|
3
|
+
export const RuntimeEnvironmentMobilePluginOptionsSchema = MobileEnvironmentDeclarationSchema.extend({
|
|
4
|
+
namespace: MobileRuntimeNamespaceSchema.optional()
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/schemas/options.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kCAAkC,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAE9D,MAAM,CAAC,MAAM,2CAA2C,GACvD,kCAAkC,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,4BAA4B,CAAC,QAAQ,EAAE;CAClD,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
/**
|
|
3
|
+
* The renderer's `performance` global: the browser performance clock this host
|
|
4
|
+
* reads once, at construction. Structural validation keeps the page's own
|
|
5
|
+
* object — `Performance.now` is a browser interface operation that requires its
|
|
6
|
+
* original receiver, so the clock is never read off a schema copy.
|
|
7
|
+
*/
|
|
8
|
+
export declare const MobilePerformanceHolderSchema: z.ZodCustom<{
|
|
9
|
+
performance: {
|
|
10
|
+
now: () => number;
|
|
11
|
+
};
|
|
12
|
+
}, {
|
|
13
|
+
performance: {
|
|
14
|
+
now: () => number;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=performance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performance.d.ts","sourceRoot":"","sources":["../../src/schemas/performance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAU5B;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B;;mBAbrB,MAAM;;;;mBAAN,MAAM;;EAe1B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
const PerformanceClockSchema = z.object({
|
|
3
|
+
now: z.custom((value) => z.function().safeParse(value).success)
|
|
4
|
+
});
|
|
5
|
+
const PerformanceHolderContractSchema = z.object({
|
|
6
|
+
performance: PerformanceClockSchema
|
|
7
|
+
});
|
|
8
|
+
/**
|
|
9
|
+
* The renderer's `performance` global: the browser performance clock this host
|
|
10
|
+
* reads once, at construction. Structural validation keeps the page's own
|
|
11
|
+
* object — `Performance.now` is a browser interface operation that requires its
|
|
12
|
+
* original receiver, so the clock is never read off a schema copy.
|
|
13
|
+
*/
|
|
14
|
+
export const MobilePerformanceHolderSchema = z.custom((value) => PerformanceHolderContractSchema.safeParse(value).success);
|
|
15
|
+
//# sourceMappingURL=performance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performance.js","sourceRoot":"","sources":["../../src/schemas/performance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAe,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;CAC7E,CAAC,CAAC;AAEH,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,WAAW,EAAE,sBAAsB;CACnC,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CACpD,CAAC,KAAK,EAAE,EAAE,CAAC,+BAA+B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CACnE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,86 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibesdotdev/host-mobile",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0-rc.2",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@vibesdotdev/kernel": "^1.0.0-rc.5",
|
|
6
|
+
"zod": "^4.6.7"
|
|
7
|
+
},
|
|
8
|
+
"peerDependencies": {
|
|
9
|
+
"@vibesdotdev/surface-sveltekit": "^1.0.0-rc.2"
|
|
10
|
+
},
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"bun": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./environment": {
|
|
20
|
+
"bun": "./dist/mobile-environment.impl.js",
|
|
21
|
+
"types": "./dist/mobile-environment.impl.d.ts",
|
|
22
|
+
"import": "./dist/mobile-environment.impl.js",
|
|
23
|
+
"default": "./dist/mobile-environment.impl.js"
|
|
24
|
+
},
|
|
25
|
+
"./plugin": {
|
|
26
|
+
"bun": "./dist/runtime-environment-mobile.plugin.js",
|
|
27
|
+
"types": "./dist/runtime-environment-mobile.plugin.d.ts",
|
|
28
|
+
"import": "./dist/runtime-environment-mobile.plugin.js",
|
|
29
|
+
"default": "./dist/runtime-environment-mobile.plugin.js"
|
|
30
|
+
},
|
|
31
|
+
"./docs/plugin": {
|
|
32
|
+
"bun": "./dist/docs/plugin.js",
|
|
33
|
+
"types": "./dist/docs/plugin.d.ts",
|
|
34
|
+
"import": "./dist/docs/plugin.js",
|
|
35
|
+
"default": "./dist/docs/plugin.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"README.md",
|
|
41
|
+
"LICENSE",
|
|
42
|
+
"!dist/**/*.tsbuildinfo",
|
|
43
|
+
"!dist/**/__tests__/**",
|
|
44
|
+
"!dist/**/*.test.js",
|
|
45
|
+
"!dist/**/*.test.d.ts"
|
|
46
|
+
],
|
|
47
|
+
"scripts": {
|
|
48
|
+
"test": "${BUN:-bun} test src/__tests__/",
|
|
49
|
+
"lint": "node ../node_modules/@vibesdotdev/internal-oxlint-toolchain/ratchet.mjs",
|
|
50
|
+
"check": "${BUN:-bun} --bun tsc -p tsconfig.json",
|
|
51
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json"
|
|
52
|
+
},
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "ssh://git@git.vibes.dev/vibesdotdev/framework.git",
|
|
56
|
+
"directory": "host-mobile"
|
|
57
|
+
},
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"registry": "https://packages.vibes.dev",
|
|
60
|
+
"access": "public"
|
|
61
|
+
},
|
|
62
|
+
"vibes": {
|
|
63
|
+
"visibility": "public",
|
|
64
|
+
"registry": {
|
|
65
|
+
"repositoryId": "4b1374d4-6830-4bfd-98e3-de66416368a8",
|
|
66
|
+
"directory": "host-mobile"
|
|
67
|
+
},
|
|
68
|
+
"handedRuntimeLogging": true,
|
|
69
|
+
"host": true
|
|
70
|
+
},
|
|
71
|
+
"description": "Credential-dark mobile webview renderer environment facts and lifecycle for Vibes runtime surfaces.",
|
|
72
|
+
"type": "module",
|
|
73
|
+
"types": "./dist/index.d.ts",
|
|
74
|
+
"license": "MIT",
|
|
75
|
+
"peerDependenciesMeta": {
|
|
76
|
+
"@vibesdotdev/surface-sveltekit": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"gitHead": "51230ebdad54bc405014633f435b499fa2a06b89",
|
|
81
|
+
"_vibes_source": {
|
|
82
|
+
"repo": "ssh://git@git.vibes.dev/vibesdotdev/framework.git",
|
|
83
|
+
"sha": "51230ebdad54bc405014633f435b499fa2a06b89",
|
|
84
|
+
"workspaceDigest": "sha256:13de443fade01c5eda5c7974e428ee3670be96e0265f78a0645aab707f841edc"
|
|
85
|
+
}
|
|
86
|
+
}
|