@ai-matrx/records 0.21.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.
@@ -4105,6 +4105,128 @@ interface DashboardRunResult {
4105
4105
  blocks: DashboardBlockResult[];
4106
4106
  }
4107
4107
 
4108
+ /** Where one agent-written value came from. Interned once per save (VAL-1). */
4109
+ interface EnrichSource {
4110
+ kind?: string;
4111
+ field_id?: Uuid;
4112
+ model?: string;
4113
+ model_version?: string | null;
4114
+ instruction?: string;
4115
+ /** What was actually read, with addresses. Never invented by the model. */
4116
+ read?: Array<{
4117
+ url?: string;
4118
+ title?: string;
4119
+ at?: string;
4120
+ }>;
4121
+ note?: string;
4122
+ confidence?: number;
4123
+ at?: string;
4124
+ }
4125
+ /** One candidate the model did not commit to, with its rank and its own source. */
4126
+ interface EnrichAlternate {
4127
+ value: unknown;
4128
+ rank: number;
4129
+ source?: EnrichSource | null;
4130
+ }
4131
+ /** One cell, as `custom.enrich_cells` answers it. The badge is drawn from exactly this. */
4132
+ interface EnrichCell {
4133
+ record_id: Uuid;
4134
+ field_key: string;
4135
+ /** Whether a model owns this column at all. False means: draw no badge. */
4136
+ agent_owned: boolean;
4137
+ value: unknown;
4138
+ value_version: number | null;
4139
+ /** `user`, `agent` or `system` — VAL-8's closed vocabulary. */
4140
+ actor: string | null;
4141
+ /** The person an agent acted for. Always set when `actor` is `agent`. */
4142
+ on_behalf_of: string | null;
4143
+ written_at: string | null;
4144
+ source: EnrichSource | null;
4145
+ /** One of: "never asked", "none", "refused", "conflicting" (VAL-2). */
4146
+ absent_reason: string | null;
4147
+ alternates: EnrichAlternate[] | null;
4148
+ /** A person holds this cell against the model until they hand it back. */
4149
+ pinned: boolean;
4150
+ /** Past its freshness date. The value is still there — stale marks it, never erases it. */
4151
+ stale: boolean;
4152
+ due_at: string | null;
4153
+ }
4154
+ /** The enrichment itself, as it is stored on the Field. */
4155
+ interface Enrichment {
4156
+ instruction: string;
4157
+ inputs: string[];
4158
+ web_search?: boolean;
4159
+ connected_source?: string | null;
4160
+ model: string;
4161
+ confidence_floor: number;
4162
+ write_policy: "auto" | "ask";
4163
+ cost_cap_cents?: number;
4164
+ review_interval_days?: number | null;
4165
+ enabled: boolean;
4166
+ enabled_by?: string | null;
4167
+ enabled_at?: string | null;
4168
+ declared_by?: string | null;
4169
+ declared_at?: string | null;
4170
+ }
4171
+ /** One agent-owned column, with its freshness census and its money. */
4172
+ interface EnrichmentSummary {
4173
+ field_id: Uuid;
4174
+ table_id: Uuid;
4175
+ field_key: string;
4176
+ label: string;
4177
+ enrichment: Enrichment;
4178
+ enabled: boolean;
4179
+ review_interval_days: number | null;
4180
+ rows_total: number;
4181
+ rows_filled: number;
4182
+ rows_stale: number;
4183
+ rows_pinned: number;
4184
+ rows_absent: number;
4185
+ runs: number;
4186
+ cost_cents: number;
4187
+ cost_per_row_cents: number | null;
4188
+ last_run_at: string | null;
4189
+ last_run: Record<string, unknown> | null;
4190
+ }
4191
+ /** One record that needs this column filled in, with what the instruction may read. */
4192
+ interface EnrichDueRow {
4193
+ record_id: Uuid;
4194
+ title: string;
4195
+ inputs: Record<string, unknown>;
4196
+ current_value: unknown;
4197
+ written_at: string | null;
4198
+ /** "never filled in", or "past its freshness date — written N days ago…". */
4199
+ reason: string;
4200
+ /** Set when the ask was larger than the organization's batch ceiling. */
4201
+ trimmed_to: number | null;
4202
+ }
4203
+ /** What one run did, and what it cost. */
4204
+ interface EnrichRun {
4205
+ run_id: Uuid;
4206
+ field_id: Uuid | null;
4207
+ field_key: string | null;
4208
+ model: string | null;
4209
+ trigger_word: string | null;
4210
+ rows_seen: number;
4211
+ rows_written: number;
4212
+ rows_absent: number;
4213
+ rows_below_floor: number;
4214
+ rows_pinned: number;
4215
+ rows_refused: number;
4216
+ cost_cents: number;
4217
+ cost_per_row_cents: number | null;
4218
+ ran_at: string;
4219
+ }
4220
+ /** What `custom.enrich_declare` answers. `says` is a sentence for a person. */
4221
+ interface EnrichDeclared {
4222
+ field_id: Uuid;
4223
+ table_id: Uuid;
4224
+ field_key: string;
4225
+ label: string;
4226
+ enrichment: Enrichment;
4227
+ says: string;
4228
+ }
4229
+
4108
4230
  /** VAL-8's whole vocabulary. There is no fourth word. */
