@bastani/atomic 0.5.9 → 0.5.10
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 +1 -1
- package/dist/sdk/define-workflow.d.ts +1 -1
- package/dist/sdk/workflows/builtin/deep-research-codebase/copilot/index.d.ts +0 -3
- package/dist/sdk/workflows/builtin/deep-research-codebase/copilot/index.d.ts.map +1 -1
- package/dist/sdk/workflows/builtin/ralph/copilot/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/sdk/define-workflow.ts +1 -1
- package/src/sdk/workflows/builtin/deep-research-codebase/copilot/index.ts +37 -59
- package/src/sdk/workflows/builtin/ralph/copilot/index.ts +30 -53
package/README.md
CHANGED
|
@@ -572,7 +572,7 @@ The runtime auto-creates `s.client` and `s.session` — use them directly inside
|
|
|
572
572
|
| Agent | How to send a prompt |
|
|
573
573
|
| ----- | -------------------- |
|
|
574
574
|
| **Claude** | `await s.session.query(prompt)` |
|
|
575
|
-
| **Copilot** | `await s.session.
|
|
575
|
+
| **Copilot** | `await s.session.send({ prompt })` |
|
|
576
576
|
| **OpenCode** | `await s.client.session.prompt({ sessionID: s.session.id, parts: [{ type: "text", text: prompt }] })` |
|
|
577
577
|
|
|
578
578
|
#### Key Rules
|
|
@@ -57,7 +57,7 @@ export declare class WorkflowBuilder<A extends AgentType = AgentType> {
|
|
|
57
57
|
* {},
|
|
58
58
|
* async (s) => {
|
|
59
59
|
* // s.client: CopilotClient, s.session: CopilotSession
|
|
60
|
-
* await s.session.
|
|
60
|
+
* await s.session.send({ prompt: s.inputs.prompt ?? "" });
|
|
61
61
|
* s.save(await s.session.getMessages());
|
|
62
62
|
* },
|
|
63
63
|
* );
|
|
@@ -26,9 +26,6 @@
|
|
|
26
26
|
*
|
|
27
27
|
* Copilot-specific concerns baked in:
|
|
28
28
|
*
|
|
29
|
-
* • F10 — every `sendAndWait` passes an explicit 30-minute timeout. The SDK
|
|
30
|
-
* default is 60 seconds; a timeout THROWS and aborts the entire stage.
|
|
31
|
-
* Explorers can easily exceed 60s on large partitions.
|
|
32
29
|
*
|
|
33
30
|
* • F5 — every `ctx.stage()` call is a FRESH session with no memory of prior
|
|
34
31
|
* stages. We forward the scout overview, history overview, and partition
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/sdk/workflows/builtin/deep-research-codebase/copilot/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/sdk/workflows/builtin/deep-research-codebase/copilot/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;;AAuBH,wBA4La"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/sdk/workflows/builtin/ralph/copilot/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/sdk/workflows/builtin/ralph/copilot/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;AAmDH,wBA4Ia"}
|
package/package.json
CHANGED
|
@@ -150,7 +150,7 @@ export class WorkflowBuilder<A extends AgentType = AgentType> {
|
|
|
150
150
|
* {},
|
|
151
151
|
* async (s) => {
|
|
152
152
|
* // s.client: CopilotClient, s.session: CopilotSession
|
|
153
|
-
* await s.session.
|
|
153
|
+
* await s.session.send({ prompt: s.inputs.prompt ?? "" });
|
|
154
154
|
* s.save(await s.session.getMessages());
|
|
155
155
|
* },
|
|
156
156
|
* );
|
|
@@ -26,9 +26,6 @@
|
|
|
26
26
|
*
|
|
27
27
|
* Copilot-specific concerns baked in:
|
|
28
28
|
*
|
|
29
|
-
* • F10 — every `sendAndWait` passes an explicit 30-minute timeout. The SDK
|
|
30
|
-
* default is 60 seconds; a timeout THROWS and aborts the entire stage.
|
|
31
|
-
* Explorers can easily exceed 60s on large partitions.
|
|
32
29
|
*
|
|
33
30
|
* • F5 — every `ctx.stage()` call is a FRESH session with no memory of prior
|
|
34
31
|
* stages. We forward the scout overview, history overview, and partition
|
|
@@ -66,15 +63,6 @@ import {
|
|
|
66
63
|
slugifyPrompt,
|
|
67
64
|
} from "../helpers/prompts.ts";
|
|
68
65
|
|
|
69
|
-
// ── Timeouts ────────────────────────────────────────────────────────────────
|
|
70
|
-
// Every sendAndWait call passes one of these explicitly — never relying on
|
|
71
|
-
// the 60-second default (F10). Pick generously; a hung session still surfaces
|
|
72
|
-
// as a clear error rather than silently breaking downstream stages.
|
|
73
|
-
const SCOUT_TIMEOUT_MS = 15 * 60 * 1000; // 15 min — short orientation call
|
|
74
|
-
const HISTORY_TIMEOUT_MS = 20 * 60 * 1000; // 20 min — reads research/ docs
|
|
75
|
-
const EXPLORER_TIMEOUT_MS = 45 * 60 * 1000; // 45 min — multi-step locate/analyze
|
|
76
|
-
const AGGREGATOR_TIMEOUT_MS = 45 * 60 * 1000; // 45 min — reads N explorer reports
|
|
77
|
-
|
|
78
66
|
export default defineWorkflow<"copilot">({
|
|
79
67
|
name: "deep-research-codebase",
|
|
80
68
|
description:
|
|
@@ -127,19 +115,16 @@ export default defineWorkflow<"copilot">({
|
|
|
127
115
|
// 4. Short LLM call: architectural orientation for downstream
|
|
128
116
|
// explorers. The prompt forbids the agent from answering the
|
|
129
117
|
// research question — its only job here is to orient.
|
|
130
|
-
await s.session.
|
|
131
|
-
{
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
},
|
|
141
|
-
SCOUT_TIMEOUT_MS,
|
|
142
|
-
);
|
|
118
|
+
await s.session.send({
|
|
119
|
+
prompt: buildScoutPrompt({
|
|
120
|
+
question: prompt,
|
|
121
|
+
tree: data.tree,
|
|
122
|
+
totalLoc: data.totalLoc,
|
|
123
|
+
totalFiles: data.totalFiles,
|
|
124
|
+
explorerCount: actualCount,
|
|
125
|
+
partitionPreview: partitions,
|
|
126
|
+
}),
|
|
127
|
+
});
|
|
143
128
|
// F9: Copilot takes SessionEvent[], not a session ID.
|
|
144
129
|
s.save(await s.session.getMessages());
|
|
145
130
|
|
|
@@ -166,10 +151,9 @@ export default defineWorkflow<"copilot">({
|
|
|
166
151
|
// The generic history prompt drives a single default-agent session
|
|
167
152
|
// through locate → analyze → synthesize inline, instead of Claude's
|
|
168
153
|
// sub-agent dispatch.
|
|
169
|
-
await s.session.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
);
|
|
154
|
+
await s.session.send({
|
|
155
|
+
prompt: buildHistoryPromptGeneric({ question: prompt, root }),
|
|
156
|
+
});
|
|
173
157
|
s.save(await s.session.getMessages());
|
|
174
158
|
},
|
|
175
159
|
),
|
|
@@ -210,21 +194,18 @@ export default defineWorkflow<"copilot">({
|
|
|
210
194
|
{},
|
|
211
195
|
{},
|
|
212
196
|
async (s) => {
|
|
213
|
-
await s.session.
|
|
214
|
-
{
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
},
|
|
226
|
-
EXPLORER_TIMEOUT_MS,
|
|
227
|
-
);
|
|
197
|
+
await s.session.send({
|
|
198
|
+
prompt: buildExplorerPromptGeneric({
|
|
199
|
+
question: prompt,
|
|
200
|
+
index: i,
|
|
201
|
+
total: explorerCount,
|
|
202
|
+
partition,
|
|
203
|
+
scoutOverview,
|
|
204
|
+
historyOverview,
|
|
205
|
+
scratchPath,
|
|
206
|
+
root,
|
|
207
|
+
}),
|
|
208
|
+
});
|
|
228
209
|
s.save(await s.session.getMessages());
|
|
229
210
|
|
|
230
211
|
// Returning structured metadata lets the aggregator stage reach
|
|
@@ -254,21 +235,18 @@ export default defineWorkflow<"copilot">({
|
|
|
254
235
|
{},
|
|
255
236
|
{},
|
|
256
237
|
async (s) => {
|
|
257
|
-
await s.session.
|
|
258
|
-
{
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
},
|
|
270
|
-
AGGREGATOR_TIMEOUT_MS,
|
|
271
|
-
);
|
|
238
|
+
await s.session.send({
|
|
239
|
+
prompt: buildAggregatorPrompt({
|
|
240
|
+
question: prompt,
|
|
241
|
+
totalLoc,
|
|
242
|
+
totalFiles,
|
|
243
|
+
explorerCount,
|
|
244
|
+
explorerFiles: explorerHandles.map((h) => h.result),
|
|
245
|
+
finalPath,
|
|
246
|
+
scoutOverview,
|
|
247
|
+
historyOverview,
|
|
248
|
+
}),
|
|
249
|
+
});
|
|
272
250
|
s.save(await s.session.getMessages());
|
|
273
251
|
},
|
|
274
252
|
);
|
|
@@ -26,14 +26,6 @@ import { safeGitStatusS } from "../helpers/git.ts";
|
|
|
26
26
|
|
|
27
27
|
const MAX_LOOPS = 10;
|
|
28
28
|
const CONSECUTIVE_CLEAN_THRESHOLD = 2;
|
|
29
|
-
/**
|
|
30
|
-
* Per-agent send timeout. `CopilotSession.sendAndWait` defaults to 60s, which
|
|
31
|
-
* is far too short for real planner/orchestrator/reviewer/debugger work — a
|
|
32
|
-
* timeout there throws and aborts the whole workflow before the next stage
|
|
33
|
-
* can run. 30 minutes gives each sub-agent ample headroom while still
|
|
34
|
-
* surfacing truly hung sessions.
|
|
35
|
-
*/
|
|
36
|
-
const AGENT_SEND_TIMEOUT_MS = 30 * 60 * 1000;
|
|
37
29
|
|
|
38
30
|
/**
|
|
39
31
|
* Concatenate the text content of every top-level assistant message in the
|
|
@@ -90,15 +82,12 @@ export default defineWorkflow<"copilot">({
|
|
|
90
82
|
{},
|
|
91
83
|
{ agent: "planner" },
|
|
92
84
|
async (s) => {
|
|
93
|
-
await s.session.
|
|
94
|
-
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
AGENT_SEND_TIMEOUT_MS,
|
|
101
|
-
);
|
|
85
|
+
await s.session.send({
|
|
86
|
+
prompt: buildPlannerPrompt(userPromptText, {
|
|
87
|
+
iteration,
|
|
88
|
+
debuggerReport: debuggerReport || undefined,
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
102
91
|
const messages = await s.session.getMessages();
|
|
103
92
|
s.save(messages);
|
|
104
93
|
return getAssistantText(messages);
|
|
@@ -113,14 +102,11 @@ export default defineWorkflow<"copilot">({
|
|
|
113
102
|
{},
|
|
114
103
|
{ agent: "orchestrator" },
|
|
115
104
|
async (s) => {
|
|
116
|
-
await s.session.
|
|
117
|
-
{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
},
|
|
122
|
-
AGENT_SEND_TIMEOUT_MS,
|
|
123
|
-
);
|
|
105
|
+
await s.session.send({
|
|
106
|
+
prompt: buildOrchestratorPrompt(userPromptText, {
|
|
107
|
+
plannerNotes: planner.result,
|
|
108
|
+
}),
|
|
109
|
+
});
|
|
124
110
|
s.save(await s.session.getMessages());
|
|
125
111
|
},
|
|
126
112
|
);
|
|
@@ -134,15 +120,12 @@ export default defineWorkflow<"copilot">({
|
|
|
134
120
|
{},
|
|
135
121
|
{ agent: "reviewer" },
|
|
136
122
|
async (s) => {
|
|
137
|
-
await s.session.
|
|
138
|
-
{
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
},
|
|
144
|
-
AGENT_SEND_TIMEOUT_MS,
|
|
145
|
-
);
|
|
123
|
+
await s.session.send({
|
|
124
|
+
prompt: buildReviewPrompt(userPromptText, {
|
|
125
|
+
gitStatus,
|
|
126
|
+
iteration,
|
|
127
|
+
}),
|
|
128
|
+
});
|
|
146
129
|
const messages = await s.session.getMessages();
|
|
147
130
|
s.save(messages);
|
|
148
131
|
return getAssistantText(messages);
|
|
@@ -165,16 +148,13 @@ export default defineWorkflow<"copilot">({
|
|
|
165
148
|
{},
|
|
166
149
|
{ agent: "reviewer" },
|
|
167
150
|
async (s) => {
|
|
168
|
-
await s.session.
|
|
169
|
-
{
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
},
|
|
176
|
-
AGENT_SEND_TIMEOUT_MS,
|
|
177
|
-
);
|
|
151
|
+
await s.session.send({
|
|
152
|
+
prompt: buildReviewPrompt(userPromptText, {
|
|
153
|
+
gitStatus,
|
|
154
|
+
iteration,
|
|
155
|
+
isConfirmationPass: true,
|
|
156
|
+
}),
|
|
157
|
+
});
|
|
178
158
|
const messages = await s.session.getMessages();
|
|
179
159
|
s.save(messages);
|
|
180
160
|
return getAssistantText(messages);
|
|
@@ -203,15 +183,12 @@ export default defineWorkflow<"copilot">({
|
|
|
203
183
|
{},
|
|
204
184
|
{ agent: "debugger" },
|
|
205
185
|
async (s) => {
|
|
206
|
-
await s.session.
|
|
207
|
-
{
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
},
|
|
213
|
-
AGENT_SEND_TIMEOUT_MS,
|
|
214
|
-
);
|
|
186
|
+
await s.session.send({
|
|
187
|
+
prompt: buildDebuggerReportPrompt(parsed, reviewRaw, {
|
|
188
|
+
iteration,
|
|
189
|
+
gitStatus,
|
|
190
|
+
}),
|
|
191
|
+
});
|
|
215
192
|
const messages = await s.session.getMessages();
|
|
216
193
|
s.save(messages);
|
|
217
194
|
return getAssistantText(messages);
|