mindoodb-app-sdk 0.0.64 → 0.0.66

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.
package/README.md CHANGED
@@ -327,10 +327,44 @@ if (session.agent) {
327
327
  - **`annotations`**: `readOnlyHint` for reads; `consequentialHint` for anything the user should confirm (sending, sharing, deleting) — Haven shows its own confirmation dialog and a refusal reaches the agent as `NOT_ALLOWED`; `untrustedContentHint` when the result contains text other people wrote.
328
328
  - **Errors**: throw `MindooDBAppAgentToolError(code, message, requiredAction?)` with `NOT_FOUND`, `INVALID_INPUT`, `INVALID_STATE`, `STATE_CHANGED`, `NOT_ALLOWED` or `FAILED`; `requiredAction` tells the agent what to do next ("call todo_tasks_search"). Any other exception becomes `FAILED`. Haven passes the agent one JSON error.
329
329
  - **Results** must be JSON. Return what changed (ids, new values), not just `ok`.
330
+ - **`scope`**: `"app"` (default) for the app's own operations ("list documents", "create a map"), `"document"` for operations on the document it shows ("write this paragraph", "set these cells"). See *Agent tools of embedded components* below.
330
331
  - **`setContext(context)`** shows the app's state to agents in `haven_get_context` under the focused app.
331
332
  - **Files** never travel through the agent. `agent.provideFile(blob, { name, mimeType })` hands Haven a file the app produced and returns a `fileRef` (valid ten minutes) for the agent to pass to `haven_files_export`, which saves it into the user's exchange folder. `agent.takeFile(fileRef)` returns a `File` the agent imported for this app with `haven_files_import`.
332
333
  - A call that runs longer than two minutes fails with `FAILED`; files are limited to 50 MB.
333
334
 
335
+ #### Agent tools of embedded components
336
+
337
+ Agents work on three levels: Haven's own tools (`haven_*`), the tools of the app the
338
+ user has open, and the tools of the components that app embeds. A host such as Mindoo
339
+ CRM offers the *workbench*: finding, creating, filing, opening and closing documents.
340
+ The embedded editors offer the *content* of the one document each shows.
341
+
342
+ - **Embedded, an app offers only its `scope: "document"` tools.** It sees just its
343
+ sandbox, so "list documents" or "create a document" would mislead; the host has its
344
+ own tools for those. Register the same tool list either way; Haven drops the rest.
345
+ - **One component per app is active.** When a host shows two documents of the same
346
+ app (two text documents side by side), the app's tool names belong to the active one:
347
+ the newest, until the host calls `embed.setActive()`, e.g. when a tab comes to the
348
+ front. Components of different apps (a spreadsheet next to a text) all keep theirs.
349
+ Haven prefers the launch in the focused app, so a component in the CRM wins over the
350
+ same app running in a background tab.
351
+ - **The host learns about its components' tools**: `embed.agentTools` is
352
+ `{ prefix, names, active, enabled }` or `null`, `embed.onAgentToolsChange` follows it,
353
+ and `embed.waitForAgentTools(timeoutMs)` resolves once the component offers tools.
354
+ A host's "open document" tool can wait for it and tell the agent which tools to use
355
+ next:
356
+
357
+ ```ts
358
+ const embed = await session.embeds.open({ componentKey, databaseId, docId, container });
359
+ await embed.setActive();
360
+ const tools = await embed.waitForAgentTools(5000);
361
+ return { docKey, editorTools: tools ? { prefix: tools.prefix, names: tools.names } : null };
362
+ ```
363
+
364
+ In tests, `host.setEmbedAgentTools(embedId, ["text_insert"])` acts as if the component
365
+ registered tools, and an app under test launched with `launchContext.embed` offers only
366
+ its document tools, as in Haven.
367
+
334
368
  `session.agent` is absent on hosts without agent tools, so check for it. Test tools by calling `execute` directly in unit tests; the reference implementation is `src/features/agent/` in [mindoodb-app-vega](https://github.com/klehmann/mindoodb-app-vega). How to design tools that agents use well is in the [best practices guide](https://github.com/klehmann/MindooDB/blob/main/docs/best-practices.md) (section "Offer operations to AI agents").
335
369
 
336
370
  ### Host-owned drag
@@ -426,6 +460,39 @@ await session.embedding.complete({ title }); // or session.embedding.cancel()
426
460
  Haven writes every change back to the host's database as it happens and only lets the
427
461
  component create documents that are children of the root.
428
462
 
463
+ **Kinds, contracts and references.** Three optional fields let hosts pick components by
464
+ what they do instead of by app:
465
+
466
+ ```json
467
+ {
468
+ "id": "person",
469
+ "label": { "en": "Person", "de": "Person" },
470
+ "intents": ["create", "edit", "view"],
471
+ "match": { "form": "contactperson" },
472
+ "category": "form",
473
+ "provides": [{ "contract": "mindoo.contacts.person@1", "fields": { "parents": "companyIds" } }],
474
+ "references": [
475
+ { "field": "companyIds", "to": "mindoo.contacts.company@1", "match": { "form": "contactcompany" }, "show": ["subject"] }
476
+ ]
477
+ }
478
+ ```
479
+
480
+ - `category`: `editor` (content: a document, a spreadsheet, a map) or `form` (a record: a
481
+ company, a person); hosts may treat a component without one as an `editor`. A CRM
482
+ offers its editors under "New" and uses its forms elsewhere.
483
+ - `provides`: contracts the root documents fulfil (`<name>@<major version>`), so a host
484
+ can rely on their shape; `fields` maps contract fields to this app's field names.
485
+ Another app offering the same contract can take this one's place.
486
+ - `references`: fields that point at other root documents (not parts, unlike
487
+ `children`), e.g. a person's company. Embedded, the component cannot see the host's
488
+ database, so it asks Haven:
489
+
490
+ ```ts
491
+ const companies = await session.embedding.lookup("companyIds", { query: "Mül" });
492
+ // [{ docId, fields: { subject } }]: only documents matching the reference's `match`,
493
+ // only its `show` fields. `docIds: [...]` fetches given ones (to show the current value).
494
+ ```
495
+
429
496
  **Embedding a component** (host app):
430
497
 
431
498
  ```ts
@@ -485,6 +552,9 @@ answers like a current Haven, so the SDK frames that URL in the container. Both
485
552
  controllers simulate unsaved changes: `setEmbedDirty`, `failNextEmbedSave`, and for an
486
553
  app under test that is a component, `getEmbeddingDirty` and `requestEmbeddingSave`.
487
554
 
555
+ A host with agent tools marks the component in the front tab with `embed.setActive()`
556
+ and reads `embed.agentTools`; see *Agent tools of embedded components*.
557
+
488
558
  ### Databases and capabilities
489
559
 
490
560
  Each database mapped to your app carries a set of **capabilities** that Haven controls. Your app should check capabilities before attempting operations and adapt its UI accordingly.
package/TESTING.md CHANGED
@@ -108,6 +108,24 @@ Each database entry can provide:
108
108
  - `methods.attachments`
109
109
  - `fulltextSetup` — the initial config returned by `db.getFulltextSetup()`; `db.setFulltextSetup()` overwrites it for the lifetime of the handle. Use this to test your app's full-text bootstrap logic. Note the mock evaluates `text` query clauses regardless of this config.
110
110
  - `summarySetup` — the initial config returned by `db.getSummarySetup()`; `db.setSummarySetup()` overwrites it for the lifetime of the handle. The mock's `query()` reads seeded documents directly and ignores this config; use it to test your app's summary bootstrap logic.
111
+ - `automerge: true` — back every document with a real Automerge document, as Haven does (off by default: plain JSON with `mock-head-N` heads). `create`/`update` then return real Automerge heads, `update` applies `set`/`unset`, `json` (with `Automerge.changeAt(json.baseHeads)` when given) and `text` patches as Automerge changes with Haven's rules (missing parents and lists are created, `unset` is idempotent, `counterIncrement` needs a counter, an empty `json` patch is rejected), and `get`/`list`/`query` return the plain projection (atomic strings as strings, counters as numbers, timestamps as ISO strings). `richText` patches run Automerge's `updateSpans` at their `baseHeads` and `richTextSteps` splice and mark at theirs, both validated and with MindooDB's recovery, and `getRichText` returns `Automerge.spans` — so values Automerge rejects (an `immutableString` as a mark value) fail here as they do in Haven. A `richText` snapshot written at older `baseHeads` is applied on a fork at those heads and merged back, as MindooDB does (Automerge 3.5's `updateSpans` inside `changeAt` indexes the current text), so a concurrent edit of the same text survives. As in MindooDB's `applyDocumentUpdate`, all parts of one `update` whose `baseHeads` agree are applied as one Automerge change (one history entry), all or nothing. Seeds are built with a fixed actor, so two mocks from the same seed have identical heads. `mockDatabasesFromDefinition(definition, seed, { automerge: true })` and the test host URL setting `automerge=1` turn it on, too.
112
+
113
+ #### Concurrent edits from another device
114
+
115
+ `applyRemoteUpdate(databaseId, docId, input, { actor? })` on the controller (`createMockMindooDBAppSession`, `createFakeBridgeHost`, the browser test host and `window.__havenTestHost`) writes `input` as another device and syncs it in; live queries update as after any write. With `automerge: true` the device holds the history up to `input.json.baseHeads` (plus its own earlier changes) and writes as its own Automerge actor, so its edit truly merges with an app save at the same heads:
116
+
117
+ ```ts
118
+ const doc = await database.documents.get("sheet-1"); // heads H
119
+ await mock.applyRemoteUpdate("main", "sheet-1", { // device B, at H
120
+ json: { baseHeads: doc!.heads, listInsert: [{ path: ["rows"], index: 1, values: ["remote"] }] },
121
+ });
122
+ const saved = await database.documents.update("sheet-1", { // the app, also at H
123
+ json: { baseHeads: doc!.heads, listInsert: [{ path: ["rows"], index: 1, values: ["local"] }] },
124
+ });
125
+ // saved.data.rows keeps both entries; saved.heads has two heads
126
+ ```
127
+
128
+ The relative order of concurrent inserts at the same index follows Automerge's op ids, as in Haven. Without `automerge`, `applyRemoteUpdate` is a plain update.
111
129
 
112
130
  ### Evaluating VirtualViews
113
131
 
@@ -161,6 +179,24 @@ const page = await navigator.entriesForward({ limit: 100 });
161
179
  Without `mindoodb`, the testing entrypoint falls back to an empty navigator and
162
180
  logs a warning — install the peer for realistic view tests.
163
181
 
182
+ Views configured for the app in Haven arrive in `launchContext.views`. Pass
183
+ them there and `session.openViewNavigator(viewId, options)` evaluates them
184
+ over their source databases' seeded documents, compiled the way Haven does
185
+ (rule or formula filter, field or formula columns). Each call opens a
186
+ navigator of its own with its options applied (`rootCategoryPath`,
187
+ `includeCategories`, `includeDocuments`, …), as in Haven; disposing one does
188
+ not affect the others. A view created with `createViewNavigator` can be
189
+ opened again by its definition id the same way.
190
+
191
+ ```ts
192
+ const mock = createMockMindooDBAppBridge({
193
+ launchContext: { views: [contactsByCompany] }, // a MindooDBAppResolvedViewDefinition
194
+ databases: [{ info: { id: "main", title: "Main", capabilities: ["read", "views"] }, documents: contacts }],
195
+ });
196
+ const session = await mock.bridge.connect();
197
+ const acme = await session.openViewNavigator("contacts_by_company", { rootCategoryPath: ["ACME"] });
198
+ ```
199
+
164
200
  The default in-memory document store also implements `documents.query()` and `documents.liveQuery()`: expression and formula-string filters are evaluated against the seeded documents, `sortBy`/`limit`/`offset` work as documented, and live query callbacks fire automatically after `create`/`update`/`delete`/`undelete` mutations. Full-text `text` clauses are supported with a deterministic mock implementation (token matching with prefix/AND semantics and an occurrence-count `textScore`) — assert on membership and relative ordering, not absolute scores, since real hosts use a BM25-style engine. That means app code built on queries and live queries is testable at Level 1 without any extra setup:
165
201
 
166
202
  ```ts
@@ -364,7 +400,7 @@ mountHavenTestHost({
364
400
  });
365
401
  ```
366
402
 
367
- The panel keeps its settings in the page URL, so a scenario can be linked or opened by Playwright directly: `/__haven-test/?db=main:read,attachments&db=archive:none&enforce=1&users=120&locale=de-DE&theme=dark` (`db=<id>:none` unmaps a database; URL settings win over the options). The same controls are scriptable as `window.__havenTestHost`:
403
+ The panel keeps its settings in the page URL, so a scenario can be linked or opened by Playwright directly: `/__haven-test/?db=main:read,attachments&db=archive:none&enforce=1&users=120&locale=de-DE&theme=dark` (`db=<id>:none` unmaps a database; `automerge=1` backs all databases with Automerge documents; URL settings win over the options). The same controls are scriptable as `window.__havenTestHost`:
368
404
 
369
405
  ```ts
370
406
  await page.goto("/__haven-test/?enforce=1");
@@ -376,6 +412,9 @@ await page.evaluate(() => window.__havenTestHost!.setLocale("de-DE"));
376
412
  await page.evaluate(() => window.__havenTestHost!.setNextScan({ fileName: "receipt.pdf", mimeType: "application/pdf", size: 1024 }));
377
413
  await app.getByRole("button", { name: "Scan" }).click();
378
414
  expect(await page.evaluate(() => window.__havenTestHost!.log.scans)).toHaveLength(1);
415
+
416
+ // with ?automerge=1: another device edits the document the app has open
417
+ await page.evaluate(() => window.__havenTestHost!.applyRemoteUpdate("main", "sheet-1", { set: { title: "Renamed elsewhere" } }));
379
418
  ```
380
419
 
381
420
  Agent tools are scriptable through `window.__havenTestHost.agent`, the same controller the Vitest helpers expose as `createFakeBridgeHost().agent`:
@@ -401,6 +440,25 @@ Lower-level pieces, if you build your own page: `createBrowserTestHost({ frame,
401
440
 
402
441
  Keep the test page out of production builds. The starter template builds it only for `vite dev` and when `HAVEN_TEST_HOST=1` is set (for preview deployments), so the app's public URL keeps showing its landing page.
403
442
 
443
+ ### Two users on two replicas
444
+
445
+ The panel's **Mode** section switches between *Single user* and *Two users* (keeping the other URL settings). `/__haven-test/?twoUsers=1` (or `mountHavenTestHost({ twoUsers: true })`) shows the app twice, side by side, as two people on two devices: each frame is launched by its own mock Haven with its own replica of every database (`automerge: true`, distinct Automerge actors), so their edits really are concurrent. The bar on top:
446
+
447
+ - **Auto-sync every 2 s** (on by default) merges the replicas with `syncMockReplicas`, like Haven's sync. Turn it off to keep the two apart — two devices offline — edit on both sides, then press **Sync** and watch the merge.
448
+ - The status says "✓ in sync" or how many documents still differ.
449
+
450
+ Each app sees the other's changes the way it would in Haven (changefeed, live queries, or its own polling). Use it to try "one changes the text, the other the color", "both add a slide", "both format the same word" by hand. Playwright reaches both frames as `[data-testid="haven-two-users-frame-1"]` / `-2`, and `window.__havenTwoUsers` scripts the mode (`sync()`, `setAutoSync(on)`, `differences()`, `hosts`).
451
+
452
+ In Vitest, two mocks with distinct `automergeActor`s plus `syncMockReplicas(a, b)` do the same without a browser:
453
+
454
+ ```ts
455
+ const a = createMockMindooDBAppSession({ databases: [def()], automergeActor: "a1".repeat(16) });
456
+ const b = createMockMindooDBAppSession({ databases: [def()], automergeActor: "b2".repeat(16) });
457
+ // … edit through each session, then:
458
+ await syncMockReplicas(a, b); // documents, deletions and attachments, both ways
459
+ expect(mockReplicaDifferences(a, b)).toBe(0);
460
+ ```
461
+
404
462
  ## When to use which level
405
463
 
406
464
  Choose Level 1 when:
@@ -363,6 +363,89 @@ function readComponentFieldMatch(value, label, errors) {
363
363
  }
364
364
  return result;
365
365
  }
366
+ var COMPONENT_CATEGORY_PATTERN = /^[a-z][a-z0-9-]{0,31}$/;
367
+ var MINDOODB_APP_COMPONENT_CONTRACT_PATTERN = /^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)+@[1-9][0-9]{0,3}$/;
368
+ var COMPONENT_CONTRACTS_MAX = 8;
369
+ var COMPONENT_REFERENCES_MAX = 8;
370
+ var COMPONENT_REFERENCE_SHOW_MAX = 8;
371
+ function readComponentContracts(value, label, errors) {
372
+ if (value === void 0) {
373
+ return void 0;
374
+ }
375
+ if (!Array.isArray(value) || value.length > COMPONENT_CONTRACTS_MAX) {
376
+ errors.push(`${label} must be an array of at most ${COMPONENT_CONTRACTS_MAX} contracts.`);
377
+ return void 0;
378
+ }
379
+ const result = [];
380
+ for (const [index, entry] of value.entries()) {
381
+ const contract = isPlainObject(entry) && typeof entry.contract === "string" ? entry.contract.trim() : "";
382
+ if (!MINDOODB_APP_COMPONENT_CONTRACT_PATTERN.test(contract)) {
383
+ errors.push(`${label}[${index}].contract must look like "mindoo.contacts.company@1".`);
384
+ return void 0;
385
+ }
386
+ let fields;
387
+ if (isPlainObject(entry) && entry.fields !== void 0) {
388
+ if (!isPlainObject(entry.fields)) {
389
+ errors.push(`${label}[${index}].fields must map contract fields to document fields.`);
390
+ return void 0;
391
+ }
392
+ fields = {};
393
+ for (const [from, to] of Object.entries(entry.fields)) {
394
+ if (!COMPONENT_FIELD_PATTERN.test(from) || typeof to !== "string" || !COMPONENT_FIELD_PATTERN.test(to)) {
395
+ errors.push(`${label}[${index}].fields must map field names to top-level field names.`);
396
+ return void 0;
397
+ }
398
+ fields[from] = to;
399
+ }
400
+ }
401
+ result.push({ contract, ...fields && Object.keys(fields).length ? { fields } : {} });
402
+ }
403
+ return result.length ? result : void 0;
404
+ }
405
+ function readComponentReferences(value, label, rootMatch, errors) {
406
+ if (value === void 0) {
407
+ return void 0;
408
+ }
409
+ if (!Array.isArray(value) || value.length > COMPONENT_REFERENCES_MAX) {
410
+ errors.push(`${label} must be an array of at most ${COMPONENT_REFERENCES_MAX} references.`);
411
+ return void 0;
412
+ }
413
+ const result = [];
414
+ const fieldsSeen = /* @__PURE__ */ new Set();
415
+ for (const [index, entry] of value.entries()) {
416
+ const at = `${label}[${index}]`;
417
+ if (!isPlainObject(entry)) {
418
+ errors.push(`${at} must be an object.`);
419
+ return void 0;
420
+ }
421
+ const field = typeof entry.field === "string" ? entry.field.trim() : "";
422
+ if (!COMPONENT_FIELD_PATTERN.test(field) || field in rootMatch || fieldsSeen.has(field)) {
423
+ errors.push(`${at}.field must be a top-level field name, not a match field and not used twice.`);
424
+ return void 0;
425
+ }
426
+ fieldsSeen.add(field);
427
+ const to = typeof entry.to === "string" ? entry.to.trim() : void 0;
428
+ if (entry.to !== void 0 && !MINDOODB_APP_COMPONENT_CONTRACT_PATTERN.test(to ?? "")) {
429
+ errors.push(`${at}.to must look like "mindoo.contacts.company@1".`);
430
+ return void 0;
431
+ }
432
+ const match = readComponentFieldMatch(entry.match, `${at}.match`, errors);
433
+ if (!match) {
434
+ return void 0;
435
+ }
436
+ if (!Object.keys(match).length) {
437
+ errors.push(`${at}.match must name at least one field, or every document could be referenced.`);
438
+ return void 0;
439
+ }
440
+ const show = Array.isArray(entry.show) ? entry.show.filter((name) => typeof name === "string" && COMPONENT_FIELD_PATTERN.test(name)) : [];
441
+ if (!show.length || show.length !== entry.show.length || show.length > COMPONENT_REFERENCE_SHOW_MAX) {
442
+ errors.push(`${at}.show must list 1-${COMPONENT_REFERENCE_SHOW_MAX} top-level field names.`);
443
+ return void 0;
444
+ }
445
+ result.push({ field, ...to ? { to } : {}, match, show: [...new Set(show)] });
446
+ }
447
+ return result.length ? result : void 0;
448
+ }
366
449
  function readComponents(value, errors) {
367
450
  if (value === void 0 || value === null) {
368
451
  return void 0;
@@ -475,6 +558,16 @@ function readComponents(value, errors) {
475
558
  }
476
559
  children = { linkField, ...childMatch && Object.keys(childMatch).length ? { match: childMatch } : {} };
477
560
  }
561
+ let category;
562
+ if (entry.category !== void 0) {
563
+ category = typeof entry.category === "string" ? entry.category.trim() : "";
564
+ if (!COMPONENT_CATEGORY_PATTERN.test(category)) {
565
+ errors.push(`${label}.category must be 1-32 lowercase letters, digits or "-", e.g. "editor" or "form".`);
566
+ return;
567
+ }
568
+ }
569
+ const provides = readComponentContracts(entry.provides, `${label}.provides`, errors);
570
+ const references = readComponentReferences(entry.references, `${label}.references`, match, errors);
478
571
  if (errors.length !== errorCount) {
479
572
  return;
480
573
  }
@@ -486,7 +579,10 @@ function readComponents(value, errors) {
486
579
  intents,
487
580
  match,
488
581
  ...create ? { create } : {},
489
- ...children ? { children } : {}
582
+ ...children ? { children } : {},
583
+ ...category ? { category } : {},
584
+ ...provides ? { provides } : {},
585
+ ...references ? { references } : {}
490
586
  });
491
587
  });
