@collective-intelligence/external-apps-server-sdk-payload 0.0.0-stage → 0.13.1

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 (61) hide show
  1. package/AGENTS.md +49 -0
  2. package/README.md +121 -2
  3. package/dist/ci-generate/declarations/ci-generate/generate.d.ts +10 -0
  4. package/dist/ci-generate/declarations/entrypoints/ci-generate.d.ts +6 -0
  5. package/dist/ci-generate/declarations/knowledge/body.d.ts +32 -0
  6. package/dist/ci-generate/declarations/knowledge/files.d.ts +42 -0
  7. package/dist/ci-generate/declarations/knowledge/manifest.d.ts +19 -0
  8. package/dist/ci-generate/declarations/package/builder.d.ts +63 -0
  9. package/dist/ci-generate/declarations/package/contract.d.ts +16 -0
  10. package/dist/ci-generate/declarations/package/stamped-fields.d.ts +7 -0
  11. package/dist/ci-generate/declarations/plugin/editor-field.d.ts +20 -0
  12. package/dist/ci-generate/declarations/plugin/integration-user.d.ts +11 -0
  13. package/dist/ci-generate/declarations/plugin/parts.d.ts +81 -0
  14. package/dist/ci-generate.d.ts +1 -0
  15. package/dist/ci-generate.js +2 -0
  16. package/dist/index/declarations/ci-generate/generate.d.ts +10 -0
  17. package/dist/index/declarations/entrypoints/index.d.ts +6 -0
  18. package/dist/index/declarations/knowledge/body.d.ts +32 -0
  19. package/dist/index/declarations/knowledge/files.d.ts +42 -0
  20. package/dist/index/declarations/knowledge/identity.d.ts +27 -0
  21. package/dist/index/declarations/knowledge/manifest.d.ts +19 -0
  22. package/dist/index/declarations/knowledge/push-job.d.ts +8 -0
  23. package/dist/index/declarations/knowledge/source.d.ts +24 -0
  24. package/dist/index/declarations/operations/conflict.d.ts +22 -0
  25. package/dist/index/declarations/operations/markdown.d.ts +25 -0
  26. package/dist/index/declarations/operations/operations.d.ts +30 -0
  27. package/dist/index/declarations/operations/write-back.d.ts +8 -0
  28. package/dist/index/declarations/package/builder.d.ts +63 -0
  29. package/dist/index/declarations/package/contract.d.ts +16 -0
  30. package/dist/index/declarations/package/stamped-fields.d.ts +7 -0
  31. package/dist/index/declarations/plugin/editor-field.d.ts +20 -0
  32. package/dist/index/declarations/plugin/grant-store.d.ts +21 -0
  33. package/dist/index/declarations/plugin/integration-user.d.ts +11 -0
  34. package/dist/index/declarations/plugin/parts.d.ts +81 -0
  35. package/dist/index/declarations/plugin/plugin.d.ts +10 -0
  36. package/dist/index.d.ts +1 -0
  37. package/dist/index.js +7 -0
  38. package/dist/package.d.ts +134 -0
  39. package/dist/package.js +24 -0
  40. package/docs/guide/ai/index.md +379 -0
  41. package/docs/guide/ai/studio.md +245 -0
  42. package/docs/guide/data/connectors.md +267 -0
  43. package/docs/guide/data/datasets.md +145 -0
  44. package/docs/guide/data/documents.md +235 -0
  45. package/docs/guide/data/index.md +62 -0
  46. package/docs/guide/data/knowledge.md +214 -0
  47. package/docs/guide/develop/extensions.md +299 -0
  48. package/docs/guide/develop/external-apps.md +289 -0
  49. package/docs/guide/develop/infrastructure.md +135 -0
  50. package/docs/guide/develop/sdks.md +252 -0
  51. package/docs/guide/index.md +83 -0
  52. package/docs/guide/platform/access.md +311 -0
  53. package/docs/guide/platform/architecture.md +166 -0
  54. package/docs/guide/platform/built-ins.md +225 -0
  55. package/docs/guide/platform/entrypoints.md +320 -0
  56. package/docs/guide/scenarios/index.md +130 -0
  57. package/docs/guide/template/index.md +295 -0
  58. package/docs/guide/template/state-machines.md +294 -0
  59. package/docs/payload-connector.md +890 -0
  60. package/docs/payload-page-editor-skill.md +284 -0
  61. package/package.json +79 -4
