@arbidocs/sdk 0.4.125 → 0.4.127

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatAttachmentFile, p as ChatAttachmentInput, q as ChatCryptoContext, r as ChatKeyRing, s as ChatKind, t as ChatMemberKey, u as ChatMemberResponse, v as ChatMessageResponse, w as ChatResponse, x as ChatSession, y as CitationSummary, z as CliConfig, B as CliCredentials, D as CommandDescriptor, E as ConfigStore, F as ConnectOptions, G as ConversationResponse, H as ConversationUsageResponse, I as CreateFactRequest, J as CreateFactsRequest, K as CreateWorkRequest, L as CreateWorkflowRequest, M as DEFAULT_AI_USD_PER_GBP, P as DecryptedChatMessage, Q as DeferredInterjectionEvent, S as DocumentAutomationAction, V as DocumentSelector, Y as FactResponse, Z as FactSearchRequest, _ as FactSearchResponse, a0 as IdentityErrorCode, a1 as IdentityPurchase, a2 as IdentityState, a3 as IdentityStatus, a4 as LinkedRun, a6 as ListFactsOptions, a9 as MailDraftSSEEvent, ab as MessageMetadataPayload, ac as MessageQueuedEvent, ad as OutputTokensDetails, ae as ParsedSlashCommand, af as PendingAuthResponse, ag as PlanStepsError, ah as PlanWorkRequest, ai as ProbeAnswerEvent, aj as ProjectBudget, ak as ProjectConversationUsageResponse, al as ProjectDetails, am as ProjectEventKind, an as ProjectEventResponse, ao as ProjectInvoicesResponse, ap as ProjectResponse, aq as ProjectUpdateRequest, ar as ProjectUsageResponse, as as QueryOptions, at as RaisedSignal, au as ReconnectOptions, av as ReconnectableWsConnection, aw as ResolvedCitation, ay as ResponseCompletedEvent, az as ResponseContentPartAddedEvent, aA as ResponseCreatedEvent, aB as ResponseFailedEvent, aC as ResponseOutputItemAddedEvent, aD as ResponseOutputItemDoneEvent, aE as ResponseOutputTextDeltaEvent, aF as ResponseOutputTextDoneEvent, aG as ResponseUsage, aH as RunProgress, aI as RunStep, aJ as RunWaitingOn, aK as SSEEvent, aL as SSEStreamCallbacks, aM as SSEStreamResult, aN as SSEStreamStartData, aQ as SendBack, aR as SkillSummary, aT as StepActionRequest, aU as StepActivityEvent, aV as StepAssignee, aW as StepField, aZ as StepKind, a_ as StepPhase, a$ as StepSignal, b0 as StepSignalWhen, b1 as StepState, b2 as StepStatus, b3 as SubmitBackgroundQueryOptions, b4 as TagChange, b5 as TagFieldDefinition, b6 as TagKind, b7 as TagKindField, b8 as TagKindSchema, b9 as TagLinks, ba as TagListQuery, bb as TagResponse, bc as TaskPlan, bd as TaskPlanStep, be as TokenBudgetContext, bf as UpdateConversationRequest, bg as UpdateFactRequest, bh as UpdateWorkflowRequest, bn as UsageBreakdown, bo as UserDailyUsageResponse, bp as UserInfo, bq as UserInputRequestEvent, br as UserMessageEvent, bs as WebSocketAuthError, bt as WorkStatus, bu as WorkflowAuthMode, bv as WorkflowResponse, bw as WorkflowRunHistoryResponse, bx as WorkflowRunResponse, by as WorkspaceContext, bz as WsConnection, bA as account, bB as agentconfig, bD as assistant, bE as authenticatedFetch, bG as buildFactsContextTool, bH as buildRetrievalChunkTool, bI as buildRetrievalFullContextTool, bJ as buildRetrievalTocTool, bK as chats, bL as connectWebSocket, bM as connectWithReconnect, bN as consumeSSEStream, bO as contacts, bP as conversations, bQ as countCitations, bR as createAuthenticatedClient, bT as doctags, bU as documents, bV as facts, bW as files, bX as filterSkills, bY as formatAgentStepLabel, bZ as formatFileSize, b_ as formatGbp, b$ as formatGbpPerMillionTokens, c0 as formatItemLabel, c2 as formatUserName, c3 as formatWorkspaceChoices, c8 as getErrorMessage, c9 as getRawWorkspaceKey, ca as health, cc as identityErrorCode, cb as identityVerification, cd as mail, ce as notifications, cf as parseSSEEvents, cg as parseSlashCommand, ch as parseSlashTokenInProgress, ci as performPasswordLogin, cl as profile, cm as projects, cn as requireData, co as requireOk, cp as resolveAuth, cq as resolveCitations, cr as resolveWorkspace, cs as responses, ct as selectWorkspace, cu as selectWorkspaceById, cv as sessions, cw as settings, cy as streamSSE, cz as stripCitationMarkdown, cA as summarizeCitations, cB as tags, cC as usdToGbp, cD as work, cE as workflowSteps, cF as workflows, cG as workspaces } from './browser-B_tpz4Ta.cjs';
1
+ export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatAttachmentFile, p as ChatAttachmentInput, q as ChatCryptoContext, r as ChatKeyRing, s as ChatKind, t as ChatMemberKey, u as ChatMemberResponse, v as ChatMessageResponse, w as ChatResponse, x as ChatSession, y as CitationSummary, z as CliConfig, B as CliCredentials, D as CommandDescriptor, E as ConfigStore, F as ConnectOptions, G as ConversationResponse, H as ConversationUsageResponse, I as CreateFactRequest, J as CreateFactsRequest, K as CreateWorkRequest, L as CreateWorkflowRequest, M as DEFAULT_AI_USD_PER_GBP, P as DecryptedChatMessage, Q as DeferredInterjectionEvent, S as DocumentAutomationAction, V as DocumentSelector, Y as FactResponse, Z as FactSearchRequest, _ as FactSearchResponse, a0 as IdentityErrorCode, a1 as IdentityPurchase, a2 as IdentityState, a3 as IdentityStatus, a4 as LinkedRun, a6 as ListFactsOptions, a9 as MailDraftSSEEvent, ab as MessageMetadataPayload, ac as MessageQueuedEvent, ad as OutputTokensDetails, ae as ParsedSlashCommand, af as PendingAuthResponse, ag as PlanStepsError, ah as PlanWorkRequest, ai as ProbeAnswerEvent, aj as ProjectBudget, ak as ProjectConversationUsageResponse, al as ProjectDetails, am as ProjectEventKind, an as ProjectEventResponse, ao as ProjectInvoicesResponse, ap as ProjectResponse, aq as ProjectUpdateRequest, ar as ProjectUsageResponse, as as QueryOptions, at as RaisedSignal, au as ReconnectOptions, av as ReconnectableWsConnection, aw as ResolvedCitation, ay as ResponseCompletedEvent, az as ResponseContentPartAddedEvent, aA as ResponseCreatedEvent, aB as ResponseFailedEvent, aC as ResponseOutputItemAddedEvent, aD as ResponseOutputItemDoneEvent, aE as ResponseOutputTextDeltaEvent, aF as ResponseOutputTextDoneEvent, aG as ResponseUsage, aH as RunProgress, aI as RunStep, aJ as RunWaitingOn, aK as SSEEvent, aL as SSEStreamCallbacks, aM as SSEStreamResult, aN as SSEStreamStartData, aQ as SendBack, aR as SkillSummary, aT as StepActionRequest, aU as StepActivityEvent, aV as StepAssignee, aW as StepField, aZ as StepKind, a_ as StepPhase, a$ as StepSignal, b0 as StepSignalWhen, b1 as StepState, b2 as StepStatus, b3 as SubmitBackgroundQueryOptions, b4 as TagChange, b5 as TagFieldDefinition, b6 as TagKind, b7 as TagKindField, b8 as TagKindSchema, b9 as TagLinks, ba as TagListQuery, bb as TagResponse, bc as TaskPlan, bd as TaskPlanStep, be as TokenBudgetContext, bf as UpdateConversationRequest, bg as UpdateFactRequest, bh as UpdateWorkflowRequest, bn as UsageBreakdown, bo as UserDailyUsageResponse, bp as UserInfo, bq as UserInputRequestEvent, br as UserMessageEvent, bs as WebSocketAuthError, bt as WorkStatus, bu as WorkflowAuthMode, bv as WorkflowResponse, bw as WorkflowRunHistoryResponse, bx as WorkflowRunResponse, by as WorkspaceContext, bz as WsConnection, bA as account, bB as agentconfig, bD as assistant, bE as authenticatedFetch, bG as buildFactsContextTool, bH as buildRetrievalChunkTool, bI as buildRetrievalFullContextTool, bJ as buildRetrievalTocTool, bK as chats, bL as connectWebSocket, bM as connectWithReconnect, bN as consumeSSEStream, bO as contacts, bP as conversations, bQ as countCitations, bR as createAuthenticatedClient, bT as doctags, bU as documents, bV as facts, bW as files, bX as filterSkills, bY as formatAgentStepLabel, bZ as formatFileSize, b_ as formatGbp, b$ as formatGbpPerMillionTokens, c0 as formatItemLabel, c2 as formatUserName, c3 as formatWorkspaceChoices, c8 as getErrorMessage, c9 as getRawWorkspaceKey, ca as health, cc as identityErrorCode, cb as identityVerification, cd as mail, ce as notifications, cf as parseSSEEvents, cg as parseSlashCommand, ch as parseSlashTokenInProgress, ci as performPasswordLogin, cl as profile, cm as projects, cn as requireData, co as requireOk, cp as resolveAuth, cq as resolveCitations, cr as resolveWorkspace, cs as responses, ct as selectWorkspace, cu as selectWorkspaceById, cv as sessions, cw as settings, cy as streamSSE, cz as stripCitationMarkdown, cA as summarizeCitations, cB as tags, cC as usdToGbp, cD as work, cE as workflowSteps, cF as workflows, cG as workspaces } from './browser-Ds-drrLp.cjs';
2
2
  export { LoginProfile } from '@arbidocs/client';
