@ai-matrx/records 0.20.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -4102,6 +4102,128 @@ interface DashboardRunResult {
4102
4102
  blocks: DashboardBlockResult[];
4103
4103
  }
4104
4104
 
4105
+ /** Where one agent-written value came from. Interned once per save (VAL-1). */
4106
+ interface EnrichSource {
4107
+ kind?: string;
4108
+ field_id?: Uuid;
4109
+ model?: string;
4110
+ model_version?: string | null;
4111
+ instruction?: string;
4112
+ /** What was actually read, with addresses. Never invented by the model. */
4113
+ read?: Array<{
4114
+ url?: string;
4115
+ title?: string;
4116
+ at?: string;
4117
+ }>;
4118
+ note?: string;
4119
+ confidence?: number;
4120
+ at?: string;
4121
+ }
4122
+ /** One candidate the model did not commit to, with its rank and its own source. */
4123
+ interface EnrichAlternate {
4124
+ value: unknown;
4125
+ rank: number;
4126
+ source?: EnrichSource | null;
4127
+ }
4128
+ /** One cell, as `custom.enrich_cells` answers it. The badge is drawn from exactly this. */
4129
+ interface EnrichCell {
4130
+ record_id: Uuid;
4131
+ field_key: string;
4132
+ /** Whether a model owns this column at all. False means: draw no badge. */
4133
+ agent_owned: boolean;
4134
+ value: unknown;
4135
+ value_version: number | null;
4136
+ /** `user`, `agent` or `system` — VAL-8's closed vocabulary. */
4137
+ actor: string | null;
4138
+ /** The person an agent acted for. Always set when `actor` is `agent`. */
4139
+ on_behalf_of: string | null;
4140
+ written_at: string | null;
4141
+ source: EnrichSource | null;
4142
+ /** One of: "never asked", "none", "refused", "conflicting" (VAL-2). */
4143
+ absent_reason: string | null;
4144
+ alternates: EnrichAlternate[] | null;
4145
+ /** A person holds this cell against the model until they hand it back. */
4146
+ pinned: boolean;
4147
+ /** Past its freshness date. The value is still there — stale marks it, never erases it. */
4148
+ stale: boolean;
4149
+ due_at: string | null;
4150
+ }
4151
+ /** The enrichment itself, as it is stored on the Field. */
4152
+ interface Enrichment {
4153
+ instruction: string;
4154
+ inputs: string[];
4155
+ web_search?: boolean;
4156
+ connected_source?: string | null;
4157
+ model: string;
4158
+ confidence_floor: number;
4159
+ write_policy: "auto" | "ask";
4160
+ cost_cap_cents?: number;
4161
+ review_interval_days?: number | null;
4162
+ enabled: boolean;
4163
+ enabled_by?: string | null;
4164
+ enabled_at?: string | null;
4165
+ declared_by?: string | null;
4166
+ declared_at?: string | null;
4167
+ }
4168
+ /** One agent-owned column, with its freshness census and its money. */
4169
+ interface EnrichmentSummary {
4170
+ field_id: Uuid;
4171
+ table_id: Uuid;
4172
+ field_key: string;
4173
+ label: string;
4174
+ enrichment: Enrichment;
4175
+ enabled: boolean;
4176
+ review_interval_days: number | null;
4177
+ rows_total: number;
4178
+ rows_filled: number;
4179
+ rows_stale: number;
4180
+ rows_pinned: number;
4181
+ rows_absent: number;
4182
+ runs: number;
4183
+ cost_cents: number;
4184
+ cost_per_row_cents: number | null;
4185
+ last_run_at: string | null;
4186
+ last_run: Record<string, unknown> | null;
4187
+ }
4188
+ /** One record that needs this column filled in, with what the instruction may read. */
4189
+ interface EnrichDueRow {
4190
+ record_id: Uuid;
4191
+ title: string;
4192
+ inputs: Record<string, unknown>;
4193
+ current_value: unknown;
4194
+ written_at: string | null;
4195
+ /** "never filled in", or "past its freshness date — written N days ago…". */
4196
+ reason: string;
4197
+ /** Set when the ask was larger than the organization's batch ceiling. */
4198
+ trimmed_to: number | null;
4199
+ }
4200
+ /** What one run did, and what it cost. */
4201
+ interface EnrichRun {
4202
+ run_id: Uuid;
4203
+ field_id: Uuid | null;
4204
+ field_key: string | null;
4205
+ model: string | null;
4206
+ trigger_word: string | null;
4207
+ rows_seen: number;
4208
+ rows_written: number;
4209
+ rows_absent: number;
4210
+ rows_below_floor: number;
4211
+ rows_pinned: number;
4212
+ rows_refused: number;
4213
+ cost_cents: number;
4214
+ cost_per_row_cents: number | null;
4215
+ ran_at: string;
4216
+ }
4217
+ /** What `custom.enrich_declare` answers. `says` is a sentence for a person. */
4218
+ interface EnrichDeclared {
4219
+ field_id: Uuid;
4220
+ table_id: Uuid;
4221
+ field_key: string;
4222
+ label: string;
4223
+ enrichment: Enrichment;
4224
+ says: string;
4225
+ }
4226
+
4105
4227
  /** VAL-8's whole vocabulary. There is no fourth word. */
