@ai-matrx/records 0.8.0 → 0.11.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.
@@ -1,5 +1,5 @@
1
- import { Timestamp, Uuid, RelationCoordinate, RecordsConfig, RecordDocument, RecordsResult, RecordRead, ReadRow, Table, Field, StoredRecord, TableCapacity, NewFieldDeclaration, FieldPatch, FormSummary, AggregateMeasure, AggregateBucket, AggregateRow, Subscription, DocToken, DocUnresolvedToken, DocTemplateRow, DocRenderRow, DocSignatureRow, RecordRevision, ReadValue, AnonTokenBinding, WorkState, WorkGraph, WorkInstantiation, WorkTurn, WorkAssignmentField, WorkSlotHold, ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding, FieldProposal, TableProposal, MyLevel, RecordsError, WriteConflict, PgError, RecordsDataSource, StaleWriteDetail, PredictedRefusal } from '../index.cjs';
2
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, AbsenceReason, Actor, AggregateOperation, COMPUTE_ON, CONTEXT_POLICIES, ComputeOn, ContextPolicy, DELIVERIES, Delivery, DocSignatureCheck, ENTITY_TOKENS, EntityToken, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, FieldBehavior, FieldRule, FieldSensitivity, FieldSource, ForbiddenEnvelopeWord, Freshness, HiddenFieldNotice, Home, KERNEL_TABLES, KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, MergeField, MergeFieldModifier, MergeFieldProvenance, MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, MergeFieldTransform, MissingBehavior, ON_DELETE, OVERRIDE_POLICIES, OnDelete, OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, ParityFieldType, ParityFieldTypeDescriptor, PerValueAccessWord, PermissionLevel, ProvenancePointer, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, RecordsActor, RecordsErrorCode, RecordsErrorSink, RecordsFilter, RecordsRealtimePort, RecordsResolverPort, RecordsResponse, RecordsTableQuery, RegisteredTable, Relation, RelationBinding, RelationCardinality, RelationCarries, RelationFlavor, RelationProperties, RelationTarget, ResolutionTriple, RetiredActorWord, Rule, RuleAnswer, RuleExpression, RuleNodeKind, RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, StorageMode, StoreDoorName, StoreRefusalCode, SubscriptionBlock, SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, TableDisplay, TableOrigin, TableType, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, ValueAlternate, ValueAlternateKey, ValueEnvelope, ValueEnvelopeKey, ValueSource, WorkTemplateNode, WorkTemplateRelation, asPermissionLevel, atLeast, err, highestLevel, isRecordsErr, measureKey, ok, publicFormPath } from '../index.cjs';
1
+ import { Timestamp, Uuid, RelationCoordinate, RecordsConfig, RecordDocument, RecordsResult, RecordRead, ReadRow, Table, Field, StoredRecord, TableCapacity, NewFieldDeclaration, FieldPatch, EntityTableFacts, NewEntityFieldDeclaration, EntityFieldRights, EntityRecordRead, EntityRecordsFound, FormSummary, AggregateMeasure, AggregateBucket, AggregateRow, Subscription, DocToken, DocUnresolvedToken, DocTemplateRow, DocRenderRow, DocSignatureRow, RecordRevision, ReadValue, AnonTokenBinding, WorkState, WorkGraph, WorkInstantiation, WorkTurn, WorkAssignmentField, WorkSlotHold, WorkInboxItem, WorkListFlavour, WorkListItem, WorkAssignment, WorkRecordState, WorkApprover, WorkChange, WorkApprovalFiled, WorkApprovalDecision, ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding, FieldProposal, TableProposal, MyLevel, RecordsError, WriteConflict, PgError, RecordsDataSource, StaleWriteDetail, PredictedRefusal } from '../index.cjs';
2
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, AbsenceReason, Actor, AggregateOperation, COMPUTE_ON, CONTEXT_POLICIES, ComputeOn, ContextPolicy, CustomFieldTableType, DELIVERIES, Delivery, DocSignatureCheck, ENTITY_TOKENS, EntityFieldValue, EntityRecordMatch, EntityToken, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, FieldBehavior, FieldRule, FieldSensitivity, FieldSource, ForbiddenEnvelopeWord, Freshness, HiddenFieldNotice, Home, KERNEL_TABLES, KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, MergeField, MergeFieldModifier, MergeFieldProvenance, MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, MergeFieldTransform, MissingBehavior, ON_DELETE, OVERRIDE_POLICIES, OnDelete, OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, ParityFieldType, ParityFieldTypeDescriptor, PerValueAccessWord, PermissionLevel, ProvenancePointer, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, RecordsActor, RecordsErrorCode, RecordsErrorSink, RecordsFilter, RecordsRealtimePort, RecordsResolverPort, RecordsResponse, RecordsTableQuery, RegisteredTable, Relation, RelationBinding, RelationCardinality, RelationCarries, RelationFlavor, RelationProperties, RelationTarget, ResolutionTriple, RetiredActorWord, Rule, RuleAnswer, RuleExpression, RuleNodeKind, RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, StorageMode, StoreDoorName, StoreRefusalCode, SubscriptionBlock, SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, TableDisplay, TableOrigin, TableType, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, ValueAlternate, ValueAlternateKey, ValueEnvelope, ValueEnvelopeKey, ValueSource, WorkDueState, WorkInboxKind, WorkOrigin, WorkTemplateNode, WorkTemplateRelation, asPermissionLevel, atLeast, err, highestLevel, isRecordsErr, measureKey, ok, publicFormPath } from '../index.cjs';
3
3
 
