@vibesdotdev/host-cef 0.0.0-stage → 1.0.0-rc.4

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 (71) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +101 -2
  3. package/dist/cef-environment.impl.d.ts +58 -0
  4. package/dist/cef-environment.impl.d.ts.map +1 -0
  5. package/dist/cef-environment.impl.js +117 -0
  6. package/dist/cef-environment.impl.js.map +1 -0
  7. package/dist/contracts.d.ts +65 -0
  8. package/dist/contracts.d.ts.map +1 -0
  9. package/dist/contracts.js +235 -0
  10. package/dist/contracts.js.map +1 -0
  11. package/dist/docs/plugin.d.ts +10 -0
  12. package/dist/docs/plugin.d.ts.map +1 -0
  13. package/dist/docs/plugin.js +17 -0
  14. package/dist/docs/plugin.js.map +1 -0
  15. package/dist/docs/runtime-environment-cef.docs.descriptor.d.ts +20 -0
  16. package/dist/docs/runtime-environment-cef.docs.descriptor.d.ts.map +1 -0
  17. package/dist/docs/runtime-environment-cef.docs.descriptor.js +174 -0
  18. package/dist/docs/runtime-environment-cef.docs.descriptor.js.map +1 -0
  19. package/dist/environment.d.ts +11 -0
  20. package/dist/environment.d.ts.map +1 -0
  21. package/dist/environment.js +10 -0
  22. package/dist/environment.js.map +1 -0
  23. package/dist/index.d.ts +4 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +3 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/native-host.client.d.ts +15 -0
  28. package/dist/native-host.client.d.ts.map +1 -0
  29. package/dist/native-host.client.descriptor.d.ts +27 -0
  30. package/dist/native-host.client.descriptor.d.ts.map +1 -0
  31. package/dist/native-host.client.descriptor.js +8 -0
  32. package/dist/native-host.client.descriptor.js.map +1 -0
  33. package/dist/native-host.client.impl.browser.d.ts +24 -0
  34. package/dist/native-host.client.impl.browser.d.ts.map +1 -0
  35. package/dist/native-host.client.impl.browser.js +279 -0
  36. package/dist/native-host.client.impl.browser.js.map +1 -0
  37. package/dist/native-host.client.js +5 -0
  38. package/dist/native-host.client.js.map +1 -0
  39. package/dist/native-host.plugin.d.ts +5 -0
  40. package/dist/native-host.plugin.d.ts.map +1 -0
  41. package/dist/native-host.plugin.js +15 -0
  42. package/dist/native-host.plugin.js.map +1 -0
  43. package/dist/runtime-environment-cef.plugin.d.ts +14 -0
  44. package/dist/runtime-environment-cef.plugin.d.ts.map +1 -0
  45. package/dist/runtime-environment-cef.plugin.js +31 -0
  46. package/dist/runtime-environment-cef.plugin.js.map +1 -0
  47. package/dist/schemas/facts.d.ts +48 -0
  48. package/dist/schemas/facts.d.ts.map +1 -0
  49. package/dist/schemas/facts.js +35 -0
  50. package/dist/schemas/facts.js.map +1 -0
  51. package/dist/schemas/failure.d.ts +17 -0
  52. package/dist/schemas/failure.d.ts.map +1 -0
  53. package/dist/schemas/failure.js +7 -0
  54. package/dist/schemas/failure.js.map +1 -0
  55. package/dist/schemas/namespace.d.ts +56 -0
  56. package/dist/schemas/namespace.d.ts.map +1 -0
  57. package/dist/schemas/namespace.js +32 -0
  58. package/dist/schemas/namespace.js.map +1 -0
  59. package/dist/schemas/native-host.d.ts +43 -0
  60. package/dist/schemas/native-host.d.ts.map +1 -0
  61. package/dist/schemas/native-host.js +55 -0
  62. package/dist/schemas/native-host.js.map +1 -0
  63. package/dist/schemas/options.d.ts +88 -0
  64. package/dist/schemas/options.d.ts.map +1 -0
  65. package/dist/schemas/options.js +22 -0
  66. package/dist/schemas/options.js.map +1 -0
  67. package/dist/schemas/readiness.d.ts +10 -0
  68. package/dist/schemas/readiness.d.ts.map +1 -0
  69. package/dist/schemas/readiness.js +11 -0
  70. package/dist/schemas/readiness.js.map +1 -0
  71. package/package.json +91 -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,102 @@