4106
4228
  type HistoryActorKind = "user" | "agent" | "system";
4107
4229
  /**
@@ -4772,6 +4894,185 @@ interface WorkAssignment {
4772
4894
  message: string;
4773
4895
  }
4774
4896
 
4897
+ /** What a step asks for before it counts as done. Every one of these is CHECKED. */
4898
+ type ChecklistRequirementKind =
4899
+ /** A person says it is done. */
4900
+ "none"
4901
+ /** A sentence of evidence, under `note`. */
4902
+ | "note"
4903
+ /** A named value filled in on the step itself. */
4904
+ | "answer"
4905
+ /** A named Field on the record the run is about must hold a value. */
4906
+ | "record_field"
4907
+ /** The step IS a form (SCR-19): finishing it needs a response record. */
4908
+ | "form"
4909
+ /** The step IS a document from a doc template (REC-68): finishing it needs a render. */
4910
+ | "document";
4911
+ interface ChecklistRequirement {
4912
+ kind: ChecklistRequirementKind;
4913
+ /** For `answer` and `record_field`: which value. */
4914
+ key?: string;
4915
+ /** What a person is asked for, in their words. */
4916
+ label?: string;
4917
+ /** For `form`: the published form this step is. */
4918
+ form_id?: Uuid;
4919
+ /** For `document`: the doc template this step renders. */
4920
+ template_id?: Uuid;
4921
+ }
4922
+ /** One step of a checklist, as it is WRITTEN — not as it is run. */
4923
+ interface ChecklistStepSpec {
4924
+ /** The name the checklist refers to this step by; lower-case, unique. */
4925
+ ref: string;
4926
+ /** What a person reads in their work. */
4927
+ title: string;
4928
+ /** Which role owns it. A role the checklist never declares is refused at save. */
4929
+ role?: string;
4930
+ /** How many days after the run starts it is due. */
4931
+ due_days?: number;
4932
+ /** Steps it waits for. A step waits only for steps listed above it. */
4933
+ depends_on?: string[];
4934
+ requires?: ChecklistRequirement;
4935
+ }
4936
+ /** A role, and the person who stands in it by default. */
4937
+ interface ChecklistRoleSpec {
4938
+ role: string;
4939
+ label?: string;
4940
+ user_id?: Uuid | null;
4941
+ }
4942
+ /** What starts a run. */
4943
+ type ChecklistTriggerKind = "manual" | "record_created" | "status_reached";
4944
+ interface ChecklistTrigger {
4945
+ kind: ChecklistTriggerKind;
4946
+ /** The Table being watched, for the two kinds that watch one. */
4947
+ table_id?: Uuid;
4948
+ /** The state, for `status_reached`. */
4949
+ status?: string;
4950
+ }
4951
+ /** THE COMPLETE DECLARATIVE CHECKLIST — one object, one call, a whole process. */
4952
+ interface ChecklistSpec {
4953
+ name: string;
4954
+ /** The Table a run is ABOUT: People, Hires, Jobs, Matters. */
4955
+ about_table_id: Uuid;
4956
+ roles?: ChecklistRoleSpec[];
4957
+ trigger?: ChecklistTrigger;
4958
+ steps: ChecklistStepSpec[];
4959
+ }
4960
+ /** What `custom.checklist_declare` answers. */
4961
+ interface ChecklistDeclared {
4962
+ template_id: Uuid;
4963
+ name: string;
4964
+ about_table_id: Uuid;
4965
+ steps_table_id: Uuid;
4966
+ steps: number;
4967
+ roles: number;
4968
+ trigger: ChecklistTrigger;
4969
+ created: boolean;
4970
+ message: string;
4971
+ ms: number;
4972
+ }
4973
+ /** One row of `custom.checklist_templates`. */
4974
+ interface ChecklistTemplateSummary {
4975
+ template_id: Uuid;
4976
+ name: string;
4977
+ about_table_id: Uuid | null;
4978
+ about_table: string | null;
4979
+ steps: number;
4980
+ roles: number;
4981
+ trigger_kind: ChecklistTriggerKind;
4982
+ trigger_status: string | null;
4983
+ open_runs: number;
4984
+ total_runs: number;
4985
+ updated_at: Timestamp;
4986
+ }
4987
+ /** `custom.checklist_template_shape` — the spec, plus what the editor needs. */
4988
+ type ChecklistTemplateShape = ChecklistSpec & {
4989
+ template_id: Uuid;
4990
+ steps_table_id: Uuid | null;
4991
+ may_change: boolean;
4992
+ };
4993
+ /** What `custom.checklist_start` answers. */
4994
+ interface ChecklistRunStarted {
4995
+ run_id: Uuid;
4996
+ template_id: Uuid;
4997
+ template: string;
4998
+ about_record_id: Uuid | null;
4999
+ about: string | null;
5000
+ steps_table_id: Uuid;
5001
+ steps_created: number;
5002
+ assigned: number;
5003
+ unassigned: number;
5004
+ origin: string;
5005
+ steps: Array<{
5006
+ ref: string;
5007
+ step_id: Uuid;
5008
+ title: string;
5009
+ role: string | null;
5010
+ }>;
5011
+ /** Roles nobody is named for, so the screen can say so rather than show blanks. */
5012
+ waiting_on_a_name: string[];
5013
+ message: string;
5014
+ ms: number;
5015
+ }
5016
+ /** One step of a RUN, as `custom.checklist_run` answers it. */
5017
+ interface ChecklistRunStep {
5018
+ step_id: Uuid;
5019
+ step_order: number;
5020
+ ref: string;
5021
+ title: string;
5022
+ role: string | null;
5023
+ assignee_name: string | null;
5024
+ assignee_user_id: Uuid | null;
5025
+ due_on: Timestamp | null;
5026
+ due_state: WorkDueState;
5027
+ status: string | null;
5028
+ finished: boolean;
5029
+ requires: ChecklistRequirementKind;
5030
+ /**
5031
+ * The key the answer is filed under, as the checklist named it. A screen files
5032
+ * evidence under THIS, never under a name it invented — the store looks for
5033
+ * exactly this key and nothing else.
5034
+ */
5035
+ requires_key: string | null;
5036
+ requires_label: string | null;
5037
+ /** The form or the document template this step is, when it is one. */
5038
+ requires_id: Uuid | null;
5039
+ evidence: Record<string, unknown>;
5040
+ /** The titles of the steps it is still waiting for. */
5041
+ blocked_by: string[];
5042
+ may_complete: boolean;
5043
+ /** Why it cannot be finished right now, in the words a person would use. */
5044
+ refusal: string | null;
5045
+ }
5046
+ /** One row of `custom.checklist_runs`. */
5047
+ interface ChecklistRunSummary {
5048
+ run_id: Uuid;
5049
+ name: string;
5050
+ template_id: Uuid | null;
5051
+ template: string | null;
5052
+ about_record_id: Uuid | null;
5053
+ about: string | null;
5054
+ about_table_id: Uuid | null;
5055
+ started_at: Timestamp | null;
5056
+ started_by: Uuid | null;
5057
+ origin: string;
5058
+ step_count: number;
5059
+ done: number;
5060
+ overdue: number;
5061
+ next_step: string | null;
5062
+ next_due: Timestamp | null;
5063
+ closed_at: Timestamp | null;
5064
+ }
5065
+ /** What `custom.checklist_step_complete` answers. */
5066
+ interface ChecklistStepCompleted {
5067
+ step_id: Uuid;
5068
+ run_id?: Uuid;
5069
+ completed: boolean;
5070
+ evidence?: Record<string, unknown>;
5071
+ steps_left?: number;
5072
+ run_closed?: boolean;
5073
+ message: string;
5074
+ }
5075
+
4775
5076
  /**
4776
5077
  * VIS-31. A signed-in OUTSIDER, with the reason in plain English.
4777
5078
  *
@@ -5199,4 +5500,4 @@ interface ConversationScopeContext {
5199
5500
  /** `About: Acme Industrial` — the chip a bound chat wears. */
