Files

16 KiB
Raw Permalink Blame History

Make extension data searchable in Warden chat

Declare searchCollections in the extension’s extension.json to make its data discoverable by read_extension_data. A collection defines one kind of record, its storage, the information a chat can receive, and the filters the dashboard can apply. One extension can declare both workspace and project collections. Once the package is installed or updated, chat can discover its collections from the stored package manifest. The extension window can be closed during a search. Basic collection search uses the dashboard capability extension-collections-v1. Dashboards with managed workspace assets, project discovery, Match and prepared passage readers also advertise extension-search-sources-v2. Their manifests use the same schemaVersion: 1 block. Discover the sources for the current conversation before relying on any particular reader. Before invoking workspace commands in an extension UI, check that get_app_info().workspaceRecords.commands includes the command you need.

Decide what chat should answer

Start with a question a colleague would ask about persisted, shared data. Name the source of truth, who can read it, the stable ID of a result, and the fields needed to identify the answer. Use an existing JSON array or KV list when its rows already match the question. If the answer requires a derived view, capture its source revision and include older projects, updates and deletions when rebuilding it. Avoid copying an entire project to a chat-specific input file. For an extension without shared records, record that decision in its README and leave the manifest field absent.

Run the standalone project example

With isa-ext 0.2.2 or newer and npm in PATH, run the following from an empty working directory. The opt-in template declares a read-only equipment collection. The ordinary Hello World template continues to request only host information.

isa-ext scaffold --name "Site Inventory" --author "Example" --directory site-inventory --search-example
cd site-inventory
npm run build

Check dist/site-inventory.isax/extension.json for equipment. From the same directory, use Python 3 to create a sample project ZIP next to the extension checkout.

import json
from pathlib import Path
from zipfile import ZipFile

stamp = "2026-01-01T10:00:00Z"
project = {"formatVersion": 1, "id": "inventory-demo", "name": "Depot East",
           "createdAt": stamp, "updatedAt": stamp}
inventory = {"equipment": [{"id": "roller-01", "name": "Road roller", "location": "Bay 7"}]}
with ZipFile(Path("../inventory-demo.zip"), "x") as archive:
    archive.writestr("project.json", json.dumps(project))
    archive.writestr("extensions/site-inventory/inventory.json", json.dumps(inventory))
  1. Install the built package in a test workspace, assign it and Read extension data to the test group, and import the ZIP through a project extension's project picker in that group.
  2. In web or online native chat, ask “Where is the road roller stored?” With a tool-capable model, discovery should include site-inventory/equipment and the result should say Bay 7, identify the imported Depot East project and point to inventory.json.
  3. Give another group the tool and the package while withholding access to the project. Repeat the query and verify that the equipment is absent from that group's results.

Choose the scope

Scope Storage Who can find records
workspace workspaceRecords published to the dashboard Members of the workspace, from any group where the chat tool is enabled. Use this for data intended for everyone in that workspace, such as published price observations.
workspace Managed workspaceAsset Members with the assigned viewer and current group read access to the asset folder and file.
project JSON files or a KV list inside the declaring extension’s namespace in a shared .isap project Members with access to the installed extension and the project in the active workspace and group. Project search can select one project or scan accessible projects.

Use managed assets for the canonical supplier catalogue and price book. If discovery advertises supplierId, pass supplierId as a top-level exact filter to link a price to a supplier profile. Use the same price observation ID once when multiple viewers read the shared price book. A historical price can carry only the original label. Verify ambiguous names before combining results. The workspaceRecords examples below describe the separate publication API for workspace-wide rows.

Keep the data shared at each scope explicit. For example, a workspace price can expose a supplier, unit price, currency and offer date. An offer document attached to a restricted project retains its own access checks.

Declare a collection