492
588
  return result.length ? result : void 0;
@@ -1174,7 +1270,8 @@ var MindooDBAppAgentApiImpl = class {
1174
1270
  name: tool.name,
1175
1271
  description: tool.description,
1176
1272
  inputSchema: toJson(tool.inputSchema),
1177
- ...tool.annotations ? { annotations: { ...tool.annotations } } : {}
1273
+ ...tool.annotations ? { annotations: { ...tool.annotations } } : {},
1274
+ ...tool.scope ? { scope: tool.scope } : {}
1178
1275
  }))
1179
1276
  });
1180
1277
  }
@@ -1438,6 +1535,8 @@ var MindooDBAppEmbedImpl = class {
1438
1535
  dirtyListeners = /* @__PURE__ */ new Set();
1439
1536
  dirtyState = void 0;
1440
1537
  tracker = null;
1538
+ toolsState = null;
1539
+ toolsListeners = /* @__PURE__ */ new Set();
1441
1540
  get placement() {
1442
1541
  return this.frame ? "frame" : "overlay";
1443
1542
  }
@@ -1470,6 +1569,56 @@ var MindooDBAppEmbedImpl = class {
1470
1569
  }
1471
1570
  await this.rpc.call("embeds.save", { embedId: this.embedId });
1472
1571
  }