4109
4231
  type HistoryActorKind = "user" | "agent" | "system";
4110
4232
  /**
@@ -5786,6 +5908,53 @@ interface RecordsClient {
5786
5908
  filter?: Record<string, AggregateFilter>;
5787
5909
  limit?: number;
5788
5910
  }): Promise<RecordsResult<StuckRow[]>>;
5911
+ /** Every agent-owned column, with how many cells are filled, stale or pinned, and what it has cost. */
5912
+ enrichments(args?: {
5913
+ table_id?: Uuid | null;
5914
+ }): Promise<RecordsResult<EnrichmentSummary[]>>;
5915
+ /**
5916
+ * Define, change or TURN ON an Enrichment on one Field. Admin on the Table.
5917
+ * `{enabled: true}` on its own turns an existing one on without resetting it —
5918
+ * and turning it on is what authorises every value it writes afterwards.
5919
+ */
5920
+ enrichDeclare(args: {
5921
+ field_id: Uuid;
5922
+ spec: Record<string, unknown>;
5923
+ }): Promise<RecordsResult<EnrichDeclared>>;
5924
+ /**
5925
+ * The rows that need this column filled in, each with what the instruction may
5926
+ * read. A cell somebody pinned is never returned. This is what a PREVIEW shows
5927
+ * before anybody enables anything.
5928
+ */
5929
+ enrichDue(args: {
5930
+ field_id: Uuid;
5931
+ limit?: number;
5932
+ include_fresh?: boolean;
5933
+ }): Promise<RecordsResult<EnrichDueRow[]>>;
5934
+ /**
5935
+ * THE BADGE DATA FOR A WHOLE PAGE, in one call. Who wrote each value, when, out
5936
+ * of what source, its candidates, whether a person pinned it and whether it is
5937
+ * past its freshness date. Asked per cell this would be one round trip per badge.
5938
+ */
5939
+ enrichCells(args: {
5940
+ table_id: Uuid;
5941
+ field_keys?: string[] | null;
5942
+ record_ids?: Uuid[] | null;
5943
+ }): Promise<RecordsResult<EnrichCell[]>>;
5944
+ /** Hold one cell against the model that fills its column, or hand it back. */
5945
+ enrichPin(args: {
5946
+ record_id: Uuid;
5947
+ field_key: string;
5948
+ pinned?: boolean;
5949
+ }): Promise<RecordsResult<{
5950
+ pinned: boolean;
5951
+ says: string;
5952
+ }>>;
5953
+ /** What this column has cost, run by run. */
5954
+ enrichRuns(args?: {
5955
+ field_id?: Uuid | null;
5956
+ limit?: number;
5957
+ }): Promise<RecordsResult<EnrichRun[]>>;
5789
5958
  /** Take a dashboard away. The records it counted are untouched — a canvas owns nothing. */
5790
5959
  dashboardDelete(args: {
5791
5960
  dashboard_id: Uuid;
@@ -6584,4 +6753,4 @@ declare function useFieldMutation(): UseFieldMutation;
6584
6753
  */
6585
6754
  declare function useMergeField(key: string | null, state?: Record<string, unknown>): MergeFieldResolution | null;
6586
6755
 
6587
- 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 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, RecordsProvider, type RecordsProviderProps, 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 UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, 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, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTables };
6756
+ 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, RecordsProvider, type RecordsProviderProps, 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 UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, 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, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTables };
@@ -4105,6 +4105,128 @@ interface DashboardRunResult {
4105
4105
  blocks: DashboardBlockResult[];
4106
4106
  }