4
4
  /**
5
5
  * DOOR-8. As-of on EITHER clock, and they are different questions:
@@ -179,6 +179,51 @@ interface RecordsClient {
179
179
  fieldRetire(args: {
180
180
  field_id: Uuid;
181
181
  }): Promise<RecordsResult<boolean>>;
182
+ /** What the registry says about a token, and whether it can hold a value at all. */
183
+ entityTable(args: {
184
+ token: string;
185
+ }): Promise<RecordsResult<EntityTableFacts>>;
186
+ /** The fields THIS organization added to that standard table. */
187
+ entityFields(args: {
188
+ token: string;
189
+ }): Promise<RecordsResult<Field[]>>;
190
+ /** Add a column to a standard table. An organization admin's right - it changes the table for everybody. */
191
+ entityFieldDeclare(args: {
192
+ token: string;
193
+ spec: NewEntityFieldDeclaration;
194
+ }): Promise<RecordsResult<Uuid>>;
195
+ /** One field's own settings. A TYPE change is refused here by name, as it is on a custom table. */
196
+ entityFieldUpdate(args: {
197
+ field_id: Uuid;
198
+ patch: Record<string, unknown>;
199
+ }): Promise<RecordsResult<Uuid>>;
200
+ /** Take a custom field off a standard table. The values already written stay in each row. */
201
+ entityFieldRetire(args: {
202
+ field_id: Uuid;
203
+ }): Promise<RecordsResult<Uuid>>;
204
+ /** May this person add a column here - and if not, the store's own sentence saying why. */
205
+ entityFieldRights(args: {
206
+ token: string;
207
+ }): Promise<RecordsResult<EntityFieldRights>>;
208
+ /** REC-53 in one answer: the row's real columns AND its custom values AND the definitions. */
209
+ entityRecordRead(args: {
210
+ token: string;
211
+ record_id: Uuid;
212
+ }): Promise<RecordsResult<EntityRecordRead>>;
213
+ /** A patch: a key left out is left alone, a key set to null is cleared with its envelope. */
214
+ entityValueWrite(args: {
215
+ token: string;
216
+ record_id: Uuid;
217
+ patch: Record<string, unknown>;
218
+ }): Promise<RecordsResult<EntityRecordRead>>;
219
+ /** Rows of that standard table with this custom value. Refuses a field nobody declared. */
220
+ entityRecordsFind(args: {
221
+ token: string;
222
+ key: string;
223
+ value?: unknown;
224
+ limit?: number;
225
+ offset?: number;
226
+ }): Promise<RecordsResult<EntityRecordsFound>>;
182
227
  /** The kernel Tables a caller writes a Home, a Field or a Rule into. */
183
228
  personKernelId(): Promise<RecordsResult<Uuid>>;
184
229
  fieldKernelId(): Promise<RecordsResult<Uuid>>;