This example exposes tasks from <project>.isap/extensions/field-operations/boards/*.json. Each file contains tasks and columns arrays. The task ID is stable, assignee.userId contains the dashboard user identity, and a task’s column determines whether it is complete.

{
  "id": "field-operations",
  "name": "Field operations",
  "version": "1.0.0",
  "entry": "index.html",
  "permissions": ["filesystem_read"],
  "searchCollections": {
    "schemaVersion": 1,
    "items": [{
      "id": "tasks",
      "description": "Assigned field tasks, priorities and deadlines on active boards.",
      "scope": "project",
      "storage": { "kind": "jsonDirectory", "path": "boards", "array": "tasks" },
      "idField": "id",
      "fields": ["title", "priority", "dueDate"],
      "searchFields": ["title"],
      "dateField": "dueDate",
      "assigneeField": "assignee.userId",
      "completion": { "kind": "column", "field": "columnId", "columns": "columns", "idField": "id", "doneField": "done" },
      "archivedField": "archived"
    }]
  }
}
Manifest field Meaning
id, description Choose a collection ID unique within the extension and a short description that helps chat decide when to use it. sources is reserved for discovery. Use 1–64 lowercase ASCII letters, digits, hyphens or underscores in the ID.
scope, storage Choose one of the storage forms below. Project paths are relative to extensions/<extension-id>/ in the authorized .isap folder.
idField Field in each row holding its stable, nonempty string identity.
fields, searchFields Declare up to 32 unique scalar fields for output and choose at least one of these for text matching. A dotted path such as customer.name addresses a nested scalar and is returned under that key.
dateField Optional row field with a calendar date in YYYY-MM-DD. Enables inclusive fromDate and throughDate filters.
assigneeField Optional row field holding the assigned user’s stable dashboard ID. The dashboard resolves the caller’s identity when filtering with assignedToMe.
completion Use {"kind":"boolean","field":"done"} for a boolean on each row. For JSON sources, column joins the row’s column ID to a column in the containing document and uses its boolean doneField. Enables the completed filter.
archivedField Optional boolean path in a containing JSON document. Set it to a board’s archive flag to exclude archived boards.
publishers Optional list of extension IDs permitted to publish to a workspace collection. For example, a price-register extension can accept reviewed prices from a separate quotation extension.

A version 1 manifest can declare up to 32 collections. Each description is plain text up to 512 UTF-8 bytes. Field paths contain up to eight dot-separated segments using ASCII letters, digits, underscores and hyphens. Use fixed relative storage paths with up to eight segments using ASCII letters, digits, underscores, dots and hyphens. The manifest validator rejects absolute paths, dot-prefixed segments, traversal and empty segments.

Storage forms

storage example Dashboard data read
{"kind":"jsonFile","path":"inventory/current.json","array":"items"} Reads rows from the selected array of one JSON file. Requires filesystem_read.
{"kind":"jsonDirectory","path":"boards","array":"tasks"} Reads the selected array from direct .json children of a project directory. Requires filesystem_read.
{"kind":"kvList","path":"inventory.kv","key":"items"} Reads values from one list in the project’s live KV store. Each value carries the declared idField. Requires the JSON project permissions and kv_store_read.
{"kind":"workspaceAsset","asset":"suppliers"} or {"kind":"workspaceAsset","asset":"prices"} Reads the managed workspace register. Declare filesystem_read, kv_store_read and the corresponding workspace_asset_suppliers_read or workspace_asset_prices_read permission.
{"kind":"projectManifest"} Discovers active shared projects through their manifests, including projects without planning tasks. Declare group_projects_read and filesystem_read. Use the returned projectId to select a project.
{"kind":"preparedDocuments"} Reads ISA Files’ prepared passages for the current documents in an accessible project. Each match identifies its source.
{"kind":"matchProject"} Reads the ISA Match project store through the dashboard’s quotation reader, including previously stored projects.
{"kind":"workspaceRecords"} Reads records published into a workspace collection owned by this extension. The dashboard captures workspace and publisher identity at the host boundary.

Built-in project readers

ISA Projects' projects collection returns the portable manifest ID as id and the authorized dashboard folder ID as projectId. Use projectId for subsequent calls. When two names match, use their distinct identities to select the intended project.

ISA Match uses matchProject for spec_items, open_requests and received_quotes. A read uses the current project store or its supported legacy location. The reader derives outstanding requests from recorded requests, received quotes and current specification items at query time. An open request has one row per unanswered request and applicable item. For an exact supplier match, pass the advertised supplierId to open_requests or received_quotes. Use requestedAt or receivedAt for date ranges on the corresponding collection.

The reader skips a project when its Match store exceeds the per-project read budget and continues searching the other authorized projects. Add up unsearchedProjects across all pages and report that count with the matches, including on the final page. Selecting a single project does not raise its read budget.

The preparedDocuments reader is specific to ISA Files. Search isa-files/passages for a short phrase in the prepared texts of accessible projects. A result identifies documentId, documentName, sourceSha256, anchor, an optional page, and an excerpt in text. This includes document preparations shared with ISA Files by ISA Contracts. Check unsearchedDocuments across all returned pages when describing coverage.

Publish a workspace collection

The owner declares the collection in its manifest. A separate workspace-wide demonstration register called example-register could publish the following collection.

{
  "schemaVersion": 1,
  "items": [{
    "id": "prices",
    "description": "Quoted product and rental prices by supplier, unit and quotation date.",
    "scope": "workspace",
    "storage": { "kind": "workspaceRecords" },
    "idField": "id",
    "fields": ["description", "supplier", "unitPrice", "unit", "currency", "receivedAt"],
    "searchFields": ["description", "supplier"],
    "dateField": "receivedAt",
    "publishers": ["isa-match-rsx-to-quote"]
  }]
}

The register UI declares workspace_records_search to query rows. A publishing extension declares workspace_records_upsert. The destination collection authorizes that extension in publishers. Assign stable IDs to observations so retrying a write identifies the same observation. Choose fields suitable for all workspace members. The original project document can be referenced from a project-scoped collection if members also need to search restricted details.

An example writer and reader use the bridge as follows. Both run inside an extension launch in the selected workspace.

await bridge.invoke('workspace_records_upsert', {
  source: 'example-register',
  collection: 'prices',
  records: [{
    id: 'offer-42-v1-line-3',
    value: {
      description: 'Verkeersbord huren', supplier: 'Voorbeeldbedrijf',
      unitPrice: 12, unit: 'week', currency: 'EUR', receivedAt: '2026-04-20'
    }
  }]
});

const page = await bridge.invoke('workspace_records_search', {
  source: 'example-register', collection: 'prices', query: 'verkeersbord', limit: 10
});

A batch accepts 1–100 distinct record IDs and commits together. The dashboard inserts id into a value when idField is id and the value omits it. For any other idField, provide the matching string at that path. Keep each record’s serialized value within 8 KiB and use only declared fields or filter paths. Omit query to browse a collection. Workspace search returns declared fields, id and a dashboard recordId. Resume with nextOffset when present. Use row field names distinct from the host-projected recordId, projectId, projectName, sourceFile, sourceFileId and completed metadata. The group that originally published the row can revise it. A replay from a different group can confirm an identical value.

Package and verify

  1. Build traditional JSON, KV or published collections with isa-ext 0.2.1 or later. For managed assets, project manifests, prepared documents and ISA Match use 0.2.2 or later. Refresh the vendored packager and manifest crate when the project bundles its CLI. Inspect dist/<extension-id>.isax/extension.json for the collection ID, scope and fields.
  2. Install or update the package in a workspace. In the package preview, review which collections are workspace-wide, which fields are returned, and which other extensions can publish. Enable Read extension data for the conversation’s group and enable the project extension for that group when searching project records. Use a chat model that supports tool calls. A local model in the native app also needs an online dashboard connection for this tool.
  3. Start with {"collection":"sources"}. Choose an advertised source and collection. For the example above, {"source":"field-operations","collection":"tasks","assignedToMe":true,"completed":false} finds the caller’s open tasks. For ISA Pricing, {"source":"isa-pricing","collection":"prices","query":"verkeersbord"} searches shared prices. For a profile, use an advertised supplier collection and its exact supplier ID filter.
  4. Check results with two groups in the same workspace. Groups with access to the price asset can find its prices. A project task should appear only in an authorized project and match the current assignee when requested. Revoke the group’s ordinary folder access and verify that a new search respects the change.

Search pages default to ten results and accept up to 25. Use the returned nextCursor or nextOffset with the same search criteria when more results are needed. A partial page can contain zero matches while the scan still has more sources to read. When a managed asset returns status: "indexing", partial: true and an empty page, retry the same question once within the read budget. If the index is still being prepared, report that state and leave the existence of matching prices or suppliers open. Report incomplete coverage whenever pagination stops early. For passage search, add up the page-level unsearchedDocuments counts. A document can be partially searched when preparation produced warnings. Report that limitation even when the last page has no continuation. Give the document name, anchor and page when available.

A project page scans up to four active project folders available through ordinary group folder access, four direct JSON files per project and 1,024 input rows. A JSON file can contain up to 4 MiB. A logical KV page reads at most 128 rows with a bounded decoded size. Project results include id, projectId, projectName, sourceFile and sourceFileId. Use these to identify the matching record in context. If the dashboard reports a changed source during continuation, restart the search to read current results.