@ai-setting/roy-agent-core 1.5.15-test → 1.5.17-beta.1
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/config/index.d.ts +1250 -0
- package/dist/config/index.js +32 -0
- package/dist/env/agent/index.d.ts +2279 -0
- package/dist/env/agent/index.js +24 -0
- package/dist/env/commands/index.d.ts +1131 -0
- package/dist/env/commands/index.js +14 -0
- package/dist/env/debug/formatters/index.d.ts +236 -0
- package/dist/env/debug/formatters/index.js +11 -0
- package/dist/env/debug/index.d.ts +1652 -0
- package/dist/env/debug/index.js +26 -0
- package/dist/env/hook/index.d.ts +279 -0
- package/dist/env/hook/index.js +29 -0
- package/dist/env/index.d.ts +3481 -0
- package/dist/env/index.js +82 -0
- package/dist/env/llm/index.d.ts +1760 -0
- package/dist/env/llm/index.js +40 -0
- package/dist/env/log-trace/index.d.ts +1574 -0
- package/dist/env/log-trace/index.js +83 -0
- package/dist/env/mcp/index.d.ts +1331 -0
- package/dist/env/mcp/index.js +39 -0
- package/dist/env/mcp/tool/index.d.ts +183 -0
- package/dist/env/mcp/tool/index.js +14 -0
- package/dist/env/memory/built-in/index.d.ts +232 -0
- package/dist/env/memory/built-in/index.js +11 -0
- package/dist/env/memory/index.d.ts +1799 -0
- package/dist/env/memory/index.js +56 -0
- package/dist/env/memory/plugin/index.d.ts +747 -0
- package/dist/env/memory/plugin/index.js +36 -0
- package/dist/env/prompt/index.d.ts +1164 -0
- package/dist/env/prompt/index.js +20 -0
- package/dist/env/session/index.d.ts +1908 -0
- package/dist/env/session/index.js +25 -0
- package/dist/env/session/storage/index.d.ts +564 -0
- package/dist/env/session/storage/index.js +18 -0
- package/dist/env/skill/index.d.ts +1266 -0
- package/dist/env/skill/index.js +34 -0
- package/dist/env/skill/tool/index.d.ts +193 -0
- package/dist/env/skill/tool/index.js +9 -0
- package/dist/env/task/delegate/index.d.ts +1612 -0
- package/dist/env/task/delegate/index.js +18 -0
- package/dist/env/task/events/index.d.ts +171 -0
- package/dist/env/task/events/index.js +7 -0
- package/dist/env/task/hooks/index.d.ts +624 -0
- package/dist/env/task/hooks/index.js +7 -0
- package/dist/env/task/index.d.ts +1553 -0
- package/dist/env/task/index.js +34 -0
- package/dist/env/task/plugins/index.d.ts +466 -0
- package/dist/env/task/plugins/index.js +23 -0
- package/dist/env/task/storage/index.d.ts +241 -0
- package/dist/env/task/storage/index.js +14 -0
- package/dist/env/task/tools/index.d.ts +1485 -0
- package/dist/env/task/tools/index.js +17 -0
- package/dist/env/task/tools/operation/index.d.ts +1484 -0
- package/dist/env/task/tools/operation/index.js +15 -0
- package/dist/env/tool/built-in/index.d.ts +218 -0
- package/dist/env/tool/built-in/index.js +25 -0
- package/dist/env/tool/index.d.ts +1396 -0
- package/dist/env/tool/index.js +39 -0
- package/dist/env/workflow/decorators/index.d.ts +2161 -0
- package/dist/env/workflow/decorators/index.js +27 -0
- package/dist/env/workflow/engine/index.d.ts +3453 -0
- package/dist/env/workflow/engine/index.js +28 -0
- package/dist/env/workflow/index.d.ts +3546 -0
- package/dist/env/workflow/index.js +136 -0
- package/dist/env/workflow/nodes/index.d.ts +2092 -0
- package/dist/env/workflow/nodes/index.js +19 -0
- package/dist/env/workflow/service/index.d.ts +227 -0
- package/dist/env/workflow/service/index.js +13 -0
- package/dist/env/workflow/storage/index.d.ts +165 -0
- package/dist/env/workflow/storage/index.js +27 -0
- package/dist/env/workflow/tools/index.d.ts +416 -0
- package/dist/env/workflow/tools/index.js +159 -0
- package/dist/env/workflow/types/index.d.ts +2255 -0
- package/dist/env/workflow/types/index.js +98 -0
- package/dist/env/workflow/utils/index.d.ts +2031 -0
- package/dist/env/workflow/utils/index.js +637 -0
- package/dist/index.d.ts +7858 -0
- package/dist/index.js +399 -0
- package/dist/shared/@ai-setting/roy-agent-core-0rtxwr28.js +258 -0
- package/dist/shared/@ai-setting/roy-agent-core-0vbdz0x7.js +36 -0
- package/dist/shared/@ai-setting/roy-agent-core-1akcqxj9.js +349 -0
- package/dist/shared/@ai-setting/roy-agent-core-1ce3fqrk.js +117 -0
- package/dist/shared/@ai-setting/roy-agent-core-2dhd60aw.js +11 -0
- package/dist/shared/@ai-setting/roy-agent-core-3jywqmdd.js +393 -0
- package/dist/shared/@ai-setting/roy-agent-core-3rr5k71j.js +200 -0
- package/dist/shared/@ai-setting/roy-agent-core-44hnfb02.js +299 -0
- package/dist/shared/@ai-setting/roy-agent-core-4t40mkpv.js +206 -0
- package/dist/shared/@ai-setting/roy-agent-core-4txzpsbt.js +393 -0
- package/dist/shared/@ai-setting/roy-agent-core-5x94xmt6.js +350 -0
- package/dist/shared/@ai-setting/roy-agent-core-69jskqjg.js +180 -0
- package/dist/shared/@ai-setting/roy-agent-core-6kvtahqv.js +408 -0
- package/dist/shared/@ai-setting/roy-agent-core-7fgf85wc.js +284 -0
- package/dist/shared/@ai-setting/roy-agent-core-81w1963m.js +762 -0
- package/dist/shared/@ai-setting/roy-agent-core-8gxth0eh.js +10 -0
- package/dist/shared/@ai-setting/roy-agent-core-92z6t4he.js +14 -0
- package/dist/shared/@ai-setting/roy-agent-core-93zfb3r1.js +922 -0
- package/dist/shared/@ai-setting/roy-agent-core-9yxb3ty9.js +15 -0
- package/dist/shared/@ai-setting/roy-agent-core-b0x5dda6.js +1130 -0
- package/dist/shared/@ai-setting/roy-agent-core-bcbqy27c.js +14 -0
- package/dist/shared/@ai-setting/roy-agent-core-bvr1761x.js +653 -0
- package/dist/shared/@ai-setting/roy-agent-core-ctdhjv68.js +93 -0
- package/dist/shared/@ai-setting/roy-agent-core-d7cyjkf7.js +872 -0
- package/dist/shared/@ai-setting/roy-agent-core-dh9d7a3m.js +11 -0
- package/dist/shared/@ai-setting/roy-agent-core-e25xkv53.js +64 -0
- package/dist/shared/@ai-setting/roy-agent-core-eajcvp4e.js +378 -0
- package/dist/shared/@ai-setting/roy-agent-core-f7q2x5z6.js +492 -0
- package/dist/shared/@ai-setting/roy-agent-core-fs0mn2jk.js +52 -0
- package/dist/shared/@ai-setting/roy-agent-core-g1s2h0e5.js +171 -0
- package/dist/shared/@ai-setting/roy-agent-core-g99pxzn5.js +862 -0
- package/dist/shared/@ai-setting/roy-agent-core-gbqcyegm.js +1387 -0
- package/dist/shared/@ai-setting/roy-agent-core-gjq1yk68.js +208 -0
- package/dist/shared/@ai-setting/roy-agent-core-gq20wsgv.js +139 -0
- package/dist/shared/@ai-setting/roy-agent-core-gwc4h96n.js +534 -0
- package/dist/shared/@ai-setting/roy-agent-core-jfh9q2qh.js +204 -0
- package/dist/shared/@ai-setting/roy-agent-core-jvatggbb.js +603 -0
- package/dist/shared/@ai-setting/roy-agent-core-kkbwepqb.js +97 -0
- package/dist/shared/@ai-setting/roy-agent-core-pjr12nnd.js +587 -0
- package/dist/shared/@ai-setting/roy-agent-core-psv4v63c.js +176 -0
- package/dist/shared/@ai-setting/roy-agent-core-psvxt4c9.js +60 -0
- package/dist/shared/@ai-setting/roy-agent-core-qqceba6k.js +442 -0
- package/dist/shared/@ai-setting/roy-agent-core-qxhq8ven.js +57 -0
- package/dist/shared/@ai-setting/roy-agent-core-qxnbvgwe.js +66 -0
- package/dist/shared/@ai-setting/roy-agent-core-r9ezzemr.js +10 -0
- package/dist/shared/@ai-setting/roy-agent-core-rhmtwnw1.js +267 -0
- package/dist/shared/@ai-setting/roy-agent-core-rvv6ydff.js +584 -0
- package/dist/shared/@ai-setting/roy-agent-core-rvxg1wps.js +102 -0
- package/dist/shared/@ai-setting/roy-agent-core-satmq6sh.js +549 -0
- package/dist/shared/@ai-setting/roy-agent-core-sx7wsvnn.js +15 -0
- package/dist/shared/@ai-setting/roy-agent-core-t94ktchq.js +213 -0
- package/dist/shared/@ai-setting/roy-agent-core-vf215qfv.js +812 -0
- package/dist/shared/@ai-setting/roy-agent-core-vkz81f7v.js +1316 -0
- package/dist/shared/@ai-setting/roy-agent-core-vn2bc59q.js +1205 -0
- package/dist/shared/@ai-setting/roy-agent-core-wa1kzqky.js +328 -0
- package/dist/shared/@ai-setting/roy-agent-core-wft9ra24.js +20 -0
- package/dist/shared/@ai-setting/roy-agent-core-wrcy0h6z.js +2098 -0
- package/dist/shared/@ai-setting/roy-agent-core-xq8hhqb8.js +419 -0
- package/dist/shared/@ai-setting/roy-agent-core-xs5rsgat.js +368 -0
- package/dist/shared/@ai-setting/roy-agent-core-zbkpc41z.js +377 -0
- package/dist/shared/@ai-setting/roy-agent-core-zgypchmt.js +172 -0
- package/dist/shared/@ai-setting/roy-agent-core-zpn0bqa8.js +103 -0
- package/package.json +29 -8
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SkillNode,
|
|
3
|
+
ToolNode,
|
|
4
|
+
WorkflowNode,
|
|
5
|
+
init_skill_node,
|
|
6
|
+
init_tool_node,
|
|
7
|
+
init_workflow_node
|
|
8
|
+
} from "../../../shared/@ai-setting/roy-agent-core-jvatggbb.js";
|
|
9
|
+
import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
10
|
+
|
|
11
|
+
// src/env/workflow/nodes/index.ts
|
|
12
|
+
init_tool_node();
|
|
13
|
+
init_skill_node();
|
|
14
|
+
init_workflow_node();
|
|
15
|
+
export {
|
|
16
|
+
WorkflowNode,
|
|
17
|
+
ToolNode,
|
|
18
|
+
SkillNode
|
|
19
|
+
};
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { z as z5 } from "zod";
|
|
2
|
+
import { z as z4 } from "zod";
|
|
3
|
+
declare const RunStatusSchema: unknown;
|
|
4
|
+
type RunStatus = z4.infer<typeof RunStatusSchema>;
|
|
5
|
+
interface RunOptions {
|
|
6
|
+
input?: Record<string, any>;
|
|
7
|
+
debug?: boolean;
|
|
8
|
+
parallelLimit?: number | null;
|
|
9
|
+
timeout?: number | null;
|
|
10
|
+
/** @deprecated No-op: workflow always waits for completion */
|
|
11
|
+
sync?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface RunResult {
|
|
14
|
+
runId: string;
|
|
15
|
+
/** Session ID (workflow_{runId} format) - useful for CLI resume */
|
|
16
|
+
sessionId?: string;
|
|
17
|
+
status: RunStatus;
|
|
18
|
+
output?: Record<string, any>;
|
|
19
|
+
error?: string;
|
|
20
|
+
durationMs?: number;
|
|
21
|
+
/** Pending node ID (when status is 'paused') */
|
|
22
|
+
pendingNodeId?: string;
|
|
23
|
+
/** Query from ask_user (when status is 'paused') */
|
|
24
|
+
query?: string;
|
|
25
|
+
/** Agent sub-session ID (for resuming agent nodes) */
|
|
26
|
+
agentSessionId?: string;
|
|
27
|
+
}
|
|
28
|
+
declare const NodeDefinitionSchema: unknown;
|
|
29
|
+
type NodeDefinition = z5.infer<typeof NodeDefinitionSchema>;
|
|
30
|
+
declare const WorkflowConfigSchema: unknown;
|
|
31
|
+
type WorkflowConfig = z5.infer<typeof WorkflowConfigSchema>;
|
|
32
|
+
declare const WorkflowMetadataSchema: unknown;
|
|
33
|
+
type WorkflowMetadata = z5.infer<typeof WorkflowMetadataSchema>;
|
|
34
|
+
declare const WorkflowDefinitionSchema: unknown;
|
|
35
|
+
type WorkflowDefinition = z5.infer<typeof WorkflowDefinitionSchema>;
|
|
36
|
+
interface Workflow {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
version: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
definition: WorkflowDefinition;
|
|
42
|
+
config: WorkflowConfig;
|
|
43
|
+
metadata: WorkflowMetadata;
|
|
44
|
+
tags: string[];
|
|
45
|
+
createdAt: Date;
|
|
46
|
+
updatedAt: Date;
|
|
47
|
+
}
|
|
48
|
+
interface WorkflowRepository {
|
|
49
|
+
create(workflow: Omit<Workflow, "id" | "createdAt" | "updatedAt">): Workflow;
|
|
50
|
+
getById(id: string): Workflow | null;
|
|
51
|
+
getByName(name: string): Workflow | null;
|
|
52
|
+
list(options?: ListOptions): Workflow[];
|
|
53
|
+
update(id: string, updates: Partial<Workflow>): Workflow | null;
|
|
54
|
+
delete(id: string): boolean;
|
|
55
|
+
}
|
|
56
|
+
interface CreateOptions {
|
|
57
|
+
tags?: string[];
|
|
58
|
+
metadata?: WorkflowMetadata;
|
|
59
|
+
taskId?: number;
|
|
60
|
+
force?: boolean;
|
|
61
|
+
}
|
|
62
|
+
interface ListOptions {
|
|
63
|
+
tag?: string;
|
|
64
|
+
taskId?: number;
|
|
65
|
+
search?: string;
|
|
66
|
+
limit?: number;
|
|
67
|
+
offset?: number;
|
|
68
|
+
}
|
|
69
|
+
interface WorkflowUpdates {
|
|
70
|
+
definition?: WorkflowDefinition;
|
|
71
|
+
config?: WorkflowConfig;
|
|
72
|
+
tags?: string[];
|
|
73
|
+
metadata?: WorkflowMetadata;
|
|
74
|
+
}
|
|
75
|
+
interface WorkflowEngine {
|
|
76
|
+
createSession(workflowId: string, options?: {
|
|
77
|
+
input?: Record<string, any>;
|
|
78
|
+
workflowName?: string;
|
|
79
|
+
workflowVersion?: string;
|
|
80
|
+
}): Promise<string>;
|
|
81
|
+
run(sessionId: string, options?: RunOptions): Promise<RunResult>;
|
|
82
|
+
runWorkflow(workflow: Workflow | WorkflowDefinition, options?: RunOptions): Promise<RunResult>;
|
|
83
|
+
stop(sessionId: string, reason?: string): Promise<void>;
|
|
84
|
+
addNode(sessionId: string, nodeDefinition: NodeDefinition): Promise<void>;
|
|
85
|
+
removeNode(sessionId: string, nodeId: string): Promise<void>;
|
|
86
|
+
}
|
|
87
|
+
type WorkflowEngineFactory = (workflow: Workflow, options?: RunOptions) => Pick<WorkflowEngine, "run" | "stop" | "runWorkflow">;
|
|
88
|
+
interface SessionInfo {
|
|
89
|
+
id: string;
|
|
90
|
+
title: string;
|
|
91
|
+
metadata: WorkflowSessionMetadata3;
|
|
92
|
+
createdAt: Date;
|
|
93
|
+
updatedAt: Date;
|
|
94
|
+
}
|
|
95
|
+
interface WorkflowSessionMetadata3 {
|
|
96
|
+
type: "workflow";
|
|
97
|
+
runId?: string;
|
|
98
|
+
workflowId?: string;
|
|
99
|
+
workflowName: string;
|
|
100
|
+
workflowVersion?: string;
|
|
101
|
+
status: "running" | "paused" | "completed" | "failed";
|
|
102
|
+
input?: any;
|
|
103
|
+
rootNodeId?: string;
|
|
104
|
+
agentSessions?: AgentSessionRef3[];
|
|
105
|
+
}
|
|
106
|
+
interface AgentSessionRef3 {
|
|
107
|
+
nodeId: string;
|
|
108
|
+
sessionId: string;
|
|
109
|
+
status: "active" | "paused" | "completed";
|
|
110
|
+
}
|
|
111
|
+
declare class WorkflowService {
|
|
112
|
+
private workflowRepository;
|
|
113
|
+
private engineFactory;
|
|
114
|
+
private sessionComponent?;
|
|
115
|
+
constructor(workflowRepository: WorkflowRepository, engineFactory: WorkflowEngineFactory, sessionComponent?: {
|
|
116
|
+
create(options: {
|
|
117
|
+
id?: string;
|
|
118
|
+
title: string;
|
|
119
|
+
metadata: any;
|
|
120
|
+
}): Promise<{
|
|
121
|
+
id: string;
|
|
122
|
+
}>;
|
|
123
|
+
get(id: string): Promise<SessionInfo | null | undefined>;
|
|
124
|
+
list?(options?: {
|
|
125
|
+
limit?: number;
|
|
126
|
+
offset?: number;
|
|
127
|
+
}): Promise<SessionInfo[]>;
|
|
128
|
+
update(id: string, updates: {
|
|
129
|
+
metadata?: any;
|
|
130
|
+
}): Promise<boolean>;
|
|
131
|
+
addMessage(sessionId: string, message: any): Promise<string>;
|
|
132
|
+
getMessages(sessionId: string): Promise<any[]>;
|
|
133
|
+
} | undefined);
|
|
134
|
+
/**
|
|
135
|
+
* Create a new workflow from definition
|
|
136
|
+
*/
|
|
137
|
+
createWorkflow(definition: WorkflowDefinition, options?: CreateOptions): Promise<Workflow>;
|
|
138
|
+
/**
|
|
139
|
+
* Get workflow by id or name
|
|
140
|
+
*/
|
|
141
|
+
getWorkflow(idOrName: string): Workflow | null;
|
|
142
|
+
/**
|
|
143
|
+
* Get workflow by id
|
|
144
|
+
*/
|
|
145
|
+
getWorkflowById(id: string): Workflow | null;
|
|
146
|
+
/**
|
|
147
|
+
* Get workflow by name
|
|
148
|
+
*/
|
|
149
|
+
getWorkflowByName(name: string): Workflow | null;
|
|
150
|
+
/**
|
|
151
|
+
* List workflows with optional filters
|
|
152
|
+
*/
|
|
153
|
+
listWorkflows(options?: ListOptions): Workflow[];
|
|
154
|
+
/**
|
|
155
|
+
* Update an existing workflow
|
|
156
|
+
*/
|
|
157
|
+
updateWorkflow(idOrName: string, updates: WorkflowUpdates, options?: {
|
|
158
|
+
tags?: string[];
|
|
159
|
+
}): Promise<Workflow>;
|
|
160
|
+
/**
|
|
161
|
+
* Delete a workflow by name or id
|
|
162
|
+
*/
|
|
163
|
+
deleteWorkflow(idOrName: string): Promise<boolean>;
|
|
164
|
+
/**
|
|
165
|
+
* Run a workflow by definition or name
|
|
166
|
+
*
|
|
167
|
+
* This creates a Session that represents the workflow run.
|
|
168
|
+
* The Session ID is used as the run identifier for pause/resume.
|
|
169
|
+
*/
|
|
170
|
+
runWorkflow(idOrNameOrDefinition: string | WorkflowDefinition, input?: Record<string, any>, options?: RunOptions): Promise<RunResult>;
|
|
171
|
+
/**
|
|
172
|
+
* Run workflow by name (convenience method)
|
|
173
|
+
*/
|
|
174
|
+
runWorkflowByName(name: string, input?: Record<string, any>, options?: RunOptions): Promise<RunResult>;
|
|
175
|
+
/**
|
|
176
|
+
* Stop a running workflow session
|
|
177
|
+
*/
|
|
178
|
+
stopRun(sessionId: string, reason?: string): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Get workflow session by ID
|
|
181
|
+
*/
|
|
182
|
+
getSession(sessionId: string): Promise<SessionInfo | null>;
|
|
183
|
+
/**
|
|
184
|
+
* List workflow sessions
|
|
185
|
+
*/
|
|
186
|
+
listSessions(options?: {
|
|
187
|
+
limit?: number;
|
|
188
|
+
offset?: number;
|
|
189
|
+
}): Promise<SessionInfo[]>;
|
|
190
|
+
/**
|
|
191
|
+
* Get messages from a workflow session
|
|
192
|
+
*/
|
|
193
|
+
getSessionMessages(sessionId: string): Promise<any[]>;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Singleton registry for WorkflowService
|
|
197
|
+
* Provides centralized access to the workflow service instance
|
|
198
|
+
*/
|
|
199
|
+
declare class WorkflowServiceRegistry {
|
|
200
|
+
private static instance;
|
|
201
|
+
private service;
|
|
202
|
+
private constructor();
|
|
203
|
+
/**
|
|
204
|
+
* Get the singleton registry instance
|
|
205
|
+
*/
|
|
206
|
+
static getInstance(): WorkflowServiceRegistry;
|
|
207
|
+
/**
|
|
208
|
+
* Register a WorkflowService instance
|
|
209
|
+
*/
|
|
210
|
+
register(service: WorkflowService): void;
|
|
211
|
+
/**
|
|
212
|
+
* Get the registered WorkflowService instance
|
|
213
|
+
* @throws Error if no service is registered
|
|
214
|
+
*/
|
|
215
|
+
get(): WorkflowService;
|
|
216
|
+
/**
|
|
217
|
+
* Check if a service is registered
|
|
218
|
+
*/
|
|
219
|
+
isRegistered(): boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Reset the registry (primarily for testing)
|
|
222
|
+
*/
|
|
223
|
+
reset(): void;
|
|
224
|
+
}
|
|
225
|
+
declare function getWorkflowService(): WorkflowService;
|
|
226
|
+
declare function registerWorkflowService(service: WorkflowService): void;
|
|
227
|
+
export { registerWorkflowService, getWorkflowService, WorkflowUpdates, WorkflowSessionMetadata3 as WorkflowSessionMetadata, WorkflowServiceRegistry, WorkflowService, WorkflowRepository, WorkflowEngineFactory, WorkflowEngine, WorkflowDefinition, SessionInfo, ListOptions, CreateOptions, AgentSessionRef3 as AgentSessionRef };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WorkflowService,
|
|
3
|
+
WorkflowServiceRegistry,
|
|
4
|
+
getWorkflowService,
|
|
5
|
+
registerWorkflowService
|
|
6
|
+
} from "../../../shared/@ai-setting/roy-agent-core-4t40mkpv.js";
|
|
7
|
+
import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
8
|
+
export {
|
|
9
|
+
registerWorkflowService,
|
|
10
|
+
getWorkflowService,
|
|
11
|
+
WorkflowServiceRegistry,
|
|
12
|
+
WorkflowService
|
|
13
|
+
};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { z as z5 } from "zod";
|
|
2
|
+
declare const WorkflowConfigSchema: unknown;
|
|
3
|
+
type WorkflowConfig = z5.infer<typeof WorkflowConfigSchema>;
|
|
4
|
+
declare const WorkflowMetadataSchema: unknown;
|
|
5
|
+
type WorkflowMetadata = z5.infer<typeof WorkflowMetadataSchema>;
|
|
6
|
+
declare const WorkflowDefinitionSchema: unknown;
|
|
7
|
+
type WorkflowDefinition = z5.infer<typeof WorkflowDefinitionSchema>;
|
|
8
|
+
interface Workflow {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
version: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
definition: WorkflowDefinition;
|
|
14
|
+
config: WorkflowConfig;
|
|
15
|
+
metadata: WorkflowMetadata;
|
|
16
|
+
tags: string[];
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the database file path
|
|
22
|
+
* Default: ~/.local/share/roy-agent/workflows.db
|
|
23
|
+
*/
|
|
24
|
+
declare function getDatabasePath(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Get the singleton database instance
|
|
27
|
+
* @param path - Optional custom database path. If not provided, uses default path.
|
|
28
|
+
* Use ':memory:' for in-memory database (testing)
|
|
29
|
+
*/
|
|
30
|
+
declare function getDatabase(path?: string): any;
|
|
31
|
+
/**
|
|
32
|
+
* Close the database connection
|
|
33
|
+
*/
|
|
34
|
+
declare function closeDatabase(): void;
|
|
35
|
+
type BunDatabase = {
|
|
36
|
+
exec(sql: string): void;
|
|
37
|
+
query<T>(sql: string): {
|
|
38
|
+
all(): T[];
|
|
39
|
+
get(...params: any[]): T | null;
|
|
40
|
+
};
|
|
41
|
+
run(sql: string, ...params: any[]): {
|
|
42
|
+
lastInsertRowid: number;
|
|
43
|
+
changes: number;
|
|
44
|
+
};
|
|
45
|
+
close(): void;
|
|
46
|
+
pragma?: (sql: string) => void;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Initialize all required tables
|
|
50
|
+
*
|
|
51
|
+
* Note: Only workflows table is created. Workflow runs are managed via SessionComponent
|
|
52
|
+
* using the session/message storage, following the session-based design.
|
|
53
|
+
*/
|
|
54
|
+
declare function initializeTables(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Reset the database instance (for testing purposes)
|
|
57
|
+
* This is useful for tests that need a fresh database
|
|
58
|
+
*/
|
|
59
|
+
declare function resetDatabase(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Initialize tables and return a ready database
|
|
62
|
+
* This is a convenience function that combines getDatabase and initializeTables
|
|
63
|
+
*/
|
|
64
|
+
declare function initDatabase(path?: string): any;
|
|
65
|
+
interface WorkflowRow {
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
version: string;
|
|
69
|
+
description: string | null;
|
|
70
|
+
definition: string;
|
|
71
|
+
config: string;
|
|
72
|
+
metadata: string;
|
|
73
|
+
tags: string;
|
|
74
|
+
task_id: number | null;
|
|
75
|
+
created_at: string;
|
|
76
|
+
updated_at: string;
|
|
77
|
+
}
|
|
78
|
+
interface ListWorkflowsOptions {
|
|
79
|
+
limit?: number;
|
|
80
|
+
offset?: number;
|
|
81
|
+
orderBy?: "name" | "created_at" | "updated_at";
|
|
82
|
+
order?: "asc" | "desc";
|
|
83
|
+
tag?: string;
|
|
84
|
+
taskId?: number;
|
|
85
|
+
search?: string;
|
|
86
|
+
}
|
|
87
|
+
interface UpdateWorkflowOptions {
|
|
88
|
+
name?: string;
|
|
89
|
+
version?: string;
|
|
90
|
+
description?: string;
|
|
91
|
+
definition?: WorkflowDefinition;
|
|
92
|
+
config?: WorkflowConfig;
|
|
93
|
+
metadata?: WorkflowMetadata;
|
|
94
|
+
tags?: string[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Row to Workflow conversion helper
|
|
98
|
+
*/
|
|
99
|
+
declare function rowToWorkflow(row: WorkflowRow): Workflow;
|
|
100
|
+
/**
|
|
101
|
+
* WorkflowRepository class
|
|
102
|
+
*
|
|
103
|
+
* Provides CRUD operations for workflows in SQLite.
|
|
104
|
+
*/
|
|
105
|
+
declare class WorkflowRepository {
|
|
106
|
+
private db;
|
|
107
|
+
constructor(db?: ReturnType<typeof getDatabase>);
|
|
108
|
+
/**
|
|
109
|
+
* Create a new workflow
|
|
110
|
+
*/
|
|
111
|
+
create(workflow: Omit<Workflow, "id" | "createdAt" | "updatedAt">): Workflow;
|
|
112
|
+
/**
|
|
113
|
+
* Create a workflow from definition only
|
|
114
|
+
*/
|
|
115
|
+
createFromDefinition(definition: WorkflowDefinition, options?: {
|
|
116
|
+
config?: WorkflowConfig;
|
|
117
|
+
metadata?: WorkflowMetadata;
|
|
118
|
+
tags?: string[];
|
|
119
|
+
}): Workflow;
|
|
120
|
+
/**
|
|
121
|
+
* Get a workflow by ID
|
|
122
|
+
*/
|
|
123
|
+
getById(id: string): Workflow | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Get a workflow by name (returns latest version)
|
|
126
|
+
*/
|
|
127
|
+
getByName(name: string): Workflow | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Get a specific version of a workflow by name
|
|
130
|
+
*/
|
|
131
|
+
getByNameAndVersion(name: string, version: string): Workflow | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* List workflows with optional filtering and pagination
|
|
134
|
+
*/
|
|
135
|
+
list(options?: ListWorkflowsOptions): Workflow[];
|
|
136
|
+
/**
|
|
137
|
+
* List all versions of a workflow by name
|
|
138
|
+
*/
|
|
139
|
+
listVersions(name: string): Workflow[];
|
|
140
|
+
/**
|
|
141
|
+
* Update a workflow
|
|
142
|
+
*/
|
|
143
|
+
update(id: string, updates: UpdateWorkflowOptions): Workflow | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* Delete a workflow
|
|
146
|
+
*/
|
|
147
|
+
delete(id: string): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Check if a workflow exists
|
|
150
|
+
*/
|
|
151
|
+
exists(id: string): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Check if a workflow with name and version exists
|
|
154
|
+
*/
|
|
155
|
+
existsByNameAndVersion(name: string, version: string): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Get total count of workflows
|
|
158
|
+
*/
|
|
159
|
+
count(): number;
|
|
160
|
+
/**
|
|
161
|
+
* Search workflows by name (partial match)
|
|
162
|
+
*/
|
|
163
|
+
search(query: string, limit?: number): Workflow[];
|
|
164
|
+
}
|
|
165
|
+
export { rowToWorkflow, resetDatabase, initializeTables, initDatabase, getDatabasePath, getDatabase, closeDatabase, WorkflowRow, WorkflowRepository, UpdateWorkflowOptions, ListWorkflowsOptions, BunDatabase };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WorkflowRepository,
|
|
3
|
+
rowToWorkflow
|
|
4
|
+
} from "../../../shared/@ai-setting/roy-agent-core-3rr5k71j.js";
|
|
5
|
+
import {
|
|
6
|
+
closeDatabase,
|
|
7
|
+
getDatabase,
|
|
8
|
+
getDatabasePath,
|
|
9
|
+
initDatabase,
|
|
10
|
+
initializeTables,
|
|
11
|
+
resetDatabase
|
|
12
|
+
} from "../../../shared/@ai-setting/roy-agent-core-zpn0bqa8.js";
|
|
13
|
+
import"../../../shared/@ai-setting/roy-agent-core-rvxg1wps.js";
|
|
14
|
+
import"../../../shared/@ai-setting/roy-agent-core-44hnfb02.js";
|
|
15
|
+
import"../../../shared/@ai-setting/roy-agent-core-xs5rsgat.js";
|
|
16
|
+
import"../../../shared/@ai-setting/roy-agent-core-psv4v63c.js";
|
|
17
|
+
import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
18
|
+
export {
|
|
19
|
+
rowToWorkflow,
|
|
20
|
+
resetDatabase,
|
|
21
|
+
initializeTables,
|
|
22
|
+
initDatabase,
|
|
23
|
+
getDatabasePath,
|
|
24
|
+
getDatabase,
|
|
25
|
+
closeDatabase,
|
|
26
|
+
WorkflowRepository
|
|
27
|
+
};
|