@ai-matrx/records 0.20.0 → 0.21.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.
@@ -4775,6 +4775,185 @@ interface WorkAssignment {
4775
4775
  message: string;
4776
4776
  }
4777
4777
 
4778
+ /** What a step asks for before it counts as done. Every one of these is CHECKED. */
4779
+ type ChecklistRequirementKind =
4780
+ /** A person says it is done. */
4781
+ "none"
4782
+ /** A sentence of evidence, under `note`. */
4783
+ | "note"
4784
+ /** A named value filled in on the step itself. */
4785
+ | "answer"
4786
+ /** A named Field on the record the run is about must hold a value. */
4787
+ | "record_field"
4788
+ /** The step IS a form (SCR-19): finishing it needs a response record. */
4789
+ | "form"
4790
+ /** The step IS a document from a doc template (REC-68): finishing it needs a render. */
4791
+ | "document";
4792
+ interface ChecklistRequirement {
4793
+ kind: ChecklistRequirementKind;
4794
+ /** For `answer` and `record_field`: which value. */
4795
+ key?: string;
4796
+ /** What a person is asked for, in their words. */
4797
+ label?: string;
4798
+ /** For `form`: the published form this step is. */
4799
+ form_id?: Uuid;
4800
+ /** For `document`: the doc template this step renders. */
4801
+ template_id?: Uuid;
4802
+ }
4803
+ /** One step of a checklist, as it is WRITTEN — not as it is run. */
4804
+ interface ChecklistStepSpec {
4805
+ /** The name the checklist refers to this step by; lower-case, unique. */
4806
+ ref: string;
4807
+ /** What a person reads in their work. */
4808
+ title: string;
4809
+ /** Which role owns it. A role the checklist never declares is refused at save. */
4810
+ role?: string;
4811
+ /** How many days after the run starts it is due. */
4812
+ due_days?: number;
4813
+ /** Steps it waits for. A step waits only for steps listed above it. */
4814
+ depends_on?: string[];
4815
+ requires?: ChecklistRequirement;
4816
+ }
4817
+ /** A role, and the person who stands in it by default. */
4818
+ interface ChecklistRoleSpec {
4819
+ role: string;
4820
+ label?: string;
4821
+ user_id?: Uuid | null;
4822
+ }
4823
+ /** What starts a run. */
4824
+ type ChecklistTriggerKind = "manual" | "record_created" | "status_reached";
4825
+ interface ChecklistTrigger {
4826
+ kind: ChecklistTriggerKind;
4827
+ /** The Table being watched, for the two kinds that watch one. */
4828
+ table_id?: Uuid;
4829
+ /** The state, for `status_reached`. */
4830
+ status?: string;
4831
+ }
4832
+ /** THE COMPLETE DECLARATIVE CHECKLIST — one object, one call, a whole process. */
4833
+ interface ChecklistSpec {
4834
+ name: string;
4835
+ /** The Table a run is ABOUT: People, Hires, Jobs, Matters. */
4836
+ about_table_id: Uuid;
4837
+ roles?: ChecklistRoleSpec[];
4838
+ trigger?: ChecklistTrigger;
4839
+ steps: ChecklistStepSpec[];
4840
+ }
4841
+ /** What `custom.checklist_declare` answers. */
4842
+ interface ChecklistDeclared {
4843
+ template_id: Uuid;
4844
+ name: string;
4845
+ about_table_id: Uuid;
4846
+ steps_table_id: Uuid;
4847
+ steps: number;
4848
+ roles: number;
4849
+ trigger: ChecklistTrigger;
4850
+ created: boolean;
4851
+ message: string;
4852
+ ms: number;
4853
+ }
4854
+ /** One row of `custom.checklist_templates`. */
4855
+ interface ChecklistTemplateSummary {
4856
+ template_id: Uuid;
4857
+ name: string;
4858
+ about_table_id: Uuid | null;
4859
+ about_table: string | null;
4860
+ steps: number;
4861
+ roles: number;
4862
+ trigger_kind: ChecklistTriggerKind;
4863
+ trigger_status: string | null;
4864
+ open_runs: number;
4865
+ total_runs: number;
4866
+ updated_at: Timestamp;
4867
+ }
4868
+ /** `custom.checklist_template_shape` — the spec, plus what the editor needs. */
4869
+ type ChecklistTemplateShape = ChecklistSpec & {
4870
+ template_id: Uuid;
4871
+ steps_table_id: Uuid | null;
4872
+ may_change: boolean;
4873
+ };
4874
+ /** What `custom.checklist_start` answers. */
4875
+ interface ChecklistRunStarted {
4876
+ run_id: Uuid;
4877
+ template_id: Uuid;
4878
+ template: string;
4879
+ about_record_id: Uuid | null;
4880
+ about: string | null;
4881
+ steps_table_id: Uuid;
4882
+ steps_created: number;
4883
+ assigned: number;
4884
+ unassigned: number;
4885
+ origin: string;
4886
+ steps: Array<{
4887
+ ref: string;
4888
+ step_id: Uuid;
4889
+ title: string;
4890
+ role: string | null;
4891
+ }>;
4892
+ /** Roles nobody is named for, so the screen can say so rather than show blanks. */
4893
+ waiting_on_a_name: string[];
4894
+ message: string;
4895
+ ms: number;
4896
+ }
4897
+ /** One step of a RUN, as `custom.checklist_run` answers it. */
4898
+ interface ChecklistRunStep {
4899
+ step_id: Uuid;
4900
+ step_order: number;
4901
+ ref: string;
4902
+ title: string;
4903
+ role: string | null;
4904
+ assignee_name: string | null;
4905
+ assignee_user_id: Uuid | null;
4906
+ due_on: Timestamp | null;
4907
+ due_state: WorkDueState;
4908
+ status: string | null;
4909
+ finished: boolean;
4910
+ requires: ChecklistRequirementKind;
4911
+ /**
4912
+ * The key the answer is filed under, as the checklist named it. A screen files
4913
+ * evidence under THIS, never under a name it invented — the store looks for
4914
+ * exactly this key and nothing else.
4915
+ */
4916
+ requires_key: string | null;
4917
+ requires_label: string | null;
4918
+ /** The form or the document template this step is, when it is one. */
4919
+ requires_id: Uuid | null;
4920
+ evidence: Record<string, unknown>;
4921
+ /** The titles of the steps it is still waiting for. */
4922
+ blocked_by: string[];
4923
+ may_complete: boolean;
4924
+ /** Why it cannot be finished right now, in the words a person would use. */
4925
+ refusal: string | null;
4926
+ }
4927
+ /** One row of `custom.checklist_runs`. */
4928
+ interface ChecklistRunSummary {
4929
+ run_id: Uuid;
4930
+ name: string;
4931
+ template_id: Uuid | null;
4932
+ template: string | null;
4933
+ about_record_id: Uuid | null;
4934
+ about: string | null;
4935
+ about_table_id: Uuid | null;
4936
+ started_at: Timestamp | null;
4937
+ started_by: Uuid | null;
4938
+ origin: string;
4939
+ step_count: number;
4940
+ done: number;
4941
+ overdue: number;
4942
+ next_step: string | null;
4943
+ next_due: Timestamp | null;
4944
+ closed_at: Timestamp | null;
4945
+ }
4946
+ /** What `custom.checklist_step_complete` answers. */
4947
+ interface ChecklistStepCompleted {
4948
+ step_id: Uuid;
4949
+ run_id?: Uuid;
4950
+ completed: boolean;
4951
+ evidence?: Record<string, unknown>;
4952
+ steps_left?: number;
4953
+ run_closed?: boolean;
4954
+ message: string;
4955
+ }
4956
+
4778
4957
  /**
4779
4958
  * VIS-31. A signed-in OUTSIDER, with the reason in plain English.
4780
4959
  *
@@ -5920,6 +6099,67 @@ interface RecordsClient {
5920
6099
  form_id: Uuid;
5921
6100
  published?: boolean;
5922
6101
  }): Promise<RecordsResult<Timestamp | null>>;
6102
+ /**
6103
+ * What is wrong with a checklist somebody is writing, in the words they would
6104
+ * use. `null` means it is fine. Pure — it reads no row and writes nothing —
6105
+ * so an editor may ask it on every keystroke and the refusal arrives BEFORE
6106
+ * the save rather than after it.
6107
+ */
6108
+ checklistRefusal(args: {
6109
+ spec: ChecklistSpec;
6110
+ }): Promise<RecordsResult<string | null>>;
6111
+ /**
6112
+ * Store a checklist, whole: ordered steps, who each belongs to by role, how
6113
+ * many days in each is due, what each waits for, what each asks for, and what
6114
+ * starts a run. Pass `template_id` to change the checklist that already
6115
+ * exists rather than making a second one.
6116
+ */
6117
+ checklistDeclare(args: {
6118
+ spec: ChecklistSpec;
6119
+ template_id?: Uuid | null;
6120
+ }): Promise<RecordsResult<ChecklistDeclared>>;
6121
+ checklistTemplates(args?: {
6122
+ about_table_id?: Uuid | null;
6123
+ limit?: number;
6124
+ }): Promise<RecordsResult<ChecklistTemplateSummary[]>>;
6125
+ checklistTemplateShape(args: {
6126
+ template_id: Uuid;
6127
+ }): Promise<RecordsResult<ChecklistTemplateShape>>;
6128
+ /**
6129
+ * Run a checklist for one record: one work item per step in the ONE work
6130
+ * layer, assigned by role to real people, dated from the offsets,
6131
+ * dependencies carried across. `roles` names who stands in each role for THIS
6132
+ * run, over whatever the checklist says by default.
6133
+ */
6134
+ checklistStart(args: {
6135
+ template_id: Uuid;
6136
+ about_record_id?: Uuid | null;
6137
+ roles?: Record<string, Uuid>;
6138
+ startingAt?: Timestamp | null;
6139
+ }): Promise<RecordsResult<ChecklistRunStarted>>;
6140
+ checklistRun(args: {
6141
+ run_id: Uuid;
6142
+ }): Promise<RecordsResult<ChecklistRunStep[]>>;
6143
+ checklistRuns(args?: {
6144
+ about_table_id?: Uuid | null;
6145
+ about_record_id?: Uuid | null;
6146
+ includeClosed?: boolean;
6147
+ limit?: number;
6148
+ }): Promise<RecordsResult<ChecklistRunSummary[]>>;
6149
+ /**
6150
+ * Tick a step off with whatever it asked for. Refused by name while a step it
6151
+ * waits for is open, or while what it asks for is missing — and the same
6152
+ * refusal meets `workSetState`, because the rule lives in the store and not
6153
+ * in this door.
6154
+ */
6155
+ checklistStepComplete(args: {
6156
+ step_id: Uuid;
6157
+ evidence?: Record<string, unknown>;
6158
+ }): Promise<RecordsResult<ChecklistStepCompleted>>;
6159
+ /** Why this step cannot be finished right now. `null` means it can. */
6160
+ checklistStepRefusal(args: {
6161
+ step_id: Uuid;
6162
+ }): Promise<RecordsResult<string | null>>;
5923
6163
  /** The five states and what each one may become. Asked, never hardcoded in a picker. */