1572
+ async setActive() {
1573
+ if (this.closedEvent) {
1574
+ return;
1575
+ }
1576
+ await this.rpc.call("embeds.setActive", { embedId: this.embedId });
1577
+ }
1578
+ get agentTools() {
1579
+ return this.toolsState;
1580
+ }
1581
+ onAgentToolsChange(listener) {
1582
+ this.toolsListeners.add(listener);
1583
+ return () => {
1584
+ this.toolsListeners.delete(listener);
1585
+ };
1586
+ }
1587
+ /** Haven reported the component's agent tools. */
1588
+ setAgentToolsState(tools) {
1589
+ if (this.closedEvent) {
1590
+ return;
1591
+ }
1592
+ this.toolsState = tools ? { ...tools, names: [...tools.names] } : null;
1593
+ this.toolsListeners.forEach((listener) => {
1594
+ try {
1595
+ listener(this.toolsState);
1596
+ } catch (error) {
1597
+ console.error("MindooDB embed agent tools listener failed.", error);
1598
+ }
1599
+ });
1600
+ }
1601
+ waitForAgentTools(timeoutMs = 1e4) {
1602
+ if (this.toolsState?.names.length) {
1603
+ return Promise.resolve(this.toolsState);
1604
+ }
1605
+ if (this.closedEvent) {
1606
+ return Promise.resolve(null);
1607
+ }
1608
+ return new Promise((resolve) => {
1609
+ const finish = (tools) => {
1610
+ clearTimeout(timer);
1611
+ stopTools();
1612
+ stopClosed();
1613
+ resolve(tools);
1614
+ };
1615
+ const timer = setTimeout(() => finish(null), timeoutMs);
1616
+ const stopTools = this.onAgentToolsChange((tools) => {
1617
+ if (tools?.names.length) finish(tools);
1618
+ });
1619
+ const stopClosed = this.onClosed(() => finish(null));
1620
+ });
1621
+ }
1473
1622
  async setRect(rect) {
1474
1623
  if (this.closedEvent) {
1475
1624
  return;
@@ -1524,6 +1673,15 @@ var MindooDBAppEmbedImpl = class {
1524
1673
  });
1525
1674
  this.listeners.clear();
1526
1675
  this.dirtyListeners.clear();
1676
+ this.toolsState = null;
1677
+ this.toolsListeners.forEach((listener) => {
1678
+ try {
1679
+ listener(null);
1680
+ } catch (error) {
1681
+ console.error("MindooDB embed agent tools listener failed.", error);
1682
+ }
1683
+ });
1684
+ this.toolsListeners.clear();
1527
1685
  }
