@arbidocs/sdk 0.4.79 → 0.4.81

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.
@@ -4153,7 +4153,9 @@ declare namespace projects {
4153
4153
  * step's `step_started` / `step_done` / `step_skipped` / `step_failed` event, the latest winning. A
4154
4154
  * `step_sent_back` reopens the step it names and every step after it (pending again); `step_ready`
4155
4155
  * records that a ready person step's assignee was told; `step_signal` is a signal a done step raised,
4156
- * and `linked_run` the thread a linked workflow started on it.
4156
+ * and `linked_run` the thread a linked workflow started on it. An agent step whose `step_waiting`
4157
+ * (then `step_progress`, as the set shrinks) carries `waiting.documents` waits for those documents
4158
+ * to finish processing before its turn starts.
4157
4159
  *
4158
4160
  * Pure functions over the API's own types (`TaskPlanStep`, `ActivityResponse`), for any client: the
4159
4161
  * CLI's `arbi run steps`, scripts and agents. They mirror the server (`src/core/workflow_steps.py`).
@@ -4189,6 +4191,11 @@ interface StepState {
4189
4191
  hasNote: boolean;
4190
4192
  /** Who was told the step is ready (`usr-` / `agt-`), since it last changed. */
4191
4193
  announcedTo: string | null;
4194
+ /**
4195
+ * The documents (ids) an agent step waits on to finish processing before its turn starts, as
4196
+ * its latest `step_waiting` / `step_progress` says; empty once it starts (or never waited).
4197
+ */
4198
+ waitingDocuments: string[];
4192
4199
  }
4193
4200
  /** One entry of a conversation's activity log, as far as steps are concerned. */
4194
4201
  interface StepActivityEvent {
@@ -4204,10 +4211,13 @@ declare const STEP_ID_PATTERN: RegExp;
4204
4211
  declare const isPersonStep: (step: Pick<TaskPlanStep, "kind">) => boolean;
4205
4212
  /** What a step waits for: its `after`, else the step before it in the list (a sequence). */
4206
4213
  declare function stepDependencies(steps: Pick<TaskPlanStep, 'id' | 'after'>[], id: string): string[];
4214
+ /** "Waiting for 3 documents to finish processing" (one: "1 document"). */
4215
+ declare function waitingForDocumentsText(count: number): string;
4207
4216
  /**
4208
4217
  * Each step's state from the activity log (oldest first): its latest step event wins. A send-back
4209
4218
  * reopens the steps it lists as pending (only the one it went `to` is `sentBack`); a `step_ready`
4210
- * records who was told, until the step's next change.
4219
+ * records who was told, and a `step_waiting` / `step_progress` the documents an agent step waits
4220
+ * on, until the step's next change.
4211
4221
  */
4212
4222
  declare function stepStatesFromActivity(events: StepActivityEvent[]): Record<string, StepState>;
4213
4223
  /** A signal a done step raised (`step_signal`). */
@@ -4267,6 +4277,8 @@ interface RunStep {
4267
4277
  signals: string[];
4268
4278
  /** The threads linked workflows started on this step's signals. */
4269
4279
  linkedRuns: LinkedRun[];
4280
+ /** The documents (ids) it waits on to finish processing before its turn starts. */
4281
+ waitingDocuments: string[];
4270
4282
  }
4271
4283
  /** A run's steps with where each stands, in plan order. */
4272
4284
  declare function runSteps(steps: TaskPlanStep[], events: StepActivityEvent[]): RunStep[];
@@ -4381,8 +4393,9 @@ declare const workflowSteps_stepFields: typeof stepFields;
4381
4393
  declare const workflowSteps_stepPhase: typeof stepPhase;
4382
4394
  declare const workflowSteps_stepStatesFromActivity: typeof stepStatesFromActivity;
4383
4395
  declare const workflowSteps_stepsPlan: typeof stepsPlan;
4396
+ declare const workflowSteps_waitingForDocumentsText: typeof waitingForDocumentsText;
4384
4397
  declare namespace workflowSteps {
4385
- 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_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_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 };
4398
+ 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_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_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 };
4386
4399
  }
