@cuylabs/agent-core 0.8.0 → 0.10.0
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 +33 -17
- package/dist/chunk-2O4MCSQS.js +780 -0
- package/dist/chunk-2TTOLHBT.js +198 -0
- package/dist/chunk-5FMSGQVX.js +281 -0
- package/dist/chunk-5NVVNXPQ.js +288 -0
- package/dist/{chunk-CAA7FHIH.js → chunk-6HZBHFOL.js} +3 -103
- package/dist/chunk-CJI7PVS2.js +58 -0
- package/dist/{chunk-N6HWIEEA.js → chunk-CMYN2RCB.js} +278 -61
- package/dist/chunk-FII65CN7.js +117 -0
- package/dist/{chunk-IVUJDISU.js → chunk-GFTW23FV.js} +5 -14
- package/dist/chunk-I6PKJ7XQ.js +292 -0
- package/dist/{chunk-BDBZ3SLK.js → chunk-ICZ66572.js} +48 -4
- package/dist/chunk-KYLPMBHD.js +316 -0
- package/dist/chunk-MXAP4UG6.js +2956 -0
- package/dist/{chunk-RZITT45F.js → chunk-N3VX7FEE.js} +39 -6
- package/dist/{chunk-YSLSEQ6B.js → chunk-NDZWXCBZ.js} +218 -95
- package/dist/{chunk-P6YF7USR.js → chunk-Q742PSH3.js} +23 -38
- package/dist/chunk-QAL3OMI3.js +943 -0
- package/dist/{chunk-RFEKJKTO.js → chunk-RN6WZEUF.js} +330 -280
- package/dist/{chunk-ZXAKHMWH.js → chunk-ROTGCYDW.js} +22 -84
- package/dist/chunk-SPBFQXOT.js +0 -0
- package/dist/{chunk-LRHOS4ZN.js → chunk-SPILYYDF.js} +3 -2
- package/dist/chunk-SSFBF3US.js +602 -0
- package/dist/chunk-SZ2XBPTW.js +8 -0
- package/dist/chunk-T4UIX5D7.js +115 -0
- package/dist/chunk-TIHPYVAJ.js +102 -0
- package/dist/{chunk-YUUJK53A.js → chunk-TOTDGK3P.js} +1 -1
- package/dist/chunk-V4RFNEET.js +563 -0
- package/dist/chunk-VOUEJSW6.js +0 -0
- package/dist/{chunk-4BDA7DQY.js → chunk-WBPOZ7CL.js} +673 -273
- package/dist/chunk-X4VN4GIJ.js +185 -0
- package/dist/dispatch/index.d.ts +93 -0
- package/dist/dispatch/index.js +37 -0
- package/dist/events/index.d.ts +93 -0
- package/dist/events/index.js +6 -0
- package/dist/{runtime → execution}/index.d.ts +120 -34
- package/dist/{runtime → execution}/index.js +18 -13
- package/dist/index-BCqEGzBj.d.ts +251 -0
- package/dist/index.d.ts +490 -122
- package/dist/index.js +2104 -615
- package/dist/{errors → inference/errors}/index.d.ts +2 -2
- package/dist/{errors → inference/errors}/index.js +1 -1
- package/dist/inference/index.d.ts +16 -23
- package/dist/inference/index.js +45 -16
- package/dist/instance-BqV2D5pc.d.ts +5723 -0
- package/dist/logger/index.d.ts +50 -0
- package/dist/logger/index.js +11 -0
- package/dist/mcp/index.d.ts +5 -9
- package/dist/mcp/index.js +2 -3
- package/dist/middleware/index.d.ts +10 -149
- package/dist/middleware/index.js +11 -3
- package/dist/model-messages-B4nK9D1-.d.ts +13 -0
- package/dist/models/index.d.ts +23 -18
- package/dist/models/index.js +48 -11
- package/dist/models/reasoning/index.d.ts +4 -0
- package/dist/{reasoning → models/reasoning}/index.js +3 -3
- package/dist/plugin/index.d.ts +458 -0
- package/dist/plugin/index.js +32 -0
- package/dist/profiles/index.d.ts +55 -0
- package/dist/profiles/index.js +30 -0
- package/dist/prompt/index.d.ts +8 -12
- package/dist/prompt/index.js +3 -2
- package/dist/safety/index.d.ts +109 -14
- package/dist/safety/index.js +59 -3
- package/dist/sandbox/index.d.ts +81 -0
- package/dist/sandbox/index.js +1 -0
- package/dist/skill/index.d.ts +10 -8
- package/dist/skill/index.js +3 -3
- package/dist/storage/index.d.ts +12 -4
- package/dist/storage/index.js +1 -1
- package/dist/subagents/index.d.ts +177 -0
- package/dist/subagents/index.js +78 -0
- package/dist/team/index.d.ts +544 -0
- package/dist/team/index.js +41 -0
- package/dist/tool/host/index.d.ts +41 -0
- package/dist/tool/host/index.js +10 -0
- package/dist/tool/index.d.ts +125 -21
- package/dist/tool/index.js +20 -13
- package/dist/{types-VQgymC1N.d.ts → types-Bj_J8u_W.d.ts} +44 -64
- package/dist/{types-CHiPh8U2.d.ts → types-C_LCeYNg.d.ts} +7 -7
- package/dist/types-RSCv7nQ4.d.ts +59 -0
- package/package.json +58 -53
- package/dist/builder-UpOWQMW3.d.ts +0 -34
- package/dist/chunk-7MUFEN4K.js +0 -559
- package/dist/chunk-7VKQ4WPB.js +0 -73
- package/dist/chunk-BFM2YHNM.js +0 -222
- package/dist/chunk-DWYX7ASF.js +0 -26
- package/dist/chunk-KUVSERLJ.js +0 -50
- package/dist/chunk-N7P4PN3O.js +0 -84
- package/dist/chunk-SDSBEQXG.js +0 -157
- package/dist/chunk-SQU2AJHO.js +0 -305
- package/dist/chunk-VBWWUHWI.js +0 -724
- package/dist/chunk-VEKUXUVF.js +0 -41
- package/dist/chunk-VNQBHPCT.js +0 -398
- package/dist/chunk-WWYYNWEW.js +0 -259
- package/dist/context/index.d.ts +0 -259
- package/dist/context/index.js +0 -26
- package/dist/events-CE72w8W4.d.ts +0 -149
- package/dist/host/index.d.ts +0 -45
- package/dist/host/index.js +0 -8
- package/dist/index-CWSchSql.d.ts +0 -1058
- package/dist/messages-BYWGn8TY.d.ts +0 -110
- package/dist/presets/index.d.ts +0 -53
- package/dist/presets/index.js +0 -28
- package/dist/reasoning/index.d.ts +0 -116
- package/dist/registry-DwYqsQkX.d.ts +0 -164
- package/dist/runner-e2YRcUoX.d.ts +0 -786
- package/dist/scope/index.d.ts +0 -10
- package/dist/scope/index.js +0 -14
- package/dist/session-manager-B_CWGTsl.d.ts +0 -274
- package/dist/signal/index.d.ts +0 -28
- package/dist/signal/index.js +0 -6
- package/dist/sub-agent/index.d.ts +0 -23
- package/dist/sub-agent/index.js +0 -15
- package/dist/tool-BHbyUAy3.d.ts +0 -150
- package/dist/tool-DLXAR9Ce.d.ts +0 -145
- package/dist/tracker-DClqYqTj.d.ts +0 -96
- package/dist/tracking/index.d.ts +0 -111
- package/dist/tracking/index.js +0 -20
- package/dist/types-BfNpU8NS.d.ts +0 -270
- package/dist/types-BnpEOYV-.d.ts +0 -50
- package/dist/types-CQL-SvTn.d.ts +0 -29
- package/dist/types-CWm-7rvB.d.ts +0 -55
- package/dist/types-KKDrdU9Y.d.ts +0 -325
- package/dist/types-QA4WhEfz.d.ts +0 -138
- package/dist/types-QKHHQLLq.d.ts +0 -336
- package/dist/types-YuWV4ag7.d.ts +0 -72
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// src/tool/host/local.ts
|
|
2
|
+
import { spawn } from "child_process";
|
|
3
|
+
import fs from "fs/promises";
|
|
4
|
+
import { existsSync } from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import process from "process";
|
|
7
|
+
function getShell() {
|
|
8
|
+
if (process.platform === "win32") {
|
|
9
|
+
return { shell: "cmd.exe", args: ["/c"] };
|
|
10
|
+
}
|
|
11
|
+
const userShell = process.env.SHELL ?? "/bin/bash";
|
|
12
|
+
return { shell: userShell, args: ["-c"] };
|
|
13
|
+
}
|
|
14
|
+
async function killProcessTree(pid) {
|
|
15
|
+
try {
|
|
16
|
+
if (process.platform !== "win32") {
|
|
17
|
+
process.kill(-pid, "SIGKILL");
|
|
18
|
+
} else {
|
|
19
|
+
const { exec: execCb } = await import("child_process");
|
|
20
|
+
execCb(`taskkill /pid ${pid} /t /f`, () => {
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
} catch {
|
|
24
|
+
try {
|
|
25
|
+
process.kill(pid, "SIGKILL");
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function localHost(defaultCwd) {
|
|
31
|
+
const cwd = defaultCwd ?? process.cwd();
|
|
32
|
+
return {
|
|
33
|
+
name: "local",
|
|
34
|
+
// --------------------------------------------------------------------------
|
|
35
|
+
// File system
|
|
36
|
+
// --------------------------------------------------------------------------
|
|
37
|
+
async readFile(filePath) {
|
|
38
|
+
const abs = path.isAbsolute(filePath) ? filePath : path.resolve(cwd, filePath);
|
|
39
|
+
return fs.readFile(abs, "utf-8");
|
|
40
|
+
},
|
|
41
|
+
async readBytes(filePath, offset, length) {
|
|
42
|
+
const abs = path.isAbsolute(filePath) ? filePath : path.resolve(cwd, filePath);
|
|
43
|
+
const fh = await fs.open(abs, "r");
|
|
44
|
+
try {
|
|
45
|
+
const buf = Buffer.alloc(length);
|
|
46
|
+
await fh.read(buf, 0, length, offset);
|
|
47
|
+
return buf;
|
|
48
|
+
} finally {
|
|
49
|
+
await fh.close();
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
async writeFile(filePath, content) {
|
|
53
|
+
const abs = path.isAbsolute(filePath) ? filePath : path.resolve(cwd, filePath);
|
|
54
|
+
await fs.mkdir(path.dirname(abs), { recursive: true });
|
|
55
|
+
await fs.writeFile(abs, content, "utf-8");
|
|
56
|
+
},
|
|
57
|
+
async exists(filePath) {
|
|
58
|
+
const abs = path.isAbsolute(filePath) ? filePath : path.resolve(cwd, filePath);
|
|
59
|
+
return existsSync(abs);
|
|
60
|
+
},
|
|
61
|
+
async stat(filePath) {
|
|
62
|
+
const abs = path.isAbsolute(filePath) ? filePath : path.resolve(cwd, filePath);
|
|
63
|
+
const s = await fs.stat(abs);
|
|
64
|
+
return {
|
|
65
|
+
size: s.size,
|
|
66
|
+
mtime: s.mtime,
|
|
67
|
+
isDirectory: s.isDirectory(),
|
|
68
|
+
isFile: s.isFile()
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
async readdir(dirPath) {
|
|
72
|
+
const abs = path.isAbsolute(dirPath) ? dirPath : path.resolve(cwd, dirPath);
|
|
73
|
+
const entries = await fs.readdir(abs, { withFileTypes: true });
|
|
74
|
+
return entries.map((e) => ({
|
|
75
|
+
name: e.name,
|
|
76
|
+
isDirectory: e.isDirectory(),
|
|
77
|
+
isFile: e.isFile()
|
|
78
|
+
}));
|
|
79
|
+
},
|
|
80
|
+
async mkdir(dirPath) {
|
|
81
|
+
const abs = path.isAbsolute(dirPath) ? dirPath : path.resolve(cwd, dirPath);
|
|
82
|
+
await fs.mkdir(abs, { recursive: true });
|
|
83
|
+
},
|
|
84
|
+
// --------------------------------------------------------------------------
|
|
85
|
+
// Process execution
|
|
86
|
+
// --------------------------------------------------------------------------
|
|
87
|
+
exec(command, options) {
|
|
88
|
+
const { shell, args } = getShell();
|
|
89
|
+
const execCwd = options?.cwd ?? cwd;
|
|
90
|
+
const env = {
|
|
91
|
+
...process.env,
|
|
92
|
+
...options?.env,
|
|
93
|
+
// Disable pagers — tools collect output, not interactive
|
|
94
|
+
PAGER: "cat",
|
|
95
|
+
GIT_PAGER: "cat"
|
|
96
|
+
};
|
|
97
|
+
return new Promise((resolve, reject) => {
|
|
98
|
+
let stdout = "";
|
|
99
|
+
let stderr = "";
|
|
100
|
+
let timedOut = false;
|
|
101
|
+
let settled = false;
|
|
102
|
+
const child = spawn(shell, [...args, command], {
|
|
103
|
+
cwd: execCwd,
|
|
104
|
+
detached: process.platform !== "win32",
|
|
105
|
+
env,
|
|
106
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
107
|
+
});
|
|
108
|
+
child.stdout?.on("data", (data) => {
|
|
109
|
+
stdout += data.toString();
|
|
110
|
+
options?.onStdout?.(data);
|
|
111
|
+
});
|
|
112
|
+
child.stderr?.on("data", (data) => {
|
|
113
|
+
stderr += data.toString();
|
|
114
|
+
options?.onStderr?.(data);
|
|
115
|
+
});
|
|
116
|
+
let timer;
|
|
117
|
+
if (options?.timeout && options.timeout > 0) {
|
|
118
|
+
timer = setTimeout(() => {
|
|
119
|
+
timedOut = true;
|
|
120
|
+
if (child.pid) killProcessTree(child.pid);
|
|
121
|
+
}, options.timeout);
|
|
122
|
+
}
|
|
123
|
+
const onAbort = () => {
|
|
124
|
+
if (child.pid) killProcessTree(child.pid);
|
|
125
|
+
};
|
|
126
|
+
options?.signal?.addEventListener("abort", onAbort, { once: true });
|
|
127
|
+
child.on("close", (code) => {
|
|
128
|
+
if (settled) return;
|
|
129
|
+
settled = true;
|
|
130
|
+
if (timer) clearTimeout(timer);
|
|
131
|
+
options?.signal?.removeEventListener("abort", onAbort);
|
|
132
|
+
resolve({ stdout, stderr, exitCode: code, timedOut });
|
|
133
|
+
});
|
|
134
|
+
child.on("error", (err) => {
|
|
135
|
+
if (settled) return;
|
|
136
|
+
settled = true;
|
|
137
|
+
if (timer) clearTimeout(timer);
|
|
138
|
+
options?.signal?.removeEventListener("abort", onAbort);
|
|
139
|
+
reject(err);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/tool/host/registry.ts
|
|
147
|
+
var ToolHostRegistry = class {
|
|
148
|
+
providers = /* @__PURE__ */ new Map();
|
|
149
|
+
register(provider) {
|
|
150
|
+
this.providers.set(provider.name, provider);
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
153
|
+
unregister(name) {
|
|
154
|
+
return this.providers.delete(name);
|
|
155
|
+
}
|
|
156
|
+
get(name) {
|
|
157
|
+
return this.providers.get(name);
|
|
158
|
+
}
|
|
159
|
+
list() {
|
|
160
|
+
return Array.from(this.providers.values()).map((provider) => ({
|
|
161
|
+
name: provider.name,
|
|
162
|
+
description: provider.description
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
async create(name, options) {
|
|
166
|
+
const provider = this.providers.get(name);
|
|
167
|
+
if (!provider) {
|
|
168
|
+
throw new Error(`Unknown tool host provider "${name}"`);
|
|
169
|
+
}
|
|
170
|
+
return await provider.create(options);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// src/tool/host/index.ts
|
|
175
|
+
var defaultToolHostRegistry = new ToolHostRegistry().register({
|
|
176
|
+
name: "local",
|
|
177
|
+
description: "Run tools on the local machine.",
|
|
178
|
+
create: (options) => localHost(options?.cwd)
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
export {
|
|
182
|
+
localHost,
|
|
183
|
+
ToolHostRegistry,
|
|
184
|
+
defaultToolHostRegistry
|
|
185
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { br as LocalDispatchRuntimeOptions, aU as DispatchRuntime, T as Tool, cY as TaskExecutorInput, cX as TaskExecutor, aR as DispatchRecord, aY as DispatchTargetInspection, aX as DispatchTarget, dd as TeamTask, bw as MemberRuntime, a_ as DispatchTargetStartResult, a$ as DispatchTargetSummary, b7 as ExternalTaskControl } from '../instance-BqV2D5pc.js';
|
|
2
|
+
export { aI as DEFAULT_DISPATCH_TOOL_IDS, aJ as DEFAULT_LOCAL_DISPATCH_CONCURRENCY, aK as DEFAULT_LOCAL_DISPATCH_DEPTH, aL as DEFAULT_LOCAL_DISPATCH_TITLE_PREFIX, aO as DISPATCH_STATES, aP as DispatchCheckOptions, aQ as DispatchListOptions, aS as DispatchResult, aT as DispatchRole, aV as DispatchStartInput, aW as DispatchState, aZ as DispatchTargetStartInput, b0 as DispatchUsage } from '../instance-BqV2D5pc.js';
|
|
3
|
+
import '../types-C_LCeYNg.js';
|
|
4
|
+
import 'ai';
|
|
5
|
+
import '../types-RSCv7nQ4.js';
|
|
6
|
+
import 'zod';
|
|
7
|
+
import '../types-CQaXbRsS.js';
|
|
8
|
+
import '../types-Bj_J8u_W.js';
|
|
9
|
+
import '@ai-sdk/provider-utils';
|
|
10
|
+
import '../sandbox/index.js';
|
|
11
|
+
import '../llm-error-D93FNNLY.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Local in-process DispatchRuntime.
|
|
15
|
+
*
|
|
16
|
+
* Launches child agents as background async tasks, tracks them in a Map,
|
|
17
|
+
* and supports redirect (via `agent.intervene()`), cancel (via
|
|
18
|
+
* AbortController), and status polling.
|
|
19
|
+
*
|
|
20
|
+
* @packageDocumentation
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Create a local in-process `DispatchRuntime`.
|
|
25
|
+
*
|
|
26
|
+
* This is the simplest runtime — child agents are forked from the parent
|
|
27
|
+
* and run as background Promise tasks in the same process. Use
|
|
28
|
+
* `createDaprDispatchRuntime()` for durable distributed dispatch.
|
|
29
|
+
*/
|
|
30
|
+
declare function createLocalDispatchRuntime(options: LocalDispatchRuntimeOptions): DispatchRuntime;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Create the standard dispatch tools from a `DispatchRuntime`.
|
|
34
|
+
*
|
|
35
|
+
* Returns `start_dispatch`, `check_dispatch`, `redirect_dispatch`,
|
|
36
|
+
* `cancel_dispatch`, and `list_dispatches`.
|
|
37
|
+
*/
|
|
38
|
+
declare function createDispatchTools(runtime: DispatchRuntime): Tool.AnyInfo[];
|
|
39
|
+
|
|
40
|
+
interface DispatchTaskExecutorOptions<RecordT extends DispatchRecord = DispatchRecord, InspectionT extends DispatchTargetInspection = DispatchTargetInspection> {
|
|
41
|
+
targets: readonly DispatchTarget<RecordT, InspectionT>[];
|
|
42
|
+
timeoutMs?: number;
|
|
43
|
+
pollIntervalMs?: number;
|
|
44
|
+
now?: () => string;
|
|
45
|
+
resolveTargetName?: (input: TaskExecutorInput) => string;
|
|
46
|
+
createRecord?: (input: {
|
|
47
|
+
taskInput: TaskExecutorInput;
|
|
48
|
+
target: DispatchTarget<RecordT, InspectionT>;
|
|
49
|
+
dispatchId: string;
|
|
50
|
+
startedAt: string;
|
|
51
|
+
startResult: DispatchTargetStartResult;
|
|
52
|
+
}) => RecordT;
|
|
53
|
+
}
|
|
54
|
+
interface DispatchExternalTaskControlOptions<RecordT extends DispatchRecord = DispatchRecord, InspectionT extends DispatchTargetInspection = DispatchTargetInspection> {
|
|
55
|
+
targets: readonly DispatchTarget<RecordT, InspectionT>[];
|
|
56
|
+
now?: () => string;
|
|
57
|
+
resolveTargetName?: (input: {
|
|
58
|
+
task: TeamTask;
|
|
59
|
+
runtime: MemberRuntime;
|
|
60
|
+
}) => string;
|
|
61
|
+
createRecord?: (input: {
|
|
62
|
+
task: TeamTask;
|
|
63
|
+
runtime: MemberRuntime;
|
|
64
|
+
target: DispatchTarget<RecordT, InspectionT>;
|
|
65
|
+
dispatchId: string;
|
|
66
|
+
startedAt: string;
|
|
67
|
+
}) => RecordT;
|
|
68
|
+
}
|
|
69
|
+
interface DispatchTaskExecutorRoute {
|
|
70
|
+
matches(input: TaskExecutorInput): boolean;
|
|
71
|
+
executor: TaskExecutor;
|
|
72
|
+
}
|
|
73
|
+
interface CompositeDispatchTaskExecutorOptions {
|
|
74
|
+
routes: readonly DispatchTaskExecutorRoute[];
|
|
75
|
+
fallback?: TaskExecutor;
|
|
76
|
+
}
|
|
77
|
+
interface RuntimeDispatchTargetOptions {
|
|
78
|
+
runtime: DispatchRuntime;
|
|
79
|
+
filter?: (target: DispatchTargetSummary) => boolean;
|
|
80
|
+
}
|
|
81
|
+
interface RuntimeDispatchExecutorOptions extends Omit<DispatchTaskExecutorOptions, "targets"> {
|
|
82
|
+
runtime: DispatchRuntime;
|
|
83
|
+
filter?: (target: DispatchTargetSummary) => boolean;
|
|
84
|
+
}
|
|
85
|
+
declare function ensureNonEmpty(input: string, label: string): string;
|
|
86
|
+
declare function mergeInspection<RecordT extends DispatchRecord, InspectionT extends DispatchTargetInspection>(record: RecordT, inspection: InspectionT | undefined, fallbackNow: string): RecordT;
|
|
87
|
+
declare function createRuntimeDispatchTargets(options: RuntimeDispatchTargetOptions): DispatchTarget[];
|
|
88
|
+
declare function createDispatchTaskExecutor<RecordT extends DispatchRecord = DispatchRecord, InspectionT extends DispatchTargetInspection = DispatchTargetInspection>(options: DispatchTaskExecutorOptions<RecordT, InspectionT>): TaskExecutor;
|
|
89
|
+
declare function createCompositeDispatchTaskExecutor(options: CompositeDispatchTaskExecutorOptions): TaskExecutor;
|
|
90
|
+
declare function createRuntimeDispatchExecutor(options: RuntimeDispatchExecutorOptions): TaskExecutor;
|
|
91
|
+
declare function createDispatchExternalTaskControl<RecordT extends DispatchRecord = DispatchRecord, InspectionT extends DispatchTargetInspection = DispatchTargetInspection>(options: DispatchExternalTaskControlOptions<RecordT, InspectionT>): ExternalTaskControl;
|
|
92
|
+
|
|
93
|
+
export { type CompositeDispatchTaskExecutorOptions, type DispatchExternalTaskControlOptions, DispatchRecord, DispatchRuntime, DispatchTarget, DispatchTargetInspection, DispatchTargetStartResult, DispatchTargetSummary, type DispatchTaskExecutorOptions, type DispatchTaskExecutorRoute, LocalDispatchRuntimeOptions, type RuntimeDispatchExecutorOptions, type RuntimeDispatchTargetOptions, createCompositeDispatchTaskExecutor, createDispatchExternalTaskControl, createDispatchTaskExecutor, createDispatchTools, createLocalDispatchRuntime, createRuntimeDispatchExecutor, createRuntimeDispatchTargets, ensureNonEmpty, mergeInspection };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createCompositeDispatchTaskExecutor,
|
|
3
|
+
createDispatchExternalTaskControl,
|
|
4
|
+
createDispatchTaskExecutor,
|
|
5
|
+
createRuntimeDispatchExecutor,
|
|
6
|
+
createRuntimeDispatchTargets,
|
|
7
|
+
ensureNonEmpty,
|
|
8
|
+
mergeInspection
|
|
9
|
+
} from "../chunk-5FMSGQVX.js";
|
|
10
|
+
import {
|
|
11
|
+
DEFAULT_DISPATCH_TOOL_IDS,
|
|
12
|
+
DEFAULT_LOCAL_DISPATCH_CONCURRENCY,
|
|
13
|
+
DEFAULT_LOCAL_DISPATCH_DEPTH,
|
|
14
|
+
DEFAULT_LOCAL_DISPATCH_TITLE_PREFIX,
|
|
15
|
+
DISPATCH_STATES,
|
|
16
|
+
createDispatchTools,
|
|
17
|
+
createLocalDispatchRuntime
|
|
18
|
+
} from "../chunk-SSFBF3US.js";
|
|
19
|
+
import "../chunk-SZ2XBPTW.js";
|
|
20
|
+
import "../chunk-Q742PSH3.js";
|
|
21
|
+
import "../chunk-ICZ66572.js";
|
|
22
|
+
export {
|
|
23
|
+
DEFAULT_DISPATCH_TOOL_IDS,
|
|
24
|
+
DEFAULT_LOCAL_DISPATCH_CONCURRENCY,
|
|
25
|
+
DEFAULT_LOCAL_DISPATCH_DEPTH,
|
|
26
|
+
DEFAULT_LOCAL_DISPATCH_TITLE_PREFIX,
|
|
27
|
+
DISPATCH_STATES,
|
|
28
|
+
createCompositeDispatchTaskExecutor,
|
|
29
|
+
createDispatchExternalTaskControl,
|
|
30
|
+
createDispatchTaskExecutor,
|
|
31
|
+
createDispatchTools,
|
|
32
|
+
createLocalDispatchRuntime,
|
|
33
|
+
createRuntimeDispatchExecutor,
|
|
34
|
+
createRuntimeDispatchTargets,
|
|
35
|
+
ensureNonEmpty,
|
|
36
|
+
mergeInspection
|
|
37
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EventBus — channel-based event streaming interface.
|
|
3
|
+
*
|
|
4
|
+
* Defines how events are published and consumed in a channel-keyed
|
|
5
|
+
* pub/sub model. The default implementation (`createEventBus`) is
|
|
6
|
+
* in-process with history replay. A distributed runtime can supply
|
|
7
|
+
* its own implementation that bridges to external infrastructure
|
|
8
|
+
* (e.g. Dapr pub/sub, Redis Streams, Kafka).
|
|
9
|
+
*
|
|
10
|
+
* Each channel is typically a session ID or workflow instance ID.
|
|
11
|
+
* Events flow from producers (workflow activities, agent execution)
|
|
12
|
+
* to consumers (SSE endpoints, WebSocket connections, TUI renderers).
|
|
13
|
+
*/
|
|
14
|
+
interface EventBusMessage {
|
|
15
|
+
/** Channel this message was published to. */
|
|
16
|
+
channel: string;
|
|
17
|
+
/** Event type — matches AgentEvent.type for agent events. */
|
|
18
|
+
type: string;
|
|
19
|
+
/** Serializable event payload. */
|
|
20
|
+
data: unknown;
|
|
21
|
+
/** Monotonically increasing sequence within the channel. */
|
|
22
|
+
seq: number;
|
|
23
|
+
}
|
|
24
|
+
interface EventBusSubscription {
|
|
25
|
+
/** Async iterator that yields events as they arrive. */
|
|
26
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<EventBusMessage>;
|
|
27
|
+
/** Stop receiving events. Safe to call multiple times. */
|
|
28
|
+
unsubscribe(): void;
|
|
29
|
+
}
|
|
30
|
+
interface EventBusSubscribeOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Replay messages strictly after this sequence number.
|
|
33
|
+
* Used to implement SSE resume via `Last-Event-ID`.
|
|
34
|
+
*/
|
|
35
|
+
afterSeq?: number;
|
|
36
|
+
}
|
|
37
|
+
interface EventBusOptions {
|
|
38
|
+
/**
|
|
39
|
+
* Maximum retained messages per channel for replay.
|
|
40
|
+
* Older messages are dropped from the head of the history buffer.
|
|
41
|
+
*/
|
|
42
|
+
maxHistoryMessages?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Maximum buffered live messages per subscriber before the subscriber
|
|
45
|
+
* is disconnected to avoid unbounded memory growth.
|
|
46
|
+
*/
|
|
47
|
+
maxBufferedMessages?: number;
|
|
48
|
+
/**
|
|
49
|
+
* How long (ms) to retain channel history with no active subscribers
|
|
50
|
+
* so reconnecting clients can resume after transient disconnects.
|
|
51
|
+
*/
|
|
52
|
+
channelRetentionMs?: number;
|
|
53
|
+
}
|
|
54
|
+
interface EventBus {
|
|
55
|
+
/**
|
|
56
|
+
* Publish an event to all subscribers of `channel`.
|
|
57
|
+
* Non-blocking — if no one is listening the event is still retained
|
|
58
|
+
* in the channel history for replay.
|
|
59
|
+
*/
|
|
60
|
+
publish(channel: string, type: string, data: unknown): void;
|
|
61
|
+
/**
|
|
62
|
+
* Subscribe to events on `channel`. Returns an async iterable that
|
|
63
|
+
* yields events as they arrive and completes when `close(channel)` is
|
|
64
|
+
* called or the subscription is unsubscribed.
|
|
65
|
+
*/
|
|
66
|
+
subscribe(channel: string, options?: EventBusSubscribeOptions): EventBusSubscription;
|
|
67
|
+
/**
|
|
68
|
+
* Close a channel. All active subscriptions complete their iterators.
|
|
69
|
+
* Subsequent publishes to this channel start a fresh stream.
|
|
70
|
+
*/
|
|
71
|
+
close(channel: string, finalEvent?: {
|
|
72
|
+
type: string;
|
|
73
|
+
data: unknown;
|
|
74
|
+
}): void;
|
|
75
|
+
/** Number of active channels (channels with at least one subscriber). */
|
|
76
|
+
readonly activeChannels: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* In-process EventBus implementation.
|
|
81
|
+
*
|
|
82
|
+
* Events are published by producers and consumed by subscribers via
|
|
83
|
+
* async iterators. Each channel maintains a history buffer for replay
|
|
84
|
+
* (e.g. SSE `Last-Event-ID` resume). Channels are automatically
|
|
85
|
+
* cleaned up after a configurable retention period with no subscribers.
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Create a new in-process event bus.
|
|
90
|
+
*/
|
|
91
|
+
declare function createEventBus(options?: EventBusOptions): EventBus;
|
|
92
|
+
|
|
93
|
+
export { type EventBus, type EventBusMessage, type EventBusOptions, type EventBusSubscribeOptions, type EventBusSubscription, createEventBus };
|