clanka 0.2.16 → 0.2.18
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/AgentTools.js +1 -1
- package/dist/ScriptPreprocessing.d.ts.map +1 -1
- package/dist/ScriptPreprocessing.js +80 -57
- package/dist/ScriptPreprocessing.js.map +1 -1
- package/dist/ScriptPreprocessing.test.js +9 -1
- package/dist/ScriptPreprocessing.test.js.map +1 -1
- package/package.json +1 -1
- package/src/AgentTools.ts +1 -1
- package/src/ScriptPreprocessing.test.ts +19 -14
- package/src/ScriptPreprocessing.ts +114 -65
- package/src/fixtures/patch5-broken.txt +227 -0
- package/src/fixtures/patch5-fixed.txt +227 -0
- package/src/fixtures/patch6-broken.txt +20 -0
- package/src/fixtures/patch6-fixed.txt +20 -0
- package/src/fixtures/patch7-broken.txt +12 -0
- package/src/fixtures/patch7-fixed.txt +12 -0
package/dist/AgentTools.js
CHANGED
|
@@ -113,7 +113,7 @@ export const AgentTools = Toolkit.make(Tool.make("readFile", {
|
|
|
113
113
|
}),
|
|
114
114
|
dependencies: [CurrentDirectory],
|
|
115
115
|
}), Tool.make("applyPatch", {
|
|
116
|
-
description: "
|
|
116
|
+
description: "Add, update or remove multiple files with a git diff / unified diff / wrapped patch.",
|
|
117
117
|
parameters: Schema.String.annotate({
|
|
118
118
|
identifier: "patch",
|
|
119
119
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScriptPreprocessing.d.ts","sourceRoot":"","sources":["../src/ScriptPreprocessing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScriptPreprocessing.d.ts","sourceRoot":"","sources":["../src/ScriptPreprocessing.ts"],"names":[],"mappings":"AAkfA,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,MAM/C,CAAA"}
|
|
@@ -52,22 +52,35 @@ const needsTemplateEscaping = (text) => {
|
|
|
52
52
|
}
|
|
53
53
|
return false;
|
|
54
54
|
};
|
|
55
|
+
const normalizePatchEscapedQuotes = (text) => text.includes("*** Begin Patch")
|
|
56
|
+
? text.replace(/\\"([A-Za-z0-9_$.-]+)\\"/g, '"$1"')
|
|
57
|
+
: text;
|
|
55
58
|
const escapeTemplateLiteralContent = (text) => {
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
const normalized = normalizePatchEscapedQuotes(text);
|
|
60
|
+
const isPatchContent = normalized.includes("*** Begin Patch");
|
|
61
|
+
if (!needsTemplateEscaping(normalized)) {
|
|
62
|
+
return normalized;
|
|
58
63
|
}
|
|
59
64
|
let out = "";
|
|
60
|
-
for (let i = 0; i <
|
|
61
|
-
const char =
|
|
65
|
+
for (let i = 0; i < normalized.length; i++) {
|
|
66
|
+
const char = normalized[i];
|
|
62
67
|
if (char === "\\") {
|
|
68
|
+
if (!isPatchContent &&
|
|
69
|
+
(normalized[i + 1] === "`" ||
|
|
70
|
+
(normalized[i + 1] === "$" && normalized[i + 2] === "{"))) {
|
|
71
|
+
out += "\\";
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
63
74
|
out += "\\\\";
|
|
64
75
|
continue;
|
|
65
76
|
}
|
|
66
|
-
if (char === "`" && !isEscaped(
|
|
77
|
+
if (char === "`" && !isEscaped(normalized, i)) {
|
|
67
78
|
out += "\\`";
|
|
68
79
|
continue;
|
|
69
80
|
}
|
|
70
|
-
if (char === "$" &&
|
|
81
|
+
if (char === "$" &&
|
|
82
|
+
normalized[i + 1] === "{" &&
|
|
83
|
+
!isEscaped(normalized, i)) {
|
|
71
84
|
out += "\\$";
|
|
72
85
|
continue;
|
|
73
86
|
}
|
|
@@ -165,54 +178,27 @@ const fixCallTemplateArgument = (script, functionName) => {
|
|
|
165
178
|
}
|
|
166
179
|
return out;
|
|
167
180
|
};
|
|
168
|
-
const
|
|
169
|
-
const out = new Set();
|
|
170
|
-
let cursor = 0;
|
|
171
|
-
while (cursor < script.length) {
|
|
172
|
-
const callStart = findNextIdentifier(script, functionName, cursor);
|
|
173
|
-
if (callStart === -1) {
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
const openParen = skipWhitespace(script, callStart + functionName.length);
|
|
177
|
-
if (script[openParen] !== "(") {
|
|
178
|
-
cursor = callStart + functionName.length;
|
|
179
|
-
continue;
|
|
180
|
-
}
|
|
181
|
-
const argumentStart = skipWhitespace(script, openParen + 1);
|
|
182
|
-
const identifier = parseIdentifier(script, argumentStart);
|
|
183
|
-
if (identifier === undefined) {
|
|
184
|
-
cursor = openParen + 1;
|
|
185
|
-
continue;
|
|
186
|
-
}
|
|
187
|
-
const argumentEnd = skipWhitespace(script, identifier.end);
|
|
188
|
-
if (script[argumentEnd] === ")" || script[argumentEnd] === ",") {
|
|
189
|
-
out.add(identifier.name);
|
|
190
|
-
}
|
|
191
|
-
cursor = identifier.end;
|
|
192
|
-
}
|
|
193
|
-
return out;
|
|
194
|
-
};
|
|
195
|
-
const fixWriteFileContentTemplates = (script) => {
|
|
181
|
+
const fixCallObjectPropertyTemplate = (script, functionName, propertyName) => {
|
|
196
182
|
let out = script;
|
|
197
183
|
let cursor = 0;
|
|
198
184
|
while (cursor < out.length) {
|
|
199
|
-
const callStart = findNextIdentifier(out,
|
|
185
|
+
const callStart = findNextIdentifier(out, functionName, cursor);
|
|
200
186
|
if (callStart === -1) {
|
|
201
187
|
break;
|
|
202
188
|
}
|
|
203
|
-
const openParen = skipWhitespace(out, callStart +
|
|
189
|
+
const openParen = skipWhitespace(out, callStart + functionName.length);
|
|
204
190
|
if (out[openParen] !== "(") {
|
|
205
|
-
cursor = callStart +
|
|
191
|
+
cursor = callStart + functionName.length;
|
|
206
192
|
continue;
|
|
207
193
|
}
|
|
208
|
-
const
|
|
209
|
-
if (
|
|
194
|
+
const propertyKey = findNextIdentifier(out, propertyName, openParen + 1);
|
|
195
|
+
if (propertyKey === -1) {
|
|
210
196
|
cursor = openParen + 1;
|
|
211
197
|
continue;
|
|
212
198
|
}
|
|
213
|
-
const colon = skipWhitespace(out,
|
|
199
|
+
const colon = skipWhitespace(out, propertyKey + propertyName.length);
|
|
214
200
|
if (out[colon] !== ":") {
|
|
215
|
-
cursor =
|
|
201
|
+
cursor = propertyKey + propertyName.length;
|
|
216
202
|
continue;
|
|
217
203
|
}
|
|
218
204
|
const templateStart = skipWhitespace(out, colon + 1);
|
|
@@ -236,27 +222,54 @@ const fixWriteFileContentTemplates = (script) => {
|
|
|
236
222
|
}
|
|
237
223
|
return out;
|
|
238
224
|
};
|
|
239
|
-
const
|
|
225
|
+
const collectCallArgumentIdentifiers = (script, functionName) => {
|
|
226
|
+
const out = new Set();
|
|
227
|
+
let cursor = 0;
|
|
228
|
+
while (cursor < script.length) {
|
|
229
|
+
const callStart = findNextIdentifier(script, functionName, cursor);
|
|
230
|
+
if (callStart === -1) {
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
const openParen = skipWhitespace(script, callStart + functionName.length);
|
|
234
|
+
if (script[openParen] !== "(") {
|
|
235
|
+
cursor = callStart + functionName.length;
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
const argumentStart = skipWhitespace(script, openParen + 1);
|
|
239
|
+
const identifier = parseIdentifier(script, argumentStart);
|
|
240
|
+
if (identifier === undefined) {
|
|
241
|
+
cursor = openParen + 1;
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
const argumentEnd = skipWhitespace(script, identifier.end);
|
|
245
|
+
if (script[argumentEnd] === ")" || script[argumentEnd] === ",") {
|
|
246
|
+
out.add(identifier.name);
|
|
247
|
+
}
|
|
248
|
+
cursor = identifier.end;
|
|
249
|
+
}
|
|
250
|
+
return out;
|
|
251
|
+
};
|
|
252
|
+
const collectCallObjectPropertyIdentifiers = (script, functionName, propertyName) => {
|
|
240
253
|
const out = new Set();
|
|
241
254
|
let cursor = 0;
|
|
242
255
|
while (cursor < script.length) {
|
|
243
|
-
const callStart = findNextIdentifier(script,
|
|
256
|
+
const callStart = findNextIdentifier(script, functionName, cursor);
|
|
244
257
|
if (callStart === -1) {
|
|
245
258
|
break;
|
|
246
259
|
}
|
|
247
|
-
const openParen = skipWhitespace(script, callStart +
|
|
260
|
+
const openParen = skipWhitespace(script, callStart + functionName.length);
|
|
248
261
|
if (script[openParen] !== "(") {
|
|
249
|
-
cursor = callStart +
|
|
262
|
+
cursor = callStart + functionName.length;
|
|
250
263
|
continue;
|
|
251
264
|
}
|
|
252
|
-
const
|
|
253
|
-
if (
|
|
265
|
+
const propertyKey = findNextIdentifier(script, propertyName, openParen + 1);
|
|
266
|
+
if (propertyKey === -1) {
|
|
254
267
|
cursor = openParen + 1;
|
|
255
268
|
continue;
|
|
256
269
|
}
|
|
257
|
-
const
|
|
258
|
-
if (script[
|
|
259
|
-
const valueStart = skipWhitespace(script,
|
|
270
|
+
const afterProperty = skipWhitespace(script, propertyKey + propertyName.length);
|
|
271
|
+
if (script[afterProperty] === ":") {
|
|
272
|
+
const valueStart = skipWhitespace(script, afterProperty + 1);
|
|
260
273
|
const identifier = parseIdentifier(script, valueStart);
|
|
261
274
|
if (identifier !== undefined) {
|
|
262
275
|
const valueEnd = skipWhitespace(script, identifier.end);
|
|
@@ -267,15 +280,20 @@ const collectWriteFileContentIdentifiers = (script) => {
|
|
|
267
280
|
cursor = valueStart + 1;
|
|
268
281
|
continue;
|
|
269
282
|
}
|
|
270
|
-
if (script[
|
|
271
|
-
out.add(
|
|
272
|
-
cursor =
|
|
283
|
+
if (script[afterProperty] === "}" || script[afterProperty] === ",") {
|
|
284
|
+
out.add(propertyName);
|
|
285
|
+
cursor = afterProperty + 1;
|
|
273
286
|
continue;
|
|
274
287
|
}
|
|
275
|
-
cursor =
|
|
288
|
+
cursor = afterProperty + 1;
|
|
276
289
|
}
|
|
277
290
|
return out;
|
|
278
291
|
};
|
|
292
|
+
const callObjectPropertyTargets = [
|
|
293
|
+
["writeFile", "content"],
|
|
294
|
+
["updateTask", "description"],
|
|
295
|
+
];
|
|
296
|
+
const fixTargetCallObjectPropertyTemplates = (script) => callObjectPropertyTargets.reduce((current, [functionName, propertyName]) => fixCallObjectPropertyTemplate(current, functionName, propertyName), script);
|
|
279
297
|
const fixAssignedTemplate = (script, variableName) => {
|
|
280
298
|
let out = script;
|
|
281
299
|
let cursor = 0;
|
|
@@ -331,8 +349,13 @@ const fixAssignedTemplatesForToolCalls = (script) => {
|
|
|
331
349
|
identifiers.add(identifier);
|
|
332
350
|
}
|
|
333
351
|
}
|
|
334
|
-
for (const
|
|
335
|
-
|
|
352
|
+
for (const [functionName, propertyName] of callObjectPropertyTargets) {
|
|
353
|
+
for (const identifier of collectCallObjectPropertyIdentifiers(script, functionName, propertyName)) {
|
|
354
|
+
identifiers.add(identifier);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (script.includes("*** Begin Patch")) {
|
|
358
|
+
identifiers.add("patch");
|
|
336
359
|
}
|
|
337
360
|
let out = script;
|
|
338
361
|
for (const identifier of identifiers) {
|
|
@@ -340,5 +363,5 @@ const fixAssignedTemplatesForToolCalls = (script) => {
|
|
|
340
363
|
}
|
|
341
364
|
return out;
|
|
342
365
|
};
|
|
343
|
-
export const preprocessScript = (script) => fixAssignedTemplatesForToolCalls(["applyPatch", "taskComplete"].reduce((current, functionName) => fixCallTemplateArgument(current, functionName),
|
|
366
|
+
export const preprocessScript = (script) => fixAssignedTemplatesForToolCalls(["applyPatch", "taskComplete"].reduce((current, functionName) => fixCallTemplateArgument(current, functionName), fixTargetCallObjectPropertyTemplates(script)));
|
|
344
367
|
//# sourceMappingURL=ScriptPreprocessing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScriptPreprocessing.js","sourceRoot":"","sources":["../src/ScriptPreprocessing.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GAAG,CAAC,IAAwB,EAAW,EAAE,CAC7D,IAAI,KAAK,SAAS,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAElD,MAAM,qBAAqB,GAAG,CAAC,IAAwB,EAAW,EA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MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACvC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IAC1B,CAAC;IAED,IAAI,GAAG,GAAG,MAAM,CAAA;IAChB,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,GAAG,GAAG,mBAAmB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAA;IAC5C,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAU,EAAE,CACzD,gCAAgC,CAC9B,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,MAAM,CACnC,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,CAAC,uBAAuB,CAAC,OAAO,EAAE,YAAY,CAAC,EACzE,oCAAoC,CAAC,MAAM,CAAC,CAC7C,CACF,CAAA"}
|
|
@@ -99,7 +99,15 @@ describe("preprocessScript", () => {
|
|
|
99
99
|
const output = preprocessScript(input);
|
|
100
100
|
assert.strictEqual(output.includes(`const body = ${wrapTemplate(`const value = ${escaped}next${escaped}`)};`), true);
|
|
101
101
|
});
|
|
102
|
-
it.each([
|
|
102
|
+
it.each([
|
|
103
|
+
"patch",
|
|
104
|
+
"patch2",
|
|
105
|
+
"patch3",
|
|
106
|
+
"patch4",
|
|
107
|
+
"patch5",
|
|
108
|
+
"patch6",
|
|
109
|
+
"patch7",
|
|
110
|
+
])("fixes broken %s", (fixture) => {
|
|
103
111
|
const content = readFileSync(join(__dirname, "fixtures", `${fixture}-broken.txt`), "utf-8");
|
|
104
112
|
const fixed = readFileSync(join(__dirname, "fixtures", `${fixture}-fixed.txt`), "utf-8");
|
|
105
113
|
assert.equal(preprocessScript(content), fixed);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScriptPreprocessing.test.js","sourceRoot":"","sources":["../src/ScriptPreprocessing.test.ts"],"names":[],"mappings":"AAAA,O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AK,GAAG,YAAY,CACxB,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,OAAO,YAAY,CAAC,EACnD,OAAO,CACR,CAAA;QACD,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAA;IAChD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
package/src/AgentTools.ts
CHANGED
|
@@ -143,7 +143,7 @@ export const AgentTools = Toolkit.make(
|
|
|
143
143
|
}),
|
|
144
144
|
Tool.make("applyPatch", {
|
|
145
145
|
description:
|
|
146
|
-
"
|
|
146
|
+
"Add, update or remove multiple files with a git diff / unified diff / wrapped patch.",
|
|
147
147
|
parameters: Schema.String.annotate({
|
|
148
148
|
identifier: "patch",
|
|
149
149
|
}),
|
|
@@ -157,18 +157,23 @@ describe("preprocessScript", () => {
|
|
|
157
157
|
)
|
|
158
158
|
})
|
|
159
159
|
|
|
160
|
-
it.each([
|
|
161
|
-
"
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
)
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
160
|
+
it.each([
|
|
161
|
+
"patch",
|
|
162
|
+
"patch2",
|
|
163
|
+
"patch3",
|
|
164
|
+
"patch4",
|
|
165
|
+
"patch5",
|
|
166
|
+
"patch6",
|
|
167
|
+
"patch7",
|
|
168
|
+
])("fixes broken %s", (fixture) => {
|
|
169
|
+
const content = readFileSync(
|
|
170
|
+
join(__dirname, "fixtures", `${fixture}-broken.txt`),
|
|
171
|
+
"utf-8",
|
|
172
|
+
)
|
|
173
|
+
const fixed = readFileSync(
|
|
174
|
+
join(__dirname, "fixtures", `${fixture}-fixed.txt`),
|
|
175
|
+
"utf-8",
|
|
176
|
+
)
|
|
177
|
+
assert.equal(preprocessScript(content), fixed)
|
|
178
|
+
})
|
|
174
179
|
})
|
|
@@ -74,23 +74,42 @@ const needsTemplateEscaping = (text: string): boolean => {
|
|
|
74
74
|
return false
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
const normalizePatchEscapedQuotes = (text: string): string =>
|
|
78
|
+
text.includes("*** Begin Patch")
|
|
79
|
+
? text.replace(/\\"([A-Za-z0-9_$.-]+)\\"/g, '"$1"')
|
|
80
|
+
: text
|
|
81
|
+
|
|
77
82
|
const escapeTemplateLiteralContent = (text: string): string => {
|
|
78
|
-
|
|
79
|
-
|
|
83
|
+
const normalized = normalizePatchEscapedQuotes(text)
|
|
84
|
+
const isPatchContent = normalized.includes("*** Begin Patch")
|
|
85
|
+
if (!needsTemplateEscaping(normalized)) {
|
|
86
|
+
return normalized
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
let out = ""
|
|
83
|
-
for (let i = 0; i <
|
|
84
|
-
const char =
|
|
90
|
+
for (let i = 0; i < normalized.length; i++) {
|
|
91
|
+
const char = normalized[i]!
|
|
85
92
|
if (char === "\\") {
|
|
93
|
+
if (
|
|
94
|
+
!isPatchContent &&
|
|
95
|
+
(normalized[i + 1] === "`" ||
|
|
96
|
+
(normalized[i + 1] === "$" && normalized[i + 2] === "{"))
|
|
97
|
+
) {
|
|
98
|
+
out += "\\"
|
|
99
|
+
continue
|
|
100
|
+
}
|
|
86
101
|
out += "\\\\"
|
|
87
102
|
continue
|
|
88
103
|
}
|
|
89
|
-
if (char === "`" && !isEscaped(
|
|
104
|
+
if (char === "`" && !isEscaped(normalized, i)) {
|
|
90
105
|
out += "\\`"
|
|
91
106
|
continue
|
|
92
107
|
}
|
|
93
|
-
if (
|
|
108
|
+
if (
|
|
109
|
+
char === "$" &&
|
|
110
|
+
normalized[i + 1] === "{" &&
|
|
111
|
+
!isEscaped(normalized, i)
|
|
112
|
+
) {
|
|
94
113
|
out += "\\$"
|
|
95
114
|
continue
|
|
96
115
|
}
|
|
@@ -214,68 +233,35 @@ const fixCallTemplateArgument = (
|
|
|
214
233
|
return out
|
|
215
234
|
}
|
|
216
235
|
|
|
217
|
-
const
|
|
236
|
+
const fixCallObjectPropertyTemplate = (
|
|
218
237
|
script: string,
|
|
219
238
|
functionName: string,
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
let cursor = 0
|
|
223
|
-
|
|
224
|
-
while (cursor < script.length) {
|
|
225
|
-
const callStart = findNextIdentifier(script, functionName, cursor)
|
|
226
|
-
if (callStart === -1) {
|
|
227
|
-
break
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
const openParen = skipWhitespace(script, callStart + functionName.length)
|
|
231
|
-
if (script[openParen] !== "(") {
|
|
232
|
-
cursor = callStart + functionName.length
|
|
233
|
-
continue
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
const argumentStart = skipWhitespace(script, openParen + 1)
|
|
237
|
-
const identifier = parseIdentifier(script, argumentStart)
|
|
238
|
-
if (identifier === undefined) {
|
|
239
|
-
cursor = openParen + 1
|
|
240
|
-
continue
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
const argumentEnd = skipWhitespace(script, identifier.end)
|
|
244
|
-
if (script[argumentEnd] === ")" || script[argumentEnd] === ",") {
|
|
245
|
-
out.add(identifier.name)
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
cursor = identifier.end
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
return out
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
const fixWriteFileContentTemplates = (script: string): string => {
|
|
239
|
+
propertyName: string,
|
|
240
|
+
): string => {
|
|
255
241
|
let out = script
|
|
256
242
|
let cursor = 0
|
|
257
243
|
|
|
258
244
|
while (cursor < out.length) {
|
|
259
|
-
const callStart = findNextIdentifier(out,
|
|
245
|
+
const callStart = findNextIdentifier(out, functionName, cursor)
|
|
260
246
|
if (callStart === -1) {
|
|
261
247
|
break
|
|
262
248
|
}
|
|
263
249
|
|
|
264
|
-
const openParen = skipWhitespace(out, callStart +
|
|
250
|
+
const openParen = skipWhitespace(out, callStart + functionName.length)
|
|
265
251
|
if (out[openParen] !== "(") {
|
|
266
|
-
cursor = callStart +
|
|
252
|
+
cursor = callStart + functionName.length
|
|
267
253
|
continue
|
|
268
254
|
}
|
|
269
255
|
|
|
270
|
-
const
|
|
271
|
-
if (
|
|
256
|
+
const propertyKey = findNextIdentifier(out, propertyName, openParen + 1)
|
|
257
|
+
if (propertyKey === -1) {
|
|
272
258
|
cursor = openParen + 1
|
|
273
259
|
continue
|
|
274
260
|
}
|
|
275
261
|
|
|
276
|
-
const colon = skipWhitespace(out,
|
|
262
|
+
const colon = skipWhitespace(out, propertyKey + propertyName.length)
|
|
277
263
|
if (out[colon] !== ":") {
|
|
278
|
-
cursor =
|
|
264
|
+
cursor = propertyKey + propertyName.length
|
|
279
265
|
continue
|
|
280
266
|
}
|
|
281
267
|
|
|
@@ -309,33 +295,75 @@ const fixWriteFileContentTemplates = (script: string): string => {
|
|
|
309
295
|
return out
|
|
310
296
|
}
|
|
311
297
|
|
|
312
|
-
const
|
|
298
|
+
const collectCallArgumentIdentifiers = (
|
|
299
|
+
script: string,
|
|
300
|
+
functionName: string,
|
|
301
|
+
): ReadonlySet<string> => {
|
|
302
|
+
const out = new Set<string>()
|
|
303
|
+
let cursor = 0
|
|
304
|
+
|
|
305
|
+
while (cursor < script.length) {
|
|
306
|
+
const callStart = findNextIdentifier(script, functionName, cursor)
|
|
307
|
+
if (callStart === -1) {
|
|
308
|
+
break
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const openParen = skipWhitespace(script, callStart + functionName.length)
|
|
312
|
+
if (script[openParen] !== "(") {
|
|
313
|
+
cursor = callStart + functionName.length
|
|
314
|
+
continue
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
const argumentStart = skipWhitespace(script, openParen + 1)
|
|
318
|
+
const identifier = parseIdentifier(script, argumentStart)
|
|
319
|
+
if (identifier === undefined) {
|
|
320
|
+
cursor = openParen + 1
|
|
321
|
+
continue
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const argumentEnd = skipWhitespace(script, identifier.end)
|
|
325
|
+
if (script[argumentEnd] === ")" || script[argumentEnd] === ",") {
|
|
326
|
+
out.add(identifier.name)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
cursor = identifier.end
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return out
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const collectCallObjectPropertyIdentifiers = (
|
|
313
336
|
script: string,
|
|
337
|
+
functionName: string,
|
|
338
|
+
propertyName: string,
|
|
314
339
|
): ReadonlySet<string> => {
|
|
315
340
|
const out = new Set<string>()
|
|
316
341
|
let cursor = 0
|
|
317
342
|
|
|
318
343
|
while (cursor < script.length) {
|
|
319
|
-
const callStart = findNextIdentifier(script,
|
|
344
|
+
const callStart = findNextIdentifier(script, functionName, cursor)
|
|
320
345
|
if (callStart === -1) {
|
|
321
346
|
break
|
|
322
347
|
}
|
|
323
348
|
|
|
324
|
-
const openParen = skipWhitespace(script, callStart +
|
|
349
|
+
const openParen = skipWhitespace(script, callStart + functionName.length)
|
|
325
350
|
if (script[openParen] !== "(") {
|
|
326
|
-
cursor = callStart +
|
|
351
|
+
cursor = callStart + functionName.length
|
|
327
352
|
continue
|
|
328
353
|
}
|
|
329
354
|
|
|
330
|
-
const
|
|
331
|
-
if (
|
|
355
|
+
const propertyKey = findNextIdentifier(script, propertyName, openParen + 1)
|
|
356
|
+
if (propertyKey === -1) {
|
|
332
357
|
cursor = openParen + 1
|
|
333
358
|
continue
|
|
334
359
|
}
|
|
335
360
|
|
|
336
|
-
const
|
|
337
|
-
|
|
338
|
-
|
|
361
|
+
const afterProperty = skipWhitespace(
|
|
362
|
+
script,
|
|
363
|
+
propertyKey + propertyName.length,
|
|
364
|
+
)
|
|
365
|
+
if (script[afterProperty] === ":") {
|
|
366
|
+
const valueStart = skipWhitespace(script, afterProperty + 1)
|
|
339
367
|
const identifier = parseIdentifier(script, valueStart)
|
|
340
368
|
if (identifier !== undefined) {
|
|
341
369
|
const valueEnd = skipWhitespace(script, identifier.end)
|
|
@@ -347,18 +375,30 @@ const collectWriteFileContentIdentifiers = (
|
|
|
347
375
|
continue
|
|
348
376
|
}
|
|
349
377
|
|
|
350
|
-
if (script[
|
|
351
|
-
out.add(
|
|
352
|
-
cursor =
|
|
378
|
+
if (script[afterProperty] === "}" || script[afterProperty] === ",") {
|
|
379
|
+
out.add(propertyName)
|
|
380
|
+
cursor = afterProperty + 1
|
|
353
381
|
continue
|
|
354
382
|
}
|
|
355
383
|
|
|
356
|
-
cursor =
|
|
384
|
+
cursor = afterProperty + 1
|
|
357
385
|
}
|
|
358
386
|
|
|
359
387
|
return out
|
|
360
388
|
}
|
|
361
389
|
|
|
390
|
+
const callObjectPropertyTargets = [
|
|
391
|
+
["writeFile", "content"],
|
|
392
|
+
["updateTask", "description"],
|
|
393
|
+
] as const
|
|
394
|
+
|
|
395
|
+
const fixTargetCallObjectPropertyTemplates = (script: string): string =>
|
|
396
|
+
callObjectPropertyTargets.reduce(
|
|
397
|
+
(current, [functionName, propertyName]) =>
|
|
398
|
+
fixCallObjectPropertyTemplate(current, functionName, propertyName),
|
|
399
|
+
script,
|
|
400
|
+
)
|
|
401
|
+
|
|
362
402
|
const fixAssignedTemplate = (script: string, variableName: string): string => {
|
|
363
403
|
let out = script
|
|
364
404
|
let cursor = 0
|
|
@@ -436,8 +476,17 @@ const fixAssignedTemplatesForToolCalls = (script: string): string => {
|
|
|
436
476
|
identifiers.add(identifier)
|
|
437
477
|
}
|
|
438
478
|
}
|
|
439
|
-
for (const
|
|
440
|
-
|
|
479
|
+
for (const [functionName, propertyName] of callObjectPropertyTargets) {
|
|
480
|
+
for (const identifier of collectCallObjectPropertyIdentifiers(
|
|
481
|
+
script,
|
|
482
|
+
functionName,
|
|
483
|
+
propertyName,
|
|
484
|
+
)) {
|
|
485
|
+
identifiers.add(identifier)
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if (script.includes("*** Begin Patch")) {
|
|
489
|
+
identifiers.add("patch")
|
|
441
490
|
}
|
|
442
491
|
|
|
443
492
|
let out = script
|
|
@@ -451,6 +500,6 @@ export const preprocessScript = (script: string): string =>
|
|
|
451
500
|
fixAssignedTemplatesForToolCalls(
|
|
452
501
|
["applyPatch", "taskComplete"].reduce(
|
|
453
502
|
(current, functionName) => fixCallTemplateArgument(current, functionName),
|
|
454
|
-
|
|
503
|
+
fixTargetCallObjectPropertyTemplates(script),
|
|
455
504
|
),
|
|
456
505
|
)
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
const patch = `*** Begin Patch
|
|
2
|
+
*** Update File: src/commands/root.ts
|
|
3
|
+
@@
|
|
4
|
+
import {
|
|
5
|
+
Config,
|
|
6
|
+
+ Data,
|
|
7
|
+
Deferred,
|
|
8
|
+
Duration,
|
|
9
|
+
Effect,
|
|
10
|
+
Fiber,
|
|
11
|
+
@@
|
|
12
|
+
const runRalph = Effect.fnUntraced(
|
|
13
|
+
@@
|
|
14
|
+
)
|
|
15
|
+
+
|
|
16
|
+
+class RalphSpecMissing extends Data.TaggedError("RalphSpecMissing")<{
|
|
17
|
+
+ readonly projectId: Project["id"]
|
|
18
|
+
+}> {
|
|
19
|
+
+ readonly message = `Project "${this.projectId}" is configured with gitFlow=\"ralph\" but is missing \"ralphSpec\". Run 'lalph projects edit' and set "Path to Ralph spec file".`
|
|
20
|
+
+}
|
|
21
|
+
+
|
|
22
|
+
+type ProjectExecutionMode =
|
|
23
|
+
+ | {
|
|
24
|
+
+ readonly _tag: "standard"
|
|
25
|
+
+ readonly gitFlow: "pr" | "commit"
|
|
26
|
+
+ }
|
|
27
|
+
+ | {
|
|
28
|
+
+ readonly _tag: "ralph"
|
|
29
|
+
+ readonly specFile: string
|
|
30
|
+
+ }
|
|
31
|
+
|
|
32
|
+
const runProject = Effect.fnUntraced(
|
|
33
|
+
function* (options: {
|
|
34
|
+
@@
|
|
35
|
+
const iterationsDisplay = isFinite ? options.iterations : "unlimited"
|
|
36
|
+
const semaphore = Semaphore.makeUnsafe(options.project.concurrency)
|
|
37
|
+
const fibers = yield* FiberSet.make()
|
|
38
|
+
+
|
|
39
|
+
+ let executionMode: ProjectExecutionMode
|
|
40
|
+
+ if (options.project.gitFlow === "ralph") {
|
|
41
|
+
+ if (!options.project.ralphSpec) {
|
|
42
|
+
+ return yield* new RalphSpecMissing({
|
|
43
|
+
+ projectId: options.project.id,
|
|
44
|
+
+ })
|
|
45
|
+
+ }
|
|
46
|
+
+ executionMode = {
|
|
47
|
+
+ _tag: "ralph",
|
|
48
|
+
+ specFile: options.project.ralphSpec,
|
|
49
|
+
+ }
|
|
50
|
+
+ } else {
|
|
51
|
+
+ executionMode = {
|
|
52
|
+
+ _tag: "standard",
|
|
53
|
+
+ gitFlow: options.project.gitFlow,
|
|
54
|
+
+ }
|
|
55
|
+
+ }
|
|
56
|
+
+
|
|
57
|
+
+ const resolveGitFlowLayer = () => {
|
|
58
|
+
+ if (executionMode._tag === "ralph") {
|
|
59
|
+
+ return GitFlowRalph
|
|
60
|
+
+ }
|
|
61
|
+
+ if (executionMode.gitFlow === "commit") {
|
|
62
|
+
+ return GitFlowCommit
|
|
63
|
+
+ }
|
|
64
|
+
+ return GitFlowPR
|
|
65
|
+
+ }
|
|
66
|
+
+
|
|
67
|
+
+ const resolveRunEffect = (startedDeferred: Deferred.Deferred<void>) => {
|
|
68
|
+
+ if (executionMode._tag === "ralph") {
|
|
69
|
+
+ return runRalph({
|
|
70
|
+
+ targetBranch: options.project.targetBranch,
|
|
71
|
+
+ stallTimeout: options.stallTimeout,
|
|
72
|
+
+ runTimeout: options.runTimeout,
|
|
73
|
+
+ review: options.project.reviewAgent,
|
|
74
|
+
+ research: options.project.researchAgent,
|
|
75
|
+
+ specFile: executionMode.specFile,
|
|
76
|
+
+ })
|
|
77
|
+
+ }
|
|
78
|
+
+ return run({
|
|
79
|
+
+ startedDeferred,
|
|
80
|
+
+ targetBranch: options.project.targetBranch,
|
|
81
|
+
+ specsDirectory: options.specsDirectory,
|
|
82
|
+
+ stallTimeout: options.stallTimeout,
|
|
83
|
+
+ runTimeout: options.runTimeout,
|
|
84
|
+
+ review: options.project.reviewAgent,
|
|
85
|
+
+ research: options.project.researchAgent,
|
|
86
|
+
+ })
|
|
87
|
+
+ }
|
|
88
|
+
+
|
|
89
|
+
+ const waitForIteration = (
|
|
90
|
+
+ startedDeferred: Deferred.Deferred<void>,
|
|
91
|
+
+ fiber: Fiber.Fiber<void, never>,
|
|
92
|
+
+ ) => {
|
|
93
|
+
+ if (executionMode._tag === "ralph") {
|
|
94
|
+
+ return Fiber.await(fiber)
|
|
95
|
+
+ }
|
|
96
|
+
+ return Deferred.await(startedDeferred)
|
|
97
|
+
+ }
|
|
98
|
+
+
|
|
99
|
+
+ const handleChosenTaskNotFound = (
|
|
100
|
+
+ currentIteration: number,
|
|
101
|
+
+ markRalphDone: () => void,
|
|
102
|
+
+ ) => {
|
|
103
|
+
+ if (executionMode._tag !== "ralph") {
|
|
104
|
+
+ return Effect.void
|
|
105
|
+
+ }
|
|
106
|
+
+ markRalphDone()
|
|
107
|
+
+ return Effect.log(
|
|
108
|
+
+ `No more work to process for Ralph, ending after ${currentIteration + 1} iteration(s).`,
|
|
109
|
+
+ )
|
|
110
|
+
+ }
|
|
111
|
+
+
|
|
112
|
+
+ const handleNoMoreWork = (
|
|
113
|
+
+ currentIteration: number,
|
|
114
|
+
+ setIterations: (iterations: number) => void,
|
|
115
|
+
+ ) => {
|
|
116
|
+
+ if (executionMode._tag === "ralph") {
|
|
117
|
+
+ return Effect.void
|
|
118
|
+
+ }
|
|
119
|
+
+ if (isFinite) {
|
|
120
|
+
+ // If we have a finite number of iterations, we exit when no more
|
|
121
|
+
+ // work is found
|
|
122
|
+
+ setIterations(currentIteration)
|
|
123
|
+
+ return Effect.log(
|
|
124
|
+
+ `No more work to process, ending after ${currentIteration} iteration(s).`,
|
|
125
|
+
+ )
|
|
126
|
+
+ }
|
|
127
|
+
+ const log =
|
|
128
|
+
+ Iterable.size(fibers) <= 1
|
|
129
|
+
+ ? Effect.log("No more work to process, waiting 30 seconds...")
|
|
130
|
+
+ : Effect.void
|
|
131
|
+
+ return Effect.andThen(log, Effect.sleep(Duration.seconds(30)))
|
|
132
|
+
+ }
|
|
133
|
+
|
|
134
|
+
yield* resetInProgress.pipe(Effect.withSpan("Main.resetInProgress"))
|
|
135
|
+
@@
|
|
136
|
+
const currentIteration = iteration
|
|
137
|
+
|
|
138
|
+
const startedDeferred = yield* Deferred.make<void>()
|
|
139
|
+
let ralphDone = false
|
|
140
|
+
|
|
141
|
+
- const gitFlow = options.project.gitFlow
|
|
142
|
+
- const isRalph = gitFlow === "ralph"
|
|
143
|
+
- const gitFlowLayer =
|
|
144
|
+
- gitFlow === "commit"
|
|
145
|
+
- ? GitFlowCommit
|
|
146
|
+
- : gitFlow === "ralph"
|
|
147
|
+
- ? GitFlowRalph
|
|
148
|
+
- : GitFlowPR
|
|
149
|
+
+ const gitFlowLayer = resolveGitFlowLayer()
|
|
150
|
+
const fiber = yield* checkForWork(options.project).pipe(
|
|
151
|
+
Effect.andThen(
|
|
152
|
+
Unify.unify(
|
|
153
|
+
- isRalph
|
|
154
|
+
- ? runRalph({
|
|
155
|
+
- targetBranch: options.project.targetBranch,
|
|
156
|
+
- stallTimeout: options.stallTimeout,
|
|
157
|
+
- runTimeout: options.runTimeout,
|
|
158
|
+
- review: options.project.reviewAgent,
|
|
159
|
+
- research: options.project.researchAgent,
|
|
160
|
+
- specFile: options.project.ralphSpec!,
|
|
161
|
+
- })
|
|
162
|
+
- : run({
|
|
163
|
+
- startedDeferred,
|
|
164
|
+
- targetBranch: options.project.targetBranch,
|
|
165
|
+
- specsDirectory: options.specsDirectory,
|
|
166
|
+
- stallTimeout: options.stallTimeout,
|
|
167
|
+
- runTimeout: options.runTimeout,
|
|
168
|
+
- review: options.project.reviewAgent,
|
|
169
|
+
- research: options.project.researchAgent,
|
|
170
|
+
- }),
|
|
171
|
+
+ resolveRunEffect(startedDeferred),
|
|
172
|
+
).pipe(
|
|
173
|
+
Effect.provide(gitFlowLayer, { local: true }),
|
|
174
|
+
withWorkerState(options.project.id),
|
|
175
|
+
),
|
|
176
|
+
),
|
|
177
|
+
Effect.catchTags({
|
|
178
|
+
ChosenTaskNotFound(_error) {
|
|
179
|
+
- if (isRalph) {
|
|
180
|
+
- ralphDone = true
|
|
181
|
+
- return Effect.log(
|
|
182
|
+
- `No more work to process for Ralph, ending after ${currentIteration + 1} iteration(s).`,
|
|
183
|
+
- )
|
|
184
|
+
- }
|
|
185
|
+
- return Effect.void
|
|
186
|
+
+ return handleChosenTaskNotFound(currentIteration, () => {
|
|
187
|
+
+ ralphDone = true
|
|
188
|
+
+ })
|
|
189
|
+
},
|
|
190
|
+
NoMoreWork(_error) {
|
|
191
|
+
- if (isFinite) {
|
|
192
|
+
- // If we have a finite number of iterations, we exit when no more
|
|
193
|
+
- // work is found
|
|
194
|
+
- iterations = currentIteration
|
|
195
|
+
- return Effect.log(
|
|
196
|
+
- `No more work to process, ending after ${currentIteration} iteration(s).`,
|
|
197
|
+
- )
|
|
198
|
+
- }
|
|
199
|
+
- const log =
|
|
200
|
+
- Iterable.size(fibers) <= 1
|
|
201
|
+
- ? Effect.log("No more work to process, waiting 30 seconds...")
|
|
202
|
+
- : Effect.void
|
|
203
|
+
- return Effect.andThen(log, Effect.sleep(Duration.seconds(30)))
|
|
204
|
+
+ return handleNoMoreWork(currentIteration, (newIterations) => {
|
|
205
|
+
+ iterations = newIterations
|
|
206
|
+
+ })
|
|
207
|
+
},
|
|
208
|
+
QuitError(_error) {
|
|
209
|
+
quit = true
|
|
210
|
+
@@
|
|
211
|
+
Effect.ensuring(Deferred.completeWith(startedDeferred, Effect.void)),
|
|
212
|
+
FiberSet.run(fibers),
|
|
213
|
+
)
|
|
214
|
+
- if (isRalph) {
|
|
215
|
+
- yield* Fiber.await(fiber)
|
|
216
|
+
- if (ralphDone) break
|
|
217
|
+
- } else {
|
|
218
|
+
- yield* Deferred.await(startedDeferred)
|
|
219
|
+
+
|
|
220
|
+
+ yield* waitForIteration(startedDeferred, fiber)
|
|
221
|
+
+ if (executionMode._tag === "ralph" && ralphDone) {
|
|
222
|
+
+ break
|
|
223
|
+
}
|
|
224
|
+
+
|
|
225
|
+
iteration++
|
|
226
|
+
}
|
|
227
|
+
*** End Patch`;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
const patch = `*** Begin Patch
|
|
2
|
+
*** Update File: src/commands/root.ts
|
|
3
|
+
@@
|
|
4
|
+
import {
|
|
5
|
+
Config,
|
|
6
|
+
+ Data,
|
|
7
|
+
Deferred,
|
|
8
|
+
Duration,
|
|
9
|
+
Effect,
|
|
10
|
+
Fiber,
|
|
11
|
+
@@
|
|
12
|
+
const runRalph = Effect.fnUntraced(
|
|
13
|
+
@@
|
|
14
|
+
)
|
|
15
|
+
+
|
|
16
|
+
+class RalphSpecMissing extends Data.TaggedError("RalphSpecMissing")<{
|
|
17
|
+
+ readonly projectId: Project["id"]
|
|
18
|
+
+}> {
|
|
19
|
+
+ readonly message = \`Project "\${this.projectId}" is configured with gitFlow="ralph" but is missing "ralphSpec". Run 'lalph projects edit' and set "Path to Ralph spec file".\`
|
|
20
|
+
+}
|
|
21
|
+
+
|
|
22
|
+
+type ProjectExecutionMode =
|
|
23
|
+
+ | {
|
|
24
|
+
+ readonly _tag: "standard"
|
|
25
|
+
+ readonly gitFlow: "pr" | "commit"
|
|
26
|
+
+ }
|
|
27
|
+
+ | {
|
|
28
|
+
+ readonly _tag: "ralph"
|
|
29
|
+
+ readonly specFile: string
|
|
30
|
+
+ }
|
|
31
|
+
|
|
32
|
+
const runProject = Effect.fnUntraced(
|
|
33
|
+
function* (options: {
|
|
34
|
+
@@
|
|
35
|
+
const iterationsDisplay = isFinite ? options.iterations : "unlimited"
|
|
36
|
+
const semaphore = Semaphore.makeUnsafe(options.project.concurrency)
|
|
37
|
+
const fibers = yield* FiberSet.make()
|
|
38
|
+
+
|
|
39
|
+
+ let executionMode: ProjectExecutionMode
|
|
40
|
+
+ if (options.project.gitFlow === "ralph") {
|
|
41
|
+
+ if (!options.project.ralphSpec) {
|
|
42
|
+
+ return yield* new RalphSpecMissing({
|
|
43
|
+
+ projectId: options.project.id,
|
|
44
|
+
+ })
|
|
45
|
+
+ }
|
|
46
|
+
+ executionMode = {
|
|
47
|
+
+ _tag: "ralph",
|
|
48
|
+
+ specFile: options.project.ralphSpec,
|
|
49
|
+
+ }
|
|
50
|
+
+ } else {
|
|
51
|
+
+ executionMode = {
|
|
52
|
+
+ _tag: "standard",
|
|
53
|
+
+ gitFlow: options.project.gitFlow,
|
|
54
|
+
+ }
|
|
55
|
+
+ }
|
|
56
|
+
+
|
|
57
|
+
+ const resolveGitFlowLayer = () => {
|
|
58
|
+
+ if (executionMode._tag === "ralph") {
|
|
59
|
+
+ return GitFlowRalph
|
|
60
|
+
+ }
|
|
61
|
+
+ if (executionMode.gitFlow === "commit") {
|
|
62
|
+
+ return GitFlowCommit
|
|
63
|
+
+ }
|
|
64
|
+
+ return GitFlowPR
|
|
65
|
+
+ }
|
|
66
|
+
+
|
|
67
|
+
+ const resolveRunEffect = (startedDeferred: Deferred.Deferred<void>) => {
|
|
68
|
+
+ if (executionMode._tag === "ralph") {
|
|
69
|
+
+ return runRalph({
|
|
70
|
+
+ targetBranch: options.project.targetBranch,
|
|
71
|
+
+ stallTimeout: options.stallTimeout,
|
|
72
|
+
+ runTimeout: options.runTimeout,
|
|
73
|
+
+ review: options.project.reviewAgent,
|
|
74
|
+
+ research: options.project.researchAgent,
|
|
75
|
+
+ specFile: executionMode.specFile,
|
|
76
|
+
+ })
|
|
77
|
+
+ }
|
|
78
|
+
+ return run({
|
|
79
|
+
+ startedDeferred,
|
|
80
|
+
+ targetBranch: options.project.targetBranch,
|
|
81
|
+
+ specsDirectory: options.specsDirectory,
|
|
82
|
+
+ stallTimeout: options.stallTimeout,
|
|
83
|
+
+ runTimeout: options.runTimeout,
|
|
84
|
+
+ review: options.project.reviewAgent,
|
|
85
|
+
+ research: options.project.researchAgent,
|
|
86
|
+
+ })
|
|
87
|
+
+ }
|
|
88
|
+
+
|
|
89
|
+
+ const waitForIteration = (
|
|
90
|
+
+ startedDeferred: Deferred.Deferred<void>,
|
|
91
|
+
+ fiber: Fiber.Fiber<void, never>,
|
|
92
|
+
+ ) => {
|
|
93
|
+
+ if (executionMode._tag === "ralph") {
|
|
94
|
+
+ return Fiber.await(fiber)
|
|
95
|
+
+ }
|
|
96
|
+
+ return Deferred.await(startedDeferred)
|
|
97
|
+
+ }
|
|
98
|
+
+
|
|
99
|
+
+ const handleChosenTaskNotFound = (
|
|
100
|
+
+ currentIteration: number,
|
|
101
|
+
+ markRalphDone: () => void,
|
|
102
|
+
+ ) => {
|
|
103
|
+
+ if (executionMode._tag !== "ralph") {
|
|
104
|
+
+ return Effect.void
|
|
105
|
+
+ }
|
|
106
|
+
+ markRalphDone()
|
|
107
|
+
+ return Effect.log(
|
|
108
|
+
+ \`No more work to process for Ralph, ending after \${currentIteration + 1} iteration(s).\`,
|
|
109
|
+
+ )
|
|
110
|
+
+ }
|
|
111
|
+
+
|
|
112
|
+
+ const handleNoMoreWork = (
|
|
113
|
+
+ currentIteration: number,
|
|
114
|
+
+ setIterations: (iterations: number) => void,
|
|
115
|
+
+ ) => {
|
|
116
|
+
+ if (executionMode._tag === "ralph") {
|
|
117
|
+
+ return Effect.void
|
|
118
|
+
+ }
|
|
119
|
+
+ if (isFinite) {
|
|
120
|
+
+ // If we have a finite number of iterations, we exit when no more
|
|
121
|
+
+ // work is found
|
|
122
|
+
+ setIterations(currentIteration)
|
|
123
|
+
+ return Effect.log(
|
|
124
|
+
+ \`No more work to process, ending after \${currentIteration} iteration(s).\`,
|
|
125
|
+
+ )
|
|
126
|
+
+ }
|
|
127
|
+
+ const log =
|
|
128
|
+
+ Iterable.size(fibers) <= 1
|
|
129
|
+
+ ? Effect.log("No more work to process, waiting 30 seconds...")
|
|
130
|
+
+ : Effect.void
|
|
131
|
+
+ return Effect.andThen(log, Effect.sleep(Duration.seconds(30)))
|
|
132
|
+
+ }
|
|
133
|
+
|
|
134
|
+
yield* resetInProgress.pipe(Effect.withSpan("Main.resetInProgress"))
|
|
135
|
+
@@
|
|
136
|
+
const currentIteration = iteration
|
|
137
|
+
|
|
138
|
+
const startedDeferred = yield* Deferred.make<void>()
|
|
139
|
+
let ralphDone = false
|
|
140
|
+
|
|
141
|
+
- const gitFlow = options.project.gitFlow
|
|
142
|
+
- const isRalph = gitFlow === "ralph"
|
|
143
|
+
- const gitFlowLayer =
|
|
144
|
+
- gitFlow === "commit"
|
|
145
|
+
- ? GitFlowCommit
|
|
146
|
+
- : gitFlow === "ralph"
|
|
147
|
+
- ? GitFlowRalph
|
|
148
|
+
- : GitFlowPR
|
|
149
|
+
+ const gitFlowLayer = resolveGitFlowLayer()
|
|
150
|
+
const fiber = yield* checkForWork(options.project).pipe(
|
|
151
|
+
Effect.andThen(
|
|
152
|
+
Unify.unify(
|
|
153
|
+
- isRalph
|
|
154
|
+
- ? runRalph({
|
|
155
|
+
- targetBranch: options.project.targetBranch,
|
|
156
|
+
- stallTimeout: options.stallTimeout,
|
|
157
|
+
- runTimeout: options.runTimeout,
|
|
158
|
+
- review: options.project.reviewAgent,
|
|
159
|
+
- research: options.project.researchAgent,
|
|
160
|
+
- specFile: options.project.ralphSpec!,
|
|
161
|
+
- })
|
|
162
|
+
- : run({
|
|
163
|
+
- startedDeferred,
|
|
164
|
+
- targetBranch: options.project.targetBranch,
|
|
165
|
+
- specsDirectory: options.specsDirectory,
|
|
166
|
+
- stallTimeout: options.stallTimeout,
|
|
167
|
+
- runTimeout: options.runTimeout,
|
|
168
|
+
- review: options.project.reviewAgent,
|
|
169
|
+
- research: options.project.researchAgent,
|
|
170
|
+
- }),
|
|
171
|
+
+ resolveRunEffect(startedDeferred),
|
|
172
|
+
).pipe(
|
|
173
|
+
Effect.provide(gitFlowLayer, { local: true }),
|
|
174
|
+
withWorkerState(options.project.id),
|
|
175
|
+
),
|
|
176
|
+
),
|
|
177
|
+
Effect.catchTags({
|
|
178
|
+
ChosenTaskNotFound(_error) {
|
|
179
|
+
- if (isRalph) {
|
|
180
|
+
- ralphDone = true
|
|
181
|
+
- return Effect.log(
|
|
182
|
+
- \`No more work to process for Ralph, ending after \${currentIteration + 1} iteration(s).\`,
|
|
183
|
+
- )
|
|
184
|
+
- }
|
|
185
|
+
- return Effect.void
|
|
186
|
+
+ return handleChosenTaskNotFound(currentIteration, () => {
|
|
187
|
+
+ ralphDone = true
|
|
188
|
+
+ })
|
|
189
|
+
},
|
|
190
|
+
NoMoreWork(_error) {
|
|
191
|
+
- if (isFinite) {
|
|
192
|
+
- // If we have a finite number of iterations, we exit when no more
|
|
193
|
+
- // work is found
|
|
194
|
+
- iterations = currentIteration
|
|
195
|
+
- return Effect.log(
|
|
196
|
+
- \`No more work to process, ending after \${currentIteration} iteration(s).\`,
|
|
197
|
+
- )
|
|
198
|
+
- }
|
|
199
|
+
- const log =
|
|
200
|
+
- Iterable.size(fibers) <= 1
|
|
201
|
+
- ? Effect.log("No more work to process, waiting 30 seconds...")
|
|
202
|
+
- : Effect.void
|
|
203
|
+
- return Effect.andThen(log, Effect.sleep(Duration.seconds(30)))
|
|
204
|
+
+ return handleNoMoreWork(currentIteration, (newIterations) => {
|
|
205
|
+
+ iterations = newIterations
|
|
206
|
+
+ })
|
|
207
|
+
},
|
|
208
|
+
QuitError(_error) {
|
|
209
|
+
quit = true
|
|
210
|
+
@@
|
|
211
|
+
Effect.ensuring(Deferred.completeWith(startedDeferred, Effect.void)),
|
|
212
|
+
FiberSet.run(fibers),
|
|
213
|
+
)
|
|
214
|
+
- if (isRalph) {
|
|
215
|
+
- yield* Fiber.await(fiber)
|
|
216
|
+
- if (ralphDone) break
|
|
217
|
+
- } else {
|
|
218
|
+
- yield* Deferred.await(startedDeferred)
|
|
219
|
+
+
|
|
220
|
+
+ yield* waitForIteration(startedDeferred, fiber)
|
|
221
|
+
+ if (executionMode._tag === "ralph" && ralphDone) {
|
|
222
|
+
+ break
|
|
223
|
+
}
|
|
224
|
+
+
|
|
225
|
+
iteration++
|
|
226
|
+
}
|
|
227
|
+
*** End Patch`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const description = `Implemented in PR #1805 (branch: lalph/EFF-736, target: main).
|
|
2
|
+
|
|
3
|
+
Key discoveries for future work:
|
|
4
|
+
|
|
5
|
+
* Root cause in \
|
|
6
|
+
\`packages/effect/src/internal/effect.ts\` (`cachedInvalidateWithTTL`): expiry was computed from start time (`now + ttlMillis` before running `self`), so long-running effects could expire before producing a value.
|
|
7
|
+
* Cache behavior reference: \
|
|
8
|
+
\`packages/effect/src/Cache.ts\` computes expiry from completion (`onExit`); `Effect.cachedWithTTL` should match this model.
|
|
9
|
+
* Regression coverage is in \
|
|
10
|
+
\`packages/effect/test/Effect.test.ts\`: `cachedWithTTL starts ttl from value creation` uses `TestClock` with 2s runtime and 1s TTL; immediate post-completion call must reuse cached value.
|
|
11
|
+
* PR review follow-up: in `cachedInvalidateWithTTL`, capture `const clock = fiber.getRef(ClockRef)` once and reuse it for both `now` and `expiresAt` to avoid duplicate `getRef` calls.
|
|
12
|
+
|
|
13
|
+
Validation run:
|
|
14
|
+
|
|
15
|
+
* pnpm lint-fix
|
|
16
|
+
* pnpm test packages/effect/test/Effect.test.ts
|
|
17
|
+
* pnpm check:tsgo
|
|
18
|
+
* pnpm docgen`;
|
|
19
|
+
await updateTask({ taskId: 'EFF-736', state: 'in-review', description });
|
|
20
|
+
console.log('task updated');
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const description = `Implemented in PR #1805 (branch: lalph/EFF-736, target: main).
|
|
2
|
+
|
|
3
|
+
Key discoveries for future work:
|
|
4
|
+
|
|
5
|
+
* Root cause in \\
|
|
6
|
+
\`packages/effect/src/internal/effect.ts\` (\`cachedInvalidateWithTTL\`): expiry was computed from start time (\`now + ttlMillis\` before running \`self\`), so long-running effects could expire before producing a value.
|
|
7
|
+
* Cache behavior reference: \\
|
|
8
|
+
\`packages/effect/src/Cache.ts\` computes expiry from completion (\`onExit\`); \`Effect.cachedWithTTL\` should match this model.
|
|
9
|
+
* Regression coverage is in \\
|
|
10
|
+
\`packages/effect/test/Effect.test.ts\`: \`cachedWithTTL starts ttl from value creation\` uses \`TestClock\` with 2s runtime and 1s TTL; immediate post-completion call must reuse cached value.
|
|
11
|
+
* PR review follow-up: in \`cachedInvalidateWithTTL\`, capture \`const clock = fiber.getRef(ClockRef)\` once and reuse it for both \`now\` and \`expiresAt\` to avoid duplicate \`getRef\` calls.
|
|
12
|
+
|
|
13
|
+
Validation run:
|
|
14
|
+
|
|
15
|
+
* pnpm lint-fix
|
|
16
|
+
* pnpm test packages/effect/test/Effect.test.ts
|
|
17
|
+
* pnpm check:tsgo
|
|
18
|
+
* pnpm docgen`;
|
|
19
|
+
await updateTask({ taskId: 'EFF-736', state: 'in-review', description });
|
|
20
|
+
console.log('task updated');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
await updateTask({
|
|
2
|
+
taskId:'EFF-736',
|
|
3
|
+
state:'in-review',
|
|
4
|
+
description:`Implemented in PR #1805.
|
|
5
|
+
|
|
6
|
+
Key discoveries for future work:
|
|
7
|
+
- Root cause was in packages/effect/src/internal/effect.ts (cachedInvalidateWithTTL): expiry used a timestamp captured before running the effect (`now + ttlMillis`), so long-running effects could expire immediately after completion.
|
|
8
|
+
- Cache module behavior in packages/effect/src/Cache.ts already bases TTL from completion time (expiry set in onExit using current clock), and cachedWithTTL should match this.
|
|
9
|
+
- Regression test added in packages/effect/test/Effect.test.ts (`cachedWithTTL / starts ttl from value creation`) using TestClock: effect runtime (2s) > TTL (1s), verifies second call immediately after first completion reuses cached value.
|
|
10
|
+
- Validation commands that passed: pnpm lint-fix, pnpm test packages/effect/test/Effect.test.ts, pnpm check:tsgo, pnpm docgen.`
|
|
11
|
+
});
|
|
12
|
+
console.log('task updated');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
await updateTask({
|
|
2
|
+
taskId:'EFF-736',
|
|
3
|
+
state:'in-review',
|
|
4
|
+
description:`Implemented in PR #1805.
|
|
5
|
+
|
|
6
|
+
Key discoveries for future work:
|
|
7
|
+
- Root cause was in packages/effect/src/internal/effect.ts (cachedInvalidateWithTTL): expiry used a timestamp captured before running the effect (\`now + ttlMillis\`), so long-running effects could expire immediately after completion.
|
|
8
|
+
- Cache module behavior in packages/effect/src/Cache.ts already bases TTL from completion time (expiry set in onExit using current clock), and cachedWithTTL should match this.
|
|
9
|
+
- Regression test added in packages/effect/test/Effect.test.ts (\`cachedWithTTL / starts ttl from value creation\`) using TestClock: effect runtime (2s) > TTL (1s), verifies second call immediately after first completion reuses cached value.
|
|
10
|
+
- Validation commands that passed: pnpm lint-fix, pnpm test packages/effect/test/Effect.test.ts, pnpm check:tsgo, pnpm docgen.`
|
|
11
|
+
});
|
|
12
|
+
console.log('task updated');
|