@lobu/runtime-device 24.8.0 → 24.10.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 (110) hide show
  1. package/dist/component.json +1 -1
  2. package/dist/dependencies.bun.lock +36 -34
  3. package/npm-shrinkwrap.json +228 -207
  4. package/package.json +1 -1
  5. package/vendor/cli/dist/bundled-skills/lobu/SKILL.md +17 -3
  6. package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +31 -4
  7. package/vendor/cli/dist/commands/_lib/apply/client.d.ts +37 -22
  8. package/vendor/cli/dist/commands/_lib/apply/client.js +63 -43
  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/dev.js +2 -0
  21. package/vendor/cli/dist/commands/memory/_lib/seed-cmd.js +6 -2
  22. package/vendor/cli/dist/config/define.d.ts +21 -3
  23. package/vendor/cli/dist/connectors/README.md +6 -2
  24. package/vendor/cli/dist/connectors/github.ts +16 -3
  25. package/vendor/cli/dist/connectors/market_quotes.ts +388 -91
  26. package/vendor/cli/dist/connectors/postgres.ts +60 -38
  27. package/vendor/cli/dist/connectors/whatsapp-web-adapter.js +41 -10
  28. package/vendor/cli/dist/connectors/whatsapp-web-helpers.ts +12 -2
  29. package/vendor/cli/dist/connectors/whatsapp_web.ts +18 -2
  30. package/vendor/cli/dist/connectors/x-dm-adapter.js +55 -21
  31. package/vendor/cli/dist/connectors/x.ts +1 -1
  32. package/vendor/cli/dist/internal/context.d.ts +5 -0
  33. package/vendor/cli/dist/internal/context.js +23 -9
  34. package/vendor/cli/dist/runtime-components.json +4 -4
  35. package/vendor/cli/package.json +1 -1
  36. package/vendor/connector-sdk/dist/connector-types.d.ts +29 -2
  37. package/vendor/connector-sdk/dist/index.d.ts +1 -0
  38. package/vendor/connector-sdk/dist/index.js +1 -0
  39. package/vendor/connector-sdk/dist/ip-reachability.d.ts +1 -1
  40. package/vendor/connector-sdk/dist/ip-reachability.js +1 -1
  41. package/vendor/connector-sdk/dist/logger.d.ts +1 -1
  42. package/vendor/connector-sdk/dist/logger.js +1 -1
  43. package/vendor/connector-sdk/dist/reaction-client-types.d.ts +3 -1
  44. package/vendor/connector-sdk/dist/retry.d.ts +1 -1
  45. package/vendor/connector-sdk/dist/retry.js +1 -1
  46. package/vendor/connector-sdk/dist/source-withheld-error.d.ts +16 -0
  47. package/vendor/connector-sdk/dist/source-withheld-error.js +19 -0
  48. package/vendor/connector-sdk/package.json +1 -1
  49. package/vendor/connector-worker/dist/daemon/automation.js +7 -4
  50. package/vendor/connector-worker/dist/daemon/index.d.ts +1 -0
  51. package/vendor/connector-worker/dist/daemon/index.js +1 -0
  52. package/vendor/connector-worker/dist/daemon/terminal-delivery.d.ts +12 -2
  53. package/vendor/connector-worker/dist/daemon/terminal-delivery.js +19 -12
  54. package/vendor/connector-worker/dist/executor/interface.d.ts +10 -0
  55. package/vendor/connector-worker/dist/executor/interface.js +6 -0
  56. package/vendor/connector-worker/dist/executor/isolate.d.ts +1 -0
  57. package/vendor/connector-worker/dist/executor/isolate.js +88 -24
  58. package/vendor/connector-worker/dist/isolate/prelude.js +5 -0
  59. package/vendor/connector-worker/package.json +1 -1
  60. package/vendor/core/dist/classify-error.d.ts +4 -5
  61. package/vendor/core/dist/classify-error.js +10 -10
  62. package/vendor/core/dist/contracts/tools/collection-presentation.d.ts +17 -1
  63. package/vendor/core/dist/contracts/tools/collection-presentation.js +27 -3
  64. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +67 -3
  65. package/vendor/core/dist/contracts/tools/manage-automations.js +38 -9
  66. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +1 -1
  67. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +8 -0
  68. package/vendor/core/dist/contracts/tools/manage-entity.js +11 -3
  69. package/vendor/core/dist/contracts/tools/manage-views.d.ts +249 -7
  70. package/vendor/core/dist/contracts/tools/manage-views.js +83 -21
  71. package/vendor/core/dist/contracts/tools/navigation.d.ts +248 -0
  72. package/vendor/core/dist/contracts/tools/navigation.js +284 -0
  73. package/vendor/core/dist/contracts/tools/save-memory.d.ts +11 -1
  74. package/vendor/core/dist/contracts/tools/save-memory.js +25 -3
  75. package/vendor/core/dist/contracts/tools/search-memory.js +1 -1
  76. package/vendor/core/dist/contracts/tools/view-attach.d.ts +7 -0
  77. package/vendor/core/dist/contracts/tools/view-attach.js +15 -0
  78. package/vendor/core/dist/contracts/tools/view-content-hash.d.ts +4 -1
  79. package/vendor/core/dist/contracts/tools/view-content-hash.js +4 -2
  80. package/vendor/core/dist/contracts/tools/view-definition.d.ts +2 -0
  81. package/vendor/core/dist/contracts/tools/view-definition.js +52 -0
  82. package/vendor/core/dist/contracts/tools/view-host.d.ts +68 -0
  83. package/vendor/core/dist/contracts/tools/view-host.js +28 -1
  84. package/vendor/core/dist/contracts/tools/view-scope.d.ts +31 -0
  85. package/vendor/core/dist/contracts/tools/view-scope.js +45 -0
  86. package/vendor/core/dist/credentials.d.ts +12 -0
  87. package/vendor/core/dist/credentials.js +1 -0
  88. package/vendor/core/dist/errors.d.ts +17 -24
  89. package/vendor/core/dist/errors.js +19 -26
  90. package/vendor/core/dist/types.d.ts +0 -6
  91. package/vendor/core/dist/worker/auth.d.ts +5 -0
  92. package/vendor/core/dist/worker/auth.js +15 -4
  93. package/vendor/core/package.json +11 -1
  94. package/vendor/postgres/cf/src/connection.js +7 -2
  95. package/vendor/postgres/cjs/src/connection.js +7 -2
  96. package/vendor/postgres/src/connection.js +7 -2
  97. package/vendor/views/dist/api.d.ts +30 -5
  98. package/vendor/views/dist/api.js +22 -8
  99. package/vendor/views/dist/bridge.d.ts +17 -0
  100. package/vendor/views/dist/bridge.js +49 -1
  101. package/vendor/views/dist/components.d.ts +27 -5
  102. package/vendor/views/dist/components.js +57 -7
  103. package/vendor/views/dist/embed.d.ts +98 -0
  104. package/vendor/views/dist/embed.js +418 -0
  105. package/vendor/views/dist/index.d.ts +3 -1
  106. package/vendor/views/dist/index.js +1 -0
  107. package/vendor/views/dist/native.d.ts +33 -1
  108. package/vendor/views/dist/native.js +3 -0
  109. package/vendor/views/package.json +1 -1
  110. /package/vendor/postgres/{.bun-tag-c81dacd34e959a7a → .bun-tag-652f2580b8090d71} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/runtime-device",