4107
4107
 
4108
+ /** Where one agent-written value came from. Interned once per save (VAL-1). */
4109
+ interface EnrichSource {
4110
+ kind?: string;
4111
+ field_id?: Uuid;
4112
+ model?: string;
4113
+ model_version?: string | null;
4114
+ instruction?: string;
4115
+ /** What was actually read, with addresses. Never invented by the model. */
4116
+ read?: Array<{
4117
+ url?: string;
4118
+ title?: string;
4119
+ at?: string;
4120
+ }>;
4121
+ note?: string;
4122
+ confidence?: number;
4123
+ at?: string;
4124
+ }
4125
+ /** One candidate the model did not commit to, with its rank and its own source. */
4126
+ interface EnrichAlternate {
4127
+ value: unknown;
4128
+ rank: number;
4129
+ source?: EnrichSource | null;
4130
+ }
4131
+ /** One cell, as `custom.enrich_cells` answers it. The badge is drawn from exactly this. */
4132
+ interface EnrichCell {
4133
+ record_id: Uuid;
4134
+ field_key: string;
4135
+ /** Whether a model owns this column at all. False means: draw no badge. */
4136
+ agent_owned: boolean;
4137
+ value: unknown;
4138
+ value_version: number | null;
4139
+ /** `user`, `agent` or `system` — VAL-8's closed vocabulary. */
4140
+ actor: string | null;
4141
+ /** The person an agent acted for. Always set when `actor` is `agent`. */
4142
+ on_behalf_of: string | null;
4143
+ written_at: string | null;
4144
+ source: EnrichSource | null;
4145
+ /** One of: "never asked", "none", "refused", "conflicting" (VAL-2). */
4146
+ absent_reason: string | null;
4147
+ alternates: EnrichAlternate[] | null;
4148
+ /** A person holds this cell against the model until they hand it back. */
4149
+ pinned: boolean;
4150
+ /** Past its freshness date. The value is still there — stale marks it, never erases it. */
4151
+ stale: boolean;
4152
+ due_at: string | null;
4153
+ }
4154
+ /** The enrichment itself, as it is stored on the Field. */
4155
+ interface Enrichment {
4156
+ instruction: string;
4157
+ inputs: string[];
4158
+ web_search?: boolean;
4159
+ connected_source?: string | null;
4160
+ model: string;
4161
+ confidence_floor: number;
4162
+ write_policy: "auto" | "ask";
4163
+ cost_cap_cents?: number;
4164
+ review_interval_days?: number | null;
4165
+ enabled: boolean;
4166
+ enabled_by?: string | null;
4167
+ enabled_at?: string | null;
4168
+ declared_by?: string | null;
4169
+ declared_at?: string | null;
4170
+ }
4171
+ /** One agent-owned column, with its freshness census and its money. */
4172
+ interface EnrichmentSummary {
4173
+ field_id: Uuid;
4174
+ table_id: Uuid;
4175
+ field_key: string;
4176
+ label: string;
4177
+ enrichment: Enrichment;
4178
+ enabled: boolean;
4179
+ review_interval_days: number | null;
4180
+ rows_total: number;
4181
+ rows_filled: number;
4182
+ rows_stale: number;
4183
+ rows_pinned: number;
4184
+ rows_absent: number;
4185
+ runs: number;
4186
+ cost_cents: number;
4187
+ cost_per_row_cents: number | null;
4188
+ last_run_at: string | null;
4189
+ last_run: Record<string, unknown> | null;
4190
+ }
4191
+ /** One record that needs this column filled in, with what the instruction may read. */
4192
+ interface EnrichDueRow {
4193
+ record_id: Uuid;
4194
+ title: string;
4195
+ inputs: Record<string, unknown>;
4196
+ current_value: unknown;
4197
+ written_at: string | null;
4198
+ /** "never filled in", or "past its freshness date — written N days ago…". */
4199
+ reason: string;
4200
+ /** Set when the ask was larger than the organization's batch ceiling. */
4201
+ trimmed_to: number | null;
4202
+ }
4203
+ /** What one run did, and what it cost. */
4204
+ interface EnrichRun {
4205
+ run_id: Uuid;
4206
+ field_id: Uuid | null;
4207
+ field_key: string | null;
4208
+ model: string | null;
4209
+ trigger_word: string | null;
4210
+ rows_seen: number;
4211
+ rows_written: number;
4212
+ rows_absent: number;
4213
+ rows_below_floor: number;
4214
+ rows_pinned: number;
4215
+ rows_refused: number;
4216
+ cost_cents: number;
4217
+ cost_per_row_cents: number | null;
4218
+ ran_at: string;
4219
+ }
4220
+ /** What `custom.enrich_declare` answers. `says` is a sentence for a person. */
4221
+ interface EnrichDeclared {
4222
+ field_id: Uuid;
4223
+ table_id: Uuid;
4224
+ field_key: string;
4225
+ label: string;
4226
+ enrichment: Enrichment;
4227
+ says: string;
4228
+ }
4229
+
4108
4230
  /** VAL-8's whole vocabulary. There is no fourth word. */