5924
6164
  workStates(): Promise<RecordsResult<WorkState[]>>;
5925
6165
  /** Why this graph would be refused — asked BEFORE it is written. `null` means it is fine. */
@@ -6344,4 +6584,4 @@ declare function useFieldMutation(): UseFieldMutation;
6344
6584
  */
6345
6585
  declare function useMergeField(key: string | null, state?: Record<string, unknown>): MergeFieldResolution | null;
6346
6586
 
6347
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, COMPUTE_ON, CONTEXT_POLICIES, type ChoiceOption, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, KERNEL_TABLES, type KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PredictedRefusal, type ProvenancePointer, type PublishBinding, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordComment, type RecordDocument, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, RecordsProvider, type RecordsProviderProps, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDueState, type WorkGraph, type WorkInboxItem, type WorkInboxKind, type WorkInstantiation, type WorkListFlavour, type WorkListItem, type WorkOrigin, type WorkRecordState, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, choiceSlug, choiceValuesOf, choicesOf, err, highestLevel, holdsARetiredChoice, isRecordsErr, isTheChosen, looksLikeAnId, measureKey, ok, optionKey, optionLabel, portalPath, publicFormPath, scopeChip, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTables };
6587
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, COMPUTE_ON, CONTEXT_POLICIES, type ChecklistDeclared, type ChecklistRequirement, type ChecklistRequirementKind, type ChecklistRoleSpec, type ChecklistRunStarted, type ChecklistRunStep, type ChecklistRunSummary, type ChecklistSpec, type ChecklistStepCompleted, type ChecklistStepSpec, type ChecklistTemplateShape, type ChecklistTemplateSummary, type ChecklistTrigger, type ChecklistTriggerKind, type ChoiceOption, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, KERNEL_TABLES, type KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PredictedRefusal, type ProvenancePointer, type PublishBinding, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordComment, type RecordDocument, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, RecordsProvider, type RecordsProviderProps, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDueState, type WorkGraph, type WorkInboxItem, type WorkInboxKind, type WorkInstantiation, type WorkListFlavour, type WorkListItem, type WorkOrigin, type WorkRecordState, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, choiceSlug, choiceValuesOf, choicesOf, err, highestLevel, holdsARetiredChoice, isRecordsErr, isTheChosen, looksLikeAnId, measureKey, ok, optionKey, optionLabel, portalPath, publicFormPath, scopeChip, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTables };
@@ -4775,6 +4775,185 @@ interface WorkAssignment {
4775
4775
  message: string;
4776
4776
  }
