@unoverse-platform/studio 0.1.90 → 0.1.91

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 (130) hide show
  1. package/local/plugin.ts +20 -12
  2. package/package.json +13 -3
  3. package/vendor/base/src/agent-mcp/discovery.ts +203 -0
  4. package/vendor/base/src/agent-mcp/handoff.ts +56 -0
  5. package/vendor/base/src/agent-mcp/index.ts +44 -0
  6. package/vendor/base/src/agent-mcp/invoke.ts +140 -0
  7. package/vendor/base/src/agent-mcp/lean.ts +111 -0
  8. package/vendor/base/src/agent-mcp/memoryContext.ts +104 -0
  9. package/vendor/base/src/agent-mcp/memoryIngest.ts +88 -0
  10. package/vendor/base/src/agent-mcp/rowComponents.ts +172 -0
  11. package/vendor/base/src/agent-mcp/tools.ts +134 -0
  12. package/vendor/base/src/agent-mcp/types.ts +130 -0
  13. package/vendor/base/src/auth/auth.ts +278 -0
  14. package/vendor/base/src/auth/authConfig.ts +73 -0
  15. package/vendor/base/src/boot.ts +245 -0
  16. package/vendor/base/src/definitions/definitions.ts +18 -0
  17. package/vendor/base/src/definitions/dsPackage.ts +45 -0
  18. package/vendor/base/src/definitions/fsCache.ts +128 -0
  19. package/vendor/base/src/definitions/index.ts +19 -0
  20. package/vendor/base/src/definitions/inputs.ts +30 -0
  21. package/vendor/base/src/definitions/load/compile/component.ts +80 -0
  22. package/vendor/base/src/definitions/load/compile/index.ts +12 -0
  23. package/vendor/base/src/definitions/load/compile/sections.ts +132 -0
  24. package/vendor/base/src/definitions/load/compile/template.ts +153 -0
  25. package/vendor/base/src/definitions/load/expand/includes.ts +27 -0
  26. package/vendor/base/src/definitions/load/expand/index.ts +17 -0
  27. package/vendor/base/src/definitions/load/expand/inherit.ts +169 -0
  28. package/vendor/base/src/definitions/load/expand/referenced.ts +164 -0
  29. package/vendor/base/src/definitions/load/expand/refs.ts +106 -0
  30. package/vendor/base/src/definitions/load/expand/walk.ts +91 -0
  31. package/vendor/base/src/definitions/load/load.ts +487 -0
  32. package/vendor/base/src/definitions/model.ts +238 -0
  33. package/vendor/base/src/definitions/registry/catalog.ts +643 -0
  34. package/vendor/base/src/definitions/registry/homes.ts +252 -0
  35. package/vendor/base/src/definitions/theme.ts +383 -0
  36. package/vendor/base/src/executor.ts +284 -0
  37. package/vendor/base/src/http/uwsFetchAdapter.ts +260 -0
  38. package/vendor/base/src/items/baseVersion.ts +96 -0
  39. package/vendor/base/src/items/collect.ts +199 -0
  40. package/vendor/base/src/items/fingerprint.ts +34 -0
  41. package/vendor/base/src/items/publish.ts +198 -0
  42. package/vendor/base/src/lint/context.mjs +56 -0
  43. package/vendor/base/src/lint/design/defs.mjs +46 -0
  44. package/vendor/base/src/lint/design/file.mjs +737 -0
  45. package/vendor/base/src/lint/design/index.d.mts +30 -0
  46. package/vendor/base/src/lint/design/index.mjs +996 -0
  47. package/vendor/base/src/lint/design/tokens.mjs +128 -0
  48. package/vendor/base/src/lint/design/vocabulary.mjs +181 -0
  49. package/vendor/base/src/lint/design/walk.mjs +444 -0
  50. package/vendor/base/src/lint/index.mjs +28 -0
  51. package/vendor/base/src/lint/nodes/blocks.mjs +63 -0
  52. package/vendor/base/src/lint/nodes/index.mjs +64 -0
  53. package/vendor/base/src/lint/nodes/load.mjs +126 -0
  54. package/vendor/base/src/lint/nodes/node.mjs +764 -0
  55. package/vendor/base/src/lint/nodes/package.mjs +112 -0
  56. package/vendor/base/src/lint/nodes/schema.mjs +75 -0
  57. package/vendor/base/src/logger.ts +33 -0
  58. package/vendor/base/src/manifests/compose.ts +539 -0
  59. package/vendor/base/src/manifests/executor/callback.ts +107 -0
  60. package/vendor/base/src/manifests/executor/context.ts +107 -0
  61. package/vendor/base/src/manifests/executor/index.ts +47 -0
  62. package/vendor/base/src/manifests/executor/lookup.ts +21 -0
  63. package/vendor/base/src/manifests/executor/memory.ts +62 -0
  64. package/vendor/base/src/manifests/executor/promise.ts +71 -0
  65. package/vendor/base/src/manifests/executor/refire.ts +34 -0
  66. package/vendor/base/src/manifests/executor/send.ts +65 -0
  67. package/vendor/base/src/manifests/executor/session.ts +46 -0
  68. package/vendor/base/src/manifests/executor/toolBridge.ts +266 -0
  69. package/vendor/base/src/manifests/index.ts +280 -0
  70. package/vendor/base/src/manifests/integrity.ts +93 -0
  71. package/vendor/base/src/manifests/rows.ts +33 -0
  72. package/vendor/base/src/manifests/runtime/auth/aws.ts +240 -0
  73. package/vendor/base/src/manifests/runtime/auth/oauth.ts +76 -0
  74. package/vendor/base/src/manifests/runtime/authorize.ts +159 -0
  75. package/vendor/base/src/manifests/runtime/channels/final.ts +171 -0
  76. package/vendor/base/src/manifests/runtime/channels/service.ts +125 -0
  77. package/vendor/base/src/manifests/runtime/channels/workflow.ts +310 -0
  78. package/vendor/base/src/manifests/runtime/context.ts +150 -0
  79. package/vendor/base/src/manifests/runtime/docstore/handlers.ts +547 -0
  80. package/vendor/base/src/manifests/runtime/docstore/index.ts +135 -0
  81. package/vendor/base/src/manifests/runtime/docstore/sectionizer.ts +184 -0
  82. package/vendor/base/src/manifests/runtime/docstore/store.ts +172 -0
  83. package/vendor/base/src/manifests/runtime/docstore/types.ts +60 -0
  84. package/vendor/base/src/manifests/runtime/duplex/audioLane.ts +165 -0
  85. package/vendor/base/src/manifests/runtime/duplex/session.ts +511 -0
  86. package/vendor/base/src/manifests/runtime/events.ts +223 -0
  87. package/vendor/base/src/manifests/runtime/helpers.ts +53 -0
  88. package/vendor/base/src/manifests/runtime/http/allowedHosts.ts +118 -0
  89. package/vendor/base/src/manifests/runtime/http/request.ts +637 -0
  90. package/vendor/base/src/manifests/runtime/http/response.ts +162 -0
  91. package/vendor/base/src/manifests/runtime/index.ts +57 -0
  92. package/vendor/base/src/manifests/runtime/loops/chunk.ts +98 -0
  93. package/vendor/base/src/manifests/runtime/loops/loop.ts +191 -0
  94. package/vendor/base/src/manifests/runtime/loops/paginate.ts +143 -0
  95. package/vendor/base/src/manifests/runtime/loops/poll.ts +169 -0
  96. package/vendor/base/src/manifests/runtime/narrate.ts +53 -0
  97. package/vendor/base/src/manifests/runtime/state.ts +171 -0
  98. package/vendor/base/src/manifests/runtime/templating.ts +110 -0
  99. package/vendor/base/src/manifests/runtime/tools/regionSkills.ts +125 -0
  100. package/vendor/base/src/manifests/runtime/tools/toolloop.ts +542 -0
  101. package/vendor/base/src/manifests/runtime/usage.ts +87 -0
  102. package/vendor/base/src/manifests/source.ts +187 -0
  103. package/vendor/base/src/manifests/watch.ts +67 -0
  104. package/vendor/base/src/markdown/document.ts +141 -0
  105. package/vendor/base/src/paths.ts +180 -0
  106. package/vendor/base/src/platform/audioManager.ts +100 -0
  107. package/vendor/base/src/platform/clientTransport.ts +65 -0
  108. package/vendor/base/src/platform/executionContext.ts +154 -0
  109. package/vendor/base/src/platform/index.ts +10 -0
  110. package/vendor/base/src/platform/pluginAPI.ts +146 -0
  111. package/vendor/base/src/platform/redis.ts +54 -0
  112. package/vendor/base/src/platform/serviceCalls.ts +222 -0
  113. package/vendor/base/src/pluginBase.ts +248 -0
  114. package/vendor/base/src/plugins/README.md +57 -0
  115. package/vendor/base/src/plugins/discovery.ts +87 -0
  116. package/vendor/base/src/plugins/index.ts +16 -0
  117. package/vendor/base/src/plugins/loader.ts +179 -0
  118. package/vendor/base/src/plugins/redis.ts +36 -0
  119. package/vendor/base/src/plugins/state.ts +53 -0
  120. package/vendor/base/src/registry.ts +95 -0
  121. package/vendor/base/src/security/permissions.ts +93 -0
  122. package/vendor/base/src/security/rules.ts +73 -0
  123. package/vendor/base/src/template/SafeExpression.ts +556 -0
  124. package/vendor/base/src/template/StringTemplateResolver.ts +75 -0
  125. package/vendor/base/src/template/index.ts +22 -0
  126. package/vendor/base/src/types.ts +50 -0
  127. package/vendor/base/src/workflow/GetMemoryService.ts +158 -0
  128. package/vendor/base/src/workflow/PlatformMemoryCore.ts +438 -0
  129. package/vendor/base/src/workflow/routing.ts +122 -0
  130. package/vendor/sdk/lib/core/store.ts +26 -6
