@amaster.ai/client 1.1.43-beta.0 → 1.1.43-beta.3

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.
package/dist/index.d.cts CHANGED
@@ -5,7 +5,7 @@ export { EntityGetParams, EntityListResponse, EntityQueryParams, FilterGroup, Fi
5
5
  import { BpmClient } from '@amaster.ai/bpm-client';
6
6
  export { ActivityInstanceTree, CamundaVariable, HistoryActivityInstance, HistoryProcessInstance, HistoryTask, ProcessInstance, ProcessVariable, Task, TaskFormSchema, TaskQueryParams, UserOperationLog } from '@amaster.ai/bpm-client';
7
7
  import { WorkflowClient } from '@amaster.ai/workflow-client';
8
- export { WorkflowFile, WorkflowInputValue, WorkflowNodeUsage, WorkflowRunRequest, WorkflowRunResponse, WorkflowRunUsage, WorkflowUsageSummary } from '@amaster.ai/workflow-client';
8
+ export { WorkflowAsyncRunDetailResponse, WorkflowAsyncRunResponse, WorkflowAsyncRunStatus, WorkflowCallbackConfig, WorkflowFile, WorkflowInputValue, WorkflowNodeUsage, WorkflowRunDetailOptions, WorkflowRunRequest, WorkflowRunResponse, WorkflowRunUsage, WorkflowUsageSummary } from '@amaster.ai/workflow-client';
9
9
  import { ASRClientConfig, ASRClient, ASRHttpClientConfig, ASRHttpClient } from '@amaster.ai/asr-client';
10
10
  export { ASRClient, ASRClientConfig, ASRHttpClient, ASRHttpClientConfig, ASRLanguage } from '@amaster.ai/asr-client';
11
11
  import { CopilotClient } from '@amaster.ai/copilot-client';
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { EntityGetParams, EntityListResponse, EntityQueryParams, FilterGroup, Fi
5
5
  import { BpmClient } from '@amaster.ai/bpm-client';
6
6
  export { ActivityInstanceTree, CamundaVariable, HistoryActivityInstance, HistoryProcessInstance, HistoryTask, ProcessInstance, ProcessVariable, Task, TaskFormSchema, TaskQueryParams, UserOperationLog } from '@amaster.ai/bpm-client';
7
7
  import { WorkflowClient } from '@amaster.ai/workflow-client';
8
- export { WorkflowFile, WorkflowInputValue, WorkflowNodeUsage, WorkflowRunRequest, WorkflowRunResponse, WorkflowRunUsage, WorkflowUsageSummary } from '@amaster.ai/workflow-client';
8
+ export { WorkflowAsyncRunDetailResponse, WorkflowAsyncRunResponse, WorkflowAsyncRunStatus, WorkflowCallbackConfig, WorkflowFile, WorkflowInputValue, WorkflowNodeUsage, WorkflowRunDetailOptions, WorkflowRunRequest, WorkflowRunResponse, WorkflowRunUsage, WorkflowUsageSummary } from '@amaster.ai/workflow-client';
9
9
  import { ASRClientConfig, ASRClient, ASRHttpClientConfig, ASRHttpClient } from '@amaster.ai/asr-client';
10
10
  export { ASRClient, ASRClientConfig, ASRHttpClient, ASRHttpClientConfig, ASRLanguage } from '@amaster.ai/asr-client';
11
11
  import { CopilotClient } from '@amaster.ai/copilot-client';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/client",
3
- "version": "1.1.43-beta.0",
3
+ "version": "1.1.43-beta.3",
4
4
  "description": "Unified API client for Amaster platform - All services in one package",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -72,16 +72,16 @@
72
72
  "registry": "https://registry.npmjs.org/"
73
73
  },
74
74
  "dependencies": {
75
- "@amaster.ai/bpm-client": "1.1.43-beta.0",
76
- "@amaster.ai/asr-client": "1.1.43-beta.0",
77
- "@amaster.ai/auth-client": "1.1.43-beta.0",
78
- "@amaster.ai/entity-client": "1.1.43-beta.0",
79
- "@amaster.ai/http-client": "1.1.43-beta.0",
80
- "@amaster.ai/workflow-client": "1.1.43-beta.0",
81
- "@amaster.ai/s3-client": "1.1.43-beta.0",
82
- "@amaster.ai/function-client": "1.1.43-beta.0",
83
- "@amaster.ai/copilot-client": "1.1.43-beta.0",
84
- "@amaster.ai/tts-client": "1.1.43-beta.0"
75
+ "@amaster.ai/bpm-client": "1.1.43-beta.3",
76
+ "@amaster.ai/http-client": "1.1.43-beta.3",
77
+ "@amaster.ai/copilot-client": "1.1.43-beta.3",
78
+ "@amaster.ai/auth-client": "1.1.43-beta.3",
79
+ "@amaster.ai/s3-client": "1.1.43-beta.3",
80
+ "@amaster.ai/entity-client": "1.1.43-beta.3",
81
+ "@amaster.ai/asr-client": "1.1.43-beta.3",
82
+ "@amaster.ai/workflow-client": "1.1.43-beta.3",
83
+ "@amaster.ai/tts-client": "1.1.43-beta.3",
84
+ "@amaster.ai/function-client": "1.1.43-beta.3"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "axios": "^1.11.0"
package/types/index.d.ts CHANGED
@@ -399,7 +399,12 @@ export type {
399
399
  } from "./bpm";
400
400
  export type {
401
401
  WorkflowClientAPI,
402
+ WorkflowAsyncRunDetailResponse,
403
+ WorkflowAsyncRunResponse,
404
+ WorkflowAsyncRunStatus,
405
+ WorkflowCallbackConfig,
402
406
  WorkflowNodeUsage,
407
+ WorkflowRunDetailOptions,
403
408
  WorkflowRunRequest,
404
409
  WorkflowRunResponse,
405
410
  WorkflowRunUsage,
@@ -9,8 +9,9 @@ import type { ClientResult } from './common';
9
9
  * Workflow execution response mode
10
10
  * - `blocking`: Wait for workflow completion (default)
11
11
  * - `streaming`: Stream workflow execution progress
12
+ * - `async`: Submit workflow execution and return immediately
12
13
  */
13
- export type WorkflowResponseMode = 'blocking' | 'streaming';
14
+ export type WorkflowResponseMode = 'blocking' | 'streaming' | 'async';
14
15
 
15
16
  /**
16
17
  * Workflow input value (can be any JSON-serializable type)
@@ -39,6 +40,22 @@ export interface WorkflowFile {
39
40
  [key: string]: unknown;
40
41
  }
41
42
 
43
+ /**
44
+ * Callback config for async workflow runs.
45
+ */
46
+ export interface WorkflowCallbackConfig {
47
+ /** Callback endpoint to receive terminal workflow result */
48
+ url: string;
49
+ /** Shared secret used for HMAC signature */
50
+ secret?: string;
51
+ /** Include workflow outputs in callback payload */
52
+ include_outputs?: boolean;
53
+ /** Include usage in callback payload */
54
+ include_usage?: boolean;
55
+ /** Include node-level usage detail */
56
+ usage_detail?: boolean;
57
+ }
58
+
42
59
  /**
43
60
  * Workflow execution request parameters
44
61
  *
@@ -63,6 +80,10 @@ export interface WorkflowRunRequest {
63
80
  trace_id?: string;
64
81
  /** Include workflow and node usage in blocking run response */
65
82
  usage?: boolean;
83
+ /** Include node-level usage details when `usage` is enabled */
84
+ usage_detail?: boolean;
85
+ /** Callback config for async workflow runs */
86
+ callback?: WorkflowCallbackConfig;
66
87
  }
67
88
 
68
89
  /**
@@ -103,8 +124,8 @@ export interface WorkflowNodeUsage {
103
124
  */
104
125
  export interface WorkflowRunUsage {
105
126
  summary: WorkflowUsageSummary;
106
- estimated_price_by_currency: Record<string, string>;
107
- nodes: WorkflowNodeUsage[];
127
+ estimated_price_by_currency?: Record<string, string>;
128
+ nodes?: WorkflowNodeUsage[];
108
129
  }
109
130
 
110
131
  /**
@@ -140,6 +161,54 @@ export interface WorkflowRunResponse<TOutput = Record<string, unknown>> {
140
161
  usage?: WorkflowRunUsage;
141
162
  }
142
163
 
164
+ /**
165
+ * Async workflow run status.
166
+ */
167
+ export type WorkflowAsyncRunStatus =
168
+ | 'pending'
169
+ | 'queued'
170
+ | 'running'
171
+ | 'succeeded'
172
+ | 'failed'
173
+ | 'paused'
174
+ | 'rate_limited'
175
+ | 'retrying'
176
+ | string;
177
+
178
+ /**
179
+ * Response returned immediately by runAsync.
180
+ */
181
+ export interface WorkflowAsyncRunResponse {
182
+ async_run_id: string;
183
+ workflow_trigger_log_id: string;
184
+ workflow_run_id: string | null;
185
+ task_id?: string;
186
+ status: WorkflowAsyncRunStatus;
187
+ queue?: string;
188
+ created_at?: number | null;
189
+ }
190
+
191
+ /**
192
+ * Async workflow run detail response.
193
+ */
194
+ export interface WorkflowAsyncRunDetailResponse extends WorkflowAsyncRunResponse {
195
+ workflow_id?: string;
196
+ error?: string | null;
197
+ outputs?: Record<string, unknown> | null;
198
+ elapsed_time?: number | null;
199
+ total_tokens?: number | null;
200
+ triggered_at?: number | null;
201
+ finished_at?: number | null;
202
+ }
203
+
204
+ /**
205
+ * Workflow run detail query options.
206
+ */
207
+ export interface WorkflowRunDetailOptions {
208
+ usage?: boolean;
209
+ usage_detail?: boolean;
210
+ }
211
+
143
212
  // ==================== Workflow Client API ====================
144
213
 
145
214
  /**
@@ -187,4 +256,29 @@ export interface WorkflowClientAPI {
187
256
  workflowName: string,
188
257
  inputs?: Record<string, WorkflowInputValue> | WorkflowRunRequest
189
258
  ): Promise<ClientResult<WorkflowRunResponse<TOutput>>>;
259
+
260
+ /**
261
+ * Submit a workflow asynchronously and return immediately.
262
+ */
263
+ runAsync(
264
+ workflowName: string,
265
+ inputs?: Record<string, WorkflowInputValue> | WorkflowRunRequest
266
+ ): Promise<ClientResult<WorkflowAsyncRunResponse>>;
267
+
268
+ /**
269
+ * Get async workflow submission status.
270
+ */
271
+ getAsyncRun(
272
+ workflowName: string,
273
+ asyncRunId: string
274
+ ): Promise<ClientResult<WorkflowAsyncRunDetailResponse>>;
275
+
276
+ /**
277
+ * Get workflow run detail and optional usage.
278
+ */
279
+ getRun<TOutput = Record<string, unknown>>(
280
+ workflowName: string,
281
+ workflowRunId: string,
282
+ options?: WorkflowRunDetailOptions
283
+ ): Promise<ClientResult<WorkflowRunResponse<TOutput>>>;
190
284
  }