4777
4777
 
4778
+ /** What a step asks for before it counts as done. Every one of these is CHECKED. */
4779
+ type ChecklistRequirementKind =
4780
+ /** A person says it is done. */
4781
+ "none"
4782
+ /** A sentence of evidence, under `note`. */
4783
+ | "note"
4784
+ /** A named value filled in on the step itself. */
4785
+ | "answer"
4786
+ /** A named Field on the record the run is about must hold a value. */
4787
+ | "record_field"
4788
+ /** The step IS a form (SCR-19): finishing it needs a response record. */
4789
+ | "form"
4790
+ /** The step IS a document from a doc template (REC-68): finishing it needs a render. */
4791
+ | "document";
4792
+ interface ChecklistRequirement {
4793
+ kind: ChecklistRequirementKind;
4794
+ /** For `answer` and `record_field`: which value. */
4795
+ key?: string;
4796
+ /** What a person is asked for, in their words. */
4797
+ label?: string;
4798
+ /** For `form`: the published form this step is. */
4799
+ form_id?: Uuid;
4800
+ /** For `document`: the doc template this step renders. */
4801
+ template_id?: Uuid;
4802
+ }
4803
+ /** One step of a checklist, as it is WRITTEN — not as it is run. */
4804
+ interface ChecklistStepSpec {
4805
+ /** The name the checklist refers to this step by; lower-case, unique. */
4806
+ ref: string;
4807
+ /** What a person reads in their work. */
4808
+ title: string;
4809
+ /** Which role owns it. A role the checklist never declares is refused at save. */
4810
+ role?: string;
4811
+ /** How many days after the run starts it is due. */
4812
+ due_days?: number;
4813
+ /** Steps it waits for. A step waits only for steps listed above it. */
4814
+ depends_on?: string[];
4815
+ requires?: ChecklistRequirement;
4816
+ }
4817
+ /** A role, and the person who stands in it by default. */
4818
+ interface ChecklistRoleSpec {
4819
+ role: string;
4820
+ label?: string;
4821
+ user_id?: Uuid | null;
4822
+ }
4823
+ /** What starts a run. */
4824
+ type ChecklistTriggerKind = "manual" | "record_created" | "status_reached";
4825
+ interface ChecklistTrigger {
4826
+ kind: ChecklistTriggerKind;
4827
+ /** The Table being watched, for the two kinds that watch one. */
4828
+ table_id?: Uuid;
4829
+ /** The state, for `status_reached`. */
4830
+ status?: string;
4831
+ }
4832
+ /** THE COMPLETE DECLARATIVE CHECKLIST — one object, one call, a whole process. */
4833
+ interface ChecklistSpec {
4834
+ name: string;
4835
+ /** The Table a run is ABOUT: People, Hires, Jobs, Matters. */
4836
+ about_table_id: Uuid;
4837
+ roles?: ChecklistRoleSpec[];
4838
+ trigger?: ChecklistTrigger;
4839
+ steps: ChecklistStepSpec[];
4840
+ }
4841
+ /** What `custom.checklist_declare` answers. */
4842
+ interface ChecklistDeclared {
4843
+ template_id: Uuid;
4844
+ name: string;
4845
+ about_table_id: Uuid;
4846
+ steps_table_id: Uuid;
4847
+ steps: number;
4848
+ roles: number;
4849
+ trigger: ChecklistTrigger;
4850
+ created: boolean;
4851
+ message: string;
4852
+ ms: number;
4853
+ }
4854
+ /** One row of `custom.checklist_templates`. */
4855
+ interface ChecklistTemplateSummary {
4856
+ template_id: Uuid;
4857
+ name: string;
4858
+ about_table_id: Uuid | null;
4859
+ about_table: string | null;
4860
+ steps: number;
4861
+ roles: number;
4862
+ trigger_kind: ChecklistTriggerKind;
4863
+ trigger_status: string | null;
4864
+ open_runs: number;
4865
+ total_runs: number;
4866
+ updated_at: Timestamp;
4867
+ }
4868
+ /** `custom.checklist_template_shape` — the spec, plus what the editor needs. */
4869
+ type ChecklistTemplateShape = ChecklistSpec & {
4870
+ template_id: Uuid;
4871
+ steps_table_id: Uuid | null;
4872
+ may_change: boolean;
4873
+ };
4874
+ /** What `custom.checklist_start` answers. */
4875
+ interface ChecklistRunStarted {
4876
+ run_id: Uuid;
4877
+ template_id: Uuid;
4878
+ template: string;
4879
+ about_record_id: Uuid | null;
4880
+ about: string | null;
4881
+ steps_table_id: Uuid;
4882
+ steps_created: number;
4883
+ assigned: number;
4884
+ unassigned: number;
4885
+ origin: string;
4886
+ steps: Array<{
4887
+ ref: string;
4888
+ step_id: Uuid;
4889
+ title: string;
4890
+ role: string | null;
4891
+ }>;
4892
+ /** Roles nobody is named for, so the screen can say so rather than show blanks. */
4893
+ waiting_on_a_name: string[];
4894
+ message: string;
4895
+ ms: number;
4896
+ }
4897
+ /** One step of a RUN, as `custom.checklist_run` answers it. */
4898
+ interface ChecklistRunStep {
4899
+ step_id: Uuid;
4900
+ step_order: number;
4901
+ ref: string;
4902
+ title: string;
4903
+ role: string | null;
4904
+ assignee_name: string | null;
4905
+ assignee_user_id: Uuid | null;
4906
+ due_on: Timestamp | null;
4907
+ due_state: WorkDueState;
4908
+ status: string | null;
4909
+ finished: boolean;
4910
+ requires: ChecklistRequirementKind;
4911
+ /**
4912
+ * The key the answer is filed under, as the checklist named it. A screen files
4913
+ * evidence under THIS, never under a name it invented — the store looks for
4914
+ * exactly this key and nothing else.
4915
+ */
4916
+ requires_key: string | null;
4917
+ requires_label: string | null;
4918
+ /** The form or the document template this step is, when it is one. */
4919
+ requires_id: Uuid | null;
4920
+ evidence: Record<string, unknown>;
4921
+ /** The titles of the steps it is still waiting for. */
4922
+ blocked_by: string[];
4923
+ may_complete: boolean;
4924
+ /** Why it cannot be finished right now, in the words a person would use. */
4925
+ refusal: string | null;
4926
+ }
4927
+ /** One row of `custom.checklist_runs`. */
4928
+ interface ChecklistRunSummary {
4929
+ run_id: Uuid;
4930
+ name: string;
4931
+ template_id: Uuid | null;
4932
+ template: string | null;
4933
+ about_record_id: Uuid | null;
4934
+ about: string | null;
4935
+ about_table_id: Uuid | null;
4936
+ started_at: Timestamp | null;
4937
+ started_by: Uuid | null;
4938
+ origin: string;
4939
+ step_count: number;
4940
+ done: number;
4941
+ overdue: number;
4942
+ next_step: string | null;
4943
+ next_due: Timestamp | null;
4944
+ closed_at: Timestamp | null;
4945
+ }
4946
+ /** What `custom.checklist_step_complete` answers. */
4947
+ interface ChecklistStepCompleted {
4948
+ step_id: Uuid;
4949
+ run_id?: Uuid;
4950
+ completed: boolean;
4951
+ evidence?: Record<string, unknown>;
4952
+ steps_left?: number;
4953
+ run_closed?: boolean;
4954
+ message: string;
4955
+ }
4956
+
4778
4957
  /**
4779
4958
  * VIS-31. A signed-in OUTSIDER, with the reason in plain English.
4780
4959
  *
@@ -5920,6 +6099,67 @@ interface RecordsClient {
5920
6099
  form_id: Uuid;
5921
6100
  published?: boolean;
5922
6101
  }): Promise<RecordsResult<Timestamp | null>>;
6102
+ /**
6103
+ * What is wrong with a checklist somebody is writing, in the words they would
6104
+ * use. `null` means it is fine. Pure — it reads no row and writes nothing —
6105
+ * so an editor may ask it on every keystroke and the refusal arrives BEFORE
6106
+ * the save rather than after it.
6107
+ */
6108
+ checklistRefusal(args: {
6109
+ spec: ChecklistSpec;
6110
+ }): Promise<RecordsResult<string | null>>;
6111
+ /**
6112
+ * Store a checklist, whole: ordered steps, who each belongs to by role, how
6113
+ * many days in each is due, what each waits for, what each asks for, and what
6114
+ * starts a run. Pass `template_id` to change the checklist that already
6115
+ * exists rather than making a second one.
6116
+ */
6117
+ checklistDeclare(args: {
6118
+ spec: ChecklistSpec;
6119
+ template_id?: Uuid | null;
6120
+ }): Promise<RecordsResult<ChecklistDeclared>>;
6121
+ checklistTemplates(args?: {
6122
+ about_table_id?: Uuid | null;
6123
+ limit?: number;
6124
+ }): Promise<RecordsResult<ChecklistTemplateSummary[]>>;
6125
+ checklistTemplateShape(args: {
6126
+ template_id: Uuid;
6127
+ }): Promise<RecordsResult<ChecklistTemplateShape>>;
6128
+ /**
6129
+ * Run a checklist for one record: one work item per step in the ONE work
6130
+ * layer, assigned by role to real people, dated from the offsets,
6131
+ * dependencies carried across. `roles` names who stands in each role for THIS
6132
+ * run, over whatever the checklist says by default.
6133
+ */
6134
+ checklistStart(args: {
6135
+ template_id: Uuid;
6136
+ about_record_id?: Uuid | null;
6137
+ roles?: Record<string, Uuid>;
6138
+ startingAt?: Timestamp | null;
6139
+ }): Promise<RecordsResult<ChecklistRunStarted>>;
6140
+ checklistRun(args: {
6141
+ run_id: Uuid;
6142
+ }): Promise<RecordsResult<ChecklistRunStep[]>>;
6143
+ checklistRuns(args?: {
6144
+ about_table_id?: Uuid | null;
6145
+ about_record_id?: Uuid | null;
6146
+ includeClosed?: boolean;
6147
+ limit?: number;
6148
+ }): Promise<RecordsResult<ChecklistRunSummary[]>>;
6149
+ /**
6150
+ * Tick a step off with whatever it asked for. Refused by name while a step it
6151
+ * waits for is open, or while what it asks for is missing — and the same
6152
+ * refusal meets `workSetState`, because the rule lives in the store and not
6153
+ * in this door.
6154
+ */
6155
+ checklistStepComplete(args: {
6156
+ step_id: Uuid;
6157
+ evidence?: Record<string, unknown>;
6158
+ }): Promise<RecordsResult<ChecklistStepCompleted>>;
6159
+ /** Why this step cannot be finished right now. `null` means it can. */
6160
+ checklistStepRefusal(args: {
6161
+ step_id: Uuid;
6162
+ }): Promise<RecordsResult<string | null>>;
5923
6163
  /** The five states and what each one may become. Asked, never hardcoded in a picker. */