@@ -0,0 +1,238 @@
1
+ /**
2
+ * The MODEL: the served definition shapes and the small kind/word normalizers that
3
+ * belong to them. Split from definitions.ts 2026-08-29.
4
+ */
5
+
6
+ export interface UnoverseDefinition {
7
+ unoverse: string;
8
+ /** `app` is the app kind's IN-CODE name (the 2026-08-23 rename, finished in code
9
+ * 2026-08-28); stored words are unchanged (DB item kind, registry rows, and the
10
+ * manifest `type` field still say "template" until their own migration).
11
+ * `template` is the Template Model kind (UNOVERSE_TEMPLATE_MODEL.md). */
12
+ kind: "component" | "app" | "atom" | "template";
13
+ name: string;
14
+ /** TEMPLATES (§9b RULED 2026-08-29): the compiled SECTIONS of each state's
15
+ * layout — one entry per `static:` / `copywriter:` / `director:` line, in
16
+ * arrangement order. `static`/`copywriter` link a component (face = its
17
+ * basename); the ONE `director` section is where deliveries land (face = its
18
+ * `state:` pin, else the owning state's name). Studio's table and seeding read
19
+ * this; the wire layouts carry the expanded ComponentSlots. */
20
+ sections?: Record<
21
+ string,
22
+ {
23
+ kind: "static" | "copywriter" | "director";
24
+ face: string;
25
+ /** Linked sections: the authored path (components/masthead). A DIRECTOR section
26
+ * with a component is a SEARCH PLACE (§9e, one word since 2026-09-02); without
27
+ * one it is a DELIVERY band. */
28
+ component?: string;
29
+ /** Linked sections: the resolvable scoped ref (email-digest/masthead). */
30
+ ref?: string;
31
+ /** SEARCH places (§9e rule 10d): the DERIVED question — never authored. Stamped at
32
+ * fill time from the first voice that speaks: the writer's headings (items), the
33
+ * page's pool (galleries), the component's own contract, or the guest's ask.
34
+ * Present on the wire only after derivation; a layout carrying one fails to load. */
35
+ ask?: string;
36
+ /** SEARCH places: which `object_type`s may answer, as the six `include*` flags
37
+ * (`ranking.ts`). A day is made of SERVICES; nothing should draw a need, a skill or
38
+ * an app into a moment. APPS ARE ALWAYS OFF on this lane, whatever is listed: the
39
+ * page's searches are SILENT — no app unlocked, no tool minted, no card lane, no
40
+ * director woken — because otherwise every place would rain cards onto the screen
41
+ * while the page was still assembling itself. */
42
+ include?: string[];
43
+ /** The previewed components' own mock values (`preview ?? default` per prop),
44
+ * keyed by REF — a linked part's one component, or each of the director's
45
+ * stand-ins. A preview host seeds instances with these the way the Components
46
+ * screen does; without them everything draws as ghosts and a finished arrangement
47
+ * reads as a broken one. Never used at runtime: a delivery fills the instance. */
48
+ seeds?: Record<string, Record<string, unknown>>;
49
+ /** Delivery bands only (a director section with no component). */
50
+ state?: string;
51
+ rules?: string;
52
+ preview?: string[];
53
+ /** Both director modes: how many the director keeps — the ONE cap word. */
54
+ pick?: number;
55
+ /** Search places: which search answers (authored; derived when absent). */
56
+ type?: "discovery" | "intent";
57
+ /** An items place (§9e rule 10c): the writer shapes min–max items, each heading
58
+ * arriving with its own search. */
59
+ items?: { min: number; max: number };
60
+ }[]
61
+ >;
62
+ /** TEMPLATES: Studio preview mocks per slot — interface refs, each rendering its
63
+ * own defaults (the interface-model rule: mocks are the interface's OWN defaults,
64
+ * never authored preview data). From the template's manifest.yaml. */
65
+ preview?: Record<string, string[]>;
66
+ /** Source basename for FILE definitions (atoms) — the identity refs resolve by. */
67
+ file?: string;
68
+ /** The client org it belongs to (server-injected from its folder, never
69
+ * hand-written) — also names its theme (`<org>/light`). Design-system components
70
+ * and atoms are universal and carry no org; an ORG component (the client's own
71
+ * microapp, `rx/orgs/<org>/components/`) carries its org and is org-private. */
72
+ org?: string;
73
+ category?: string;
74
+ /** Human display name ("Bank Transfer"); falls back to `name` (the id). */
75
+ title?: string;
76
+ description?: string;
77
+ /** COMPOSITION CONTEXT (UNOVERSE_AUTHORING §3b): what the definition says about filling
78
+ * the WHOLE of it — never drawn, never discovery copy. STAMPED BY THE LOADER from the
79
+ * envelope's own `description` when a manifest's discovery copy takes that key. */
80
+ composition?: string;
81
+ /** TEMPLATES: the spatial-discovery selection text — ranked against user intent
82
+ * by findIntent, exactly like a node's whenToUse in the node catalog. Write it
83
+ * outcome-first in the user's vocabulary (packages/docs/nodes/14-node-discoverability.md);
84
+ * `description` stays the human "what it is". When present it REPLACES
85
+ * description in the embedded text. */
86
+ whenToUse?: string;
87
+ props?: Record<string, unknown>;
88
+ /** COMPONENTS (render contract): the composed `state` block. The manifest's arrival
89
+ * `defaultState` seeds it so the SDK renders that face on arrival (merged beneath
90
+ * live data). Server-composed from the manifest, never hand-written. */
91
+ state?: Record<string, unknown>;
92
+ /** COMPONENTS: projected capability flag — true iff the component folder carries a
93
+ * manifest.json (spatial-capable). Derived from presence, never authored in a def. */
94
+ spatial?: boolean;
95
+ /** Display icon URL (from the manifest; catalogs/drawers only). */
96
+ icon?: string;
97
+ /** COMPONENTS: manifest version (display only). */
98
+ version?: string;
99
+ /** COMPONENTS: credential types a lifecycle hook needs, by name. The canvas offers the
100
+ * same picker a node gets; the value is resolved server-side and never in this folder. */
101
+ credentials?: string[];
102
+ root: unknown;
103
+ /** TEMPLATE LAYOUTS (name-sync): present only when the template folder carries
104
+ * MULTIPLE layouts/ files. Each entry is a fully composed arrangement; the SDK
105
+ * presents the layout whose name matches the latest surfaced component view,
106
+ * falling back to `defaultLayout` (the manifest's `layout`). One-layout
107
+ * templates never carry this — byte-for-byte the classic behavior. */
108
+ layouts?: Record<string, unknown>;
109
+ defaultLayout?: string;
110
+ /** THE APP'S TEMPLATES (the container noun folded into templates, 2026-08-28):
111
+ * the manifest's `templates:` block, straight through. Each entry is a PLACE the
112
+ * layout positions by name (`type: Template, name: courses`) and owns the width
113
+ * of. `use:` mounts a template definition (its own states/shapes/slots run
114
+ * there), with the per-USE director grant beside it; the legacy holder form
115
+ * (interface / states) remains a template with one shape. `workflow`/`query`
116
+ * are the place's source, served as data. */
117
+ templates?: Record<
118
+ string,
119
+ {
120
+ /** Mount this template definition here (bare shelf name or `<org>/<name>`) —
121
+ * the holder grammar: a place names what it holds (`interface:` for one
122
+ * component, `template:` for a mounted template). Unmoved by the 2026-09-01
123
+ * rename: here the word names a TEMPLATE, which is what it means. */
124
+ template?: string;
125
+ /** STAMPED BY THE LOADER for a state-held mount: the mounted template's own
126
+ * state names — the views whose arrival counts as this state's claim. */
127
+ claims?: string[];
128
+ /** Director-at-use: duties + rules granted for THIS placement. */
129
+ director?: Record<string, unknown>;
130
+ /** This place's own Studio preview seeds (interface refs). */
131
+ preview?: string[];
132
+ /** This place's own FEED, one block: workflow + trigger + autoTrigger +
133
+ * inputSchema (the app-level `binding` word, applied per place; the first
134
+ * carrier lifts to the app level for the composer). */
135
+ binding?: { workflow?: string; trigger?: string; autoTrigger?: boolean; inputSchema?: Record<string, unknown> };
136
+ /** Legacy holder shorthand: a one-state place holding this interface. */
137
+ interface?: string;
138
+ /** Legacy holder states — each holds an interface; tabs switch between them. */
139
+ states?: Record<string, { interface?: string; state?: string; width?: string; workflow?: string; trigger?: string; autoTrigger?: boolean; query?: Record<string, unknown>; inputSchema?: Record<string, unknown> }>;
140
+ workflow?: string;
141
+ trigger?: string;
142
+ autoTrigger?: boolean;
143
+ query?: Record<string, unknown>;
144
+ }
145
+ >;
146
+ /** TEMPLATES (STATE_MODEL v2 §5 rules 3+5): the DECLARED STATE ORDER — the priority
147
+ * ladder and arrival-scan order, from the manifest's `stateOrder`. First entry
148
+ * outranks all below it; no name is special. Absent → legacy recency semantics. */
149
+ stateOrder?: string[];
150
+ /** THE LATCH, PER STATE (MCP guide §The Component Latch, moved here from the manifest
151
+ * 2026-08-31): the states whose wearer the conversation may be ADDRESSED AT, keyed by
152
+ * state name. Compiled from each state's own `latch:` block and stamped beside
153
+ * `stateOrder`, because states themselves are compiled away into `layouts`.
154
+ *
155
+ * A state absent from this map can never hold the latch, so the SAME instance
156
+ * retracted from its page state to an inline one drops the pill by construction —
157
+ * which is the thing a manifest-level declaration could not say. `resolveLatch` reads
158
+ * this map; nothing about the latch travels on the wire with a render. */
159
+ latches?: Record<string, { title: string; icon?: string }>;
160
+ /** COMPONENTS (STATE_MODEL v2 §5 rule 2): the PUBLIC MENU — the top-level state
161
+ * names of the authored `state.view` tree, compiled at serve time. What hosts may
162
+ * place at spawn and templates may react to; nested substates never appear here. */
163
+ publicStates?: string[];
164
+ /** REFERENCE, DON'T COPY: the shared pieces this definition NAMES rather than carries,
165
+ * by ref name. Present only on the referenced form (`referencedDefinition`), which a
166
+ * client asks for explicitly; the default form still inlines every Ref. */
167
+ defs?: Record<string, unknown>;
168
+ /** COMPONENTS (STATE_MODEL v2): the view tree's declared initial — the base the
169
+ * client retracts to and the fallback when no host placement matches. */
170
+ initialView?: string;
171
+ /** COMPONENTS (STATE_MODEL v2): the authored `state.view` TREE, served as a nested
172
+ * projection so viewers render states from the DECLARATION instead of scanning
173
+ * layouts for Switches (the scan surfaced embedded components' content selectors —
174
+ * a Document's tab cases — as fake states). Public states in tree order, each with
175
+ * its layout, its substep discriminant (`on` + `initial`), and its private
176
+ * substates. The tree stays the single source of truth; this is its projection. */
177
+ stateTree?: {
178
+ name: string;
179
+ layout?: string;
180
+ on?: string;
181
+ initial?: string;
182
+ states?: { name: string; layout?: string }[];
183
+ }[];
184
+ }
185
+
186
+ /** A COMPONENT manifest — `rx/components/<name>/manifest.json`. OPTIONAL: its PRESENCE
187
+ * is what makes a component spatial-capable (a basic component has none and is never
188
+ * discovered). It is the single home for the discovery meta; there is NO flag inside —
189
+ * presence is the capability, the workbench registry toggle is the activation. */
190
+ export interface ComponentManifest {
191
+ title?: string;
192
+ /** Display icon URL (square; shown in catalogs/drawers — never embedded). */
193
+ icon?: string;
194
+ description?: string;
195
+ /** Spatial-discovery selection text — see UnoverseDefinition.whenToUse. Required
196
+ * in practice (the discoverability guard enforces it). */
197
+ whenToUse?: string;
198
+ category?: string;
199
+ version?: string;
200
+ /** The component's ARRIVAL state — an OPEN name (default "inline"). Injected into the
201
+ * composed def's `state` block so the SDK renders that face on arrival; the component
202
+ * still writes its own `defaultState` at runtime via setValue (STATE_MODEL §5b). This is
203
+ * the render contract's home for the default state — parallel to a template's manifest. */
204
+ defaultState?: string;
205
+ /** LIFECYCLE opt-in — the phases whose server-side handler this component brings
206
+ * (e.g. ["onStart"]). Each name maps to a sibling file (onStart → onstart.js), run by
207
+ * the MCP render path. Presence here AUTHORIZES execution; a file with no opt-in is
208
+ * inert. See UNOVERSE_AUTHORING.md §3c. */
209
+ lifecycle?: string[];
210
+ }
211
+
212
+
213
+ /** THE BASE ARRANGEMENT (UNOVERSE_TEMPLATE_MODEL §12): which layout is the app's
214
+ * default. An explicit `layout:` still wins, but the line is no longer required —
215
+ * states own layouts and declaration order ranks them, so the FIRST DECLARED STATE
216
+ * is the base. "main" remains the default only for manifests with no states block. */
217
+ export function defaultLayoutOf(m: { layout?: string; states?: unknown } | null | undefined): string {
218
+ if (typeof m?.layout === "string" && m.layout) return m.layout;
219
+ const states = m?.states;
220
+ if (states && typeof states === "object" && !Array.isArray(states)) {
221
+ const first = Object.keys(states)[0];
222
+ if (first) return first;
223
+ }
224
+ return "main";
225
+ }
226
+
227
+ /** THE DECLARATION WORD IS `type:` (authored; `kind:` is the legacy spelling, still
228
+ * read). The catalogue filter matches on the internal `kind` field, so an envelope
229
+ * written with the new word must land there — and the authored declaration is then
230
+ * removed so a definition object never carries a stray top-level `type`. */
231
+ export function normalizeDeclaredKind(d: UnoverseDefinition & { type?: unknown }): void {
232
+ const declared = d.type;
233
+ if (declared === "component" || declared === "template" || declared === "atom" || declared === "app") {
234
+ if (!d.kind) d.kind = declared;
235
+ delete d.type;
236
+ }
237
+ }
238
+