4109
4231
  type HistoryActorKind = "user" | "agent" | "system";
4110
4232
  /**
@@ -5786,6 +5908,53 @@ interface RecordsClient {
5786
5908
  filter?: Record<string, AggregateFilter>;
5787
5909
  limit?: number;
5788
5910
  }): Promise<RecordsResult<StuckRow[]>>;
5911
+ /** Every agent-owned column, with how many cells are filled, stale or pinned, and what it has cost. */
5912
+ enrichments(args?: {
5913
+ table_id?: Uuid | null;
5914
+ }): Promise<RecordsResult<EnrichmentSummary[]>>;
5915
+ /**
5916
+ * Define, change or TURN ON an Enrichment on one Field. Admin on the Table.
5917
+ * `{enabled: true}` on its own turns an existing one on without resetting it —
5918
+ * and turning it on is what authorises every value it writes afterwards.
5919
+ */
5920
+ enrichDeclare(args: {
5921
+ field_id: Uuid;
5922
+ spec: Record<string, unknown>;
5923
+ }): Promise<RecordsResult<EnrichDeclared>>;
5924
+ /**
5925
+ * The rows that need this column filled in, each with what the instruction may
5926
+ * read. A cell somebody pinned is never returned. This is what a PREVIEW shows
5927
+ * before anybody enables anything.
5928
+ */
5929
+ enrichDue(args: {
5930
+ field_id: Uuid;
5931
+ limit?: number;
5932
+ include_fresh?: boolean;
5933
+ }): Promise<RecordsResult<EnrichDueRow[]>>;
5934
+ /**
5935
+ * THE BADGE DATA FOR A WHOLE PAGE, in one call. Who wrote each value, when, out
5936
+ * of what source, its candidates, whether a person pinned it and whether it is
5937
+ * past its freshness date. Asked per cell this would be one round trip per badge.
5938
+ */
5939
+ enrichCells(args: {
5940
+ table_id: Uuid;
5941
+ field_keys?: string[] | null;
5942
+ record_ids?: Uuid[] | null;
5943
+ }): Promise<RecordsResult<EnrichCell[]>>;
5944
+ /** Hold one cell against the model that fills its column, or hand it back. */
5945
+ enrichPin(args: {
5946
+ record_id: Uuid;
5947
+ field_key: string;
5948
+ pinned?: boolean;
5949
+ }): Promise<RecordsResult<{
5950
+ pinned: boolean;
5951
+ says: string;
5952
+ }>>;
5953
+ /** What this column has cost, run by run. */
5954
+ enrichRuns(args?: {
5955
+ field_id?: Uuid | null;
5956
+ limit?: number;
5957
+ }): Promise<RecordsResult<EnrichRun[]>>;
5789
5958
  /** Take a dashboard away. The records it counted are untouched — a canvas owns nothing. */