5200
5501
  declare function scopeChip(scope: ConversationScope): string;
5201
5502
 
5202
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, COMPUTE_ON, CONTEXT_POLICIES, type ChoiceOption, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, KERNEL_TABLES, type KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PredictedRefusal, type ProvenancePointer, type PublishBinding, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordComment, type RecordDocument, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDueState, type WorkGraph, type WorkInboxItem, type WorkInboxKind, type WorkInstantiation, type WorkListFlavour, type WorkListItem, type WorkOrigin, type WorkRecordState, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, choiceSlug, choiceValuesOf, choicesOf, err, highestLevel, holdsARetiredChoice, isRecordsErr, isTheChosen, looksLikeAnId, measureKey, ok, optionKey, optionLabel, portalPath, publicFormPath, scopeChip };
5503
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, COMPUTE_ON, CONTEXT_POLICIES, type ChecklistDeclared, type ChecklistRequirement, type ChecklistRequirementKind, type ChecklistRoleSpec, type ChecklistRunStarted, type ChecklistRunStep, type ChecklistRunSummary, type ChecklistSpec, type ChecklistStepCompleted, type ChecklistStepSpec, type ChecklistTemplateShape, type ChecklistTemplateSummary, type ChecklistTrigger, type ChecklistTriggerKind, type ChoiceOption, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EnrichAlternate, type EnrichCell, type EnrichDeclared, type EnrichDueRow, type EnrichRun, type EnrichSource, type Enrichment, type EnrichmentSummary, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, KERNEL_TABLES, type KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PredictedRefusal, type ProvenancePointer, type PublishBinding, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordComment, type RecordDocument, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDueState, type WorkGraph, type WorkInboxItem, type WorkInboxKind, type WorkInstantiation, type WorkListFlavour, type WorkListItem, type WorkOrigin, type WorkRecordState, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, choiceSlug, choiceValuesOf, choicesOf, err, highestLevel, holdsARetiredChoice, isRecordsErr, isTheChosen, looksLikeAnId, measureKey, ok, optionKey, optionLabel, portalPath, publicFormPath, scopeChip };
package/dist/index.d.ts CHANGED
@@ -4102,6 +4102,128 @@ interface DashboardRunResult {
4102
4102
  blocks: DashboardBlockResult[];
4103
4103
  }
