@defai.digital/agent-domain 13.0.3
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/LICENSE +214 -0
- package/dist/enhanced-executor.d.ts +170 -0
- package/dist/enhanced-executor.d.ts.map +1 -0
- package/dist/enhanced-executor.js +1072 -0
- package/dist/enhanced-executor.js.map +1 -0
- package/dist/executor.d.ts +120 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +929 -0
- package/dist/executor.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/loader.d.ts +50 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +160 -0
- package/dist/loader.js.map +1 -0
- package/dist/persistent-registry.d.ts +105 -0
- package/dist/persistent-registry.d.ts.map +1 -0
- package/dist/persistent-registry.js +183 -0
- package/dist/persistent-registry.js.map +1 -0
- package/dist/production-factories.d.ts +70 -0
- package/dist/production-factories.d.ts.map +1 -0
- package/dist/production-factories.js +434 -0
- package/dist/production-factories.js.map +1 -0
- package/dist/prompt-executor.d.ts +119 -0
- package/dist/prompt-executor.d.ts.map +1 -0
- package/dist/prompt-executor.js +211 -0
- package/dist/prompt-executor.js.map +1 -0
- package/dist/registry.d.ts +57 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +123 -0
- package/dist/registry.js.map +1 -0
- package/dist/selection-service.d.ts +74 -0
- package/dist/selection-service.d.ts.map +1 -0
- package/dist/selection-service.js +322 -0
- package/dist/selection-service.js.map +1 -0
- package/dist/selector.d.ts +51 -0
- package/dist/selector.d.ts.map +1 -0
- package/dist/selector.js +249 -0
- package/dist/selector.js.map +1 -0
- package/dist/stub-checkpoint.d.ts +23 -0
- package/dist/stub-checkpoint.d.ts.map +1 -0
- package/dist/stub-checkpoint.js +137 -0
- package/dist/stub-checkpoint.js.map +1 -0
- package/dist/stub-delegation-tracker.d.ts +25 -0
- package/dist/stub-delegation-tracker.d.ts.map +1 -0
- package/dist/stub-delegation-tracker.js +118 -0
- package/dist/stub-delegation-tracker.js.map +1 -0
- package/dist/stub-parallel-executor.d.ts +19 -0
- package/dist/stub-parallel-executor.d.ts.map +1 -0
- package/dist/stub-parallel-executor.js +176 -0
- package/dist/stub-parallel-executor.js.map +1 -0
- package/dist/types.d.ts +614 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +15 -0
- package/dist/types.js.map +1 -0
- package/dist/workflow-templates.d.ts +117 -0
- package/dist/workflow-templates.d.ts.map +1 -0
- package/dist/workflow-templates.js +342 -0
- package/dist/workflow-templates.js.map +1 -0
- package/package.json +51 -0
- package/src/enhanced-executor.ts +1395 -0
- package/src/executor.ts +1153 -0
- package/src/index.ts +172 -0
- package/src/loader.ts +191 -0
- package/src/persistent-registry.ts +235 -0
- package/src/production-factories.ts +613 -0
- package/src/prompt-executor.ts +310 -0
- package/src/registry.ts +167 -0
- package/src/selection-service.ts +411 -0
- package/src/selector.ts +299 -0
- package/src/stub-checkpoint.ts +187 -0
- package/src/stub-delegation-tracker.ts +161 -0
- package/src/stub-parallel-executor.ts +224 -0
- package/src/types.ts +784 -0
- package/src/workflow-templates.ts +393 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stub Checkpoint Implementation
|
|
3
|
+
*
|
|
4
|
+
* Provides minimal checkpoint storage and manager for when no real
|
|
5
|
+
* implementation is provided via AgentDomainConfig factories.
|
|
6
|
+
*
|
|
7
|
+
* Uses in-memory storage (data lost between invocations).
|
|
8
|
+
* For production use, provide real implementations via config.
|
|
9
|
+
*/
|
|
10
|
+
import type { CheckpointStorageFactory, CheckpointManagerFactory } from './types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Stub checkpoint storage factory
|
|
13
|
+
*/
|
|
14
|
+
export declare const stubCheckpointStorageFactory: CheckpointStorageFactory;
|
|
15
|
+
/**
|
|
16
|
+
* Stub checkpoint manager factory
|
|
17
|
+
*/
|
|
18
|
+
export declare const stubCheckpointManagerFactory: CheckpointManagerFactory;
|
|
19
|
+
/**
|
|
20
|
+
* Reset the warning flag (for testing)
|
|
21
|
+
*/
|
|
22
|
+
export declare function resetCheckpointStubWarning(): void;
|
|
23
|
+
//# sourceMappingURL=stub-checkpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stub-checkpoint.d.ts","sourceRoot":"","sources":["../src/stub-checkpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAIV,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,YAAY,CAAC;AA0IpB;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,wBAS1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,wBAO1C,CAAC;AAEF;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stub Checkpoint Implementation
|
|
3
|
+
*
|
|
4
|
+
* Provides minimal checkpoint storage and manager for when no real
|
|
5
|
+
* implementation is provided via AgentDomainConfig factories.
|
|
6
|
+
*
|
|
7
|
+
* Uses in-memory storage (data lost between invocations).
|
|
8
|
+
* For production use, provide real implementations via config.
|
|
9
|
+
*/
|
|
10
|
+
let _warnedOnce = false;
|
|
11
|
+
/**
|
|
12
|
+
* In-memory checkpoint storage (stub)
|
|
13
|
+
*/
|
|
14
|
+
function createInMemoryCheckpointStorage() {
|
|
15
|
+
const checkpoints = new Map();
|
|
16
|
+
return {
|
|
17
|
+
async save(checkpoint) {
|
|
18
|
+
checkpoints.set(checkpoint.checkpointId, { ...checkpoint });
|
|
19
|
+
},
|
|
20
|
+
async load(checkpointId) {
|
|
21
|
+
return checkpoints.get(checkpointId) ?? null;
|
|
22
|
+
},
|
|
23
|
+
async loadLatest(agentId, sessionId) {
|
|
24
|
+
let latest = null;
|
|
25
|
+
let latestTime = 0;
|
|
26
|
+
for (const cp of checkpoints.values()) {
|
|
27
|
+
if (cp.agentId !== agentId)
|
|
28
|
+
continue;
|
|
29
|
+
if (sessionId !== undefined && cp.sessionId !== sessionId)
|
|
30
|
+
continue;
|
|
31
|
+
const time = new Date(cp.createdAt).getTime();
|
|
32
|
+
if (time > latestTime) {
|
|
33
|
+
latestTime = time;
|
|
34
|
+
latest = cp;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return latest;
|
|
38
|
+
},
|
|
39
|
+
async list(agentId, sessionId) {
|
|
40
|
+
const results = [];
|
|
41
|
+
for (const cp of checkpoints.values()) {
|
|
42
|
+
if (cp.agentId !== agentId)
|
|
43
|
+
continue;
|
|
44
|
+
if (sessionId !== undefined && cp.sessionId !== sessionId)
|
|
45
|
+
continue;
|
|
46
|
+
results.push({ ...cp });
|
|
47
|
+
}
|
|
48
|
+
return results.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
|
|
49
|
+
},
|
|
50
|
+
async delete(checkpointId) {
|
|
51
|
+
return checkpoints.delete(checkpointId);
|
|
52
|
+
},
|
|
53
|
+
async deleteExpired() {
|
|
54
|
+
const now = Date.now();
|
|
55
|
+
let count = 0;
|
|
56
|
+
for (const [id, cp] of checkpoints.entries()) {
|
|
57
|
+
if (cp.expiresAt && new Date(cp.expiresAt).getTime() < now) {
|
|
58
|
+
checkpoints.delete(id);
|
|
59
|
+
count++;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return count;
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Creates a stub checkpoint manager
|
|
68
|
+
*/
|
|
69
|
+
function createStubCheckpointManager(agentId, sessionId, storage, config) {
|
|
70
|
+
return {
|
|
71
|
+
getConfig() {
|
|
72
|
+
return { ...config };
|
|
73
|
+
},
|
|
74
|
+
shouldCheckpoint(stepIndex) {
|
|
75
|
+
if (!config.enabled)
|
|
76
|
+
return false;
|
|
77
|
+
return (stepIndex + 1) % config.intervalSteps === 0;
|
|
78
|
+
},
|
|
79
|
+
async createCheckpoint(stepIndex, stepId, previousOutputs, metadata) {
|
|
80
|
+
const now = new Date();
|
|
81
|
+
const checkpoint = {
|
|
82
|
+
checkpointId: crypto.randomUUID(),
|
|
83
|
+
agentId,
|
|
84
|
+
sessionId,
|
|
85
|
+
stepIndex,
|
|
86
|
+
stepId,
|
|
87
|
+
previousOutputs: { ...previousOutputs },
|
|
88
|
+
metadata,
|
|
89
|
+
createdAt: now.toISOString(),
|
|
90
|
+
expiresAt: config.retentionHours
|
|
91
|
+
? new Date(now.getTime() + config.retentionHours * 3600 * 1000).toISOString()
|
|
92
|
+
: undefined,
|
|
93
|
+
};
|
|
94
|
+
await storage.save(checkpoint);
|
|
95
|
+
return checkpoint;
|
|
96
|
+
},
|
|
97
|
+
async getLatestCheckpoint() {
|
|
98
|
+
return storage.loadLatest(agentId, sessionId);
|
|
99
|
+
},
|
|
100
|
+
async getResumeContext(checkpointId) {
|
|
101
|
+
const checkpoint = await storage.load(checkpointId);
|
|
102
|
+
if (!checkpoint)
|
|
103
|
+
return null;
|
|
104
|
+
return {
|
|
105
|
+
startFromStep: checkpoint.stepIndex + 1,
|
|
106
|
+
previousOutputs: { ...checkpoint.previousOutputs },
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
async cleanup() {
|
|
110
|
+
return storage.deleteExpired();
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Stub checkpoint storage factory
|
|
116
|
+
*/
|
|
117
|
+
export const stubCheckpointStorageFactory = () => {
|
|
118
|
+
if (!_warnedOnce) {
|
|
119
|
+
console.warn('[agent-domain] Using stub checkpoint storage. ' +
|
|
120
|
+
'For persistent checkpoints, provide checkpointStorageFactory in config.');
|
|
121
|
+
_warnedOnce = true;
|
|
122
|
+
}
|
|
123
|
+
return createInMemoryCheckpointStorage();
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Stub checkpoint manager factory
|
|
127
|
+
*/
|
|
128
|
+
export const stubCheckpointManagerFactory = (agentId, sessionId, storage, config) => {
|
|
129
|
+
return createStubCheckpointManager(agentId, sessionId, storage, config);
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Reset the warning flag (for testing)
|
|
133
|
+
*/
|
|
134
|
+
export function resetCheckpointStubWarning() {
|
|
135
|
+
_warnedOnce = false;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=stub-checkpoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stub-checkpoint.js","sourceRoot":"","sources":["../src/stub-checkpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB;;GAEG;AACH,SAAS,+BAA+B;IACtC,MAAM,WAAW,GAAG,IAAI,GAAG,EAAsB,CAAC;IAElD,OAAO;QACL,KAAK,CAAC,IAAI,CAAC,UAAsB;YAC/B,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,YAAY,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC;QAC9D,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,YAAoB;YAC7B,OAAO,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC;QAC/C,CAAC;QAED,KAAK,CAAC,UAAU,CAAC,OAAe,EAAE,SAAkB;YAClD,IAAI,MAAM,GAAsB,IAAI,CAAC;YACrC,IAAI,UAAU,GAAG,CAAC,CAAC;YAEnB,KAAK,MAAM,EAAE,IAAI,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC;gBACtC,IAAI,EAAE,CAAC,OAAO,KAAK,OAAO;oBAAE,SAAS;gBACrC,IAAI,SAAS,KAAK,SAAS,IAAI,EAAE,CAAC,SAAS,KAAK,SAAS;oBAAE,SAAS;gBAEpE,MAAM,IAAI,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,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAChD,CAAC;QAED,KAAK,CAAC,gBAAgB,CAAC,YAAoB;YAIzC,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACpD,IAAI,CAAC,UAAU;gBAAE,OAAO,IAAI,CAAC;YAE7B,OAAO;gBACL,aAAa,EAAE,UAAU,CAAC,SAAS,GAAG,CAAC;gBACvC,eAAe,EAAE,EAAE,GAAG,UAAU,CAAC,eAAe,EAAE;aACnD,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,OAAO;YACX,OAAO,OAAO,CAAC,aAAa,EAAE,CAAC;QACjC,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAA6B,GAAG,EAAE;IACzE,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CACV,gDAAgD;YAChD,yEAAyE,CAC1E,CAAC;QACF,WAAW,GAAG,IAAI,CAAC;IACrB,CAAC;IACD,OAAO,+BAA+B,EAAE,CAAC;AAC3C,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAA6B,CACpE,OAAe,EACf,SAA6B,EAC7B,OAA8B,EAC9B,MAAwB,EACxB,EAAE;IACF,OAAO,2BAA2B,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,0BAA0B;IACxC,WAAW,GAAG,KAAK,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stub Delegation Tracker Implementation
|
|
3
|
+
*
|
|
4
|
+
* Provides a minimal delegation tracker for when no real implementation
|
|
5
|
+
* is provided via AgentDomainConfig.delegationTrackerFactory.
|
|
6
|
+
*
|
|
7
|
+
* This stub:
|
|
8
|
+
* - Logs a warning on first use
|
|
9
|
+
* - Allows delegations within depth limits
|
|
10
|
+
* - Tracks basic context and history
|
|
11
|
+
*
|
|
12
|
+
* For production use, provide a real implementation via config.
|
|
13
|
+
*/
|
|
14
|
+
import type { DelegationTrackerFactory } from './types.js';
|
|
15
|
+
/**
|
|
16
|
+
* Stub delegation tracker factory
|
|
17
|
+
*
|
|
18
|
+
* Use this as a fallback when no factory is provided in config.
|
|
19
|
+
*/
|
|
20
|
+
export declare const stubDelegationTrackerFactory: DelegationTrackerFactory;
|
|
21
|
+
/**
|
|
22
|
+
* Reset the warning flag (for testing)
|
|
23
|
+
*/
|
|
24
|
+
export declare function resetStubWarning(): void;
|
|
25
|
+
//# sourceMappingURL=stub-delegation-tracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stub-delegation-tracker.d.ts","sourceRoot":"","sources":["../src/stub-delegation-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAYH,OAAO,KAAK,EAAyB,wBAAwB,EAAE,MAAM,YAAY,CAAC;AA2HlF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,wBACd,CAAC;AAE9B;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stub Delegation Tracker Implementation
|
|
3
|
+
*
|
|
4
|
+
* Provides a minimal delegation tracker for when no real implementation
|
|
5
|
+
* is provided via AgentDomainConfig.delegationTrackerFactory.
|
|
6
|
+
*
|
|
7
|
+
* This stub:
|
|
8
|
+
* - Logs a warning on first use
|
|
9
|
+
* - Allows delegations within depth limits
|
|
10
|
+
* - Tracks basic context and history
|
|
11
|
+
*
|
|
12
|
+
* For production use, provide a real implementation via config.
|
|
13
|
+
*/
|
|
14
|
+
import { createRootDelegationContext, DelegationErrorCodes, } from '@defai.digital/contracts';
|
|
15
|
+
let _warnedOnce = false;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a stub delegation tracker
|
|
18
|
+
*
|
|
19
|
+
* This is used when no delegationTrackerFactory is provided in config.
|
|
20
|
+
* It provides basic functionality but logs a warning.
|
|
21
|
+
*/
|
|
22
|
+
function createStubDelegationTracker(agentId, parentContext, maxDepth) {
|
|
23
|
+
// Warn once about stub usage
|
|
24
|
+
if (!_warnedOnce) {
|
|
25
|
+
console.warn('[agent-domain] Using stub delegation tracker. ' +
|
|
26
|
+
'For full delegation support, provide delegationTrackerFactory in AgentDomainConfig.');
|
|
27
|
+
_warnedOnce = true;
|
|
28
|
+
}
|
|
29
|
+
// Initialize context
|
|
30
|
+
let context;
|
|
31
|
+
if (parentContext) {
|
|
32
|
+
// Create child context
|
|
33
|
+
context = {
|
|
34
|
+
...parentContext,
|
|
35
|
+
currentDepth: parentContext.currentDepth + 1,
|
|
36
|
+
delegationChain: [...parentContext.delegationChain, agentId],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
// Create root context
|
|
41
|
+
context = createRootDelegationContext(agentId, crypto.randomUUID(), maxDepth);
|
|
42
|
+
}
|
|
43
|
+
const delegationHistory = [];
|
|
44
|
+
return {
|
|
45
|
+
getContext() {
|
|
46
|
+
return { ...context };
|
|
47
|
+
},
|
|
48
|
+
canDelegate(toAgentId) {
|
|
49
|
+
// INV-DT-001: Check depth limit
|
|
50
|
+
if (context.currentDepth >= context.maxDepth) {
|
|
51
|
+
return {
|
|
52
|
+
allowed: false,
|
|
53
|
+
reason: DelegationErrorCodes.MAX_DEPTH_EXCEEDED,
|
|
54
|
+
message: `Maximum delegation depth ${context.maxDepth} reached`,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
// INV-DT-002: Check for circular delegation
|
|
58
|
+
if (context.delegationChain.includes(toAgentId)) {
|
|
59
|
+
return {
|
|
60
|
+
allowed: false,
|
|
61
|
+
reason: DelegationErrorCodes.CIRCULAR_DELEGATION,
|
|
62
|
+
message: `Cannot delegate to ${toAgentId} - already in delegation chain`,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
allowed: true,
|
|
67
|
+
reason: 'ALLOWED',
|
|
68
|
+
message: `Delegation to ${toAgentId} is allowed`,
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
createDelegationRequest(toAgentId, task, input, timeout) {
|
|
72
|
+
const checkResult = this.canDelegate(toAgentId);
|
|
73
|
+
if (!checkResult.allowed) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
fromAgentId: agentId,
|
|
78
|
+
toAgentId,
|
|
79
|
+
task,
|
|
80
|
+
input,
|
|
81
|
+
timeout,
|
|
82
|
+
context,
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
createChildContext(toAgentId) {
|
|
86
|
+
return {
|
|
87
|
+
...context,
|
|
88
|
+
currentDepth: context.currentDepth + 1,
|
|
89
|
+
delegationChain: [...context.delegationChain, toAgentId],
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
recordResult(result) {
|
|
93
|
+
delegationHistory.push(result);
|
|
94
|
+
},
|
|
95
|
+
getHistory() {
|
|
96
|
+
return [...delegationHistory];
|
|
97
|
+
},
|
|
98
|
+
isRoot() {
|
|
99
|
+
return context.currentDepth === 0;
|
|
100
|
+
},
|
|
101
|
+
getRemainingDepth() {
|
|
102
|
+
return context.maxDepth - context.currentDepth;
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Stub delegation tracker factory
|
|
108
|
+
*
|
|
109
|
+
* Use this as a fallback when no factory is provided in config.
|
|
110
|
+
*/
|
|
111
|
+
export const stubDelegationTrackerFactory = createStubDelegationTracker;
|
|
112
|
+
/**
|
|
113
|
+
* Reset the warning flag (for testing)
|
|
114
|
+
*/
|
|
115
|
+
export function resetStubWarning() {
|
|
116
|
+
_warnedOnce = false;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=stub-delegation-tracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stub-delegation-tracker.js","sourceRoot":"","sources":["../src/stub-delegation-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAGlC,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB;;;;;GAKG;AACH,SAAS,2BAA2B,CAClC,OAAe,EACf,aAA4C,EAC5C,QAAgB;IAEhB,6BAA6B;IAC7B,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CACV,gDAAgD;YAChD,qFAAqF,CACtF,CAAC;QACF,WAAW,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,qBAAqB;IACrB,IAAI,OAA0B,CAAC;IAE/B,IAAI,aAAa,EAAE,CAAC;QAClB,uBAAuB;QACvB,OAAO,GAAG;YACR,GAAG,aAAa;YAChB,YAAY,EAAE,aAAa,CAAC,YAAY,GAAG,CAAC;YAC5C,eAAe,EAAE,CAAC,GAAG,aAAa,CAAC,eAAe,EAAE,OAAO,CAAC;SAC7D,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,sBAAsB;QACtB,OAAO,GAAG,2BAA2B,CACnC,OAAO,EACP,MAAM,CAAC,UAAU,EAAE,EACnB,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,MAAM,iBAAiB,GAAuB,EAAE,CAAC;IAEjD,OAAO;QACL,UAAU;YACR,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;QACxB,CAAC;QAED,WAAW,CAAC,SAAiB;YAC3B,gCAAgC;YAChC,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;gBAC7C,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,MAAM,EAAE,oBAAoB,CAAC,kBAAkB;oBAC/C,OAAO,EAAE,4BAA4B,OAAO,CAAC,QAAQ,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CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GACvC,2BAA2B,CAAC;AAE9B;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC9B,WAAW,GAAG,KAAK,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stub Parallel Executor Implementation
|
|
3
|
+
*
|
|
4
|
+
* Provides minimal parallel execution for when no real implementation
|
|
5
|
+
* is provided via AgentDomainConfig factories.
|
|
6
|
+
*
|
|
7
|
+
* This stub executes steps sequentially (not actually in parallel).
|
|
8
|
+
* For real parallel execution, provide parallelExecutorFactory in config.
|
|
9
|
+
*/
|
|
10
|
+
import type { ParallelExecutorFactory } from './types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Stub parallel executor factory
|
|
13
|
+
*/
|
|
14
|
+
export declare const stubParallelExecutorFactory: ParallelExecutorFactory;
|
|
15
|
+
/**
|
|
16
|
+
* Reset the warning flag (for testing)
|
|
17
|
+
*/
|
|
18
|
+
export declare function resetParallelStubWarning(): void;
|
|
19
|
+
//# sourceMappingURL=stub-parallel-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stub-parallel-executor.d.ts","sourceRoot":"","sources":["../src/stub-parallel-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,KAAK,EAKV,uBAAuB,EACxB,MAAM,YAAY,CAAC;AA6LpB;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,uBAEzC,CAAC;AAEF;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAE/C"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stub Parallel Executor Implementation
|
|
3
|
+
*
|
|
4
|
+
* Provides minimal parallel execution for when no real implementation
|
|
5
|
+
* is provided via AgentDomainConfig factories.
|
|
6
|
+
*
|
|
7
|
+
* This stub executes steps sequentially (not actually in parallel).
|
|
8
|
+
* For real parallel execution, provide parallelExecutorFactory in config.
|
|
9
|
+
*/
|
|
10
|
+
import { createDefaultParallelExecutionConfig, TIMEOUT_ORCHESTRATION_EXECUTION, } from '@defai.digital/contracts';
|
|
11
|
+
let _warnedOnce = false;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a stub parallel executor that executes steps sequentially
|
|
14
|
+
*/
|
|
15
|
+
function createStubParallelExecutor(config = {}) {
|
|
16
|
+
if (!_warnedOnce) {
|
|
17
|
+
console.warn('[agent-domain] Using stub parallel executor (sequential execution). ' +
|
|
18
|
+
'For real parallel execution, provide parallelExecutorFactory in config.');
|
|
19
|
+
_warnedOnce = true;
|
|
20
|
+
}
|
|
21
|
+
const cfg = { ...createDefaultParallelExecutionConfig(), ...config };
|
|
22
|
+
let cancelled = false;
|
|
23
|
+
return {
|
|
24
|
+
getConfig() {
|
|
25
|
+
return { ...cfg };
|
|
26
|
+
},
|
|
27
|
+
async executeGroup(steps, executor, previousOutputs = {}) {
|
|
28
|
+
const startTime = Date.now();
|
|
29
|
+
const stepResults = [];
|
|
30
|
+
const outputs = { ...previousOutputs };
|
|
31
|
+
let failedCount = 0;
|
|
32
|
+
let cancelledCount = 0;
|
|
33
|
+
// Build execution layers (respecting dependencies)
|
|
34
|
+
const layers = this.buildExecutionLayers(steps);
|
|
35
|
+
// Execute layers sequentially (stub doesn't do real parallelism)
|
|
36
|
+
for (const layer of layers) {
|
|
37
|
+
if (cancelled) {
|
|
38
|
+
// Mark remaining steps as cancelled
|
|
39
|
+
for (const step of layer) {
|
|
40
|
+
stepResults.push({
|
|
41
|
+
stepId: step.stepId,
|
|
42
|
+
success: false,
|
|
43
|
+
cancelled: true,
|
|
44
|
+
durationMs: 0,
|
|
45
|
+
});
|
|
46
|
+
cancelledCount++;
|
|
47
|
+
}
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
// Execute steps in layer sequentially
|
|
51
|
+
for (const step of layer) {
|
|
52
|
+
if (cancelled) {
|
|
53
|
+
stepResults.push({
|
|
54
|
+
stepId: step.stepId,
|
|
55
|
+
success: false,
|
|
56
|
+
cancelled: true,
|
|
57
|
+
durationMs: 0,
|
|
58
|
+
});
|
|
59
|
+
cancelledCount++;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const stepStart = Date.now();
|
|
63
|
+
// Create cancellable timeout to prevent timer leaks
|
|
64
|
+
let timeoutId;
|
|
65
|
+
const stepTimeoutMs = cfg.groupTimeoutMs ?? TIMEOUT_ORCHESTRATION_EXECUTION;
|
|
66
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
67
|
+
timeoutId = setTimeout(() => { reject(new Error('Step timed out')); }, stepTimeoutMs);
|
|
68
|
+
});
|
|
69
|
+
try {
|
|
70
|
+
const output = await Promise.race([
|
|
71
|
+
executor(step, outputs),
|
|
72
|
+
timeoutPromise,
|
|
73
|
+
]);
|
|
74
|
+
// Clean up timeout
|
|
75
|
+
if (timeoutId !== undefined) {
|
|
76
|
+
clearTimeout(timeoutId);
|
|
77
|
+
}
|
|
78
|
+
outputs[step.stepId] = output;
|
|
79
|
+
stepResults.push({
|
|
80
|
+
stepId: step.stepId,
|
|
81
|
+
success: true,
|
|
82
|
+
output,
|
|
83
|
+
durationMs: Date.now() - stepStart,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
// Clean up timeout on error too
|
|
88
|
+
if (timeoutId !== undefined) {
|
|
89
|
+
clearTimeout(timeoutId);
|
|
90
|
+
}
|
|
91
|
+
const result = {
|
|
92
|
+
stepId: step.stepId,
|
|
93
|
+
success: false,
|
|
94
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
95
|
+
durationMs: Date.now() - stepStart,
|
|
96
|
+
};
|
|
97
|
+
stepResults.push(result);
|
|
98
|
+
failedCount++;
|
|
99
|
+
// If step is critical (not parallel) and failFast strategy, stop execution
|
|
100
|
+
if (!step.parallel && cfg.failureStrategy === 'failFast') {
|
|
101
|
+
cancelled = true;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
stepResults,
|
|
108
|
+
totalDurationMs: Date.now() - startTime,
|
|
109
|
+
allSucceeded: failedCount === 0 && cancelledCount === 0,
|
|
110
|
+
failedCount,
|
|
111
|
+
cancelledCount,
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
buildExecutionLayers(steps) {
|
|
115
|
+
// Simple topological sort based on dependencies
|
|
116
|
+
const layers = [];
|
|
117
|
+
const completed = new Set();
|
|
118
|
+
const remaining = [...steps];
|
|
119
|
+
// Guard against infinite loops with max iteration limit
|
|
120
|
+
const maxIterations = steps.length + 1;
|
|
121
|
+
let iterations = 0;
|
|
122
|
+
while (remaining.length > 0 && iterations < maxIterations) {
|
|
123
|
+
iterations++;
|
|
124
|
+
// Find steps with all dependencies satisfied
|
|
125
|
+
const ready = [];
|
|
126
|
+
const stillWaiting = [];
|
|
127
|
+
for (const step of remaining) {
|
|
128
|
+
const deps = step.dependencies ?? [];
|
|
129
|
+
if (deps.every((dep) => completed.has(dep))) {
|
|
130
|
+
ready.push(step);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
stillWaiting.push(step);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (ready.length === 0 && stillWaiting.length > 0) {
|
|
137
|
+
// Circular dependency or missing dependency - execute remaining steps
|
|
138
|
+
const unresolvableSteps = stillWaiting.map((s) => s.stepId).join(', ');
|
|
139
|
+
console.warn(`[buildExecutionLayers] Circular or unresolvable dependencies detected. ` +
|
|
140
|
+
`Unresolvable steps: ${unresolvableSteps}`);
|
|
141
|
+
layers.push(stillWaiting);
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
if (ready.length > 0) {
|
|
145
|
+
layers.push(ready);
|
|
146
|
+
for (const step of ready) {
|
|
147
|
+
completed.add(step.stepId);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
remaining.length = 0;
|
|
151
|
+
remaining.push(...stillWaiting);
|
|
152
|
+
}
|
|
153
|
+
if (iterations >= maxIterations) {
|
|
154
|
+
console.error(`[buildExecutionLayers] Max iterations (${maxIterations}) reached. ` +
|
|
155
|
+
`This indicates a bug in the algorithm or malformed input.`);
|
|
156
|
+
}
|
|
157
|
+
return layers;
|
|
158
|
+
},
|
|
159
|
+
cancel() {
|
|
160
|
+
cancelled = true;
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Stub parallel executor factory
|
|
166
|
+
*/
|
|
167
|
+
export const stubParallelExecutorFactory = (config) => {
|
|
168
|
+
return createStubParallelExecutor(config);
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Reset the warning flag (for testing)
|
|
172
|
+
*/
|
|
173
|
+
export function resetParallelStubWarning() {
|
|
174
|
+
_warnedOnce = false;
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=stub-parallel-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stub-parallel-executor.js","sourceRoot":"","sources":["../src/stub-parallel-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEL,oCAAoC,EAEpC,+BAA+B,GAChC,MAAM,0BAA0B,CAAC;AASlC,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB;;GAEG;AACH,SAAS,0BAA0B,CACjC,SAA2C,EAAE;IAE7C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CACV,sEAAsE;YACtE,yEAAyE,CAC1E,CAAC;QACF,WAAW,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,MAAM,GAAG,GAAG,EAAE,GAAG,oCAAoC,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC;IACrE,IAAI,SAAS,GAAG,KAAK,CAAC;IAEtB,OAAO;QACL,SAAS;YACP,OAAO,E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