@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,122 @@
1
+ /**
2
+ * Signal routing over a frozen route table — the runtime half of the workflow contract.
3
+ *
4
+ * The types here are the WIRE CONTRACT for a compiled workflow: the engine's compiler
5
+ * (RouteTableBuilder, engine-side — it needs the node metadata registry and must never
6
+ * enter this package) produces a RouteTable; anything that runs one consumes these shapes.
7
+ * The compiler's own declarations stay structurally identical — the runtime round-trip
8
+ * tests hold the two in parity.
9
+ *
10
+ * SignalRoutingEngine is pure routing logic: given a completed node's output and the
11
+ * route table, which downstream signals fire. No signal management, no execution.
12
+ */
13
+
14
+ import { createLogger } from "../logger.js";
15
+
16
+ /** One compiled edge: source → target with its signal type and connector handles. */
17
+ export interface RouteEntry {
18
+ targetNodeId: string;
19
+ signalType: string; // "EXECUTE" | "SPAWN" | "RESET" etc.
20
+ targetHandle?: string; // Which input connector this edge connects to
21
+ sourceHandle?: string; // Which output connector this edge comes from
22
+ }
23
+
24
+ /** The frozen routing derived from a workflow's nodes + edges. */
25
+ export interface RouteTable {
26
+ routing: Map<string, RouteEntry[]>; // Source → [RouteEntries with signal types]
27
+ dependencies: Map<string, string[]>; // Target → [Source Node IDs] (for execution order)
28
+ connectorDependencies?: Map<string, Map<string, string[]>>; // Target → Connector → [Source Node IDs]
29
+ triggerNodes: string[]; // Nodes that start execution
30
+ nodeTriggerMap?: Map<string, string>; // nodeId → upstream InputTrigger ID (Focus Mode routing)
31
+ }
32
+
33
+ /** A signal the router decided to send. */
34
+ export interface SignalRoute {
35
+ targetNodeId: string;
36
+ signal: string;
37
+ sourceNodeId: string;
38
+ targetHandle?: string; // Which input connector this signal targets
39
+ }
40
+
41
+ const logger = createLogger("SignalRoutingEngine");
42
+
43
+ export class SignalRoutingEngine {
44
+ /**
45
+ * Get signals to send when a node completes execution - ROUTE TABLE VERSION
46
+ * Ultra-fast O(1) lookup using pre-computed route table
47
+ * Now with multi-output support - filters based on active output connectors
48
+ */
49
+ static getSignalsForCompletedNode(nodeId: string, nodeOutput: any, routeTable: RouteTable): SignalRoute[] {
50
+ const signals: SignalRoute[] = [];
51
+
52
+ if (!routeTable?.routing) {
53
+ logger.warn(`No route table provided for node completion`, { nodeId });
54
+ return signals;
55
+ }
56
+
57
+ const routeEntries = routeTable.routing.get(nodeId) || [];
58
+
59
+ for (const routeEntry of routeEntries) {
60
+ // For nodes using __outputs pattern, check if the specific output exists
61
+ if (nodeOutput?.__outputs) {
62
+ // If there's a sourceHandle, check if that specific output exists
63
+ if (routeEntry.sourceHandle) {
64
+ const hasOutput =
65
+ routeEntry.sourceHandle in nodeOutput.__outputs &&
66
+ nodeOutput.__outputs[routeEntry.sourceHandle] !== undefined;
67
+
68
+ if (!hasOutput) {
69
+ // Debug level - this is normal for streaming nodes that emit partial outputs
70
+ logger.debug(`No signal - output connector has no data`, {
71
+ from: nodeId,
72
+ to: routeEntry.targetNodeId,
73
+ sourceHandle: routeEntry.sourceHandle,
74
+ });
75
+ continue; // Skip this route
76
+ }
77
+ }
78
+ // If no sourceHandle specified, node should have a default output
79
+ }
80
+ // For legacy multi-output nodes (IfElse, etc), check if the specific output exists
81
+ else if (routeEntry.sourceHandle && nodeOutput && typeof nodeOutput === "object") {
82
+ const hasOutput = routeEntry.sourceHandle in nodeOutput;
83
+
84
+ if (!hasOutput) {
85
+ logger.debug(`No signal - output connector has no data`, {
86
+ from: nodeId,
87
+ to: routeEntry.targetNodeId,
88
+ sourceHandle: routeEntry.sourceHandle,
89
+ });
90
+ continue; // Skip this route
91
+ }
92
+ }
93
+ // For flat output nodes or nodes with data, always send signal
94
+
95
+ signals.push({
96
+ targetNodeId: routeEntry.targetNodeId,
97
+ signal: routeEntry.signalType, // Use pre-computed signal type!
98
+ sourceNodeId: nodeId,
99
+ targetHandle: routeEntry.targetHandle, // Include target connector
100
+ });
101
+
102
+ if (routeEntry.signalType === "SPAWN") {
103
+ logger.debug(`Routing SPAWN signal`, {
104
+ from: nodeId,
105
+ to: routeEntry.targetNodeId,
106
+ targetHandle: routeEntry.targetHandle,
107
+ sourceHandle: routeEntry.sourceHandle,
108
+ });
109
+ }
110
+
111
+ logger.debug(`Using route table to add active signal`, {
112
+ from: nodeId,
113
+ to: routeEntry.targetNodeId,
114
+ signal: routeEntry.signalType,
115
+ targetHandle: routeEntry.targetHandle,
116
+ sourceHandle: routeEntry.sourceHandle,
117
+ });
118
+ }
119
+
120
+ return signals;
121
+ }
122
+ }
@@ -215,12 +215,20 @@ export class ComponentStore {
215
215
  * lower states update silently underneath).
