Namespace IntentSharp.Documents
Classes
- DefaultIntentDocumentValidator
Checks a proposed version of a default intent document, such as the target runtime's plan intent at
defaults/intentsharp.target.plan.json: the intents the library runs itself, which a developer or a model may replace in the document store. A version that does not load is refused before it is stored; a change to the document's output rules is reported in Changes. Every client registers one, so an edit of a default intent passes the same checks as any other edit.
- DocumentConflictException
Thrown by an IDocumentStore when a write was based on something that has since changed: a save whose BasedOn is not the running sequence, or a state write whose expected etag is not the current one. Nothing was written; read again and retry on what is there now.
- DocumentFormatException
Thrown by Parse(string) when a document's text is not valid in the format.
- DocumentFormats
The formats documents are read in, chosen by a document's extension. JSON is always registered; the IntentSharp.Catalog and IntentSharp.Guardrails packages add YAML, and AddDocumentFormat(IDocumentFormat) adds any other. Safe to read from several threads, also while a format is added.
- DocumentProblem
A problem found in a document's text, with the line it is on when known.
- DocumentSave
A request to SaveAsync(DocumentSave, CancellationToken): the text of a new version of a document, who wrote it, and whether it runs.
- DocumentStoreExtensions
Operations every IDocumentStore supports through its own members.
- DocumentVersion
One stored version of a document in an IDocumentStore: its sequence, the hash of its text, who wrote it and why, and whether it is the document's running version. A store returns a new instance from every call, so an instance describes the version as it was when the call returned.
- EditAuthor
Who wrote a version of a document: the kind of author and, optionally, a label naming them.
- EditImpact
What a proposed version of a document would do, as an IDocumentValidator assessed it: whether it loads, the problems found, the items it changes, and whether it widens a security item.
- FolderDocumentStore
An IDocumentStore over a folder people edit: each document is a file in the working folder (its working copy), and the store keeps every version's text, the running pointers and the state values beside it, in
.intentsharpinside the folder unless StateRoot names another folder. An edit made to a working copy, while the application runs or while it is stopped, becomes a version written by External, and runs only if the document's validators pass it.
- FolderDocumentStoreOptions
Settings for FolderDocumentStore. These belong to the store a developer chooses, so they are set in code; a document never configures the store that holds it. The store copies them when it is created, so a change made afterwards does not reach it.
- InMemoryDocumentStore
An IDocumentStore held in process memory: for tests, samples and applications that load their documents in code. Everything it holds is lost when the process ends. It follows the whole store contract, versions, running versions, rejection, change tokens and state etags included, and is safe to use from several threads.
- JsonDocumentFormat
The JSON format, registered in every DocumentFormats: reads
.jsondocuments with the line of every node and key. Comments and trailing commas are allowed, because people edit these files; a key that appears twice in one object is an error, not a silent overwrite.
- ParsedDocument
A document parsed by an IDocumentFormat: its JSON tree and lookups that give the source line of a node or of a property's key, so a problem found later can name the line.
- SettingChange
One named item a proposed document changes, with its value before and after: a setting, a provider or model in a chain, a rule, or any other item the document's validator reports.
- StateEntry
A state value an IDocumentStore keeps beside the documents, such as a ledger or a tally that must survive a restart, with the etag that a compare-and-swap write names.
- StoredDocument
A document's text as one version holds it, with the description of that version.
Structs
- DocumentId
The path of a document in an IDocumentStore, relative to the store's root, with forward slashes. The constructor normalizes the path it is given, so two ids are equal exactly when their Path values are equal, compared ordinally (case-sensitive).
Interfaces
- IDocumentFormat
Reads one text format, such as JSON or YAML, into a JSON tree with the line of each node. A document's format is chosen by its extension from the formats registered in DocumentFormats: the core registers JSON, and the IntentSharp.Catalog and IntentSharp.Guardrails packages register YAML. Implement it to read another format.
- IDocumentStore
Versioned text documents and a few state values: the store behind intent files, rule files, compiled companions, settings and the provider file. The store works in text, not formats; reading a document's content is the job of whoever owns that kind of document. Every save makes a new version, and each document has at most one running version, the one a read without a sequence returns. Implement it to keep documents in any storage; the library ships InMemoryDocumentStore.
- IDocumentValidator
Checks a proposed version of one kind of document before it is stored and run: whether it loads, what it changes, and whether it widens a security item. The package that owns each kind of document (settings, the provider file, rule files, intent files) implements one and registers it with AddDocumentValidator(IDocumentValidator) or in dependency injection; the library runs every validator whose Handles(DocumentId) is true for an edited document, and refuses an edit that no validator handles.
Enums
- AuthorKind
Who wrote a version of a document.