1528
1686
  };
1529
1687
  var MindooDBAppEmbedsClient = class {
@@ -1547,6 +1705,16 @@ var MindooDBAppEmbedsClient = class {
1547
1705
  }
1548
1706
  return;
1549
1707
  }
1708
+ if (message.event?.type === "agentTools") {
1709
+ const { embedId, agentTools } = message.event;
1710
+ const embed2 = this.open.get(embedId);
1711
+ if (embed2) {
1712
+ embed2.setAgentToolsState(agentTools ?? null);
1713
+ } else {
1714
+ this.earlyTools.set(embedId, agentTools ?? null);
1715
+ }
1716
+ return;
1717
+ }
1550
1718
  if (message.event?.type !== "closed") {
1551
1719
  return;
1552
1720
  }
@@ -1591,6 +1759,10 @@ var MindooDBAppEmbedsClient = class {
1591
1759
  this.earlyDirty.delete(embed.embedId);
1592
1760
  embed.setDirtyState(earlyDirty);
1593
1761
  }
1762
+ if (this.earlyTools.has(embed.embedId)) {
1763
+ embed.setAgentToolsState(this.earlyTools.get(embed.embedId) ?? null);
1764
+ this.earlyTools.delete(embed.embedId);
1765
+ }
1594
1766
  const early = this.early.get(embed.embedId);
