@lobu/runtime-device 24.8.0 → 24.9.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 (70) hide show
  1. package/dist/component.json +1 -1
  2. package/dist/dependencies.bun.lock +24 -24
  3. package/npm-shrinkwrap.json +179 -175
  4. package/package.json +1 -1
  5. package/vendor/cli/dist/bundled-skills/lobu/SKILL.md +14 -3
  6. package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +27 -0
  7. package/vendor/cli/dist/commands/_lib/apply/client.d.ts +16 -5
  8. package/vendor/cli/dist/commands/_lib/apply/client.js +31 -9
  9. package/vendor/cli/dist/commands/_lib/apply/deployment.d.ts +8 -12
  10. package/vendor/cli/dist/commands/_lib/apply/deployment.js +14 -1
  11. package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +8 -4
  12. package/vendor/cli/dist/commands/_lib/apply/desired-state.js +2 -1
  13. package/vendor/cli/dist/commands/_lib/apply/diff.d.ts +26 -7
  14. package/vendor/cli/dist/commands/_lib/apply/diff.js +101 -30
  15. package/vendor/cli/dist/commands/_lib/apply/map-config.js +29 -2
  16. package/vendor/cli/dist/commands/_lib/apply/render.js +2 -0
  17. package/vendor/cli/dist/commands/_lib/apply/shared.d.ts +20 -0
  18. package/vendor/cli/dist/commands/_lib/apply/shared.js +22 -0
  19. package/vendor/cli/dist/commands/_lib/init-from-org/bootstrap.js +14 -0
  20. package/vendor/cli/dist/commands/memory/_lib/seed-cmd.js +6 -2
  21. package/vendor/cli/dist/config/define.d.ts +21 -3
  22. package/vendor/cli/dist/connectors/README.md +6 -2
  23. package/vendor/cli/dist/connectors/github.ts +16 -3
  24. package/vendor/cli/dist/connectors/market_quotes.ts +388 -91
  25. package/vendor/cli/dist/connectors/postgres.ts +21 -14
  26. package/vendor/cli/dist/connectors/x-dm-adapter.js +55 -21
  27. package/vendor/cli/dist/connectors/x.ts +1 -1
  28. package/vendor/cli/dist/runtime-components.json +4 -4
  29. package/vendor/cli/package.json +1 -1
  30. package/vendor/connector-sdk/dist/connector-types.d.ts +23 -2
  31. package/vendor/connector-sdk/package.json +1 -1
  32. package/vendor/connector-worker/dist/daemon/automation.js +7 -4
  33. package/vendor/connector-worker/dist/executor/isolate.js +3 -0
  34. package/vendor/connector-worker/package.json +1 -1
  35. package/vendor/core/dist/classify-error.d.ts +3 -4
  36. package/vendor/core/dist/classify-error.js +8 -8
  37. package/vendor/core/dist/contracts/tools/collection-presentation.d.ts +17 -1
  38. package/vendor/core/dist/contracts/tools/collection-presentation.js +27 -3
  39. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +39 -0
  40. package/vendor/core/dist/contracts/tools/manage-automations.js +11 -1
  41. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +1 -1
  42. package/vendor/core/dist/contracts/tools/manage-views.d.ts +249 -7
  43. package/vendor/core/dist/contracts/tools/manage-views.js +83 -21
  44. package/vendor/core/dist/contracts/tools/navigation.d.ts +248 -0
  45. package/vendor/core/dist/contracts/tools/navigation.js +284 -0
  46. package/vendor/core/dist/contracts/tools/view-attach.d.ts +7 -0
  47. package/vendor/core/dist/contracts/tools/view-attach.js +15 -0
  48. package/vendor/core/dist/contracts/tools/view-content-hash.d.ts +4 -1
  49. package/vendor/core/dist/contracts/tools/view-content-hash.js +4 -2
  50. package/vendor/core/dist/contracts/tools/view-definition.d.ts +2 -0
  51. package/vendor/core/dist/contracts/tools/view-definition.js +52 -0
  52. package/vendor/core/dist/contracts/tools/view-host.d.ts +68 -0
  53. package/vendor/core/dist/contracts/tools/view-host.js +28 -1
  54. package/vendor/core/dist/contracts/tools/view-scope.d.ts +31 -0
  55. package/vendor/core/dist/contracts/tools/view-scope.js +45 -0
  56. package/vendor/core/dist/errors.d.ts +17 -24
  57. package/vendor/core/dist/errors.js +17 -24
  58. package/vendor/core/dist/types.d.ts +0 -6
  59. package/vendor/core/package.json +11 -1
  60. package/vendor/views/dist/api.d.ts +30 -5
  61. package/vendor/views/dist/api.js +22 -8
  62. package/vendor/views/dist/bridge.d.ts +17 -0
  63. package/vendor/views/dist/bridge.js +49 -1
  64. package/vendor/views/dist/components.d.ts +27 -5
  65. package/vendor/views/dist/components.js +57 -7
  66. package/vendor/views/dist/embed.d.ts +98 -0
  67. package/vendor/views/dist/embed.js +418 -0
  68. package/vendor/views/dist/index.d.ts +3 -1
  69. package/vendor/views/dist/index.js +1 -0
  70. package/vendor/views/package.json +1 -1
