@aikirun/client 0.9.0 → 0.9.2

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 (2) hide show
  1. package/README.md +16 -82
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @aikirun/client
2
2
 
3
- Client SDK for Aiki durable execution platform - connect to the Aiki server, start workflows, and manage execution.
3
+ Client SDK for Aiki durable execution platform.
4
4
 
5
5
  ## Installation
6
6
 
@@ -10,110 +10,44 @@ npm install @aikirun/client
10
10
 
11
11
  ## Quick Start
12
12
 
13
- ### Initialize the Client
14
-
15
13
  ```typescript
16
14
  import { client } from "@aikirun/client";
15
+ import { orderWorkflowV1 } from "./workflows.ts";
17
16
 
18
17
  const aikiClient = await client({
19
18
  url: "http://localhost:9876",
20
- redis: {
21
- host: "localhost",
22
- port: 6379,
23
- },
19
+ redis: { host: "localhost", port: 6379 },
24
20
  });
25
- ```
26
-
27
- ### Start a Workflow
28
21
 
29
- ```typescript
30
- import { onboardingWorkflowV1 } from "./workflows.ts";
31
-
32
- const stateHandle = await onboardingWorkflowV1.start(aikiClient, {
33
- email: "user@example.com",
22
+ // Start a workflow
23
+ const handle = await orderWorkflowV1.start(aikiClient, {
24
+ orderId: "order-123",
34
25
  });
35
- ```
36
26
 
37
- ### Wait for Workflow Completion
27
+ // Wait for completion
28
+ const result = await handle.waitForStatus("completed");
38
29
 
39
- ```typescript
40
- const result = await stateHandle.wait(
41
- { type: "status", status: "completed" },
42
- { maxDurationMs: 60_000, pollIntervalMs: 5_000 },
43
- );
44
-
45
- if (result.success) {
46
- console.log("Workflow completed!");
47
- } else {
48
- console.log("Workflow did not complete:", result.cause);
49
- }
50
- ```
51
-
52
- ### Get Workflow State
53
-
54
- ```typescript
55
- const state = await stateHandle.getState();
56
- console.log("Current status:", state.status);
30
+ // Close when done
31
+ await aikiClient.close();
57
32
  ```
58
33
 
59
34
  ## Features
60
35
 
61
- - **Reliable Connection** - HTTP client with automatic retry and connection pooling
36
+ - **Server Connection** - Connect to the Aiki server via HTTP
62
37
  - **Workflow Management** - Start workflows with type-safe inputs
63
- - **State Polling** - Wait for workflow completion with configurable polling
64
- - **Logger** - Built-in logging for debugging
65
- - **Create Context** - Pass application context through workflow execution
66
- - **Redis Integration** - Connect to Redis for distributed state management
38
+ - **Redis Integration** - Distributed state and message streaming
39
+ - **Context Injection** - Pass application context to workflows
40
+ - **Custom Logging** - Plug in your own logger
67
41
 
68
- ## Configuration
42
+ ## Documentation
69
43
 
70
- ### Client Parameters
71
-
72
- ```typescript
73
- interface ClientParams<AppContext> {
74
- url: string; // Server URL
75
- redis: {
76
- host: string;
77
- port: number;
78
- password?: string;
79
- db?: number;
80
- maxRetriesPerRequest?: number;
81
- retryDelayOnFailoverMs?: number;
82
- connectTimeoutMs?: number;
83
- };
84
- createContext?: (run: WorkflowRun) => AppContext | Promise<AppContext>;
85
- logger?: Logger;
86
- }
87
- ```
88
-
89
- ### Create Context Example
90
-
91
- ```typescript
92
- const aikiClient = await client({
93
- url: "http://localhost:9876",
94
- redis: { host: "localhost", port: 6379 },
95
- createContext: (run) => ({
96
- traceId: generateTraceId(),
97
- workflowRunId: run.id,
98
- userId: extractUserIdFromRun(run),
99
- }),
100
- });
101
- ```
102
-
103
- ## API Reference
104
-
105
- See the [Aiki documentation](https://github.com/aikirun/aiki) for comprehensive API reference.
44
+ For comprehensive documentation including configuration options and context injection, see the [Client Guide](https://github.com/aikirun/aiki/blob/main/docs/core-concepts/client.md).
106
45
 
107
46
  ## Related Packages
108
47
 
109
48
  - [@aikirun/workflow](https://www.npmjs.com/package/@aikirun/workflow) - Define workflows
110
49
  - [@aikirun/task](https://www.npmjs.com/package/@aikirun/task) - Define tasks
111
50
  - [@aikirun/worker](https://www.npmjs.com/package/@aikirun/worker) - Execute workflows
112
- - [@aikirun/types](https://www.npmjs.com/package/@aikirun/types) - Type definitions
113
-
114
- ## Changelog
115
-
116
- See the [CHANGELOG](https://github.com/aikirun/aiki/blob/main/CHANGELOG.md) for version history.
117
51
 
118
52
  ## License
119
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikirun/client",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "Client SDK for Aiki - connect to the server, start workflows, and manage execution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "build": "tsup"
19
19
  },
20
20
  "dependencies": {
21
- "@aikirun/types": "0.9.0",
21
+ "@aikirun/types": "0.9.2",
22
22
  "@orpc/client": "^1.9.3",
23
23
  "ioredis": "^5.4.1",
24
24
  "zod": "^4.1.12"