5924
6164
  workStates(): Promise<RecordsResult<WorkState[]>>;
5925
6165
  /** Why this graph would be refused — asked BEFORE it is written. `null` means it is fine. */
@@ -6344,4 +6584,4 @@ declare function useFieldMutation(): UseFieldMutation;
6344
6584
  */
6345
6585
  declare function useMergeField(key: string | null, state?: Record<string, unknown>): MergeFieldResolution | null;
6346
6586
 
6347
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, COMPUTE_ON, CONTEXT_POLICIES, type ChoiceOption, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, KERNEL_TABLES, type KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PredictedRefusal, type ProvenancePointer, type PublishBinding, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordComment, type RecordDocument, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, RecordsProvider, type RecordsProviderProps, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDueState, type WorkGraph, type WorkInboxItem, type WorkInboxKind, type WorkInstantiation, type WorkListFlavour, type WorkListItem, type WorkOrigin, type WorkRecordState, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, choiceSlug, choiceValuesOf, choicesOf, err, highestLevel, holdsARetiredChoice, isRecordsErr, isTheChosen, looksLikeAnId, measureKey, ok, optionKey, optionLabel, portalPath, publicFormPath, scopeChip, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTables };
6587
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, COMPUTE_ON, CONTEXT_POLICIES, type ChecklistDeclared, type ChecklistRequirement, type ChecklistRequirementKind, type ChecklistRoleSpec, type ChecklistRunStarted, type ChecklistRunStep, type ChecklistRunSummary, type ChecklistSpec, type ChecklistStepCompleted, type ChecklistStepSpec, type ChecklistTemplateShape, type ChecklistTemplateSummary, type ChecklistTrigger, type ChecklistTriggerKind, type ChoiceOption, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, KERNEL_TABLES, type KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PredictedRefusal, type ProvenancePointer, type PublishBinding, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordComment, type RecordDocument, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, RecordsProvider, type RecordsProviderProps, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDueState, type WorkGraph, type WorkInboxItem, type WorkInboxKind, type WorkInstantiation, type WorkListFlavour, type WorkListItem, type WorkOrigin, type WorkRecordState, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, choiceSlug, choiceValuesOf, choicesOf, err, highestLevel, holdsARetiredChoice, isRecordsErr, isTheChosen, looksLikeAnId, measureKey, ok, optionKey, optionLabel, portalPath, publicFormPath, scopeChip, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTables };
@@ -1994,6 +1994,16 @@ var DOORS = {
1994
1994
  workApprovalMayDecide: "work_approval_may_decide",
1995
1995
  workApprovalDecide: "work_approval_decide",
1996
1996
  workApprovalRead: "work_approval_read",
1997
+ // PRODUCTS row 13 — checklists and SOP runs.
1998
+ checklistRefusal: "checklist_refusal",
1999
+ checklistDeclare: "checklist_declare",
2000
+ checklistTemplates: "checklist_templates",
2001
+ checklistTemplateShape: "checklist_template_shape",
2002
+ checklistStart: "checklist_start",
2003
+ checklistRun: "checklist_run",
2004
+ checklistRuns: "checklist_runs",
2005
+ checklistStepComplete: "checklist_step_complete",
2006
+ checklistStepRefusal: "checklist_step_refusal",
1997
2007
  // Declared here BECAUSE they do not exist yet: naming them is what makes the
1998
2008
  // absence visible to `pnpm check:store-registry` and to the suite.
1999
2009
  metadataSearch: "metadata_search",
@@ -3324,6 +3334,86 @@ function createRecordsClient(config) {
3324
3334
  "workSlotExpire"
3325
3335
  );
3326
3336
  },