3
- "version": "24.8.0",
3
+ "version": "24.10.0",
4
4
  "type": "module",
5
5
  "license": "BUSL-1.1",
6
6
  "repository": {
@@ -167,6 +167,8 @@ export default defineConfig({
167
167
 
168
168
  The entity schema also renders the record page form. Give every array `items` and every object `properties` (bare ones render as raw JSON), put the label in `title` and help text in `description`, mark derived fields `readOnly: true`, and declare every field an Automation writes.
169
169
 
170
+ For a "when did this field last change" timestamp, declare root `metadata_schema["x-lobu-stamps"]: { "stage_at": "stage" }` instead of writing it from an Automation. The stamp field must be a declared `{ type: "string", format: "date-time" }` property (not listed in `required`) and the tracked field a declared property. Every writer (agent, SDK, Automation, connector projection, view action, approval) then gets it for free: the server sets `stage_at` when a record is created with `stage` set or when `stage` changes value, and discards any value a caller sends for `stage_at`. `readOnly` alone is presentation only; it is not enforced.
171
+
170
172
  Seed data records still live as YAML under `./data`. Then seed or operate the memory workspace with:
171
173
 
172
174
  ```bash
@@ -242,7 +244,7 @@ Before authoring UI, inspect available native entity/event pages, existing views
242
244
  2. If that surface cannot meet a concrete requirement, compose its exported parts, such as an individual table, board, graph or shared collection controls when available. Preserve shared selection and action handling instead of rebuilding that logic.
243
245
  3. If those parts still do not fit, use smaller shared primitives and write custom UI only for the remaining gap. Explain the unmet requirement that forced each step down.
244
246
 
245
- Check the current exports and target host before choosing an import; native renderer registrations do not imply React exports. Surface a missing export as a platform gap rather than inventing an API or silently copying the native implementation. `@lobu/views/components` currently supplies theme-aware defaults such as `Card`, `DataTable`, filters, charts, links and query-state components. When exploration needs specialized linked charts, drilldowns, scenario controls or Canvas/SVG, compose a React view from the suitable existing components.
247
+ Check the current exports and target host before choosing an import; native renderer registrations do not imply React exports. Surface a missing export as a platform gap rather than inventing an API or silently copying the native implementation. `@lobu/views/components` currently supplies theme-aware defaults such as `Card`, `DataTable`, filters, charts, links and query-state components. `LoadingState` draws skeleton lines in the host's style; `Skeleton` is a pulsing block to size like the content it stands for (a figure, a row, a chart), so a slow read keeps the page's shape instead of showing text. When exploration needs specialized linked charts, drilldowns, scenario controls or Canvas/SVG, compose a React view from the suitable existing components.
246
248
 
247
249
  Native JSON templates use the target renderer's registered component names and overrides; inspect what that host actually supplies. React views compose imported components in their own bundle, independently of that native renderer map.
248
250
 
@@ -298,7 +300,9 @@ export default function Pipeline() {
298
300
  }
299
301
  ```
300
302
 
301
- `defineView` is the view's only declaration: `key`, optional `name` (defaults to the key) and `description`, `attach`, `params` and `actions` are read from it, never passed separately. `views.set` always requires `source_code` containing the entrypoint module, including when retaining multiple files. Write `defineView` out as a literal (no variables, spreads or `${}` templates): the server reads it without running the module.
303
+ `defineView` is the view's only declaration: `key`, optional `name` (defaults to the key) and `description`, `attach`, `params`, `actions` and `resources` are read from it, never passed separately. `views.set` always requires `source_code` containing the entrypoint module, including when retaining multiple files. Write `defineView` out as a literal (no variables, spreads or `${}` templates): the server reads it without running the module.
304
+
305
+ A view makes no network requests of its own; data comes through `useQuery`. The one exception is images: `resources: ["https://tile.openstreetmap.org"]` declares origins the view may load images (map tiles, logos) from. Each entry is a bare `https://` origin with a public hostname (no path, wildcard, localhost or IP), at most 8. The images-only limit is a save-time check: `views.set` renders the view's empty, error and loading states in an offline browser and refuses the save if anything other than an image from a declared origin is requested. It is not enforced at runtime. MCP hosts receive the origins as the MCP Apps `resourceDomains` CSP, which allows scripts, styles, fonts and media from them as well as images, and the Lobu web app applies no runtime CSP to views. Declare only image or tile CDN origins you trust. Hosts that render through the generic `ui://lobu/views` loader use its CSP, which declares no image origins, so declared images may not load there.
302
306
 
303
307
  For a multi-file view, `files` maps relative paths to complete source strings and `entrypoint` names the view module. Include all three inputs below; `source_code` must exactly equal `files[entrypoint]`:
304
308
 
@@ -324,6 +328,7 @@ Import reusable UI from **`@lobu/views/components`**. Discover this kit with `se
324
328
  | SQL, computed TypeScript or local rows | `EntityListPage title={title}` with `DataTable columns={columns} rows={rows} keyOf={keyOf}` as children |
325
329
  | Complete record body | `EntityRecordPage entity={entity} owner={workspace} schema={schema}` |
326
330
  | Entity table or individual fields | `EntityTableView`, `RecordSpecSheet`, `SchemaValue`, `EntityAvatar` |
331
+ | Workspace schema, proposed schema or schema diff | `SchemaGraph`, `SchemaGraph schema={spec}`, `SchemaGraph schema={spec} base="workspace"`, or `SchemaGraph schema={after} base={before}` |
327
332
  | Saved resource identity and navigation | `AutomationReference`, `AgentReference`, `ConnectorReference` |
328
333
  | Automation instructions, sources, triggers, outputs and code | `AutomationDefinition value={definition}` |
329
334
  | Agent identity, models and settings | `AgentDefinition value={definition}` |
@@ -335,6 +340,8 @@ The host supplies native JS/CSS, React and live theme. Do not copy product marku
335
340
 
336
341
  **Page bodies are controlled.** Supply data and slots; they fetch nothing and authorize no writes. `EntityListPage` accepts `title`, optional `actions`/`controls`, and either `table: EntityTableViewProps` or `children`. Its `loading`, `error`, `onRetry` and `empty` affect only results, keeping controls mounted. Native table props include rows, schema, linked lookups, sorting and pagination; honor `metadata.has_more`. For SQL/TypeScript rows use `DataTable`, without inventing entity IDs or types. `EntityRecordPage` renders the native title/avatar and schema fields; `actions`, `details`, `summary`, and `children` supply editing, links, activity and tabs. Default `layout="record"` adapts to width; `layout="content"` retains the header while children own the layout. A `null` title/details/summary hides that slot. Preserve zero and false.
337
342
 
343
+ **SchemaGraph is read-only.** It reuses the native schema canvas. Omit props for the mounted workspace schema, pass `schema` for a supplied snapshot, add `base="workspace"` to compare a proposal with the live workspace, or pass another spec as `base`. A spec is `{ entityTypes: [{ slug, name?, description?, metadata_schema?, event_kinds? }], relationshipTypes: [{ slug, name?, metadata_schema?, rules: [{ source_entity_type_slug, target_entity_type_slug }] }] }`. Specs are full snapshots: an omitted type is removed in a diff. Added, removed and changed types/rules remain visible; inspect type details for metadata fields, event kinds and rule changes. Existing entity types open their native pages; unsaved types show details in place. Live reads use the visiting user’s session and permissions through the existing broker; supplied snapshots still render when workspace reads are unavailable. No edits or schema writes are performed. The leaf names match `entitySchema`: list responses use `entity_types` / `relationship_types`; attach `listRules` results to the matching relationship by ID. To apply a reviewed spec, use existing `createType` / `createRelType` (both require `name`) and `addRule({ slug, ...rule })` separately. The graph’s optional name falls back to slug for display only. Hosts without native components throw the standard unavailable-native error.
344
+
338
345
  **References resolve saved identity.** Pass `mode="live"`, mounted `workspace`, optional `appearance="inline" | "row"` (default row), and `automationId` (positive decimal string), `agentId`, or `connectorKey` plus optional numeric `connectionId`. Discover IDs first. These reuse product rows and visiting-user permission checks; they accept no authored name/status or mutation callbacks. Invalid selectors, another workspace, missing records and refused reads show unavailable. A connector definition does not imply a connected account. Reads refresh on mount, focus, reconnect and host invalidation, without interval polling.
339
346
 
340
347
  **Definitions render supplied objects.** All three have the same signature: `{ value: Record<string, unknown> }`. Pass the existing saved definition or complete proposed snapshot, not a patch. Automation fields include `name`, `description`, `prompt`, `sources`, `triggers`, `outputs`, `reaction_script`; Agent fields include `name`, `description`, `identity_md`, `settings`; Connector fields include `name`, `description`, `version`, `actions_schema`, `feeds_schema`, `source_code`. Remaining nested settings stay inspectable. Missing fields differ from empty values. Bodies fetch nothing, execute no supplied code, and add no save/approval controls. Label authored objects as Snapshot or Proposal preview; use a reference for live identity. Never supply credentials.
@@ -368,7 +375,14 @@ Rules that are load-bearing, not style:
368
375
 
369
376
  - Use structured reads: `useQuery(tool("manage_entity", { action: "list", entity_type: type, filters, limit: 100 }))`. The host admits entity `list/get/list_links` and entity-type schema `list/get` reads; tools marked read-only are also available. Use existing tool input/result contracts and preserve server authorization. Send structured arguments, never TypeScript inside a string. `sql` remains available; script-string queries are compatibility support for installed views. `query_sql` allows 500 rows max with a 5 second timeout — branch on the typed `errorCode` (e.g. `UPSTREAM_TIMEOUT`), never on message text, and render `truncated` honestly instead of passing partial data off as complete. Each `query_sql` cell is bounded too: strings keep their first 4,000 Unicode code points plus "… [truncated]"; JSON values over 16 KiB become `{ _truncated: true, bytes }` (attachments become null with `attachments_truncated`). `truncatedColumns` names the affected columns. Select smaller elements or fields, for example one array element per row with `jsonb_array_elements(...)`, and paginate as needed; each returned cell is still subject to these limits.
370
377
  - Never aggregate history in a view: no `GROUP BY`, `DISTINCT ON`, per-row regexp, or leading-wildcard `LIKE` over `events` or other growing tables. For "latest state" views, have an Automation maintain keyed event outputs (each run supersedes the previous event with the same key) and read the current head with `read_knowledge`.
371
- - `run_sdk` is not exposed to views. Writes go only through declared view actions (`useAction` → `invoke_view_action`), which emit the declared event kind and can activate workspace-triggered Automations. Action `value` payloads are capped at 4000 JSON chars — save content first, then pass the id. A subject shown from a superseded event rejects with 409; refetch and ask the user to re-confirm rather than retrying blindly.
378
+ - `run_sdk` is not exposed to views. Writes go only through declared view actions (`useAction` → `invoke_view_action`). An action declares `emits` (append that event kind, which can activate workspace-triggered Automations), `updates: { entityType, fields }` (write those metadata fields on one record), or both, which commit in one transaction. An `updates` action takes `value: { entity_id, set: { field: value } }`; the view must attach to `entityType`, `set` may only name declared fields, and schema-stamped fields are refused. Pass `{ expected }` as the second argument with the values the view read: a stale read returns 409 `PRECONDITION_FAILED` and writes nothing. The write runs as the clicking user without claiming field ownership, so a human-owned field comes back as `pending_approval` instead of `applied`. Do not add an Automation that only copies an action's event onto the record; declare `updates` instead. Action `value` payloads are capped at 4000 JSON chars — save content first, then pass the id. A subject shown from a superseded event rejects with 409; refetch and ask the user to re-confirm rather than retrying blindly.
379
+
380
+ ```tsx
381
+ // actions: { markWon: { emits: "deal.won", updates: { entityType: "deal", fields: ["stage"] } } }
382
+ const markWon = useAction("markWon");
383
+ const sent = await markWon({ entity_id: deal.id, set: { stage: "won" } }, { expected: { stage: deal.metadata.stage } });
384
+ // sent.result.applied: { entity_id, fields } with server stamps; sent.result.pending_approval when held
385
+ ```
372
386
  - Link with `Link` from `@lobu/views/components` (or `useHost().openLink`): `href="<type>/<slug>"` opens that record in the workspace, supported links within the same workspace open in the peek pane, other app links navigate normally, and external URLs open a new tab. A plain `<a href>` goes nowhere inside the sandboxed frame.
373
387
  - For several offers, publish one event with a card for each held proposal. Obtain the real pending approval through the existing agent/Automation write method under its normal policy, then read its returned event ID to obtain the canonical review URL. Link each card to that exact review; the host opens it in peek. Each offer has its own run and decision. Use native Current/Proposed fields for updates and the proposed definition for creation. A resource snapshot alone is a preview, not an approval: never fabricate Approve/Reject buttons or imply that a missing resource ID creates anything. Existing settings `?run_id=` links remain compatible; new offers use the proposal review instead of the settings page.
374
388
  - Views run in a sandboxed frame with no direct network: no fetch, no third-party calls at runtime. Reuse local React components through relative imports and `source_files: { entrypoint, files }` plus `dependencies: {}` for local-only components with `views.set`, or use `viewFromFile` + `lobu apply`. Extra npm dependencies need the CLI-bundled `compiled_code`; listing `dependencies` alone does not install packages.
@@ -262,6 +262,11 @@ export async function fetchRemoteSnapshot(client, state, only, prune = false) {
262
262
  // Views are org-scoped modules (neither agents nor memory): a full apply
263
263
  // reconciles them against `manage_views list` (metadata only).
264
264
  const views = only === undefined ? await client.listViews() : [];
265
+ // Navigation is read only when the config manages it: its revision is the
266
+ // compare-and-swap token the write presents.
267
+ const navigation = only === undefined && state.navigation !== undefined
268
+ ? await client.getNavigation()
269
+ : undefined;
265
270
  return {
266
271
  agents,
267
272
  agentSettings,
@@ -274,6 +279,7 @@ export async function fetchRemoteSnapshot(client, state, only, prune = false) {
274
279
  feedsByConnectionId,
275
280
  inferenceProviders,
276
281
  views,
282
+ ...(navigation ? { navigation } : {}),
277
283
  };
278
284
  }
279
285
  // ── Connector definition install (runs INSIDE executePlan, after confirm) ──
@@ -514,7 +520,7 @@ export async function executePlan(ctx, pendingAuth) {
514
520
  for (const row of rowsByKind("entity-type")) {
515
521
  if (row.kind !== "entity-type")
516
522
  continue;
517
- if (!row.desired)
523
+ if (!row.desired || row.verb === "delete")
518
524
  continue;
519
525
  // The upsert rebuilds `metadata_schema` from the config's flat properties/
520
526
  // required, so hand it the live type's out-of-band top-level keys (e.g.
@@ -533,7 +539,7 @@ export async function executePlan(ctx, pendingAuth) {
533
539
  [...clearFacets].some((f) => f.startsWith("properties."))) {
534
540
  clearFacets.add("properties");
535
541
  }
536
- await ctx.client.upsertEntityType(row.desired, row.remote?.schemaExtras, {
542
+ await ctx.client.upsertEntityType(row.verb, row.desired, row.remote?.schemaExtras, {
537
543
  properties: row.remote?.properties,
538
544
  required: row.remote?.required,
539
545
  }, clearFacets,
@@ -547,9 +553,9 @@ export async function executePlan(ctx, pendingAuth) {
547
553
  for (const row of rowsByKind("relationship-type")) {
548
554
  if (row.kind !== "relationship-type")
549
555
  continue;
550
- if (!row.desired)
556
+ if (!row.desired || row.verb === "delete")
551
557
  continue;
552
- await ctx.client.upsertRelationshipType(row.desired);
558
+ await ctx.client.upsertRelationshipType(row.verb, row.desired);
553
559
  printText(renderProgress(row.verb, "relationship-type", row.id));
554
560
  }
555
561
  // 2) Connector definitions — install/update them, refetch the catalog, then
@@ -583,6 +589,23 @@ export async function executePlan(ctx, pendingAuth) {
583
589
  printText(renderProgress(row.verb, "view", row.id, `${result.written ? "(pushed" : "(unchanged"}, ${kb} KB)`));
584
590
  printText(chalk.dim(` → ${ctx.apiBaseUrl}/api/${ctx.orgSlug}/views/${row.id}/shell`));
585
591
  }
592
+ // 2c) Navigation — after views, since its targets must resolve when saved.
593
+ // The write presents the revision this apply read; anyone else's edit
594
+ // in between fails it (409) rather than being overwritten.
595
+ for (const row of rowsByKind("navigation")) {
596
+ if (row.kind !== "navigation")
597
+ continue;
598
+ try {
599
+ const result = await ctx.client.setNavigation(row.revision, row.desired);
600
+ printText(renderProgress(row.verb, "navigation", row.id, `(revision ${result.revision})`));
601
+ }
602
+ catch (error) {
603
+ if (error instanceof ApiError && error.status === 409) {
604
+ throw new Error(`Workspace navigation changed since this apply read it (revision ${row.revision}). Run lobu apply again to plan against the current document.`);
605
+ }
606
+ throw error;
607
+ }
608
+ }
586
609
  // 3) Agents
587
610
  for (const row of rowsByKind("agent")) {
588
611
  if (row.kind !== "agent")
@@ -1219,6 +1242,10 @@ async function applyProject(opts, prepared) {
1219
1242
  return baselineRecord ?? undefined;
1220
1243
  }
1221
1244
  const built = buildAttributionAndOwned(state, snapshot, resolvedOrg?.id, prune);
1245
+ // Navigation is full-apply only: a partial run keeps the last record.
1246
+ if (opts.only !== undefined && baselineRecord?.attribution.navigation) {
1247
+ built.attribution.navigation = baselineRecord.attribution.navigation;
1248
+ }
1222
1249
  if (opts.only === "memory" && baselineRecord) {
1223
1250
  built.owned = [
1224
1251
  ...built.owned,
@@ -1,3 +1,4 @@
1
+ import type { NavigationConfig } from "@lobu/core/contracts/tools/navigation";
1
2
  import type { EntityMetrics } from "@lobu/connector-sdk";
2
3
  import { type AgentSettings } from "@lobu/core";
3
4
  import type { FlatActionInput } from "@lobu/core/contracts/tools/action-input";
@@ -10,7 +11,7 @@ import type { ViewSetInput } from "@lobu/core/contracts/tools/manage-views";
10
11
  import { ApiError } from "../../memory/_lib/errors.js";
11
12
  import type { DeploymentSummary } from "./deployment.js";
12
13
  import type { DesiredAgentMetadata, DesiredEntityType, DesiredRelationshipType } from "./desired-state.js";
13
- import { type AutomationSource, type EntityBacking, type RelationshipRule } from "./shared.js";
14
+ import { type AutomationSource, type EntityBacking, type EntityTypeDisplayFields, type RelationshipRule } from "./shared.js";
14
15
  export interface RemoteAgent {
15
16
  agentId: string;
16
17
  name: string;
@@ -53,12 +54,10 @@ export interface DeploymentPauseState {
53
54
  rollbackOf?: string | null;
54
55
  pausedBy?: string | null;
55
56
  }
56
- export interface RemoteEntityType {
57
+ export interface RemoteEntityType extends EntityTypeDisplayFields {
57
58
  /** Persistent incarnation id (`entity_types.id`) — the `owned` identity for deletes. */
58
59
  id?: number;
59
60
  slug: string;
60
- name?: string;
61
- description?: string;
62
61
  required?: string[];
63
62
  properties?: Record<string, unknown>;
64
63
  /** Event kinds keyed by semantic_type (mirrors {@link DesiredEntityType.eventKinds}); hoisted from the row's `event_kinds`. */
@@ -156,6 +155,8 @@ export interface RemoteAutomation {
156
155
  outputs?: Record<string, unknown> | null;
157
156
  reactions_guidance?: string | null;
158
157
  }
158
+ /** Whether apply creates a schema type or updates the existing one. */
159
+ type SchemaWriteVerb = "create" | "update";
159
160
  interface UpsertEntityTypeResult {
160
161
  created?: boolean;
161
162
  updated?: boolean;
@@ -355,27 +356,43 @@ export declare class ApplyClient {
355
356
  listViews(): Promise<RemoteView[]>;
356
357
  /**
357
358
  * Store a view: source + CLI-bundled browser bundle. The server reads the
358
- * view's key, attach, params and actions from the source. Returns whether a
359
+ * view's key, attach, params, actions and resources from the source. Returns whether a
359
360
  * write happened (same executable artifact is a server-side no-op).
360
361
  */
361
362
  setView(payload: SetViewPayload): Promise<{
362
363
  written: boolean;
363
364
  content_hash: string;
364
365
  }>;
366
+ /**
367
+ * The stored navigation document and its revision. Needs editor access: the
368
+ * raw document is only returned to a caller who could also write it.
369
+ */
370
+ getNavigation(): Promise<{
371
+ revision: number;
372
+ config: NavigationConfig | null;
373
+ }>;
374
+ /** Replace the navigation document; 409 when `expectedRevision` is stale. */
375
+ setNavigation(expectedRevision: number, config: NavigationConfig | null): Promise<{
376
+ revision: number;
377
+ }>;
365
378
  /** Delete an applied view by key (prune-gated removal). */
366
379
  removeView(key: string): Promise<void>;
367
380
  listEntityTypes(): Promise<RemoteEntityType[]>;
368
381
  /**
369
382
  * The `manage_entity_schema` admin tool exposes separate `create` / `update`
370
- * actions and surfaces duplicates as a coded 409 (`[entity_type_exists]` /
371
- * `[relationship_type_exists]`). Probe with `create`; on that explicit
372
- * duplicate signal retry with `update`. Any other error (e.g. a 422
373
- * `[invalid_schema]` validation failure) propagates verbatim — retrying it
374
- * as an update used to mask the real message behind "Entity type not
375
- * found" (issue #1177).
383
+ * actions. The plan already knows which one a row needs, so an `update` row
384
+ * goes straight to `update`: probing with `create` first made every apply of
385
+ * an existing type a failed call on the server. A `create` row that meets a
386
+ * duplicate (`[entity_type_exists]` / `[relationship_type_exists]`, 409) was
387
+ * created concurrently after the plan was read, so it is reconciled as an
388
+ * update. Any other error (e.g. a 422 `[invalid_schema]` validation failure)
389
+ * propagates verbatim — retrying it as an update used to mask the real
390
+ * message behind "Entity type not found" (issue #1177).
376
391
  */
377
392
  private upsertSchemaResource;
378
- upsertEntityType(entity: Omit<DesiredEntityType, "metadata">,
393
+ upsertEntityType(
394
+ /** The plan's verb for this row: whether the type exists remotely. */
395
+ verb: SchemaWriteVerb, entity: Omit<DesiredEntityType, "metadata">,
379
396
  /**
380
397
  * The live type's `metadata_schema` extension keys
381
398
  * ({@link RemoteEntityType.schemaExtras}), from the remote snapshot this
@@ -420,7 +437,9 @@ export declare class ApplyClient {
420
437
  listRelationshipTypeRules(slug: string): Promise<Array<RelationshipRule & {
421
438
  id: number;
422
439
  }>>;
423
- upsertRelationshipType(rel: Omit<DesiredRelationshipType, "metadata">): Promise<UpsertEntityTypeResult>;
440
+ upsertRelationshipType(
441
+ /** The plan's verb for this row: whether the type exists remotely. */
442
+ verb: SchemaWriteVerb, rel: Omit<DesiredRelationshipType, "metadata">): Promise<UpsertEntityTypeResult>;
424
443
  /**
425
444
  * Delete an entity type (code-managed prune). The server soft-deletes and
426
445
  * REFUSES if instances of the type still exist — the data is exempt from
@@ -555,18 +574,14 @@ export declare class ApplyClient {
555
574
  updateFeed(feedId: number, payload: UpdateFeedPayload): Promise<RemoteFeed>;
556
575
  }
557
576
  /**
558
- * Recognise duplicate-name errors from the admin tools without substring
559
- * matching the user-facing message. The server stamps a bracketed code into
560
- * the error message of every duplicate path `apply` upserts through
561
- * (`manage_entity_schema` create / add_rule → `[entity_type_exists]`,
562
- * `[relationship_type_exists]`, `[already_exists]`, all httpStatus 409).
577
+ * Recognise duplicate-name errors from the admin tools by status alone. Every
578
+ * duplicate path `apply` upserts through (`manage_entity_schema` create /
579
+ * add_rule) answers 409, and nothing else those calls return does.
563
580
  *
564
581
  * Anything else is NOT a duplicate. In particular a 422 schema-validation
565
582
  * error (`[invalid_schema]`, e.g. ">4 x-table-column fields") must surface
566
- * verbatim — the old status-only fallback treated any 4xx as "already
567
- * exists", retried with `action: update`, and buried the real message under
568
- * a misleading "Entity type not found" (issue #1177). The 409 fallback stays
569
- * as a belt-and-braces signal for duplicate paths that predate the codes.
583
+ * verbatim: the old any-4xx fallback retried with `action: update` and buried
584
+ * the real message under a misleading "Entity type not found" (issue #1177).
570
585
  */
571
586
  export declare function isDuplicateError(err: ApiError): boolean;
572
587
  interface ResolvedClient {
@@ -2,7 +2,7 @@ import { getToolResultFailure, isPendingToolApproval, } from "@lobu/core";
2
2
  import { ApiClient } from "../../../internal/api-client.js";
3
3
  import { resolveApiClient } from "../../../internal/index.js";
4
4
  import { ApiError } from "../../memory/_lib/errors.js";
5
- import { isRecord, } from "./shared.js";
5
+ import { ENTITY_TYPE_DISPLAY_FIELDS, isRecord, } from "./shared.js";
6
6
  // ── Shape predicates ───────────────────────────────────────────────────────
7
7
  /**
8
8
  * Read the first array-valued key from a response body. Endpoints that may
@@ -43,13 +43,15 @@ function hoistEntityTypeSchema(row) {
43
43
  const out = {
44
44
  ...(row.id !== undefined ? { id: row.id } : {}),
45
45
  slug: row.slug,
46
- ...(row.name !== undefined ? { name: row.name } : {}),
47
- ...(row.description !== undefined ? { description: row.description } : {}),
48
46
  // Preserve owning org so prune can skip public types from other orgs.
49
47
  ...(row.organization_id !== undefined
50
48
  ? { organization_id: row.organization_id }
51
49
  : {}),
52
50
  };
51
+ for (const field of ENTITY_TYPE_DISPLAY_FIELDS) {
52
+ if (row[field] !== undefined)
53
+ out[field] = row[field];
54
+ }
53
55
  if (isRecord(schema)) {
54
56
  if (isRecord(schema.properties))
55
57
  out.properties = schema.properties;
@@ -326,7 +328,7 @@ export class ApplyClient {
326
328
  }
327
329
  /**
328
330
  * Store a view: source + CLI-bundled browser bundle. The server reads the
329
- * view's key, attach, params and actions from the source. Returns whether a
331
+ * view's key, attach, params, actions and resources from the source. Returns whether a
330
332
  * write happened (same executable artifact is a server-side no-op).
331
333
  */
332
334
  async setView(payload) {
@@ -339,6 +341,24 @@ export class ApplyClient {
339
341
  content_hash: body.view?.content_hash ?? "",
340
342
  };
341
343
  }
344
+ /**
345
+ * The stored navigation document and its revision. Needs editor access: the
346
+ * raw document is only returned to a caller who could also write it.
347
+ */
348
+ async getNavigation() {
349
+ const { body } = await this.request("POST", `/api/${this.orgSlug}/manage_views`, {
350
+ action: "get_navigation",
351
+ });
352
+ if (body.config === undefined) {
353
+ throw new Error("This login cannot read the workspace navigation document; an owner or admin with admin access manages navigation.");
354
+ }
355
+ return { revision: body.revision ?? 0, config: body.config };
356
+ }
357
+ /** Replace the navigation document; 409 when `expectedRevision` is stale. */
358
+ async setNavigation(expectedRevision, config) {
359
+ const { body } = await this.request("POST", `/api/${this.orgSlug}/manage_views`, { action: "set_navigation", expected_revision: expectedRevision, config });
360
+ return { revision: body.revision ?? expectedRevision + 1 };
361
+ }
342
362
  /** Delete an applied view by key (prune-gated removal). */
343
363
  async removeView(key) {
344
364
  await this.request("POST", `/api/${this.orgSlug}/manage_views`, {
@@ -360,15 +380,27 @@ export class ApplyClient {
360
380
  }
361
381
  /**
362
382
  * The `manage_entity_schema` admin tool exposes separate `create` / `update`
363
- * actions and surfaces duplicates as a coded 409 (`[entity_type_exists]` /
364
- * `[relationship_type_exists]`). Probe with `create`; on that explicit
365
- * duplicate signal retry with `update`. Any other error (e.g. a 422
366
- * `[invalid_schema]` validation failure) propagates verbatim — retrying it
367
- * as an update used to mask the real message behind "Entity type not
368
- * found" (issue #1177).
383
+ * actions. The plan already knows which one a row needs, so an `update` row
384
+ * goes straight to `update`: probing with `create` first made every apply of
385
+ * an existing type a failed call on the server. A `create` row that meets a
386
+ * duplicate (`[entity_type_exists]` / `[relationship_type_exists]`, 409) was
387
+ * created concurrently after the plan was read, so it is reconciled as an
388
+ * update. Any other error (e.g. a 422 `[invalid_schema]` validation failure)
389
+ * propagates verbatim — retrying it as an update used to mask the real
390
+ * message behind "Entity type not found" (issue #1177).
369
391
  */
370
- async upsertSchemaResource(schemaType, payload) {
392
+ async upsertSchemaResource(verb, schemaType, payload) {
371
393
  const url = `/api/${this.orgSlug}/manage_entity_schema`;
394
+ const update = async () => {
395
+ await this.request("POST", url, {
396
+ schema_type: schemaType,
397
+ action: "update",
398
+ ...payload,
399
+ });
400
+ return { updated: true };
401
+ };
402
+ if (verb === "update")
403
+ return update();
372
404
  try {
373
405
  await this.request("POST", url, {
374
406
  schema_type: schemaType,
@@ -378,18 +410,14 @@ export class ApplyClient {
378
410
  return { created: true };
379
411
  }
380
412
  catch (err) {
381
- if (err instanceof ApiError && isDuplicateError(err)) {
382
- await this.request("POST", url, {
383
- schema_type: schemaType,
384
- action: "update",
385
- ...payload,
386
- });
387
- return { updated: true };
388
- }
413
+ if (err instanceof ApiError && isDuplicateError(err))
414
+ return update();
389
415
  throw err;
390
416
  }
391
417
  }
392
418
  async upsertEntityType(
419
+ /** The plan's verb for this row: whether the type exists remotely. */
420
+ verb,
393
421
  // `metadata` is authoring-only — never sent to the server (see
394
422
  // DesiredEntityType); extra properties on the passed value are ignored.
395
423
  entity,
@@ -429,12 +457,14 @@ export class ApplyClient {
429
457
  // `properties`/`required`. Fold them into `metadata_schema` so the schema
430
458
  // actually persists (otherwise every apply re-reports a `properties`
431
459
  // update because the stored schema stays empty).
432
- const { slug, name, description, required, properties, eventKinds, backing, metrics, resolutionPolicy, collection, rulesSource, } = entity;
460
+ const { slug, required, properties, eventKinds, backing, metrics, resolutionPolicy, collection, rulesSource, } = entity;
433
461
  const payload = { slug };
434
- if (name !== undefined)
435
- payload.name = name;
436
- if (description !== undefined)
437
- payload.description = description;
462
+ // Declared display fields only: an omitted one is never sent, so the
463
+ // server keeps whatever it has (e.g. an icon set in the UI).
464
+ for (const field of ENTITY_TYPE_DISPLAY_FIELDS) {
465
+ if (entity[field] !== undefined)
466
+ payload[field] = entity[field];
467
+ }
438
468
  if (properties !== undefined ||
439
469
  required !== undefined ||
440
470
  resolutionPolicy !== undefined ||
@@ -526,7 +556,7 @@ export class ApplyClient {
526
556
  if (rulesSource !== undefined || clearFacets?.has("rules")) {
527
557
  payload.rules_source = rulesSource?.sourceCode ?? null;
528
558
  }
529
- return this.upsertSchemaResource("entity_type", payload);
559
+ return this.upsertSchemaResource(verb, "entity_type", payload);
530
560
  }
531
561
  async listRelationshipTypes() {
532
562
  const { body } = await this.request("POST", `/api/${this.orgSlug}/manage_entity_schema`, {
@@ -556,10 +586,12 @@ export class ApplyClient {
556
586
  }));
557
587
  }
558
588
  async upsertRelationshipType(
589
+ /** The plan's verb for this row: whether the type exists remotely. */
590
+ verb,
559
591
  // `metadata` is authoring-only — never sent (see DesiredRelationshipType).
560
592
  rel) {
561
593
  const { rules, ...payload } = rel;
562
- const result = await this.upsertSchemaResource("relationship_type", payload);
594
+ const result = await this.upsertSchemaResource(verb, "relationship_type", payload);
563
595
  // Reconcile rules to exactly the desired set so config is the source of
564
596
  // truth (declarative). Without removing extras, dropping a rule from config
565
597
  // would never take effect AND would churn a perpetual "rules changed"
@@ -1115,28 +1147,16 @@ function mapConnectorDefinitionItem(item) {
1115
1147
  };
1116
1148
  }
1117
1149
  /**
1118
- * Recognise duplicate-name errors from the admin tools without substring
1119
- * matching the user-facing message. The server stamps a bracketed code into
1120
- * the error message of every duplicate path `apply` upserts through
1121
- * (`manage_entity_schema` create / add_rule → `[entity_type_exists]`,
1122
- * `[relationship_type_exists]`, `[already_exists]`, all httpStatus 409).
1150
+ * Recognise duplicate-name errors from the admin tools by status alone. Every
1151
+ * duplicate path `apply` upserts through (`manage_entity_schema` create /
1152
+ * add_rule) answers 409, and nothing else those calls return does.
1123
1153
  *
1124
1154
  * Anything else is NOT a duplicate. In particular a 422 schema-validation
1125
1155
  * error (`[invalid_schema]`, e.g. ">4 x-table-column fields") must surface
1126
- * verbatim — the old status-only fallback treated any 4xx as "already
1127
- * exists", retried with `action: update`, and buried the real message under
1128
- * a misleading "Entity type not found" (issue #1177). The 409 fallback stays
1129
- * as a belt-and-braces signal for duplicate paths that predate the codes.
1156
+ * verbatim: the old any-4xx fallback retried with `action: update` and buried
1157
+ * the real message under a misleading "Entity type not found" (issue #1177).
1130
1158
  */
1131
1159
  export function isDuplicateError(err) {
1132
- if (typeof err.status !== "number")
1133
- return false;
1134
- const message = err.message.toLowerCase();
1135
- if (message.includes("[entity_type_exists]") ||
1136
- message.includes("[relationship_type_exists]") ||
1137
- message.includes("[already_exists]")) {
1138
- return true;
1139
- }
1140
1160
  return err.status === 409;
1141
1161
  }
1142
1162
  export async function resolveApplyClient(opts) {
@@ -1,15 +1,4 @@
1
- /**
2
- * Deployment identity for `lobu apply`.
3
- *
4
- * Each apply run mints an `apply_id`, sends it as `x-lobu-apply-id` on every
5
- * mutation (the server stamps its config-audit events with it), and posts a
6
- * summary to `POST /api/<org>/deployments` at the end — including the
7
- * redacted desired-state snapshot (`manifest`) that makes the deployment
8
- * self-contained: `lobu rollback <apply_id>` re-applies it through the same
9
- * diff/execute engine, repointing connectors to their retained versions. The
10
- * summary still records the config repo's HEAD SHA so git-first rollback
11
- * (revert commit → re-apply) stays first-class for config-as-code orgs.
12
- */
1
+ import type { NavigationConfig } from "@lobu/core/contracts/tools/navigation";
13
2
  import type { DesiredState } from "./desired-state.js";
14
3
  import type { Baseline, DiffPlan, DiffRow, RemoteSnapshot } from "./diff.js";
15
4
  export declare function mintApplyId(): string;
@@ -58,6 +47,8 @@ export interface DeploymentManifest {
58
47
  entityTypes: unknown[];
59
48
  relationshipTypes: unknown[];
60
49
  automations: unknown[];
50
+ /** The navigation document this config last applied (or found equal). */
51
+ navigation?: NavigationBaseline;
61
52
  };
62
53
  /**
63
54
  * Kind-qualified definition incarnation identities (`entity-type:12`,
@@ -65,11 +56,16 @@ export interface DeploymentManifest {
65
56
  */
66
57
  owned?: string[];
67
58
  }
59
+ /** What the workspace navigation was after this config's last apply. */
60
+ export interface NavigationBaseline {
61
+ config: NavigationConfig | null;
62
+ }
68
63
  export interface BaselineRecord {
69
64
  attribution: {
70
65
  entityTypes: unknown[];
71
66
  relationshipTypes: unknown[];
72
67
  automations: unknown[];
68
+ navigation?: NavigationBaseline;
73
69
  };
74
70
  owned: string[];
75
71
  /** Connector key → version from the deployment's post-apply pins. */
@@ -96,11 +96,15 @@ export function loadBaselineFromManifest(manifest) {
96
96
  !Array.isArray(attribution.automations)) {
97
97
  return null;
98
98
  }
99
+ const navigation = attribution.navigation;
99
100
  return {
100
101
  attribution: {
101
102
  entityTypes: attribution.entityTypes,
102
103
  relationshipTypes: attribution.relationshipTypes,
103
104
  automations: attribution.automations,
105
+ ...(navigation && typeof navigation === "object" && "config" in navigation
106
+ ? { navigation: { config: navigation.config } }
107
+ : {}),
104
108
  },
105
109
  owned: manifest.owned,
106
110
  ...(manifest.connector_versions
@@ -242,7 +246,16 @@ export function buildAttributionAndOwned(state, remote, orgId, prune = false) {
242
246
  }
243
247
  }
244
248
  return {
245
- attribution: { entityTypes, relationshipTypes, automations },
249
+ attribution: {
250
+ entityTypes,
251
+ relationshipTypes,
252
+ automations,
253
+ // A full apply that manages navigation leaves it as the config says
254
+ // (a write, or already equal); the next apply compares against this.
255
+ ...(remote.navigation !== undefined && state.navigation !== undefined
256
+ ? { navigation: { config: state.navigation } }
257
+ : {}),
258
+ },
246
259
  owned,
247
260
  };
248
261
  }
@@ -1,19 +1,18 @@
1
+ import type { NavigationConfig } from "@lobu/core/contracts/tools/navigation";
1
2
  import type { ConnectorDefinition, EntityMetrics } from "@lobu/connector-sdk";
2
3
  import type { AgentSettings } from "@lobu/core";
3
4
  import type { CollectionPresentation } from "@lobu/core/contracts/tools/collection-presentation";
4
5
  import type { AutomationEventTrigger, AutomationScheduleTrigger, AutomationWorkspaceEventTrigger, ManageAutomationsArgs } from "@lobu/core/contracts/tools/manage-automations";
5
6
  import type { RetainedSource } from "@lobu/core/contracts/tools/source-files";
6
7
  import type { Automation, InferenceCapabilityBlock, InferenceModality, Project } from "../../../config/index.js";
7
- import { type AutomationSource, type EntityBacking, type RelationshipRule } from "./shared.js";
8
+ import { type AutomationSource, type EntityBacking, type EntityTypeDisplayFields, type RelationshipRule } from "./shared.js";
8
9
  export interface DesiredAgentMetadata {
9
10
  agentId: string;
10
11
  name: string;
11
12
  description?: string;
12
13
  }
13
- export interface DesiredEntityType {
14
+ export interface DesiredEntityType extends EntityTypeDisplayFields {
14
15
  slug: string;
15
- name?: string;
16
- description?: string;
17
16
  required?: string[];
18
17
  properties?: Record<string, unknown>;
19
18
  /**
@@ -323,6 +322,11 @@ export interface DesiredState {
323
322
  * path — and apply re-derives it from the bundle, refusing a mismatch.
324
323
  */
325
324
  views: DesiredView[];
325
+ /**
326
+ * The workspace navigation document, already validated. Undefined when the
327
+ * config leaves navigation unmanaged; null returns it to the default.
328
+ */
329
+ navigation?: NavigationConfig | null;
326
330
  /**
327
331
  * Names of env vars referenced via `secret()` / `$VAR` (provider keys,
328
332
  * auth-profile + mcp credentials). The CLI surfaces these before mutating
@@ -497,7 +497,7 @@ async function resolveViewSources(sources, cwd) {
497
497
  }
498
498
  const bundled = await bundleViewFromFile(abs, baseDir);
499
499
  sourceCode = bundled.sourceFiles.files[bundled.sourceFiles.entrypoint];
500
- const { key, name, description, attach, params, actions } = bundled.definition;
500
+ const { key, name, description, attach, params, actions, resources } = bundled.definition;
501
501
  if (seen.has(key)) {
502
502
  throw new ValidationError(`duplicate view key "${key}" in lobu.config.ts — each viewFromFile must resolve to a unique key`);
503
503
  }
@@ -517,6 +517,7 @@ async function resolveViewSources(sources, cwd) {
517
517
  attach,
518
518
  params,
519
519
  actions,
520
+ resources,
520
521
  }, bundled.compiledCode, {
521
522
  sourceFiles: bundled.sourceFiles,
522
523
  dependencies: bundled.dependencies,