package/dist/browser.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatAttachmentFile, p as ChatAttachmentInput, q as ChatCryptoContext, r as ChatKeyRing, s as ChatKind, t as ChatMemberKey, u as ChatMemberResponse, v as ChatMessageResponse, w as ChatResponse, x as ChatSession, y as CitationSummary, z as CliConfig, B as CliCredentials, D as CommandDescriptor, E as ConfigStore, F as ConnectOptions, G as ConversationResponse, H as ConversationUsageResponse, I as CreateFactRequest, J as CreateFactsRequest, K as CreateWorkRequest, L as CreateWorkflowRequest, M as DEFAULT_AI_USD_PER_GBP, P as DecryptedChatMessage, Q as DeferredInterjectionEvent, S as DocumentAutomationAction, V as DocumentSelector, Y as FactResponse, Z as FactSearchRequest, _ as FactSearchResponse, a0 as IdentityErrorCode, a1 as IdentityPurchase, a2 as IdentityState, a3 as IdentityStatus, a4 as LinkedRun, a6 as ListFactsOptions, a9 as MailDraftSSEEvent, ab as MessageMetadataPayload, ac as MessageQueuedEvent, ad as OutputTokensDetails, ae as ParsedSlashCommand, af as PendingAuthResponse, ag as PlanStepsError, ah as PlanWorkRequest, ai as ProbeAnswerEvent, aj as ProjectBudget, ak as ProjectConversationUsageResponse, al as ProjectDetails, am as ProjectEventKind, an as ProjectEventResponse, ao as ProjectInvoicesResponse, ap as ProjectResponse, aq as ProjectUpdateRequest, ar as ProjectUsageResponse, as as QueryOptions, at as RaisedSignal, au as ReconnectOptions, av as ReconnectableWsConnection, aw as ResolvedCitation, ay as ResponseCompletedEvent, az as ResponseContentPartAddedEvent, aA as ResponseCreatedEvent, aB as ResponseFailedEvent, aC as ResponseOutputItemAddedEvent, aD as ResponseOutputItemDoneEvent, aE as ResponseOutputTextDeltaEvent, aF as ResponseOutputTextDoneEvent, aG as ResponseUsage, aH as RunProgress, aI as RunStep, aJ as RunWaitingOn, aK as SSEEvent, aL as SSEStreamCallbacks, aM as SSEStreamResult, aN as SSEStreamStartData, aQ as SendBack, aR as SkillSummary, aT as StepActionRequest, aU as StepActivityEvent, aV as StepAssignee, aW as StepField, aZ as StepKind, a_ as StepPhase, a$ as StepSignal, b0 as StepSignalWhen, b1 as StepState, b2 as StepStatus, b3 as SubmitBackgroundQueryOptions, b4 as TagChange, b5 as TagFieldDefinition, b6 as TagKind, b7 as TagKindField, b8 as TagKindSchema, b9 as TagLinks, ba as TagListQuery, bb as TagResponse, bc as TaskPlan, bd as TaskPlanStep, be as TokenBudgetContext, bf as UpdateConversationRequest, bg as UpdateFactRequest, bh as UpdateWorkflowRequest, bn as UsageBreakdown, bo as UserDailyUsageResponse, bp as UserInfo, bq as UserInputRequestEvent, br as UserMessageEvent, bs as WebSocketAuthError, bt as WorkStatus, bu as WorkflowAuthMode, bv as WorkflowResponse, bw as WorkflowRunHistoryResponse, bx as WorkflowRunResponse, by as WorkspaceContext, bz as WsConnection, bA as account, bB as agentconfig, bD as assistant, bE as authenticatedFetch, bG as buildFactsContextTool, bH as buildRetrievalChunkTool, bI as buildRetrievalFullContextTool, bJ as buildRetrievalTocTool, bK as chats, bL as connectWebSocket, bM as connectWithReconnect, bN as consumeSSEStream, bO as contacts, bP as conversations, bQ as countCitations, bR as createAuthenticatedClient, bT as doctags, bU as documents, bV as facts, bW as files, bX as filterSkills, bY as formatAgentStepLabel, bZ as formatFileSize, b_ as formatGbp, b$ as formatGbpPerMillionTokens, c0 as formatItemLabel, c2 as formatUserName, c3 as formatWorkspaceChoices, c8 as getErrorMessage, c9 as getRawWorkspaceKey, ca as health, cc as identityErrorCode, cb as identityVerification, cd as mail, ce as notifications, cf as parseSSEEvents, cg as parseSlashCommand, ch as parseSlashTokenInProgress, ci as performPasswordLogin, cl as profile, cm as projects, cn as requireData, co as requireOk, cp as resolveAuth, cq as resolveCitations, cr as resolveWorkspace, cs as responses, ct as selectWorkspace, cu as selectWorkspaceById, cv as sessions, cw as settings, cy as streamSSE, cz as stripCitationMarkdown, cA as summarizeCitations, cB as tags, cC as usdToGbp, cD as work, cE as workflowSteps, cF as workflows, cG as workspaces } from './browser-B_tpz4Ta.js';
1
+ export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatAttachmentFile, p as ChatAttachmentInput, q as ChatCryptoContext, r as ChatKeyRing, s as ChatKind, t as ChatMemberKey, u as ChatMemberResponse, v as ChatMessageResponse, w as ChatResponse, x as ChatSession, y as CitationSummary, z as CliConfig, B as CliCredentials, D as CommandDescriptor, E as ConfigStore, F as ConnectOptions, G as ConversationResponse, H as ConversationUsageResponse, I as CreateFactRequest, J as CreateFactsRequest, K as CreateWorkRequest, L as CreateWorkflowRequest, M as DEFAULT_AI_USD_PER_GBP, P as DecryptedChatMessage, Q as DeferredInterjectionEvent, S as DocumentAutomationAction, V as DocumentSelector, Y as FactResponse, Z as FactSearchRequest, _ as FactSearchResponse, a0 as IdentityErrorCode, a1 as IdentityPurchase, a2 as IdentityState, a3 as IdentityStatus, a4 as LinkedRun, a6 as ListFactsOptions, a9 as MailDraftSSEEvent, ab as MessageMetadataPayload, ac as MessageQueuedEvent, ad as OutputTokensDetails, ae as ParsedSlashCommand, af as PendingAuthResponse, ag as PlanStepsError, ah as PlanWorkRequest, ai as ProbeAnswerEvent, aj as ProjectBudget, ak as ProjectConversationUsageResponse, al as ProjectDetails, am as ProjectEventKind, an as ProjectEventResponse, ao as ProjectInvoicesResponse, ap as ProjectResponse, aq as ProjectUpdateRequest, ar as ProjectUsageResponse, as as QueryOptions, at as RaisedSignal, au as ReconnectOptions, av as ReconnectableWsConnection, aw as ResolvedCitation, ay as ResponseCompletedEvent, az as ResponseContentPartAddedEvent, aA as ResponseCreatedEvent, aB as ResponseFailedEvent, aC as ResponseOutputItemAddedEvent, aD as ResponseOutputItemDoneEvent, aE as ResponseOutputTextDeltaEvent, aF as ResponseOutputTextDoneEvent, aG as ResponseUsage, aH as RunProgress, aI as RunStep, aJ as RunWaitingOn, aK as SSEEvent, aL as SSEStreamCallbacks, aM as SSEStreamResult, aN as SSEStreamStartData, aQ as SendBack, aR as SkillSummary, aT as StepActionRequest, aU as StepActivityEvent, aV as StepAssignee, aW as StepField, aZ as StepKind, a_ as StepPhase, a$ as StepSignal, b0 as StepSignalWhen, b1 as StepState, b2 as StepStatus, b3 as SubmitBackgroundQueryOptions, b4 as TagChange, b5 as TagFieldDefinition, b6 as TagKind, b7 as TagKindField, b8 as TagKindSchema, b9 as TagLinks, ba as TagListQuery, bb as TagResponse, bc as TaskPlan, bd as TaskPlanStep, be as TokenBudgetContext, bf as UpdateConversationRequest, bg as UpdateFactRequest, bh as UpdateWorkflowRequest, bn as UsageBreakdown, bo as UserDailyUsageResponse, bp as UserInfo, bq as UserInputRequestEvent, br as UserMessageEvent, bs as WebSocketAuthError, bt as WorkStatus, bu as WorkflowAuthMode, bv as WorkflowResponse, bw as WorkflowRunHistoryResponse, bx as WorkflowRunResponse, by as WorkspaceContext, bz as WsConnection, bA as account, bB as agentconfig, bD as assistant, bE as authenticatedFetch, bG as buildFactsContextTool, bH as buildRetrievalChunkTool, bI as buildRetrievalFullContextTool, bJ as buildRetrievalTocTool, bK as chats, bL as connectWebSocket, bM as connectWithReconnect, bN as consumeSSEStream, bO as contacts, bP as conversations, bQ as countCitations, bR as createAuthenticatedClient, bT as doctags, bU as documents, bV as facts, bW as files, bX as filterSkills, bY as formatAgentStepLabel, bZ as formatFileSize, b_ as formatGbp, b$ as formatGbpPerMillionTokens, c0 as formatItemLabel, c2 as formatUserName, c3 as formatWorkspaceChoices, c8 as getErrorMessage, c9 as getRawWorkspaceKey, ca as health, cc as identityErrorCode, cb as identityVerification, cd as mail, ce as notifications, cf as parseSSEEvents, cg as parseSlashCommand, ch as parseSlashTokenInProgress, ci as performPasswordLogin, cl as profile, cm as projects, cn as requireData, co as requireOk, cp as resolveAuth, cq as resolveCitations, cr as resolveWorkspace, cs as responses, ct as selectWorkspace, cu as selectWorkspaceById, cv as sessions, cw as settings, cy as streamSSE, cz as stripCitationMarkdown, cA as summarizeCitations, cB as tags, cC as usdToGbp, cD as work, cE as workflowSteps, cF as workflows, cG as workspaces } from './browser-Ds-drrLp.js';
2
2
  export { LoginProfile } from '@arbidocs/client';