4387
4400
 
4388
4401
  /**
@@ -4153,7 +4153,9 @@ declare namespace projects {
4153
4153
  * step's `step_started` / `step_done` / `step_skipped` / `step_failed` event, the latest winning. A
4154
4154
  * `step_sent_back` reopens the step it names and every step after it (pending again); `step_ready`
4155
4155
  * records that a ready person step's assignee was told; `step_signal` is a signal a done step raised,
4156
- * and `linked_run` the thread a linked workflow started on it.
4156
+ * and `linked_run` the thread a linked workflow started on it. An agent step whose `step_waiting`
4157
+ * (then `step_progress`, as the set shrinks) carries `waiting.documents` waits for those documents
4158
+ * to finish processing before its turn starts.
4157
4159
  *
4158
4160
  * Pure functions over the API's own types (`TaskPlanStep`, `ActivityResponse`), for any client: the
4159
4161
  * CLI's `arbi run steps`, scripts and agents. They mirror the server (`src/core/workflow_steps.py`).
@@ -4189,6 +4191,11 @@ interface StepState {
4189
4191
  hasNote: boolean;
4190
4192
  /** Who was told the step is ready (`usr-` / `agt-`), since it last changed. */
4191
4193
  announcedTo: string | null;
4194
+ /**
4195
+ * The documents (ids) an agent step waits on to finish processing before its turn starts, as
4196
+ * its latest `step_waiting` / `step_progress` says; empty once it starts (or never waited).
4197
+ */
4198
+ waitingDocuments: string[];
4192
4199
  }
4193
4200
  /** One entry of a conversation's activity log, as far as steps are concerned. */
4194
4201
  interface StepActivityEvent {
@@ -4204,10 +4211,13 @@ declare const STEP_ID_PATTERN: RegExp;
4204
4211
  declare const isPersonStep: (step: Pick<TaskPlanStep, "kind">) => boolean;
4205
4212
  /** What a step waits for: its `after`, else the step before it in the list (a sequence). */
4206
4213
  declare function stepDependencies(steps: Pick<TaskPlanStep, 'id' | 'after'>[], id: string): string[];
4214
+ /** "Waiting for 3 documents to finish processing" (one: "1 document"). */
4215
+ declare function waitingForDocumentsText(count: number): string;
4207
4216
  /**
4208
4217
  * Each step's state from the activity log (oldest first): its latest step event wins. A send-back
4209
4218
  * reopens the steps it lists as pending (only the one it went `to` is `sentBack`); a `step_ready`
4210
- * records who was told, until the step's next change.
4219
+ * records who was told, and a `step_waiting` / `step_progress` the documents an agent step waits
4220
+ * on, until the step's next change.
4211
4221
  */
4212
4222
  declare function stepStatesFromActivity(events: StepActivityEvent[]): Record<string, StepState>;
4213
4223
  /** A signal a done step raised (`step_signal`). */
@@ -4267,6 +4277,8 @@ interface RunStep {
4267
4277
  signals: string[];
4268
4278
  /** The threads linked workflows started on this step's signals. */
4269
4279
  linkedRuns: LinkedRun[];
4280
+ /** The documents (ids) it waits on to finish processing before its turn starts. */
4281
+ waitingDocuments: string[];
4270
4282
  }
4271
4283
  /** A run's steps with where each stands, in plan order. */
4272
4284
  declare function runSteps(steps: TaskPlanStep[], events: StepActivityEvent[]): RunStep[];
@@ -4381,8 +4393,9 @@ declare const workflowSteps_stepFields: typeof stepFields;
4381
4393
  declare const workflowSteps_stepPhase: typeof stepPhase;
4382
4394
  declare const workflowSteps_stepStatesFromActivity: typeof stepStatesFromActivity;
4383
4395
  declare const workflowSteps_stepsPlan: typeof stepsPlan;
4396
+ declare const workflowSteps_waitingForDocumentsText: typeof waitingForDocumentsText;
4384
4397
  declare namespace workflowSteps {
4385
- 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_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_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 };
4398
+ 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_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_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 };
4386
4399
  }