@@ -462,6 +507,86 @@ interface RecordsClient {
462
507
  workSlotExpire(args: {
463
508
  table_id: Uuid;
464
509
  }): Promise<RecordsResult<number>>;
510
+ /**
511
+ * THE ONE INBOX. Assignments, approvals and the agent's proposals, in one
512
+ * ordered list with ONE row shape — PRODUCTS.md row 6. A second queue for the
513
+ * agent's suggestions is the thing this replaces.
514
+ */
515
+ workInbox(args?: {
516
+ limit?: number;
517
+ offset?: number;
518
+ includeDecided?: boolean;
519
+ }): Promise<RecordsResult<WorkInboxItem[]>>;
520
+ /** "My work", "work I assigned", "waiting on somebody being chosen". */
521
+ workList(args?: {
522
+ flavour?: WorkListFlavour;
523
+ includeFinished?: boolean;
524
+ limit?: number;
525
+ offset?: number;
526
+ }): Promise<RecordsResult<WorkListItem[]>>;
527
+ /**
528
+ * Give one record to one person: the Assignee value AND editor access, in one
529
+ * transaction. Passing no `user_id` un-assigns and says plainly that nobody's
530
+ * access was taken away.
531
+ */
532
+ workAssign(args: {
533
+ record_id: Uuid;
534
+ user_id?: Uuid | null;
535
+ dueDate?: string | null;
536
+ clearDue?: boolean;
537
+ }): Promise<RecordsResult<WorkAssignment>>;
538
+ /** The states this record may be moved to, and the sentence for each it may not. */
539
+ workRecordStates(args: {
540
+ record_id: Uuid;
541
+ }): Promise<RecordsResult<WorkRecordState[]>>;
542
+ /** Move it. The store refuses a move the model forbids, in its own words. */
543
+ workSetState(args: {
544
+ record_id: Uuid;
545
+ state_id: Uuid | null;
546
+ }): Promise<RecordsResult<unknown>>;
547
+ /** The person-kernel record standing for a signed-in person here. */
548
+ workPerson(args: {
549
+ user_id: Uuid;
550
+ create?: boolean;
551
+ }): Promise<RecordsResult<Uuid | null>>;
552
+ /** The templates this person may run, so a picker has ids to offer. */
553
+ workTemplates(args?: {
554
+ limit?: number;
555
+ }): Promise<RecordsResult<Array<{
556
+ template_id: Uuid;
557
+ name: string;
558
+ nodes: number;
559
+ relations: number;
560
+ created_at: string;
561
+ }>>>;
562
+ /** Who may decide a change about this subject, and why each of them may. */
563
+ workApprovalApprovers(args: {
564
+ subject_id: Uuid | null;
565
+ approver_id?: Uuid | null;
566
+ }): Promise<RecordsResult<WorkApprover[]>>;
567
+ /** Ask for a change instead of making it. Viewer on the subject is enough to ASK. */
568
+ workApprovalRequest(args: {
569
+ subject_id: Uuid;
570
+ change: WorkChange;
571
+ note?: string | null;
572
+ approver_id?: Uuid | null;
573
+ origin?: "person" | "agent";
574
+ conversation_id?: Uuid | null;
575
+ }): Promise<RecordsResult<WorkApprovalFiled>>;
576
+ /** Whether THIS person may decide THIS one — so a screen never draws a dead button. */
577
+ workApprovalMayDecide(args: {
578
+ approval_id: Uuid;
579
+ }): Promise<RecordsResult<boolean>>;
580
+ /** Approve or decline. Approving APPLIES the change, as the person approving. */
581
+ workApprovalDecide(args: {
582
+ approval_id: Uuid;
583
+ approve: boolean;
584
+ note?: string | null;
585
+ }): Promise<RecordsResult<WorkApprovalDecision>>;
586
+ /** One waiting change in full, for the person deciding it or the one who asked. */
587
+ workApprovalRead(args: {
588
+ approval_id: Uuid;
589
+ }): Promise<RecordsResult<Record<string, unknown>>>;
465
590
  /** VIS-31. Is this account a signed-in outsider — no NON-personal organization? */
466
591
  isExternalPrincipal(args?: {
467
592
  user_id?: Uuid | null;
@@ -569,6 +694,15 @@ declare const DOORS: {
569
694
  readonly fieldDeclare: "field_declare";
570
695
  readonly fieldUpdate: "field_update";
571
696
  readonly fieldRetire: "field_retire";
697
+ readonly entityTable: "entity_table";
698
+ readonly entityFields: "entity_fields";
699
+ readonly entityFieldDeclare: "entity_field_declare";
700
+ readonly entityFieldUpdate: "entity_field_update";
701
+ readonly entityFieldRetire: "entity_field_retire";
702
+ readonly entityFieldRights: "entity_field_rights";
703
+ readonly entityRecordRead: "entity_record_read";
704
+ readonly entityValueWrite: "entity_value_write";
705
+ readonly entityRecordsFind: "entity_records_find";
572
706
  readonly tableCapacity: "table_capacity";
573
707
  readonly tableStorage: "table_storage";
574
708
  readonly promoteTable: "promote_table";
@@ -631,6 +765,19 @@ declare const DOORS: {
631
765
  readonly workSlotRelease: "work_slot_release";
632
766
  readonly workSlotHolds: "work_slot_holds";
633
767
  readonly workSlotExpire: "work_slot_expire";
768
+ readonly workPerson: "work_person";
769
+ readonly workAssign: "work_assign";
770
+ readonly workRecordStates: "work_record_states";
771
+ readonly workSetState: "work_set_state";
772
+ readonly workList: "work_list";
773
+ readonly workTemplates: "work_templates";
774
+ /** THE ONE QUEUE: assignments, approvals and the agent's proposals together. */
775
+ readonly workInbox: "work_inbox";
776
+ readonly workApprovalApprovers: "work_approval_approvers";
777
+ readonly workApprovalRequest: "work_approval_request";
778
+ readonly workApprovalMayDecide: "work_approval_may_decide";
779
+ readonly workApprovalDecide: "work_approval_decide";
780
+ readonly workApprovalRead: "work_approval_read";
634
781
  readonly metadataSearch: "metadata_search";
635
782
  readonly ruleDeclare: "rule_declare";
636
783
  readonly fieldPropose: "field_propose";
@@ -751,4 +898,4 @@ declare function parseCsv(text: string): string[][];
751
898
  declare function importCsv(fields: Field[], text: string): ParsedImport;
752
899
  declare function importXlsx(fields: Field[], bytes: ArrayBuffer | Uint8Array): Promise<ParsedImport>;
753
900
 
754
- export { AggregateBucket, AggregateMeasure, AggregateRow, AnonTokenBinding, type AsOf, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_PAGE_SIZE, DEFAULT_VALUE_MAX_BYTES, DOORS, DocRenderRow, DocSignatureRow, DocTemplateRow, DocToken, DocUnresolvedToken, type DoorKey, type ExportRow, ExternalPrincipalCard, Field, FieldPatch, FieldProposal, FormSummary, MAPPED_SQLSTATES, type MirrorLimits, MyLevel, NewFieldDeclaration, type ParsedImport, PgError, PredictedRefusal, type PromotedPredicate, PublishBinding, type QueryPlan, ReadRow, ReadValue, RecordDocument, type RecordQuery, RecordRead, RecordRevision, type RecordsClient, RecordsConfig, RecordsDataSource, RecordsError, RecordsResult, RelationCoordinate, ResolvedPublishBinding, StaleWriteDetail, StoredRecord, Subscription, type SupabaseLike, Table, TableCapacity, TableProposal, Timestamp, Uuid, WorkAssignmentField, WorkGraph, WorkInstantiation, WorkSlotHold, WorkState, WorkTurn, WriteConflict, asWriteConflict, cellText, createRecordsClient, doorAbsent, doorCensus, doorExists, exportCsv, exportXlsx, importCsv, importXlsx, intersectIds, mapPgError, parseCsv, planQuery, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, staleWriteDetail, supabaseDataSource, toAoa };
901
+ export { AggregateBucket, AggregateMeasure, AggregateRow, AnonTokenBinding, type AsOf, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_PAGE_SIZE, DEFAULT_VALUE_MAX_BYTES, DOORS, DocRenderRow, DocSignatureRow, DocTemplateRow, DocToken, DocUnresolvedToken, type DoorKey, EntityFieldRights, EntityRecordRead, EntityRecordsFound, EntityTableFacts, type ExportRow, ExternalPrincipalCard, Field, FieldPatch, FieldProposal, FormSummary, MAPPED_SQLSTATES, type MirrorLimits, MyLevel, NewEntityFieldDeclaration, NewFieldDeclaration, type ParsedImport, PgError, PredictedRefusal, type PromotedPredicate, PublishBinding, type QueryPlan, ReadRow, ReadValue, RecordDocument, type RecordQuery, RecordRead, RecordRevision, type RecordsClient, RecordsConfig, RecordsDataSource, RecordsError, RecordsResult, RelationCoordinate, ResolvedPublishBinding, StaleWriteDetail, StoredRecord, Subscription, type SupabaseLike, Table, TableCapacity, TableProposal, Timestamp, Uuid, WorkApprovalDecision, WorkApprovalFiled, WorkApprover, WorkAssignment, WorkAssignmentField, WorkChange, WorkGraph, WorkInboxItem, WorkInstantiation, WorkListFlavour, WorkListItem, WorkRecordState, WorkSlotHold, WorkState, WorkTurn, WriteConflict, asWriteConflict, cellText, createRecordsClient, doorAbsent, doorCensus, doorExists, exportCsv, exportXlsx, importCsv, importXlsx, intersectIds, mapPgError, parseCsv, planQuery, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, staleWriteDetail, supabaseDataSource, toAoa };
@@ -1,5 +1,5 @@
1
- import { Timestamp, Uuid, RelationCoordinate, RecordsConfig, RecordDocument, RecordsResult, RecordRead, ReadRow, Table, Field, StoredRecord, TableCapacity, NewFieldDeclaration, FieldPatch, FormSummary, AggregateMeasure, AggregateBucket, AggregateRow, Subscription, DocToken, DocUnresolvedToken, DocTemplateRow, DocRenderRow, DocSignatureRow, RecordRevision, ReadValue, AnonTokenBinding, WorkState, WorkGraph, WorkInstantiation, WorkTurn, WorkAssignmentField, WorkSlotHold, ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding, FieldProposal, TableProposal, MyLevel, RecordsError, WriteConflict, PgError, RecordsDataSource, StaleWriteDetail, PredictedRefusal } from '../index.js';
2
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, AbsenceReason, Actor, AggregateOperation, COMPUTE_ON, CONTEXT_POLICIES, ComputeOn, ContextPolicy, DELIVERIES, Delivery, DocSignatureCheck, ENTITY_TOKENS, EntityToken, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, FieldBehavior, FieldRule, FieldSensitivity, FieldSource, ForbiddenEnvelopeWord, Freshness, HiddenFieldNotice, Home, KERNEL_TABLES, KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, MergeField, MergeFieldModifier, MergeFieldProvenance, MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, MergeFieldTransform, MissingBehavior, ON_DELETE, OVERRIDE_POLICIES, OnDelete, OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, ParityFieldType, ParityFieldTypeDescriptor, PerValueAccessWord, PermissionLevel, ProvenancePointer, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, RecordsActor, RecordsErrorCode, RecordsErrorSink, RecordsFilter, RecordsRealtimePort, RecordsResolverPort, RecordsResponse, RecordsTableQuery, RegisteredTable, Relation, RelationBinding, RelationCardinality, RelationCarries, RelationFlavor, RelationProperties, RelationTarget, ResolutionTriple, RetiredActorWord, Rule, RuleAnswer, RuleExpression, RuleNodeKind, RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, StorageMode, StoreDoorName, StoreRefusalCode, SubscriptionBlock, SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, TableDisplay, TableOrigin, TableType, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, ValueAlternate, ValueAlternateKey, ValueEnvelope, ValueEnvelopeKey, ValueSource, WorkTemplateNode, WorkTemplateRelation, asPermissionLevel, atLeast, err, highestLevel, isRecordsErr, measureKey, ok, publicFormPath } from '../index.js';
1
+ import { Timestamp, Uuid, RelationCoordinate, RecordsConfig, RecordDocument, RecordsResult, RecordRead, ReadRow, Table, Field, StoredRecord, TableCapacity, NewFieldDeclaration, FieldPatch, EntityTableFacts, NewEntityFieldDeclaration, EntityFieldRights, EntityRecordRead, EntityRecordsFound, FormSummary, AggregateMeasure, AggregateBucket, AggregateRow, Subscription, DocToken, DocUnresolvedToken, DocTemplateRow, DocRenderRow, DocSignatureRow, RecordRevision, ReadValue, AnonTokenBinding, WorkState, WorkGraph, WorkInstantiation, WorkTurn, WorkAssignmentField, WorkSlotHold, WorkInboxItem, WorkListFlavour, WorkListItem, WorkAssignment, WorkRecordState, WorkApprover, WorkChange, WorkApprovalFiled, WorkApprovalDecision, ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding, FieldProposal, TableProposal, MyLevel, RecordsError, WriteConflict, PgError, RecordsDataSource, StaleWriteDetail, PredictedRefusal } from '../index.js';
2
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, AbsenceReason, Actor, AggregateOperation, COMPUTE_ON, CONTEXT_POLICIES, ComputeOn, ContextPolicy, CustomFieldTableType, DELIVERIES, Delivery, DocSignatureCheck, ENTITY_TOKENS, EntityFieldValue, EntityRecordMatch, EntityToken, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, FieldBehavior, FieldRule, FieldSensitivity, FieldSource, ForbiddenEnvelopeWord, Freshness, HiddenFieldNotice, Home, KERNEL_TABLES, KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, MergeField, MergeFieldModifier, MergeFieldProvenance, MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, MergeFieldTransform, MissingBehavior, ON_DELETE, OVERRIDE_POLICIES, OnDelete, OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, ParityFieldType, ParityFieldTypeDescriptor, PerValueAccessWord, PermissionLevel, ProvenancePointer, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, RecordsActor, RecordsErrorCode, RecordsErrorSink, RecordsFilter, RecordsRealtimePort, RecordsResolverPort, RecordsResponse, RecordsTableQuery, RegisteredTable, Relation, RelationBinding, RelationCardinality, RelationCarries, RelationFlavor, RelationProperties, RelationTarget, ResolutionTriple, RetiredActorWord, Rule, RuleAnswer, RuleExpression, RuleNodeKind, RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, StorageMode, StoreDoorName, StoreRefusalCode, SubscriptionBlock, SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, TableDisplay, TableOrigin, TableType, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, ValueAlternate, ValueAlternateKey, ValueEnvelope, ValueEnvelopeKey, ValueSource, WorkDueState, WorkInboxKind, WorkOrigin, WorkTemplateNode, WorkTemplateRelation, asPermissionLevel, atLeast, err, highestLevel, isRecordsErr, measureKey, ok, publicFormPath } from '../index.js';
3
3
 
4
4
  /**
5
5
  * DOOR-8. As-of on EITHER clock, and they are different questions:
@@ -179,6 +179,51 @@ interface RecordsClient {
179
179
  fieldRetire(args: {
180
180
  field_id: Uuid;
181
181
  }): Promise<RecordsResult<boolean>>;
182
+ /** What the registry says about a token, and whether it can hold a value at all. */
183
+ entityTable(args: {
184
+ token: string;
185
+ }): Promise<RecordsResult<EntityTableFacts>>;
186
+ /** The fields THIS organization added to that standard table. */
187
+ entityFields(args: {
188
+ token: string;
189
+ }): Promise<RecordsResult<Field[]>>;
190
+ /** Add a column to a standard table. An organization admin's right - it changes the table for everybody. */
191
+ entityFieldDeclare(args: {
192
+ token: string;
193
+ spec: NewEntityFieldDeclaration;
194
+ }): Promise<RecordsResult<Uuid>>;
195
+ /** One field's own settings. A TYPE change is refused here by name, as it is on a custom table. */
196
+ entityFieldUpdate(args: {
197
+ field_id: Uuid;
198
+ patch: Record<string, unknown>;
199
+ }): Promise<RecordsResult<Uuid>>;
200
+ /** Take a custom field off a standard table. The values already written stay in each row. */
201
+ entityFieldRetire(args: {
202
+ field_id: Uuid;
203
+ }): Promise<RecordsResult<Uuid>>;
204
+ /** May this person add a column here - and if not, the store's own sentence saying why. */
205
+ entityFieldRights(args: {
206
+ token: string;
207
+ }): Promise<RecordsResult<EntityFieldRights>>;
208
+ /** REC-53 in one answer: the row's real columns AND its custom values AND the definitions. */
209
+ entityRecordRead(args: {
210
+ token: string;
211
+ record_id: Uuid;
212
+ }): Promise<RecordsResult<EntityRecordRead>>;
213
+ /** A patch: a key left out is left alone, a key set to null is cleared with its envelope. */
214
+ entityValueWrite(args: {
215
+ token: string;
216
+ record_id: Uuid;
217
+ patch: Record<string, unknown>;
218
+ }): Promise<RecordsResult<EntityRecordRead>>;
219
+ /** Rows of that standard table with this custom value. Refuses a field nobody declared. */
220
+ entityRecordsFind(args: {
221
+ token: string;
222
+ key: string;
223
+ value?: unknown;
224
+ limit?: number;
225
+ offset?: number;
226
+ }): Promise<RecordsResult<EntityRecordsFound>>;
182
227
  /** The kernel Tables a caller writes a Home, a Field or a Rule into. */
183
228
  personKernelId(): Promise<RecordsResult<Uuid>>;
184
229
  fieldKernelId(): Promise<RecordsResult<Uuid>>;
@@ -462,6 +507,86 @@ interface RecordsClient {
462
507
  workSlotExpire(args: {
463
508
  table_id: Uuid;
464
509
  }): Promise<RecordsResult<number>>;
510
+ /**
511
+ * THE ONE INBOX. Assignments, approvals and the agent's proposals, in one
512
+ * ordered list with ONE row shape — PRODUCTS.md row 6. A second queue for the
513
+ * agent's suggestions is the thing this replaces.
514
+ */
515
+ workInbox(args?: {
516
+ limit?: number;
517
+ offset?: number;
518
+ includeDecided?: boolean;
519
+ }): Promise<RecordsResult<WorkInboxItem[]>>;
520
+ /** "My work", "work I assigned", "waiting on somebody being chosen". */
521
+ workList(args?: {
522
+ flavour?: WorkListFlavour;
523
+ includeFinished?: boolean;
524
+ limit?: number;
525
+ offset?: number;
526
+ }): Promise<RecordsResult<WorkListItem[]>>;
527
+ /**
528
+ * Give one record to one person: the Assignee value AND editor access, in one
529
+ * transaction. Passing no `user_id` un-assigns and says plainly that nobody's
530
+ * access was taken away.
531
+ */
532
+ workAssign(args: {
533
+ record_id: Uuid;
534
+ user_id?: Uuid | null;
535
+ dueDate?: string | null;
536
+ clearDue?: boolean;
537
+ }): Promise<RecordsResult<WorkAssignment>>;
538
+ /** The states this record may be moved to, and the sentence for each it may not. */
539
+ workRecordStates(args: {
540
+ record_id: Uuid;
541
+ }): Promise<RecordsResult<WorkRecordState[]>>;
542
+ /** Move it. The store refuses a move the model forbids, in its own words. */
543
+ workSetState(args: {
544
+ record_id: Uuid;
545
+ state_id: Uuid | null;
546
+ }): Promise<RecordsResult<unknown>>;
547
+ /** The person-kernel record standing for a signed-in person here. */
548
+ workPerson(args: {
549
+ user_id: Uuid;
550
+ create?: boolean;
551
+ }): Promise<RecordsResult<Uuid | null>>;
552
+ /** The templates this person may run, so a picker has ids to offer. */
553
+ workTemplates(args?: {
554
+ limit?: number;
555
+ }): Promise<RecordsResult<Array<{
556
+ template_id: Uuid;
557
+ name: string;
558
+ nodes: number;
559
+ relations: number;
560
+ created_at: string;
561
+ }>>>;
562
+ /** Who may decide a change about this subject, and why each of them may. */
563
+ workApprovalApprovers(args: {
564
+ subject_id: Uuid | null;
565
+ approver_id?: Uuid | null;
566
+ }): Promise<RecordsResult<WorkApprover[]>>;
567
+ /** Ask for a change instead of making it. Viewer on the subject is enough to ASK. */
568
+ workApprovalRequest(args: {
569
+ subject_id: Uuid;
570
+ change: WorkChange;
571
+ note?: string | null;
572
+ approver_id?: Uuid | null;
573
+ origin?: "person" | "agent";
574
+ conversation_id?: Uuid | null;
575
+ }): Promise<RecordsResult<WorkApprovalFiled>>;
576
+ /** Whether THIS person may decide THIS one — so a screen never draws a dead button. */
577
+ workApprovalMayDecide(args: {
578
+ approval_id: Uuid;
579
+ }): Promise<RecordsResult<boolean>>;
580
+ /** Approve or decline. Approving APPLIES the change, as the person approving. */
581
+ workApprovalDecide(args: {
582
+ approval_id: Uuid;
583
+ approve: boolean;
584
+ note?: string | null;
585
+ }): Promise<RecordsResult<WorkApprovalDecision>>;
586
+ /** One waiting change in full, for the person deciding it or the one who asked. */
587
+ workApprovalRead(args: {
588
+ approval_id: Uuid;
589
+ }): Promise<RecordsResult<Record<string, unknown>>>;
465
590
  /** VIS-31. Is this account a signed-in outsider — no NON-personal organization? */
466
591
  isExternalPrincipal(args?: {
467
592
  user_id?: Uuid | null;
@@ -569,6 +694,15 @@ declare const DOORS: {
569
694
  readonly fieldDeclare: "field_declare";
570
695
  readonly fieldUpdate: "field_update";
571
696
  readonly fieldRetire: "field_retire";
697
+ readonly entityTable: "entity_table";
698
+ readonly entityFields: "entity_fields";
699
+ readonly entityFieldDeclare: "entity_field_declare";
700
+ readonly entityFieldUpdate: "entity_field_update";
701
+ readonly entityFieldRetire: "entity_field_retire";
702
+ readonly entityFieldRights: "entity_field_rights";
703
+ readonly entityRecordRead: "entity_record_read";
704
+ readonly entityValueWrite: "entity_value_write";
705
+ readonly entityRecordsFind: "entity_records_find";
572
706
  readonly tableCapacity: "table_capacity";
573
707
  readonly tableStorage: "table_storage";
574
708
  readonly promoteTable: "promote_table";
@@ -631,6 +765,19 @@ declare const DOORS: {
631
765
  readonly workSlotRelease: "work_slot_release";
632
766
  readonly workSlotHolds: "work_slot_holds";
633
767
  readonly workSlotExpire: "work_slot_expire";
768
+ readonly workPerson: "work_person";
769
+ readonly workAssign: "work_assign";
770
+ readonly workRecordStates: "work_record_states";
771
+ readonly workSetState: "work_set_state";
772
+ readonly workList: "work_list";
773
+ readonly workTemplates: "work_templates";
774
+ /** THE ONE QUEUE: assignments, approvals and the agent's proposals together. */
775
+ readonly workInbox: "work_inbox";
776
+ readonly workApprovalApprovers: "work_approval_approvers";
777
+ readonly workApprovalRequest: "work_approval_request";
778
+ readonly workApprovalMayDecide: "work_approval_may_decide";
779
+ readonly workApprovalDecide: "work_approval_decide";
780
+ readonly workApprovalRead: "work_approval_read";
634
781
  readonly metadataSearch: "metadata_search";
635
782
  readonly ruleDeclare: "rule_declare";
636
783
  readonly fieldPropose: "field_propose";
@@ -751,4 +898,4 @@ declare function parseCsv(text: string): string[][];
751
898
  declare function importCsv(fields: Field[], text: string): ParsedImport;
752
899
  declare function importXlsx(fields: Field[], bytes: ArrayBuffer | Uint8Array): Promise<ParsedImport>;
753
900
 
754
- export { AggregateBucket, AggregateMeasure, AggregateRow, AnonTokenBinding, type AsOf, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_PAGE_SIZE, DEFAULT_VALUE_MAX_BYTES, DOORS, DocRenderRow, DocSignatureRow, DocTemplateRow, DocToken, DocUnresolvedToken, type DoorKey, type ExportRow, ExternalPrincipalCard, Field, FieldPatch, FieldProposal, FormSummary, MAPPED_SQLSTATES, type MirrorLimits, MyLevel, NewFieldDeclaration, type ParsedImport, PgError, PredictedRefusal, type PromotedPredicate, PublishBinding, type QueryPlan, ReadRow, ReadValue, RecordDocument, type RecordQuery, RecordRead, RecordRevision, type RecordsClient, RecordsConfig, RecordsDataSource, RecordsError, RecordsResult, RelationCoordinate, ResolvedPublishBinding, StaleWriteDetail, StoredRecord, Subscription, type SupabaseLike, Table, TableCapacity, TableProposal, Timestamp, Uuid, WorkAssignmentField, WorkGraph, WorkInstantiation, WorkSlotHold, WorkState, WorkTurn, WriteConflict, asWriteConflict, cellText, createRecordsClient, doorAbsent, doorCensus, doorExists, exportCsv, exportXlsx, importCsv, importXlsx, intersectIds, mapPgError, parseCsv, planQuery, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, staleWriteDetail, supabaseDataSource, toAoa };
901
+ export { AggregateBucket, AggregateMeasure, AggregateRow, AnonTokenBinding, type AsOf, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_PAGE_SIZE, DEFAULT_VALUE_MAX_BYTES, DOORS, DocRenderRow, DocSignatureRow, DocTemplateRow, DocToken, DocUnresolvedToken, type DoorKey, EntityFieldRights, EntityRecordRead, EntityRecordsFound, EntityTableFacts, type ExportRow, ExternalPrincipalCard, Field, FieldPatch, FieldProposal, FormSummary, MAPPED_SQLSTATES, type MirrorLimits, MyLevel, NewEntityFieldDeclaration, NewFieldDeclaration, type ParsedImport, PgError, PredictedRefusal, type PromotedPredicate, PublishBinding, type QueryPlan, ReadRow, ReadValue, RecordDocument, type RecordQuery, RecordRead, RecordRevision, type RecordsClient, RecordsConfig, RecordsDataSource, RecordsError, RecordsResult, RelationCoordinate, ResolvedPublishBinding, StaleWriteDetail, StoredRecord, Subscription, type SupabaseLike, Table, TableCapacity, TableProposal, Timestamp, Uuid, WorkApprovalDecision, WorkApprovalFiled, WorkApprover, WorkAssignment, WorkAssignmentField, WorkChange, WorkGraph, WorkInboxItem, WorkInstantiation, WorkListFlavour, WorkListItem, WorkRecordState, WorkSlotHold, WorkState, WorkTurn, WriteConflict, asWriteConflict, cellText, createRecordsClient, doorAbsent, doorCensus, doorExists, exportCsv, exportXlsx, importCsv, importXlsx, intersectIds, mapPgError, parseCsv, planQuery, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, staleWriteDetail, supabaseDataSource, toAoa };
@@ -1653,6 +1653,24 @@ var DOORS = {
1653
1653
  fieldDeclare: "field_declare",
1654
1654
  fieldUpdate: "field_update",
1655
1655
  fieldRetire: "field_retire",
1656
+ // CUSTOM FIELDS ON A STANDARD BUSINESS TABLE. Every door above is keyed by a
1657
+ // custom Table's uuid, and a standard table has no Table record - so until
1658
+ // 2026-09-20 `custom.applicable_fields(org, 'party', null)` answered `22P02
1659
+ // invalid input syntax for uuid` and there was no other way in. These are
1660
+ // keyed by the REGISTRY TOKEN instead, and they are one set for all 643
1661
+ // tables the registry types Entity or Detail. The three value doors are
1662
+ // SECURITY INVOKER in the database on purpose: the standard table's own
1663
+ // row-level security is what decides who may read and write its rows, and a
1664
+ // definer wrapper would replace it with a second access system.
1665
+ entityTable: "entity_table",
1666
+ entityFields: "entity_fields",
1667
+ entityFieldDeclare: "entity_field_declare",
1668
+ entityFieldUpdate: "entity_field_update",
1669
+ entityFieldRetire: "entity_field_retire",
1670
+ entityFieldRights: "entity_field_rights",
1671
+ entityRecordRead: "entity_record_read",
1672
+ entityValueWrite: "entity_value_write",
1673
+ entityRecordsFind: "entity_records_find",
1656
1674
  tableCapacity: "table_capacity",
1657
1675
  tableStorage: "table_storage",
1658
1676
  promoteTable: "promote_table",
@@ -1759,6 +1777,23 @@ var DOORS = {
1759
1777
  workSlotRelease: "work_slot_release",
1760
1778
  workSlotHolds: "work_slot_holds",
1761
1779
  workSlotExpire: "work_slot_expire",
1780
+ // THE WORK LAYER'S OWN DOORS (lane WORK-DOORS, 2026-09-20). Until this lane
1781
+ // all nineteen `custom.work_*` functions were SECURITY INVOKER with no client
1782
+ // grant: REC-69, REC-70 and REC-71 were live in the store and unreachable
1783
+ // from a browser. These are the verbs a person actually uses.
1784
+ workPerson: "work_person",
1785
+ workAssign: "work_assign",
1786
+ workRecordStates: "work_record_states",
1787
+ workSetState: "work_set_state",
1788
+ workList: "work_list",
1789
+ workTemplates: "work_templates",
1790
+ /** THE ONE QUEUE: assignments, approvals and the agent's proposals together. */
1791
+ workInbox: "work_inbox",
1792
+ workApprovalApprovers: "work_approval_approvers",
1793
+ workApprovalRequest: "work_approval_request",
1794
+ workApprovalMayDecide: "work_approval_may_decide",
1795
+ workApprovalDecide: "work_approval_decide",
1796
+ workApprovalRead: "work_approval_read",
1762
1797
  // Declared here BECAUSE they do not exist yet: naming them is what makes the
1763
1798
  // absence visible to `pnpm check:store-registry` and to the suite.
1764
1799
  metadataSearch: "metadata_search",
@@ -2192,6 +2227,88 @@ function createRecordsClient(config) {
2192
2227
  "fieldDeclare"
2193
2228
  );
2194
2229
  },
2230
+ async entityTable({ token }) {
2231
+ const answer = await callDoor(
2232
+ DOORS.entityTable,
2233
+ { p_token: token },
2234
+ "entityTable"
2235
+ );
2236
+ if (!answer.ok) return err(answer.error);
2237
+ const row = Array.isArray(answer.data) ? answer.data[0] : answer.data;
2238
+ if (!row) {
2239
+ return err({
2240
+ code: "not_found",
2241
+ message: `The registry answered nothing for the table "${token}".`,
2242
+ hint: "REC-33: a standard table is named by its registry token. Nothing was read."
2243
+ });
2244
+ }
2245
+ return ok(row);
2246
+ },
2247
+ async entityFields({ token }) {
2248
+ const rows = await callDoor(
2249
+ DOORS.entityFields,
2250
+ { p_organization_id: org, p_token: token },
2251
+ "entityFields"
2252
+ );
2253
+ if (!rows.ok) return err(rows.error);
2254
+ return ok((rows.data ?? []).map((row) => ({ id: row.id, ...row.data })));
2255
+ },
2256
+ async entityFieldDeclare({ token, spec }) {
2257
+ return callDoor(
2258
+ DOORS.entityFieldDeclare,
2259
+ { p_organization_id: org, p_token: token, p_spec: spec },
2260
+ "entityFieldDeclare"
2261
+ );
2262
+ },
2263
+ async entityFieldUpdate({ field_id, patch }) {
2264
+ return callDoor(
2265
+ DOORS.entityFieldUpdate,
2266
+ { p_organization_id: org, p_field_id: field_id, p_patch: patch },
2267
+ "entityFieldUpdate"
2268
+ );
2269
+ },
2270
+ async entityFieldRetire({ field_id }) {
2271
+ return callDoor(
2272
+ DOORS.entityFieldRetire,
2273
+ { p_organization_id: org, p_field_id: field_id },
2274
+ "entityFieldRetire"
2275
+ );
2276
+ },
2277
+ async entityFieldRights({ token }) {
2278
+ return callDoor(
2279
+ DOORS.entityFieldRights,
2280
+ { p_organization_id: org, p_token: token },
2281
+ "entityFieldRights"
2282
+ );
2283
+ },
2284
+ async entityRecordRead({ token, record_id }) {
2285
+ return callDoor(
2286
+ DOORS.entityRecordRead,
2287
+ { p_organization_id: org, p_token: token, p_record_id: record_id },
2288
+ "entityRecordRead"
2289
+ );
2290
+ },
2291
+ async entityValueWrite({ token, record_id, patch }) {
2292
+ return callDoor(
2293
+ DOORS.entityValueWrite,
2294
+ { p_organization_id: org, p_token: token, p_record_id: record_id, p_patch: patch },
2295
+ "entityValueWrite"
2296
+ );
2297
+ },
2298
+ async entityRecordsFind({ token, key, value, limit, offset }) {
2299
+ return callDoor(
2300
+ DOORS.entityRecordsFind,
2301
+ {
2302
+ p_organization_id: org,
2303
+ p_token: token,
2304
+ p_key: key,
2305
+ p_value: value === void 0 ? null : value,
2306
+ ...limit === void 0 ? {} : { p_limit: limit },
2307
+ ...offset === void 0 ? {} : { p_offset: offset }
2308
+ },
2309
+ "entityRecordsFind"
2310
+ );
2311
+ },
2195
2312
  async fieldUpdate({ field_id, patch }) {
2196
2313
  return callDoor(
2197
2314
  DOORS.fieldUpdate,
@@ -2609,6 +2726,128 @@ function createRecordsClient(config) {
2609
2726
  "workSlotExpire"
2610
2727
  );
2611
2728
  },
2729
+ // ── the work layer a person actually uses ────────────────────────────
2730
+ async workInbox(args) {
2731
+ return callDoor(
2732
+ DOORS.workInbox,
2733
+ {
2734
+ p_organization_id: org,
2735
+ p_limit: args?.limit ?? 50,
2736
+ p_offset: args?.offset ?? 0,
2737
+ p_include_decided: args?.includeDecided ?? false
2738
+ },
2739
+ "workInbox"
2740
+ );
2741
+ },
2742
+ async workList(args) {
2743
+ return callDoor(
2744
+ DOORS.workList,
2745
+ {
2746
+ p_organization_id: org,
2747
+ p_flavour: args?.flavour ?? "mine",
2748
+ p_include_finished: args?.includeFinished ?? false,
2749
+ p_limit: args?.limit ?? 100,
2750
+ p_offset: args?.offset ?? 0
2751
+ },
2752
+ "workList"
2753
+ );
2754
+ },
2755
+ async workAssign({ record_id, user_id = null, dueDate = null, clearDue = false }) {
2756
+ return callDoor(
2757
+ DOORS.workAssign,
2758
+ {
2759
+ p_organization_id: org,
2760
+ p_record_id: record_id,
2761
+ p_assignee_user_id: user_id,
2762
+ p_due_date: dueDate,
2763
+ p_clear_due: clearDue
2764
+ },
2765
+ "workAssign"
2766
+ );
2767
+ },
2768
+ async workRecordStates({ record_id }) {
2769
+ return callDoor(
2770
+ DOORS.workRecordStates,
2771
+ { p_organization_id: org, p_record_id: record_id },
2772
+ "workRecordStates"
2773
+ );
2774
+ },
2775
+ async workSetState({ record_id, state_id }) {
2776
+ return callDoor(
2777
+ DOORS.workSetState,
2778
+ { p_organization_id: org, p_record_id: record_id, p_state_id: state_id },
2779
+ "workSetState"
2780
+ );
2781
+ },
2782
+ async workPerson({ user_id, create = true }) {
2783
+ return callDoor(
2784
+ DOORS.workPerson,
2785
+ { p_organization_id: org, p_user_id: user_id, p_create: create },
2786
+ "workPerson"
2787
+ );
2788
+ },
2789
+ async workTemplates(args) {
2790
+ return callDoor(
2791
+ DOORS.workTemplates,
2792
+ { p_organization_id: org, p_limit: args?.limit ?? 100 },
2793
+ "workTemplates"
2794
+ );
2795
+ },
2796
+ async workApprovalApprovers({ subject_id, approver_id = null }) {
2797
+ return callDoor(
2798
+ DOORS.workApprovalApprovers,
2799
+ { p_organization_id: org, p_subject_id: subject_id, p_approver_id: approver_id },
2800
+ "workApprovalApprovers"
2801
+ );
2802
+ },
2803
+ async workApprovalRequest({
2804
+ subject_id,
2805
+ change,
2806
+ note = null,
2807
+ approver_id = null,
2808
+ origin = "person",
2809
+ conversation_id = null
2810
+ }) {
2811
+ return callDoor(
2812
+ DOORS.workApprovalRequest,
2813
+ {
2814
+ p_organization_id: org,
2815
+ p_subject_id: subject_id,
2816
+ p_change: change,
2817
+ p_note: note,
2818
+ p_approver_id: approver_id,
2819
+ p_origin: origin,
2820
+ p_conversation_id: conversation_id
2821
+ },
2822
+ "workApprovalRequest"
2823
+ );
2824
+ },
2825
+ async workApprovalMayDecide({ approval_id }) {
2826
+ return callDoor(
2827
+ DOORS.workApprovalMayDecide,
2828
+ { p_organization_id: org, p_approval_id: approval_id },
2829
+ "workApprovalMayDecide"
2830
+ );
2831
+ },
2832
+ async workApprovalDecide({ approval_id, approve, note = null }) {
2833
+ return callDoor(
2834
+ DOORS.workApprovalDecide,
2835
+ {
2836
+ p_organization_id: org,
2837
+ p_approval_id: approval_id,
2838
+ p_approve: approve,
2839
+ p_note: note
2840
+ },
2841
+ "workApprovalDecide"
2842
+ );
2843
+ },
2844
+ async workApprovalRead({ approval_id }) {
2845
+ return callDoor(
2846
+ DOORS.workApprovalRead,
2847
+ { p_organization_id: org, p_approval_id: approval_id },
2848
+ "workApprovalRead"
2849
+ );
2850
+ },
2612
2851
  // ── the trust doors ──────────────────────────────────────────────────
2613
2852
  async isExternalPrincipal(args) {
2614
2853
  return trustDoor(