@axiom-lattice/protocols 2.1.51 → 2.1.54

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,3 +1,5 @@
1
+ import type { AgentConfig } from "./AgentLatticeProtocol";
2
+
1
3
  /**
2
4
  * Plugin Connection 字段 schema(驱动前端表单渲染)
3
5
  */
@@ -190,4 +192,16 @@ export interface Plugin {
190
192
  * Builder 在构建中间件之前从所有启用的插件中收集。
191
193
  */
192
194
  skills?: Record<string, string>;
195
+ /**
196
+ * 插件贡献的 Agent 定义(以 agent key 为键)。
197
+ * 在租户首次访问时通过 ensurePluginAgentsForTenant 按租户注册到
198
+ * AgentLatticeManager,与 builtin agents 模式一致。所有租户全局可用。
199
+ */
200
+ agents?: Record<string, AgentConfig>;
201
+ /**
202
+ * 插件贡献的 Store 实现(以 store type 为键)。
203
+ * 在 configureStores 时通过 customStores 机制自动注册到 StoreLatticeManager。
204
+ * 支持工厂函数(延迟初始化)或实例对象。
205
+ */
206
+ stores?: Record<string, object | (() => object)>;
193
207
  }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * STTModelLatticeProtocol
3
+ *
4
+ * Speech-to-text model lattice protocol for defining unified interface
5
+ * for speech recognition / transcription models.
6
+ */
7
+
8
+ import { BaseLatticeProtocol } from "./BaseLatticeProtocol";
9
+
10
+ /**
11
+ * STT provider configuration.
12
+ */
13
+ export interface STTConfig {
14
+ /** Provider type */
15
+ provider?: string;
16
+ /** API mode: "whisper" uses /v1/audio/transcriptions, "chat" uses /v1/chat/completions */
17
+ apiMode?: "whisper" | "chat";
18
+ /** Model name, e.g. "whisper-1", "qwen3-asr-flash" */
19
+ model?: string;
20
+ /** Direct API key */
21
+ apiKey?: string;
22
+ /** Environment variable name for API key, e.g. "DASHSCOPE_API_KEY" */
23
+ apiKeyEnvName?: string;
24
+ /** Custom base URL */
25
+ baseURL?: string;
26
+ /** Request timeout in milliseconds */
27
+ timeout?: number;
28
+ /** Additional parameters passed through to provider (e.g. asr_options) */
29
+ extra?: Record<string, unknown>;
30
+ }
31
+
32
+ /**
33
+ * Result returned by a transcription provider.
34
+ */
35
+ export interface TranscriptionResult {
36
+ /** Transcribed text */
37
+ text: string;
38
+ /** Confidence score 0-1, if available */
39
+ confidence?: number;
40
+ /** Word-level timing segments, if available */
41
+ segments?: Array<{
42
+ start: number;
43
+ end: number;
44
+ text: string;
45
+ }>;
46
+ }
47
+
48
+ /**
49
+ * STT client interface for providers to implement.
50
+ */
51
+ export interface STTClient {
52
+ transcribe(audio: Buffer, format: string): Promise<TranscriptionResult>;
53
+ }
54
+
55
+ /**
56
+ * STT model lattice protocol interface.
57
+ */
58
+ export interface STTModelLatticeProtocol
59
+ extends BaseLatticeProtocol<STTConfig, STTClient> {
60
+ /**
61
+ * Transcribe audio buffer to text.
62
+ * @param audio - Raw audio buffer
63
+ * @param format - Audio format, e.g. "webm", "wav", "mp3"
64
+ */
65
+ transcribe(audio: Buffer, format: string): Promise<TranscriptionResult>;
66
+ }
@@ -19,6 +19,16 @@ export interface TaskItem {
19
19
  */
20
20
  tenantId: string;
21
21
 
22
+ /**
23
+ * Workspace identifier (from runConfig)
24
+ */
25
+ workspaceId?: string;
26
+
27
+ /**
28
+ * Project identifier (from runConfig)
29
+ */
30
+ projectId?: string;
31
+
22
32
  /**
23
33
  * Owner type — either a user or an agent
24
34
  */
@@ -42,7 +52,7 @@ export interface TaskItem {
42
52
  /**
43
53
  * Task status
44
54
  */
45
- status: 'pending' | 'in_progress' | 'completed' | 'cancelled';
55
+ status: 'pending' | 'in_progress' | 'review' | 'failed' | 'interrupted' | 'completed' | 'cancelled';
46
56
 
47
57
  /**
48
58
  * Task priority level
@@ -83,6 +93,26 @@ export interface TaskItem {
83
93
  * Task last update timestamp
84
94
  */
85
95
  updatedAt: Date;
96
+
97
+ /**
98
+ * Whether this task requires review before completion
99
+ */
100
+ requireReview?: boolean;
101
+
102
+ /**
103
+ * IDs of tasks this task depends on
104
+ */
105
+ dependencies?: string[];
106
+
107
+ /**
108
+ * Task result output
109
+ */
110
+ result?: string;
111
+
112
+ /**
113
+ * Reason for task failure (when status is 'failed')
114
+ */
115
+ failureReason?: string;
86
116
  }
87
117
 
88
118
  /**
@@ -102,13 +132,23 @@ export interface CreateTaskRequest {
102
132
  /**
103
133
  * Task status — defaults to 'pending' if not provided
104
134
  */
105
- status?: 'pending' | 'in_progress' | 'completed' | 'cancelled';
135
+ status?: 'pending' | 'in_progress' | 'review' | 'failed' | 'interrupted' | 'completed' | 'cancelled';
106
136
 
107
137
  /**
108
138
  * Task priority level — defaults to 'medium' if not provided
109
139
  */
110
140
  priority?: 'low' | 'medium' | 'high';
111
141
 
142
+ /**
143
+ * Workspace identifier
144
+ */
145
+ workspaceId?: string;
146
+
147
+ /**
148
+ * Project identifier
149
+ */
150
+ projectId?: string;
151
+
112
152
  /**
113
153
  * Optional due date as ISO string
114
154
  */
@@ -143,6 +183,26 @@ export interface CreateTaskRequest {
143
183
  * Owner identifier — defaults based on context if not provided
144
184
  */
145
185
  ownerId?: string;
186
+
187
+ /**
188
+ * Whether this task requires review before completion
189
+ */
190
+ requireReview?: boolean;
191
+
192
+ /**
193
+ * IDs of tasks this task depends on
194
+ */
195
+ dependencies?: string[];
196
+
197
+ /**
198
+ * Task result output
199
+ */
200
+ result?: string;
201
+
202
+ /**
203
+ * Reason for task failure (when status is 'failed')
204
+ */
205
+ failureReason?: string;
146
206
  }
147
207
 
148
208
  /**
@@ -162,13 +222,23 @@ export interface UpdateTaskRequest {
162
222
  /**
163
223
  * Task status
164
224
  */
165
- status?: 'pending' | 'in_progress' | 'completed' | 'cancelled';
225
+ status?: 'pending' | 'in_progress' | 'review' | 'failed' | 'interrupted' | 'completed' | 'cancelled';
166
226
 
167
227
  /**
168
228
  * Task priority level
169
229
  */
170
230
  priority?: 'low' | 'medium' | 'high';
171
231
 
232
+ /**
233
+ * Workspace identifier
234
+ */
235
+ workspaceId?: string;
236
+
237
+ /**
238
+ * Project identifier
239
+ */
240
+ projectId?: string;
241
+
172
242
  /**
173
243
  * Optional due date as ISO string
174
244
  */
@@ -203,6 +273,26 @@ export interface UpdateTaskRequest {
203
273
  * Owner identifier
204
274
  */
205
275
  ownerId?: string;
276
+
277
+ /**
278
+ * Whether this task requires review before completion
279
+ */
280
+ requireReview?: boolean;
281
+
282
+ /**
283
+ * IDs of tasks this task depends on
284
+ */
285
+ dependencies?: string[];
286
+
287
+ /**
288
+ * Task result output
289
+ */
290
+ result?: string;
291
+
292
+ /**
293
+ * Reason for task failure (when status is 'failed')
294
+ */
295
+ failureReason?: string;
206
296
  }
207
297
 
208
298
  /**
@@ -234,6 +324,16 @@ export interface TaskListFilter {
234
324
  */
235
325
  priority?: string;
236
326
 
327
+ /**
328
+ * Filter by workspace ID
329
+ */
330
+ workspaceId?: string;
331
+
332
+ /**
333
+ * Filter by project ID
334
+ */
335
+ projectId?: string;
336
+
237
337
  /**
238
338
  * Filter by parent task ID
239
339
  */
@@ -0,0 +1,49 @@
1
+ /**
2
+ * TaskWorkItemProtocol
3
+ *
4
+ * Work item protocol for event-sourced task change tracking.
5
+ * Every status change or action on a TaskItem produces one TaskWorkItem.
6
+ */
7
+
8
+ export interface TaskWorkItem {
9
+ id: string;
10
+ taskId: string;
11
+ tenantId: string;
12
+ workspaceId?: string;
13
+ projectId?: string;
14
+ action: string;
15
+ actor: string;
16
+ threadId?: string;
17
+ summary?: string;
18
+ detail?: Record<string, unknown>;
19
+ attempt?: number;
20
+ createdAt: Date;
21
+ }
22
+
23
+ export interface CreateWorkItemRequest {
24
+ taskId: string;
25
+ tenantId: string;
26
+ workspaceId?: string;
27
+ projectId?: string;
28
+ action: string;
29
+ actor: string;
30
+ threadId?: string;
31
+ summary?: string;
32
+ detail?: Record<string, unknown>;
33
+ attempt?: number;
34
+ }
35
+
36
+ export interface TaskWorkItemListFilter {
37
+ tenantId: string;
38
+ taskId: string;
39
+ workspaceId?: string;
40
+ projectId?: string;
41
+ action?: string;
42
+ limit?: number;
43
+ offset?: number;
44
+ }
45
+
46
+ export interface TaskWorkItemStore {
47
+ create(params: CreateWorkItemRequest): Promise<TaskWorkItem>;
48
+ list(filter: TaskWorkItemListFilter): Promise<TaskWorkItem[]>;
49
+ }
package/src/index.ts CHANGED
@@ -13,6 +13,7 @@ export * from "./UILatticeProtocol";
13
13
  export * from "./QueueLatticeProtocol";
14
14
  export * from "./ScheduleLatticeProtocol";
15
15
  export * from "./EmbeddingsLatticeProtocol";
16
+ export * from "./STTModelLatticeProtocol";
16
17
  export * from "./VectorStoreLatticeProtocol";
17
18
  export * from "./LoggerLatticeProtocol";
18
19
  export * from "./MessageProtocol";
@@ -37,6 +38,7 @@ export * from "./VectorStoreProviderProtocol";
37
38
  export * from "./MenuProtocol";
38
39
  export * from "./EvalStoreProtocol";
39
40
  export * from "./TaskStoreProtocol";
41
+ export * from "./TaskWorkItemProtocol";
40
42
 
41
43
  export * from "./ChannelAdapterProtocol";
42
44
  export * from "./A2AProtocol";