5790
5959
  dashboardDelete(args: {
5791
5960
  dashboard_id: Uuid;
@@ -6584,4 +6753,4 @@ declare function useFieldMutation(): UseFieldMutation;
6584
6753
  */
6585
6754
  declare function useMergeField(key: string | null, state?: Record<string, unknown>): MergeFieldResolution | null;
6586
6755
 
6587
- 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 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, RecordsProvider, type RecordsProviderProps, 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 UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, 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, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTables };
6756
+ 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, RecordsProvider, type RecordsProviderProps, 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 UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, 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, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTables };
@@ -1865,6 +1865,22 @@ var DOORS = {
1865
1865
  dashboardRun: "dashboard_run",
1866
1866
  dashboardStuck: "dashboard_stuck",
1867
1867
  dashboardDelete: "dashboard_delete",
1868
+ // PRODUCTS row 10 — "fill in each company's industry and headcount, and keep
1869
+ // it fresh". An Enrichment is not an object of its own: it is a Field saying
1870
+ // `source = agent`, with its instruction, inputs, model, confidence floor and
1871
+ // freshness in `source_config` (AGT-6). `enrichCells` is the one a GRID calls —
1872
+ // the badge data for a whole page in one round trip, because a badge asked per
1873
+ // cell is fifty round trips to draw fifty badges. `enrichPin` is the half of
1874
+ // this product that decides whether anybody ever trusts it: the moment a
1875
+ // person types over an agent-owned cell the store pins it, and the next run
1876
+ // leaves it exactly as they left it.
1877
+ enrichments: "enrichments",
1878
+ enrichDeclare: "enrich_declare",
1879
+ enrichDue: "enrich_due",
1880
+ enrichCells: "enrich_cells",
1881
+ enrichLand: "enrich_land",
1882
+ enrichPin: "enrich_pin",
1883
+ enrichRuns: "enrich_runs",
1868
1884
  // PRODUCTS row 4 — "Who changed this price, and can I put it back?" The
1869
1885
  // history has been in the store since W3-HIST; until 2026-09-20 the only way
1870
1886
  // to ask for it was `io_revisions`, which answers a raw uuid for the author
@@ -2774,6 +2790,67 @@ function createRecordsClient(config) {
2774
2790
  "ruleEval"
2775
2791
  );
2776
2792
  },
2793
+ async enrichments(args) {
2794
+ return callDoor(
2795
+ DOORS.enrichments,
2796
+ { p_organization_id: org, p_table_id: args?.table_id ?? null },
2797
+ "enrichments"
2798
+ );
2799
+ },
2800
+ async enrichDeclare(args) {
2801
+ return callDoor(
2802
+ DOORS.enrichDeclare,
2803
+ { p_organization_id: org, p_field_id: args.field_id, p_spec: args.spec },
2804
+ "enrichDeclare"
2805
+ );
2806
+ },
2807
+ async enrichDue(args) {
2808
+ return callDoor(
2809
+ DOORS.enrichDue,
2810
+ {
2811
+ p_organization_id: org,
2812
+ p_field_id: args.field_id,
2813
+ p_limit: args.limit ?? 50,
2814
+ p_include_fresh: args.include_fresh ?? false
2815
+ },
2816
+ "enrichDue"
2817
+ );
2818
+ },
2819
+ async enrichCells(args) {
2820
+ return callDoor(
2821
+ DOORS.enrichCells,
2822
+ {
2823
+ p_organization_id: org,
2824
+ p_table_id: args.table_id,
2825
+ p_field_keys: args.field_keys ?? null,
2826
+ p_record_ids: args.record_ids ?? null
2827
+ },
2828
+ "enrichCells"
2829
+ );
2830
+ },
2831
+ async enrichPin(args) {
2832
+ return callDoor(
2833
+ DOORS.enrichPin,
2834
+ {
2835
+ p_organization_id: org,
2836
+ p_record_id: args.record_id,
2837
+ p_field_key: args.field_key,
2838
+ p_pinned: args.pinned ?? true
2839
+ },
2840
+ "enrichPin"
2841
+ );
2842
+ },
2843
+ async enrichRuns(args) {
2844
+ return callDoor(
2845
+ DOORS.enrichRuns,
2846
+ {
2847
+ p_organization_id: org,
2848
+ p_field_id: args?.field_id ?? null,
2849
+ p_limit: args?.limit ?? 50
2850
+ },
2851
+ "enrichRuns"
2852
+ );
2853
+ },
2777
2854
  async dashboards(args) {
2778
2855
  return callDoor(
2779
2856
  DOORS.dashboards,