package/dist/browser.js CHANGED
@@ -4350,6 +4350,7 @@ __export(documents_exports, {
4350
4350
  SUPPORTED_EXTENSIONS: () => SUPPORTED_EXTENSIONS,
4351
4351
  deleteDocuments: () => deleteDocuments,
4352
4352
  downloadDocument: () => downloadDocument,
4353
+ finaliseTranslation: () => finaliseTranslation,
4353
4354
  getDocuments: () => getDocuments,
4354
4355
  getParsedContent: () => getParsedContent,
4355
4356
  getThumbnails: () => getThumbnails,
@@ -4508,6 +4509,14 @@ async function listVersions(arbi, docId) {
4508
4509
  "Failed to fetch document versions"
4509
4510
  );
4510
4511
  }
4512
+ async function finaliseTranslation(arbi, docId) {
4513
+ return requireData(
4514
+ await arbi.fetch.POST("/v1/document/{document_ext_id}/finalise-translation", {
4515
+ params: { path: { document_ext_id: docId } }
4516
+ }),
4517
+ "Failed to finalise the translation"
4518
+ );
4519
+ }
4511
4520
  async function deleteDocuments(arbi, externalIds) {
4512
4521
  requireOk(
4513
4522
  await arbi.fetch.DELETE("/v1/document/", { body: { external_ids: externalIds } }),
@@ -6636,6 +6645,7 @@ __export(workflow_steps_exports, {
6636
6645
  PERSON_STEP_KINDS: () => PERSON_STEP_KINDS,
6637
6646
  PlanStepsError: () => PlanStepsError,
6638
6647
  SIGNAL_NAME_PATTERN: () => SIGNAL_NAME_PATTERN,
6648
+ STEP_ACTION_TYPES: () => STEP_ACTION_TYPES,
6639
6649
  STEP_FIELD_OPTION_TONES: () => STEP_FIELD_OPTION_TONES,
6640
6650
  STEP_FIELD_TYPES: () => STEP_FIELD_TYPES,
6641
6651
  STEP_ID_PATTERN: () => STEP_ID_PATTERN,
@@ -6660,7 +6670,8 @@ __export(workflow_steps_exports, {
6660
6670
  stepsPlan: () => stepsPlan,
6661
6671
  waitingForDocumentsText: () => waitingForDocumentsText
6662
6672
  });
6663
- var STEP_KINDS = ["form", "upload", "agent", "review"];
6673
+ var STEP_KINDS = ["form", "upload", "agent", "review", "action"];
6674
+ var STEP_ACTION_TYPES = ["sign", "email_draft", "tabular_review"];
6664
6675
  var PERSON_STEP_KINDS = ["form", "upload", "review"];
6665
6676
  var STEP_ID_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
6666
6677
  var STEP_EVENTS = {
@@ -6676,7 +6687,9 @@ var EMPTY_STATE = {
6676
6687
  sentBack: false,
6677
6688
  hasNote: false,
6678
6689
  announcedTo: null,
6679
- waitingDocuments: []
6690
+ waitingDocuments: [],
6691
+ waitingAction: null,
6692
+ waitingDocument: null
6680
6693
  };
6681
6694
  var str = (v2) => typeof v2 === "string" ? v2 : null;
6682
6695
  var isFinished = (state) => state?.status === "done" || state?.status === "skipped";
@@ -6738,6 +6751,14 @@ function stepStatesFromActivity(events) {
6738
6751
  const documents = waitingDocumentsOf(detail);
6739
6752
  if (documents)
6740
6753
  states[step] = { ...states[step] ?? EMPTY_STATE, waitingDocuments: documents };
6754
+ const action = str(detail.action);
6755
+ const waiting = detail.waiting;
6756
+ if (action && waiting && typeof waiting === "object" && !documents)
6757
+ states[step] = {
6758
+ ...states[step] ?? EMPTY_STATE,
6759
+ waitingAction: action,
6760
+ waitingDocument: str(waiting.doc_ext_id)
6761
+ };
6741
6762
  continue;
6742
6763
  }
6743
6764
  const status = STEP_EVENTS[e.kind];
@@ -6791,6 +6812,7 @@ function sendBacks(events) {
6791
6812
  }
6792
6813
  function stepPhase(steps, states, id) {
6793
6814
  const state = states[id];
6815
+ if (state?.status === "running" && state.waitingAction) return "waiting";
6794
6816
  if (state && state.status !== "pending") return state.status;
6795
6817
  return stepDependencies(steps, id).every((d2) => isFinished(states[d2])) ? "ready" : "pending";
6796
6818
  }
@@ -6816,7 +6838,9 @@ function runSteps(steps, events) {
6816
6838
  timesSentBack: backs.filter((b2) => b2.to === s2.id).length,
6817
6839
  signals: [...new Set(signals.filter((x2) => x2.step === s2.id).map((x2) => x2.signal))],
6818
6840
  linkedRuns: links.filter((l2) => l2.step === s2.id),
6819
- waitingDocuments: state.waitingDocuments
6841
+ waitingDocuments: state.waitingDocuments,
6842
+ waitingAction: state.waitingAction,
6843
+ waitingDocument: state.waitingDocument
6820
6844
  };
6821
6845
  });
6822
6846
  }
@@ -6976,8 +7000,22 @@ var STEP_KEYS = /* @__PURE__ */ new Set([
6976
7000
  "signals",
6977
7001
  "assignee",
6978
7002
  "remind_after_hours",
6979
- "fields"
7003
+ "fields",
7004
+ "action",
7005
+ "edit_document"
6980
7006
  ]);
7007
+ 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");
7008
+ var DOCUMENT_REF_HINT = "a doc- id, {step: <step id>} or {input: <field>}";
7009
+ function checkAction(action, at2, problems) {
7010
+ if (!isRecord(action) || !STEP_ACTION_TYPES.includes(action.type)) {
7011
+ problems.push(`${at2}.type: must be one of ${STEP_ACTION_TYPES.join(", ")}`);
7012
+ return;
7013
+ }
7014
+ if (action.type === "sign" && !isDocumentRef(action.document))
7015
+ problems.push(`${at2}.document: the document to sign, ${DOCUMENT_REF_HINT}`);
7016
+ if (isSet(action.attachments) && (!Array.isArray(action.attachments) || !action.attachments.every(isDocumentRef)))
7017
+ problems.push(`${at2}.attachments: a list of documents, each ${DOCUMENT_REF_HINT}`);
7018
+ }
6981
7019
  var SIGNAL_NAME_PATTERN = /^[a-z0-9][a-z0-9_.-]{0,63}$/;
6982
7020
  var FIELD_NAME_PATTERN = /^[a-zA-Z][a-zA-Z0-9_]{0,63}$/;
6983
7021
  var WHEN_KEYS = ["field", "equals", "contains", "matches", "approved"];
@@ -7126,6 +7164,20 @@ function checkStep(raw, at2, problems) {
7126
7164
  if (!STEP_KEYS.has(key))
7127
7165
  problems.push(`${at2}.${key}: unknown field (allowed: ${[...STEP_KEYS].join(", ")})`);
7128
7166
  const { id, title, kind, after, skill, prompt, inputs, branch, ui } = raw;
7167
+ const { action, edit_document: editDocument } = raw;
7168
+ if (kind === "action") {
7169
+ if (!isSet(action))
7170
+ problems.push(
7171
+ `${at2}.action: an action step needs an action (${STEP_ACTION_TYPES.join(", ")})`
7172
+ );
7173
+ else checkAction(action, `${at2}.action`, problems);
7174
+ } else if (isSet(action)) problems.push(`${at2}.action: only an action step has an action`);
7175
+ if (isSet(editDocument)) {
7176
+ if (kind !== "agent" || branch)
7177
+ problems.push(`${at2}.edit_document: belongs to an agent step on the main line`);
7178
+ else if (!isDocumentRef(editDocument))
7179
+ problems.push(`${at2}.edit_document: ${DOCUMENT_REF_HINT}`);
7180
+ }
7129
7181
  if (typeof id !== "string" || !STEP_ID_PATTERN.test(id))
7130
7182
  problems.push(
7131
7183
  `${at2}.id: must be lowercase letters, digits, "_" or "-", starting with a letter (got ${JSON.stringify(id)})`
@@ -7212,7 +7264,9 @@ function checkStep(raw, at2, problems) {
7212
7264
  ...isSet(signals) ? { signals } : {},
7213
7265
  ...isSet(assignee) ? { assignee } : {},
7214
7266
  ...isSet(remind) ? { remind_after_hours: remind } : {},
7215
- ...isSet(stepFieldsRaw) ? { fields: normalFields(stepFieldsRaw) } : {}
7267
+ ...isSet(stepFieldsRaw) ? { fields: normalFields(stepFieldsRaw) } : {},
7268
+ ...isSet(action) ? { action } : {},
7269
+ ...isSet(editDocument) ? { edit_document: editDocument } : {}
7216
7270
  };
7217
7271
  }
7218
7272
  function parsePlanSteps(value) {
@@ -7380,9 +7434,11 @@ __export(workflows_exports, {
7380
7434
  createWorkflow: () => createWorkflow,
7381
7435
  deleteWorkflow: () => deleteWorkflow,
7382
7436
  getWorkflow: () => getWorkflow,
7437
+ grantWorkflowAgentAccess: () => grantWorkflowAgentAccess,
7383
7438
  listWorkflowRuns: () => listWorkflowRuns,
7384
7439
  listWorkflows: () => listWorkflows,
7385
7440
  runWorkflow: () => runWorkflow,
7441
+ runsUnattended: () => runsUnattended,
7386
7442
  updateWorkflow: () => updateWorkflow
7387
7443
  });
7388
7444
  var byId2 = (workflowId) => ({ params: { path: { workflow_id: workflowId } } });
@@ -7422,6 +7478,19 @@ async function listWorkflowRuns(arbi, workflowId) {
7422
7478
  "Failed to list automation executions"
7423
7479
  );
7424
7480
  }
7481
+ var runsUnattended = (w2) => !w2.on_demand;
7482
+ async function grantWorkflowAgentAccess(agents, workflow, grant) {
7483
+ if (workflow.auth_mode !== "scheduled_permanent" || !runsUnattended(workflow) || !workflow.agent_ext_id)
7484
+ return null;
7485
+ const email = agents.find((a2) => a2.external_id === workflow.agent_ext_id)?.email;
7486
+ if (!email) return null;
7487
+ try {
7488
+ await grant(email);
7489
+ } catch (err) {
7490
+ if (!/already|no users found to add/i.test(String(err?.message ?? err))) throw err;
7491
+ }
7492
+ return email;
7493
+ }
7425
7494
 
7426
7495
  // src/operations/facts.ts
7427
7496
  var facts_exports = {};