@ai-matrx/records 0.57.0 → 0.57.2

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.
@@ -3022,6 +3022,11 @@ declare const STORE_DOORS: readonly [{
3022
3022
  readonly args: "p_organization_id uuid, p_table_id uuid";
3023
3023
  readonly returns: "jsonb";
3024
3024
  readonly security: "definer";
3025
+ }, {
3026
+ readonly name: "table_facts";
3027
+ readonly args: "p_organization_id uuid";
3028
+ readonly returns: "TABLE(table_id uuid, visibility text, mine boolean)";
3029
+ readonly security: "definer";
3025
3030
  }, {
3026
3031
  readonly name: "table_from_example";
3027
3032
  readonly args: "p_organization_id uuid, p_home_id uuid, p_example jsonb";
@@ -4029,6 +4034,8 @@ interface PredictedRefusal {
4029
4034
  /** The message the store's own body would raise, word for word. */
4030
4035
  message: string;
4031
4036
  hint?: string;
4037
+ /** The store's structured detail, when its refusal carries one (e.g. `{ example }`). */
4038
+ detail?: Record<string, unknown>;
4032
4039
  sqlstate: string;
4033
4040
  /**
4034
4041
  * Which of the store's bodies would raise it, so a reader can go and check
@@ -4462,7 +4469,25 @@ interface TableArchiveProgress {
4462
4469
  /** FLD-3. A constraint attached to a Field. A Rule, never a behaviour. */
4463
4470
  interface FieldRule {
4464
4471
  kind: "min" | "max" | "length" | "pattern" | "equals_field" | "differs_from_field";
4465
- value: string | number;
4472
+ /**
4473
+ * The rule's own number or word: the least / the most for `min` / `max`, the
4474
+ * LONGEST for `length`, the pattern for `pattern`, the other column's key for
4475
+ * `equals_field` / `differs_from_field`. A `length` rule that only says how
4476
+ * SHORT a value may be carries `min` and no `value`.
4477
+ */
4478
+ value?: string | number;
4479
+ /**
4480
+ * STORE-RULE-GAPS (the older grid's `patternHint`). On a `pattern` rule only:
4481
+ * how a person writes it, e.g. `"949-555-0142"`. The store refuses an example
4482
+ * its own pattern would refuse, and a refused value is told "Enter it like
4483
+ * 949-555-0142." (the hint, and `detail.example`).
4484
+ */
4485
+ example?: string;
4486
+ /**
4487
+ * STORE-RULE-GAPS (the older grid's `minLength`). On a `length` rule only: the
4488
+ * fewest characters. A blank is `required`'s question, never "too short".
4489
+ */
4490
+ min?: number;
4466
4491
  /** FLD-10. Empty means "wherever the Field applies". */
4467
4492
  applies_to_types?: string[];
4468
4493
  }
@@ -4667,6 +4692,12 @@ interface NewFieldDeclaration {
4667
4692
  config?: Record<string, unknown>;
4668
4693
  /** A text column that holds a signature (`custom.doc_sign` accepts no other). */
4669
4694
  format?: string;
4695
+ /**
4696
+ * STORE-RULE-GAPS (the older grid's `allowOther`). A choice list only: a value
4697
+ * that is none of the choices is ADDED to the list as typed instead of
4698
+ * refused. Stored as `config.allow_other`; absent means off.
4699
+ */
4700
+ allow_other?: boolean;
4670
4701
  }
4671
4702
  /**
4672
4703
  * Every word `custom._field_document_for` resolves for `type`: any parity type
@@ -4736,6 +4767,12 @@ interface FieldPatch {
4736
4767
  /** SEAT-SUITES: whether the store builds an index for this column, and a unique one. */
4737
4768
  promoted?: boolean;
4738
4769
  unique?: boolean;
4770
+ /**
4771
+ * STORE-RULE-GAPS. A choice list's "other values allowed" setting — see
4772
+ * `NewFieldDeclaration.allow_other`. Refused by name on any other column; a
4773
+ * retype that stays a list keeps it.
4774
+ */
4775
+ allow_other?: boolean;
4739
4776
  /** §D / T7: which fields a worked-out column reads. */
4740
4777
  depends_on?: Uuid[];
4741
4778
  /**
@@ -4774,6 +4811,11 @@ interface FieldPatch {
4774
4811
  */
4775
4812
  expr?: Record<string, unknown>;
4776
4813
  }
4814
+ /**
4815
+ * Whether a choice column takes values that are not one of its choices
4816
+ * (`config.allow_other`, STORE-RULE-GAPS). Off unless the column says so.
4817
+ */
4818
+ declare function allowsOtherValues(field: Pick<Field, "type" | "config">): boolean;
4777
4819
 
4778
4820
  /** One option, as `_choices` names it and as `optionsOf` returns it. */
4779
4821
  interface ChoiceOption {
@@ -8610,6 +8652,16 @@ interface RecordsClient {
8610
8652
  total: number | null;
8611
8653
  }>>;
8612
8654
  tableList(): Promise<RecordsResult<Table[]>>;
8655
+ /**
8656
+ * IS THIS TABLE IN THE ARCHIVE? (lane HUB-FIX, 2026-09-23.) The archived row for one
8657
+ * Table of this organization, or `null` when the archive does not hold it — which
8658
+ * is an ANSWER, never "it may have been deleted". A table page that cannot find a
8659
+ * Table asks this before saying anything: an archived Table's own address used to
8660
+ * read "…or it may have been deleted" when it was archived and one click from back.
8661
+ */
8662
+ tableArchived(args: {
8663
+ table_id: Uuid;
8664
+ }): Promise<RecordsResult<ArchivedRow | null>>;
8613
8665
  fields(args: {
8614
8666
  table_id: Uuid;
8615
8667
  recordType?: string;
@@ -10081,6 +10133,13 @@ interface UseRecordsState extends Async<{
10081
10133
  /** A page of records, realtime-aware when the host bound the port. */
10082
10134
  declare function useRecords(tableId: Uuid | null, options?: UseRecordsOptions): UseRecordsState;
10083
10135
  /** One record, its values and (optionally) which Rule version computed each. */
10136
+ /**
10137
+ * HOW MANY TIMES THIS PAGE HAS WRITTEN THIS RECORD (lane RECORDS-UI-FIX, 2026-09-23).
10138
+ * A screen that shows a record puts this in its read's dependencies and re-reads when a
10139
+ * write through any client on the page lands on it — the record panel's history read
10140
+ * "3 versions" after its fourth write because nothing told it. See `core/recordChanges`.
10141
+ */
10142
+ declare function useRecordChangeRevision(recordId: Uuid | null | undefined): number;
10084
10143
  declare function useRecord(recordId: Uuid | null, withComputed?: boolean): Async<RecordRead | null>;
10085
10144
  interface UseRecordMutation {
10086
10145
  write: (args: {
@@ -10262,4 +10321,4 @@ declare function useFieldMutation(): UseFieldMutation;
10262
10321
  */
10263
10322
  declare function useMergeField(key: string | null, state?: Record<string, unknown>): MergeFieldResolution | null;
10264
10323
 
10265
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, ARCHIVE_LANES, ARCHIVE_LANE_LABEL, ARCHIVE_LANE_MEANS, type AbsenceReason, type ActionRefusal, type ActionRunResult, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, type ArchiveLane, type ArchivedDoorRow, type ArchivedRow, type BookingAvailability, type BookingDeclared, type BookingSummary, type BookingWindow, COMPUTE_ON, CONTEXT_POLICIES, type CaptureField, type CaptureFileRef, type CaptureOutcome, type CaptureQuestion, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSheetFace, type CaptureSheetSummary, type CaptureSyncReport, 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 ChoiceOptions, type CoerceOptions, type Coerced, type CoercedAnswers, type CoercibleField, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DECLARABLE_FIELD_KINDS, DEFAULT_ARCHIVE_LANE, DEFAULT_PORTAL_ARCHIVE_FILTER, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type DeclarableFieldKind, type DecorationColor, type DecorationPath, type DecorationRule, type DecorationRuleOp, type DecorationTarget, type Delivery, type DigestPreview, 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 ExampleBuilt, type ExampleSpec, type ExternalPrincipalCard, FIELD_KINDS, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldKind, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type FormulaParse, type Freshness, type GridLayout, type GridLayoutMode, type GridRowHeight, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportColumnsDeclared, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, type IoExportPage, KERNEL_TABLES, type KernelTableName, type KernelTargets, 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, PIPELINE_RULE_KINDS, PORTAL_ARCHIVE_FILTERS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveResult, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalArchiveAnswer, type PortalArchiveFilter, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PortalTableRef, type PredictedRefusal, type ProvenancePointer, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordChangeAction, type RecordComment, type RecordDocument, type RecordEvent, type RecordFilter, type RecordGraphWritten, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsChangeSink, 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 RelationDisplay, type RelationDisplaySpec, type RelationFlavor, type RelationProperties, type RelationStore, type RelationTarget, type RelationWordsManyArgs, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type RowAction, type RowActionStep, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableArchiveProgress, type TableCapacity, type TableDecorations, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type TableWebhook, type TableWebhookDeclared, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type UseTableArchive, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type ViewLayout, 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, actionRefusals, archivedByLine, archivedWhen, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, coerceTypedAnswer, coerceTypedAnswers, coercionLabel, emptyArchiveLine, emptyPortalArchiveLine, err, exampleSpec, exportPageXlsx, fieldKindFor, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isArchiveLane, isDecided, isOwnOp, isPortalArchiveFilter, isRecordsErr, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, ok, openCaptureQueue, optionKey, optionLabel, portalArchiveConsequence, portalConfirmLine, portalPath, portalTitleTypedBack, publicFormPath, recordChangeTrigger, rememberedOpCount, sameDocument, scopeChip, stableFilterKey, tableShapeChanged, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTableArchive, useTables };
10324
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, ARCHIVE_LANES, ARCHIVE_LANE_LABEL, ARCHIVE_LANE_MEANS, type AbsenceReason, type ActionRefusal, type ActionRunResult, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, type ArchiveLane, type ArchivedDoorRow, type ArchivedRow, type BookingAvailability, type BookingDeclared, type BookingSummary, type BookingWindow, COMPUTE_ON, CONTEXT_POLICIES, type CaptureField, type CaptureFileRef, type CaptureOutcome, type CaptureQuestion, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSheetFace, type CaptureSheetSummary, type CaptureSyncReport, 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 ChoiceOptions, type CoerceOptions, type Coerced, type CoercedAnswers, type CoercibleField, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DECLARABLE_FIELD_KINDS, DEFAULT_ARCHIVE_LANE, DEFAULT_PORTAL_ARCHIVE_FILTER, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type DeclarableFieldKind, type DecorationColor, type DecorationPath, type DecorationRule, type DecorationRuleOp, type DecorationTarget, type Delivery, type DigestPreview, 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 ExampleBuilt, type ExampleSpec, type ExternalPrincipalCard, FIELD_KINDS, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldKind, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type FormulaParse, type Freshness, type GridLayout, type GridLayoutMode, type GridRowHeight, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportColumnsDeclared, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, type IoExportPage, KERNEL_TABLES, type KernelTableName, type KernelTargets, 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, PIPELINE_RULE_KINDS, PORTAL_ARCHIVE_FILTERS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveResult, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalArchiveAnswer, type PortalArchiveFilter, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PortalTableRef, type PredictedRefusal, type ProvenancePointer, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordChangeAction, type RecordComment, type RecordDocument, type RecordEvent, type RecordFilter, type RecordGraphWritten, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsChangeSink, 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 RelationDisplay, type RelationDisplaySpec, type RelationFlavor, type RelationProperties, type RelationStore, type RelationTarget, type RelationWordsManyArgs, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type RowAction, type RowActionStep, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableArchiveProgress, type TableCapacity, type TableDecorations, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type TableWebhook, type TableWebhookDeclared, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type UseTableArchive, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type ViewLayout, 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, actionRefusals, allowsOtherValues, archivedByLine, archivedWhen, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, coerceTypedAnswer, coerceTypedAnswers, coercionLabel, emptyArchiveLine, emptyPortalArchiveLine, err, exampleSpec, exportPageXlsx, fieldKindFor, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isArchiveLane, isDecided, isOwnOp, isPortalArchiveFilter, isRecordsErr, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, ok, openCaptureQueue, optionKey, optionLabel, portalArchiveConsequence, portalConfirmLine, portalPath, portalTitleTypedBack, publicFormPath, recordChangeTrigger, rememberedOpCount, sameDocument, scopeChip, stableFilterKey, tableShapeChanged, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordChangeRevision, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTableArchive, useTables };
@@ -3022,6 +3022,11 @@ declare const STORE_DOORS: readonly [{
3022
3022
  readonly args: "p_organization_id uuid, p_table_id uuid";
3023
3023
  readonly returns: "jsonb";
3024
3024
  readonly security: "definer";
3025
+ }, {
3026
+ readonly name: "table_facts";
3027
+ readonly args: "p_organization_id uuid";
3028
+ readonly returns: "TABLE(table_id uuid, visibility text, mine boolean)";
3029
+ readonly security: "definer";
3025
3030
  }, {
3026
3031
  readonly name: "table_from_example";
3027
3032
  readonly args: "p_organization_id uuid, p_home_id uuid, p_example jsonb";
@@ -4029,6 +4034,8 @@ interface PredictedRefusal {
4029
4034
  /** The message the store's own body would raise, word for word. */
4030
4035
  message: string;
4031
4036
  hint?: string;
4037
+ /** The store's structured detail, when its refusal carries one (e.g. `{ example }`). */
4038
+ detail?: Record<string, unknown>;
4032
4039
  sqlstate: string;
4033
4040
  /**
4034
4041
  * Which of the store's bodies would raise it, so a reader can go and check
@@ -4462,7 +4469,25 @@ interface TableArchiveProgress {
4462
4469
  /** FLD-3. A constraint attached to a Field. A Rule, never a behaviour. */
4463
4470
  interface FieldRule {
4464
4471
  kind: "min" | "max" | "length" | "pattern" | "equals_field" | "differs_from_field";
4465
- value: string | number;
4472
+ /**
4473
+ * The rule's own number or word: the least / the most for `min` / `max`, the
4474
+ * LONGEST for `length`, the pattern for `pattern`, the other column's key for
4475
+ * `equals_field` / `differs_from_field`. A `length` rule that only says how
4476
+ * SHORT a value may be carries `min` and no `value`.
4477
+ */
4478
+ value?: string | number;
4479
+ /**
4480
+ * STORE-RULE-GAPS (the older grid's `patternHint`). On a `pattern` rule only:
4481
+ * how a person writes it, e.g. `"949-555-0142"`. The store refuses an example
4482
+ * its own pattern would refuse, and a refused value is told "Enter it like
4483
+ * 949-555-0142." (the hint, and `detail.example`).
4484
+ */
4485
+ example?: string;
4486
+ /**
4487
+ * STORE-RULE-GAPS (the older grid's `minLength`). On a `length` rule only: the
4488
+ * fewest characters. A blank is `required`'s question, never "too short".
4489
+ */
4490
+ min?: number;
4466
4491
  /** FLD-10. Empty means "wherever the Field applies". */
4467
4492
  applies_to_types?: string[];
4468
4493
  }
@@ -4667,6 +4692,12 @@ interface NewFieldDeclaration {
4667
4692
  config?: Record<string, unknown>;
4668
4693
  /** A text column that holds a signature (`custom.doc_sign` accepts no other). */
4669
4694
  format?: string;
4695
+ /**
4696
+ * STORE-RULE-GAPS (the older grid's `allowOther`). A choice list only: a value
4697
+ * that is none of the choices is ADDED to the list as typed instead of
4698
+ * refused. Stored as `config.allow_other`; absent means off.
4699
+ */
4700
+ allow_other?: boolean;
4670
4701
  }
4671
4702
  /**
4672
4703
  * Every word `custom._field_document_for` resolves for `type`: any parity type
@@ -4736,6 +4767,12 @@ interface FieldPatch {
4736
4767
  /** SEAT-SUITES: whether the store builds an index for this column, and a unique one. */
4737
4768
  promoted?: boolean;
4738
4769
  unique?: boolean;
4770
+ /**
4771
+ * STORE-RULE-GAPS. A choice list's "other values allowed" setting — see
4772
+ * `NewFieldDeclaration.allow_other`. Refused by name on any other column; a
4773
+ * retype that stays a list keeps it.
4774
+ */
4775
+ allow_other?: boolean;
4739
4776
  /** §D / T7: which fields a worked-out column reads. */
4740
4777
  depends_on?: Uuid[];
4741
4778
  /**
@@ -4774,6 +4811,11 @@ interface FieldPatch {
4774
4811
  */
4775
4812
  expr?: Record<string, unknown>;
4776
4813
  }
4814
+ /**
4815
+ * Whether a choice column takes values that are not one of its choices
4816
+ * (`config.allow_other`, STORE-RULE-GAPS). Off unless the column says so.
4817
+ */
4818
+ declare function allowsOtherValues(field: Pick<Field, "type" | "config">): boolean;
4777
4819
 
4778
4820
  /** One option, as `_choices` names it and as `optionsOf` returns it. */
4779
4821
  interface ChoiceOption {
@@ -8610,6 +8652,16 @@ interface RecordsClient {
8610
8652
  total: number | null;
8611
8653
  }>>;
8612
8654
  tableList(): Promise<RecordsResult<Table[]>>;
8655
+ /**
8656
+ * IS THIS TABLE IN THE ARCHIVE? (lane HUB-FIX, 2026-09-23.) The archived row for one
8657
+ * Table of this organization, or `null` when the archive does not hold it — which
8658
+ * is an ANSWER, never "it may have been deleted". A table page that cannot find a
8659
+ * Table asks this before saying anything: an archived Table's own address used to
8660
+ * read "…or it may have been deleted" when it was archived and one click from back.
8661
+ */
8662
+ tableArchived(args: {
8663
+ table_id: Uuid;
8664
+ }): Promise<RecordsResult<ArchivedRow | null>>;
8613
8665
  fields(args: {
8614
8666
  table_id: Uuid;
8615
8667
  recordType?: string;
@@ -10081,6 +10133,13 @@ interface UseRecordsState extends Async<{
10081
10133
  /** A page of records, realtime-aware when the host bound the port. */
10082
10134
  declare function useRecords(tableId: Uuid | null, options?: UseRecordsOptions): UseRecordsState;
10083
10135
  /** One record, its values and (optionally) which Rule version computed each. */
10136
+ /**
10137
+ * HOW MANY TIMES THIS PAGE HAS WRITTEN THIS RECORD (lane RECORDS-UI-FIX, 2026-09-23).
10138
+ * A screen that shows a record puts this in its read's dependencies and re-reads when a
10139
+ * write through any client on the page lands on it — the record panel's history read
10140
+ * "3 versions" after its fourth write because nothing told it. See `core/recordChanges`.
10141
+ */
10142
+ declare function useRecordChangeRevision(recordId: Uuid | null | undefined): number;
10084
10143
  declare function useRecord(recordId: Uuid | null, withComputed?: boolean): Async<RecordRead | null>;
10085
10144
  interface UseRecordMutation {
10086
10145
  write: (args: {
@@ -10262,4 +10321,4 @@ declare function useFieldMutation(): UseFieldMutation;
10262
10321
  */
10263
10322
  declare function useMergeField(key: string | null, state?: Record<string, unknown>): MergeFieldResolution | null;
10264
10323
 
10265
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, ARCHIVE_LANES, ARCHIVE_LANE_LABEL, ARCHIVE_LANE_MEANS, type AbsenceReason, type ActionRefusal, type ActionRunResult, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, type ArchiveLane, type ArchivedDoorRow, type ArchivedRow, type BookingAvailability, type BookingDeclared, type BookingSummary, type BookingWindow, COMPUTE_ON, CONTEXT_POLICIES, type CaptureField, type CaptureFileRef, type CaptureOutcome, type CaptureQuestion, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSheetFace, type CaptureSheetSummary, type CaptureSyncReport, 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 ChoiceOptions, type CoerceOptions, type Coerced, type CoercedAnswers, type CoercibleField, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DECLARABLE_FIELD_KINDS, DEFAULT_ARCHIVE_LANE, DEFAULT_PORTAL_ARCHIVE_FILTER, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type DeclarableFieldKind, type DecorationColor, type DecorationPath, type DecorationRule, type DecorationRuleOp, type DecorationTarget, type Delivery, type DigestPreview, 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 ExampleBuilt, type ExampleSpec, type ExternalPrincipalCard, FIELD_KINDS, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldKind, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type FormulaParse, type Freshness, type GridLayout, type GridLayoutMode, type GridRowHeight, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportColumnsDeclared, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, type IoExportPage, KERNEL_TABLES, type KernelTableName, type KernelTargets, 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, PIPELINE_RULE_KINDS, PORTAL_ARCHIVE_FILTERS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveResult, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalArchiveAnswer, type PortalArchiveFilter, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PortalTableRef, type PredictedRefusal, type ProvenancePointer, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordChangeAction, type RecordComment, type RecordDocument, type RecordEvent, type RecordFilter, type RecordGraphWritten, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsChangeSink, 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 RelationDisplay, type RelationDisplaySpec, type RelationFlavor, type RelationProperties, type RelationStore, type RelationTarget, type RelationWordsManyArgs, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type RowAction, type RowActionStep, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableArchiveProgress, type TableCapacity, type TableDecorations, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type TableWebhook, type TableWebhookDeclared, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type UseTableArchive, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type ViewLayout, 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, actionRefusals, archivedByLine, archivedWhen, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, coerceTypedAnswer, coerceTypedAnswers, coercionLabel, emptyArchiveLine, emptyPortalArchiveLine, err, exampleSpec, exportPageXlsx, fieldKindFor, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isArchiveLane, isDecided, isOwnOp, isPortalArchiveFilter, isRecordsErr, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, ok, openCaptureQueue, optionKey, optionLabel, portalArchiveConsequence, portalConfirmLine, portalPath, portalTitleTypedBack, publicFormPath, recordChangeTrigger, rememberedOpCount, sameDocument, scopeChip, stableFilterKey, tableShapeChanged, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTableArchive, useTables };
10324
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, ARCHIVE_LANES, ARCHIVE_LANE_LABEL, ARCHIVE_LANE_MEANS, type AbsenceReason, type ActionRefusal, type ActionRunResult, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, type ArchiveLane, type ArchivedDoorRow, type ArchivedRow, type BookingAvailability, type BookingDeclared, type BookingSummary, type BookingWindow, COMPUTE_ON, CONTEXT_POLICIES, type CaptureField, type CaptureFileRef, type CaptureOutcome, type CaptureQuestion, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSheetFace, type CaptureSheetSummary, type CaptureSyncReport, 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 ChoiceOptions, type CoerceOptions, type Coerced, type CoercedAnswers, type CoercibleField, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DECLARABLE_FIELD_KINDS, DEFAULT_ARCHIVE_LANE, DEFAULT_PORTAL_ARCHIVE_FILTER, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type DeclarableFieldKind, type DecorationColor, type DecorationPath, type DecorationRule, type DecorationRuleOp, type DecorationTarget, type Delivery, type DigestPreview, 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 ExampleBuilt, type ExampleSpec, type ExternalPrincipalCard, FIELD_KINDS, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldKind, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type FormulaParse, type Freshness, type GridLayout, type GridLayoutMode, type GridRowHeight, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportColumnsDeclared, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, type IoExportPage, KERNEL_TABLES, type KernelTableName, type KernelTargets, 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, PIPELINE_RULE_KINDS, PORTAL_ARCHIVE_FILTERS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveResult, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalArchiveAnswer, type PortalArchiveFilter, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PortalTableRef, type PredictedRefusal, type ProvenancePointer, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordChangeAction, type RecordComment, type RecordDocument, type RecordEvent, type RecordFilter, type RecordGraphWritten, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsChangeSink, 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 RelationDisplay, type RelationDisplaySpec, type RelationFlavor, type RelationProperties, type RelationStore, type RelationTarget, type RelationWordsManyArgs, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type RowAction, type RowActionStep, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableArchiveProgress, type TableCapacity, type TableDecorations, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type TableWebhook, type TableWebhookDeclared, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type UseTableArchive, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type ViewLayout, 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, actionRefusals, allowsOtherValues, archivedByLine, archivedWhen, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, coerceTypedAnswer, coerceTypedAnswers, coercionLabel, emptyArchiveLine, emptyPortalArchiveLine, err, exampleSpec, exportPageXlsx, fieldKindFor, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isArchiveLane, isDecided, isOwnOp, isPortalArchiveFilter, isRecordsErr, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, ok, openCaptureQueue, optionKey, optionLabel, portalArchiveConsequence, portalConfirmLine, portalPath, portalTitleTypedBack, publicFormPath, recordChangeTrigger, rememberedOpCount, sameDocument, scopeChip, stableFilterKey, tableShapeChanged, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordChangeRevision, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTableArchive, useTables };
@@ -3024,6 +3024,7 @@ var STORE_DOORS = [
3024
3024
  { name: "table_declare", args: "p_organization_id uuid, p_spec jsonb", returns: "uuid", security: "definer" },
3025
3025
  { name: "table_decorate", args: "p_organization_id uuid, p_table_id uuid, p_path text[], p_value jsonb DEFAULT NULL::jsonb", returns: "jsonb", security: "definer" },
3026
3026
  { name: "table_decorations", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
3027
+ { name: "table_facts", args: "p_organization_id uuid", returns: "TABLE(table_id uuid, visibility text, mine boolean)", security: "definer" },
3027
3028
  { name: "table_from_example", args: "p_organization_id uuid, p_home_id uuid, p_example jsonb", returns: "jsonb", security: "definer" },
3028
3029
  { name: "table_has_a_visible_record", args: "p_user uuid, p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "definer" },
3029
3030
  { name: "table_is_live", args: "p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "invoker" },
@@ -4519,6 +4520,7 @@ var DOORS = {
4519
4520
  // everywhere in that organization. This is the one question the rail has to
4520
4521
  // ask, under the same wall and visibility gate as `portals` itself.
4521
4522
  portalTables: "portal_tables",
4523
+ tableFacts: "table_facts",
4522
4524
  portalCard: "portal_card",
4523
4525
  portalDeclare: "portal_declare",
4524
4526
  portalInvite: "portal_invite",
@@ -4895,6 +4897,22 @@ function staleWriteDetail(error) {
4895
4897
  };
4896
4898
  }
4897
4899
 
4900
+ // src/core/recordChanges.ts
4901
+ var listeners = /* @__PURE__ */ new Set();
4902
+ function announceRecordChanged(recordId) {
4903
+ for (const listener of [...listeners]) {
4904
+ try {
4905
+ listener(recordId);
4906
+ } catch (thrown) {
4907
+ console.error("[@ai-matrx/records] a record-change listener threw", thrown);
4908
+ }
4909
+ }
4910
+ }
4911
+ function onRecordChanged(listener) {
4912
+ listeners.add(listener);
4913
+ return () => listeners.delete(listener);
4914
+ }
4915
+
4898
4916
  // src/core/query.ts
4899
4917
  var DEFAULT_PAGE_SIZE = 50;
4900
4918
  function planQuery(query) {
@@ -4936,12 +4954,22 @@ function intersectIds(sets) {
4936
4954
 
4937
4955
  // src/core/client.ts
4938
4956
  var DEFAULT_SCHEMA = "custom";
4957
+ var A_PERSONS_REFUSAL = /* @__PURE__ */ new Set([
4958
+ "refused_by_rule",
4959
+ "stale_write",
4960
+ "invalid_argument",
4961
+ "already_exists",
4962
+ "missing_reference"
4963
+ ]);
4964
+ function isAPersonsRefusal(code) {
4965
+ return A_PERSONS_REFUSAL.has(code);
4966
+ }
4939
4967
  function sink(config) {
4940
- return config.onError ?? ((e) => (
4941
- // The defined degradation, stated: loud, with the store's own words, and
4942
- // naming where it happened. Never silence.
4943
- console.error(`[@ai-matrx/records] ${e.where}: ${e.code} \u2014 ${e.message}${e.hint ? ` (${e.hint})` : ""}`)
4944
- ));
4968
+ return config.onError ?? ((e) => {
4969
+ const line = `[@ai-matrx/records] ${e.where}: ${e.code} \u2014 ${e.message}${e.hint ? ` (${e.hint})` : ""}`;
4970
+ if (isAPersonsRefusal(e.code)) console.info(line);
4971
+ else console.error(line);
4972
+ });
4945
4973
  }
4946
4974
  function createRecordsClient(config) {
4947
4975
  const schema = config.schema ?? DEFAULT_SCHEMA;
@@ -5048,21 +5076,26 @@ function createRecordsClient(config) {
5048
5076
  },
5049
5077
  "recordUpdate"
5050
5078
  );
5079
+ if (result.ok) announceRecordChanged(record_id);
5051
5080
  return result;
5052
5081
  },
5053
5082
  async recordDelete({ record_id }) {
5054
- return callDoor(
5083
+ const result = await callDoor(
5055
5084
  DOORS.recordDelete,
5056
5085
  { p_organization_id: org, p_record_id: record_id },
5057
5086
  "recordDelete"
5058
5087
  );
5088
+ if (result.ok) announceRecordChanged(record_id);
5089
+ return result;
5059
5090
  },
5060
5091
  async recordRestore({ record_id }) {
5061
- return callDoor(
5092
+ const result = await callDoor(
5062
5093
  DOORS.recordRestore,
5063
5094
  { p_organization_id: org, p_record_id: record_id },
5064
5095
  "recordRestore"
5065
5096
  );
5097
+ if (result.ok) announceRecordChanged(record_id);
5098
+ return result;
5066
5099
  },
5067
5100
  async tableArchive({ table_id, chunk, includeTable }) {
5068
5101
  return callDoor(
@@ -5112,6 +5145,24 @@ function createRecordsClient(config) {
5112
5145
  })
5113
5146
  );
5114
5147
  },
5148
+ async tableArchived({ table_id }) {
5149
+ const kernel = await callDoor(DOORS.tableKernelId, {}, "tableArchived.kernel");
5150
+ if (!kernel.ok) return err(kernel.error);
5151
+ const PAGE = 200;
5152
+ for (let page = 0; page < 25; page += 1) {
5153
+ const answered = await this.listArchived({
5154
+ table_id: kernel.data,
5155
+ lane: "org",
5156
+ limit: PAGE,
5157
+ offset: page * PAGE
5158
+ });
5159
+ if (!answered.ok) return err(answered.error);
5160
+ const hit = answered.data.rows.find((row) => row.id === table_id);
5161
+ if (hit) return ok(hit);
5162
+ if (answered.data.total !== null) return ok(null);
5163
+ }
5164
+ return ok(null);
5165
+ },
5115
5166
  async listArchived({ table_id, lane = DEFAULT_ARCHIVE_LANE, limit = 50, offset = 0 }) {
5116
5167
  const door = await callDoor(
5117
5168
  DOORS.readRecordsArchived,
@@ -5277,6 +5328,23 @@ function createRecordsClient(config) {
5277
5328
  const { document } = unfold(row.document);
5278
5329
  return { ...document, id: row.id, organization_id: org };
5279
5330
  });
5331
+ if (doorExists(DOORS.tableFacts)) {
5332
+ const facts = await callDoor(
5333
+ DOORS.tableFacts,
5334
+ { p_organization_id: org },
5335
+ "tableList.facts"
5336
+ );
5337
+ if (facts.ok) {
5338
+ const byId = new Map((facts.data ?? []).map((f) => [f.table_id, f]));
5339
+ const me = config.actor.user_id ?? null;
5340
+ for (const table of tables) {
5341
+ const fact = byId.get(table.id);
5342
+ if (!fact) continue;
5343
+ table.visibility = fact.visibility;
5344
+ if (fact.mine && me) table.created_by = me;
5345
+ }
5346
+ }
5347
+ }
5280
5348
  tables.sort((a, b) => (a.name ?? "").localeCompare(b.name ?? ""));
5281
5349
  return ok(tables);
5282
5350
  },
@@ -5313,9 +5381,11 @@ function createRecordsClient(config) {
5313
5381
  );
5314
5382
  },
5315
5383
  async fieldDeclare({ table_id, spec }) {
5384
+ const { allow_other, ...rest } = spec;
5385
+ const p_spec = allow_other === void 0 ? rest : { ...rest, config: { ...rest.config ?? {}, allow_other } };
5316
5386
  return callDoor(
5317
5387
  DOORS.fieldDeclare,
5318
- { p_organization_id: org, p_table_id: table_id, p_spec: spec },
5388
+ { p_organization_id: org, p_table_id: table_id, p_spec },
5319
5389
  "fieldDeclare"
5320
5390
  );
5321
5391
  },
@@ -6283,14 +6353,16 @@ function createRecordsClient(config) {
6283
6353
  );
6284
6354
  },
6285
6355
  async restoreVersion({ record_id, version }) {
6286
- return callDoor(
6356
+ const result = await callDoor(
6287
6357
  DOORS.restoreVersion,
6288
6358
  { p_organization_id: org, p_record_id: record_id, p_version: version },
6289
6359
  "restoreVersion"
6290
6360
  );
6361
+ if (result.ok) announceRecordChanged(record_id);
6362
+ return result;
6291
6363
  },
6292
6364
  async valueRestore({ record_id, field_key, version }) {
6293
- return callDoor(
6365
+ const answered = await callDoor(
6294
6366
  DOORS.valueRestore,
6295
6367
  {
6296
6368
  p_organization_id: org,
@@ -6300,6 +6372,8 @@ function createRecordsClient(config) {
6300
6372
  },
6301
6373
  "valueRestore"
6302
6374
  );
6375
+ if (answered.ok) announceRecordChanged(record_id);
6376
+ return answered;
6303
6377
  },
6304
6378
  async commentThread({ record_id, include_resolved }) {
6305
6379
  return callDoor(
@@ -7226,13 +7300,24 @@ function useRecords(tableId, options = {}) {
7226
7300
  const liveReason = realtime ? tableId ? "Live: changes to this table re-read through the read door." : "Not live: no table selected." : "Not live: this host bound no realtime port, so this list updates when you reload it.";
7227
7301
  return { ...base, live, liveReason };
7228
7302
  }
7303
+ function useRecordChangeRevision(recordId) {
7304
+ const [revision, setRevision] = useState(0);
7305
+ useEffect(() => {
7306
+ if (!recordId) return;
7307
+ return onRecordChanged((changed) => {
7308
+ if (changed === recordId) setRevision((n) => n + 1);
7309
+ });
7310
+ }, [recordId]);
7311
+ return revision;
7312
+ }
7229
7313
  function useRecord(recordId, withComputed = false) {
7314
+ const changed = useRecordChangeRevision(recordId);
7230
7315
  return useAsync(
7231
7316
  async (client) => {
7232
7317
  if (!recordId) return { ok: true, data: null };
7233
7318
  return client.recordRead({ record_id: recordId, withComputed });
7234
7319
  },
7235
- [recordId, withComputed]
7320
+ [recordId, withComputed, changed]
7236
7321
  );
7237
7322
  }
7238
7323
  function useRecordMutation() {
@@ -7578,6 +7663,11 @@ var OVERRIDE_POLICIES = [
7578
7663
  var FRESHNESS = ["live", "cached", "snapshot"];
7579
7664
  var TABLE_DISPLAYS = ["list", "grid", "board", "calendar", "timeline"];
7580
7665
 
7666
+ // src/field.ts
7667
+ function allowsOtherValues(field) {
7668
+ return field.type === "list" && field.config?.["allow_other"] === true;
7669
+ }
7670
+
7581
7671
  // src/choice.ts
7582
7672
  var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
7583
7673
  function optionKey(option) {
@@ -8207,6 +8297,7 @@ export {
8207
8297
  VALUE_ALTERNATE_KEYS,
8208
8298
  VALUE_ENVELOPE_KEYS,
8209
8299
  actionRefusals,
8300
+ allowsOtherValues,
8210
8301
  archivedByLine,
8211
8302
  archivedWhen,
8212
8303
  asPermissionLevel,
@@ -8267,6 +8358,7 @@ export {
8267
8358
  useMyLevels,
8268
8359
  useOptionalRecordsClient,
8269
8360
  useRecord,
8361
+ useRecordChangeRevision,
8270
8362
  useRecordMutation,
8271
8363
  useRecords,
8272
8364
  useRecordsActor,