@@ -13,7 +13,7 @@
13
13
  * "2.0", method, params }`. Anything else in the inbox is ignored, exactly
14
14
  * like the SDK's transport.
15
15
  */
16
- import { VIEW_OPEN_RECORD_METHOD, VIEW_WORKSPACE_META_KEY, } from "@lobu/core/contracts/tools/view-host";
16
+ import { VIEW_EMBED_FOCUS_NOTIFICATION, VIEW_EMBED_SIZE_NOTIFICATION, VIEW_EMBEDS_FOCUS_METHOD, VIEW_EMBEDS_SYNC_METHOD, VIEW_FOCUS_ENTER_NOTIFICATION, VIEW_OPEN_RECORD_METHOD, VIEW_WORKSPACE_META_KEY, } from "@lobu/core/contracts/tools/view-host";
17
17
  export class ViewBridgeError extends Error {
18
18
  code;
19
19
  constructor(message, code) {
@@ -54,6 +54,9 @@ export class ViewBridge {
54
54
  toolCancelledListeners = new Set();
55
55
  hostContextListeners = new Set();
56
56
  dataChangedListeners = new Set();
57
+ embedSizeListeners = new Set();
58
+ embedFocusListeners = new Set();
59
+ focusEnterListeners = new Set();
57
60
  /** Set by the first `tool-input` and never cleared: queries must not fire
58
61
  * before it (the host seeds scope + params there; anything read earlier
59
62
  * runs against defaults and double-fetches). */
@@ -132,6 +135,30 @@ export class ViewBridge {
132
135
  this.dataChangedListeners.add(listener);
133
136
  return () => this.dataChangedListeners.delete(listener);
134
137
  }
138
+ /** A child view's height in a slot (Lobu web host only). */
139
+ onEmbedSize(listener) {
140
+ this.embedSizeListeners.add(listener);
141
+ return () => this.embedSizeListeners.delete(listener);
142
+ }
143
+ /** Keyboard focus left a slot's child (Lobu web host only). */
144
+ onEmbedFocus(listener) {
145
+ this.embedFocusListeners.add(listener);
146
+ return () => this.embedFocusListeners.delete(listener);
147
+ }
148
+ /** Keyboard focus entered this view as a slot's child (Lobu web host only). */
149
+ onFocusEnter(listener) {
150
+ this.focusEnterListeners.add(listener);
151
+ return () => this.focusEnterListeners.delete(listener);
152
+ }
153
+ /** Report every slot on screen. Rejects with code -32601 on a host that
154
+ * does not mount embedded views. */
155
+ syncEmbeds(embeds) {
156
+ return this.request(VIEW_EMBEDS_SYNC_METHOD, { embeds });
157
+ }
158
+ /** Move keyboard focus into a slot's child. */
159
+ focusEmbed(id, direction) {
160
+ return this.request(VIEW_EMBEDS_FOCUS_METHOD, { id, direction });
161
+ }
135
162
  /**
136
163
  * Run the `ui/initialize` handshake, then announce readiness. Resolves with
137
164
  * the host context. Rejects when the host answers with an error or stays
@@ -354,6 +381,27 @@ export class ViewBridge {
354
381
  listener();
355
382
  break;
356
383
  }
384
+ case VIEW_EMBED_SIZE_NOTIFICATION: {
385
+ if (typeof params.id !== "string" || typeof params.height !== "number")
386
+ break;
387
+ for (const listener of [...this.embedSizeListeners])
388
+ listener(params.id, params.height);
389
+ break;
390
+ }
391
+ case VIEW_EMBED_FOCUS_NOTIFICATION: {
392
+ if (typeof params.id !== "string")
393
+ break;
394
+ const direction = params.direction === "backward" ? "backward" : "forward";
395
+ for (const listener of [...this.embedFocusListeners])
396
+ listener(params.id, direction);
397
+ break;
398
+ }
399
+ case VIEW_FOCUS_ENTER_NOTIFICATION: {
400
+ const direction = params.direction === "backward" ? "backward" : "forward";
401
+ for (const listener of [...this.focusEnterListeners])
402
+ listener(direction);
403
+ break;
404
+ }
357
405
  default:
358
406
  break;
359
407
  }
@@ -8,10 +8,11 @@
8
8
  * what the host returns, plus the honest states (`QueryState.loading`,
9
9
  * `.error`, `.errorCode`, `.truncated`) that `useQuery` reports.
10
10
  *
11
- * Styling follows the shell's theme tokens (`--fg`, `--muted`, `--border`,
12
- * `--accent`, `--font`, `--radius`, `--radius-lg`), which derive from the
13
- * host's MCP Apps style variables and flip with its `.dark` class, so kit
14
- * output takes the host's look without configuration. Theme tokens carry
11
+ * Styling follows the shell's theme tokens (shadcn names: `--foreground`,
12
+ * `--muted-foreground` for secondary text, `--muted`/`--accent` for surfaces,
13
+ * `--border`, `--primary`, `--font-sans`, `--radius`, `--radius-lg`), which
14
+ * derive from the host's MCP Apps style variables and flip with its `.dark`
15
+ * class, so kit output takes the host's look without configuration. Theme tokens carry
15
16
  * light-mode fallbacks; pie series and error accents use fixed colors.
16
17
  *
17
18
  * Server-side compile allowlist: this module is pinned beside `react` and
@@ -144,8 +145,29 @@ export declare function Link({ href, children, }: {
144
145
  href: string;
145
146
  children: ReactNode;
146
147
  }): import("react/jsx-runtime").JSX.Element;
147
- export declare function LoadingState({ text }: {
148
+ export interface SkeletonProps {
149
+ /** CSS width; default the full width. */
150
+ width?: number | string;
151
+ /** CSS height; default one line of text. */
152
+ height?: number | string;
153
+ /** Corner radius; default the host's. */
154
+ radius?: number | string;
155
+ }
156
+ /**
157
+ * A placeholder shaped like what is loading: a pulsing block in the host's
158
+ * muted surface colour. Size it like the content it stands for (a figure,
159
+ * a row, a chart) so the page does not jump when the data lands. Purely
160
+ * visual; announce the wait with `LoadingState` or your own `role="status"`.
161
+ */
162
+ export declare function Skeleton({ width, height, radius, }: SkeletonProps): import("react/jsx-runtime").JSX.Element;
163
+ /**
164
+ * A query's loading state, as skeleton lines in the host's style. `text` is
165
+ * what assistive technology announces; `lines` sets how many lines stand in
166
+ * for the content (default 3).
167
+ */
168
+ export declare function LoadingState({ text, lines, }: {
148
169
  text?: string;
170
+ lines?: number;
149
171
  }): import("react/jsx-runtime").JSX.Element;
150
172
  export declare function EmptyState({ title, hint }: {
151
173
  title: string;
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useId, useRef, useState } from "react";
3
3
  import { resolveViewHref, useHost } from "./api.js";
4
- const FONT_STACK = 'var(--font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif)';
4
+ const FONT_STACK = 'var(--font-sans, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif)';
5
5
  const INK = {
6
- color: "var(--fg, #0a0a0a)",
6
+ color: "var(--foreground, #0a0a0a)",
7
7
  fontFamily: FONT_STACK,
8
8
  fontSize: 13,
9
9
  lineHeight: 1.45,
@@ -87,7 +87,7 @@ function PageButton({ disabled, onClick, label, }) {
87
87
  border: "1px solid var(--border, #e5e7eb)",
88
88
  borderRadius: "var(--radius, 6px)",
89
89
  background: "transparent",
90
- color: "var(--fg, #0a0a0a)",
90
+ color: "var(--foreground, #0a0a0a)",
91
91
  padding: "2px 10px",
92
92
  font: "inherit",
93
93
  }, children: label === "Previous page" ? "‹ Prev" : "Next ›" }));
@@ -115,7 +115,7 @@ const FIELD_BOX = {
115
115
  border: "1px solid var(--border, #e5e7eb)",
116
116
  borderRadius: "var(--radius, 6px)",
117
117
  background: "transparent",
118
- color: "var(--fg, #0a0a0a)",
118
+ color: "var(--foreground, #0a0a0a)",
119
119
  padding: "4px 8px",
120
120
  font: "inherit",
121
121
  maxWidth: "100%",
@@ -323,8 +323,58 @@ export function Link({ href, children, }) {
323
323
  /* ------------------------------------------------------------------ */
324
324
  /* Query states — render `useQuery` honestly */
325
325
  /* ------------------------------------------------------------------ */
326
- export function LoadingState({ text = "Loading…" }) {
327
- return (_jsx("p", { role: "status", style: { ...INK, color: "var(--color-text-secondary, #6b7280)" }, children: text }));
326
+ const VISUALLY_HIDDEN = {
327
+ position: "absolute",
328
+ width: 1,
329
+ height: 1,
330
+ overflow: "hidden",
331
+ clip: "rect(0 0 0 0)",
332
+ whiteSpace: "nowrap",
333
+ };
334
+ /** Pulse an element while it is mounted, unless the reader asked for less
335
+ * motion. The kit ships no stylesheet, so the animation runs from script. */
336
+ function usePulse(ref) {
337
+ useEffect(() => {
338
+ const el = ref.current;
339
+ if (!el || typeof el.animate !== "function")
340
+ return;
341
+ if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)
342
+ return;
343
+ const pulse = el.animate([{ opacity: 1 }, { opacity: 0.45 }, { opacity: 1 }], {
344
+ duration: 1600,
345
+ iterations: Number.POSITIVE_INFINITY,
346
+ easing: "ease-in-out",
347
+ });
348
+ return () => pulse.cancel();
349
+ }, [ref]);
350
+ }
351
+ /**
352
+ * A placeholder shaped like what is loading: a pulsing block in the host's
353
+ * muted surface colour. Size it like the content it stands for (a figure,
354
+ * a row, a chart) so the page does not jump when the data lands. Purely
355
+ * visual; announce the wait with `LoadingState` or your own `role="status"`.
356
+ */
357
+ export function Skeleton({ width = "100%", height = 14, radius, }) {
358
+ const ref = useRef(null);
359
+ usePulse(ref);
360
+ return (_jsx("span", { ref: ref, "aria-hidden": "true", style: {
361
+ display: "block",
362
+ width,
363
+ height,
364
+ borderRadius: radius ?? "var(--radius, 6px)",
365
+ background: "var(--muted, #f3f4f6)",
366
+ } }));
367
+ }
368
+ /**
369
+ * A query's loading state, as skeleton lines in the host's style. `text` is
370
+ * what assistive technology announces; `lines` sets how many lines stand in
371
+ * for the content (default 3).
372
+ */
373
+ export function LoadingState({ text = "Loading…", lines = 3, }) {
374
+ const widths = ["72%", "94%", "56%", "84%", "64%"];
375
+ // Fixed placeholder lines: each keeps its position for the whole wait.
376
+ const placeholders = Array.from({ length: Number.isFinite(lines) ? Math.max(1, Math.floor(lines)) : 3 }, (_, i) => ({ id: `line-${i}`, width: widths[i % widths.length] }));
377
+ return (_jsxs("div", { role: "status", style: { display: "grid", gap: 8, padding: "4px 0" }, children: [_jsx("span", { style: VISUALLY_HIDDEN, children: text }), placeholders.map((line) => (_jsx(Skeleton, { width: line.width, height: 12 }, line.id)))] }));
328
378
  }
329
379
  export function EmptyState({ title, hint }) {
330
380
  return (_jsxs("div", { style: { ...INK, color: "var(--color-text-secondary, #6b7280)" }, children: [_jsx("p", { style: { margin: "4px 0" }, children: title }), hint && _jsx("p", { style: { margin: "0 0 4px", fontSize: 12 }, children: hint })] }));
@@ -344,7 +394,7 @@ export function ErrorState({ message, errorCode, onRetry, }) {
344
394
  border: "1px solid var(--border, #e5e7eb)",
345
395
  borderRadius: "var(--radius, 6px)",
346
396
  background: "transparent",
347
- color: "var(--fg, #0a0a0a)",
397
+ color: "var(--foreground, #0a0a0a)",
348
398
  padding: "2px 10px",
349
399
  font: "inherit",
350
400
  }, children: "Retry" }))] }));
@@ -0,0 +1,98 @@
1
+ /**
2
+ * `<EmbeddedView>` — place another registered view inside this one.
3
+ *
4
+ * The child is never rendered by this frame. The slot reports its position
5
+ * to the host (`lobu/embeds/sync`), and the Lobu web host mounts the child as
6
+ * its own sandboxed frame over the slot: its own bundle, its own view key and
7
+ * actions, the visitor's own session. This frame cannot reach into the child,
8
+ * and the child's param changes stay with that one instance — they never
9
+ * reach this view's params, a sibling, or the address bar.
10
+ *
11
+ * Hosts that do not mount embedded views (other MCP Apps hosts) answer
12
+ * -32601, and the slot says so instead of rendering nothing.
13
+ */
14
+ import { type ViewEmbedParams, type ViewEmbedScope, type ViewFocusDirection } from "@lobu/core/contracts/tools/view-host";
15
+ import { type ReactNode, type RefObject } from "react";
16
+ import { type ViewBridge } from "./bridge.js";
17
+ interface SlotEntry {
18
+ view: string;
19
+ scope: ViewEmbedScope;
20
+ params: ViewEmbedParams;
21
+ element: RefObject<HTMLElement | null>;
22
+ enter: RefObject<HTMLElement | null>;
23
+ after: RefObject<HTMLElement | null>;
24
+ }
25
+ type SlotState = {
26
+ kind: "pending";
27
+ } | {
28
+ kind: "mounted";
29
+ height: number | null;
30
+ } | {
31
+ kind: "refused";
32
+ reason: string;
33
+ } | {
34
+ kind: "unsupported";
35
+ };
36
+ /**
37
+ * The slots of one frame. A change that can move a slot — the page's DOM, a
38
+ * resize, any scroll, an image load, a transition or animation — schedules
39
+ * one measurement on the next animation frame; only a changed picture is
40
+ * sent, carrying all slots (the host's answer is the whole picture, never a
41
+ * diff). Nothing polls: with no change there is no work, and motion keeps
42
+ * measuring each frame only until it ends (bounded by `MOTION_LIMIT_MS`).
43
+ */
44
+ export declare class EmbedRegistry {
45
+ private readonly bridge;
46
+ private slots;
47
+ private states;
48
+ private listeners;
49
+ private frame;
50
+ private unsupported;
51
+ private connected;
52
+ private returning;
53
+ /** Set while focus is being placed on entry from the host, so a slot that
54
+ * is itself the first or last stop passes the same direction on. */
55
+ arrival: ViewFocusDirection | null;
56
+ constructor(bridge: () => ViewBridge | null);
57
+ /** Wire the host's notifications; returns the teardown. */
58
+ attach(bridge: ViewBridge): () => void;
59
+ private observer;
60
+ /** Transitions/animations running now, and when to stop trusting the count. */
61
+ private moving;
62
+ private motionUntil;
63
+ /** The last picture sent; an identical one is not sent again. */
64
+ private sent;
65
+ setConnected(connected: boolean): void;
66
+ register(id: string, entry: SlotEntry): () => void;
67
+ /** Keyboard focus reached the slot: hand it to the child, unless it is
68
+ * coming back out of the child the other way. */
69
+ enter(id: string, direction: ViewFocusDirection): void;
70
+ state(id: string): SlotState;
71
+ subscribe: (listener: () => void) => (() => void);
72
+ private setState;
73
+ schedule(): void;
74
+ private sync;
75
+ }
76
+ /** Installed by the view runtime's provider. */
77
+ export declare function EmbedProvider({ registry, children, }: {
78
+ registry: EmbedRegistry;
79
+ children: ReactNode;
80
+ }): import("react/jsx-runtime").JSX.Element;
81
+ export interface EmbeddedViewProps {
82
+ /** Key of the view to show; it is registered and authorized on its own. */
83
+ view: string;
84
+ /** The child's scope. Omit for a workspace view. */
85
+ scope?: ViewEmbedScope;
86
+ /** The child's starting params. A change here resets the instance to them;
87
+ * the child's own changes stay local to it. */
88
+ params?: Record<string, string | number | boolean>;
89
+ /** Stable instance id; defaults to the slot's position in the tree. */
90
+ id?: string;
91
+ /** Accessible name of the slot. */
92
+ title?: string;
93
+ /** Height reserved until the child reports its own. */
94
+ minHeight?: number;
95
+ }
96
+ export declare function EmbeddedView({ view, scope, params, id: explicitId, title, minHeight, }: EmbeddedViewProps): import("react/jsx-runtime").JSX.Element;
97
+ export {};
98
+ //# sourceMappingURL=embed.d.ts.map