larkci 0.2.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +267 -66
  2. package/dist/api/client.d.ts +39 -5
  3. package/dist/api/client.d.ts.map +1 -1
  4. package/dist/api/client.js +76 -19
  5. package/dist/api/client.js.map +1 -1
  6. package/dist/api/types.d.ts +75 -19
  7. package/dist/api/types.d.ts.map +1 -1
  8. package/dist/commands/create-workflow.d.ts.map +1 -1
  9. package/dist/commands/create-workflow.js +2 -0
  10. package/dist/commands/create-workflow.js.map +1 -1
  11. package/dist/commands/events.d.ts +3 -0
  12. package/dist/commands/events.d.ts.map +1 -0
  13. package/dist/commands/events.js +34 -0
  14. package/dist/commands/events.js.map +1 -0
  15. package/dist/commands/execution.d.ts.map +1 -1
  16. package/dist/commands/execution.js +0 -26
  17. package/dist/commands/execution.js.map +1 -1
  18. package/dist/commands/generations.d.ts +3 -0
  19. package/dist/commands/generations.d.ts.map +1 -0
  20. package/dist/commands/generations.js +30 -0
  21. package/dist/commands/generations.js.map +1 -0
  22. package/dist/commands/get-workflow.d.ts +3 -0
  23. package/dist/commands/get-workflow.d.ts.map +1 -0
  24. package/dist/commands/get-workflow.js +26 -0
  25. package/dist/commands/get-workflow.js.map +1 -0
  26. package/dist/commands/invoke.d.ts.map +1 -1
  27. package/dist/commands/invoke.js +66 -4
  28. package/dist/commands/invoke.js.map +1 -1
  29. package/dist/commands/list-workflows.d.ts.map +1 -1
  30. package/dist/commands/list-workflows.js +2 -0
  31. package/dist/commands/list-workflows.js.map +1 -1
  32. package/dist/commands/repairs.d.ts +3 -0
  33. package/dist/commands/repairs.d.ts.map +1 -0
  34. package/dist/commands/repairs.js +123 -0
  35. package/dist/commands/repairs.js.map +1 -0
  36. package/dist/commands/secret-contexts.d.ts.map +1 -1
  37. package/dist/commands/secret-contexts.js +45 -0
  38. package/dist/commands/secret-contexts.js.map +1 -1
  39. package/dist/commands/update-workflow.d.ts +3 -0
  40. package/dist/commands/update-workflow.d.ts.map +1 -0
  41. package/dist/commands/update-workflow.js +48 -0
  42. package/dist/commands/update-workflow.js.map +1 -0
  43. package/dist/commands/workflow-groups.d.ts +3 -0
  44. package/dist/commands/workflow-groups.d.ts.map +1 -0
  45. package/dist/commands/workflow-groups.js +126 -0
  46. package/dist/commands/workflow-groups.js.map +1 -0
  47. package/dist/index.js +13 -1
  48. package/dist/index.js.map +1 -1
  49. package/package.json +5 -3