1
- # Temporary Holding Version
1
+ # @vibesdotdev/host-cef
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Vibes runtime environment for a renderer running inside a native CEF
4
+ (Chromium Embedded Framework) host. The host attests facts about the renderer:
5
+ its identity, lifecycle generation, trusted origin, platform, deployment tier
6
+ and the semantic capabilities it offers. This package parses those facts
7
+ strictly and turns them into runtime scope, so discovery and candidate selection
8
+ can reason about where the code runs.
9
+
10
+ It is credential-dark. It never exposes daemon endpoints, socket paths,
11
+ credentials, filesystem access or feature verbs to the
12
+ renderer: `getEnv()` serves only the declared `PUBLIC_*` values the host captured at launch (else `undefined`), and there is no secret accessor: credentials resolve through `runtime.resolveCredential`, which answers `no-store` here.
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ bun add @vibesdotdev/host-cef @vibesdotdev/kernel
18
+ ```
19
+
20
+ ## Use
21
+
22
+ Select the environment through the browser surface, before bootstrap:
23
+
24
+ ```ts
25
+ import { ensureBrowserRuntime } from '@vibesdotdev/surface-sveltekit/surface-browser';
26
+ import { createRuntimeEnvironmentCefPlugin } from '@vibesdotdev/host-cef/plugin';
27
+
28
+ await ensureBrowserRuntime({
29
+ environment: async () => createRuntimeEnvironmentCefPlugin(),
30
+ plugins: [() => import('@vibesdotdev/kernel/client/plugin')]
31
+ });
32
+ ```
33
+
34
+ The plugin reads facts with one call, `call('environment')`, on the namespace
35
+ the native host injects at `globalThis.vibes.runtime`. The host marks the page
36
+ at document start and fires `vibes:runtime-host-ready` after injecting, so the
37
+ plugin uses a namespace that is already installed at once and otherwise waits
38
+ for that event, with no poll or timer. A page without the host
39
+ marker fails at once with `CapabilityError` `UNAVAILABLE`, reason
40
+ `host-unavailable`. Pass `namespace` to supply the host yourself, for example in
41
+ tests:
42
+
43
+ ```ts
44
+ createRuntimeEnvironmentCefPlugin({
45
+ namespace: { call: async () => hostFacts }
46
+ });
47
+ ```
48
+
49
+ The environment serves two runtime bindings through the reader's owning schema:
50
+
51
+ - `cef/runtime-namespace` (`CEF_RUNTIME_NAMESPACE_BINDING`): the host's original
52
+ namespace and receivers; absent when constructed without a namespace.
53
+ - `cef/runtime-capabilities` (`CEF_RUNTIME_CAPABILITIES_BINDING`): the advertised
54
+ kind ids, available even without a namespace.
55
+
56
+ `@vibesdotdev/kernel-rpc/cef` consumes these bindings without reading page globals.
57
+ Unknown binding keys return `undefined`; reader-schema mismatches refuse with
58
+ `INVALID_INPUT / binding-invalid`.
59
+
60
+ Any unknown key in the facts, at any level, fails the parse. Feature packages do
61
+ not read these facts directly; they use ordinary runtime kinds and clients.
62
+
63
+ The environment also supplies the host clock the kernel's lifecycle needs:
64
+ monotonic milliseconds from the renderer's browser performance clock
65
+ (`performance.now()`, never `Date.now()`), so `runtime.lifecycle.now()` and
66
+ disposal's finalization budget run on renderer time. The kernel validates the
67
+ readings and owns the lifecycle refusals.
68
+
69
+ ## Docs
70
+
71
+ Compose `@vibesdotdev/docs/plugin` with `@vibesdotdev/host-cef/docs/plugin` to add the
72
+ `runtime.environment.cef` topic to runtime docs discovery. That plugin registers
73
+ documentation only. [SPEC.md](SPEC.md) is the full contract.
74
+
75
+ ## Typed failures
76
+
77
+ Invalid constructor/plugin options refuse `INVALID_INPUT / cef-environment-options-invalid`.
78
+ Invalid or unreadable host facts refuse `INVALID_INPUT / cef-host-facts-invalid`;
79
+ a failed native call refuses `UNAVAILABLE / cef-host-facts-unavailable`.
80
+ Unreadable globals, failed event registration and ready without namespace refuse
81
+ `UNAVAILABLE / host-unavailable`. These errors contain fixed, value-free metadata
82
+ without caller values or raw causes. Repair the host payload or injection order;
83
+ supply a callable namespace and a workspace root of 1–4096 characters.
84
+
85
+ ## Verify
86
+
87
+ From this package run `bun run check`, `bun run test`, and `bun run build`.
88
+ Configured unit checks also include rules and lint. Build and prepack emit without
89
+ deleting live dist. The public-entrypoint test is in-process: it proves the export
90
+ map's source targets and exact condition mappings, explicit publication exclusions,
91
+ the root contract and real plugin composition through public package imports and
92
+ owned test runtimes with only the native namespace faked. It needs no prior build
93
+ and does not pack or extract tarballs, so it is not a distributed-artifact
94
+ certification. Native CEF execution is separate from this
95
+ simulated native-boundary coverage. `check` uses the noEmit `tsconfig.json`, including
96
+ TypeScript and TSX tests; `tsconfig.test.json` inherits that project. Build and
97
+ prepack use `tsconfig.build.json` to emit production JavaScript and declarations,
98
+ excluding tests, `__tests__` and `src/svelte/**`.
99
+
100
+ ## License
101
+
102
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,58 @@
1
+ /** CEF renderer implementation of the runtime/environment contract. */
2
+ import { type EnvironmentIdentity, type RuntimeEnvironmentImplementation, type RuntimeInvocationStore, type RuntimeLoaderImplementation, type RuntimeScope } from '@vibesdotdev/kernel';
3
+ import { type CefEnvironmentDeclaration } from './schemas/options.ts';
4
+ import * as z from 'zod/v4';
5
+ import { type CefHostFacts, type CefRuntimeNamespace } from './contracts.ts';
6
+ export type { CefEnvironmentDeclaration } from './schemas/options.ts';
7
+ export declare class CefEnvironment implements RuntimeEnvironmentImplementation {
8
+ readonly id = "cef";
9
+ readonly description = "CEF browser renderer environment";
10
+ readonly identity: EnvironmentIdentity;
11
+ readonly scope: RuntimeScope;
12
+ readonly loader: RuntimeLoaderImplementation;
13
+ readonly facts: CefHostFacts;
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
18
+ * milliseconds since the renderer's time origin — never `Date.now()`.
19
+ */
20
+ private readonly readPerformanceMs;
21
+ /** The host's namespace, captured where it arrived and read only through a binding's owning schema. */
22
+ private readonly namespace;
23
+ /**
24
+ * `declaration.workspace` is the virtual root the app entry declared for
25
+ * this renderer; the environment declares it in its scope and invents none.
26
+ * `namespace` is the host's native namespace (the one `facts` were read from); the environment serves it through
27
+ * `CEF_RUNTIME_NAMESPACE_BINDING`; capabilities are independently bound from facts.
28
+ *
29
+ * All three are read once through the same guarded schemas the plugin uses (strict facts, a `{ root }` workspace
30
+ * capped at 4096, a namespace object with a callable `call`); anything else is refused `INVALID_INPUT`
31
+ * `cef-environment-options-invalid`, reporting issue counts and fixed failure categories only.
32
+ */
33
+ constructor(factsInput: CefHostFacts, declarationInput?: CefEnvironmentDeclaration, namespaceInput?: CefRuntimeNamespace);
34
+ createInvocationStore(): RuntimeInvocationStore;
35
+ /** Serves only the public values the native host declared at boot; anything else is undeclared. */
36
+ getEnv(key: string): string | undefined;
37
+ /** A copy of the declared public values, so callers cannot rewrite the attested facts. */
38
+ getEnvSnapshot(): {
39
+ [x: string]: string;
40
+ };
41
+ getPlatform(): string;
42
+ /**
43
+ * Live monotonic milliseconds from the renderer's browser performance
44
+ * clock, for the kernel's lifecycle (`runtime.lifecycle.now()`): finite,
45
+ * nonnegative and nondecreasing, per the `RuntimeEnvironmentImplementation`
46
+ * contract. The kernel validates the value; this host only reads its
47
+ * renderer clock.
48
+ */
49
+ monotonicNow(): number;
50
+ /**
51
+ * Serves the host namespace and the host's advertised capability ids (`CEF_RUNTIME_CAPABILITIES_BINDING`, from
52
+ * its facts), each read through the caller's owning schema: a value that does not match it is `INVALID_INPUT
53
+ * binding-invalid` (the kernel's convention), never a quiet absence; any other key, or an environment built
54
+ * without a namespace asked for it, answers `undefined`.
55
+ */
56
+ getBinding<T>(key: string, schema: z.ZodType<T>): T | undefined;
57
+ }
58
+ //# sourceMappingURL=cef-environment.impl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cef-environment.impl.d.ts","sourceRoot":"","sources":["../src/cef-environment.impl.ts"],"names":[],"mappings":"AAAA,uEAAuE;AAEvE,OAAO,EAKN,KAAK,mBAAmB,EACxB,KAAK,gCAAgC,EAErC,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,YAAY,EACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAA6B,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjG,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAKN,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,MAAM,gBAAgB,CAAC;AAOxB,YAAY,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEtE,qBAAa,cAAe,YAAW,gCAAgC;IACtE,QAAQ,CAAC,EAAE,SAAS;IACpB,QAAQ,CAAC,WAAW,sCAAsC;IAC1D,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAKpC;IACF,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,MAAM,8BAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAe;IACjD,uGAAuG;IACvG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4B;IAEtD;;;;;;;;;OASG;gBACS,UAAU,EAAE,YAAY,EAAE,gBAAgB,GAAE,yBAA8B,EAAE,cAAc,CAAC,EAAE,mBAAmB;IA8B5H,qBAAqB,IAAI,sBAAsB;IAI/C,mGAAmG;IACnG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIvC,0FAA0F;IAC1F,cAAc;;;IAId,WAAW,IAAI,MAAM;IAIrB;;;;;;OAMG;IACH,YAAY,IAAI,MAAM;IAItB;;;;;OAKG;IACH,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS;CAK/D"}
@@ -0,0 +1,117 @@
1
+ /** CEF renderer 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 { captureValue, createSinglePrincipalInvocationStore, declareRuntimeScope, decodeCapturedBinding } from '@vibesdotdev/kernel';
11
+ import { CefEnvironmentInputSchema } from "./schemas/options.js";
12
+ import * as z from 'zod/v4';
13
+ import { CEF_RUNTIME_CAPABILITIES_BINDING, CEF_RUNTIME_NAMESPACE_BINDING, readBrowserPerformanceClock, readCefInput } from "./contracts.js";
14
+ /** A renderer imports what its bundle ships; it has no filesystem to discover. */
15
+ const importLoader = {
16
+ importModule: (specifier) => import(__rewriteRelativeImportExtension(/* @vite-ignore */ specifier))
17
+ };
18
+ export class CefEnvironment {
19
+ id = 'cef';
20
+ description = 'CEF browser renderer environment';
21
+ identity = {
22
+ esm: true,
23
+ typescript: false,
24
+ nativeLoader: false,
25
+ substrate: 'browser'
26
+ };
27
+ scope;
28
+ loader = importLoader;
29
+ facts;
30
+ /**
31
+ * The renderer's browser performance clock (`performance.now()`), captured
32
+ * once at construction so the value the kernel reads can never drift to a
33
+ * different page clock. Its readings are monotonic, nonnegative
34
+ * milliseconds since the renderer's time origin — never `Date.now()`.
35
+ */
36
+ readPerformanceMs;
37
+ /** The host's namespace, captured where it arrived and read only through a binding's owning schema. */
38
+ namespace;
39
+ /**
40
+ * `declaration.workspace` is the virtual root the app entry declared for
41
+ * this renderer; the environment declares it in its scope and invents none.
42
+ * `namespace` is the host's native namespace (the one `facts` were read from); the environment serves it through
43
+ * `CEF_RUNTIME_NAMESPACE_BINDING`; capabilities are independently bound from facts.
44
+ *
45
+ * All three are read once through the same guarded schemas the plugin uses (strict facts, a `{ root }` workspace
46
+ * capped at 4096, a namespace object with a callable `call`); anything else is refused `INVALID_INPUT`
47
+ * `cef-environment-options-invalid`, reporting issue counts and fixed failure categories only.
48
+ */
49
+ constructor(factsInput, declarationInput = {}, namespaceInput) {
50
+ const { facts, declaration, namespace } = readCefInput(CefEnvironmentInputSchema, {
51
+ facts: factsInput,
52
+ declaration: declarationInput,
53
+ namespace: namespaceInput
54
+ });
55
+ this.facts = facts;
56
+ this.namespace = namespace === undefined ? undefined : captureValue(namespace);
57
+ this.readPerformanceMs = readBrowserPerformanceClock();
58
+ // A renderer declares no credential capability: identity is the host's
59
+ // one actor (single-principal store). Native capability ids stay facts.
60
+ const scope = {
61
+ surface: 'browser',
62
+ hardware: 'consumer',
63
+ purpose: 'direct',
64
+ lifecycle: 'persistent',
65
+ hosting: { mode: 'local', owner: 'consumer', venue: 'user-device' },
66
+ qualifiers: {
67
+ dev: this.facts.dev,
68
+ cef: true,
69
+ os: this.facts.platform,
70
+ environmentTier: this.facts.environmentTier,
71
+ trustedOrigin: this.facts.trustedOrigin,
72
+ rendererGeneration: this.facts.renderer.generation
73
+ }
74
+ };
75
+ if (declaration.workspace)
76
+ scope.workspace = { root: declaration.workspace.root };
77
+ this.scope = declareRuntimeScope(scope, 'runtime-environment-cef');
78
+ }
79
+ createInvocationStore() {
80
+ return createSinglePrincipalInvocationStore();
81
+ }
82
+ /** Serves only the public values the native host declared at boot; anything else is undeclared. */
83
+ getEnv(key) {
84
+ return Object.hasOwn(this.facts.env, key) ? this.facts.env[key] : undefined;
85
+ }
86
+ /** A copy of the declared public values, so callers cannot rewrite the attested facts. */
87
+ getEnvSnapshot() {
88
+ return { ...this.facts.env };
89
+ }
90
+ getPlatform() {
91
+ return this.facts.platform;
92
+ }
93
+ /**
94
+ * Live monotonic milliseconds from the renderer's browser performance
95
+ * clock, for the kernel's lifecycle (`runtime.lifecycle.now()`): finite,
96
+ * nonnegative and nondecreasing, per the `RuntimeEnvironmentImplementation`
97
+ * contract. The kernel validates the value; this host only reads its
98
+ * renderer clock.
99
+ */
100
+ monotonicNow() {
101
+ return this.readPerformanceMs();
102
+ }
103
+ /**
104
+ * Serves the host namespace and the host's advertised capability ids (`CEF_RUNTIME_CAPABILITIES_BINDING`, from
105
+ * its facts), each read through the caller's owning schema: a value that does not match it is `INVALID_INPUT
106
+ * binding-invalid` (the kernel's convention), never a quiet absence; any other key, or an environment built
107
+ * without a namespace asked for it, answers `undefined`.
108
+ */
109
+ getBinding(key, schema) {
110
+ if (key === CEF_RUNTIME_CAPABILITIES_BINDING)
111
+ return decodeCapturedBinding(key, captureValue(this.facts.capabilities), schema);
112
+ if (key !== CEF_RUNTIME_NAMESPACE_BINDING)
113
+ return undefined;
114
+ return decodeCapturedBinding(key, this.namespace, schema);
115
+ }
116
+ }
117
+ //# sourceMappingURL=cef-environment.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cef-environment.impl.js","sourceRoot":"","sources":["../src/cef-environment.impl.ts"],"names":[],"mappings":"AAAA,uEAAuE;;;;;;;;;AAEvE,OAAO,EACN,YAAY,EACZ,oCAAoC,EACpC,mBAAmB,EACnB,qBAAqB,EAOrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,yBAAyB,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;;;OAKG;IACH,UAAU,CAAI,GAAW,EAAE,MAAoB;QAC9C,IAAI,GAAG,KAAK,gCAAgC;YAAE,OAAO,qBAAqB,CAAC,GAAG,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;QAC/H,IAAI,GAAG,KAAK,6BAA6B;YAAE,OAAO,SAAS,CAAC;QAC5D,OAAO,qBAAqB,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;CACD"}
@@ -0,0 +1,65 @@
1
+ /** Guarded native CEF acquisition and compatible contract exports. */
2
+ import type * as z from 'zod/v4';
3
+ import { CapabilityError, type CaughtFailure } from '@vibesdotdev/kernel';
4
+ import { type CefHostFacts } from './schemas/facts.ts';
5
+ import { type CefRuntimeNamespace } from './schemas/namespace.ts';
6
+ import { type CefReadinessOptions } from './schemas/readiness.ts';
7
+ export { CefHostFactsSchema, CefHostLifecycleSchema, type CefHostFacts, type CefHostLifecycle } from './schemas/facts.ts';
8
+ export { CefPerformanceHolderSchema, CefRuntimeNamespaceSchema, type CefRuntimeNamespace } from './schemas/namespace.ts';
9
+ export { CefWorkspaceDeclarationSchema, CefEnvironmentDeclarationSchema } from './schemas/options.ts';
10
+ /**
11
+ * The runtime binding key under which `CefEnvironment` serves the host's namespace (`runtime.getBinding(key, schema)`).
12
+ * A transport that relays over the namespace (`@vibesdotdev/kernel-rpc/cef`) reads it through this binding with its
13
+ * own structural schema, so it never imports this package or reads `globalThis`: the page's globals are
14
+ * read here, once, by the host package. The transport pins the same string; this package's binding test proves
15
+ * the two agree.
16
+ */
17
+ export declare const CEF_RUNTIME_NAMESPACE_BINDING = "cef/runtime-namespace";
18
+ /**
19
+ * The runtime binding key under which `CefEnvironment` serves the host's advertised capability ids (the facts'
20
+ * `capabilities`). `@vibesdotdev/kernel-rpc/cef` reads it to learn whether the host admits a connect asking for
21
+ * Date metadata; the transport pins the same string.
22
+ */
23
+ export declare const CEF_RUNTIME_CAPABILITIES_BINDING = "cef/runtime-capabilities";
24
+ /** Set synchronously by the native host at document start: this page runs in a CEF host. */
25
+ export declare const NATIVE_HOST_MARKER = "__vibesNativeHost";
26
+ /** Fired by the native host after it installs `vibes.runtime`. */
27
+ export declare const NATIVE_HOST_READY_EVENT = "vibes:runtime-host-ready";
28
+ /** The reason caller values the CEF environment or its plugin could not read are refused with. */
29
+ export declare const CEF_ENVIRONMENT_OPTIONS_INVALID = "cef-environment-options-invalid";
30
+ /** Refuse invalid options without retaining caller-owned field names or thrown values. */
31
+ export declare function cefOptionsInvalid(issues: readonly string[], unreadable?: string): CapabilityError;
32
+ /**
33
+ * The one shape a caught failure takes at this boundary: the kernel's value-free
34
+ * facts (`valueFreeFailure`) narrowed through `FailureNameSchema` to fixed
35
+ * class-name categories. The caught failure's message is never read and the
36
+ * value itself is never retained, so a hostile native value cannot travel on a
37
+ * refusal — not in `details`, and not as `cause`.
38
+ */
39
+ export declare function failureFacts(caught: CaughtFailure): {
40
+ failure: {
41
+ name: "Error" | "NonErrorThrown" | "UnreadableFailure" | "CapabilityError" | "TypeError" | "RangeError" | "SyntaxError" | "ReferenceError" | "URIError" | "EvalError" | "AggregateError" | "ZodError";
42
+ };
43
+ };
44
+ export declare function readCefInput<S extends z.ZodType>(schema: S, value: z.input<S>): z.output<S>;
45
+ /**
46
+ * The renderer's browser performance clock (`performance.now()`), captured
47
+ * once as a bound reader so kernel lifecycle readings can never drift to a
48
+ * different page clock. A page whose `performance` global is unreadable is a
49
+ * broken page: refused `UNAVAILABLE / host-unavailable` — the same value-free
50
+ * refusal acquisition uses, never `Date.now()`.
51
+ */
52
+ export declare function readBrowserPerformanceClock(): () => number;
53
+ /** Resolve the injected generic runtime namespace without teaching features about globals. */
54
+ export declare function getGlobalCefRuntimeNamespace(): CefRuntimeNamespace | null;
55
+ /**
56
+ * The native runtime namespace, once the host says it is installed.
57
+ *
58
+ * Renderer code can mount before the host injects `vibes.runtime` (CEF injects
59
+ * after main-frame load). The host marks the page synchronously at document
60
+ * start and fires the ready event after injection, so this never polls or
61
+ * times out: a page without the marker has no CEF host (`host-unavailable`).
62
+ */
63
+ export declare function awaitCefRuntimeNamespace(optionsInput?: CefReadinessOptions): Promise<CefRuntimeNamespace>;
64
+ export declare function readCefHostFacts(namespace: CefRuntimeNamespace): Promise<CefHostFacts>;
65
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,KAAK,KAAK,CAAC,MAAM,QAAQ,CAAC;AACjC,OAAO,EACH,eAAe,EACf,KAAK,aAAa,EACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAIN,KAAK,mBAAmB,EACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAA6B,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7F,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC1H,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACzH,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AAEtG;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,0BAA0B,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,6BAA6B,CAAC;AAE3E,4FAA4F;AAC5F,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AACtD,kEAAkE;AAClE,eAAO,MAAM,uBAAuB,6BAA6B,CAAC;AAElE,kGAAkG;AAClG,eAAO,MAAM,+BAA+B,oCAAoC,CAAC;AAKjF,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,eAAe,CAKjG;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa;;;;EAEjD;AAmBD,wBAAgB,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAI3F;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,MAAM,CAa1D;AAED,8FAA8F;AAC9F,wBAAgB,4BAA4B,IAAI,mBAAmB,GAAG,IAAI,CAGzE;AAED;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAAC,YAAY,GAAE,mBAAwB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAoGnH;AAED,wBAAsB,gBAAgB,CACrC,SAAS,EAAE,mBAAmB,GAC5B,OAAO,CAAC,YAAY,CAAC,CAYvB"}
@@ -0,0 +1,235 @@
1
+ import { CapabilityError, settle, settleNow, valueFreeFailure } from '@vibesdotdev/kernel';
2
+ import { CefHostFactsSchema } from "./schemas/facts.js";
3
+ import { CefNamespaceGlobalSchema, CefMarkedPageSchema, CefPerformanceHolderSchema } from "./schemas/namespace.js";
4
+ import { CefReadinessOptionsSchema } from "./schemas/readiness.js";
5
+ import { FailureNameSchema } from "./schemas/failure.js";
6
+ export { CefHostFactsSchema, CefHostLifecycleSchema } from "./schemas/facts.js";
7
+ export { CefPerformanceHolderSchema, CefRuntimeNamespaceSchema } from "./schemas/namespace.js";
8
+ export { CefWorkspaceDeclarationSchema, CefEnvironmentDeclarationSchema } from "./schemas/options.js";
9
+ /**
10
+ * The runtime binding key under which `CefEnvironment` serves the host's namespace (`runtime.getBinding(key, schema)`).
11
+ * A transport that relays over the namespace (`@vibesdotdev/kernel-rpc/cef`) reads it through this binding with its
12
+ * own structural schema, so it never imports this package or reads `globalThis`: the page's globals are
13
+ * read here, once, by the host package. The transport pins the same string; this package's binding test proves
14
+ * the two agree.
15
+ */
16
+ export const CEF_RUNTIME_NAMESPACE_BINDING = 'cef/runtime-namespace';
17
+ /**
18
+ * The runtime binding key under which `CefEnvironment` serves the host's advertised capability ids (the facts'
19
+ * `capabilities`). `@vibesdotdev/kernel-rpc/cef` reads it to learn whether the host admits a connect asking for
20
+ * Date metadata; the transport pins the same string.
21
+ */
22
+ export const CEF_RUNTIME_CAPABILITIES_BINDING = 'cef/runtime-capabilities';
23
+ /** Set synchronously by the native host at document start: this page runs in a CEF host. */
24
+ export const NATIVE_HOST_MARKER = '__vibesNativeHost';
25
+ /** Fired by the native host after it installs `vibes.runtime`. */
26
+ export const NATIVE_HOST_READY_EVENT = 'vibes:runtime-host-ready';
27
+ /** The reason caller values the CEF environment or its plugin could not read are refused with. */
28
+ export const CEF_ENVIRONMENT_OPTIONS_INVALID = 'cef-environment-options-invalid';
29
+ /** The fixed message every caught-failure refusal at this boundary carries. */
30
+ const CEF_READ_FAILED_MESSAGE = 'The CEF host input could not be read.';
31
+ /** Refuse invalid options without retaining caller-owned field names or thrown values. */
32
+ export function cefOptionsInvalid(issues, unreadable) {
33
+ return new CapabilityError('The CEF environment options are invalid.', 'INVALID_INPUT', {
34
+ reason: CEF_ENVIRONMENT_OPTIONS_INVALID, retryable: false,
35
+ details: { issueCount: Math.min(issues.length, 16), unreadable: unreadable !== undefined }
36
+ });
37
+ }
38
+ /**
39
+ * The one shape a caught failure takes at this boundary: the kernel's value-free
40
+ * facts (`valueFreeFailure`) narrowed through `FailureNameSchema` to fixed
41
+ * class-name categories. The caught failure's message is never read and the
42
+ * value itself is never retained, so a hostile native value cannot travel on a
43
+ * refusal — not in `details`, and not as `cause`.
44
+ */
45
+ export function failureFacts(caught) {
46
+ return { failure: { name: FailureNameSchema.parse(valueFreeFailure(caught).name) } };
47
+ }
48
+ /**
49
+ * The one refusal a caught failure produces at this boundary: the fixed message
50
+ * with the failure's value-free facts in `details.failure`.
51
+ */
52
+ function cefReadFailed(caught, reason, code) {
53
+ return new CapabilityError(CEF_READ_FAILED_MESSAGE, code, { reason, retryable: false, details: failureFacts(caught) });
54
+ }
55
+ /** Guard schema predicates and getters through the kernel's caught-failure boundary. */
56
+ function parseCefBoundary(schema, value, reason, code) {
57
+ const settled = settleNow(() => schema.safeParse(value));
58
+ if (settled.ok)
59
+ return settled.value;
60
+ throw cefReadFailed(settled.cause, reason, code);
61
+ }
62
+ export function readCefInput(schema, value) {
63
+ const parsed = parseCefBoundary(schema, value, CEF_ENVIRONMENT_OPTIONS_INVALID, 'INVALID_INPUT');
64
+ if (parsed.success)
65
+ return parsed.data;
66
+ throw cefOptionsInvalid(parsed.error.issues.map((issue) => issue.code));
67
+ }
68
+ /**
69
+ * The renderer's browser performance clock (`performance.now()`), captured
70
+ * once as a bound reader so kernel lifecycle readings can never drift to a
71
+ * different page clock. A page whose `performance` global is unreadable is a
72
+ * broken page: refused `UNAVAILABLE / host-unavailable` — the same value-free
73
+ * refusal acquisition uses, never `Date.now()`.
74
+ */
75
+ export function readBrowserPerformanceClock() {
76
+ const page = parseCefBoundary(CefPerformanceHolderSchema, globalThis, 'host-unavailable', 'UNAVAILABLE');
77
+ if (!page.success) {
78
+ throw new CapabilityError('The CEF renderer has no readable performance clock.', 'UNAVAILABLE', {
79
+ reason: 'host-unavailable',
80
+ retryable: false
81
+ });
82
+ }
83
+ // The schema output is the page's own global object (identity-preserving
84
+ // `z.custom`), never a schema copy: Performance.now requires its original
85
+ // receiver, so bind the captured method to it.
86
+ const { performance } = page.data;
87
+ return performance.now.bind(performance);
88
+ }
89
+ /** Resolve the injected generic runtime namespace without teaching features about globals. */
90
+ export function getGlobalCefRuntimeNamespace() {
91
+ const host = parseCefBoundary(CefNamespaceGlobalSchema, globalThis, 'host-unavailable', 'UNAVAILABLE');
92
+ return host.success ? host.data.vibes.runtime : null;
93
+ }
94
+ /**
95
+ * The native runtime namespace, once the host says it is installed.
96
+ *
97
+ * Renderer code can mount before the host injects `vibes.runtime` (CEF injects
98
+ * after main-frame load). The host marks the page synchronously at document
99
+ * start and fires the ready event after injection, so this never polls or
100
+ * times out: a page without the marker has no CEF host (`host-unavailable`).
101
+ */
102
+ export async function awaitCefRuntimeNamespace(optionsInput = {}) {
103
+ const options = readCefInput(CefReadinessOptionsSchema, optionsInput);
104
+ const signals = [options.signal, options.lifecycle?.signal].filter((signal) => signal !== undefined);
105
+ const cancelled = () => new CapabilityError('CEF host readiness was cancelled.', 'CANCELLED', {
106
+ reason: 'wait-aborted', retryable: false,
107
+ details: { cause: options.lifecycle?.signal.aborted ? 'runtime-disposed' : 'caller-aborted' }
108
+ });
109
+ if (signals.some((signal) => signal.aborted))
110
+ throw cancelled();
111
+ const immediate = getGlobalCefRuntimeNamespace();
112
+ if (immediate)
113
+ return immediate;
114
+ const page = parseCefBoundary(CefMarkedPageSchema, globalThis, 'host-unavailable', 'UNAVAILABLE');
115
+ if (!page.success) {
116
+ throw new CapabilityError('This page has no CEF runtime host.', 'UNAVAILABLE', {
117
+ reason: 'host-unavailable', retryable: false
118
+ });
119
+ }
120
+ return new Promise((resolve, reject) => {
121
+ let settled = false;
122
+ let registering = true;
123
+ let primary;
124
+ let result;
125
+ const removals = [];
126
+ /** Value-free facts of each caught native failure; the raw failures are never retained. */
127
+ const failures = [];
128
+ /**
129
+ * The rejection every caught native failure ends in: the primary refusal's
130
+ * own message, code, reason, retryable and details, with each cleanup
131
+ * failure beside them as a value-free fact in `details.cleanupFailures`.
132
+ * Nothing is dropped, and no caught native value rides on the refusal.
133
+ */
134
+ const rejected = () => {
135
+ const refusal = primary ?? new CapabilityError(CEF_READ_FAILED_MESSAGE, 'UNAVAILABLE', {
136
+ reason: 'host-unavailable', retryable: false
137
+ });
138
+ return new CapabilityError(refusal.message, refusal.code, {
139
+ reason: refusal.reason,
140
+ retryable: refusal.retryable,
141
+ details: { ...refusal.details, cleanupFailures: failures }
142
+ });
143
+ };
144
+ const complete = () => {
145
+ // A native add may invoke the callback before installing the listener.
146
+ // Wait for registration to unwind before removing anything.
147
+ if (registering || !settled)
148
+ return;
149
+ for (const remove of removals.splice(0)) {
150
+ const cleanup = settleNow(remove);
151
+ if (!cleanup.ok)
152
+ failures.push(failureFacts(cleanup.cause).failure);
153
+ }
154
+ if (failures.length > 0)
155
+ reject(rejected());
156
+ else if (primary)
157
+ reject(primary);
158
+ else
159
+ resolve(result);
160
+ };
161
+ const finish = (error, namespace) => {
162
+ if (settled)
163
+ return;
164
+ settled = true;
165
+ primary = error;
166
+ result = namespace;
167
+ complete();
168
+ };
169
+ const abort = () => finish(cancelled());
170
+ const ready = () => {
171
+ if (settled)
172
+ return;
173
+ if (signals.some((signal) => signal.aborted))
174
+ return abort();
175
+ const acquired = settleNow(() => getGlobalCefRuntimeNamespace());
176
+ if (acquired.ok) {
177
+ if (acquired.value)
178
+ finish(undefined, acquired.value);
179
+ else
180
+ finish(new CapabilityError('The CEF host signalled ready without its namespace.', 'UNAVAILABLE', {
181
+ reason: 'host-unavailable', retryable: false
182
+ }));
183
+ return;
184
+ }
185
+ finish(cefReadFailed(acquired.cause, 'host-unavailable', 'UNAVAILABLE'));
186
+ };
187
+ const registration = settleNow(() => {
188
+ for (const signal of signals) {
189
+ if (settled)
190
+ break;
191
+ removals.push(() => signal.removeEventListener('abort', abort));
192
+ signal.addEventListener('abort', abort, { once: true });
193
+ if (signal.aborted)
194
+ abort();
195
+ }
196
+ for (const event of [NATIVE_HOST_READY_EVENT, 'bridgeReady']) {
197
+ if (settled)
198
+ break;
199
+ removals.push(() => page.data.removeEventListener(event, ready));
200
+ page.data.addEventListener(event, ready, { once: true });
201
+ }
202
+ if (!settled) {
203
+ if (signals.some((signal) => signal.aborted))
204
+ abort();
205
+ else if (getGlobalCefRuntimeNamespace())
206
+ ready();
207
+ }
208
+ });
209
+ // Registration is the one path that can fail after the promise settled, so the
210
+ // failure either joins the value-free facts the rejection carries or becomes
211
+ // the refusal it rejects with.
212
+ if (!registration.ok) {
213
+ if (settled)
214
+ failures.push(failureFacts(registration.cause).failure);
215
+ else
216
+ finish(cefReadFailed(registration.cause, 'host-unavailable', 'UNAVAILABLE'));
217
+ }
218
+ registering = false;
219
+ complete();
220
+ });
221
+ }
222
+ export async function readCefHostFacts(namespace) {
223
+ const called = await settle(() => namespace.call('environment'));
224
+ if (!called.ok) {
225
+ throw cefReadFailed(called.cause, 'cef-host-facts-unavailable', 'UNAVAILABLE');
226
+ }
227
+ const parsed = parseCefBoundary(CefHostFactsSchema, called.value, 'cef-host-facts-invalid', 'INVALID_INPUT');
228
+ if (!parsed.success) {
229
+ throw new CapabilityError('The CEF host facts are invalid.', 'INVALID_INPUT', {
230
+ reason: 'cef-host-facts-invalid', retryable: false
231
+ });
232
+ }
233
+ return parsed.data;
234
+ }
235
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAEvD,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAqB,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EACN,wBAAwB,EACxB,mBAAmB,EACnB,0BAA0B,EAE1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAA4B,MAAM,wBAAwB,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAA4C,MAAM,oBAAoB,CAAC;AAC1H,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAA4B,MAAM,wBAAwB,CAAC;AACzH,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AAEtG;;;;;;GAMG;AACH,MAAM,C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nF,CAAC;QACD,WAAW,GAAG,KAAK,CAAC;QACpB,QAAQ,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,SAA8B;IAE9B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;IACjE,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QAChB,MAAM,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,4BAA4B,EAAE,aAAa,CAAC,CAAC;IAChF,CAAC;IACD,MAAM,MAAM,GAAG,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,CAAC,KAAK,EAAE,wBAAwB,EAAE,eAAe,CAAC,CAAC;IAC7G,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACrB,MAAM,IAAI,eAAe,CAAC,iCAAiC,EAAE,eAAe,EAAE;YAC7E,MAAM,EAAE,wBAAwB,EAAE,SAAS,EAAE,KAAK;SAClD,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACpB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Docs-only plugin for the CEF 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-cef/plugin`.
7
+ */
8
+ export declare const runtimeEnvironmentCefDocsPlugin: import("@vibesdotdev/kernel").RuntimePlugin;
9
+ export default runtimeEnvironmentCefDocsPlugin;
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,+BAA+B,6CAK1C,CAAC;AAEH,eAAe,+BAA+B,CAAC"}