@exponential_app/engine 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +54 -0
  3. package/README.md +35 -2
  4. package/dist/capabilities.js +29 -0
  5. package/dist/capabilities.js.map +9 -0
  6. package/dist/chunks/index-4ntgtkmb.js +6783 -0
  7. package/dist/chunks/index-4ntgtkmb.js.map +13 -0
  8. package/dist/chunks/index-ans80t68.js +382 -0
  9. package/dist/chunks/index-ans80t68.js.map +9 -0
  10. package/dist/chunks/index-ax4aay30.js +315 -0
  11. package/dist/chunks/index-ax4aay30.js.map +10 -0
  12. package/dist/chunks/index-e49v2qpf.js +2177 -0
  13. package/dist/chunks/index-e49v2qpf.js.map +9 -0
  14. package/dist/chunks/index-m2845dn6.js +72 -0
  15. package/dist/chunks/index-m2845dn6.js.map +10 -0
  16. package/dist/chunks/index-md3hz6r2.js +3015 -0
  17. package/dist/chunks/index-md3hz6r2.js.map +19 -0
  18. package/dist/chunks/index-n0acffvs.js +366 -0
  19. package/dist/chunks/index-n0acffvs.js.map +10 -0
  20. package/dist/chunks/index-nrr8x2kq.js +259 -0
  21. package/dist/chunks/index-nrr8x2kq.js.map +10 -0
  22. package/dist/chunks/index-s3xjr701.js +170 -0
  23. package/dist/chunks/index-s3xjr701.js.map +10 -0
  24. package/dist/chunks/index-t89cvabm.js +2301 -0
  25. package/dist/chunks/index-t89cvabm.js.map +10 -0
  26. package/dist/chunks/index-zw0575tv.js +126 -0
  27. package/dist/chunks/index-zw0575tv.js.map +10 -0
  28. package/dist/consent.js +24 -0
  29. package/dist/consent.js.map +9 -0
  30. package/dist/index.js +526 -0
  31. package/dist/index.js.map +11 -0
  32. package/dist/lifecycle.js +11 -0
  33. package/dist/lifecycle.js.map +9 -0
  34. package/dist/outbox.js +27 -0
  35. package/dist/outbox.js.map +9 -0
  36. package/dist/pdf.js +15 -0
  37. package/dist/pdf.js.map +9 -0
  38. package/dist/providers.js +26 -0
  39. package/dist/providers.js.map +9 -0
  40. package/dist/runner.js +24 -0
  41. package/dist/runner.js.map +9 -0
  42. package/dist/tools.js +38 -0
  43. package/dist/tools.js.map +9 -0
  44. package/dist/types/domain-contract/src/app-records.d.ts +3148 -0
  45. package/dist/types/domain-contract/src/app-share.d.ts +222 -0
  46. package/dist/types/domain-contract/src/apps.d.ts +594 -0
  47. package/dist/types/eengine/fixtures/providers.json +55 -0
  48. package/dist/types/eengine/src/broker.d.ts +80 -0
  49. package/dist/types/eengine/src/capabilities.d.ts +86 -0
  50. package/dist/types/eengine/src/consent.d.ts +50 -0
  51. package/dist/types/eengine/src/index.d.ts +11 -0
  52. package/dist/types/eengine/src/instance.d.ts +122 -0
  53. package/dist/types/eengine/src/lifecycle.d.ts +64 -0
  54. package/dist/types/eengine/src/outbox.d.ts +3 -0
  55. package/dist/types/eengine/src/pdf.d.ts +36 -0
  56. package/dist/types/eengine/src/providers.d.ts +38 -0
  57. package/dist/types/eengine/src/runner.d.ts +82 -0
  58. package/dist/types/eengine/src/stores.d.ts +125 -0
  59. package/dist/types/eengine/src/tools.d.ts +79 -0
  60. package/dist/types/eengine/src/web/index.d.ts +20 -0
  61. package/dist/types/eengine/src/web/mcp.d.ts +27 -0
  62. package/dist/types/eengine/src/web/platform.d.ts +91 -0
  63. package/dist/types/eengine/src/web/stores.d.ts +125 -0
  64. package/dist/types/emcp/fixtures/automations.json +521 -0
  65. package/dist/types/emcp/fixtures/hub.json +498 -0
  66. package/dist/types/emcp/src/access.d.ts +55 -0
  67. package/dist/types/emcp/src/audit.d.ts +22 -0
  68. package/dist/types/emcp/src/automations.d.ts +111 -0
  69. package/dist/types/emcp/src/exposes.d.ts +242 -0
  70. package/dist/types/emcp/src/hub.d.ts +63 -0
  71. package/dist/types/emcp/src/index.d.ts +7 -0
  72. package/dist/types/emcp/src/pure.d.ts +11 -0
  73. package/dist/types/emcp/src/upstream.d.ts +288 -0
  74. package/dist/types/emcp/src/vault.d.ts +34 -0
  75. package/dist/web/index.js +791 -0
  76. package/dist/web/index.js.map +13 -0
  77. package/fixtures/bundle.json +1165 -0
  78. package/fixtures/capabilities.json +373 -0
  79. package/fixtures/consent.json +146 -0
  80. package/fixtures/lifecycle.json +125 -0
  81. package/fixtures/outbox.json +8 -0
  82. package/fixtures/providers.json +55 -0
  83. package/fixtures/runner.json +2167 -0
  84. package/package.json +92 -4
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/eengine/src/runner.ts"],
4
+ "sourcesContent": [
5
+ "// E6 (#VAPP-266 … #VAPP-269): the runner, the prebuilt shell an exported app\n// runs in on macOS, Windows, Linux, Android, iOS and the web. It has no chrome\n// of its own: its navigation, its Permissions entry, a package that cannot\n// load and the failed-action toast are genUI surfaces made of existing\n// components, built here once (the Rust twin `eengine::runner` replays the\n// same cases; Swift and Kotlin reach it over `eengine-ffi`). Locked by\n// `fixtures/runner.json`.\n\nimport { navScreens, packageScreens } from \"@exponential_app/eui/host\"\n\nimport fixture from \"../fixtures/runner.json\" with { type: \"json\" }\nimport type { ManifestEntry } from \"./capabilities\"\nimport { scopeDef } from \"./capabilities\"\nimport type { SurfaceComponent } from \"./consent\"\nimport type { NetworkPolicy } from \"./providers\"\n\nexport const RUNNER_COPY = fixture.copy\nexport const RUNNER_BUNDLE = fixture.bundle\nexport const RUNNER_SHELL = fixture.shell\n\nexport type FormFactor = `wide` | `compact`\nexport type RunnerFailure = `missing` | `config` | `signature` | `invalid` | `busy`\n\n// ---------------------------------------------------------------- config\n\n/** A bundle's `runner.json`, validated. */\nexport interface RunnerConfig {\n id: string\n name: string\n version: string\n network: NetworkPolicy\n}\n\nexport interface RunnerConfigIssue {\n key: string\n code: string\n}\n\nconst CONFIG_KEYS = Object.keys(fixture.config.keys)\n\n/** `runner.json` → the config (absent optional keys = their default) and its issues, in key order then the extra keys sorted. */\nexport function runnerConfig(input: unknown): { config: RunnerConfig | null; issues: RunnerConfigIssue[] } {\n if (!input || typeof input !== `object` || Array.isArray(input)) return { config: null, issues: [{ key: ``, code: `notAnObject` }] }\n const raw = input as Record<string, unknown>\n const issues: RunnerConfigIssue[] = []\n const out: Record<string, unknown> = {}\n for (const key of CONFIG_KEYS) {\n const def = (fixture.config.keys as Record<string, { required?: boolean; pattern?: string; maxLength?: number; values?: string[]; default?: string }>)[key]!\n const value = raw[key]\n if (value === undefined) {\n if (def.required) issues.push({ key, code: `missing` })\n else out[key] = def.default\n continue\n }\n const ok =\n typeof value === `string` &&\n (!def.pattern || new RegExp(def.pattern).test(value)) &&\n (!def.maxLength || ([...value].length <= def.maxLength && value.trim().length > 0)) &&\n (!def.values || def.values.includes(value))\n if (ok) out[key] = value\n else issues.push({ key, code: `invalid` })\n }\n const extra = Object.keys(raw)\n .filter((k) => !CONFIG_KEYS.includes(k))\n .sort()\n for (const key of extra) issues.push({ key, code: fixture.config.forbidden.includes(key) ? `forbidden` : `unknown` })\n return { config: issues.length ? null : (out as unknown as RunnerConfig), issues }\n}\n\n// ---------------------------------------------------------------- the shell\n\ntype Pkg = Record<string, unknown> & { name?: unknown; templates?: unknown; screens?: unknown; capabilities?: unknown }\ntype Template = Record<string, unknown> & { components?: unknown; data?: unknown }\n\nconst manifestOf = (pkg: Pkg): ManifestEntry[] => (Array.isArray(pkg.capabilities) ? (pkg.capabilities as ManifestEntry[]) : [])\n\n/** Does the package declare an `ask` scope (the shell then offers Permissions)? */\nexport function runnerHasPermissions(pkg: Pkg): boolean {\n return manifestOf(pkg).some((m) => {\n const def = scopeDef(m.id)\n return !!def && !def.scope.hostOnly && def.scope.consent === `ask`\n })\n}\n\nconst event = (name: string, context?: Record<string, unknown>) => ({ event: context ? { name, context } : { name } })\n\n/** The shell around one screen's template: its components (the template's root becomes `runner_page`) and its extra data. */\nfunction shellComponents(pkg: Pkg, screen: string, components: SurfaceComponent[], formFactor: FormFactor): { components: SurfaceComponent[]; data: Record<string, unknown> | null } {\n const nav = navScreens(pkg)\n const permissions = runnerHasPermissions(pkg)\n const tabs = nav.length >= 2\n const page = components.map((c) => (c.id === `root` ? { ...c, id: `runner_page` } : c))\n if (!tabs && !permissions)\n return { components: [{ id: `root`, component: `Box`, style: { display: `flex`, flexDirection: `column`, height: `100%`, overflowY: `auto` }, children: [`runner_page`] }, ...page], data: null }\n const S = fixture.shell\n if (formFactor === `wide`) {\n const nav_children = [`runner_title`, ...(tabs ? [`runner_screens`] : []), ...(permissions ? [`runner_permissions`] : [])]\n const shell: SurfaceComponent[] = [\n { id: `root`, component: `Stack`, direction: `horizontal`, gap: `none`, align: `stretch`, style: { height: `100%` }, children: [`runner_sidebar`] },\n { id: `runner_sidebar`, component: `Sidebar`, width: S.sidebarWidth, collapseBelow: `never`, children: [`runner_scroll`], slots: { sidebar: `runner_nav` } },\n { id: `runner_scroll`, component: `Box`, style: { display: `flex`, flexDirection: `column`, flexGrow: 1, minHeight: 0, overflowY: `auto` }, children: [`runner_page`] },\n { id: `runner_nav`, component: `Stack`, gap: `sm`, style: { padding: `$spacing.sm` }, children: nav_children },\n { id: `runner_title`, component: `Heading`, text: typeof pkg.name === `string` ? pkg.name : ``, level: S.titleLevel },\n ]\n if (tabs)\n shell.push(\n { id: `runner_screens`, component: `List`, children: nav.map((_, i) => `runner_screen_${i}`) },\n ...nav.map((s, i) => ({\n id: `runner_screen_${i}`,\n component: `Row`,\n title: s.title ?? s.template,\n ...(s.icon ? { icon: s.icon } : {}),\n selected: s.template === screen,\n density: `compact`,\n pressable: true,\n on: { press: event(`runner.navigate`, { screen: s.template }) },\n })),\n )\n if (permissions)\n shell.push({ id: `runner_permissions`, component: `Row`, title: fixture.copy.permissions, icon: S.permissionsIcon, density: `compact`, pressable: true, on: { press: event(`runner.permissions`) } })\n return { components: [...shell, ...page], data: null }\n }\n const bar = [...(tabs ? [`runner_tabs_box`] : []), ...(permissions ? [`runner_permissions`] : [])]\n const shell: SurfaceComponent[] = [\n { id: `root`, component: `Stack`, gap: `none`, style: { height: `100%` }, children: [`runner_main`, `runner_separator`, `runner_bar`] },\n { id: `runner_main`, component: `Box`, style: { display: `flex`, flexDirection: `column`, flexGrow: 1, minHeight: 0, overflowY: `auto` }, children: [`runner_page`] },\n { id: `runner_separator`, component: `Separator` },\n { id: `runner_bar`, component: `Stack`, direction: `horizontal`, gap: `sm`, align: `center`, justify: `end`, style: { padding: `$spacing.sm` }, children: bar },\n ]\n if (tabs)\n shell.push(\n { id: `runner_tabs_box`, component: `Box`, style: { display: `flex`, flexDirection: `column`, flexGrow: 1, minWidth: 0 }, children: [`runner_tabs`] },\n {\n id: `runner_tabs`,\n component: `Tabs`,\n tabs: nav.map((s) => ({ label: s.title ?? s.template, value: s.template, ...(s.icon ? { icon: s.icon } : {}) })),\n value: { \"@path\": `/runner/screen` },\n fill: true,\n on: { change: event(`runner.navigate`, { screen: { \"@path\": `/runner/screen` } }) },\n },\n )\n if (permissions)\n shell.push({ id: `runner_permissions`, component: `Button`, label: fixture.copy.permissions, icon: S.permissionsIcon, size: `icon`, variant: `ghost`, on: { press: event(`runner.permissions`) } })\n return { components: [...shell, ...page], data: tabs ? { runner: { screen } } : null }\n}\n\n/**\n * The package the runner's painter installs: every screen's template wrapped\n * in the shell for `formFactor`. A package without screens gets one, its first\n * template. The Engine keeps the ORIGINAL package (its signature, its grants);\n * only the painter sees this one.\n */\nexport function runnerPackage(pkg: Pkg, formFactor: FormFactor): Pkg {\n const templates = pkg.templates && typeof pkg.templates === `object` ? (pkg.templates as Record<string, Template>) : {}\n let out: Pkg = pkg\n if (packageScreens(pkg).length === 0) {\n const first = Object.keys(templates)[0]\n if (!first) return pkg\n out = { ...pkg, screens: [{ template: first, title: typeof pkg.name === `string` ? pkg.name : first }] }\n }\n const wrapped: Record<string, Template> = { ...templates }\n for (const s of packageScreens(out)) {\n const t = templates[s.template]\n if (!t || !Array.isArray(t.components)) continue\n const { components, data } = shellComponents(out, s.template, t.components as SurfaceComponent[], formFactor)\n if (components === t.components) continue\n const base = t.data && typeof t.data === `object` && !Array.isArray(t.data) ? (t.data as Record<string, unknown>) : {}\n wrapped[s.template] = { ...t, components, ...(data ? { data: { ...base, ...data } } : {}) }\n }\n return { ...out, templates: wrapped }\n}\n\n// ---------------------------------------------------------------- surfaces\n\n/** What the runner paints instead of the app when its bundle cannot load. */\nexport function runnerFailure(kind: RunnerFailure): SurfaceComponent[] {\n return [{ id: `root`, component: `EmptyState`, icon: fixture.shell.failureIcon, title: fixture.copy.failed.title, description: fixture.copy.failed[kind] }]\n}\n\n/** The failed-action toast (a refused call, a refused link): surface `toast`; a broker reason code reads as `copy.refusals`. */\nexport function runnerToast(message: string): SurfaceComponent[] {\n const refusals = fixture.copy.refusals as Record<string, string>\n return [{ id: `root`, component: `Toast`, title: Object.hasOwn(refusals, message) ? refusals[message]! : message, type: `error` }]\n}\n"
6
+ ],
7
+ "mappings": ";;;;;AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,UAAU,OAAO,IAAI,SAAS,WAAY,SAAS,MAAM,QAAQ,CAAC;AAAA;",
8
+ "debugId": "8614238A2FCD206064756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,126 @@
1
+ import {
2
+ capabilityNameValid2
3
+ } from "./index-md3hz6r2.js";
4
+
5
+ // packages/eengine/src/providers.ts
6
+ import { recordRefusal } from "@exponential_app/eui/host";
7
+ // packages/eengine/fixtures/providers.json
8
+ var providers_default = {
9
+ $comment: "VAPP-260 (Engine E0, epic VAPP-259, docs/spec/apps.md §13.1): WHAT A HOST HANDS THE ENGINE, the `HostConfig`. Each key of `providers` is `required` (the Engine refuses to start without it: `missing`) or optional (absent = its `default`); `list: true` = zero or more. There is NO telemetry and NO update provider: `forbidden` keys are refused by name (`forbidden`), so an exported runner can never grow an analytics, crash-report or over-the-air channel through its config (a new package version = a rebundle, decided 2026-11-05); any other unknown key is `unknown`. `network` is one of `networkPolicies`; `identity.kind` one of `identityKinds`. A capability is mounted under its name (capabilities.json), each name once (`duplicateCapability`); an agent provider (Agents' `AgentProvider`: `acp`, `localModel`, `remoteSession`) once per id (`duplicateAgent`). `validateHostConfig(config)` -> the issues `{key, code}` in `providers` order, then forbidden and unknown keys sorted. HOSTS (`hosts`): what each host kind provides, informative and checked against the validator (each must pass). IDENTITY (`identityCases`, `engineViewer`): `member` = the signed-in member with their team role and app access (Exponential); `local` = ONE person on one device and no account (the softcoded app, eDE Local desktops, exported apps): the viewer = `{id: the device uuid, role: owner, access: write}`, so genUI's `recordRefusal` allows every op of every kind policy (`member`, `author`, `owners` all collapse to \"me\"), and records the instance writes carry the device uuid as author; `peer` = a P2P key (Spezl), judged like `member` with the key as id and role `member`. NETWORK (`networkCases`, `networkAllows`): `off` = nothing leaves the device (upstreams, `http.fetch` and a sync transport are refused `offline`); `upstreamsOnly` = the package's declared `upstreams` and the sync transport, never `http.fetch`; `any` = all three (an `http.fetch` still needs its manifest origin and consent: capabilities.json). A refusal is `{allowed: false, reason}`.",
10
+ providers: {
11
+ host: { required: true, doc: "HostInfo: host kind, platform, form factor, locale, Engine version" },
12
+ storage: { required: true, doc: "RecordStore: query, write (writeId), history, subscribe (MemoryRecordStore, SqliteRecordStore = elocal's app-records table, SyncedRecordStore)" },
13
+ blobs: { required: true, doc: "BlobStore: put/get record files (FsBlobStore, the server's attachments)" },
14
+ identity: { required: true, doc: "Identity: the viewer (member, local or peer)" },
15
+ vault: { required: true, doc: "emcp Vault: grants, upstream tokens (Keychain, Keystore, libsecret, sealed server column)" },
16
+ window: { required: true, doc: "WindowHost: open a screen (window, nav stack, sheet), report lifecycle events" },
17
+ clock: { required: false, default: "system", doc: "Clock: now (tests pin it)" },
18
+ zone: { required: false, default: "device", doc: "HostZone: the IANA zone of today/now/month (the team's in Exponential)" },
19
+ network: { required: false, default: "upstreamsOnly", doc: "NetworkPolicy" },
20
+ sync: { required: false, default: null, doc: "SyncTransport: pull deltas, push outbox entries (Exponential: Electric in, tRPC out; Spezl: P2P); absent = writes apply locally, no outbox" },
21
+ agents: { required: false, default: [], list: true, doc: "AgentProvider (Agents): acp, localModel, remoteSession; each gets its tools only as a hub grant" },
22
+ capabilities: { required: false, default: [], list: true, doc: "Capability: a native tool provider on the in-process hub (capabilities.json)" },
23
+ consent: { required: false, default: "sheet", doc: "ConsentUi: the Engine's own genUI sheet unless the host paints it (consent.json)" }
24
+ },
25
+ forbidden: ["analytics", "crashReporter", "telemetry", "updateChannel", "updates"],
26
+ networkPolicies: ["off", "upstreamsOnly", "any"],
27
+ identityKinds: ["member", "local", "peer"],
28
+ hosts: {
29
+ exponential: { host: {}, storage: {}, blobs: {}, identity: { kind: "member" }, vault: {}, window: {}, zone: {}, network: "any", sync: {}, agents: [{ id: "acp" }, { id: "remoteSession" }], capabilities: [{ name: "files" }, { name: "share" }, { name: "notifications" }] },
30
+ softcoded: { host: {}, storage: {}, blobs: {}, identity: { kind: "local" }, vault: {}, window: {}, network: "upstreamsOnly", agents: [{ id: "localModel" }] },
31
+ ede: { host: {}, storage: {}, blobs: {}, identity: { kind: "local" }, vault: {}, window: {}, network: "any", agents: [{ id: "acp" }], capabilities: [{ name: "files" }, { name: "notifications" }, { name: "shell" }] },
32
+ spezl: { host: {}, storage: {}, blobs: {}, identity: { kind: "peer" }, vault: {}, window: {}, network: "any", sync: {}, agents: [{ id: "acp" }] },
33
+ exported: { host: {}, storage: {}, blobs: {}, identity: { kind: "local" }, vault: {}, window: {}, network: "off", capabilities: [{ name: "photos" }, { name: "print" }, { name: "share" }] }
34
+ },
35
+ validateCases: [
36
+ { name: "the minimum", config: { host: {}, storage: {}, blobs: {}, identity: { kind: "local" }, vault: {}, window: {} }, expected: [] },
37
+ { name: "every required key missing", config: {}, expected: [{ key: "host", code: "missing" }, { key: "storage", code: "missing" }, { key: "blobs", code: "missing" }, { key: "identity", code: "missing" }, { key: "vault", code: "missing" }, { key: "window", code: "missing" }] },
38
+ { name: "no telemetry, no update channel", config: { host: {}, storage: {}, blobs: {}, identity: { kind: "local" }, vault: {}, window: {}, updates: {}, telemetry: {}, theme: {} }, expected: [{ key: "telemetry", code: "forbidden" }, { key: "theme", code: "unknown" }, { key: "updates", code: "forbidden" }] },
39
+ { name: "a bad network policy and identity kind", config: { host: {}, storage: {}, blobs: {}, identity: { kind: "guest" }, vault: {}, window: {}, network: "lan" }, expected: [{ key: "identity", code: "invalid" }, { key: "network", code: "invalid" }] },
40
+ { name: "a capability or agent twice", config: { host: {}, storage: {}, blobs: {}, identity: { kind: "member" }, vault: {}, window: {}, agents: [{ id: "acp" }, { id: "acp" }], capabilities: [{ name: "photos" }, { name: "photos" }] }, expected: [{ key: "agents", code: "duplicateAgent" }, { key: "capabilities", code: "duplicateCapability" }] },
41
+ { name: "a capability under a reserved or invalid name", config: { host: {}, storage: {}, blobs: {}, identity: { kind: "member" }, vault: {}, window: {}, capabilities: [{ name: "records" }, { name: "Bad_Name" }] }, expected: [{ key: "capabilities", code: "invalidCapability" }] },
42
+ { name: "an unknown agent provider", config: { host: {}, storage: {}, blobs: {}, identity: { kind: "member" }, vault: {}, window: {}, agents: [{ id: "openclaw" }] }, expected: [{ key: "agents", code: "invalid" }] }
43
+ ],
44
+ agentProviders: ["acp", "localModel", "remoteSession"],
45
+ identityCases: [
46
+ { name: "local: an author-only update of someone else's record", identity: { kind: "local", deviceId: "d-1" }, policy: { read: "author", create: "owners", update: "author", delete: "owners" }, op: "update", row: { authorId: "u-imported" }, expected: { viewer: { id: "d-1", role: "owner", access: "write" }, refusal: null } },
47
+ { name: "local: an owners-only delete", identity: { kind: "local", deviceId: "d-1" }, policy: { read: "member", create: "member", update: "author", delete: "owners" }, op: "delete", row: { authorId: "d-1" }, expected: { viewer: { id: "d-1", role: "owner", access: "write" }, refusal: null } },
48
+ { name: "member: the policy applies", identity: { kind: "member", userId: "u-1", role: "member", access: "write" }, policy: { read: "member", create: "member", update: "author", delete: "author" }, op: "update", row: { authorId: "u-2" }, expected: { viewer: { id: "u-1", role: "member", access: "write" }, refusal: "Only the record's author or a team owner can change it" } },
49
+ { name: "peer: a key judged as a member", identity: { kind: "peer", key: "pk-9" }, policy: { read: "member", create: "member", update: "author", delete: "author" }, op: "update", row: { authorId: "pk-9" }, expected: { viewer: { id: "pk-9", role: "member", access: "write" }, refusal: null } }
50
+ ],
51
+ networkCases: [
52
+ { policy: "off", target: "upstream", declared: true, expected: { allowed: false, reason: "offline" } },
53
+ { policy: "off", target: "sync", declared: true, expected: { allowed: false, reason: "offline" } },
54
+ { policy: "off", target: "http", declared: true, expected: { allowed: false, reason: "offline" } },
55
+ { policy: "upstreamsOnly", target: "upstream", declared: true, expected: { allowed: true, reason: null } },
56
+ { policy: "upstreamsOnly", target: "upstream", declared: false, expected: { allowed: false, reason: "notDeclared" } },
57
+ { policy: "upstreamsOnly", target: "sync", declared: true, expected: { allowed: true, reason: null } },
58
+ { policy: "upstreamsOnly", target: "http", declared: true, expected: { allowed: false, reason: "network" } },
59
+ { policy: "any", target: "http", declared: true, expected: { allowed: true, reason: null } },
60
+ { policy: "any", target: "upstream", declared: false, expected: { allowed: false, reason: "notDeclared" } }
61
+ ]
62
+ };
63
+
64
+ // packages/eengine/src/providers.ts
65
+ var PROVIDER_KEYS2 = Object.keys(providers_default.providers);
66
+ var FORBIDDEN_HOST_KEYS2 = providers_default.forbidden;
67
+ var NETWORK_POLICIES2 = providers_default.networkPolicies;
68
+ var IDENTITY_KINDS2 = providers_default.identityKinds;
69
+ var AGENT_PROVIDERS2 = providers_default.agentProviders;
70
+ var isObject = (v) => !!v && typeof v === `object` && !Array.isArray(v);
71
+ function validateHostConfig2(config) {
72
+ const issues = [];
73
+ for (const key of PROVIDER_KEYS2) {
74
+ const def = providers_default.providers[key];
75
+ const value = config[key];
76
+ if (value === undefined) {
77
+ if (def.required)
78
+ issues.push({ key, code: `missing` });
79
+ continue;
80
+ }
81
+ if (key === `identity` && !(isObject(value) && IDENTITY_KINDS2.includes(value.kind)))
82
+ issues.push({ key, code: `invalid` });
83
+ if (key === `network` && !NETWORK_POLICIES2.includes(value))
84
+ issues.push({ key, code: `invalid` });
85
+ if (key === `agents`) {
86
+ const ids = Array.isArray(value) ? value.map((a) => isObject(a) ? a.id : undefined) : null;
87
+ if (!ids || ids.some((id) => !AGENT_PROVIDERS2.includes(id)))
88
+ issues.push({ key, code: `invalid` });
89
+ else if (new Set(ids).size !== ids.length)
90
+ issues.push({ key, code: `duplicateAgent` });
91
+ }
92
+ if (key === `capabilities`) {
93
+ const names = Array.isArray(value) ? value.map((c) => isObject(c) ? c.name : undefined) : null;
94
+ if (!names || names.some((n) => typeof n !== `string` || !capabilityNameValid2(n)))
95
+ issues.push({ key, code: `invalidCapability` });
96
+ else if (new Set(names).size !== names.length)
97
+ issues.push({ key, code: `duplicateCapability` });
98
+ }
99
+ }
100
+ const extra = Object.keys(config).filter((k) => !PROVIDER_KEYS2.includes(k)).sort();
101
+ for (const key of extra)
102
+ issues.push({ key, code: FORBIDDEN_HOST_KEYS2.includes(key) ? `forbidden` : `unknown` });
103
+ return issues;
104
+ }
105
+ function engineViewer2(identity) {
106
+ if (identity.kind === `local`)
107
+ return { id: identity.deviceId, role: `owner`, access: `write` };
108
+ if (identity.kind === `peer`)
109
+ return { id: identity.key, role: `member`, access: `write` };
110
+ return { id: identity.userId, role: identity.role, access: identity.access ?? `write` };
111
+ }
112
+ var engineRecordRefusal2 = (identity, policy, op, row) => recordRefusal(policy, op, engineViewer2(identity), row);
113
+ function networkAllows2(policy, target, declared) {
114
+ if (policy === `off`)
115
+ return { allowed: false, reason: `offline` };
116
+ if (target === `upstream` && !declared)
117
+ return { allowed: false, reason: `notDeclared` };
118
+ if (target === `http` && policy === `upstreamsOnly`)
119
+ return { allowed: false, reason: `network` };
120
+ return { allowed: true, reason: null };
121
+ }
122
+
123
+ export { PROVIDER_KEYS2, FORBIDDEN_HOST_KEYS2, NETWORK_POLICIES2, IDENTITY_KINDS2, AGENT_PROVIDERS2, validateHostConfig2, engineViewer2, engineRecordRefusal2, networkAllows2 };
124
+
125
+ //# debugId=68437053B3E9A13064756E2164756E21
126
+ //# sourceMappingURL=index-zw0575tv.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/eengine/src/providers.ts"],
4
+ "sourcesContent": [
5
+ "// VAPP-260: what a host hands the Engine (`HostConfig`), the viewer each\n// identity kind yields, and the network policy. Locked by `fixtures/providers.json`.\n\nimport { recordRefusal, type RecordOp, type RecordOwnership, type RecordPolicy, type RecordViewer } from \"@exponential_app/eui/host\"\n\nimport fixture from \"../fixtures/providers.json\" with { type: \"json\" }\nimport { capabilityNameValid } from \"./capabilities\"\n\nexport type ProviderKey = keyof typeof fixture.providers\nexport type NetworkPolicy = `off` | `upstreamsOnly` | `any`\nexport type IdentityKind = `member` | `local` | `peer`\nexport type AgentProviderId = `acp` | `localModel` | `remoteSession`\n\nexport const PROVIDER_KEYS = Object.keys(fixture.providers) as ProviderKey[]\nexport const FORBIDDEN_HOST_KEYS: readonly string[] = fixture.forbidden\nexport const NETWORK_POLICIES = fixture.networkPolicies as readonly NetworkPolicy[]\nexport const IDENTITY_KINDS = fixture.identityKinds as readonly IdentityKind[]\nexport const AGENT_PROVIDERS = fixture.agentProviders as readonly AgentProviderId[]\n\nexport interface HostConfigIssue {\n key: string\n code: `missing` | `forbidden` | `unknown` | `invalid` | `duplicateAgent` | `duplicateCapability` | `invalidCapability`\n}\n\nconst isObject = (v: unknown): v is Record<string, unknown> => !!v && typeof v === `object` && !Array.isArray(v)\n\n/** Every problem with a host config: providers in order, then forbidden/unknown keys sorted. */\nexport function validateHostConfig(config: Record<string, unknown>): HostConfigIssue[] {\n const issues: HostConfigIssue[] = []\n for (const key of PROVIDER_KEYS) {\n const def = fixture.providers[key] as { required: boolean }\n const value = config[key]\n if (value === undefined) {\n if (def.required) issues.push({ key, code: `missing` })\n continue\n }\n if (key === `identity` && !(isObject(value) && (IDENTITY_KINDS as readonly unknown[]).includes(value.kind))) issues.push({ key, code: `invalid` })\n if (key === `network` && !(NETWORK_POLICIES as readonly unknown[]).includes(value)) issues.push({ key, code: `invalid` })\n if (key === `agents`) {\n const ids = Array.isArray(value) ? value.map((a) => (isObject(a) ? a.id : undefined)) : null\n if (!ids || ids.some((id) => !(AGENT_PROVIDERS as readonly unknown[]).includes(id))) issues.push({ key, code: `invalid` })\n else if (new Set(ids).size !== ids.length) issues.push({ key, code: `duplicateAgent` })\n }\n if (key === `capabilities`) {\n const names = Array.isArray(value) ? value.map((c) => (isObject(c) ? c.name : undefined)) : null\n if (!names || names.some((n) => typeof n !== `string` || !capabilityNameValid(n))) issues.push({ key, code: `invalidCapability` })\n else if (new Set(names).size !== names.length) issues.push({ key, code: `duplicateCapability` })\n }\n }\n const extra = Object.keys(config)\n .filter((k) => !(PROVIDER_KEYS as readonly string[]).includes(k))\n .sort()\n for (const key of extra) issues.push({ key, code: FORBIDDEN_HOST_KEYS.includes(key) ? `forbidden` : `unknown` })\n return issues\n}\n\nexport type EngineIdentity =\n | { kind: `member`; userId: string; role: string | null; access?: `none` | `read` | `write` }\n | { kind: `local`; deviceId: string }\n | { kind: `peer`; key: string }\n\n/** The records viewer of an identity: local = the one owner of everything (\"me\"). */\nexport function engineViewer(identity: EngineIdentity): Required<RecordViewer> {\n if (identity.kind === `local`) return { id: identity.deviceId, role: `owner`, access: `write` }\n if (identity.kind === `peer`) return { id: identity.key, role: `member`, access: `write` }\n return { id: identity.userId, role: identity.role, access: identity.access ?? `write` }\n}\n\n/** Why the viewer of `identity` may not `op` (null = allowed). */\nexport const engineRecordRefusal = (identity: EngineIdentity, policy: RecordPolicy, op: RecordOp, row?: RecordOwnership | null): string | null =>\n recordRefusal(policy, op, engineViewer(identity), row)\n\n/** May the instance reach `target` under `policy`? `declared` = the package declares the upstream (or the origin). */\nexport function networkAllows(policy: NetworkPolicy, target: `upstream` | `sync` | `http`, declared: boolean): { allowed: boolean; reason: string | null } {\n if (policy === `off`) return { allowed: false, reason: `offline` }\n if (target === `upstream` && !declared) return { allowed: false, reason: `notDeclared` }\n if (target === `http` && policy === `upstreamsOnly`) return { allowed: false, reason: `network` }\n return { allowed: true, reason: null }\n}\n"
6
+ ],
7
+ "mappings": ";;;;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUO,IAAM,iBAAgB,OAAO,KAAK,kBAAQ,SAAS;AACnD,IAAM,uBAAyC,kBAAQ;AACvD,IAAM,oBAAmB,kBAAQ;AACjC,IAAM,kBAAiB,kBAAQ;AAC/B,IAAM,mBAAkB,kBAAQ;AAOvC,IAAM,WAAW,CAAC,MAA6C,CAAC,CAAC,KAAK,OAAO,MAAM,YAAY,CAAC,MAAM,QAAQ,CAAC;AAGxG,SAAS,mBAAkB,CAAC,QAAoD;AAAA,EACrF,MAAM,SAA4B,CAAC;AAAA,EACnC,WAAW,OAAO,gBAAe;AAAA,IAC/B,MAAM,MAAM,kBAAQ,UAAU;AAAA,IAC9B,MAAM,QAAQ,OAAO;AAAA,IACrB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manageSheet2
10
+ } from "./chunks/index-nrr8x2kq.js";
11
+ import"./chunks/index-md3hz6r2.js";
12
+ export {
13
+ CONSENT_COPY2 as CONSENT_COPY,
14
+ GRANTS_RECORD_VERSION2 as GRANTS_RECORD_VERSION,
15
+ consentAnswer2 as consentAnswer,
16
+ consentSheet2 as consentSheet,
17
+ grantWrite2 as grantWrite,
18
+ grantsOnPackage2 as grantsOnPackage,
19
+ grantsRecord2 as grantsRecord,
20
+ manageSheet2 as manageSheet
21
+ };
22
+
23
+ //# debugId=5375CA8FE54EE02164756E2164756E21
24
+ //# sourceMappingURL=consent.js.map
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "5375CA8FE54EE02164756E2164756E21",
8
+ "names": []
9
+ }