@lov3kaizen/agentsea-crews 1.0.1 → 1.1.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/README.md +56 -0
- package/dist/Crew-BnvVjN7A.d.mts +1060 -0
- package/dist/Crew-BnvVjN7A.d.ts +1060 -0
- package/dist/DebugMode-CbYgA7Yw.d.mts +190 -0
- package/dist/DebugMode-o5e9gmQ7.d.ts +190 -0
- package/dist/{chunk-TFB7N65B.mjs → chunk-3NMVWRVW.mjs} +1 -1
- package/dist/{chunk-QMK3HWFX.mjs → chunk-J5KQSOGT.mjs} +306 -61
- package/dist/index.d.mts +975 -0
- package/dist/index.d.ts +975 -0
- package/dist/index.js +335 -96
- package/dist/index.mjs +26 -25
- package/dist/nestjs/index.d.mts +98 -0
- package/dist/nestjs/index.d.ts +98 -0
- package/dist/nestjs/index.js +305 -66
- package/dist/nestjs/index.mjs +1 -1
- package/dist/templates/index.d.mts +78 -0
- package/dist/templates/index.d.ts +78 -0
- package/dist/templates/index.js +305 -66
- package/dist/templates/index.mjs +2 -2
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
createResearchCrewConfig,
|
|
18
18
|
createWritingCrew,
|
|
19
19
|
createWritingCrewConfig
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-3NMVWRVW.mjs";
|
|
21
21
|
import {
|
|
22
22
|
AgentCapabilities,
|
|
23
23
|
AgentRegistry,
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
createCollaborationManager,
|
|
45
45
|
createConflictResolver,
|
|
46
46
|
createConsensusStrategy,
|
|
47
|
+
createCoreExecutor,
|
|
47
48
|
createCrew,
|
|
48
49
|
createCrewAgent,
|
|
49
50
|
createDelegationCoordinator,
|
|
@@ -53,8 +54,9 @@ import {
|
|
|
53
54
|
createRoundRobinStrategy,
|
|
54
55
|
createStrategy,
|
|
55
56
|
createTask,
|
|
56
|
-
createTaskQueue
|
|
57
|
-
|
|
57
|
+
createTaskQueue,
|
|
58
|
+
nanoid
|
|
59
|
+
} from "./chunk-J5KQSOGT.mjs";
|
|
58
60
|
|
|
59
61
|
// src/types/role.types.ts
|
|
60
62
|
var PROFICIENCY_WEIGHTS = {
|
|
@@ -73,7 +75,6 @@ var PRIORITY_WEIGHTS = {
|
|
|
73
75
|
};
|
|
74
76
|
|
|
75
77
|
// src/workflows/WorkflowBuilder.ts
|
|
76
|
-
import { nanoid } from "nanoid";
|
|
77
78
|
var BranchBuilder = class {
|
|
78
79
|
parent;
|
|
79
80
|
condition;
|
|
@@ -397,7 +398,6 @@ function workflow(name) {
|
|
|
397
398
|
}
|
|
398
399
|
|
|
399
400
|
// src/workflows/DAGExecutor.ts
|
|
400
|
-
import { nanoid as nanoid2 } from "nanoid";
|
|
401
401
|
var DAGExecutor = class {
|
|
402
402
|
dag;
|
|
403
403
|
_handlers;
|
|
@@ -828,24 +828,27 @@ var DAGExecutor = class {
|
|
|
828
828
|
}
|
|
829
829
|
};
|
|
830
830
|
function createDAGFromSteps(steps, _handlers) {
|
|
831
|
-
const
|
|
832
|
-
const
|
|
831
|
+
const nodeIds = steps.map(() => nanoid());
|
|
832
|
+
const nameToId = /* @__PURE__ */ new Map();
|
|
833
833
|
for (let i = 0; i < steps.length; i++) {
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
834
|
+
nameToId.set(steps[i].name, nodeIds[i]);
|
|
835
|
+
}
|
|
836
|
+
const nodes = steps.map((step, i) => {
|
|
837
|
+
let dependencies;
|
|
838
|
+
if (step.dependsOn && step.dependsOn.length > 0) {
|
|
839
|
+
dependencies = step.dependsOn.map((name) => nameToId.get(name)).filter((id) => id !== void 0);
|
|
840
|
+
} else {
|
|
841
|
+
dependencies = i > 0 ? [nodeIds[i - 1]] : [];
|
|
842
|
+
}
|
|
843
|
+
return {
|
|
844
|
+
id: nodeIds[i],
|
|
838
845
|
name: step.name,
|
|
839
846
|
stepConfig: step,
|
|
840
|
-
dependencies
|
|
841
|
-
// Sequential by default
|
|
847
|
+
dependencies
|
|
842
848
|
};
|
|
843
|
-
|
|
844
|
-
previousNodeIds.length = 0;
|
|
845
|
-
previousNodeIds.push(nodeId);
|
|
846
|
-
}
|
|
849
|
+
});
|
|
847
850
|
return {
|
|
848
|
-
id:
|
|
851
|
+
id: nanoid(),
|
|
849
852
|
nodes,
|
|
850
853
|
edges: []
|
|
851
854
|
};
|
|
@@ -1059,7 +1062,6 @@ function createParallelExecutor(options) {
|
|
|
1059
1062
|
}
|
|
1060
1063
|
|
|
1061
1064
|
// src/workflows/Checkpointing.ts
|
|
1062
|
-
import { nanoid as nanoid3 } from "nanoid";
|
|
1063
1065
|
var InMemoryCheckpointStorage = class {
|
|
1064
1066
|
checkpoints = /* @__PURE__ */ new Map();
|
|
1065
1067
|
save(checkpoint) {
|
|
@@ -1113,7 +1115,7 @@ var CheckpointManager = class {
|
|
|
1113
1115
|
*/
|
|
1114
1116
|
async save(workflowId, state) {
|
|
1115
1117
|
const checkpoint = {
|
|
1116
|
-
id:
|
|
1118
|
+
id: nanoid(),
|
|
1117
1119
|
workflowId,
|
|
1118
1120
|
timestamp: /* @__PURE__ */ new Date(),
|
|
1119
1121
|
stepIndex: state.currentStepIndex,
|
|
@@ -1638,7 +1640,6 @@ function createSharedMemory(config) {
|
|
|
1638
1640
|
}
|
|
1639
1641
|
|
|
1640
1642
|
// src/memory/ConversationHistory.ts
|
|
1641
|
-
import { nanoid as nanoid4 } from "nanoid";
|
|
1642
1643
|
var ConversationHistory = class {
|
|
1643
1644
|
agentMessages = /* @__PURE__ */ new Map();
|
|
1644
1645
|
threads = /* @__PURE__ */ new Map();
|
|
@@ -1660,7 +1661,7 @@ var ConversationHistory = class {
|
|
|
1660
1661
|
addMessage(agentName, message) {
|
|
1661
1662
|
const fullMessage = {
|
|
1662
1663
|
...message,
|
|
1663
|
-
id:
|
|
1664
|
+
id: nanoid(),
|
|
1664
1665
|
agentName,
|
|
1665
1666
|
timestamp: /* @__PURE__ */ new Date(),
|
|
1666
1667
|
threadId: this.currentThreadId
|
|
@@ -1807,7 +1808,7 @@ var ConversationHistory = class {
|
|
|
1807
1808
|
*/
|
|
1808
1809
|
createThread(title, participants = []) {
|
|
1809
1810
|
const thread = {
|
|
1810
|
-
id:
|
|
1811
|
+
id: nanoid(),
|
|
1811
1812
|
title,
|
|
1812
1813
|
participants,
|
|
1813
1814
|
messages: [],
|
|
@@ -2002,7 +2003,6 @@ function createConversationHistory(config) {
|
|
|
2002
2003
|
}
|
|
2003
2004
|
|
|
2004
2005
|
// src/memory/KnowledgeBase.ts
|
|
2005
|
-
import { nanoid as nanoid5 } from "nanoid";
|
|
2006
2006
|
var KnowledgeBase = class {
|
|
2007
2007
|
items = /* @__PURE__ */ new Map();
|
|
2008
2008
|
tagIndex = /* @__PURE__ */ new Map();
|
|
@@ -2041,7 +2041,7 @@ var KnowledgeBase = class {
|
|
|
2041
2041
|
}
|
|
2042
2042
|
const fullItem = {
|
|
2043
2043
|
...item,
|
|
2044
|
-
id:
|
|
2044
|
+
id: nanoid(),
|
|
2045
2045
|
created: /* @__PURE__ */ new Date(),
|
|
2046
2046
|
updated: /* @__PURE__ */ new Date(),
|
|
2047
2047
|
accessCount: 0
|
|
@@ -2501,6 +2501,7 @@ export {
|
|
|
2501
2501
|
createConflictResolver,
|
|
2502
2502
|
createConsensusStrategy,
|
|
2503
2503
|
createConversationHistory,
|
|
2504
|
+
createCoreExecutor,
|
|
2504
2505
|
createCrew,
|
|
2505
2506
|
createCrewAgent,
|
|
2506
2507
|
createCustomerSupportCrew,
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { DynamicModule, Type, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
|
|
2
|
+
import { e as CrewConfig, D as DelegationStrategyType, a as Crew, f as CrewExecutionOptions, g as CrewResult, b as CrewEvent, R as RoleConfig, d as TaskConfig } from '../Crew-BnvVjN7A.mjs';
|
|
3
|
+
import { C as CrewDashboard, D as DebugMode } from '../DebugMode-CbYgA7Yw.mjs';
|
|
4
|
+
import 'eventemitter3';
|
|
5
|
+
|
|
6
|
+
interface CrewsModuleOptions {
|
|
7
|
+
crews?: CrewConfig[];
|
|
8
|
+
defaultStrategy?: DelegationStrategyType;
|
|
9
|
+
enableMonitoring?: boolean;
|
|
10
|
+
enableDebug?: boolean;
|
|
11
|
+
global?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface CrewsModuleAsyncOptions {
|
|
14
|
+
imports?: Type<unknown>[];
|
|
15
|
+
useFactory?: (...args: unknown[]) => Promise<CrewsModuleOptions> | CrewsModuleOptions;
|
|
16
|
+
inject?: unknown[];
|
|
17
|
+
global?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare const CREWS_MODULE_OPTIONS = "CREWS_MODULE_OPTIONS";
|
|
20
|
+
declare const CREWS_SERVICE = "CREWS_SERVICE";
|
|
21
|
+
declare class CrewsModule {
|
|
22
|
+
static forRoot(options?: CrewsModuleOptions): DynamicModule;
|
|
23
|
+
static forRootAsync(options: CrewsModuleAsyncOptions): DynamicModule;
|
|
24
|
+
static forFeature(crews: CrewConfig[]): DynamicModule;
|
|
25
|
+
private static createProviders;
|
|
26
|
+
private static createAsyncProviders;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface ManagedCrew {
|
|
30
|
+
crew: Crew;
|
|
31
|
+
dashboard?: CrewDashboard;
|
|
32
|
+
debugMode?: DebugMode;
|
|
33
|
+
}
|
|
34
|
+
declare class CrewsService implements OnModuleInit, OnModuleDestroy {
|
|
35
|
+
private readonly crews;
|
|
36
|
+
private readonly options;
|
|
37
|
+
constructor(options?: CrewsModuleOptions);
|
|
38
|
+
onModuleInit(): Promise<void>;
|
|
39
|
+
onModuleDestroy(): Promise<void>;
|
|
40
|
+
registerCrew(config: CrewConfig): Promise<Crew>;
|
|
41
|
+
unregisterCrew(name: string): boolean;
|
|
42
|
+
getCrew(name: string): Crew | undefined;
|
|
43
|
+
getCrewNames(): string[];
|
|
44
|
+
hasCrew(name: string): boolean;
|
|
45
|
+
runCrew(name: string, options?: CrewExecutionOptions): Promise<CrewResult>;
|
|
46
|
+
runCrewStream(name: string, options?: CrewExecutionOptions): AsyncGenerator<CrewEvent>;
|
|
47
|
+
runCrewWithCallback(name: string, onEvent: (event: CrewEvent) => void, options?: CrewExecutionOptions): Promise<CrewResult>;
|
|
48
|
+
pauseCrew(name: string): void;
|
|
49
|
+
resumeCrew(name: string): void;
|
|
50
|
+
abortCrew(name: string): void;
|
|
51
|
+
getDashboard(name: string): CrewDashboard | undefined;
|
|
52
|
+
getDebugMode(name: string): DebugMode | undefined;
|
|
53
|
+
getCrewStatus(name: string): ReturnType<Crew['getStatus']> | undefined;
|
|
54
|
+
getCrewMetrics(name: string): ReturnType<Crew['getMetrics']> | undefined;
|
|
55
|
+
getAllStatus(): Map<string, ReturnType<Crew['getStatus']>>;
|
|
56
|
+
healthCheck(): Promise<{
|
|
57
|
+
healthy: boolean;
|
|
58
|
+
crews: Array<{
|
|
59
|
+
name: string;
|
|
60
|
+
status: string;
|
|
61
|
+
healthy: boolean;
|
|
62
|
+
}>;
|
|
63
|
+
}>;
|
|
64
|
+
}
|
|
65
|
+
declare function createCrewsService(options?: CrewsModuleOptions): CrewsService;
|
|
66
|
+
|
|
67
|
+
declare function CrewDef(config: Partial<CrewConfig>): ClassDecorator;
|
|
68
|
+
declare function RoleDef(config: RoleConfig): PropertyDecorator;
|
|
69
|
+
declare function TaskDef(config: Partial<TaskConfig>): MethodDecorator;
|
|
70
|
+
declare function OnCrewEvent(eventType: string): MethodDecorator;
|
|
71
|
+
declare function InjectCrew(name?: string): ParameterDecorator;
|
|
72
|
+
declare function getCrewMetadata(target: Function): Partial<CrewConfig> | undefined;
|
|
73
|
+
declare function getRoleMetadata(target: Function): Array<{
|
|
74
|
+
propertyKey: string | symbol;
|
|
75
|
+
config: RoleConfig;
|
|
76
|
+
}>;
|
|
77
|
+
declare function getTaskMetadata(target: Function): Array<{
|
|
78
|
+
methodKey: string | symbol;
|
|
79
|
+
config: Partial<TaskConfig>;
|
|
80
|
+
handler: Function;
|
|
81
|
+
}>;
|
|
82
|
+
declare function getEventHandlerMetadata(target: Function): Array<{
|
|
83
|
+
eventType: string;
|
|
84
|
+
methodKey: string | symbol;
|
|
85
|
+
handler: Function;
|
|
86
|
+
}>;
|
|
87
|
+
declare function getInjectCrewMetadata(target: Function): Array<{
|
|
88
|
+
index: number;
|
|
89
|
+
name?: string;
|
|
90
|
+
}>;
|
|
91
|
+
declare function RequireCapability(...capabilities: string[]): PropertyDecorator;
|
|
92
|
+
declare function Priority(priority: 'critical' | 'high' | 'medium' | 'low'): MethodDecorator;
|
|
93
|
+
declare function Timeout(ms: number): MethodDecorator;
|
|
94
|
+
declare function Retry(maxRetries: number): MethodDecorator;
|
|
95
|
+
declare function DependsOn(...taskNames: string[]): MethodDecorator;
|
|
96
|
+
declare function AssignTo(agentName: string): MethodDecorator;
|
|
97
|
+
|
|
98
|
+
export { AssignTo, CREWS_MODULE_OPTIONS, CREWS_SERVICE, CrewDef, CrewsModule, type CrewsModuleAsyncOptions, type CrewsModuleOptions, CrewsService, DependsOn, InjectCrew, type ManagedCrew, OnCrewEvent, Priority, RequireCapability, Retry, RoleDef, TaskDef, Timeout, createCrewsService, getCrewMetadata, getEventHandlerMetadata, getInjectCrewMetadata, getRoleMetadata, getTaskMetadata };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { DynamicModule, Type, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
|
|
2
|
+
import { e as CrewConfig, D as DelegationStrategyType, a as Crew, f as CrewExecutionOptions, g as CrewResult, b as CrewEvent, R as RoleConfig, d as TaskConfig } from '../Crew-BnvVjN7A.js';
|
|
3
|
+
import { C as CrewDashboard, D as DebugMode } from '../DebugMode-o5e9gmQ7.js';
|
|
4
|
+
import 'eventemitter3';
|
|
5
|
+
|
|
6
|
+
interface CrewsModuleOptions {
|
|
7
|
+
crews?: CrewConfig[];
|
|
8
|
+
defaultStrategy?: DelegationStrategyType;
|
|
9
|
+
enableMonitoring?: boolean;
|
|
10
|
+
enableDebug?: boolean;
|
|
11
|
+
global?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface CrewsModuleAsyncOptions {
|
|
14
|
+
imports?: Type<unknown>[];
|
|
15
|
+
useFactory?: (...args: unknown[]) => Promise<CrewsModuleOptions> | CrewsModuleOptions;
|
|
16
|
+
inject?: unknown[];
|
|
17
|
+
global?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare const CREWS_MODULE_OPTIONS = "CREWS_MODULE_OPTIONS";
|
|
20
|
+
declare const CREWS_SERVICE = "CREWS_SERVICE";
|
|
21
|
+
declare class CrewsModule {
|
|
22
|
+
static forRoot(options?: CrewsModuleOptions): DynamicModule;
|
|
23
|
+
static forRootAsync(options: CrewsModuleAsyncOptions): DynamicModule;
|
|
24
|
+
static forFeature(crews: CrewConfig[]): DynamicModule;
|
|
25
|
+
private static createProviders;
|
|
26
|
+
private static createAsyncProviders;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface ManagedCrew {
|
|
30
|
+
crew: Crew;
|
|
31
|
+
dashboard?: CrewDashboard;
|
|
32
|
+
debugMode?: DebugMode;
|
|
33
|
+
}
|
|
34
|
+
declare class CrewsService implements OnModuleInit, OnModuleDestroy {
|
|
35
|
+
private readonly crews;
|
|
36
|
+
private readonly options;
|
|
37
|
+
constructor(options?: CrewsModuleOptions);
|
|
38
|
+
onModuleInit(): Promise<void>;
|
|
39
|
+
onModuleDestroy(): Promise<void>;
|
|
40
|
+
registerCrew(config: CrewConfig): Promise<Crew>;
|
|
41
|
+
unregisterCrew(name: string): boolean;
|
|
42
|
+
getCrew(name: string): Crew | undefined;
|
|
43
|
+
getCrewNames(): string[];
|
|
44
|
+
hasCrew(name: string): boolean;
|
|
45
|
+
runCrew(name: string, options?: CrewExecutionOptions): Promise<CrewResult>;
|
|
46
|
+
runCrewStream(name: string, options?: CrewExecutionOptions): AsyncGenerator<CrewEvent>;
|
|
47
|
+
runCrewWithCallback(name: string, onEvent: (event: CrewEvent) => void, options?: CrewExecutionOptions): Promise<CrewResult>;
|
|
48
|
+
pauseCrew(name: string): void;
|
|
49
|
+
resumeCrew(name: string): void;
|
|
50
|
+
abortCrew(name: string): void;
|
|
51
|
+
getDashboard(name: string): CrewDashboard | undefined;
|
|
52
|
+
getDebugMode(name: string): DebugMode | undefined;
|
|
53
|
+
getCrewStatus(name: string): ReturnType<Crew['getStatus']> | undefined;
|
|
54
|
+
getCrewMetrics(name: string): ReturnType<Crew['getMetrics']> | undefined;
|
|
55
|
+
getAllStatus(): Map<string, ReturnType<Crew['getStatus']>>;
|
|
56
|
+
healthCheck(): Promise<{
|
|
57
|
+
healthy: boolean;
|
|
58
|
+
crews: Array<{
|
|
59
|
+
name: string;
|
|
60
|
+
status: string;
|
|
61
|
+
healthy: boolean;
|
|
62
|
+
}>;
|
|
63
|
+
}>;
|
|
64
|
+
}
|
|
65
|
+
declare function createCrewsService(options?: CrewsModuleOptions): CrewsService;
|
|
66
|
+
|
|
67
|
+
declare function CrewDef(config: Partial<CrewConfig>): ClassDecorator;
|
|
68
|
+
declare function RoleDef(config: RoleConfig): PropertyDecorator;
|
|
69
|
+
declare function TaskDef(config: Partial<TaskConfig>): MethodDecorator;
|
|
70
|
+
declare function OnCrewEvent(eventType: string): MethodDecorator;
|
|
71
|
+
declare function InjectCrew(name?: string): ParameterDecorator;
|
|
72
|
+
declare function getCrewMetadata(target: Function): Partial<CrewConfig> | undefined;
|
|
73
|
+
declare function getRoleMetadata(target: Function): Array<{
|
|
74
|
+
propertyKey: string | symbol;
|
|
75
|
+
config: RoleConfig;
|
|
76
|
+
}>;
|
|
77
|
+
declare function getTaskMetadata(target: Function): Array<{
|
|
78
|
+
methodKey: string | symbol;
|
|
79
|
+
config: Partial<TaskConfig>;
|
|
80
|
+
handler: Function;
|
|
81
|
+
}>;
|
|
82
|
+
declare function getEventHandlerMetadata(target: Function): Array<{
|
|
83
|
+
eventType: string;
|
|
84
|
+
methodKey: string | symbol;
|
|
85
|
+
handler: Function;
|
|
86
|
+
}>;
|
|
87
|
+
declare function getInjectCrewMetadata(target: Function): Array<{
|
|
88
|
+
index: number;
|
|
89
|
+
name?: string;
|
|
90
|
+
}>;
|
|
91
|
+
declare function RequireCapability(...capabilities: string[]): PropertyDecorator;
|
|
92
|
+
declare function Priority(priority: 'critical' | 'high' | 'medium' | 'low'): MethodDecorator;
|
|
93
|
+
declare function Timeout(ms: number): MethodDecorator;
|
|
94
|
+
declare function Retry(maxRetries: number): MethodDecorator;
|
|
95
|
+
declare function DependsOn(...taskNames: string[]): MethodDecorator;
|
|
96
|
+
declare function AssignTo(agentName: string): MethodDecorator;
|
|
97
|
+
|
|
98
|
+
export { AssignTo, CREWS_MODULE_OPTIONS, CREWS_SERVICE, CrewDef, CrewsModule, type CrewsModuleAsyncOptions, type CrewsModuleOptions, CrewsService, DependsOn, InjectCrew, type ManagedCrew, OnCrewEvent, Priority, RequireCapability, Retry, RoleDef, TaskDef, Timeout, createCrewsService, getCrewMetadata, getEventHandlerMetadata, getInjectCrewMetadata, getRoleMetadata, getTaskMetadata };
|