@lazyingart/agintiflow 0.20.312 → 0.20.313
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lazyingart/agintiflow",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.313",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AgInTiFlow is a project-aware agent workspace for hybrid wet-dry R&D, hardware-aware intelligence, software automation, and industrial workflows.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
modelPlanningTimeoutRetryRoute,
|
|
12
12
|
nextStepRuntimeConfig,
|
|
13
13
|
recordAlreadyCommittedRepositoryRepair,
|
|
14
|
+
recordProjectVerificationOutcome,
|
|
14
15
|
runAgent,
|
|
15
16
|
} from "../src/agent-runner.js";
|
|
16
17
|
import { resolveRuntimeConfig } from "../src/config.js";
|
|
@@ -155,43 +156,42 @@ try {
|
|
|
155
156
|
artifact_root: scopedArtifactRoot,
|
|
156
157
|
})}`,
|
|
157
158
|
].join("\n");
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
currentRequest: scopedGoal,
|
|
167
|
-
currentHash: "scoped-repair",
|
|
168
|
-
},
|
|
169
|
-
activeExecutionContract: {
|
|
170
|
-
revision: 1,
|
|
171
|
-
refreshedAt,
|
|
172
|
-
startedMutationRevision: 0,
|
|
173
|
-
requiresWorkspaceMutation: true,
|
|
174
|
-
requiresFileMutation: true,
|
|
175
|
-
requiresSourceGrounding: true,
|
|
176
|
-
},
|
|
177
|
-
projectVerification: {
|
|
178
|
-
mutationRevision: 0,
|
|
179
|
-
mutationHistory: [],
|
|
180
|
-
testRuns: [],
|
|
181
|
-
discoveredTests: [],
|
|
182
|
-
},
|
|
183
|
-
toolLoop: {
|
|
184
|
-
recent: [{
|
|
185
|
-
toolName: "read_file",
|
|
186
|
-
ok: true,
|
|
187
|
-
blocked: false,
|
|
188
|
-
path: scopedSource,
|
|
189
|
-
at: groundedAt,
|
|
190
|
-
}],
|
|
191
|
-
},
|
|
159
|
+
const scopedState = {
|
|
160
|
+
goal: scopedGoal,
|
|
161
|
+
commandCwd: scopedRepairRoot,
|
|
162
|
+
meta: {
|
|
163
|
+
goalContract: {
|
|
164
|
+
revision: 1,
|
|
165
|
+
currentRequest: scopedGoal,
|
|
166
|
+
currentHash: "scoped-repair",
|
|
192
167
|
},
|
|
193
|
-
|
|
194
|
-
|
|
168
|
+
activeExecutionContract: {
|
|
169
|
+
revision: 1,
|
|
170
|
+
refreshedAt,
|
|
171
|
+
startedMutationRevision: 0,
|
|
172
|
+
requiresWorkspaceMutation: true,
|
|
173
|
+
requiresFileMutation: true,
|
|
174
|
+
requiresSourceGrounding: true,
|
|
175
|
+
},
|
|
176
|
+
projectVerification: {
|
|
177
|
+
mutationRevision: 0,
|
|
178
|
+
mutationHistory: [],
|
|
179
|
+
testRuns: [],
|
|
180
|
+
discoveredTests: [],
|
|
181
|
+
},
|
|
182
|
+
toolLoop: {
|
|
183
|
+
recent: [{
|
|
184
|
+
toolName: "read_file",
|
|
185
|
+
ok: true,
|
|
186
|
+
blocked: false,
|
|
187
|
+
path: scopedSource,
|
|
188
|
+
at: groundedAt,
|
|
189
|
+
}],
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
const scopedConfig = { commandCwd: scopedRepairRoot, goal: scopedGoal };
|
|
194
|
+
const scopedRuntime = nextStepRuntimeConfig(scopedConfig, scopedState);
|
|
195
195
|
assert.equal(scopedRuntime.scopedArtifactTask, true);
|
|
196
196
|
assert.equal(
|
|
197
197
|
scopedRuntime.completionFreshMutationRequired,
|
|
@@ -200,6 +200,34 @@ try {
|
|
|
200
200
|
);
|
|
201
201
|
assert.deepEqual(scopedRuntime.completionFreshMutationPaths, [scopedSource]);
|
|
202
202
|
assert.equal(scopedRuntime.completionFreshMutationNeedsSourceRead, false);
|
|
203
|
+
recordProjectVerificationOutcome(
|
|
204
|
+
scopedState,
|
|
205
|
+
{
|
|
206
|
+
toolName: "write_file",
|
|
207
|
+
ok: true,
|
|
208
|
+
path: scopedSource,
|
|
209
|
+
args: { path: scopedSource },
|
|
210
|
+
change: {
|
|
211
|
+
path: scopedSource,
|
|
212
|
+
beforeHash: "rejected-report",
|
|
213
|
+
afterHash: "corrected-report",
|
|
214
|
+
beforeBytes: 18,
|
|
215
|
+
afterBytes: 96,
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
{ ...scopedConfig, ...scopedRuntime }
|
|
219
|
+
);
|
|
220
|
+
assert.deepEqual(
|
|
221
|
+
scopedState.meta.activeExecutionContract.scopedArtifactMutationPaths,
|
|
222
|
+
[scopedSource],
|
|
223
|
+
"a successful scoped artifact write did not persist its current-turn mutation"
|
|
224
|
+
);
|
|
225
|
+
const scopedRuntimeAfterWrite = nextStepRuntimeConfig(scopedConfig, scopedState);
|
|
226
|
+
assert.equal(
|
|
227
|
+
scopedRuntimeAfterWrite.completionFreshMutationRequired,
|
|
228
|
+
undefined,
|
|
229
|
+
"a successful current-turn scoped artifact write remained trapped in source-mutation recovery"
|
|
230
|
+
);
|
|
203
231
|
} finally {
|
|
204
232
|
await fs.rm(scopedRepairRoot, { recursive: true, force: true });
|
|
205
233
|
}
|
package/src/agent-runner.js
CHANGED
|
@@ -6622,6 +6622,28 @@ export function recordProjectVerificationOutcome(state = {}, toolResult = {}, co
|
|
|
6622
6622
|
const projectMutationPaths = successfulProjectMutationPaths(toolResult, state, config);
|
|
6623
6623
|
const privateMutationPaths = successfulPrivateVerificationMutationPaths(toolResult);
|
|
6624
6624
|
const materialMutationPaths = materialProjectMutationPaths(toolResult, state, config);
|
|
6625
|
+
const scopedArtifactMutationPaths = successfulScopedArtifactMutationPaths(
|
|
6626
|
+
toolResult,
|
|
6627
|
+
state,
|
|
6628
|
+
config
|
|
6629
|
+
);
|
|
6630
|
+
const activeExecutionContract = state.meta?.activeExecutionContract;
|
|
6631
|
+
if (
|
|
6632
|
+
["write_file", "apply_patch"].includes(toolName) &&
|
|
6633
|
+
scopedArtifactMutationPaths.length > 0 &&
|
|
6634
|
+
Number(activeExecutionContract?.revision || 0) ===
|
|
6635
|
+
Number(state.meta?.goalContract?.revision || 0)
|
|
6636
|
+
) {
|
|
6637
|
+
activeExecutionContract.scopedArtifactMutationAt = now;
|
|
6638
|
+
activeExecutionContract.scopedArtifactMutationPaths = [
|
|
6639
|
+
...new Set([
|
|
6640
|
+
...(Array.isArray(activeExecutionContract.scopedArtifactMutationPaths)
|
|
6641
|
+
? activeExecutionContract.scopedArtifactMutationPaths
|
|
6642
|
+
: []),
|
|
6643
|
+
...scopedArtifactMutationPaths,
|
|
6644
|
+
]),
|
|
6645
|
+
].slice(0, 24);
|
|
6646
|
+
}
|
|
6625
6647
|
if (["write_file", "apply_patch"].includes(toolName) && privateMutationPaths.length) {
|
|
6626
6648
|
delete state.meta.verifiedCompletionCandidate;
|
|
6627
6649
|
verification.privateMutationRevision += 1;
|
|
@@ -6669,7 +6691,6 @@ export function recordProjectVerificationOutcome(state = {}, toolResult = {}, co
|
|
|
6669
6691
|
}
|
|
6670
6692
|
: {}),
|
|
6671
6693
|
}, config);
|
|
6672
|
-
const activeExecutionContract = state.meta?.activeExecutionContract;
|
|
6673
6694
|
if (
|
|
6674
6695
|
materialMutationPaths.length > 0 &&
|
|
6675
6696
|
Number(activeExecutionContract?.revision || 0) ===
|
|
@@ -13820,6 +13841,33 @@ function successfulMutationPaths(toolResult = {}) {
|
|
|
13820
13841
|
return [...new Set([toolResult.path, ...changes.map((change) => change.path)].filter(Boolean))];
|
|
13821
13842
|
}
|
|
13822
13843
|
|
|
13844
|
+
function successfulScopedArtifactMutationPaths(
|
|
13845
|
+
toolResult = {},
|
|
13846
|
+
state = {},
|
|
13847
|
+
config = {}
|
|
13848
|
+
) {
|
|
13849
|
+
const artifactRoot = String(
|
|
13850
|
+
config.scopedArtifactRoot ||
|
|
13851
|
+
scopedArtifactRoot(completionContractGoal(config, state)) ||
|
|
13852
|
+
""
|
|
13853
|
+
).trim();
|
|
13854
|
+
if (!artifactRoot) return [];
|
|
13855
|
+
const commandCwd = path.resolve(
|
|
13856
|
+
config.commandCwd || state.commandCwd || process.cwd()
|
|
13857
|
+
);
|
|
13858
|
+
const resolvedRoot = path.resolve(commandCwd, artifactRoot);
|
|
13859
|
+
return successfulMutationPaths(toolResult)
|
|
13860
|
+
.map((candidate) => path.resolve(commandCwd, String(candidate || "")))
|
|
13861
|
+
.filter((candidate) => {
|
|
13862
|
+
const relative = path.relative(resolvedRoot, candidate);
|
|
13863
|
+
return (
|
|
13864
|
+
relative === "" ||
|
|
13865
|
+
(!relative.startsWith("..") && !path.isAbsolute(relative))
|
|
13866
|
+
);
|
|
13867
|
+
})
|
|
13868
|
+
.map((candidate) => path.relative(commandCwd, candidate).replace(/\\/g, "/"));
|
|
13869
|
+
}
|
|
13870
|
+
|
|
13823
13871
|
function successfulWorkspaceMutationPaths(toolResult = {}) {
|
|
13824
13872
|
if (!toolResult || toolResult.blocked || toolResult.skipped) return [];
|
|
13825
13873
|
if (!["write_file", "apply_patch"].includes(String(toolResult.toolName || ""))) return [];
|
|
@@ -15321,6 +15369,20 @@ export function nextStepRuntimeConfig(config = {}, state = {}) {
|
|
|
15321
15369
|
runtimeConfig.scopedArtifactRoot = scopedRootRelative.replace(/\\/g, "/");
|
|
15322
15370
|
runtimeConfig.workspaceWritePathScopeRoots = [runtimeConfig.scopedArtifactRoot];
|
|
15323
15371
|
}
|
|
15372
|
+
const scopedArtifactMutationAt = Date.parse(
|
|
15373
|
+
String(groundingExecutionContract.scopedArtifactMutationAt || "")
|
|
15374
|
+
);
|
|
15375
|
+
const executionContractRefreshedAt = Date.parse(
|
|
15376
|
+
String(groundingExecutionContract.refreshedAt || "")
|
|
15377
|
+
);
|
|
15378
|
+
const groundingScopedArtifactMutationSatisfied = Boolean(
|
|
15379
|
+
scopedArtifactTask &&
|
|
15380
|
+
Number.isFinite(scopedArtifactMutationAt) &&
|
|
15381
|
+
(
|
|
15382
|
+
!Number.isFinite(executionContractRefreshedAt) ||
|
|
15383
|
+
scopedArtifactMutationAt >= executionContractRefreshedAt
|
|
15384
|
+
)
|
|
15385
|
+
);
|
|
15324
15386
|
if (
|
|
15325
15387
|
(
|
|
15326
15388
|
groundingTaskContract.requiresSourceGrounding === true ||
|
|
@@ -15435,7 +15497,8 @@ export function nextStepRuntimeConfig(config = {}, state = {}) {
|
|
|
15435
15497
|
const currentTurnRequiresFreshMutation = Boolean(
|
|
15436
15498
|
groundingExecutionContract.requiresFileMutation === true &&
|
|
15437
15499
|
groundingExecutionContract.requiresSourceGrounding === true &&
|
|
15438
|
-
!groundingFreshMutationSatisfied
|
|
15500
|
+
!groundingFreshMutationSatisfied &&
|
|
15501
|
+
!groundingScopedArtifactMutationSatisfied
|
|
15439
15502
|
);
|
|
15440
15503
|
const explicitHeadRestore = currentTurnRequiresFreshMutation
|
|
15441
15504
|
? explicitlyRequestedDirtyHeadRestore(state, config)
|