@librechat/agents 3.6.3 → 3.6.5
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/cjs/graphs/Graph.cjs +44 -19
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/hooks/HookRegistry.cjs +7 -1
- package/dist/cjs/hooks/HookRegistry.cjs.map +1 -1
- package/dist/cjs/hooks/index.cjs +1 -1
- package/dist/cjs/langchain/index.cjs +12 -0
- package/dist/cjs/langchain/messages.cjs +12 -0
- package/dist/cjs/langfuseConfig.cjs +16 -0
- package/dist/cjs/langfuseConfig.cjs.map +1 -1
- package/dist/cjs/langfuseSpanRegistry.cjs +16 -4
- package/dist/cjs/langfuseSpanRegistry.cjs.map +1 -1
- package/dist/cjs/main.cjs +15 -1
- package/dist/cjs/run.cjs +4 -0
- package/dist/cjs/run.cjs.map +1 -1
- package/dist/cjs/tools/SubagentTool.cjs +14 -4
- package/dist/cjs/tools/SubagentTool.cjs.map +1 -1
- package/dist/cjs/tools/ToolNode.cjs +1 -1
- package/dist/cjs/tools/subagent/InMemorySubagentTaskStore.cjs +403 -0
- package/dist/cjs/tools/subagent/InMemorySubagentTaskStore.cjs.map +1 -0
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs +201 -61
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs.map +1 -1
- package/dist/cjs/tools/subagent/index.cjs +1 -0
- package/dist/esm/graphs/Graph.mjs +44 -19
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/hooks/HookRegistry.mjs +7 -1
- package/dist/esm/hooks/HookRegistry.mjs.map +1 -1
- package/dist/esm/hooks/index.mjs +1 -1
- package/dist/esm/langchain/index.mjs +2 -2
- package/dist/esm/langchain/messages.mjs +2 -2
- package/dist/esm/langfuseConfig.mjs +16 -0
- package/dist/esm/langfuseConfig.mjs.map +1 -1
- package/dist/esm/langfuseSpanRegistry.mjs +16 -4
- package/dist/esm/langfuseSpanRegistry.mjs.map +1 -1
- package/dist/esm/main.mjs +4 -3
- package/dist/esm/run.mjs +4 -0
- package/dist/esm/run.mjs.map +1 -1
- package/dist/esm/tools/SubagentTool.mjs +14 -4
- package/dist/esm/tools/SubagentTool.mjs.map +1 -1
- package/dist/esm/tools/ToolNode.mjs +1 -1
- package/dist/esm/tools/subagent/InMemorySubagentTaskStore.mjs +403 -0
- package/dist/esm/tools/subagent/InMemorySubagentTaskStore.mjs.map +1 -0
- package/dist/esm/tools/subagent/SubagentExecutor.mjs +201 -61
- package/dist/esm/tools/subagent/SubagentExecutor.mjs.map +1 -1
- package/dist/esm/tools/subagent/index.mjs +1 -0
- package/dist/types/graphs/Graph.d.ts +6 -3
- package/dist/types/hooks/HookRegistry.d.ts +8 -0
- package/dist/types/langchain/messages.d.ts +2 -2
- package/dist/types/langfuseSpanRegistry.d.ts +9 -4
- package/dist/types/run.d.ts +1 -0
- package/dist/types/tools/SubagentTool.d.ts +5 -2
- package/dist/types/tools/subagent/InMemorySubagentTaskStore.d.ts +45 -0
- package/dist/types/tools/subagent/SubagentExecutor.d.ts +30 -3
- package/dist/types/tools/subagent/index.d.ts +2 -0
- package/dist/types/types/graph.d.ts +22 -4
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/run.d.ts +6 -0
- package/dist/types/types/subagentTasks.d.ts +172 -0
- package/package.json +1 -1
- package/src/graphs/Graph.ts +75 -30
- package/src/hooks/HookRegistry.ts +18 -0
- package/src/langchain/messages.ts +3 -0
- package/src/langfuseConfig.ts +43 -0
- package/src/langfuseSpanRegistry.ts +42 -4
- package/src/run.ts +4 -0
- package/src/tools/SubagentTool.ts +37 -3
- package/src/tools/subagent/InMemorySubagentTaskStore.ts +632 -0
- package/src/tools/subagent/SubagentExecutor.ts +411 -74
- package/src/tools/subagent/index.ts +2 -0
- package/src/types/graph.ts +22 -4
- package/src/types/index.ts +1 -0
- package/src/types/run.ts +6 -0
- package/src/types/subagentTasks.ts +162 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import { nanoid } from "nanoid";
|
|
2
|
+
//#region src/tools/subagent/InMemorySubagentTaskStore.ts
|
|
3
|
+
const DEFAULT_COMPLETED_TTL_MS = 3600 * 1e3;
|
|
4
|
+
const DEFAULT_MAX_ERROR_CHARS = 4 * 1024;
|
|
5
|
+
const DEFAULT_MAX_MESSAGE_CHARS = 64 * 1024;
|
|
6
|
+
const DEFAULT_TASK_TIMEOUT_MS = 1800 * 1e3;
|
|
7
|
+
const DEFAULT_MAX_CONTROLS = 32;
|
|
8
|
+
const DEFAULT_MAX_RESULT_CHARS = 1e5;
|
|
9
|
+
const DEFAULT_MAX_RUNNING_PER_SCOPE = 10;
|
|
10
|
+
const DEFAULT_MAX_RUNNING_TOTAL = 100;
|
|
11
|
+
const DEFAULT_MAX_TASKS_PER_SCOPE = 200;
|
|
12
|
+
const DEFAULT_MAX_TASKS_TOTAL = 2e3;
|
|
13
|
+
function resolvePositiveInteger(value, fallback) {
|
|
14
|
+
return Number.isSafeInteger(value) && value != null && value > 0 ? value : fallback;
|
|
15
|
+
}
|
|
16
|
+
function resolveOptions(options) {
|
|
17
|
+
const maxTasksPerScope = resolvePositiveInteger(options.maxTasksPerScope, DEFAULT_MAX_TASKS_PER_SCOPE);
|
|
18
|
+
const maxTasksTotal = resolvePositiveInteger(options.maxTasksTotal, DEFAULT_MAX_TASKS_TOTAL);
|
|
19
|
+
return {
|
|
20
|
+
completedTtlMs: resolvePositiveInteger(options.completedTtlMs, DEFAULT_COMPLETED_TTL_MS),
|
|
21
|
+
maxControlMessageChars: resolvePositiveInteger(options.maxControlMessageChars, DEFAULT_MAX_MESSAGE_CHARS),
|
|
22
|
+
maxControlsPerTask: resolvePositiveInteger(options.maxControlsPerTask, DEFAULT_MAX_CONTROLS),
|
|
23
|
+
maxErrorChars: resolvePositiveInteger(options.maxErrorChars, DEFAULT_MAX_ERROR_CHARS),
|
|
24
|
+
maxResultChars: resolvePositiveInteger(options.maxResultChars, DEFAULT_MAX_RESULT_CHARS),
|
|
25
|
+
maxRunningPerScope: Math.min(resolvePositiveInteger(options.maxRunningPerScope, DEFAULT_MAX_RUNNING_PER_SCOPE), maxTasksPerScope),
|
|
26
|
+
maxRunningTotal: Math.min(resolvePositiveInteger(options.maxRunningTotal, DEFAULT_MAX_RUNNING_TOTAL), maxTasksTotal),
|
|
27
|
+
maxTasksPerScope,
|
|
28
|
+
maxTasksTotal,
|
|
29
|
+
taskTimeoutMs: resolvePositiveInteger(options.taskTimeoutMs, DEFAULT_TASK_TIMEOUT_MS)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function toErrorMessage(error) {
|
|
33
|
+
if (error instanceof Error && error.message.trim() !== "") return error.message;
|
|
34
|
+
return "Detached subagent task failed.";
|
|
35
|
+
}
|
|
36
|
+
function truncateMiddle(value, maxChars) {
|
|
37
|
+
if (value.length <= maxChars) return value;
|
|
38
|
+
const marker = "\n…[truncated]…\n";
|
|
39
|
+
const available = Math.max(0, maxChars - 15);
|
|
40
|
+
const head = Math.ceil(available / 2);
|
|
41
|
+
return `${value.slice(0, head)}${marker}${value.slice(value.length - (available - head))}`;
|
|
42
|
+
}
|
|
43
|
+
function toInjectedMessage(control) {
|
|
44
|
+
return {
|
|
45
|
+
role: "user",
|
|
46
|
+
content: control.message,
|
|
47
|
+
source: "steer"
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function snapshot(task) {
|
|
51
|
+
return {
|
|
52
|
+
taskId: task.id,
|
|
53
|
+
threadId: task.threadId,
|
|
54
|
+
subagentType: task.subagentType,
|
|
55
|
+
status: task.status,
|
|
56
|
+
createdAt: task.createdAt,
|
|
57
|
+
updatedAt: task.updatedAt,
|
|
58
|
+
resultAvailable: task.status === "completed" && task.result != null && !task.resultClaimed,
|
|
59
|
+
resultClaimed: task.resultClaimed,
|
|
60
|
+
pendingControls: task.controls.length,
|
|
61
|
+
...task.progress == null ? {} : { progress: { ...task.progress } },
|
|
62
|
+
...task.error == null ? {} : { error: task.error }
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function abortReason(signal) {
|
|
66
|
+
return signal.reason instanceof Error ? signal.reason : /* @__PURE__ */ new Error("Detached subagent task cancelled.");
|
|
67
|
+
}
|
|
68
|
+
var InMemorySubagentTaskStore = class {
|
|
69
|
+
buckets = /* @__PURE__ */ new Map();
|
|
70
|
+
options;
|
|
71
|
+
runningTasks = 0;
|
|
72
|
+
totalTasks = 0;
|
|
73
|
+
constructor(options = {}) {
|
|
74
|
+
this.options = resolveOptions(options);
|
|
75
|
+
}
|
|
76
|
+
start(request) {
|
|
77
|
+
const scopeId = request.scopeId.trim();
|
|
78
|
+
const idempotencyKey = request.idempotencyKey.trim();
|
|
79
|
+
const requestFingerprint = request.requestFingerprint?.trim();
|
|
80
|
+
if (scopeId === "" || idempotencyKey === "") throw new Error("Subagent task scope and idempotency key are required.");
|
|
81
|
+
const now = Date.now();
|
|
82
|
+
const bucket = this.getBucket(scopeId);
|
|
83
|
+
this.sweepBucket(bucket, now);
|
|
84
|
+
const existingId = bucket.taskIdByIdempotencyKey.get(idempotencyKey);
|
|
85
|
+
if (existingId != null) {
|
|
86
|
+
const existing = bucket.tasks.get(existingId);
|
|
87
|
+
if (existing != null) {
|
|
88
|
+
if (requestFingerprint != null && requestFingerprint !== "" && existing.requestFingerprint != null && existing.requestFingerprint !== requestFingerprint) return {
|
|
89
|
+
accepted: false,
|
|
90
|
+
reason: "conflict",
|
|
91
|
+
task: snapshot(existing)
|
|
92
|
+
};
|
|
93
|
+
return {
|
|
94
|
+
accepted: true,
|
|
95
|
+
isNew: false,
|
|
96
|
+
task: snapshot(existing)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
bucket.taskIdByIdempotencyKey.delete(idempotencyKey);
|
|
100
|
+
}
|
|
101
|
+
let running = 0;
|
|
102
|
+
for (const task of bucket.tasks.values()) if (task.status === "running") running += 1;
|
|
103
|
+
if (running >= this.options.maxRunningPerScope || this.runningTasks >= this.options.maxRunningTotal) {
|
|
104
|
+
this.dropEmptyBucket(scopeId, bucket);
|
|
105
|
+
return {
|
|
106
|
+
accepted: false,
|
|
107
|
+
reason: "capacity"
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
if (!this.makeRoom(bucket) || !this.makeGlobalRoom()) {
|
|
111
|
+
this.dropEmptyBucket(scopeId, bucket);
|
|
112
|
+
return {
|
|
113
|
+
accepted: false,
|
|
114
|
+
reason: "capacity"
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const taskId = nanoid();
|
|
118
|
+
const requestedThreadId = request.threadId?.trim();
|
|
119
|
+
const task = {
|
|
120
|
+
id: taskId,
|
|
121
|
+
idempotencyKey,
|
|
122
|
+
...requestFingerprint == null || requestFingerprint === "" ? {} : { requestFingerprint },
|
|
123
|
+
scopeId,
|
|
124
|
+
threadId: requestedThreadId != null && requestedThreadId !== "" ? requestedThreadId : taskId,
|
|
125
|
+
subagentType: request.subagentType,
|
|
126
|
+
status: "running",
|
|
127
|
+
createdAt: now,
|
|
128
|
+
updatedAt: now,
|
|
129
|
+
controller: new AbortController(),
|
|
130
|
+
controls: [],
|
|
131
|
+
progressEvents: 0,
|
|
132
|
+
resultClaimed: false,
|
|
133
|
+
acceptingControls: true
|
|
134
|
+
};
|
|
135
|
+
this.buckets.set(scopeId, bucket);
|
|
136
|
+
bucket.tasks.set(task.id, task);
|
|
137
|
+
bucket.taskIdByIdempotencyKey.set(idempotencyKey, task.id);
|
|
138
|
+
this.runningTasks += 1;
|
|
139
|
+
this.totalTasks += 1;
|
|
140
|
+
task.timeout = setTimeout(() => {
|
|
141
|
+
this.finishWithError(task, "error", /* @__PURE__ */ new Error("Detached subagent task timed out."));
|
|
142
|
+
}, this.options.taskTimeoutMs);
|
|
143
|
+
task.timeout.unref();
|
|
144
|
+
const runtime = this.createRuntime(task);
|
|
145
|
+
Promise.resolve().then(() => {
|
|
146
|
+
if (task.status !== "running" || task.controller.signal.aborted) return;
|
|
147
|
+
return request.run(runtime);
|
|
148
|
+
}).then((result) => {
|
|
149
|
+
if (task.status !== "running" || result == null) return;
|
|
150
|
+
if (task.controller.signal.aborted) {
|
|
151
|
+
this.finishWithError(task, "cancelled", abortReason(task.controller.signal));
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
task.status = "completed";
|
|
155
|
+
task.acceptingControls = false;
|
|
156
|
+
task.controls.length = 0;
|
|
157
|
+
task.result = truncateMiddle(result.content, this.options.maxResultChars);
|
|
158
|
+
task.updatedAt = Date.now();
|
|
159
|
+
this.runningTasks -= 1;
|
|
160
|
+
this.scheduleExpiry(task);
|
|
161
|
+
}, (error) => {
|
|
162
|
+
const status = task.controller.signal.aborted ? "cancelled" : "error";
|
|
163
|
+
this.finishWithError(task, status, error);
|
|
164
|
+
});
|
|
165
|
+
return {
|
|
166
|
+
accepted: true,
|
|
167
|
+
isNew: true,
|
|
168
|
+
task: snapshot(task)
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
get(scopeId, taskId) {
|
|
172
|
+
const task = this.find(scopeId, taskId);
|
|
173
|
+
return task == null ? void 0 : snapshot(task);
|
|
174
|
+
}
|
|
175
|
+
list(scopeId) {
|
|
176
|
+
const bucket = this.buckets.get(scopeId.trim());
|
|
177
|
+
if (bucket == null) return [];
|
|
178
|
+
this.sweepBucket(bucket, Date.now());
|
|
179
|
+
return [...bucket.tasks.values()].sort((left, right) => left.createdAt - right.createdAt).map(snapshot);
|
|
180
|
+
}
|
|
181
|
+
claim(scopeId, taskId) {
|
|
182
|
+
const task = this.find(scopeId, taskId);
|
|
183
|
+
if (task == null) return { status: "not_found" };
|
|
184
|
+
if (task.status === "running") return {
|
|
185
|
+
status: "running",
|
|
186
|
+
task: snapshot(task)
|
|
187
|
+
};
|
|
188
|
+
if (task.resultClaimed) return {
|
|
189
|
+
status: "claimed",
|
|
190
|
+
task: snapshot(task)
|
|
191
|
+
};
|
|
192
|
+
task.resultClaimed = true;
|
|
193
|
+
task.updatedAt = Date.now();
|
|
194
|
+
const taskSnapshot = snapshot(task);
|
|
195
|
+
this.scheduleExpiry(task);
|
|
196
|
+
if (task.status === "completed") {
|
|
197
|
+
const result = task.result ?? "";
|
|
198
|
+
task.result = void 0;
|
|
199
|
+
return {
|
|
200
|
+
status: "completed",
|
|
201
|
+
task: taskSnapshot,
|
|
202
|
+
result
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
const error = task.error ?? "Detached subagent task did not complete.";
|
|
206
|
+
return {
|
|
207
|
+
status: task.status,
|
|
208
|
+
task: taskSnapshot,
|
|
209
|
+
error
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
control(scopeId, taskId, command) {
|
|
213
|
+
const task = this.find(scopeId, taskId);
|
|
214
|
+
if (task == null) return { status: "not_found" };
|
|
215
|
+
if (command.action === "cancel") {
|
|
216
|
+
if (task.status !== "running") return {
|
|
217
|
+
status: "not_running",
|
|
218
|
+
task: snapshot(task)
|
|
219
|
+
};
|
|
220
|
+
this.finishWithError(task, "cancelled", /* @__PURE__ */ new Error("Detached subagent task cancelled by its parent."));
|
|
221
|
+
return {
|
|
222
|
+
status: "cancelled",
|
|
223
|
+
task: snapshot(task)
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
if (task.status !== "running" || !task.acceptingControls) return {
|
|
227
|
+
status: "not_running",
|
|
228
|
+
task: snapshot(task)
|
|
229
|
+
};
|
|
230
|
+
if (command.action === "cancel_message") {
|
|
231
|
+
const index = task.controls.findIndex((control) => control.id === command.controlId);
|
|
232
|
+
if (index < 0) return {
|
|
233
|
+
status: "control_not_found",
|
|
234
|
+
task: snapshot(task)
|
|
235
|
+
};
|
|
236
|
+
task.controls.splice(index, 1);
|
|
237
|
+
task.updatedAt = Date.now();
|
|
238
|
+
return {
|
|
239
|
+
status: "accepted",
|
|
240
|
+
task: snapshot(task)
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
const message = command.message.trim();
|
|
244
|
+
if (message === "") return {
|
|
245
|
+
status: "invalid",
|
|
246
|
+
message: "A non-empty message is required."
|
|
247
|
+
};
|
|
248
|
+
if (message.length > this.options.maxControlMessageChars) return {
|
|
249
|
+
status: "invalid",
|
|
250
|
+
message: `Message exceeds ${this.options.maxControlMessageChars} characters.`
|
|
251
|
+
};
|
|
252
|
+
if (task.controls.length >= this.options.maxControlsPerTask) return {
|
|
253
|
+
status: "invalid",
|
|
254
|
+
message: `Task already has ${this.options.maxControlsPerTask} pending messages.`
|
|
255
|
+
};
|
|
256
|
+
const control = {
|
|
257
|
+
id: nanoid(),
|
|
258
|
+
action: command.action,
|
|
259
|
+
message
|
|
260
|
+
};
|
|
261
|
+
task.controls.push(control);
|
|
262
|
+
task.updatedAt = Date.now();
|
|
263
|
+
return {
|
|
264
|
+
status: "accepted",
|
|
265
|
+
task: snapshot(task),
|
|
266
|
+
controlId: control.id
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
getBucket(scopeId) {
|
|
270
|
+
let bucket = this.buckets.get(scopeId);
|
|
271
|
+
if (bucket == null) {
|
|
272
|
+
bucket = {
|
|
273
|
+
tasks: /* @__PURE__ */ new Map(),
|
|
274
|
+
taskIdByIdempotencyKey: /* @__PURE__ */ new Map()
|
|
275
|
+
};
|
|
276
|
+
this.buckets.set(scopeId, bucket);
|
|
277
|
+
}
|
|
278
|
+
return bucket;
|
|
279
|
+
}
|
|
280
|
+
find(scopeId, taskId) {
|
|
281
|
+
const bucket = this.buckets.get(scopeId.trim());
|
|
282
|
+
if (bucket == null) return;
|
|
283
|
+
this.sweepBucket(bucket, Date.now());
|
|
284
|
+
return bucket.tasks.get(taskId);
|
|
285
|
+
}
|
|
286
|
+
makeRoom(bucket) {
|
|
287
|
+
if (bucket.tasks.size < this.options.maxTasksPerScope) return true;
|
|
288
|
+
const terminal = [...bucket.tasks.values()].filter((task) => task.status !== "running").sort((left, right) => left.updatedAt - right.updatedAt);
|
|
289
|
+
let removeCount = bucket.tasks.size - this.options.maxTasksPerScope + 1;
|
|
290
|
+
for (const task of terminal) {
|
|
291
|
+
if (removeCount <= 0) break;
|
|
292
|
+
this.removeTask(task);
|
|
293
|
+
removeCount -= 1;
|
|
294
|
+
}
|
|
295
|
+
return bucket.tasks.size < this.options.maxTasksPerScope;
|
|
296
|
+
}
|
|
297
|
+
makeGlobalRoom() {
|
|
298
|
+
if (this.totalTasks < this.options.maxTasksTotal) return true;
|
|
299
|
+
const terminal = [...this.buckets.values()].flatMap((bucket) => [...bucket.tasks.values()]).filter((task) => task.status !== "running").sort((left, right) => left.updatedAt - right.updatedAt);
|
|
300
|
+
let removeCount = this.totalTasks - this.options.maxTasksTotal + 1;
|
|
301
|
+
for (const task of terminal) {
|
|
302
|
+
if (removeCount <= 0) break;
|
|
303
|
+
this.removeTask(task);
|
|
304
|
+
removeCount -= 1;
|
|
305
|
+
}
|
|
306
|
+
return this.totalTasks < this.options.maxTasksTotal;
|
|
307
|
+
}
|
|
308
|
+
sweepBucket(bucket, now) {
|
|
309
|
+
for (const task of bucket.tasks.values()) if (task.status !== "running" && now - task.updatedAt > this.options.completedTtlMs) this.removeTask(task);
|
|
310
|
+
}
|
|
311
|
+
removeTask(task) {
|
|
312
|
+
const bucket = this.buckets.get(task.scopeId);
|
|
313
|
+
if (bucket?.tasks.get(task.id) !== task) return;
|
|
314
|
+
bucket.tasks.delete(task.id);
|
|
315
|
+
this.totalTasks -= 1;
|
|
316
|
+
if (bucket.taskIdByIdempotencyKey.get(task.idempotencyKey) === task.id) bucket.taskIdByIdempotencyKey.delete(task.idempotencyKey);
|
|
317
|
+
if (bucket.tasks.size === 0) this.buckets.delete(task.scopeId);
|
|
318
|
+
this.clearTaskExpiry(task);
|
|
319
|
+
this.clearTaskTimeout(task);
|
|
320
|
+
}
|
|
321
|
+
dropEmptyBucket(scopeId, bucket) {
|
|
322
|
+
if (bucket.tasks.size === 0 && this.buckets.get(scopeId) === bucket) this.buckets.delete(scopeId);
|
|
323
|
+
}
|
|
324
|
+
scheduleExpiry(task) {
|
|
325
|
+
this.clearTaskTimeout(task);
|
|
326
|
+
this.clearTaskExpiry(task);
|
|
327
|
+
task.expiry = setTimeout(() => {
|
|
328
|
+
this.removeTask(task);
|
|
329
|
+
}, this.options.completedTtlMs);
|
|
330
|
+
task.expiry.unref();
|
|
331
|
+
}
|
|
332
|
+
clearTaskExpiry(task) {
|
|
333
|
+
if (task.expiry == null) return;
|
|
334
|
+
clearTimeout(task.expiry);
|
|
335
|
+
task.expiry = void 0;
|
|
336
|
+
}
|
|
337
|
+
clearTaskTimeout(task) {
|
|
338
|
+
if (task.timeout == null) return;
|
|
339
|
+
clearTimeout(task.timeout);
|
|
340
|
+
task.timeout = void 0;
|
|
341
|
+
}
|
|
342
|
+
finishWithError(task, status, error) {
|
|
343
|
+
if (task.status !== "running") return;
|
|
344
|
+
const message = truncateMiddle(toErrorMessage(error), this.options.maxErrorChars);
|
|
345
|
+
const resolved = new Error(message);
|
|
346
|
+
task.status = status;
|
|
347
|
+
this.runningTasks -= 1;
|
|
348
|
+
task.acceptingControls = false;
|
|
349
|
+
task.controls.length = 0;
|
|
350
|
+
task.error = message;
|
|
351
|
+
task.updatedAt = Date.now();
|
|
352
|
+
this.scheduleExpiry(task);
|
|
353
|
+
task.controller.abort(resolved);
|
|
354
|
+
}
|
|
355
|
+
createRuntime(task) {
|
|
356
|
+
const take = (accept) => {
|
|
357
|
+
if (task.status !== "running") return [];
|
|
358
|
+
const selected = [];
|
|
359
|
+
const retained = [];
|
|
360
|
+
for (const control of task.controls) (accept(control) ? selected : retained).push(control);
|
|
361
|
+
task.controls = retained;
|
|
362
|
+
if (selected.length > 0) task.updatedAt = Date.now();
|
|
363
|
+
return selected.map(toInjectedMessage);
|
|
364
|
+
};
|
|
365
|
+
return {
|
|
366
|
+
taskId: task.id,
|
|
367
|
+
signal: task.controller.signal,
|
|
368
|
+
shouldPreempt: () => task.status === "running" && task.controls.some((control) => control.action === "interrupt"),
|
|
369
|
+
drain: (boundary) => {
|
|
370
|
+
if (boundary === "preempt") return take((control) => control.action === "interrupt");
|
|
371
|
+
if (boundary === "tool") return take((control) => control.action !== "queue");
|
|
372
|
+
return take(() => true);
|
|
373
|
+
},
|
|
374
|
+
closeTurn: () => {
|
|
375
|
+
const messages = take(() => true);
|
|
376
|
+
if (messages.length > 0) return {
|
|
377
|
+
closed: false,
|
|
378
|
+
messages
|
|
379
|
+
};
|
|
380
|
+
task.acceptingControls = false;
|
|
381
|
+
return {
|
|
382
|
+
closed: true,
|
|
383
|
+
messages: []
|
|
384
|
+
};
|
|
385
|
+
},
|
|
386
|
+
reportProgress: (event) => {
|
|
387
|
+
if (task.status !== "running") return;
|
|
388
|
+
task.progressEvents += 1;
|
|
389
|
+
task.updatedAt = Date.now();
|
|
390
|
+
task.progress = {
|
|
391
|
+
phase: event.phase,
|
|
392
|
+
at: task.updatedAt,
|
|
393
|
+
eventCount: task.progressEvents,
|
|
394
|
+
...event.label == null ? {} : { label: event.label }
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
//#endregion
|
|
401
|
+
export { InMemorySubagentTaskStore };
|
|
402
|
+
|
|
403
|
+
//# sourceMappingURL=InMemorySubagentTaskStore.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InMemorySubagentTaskStore.mjs","names":[],"sources":["../../../../src/tools/subagent/InMemorySubagentTaskStore.ts"],"mappings":";;AAiBA,MAAM,2BAA2B,OAAU;AAC3C,MAAM,0BAA0B,IAAI;AACpC,MAAM,4BAA4B,KAAK;AACvC,MAAM,0BAA0B,OAAU;AAC1C,MAAM,uBAAuB;AAC7B,MAAM,2BAA2B;AACjC,MAAM,gCAAgC;AACtC,MAAM,4BAA4B;AAClC,MAAM,8BAA8B;AACpC,MAAM,0BAA0B;AAkDhC,SAAS,uBACP,OACA,UACQ;CACR,OAAO,OAAO,cAAc,KAAK,KAAK,SAAS,QAAQ,QAAQ,IAC3D,QACA;AACN;A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