@arbidocs/sdk 0.4.125 → 0.4.126

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.
@@ -1137,6 +1137,15 @@ declare function listVersions(arbi: ArbiClient, docId: string): Promise<{
1137
1137
  source_message_ext_id?: string | null | undefined;
1138
1138
  conversation_ext_id?: string | null | undefined;
1139
1139
  }[]>;
1140
+ /**
1141
+ * Finalise a translation: save its current version as a new PDF document, labelled "Translation" and linked
1142
+ * to the original it translates. The editable translation is unchanged. Returns the new PDF's id.
1143
+ */
1144
+ declare function finaliseTranslation(arbi: ArbiClient, docId: string): Promise<{
1145
+ document_ext_id: string;
1146
+ translation_ref: string;
1147
+ source_ref?: string | null | undefined;
1148
+ }>;
1140
1149
  /** Delete documents. A document goes with all its versions, and an email with its attachments. */
1141
1150
  declare function deleteDocuments(arbi: ArbiClient, externalIds: string[]): Promise<void>;
1142
1151
  declare function updateDocuments(arbi: ArbiClient, documents: DocUpdateRequest$1[]): Promise<{
@@ -1384,6 +1393,7 @@ type documents_UploadOptions = UploadOptions;
1384
1393
  type documents_UploadResult = UploadResult;
1385
1394
  declare const documents_deleteDocuments: typeof deleteDocuments;
1386
1395
  declare const documents_downloadDocument: typeof downloadDocument;
1396
+ declare const documents_finaliseTranslation: typeof finaliseTranslation;
1387
1397
  declare const documents_getDocuments: typeof getDocuments;
1388
1398
  declare const documents_getParsedContent: typeof getParsedContent;
1389
1399
  declare const documents_getThumbnails: typeof getThumbnails;
@@ -1399,7 +1409,7 @@ declare const documents_uploadDocumentsDirect: typeof uploadDocumentsDirect;
1399
1409
  declare const documents_uploadFiles: typeof uploadFiles;
1400
1410
  declare const documents_uploadUrl: typeof uploadUrl;
1401
1411
  declare namespace documents {
1402
- export { type documents_DirectUploadClient as DirectUploadClient, type documents_DirectUploadFile as DirectUploadFile, type documents_DirectUploadProgress as DirectUploadProgress, type documents_DocumentListFields as DocumentListFields, type documents_DocumentListOrder as DocumentListOrder, type documents_ListAllOptions as ListAllOptions, type documents_ListPaginatedOptions as ListPaginatedOptions, documents_MAX_PAGES as MAX_PAGES, documents_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documents_SkippedFile as SkippedFile, type documents_UploadBatchResult as UploadBatchResult, type documents_UploadDirectOptions as UploadDirectOptions, type documents_UploadDirectResult as UploadDirectResult, type documents_UploadOptions as UploadOptions, type documents_UploadResult as UploadResult, documents_deleteDocuments as deleteDocuments, documents_downloadDocument as downloadDocument, documents_getDocuments as getDocuments, documents_getParsedContent as getParsedContent, documents_getThumbnails as getThumbnails, documents_listAll as listAll, documents_listDocuments as listDocuments, documents_listPaginated as listPaginated, documents_listVersions as listVersions, documents_mimeFromName as mimeFromName, documents_presignedPut as presignedPut, documents_sanitizeFolderPath as sanitizeFolderPath, documents_updateDocuments as updateDocuments, documents_uploadDocumentsDirect as uploadDocumentsDirect, uploadFile$1 as uploadFile, documents_uploadFiles as uploadFiles, documents_uploadUrl as uploadUrl };
1412
+ export { type documents_DirectUploadClient as DirectUploadClient, type documents_DirectUploadFile as DirectUploadFile, type documents_DirectUploadProgress as DirectUploadProgress, type documents_DocumentListFields as DocumentListFields, type documents_DocumentListOrder as DocumentListOrder, type documents_ListAllOptions as ListAllOptions, type documents_ListPaginatedOptions as ListPaginatedOptions, documents_MAX_PAGES as MAX_PAGES, documents_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documents_SkippedFile as SkippedFile, type documents_UploadBatchResult as UploadBatchResult, type documents_UploadDirectOptions as UploadDirectOptions, type documents_UploadDirectResult as UploadDirectResult, type documents_UploadOptions as UploadOptions, type documents_UploadResult as UploadResult, documents_deleteDocuments as deleteDocuments, documents_downloadDocument as downloadDocument, documents_finaliseTranslation as finaliseTranslation, documents_getDocuments as getDocuments, documents_getParsedContent as getParsedContent, documents_getThumbnails as getThumbnails, documents_listAll as listAll, documents_listDocuments as listDocuments, documents_listPaginated as listPaginated, documents_listVersions as listVersions, documents_mimeFromName as mimeFromName, documents_presignedPut as presignedPut, documents_sanitizeFolderPath as sanitizeFolderPath, documents_updateDocuments as updateDocuments, documents_uploadDocumentsDirect as uploadDocumentsDirect, uploadFile$1 as uploadFile, documents_uploadFiles as uploadFiles, documents_uploadUrl as uploadUrl };
1403
1413
  }
1404
1414
 
1405
1415
  /**
@@ -3940,6 +3950,18 @@ declare function getAgentConfig(arbi: ArbiClient, agentExtId: string): Promise<{
3940
3950
  } | undefined;
3941
3951
  }[] | undefined;
3942
3952
  };
3953
+ TranslationLLM: {
3954
+ API_TYPE: "local" | "remote";
3955
+ ENABLE_THINKING: boolean;
3956
+ MODEL_NAME: string;
3957
+ SYSTEM_INSTRUCTION: string;
3958
+ TEMPERATURE: number;
3959
+ MAX_TOKENS: number;
3960
+ WINDOW_TOKENS: number;
3961
+ CONTEXT_TOKENS: number;
3962
+ GLOSSARY_TOKENS: number;
3963
+ MAX_CONCURRENT: number;
3964
+ };
3943
3965
  MemoryLLM: {
3944
3966
  API_TYPE: "local" | "remote";
3945
3967
  ENABLE_THINKING: boolean;
@@ -4914,7 +4936,8 @@ type StepStatus = 'pending' | 'running' | 'done' | 'skipped' | 'failed';
4914
4936
  * Where a step stands in a run: `pending` while something it waits for is unfinished, `ready`
4915
4937
  * once everything it waits for is done or skipped, then its own status.
4916
4938
  */
4917
- type StepPhase = 'pending' | 'ready' | 'running' | 'done' | 'skipped' | 'failed';
4939
+ /** `waiting`: an action step started and now waits for people (signers to sign, a draft to be sent). */
4940
+ type StepPhase = 'pending' | 'ready' | 'running' | 'waiting' | 'done' | 'skipped' | 'failed';
4918
4941
  interface StepState {
4919
4942
  status: StepStatus;
4920
4943
  /** The step's answer in the thread (an agent step: a message id), or what a branch delivered. */
@@ -4931,6 +4954,12 @@ interface StepState {
4931
4954
  * its latest `step_waiting` / `step_progress` says; empty once it starts (or never waited).
4932
4955
  */
4933
4956
  waitingDocuments: string[];
4957
+ /**
4958
+ * What a started action step waits for (`sign`, `email_draft`), as its latest `step_waiting` says,
4959
+ * and the document it is about (a signature request's document); null when it waits on nothing.
4960
+ */
4961
+ waitingAction: string | null;
4962
+ waitingDocument: string | null;
4934
4963
  }
4935
4964
  /** One entry of a conversation's activity log, as far as steps are concerned. */
4936
4965
  interface StepActivityEvent {
@@ -4940,6 +4969,8 @@ interface StepActivityEvent {
4940
4969
  created_at?: string;
4941
4970
  }
4942
4971
  declare const STEP_KINDS: readonly StepKind[];
4972
+ /** What an `action` step does with a platform feature (`src/core/workflow_actions.py`). */
4973
+ declare const STEP_ACTION_TYPES: readonly ["sign", "email_draft", "tabular_review"];
4943
4974
  declare const PERSON_STEP_KINDS: readonly StepKind[];
4944
4975
  /** The server's step id rule. */
4945
4976
  declare const STEP_ID_PATTERN: RegExp;
@@ -5014,6 +5045,9 @@ interface RunStep {
5014
5045
  linkedRuns: LinkedRun[];
5015
5046
  /** The documents (ids) it waits on to finish processing before its turn starts. */
5016
5047
  waitingDocuments: string[];
5048
+ /** A started action step waiting for people: what for (`sign`, `email_draft`), and its document. */
5049
+ waitingAction: string | null;
5050
+ waitingDocument: string | null;
5017
5051
  }
5018
5052
  /** A run's steps with where each stands, in plan order. */
5019
5053
  declare function runSteps(steps: TaskPlanStep[], events: StepActivityEvent[]): RunStep[];
@@ -5107,6 +5141,7 @@ type workflowSteps_RaisedSignal = RaisedSignal;
5107
5141
  type workflowSteps_RunStep = RunStep;
5108
5142
  type workflowSteps_RunWaitingOn = RunWaitingOn;
5109
5143
  declare const workflowSteps_SIGNAL_NAME_PATTERN: typeof SIGNAL_NAME_PATTERN;
5144
+ declare const workflowSteps_STEP_ACTION_TYPES: typeof STEP_ACTION_TYPES;
5110
5145
  declare const workflowSteps_STEP_FIELD_OPTION_TONES: typeof STEP_FIELD_OPTION_TONES;
5111
5146
  declare const workflowSteps_STEP_FIELD_TYPES: typeof STEP_FIELD_TYPES;
5112
5147
  declare const workflowSteps_STEP_ID_PATTERN: typeof STEP_ID_PATTERN;
@@ -5144,7 +5179,7 @@ declare const workflowSteps_stepStatesFromActivity: typeof stepStatesFromActivit
5144
5179
  declare const workflowSteps_stepsPlan: typeof stepsPlan;
5145
5180
  declare const workflowSteps_waitingForDocumentsText: typeof waitingForDocumentsText;
5146
5181
  declare namespace workflowSteps {
5147
- export { type workflowSteps_LinkedRun as LinkedRun, workflowSteps_PERSON_STEP_KINDS as PERSON_STEP_KINDS, workflowSteps_PlanStepsError as PlanStepsError, type workflowSteps_RaisedSignal as RaisedSignal, type workflowSteps_RunStep as RunStep, type workflowSteps_RunWaitingOn as RunWaitingOn, workflowSteps_SIGNAL_NAME_PATTERN as SIGNAL_NAME_PATTERN, workflowSteps_STEP_FIELD_OPTION_TONES as STEP_FIELD_OPTION_TONES, workflowSteps_STEP_FIELD_TYPES as STEP_FIELD_TYPES, workflowSteps_STEP_ID_PATTERN as STEP_ID_PATTERN, workflowSteps_STEP_KINDS as STEP_KINDS, type workflowSteps_SendBack as SendBack, type workflowSteps_StepActivityEvent as StepActivityEvent, type workflowSteps_StepAssignee as StepAssignee, type workflowSteps_StepField as StepField, type workflowSteps_StepFieldOption as StepFieldOption, type workflowSteps_StepFieldOptionTone as StepFieldOptionTone, type workflowSteps_StepKind as StepKind, type workflowSteps_StepPhase as StepPhase, type workflowSteps_StepSignal as StepSignal, type workflowSteps_StepSignalWhen as StepSignalWhen, type workflowSteps_StepState as StepState, type workflowSteps_StepStatus as StepStatus, type workflowSteps_TaskPlanStep as TaskPlanStep, workflowSteps_checkStepInputs as checkStepInputs, workflowSteps_describeAssignee as describeAssignee, workflowSteps_describeInputProblems as describeInputProblems, workflowSteps_isPersonStep as isPersonStep, workflowSteps_linkedRuns as linkedRuns, workflowSteps_messageWorkflowStep as messageWorkflowStep, workflowSteps_missingRequiredFields as missingRequiredFields, workflowSteps_parseInputPairs as parseInputPairs, workflowSteps_parsePlanSteps as parsePlanSteps, workflowSteps_raisedSignals as raisedSignals, workflowSteps_runSteps as runSteps, workflowSteps_runWaitingOn as runWaitingOn, workflowSteps_sendBacks as sendBacks, workflowSteps_stepDependencies as stepDependencies, workflowSteps_stepFields as stepFields, workflowSteps_stepPhase as stepPhase, workflowSteps_stepStatesFromActivity as stepStatesFromActivity, workflowSteps_stepsPlan as stepsPlan, workflowSteps_waitingForDocumentsText as waitingForDocumentsText };
5182
+ export { type workflowSteps_LinkedRun as LinkedRun, workflowSteps_PERSON_STEP_KINDS as PERSON_STEP_KINDS, workflowSteps_PlanStepsError as PlanStepsError, type workflowSteps_RaisedSignal as RaisedSignal, type workflowSteps_RunStep as RunStep, type workflowSteps_RunWaitingOn as RunWaitingOn, workflowSteps_SIGNAL_NAME_PATTERN as SIGNAL_NAME_PATTERN, workflowSteps_STEP_ACTION_TYPES as STEP_ACTION_TYPES, workflowSteps_STEP_FIELD_OPTION_TONES as STEP_FIELD_OPTION_TONES, workflowSteps_STEP_FIELD_TYPES as STEP_FIELD_TYPES, workflowSteps_STEP_ID_PATTERN as STEP_ID_PATTERN, workflowSteps_STEP_KINDS as STEP_KINDS, type workflowSteps_SendBack as SendBack, type workflowSteps_StepActivityEvent as StepActivityEvent, type workflowSteps_StepAssignee as StepAssignee, type workflowSteps_StepField as StepField, type workflowSteps_StepFieldOption as StepFieldOption, type workflowSteps_StepFieldOptionTone as StepFieldOptionTone, type workflowSteps_StepKind as StepKind, type workflowSteps_StepPhase as StepPhase, type workflowSteps_StepSignal as StepSignal, type workflowSteps_StepSignalWhen as StepSignalWhen, type workflowSteps_StepState as StepState, type workflowSteps_StepStatus as StepStatus, type workflowSteps_TaskPlanStep as TaskPlanStep, workflowSteps_checkStepInputs as checkStepInputs, workflowSteps_describeAssignee as describeAssignee, workflowSteps_describeInputProblems as describeInputProblems, workflowSteps_isPersonStep as isPersonStep, workflowSteps_linkedRuns as linkedRuns, workflowSteps_messageWorkflowStep as messageWorkflowStep, workflowSteps_missingRequiredFields as missingRequiredFields, workflowSteps_parseInputPairs as parseInputPairs, workflowSteps_parsePlanSteps as parsePlanSteps, workflowSteps_raisedSignals as raisedSignals, workflowSteps_runSteps as runSteps, workflowSteps_runWaitingOn as runWaitingOn, workflowSteps_sendBacks as sendBacks, workflowSteps_stepDependencies as stepDependencies, workflowSteps_stepFields as stepFields, workflowSteps_stepPhase as stepPhase, workflowSteps_stepStatesFromActivity as stepStatesFromActivity, workflowSteps_stepsPlan as stepsPlan, workflowSteps_waitingForDocumentsText as waitingForDocumentsText };
5148
5183
  }
5149
5184
 
5150
5185
  /**
@@ -5297,6 +5332,20 @@ declare function deleteWorkflow(arbi: ArbiClient, workflowId: string): Promise<v
5297
5332
  declare function runWorkflow(arbi: ArbiClient, workflowId: string): Promise<WorkflowRunResponse>;
5298
5333
  /** Persisted document-action runs, including failures and their affected documents. */
5299
5334
  declare function listWorkflowRuns(arbi: ArbiClient, workflowId: string): Promise<WorkflowRunHistoryResponse[]>;
5335
+ /** Does a workflow run with nobody present (a schedule, an event, after a task), so its agent needs a key? */
5336
+ declare const runsUnattended: (w: Pick<WorkflowResponse, "on_demand">) => boolean;
5337
+ /**
5338
+ * Deposit a key for a workflow's agent: give it STANDING membership of the workflow's workspace while the
5339
+ * owner is signed in, so unattended runs (schedules, events) derive the workspace key themselves. Only for a
5340
+ * `scheduled_permanent` workflow that runs unattended; the agent is the one the server assigned (the owner's
5341
+ * Assistant when none was named). `grant(email)` adds the agent with the workspace key (the open workspace's,
5342
+ * or one sealed by the caller). Returns the agent's email, or null when there was nothing to grant. Without a
5343
+ * deposit a run asks the owner for access each time instead.
5344
+ */
5345
+ declare function grantWorkflowAgentAccess(agents: {
5346
+ external_id: string;
5347
+ email: string;
5348
+ }[], workflow: Pick<WorkflowResponse, 'auth_mode' | 'agent_ext_id' | 'on_demand'>, grant: (email: string) => Promise<unknown>): Promise<string | null>;
5300
5349
 
5301
5350
  type workflows_CreateWorkflowRequest = CreateWorkflowRequest;
5302
5351
  type workflows_DocumentAutomationAction = DocumentAutomationAction;
@@ -5309,12 +5358,14 @@ type workflows_WorkflowRunResponse = WorkflowRunResponse;
5309
5358
  declare const workflows_createWorkflow: typeof createWorkflow;
5310
5359
  declare const workflows_deleteWorkflow: typeof deleteWorkflow;
5311
5360
  declare const workflows_getWorkflow: typeof getWorkflow;
5361
+ declare const workflows_grantWorkflowAgentAccess: typeof grantWorkflowAgentAccess;
5312
5362
  declare const workflows_listWorkflowRuns: typeof listWorkflowRuns;
5313
5363
  declare const workflows_listWorkflows: typeof listWorkflows;
5314
5364
  declare const workflows_runWorkflow: typeof runWorkflow;
5365
+ declare const workflows_runsUnattended: typeof runsUnattended;
5315
5366
  declare const workflows_updateWorkflow: typeof updateWorkflow;
5316
5367
  declare namespace workflows {
5317
- export { type workflows_CreateWorkflowRequest as CreateWorkflowRequest, type workflows_DocumentAutomationAction as DocumentAutomationAction, type workflows_DocumentSelector as DocumentSelector, type workflows_UpdateWorkflowRequest as UpdateWorkflowRequest, type workflows_WorkflowAuthMode as WorkflowAuthMode, type workflows_WorkflowResponse as WorkflowResponse, type workflows_WorkflowRunHistoryResponse as WorkflowRunHistoryResponse, type workflows_WorkflowRunResponse as WorkflowRunResponse, workflows_createWorkflow as createWorkflow, workflows_deleteWorkflow as deleteWorkflow, workflows_getWorkflow as getWorkflow, workflows_listWorkflowRuns as listWorkflowRuns, workflows_listWorkflows as listWorkflows, workflows_runWorkflow as runWorkflow, workflows_updateWorkflow as updateWorkflow };
5368
+ export { type workflows_CreateWorkflowRequest as CreateWorkflowRequest, type workflows_DocumentAutomationAction as DocumentAutomationAction, type workflows_DocumentSelector as DocumentSelector, type workflows_UpdateWorkflowRequest as UpdateWorkflowRequest, type workflows_WorkflowAuthMode as WorkflowAuthMode, type workflows_WorkflowResponse as WorkflowResponse, type workflows_WorkflowRunHistoryResponse as WorkflowRunHistoryResponse, type workflows_WorkflowRunResponse as WorkflowRunResponse, workflows_createWorkflow as createWorkflow, workflows_deleteWorkflow as deleteWorkflow, workflows_getWorkflow as getWorkflow, workflows_grantWorkflowAgentAccess as grantWorkflowAgentAccess, workflows_listWorkflowRuns as listWorkflowRuns, workflows_listWorkflows as listWorkflows, workflows_runWorkflow as runWorkflow, workflows_runsUnattended as runsUnattended, workflows_updateWorkflow as updateWorkflow };
5318
5369
  }
5319
5370
 
5320
5371
  /**
@@ -8274,6 +8325,7 @@ declare class Arbi {
8274
8325
  metadata?: {
8275
8326
  [key: string]: unknown;
8276
8327
  } | null;
8328
+ conversation_ext_id?: string | null;
8277
8329
  }>;
8278
8330
  /** Read the status of a background turn. */
8279
8331
  getResponse: (id: string) => Promise<{
@@ -8291,6 +8343,7 @@ declare class Arbi {
8291
8343
  metadata?: {
8292
8344
  [key: string]: unknown;
8293
8345
  } | null;
8346
+ conversation_ext_id?: string | null;
8294
8347
  }>;
8295
8348
  /**
8296
8349
  * Send a question to the RAG assistant with streaming support.
@@ -8311,11 +8364,12 @@ declare class Arbi {
8311
8364
  user_invocable: boolean;
8312
8365
  arg_hint: string;
8313
8366
  skill_type: string;
8314
- workspace_ext_id: string;
8315
- doc_ext_id: string;
8316
- updated_at: string;
8367
+ workspace_ext_id?: string | null;
8368
+ doc_ext_id?: string | null;
8369
+ updated_at?: string | null;
8317
8370
  visibility: string;
8318
8371
  is_owner: boolean;
8372
+ content?: string | null;
8319
8373
  }[]>;
8320
8374
  /**
8321
8375
  * Search documents without LLM generation (retrieval only).
@@ -8983,6 +9037,18 @@ declare class Arbi {
8983
9037
  } | undefined;
8984
9038
  }[] | undefined;
8985
9039
  };
9040
+ TranslationLLM: {
9041
+ API_TYPE: "local" | "remote";
9042
+ ENABLE_THINKING: boolean;
9043
+ MODEL_NAME: string;
9044
+ SYSTEM_INSTRUCTION: string;
9045
+ TEMPERATURE: number;
9046
+ MAX_TOKENS: number;
9047
+ WINDOW_TOKENS: number;
9048
+ CONTEXT_TOKENS: number;
9049
+ GLOSSARY_TOKENS: number;
9050
+ MAX_CONCURRENT: number;
9051
+ };
8986
9052
  MemoryLLM: {
8987
9053
  API_TYPE: "local" | "remote";
8988
9054
  ENABLE_THINKING: boolean;
@@ -9446,6 +9512,18 @@ declare class Arbi {
9446
9512
  } | undefined;
9447
9513
  }[] | undefined;
9448
9514
  };
9515
+ TranslationLLM: {
9516
+ API_TYPE: "local" | "remote";
9517
+ ENABLE_THINKING: boolean;
9518
+ MODEL_NAME: string;
9519
+ SYSTEM_INSTRUCTION: string;
9520
+ TEMPERATURE: number;
9521
+ MAX_TOKENS: number;
9522
+ WINDOW_TOKENS: number;
9523
+ CONTEXT_TOKENS: number;
9524
+ GLOSSARY_TOKENS: number;
9525
+ MAX_CONCURRENT: number;
9526
+ };
9449
9527
  MemoryLLM: {
9450
9528
  API_TYPE: "local" | "remote";
9451
9529
  ENABLE_THINKING: boolean;
@@ -10492,6 +10570,18 @@ declare function getConfig(arbi: ArbiClient, configId: string): Promise<{
10492
10570
  } | undefined;
10493
10571
  }[] | undefined;
10494
10572
  };
10573
+ TranslationLLM: {
10574
+ API_TYPE: "local" | "remote";
10575
+ ENABLE_THINKING: boolean;
10576
+ MODEL_NAME: string;
10577
+ SYSTEM_INSTRUCTION: string;
10578
+ TEMPERATURE: number;
10579
+ MAX_TOKENS: number;
10580
+ WINDOW_TOKENS: number;
10581
+ CONTEXT_TOKENS: number;
10582
+ GLOSSARY_TOKENS: number;
10583
+ MAX_CONCURRENT: number;
10584
+ };
10495
10585
  MemoryLLM: {
10496
10586
  API_TYPE: "local" | "remote";
10497
10587
  ENABLE_THINKING: boolean;
@@ -1137,6 +1137,15 @@ declare function listVersions(arbi: ArbiClient, docId: string): Promise<{
1137
1137
  source_message_ext_id?: string | null | undefined;
1138
1138
  conversation_ext_id?: string | null | undefined;
1139
1139
  }[]>;
1140
+ /**
1141
+ * Finalise a translation: save its current version as a new PDF document, labelled "Translation" and linked
1142
+ * to the original it translates. The editable translation is unchanged. Returns the new PDF's id.
1143
+ */
1144
+ declare function finaliseTranslation(arbi: ArbiClient, docId: string): Promise<{
1145
+ document_ext_id: string;
1146
+ translation_ref: string;
1147
+ source_ref?: string | null | undefined;
1148
+ }>;
1140
1149
  /** Delete documents. A document goes with all its versions, and an email with its attachments. */
1141
1150
  declare function deleteDocuments(arbi: ArbiClient, externalIds: string[]): Promise<void>;
1142
1151
  declare function updateDocuments(arbi: ArbiClient, documents: DocUpdateRequest$1[]): Promise<{
@@ -1384,6 +1393,7 @@ type documents_UploadOptions = UploadOptions;
1384
1393
  type documents_UploadResult = UploadResult;
1385
1394
  declare const documents_deleteDocuments: typeof deleteDocuments;
1386
1395
  declare const documents_downloadDocument: typeof downloadDocument;
1396
+ declare const documents_finaliseTranslation: typeof finaliseTranslation;
1387
1397
  declare const documents_getDocuments: typeof getDocuments;
1388
1398
  declare const documents_getParsedContent: typeof getParsedContent;
1389
1399
  declare const documents_getThumbnails: typeof getThumbnails;
@@ -1399,7 +1409,7 @@ declare const documents_uploadDocumentsDirect: typeof uploadDocumentsDirect;
1399
1409
  declare const documents_uploadFiles: typeof uploadFiles;
1400
1410
  declare const documents_uploadUrl: typeof uploadUrl;
1401
1411
  declare namespace documents {
1402
- export { type documents_DirectUploadClient as DirectUploadClient, type documents_DirectUploadFile as DirectUploadFile, type documents_DirectUploadProgress as DirectUploadProgress, type documents_DocumentListFields as DocumentListFields, type documents_DocumentListOrder as DocumentListOrder, type documents_ListAllOptions as ListAllOptions, type documents_ListPaginatedOptions as ListPaginatedOptions, documents_MAX_PAGES as MAX_PAGES, documents_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documents_SkippedFile as SkippedFile, type documents_UploadBatchResult as UploadBatchResult, type documents_UploadDirectOptions as UploadDirectOptions, type documents_UploadDirectResult as UploadDirectResult, type documents_UploadOptions as UploadOptions, type documents_UploadResult as UploadResult, documents_deleteDocuments as deleteDocuments, documents_downloadDocument as downloadDocument, documents_getDocuments as getDocuments, documents_getParsedContent as getParsedContent, documents_getThumbnails as getThumbnails, documents_listAll as listAll, documents_listDocuments as listDocuments, documents_listPaginated as listPaginated, documents_listVersions as listVersions, documents_mimeFromName as mimeFromName, documents_presignedPut as presignedPut, documents_sanitizeFolderPath as sanitizeFolderPath, documents_updateDocuments as updateDocuments, documents_uploadDocumentsDirect as uploadDocumentsDirect, uploadFile$1 as uploadFile, documents_uploadFiles as uploadFiles, documents_uploadUrl as uploadUrl };
1412
+ export { type documents_DirectUploadClient as DirectUploadClient, type documents_DirectUploadFile as DirectUploadFile, type documents_DirectUploadProgress as DirectUploadProgress, type documents_DocumentListFields as DocumentListFields, type documents_DocumentListOrder as DocumentListOrder, type documents_ListAllOptions as ListAllOptions, type documents_ListPaginatedOptions as ListPaginatedOptions, documents_MAX_PAGES as MAX_PAGES, documents_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documents_SkippedFile as SkippedFile, type documents_UploadBatchResult as UploadBatchResult, type documents_UploadDirectOptions as UploadDirectOptions, type documents_UploadDirectResult as UploadDirectResult, type documents_UploadOptions as UploadOptions, type documents_UploadResult as UploadResult, documents_deleteDocuments as deleteDocuments, documents_downloadDocument as downloadDocument, documents_finaliseTranslation as finaliseTranslation, documents_getDocuments as getDocuments, documents_getParsedContent as getParsedContent, documents_getThumbnails as getThumbnails, documents_listAll as listAll, documents_listDocuments as listDocuments, documents_listPaginated as listPaginated, documents_listVersions as listVersions, documents_mimeFromName as mimeFromName, documents_presignedPut as presignedPut, documents_sanitizeFolderPath as sanitizeFolderPath, documents_updateDocuments as updateDocuments, documents_uploadDocumentsDirect as uploadDocumentsDirect, uploadFile$1 as uploadFile, documents_uploadFiles as uploadFiles, documents_uploadUrl as uploadUrl };
1403
1413
  }
1404
1414
 
1405
1415
  /**
@@ -3940,6 +3950,18 @@ declare function getAgentConfig(arbi: ArbiClient, agentExtId: string): Promise<{
3940
3950
  } | undefined;
3941
3951
  }[] | undefined;
3942
3952
  };
3953
+ TranslationLLM: {
3954
+ API_TYPE: "local" | "remote";
3955
+ ENABLE_THINKING: boolean;
3956
+ MODEL_NAME: string;
3957
+ SYSTEM_INSTRUCTION: string;
3958
+ TEMPERATURE: number;
3959
+ MAX_TOKENS: number;
3960
+ WINDOW_TOKENS: number;
3961
+ CONTEXT_TOKENS: number;
3962
+ GLOSSARY_TOKENS: number;
3963
+ MAX_CONCURRENT: number;
3964
+ };
3943
3965
  MemoryLLM: {
3944
3966
  API_TYPE: "local" | "remote";
3945
3967
  ENABLE_THINKING: boolean;
@@ -4914,7 +4936,8 @@ type StepStatus = 'pending' | 'running' | 'done' | 'skipped' | 'failed';
4914
4936
  * Where a step stands in a run: `pending` while something it waits for is unfinished, `ready`
4915
4937
  * once everything it waits for is done or skipped, then its own status.
4916
4938
  */
4917
- type StepPhase = 'pending' | 'ready' | 'running' | 'done' | 'skipped' | 'failed';
4939
+ /** `waiting`: an action step started and now waits for people (signers to sign, a draft to be sent). */
4940
+ type StepPhase = 'pending' | 'ready' | 'running' | 'waiting' | 'done' | 'skipped' | 'failed';
4918
4941
  interface StepState {
4919
4942
  status: StepStatus;
4920
4943
  /** The step's answer in the thread (an agent step: a message id), or what a branch delivered. */
@@ -4931,6 +4954,12 @@ interface StepState {
4931
4954
  * its latest `step_waiting` / `step_progress` says; empty once it starts (or never waited).
4932
4955
  */
4933
4956
  waitingDocuments: string[];
4957
+ /**
4958
+ * What a started action step waits for (`sign`, `email_draft`), as its latest `step_waiting` says,
4959
+ * and the document it is about (a signature request's document); null when it waits on nothing.
4960
+ */
4961
+ waitingAction: string | null;
4962
+ waitingDocument: string | null;
4934
4963
  }
4935
4964
  /** One entry of a conversation's activity log, as far as steps are concerned. */
4936
4965
  interface StepActivityEvent {
@@ -4940,6 +4969,8 @@ interface StepActivityEvent {
4940
4969
  created_at?: string;
4941
4970
  }
4942
4971
  declare const STEP_KINDS: readonly StepKind[];
4972
+ /** What an `action` step does with a platform feature (`src/core/workflow_actions.py`). */
4973
+ declare const STEP_ACTION_TYPES: readonly ["sign", "email_draft", "tabular_review"];
4943
4974
  declare const PERSON_STEP_KINDS: readonly StepKind[];
4944
4975
  /** The server's step id rule. */
4945
4976
  declare const STEP_ID_PATTERN: RegExp;
@@ -5014,6 +5045,9 @@ interface RunStep {
5014
5045
  linkedRuns: LinkedRun[];
5015
5046
  /** The documents (ids) it waits on to finish processing before its turn starts. */
5016
5047
  waitingDocuments: string[];
5048
+ /** A started action step waiting for people: what for (`sign`, `email_draft`), and its document. */
5049
+ waitingAction: string | null;
5050
+ waitingDocument: string | null;
5017
5051
  }
5018
5052
  /** A run's steps with where each stands, in plan order. */
5019
5053
  declare function runSteps(steps: TaskPlanStep[], events: StepActivityEvent[]): RunStep[];
@@ -5107,6 +5141,7 @@ type workflowSteps_RaisedSignal = RaisedSignal;
5107
5141
  type workflowSteps_RunStep = RunStep;
5108
5142
  type workflowSteps_RunWaitingOn = RunWaitingOn;
5109
5143
  declare const workflowSteps_SIGNAL_NAME_PATTERN: typeof SIGNAL_NAME_PATTERN;
5144
+ declare const workflowSteps_STEP_ACTION_TYPES: typeof STEP_ACTION_TYPES;
5110
5145
  declare const workflowSteps_STEP_FIELD_OPTION_TONES: typeof STEP_FIELD_OPTION_TONES;
5111
5146
  declare const workflowSteps_STEP_FIELD_TYPES: typeof STEP_FIELD_TYPES;
5112
5147
  declare const workflowSteps_STEP_ID_PATTERN: typeof STEP_ID_PATTERN;
@@ -5144,7 +5179,7 @@ declare const workflowSteps_stepStatesFromActivity: typeof stepStatesFromActivit
5144
5179
  declare const workflowSteps_stepsPlan: typeof stepsPlan;
5145
5180
  declare const workflowSteps_waitingForDocumentsText: typeof waitingForDocumentsText;
5146
5181
  declare namespace workflowSteps {
5147
- export { type workflowSteps_LinkedRun as LinkedRun, workflowSteps_PERSON_STEP_KINDS as PERSON_STEP_KINDS, workflowSteps_PlanStepsError as PlanStepsError, type workflowSteps_RaisedSignal as RaisedSignal, type workflowSteps_RunStep as RunStep, type workflowSteps_RunWaitingOn as RunWaitingOn, workflowSteps_SIGNAL_NAME_PATTERN as SIGNAL_NAME_PATTERN, workflowSteps_STEP_FIELD_OPTION_TONES as STEP_FIELD_OPTION_TONES, workflowSteps_STEP_FIELD_TYPES as STEP_FIELD_TYPES, workflowSteps_STEP_ID_PATTERN as STEP_ID_PATTERN, workflowSteps_STEP_KINDS as STEP_KINDS, type workflowSteps_SendBack as SendBack, type workflowSteps_StepActivityEvent as StepActivityEvent, type workflowSteps_StepAssignee as StepAssignee, type workflowSteps_StepField as StepField, type workflowSteps_StepFieldOption as StepFieldOption, type workflowSteps_StepFieldOptionTone as StepFieldOptionTone, type workflowSteps_StepKind as StepKind, type workflowSteps_StepPhase as StepPhase, type workflowSteps_StepSignal as StepSignal, type workflowSteps_StepSignalWhen as StepSignalWhen, type workflowSteps_StepState as StepState, type workflowSteps_StepStatus as StepStatus, type workflowSteps_TaskPlanStep as TaskPlanStep, workflowSteps_checkStepInputs as checkStepInputs, workflowSteps_describeAssignee as describeAssignee, workflowSteps_describeInputProblems as describeInputProblems, workflowSteps_isPersonStep as isPersonStep, workflowSteps_linkedRuns as linkedRuns, workflowSteps_messageWorkflowStep as messageWorkflowStep, workflowSteps_missingRequiredFields as missingRequiredFields, workflowSteps_parseInputPairs as parseInputPairs, workflowSteps_parsePlanSteps as parsePlanSteps, workflowSteps_raisedSignals as raisedSignals, workflowSteps_runSteps as runSteps, workflowSteps_runWaitingOn as runWaitingOn, workflowSteps_sendBacks as sendBacks, workflowSteps_stepDependencies as stepDependencies, workflowSteps_stepFields as stepFields, workflowSteps_stepPhase as stepPhase, workflowSteps_stepStatesFromActivity as stepStatesFromActivity, workflowSteps_stepsPlan as stepsPlan, workflowSteps_waitingForDocumentsText as waitingForDocumentsText };
5182
+ export { type workflowSteps_LinkedRun as LinkedRun, workflowSteps_PERSON_STEP_KINDS as PERSON_STEP_KINDS, workflowSteps_PlanStepsError as PlanStepsError, type workflowSteps_RaisedSignal as RaisedSignal, type workflowSteps_RunStep as RunStep, type workflowSteps_RunWaitingOn as RunWaitingOn, workflowSteps_SIGNAL_NAME_PATTERN as SIGNAL_NAME_PATTERN, workflowSteps_STEP_ACTION_TYPES as STEP_ACTION_TYPES, workflowSteps_STEP_FIELD_OPTION_TONES as STEP_FIELD_OPTION_TONES, workflowSteps_STEP_FIELD_TYPES as STEP_FIELD_TYPES, workflowSteps_STEP_ID_PATTERN as STEP_ID_PATTERN, workflowSteps_STEP_KINDS as STEP_KINDS, type workflowSteps_SendBack as SendBack, type workflowSteps_StepActivityEvent as StepActivityEvent, type workflowSteps_StepAssignee as StepAssignee, type workflowSteps_StepField as StepField, type workflowSteps_StepFieldOption as StepFieldOption, type workflowSteps_StepFieldOptionTone as StepFieldOptionTone, type workflowSteps_StepKind as StepKind, type workflowSteps_StepPhase as StepPhase, type workflowSteps_StepSignal as StepSignal, type workflowSteps_StepSignalWhen as StepSignalWhen, type workflowSteps_StepState as StepState, type workflowSteps_StepStatus as StepStatus, type workflowSteps_TaskPlanStep as TaskPlanStep, workflowSteps_checkStepInputs as checkStepInputs, workflowSteps_describeAssignee as describeAssignee, workflowSteps_describeInputProblems as describeInputProblems, workflowSteps_isPersonStep as isPersonStep, workflowSteps_linkedRuns as linkedRuns, workflowSteps_messageWorkflowStep as messageWorkflowStep, workflowSteps_missingRequiredFields as missingRequiredFields, workflowSteps_parseInputPairs as parseInputPairs, workflowSteps_parsePlanSteps as parsePlanSteps, workflowSteps_raisedSignals as raisedSignals, workflowSteps_runSteps as runSteps, workflowSteps_runWaitingOn as runWaitingOn, workflowSteps_sendBacks as sendBacks, workflowSteps_stepDependencies as stepDependencies, workflowSteps_stepFields as stepFields, workflowSteps_stepPhase as stepPhase, workflowSteps_stepStatesFromActivity as stepStatesFromActivity, workflowSteps_stepsPlan as stepsPlan, workflowSteps_waitingForDocumentsText as waitingForDocumentsText };
5148
5183
  }
5149
5184
 
5150
5185
  /**
@@ -5297,6 +5332,20 @@ declare function deleteWorkflow(arbi: ArbiClient, workflowId: string): Promise<v
5297
5332
  declare function runWorkflow(arbi: ArbiClient, workflowId: string): Promise<WorkflowRunResponse>;
5298
5333
  /** Persisted document-action runs, including failures and their affected documents. */
5299
5334
  declare function listWorkflowRuns(arbi: ArbiClient, workflowId: string): Promise<WorkflowRunHistoryResponse[]>;
5335
+ /** Does a workflow run with nobody present (a schedule, an event, after a task), so its agent needs a key? */
5336
+ declare const runsUnattended: (w: Pick<WorkflowResponse, "on_demand">) => boolean;
5337
+ /**
5338
+ * Deposit a key for a workflow's agent: give it STANDING membership of the workflow's workspace while the
5339
+ * owner is signed in, so unattended runs (schedules, events) derive the workspace key themselves. Only for a
5340
+ * `scheduled_permanent` workflow that runs unattended; the agent is the one the server assigned (the owner's
5341
+ * Assistant when none was named). `grant(email)` adds the agent with the workspace key (the open workspace's,
5342
+ * or one sealed by the caller). Returns the agent's email, or null when there was nothing to grant. Without a
5343
+ * deposit a run asks the owner for access each time instead.
5344
+ */
5345
+ declare function grantWorkflowAgentAccess(agents: {
5346
+ external_id: string;
5347
+ email: string;
5348
+ }[], workflow: Pick<WorkflowResponse, 'auth_mode' | 'agent_ext_id' | 'on_demand'>, grant: (email: string) => Promise<unknown>): Promise<string | null>;
5300
5349
 
5301
5350
  type workflows_CreateWorkflowRequest = CreateWorkflowRequest;
5302
5351
  type workflows_DocumentAutomationAction = DocumentAutomationAction;
@@ -5309,12 +5358,14 @@ type workflows_WorkflowRunResponse = WorkflowRunResponse;
5309
5358
  declare const workflows_createWorkflow: typeof createWorkflow;
5310
5359
  declare const workflows_deleteWorkflow: typeof deleteWorkflow;
5311
5360
  declare const workflows_getWorkflow: typeof getWorkflow;
5361
+ declare const workflows_grantWorkflowAgentAccess: typeof grantWorkflowAgentAccess;
5312
5362
  declare const workflows_listWorkflowRuns: typeof listWorkflowRuns;
5313
5363
  declare const workflows_listWorkflows: typeof listWorkflows;
5314
5364
  declare const workflows_runWorkflow: typeof runWorkflow;
5365
+ declare const workflows_runsUnattended: typeof runsUnattended;
5315
5366
  declare const workflows_updateWorkflow: typeof updateWorkflow;
5316
5367
  declare namespace workflows {
5317
- export { type workflows_CreateWorkflowRequest as CreateWorkflowRequest, type workflows_DocumentAutomationAction as DocumentAutomationAction, type workflows_DocumentSelector as DocumentSelector, type workflows_UpdateWorkflowRequest as UpdateWorkflowRequest, type workflows_WorkflowAuthMode as WorkflowAuthMode, type workflows_WorkflowResponse as WorkflowResponse, type workflows_WorkflowRunHistoryResponse as WorkflowRunHistoryResponse, type workflows_WorkflowRunResponse as WorkflowRunResponse, workflows_createWorkflow as createWorkflow, workflows_deleteWorkflow as deleteWorkflow, workflows_getWorkflow as getWorkflow, workflows_listWorkflowRuns as listWorkflowRuns, workflows_listWorkflows as listWorkflows, workflows_runWorkflow as runWorkflow, workflows_updateWorkflow as updateWorkflow };
5368
+ export { type workflows_CreateWorkflowRequest as CreateWorkflowRequest, type workflows_DocumentAutomationAction as DocumentAutomationAction, type workflows_DocumentSelector as DocumentSelector, type workflows_UpdateWorkflowRequest as UpdateWorkflowRequest, type workflows_WorkflowAuthMode as WorkflowAuthMode, type workflows_WorkflowResponse as WorkflowResponse, type workflows_WorkflowRunHistoryResponse as WorkflowRunHistoryResponse, type workflows_WorkflowRunResponse as WorkflowRunResponse, workflows_createWorkflow as createWorkflow, workflows_deleteWorkflow as deleteWorkflow, workflows_getWorkflow as getWorkflow, workflows_grantWorkflowAgentAccess as grantWorkflowAgentAccess, workflows_listWorkflowRuns as listWorkflowRuns, workflows_listWorkflows as listWorkflows, workflows_runWorkflow as runWorkflow, workflows_runsUnattended as runsUnattended, workflows_updateWorkflow as updateWorkflow };
5318
5369
  }
5319
5370
 
5320
5371
  /**
@@ -8274,6 +8325,7 @@ declare class Arbi {
8274
8325
  metadata?: {
8275
8326
  [key: string]: unknown;
8276
8327
  } | null;
8328
+ conversation_ext_id?: string | null;
8277
8329
  }>;
8278
8330
  /** Read the status of a background turn. */
8279
8331
  getResponse: (id: string) => Promise<{
@@ -8291,6 +8343,7 @@ declare class Arbi {
8291
8343
  metadata?: {
8292
8344
  [key: string]: unknown;
8293
8345
  } | null;
8346
+ conversation_ext_id?: string | null;
8294
8347
  }>;
8295
8348
  /**
8296
8349
  * Send a question to the RAG assistant with streaming support.
@@ -8311,11 +8364,12 @@ declare class Arbi {
8311
8364
  user_invocable: boolean;
8312
8365
  arg_hint: string;
8313
8366
  skill_type: string;
8314
- workspace_ext_id: string;
8315
- doc_ext_id: string;
8316
- updated_at: string;
8367
+ workspace_ext_id?: string | null;
8368
+ doc_ext_id?: string | null;
8369
+ updated_at?: string | null;
8317
8370
  visibility: string;
8318
8371
  is_owner: boolean;
8372
+ content?: string | null;
8319
8373
  }[]>;
8320
8374
  /**
8321
8375
  * Search documents without LLM generation (retrieval only).
@@ -8983,6 +9037,18 @@ declare class Arbi {
8983
9037
  } | undefined;
8984
9038
  }[] | undefined;
8985
9039
  };
9040
+ TranslationLLM: {
9041
+ API_TYPE: "local" | "remote";
9042
+ ENABLE_THINKING: boolean;
9043
+ MODEL_NAME: string;
9044
+ SYSTEM_INSTRUCTION: string;
9045
+ TEMPERATURE: number;
9046
+ MAX_TOKENS: number;
9047
+ WINDOW_TOKENS: number;
9048
+ CONTEXT_TOKENS: number;
9049
+ GLOSSARY_TOKENS: number;
9050
+ MAX_CONCURRENT: number;
9051
+ };
8986
9052
  MemoryLLM: {
8987
9053
  API_TYPE: "local" | "remote";
8988
9054
  ENABLE_THINKING: boolean;
@@ -9446,6 +9512,18 @@ declare class Arbi {
9446
9512
  } | undefined;
9447
9513
  }[] | undefined;
9448
9514
  };
9515
+ TranslationLLM: {
9516
+ API_TYPE: "local" | "remote";
9517
+ ENABLE_THINKING: boolean;
9518
+ MODEL_NAME: string;
9519
+ SYSTEM_INSTRUCTION: string;
9520
+ TEMPERATURE: number;
9521
+ MAX_TOKENS: number;
9522
+ WINDOW_TOKENS: number;
9523
+ CONTEXT_TOKENS: number;
9524
+ GLOSSARY_TOKENS: number;
9525
+ MAX_CONCURRENT: number;
9526
+ };
9449
9527
  MemoryLLM: {
9450
9528
  API_TYPE: "local" | "remote";
9451
9529
  ENABLE_THINKING: boolean;
@@ -10492,6 +10570,18 @@ declare function getConfig(arbi: ArbiClient, configId: string): Promise<{
10492
10570
  } | undefined;
10493
10571
  }[] | undefined;
10494
10572
  };
10573
+ TranslationLLM: {
10574
+ API_TYPE: "local" | "remote";
10575
+ ENABLE_THINKING: boolean;
10576
+ MODEL_NAME: string;
10577
+ SYSTEM_INSTRUCTION: string;
10578
+ TEMPERATURE: number;
10579
+ MAX_TOKENS: number;
10580
+ WINDOW_TOKENS: number;
10581
+ CONTEXT_TOKENS: number;
10582
+ GLOSSARY_TOKENS: number;
10583
+ MAX_CONCURRENT: number;
10584
+ };
10495
10585
  MemoryLLM: {
10496
10586
  API_TYPE: "local" | "remote";
10497
10587
  ENABLE_THINKING: boolean;
package/dist/browser.cjs CHANGED
@@ -4353,6 +4353,7 @@ __export(documents_exports, {
4353
4353
  SUPPORTED_EXTENSIONS: () => SUPPORTED_EXTENSIONS,
4354
4354
  deleteDocuments: () => deleteDocuments,
4355
4355
  downloadDocument: () => downloadDocument,
4356
+ finaliseTranslation: () => finaliseTranslation,
4356
4357
  getDocuments: () => getDocuments,
4357
4358
  getParsedContent: () => getParsedContent,
4358
4359
  getThumbnails: () => getThumbnails,
@@ -4511,6 +4512,14 @@ async function listVersions(arbi, docId) {
4511
4512
  "Failed to fetch document versions"
4512
4513
  );
4513
4514
  }
4515
+ async function finaliseTranslation(arbi, docId) {
4516
+ return requireData(
4517
+ await arbi.fetch.POST("/v1/document/{document_ext_id}/finalise-translation", {
4518
+ params: { path: { document_ext_id: docId } }
4519
+ }),
4520
+ "Failed to finalise the translation"
4521
+ );
4522
+ }
4514
4523
  async function deleteDocuments(arbi, externalIds) {
4515
4524
  requireOk(
4516
4525
  await arbi.fetch.DELETE("/v1/document/", { body: { external_ids: externalIds } }),
@@ -6639,6 +6648,7 @@ __export(workflow_steps_exports, {
6639
6648
  PERSON_STEP_KINDS: () => PERSON_STEP_KINDS,
6640
6649
  PlanStepsError: () => PlanStepsError,
6641
6650
  SIGNAL_NAME_PATTERN: () => SIGNAL_NAME_PATTERN,
6651
+ STEP_ACTION_TYPES: () => STEP_ACTION_TYPES,
6642
6652
  STEP_FIELD_OPTION_TONES: () => STEP_FIELD_OPTION_TONES,
6643
6653
  STEP_FIELD_TYPES: () => STEP_FIELD_TYPES,
6644
6654
  STEP_ID_PATTERN: () => STEP_ID_PATTERN,
@@ -6663,7 +6673,8 @@ __export(workflow_steps_exports, {
6663
6673
  stepsPlan: () => stepsPlan,
6664
6674
  waitingForDocumentsText: () => waitingForDocumentsText
6665
6675
  });
6666
- var STEP_KINDS = ["form", "upload", "agent", "review"];
6676
+ var STEP_KINDS = ["form", "upload", "agent", "review", "action"];
6677
+ var STEP_ACTION_TYPES = ["sign", "email_draft", "tabular_review"];
6667
6678
  var PERSON_STEP_KINDS = ["form", "upload", "review"];
6668
6679
  var STEP_ID_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
6669
6680
  var STEP_EVENTS = {
@@ -6679,7 +6690,9 @@ var EMPTY_STATE = {
6679
6690
  sentBack: false,
6680
6691
  hasNote: false,
6681
6692
  announcedTo: null,
6682
- waitingDocuments: []
6693
+ waitingDocuments: [],
6694
+ waitingAction: null,
6695
+ waitingDocument: null
6683
6696
  };
6684
6697
  var str = (v2) => typeof v2 === "string" ? v2 : null;
6685
6698
  var isFinished = (state) => state?.status === "done" || state?.status === "skipped";
@@ -6741,6 +6754,14 @@ function stepStatesFromActivity(events) {
6741
6754
  const documents = waitingDocumentsOf(detail);
6742
6755
  if (documents)
6743
6756
  states[step] = { ...states[step] ?? EMPTY_STATE, waitingDocuments: documents };
6757
+ const action = str(detail.action);
6758
+ const waiting = detail.waiting;
6759
+ if (action && waiting && typeof waiting === "object" && !documents)
6760
+ states[step] = {
6761
+ ...states[step] ?? EMPTY_STATE,
6762
+ waitingAction: action,
6763
+ waitingDocument: str(waiting.doc_ext_id)
6764
+ };
6744
6765
  continue;
6745
6766
  }
6746
6767
  const status = STEP_EVENTS[e.kind];
@@ -6794,6 +6815,7 @@ function sendBacks(events) {
6794
6815
  }
6795
6816
  function stepPhase(steps, states, id) {
6796
6817
  const state = states[id];
6818
+ if (state?.status === "running" && state.waitingAction) return "waiting";
6797
6819
  if (state && state.status !== "pending") return state.status;
6798
6820
  return stepDependencies(steps, id).every((d2) => isFinished(states[d2])) ? "ready" : "pending";
6799
6821
  }
@@ -6819,7 +6841,9 @@ function runSteps(steps, events) {
6819
6841
  timesSentBack: backs.filter((b2) => b2.to === s2.id).length,
6820
6842
  signals: [...new Set(signals.filter((x2) => x2.step === s2.id).map((x2) => x2.signal))],
6821
6843
  linkedRuns: links.filter((l2) => l2.step === s2.id),
6822
- waitingDocuments: state.waitingDocuments
6844
+ waitingDocuments: state.waitingDocuments,
6845
+ waitingAction: state.waitingAction,
6846
+ waitingDocument: state.waitingDocument
6823
6847
  };
6824
6848
  });
6825
6849
  }
@@ -6979,8 +7003,22 @@ var STEP_KEYS = /* @__PURE__ */ new Set([
6979
7003
  "signals",
6980
7004
  "assignee",
6981
7005
  "remind_after_hours",
6982
- "fields"
7006
+ "fields",
7007
+ "action",
7008
+ "edit_document"
6983
7009
  ]);
7010
+ var isDocumentRef = (v2) => typeof v2 === "string" && /^doc-[a-zA-Z0-9]{8}(?:@v[0-9]+)?$/.test(v2) || isRecord(v2) && Object.keys(v2).length === 1 && (typeof v2.step === "string" && STEP_ID_PATTERN.test(v2.step) || typeof v2.input === "string");
7011
+ var DOCUMENT_REF_HINT = "a doc- id, {step: <step id>} or {input: <field>}";
7012
+ function checkAction(action, at2, problems) {
7013
+ if (!isRecord(action) || !STEP_ACTION_TYPES.includes(action.type)) {
7014
+ problems.push(`${at2}.type: must be one of ${STEP_ACTION_TYPES.join(", ")}`);
7015
+ return;
7016
+ }
7017
+ if (action.type === "sign" && !isDocumentRef(action.document))
7018
+ problems.push(`${at2}.document: the document to sign, ${DOCUMENT_REF_HINT}`);
7019
+ if (isSet(action.attachments) && (!Array.isArray(action.attachments) || !action.attachments.every(isDocumentRef)))
7020
+ problems.push(`${at2}.attachments: a list of documents, each ${DOCUMENT_REF_HINT}`);
7021
+ }
6984
7022
  var SIGNAL_NAME_PATTERN = /^[a-z0-9][a-z0-9_.-]{0,63}$/;
6985
7023
  var FIELD_NAME_PATTERN = /^[a-zA-Z][a-zA-Z0-9_]{0,63}$/;
6986
7024
  var WHEN_KEYS = ["field", "equals", "contains", "matches", "approved"];
@@ -7129,6 +7167,20 @@ function checkStep(raw, at2, problems) {
7129
7167
  if (!STEP_KEYS.has(key))
7130
7168
  problems.push(`${at2}.${key}: unknown field (allowed: ${[...STEP_KEYS].join(", ")})`);
7131
7169
  const { id, title, kind, after, skill, prompt, inputs, branch, ui } = raw;
7170
+ const { action, edit_document: editDocument } = raw;
7171
+ if (kind === "action") {
7172
+ if (!isSet(action))
7173
+ problems.push(
7174
+ `${at2}.action: an action step needs an action (${STEP_ACTION_TYPES.join(", ")})`
7175
+ );
7176
+ else checkAction(action, `${at2}.action`, problems);
7177
+ } else if (isSet(action)) problems.push(`${at2}.action: only an action step has an action`);
7178
+ if (isSet(editDocument)) {
7179
+ if (kind !== "agent" || branch)
7180
+ problems.push(`${at2}.edit_document: belongs to an agent step on the main line`);
7181
+ else if (!isDocumentRef(editDocument))
7182
+ problems.push(`${at2}.edit_document: ${DOCUMENT_REF_HINT}`);
7183
+ }
7132
7184
  if (typeof id !== "string" || !STEP_ID_PATTERN.test(id))
7133
7185
  problems.push(
7134
7186
  `${at2}.id: must be lowercase letters, digits, "_" or "-", starting with a letter (got ${JSON.stringify(id)})`
@@ -7215,7 +7267,9 @@ function checkStep(raw, at2, problems) {
7215
7267
  ...isSet(signals) ? { signals } : {},
7216
7268
  ...isSet(assignee) ? { assignee } : {},
7217
7269
  ...isSet(remind) ? { remind_after_hours: remind } : {},
7218
- ...isSet(stepFieldsRaw) ? { fields: normalFields(stepFieldsRaw) } : {}
7270
+ ...isSet(stepFieldsRaw) ? { fields: normalFields(stepFieldsRaw) } : {},
7271
+ ...isSet(action) ? { action } : {},
7272
+ ...isSet(editDocument) ? { edit_document: editDocument } : {}
7219
7273
  };
7220
7274
  }
7221
7275
  function parsePlanSteps(value) {
@@ -7383,9 +7437,11 @@ __export(workflows_exports, {
7383
7437
  createWorkflow: () => createWorkflow,
7384
7438
  deleteWorkflow: () => deleteWorkflow,
7385
7439
  getWorkflow: () => getWorkflow,
7440
+ grantWorkflowAgentAccess: () => grantWorkflowAgentAccess,
7386
7441
  listWorkflowRuns: () => listWorkflowRuns,
7387
7442
  listWorkflows: () => listWorkflows,
7388
7443
  runWorkflow: () => runWorkflow,
7444
+ runsUnattended: () => runsUnattended,
7389
7445
  updateWorkflow: () => updateWorkflow
7390
7446
  });
7391
7447
  var byId2 = (workflowId) => ({ params: { path: { workflow_id: workflowId } } });
@@ -7425,6 +7481,19 @@ async function listWorkflowRuns(arbi, workflowId) {
7425
7481
  "Failed to list automation executions"
7426
7482
  );
7427
7483
  }
7484
+ var runsUnattended = (w2) => !w2.on_demand;
7485
+ async function grantWorkflowAgentAccess(agents, workflow, grant) {
7486
+ if (workflow.auth_mode !== "scheduled_permanent" || !runsUnattended(workflow) || !workflow.agent_ext_id)
7487
+ return null;
7488
+ const email = agents.find((a2) => a2.external_id === workflow.agent_ext_id)?.email;
7489
+ if (!email) return null;
7490
+ try {
7491
+ await grant(email);
7492
+ } catch (err) {
7493
+ if (!/already|no users found to add/i.test(String(err?.message ?? err))) throw err;
7494
+ }
7495
+ return email;
7496
+ }
7428
7497
 
7429
7498
  // src/operations/facts.ts
7430
7499
  var facts_exports = {};