4104
4104
 
4105
+ /** Where one agent-written value came from. Interned once per save (VAL-1). */
4106
+ interface EnrichSource {
4107
+ kind?: string;
4108
+ field_id?: Uuid;
4109
+ model?: string;
4110
+ model_version?: string | null;
4111
+ instruction?: string;
4112
+ /** What was actually read, with addresses. Never invented by the model. */
4113
+ read?: Array<{
4114
+ url?: string;
4115
+ title?: string;
4116
+ at?: string;
4117
+ }>;
4118
+ note?: string;
4119
+ confidence?: number;
4120
+ at?: string;
4121
+ }
4122
+ /** One candidate the model did not commit to, with its rank and its own source. */
4123
+ interface EnrichAlternate {
4124
+ value: unknown;
4125
+ rank: number;
4126
+ source?: EnrichSource | null;
4127
+ }
4128
+ /** One cell, as `custom.enrich_cells` answers it. The badge is drawn from exactly this. */
4129
+ interface EnrichCell {
4130
+ record_id: Uuid;
4131
+ field_key: string;
4132
+ /** Whether a model owns this column at all. False means: draw no badge. */
4133
+ agent_owned: boolean;
4134
+ value: unknown;
4135
+ value_version: number | null;
4136
+ /** `user`, `agent` or `system` — VAL-8's closed vocabulary. */
4137
+ actor: string | null;
4138
+ /** The person an agent acted for. Always set when `actor` is `agent`. */
4139
+ on_behalf_of: string | null;
4140
+ written_at: string | null;
4141
+ source: EnrichSource | null;
4142
+ /** One of: "never asked", "none", "refused", "conflicting" (VAL-2). */
4143
+ absent_reason: string | null;
4144
+ alternates: EnrichAlternate[] | null;
4145
+ /** A person holds this cell against the model until they hand it back. */
4146
+ pinned: boolean;
4147
+ /** Past its freshness date. The value is still there — stale marks it, never erases it. */
4148
+ stale: boolean;
4149
+ due_at: string | null;
4150
+ }
4151
+ /** The enrichment itself, as it is stored on the Field. */
4152
+ interface Enrichment {
4153
+ instruction: string;
4154
+ inputs: string[];
4155
+ web_search?: boolean;
4156
+ connected_source?: string | null;
4157
+ model: string;
4158
+ confidence_floor: number;
4159
+ write_policy: "auto" | "ask";
4160
+ cost_cap_cents?: number;
4161
+ review_interval_days?: number | null;
4162
+ enabled: boolean;
4163
+ enabled_by?: string | null;
4164
+ enabled_at?: string | null;
4165
+ declared_by?: string | null;
4166
+ declared_at?: string | null;
4167
+ }
4168
+ /** One agent-owned column, with its freshness census and its money. */
4169
+ interface EnrichmentSummary {
4170
+ field_id: Uuid;
4171
+ table_id: Uuid;
4172
+ field_key: string;
4173
+ label: string;
4174
+ enrichment: Enrichment;
4175
+ enabled: boolean;
4176
+ review_interval_days: number | null;
4177
+ rows_total: number;
4178
+ rows_filled: number;
4179
+ rows_stale: number;
4180
+ rows_pinned: number;
4181
+ rows_absent: number;
4182
+ runs: number;
4183
+ cost_cents: number;
4184
+ cost_per_row_cents: number | null;
4185
+ last_run_at: string | null;
4186
+ last_run: Record<string, unknown> | null;
4187
+ }
4188
+ /** One record that needs this column filled in, with what the instruction may read. */
4189
+ interface EnrichDueRow {
4190
+ record_id: Uuid;
4191
+ title: string;
4192
+ inputs: Record<string, unknown>;
4193
+ current_value: unknown;
4194
+ written_at: string | null;
4195
+ /** "never filled in", or "past its freshness date — written N days ago…". */
4196
+ reason: string;
4197
+ /** Set when the ask was larger than the organization's batch ceiling. */
4198
+ trimmed_to: number | null;
4199
+ }
4200
+ /** What one run did, and what it cost. */
4201
+ interface EnrichRun {
4202
+ run_id: Uuid;
4203
+ field_id: Uuid | null;
4204
+ field_key: string | null;
4205
+ model: string | null;
4206
+ trigger_word: string | null;
4207
+ rows_seen: number;
4208
+ rows_written: number;
4209
+ rows_absent: number;
4210
+ rows_below_floor: number;
4211
+ rows_pinned: number;
4212
+ rows_refused: number;
4213
+ cost_cents: number;
4214
+ cost_per_row_cents: number | null;
4215
+ ran_at: string;
4216
+ }
4217
+ /** What `custom.enrich_declare` answers. `says` is a sentence for a person. */
4218
+ interface EnrichDeclared {
4219
+ field_id: Uuid;
4220
+ table_id: Uuid;
4221
+ field_key: string;
4222
+ label: string;
4223
+ enrichment: Enrichment;
4224
+ says: string;
4225
+ }
4226
+
4105
4227
  /** VAL-8's whole vocabulary. There is no fourth word. */