216
216
  */
217
217
  /**
218
- * RULE 5's EMPTY DELIVERY (STATE_MODEL §5 rule 5, amended 2026-08-26): a discovery
219
- * turn that ran with cards enabled and surfaced NONE still owns the screen — the
220
- * server says so with COMPONENTS_CLEAR, and every earlier-turn component sitting in
221
- * a public state retracts to inline. `supersede` for ALL states at once: same
222
- * durable (`lifetime: "conversation"`) opt-out, same same-turn exemption. Rule 7
223
- * stands — this rides the answer's delivery, never the guest's typing.
218
+ * RULE 5's EMPTY DELIVERY (STATE_MODEL §5 rule 5; the director is the sender since
219
+ * 2026-08-30 — confirmed-empty and spent-or-kept both arrive as COMPONENTS_CLEAR):
220
+ * every earlier-turn component sitting in a public state retires. Same durable
221
+ * (`lifetime: "conversation"`) opt-out, same same-turn exemption as `supersede`.
222
+ * Rule 7 stands — this rides the answer's delivery, never the guest's typing.
223
+ *
224
+ * A CLEAR NEVER STAMPS A STATE NOBODY DREW (STATE_MODEL §5 rule 5, 2026-09-03).
225
+ * `inline` is the retirement of a CHAT-lifetime card. A v2 slice whose public menu
226
+ * has no `inline` cannot wear it — worn anyway, the renderer fell back to the
227
+ * default drawing and the chat flow painted retired GRID cards into the
228
+ * conversation (observed live: BPP course cards). Such a slice retires to its
229
+ * DECLARED base, written WITHOUT a touch: its delivery was just spent
230
+ * (`spendDelivery` runs first), and a touch would re-admit it to the delivery it
231
+ * is leaving — the mount would hold the very cards the clear retired.
224
232
  */
225
233
  supersedeAll(arrivingChatId?: string): void {
226
234
  let changed = false;
@@ -229,6 +237,18 @@ export class ComponentStore {
229
237
  if (slice.lifetime === "conversation") continue;
230
238
  const v = (slice.state ?? slice.view ?? slice.defaultState) as unknown;
231
239
  if (typeof v !== "string" || !v || v === "inline") continue;
240
+ const menu = Array.isArray(slice.publicStates) ? (slice.publicStates as unknown[]) : undefined;
241
+ if (menu && !menu.includes("inline")) {
242
+ const base = typeof slice.initialView === "string" ? slice.initialView : undefined;
243
+ if (base && v !== base) {
244
+ const next: Record<string, unknown> = { ...slice };
245
+ next[this.faceKey(next)] = base;
246
+ if ("defaultState" in next) next.defaultState = base;
247
+ this.data.set(key, next);
248
+ changed = true;
249
+ }
250
+ continue;
251
+ }
232
252
  const next: Record<string, unknown> = { ...slice };
233
253
  next[this.faceKey(next)] = "inline";
234
254
  if ("defaultState" in next) next.defaultState = "inline";