3337
+ // ── checklists and SOP runs ──────────────────────────────────────────
3338
+ async checklistRefusal({ spec }) {
3339
+ return callDoor(
3340
+ DOORS.checklistRefusal,
3341
+ { p_spec: spec },
3342
+ "checklistRefusal"
3343
+ );
3344
+ },
3345
+ async checklistDeclare({ spec, template_id = null }) {
3346
+ return callDoor(
3347
+ DOORS.checklistDeclare,
3348
+ { p_organization_id: org, p_spec: spec, p_template_id: template_id },
3349
+ "checklistDeclare"
3350
+ );
3351
+ },
3352
+ async checklistTemplates(args) {
3353
+ return callDoor(
3354
+ DOORS.checklistTemplates,
3355
+ {
3356
+ p_organization_id: org,
3357
+ p_about_table_id: args?.about_table_id ?? null,
3358
+ p_limit: args?.limit ?? 100
3359
+ },
3360
+ "checklistTemplates"
3361
+ );
3362
+ },
3363
+ async checklistTemplateShape({ template_id }) {
3364
+ return callDoor(
3365
+ DOORS.checklistTemplateShape,
3366
+ { p_organization_id: org, p_template_id: template_id },
3367
+ "checklistTemplateShape"
3368
+ );
3369
+ },
3370
+ async checklistStart({ template_id, about_record_id = null, roles = {}, startingAt = null }) {
3371
+ return callDoor(
3372
+ DOORS.checklistStart,
3373
+ {
3374
+ p_organization_id: org,
3375
+ p_template_id: template_id,
3376
+ p_about_record_id: about_record_id,
3377
+ p_roles: roles,
3378
+ p_starting_at: startingAt
3379
+ },
3380
+ "checklistStart"
3381
+ );
3382
+ },
3383
+ async checklistRun({ run_id }) {
3384
+ return callDoor(
3385
+ DOORS.checklistRun,
3386
+ { p_organization_id: org, p_run_id: run_id },
3387
+ "checklistRun"
3388
+ );
3389
+ },
3390
+ async checklistRuns(args) {
3391
+ return callDoor(
3392
+ DOORS.checklistRuns,
3393
+ {
3394
+ p_organization_id: org,
3395
+ p_about_table_id: args?.about_table_id ?? null,
3396
+ p_about_record_id: args?.about_record_id ?? null,
3397
+ p_include_closed: args?.includeClosed ?? true,
3398
+ p_limit: args?.limit ?? 100
3399
+ },
3400
+ "checklistRuns"
3401
+ );
3402
+ },
3403
+ async checklistStepComplete({ step_id, evidence = {} }) {
3404
+ return callDoor(
3405
+ DOORS.checklistStepComplete,
3406
+ { p_organization_id: org, p_step_id: step_id, p_evidence: evidence },
3407
+ "checklistStepComplete"
3408
+ );
3409
+ },
3410
+ async checklistStepRefusal({ step_id }) {
3411
+ return callDoor(
3412
+ DOORS.checklistStepRefusal,
3413
+ { p_organization_id: org, p_step_id: step_id },
3414
+ "checklistStepRefusal"
3415
+ );
3416
+ },
3327
3417
  // ── the work layer a person actually uses ────────────────────────────
3328
3418
  async workInbox(args) {
3329
3419
  return callDoor(