4106
4228
  type HistoryActorKind = "user" | "agent" | "system";
4107
4229
  /**
@@ -4772,6 +4894,185 @@ interface WorkAssignment {
4772
4894
  message: string;
4773
4895
  }
4774
4896
 
4897
+ /** What a step asks for before it counts as done. Every one of these is CHECKED. */
4898
+ type ChecklistRequirementKind =
4899
+ /** A person says it is done. */
4900
+ "none"
4901
+ /** A sentence of evidence, under `note`. */
4902
+ | "note"
4903
+ /** A named value filled in on the step itself. */
4904
+ | "answer"
4905
+ /** A named Field on the record the run is about must hold a value. */
4906
+ | "record_field"
4907
+ /** The step IS a form (SCR-19): finishing it needs a response record. */
4908
+ | "form"
4909
+ /** The step IS a document from a doc template (REC-68): finishing it needs a render. */
4910
+ | "document";
4911
+ interface ChecklistRequirement {
4912
+ kind: ChecklistRequirementKind;
4913
+ /** For `answer` and `record_field`: which value. */
4914
+ key?: string;
4915
+ /** What a person is asked for, in their words. */
4916
+ label?: string;
4917
+ /** For `form`: the published form this step is. */
4918
+ form_id?: Uuid;
4919
+ /** For `document`: the doc template this step renders. */
4920
+ template_id?: Uuid;
4921
+ }
4922
+ /** One step of a checklist, as it is WRITTEN — not as it is run. */
4923
+ interface ChecklistStepSpec {
4924
+ /** The name the checklist refers to this step by; lower-case, unique. */
4925
+ ref: string;
4926
+ /** What a person reads in their work. */
4927
+ title: string;
4928
+ /** Which role owns it. A role the checklist never declares is refused at save. */
4929
+ role?: string;
4930
+ /** How many days after the run starts it is due. */
4931
+ due_days?: number;
4932
+ /** Steps it waits for. A step waits only for steps listed above it. */
4933
+ depends_on?: string[];
4934
+ requires?: ChecklistRequirement;
4935
+ }
4936
+ /** A role, and the person who stands in it by default. */
4937
+ interface ChecklistRoleSpec {
4938
+ role: string;
4939
+ label?: string;
4940
+ user_id?: Uuid | null;
4941
+ }
4942
+ /** What starts a run. */
4943
+ type ChecklistTriggerKind = "manual" | "record_created" | "status_reached";
4944
+ interface ChecklistTrigger {
4945
+ kind: ChecklistTriggerKind;
4946
+ /** The Table being watched, for the two kinds that watch one. */
4947
+ table_id?: Uuid;
4948
+ /** The state, for `status_reached`. */
4949
+ status?: string;
4950
+ }
4951
+ /** THE COMPLETE DECLARATIVE CHECKLIST — one object, one call, a whole process. */
4952
+ interface ChecklistSpec {
4953
+ name: string;
4954
+ /** The Table a run is ABOUT: People, Hires, Jobs, Matters. */
4955
+ about_table_id: Uuid;
4956
+ roles?: ChecklistRoleSpec[];
4957
+ trigger?: ChecklistTrigger;
4958
+ steps: ChecklistStepSpec[];
4959
+ }
4960
+ /** What `custom.checklist_declare` answers. */
4961
+ interface ChecklistDeclared {
4962
+ template_id: Uuid;
4963
+ name: string;
4964
+ about_table_id: Uuid;
4965
+ steps_table_id: Uuid;
4966
+ steps: number;
4967
+ roles: number;
4968
+ trigger: ChecklistTrigger;
4969
+ created: boolean;
4970
+ message: string;
4971
+ ms: number;
4972
+ }
4973
+ /** One row of `custom.checklist_templates`. */
4974
+ interface ChecklistTemplateSummary {
4975
+ template_id: Uuid;
4976
+ name: string;
4977
+ about_table_id: Uuid | null;
4978
+ about_table: string | null;
4979
+ steps: number;
4980
+ roles: number;
4981
+ trigger_kind: ChecklistTriggerKind;
4982
+ trigger_status: string | null;
4983
+ open_runs: number;
4984
+ total_runs: number;
4985
+ updated_at: Timestamp;
4986
+ }
4987
+ /** `custom.checklist_template_shape` — the spec, plus what the editor needs. */
4988
+ type ChecklistTemplateShape = ChecklistSpec & {
4989
+ template_id: Uuid;
4990
+ steps_table_id: Uuid | null;
4991
+ may_change: boolean;
4992
+ };
4993
+ /** What `custom.checklist_start` answers. */
4994
+ interface ChecklistRunStarted {
4995
+ run_id: Uuid;
4996
+ template_id: Uuid;
4997
+ template: string;
4998
+ about_record_id: Uuid | null;
4999
+ about: string | null;
5000
+ steps_table_id: Uuid;
5001
+ steps_created: number;
5002
+ assigned: number;
5003
+ unassigned: number;
5004
+ origin: string;
5005
+ steps: Array<{
5006
+ ref: string;
5007
+ step_id: Uuid;
5008
+ title: string;
5009
+ role: string | null;
5010
+ }>;
5011
+ /** Roles nobody is named for, so the screen can say so rather than show blanks. */
5012
+ waiting_on_a_name: string[];
5013
+ message: string;
5014
+ ms: number;
5015
+ }
5016
+ /** One step of a RUN, as `custom.checklist_run` answers it. */
5017
+ interface ChecklistRunStep {
5018
+ step_id: Uuid;
5019
+ step_order: number;
5020
+ ref: string;
5021
+ title: string;
5022
+ role: string | null;
5023
+ assignee_name: string | null;
5024
+ assignee_user_id: Uuid | null;
5025
+ due_on: Timestamp | null;
5026
+ due_state: WorkDueState;
5027
+ status: string | null;
5028
+ finished: boolean;
5029
+ requires: ChecklistRequirementKind;
5030
+ /**
5031
+ * The key the answer is filed under, as the checklist named it. A screen files
5032
+ * evidence under THIS, never under a name it invented — the store looks for
5033
+ * exactly this key and nothing else.
5034
+ */
5035
+ requires_key: string | null;
5036
+ requires_label: string | null;
5037
+ /** The form or the document template this step is, when it is one. */
5038
+ requires_id: Uuid | null;
5039
+ evidence: Record<string, unknown>;
5040
+ /** The titles of the steps it is still waiting for. */
5041
+ blocked_by: string[];
5042
+ may_complete: boolean;
5043
+ /** Why it cannot be finished right now, in the words a person would use. */
5044
+ refusal: string | null;
5045
+ }
5046
+ /** One row of `custom.checklist_runs`. */
5047
+ interface ChecklistRunSummary {
5048
+ run_id: Uuid;
5049
+ name: string;
5050
+ template_id: Uuid | null;
5051
+ template: string | null;
5052
+ about_record_id: Uuid | null;
5053
+ about: string | null;
5054
+ about_table_id: Uuid | null;
5055
+ started_at: Timestamp | null;
5056
+ started_by: Uuid | null;
5057
+ origin: string;
5058
+ step_count: number;
5059
+ done: number;
5060
+ overdue: number;
5061
+ next_step: string | null;
5062
+ next_due: Timestamp | null;
5063
+ closed_at: Timestamp | null;
5064
+ }
5065
+ /** What `custom.checklist_step_complete` answers. */
5066
+ interface ChecklistStepCompleted {
5067
+ step_id: Uuid;
5068
+ run_id?: Uuid;
5069
+ completed: boolean;
5070
+ evidence?: Record<string, unknown>;
5071
+ steps_left?: number;
5072
+ run_closed?: boolean;
5073
+ message: string;
5074
+ }
5075
+
4775
5076
  /**
4776
5077
  * VIS-31. A signed-in OUTSIDER, with the reason in plain English.
4777
5078
  *
@@ -5199,4 +5500,4 @@ interface ConversationScopeContext {
5199
5500
  /** `About: Acme Industrial` — the chip a bound chat wears. */