@@ -0,0 +1,145 @@
1
+ # Datasets
2
+
3
+ Query typed tables of measurements, events and warehouse data, and control who can read them.
4
+
5
+ A Dataset is a typed collection of rows that belongs to an Organization. Each Dataset has a stable identity, a versioned definition, a policy that says who may query it, and provenance on every result. Datasets hold data that has many rows and few edits, such as meter readings, monthly sales figures or a table in a customer's data warehouse. Agents, workflows and Studio query that data in bounded, typed requests.
6
+
7
+ ## Datasets and Knowledge
8
+
9
+ A Dataset holds observations about the things that Knowledge records describe, with one row per measurement, event or transaction. The [Data resources](index.md) page compares Datasets with Knowledge and Documents and lists which kind fits which demo situation.
10
+
11
+ A strategy Metric shows the split. The Metric itself is a Knowledge record with an owner, a target, a unit, a status and links to goals, and its history of measured values is a Dataset. A Dataset field such as `customerId` can bind to the Customer schema in Knowledge. That binding links the two without copying rows into Knowledge, and deleting one side does not delete the other.
12
+
13
+ ```mermaid
14
+ flowchart LR
15
+ subgraph K[Knowledge]
16
+ KS[Customer schema]
17
+ end
18
+ subgraph D[Datasets]
19
+ DS[Orders Dataset]
20
+ end
21
+ K --- KC[Records, relation fields, semantic search]
22
+ D --- DC[Typed rows, measures, aggregates, time buckets]
23
+ DS -. optional binding on customerId .-> KS
24
+ ```
25
+
26
+ ## Managed and External Datasets
27
+
28
+ A Dataset has one of two backings. CI stores the rows of a Managed Dataset in PostgreSQL, in the Organization Dataset Store. The rows of an External Dataset stay in the customer's system, and CI queries them live. Both backings use the same query contract, so tools, workflows and Studio do not need to know which one they read. The backing shows only in the provenance, the capabilities and the freshness of a result.
29
+
30
+ CI keeps no hidden copy of External data. Every query reaches the provider and CI caches no results, so when the provider is down the query fails with no fallback.
31
+
32
+ | Provider | Backing | Source |
33
+ | ----------------------------------------------------------------------- | -------- | ---------------------------------------------------------- |
34
+ | `builtin.core.datasets.providers.postgres` | Managed | Rows stored in CI |
35
+ | Microsoft Fabric (package `builtin.integrations.microsoft-fabric`) | External | Fabric Warehouses and Lakehouse SQL analytics endpoints |
36
+ | Databricks (package `builtin.integrations.databricks`) | External | Unity Catalog tables and views through one SQL Warehouse |
37
+ | Remote Gateway (`builtin.core.external-apps.providers.remote-external`) | External | A customer server that exposes rows through the server SDK |
38
+
39
+ The Fabric and Databricks packages do not install automatically, so install the package before you declare a Dataset that uses it. A Fabric connection holds one service principal from the customer's Microsoft Entra tenant, with a tenant ID, a client ID and a client secret or certificate. A Databricks connection uses service principal OAuth and rejects personal access tokens. A Fabric source location has exactly three parts: workspace, item and object. To combine several sources, combine them in the customer's warehouse and point the Dataset at the result. New Lakehouse tables can take a few minutes to appear on the Fabric SQL analytics endpoint, so refresh the metadata in Fabric if a new table is missing.
40
+
41
+ A Remote Gateway Dataset answers `records` queries only, with at most 1,000 rows, 1 MiB and 60 seconds per request. CI checks the Dataset policy first, and the customer server can narrow the result further but cannot widen it.
42
+
43
+ ## Load a Managed Dataset
44
+
45
+ In the Dashboard you create a Dataset in one of two ways: import a structured file as a Managed Dataset, or connect a compatible External source. A Managed import accepts CSV, Excel `.xlsx`, JSON arrays of records, JSON Lines and Parquet. CI inspects the file and proposes field types, identity fields and candidate time fields, and a person reviews and approves the proposal before CI loads any rows. There is no spreadsheet-style row editor.
46
+
47
+ Ingestion runs in the background. The API answers `202 Accepted` with a run ID, and you follow the run until it finishes. Each run uses one mode: `append` adds rows, `upsert` inserts or updates rows by their identity fields, and `replace` swaps all visible rows in one step. If an `upsert` run contains the same identity twice, CI rejects the run and does not pick one row for you.
48
+
49
+ The table template of the Dataset decides which modes it allows.
50
+
51
+ | Template | Purpose | Modes |
52
+ | ----------------- | -------------------------------- | ----------------------------- |
53
+ | `generic-table` | General typed records | `append`, `upsert`, `replace` |
54
+ | `entity-snapshot` | Current state keyed by entity | `upsert`, `replace` |
55
+ | `time-series` | Time-indexed measures | `append` |
56
+ | `event-log` | Append-only events | `append` |
57
+ | `fact-table` | Dimensions, measures and periods | `append`, `upsert` |
58
+ | `status-update` | Append-only status history | `append` |
59
+
60
+ ## Query a Dataset
61
+
62
+ A Dataset query has one of three kinds. `records` returns selected rows with filters, sort and pagination. `aggregate` groups measures by dimensions with `count`, `countDistinct`, `sum`, `average`, `minimum` and `maximum`. `timeSeries` buckets measures over a time field, with a grain from `minute` to `year`.
63
+
64
+ ```ts
65
+ type RecordsQuery = Readonly<{
66
+ kind: "records"
67
+ datasetId: string
68
+ definitionRevision?: string
69
+ select: readonly string[]
70
+ filters?: DatasetFilter
71
+ sort?: readonly DatasetSort[]
72
+ page: DatasetPageRequest
73
+ }>
74
+ ```
75
+
76
+ A Managed `records` query returns at most 50 fields, 100 rows and 1 MiB per response. Filters are combined with AND and use `eq`, `ne`, `lt`, `lte`, `gt`, `gte`, `contains` and `isNull`. CI returns 64-bit integers and decimals as exact JSON strings, so parse them before you do arithmetic.
77
+
78
+ Datasets accept no SQL. Calculated measures use a constrained expression model, and an operation that the provider cannot run fails with a typed capability error. CI never loads a whole table to compute a result in memory.
79
+
80
+ > **Note:** The External providers that ship today answer `records` and `aggregate`, and
81
+ > the Remote Gateway answers `records` only. Use a Managed Dataset when the demo
82
+ > needs `timeSeries`.
83
+
84
+ Every result carries its provenance: the Dataset ID, the definition revision, the query kind, the backing, the freshness when the provider knows it, a correlation ID, the timing, and warnings for partial or stale results. Provenance never contains credentials or physical table names.
85
+
86
+ ## Access
87
+
88
+ Each Dataset has its own policy, and the policy lists its principals by ID. It holds `principals` (each a `user` or `service` with an `id`), `allowedOperations` (`describe`, `records`, `aggregate`, `time_series`), `allowedFields`, `sensitiveFields`, an optional `rowFilter`, and the limits `maxRows`, `maxBytes` and `maxTimeoutMs`. A user also needs the Organization permission to query Datasets, and a Dataset grant does not give Organization membership or capabilities.
89
+
90
+ Knowledge access works differently: each Knowledge Data Policy targets one schema, and no policy targets a whole domain. The [Access](../platform/access.md) page explains both models.
91
+
92
+ > **Warning:** A package-declared Dataset without a `dataPolicy` grants access to nobody,
93
+ > including the person who deployed it. Always declare the principals that the
94
+ > demo needs.
95
+
96
+ ## Declare a Dataset in a package
97
+
98
+ `declareDatasetConnectorInstance` declares a Dataset in a package. An External declaration names the provider, a connection slot, the source location and the policy:
99
+
100
+ ```ts
101
+ const orders = declareDatasetConnectorInstance({
102
+ manifest: { fqn: "com.acme.sales.instances.orders", version: "1.0.0" },
103
+ presentation: { displayName: "Warehouse orders" },
104
+ definition: {
105
+ lifecycle: { deployMode: "init_only", readonly: false },
106
+ bindingMode: "external",
107
+ providerFqn: "com.acme.integrations.warehouse",
108
+ connection: { setupKey: "warehouse" },
109
+ sourceLocation: {
110
+ segments: [
111
+ { kind: "container", opaqueId: "sales", label: "Sales" },
112
+ { kind: "dataset", opaqueId: "table:orders", label: "Orders" }
113
+ ]
114
+ },
115
+ dataPolicy: {
116
+ principals: [{ kind: "user", id: "7f824c46-..." }],
117
+ allowedOperations: ["describe", "records"],
118
+ allowedFields: ["id", "total"],
119
+ maxRows: 1000,
120
+ maxBytes: 1048576
121
+ }
122
+ }
123
+ })
124
+ ```
125
+
126
+ A deploy configures Datasets and loads no data. An External Dataset is ready to query live once its connection works, and its optional schedules run health checks or propose definition changes for review. A Managed declaration creates an empty Dataset, and loading rows stays a manual import. CI refuses a Managed declaration when the Organization Dataset Store is not enabled. Removing the package never deletes Managed rows.
127
+
128
+ ## Datasets for agents and workflows
129
+
130
+ Agents use one tool, Query Dataset (`builtin.core.datasets.tools.query`). It lists, describes and queries the Datasets that an agent may use, with bounded `records`, `aggregate` and `timeSeries` requests. You choose those Datasets by ID in the Skill binding, and an empty selection gives the agent no Datasets. The agent never passes SQL, provider names, connections or table locations. The [AI](../ai/index.md) page explains Skills and tool bindings.
131
+
132
+ Workflows have one node for each operation: describe, query records, query aggregate and query time series. Studio shows Datasets in their own area, apart from the Knowledge views.
133
+
134
+ ## Limits
135
+
136
+ Datasets are sized for about 100,000 to 1,000,000 data points per Organization and do not fit a high-volume telemetry stream. Joins across Datasets, writes back to External Datasets, streaming ingestion and copying External data into a Managed Dataset are not available. A route for external applications to query Datasets directly is planned; today agents, workflows and Studio run the queries.
137
+
138
+ ## Related pages
139
+
140
+ - [Data resources](index.md)
141
+ - [Knowledge](knowledge.md)
142
+ - [Connectors](connectors.md)
143
+ - [Access](../platform/access.md)
144
+ - [AI](../ai/index.md)
145
+ - [Extensions](../develop/extensions.md)
@@ -0,0 +1,235 @@
1
+ # Documents
2
+
3
+ Keep files in Document Collections, sync them from Microsoft 365 or Google Drive, control who reads them, and know when their content becomes searchable.
4
+
5
+ Documents is the Data resource for files. It keeps files in Document Collections, with folders, Documents and Versions, and with permissions on each collection and folder. Knowledge holds typed records with fields, and Documents holds files that people browse in Studio and that agents and workflows search. A Knowledge file field also stores its file through Documents, in an internal collection that Documents browse and search never show; a reader reaches that file through the Knowledge record. See [Knowledge](knowledge.md) for records and file fields.
6
+
7
+ ## Collections, Documents and Versions
8
+
9
+ | Term | Meaning |
10
+ | -------------------- | ------------------------------------------------------------------------------------------------------ |
11
+ | Document Collection | The container and permission boundary. Each collection has one source: Local or Connected. |
12
+ | Local Collection | A collection with no outside system. CI holds the authoritative copy of its files. |
13
+ | Connected Collection | A collection that one Documents connector keeps in sync with folders in Microsoft 365 or Google Drive. |
14
+ | Document | The identity of one file. It sits in exactly one folder. |
15
+ | Document Version | An immutable revision of a Document. Changed bytes create a new Version; a rename or a move does not. |
16
+
17
+ Files enter a Local Collection through the API and through workflows. A Connected Collection follows its provider: the outside drive stays authoritative, and each sync imports its changes as new Documents and Versions. Two actions in Studio show the difference. Download returns the bytes of the stored Version that the reader selected, and open original opens the live file at the provider, which can be newer than the last sync.
18
+
19
+ ## Where people work with Documents
20
+
21
+ Organization admins and Tenant admins manage collections in the Dashboard under **Documents**, then **Collections**. **Add new** opens Setup. A Local Collection takes two steps, Source and Details. A Connected Collection adds a Connection step, where you pick a Documents connector and a connection, and a Sync step with **Automatic sync**, which is on by default. Details holds the name, the remote folders and the two indexing options, **Index content** and **Index overview**.
22
+
23
+ The detail page of a collection has a **Files** tab with a folder explorer and file details, including Versions, and a **Permission tester** tab. It also shows the indexing and sync settings, the sync status and a **Sync now** action. An Organization admin can inspect folders, files and Version identifiers there without permission to read their content.
24
+
25
+ End users read Documents in Studio. The Documents page lists the collections that the user can read, shows their folders and files, searches by file name and content, downloads the selected Version and opens the original at the provider. It has no upload or edit controls. Plain text files up to 1 MiB show a text preview; other files show a fallback and stay downloadable.
26
+
27
+ > **Warning:** Both indexing options are off by default, in Dashboard Setup and in a package
28
+ > declaration. With both off, CI uses no embeddings and no AI processing for the
29
+ > collection's files, so semantic search and the retrieval tools find nothing in
30
+ > their content. Turn on **Index content** (or `indexContent: true`) for any
31
+ > demo step that searches inside files.
32
+
33
+ ## Permissions
34
+
35
+ Documents has three operations. `read` is called View in the Dashboard and opens the current Version of each file. `history` is called View history and opens older Versions and the Version list. `write` creates, updates and deletes. A Document Data Policy opens one of these operations on one collection or one folder for the holders of a capability. Unlike a Knowledge Data Policy, it has no `where` clause and no Grant Axes.
36
+
37
+ The core default policies open View to holders of the core Documents data capability at `read` and `write` at `manage`. No default policy opens View history, so members see older Versions only where a package Document Data Policy opens `history`. Holders of the Documents admin capability at `manage` get all three operations.
38
+
39
+ A package declares its own capability and the policies that use it:
40
+
41
+ ```ts
42
+ import {
43
+ access,
44
+ declareAccessCapabilities,
45
+ declareAccessDocumentDataPolicy
46
+ } from "@collective-intelligence/extensions-sdk"
47
+
48
+ export const hr = declareAccessCapabilities({
49
+ manifest: { fqn: "acme.hr", version: "1.0.0" },
50
+ definition: {
51
+ nodes: { policies: { kind: "readManage" } },
52
+ lifecycle: { deployMode: "upsert", readonly: true }
53
+ }
54
+ })
55
+
56
+ export const hrPoliciesRead = declareAccessDocumentDataPolicy({
57
+ manifest: { fqn: "acme.hr.policies.hr-policies-read", version: "1.0.0" },
58
+ definition: {
59
+ collection: hrPolicies, // the declaration in the next section
60
+ operation: "read",
61
+ capability: access.requires(hr.policies, "read")
62
+ }
63
+ })
64
+ ```
65
+
66
+ A policy on a folder uses `folder: { collection, target: { drive, folders } }` in place of `collection`. A second policy with `operation: "history"` lets the same people open older Versions. Who holds the capability comes from Access Profiles and Access Grants, which [Grants and permissions](../platform/access.md) explains.
67
+
68
+ To check a result, open the collection's **Permission tester**, choose **View collection as** and pick a person. The tester shows View, View history and Update for each file. It tests the Documents that already exist, so a Connected Collection that has not imported any file yet shows an empty result. Check the sync status before you read an empty result as a denial.
69
+
70
+ ## Declare a Connected Collection in a package
71
+
72
+ `declareDocumentCollection` declares one Connected Collection whose identity is the declaration FQN. No option declares a Local Collection.
73
+
74
+ ```ts
75
+ import {
76
+ declareDocumentCollection,
77
+ packageVariables
78
+ } from "@collective-intelligence/extensions-sdk"
79
+
80
+ const vars = packageVariables({ hrDrive: { type: "string" } })
81
+
82
+ export const hrPolicies = declareDocumentCollection({
83
+ manifest: { fqn: "acme.documents.hr-policies", version: "1.0.0" },
84
+ presentation: {
85
+ displayName: "HR policies",
86
+ description: "Company HR policies"
87
+ },
88
+ definition: {
89
+ connectorFqn:
90
+ "builtin.integrations.microsoft-365.connectors.documents-drive",
91
+ connection: { setupKey: "microsoft365" },
92
+ title: "HR Policies",
93
+ indexContent: true,
94
+ remoteRoots: [{ drive: vars.hrDrive, folders: ["Policies"] }]
95
+ }
96
+ })
97
+ ```
98
+
99
+ `connection` names a connection that the package declares (`{ connectionInstanceFqn }`) or an existing one (`{ setupKey }`, filled with a `{ connectionId }` in the Inputs File). `indexContent` and `indexOverview` default to `false`, and `syncEnabled` defaults to `true`. A remote root is a path `{ drive, folders }` or a `{ remoteId }`. On Microsoft 365, `drive` is the drive title `<siteName> / <libraryName>` that the Dashboard source browser shows, and an empty `folders` names the whole drive. Each value can be a Package Variable, so one release serves environments with different folders.
100
+
101
+ You can leave out `connectorFqn`. The deploy then takes the one Documents connector among the package dependencies whose connection template matches, and it refuses the deploy when none or several match. One `ci deploy` also installs a missing built-in dependency such as `builtin.integrations.microsoft-365`.
102
+
103
+ Package declaration is verified for Microsoft 365 only. Create a Google Drive collection through Dashboard Setup, which offers every installed Documents connector.
104
+
105
+ The first deploy resolves each folder at the provider before it changes anything, so a missing folder refuses the deploy. A later deploy of the same declaration writes nothing and never starts a sync. Removing the declaration, or uninstalling the package, keeps the collection and its files.
106
+
107
+ > **Note:** A Microsoft 365 app that has only the `Files.SelectedOperations.Selected`
108
+ > permission cannot list drives, so a path of names cannot resolve. Declare each
109
+ > root of such a tenant as `{remoteId}`.
110
+
111
+ ## Sync
112
+
113
+ | Connector | FQN | Reads |
114
+ | ----------------------- | ------------------------------------------------------------------ | ------------------------------------------------------ |
115
+ | Microsoft 365 Documents | `builtin.integrations.microsoft-365.connectors.documents-drive` | OneDrive and SharePoint drives through Microsoft Graph |
116
+ | Google Drive Documents | `builtin.integrations.google-workspace.connectors.documents-drive` | My Drive and shared drives |
117
+
118
+ Each Connected Collection has its own Documents connector instance, and two Connected Collections on the same provider account cannot overlap their root folders. Google Drive exports native files as Office files: Docs as DOCX, Sheets as XLSX, Slides as PPTX and Drawings as PNG. It skips native types that have no export, and the Microsoft 365 connector skips OneNote notebooks.
119
+
120
+ With **Automatic sync** on, CI starts a sync five minutes after the last attempt ended, also after a failed one. **Sync now** starts one at once. With Automatic sync off, the collection syncs only on Sync now. A sync saves its provider position only after it applies the changes, so an interrupted sync continues without losing any. A Local Collection has no sync status.
121
+
122
+ | Status | Meaning |
123
+ | ----------- | --------------------------------------------------------------------------------------------------------------- |
124
+ | Not synced | No sync has completed yet. |
125
+ | Syncing | A sync is requested or running. |
126
+ | Up to date | A sync completed in the last ten minutes, or at any time when Automatic sync is off. |
127
+ | Sync issues | The last sync failed, a Quarantined File is open, or Automatic sync is on and no sync completed in ten minutes. |
128
+
129
+ Excluded Folder Names keep archive folders out. The package declaration sets them with `excludedFolderNames`, for example `["archives"]`, and no Dashboard field changes them. A file below a folder with one of these names, at any depth under a root, is never downloaded, read or embedded. The match ignores case, accents, outer spaces and one pair of `[]` or `()` around the name, and the whole name must match. A root is never excluded by its own name. A Document that was imported before its folder took an excluded name leaves search, browse and the AI tools, and it comes back with the same identity when the folder leaves the excluded name. A changed list makes the next sync walk every folder again.
130
+
131
+ A file whose download fails three times on the same provider revision becomes a Quarantined File. The sync stops fetching it and shows it as an error in **Sync issues**, which sets the status to Sync issues. **Sync now** tries every Quarantined File once more, and a new revision of the file at the provider starts it again. Other failed downloads retry on their own and show as warnings that do not change the status.
132
+
133
+ ## Supported file formats
134
+
135
+ | Group | Formats | How CI reads them | Needs |
136
+ | ------------- | ---------------------------------------- | ---------------------------------------------------------- | ---------------------- |
137
+ | Text | TXT, MD, CSV, JSON | Text reader | Nothing |
138
+ | PDF | PDF | Text and structure, page OCR for pages with almost no text | A vision model for OCR |
139
+ | Office | DOCX, XLSX, PPTX | Office readers | Nothing |
140
+ | Legacy Office | DOC, XLS, PPT, RTF | Conversion to DOCX, XLSX or PPTX, then the Office readers | The Compute service |
141
+ | Images | JPEG, PNG, WebP | Visible text and a description from a vision model | A vision model |
142
+ | Audio | AAC, AIFF, FLAC, M4A, MP3, OGG, WAV, WMA | Speech transcription | The Compute service |
143
+ | Video | AVI, MKV, MOV, MP4, WebM, WMV | Speech transcription of the audio track | The Compute service |
144
+
145
+ CI reads no other format. HTML, TIF, TIFF, BMP and GIF files, for example, sync and download like any file, but CI does not index their content. The Compute service is a separate CI service that runs transcription and Office conversion.
146
+
147
+ Each entry path has its own list of accepted formats. Documents accepts all formats in the table. Knowledge file fields accept DOC, DOCX, JPEG, MD, PDF, PNG, PPT, PPTX, RTF, TXT, WebP, XLS and XLSX. A CI deployment can narrow either list. A file outside the list still syncs, lists and downloads, and its indexing status is `unsupported`. Without the Compute service, a legacy Office file is `unsupported` with the reason that conversion is not available.
148
+
149
+ ## What CI reads from each format
150
+
151
+ For a PDF, CI reads the native text and rebuilds its structure. In a PDF of three or more pages it removes headers and footers that repeat across pages. It finds headings up to six levels from their numbering and font size, and the document title on page one. It rebuilds tables from ruled grids or from aligned columns, also when a table continues on the next page, and it reads multi-column pages column by column. A page with fewer than 50 letters and digits goes to page OCR, and a PDF with almost no text is read by OCR as a whole.
152
+
153
+ For Office files, CI keeps what the author sees:
154
+
155
+ - DOCX headings come from Word heading styles in any language, and from font size only when the file uses no heading style. Text boxes, footnotes and endnotes stay next to the text that holds them. Deleted tracked changes and comments stay out, and headers and footers are kept as metadata.
156
+ - PPTX gives the shown slides with their groups, tables and speaker notes. Hidden slides give nothing, and the title of the first slide is the document title.
157
+ - XLSX gives one table per visible sheet. Hidden sheets, rows and columns give nothing, dates use ISO 8601, and a text cell such as `00123` keeps its leading zeros.
158
+
159
+ A merged cell repeats its value down the rows it covers, so each table row has the full column count.
160
+
161
+ DOC, XLS, PPT and RTF files go through one conversion with LibreOffice in the Compute service, and the Office readers then read the converted copy. The copy stays internal: search results, citations and downloads always point to the original file. The conversion never runs macros and never fetches external content. A corrupt or password-protected file, a conversion over 60 seconds or an empty result fails that file.
162
+
163
+ Images in DOCX, PPTX and PDF files go to the vision model too, as do stand-alone JPEG, PNG and WebP files. Each kept image gives its visible text and a short description. CI drops images whose short side is under 128 pixels, keeps at most 50 images per file and reads each distinct image once. Each described image uses one page of the Organization's daily OCR budget. A file with an image that failed or found no budget is `partial`.
164
+
165
+ Audio and video go to the Compute service for transcription, which detects the language. A video gives the speech of its audio track; CI does not index video frames. Opening, downloading or searching a file never starts a transcription.
166
+
167
+ The file indexing strategy decides how much of this work runs. CI takes the Organization's setting, else the tenant default, else `text_with_image_descriptions`.
168
+
169
+ - `text_only` reads text only and drops images.
170
+ - `text_with_ocr` adds page OCR for sparse PDF pages and reads stand-alone image files.
171
+ - `text_with_image_descriptions`, the default, also describes every kept image.
172
+ - `hybrid_multimodal` also stores an image vector for each kept image, and it needs an embedding model that accepts images.
173
+
174
+ Every strategy except `text_only` needs an enabled vision model.
175
+
176
+ | Limit | Default |
177
+ | ---------------------------------- | ---------------------------------------------------- |
178
+ | PDF page OCR and image reading | PDFs up to 32 MiB; text extraction has no size limit |
179
+ | One image sent to the vision model | 8 MiB |
180
+ | Audio and video transcription | 100 MiB and 30 minutes per file |
181
+ | Legacy Office conversion | 60 seconds per file |
182
+ | Studio text preview | 1 MiB |
183
+
184
+ Above 32 MiB, a PDF keeps the native text of its sparse pages and becomes `partial`, and a PDF with almost no text fails.
185
+
186
+ ## How indexing works
187
+
188
+ ```mermaid
189
+ flowchart LR
190
+ S[Sync or API write] --> V[New Document Version]
191
+ V --> E[Extraction: text, structure, OCR, images, speech]
192
+ E --> F[Fragments]
193
+ F --> M[Embeddings]
194
+ M --> Q[Searchable]
195
+ E -. optional .-> O[Overview]
196
+ ```
197
+
198
+ Knowledge file fields and Documents share one processing pipeline. Extraction turns a file into text and structure. Segmentation cuts that text into Fragments, the units that search and the retrieval tools return. CI then embeds each Fragment with the document title in front, so a passage from page 40 still says which file it comes from. With **Index overview** on, CI also writes a short summary of the file.
199
+
200
+ The pipeline keeps the structure that extraction found. CI splits a paragraph only when it is too long for one Fragment, and then between sentences. Fragments do not overlap. A table becomes groups of whole rows, and every group repeats the table header, so each Fragment is a readable table. A table never shares a Fragment with prose, and a heading joins the content that follows it.
201
+
202
+ CI stores one result for the same bytes in the same Organization with the same processing settings, and every Document and Knowledge file with those bytes uses that result. A duplicate file costs no second extraction or embedding. When the processing settings change, for example the file indexing strategy, CI processes the files again in the background, and the old result serves search until the new one is ready.
203
+
204
+ A file is searchable when its Fragments and their vectors are saved. CI does not wait for the overview. Only the current Version of each Document is in semantic search. While a new Version is processed, search keeps the previous Version, and it switches when the new one is ready.
205
+
206
+ ## Wait for indexing in a workflow
207
+
208
+ > **Warning:** A finished sync means that the files are imported. Indexing runs after the
209
+ > sync, so the new content is not searchable yet.
210
+
211
+ The Documents workflow nodes come in two branches, Local and Connected. Both have Create, List, Get, Update, Delete and Restore Collection, and Search Documents, Search Within Document, Expand Passage and Read Document Range. The Connected branch adds Start Collection Sync, Get Collection Sync Status, Set Collection Sync Settings and Wait for Collection Sync.
212
+
213
+ Wait for Collection Sync takes the import reference that Create Collection or Start Collection Sync returns, and a `wait` level. Level `sync`, the default, waits for that import. Level `indexing` also waits for the enabled indexing of the files that the import brought in. Use `indexing` before a demo step that searches the new content. Level `indexing` needs at least one indexing option on the collection, and the wait fails when both are off. An optional `expiresAt` ends the wait through an `expired` outcome. The wait never starts indexing and never changes the collection's settings.
214
+
215
+ A search node returns what is searchable when it runs. In a test, an empty result from a random query does not prove that a file is missing, because semantic search ranks by meaning. Test an empty result with a scope that you know is empty or with a filter that excludes everything.
216
+
217
+ ## Search and retrieval tools
218
+
219
+ Studio search matches file names at once and adds content matches from the semantic index. A file-name match works before indexing, and a content match needs an indexed Version. One search returns at most 100 results.
220
+
221
+ Agents and Skills search Documents through two built-in tools. Bind them as [AI](../ai/index.md) describes.
222
+
223
+ - Documents Query (`builtin.core.documents.tools.query`) searches Documents only. Each result has a title, a score, an overview and up to three ranked passages with their location. An empty `documentCollections` list searches every readable collection, and `documentId` searches inside one file. Its `coverage` output lists readable files that are still indexing, partial, failed or over budget.
224
+ - Advanced Information Retrieval (`builtin.core.information.tools.advanced-retrieval`) searches Knowledge and Documents together, and `sources` defaults to both. It comes with Expand Passage and Read Source Range to read the text around a passage. It also returns a file from a Knowledge file field when the reader can read that record.
225
+
226
+ Every search checks the reader's current permissions. A file that the reader may not read looks the same as a file that does not exist.
227
+
228
+ ## Related pages
229
+
230
+ - [Data resources](index.md)
231
+ - [Knowledge](knowledge.md)
232
+ - [Connectors](connectors.md)
233
+ - [Grants and permissions](../platform/access.md)
234
+ - [AI](../ai/index.md)
235
+ - [Extensions](../develop/extensions.md)
@@ -0,0 +1,62 @@
1
+ # Data resources
2
+
3
+ Choose between Knowledge, Datasets and Documents, and see where each kind keeps its data.
4
+
5
+ Collective Intelligence (CI) has three kinds of Data resource: Knowledge, Datasets and Documents. Each kind has its own unit. A Knowledge schema holds records, a Dataset holds typed rows, and a Document Collection holds files. Choose the kind for each part of your demo first, then open its page. Every Data resource belongs to one Organization; [Platform architecture](../platform/architecture.md) explains how CI keeps the data of Organizations apart.
6
+
7
+ ## Which kind to use
8
+
9
+ - Users create, edit and link items such as a customer, a Lead or a goal: use Knowledge.
10
+ - The customer keeps a warehouse in Microsoft Fabric or Databricks: use an External Dataset, which CI queries live.
11
+ - The customer has a CSV or Excel export and wants to see trends or totals: import it into a Managed Dataset.
12
+ - People read, search and cite files such as contracts, manuals or reports: use Documents. Pick a Connected Collection when the files live in Microsoft 365 or Google Drive, and a Local Collection when your demo adds the files itself.
13
+ - One record needs an attached file, such as a signed PDF on a Lead: use a file field on the Knowledge schema.
14
+
15
+ Knowledge and Datasets often appear in the same demo. Knowledge models the things that people talk about, edit and link, with one record per thing. A Dataset models observations about those things, with one row per measurement, event or transaction, and CI does not create a Knowledge record for each row. The [Datasets](datasets.md) page shows how a Dataset field can bind to a Knowledge schema without copying rows.
16
+
17
+ ## Compare the three kinds
18
+
19
+ | | Knowledge | Datasets | Documents |
20
+ | --------------- | -------------------------------------------------------------- | --------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
21
+ | One item is | A record of a schema | A row of a Dataset | A Document with immutable Versions, in a Document Collection |
22
+ | Who changes it | People in forms, Studio and apps, plus agents and workflows | Ingestion runs for a Managed Dataset, the source system for an External one | The API and workflows for a Local Collection, sync for a Connected one |
23
+ | Links | Relation fields between records | An optional binding from a Dataset field to a Knowledge schema | Folders inside the collection |
24
+ | Queries | Field filters, text search, semantic search and relation paths | `records`, `aggregate` and `timeSeries` | Filename search and semantic search over content |
25
+ | Access | Knowledge Data Policies, each on one schema | One policy per Dataset with an explicit list of principals | Document Data Policies and rules per collection, folder and file |
26
+ | Tool for agents | Knowledge Query | Query Dataset | Documents Query |
27
+
28
+ Advanced Information Retrieval is the one tool that searches more than one kind in a single call. It covers Knowledge and Documents. Agents query Datasets with Query Dataset only. The [AI](../ai/index.md) page explains tools and Skills.
29
+
30
+ ## Where the data lives
31
+
32
+ Two questions describe each mode. The first asks who holds the authoritative copy: a managed mode keeps it in CI, and an external mode leaves it in the outside system. The second asks whether a connector keeps the data in sync from an outside system; data that a connector syncs is connected.
33
+
34
+ ```mermaid
35
+ flowchart LR
36
+ W[People, apps, agents, workflows] --> K[Knowledge records]
37
+ S[Outside system] -->|connector sync| KC[Connected Knowledge records]
38
+ F[File import] --> M[Managed Dataset]
39
+ S -.->|live query, no copy| E[External Dataset]
40
+ A[API and workflows] --> L[Local Collection]
41
+ S -->|connector sync| C[Connected Collection]
42
+ ```
43
+
44
+ | Kind and mode | Stored in CI | Authoritative copy | Changes come from |
45
+ | --------------------------- | -------------------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------- |
46
+ | Knowledge records | Yes | CI | People, apps, agents and workflows |
47
+ | Connected Knowledge records | Yes, as a synced copy | The source system; with an outbound binding, CI edits also reach it | Connector pipeline runs, and CI edits when the schema allows them |
48
+ | Managed Dataset | Yes, in PostgreSQL | CI | Ingestion runs that append, upsert or replace rows |
49
+ | External Dataset | No | The source system | The source system only |
50
+ | Local Collection | Yes | CI | The API and workflows |
51
+ | Connected Collection | Yes, as immutable Versions | The source system | Sync runs from Microsoft 365 or Google Drive |
52
+
53
+ An External Dataset has no copy in CI. Every query reaches the provider, CI caches no results, and a query fails when the provider is down. CI writes nothing back to an External Dataset. Documents have no live mode: both collection types store their files in CI, and Studio can open the current file in the provider for a Connected Collection. For connected Knowledge records, the schema's `localMutationPolicy` decides whether people can edit them in CI. `always` allows edits, `connector_backed` allows them only while a connector binding sends edits back to the source, and `never` refuses them. The [Connectors](connectors.md) page explains bindings and sync.
54
+
55
+ ## Related pages
56
+
57
+ - [Knowledge](knowledge.md)
58
+ - [Datasets](datasets.md)
59
+ - [Documents](documents.md)
60
+ - [Connectors](connectors.md)
61
+ - [Platform architecture](../platform/architecture.md)
62
+ - [AI](../ai/index.md)