@shepai/cli 1.8.1 → 1.9.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/dist/src/application/ports/output/agent-executor-factory.interface.d.ts +45 -0
- package/dist/src/application/ports/output/agent-executor-factory.interface.d.ts.map +1 -0
- package/dist/src/application/ports/output/agent-executor-factory.interface.js +19 -0
- package/dist/src/application/ports/output/agent-executor.interface.d.ts +117 -0
- package/dist/src/application/ports/output/agent-executor.interface.d.ts.map +1 -0
- package/dist/src/application/ports/output/agent-executor.interface.js +23 -0
- package/dist/src/application/ports/output/agent-registry.interface.d.ts +91 -0
- package/dist/src/application/ports/output/agent-registry.interface.d.ts.map +1 -0
- package/dist/src/application/ports/output/agent-registry.interface.js +33 -0
- package/dist/src/application/ports/output/agent-run-repository.interface.d.ts +70 -0
- package/dist/src/application/ports/output/agent-run-repository.interface.d.ts.map +1 -0
- package/dist/src/application/ports/output/agent-run-repository.interface.js +11 -0
- package/dist/src/application/ports/output/agent-runner.interface.d.ts +82 -0
- package/dist/src/application/ports/output/agent-runner.interface.d.ts.map +1 -0
- package/dist/src/application/ports/output/agent-runner.interface.js +23 -0
- package/dist/src/application/ports/output/index.d.ts +5 -0
- package/dist/src/application/ports/output/index.d.ts.map +1 -1
- package/dist/src/application/use-cases/agents/run-agent.use-case.d.ts +52 -0
- package/dist/src/application/use-cases/agents/run-agent.use-case.d.ts.map +1 -0
- package/dist/src/application/use-cases/agents/run-agent.use-case.js +77 -0
- package/dist/src/domain/generated/output.d.ts +98 -0
- package/dist/src/domain/generated/output.d.ts.map +1 -1
- package/dist/src/domain/generated/output.js +17 -0
- package/dist/src/infrastructure/di/container.d.ts.map +1 -1
- package/dist/src/infrastructure/di/container.js +42 -1
- package/dist/src/infrastructure/persistence/sqlite/mappers/agent-run.mapper.d.ts +51 -0
- package/dist/src/infrastructure/persistence/sqlite/mappers/agent-run.mapper.d.ts.map +1 -0
- package/dist/src/infrastructure/persistence/sqlite/mappers/agent-run.mapper.js +64 -0
- package/dist/src/infrastructure/persistence/sqlite/migrations.d.ts +2 -13
- package/dist/src/infrastructure/persistence/sqlite/migrations.d.ts.map +1 -1
- package/dist/src/infrastructure/persistence/sqlite/migrations.js +63 -30
- package/dist/src/infrastructure/repositories/agent-run.repository.d.ts +25 -0
- package/dist/src/infrastructure/repositories/agent-run.repository.d.ts.map +1 -0
- package/dist/src/infrastructure/repositories/agent-run.repository.js +119 -0
- package/dist/src/infrastructure/services/agents/agent-executor-factory.service.d.ts +43 -0
- package/dist/src/infrastructure/services/agents/agent-executor-factory.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/agent-executor-factory.service.js +58 -0
- package/dist/src/infrastructure/services/agents/agent-registry.service.d.ts +18 -0
- package/dist/src/infrastructure/services/agents/agent-registry.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/agent-registry.service.js +30 -0
- package/dist/src/infrastructure/services/agents/agent-runner.service.d.ts +27 -0
- package/dist/src/infrastructure/services/agents/agent-runner.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/agent-runner.service.js +117 -0
- package/dist/src/infrastructure/services/agents/executors/claude-code-executor.service.d.ts +37 -0
- package/dist/src/infrastructure/services/agents/executors/claude-code-executor.service.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/executors/claude-code-executor.service.js +275 -0
- package/dist/src/infrastructure/services/agents/langgraph/analyze-repository-graph.d.ts +119 -0
- package/dist/src/infrastructure/services/agents/langgraph/analyze-repository-graph.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/langgraph/analyze-repository-graph.js +56 -0
- package/dist/src/infrastructure/services/agents/langgraph/checkpointer.d.ts +9 -0
- package/dist/src/infrastructure/services/agents/langgraph/checkpointer.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/langgraph/checkpointer.js +10 -0
- package/dist/src/infrastructure/services/agents/langgraph/prompts/analyze-repository.prompt.d.ts +3 -0
- package/dist/src/infrastructure/services/agents/langgraph/prompts/analyze-repository.prompt.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/langgraph/prompts/analyze-repository.prompt.js +18 -0
- package/dist/src/infrastructure/services/agents/streaming/event-channel.d.ts +39 -0
- package/dist/src/infrastructure/services/agents/streaming/event-channel.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/streaming/event-channel.js +64 -0
- package/dist/src/infrastructure/services/agents/streaming/index.d.ts +9 -0
- package/dist/src/infrastructure/services/agents/streaming/index.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/streaming/index.js +8 -0
- package/dist/src/infrastructure/services/agents/streaming/streaming-executor-proxy.d.ts +25 -0
- package/dist/src/infrastructure/services/agents/streaming/streaming-executor-proxy.d.ts.map +1 -0
- package/dist/src/infrastructure/services/agents/streaming/streaming-executor-proxy.js +51 -0
- package/dist/src/infrastructure/services/web-server.service.d.ts.map +1 -1
- package/dist/src/infrastructure/services/web-server.service.js +2 -3
- package/dist/src/presentation/cli/commands/run.command.d.ts +19 -0
- package/dist/src/presentation/cli/commands/run.command.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/run.command.js +130 -0
- package/dist/src/presentation/cli/index.js +2 -0
- package/dist/src/presentation/cli/ui/messages.d.ts +1 -1
- package/dist/src/presentation/cli/ui/messages.d.ts.map +1 -1
- package/dist/src/presentation/cli/ui/messages.js +9 -3
- package/dist/src/presentation/cli/ui/symbols.d.ts +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -3
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/cache/.previewinfo +1 -1
- package/web/.next/cache/.rscinfo +1 -1
- package/web/.next/cache/config.json +3 -3
- package/web/.next/fallback-build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +3 -3
- package/web/.next/required-server-files.js +1 -1
- package/web/.next/required-server-files.json +1 -1
- package/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.html +2 -2
- package/web/.next/server/app/_not-found.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/index.html +2 -2
- package/web/.next/server/app/index.rsc +1 -1
- package/web/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/version.html +2 -2
- package/web/.next/server/app/version.rsc +1 -1
- package/web/.next/server/app/version.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/version.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/version.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/version.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/version.segments/version/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/version.segments/version.segment.rsc +1 -1
- package/web/.next/server/chunks/ssr/_ccea5183._.js +1 -1
- package/web/.next/server/pages/404.html +2 -2
- package/web/.next/server/pages/500.html +2 -2
- package/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/server/server-reference-manifest.json +1 -1
- package/web/.next/trace +1 -1
- package/web/.next/trace-build +1 -1
- package/web/next.config.mjs +1 -0
- package/web/next.config.ts +0 -47
- /package/web/.next/static/{hQhBYhX3g-lgV-ix_LYg2 → -QL3Wkz2EyCtR0S30gd0p}/_buildManifest.js +0 -0
- /package/web/.next/static/{hQhBYhX3g-lgV-ix_LYg2 → -QL3Wkz2EyCtR0S30gd0p}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{hQhBYhX3g-lgV-ix_LYg2 → -QL3Wkz2EyCtR0S30gd0p}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code Executor Service
|
|
3
|
+
*
|
|
4
|
+
* Infrastructure implementation of IAgentExecutor for Claude Code agent.
|
|
5
|
+
* Executes prompts via the `claude` CLI subprocess with JSON and stream-json
|
|
6
|
+
* output formats.
|
|
7
|
+
*
|
|
8
|
+
* Uses constructor dependency injection for the spawn function
|
|
9
|
+
* to enable testability without mocking node:child_process directly.
|
|
10
|
+
*/
|
|
11
|
+
/** Features supported by Claude Code CLI */
|
|
12
|
+
const SUPPORTED_FEATURES = new Set([
|
|
13
|
+
'session-resume',
|
|
14
|
+
'streaming',
|
|
15
|
+
'system-prompt',
|
|
16
|
+
'structured-output',
|
|
17
|
+
]);
|
|
18
|
+
/**
|
|
19
|
+
* Executor service for Claude Code agent.
|
|
20
|
+
* Uses subprocess spawning to interact with the `claude` CLI.
|
|
21
|
+
*/
|
|
22
|
+
export class ClaudeCodeExecutorService {
|
|
23
|
+
spawn;
|
|
24
|
+
agentType = 'claude-code';
|
|
25
|
+
constructor(spawn) {
|
|
26
|
+
this.spawn = spawn;
|
|
27
|
+
}
|
|
28
|
+
async execute(prompt, options) {
|
|
29
|
+
const args = this.buildArgs(prompt, options);
|
|
30
|
+
const spawnOpts = this.buildSpawnOptions(options);
|
|
31
|
+
const proc = this.spawn('claude', args, spawnOpts);
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
let stdout = '';
|
|
34
|
+
let stderr = '';
|
|
35
|
+
let timedOut = false;
|
|
36
|
+
let timeoutId;
|
|
37
|
+
if (options?.timeout) {
|
|
38
|
+
timeoutId = setTimeout(() => {
|
|
39
|
+
timedOut = true;
|
|
40
|
+
proc.kill();
|
|
41
|
+
}, options.timeout);
|
|
42
|
+
}
|
|
43
|
+
proc.stdout?.on('data', (chunk) => {
|
|
44
|
+
stdout += chunk.toString();
|
|
45
|
+
});
|
|
46
|
+
proc.stderr?.on('data', (chunk) => {
|
|
47
|
+
stderr += chunk.toString();
|
|
48
|
+
});
|
|
49
|
+
proc.on('error', (error) => {
|
|
50
|
+
if (timeoutId)
|
|
51
|
+
clearTimeout(timeoutId);
|
|
52
|
+
reject(error);
|
|
53
|
+
});
|
|
54
|
+
proc.on('close', (code) => {
|
|
55
|
+
if (timeoutId)
|
|
56
|
+
clearTimeout(timeoutId);
|
|
57
|
+
if (timedOut) {
|
|
58
|
+
reject(new Error('Agent execution timed out'));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (code !== 0 && code !== null) {
|
|
62
|
+
reject(new Error(stderr.trim() || `Process exited with code ${code}`));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
resolve(this.parseJsonResult(stdout));
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async *executeStream(prompt, options) {
|
|
70
|
+
const args = this.buildStreamArgs(prompt, options);
|
|
71
|
+
const spawnOpts = this.buildSpawnOptions(options);
|
|
72
|
+
const proc = this.spawn('claude', args, spawnOpts);
|
|
73
|
+
// Close stdin immediately - we're not sending input in print mode
|
|
74
|
+
if (proc.stdin) {
|
|
75
|
+
proc.stdin.end();
|
|
76
|
+
}
|
|
77
|
+
// Buffer for incomplete lines
|
|
78
|
+
let lineBuffer = '';
|
|
79
|
+
let stderr = '';
|
|
80
|
+
// Create an async queue to bridge event-based IO to async iteration
|
|
81
|
+
const queue = [];
|
|
82
|
+
let resolve = null;
|
|
83
|
+
let error = null;
|
|
84
|
+
function enqueue(event) {
|
|
85
|
+
queue.push(event);
|
|
86
|
+
if (resolve) {
|
|
87
|
+
resolve();
|
|
88
|
+
resolve = null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function waitForItem() {
|
|
92
|
+
if (queue.length > 0)
|
|
93
|
+
return Promise.resolve();
|
|
94
|
+
return new Promise((r) => {
|
|
95
|
+
resolve = r;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
proc.stdout?.on('data', (chunk) => {
|
|
99
|
+
lineBuffer += chunk.toString();
|
|
100
|
+
const lines = lineBuffer.split('\n');
|
|
101
|
+
// Keep the last partial line in the buffer
|
|
102
|
+
lineBuffer = lines.pop() ?? '';
|
|
103
|
+
for (const line of lines) {
|
|
104
|
+
const trimmed = line.trim();
|
|
105
|
+
if (!trimmed)
|
|
106
|
+
continue;
|
|
107
|
+
const event = this.parseStreamLine(trimmed);
|
|
108
|
+
if (event) {
|
|
109
|
+
enqueue(event);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
proc.stderr?.on('data', (chunk) => {
|
|
114
|
+
stderr += chunk.toString();
|
|
115
|
+
});
|
|
116
|
+
proc.on('error', (err) => {
|
|
117
|
+
error = err;
|
|
118
|
+
enqueue(null); // signal end
|
|
119
|
+
});
|
|
120
|
+
proc.on('close', (code) => {
|
|
121
|
+
// Process any remaining data in the buffer
|
|
122
|
+
if (lineBuffer.trim()) {
|
|
123
|
+
const event = this.parseStreamLine(lineBuffer.trim());
|
|
124
|
+
if (event)
|
|
125
|
+
enqueue(event);
|
|
126
|
+
}
|
|
127
|
+
if (code !== 0 && code !== null && stderr.trim()) {
|
|
128
|
+
enqueue({
|
|
129
|
+
type: 'error',
|
|
130
|
+
content: stderr.trim(),
|
|
131
|
+
timestamp: new Date(),
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
enqueue(null); // signal end
|
|
135
|
+
});
|
|
136
|
+
// Yield events as they arrive
|
|
137
|
+
while (true) {
|
|
138
|
+
await waitForItem();
|
|
139
|
+
const item = queue.shift();
|
|
140
|
+
if (item === null || item === undefined) {
|
|
141
|
+
if (error !== null) {
|
|
142
|
+
yield {
|
|
143
|
+
type: 'error',
|
|
144
|
+
content: error.message,
|
|
145
|
+
timestamp: new Date(),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
yield item;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
supportsFeature(feature) {
|
|
154
|
+
return SUPPORTED_FEATURES.has(feature);
|
|
155
|
+
}
|
|
156
|
+
buildArgs(prompt, options) {
|
|
157
|
+
const args = ['-p', prompt, '--output-format', 'json'];
|
|
158
|
+
if (options?.resumeSession)
|
|
159
|
+
args.push('--resume', options.resumeSession);
|
|
160
|
+
if (options?.model)
|
|
161
|
+
args.push('--model', options.model);
|
|
162
|
+
if (options?.systemPrompt)
|
|
163
|
+
args.push('--append-system-prompt', options.systemPrompt);
|
|
164
|
+
if (options?.allowedTools?.length)
|
|
165
|
+
args.push('--allowedTools', options.allowedTools.join(','));
|
|
166
|
+
if (options?.outputSchema)
|
|
167
|
+
args.push('--json-schema', JSON.stringify(options.outputSchema));
|
|
168
|
+
if (options?.maxTurns)
|
|
169
|
+
args.push('--max-turns', String(options.maxTurns));
|
|
170
|
+
return args;
|
|
171
|
+
}
|
|
172
|
+
buildStreamArgs(prompt, options) {
|
|
173
|
+
const args = this.buildArgs(prompt, options);
|
|
174
|
+
const fmtIdx = args.indexOf('--output-format');
|
|
175
|
+
if (fmtIdx !== -1)
|
|
176
|
+
args[fmtIdx + 1] = 'stream-json';
|
|
177
|
+
// stream-json requires --verbose and --include-partial-messages when using -p (--print)
|
|
178
|
+
// --no-chrome ensures it runs in non-interactive mode without browser integration
|
|
179
|
+
args.push('--verbose', '--include-partial-messages', '--no-chrome');
|
|
180
|
+
return args;
|
|
181
|
+
}
|
|
182
|
+
buildSpawnOptions(options) {
|
|
183
|
+
const spawnOpts = {};
|
|
184
|
+
if (options?.cwd)
|
|
185
|
+
spawnOpts.cwd = options.cwd;
|
|
186
|
+
return spawnOpts;
|
|
187
|
+
}
|
|
188
|
+
parseJsonResult(stdout) {
|
|
189
|
+
const trimmed = stdout.trim();
|
|
190
|
+
try {
|
|
191
|
+
const parsed = JSON.parse(trimmed);
|
|
192
|
+
const result = {
|
|
193
|
+
result: parsed.result ?? trimmed,
|
|
194
|
+
};
|
|
195
|
+
if (parsed.session_id) {
|
|
196
|
+
result.sessionId = parsed.session_id;
|
|
197
|
+
}
|
|
198
|
+
if (parsed.input_tokens !== undefined && parsed.output_tokens !== undefined) {
|
|
199
|
+
result.usage = {
|
|
200
|
+
inputTokens: parsed.input_tokens,
|
|
201
|
+
outputTokens: parsed.output_tokens,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
// Store additional metadata
|
|
205
|
+
const { result: _r, session_id: _s, input_tokens: _it, output_tokens: _ot, ...rest } = parsed;
|
|
206
|
+
if (Object.keys(rest).length > 0) {
|
|
207
|
+
result.metadata = rest;
|
|
208
|
+
}
|
|
209
|
+
return result;
|
|
210
|
+
}
|
|
211
|
+
catch {
|
|
212
|
+
// If stdout is not valid JSON, treat it as raw text result
|
|
213
|
+
return { result: trimmed };
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
parseStreamLine(line) {
|
|
217
|
+
try {
|
|
218
|
+
const parsed = JSON.parse(line);
|
|
219
|
+
// Handle Claude Code stream_json format with nested events
|
|
220
|
+
if (parsed.type === 'stream_event' && parsed.event) {
|
|
221
|
+
const { event } = parsed;
|
|
222
|
+
// Extract text deltas for progress
|
|
223
|
+
if (event.type === 'content_block_delta' && event.delta?.text) {
|
|
224
|
+
return {
|
|
225
|
+
type: 'progress',
|
|
226
|
+
content: event.delta.text,
|
|
227
|
+
timestamp: new Date(),
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
// Message complete - ignore for now (accumulated text is in progress events)
|
|
231
|
+
if (event.type === 'message_stop') {
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// Ignore assistant messages - we already get all text via content_block_delta events
|
|
236
|
+
if (parsed.type === 'assistant') {
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
// Handle legacy format (backward compatibility)
|
|
240
|
+
if (parsed.type === 'result') {
|
|
241
|
+
return {
|
|
242
|
+
type: 'result',
|
|
243
|
+
content: parsed.result ?? '',
|
|
244
|
+
timestamp: new Date(),
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
if (parsed.type === 'error') {
|
|
248
|
+
return {
|
|
249
|
+
type: 'error',
|
|
250
|
+
content: parsed.error ?? parsed.message ?? '',
|
|
251
|
+
timestamp: new Date(),
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
// Generic progress for other event types (ensure content is a string)
|
|
255
|
+
if (parsed.content || parsed.message) {
|
|
256
|
+
const rawContent = parsed.content ?? parsed.message;
|
|
257
|
+
const content = typeof rawContent === 'string' ? rawContent : JSON.stringify(rawContent);
|
|
258
|
+
return {
|
|
259
|
+
type: 'progress',
|
|
260
|
+
content,
|
|
261
|
+
timestamp: new Date(),
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
// Non-JSON line, treat as progress text
|
|
268
|
+
return {
|
|
269
|
+
type: 'progress',
|
|
270
|
+
content: line,
|
|
271
|
+
timestamp: new Date(),
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { type BaseCheckpointSaver } from '@langchain/langgraph';
|
|
2
|
+
import type { IAgentExecutor } from '../../../../application/ports/output/agent-executor.interface.js';
|
|
3
|
+
/**
|
|
4
|
+
* State annotation for the analyze-repository graph.
|
|
5
|
+
*
|
|
6
|
+
* Uses LangGraph's Annotation API to define state channels with
|
|
7
|
+
* last-value semantics (default behavior — each update replaces the value).
|
|
8
|
+
*/
|
|
9
|
+
export declare const AnalyzeRepositoryState: import("@langchain/langgraph").AnnotationRoot<{
|
|
10
|
+
repositoryPath: {
|
|
11
|
+
(): import("@langchain/langgraph").LastValue<string>;
|
|
12
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string, string>): import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
|
|
13
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
14
|
+
};
|
|
15
|
+
analysisMarkdown: {
|
|
16
|
+
(): import("@langchain/langgraph").LastValue<string>;
|
|
17
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string, string>): import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
|
|
18
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
19
|
+
};
|
|
20
|
+
sessionId: {
|
|
21
|
+
(): import("@langchain/langgraph").LastValue<string | undefined>;
|
|
22
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | undefined, string | undefined>): import("@langchain/langgraph").BinaryOperatorAggregate<string | undefined, string | undefined>;
|
|
23
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
24
|
+
};
|
|
25
|
+
error: {
|
|
26
|
+
(): import("@langchain/langgraph").LastValue<string | undefined>;
|
|
27
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | undefined, string | undefined>): import("@langchain/langgraph").BinaryOperatorAggregate<string | undefined, string | undefined>;
|
|
28
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
29
|
+
};
|
|
30
|
+
}>;
|
|
31
|
+
export type AnalyzeRepositoryStateType = typeof AnalyzeRepositoryState.State;
|
|
32
|
+
/**
|
|
33
|
+
* Factory function that creates and compiles the analyze-repository LangGraph.
|
|
34
|
+
*
|
|
35
|
+
* The graph has a single node (`analyze`) that calls the provided IAgentExecutor
|
|
36
|
+
* to generate a repository analysis document. An optional checkpointer enables
|
|
37
|
+
* persistence of graph state across invocations.
|
|
38
|
+
*
|
|
39
|
+
* @param executor - The agent executor to delegate prompt execution to
|
|
40
|
+
* @param checkpointer - Optional checkpoint saver for state persistence
|
|
41
|
+
* @returns A compiled LangGraph ready to be invoked
|
|
42
|
+
*/
|
|
43
|
+
export declare function createAnalyzeRepositoryGraph(executor: IAgentExecutor, checkpointer?: BaseCheckpointSaver): import("@langchain/langgraph").CompiledStateGraph<{
|
|
44
|
+
repositoryPath: string;
|
|
45
|
+
analysisMarkdown: string;
|
|
46
|
+
sessionId: string | undefined;
|
|
47
|
+
error: string | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
repositoryPath?: string | undefined;
|
|
50
|
+
analysisMarkdown?: string | undefined;
|
|
51
|
+
sessionId?: string | undefined;
|
|
52
|
+
error?: string | undefined;
|
|
53
|
+
}, "__start__" | "analyze", {
|
|
54
|
+
repositoryPath: {
|
|
55
|
+
(): import("@langchain/langgraph").LastValue<string>;
|
|
56
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string, string>): import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
|
|
57
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
58
|
+
};
|
|
59
|
+
analysisMarkdown: {
|
|
60
|
+
(): import("@langchain/langgraph").LastValue<string>;
|
|
61
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string, string>): import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
|
|
62
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
63
|
+
};
|
|
64
|
+
sessionId: {
|
|
65
|
+
(): import("@langchain/langgraph").LastValue<string | undefined>;
|
|
66
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | undefined, string | undefined>): import("@langchain/langgraph").BinaryOperatorAggregate<string | undefined, string | undefined>;
|
|
67
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
68
|
+
};
|
|
69
|
+
error: {
|
|
70
|
+
(): import("@langchain/langgraph").LastValue<string | undefined>;
|
|
71
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | undefined, string | undefined>): import("@langchain/langgraph").BinaryOperatorAggregate<string | undefined, string | undefined>;
|
|
72
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
73
|
+
};
|
|
74
|
+
}, {
|
|
75
|
+
repositoryPath: {
|
|
76
|
+
(): import("@langchain/langgraph").LastValue<string>;
|
|
77
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string, string>): import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
|
|
78
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
79
|
+
};
|
|
80
|
+
analysisMarkdown: {
|
|
81
|
+
(): import("@langchain/langgraph").LastValue<string>;
|
|
82
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string, string>): import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
|
|
83
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
84
|
+
};
|
|
85
|
+
sessionId: {
|
|
86
|
+
(): import("@langchain/langgraph").LastValue<string | undefined>;
|
|
87
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | undefined, string | undefined>): import("@langchain/langgraph").BinaryOperatorAggregate<string | undefined, string | undefined>;
|
|
88
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
89
|
+
};
|
|
90
|
+
error: {
|
|
91
|
+
(): import("@langchain/langgraph").LastValue<string | undefined>;
|
|
92
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | undefined, string | undefined>): import("@langchain/langgraph").BinaryOperatorAggregate<string | undefined, string | undefined>;
|
|
93
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
94
|
+
};
|
|
95
|
+
}, import("@langchain/langgraph").StateDefinition, {
|
|
96
|
+
analyze: Partial<import("@langchain/langgraph").StateType<{
|
|
97
|
+
repositoryPath: {
|
|
98
|
+
(): import("@langchain/langgraph").LastValue<string>;
|
|
99
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string, string>): import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
|
|
100
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
101
|
+
};
|
|
102
|
+
analysisMarkdown: {
|
|
103
|
+
(): import("@langchain/langgraph").LastValue<string>;
|
|
104
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string, string>): import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
|
|
105
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
106
|
+
};
|
|
107
|
+
sessionId: {
|
|
108
|
+
(): import("@langchain/langgraph").LastValue<string | undefined>;
|
|
109
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | undefined, string | undefined>): import("@langchain/langgraph").BinaryOperatorAggregate<string | undefined, string | undefined>;
|
|
110
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
111
|
+
};
|
|
112
|
+
error: {
|
|
113
|
+
(): import("@langchain/langgraph").LastValue<string | undefined>;
|
|
114
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | undefined, string | undefined>): import("@langchain/langgraph").BinaryOperatorAggregate<string | undefined, string | undefined>;
|
|
115
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
116
|
+
};
|
|
117
|
+
}>>;
|
|
118
|
+
}, unknown, unknown>;
|
|
119
|
+
//# sourceMappingURL=analyze-repository-graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze-repository-graph.d.ts","sourceRoot":"","sources":["../../../../../../src/infrastructure/services/agents/langgraph/analyze-repository-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wDAAwD,CAAC;AAI7F;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;EAKjC,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,OAAO,sBAAsB,CAAC,KAAK,CAAC;AA+B7E;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,cAAc,EACxB,YAAY,CAAC,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAQnC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Annotation, StateGraph, START, END } from '@langchain/langgraph';
|
|
2
|
+
import { AgentFeature } from '../../../../domain/generated/output.js';
|
|
3
|
+
import { buildAnalyzePrompt } from './prompts/analyze-repository.prompt.js';
|
|
4
|
+
/**
|
|
5
|
+
* State annotation for the analyze-repository graph.
|
|
6
|
+
*
|
|
7
|
+
* Uses LangGraph's Annotation API to define state channels with
|
|
8
|
+
* last-value semantics (default behavior — each update replaces the value).
|
|
9
|
+
*/
|
|
10
|
+
export const AnalyzeRepositoryState = Annotation.Root({
|
|
11
|
+
repositoryPath: (Annotation),
|
|
12
|
+
analysisMarkdown: (Annotation),
|
|
13
|
+
sessionId: (Annotation),
|
|
14
|
+
error: (Annotation),
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* Creates the analyze node function that calls the agent-agnostic executor.
|
|
18
|
+
*
|
|
19
|
+
* The node receives the current state, builds a prompt from the repository path,
|
|
20
|
+
* and delegates execution to the injected IAgentExecutor. Session resume is
|
|
21
|
+
* attempted if the executor supports it and a sessionId exists in state.
|
|
22
|
+
*/
|
|
23
|
+
function createAnalyzeNode(executor) {
|
|
24
|
+
return async (state) => {
|
|
25
|
+
const prompt = buildAnalyzePrompt(state.repositoryPath);
|
|
26
|
+
const options = {
|
|
27
|
+
cwd: state.repositoryPath,
|
|
28
|
+
};
|
|
29
|
+
if (state.sessionId && executor.supportsFeature(AgentFeature.sessionResume)) {
|
|
30
|
+
options.resumeSession = state.sessionId;
|
|
31
|
+
}
|
|
32
|
+
const result = await executor.execute(prompt, options);
|
|
33
|
+
return {
|
|
34
|
+
analysisMarkdown: result.result,
|
|
35
|
+
sessionId: result.sessionId ?? state.sessionId,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Factory function that creates and compiles the analyze-repository LangGraph.
|
|
41
|
+
*
|
|
42
|
+
* The graph has a single node (`analyze`) that calls the provided IAgentExecutor
|
|
43
|
+
* to generate a repository analysis document. An optional checkpointer enables
|
|
44
|
+
* persistence of graph state across invocations.
|
|
45
|
+
*
|
|
46
|
+
* @param executor - The agent executor to delegate prompt execution to
|
|
47
|
+
* @param checkpointer - Optional checkpoint saver for state persistence
|
|
48
|
+
* @returns A compiled LangGraph ready to be invoked
|
|
49
|
+
*/
|
|
50
|
+
export function createAnalyzeRepositoryGraph(executor, checkpointer) {
|
|
51
|
+
const graph = new StateGraph(AnalyzeRepositoryState)
|
|
52
|
+
.addNode('analyze', createAnalyzeNode(executor))
|
|
53
|
+
.addEdge(START, 'analyze')
|
|
54
|
+
.addEdge('analyze', END);
|
|
55
|
+
return graph.compile({ checkpointer });
|
|
56
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SqliteSaver } from '@langchain/langgraph-checkpoint-sqlite';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a SQLite-backed checkpoint saver for LangGraph state persistence.
|
|
4
|
+
*
|
|
5
|
+
* @param dbPath - Path to the SQLite database file (e.g., ':memory:' or a file path)
|
|
6
|
+
* @returns A SqliteSaver instance ready for use as a LangGraph checkpointer
|
|
7
|
+
*/
|
|
8
|
+
export declare function createCheckpointer(dbPath: string): SqliteSaver;
|
|
9
|
+
//# sourceMappingURL=checkpointer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpointer.d.ts","sourceRoot":"","sources":["../../../../../../src/infrastructure/services/agents/langgraph/checkpointer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAErE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAE9D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SqliteSaver } from '@langchain/langgraph-checkpoint-sqlite';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a SQLite-backed checkpoint saver for LangGraph state persistence.
|
|
4
|
+
*
|
|
5
|
+
* @param dbPath - Path to the SQLite database file (e.g., ':memory:' or a file path)
|
|
6
|
+
* @returns A SqliteSaver instance ready for use as a LangGraph checkpointer
|
|
7
|
+
*/
|
|
8
|
+
export function createCheckpointer(dbPath) {
|
|
9
|
+
return SqliteSaver.fromConnString(dbPath);
|
|
10
|
+
}
|
package/dist/src/infrastructure/services/agents/langgraph/prompts/analyze-repository.prompt.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const ANALYZE_REPOSITORY_PROMPT = "You are analyzing a software repository.\nExamine the codebase structure, dependencies, architecture patterns, and conventions.\nGenerate a comprehensive analysis document in Markdown format.\n\nRepository path: {{repositoryPath}}\n\nYour analysis should include:\n1. Project overview and purpose\n2. Technology stack and dependencies\n3. Architecture patterns and code organization\n4. Key conventions and patterns\n5. Build system and development workflow\n6. Testing strategy\n\nOutput a complete shep-analysis.md document.";
|
|
2
|
+
export declare function buildAnalyzePrompt(repositoryPath: string): string;
|
|
3
|
+
//# sourceMappingURL=analyze-repository.prompt.d.ts.map
|
package/dist/src/infrastructure/services/agents/langgraph/prompts/analyze-repository.prompt.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze-repository.prompt.d.ts","sourceRoot":"","sources":["../../../../../../../src/infrastructure/services/agents/langgraph/prompts/analyze-repository.prompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,mhBAcO,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAEjE"}
|
package/dist/src/infrastructure/services/agents/langgraph/prompts/analyze-repository.prompt.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const ANALYZE_REPOSITORY_PROMPT = `You are analyzing a software repository.
|
|
2
|
+
Examine the codebase structure, dependencies, architecture patterns, and conventions.
|
|
3
|
+
Generate a comprehensive analysis document in Markdown format.
|
|
4
|
+
|
|
5
|
+
Repository path: {{repositoryPath}}
|
|
6
|
+
|
|
7
|
+
Your analysis should include:
|
|
8
|
+
1. Project overview and purpose
|
|
9
|
+
2. Technology stack and dependencies
|
|
10
|
+
3. Architecture patterns and code organization
|
|
11
|
+
4. Key conventions and patterns
|
|
12
|
+
5. Build system and development workflow
|
|
13
|
+
6. Testing strategy
|
|
14
|
+
|
|
15
|
+
Output a complete shep-analysis.md document.`;
|
|
16
|
+
export function buildAnalyzePrompt(repositoryPath) {
|
|
17
|
+
return ANALYZE_REPOSITORY_PROMPT.replace('{{repositoryPath}}', repositoryPath);
|
|
18
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EventChannel - Generic Async Push/Pull Queue
|
|
3
|
+
*
|
|
4
|
+
* Bridges event producers (push) and async iteration consumers (for-await-of).
|
|
5
|
+
* Used by the streaming infrastructure to forward agent execution events
|
|
6
|
+
* from the StreamingExecutorProxy to the AgentRunnerService caller.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const channel = new EventChannel<string>();
|
|
11
|
+
*
|
|
12
|
+
* // Producer side
|
|
13
|
+
* channel.push('progress update');
|
|
14
|
+
* channel.push('done');
|
|
15
|
+
* channel.close();
|
|
16
|
+
*
|
|
17
|
+
* // Consumer side
|
|
18
|
+
* for await (const event of channel) {
|
|
19
|
+
* console.log(event);
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class EventChannel<T> implements AsyncIterable<T> {
|
|
24
|
+
private queue;
|
|
25
|
+
private closed;
|
|
26
|
+
private resolve;
|
|
27
|
+
/**
|
|
28
|
+
* Push an event into the channel.
|
|
29
|
+
* Ignored if the channel is already closed.
|
|
30
|
+
*/
|
|
31
|
+
push(event: T): void;
|
|
32
|
+
/**
|
|
33
|
+
* Close the channel, signaling no more events will be pushed.
|
|
34
|
+
* Safe to call multiple times.
|
|
35
|
+
*/
|
|
36
|
+
close(): void;
|
|
37
|
+
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=event-channel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-channel.d.ts","sourceRoot":"","sources":["../../../../../../src/infrastructure/services/agents/streaming/event-channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,YAAY,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IACtD,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAA6B;IAE5C;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;IASpB;;;OAGG;IACH,KAAK,IAAI,IAAI;IAQN,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC;CAYlD"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EventChannel - Generic Async Push/Pull Queue
|
|
3
|
+
*
|
|
4
|
+
* Bridges event producers (push) and async iteration consumers (for-await-of).
|
|
5
|
+
* Used by the streaming infrastructure to forward agent execution events
|
|
6
|
+
* from the StreamingExecutorProxy to the AgentRunnerService caller.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const channel = new EventChannel<string>();
|
|
11
|
+
*
|
|
12
|
+
* // Producer side
|
|
13
|
+
* channel.push('progress update');
|
|
14
|
+
* channel.push('done');
|
|
15
|
+
* channel.close();
|
|
16
|
+
*
|
|
17
|
+
* // Consumer side
|
|
18
|
+
* for await (const event of channel) {
|
|
19
|
+
* console.log(event);
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export class EventChannel {
|
|
24
|
+
queue = [];
|
|
25
|
+
closed = false;
|
|
26
|
+
resolve = null;
|
|
27
|
+
/**
|
|
28
|
+
* Push an event into the channel.
|
|
29
|
+
* Ignored if the channel is already closed.
|
|
30
|
+
*/
|
|
31
|
+
push(event) {
|
|
32
|
+
if (this.closed)
|
|
33
|
+
return;
|
|
34
|
+
this.queue.push(event);
|
|
35
|
+
if (this.resolve) {
|
|
36
|
+
this.resolve();
|
|
37
|
+
this.resolve = null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Close the channel, signaling no more events will be pushed.
|
|
42
|
+
* Safe to call multiple times.
|
|
43
|
+
*/
|
|
44
|
+
close() {
|
|
45
|
+
this.closed = true;
|
|
46
|
+
if (this.resolve) {
|
|
47
|
+
this.resolve();
|
|
48
|
+
this.resolve = null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async *[Symbol.asyncIterator]() {
|
|
52
|
+
while (true) {
|
|
53
|
+
if (this.queue.length > 0) {
|
|
54
|
+
yield this.queue.shift();
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (this.closed)
|
|
58
|
+
return;
|
|
59
|
+
await new Promise((r) => {
|
|
60
|
+
this.resolve = r;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Streaming Module
|
|
3
|
+
*
|
|
4
|
+
* Provides the streaming infrastructure for transparent real-time
|
|
5
|
+
* event delivery from agent executors through the graph pipeline.
|
|
6
|
+
*/
|
|
7
|
+
export { EventChannel } from './event-channel.js';
|
|
8
|
+
export { StreamingExecutorProxy } from './streaming-executor-proxy.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/infrastructure/services/agents/streaming/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Streaming Module
|
|
3
|
+
*
|
|
4
|
+
* Provides the streaming infrastructure for transparent real-time
|
|
5
|
+
* event delivery from agent executors through the graph pipeline.
|
|
6
|
+
*/
|
|
7
|
+
export { EventChannel } from './event-channel.js';
|
|
8
|
+
export { StreamingExecutorProxy } from './streaming-executor-proxy.js';
|