5200
5501
  declare function scopeChip(scope: ConversationScope): string;
5201
5502
 
5202
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, COMPUTE_ON, CONTEXT_POLICIES, type ChoiceOption, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, KERNEL_TABLES, type KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PredictedRefusal, type ProvenancePointer, type PublishBinding, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordComment, type RecordDocument, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDueState, type WorkGraph, type WorkInboxItem, type WorkInboxKind, type WorkInstantiation, type WorkListFlavour, type WorkListItem, type WorkOrigin, type WorkRecordState, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, choiceSlug, choiceValuesOf, choicesOf, err, highestLevel, holdsARetiredChoice, isRecordsErr, isTheChosen, looksLikeAnId, measureKey, ok, optionKey, optionLabel, portalPath, publicFormPath, scopeChip };
5503
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, COMPUTE_ON, CONTEXT_POLICIES, type ChecklistDeclared, type ChecklistRequirement, type ChecklistRequirementKind, type ChecklistRoleSpec, type ChecklistRunStarted, type ChecklistRunStep, type ChecklistRunSummary, type ChecklistSpec, type ChecklistStepCompleted, type ChecklistStepSpec, type ChecklistTemplateShape, type ChecklistTemplateSummary, type ChecklistTrigger, type ChecklistTriggerKind, type ChoiceOption, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EnrichAlternate, type EnrichCell, type EnrichDeclared, type EnrichDueRow, type EnrichRun, type EnrichSource, type Enrichment, type EnrichmentSummary, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, KERNEL_TABLES, type KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PredictedRefusal, type ProvenancePointer, type PublishBinding, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordComment, type RecordDocument, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDueState, type WorkGraph, type WorkInboxItem, type WorkInboxKind, type WorkInstantiation, type WorkListFlavour, type WorkListItem, type WorkOrigin, type WorkRecordState, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, choiceSlug, choiceValuesOf, choicesOf, err, highestLevel, holdsARetiredChoice, isRecordsErr, isTheChosen, looksLikeAnId, measureKey, ok, optionKey, optionLabel, portalPath, publicFormPath, scopeChip };