package/README.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  Command-line interface for creating, invoking, and managing [LarkCI](https://getlark.ai) testing workflows.
4
4
 
5
+ ## Table of Contents
6
+
7
+ - [Quickstart](#quickstart)
8
+ - [Configuration](#configuration)
9
+ - [CI Pipeline Usage](#ci-pipeline-usage)
10
+ - [Usage](#usage)
11
+ - [workflows](#commands) — create, get, update, list, archive, invoke
12
+ - [workflows executions](#workflows-executions-get--get-execution-details) — get, logs, cancel
13
+ - [workflows repairs](#workflows-repairs-trigger--trigger-a-workflow-repair) — trigger, list, get, cancel, logs
14
+ - [workflows generations](#workflows-generations-cancel--cancel-a-running-generation) — cancel
15
+ - [workflows events](#workflows-events-list--list-workflow-events) — list
16
+ - [workflow-groups](#workflow-groups-create--create-a-workflow-group) — create, list, get, update, delete
17
+ - [secret-contexts](#secret-contexts-list--list-secret-contexts) — list, get, create, update, delete, delete-key
18
+ - [Examples](#examples)
19
+ - [Contributing](#contributing)
20
+ - [License](#license)
21
+
5
22
  ## Quickstart
6
23
 
7
24
  Requires Node.js >= 18.
@@ -30,6 +47,37 @@ Alternatively, pass it inline with the `--api-key` flag (see [Global Options](#g
30
47
 
31
48
  The CLI also supports a `.env` file in the current directory.
32
49
 
50
+ ## CI Pipeline Usage
51
+
52
+ The `--wait` flag makes it easy to use in CI pipelines. The command will block until the workflow completes and exit with a non-zero code on failure.
53
+
54
+ ### GitHub Actions Example
55
+
56
+ Set the `LARKCI_API_KEY` environment variable in GitHub Actions secrets.
57
+
58
+ ```yaml
59
+ - name: Run LarkCI Tests
60
+ run: npx -y larkci@latest workflows invoke --all --wait
61
+ env:
62
+ LARKCI_API_KEY: ${{ secrets.LARKCI_API_KEY }}
63
+ ```
64
+
65
+ ### CircleCI Example
66
+
67
+ Set the `LARKCI_API_KEY` environment variable in CircleCI.
68
+
69
+ ```yaml
70
+ larkci_tests:
71
+ docker:
72
+ - image: cimg/node:lts
73
+ resource_class: small
74
+ steps:
75
+ - run:
76
+ name: Run LarkCI Tests
77
+ command: |
78
+ npx -y larkci@latest workflows invoke --all --wait
79
+ ```
80
+
33
81
  ## Usage
34
82
 
35
83
  ```bash
@@ -52,12 +100,13 @@ larkci [options] <command>
52
100
  larkci workflows create --name "login-flow" --description "Test the login process end-to-end"
53
101
  ```
54
102
 
55
- | Flag | Required | Description | Default |
56
- | --------------------------------- | -------- | ----------------------------------------------- | ------------ |
57
- | `--name <name>` | Yes | Workflow name | |
58
- | `--description <description>` | Yes | Workflow description | |
59
- | `--mode <mode>` | No | Execution mode: `ai_driven` or `deterministic` | `ai_driven` |
60
- | `--secret-contexts <contexts...>` | No | Secret contexts to attach to the workflow | |
103
+ | Flag | Required | Description | Default |
104
+ | --------------------------------- | -------- | ---------------------------------------------- | ----------- |
105
+ | `--name <name>` | Yes | Workflow name | |
106
+ | `--description <description>` | Yes | Workflow description | |
107
+ | `--mode <mode>` | No | Execution mode: `ai_driven` or `deterministic` | `ai_driven` |
108
+ | `--secret-contexts <contexts...>` | No | Secret contexts to attach to the workflow | |
109
+ | `--group-id <groupId>` | No | Workflow group ID to assign this workflow to | |
61
110
 
62
111
  ```bash
63
112
  # Create a deterministic workflow with secret contexts
@@ -68,6 +117,30 @@ larkci workflows create \
68
117
  --secret-contexts production staging
69
118
  ```
70
119
 
120
+ #### `workflows get` — Get workflow details
121
+
122
+ ```bash
123
+ larkci workflows get <workflow_id>
124
+ ```
125
+
126
+ Returns the full workflow resource including status, mode, schedule, and last execution/generation/repair info.
127
+
128
+ #### `workflows update` — Update a workflow
129
+
130
+ ```bash
131
+ larkci workflows update <workflow_id> --name "new-name" --description "updated description"
132
+ ```
133
+
134
+ | Flag | Description |
135
+ | --------------------------------- | ----------------------------------------- |
136
+ | `--name <name>` | New name for the workflow |
137
+ | `--description <description>` | New description for the workflow |
138
+ | `--secret-contexts <contexts...>` | Secret contexts to attach |
139
+ | `--schedule <cron>` | Cron schedule for the workflow |
140
+ | `--group-id <groupId>` | Workflow group ID (use `null` to ungroup) |
141
+
142
+ At least one option is required.
143
+
71
144
  #### `workflows archive` — Archive a workflow
72
145
 
73
146
  ```bash
@@ -90,10 +163,11 @@ Restores an archived workflow so it appears in the list and can be invoked again
90
163
  larkci workflows list
91
164
  ```
92
165
 
93
- | Flag | Description | Default |
94
- | ------------------ | ------------------------------- | ------- |
95
- | `--limit <number>` | Max workflows to return (1–100) | `10` |
96
- | `--offset <number>`| Number of workflows to skip | `0` |
166
+ | Flag | Description | Default |
167
+ | ---------------------- | ------------------------------- | ------- |
168
+ | `--limit <number>` | Max workflows to return (1–100) | `10` |
169
+ | `--offset <number>` | Number of workflows to skip | `0` |
170
+ | `--group-id <groupId>` | Filter workflows by group ID | |
97
171
 
98
172
  #### `workflows invoke` — Invoke workflows
99
173
 
@@ -103,30 +177,27 @@ larkci workflows invoke --all --wait --timeout 300
103
177
 
104
178
  # Invoke specific workflows and wait
105
179
  larkci workflows invoke --workflow-ids wf_abc123 wf_def456 --wait --timeout 300
106
- ```
107
180
 
108
- | Flag | Description |
109
- | ------------------------- | -------------------------------------------------------------------------------- |
110
- | `--workflow-ids <id...>` | The IDs of the workflows to invoke |
111
- | `--all` | Invoke all workflows |
112
- | `--wait` | Wait for the execution to finish (successfully or unsuccessfully) before exiting |
113
- | `--timeout <seconds>` | Maximum time to wait in seconds (default: 600, requires `--wait`) |
114
- | `--verbose` | Print verbose output (includes logs) |
181
+ # Invoke all workflows in a group by ID
182
+ larkci workflows invoke --group-id wfl_grp_abc123 --wait
115
183
 
116
- Either `--workflow-ids` or `--all` is required.
117
-
118
- Exit codes: `0` = success, `1` = workflow failure, `2` = timeout, `3` = unexpected error.
184
+ # Invoke all workflows in a group by name
185
+ larkci workflows invoke --group-name "Checkout Flow" --wait
186
+ ```
119
187
 
120
- #### `workflows executions list` — List executions
188
+ | Flag | Description |
189
+ | -------------------------- | -------------------------------------------------------------------------------- |
190
+ | `--workflow-ids <id...>` | The IDs of the workflows to invoke |
191
+ | `--all` | Invoke all workflows |
192
+ | `--group-id <groupId>` | Invoke all workflows in a group (by group ID) |
193
+ | `--group-name <groupName>` | Invoke all workflows in a group (by group name) |
194
+ | `--wait` | Wait for the execution to finish (successfully or unsuccessfully) before exiting |
195
+ | `--timeout <seconds>` | Maximum time to wait in seconds (default: 600, requires `--wait`) |
196
+ | `--verbose` | Print verbose output (includes logs) |
121
197
 
122
- ```bash
123
- larkci workflows executions list <workflow_id>
124
- ```
198
+ One of `--workflow-ids`, `--all`, `--group-id`, or `--group-name` is required.
125
199
 
126
- | Flag | Description | Default |
127
- | ------------------ | -------------------------------- | ------- |
128
- | `--limit <number>` | Max executions to return (1–100) | `10` |
129
- | `--offset <number>`| Number of executions to skip | `0` |
200
+ Exit codes: `0` = success, `1` = workflow failure, `2` = timeout, `3` = unexpected error.
130
201
 
131
202
  #### `workflows executions get` — Get execution details
132
203
 
@@ -146,6 +217,107 @@ larkci workflows executions logs <workflow_id> <execution_id>
146
217
  larkci workflows executions cancel <workflow_id> <execution_id>
147
218
  ```
148
219
 
220
+ #### `workflows repairs trigger` — Trigger a workflow repair
221
+
222
+ ```bash
223
+ larkci workflows repairs trigger <workflow_id>
224
+ ```
225
+
226
+ Triggers a repair for a workflow. Returns the repair resource.
227
+
228
+ #### `workflows repairs list` — List workflow repairs
229
+
230
+ ```bash
231
+ larkci workflows repairs list <workflow_id>
232
+ ```
233
+
234
+ | Flag | Description | Default |
235
+ | ------------------- | ----------------------------- | ------- |
236
+ | `--limit <number>` | Max repairs to return (1–100) | `10` |
237
+ | `--offset <number>` | Number of repairs to skip | `0` |
238
+
239
+ #### `workflows repairs get` — Get repair details
240
+
241
+ ```bash
242
+ larkci workflows repairs get <workflow_id> <repair_id>
243
+ ```
244
+
245
+ #### `workflows repairs cancel` — Cancel a running repair
246
+
247
+ ```bash
248
+ larkci workflows repairs cancel <workflow_id> <repair_id>
249
+ ```
250
+
251
+ #### `workflows repairs logs` — Get repair logs
252
+
253
+ ```bash
254
+ larkci workflows repairs logs <workflow_id> <repair_id>
255
+ ```
256
+
257
+ #### `workflows generations cancel` — Cancel a running generation
258
+
259
+ ```bash
260
+ larkci workflows generations cancel <workflow_id> <generation_id>
261
+ ```
262
+
263
+ #### `workflows events list` — List workflow events
264
+
265
+ ```bash
266
+ larkci workflows events list <workflow_id>
267
+ ```
268
+
269
+ | Flag | Description | Default |
270
+ | ------------------- | ---------------------------- | ------- |
271
+ | `--limit <number>` | Max events to return (1–100) | `10` |
272
+ | `--offset <number>` | Number of events to skip | `0` |
273
+
274
+ Lists all events (generations, executions, repairs) for a workflow.
275
+
276
+ #### `workflow-groups create` — Create a workflow group
277
+
278
+ ```bash
279
+ larkci workflow-groups create --name "Checkout Flow"
280
+ ```
281
+
282
+ | Flag | Required | Description |
283
+ | --------------- | -------- | -------------------------- |
284
+ | `--name <name>` | Yes | Name of the workflow group |
285
+
286
+ #### `workflow-groups list` — List workflow groups
287
+
288
+ ```bash
289
+ larkci workflow-groups list
290
+ ```
291
+
292
+ | Flag | Description | Default |
293
+ | ------------------- | ---------------------------- | ------- |
294
+ | `--limit <number>` | Max groups to return (1–100) | `10` |
295
+ | `--offset <number>` | Number of groups to skip | `0` |
296
+
297
+ #### `workflow-groups get` — Get a workflow group
298
+
299
+ ```bash
300
+ larkci workflow-groups get <group_id>
301
+ ```
302
+
303
+ #### `workflow-groups update` — Update a workflow group
304
+
305
+ ```bash
306
+ larkci workflow-groups update <group_id> --name "Updated Name"
307
+ ```
308
+
309
+ | Flag | Description |
310
+ | --------------- | ------------------------------- |
311
+ | `--name <name>` | New name for the workflow group |
312
+
313
+ #### `workflow-groups delete` — Delete a workflow group
314
+
315
+ ```bash
316
+ larkci workflow-groups delete <group_id>
317
+ ```
318
+
319
+ Workflows in the group become ungrouped.
320
+
149
321
  #### `secret-contexts list` — List secret contexts
150
322
 
151
323
  ```bash
@@ -168,10 +340,10 @@ Returns the context name and the list of key names stored in it. Does not return
168
340
  larkci secret-contexts create --context production --secret username=admin --secret password=s3cret
169
341
  ```
170
342
 
171
- | Flag | Required | Description |
172
- | --------------------------- | -------- | -------------------------------------------------- |
173
- | `--context <name>` | Yes | Name of the secret context |
174
- | `--secret <key=value>` | Yes | Secret key-value pair (repeat for multiple values) |
343
+ | Flag | Required | Description |
344
+ | ---------------------- | -------- | -------------------------------------------------- |
345
+ | `--context <name>` | Yes | Name of the secret context |
346
+ | `--secret <key=value>` | Yes | Secret key-value pair (repeat for multiple values) |
175
347
 
176
348
  ```bash
177
349
  # Create a secret context with multiple credentials
@@ -182,6 +354,19 @@ larkci secret-contexts create \
182
354
  --secret password=testpass
183
355
  ```
184
356
 
357
+ #### `secret-contexts update` — Update a key in a secret context
358
+
359
+ ```bash
360
+ larkci secret-contexts update <context> --key <key> --value <value>
361
+ ```
362
+
363
+ | Flag | Required | Description |
364
+ | ----------------- | -------- | --------------------------- |
365
+ | `--key <key>` | Yes | The key to create or update |
366
+ | `--value <value>` | Yes | The new value for the key |
367
+
368
+ If the key already exists its value is replaced; if it does not exist it is added.
369
+
185
370
  #### `secret-contexts delete` — Delete a secret context
186
371
 
187
372
  ```bash
@@ -190,15 +375,32 @@ larkci secret-contexts delete <context>
190
375
 
191
376
  Permanently deletes a secret context. Workflows referencing it will no longer have access.
192
377
 
378
+ #### `secret-contexts delete-key` — Delete a key from a secret context
379
+
380
+ ```bash
381
+ larkci secret-contexts delete-key <context> <key>
382
+ ```
383
+
384
+ Removes a single key-value pair from an existing secret context.
385
+
193
386
  ### Examples
194
387
 
195
388
  ```bash
196
389
  # Create a workflow
197
390
  larkci workflows create --name "signup-flow" --description "Test user signup"
198
391
 
392
+ # Get workflow details
393
+ larkci workflows get wf_abc123
394
+
395
+ # Update a workflow
396
+ larkci workflows update wf_abc123 --name "updated-signup-flow" --schedule "0 9 * * *"
397
+
199
398
  # List your workflows
200
399
  larkci workflows list --limit 20
201
400
 
401
+ # List workflows in a group
402
+ larkci workflows list --group-id grp_abc123
403
+
202
404
  # Archive a workflow
203
405
  larkci workflows archive wf_abc123
204
406
 
@@ -214,8 +416,11 @@ larkci workflows invoke --workflow-ids wf_abc123 --wait
214
416
  # Invoke and wait (up to 5 minutes) with verbose logs
215
417
  larkci workflows invoke --workflow-ids wf_abc123 --wait --timeout 300 --verbose
216
418
 
217
- # List recent executions for a workflow
218
- larkci workflows executions list wf_abc123
419
+ # Invoke all workflows in a group by ID
420
+ larkci workflows invoke --group-id wfl_grp_abc123 --wait
421
+
422
+ # Invoke all workflows in a group by name
423
+ larkci workflows invoke --group-name "Checkout Flow" --wait
219
424
 
220
425
  # Check execution status
221
426
  larkci workflows executions get wf_abc123 exec_xyz789
@@ -226,53 +431,49 @@ larkci workflows executions logs wf_abc123 exec_xyz789
226
431
  # Cancel a running execution
227
432
  larkci workflows executions cancel wf_abc123 exec_xyz789
228
433
 
434
+ # Trigger a repair
435
+ larkci workflows repairs trigger wf_abc123
436
+
437
+ # List repairs
438
+ larkci workflows repairs list wf_abc123
439
+
440
+ # Cancel a generation
441
+ larkci workflows generations cancel wf_abc123 gen_xyz789
442
+
443
+ # List events
444
+ larkci workflows events list wf_abc123
445
+
446
+ # Create a workflow group
447
+ larkci workflow-groups create --name "Checkout Flow"
448
+
449
+ # List workflow groups
450
+ larkci workflow-groups list
451
+
452
+ # Delete a workflow group
453
+ larkci workflow-groups delete grp_abc123
454
+
229
455
  # Override API key inline
230
456
  larkci --api-key sk-test-key workflows invoke --workflow-ids wf_abc123
231
457
 
232
458
  # Store credentials for a secret context
233
459
  larkci secret-contexts create --context production --secret username=admin --secret password=s3cret
234
460
 
461
+ # Update a single key in a secret context
462
+ larkci secret-contexts update production --key password --value new-s3cret
463
+
235
464
  # List all secret contexts
236
465
  larkci secret-contexts list
237
466
 
238
467
  # View the keys stored in a secret context
239
468
  larkci secret-contexts get production
240
469
 
470
+ # Delete a key from a secret context
471
+ larkci secret-contexts delete-key production password
472
+
241
473
  # Delete a secret context
242
474
  larkci secret-contexts delete production
243
475
  ```
244
476
 
245
- ## CI Pipeline Usage
246
-
247
- The `--wait` flag makes it easy to use in CI pipelines. The command will block until the workflow completes and exit with a non-zero code on failure.
248
-
249
- ### GitHub Actions Example
250
-
251
- Set the `LARKCI_API_KEY` environment variable in GitHub Actions secrets.
252
-
253
- ```yaml
254
- - name: Run LarkCI Tests
255
- run: npx -y larkci@latest workflows invoke --all --wait
256
- env:
257
- LARKCI_API_KEY: ${{ secrets.LARKCI_API_KEY }}
258
- ```
259
-
260
- ### CircleCI Example
261
-
262
- Set the `LARKCI_API_KEY` environment variable in CircleCI.
263
-
264
- ```yaml
265
- larkci_tests:
266
- docker:
267
- - image: cimg/node:lts
268
- resource_class: small
269
- steps:
270
- - run:
271
- name: Run LarkCI Tests
272
- command: |
273
- npx -y larkci@latest workflows invoke --all --wait
274
- ```
275
-
276
477
  ## Contributing
277
478
 
278
479
  See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
@@ -1,5 +1,5 @@
1
1
  import type { Config } from "../config.js";
2
- import type { GetSecretContextResponse, ListSecretContextsResponse, ListWorkflowExecutionsResponse, ListWorkflowsResponse, WorkflowExecutionResource, WorkflowResource } from "./types.js";
2
+ import type { GetSecretContextResponse, ListSecretContextsResponse, ListWorkflowEventsResponse, ListWorkflowGroupsResponse, ListWorkflowRepairsResponse, ListWorkflowsResponse, WorkflowExecutionResource, WorkflowGenerationResource, WorkflowGroupResource, WorkflowRepairResource, WorkflowResource } from "./types.js";
3
3
  export declare class TimeoutError extends Error {
4
4
  constructor(message: string);
5
5
  }
@@ -13,11 +13,21 @@ export declare class LarkCIClient {
13
13
  private apiKey;
14
14
  constructor(config: Config);
15
15
  private request;
16
+ private buildQueryPath;
16
17
  createWorkflow(options: {
17
18
  name: string;
18
19
  description: string;
19
20
  secret_contexts?: string[];
20
21
  mode?: "ai_driven" | "deterministic";
22
+ group_id?: string;
23
+ }): Promise<WorkflowResource>;
24
+ getWorkflow(workflowId: string): Promise<WorkflowResource>;
25
+ updateWorkflow(workflowId: string, options: {
26
+ name?: string;
27
+ description?: string;
28
+ secret_contexts?: string[];
29
+ schedule?: string | null;
30
+ group_id?: string | null;
21
31
  }): Promise<WorkflowResource>;
22
32
  archiveWorkflow(workflowId: string): Promise<WorkflowResource>;
23
33
  unarchiveWorkflow(workflowId: string): Promise<WorkflowResource>;
@@ -25,21 +35,45 @@ export declare class LarkCIClient {
25
35
  listWorkflows(options?: {
26
36
  limit?: number;
27
37
  offset?: number;
38
+ group_id?: string;
28
39
  }): Promise<ListWorkflowsResponse>;
29
- listWorkflowExecutions(workflowId: string, options?: {
30
- limit?: number;
31
- offset?: number;
32
- }): Promise<ListWorkflowExecutionsResponse>;
33
40
  getWorkflowExecution(workflowId: string, executionId: string): Promise<WorkflowExecutionResource>;
34
41
  getWorkflowExecutionLogs(workflowId: string, executionId: string): Promise<string[]>;
35
42
  cancelWorkflowExecution(workflowId: string, executionId: string): Promise<WorkflowExecutionResource>;
43
+ cancelWorkflowGeneration(workflowId: string, generationId: string): Promise<WorkflowGenerationResource>;
44
+ repairWorkflow(workflowId: string): Promise<WorkflowRepairResource>;
45
+ listWorkflowRepairs(workflowId: string, options?: {
46
+ limit?: number;
47
+ offset?: number;
48
+ }): Promise<ListWorkflowRepairsResponse>;
49
+ getWorkflowRepair(workflowId: string, repairId: string): Promise<WorkflowRepairResource>;
50
+ cancelWorkflowRepair(workflowId: string, repairId: string): Promise<WorkflowRepairResource>;
51
+ getWorkflowRepairLogs(workflowId: string, repairId: string): Promise<string[]>;
52
+ listWorkflowEvents(workflowId: string, options?: {
53
+ limit?: number;
54
+ offset?: number;
55
+ }): Promise<ListWorkflowEventsResponse>;
36
56
  listSecretContexts(): Promise<ListSecretContextsResponse>;
37
57
  getSecretContext(context: string): Promise<GetSecretContextResponse>;
38
58
  createSecretContext(options: {
39
59
  context: string;
40
60
  value: Record<string, string>;
41
61
  }): Promise<void>;
62
+ updateSecretContext(context: string, key: string, value: string): Promise<void>;
42
63
  deleteSecretContext(context: string): Promise<void>;
64
+ deleteSecretContextKey(context: string, key: string): Promise<void>;
65
+ createWorkflowGroup(options: {
66
+ name: string;
67
+ }): Promise<WorkflowGroupResource>;
68
+ listWorkflowGroups(options?: {
69
+ limit?: number;
70
+ offset?: number;
71
+ }): Promise<ListWorkflowGroupsResponse>;
72
+ getWorkflowGroup(groupId: string): Promise<WorkflowGroupResource>;
73
+ updateWorkflowGroup(groupId: string, options: {
74
+ name?: string;
75
+ }): Promise<WorkflowGroupResource>;
76
+ deleteWorkflowGroup(groupId: string): Promise<void>;
43
77
  pollWorkflowExecution(workflowId: string, executionId: string, options: PollOptions): Promise<WorkflowExecutionResource>;
44
78
  }
45
79
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,8BAA8B,EAC9B,qBAAqB,EACrB,yBAAyB,EACzB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB,qBAAa,YAAa,SAAQ,KAAK;gBACzB,OAAO,EAAE,MAAM;CAI5B;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,CACP,SAAS,EAAE,yBAAyB,EACpC,SAAS,EAAE,MAAM,KACd,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B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IAQV,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOnD,sBAAsB,CAC1B,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC;IASV,mBAAmB,CAAC,OAAO,EAAE;QACjC,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAQ5B,kBAAkB,CAAC,OAAO,CAAC,EAAE;QACjC,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAQjC,gBAAgB,CACpB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,qBAAqB,CAAC;IAO3B,mBAAmB,CACvB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GACzB,OAAO,CAAC,qBAAqB,CAAC;IAQ3B,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASnD,qBAAqB,CACzB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,yBAAyB,CAAC;CA+BtC"}
@@ -45,9 +45,25 @@ export class LarkCIClient {
45
45
  return undefined;
46
46
  return JSON.parse(text);
47
47
  }
48
+ buildQueryPath(basePath, params) {
49
+ const qs = new URLSearchParams();
50
+ for (const [key, value] of Object.entries(params)) {
51
+ if (value !== undefined)
52
+ qs.set(key, String(value));
53
+ }
54
+ const query = qs.toString();
55
+ return query ? `${basePath}?${query}` : basePath;
56
+ }
57
+ // ── Workflows ──────────────────────────────────────────────
48
58
  async createWorkflow(options) {
49
59
  return this.request("POST", "/workflows", options);
50
60
  }
61
+ async getWorkflow(workflowId) {
62
+ return this.request("GET", `/workflows/${workflowId}`);
63
+ }
64
+ async updateWorkflow(workflowId, options) {
65
+ return this.request("PUT", `/workflows/${workflowId}`, options);
66
+ }
51
67
  async archiveWorkflow(workflowId) {
52
68
  return this.request("POST", `/workflows/${workflowId}/archive`);
53
69
  }
@@ -58,27 +74,14 @@ export class LarkCIClient {
58
74
  return this.request("POST", `/workflows/${workflowId}/invoke`, {});
59
75
  }
60
76
  async listWorkflows(options) {
61
- const params = new URLSearchParams();
62
- if (options?.limit !== undefined)
63
- params.set("limit", String(options.limit));
64
- if (options?.offset !== undefined)
65
- params.set("offset", String(options.offset));
66
- const query = params.toString();
67
- const path = query ? `/workflows?${query}` : "/workflows";
68
- return this.request("GET", path);
69
- }
70
- async listWorkflowExecutions(workflowId, options) {
71
- const params = new URLSearchParams();
72
- if (options?.limit !== undefined)
73
- params.set("limit", String(options.limit));
74
- if (options?.offset !== undefined)
75
- params.set("offset", String(options.offset));
76
- const query = params.toString();
77
- const path = query
78
- ? `/workflows/${workflowId}/executions?${query}`
79
- : `/workflows/${workflowId}/executions`;
77
+ const path = this.buildQueryPath("/workflows", {
78
+ limit: options?.limit,
79
+ offset: options?.offset,
80
+ group_id: options?.group_id,
81
+ });
80
82
  return this.request("GET", path);
81
83
  }
84
+ // ── Executions ─────────────────────────────────────────────
82
85
  async getWorkflowExecution(workflowId, executionId) {
83
86
  return this.request("GET", `/workflows/${workflowId}/executions/${executionId}`);
84
87
  }
@@ -88,6 +91,33 @@ export class LarkCIClient {
88
91
  async cancelWorkflowExecution(workflowId, executionId) {
89
92
  return this.request("POST", `/workflows/${workflowId}/executions/${executionId}/cancel`);
90
93
  }
94
+ // ── Generations ────────────────────────────────────────────
95
+ async cancelWorkflowGeneration(workflowId, generationId) {
96
+ return this.request("POST", `/workflows/${workflowId}/generations/${generationId}/cancel`);
97
+ }
98
+ // ── Repairs ────────────────────────────────────────────────
99
+ async repairWorkflow(workflowId) {
100
+ return this.request("POST", `/workflows/${workflowId}/repair`);
101
+ }
102
+ async listWorkflowRepairs(workflowId, options) {
103
+ const path = this.buildQueryPath(`/workflows/${workflowId}/repairs`, { limit: options?.limit, offset: options?.offset });
104
+ return this.request("GET", path);
105
+ }
106
+ async getWorkflowRepair(workflowId, repairId) {
107
+ return this.request("GET", `/workflows/${workflowId}/repairs/${repairId}`);
108
+ }
109
+ async cancelWorkflowRepair(workflowId, repairId) {
110
+ return this.request("POST", `/workflows/${workflowId}/repairs/${repairId}/cancel`);
111
+ }
112
+ async getWorkflowRepairLogs(workflowId, repairId) {
113
+ return this.request("GET", `/workflows/${workflowId}/repairs/${repairId}/logs`);
114
+ }
115
+ // ── Events ─────────────────────────────────────────────────
116
+ async listWorkflowEvents(workflowId, options) {
117
+ const path = this.buildQueryPath(`/workflows/${workflowId}/events`, { limit: options?.limit, offset: options?.offset });
118
+ return this.request("GET", path);
119
+ }
120
+ // ── Secret Contexts ────────────────────────────────────────
91
121
  async listSecretContexts() {
92
122
  return this.request("GET", "/secret-contexts");
93
123
  }
@@ -97,9 +127,36 @@ export class LarkCIClient {
97
127
  async createSecretContext(options) {
98
128
  await this.request("POST", "/secret-contexts", options);
99
129
  }
130
+ async updateSecretContext(context, key, value) {
131
+ await this.request("PATCH", `/secret-contexts/${encodeURIComponent(context)}`, { key, value });
132
+ }
100
133
  async deleteSecretContext(context) {
101
134
  await this.request("DELETE", `/secret-contexts/${encodeURIComponent(context)}`);
102
135
  }
136
+ async deleteSecretContextKey(context, key) {
137
+ await this.request("DELETE", `/secret-contexts/${encodeURIComponent(context)}/${encodeURIComponent(key)}`);
138
+ }
139
+ // ── Workflow Groups ────────────────────────────────────────
140
+ async createWorkflowGroup(options) {
141
+ return this.request("POST", "/workflow-groups", options);
142
+ }
143
+ async listWorkflowGroups(options) {
144
+ const path = this.buildQueryPath("/workflow-groups", {
145
+ limit: options?.limit,
146
+ offset: options?.offset,
147
+ });
148
+ return this.request("GET", path);
149
+ }
150
+ async getWorkflowGroup(groupId) {
151
+ return this.request("GET", `/workflow-groups/${groupId}`);
152
+ }
153
+ async updateWorkflowGroup(groupId, options) {
154
+ return this.request("PUT", `/workflow-groups/${groupId}`, options);
155
+ }
156
+ async deleteWorkflowGroup(groupId) {
157
+ await this.request("DELETE", `/workflow-groups/${groupId}`);
158
+ }
159
+ // ── Polling ────────────────────────────────────────────────
103
160
  async pollWorkflowExecution(workflowId, executionId, options) {
104
161
  const { timeoutMs, pollIntervalMs, onPoll } = options;
105
162
  const startTime = Date.now();