4387
4400
 
4388
4401
  /**
package/dist/browser.cjs CHANGED
@@ -6239,7 +6239,8 @@ __export(workflow_steps_exports, {
6239
6239
  stepFields: () => stepFields,
6240
6240
  stepPhase: () => stepPhase,
6241
6241
  stepStatesFromActivity: () => stepStatesFromActivity,
6242
- stepsPlan: () => stepsPlan
6242
+ stepsPlan: () => stepsPlan,
6243
+ waitingForDocumentsText: () => waitingForDocumentsText
6243
6244
  });
6244
6245
  var STEP_KINDS = ["form", "upload", "agent", "review"];
6245
6246
  var PERSON_STEP_KINDS = ["form", "upload", "review"];
@@ -6256,7 +6257,8 @@ var EMPTY_STATE = {
6256
6257
  error: null,
6257
6258
  sentBack: false,
6258
6259
  hasNote: false,
6259
- announcedTo: null
6260
+ announcedTo: null,
6261
+ waitingDocuments: []
6260
6262
  };
6261
6263
  var str = (v2) => typeof v2 === "string" ? v2 : null;
6262
6264
  var isFinished = (state) => state?.status === "done" || state?.status === "skipped";
@@ -6285,6 +6287,15 @@ function reopenedBy(detail) {
6285
6287
  const listed = Array.isArray(detail.reopened) ? detail.reopened : to ? [to] : [];
6286
6288
  return listed.filter((id) => typeof id === "string");
6287
6289
  }
6290
+ function waitingDocumentsOf(detail) {
6291
+ const waiting = detail.waiting;
6292
+ if (!waiting || typeof waiting !== "object" || Array.isArray(waiting)) return null;
6293
+ const documents = waiting.documents;
6294
+ return Array.isArray(documents) ? documents.filter((id) => typeof id === "string") : null;
6295
+ }
6296
+ function waitingForDocumentsText(count) {
6297
+ return `Waiting for ${count} ${count === 1 ? "document" : "documents"} to finish processing`;
6298
+ }
6288
6299
  function stepStatesFromActivity(events) {
6289
6300
  const states = {};
6290
6301
  for (const e of events) {
@@ -6305,6 +6316,12 @@ function stepStatesFromActivity(events) {
6305
6316
  states[step] = { ...states[step] ?? EMPTY_STATE, announcedTo: str(detail.to) };
6306
6317
  continue;
6307
6318
  }
6319
+ if (e.kind === "step_waiting" || e.kind === "step_progress") {
6320
+ const documents = waitingDocumentsOf(detail);
6321
+ if (documents)
6322
+ states[step] = { ...states[step] ?? EMPTY_STATE, waitingDocuments: documents };
6323
+ continue;
6324
+ }
6308
6325
  const status = STEP_EVENTS[e.kind];
6309
6326
  if (!status) continue;
6310
6327
  states[step] = {
@@ -6380,7 +6397,8 @@ function runSteps(steps, events) {
6380
6397
  hasNote: state.hasNote,
6381
6398
  timesSentBack: backs.filter((b2) => b2.to === s2.id).length,
6382
6399
  signals: [...new Set(signals.filter((x2) => x2.step === s2.id).map((x2) => x2.signal))],
6383
- linkedRuns: links.filter((l2) => l2.step === s2.id)
6400
+ linkedRuns: links.filter((l2) => l2.step === s2.id),
6401
+ waitingDocuments: state.waitingDocuments
6384
6402
  };
6385
6403
  });
6386
6404
  }