1595
1767
  if (early) {
1596
1768
  this.early.delete(embed.embedId);
@@ -1617,6 +1789,15 @@ var MindooDBAppEmbedsClient = class {
1617
1789
  setDirty: async (dirty) => {
1618
1790
  await this.rpc.call("embedding.setDirty", { dirty: dirty === true });
1619
1791
  },
1792
+ lookup: async (field, options) => {
1793
+ const result = await this.rpc.call("embedding.lookup", {
1794
+ field: String(field),
1795
+ ...options?.query ? { query: String(options.query) } : {},
1796
+ ...options?.docIds ? { docIds: options.docIds.map(String) } : {},
1797
+ ...options?.limit ? { limit: Number(options.limit) } : {}
1798
+ });
1799
+ return Array.isArray(result) ? result : [];
1800
+ },
1620
1801
  onSaveRequest: (handler) => {
1621
1802
  this.saveHandler = handler;
1622
1803
  return () => {
@@ -1635,6 +1816,7 @@ var MindooDBAppEmbedsClient = class {
1635
1816
  /** Events that arrived before `embeds.open` resolved with their id. */
1636
1817
  early = /* @__PURE__ */ new Map();
1637
1818
  earlyDirty = /* @__PURE__ */ new Map();
1819
+ earlyTools = /* @__PURE__ */ new Map();
1638
1820
  stopListening;
1639
1821
  /** This app as a component: what to do when its host asks it to save. */
1640
1822
  saveHandler = null;
@@ -3370,6 +3552,7 @@ export {
3370
3552
  validateMindooDBAppAccepts,
3371
3553
  mindooDBAppAcceptMatchesType,
3372
3554
  MINDOODB_APP_COMPONENTS_MAX,
3555
+ MINDOODB_APP_COMPONENT_CONTRACT_PATTERN,
3373
3556
  validateMindooDBAppComponents,
3374
3557
  mindooDBAppComponentFieldsMatch,
3375
3558
  resolveMindooDBAppLocalizedText,
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MindooDBAppAttachmentPreviewMode, a as MindooDBAppDragBindSourceOptions, b as MindooDBAppDragStartInput, c as MindooDBAppDragStartResult, d as MindooDBAppDragPreview, e as MindooDBAppBridge, f as MindooDBAppAgentToolErrorCode, g as MindooDBAppHostShortcutBinding, h as MindooDBAppHostShortcutAction, i as MindooDBAppHostingMode, j as MindooDBAppDefinition, k as MindooDBAppDatabase, l as MindooDBAppDocument, m as MindooDBAppRichTextSpan, n as MindooDBAppRichTextSnapshot, o as MindooDBAppCreateDocumentInput } from './types-BeRUxGKN.js';
2
- export { p as MINDOODB_APP_ACCEPTS_MAX, q as MINDOODB_APP_COMPONENTS_MAX, r as MINDOODB_APP_DEFINITION_FILE_NAME, s as MINDOODB_APP_DEFINITION_FORMAT, t as MINDOODB_APP_DEFINITION_PERMISSIONS, u as MINDOODB_APP_DEFINITION_REGISTRATION_PERMISSIONS, v as MINDOODB_APP_DEFINITION_VERSION, w as MINDOODB_APP_LISTING_DESCRIPTION_MAX, x as MINDOODB_APP_LISTING_MAX_SCREENSHOTS, y as MINDOODB_APP_LISTING_SUMMARY_MAX, z as MINDOODB_APP_SEAL_SIGNING_DOMAIN, A as MINDOODB_APP_WELL_KNOWN_DRAG_TYPES, B as MindooDBAppAcceptSpec, C as MindooDBAppAccessDecision, D as MindooDBAppAccessTier, E as MindooDBAppAgentApi, F as MindooDBAppAgentRegistration, G as MindooDBAppAgentTool, H as MindooDBAppAgentToolAnnotations, I as MindooDBAppAgentToolDescriptor, J as MindooDBAppAttachmentApi, K as MindooDBAppAttachmentChunk, L as MindooDBAppAttachmentInfo, N as MindooDBAppAttachmentPreviewOptions, O as MindooDBAppAttachmentPreviewSession, P as MindooDBAppAutomergeChangesPatch, Q as MindooDBAppAutomergeChangesSince, R as MindooDBAppAutomergeGetOptions, S as MindooDBAppAutomergePatchResult, T as MindooDBAppAutomergeSnapshot, U as MindooDBAppBridgeAgentInvokeMessage, V as MindooDBAppBridgeAgentResultMessage, W as MindooDBAppBridgeBeforeCloseAck, X as MindooDBAppBridgeBeforeCloseMessage, Y as MindooDBAppBridgeConnectMessage, Z as MindooDBAppBridgeConnectOptions, _ as MindooDBAppBridgeConnectedMessage, $ as MindooDBAppBridgeDragDropMessage, a0 as MindooDBAppBridgeDragLeaveMessage, a1 as MindooDBAppBridgeDragOverMessage, a2 as MindooDBAppBridgeEmbedEventMessage, a3 as MindooDBAppBridgeEmbeddingRequestMessage, a4 as MindooDBAppBridgeErrorPayload, a5 as MindooDBAppBridgeHandshakeErrorMessage, a6 as MindooDBAppBridgeHostFocusChangedMessage, a7 as MindooDBAppBridgeIncomingContentMessage, a8 as MindooDBAppBridgeLocaleChangedMessage, a9 as MindooDBAppBridgePortMessage, aa as MindooDBAppBridgeQueryResultMessage, ab as MindooDBAppBridgeRpcError, ac as MindooDBAppBridgeRpcMessage, ad as MindooDBAppBridgeRpcRequest, ae as MindooDBAppBridgeRpcSuccess, af as MindooDBAppBridgeShortcutInvokedMessage, ag as MindooDBAppBridgeShortcutsChangedMessage, ah as MindooDBAppBridgeStreamAbortRequest, ai as MindooDBAppBridgeStreamAck, aj as MindooDBAppBridgeStreamCloseRequest, ak as MindooDBAppBridgeStreamError, al as MindooDBAppBridgeStreamMessage, am as MindooDBAppBridgeStreamOpenResult, an as MindooDBAppBridgeStreamReadRequest, ao as MindooDBAppBridgeStreamWriteRequest, ap as MindooDBAppBridgeThemeChangedMessage, aq as MindooDBAppBridgeUiPreferencesChangedMessage, ar as MindooDBAppBridgeViewChangedMessage, as as MindooDBAppBridgeViewportChangedMessage, at as MindooDBAppBridgeWorkspaceFocusRequestedMessage, au as MindooDBAppBrowserFeatures, av as MindooDBAppCapability, aw as MindooDBAppComponentChildren, ax as MindooDBAppComponentFieldValue, ay as MindooDBAppComponentInfo, az as MindooDBAppComponentIntent, aA as MindooDBAppComponentQuery, aB as MindooDBAppComponentSpec, aC as MindooDBAppComponentsApi, aD as MindooDBAppConfiguredViewCategorizationStyle, aE as MindooDBAppConfiguredViewColumn, aF as MindooDBAppConfiguredViewColumnRole, aG as MindooDBAppConfiguredViewExpressionMode, aH as MindooDBAppConfiguredViewFieldExpression, aI as MindooDBAppConfiguredViewFilterDefinition, aJ as MindooDBAppConfiguredViewFilterMode, aK as MindooDBAppConfiguredViewFilterRule, aL as MindooDBAppConfiguredViewFormulaExpression, aM as MindooDBAppConfiguredViewFormulaFilterDefinition, aN as MindooDBAppConfiguredViewPreviewMode, aO as MindooDBAppConfiguredViewRuleFilterDefinition, aP as MindooDBAppConfiguredViewRuleMatchMode, aQ as MindooDBAppConfiguredViewRuleOperator, aR as MindooDBAppConfiguredViewValueExpression, aS as MindooDBAppCreateKeyInfo, aT as MindooDBAppCreateViewInput, aU as MindooDBAppCreateViewNavigatorInput, aV as MindooDBAppDatabaseInfo, aW as MindooDBAppDefinitionDatabase, aX as MindooDBAppDefinitionListing, aY as MindooDBAppDefinitionPermission, aZ as MindooDBAppDefinitionRegistrationPermission, a_ as MindooDBAppDefinitionScreenshot, a$ as MindooDBAppDefinitionValidation, b0 as MindooDBAppDirectoryApi, b1 as MindooDBAppDirectoryEntry, b2 as MindooDBAppDocumentApi, b3 as MindooDBAppDocumentHeadCursorResult, b4 as MindooDBAppDocumentHistoryEntry, b5 as MindooDBAppDocumentListQuery, b6 as MindooDBAppDocumentListResult, b7 as MindooDBAppDocumentQuery, b8 as MindooDBAppDocumentRevisionId, b9 as MindooDBAppDocumentScanPreset, ba as MindooDBAppDocumentSummary, bb as MindooDBAppDragApi, bc as MindooDBAppDragCancelReason, bd as MindooDBAppDragDropEvent, be as MindooDBAppDragEffect, bf as MindooDBAppDragHoverResult, bg as MindooDBAppDragOffer, bh as MindooDBAppDragOverEvent, bi as MindooDBAppDragPointer, bj as MindooDBAppDragProfile, bk as MindooDBAppEmbed, bl as MindooDBAppEmbedCloseReason, bm as MindooDBAppEmbedClosedEvent, bn as MindooDBAppEmbedContext, bo as MindooDBAppEmbedDirtyEvent, bp as MindooDBAppEmbedOpenInput, bq as MindooDBAppEmbedRect, br as MindooDBAppEmbeddingApi, bs as MindooDBAppEmbedsApi, bt as MindooDBAppEntryAttachmentRef, bu as MindooDBAppEntryProvenance, bv as MindooDBAppExtractDocumentTextInput, bw as MindooDBAppExtractDocumentTextResult, bx as MindooDBAppExtractTextFormat, by as MindooDBAppExtractionSetup, bz as MindooDBAppFulltextSetup, bA as MindooDBAppHistoricalDocument, bB as MindooDBAppHistoryQuery, bC as MindooDBAppHostTheme, bD as MindooDBAppIdentityApi, bE as MindooDBAppInaccessibleDocument, bF as MindooDBAppInaccessibleDocumentListQuery, bG as MindooDBAppInaccessibleDocumentListResult, bH as MindooDBAppIncomingContent, bI as MindooDBAppIncomingContentHandler, bJ as MindooDBAppIncomingContentInfo, bK as MindooDBAppIncomingItem, bL as MindooDBAppIncomingItemInfo, bM as MindooDBAppIncomingResult, bN as MindooDBAppIncomingSource, bO as MindooDBAppJsonCounterIncrementPatch, bP as MindooDBAppJsonListDeletePatch, bQ as MindooDBAppJsonListInsertPatch, bR as MindooDBAppJsonPatch, bS as MindooDBAppJsonSetPatch, bT as MindooDBAppJsonTextMarkPatch, bU as MindooDBAppJsonTextSplicePatch, bV as MindooDBAppJsonTextUnmarkPatch, bW as MindooDBAppJsonUnsetPatch, bX as MindooDBAppLaunchContext, bY as MindooDBAppListUsersOptions, bZ as MindooDBAppListUsersPage, b_ as MindooDBAppLiveQuerySubscription, b$ as MindooDBAppLocalizedText, c0 as MindooDBAppMenuAnchor, c1 as MindooDBAppMenuApi, c2 as MindooDBAppMenuCommandItem, c3 as MindooDBAppMenuDismissReason, c4 as MindooDBAppMenuDismissedResult, c5 as MindooDBAppMenuItem, c6 as MindooDBAppMenuKind, c7 as MindooDBAppMenuPlacement, c8 as MindooDBAppMenuPointAnchor, c9 as MindooDBAppMenuRect, ca as MindooDBAppMenuRectAnchor, cb as MindooDBAppMenuSelectionResult, cc as MindooDBAppMenuSeparatorItem, cd as MindooDBAppNotificationSeverity, ce as MindooDBAppNotifyInput, cf as MindooDBAppNotifyResult, cg as MindooDBAppProposeAppInput, ch as MindooDBAppProposeAppResult, ci as MindooDBAppQueryCoverage, cj as MindooDBAppQueryInclude, ck as MindooDBAppQueryIncludeCardinality, cl as MindooDBAppQueryIncludeSlots, cm as MindooDBAppQueryResult, cn as MindooDBAppQueryRow, co as MindooDBAppQuerySortKey, cp as MindooDBAppQueryTextClause, cq as MindooDBAppReadableAttachmentStream, cr as MindooDBAppRecipientOptions, cs as MindooDBAppResolvedViewDefinition, ct as MindooDBAppResolvedViewSource, cu as MindooDBAppRevisionPhase, cv as MindooDBAppRevisionVerification, cw as MindooDBAppRichTextBlockSpan, cx as MindooDBAppRichTextGetOptions, cy as MindooDBAppRichTextImmutableString, cz as MindooDBAppRichTextMarkRange, cA as MindooDBAppRichTextMaterializeValue, cB as MindooDBAppRichTextPatch, cC as MindooDBAppRichTextScalar, cD as MindooDBAppRichTextSpliceStep, cE as MindooDBAppRichTextStep, cF as MindooDBAppRichTextStepPatch, cG as MindooDBAppRichTextTextSpan, cH as MindooDBAppRuntime, cI as MindooDBAppScanAttachmentOptions, cJ as MindooDBAppScanAttachmentResult, cK as MindooDBAppScopedDocId, cL as MindooDBAppScopedDocumentSummary, cM as MindooDBAppSealIntent, cN as MindooDBAppSealedChannelOpenInput, cO as MindooDBAppSealedChannelOpenResult, cP as MindooDBAppSealedChannelRequestInput, cQ as MindooDBAppSession, cR as MindooDBAppShowMenuInput, cS as MindooDBAppShowMenuResult, cT as MindooDBAppSignPreview, cU as MindooDBAppSignPreviewScope, cV as MindooDBAppSignStatementInput, cW as MindooDBAppSignStatementResult, cX as MindooDBAppStorageApi, cY as MindooDBAppSummarySetup, cZ as MindooDBAppTextCursorOptions, c_ as MindooDBAppTextCursorPosition, c$ as MindooDBAppTextCursorPositionsResult, d0 as MindooDBAppTextCursorsResult, d1 as MindooDBAppTextEdit, d2 as MindooDBAppTextPatch, d3 as MindooDBAppThemeMode, d4 as MindooDBAppTimestampApi, d5 as MindooDBAppTimestampInput, d6 as MindooDBAppTimestampProvider, d7 as MindooDBAppTimestampResult, d8 as MindooDBAppUiPreferences, d9 as MindooDBAppUpdateDocumentInput, da as MindooDBAppViewCursorDocumentListResult, db as MindooDBAppViewCursorResult, dc as MindooDBAppViewEntry, dd as MindooDBAppViewEntryKind, de as MindooDBAppViewNavigator, df as MindooDBAppViewNavigatorExpansionState, dg as MindooDBAppViewNavigatorOpenOptions, dh as MindooDBAppViewNavigatorPageOptions, di as MindooDBAppViewNavigatorPageResult, dj as MindooDBAppViewNavigatorRangeQuery, dk as MindooDBAppViewNavigatorSelectionState, dl as MindooDBAppViewUpdateStats, dm as MindooDBAppViewport, dn as MindooDBAppWellKnownDragType, dp as MindooDBAppWritableAttachmentStream, dq as mindooDBAppAcceptMatchesType, dr as mindooDBAppComponentFieldsMatch, ds as resolveMindooDBAppDefinitionUrl, dt as resolveMindooDBAppListingAssetUrl, du as resolveMindooDBAppLocalizedText, dv as validateMindooDBAppAccepts, dw as validateMindooDBAppComponents, dx as validateMindooDBAppDefinition } from './types-BeRUxGKN.js';
1
+ import { M as MindooDBAppAttachmentPreviewMode, a as MindooDBAppDragBindSourceOptions, b as MindooDBAppDragStartInput, c as MindooDBAppDragStartResult, d as MindooDBAppDragPreview, e as MindooDBAppBridge, f as MindooDBAppAgentToolErrorCode, g as MindooDBAppHostShortcutBinding, h as MindooDBAppHostShortcutAction, i as MindooDBAppHostingMode, j as MindooDBAppDefinition, k as MindooDBAppDatabase, l as MindooDBAppDocument, m as MindooDBAppRichTextSpan, n as MindooDBAppRichTextSnapshot, o as MindooDBAppCreateDocumentInput } from './types-Cuw-0Iou.js';
2
+ export { p as MINDOODB_APP_ACCEPTS_MAX, q as MINDOODB_APP_COMPONENTS_MAX, r as MINDOODB_APP_COMPONENT_CONTRACT_PATTERN, s as MINDOODB_APP_DEFINITION_FILE_NAME, t as MINDOODB_APP_DEFINITION_FORMAT, u as MINDOODB_APP_DEFINITION_PERMISSIONS, v as MINDOODB_APP_DEFINITION_REGISTRATION_PERMISSIONS, w as MINDOODB_APP_DEFINITION_VERSION, x as MINDOODB_APP_LISTING_DESCRIPTION_MAX, y as MINDOODB_APP_LISTING_MAX_SCREENSHOTS, z as MINDOODB_APP_LISTING_SUMMARY_MAX, A as MINDOODB_APP_SEAL_SIGNING_DOMAIN, B as MINDOODB_APP_WELL_KNOWN_DRAG_TYPES, C as MindooDBAppAcceptSpec, D as MindooDBAppAccessDecision, E as MindooDBAppAccessTier, F as MindooDBAppAgentApi, G as MindooDBAppAgentRegistration, H as MindooDBAppAgentTool, I as MindooDBAppAgentToolAnnotations, J as MindooDBAppAgentToolDescriptor, K as MindooDBAppAgentToolScope, L as MindooDBAppAttachmentApi, N as MindooDBAppAttachmentChunk, O as MindooDBAppAttachmentInfo, P as MindooDBAppAttachmentPreviewOptions, Q as MindooDBAppAttachmentPreviewSession, R as MindooDBAppAutomergeChangesPatch, S as MindooDBAppAutomergeChangesSince, T as MindooDBAppAutomergeGetOptions, U as MindooDBAppAutomergePatchResult, V as MindooDBAppAutomergeSnapshot, W as MindooDBAppBridgeAgentInvokeMessage, X as MindooDBAppBridgeAgentResultMessage, Y as MindooDBAppBridgeBeforeCloseAck, Z as MindooDBAppBridgeBeforeCloseMessage, _ as MindooDBAppBridgeConnectMessage, $ as MindooDBAppBridgeConnectOptions, a0 as MindooDBAppBridgeConnectedMessage, a1 as MindooDBAppBridgeDragDropMessage, a2 as MindooDBAppBridgeDragLeaveMessage, a3 as MindooDBAppBridgeDragOverMessage, a4 as MindooDBAppBridgeEmbedEventMessage, a5 as MindooDBAppBridgeEmbeddingRequestMessage, a6 as MindooDBAppBridgeErrorPayload, a7 as MindooDBAppBridgeHandshakeErrorMessage, a8 as MindooDBAppBridgeHostFocusChangedMessage, a9 as MindooDBAppBridgeIncomingContentMessage, aa as MindooDBAppBridgeLocaleChangedMessage, ab as MindooDBAppBridgePortMessage, ac as MindooDBAppBridgeQueryResultMessage, ad as MindooDBAppBridgeRpcError, ae as MindooDBAppBridgeRpcMessage, af as MindooDBAppBridgeRpcRequest, ag as MindooDBAppBridgeRpcSuccess, ah as MindooDBAppBridgeShortcutInvokedMessage, ai as MindooDBAppBridgeShortcutsChangedMessage, aj as MindooDBAppBridgeStreamAbortRequest, ak as MindooDBAppBridgeStreamAck, al as MindooDBAppBridgeStreamCloseRequest, am as MindooDBAppBridgeStreamError, an as MindooDBAppBridgeStreamMessage, ao as MindooDBAppBridgeStreamOpenResult, ap as MindooDBAppBridgeStreamReadRequest, aq as MindooDBAppBridgeStreamWriteRequest, ar as MindooDBAppBridgeThemeChangedMessage, as as MindooDBAppBridgeUiPreferencesChangedMessage, at as MindooDBAppBridgeViewChangedMessage, au as MindooDBAppBridgeViewportChangedMessage, av as MindooDBAppBridgeWorkspaceFocusRequestedMessage, aw as MindooDBAppBrowserFeatures, ax as MindooDBAppCapability, ay as MindooDBAppComponentCategory, az as MindooDBAppComponentChildren, aA as MindooDBAppComponentContract, aB as MindooDBAppComponentFieldValue, aC as MindooDBAppComponentInfo, aD as MindooDBAppComponentIntent, aE as MindooDBAppComponentQuery, aF as MindooDBAppComponentReference, aG as MindooDBAppComponentSpec, aH as MindooDBAppComponentsApi, aI as MindooDBAppConfiguredViewCategorizationStyle, aJ as MindooDBAppConfiguredViewColumn, aK as MindooDBAppConfiguredViewColumnRole, aL as MindooDBAppConfiguredViewExpressionMode, aM as MindooDBAppConfiguredViewFieldExpression, aN as MindooDBAppConfiguredViewFilterDefinition, aO as MindooDBAppConfiguredViewFilterMode, aP as MindooDBAppConfiguredViewFilterRule, aQ as MindooDBAppConfiguredViewFormulaExpression, aR as MindooDBAppConfiguredViewFormulaFilterDefinition, aS as MindooDBAppConfiguredViewPreviewMode, aT as MindooDBAppConfiguredViewRuleFilterDefinition, aU as MindooDBAppConfiguredViewRuleMatchMode, aV as MindooDBAppConfiguredViewRuleOperator, aW as MindooDBAppConfiguredViewValueExpression, aX as MindooDBAppCreateKeyInfo, aY as MindooDBAppCreateViewInput, aZ as MindooDBAppCreateViewNavigatorInput, a_ as MindooDBAppDatabaseInfo, a$ as MindooDBAppDefinitionDatabase, b0 as MindooDBAppDefinitionListing, b1 as MindooDBAppDefinitionPermission, b2 as MindooDBAppDefinitionRegistrationPermission, b3 as MindooDBAppDefinitionScreenshot, b4 as MindooDBAppDefinitionValidation, b5 as MindooDBAppDirectoryApi, b6 as MindooDBAppDirectoryEntry, b7 as MindooDBAppDocumentApi, b8 as MindooDBAppDocumentHeadCursorResult, b9 as MindooDBAppDocumentHistoryEntry, ba as MindooDBAppDocumentListQuery, bb as MindooDBAppDocumentListResult, bc as MindooDBAppDocumentQuery, bd as MindooDBAppDocumentRevisionId, be as MindooDBAppDocumentScanPreset, bf as MindooDBAppDocumentSummary, bg as MindooDBAppDragApi, bh as MindooDBAppDragCancelReason, bi as MindooDBAppDragDropEvent, bj as MindooDBAppDragEffect, bk as MindooDBAppDragHoverResult, bl as MindooDBAppDragOffer, bm as MindooDBAppDragOverEvent, bn as MindooDBAppDragPointer, bo as MindooDBAppDragProfile, bp as MindooDBAppEmbed, bq as MindooDBAppEmbedAgentTools, br as MindooDBAppEmbedAgentToolsEvent, bs as MindooDBAppEmbedCloseReason, bt as MindooDBAppEmbedClosedEvent, bu as MindooDBAppEmbedContext, bv as MindooDBAppEmbedDirtyEvent, bw as MindooDBAppEmbedOpenInput, bx as MindooDBAppEmbedRect, by as MindooDBAppEmbeddingApi, bz as MindooDBAppEmbeddingLookupOptions, bA as MindooDBAppEmbeddingLookupResult, bB as MindooDBAppEmbedsApi, bC as MindooDBAppEntryAttachmentRef, bD as MindooDBAppEntryProvenance, bE as MindooDBAppExtractDocumentTextInput, bF as MindooDBAppExtractDocumentTextResult, bG as MindooDBAppExtractTextFormat, bH as MindooDBAppExtractionSetup, bI as MindooDBAppFulltextSetup, bJ as MindooDBAppHistoricalDocument, bK as MindooDBAppHistoryQuery, bL as MindooDBAppHostTheme, bM as MindooDBAppIdentityApi, bN as MindooDBAppInaccessibleDocument, bO as MindooDBAppInaccessibleDocumentListQuery, bP as MindooDBAppInaccessibleDocumentListResult, bQ as MindooDBAppIncomingContent, bR as MindooDBAppIncomingContentHandler, bS as MindooDBAppIncomingContentInfo, bT as MindooDBAppIncomingItem, bU as MindooDBAppIncomingItemInfo, bV as MindooDBAppIncomingResult, bW as MindooDBAppIncomingSource, bX as MindooDBAppJsonCounterIncrementPatch, bY as MindooDBAppJsonListDeletePatch, bZ as MindooDBAppJsonListInsertPatch, b_ as MindooDBAppJsonPatch, b$ as MindooDBAppJsonSetPatch, c0 as MindooDBAppJsonTextMarkPatch, c1 as MindooDBAppJsonTextSplicePatch, c2 as MindooDBAppJsonTextUnmarkPatch, c3 as MindooDBAppJsonUnsetPatch, c4 as MindooDBAppLaunchContext, c5 as MindooDBAppListUsersOptions, c6 as MindooDBAppListUsersPage, c7 as MindooDBAppLiveQuerySubscription, c8 as MindooDBAppLocalizedText, c9 as MindooDBAppMenuAnchor, ca as MindooDBAppMenuApi, cb as MindooDBAppMenuCommandItem, cc as MindooDBAppMenuDismissReason, cd as MindooDBAppMenuDismissedResult, ce as MindooDBAppMenuItem, cf as MindooDBAppMenuKind, cg as MindooDBAppMenuPlacement, ch as MindooDBAppMenuPointAnchor, ci as MindooDBAppMenuRect, cj as MindooDBAppMenuRectAnchor, ck as MindooDBAppMenuSelectionResult, cl as MindooDBAppMenuSeparatorItem, cm as MindooDBAppNotificationSeverity, cn as MindooDBAppNotifyInput, co as MindooDBAppNotifyResult, cp as MindooDBAppProposeAppInput, cq as MindooDBAppProposeAppResult, cr as MindooDBAppQueryCoverage, cs as MindooDBAppQueryInclude, ct as MindooDBAppQueryIncludeCardinality, cu as MindooDBAppQueryIncludeSlots, cv as MindooDBAppQueryResult, cw as MindooDBAppQueryRow, cx as MindooDBAppQuerySortKey, cy as MindooDBAppQueryTextClause, cz as MindooDBAppReadableAttachmentStream, cA as MindooDBAppRecipientOptions, cB as MindooDBAppResolvedViewDefinition, cC as MindooDBAppResolvedViewSource, cD as MindooDBAppRevisionPhase, cE as MindooDBAppRevisionVerification, cF as MindooDBAppRichTextBlockSpan, cG as MindooDBAppRichTextGetOptions, cH as MindooDBAppRichTextImmutableString, cI as MindooDBAppRichTextMarkRange, cJ as MindooDBAppRichTextMaterializeValue, cK as MindooDBAppRichTextPatch, cL as MindooDBAppRichTextScalar, cM as MindooDBAppRichTextSpliceStep, cN as MindooDBAppRichTextStep, cO as MindooDBAppRichTextStepPatch, cP as MindooDBAppRichTextTextSpan, cQ as MindooDBAppRuntime, cR as MindooDBAppScanAttachmentOptions, cS as MindooDBAppScanAttachmentResult, cT as MindooDBAppScopedDocId, cU as MindooDBAppScopedDocumentSummary, cV as MindooDBAppSealIntent, cW as MindooDBAppSealedChannelOpenInput, cX as MindooDBAppSealedChannelOpenResult, cY as MindooDBAppSealedChannelRequestInput, cZ as MindooDBAppSession, c_ as MindooDBAppShowMenuInput, c$ as MindooDBAppShowMenuResult, d0 as MindooDBAppSignPreview, d1 as MindooDBAppSignPreviewScope, d2 as MindooDBAppSignStatementInput, d3 as MindooDBAppSignStatementResult, d4 as MindooDBAppStorageApi, d5 as MindooDBAppSummarySetup, d6 as MindooDBAppTextCursorOptions, d7 as MindooDBAppTextCursorPosition, d8 as MindooDBAppTextCursorPositionsResult, d9 as MindooDBAppTextCursorsResult, da as MindooDBAppTextEdit, db as MindooDBAppTextPatch, dc as MindooDBAppThemeMode, dd as MindooDBAppTimestampApi, de as MindooDBAppTimestampInput, df as MindooDBAppTimestampProvider, dg as MindooDBAppTimestampResult, dh as MindooDBAppUiPreferences, di as MindooDBAppUpdateDocumentInput, dj as MindooDBAppViewCursorDocumentListResult, dk as MindooDBAppViewCursorResult, dl as MindooDBAppViewEntry, dm as MindooDBAppViewEntryKind, dn as MindooDBAppViewNavigator, dp as MindooDBAppViewNavigatorExpansionState, dq as MindooDBAppViewNavigatorOpenOptions, dr as MindooDBAppViewNavigatorPageOptions, ds as MindooDBAppViewNavigatorPageResult, dt as MindooDBAppViewNavigatorRangeQuery, du as MindooDBAppViewNavigatorSelectionState, dv as MindooDBAppViewUpdateStats, dw as MindooDBAppViewport, dx as MindooDBAppWellKnownDragType, dy as MindooDBAppWritableAttachmentStream, dz as mindooDBAppAcceptMatchesType, dA as mindooDBAppComponentFieldsMatch, dB as resolveMindooDBAppDefinitionUrl, dC as resolveMindooDBAppListingAssetUrl, dD as resolveMindooDBAppLocalizedText, dE as validateMindooDBAppAccepts, dF as validateMindooDBAppComponents, dG as validateMindooDBAppDefinition } from './types-Cuw-0Iou.js';
3
3
  export { M as MINDOODB_APP_BUNDLE_ARCHIVE_FILE_NAME, a as MINDOODB_APP_BUNDLE_MANIFEST_FILE_NAME, b as MINDOODB_APP_BUNDLE_MANIFEST_FORMAT, c as MINDOODB_APP_BUNDLE_MANIFEST_VERSION, d as MindooDBAppBundleArchive, e as MindooDBAppBundleFileEntry, f as MindooDBAppBundleHash, g as MindooDBAppBundleManifest, h as MindooDBAppBundleManifestValidation, i as buildMindooDBAppBundleContentHashInput, j as isMindooDBAppBundleHash, n as normalizeMindooDBAppBundlePath, v as validateMindooDBAppBundleManifest } from './appBundleManifest-B0xfpaXG.js';
4
4
  import { MindooDBAppBooleanExpression } from 'mindoodb-view-language';
5
5
  export { MindooDBAppBooleanExpression, MindooDBAppExpression, MindooDBAppFilterDefinition, MindooDBAppViewCategoryChildrenPageRequest, MindooDBAppViewColumn, MindooDBAppViewColumnRole, MindooDBAppViewDefinition, MindooDBAppViewExpansionState, MindooDBAppViewExpressionBase, MindooDBAppViewExpressionDatePart, MindooDBAppViewExpressionOperation, MindooDBAppViewFieldExpression, MindooDBAppViewIfExpression, MindooDBAppViewLetExpression, MindooDBAppViewLiteralExpression, MindooDBAppViewLookupByPath, MindooDBAppViewOperationExpression, MindooDBAppViewOriginExpression, MindooDBAppViewPageRequest, MindooDBAppViewPageResult, MindooDBAppViewRow, MindooDBAppViewSortDirection, MindooDBAppViewTotalMode, MindooDBAppViewValueExpressionRef, MindooDBAppViewVariableExpression, createViewLanguage } from 'mindoodb-view-language';
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ import {
4
4
  DEFAULT_HAVEN_HOST_SHORTCUTS,
5
5
  MINDOODB_APP_ACCEPTS_MAX,
6
6
  MINDOODB_APP_COMPONENTS_MAX,
7
+ MINDOODB_APP_COMPONENT_CONTRACT_PATTERN,
7
8
  MINDOODB_APP_DEFINITION_FILE_NAME,
8
9
  MINDOODB_APP_DEFINITION_FORMAT,
9
10
  MINDOODB_APP_DEFINITION_PERMISSIONS,
@@ -47,7 +48,7 @@ import {
47
48
  validateMindooDBAppAccepts,
48
49
  validateMindooDBAppComponents,
49
50
  validateMindooDBAppDefinition
50
- } from "./chunk-BE7LLFFE.js";
51
+ } from "./chunk-B3K3I2S2.js";
51
52
  import {
52
53
  MINDOODB_APP_BUNDLE_ARCHIVE_FILE_NAME,
53
54
  MINDOODB_APP_BUNDLE_MANIFEST_FILE_NAME,
@@ -1288,6 +1289,7 @@ export {
1288
1289
  MINDOODB_APP_BUNDLE_MANIFEST_FORMAT,
1289
1290
  MINDOODB_APP_BUNDLE_MANIFEST_VERSION,
1290
1291
  MINDOODB_APP_COMPONENTS_MAX,
1292
+ MINDOODB_APP_COMPONENT_CONTRACT_PATTERN,
1291
1293
  MINDOODB_APP_DEFINITION_FILE_NAME,
1292
1294
  MINDOODB_APP_DEFINITION_FORMAT,
1293
1295
  MINDOODB_APP_DEFINITION_PERMISSIONS,