@lazyingart/agintiflow 0.20.278 → 0.20.280
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 +1 -1
- package/scripts/smoke-dynamic-step-budget.js +85 -0
- package/src/agent-runner.js +38 -14
- package/src/scs-evidence.js +34 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lazyingart/agintiflow",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.280",
|
|
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",
|
|
@@ -182,6 +182,91 @@ function toolMessage(payload) {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
try {
|
|
185
|
+
const readOnlyVerificationGoal = [
|
|
186
|
+
"Continue this exact saved task in the same workspace. Do not start over and do",
|
|
187
|
+
"not modify source_brief.md, measurements.csv, prompt.txt, or TASK.md.",
|
|
188
|
+
"The prior run completed the task-owned repository repair. Run exactly `git status --short`.",
|
|
189
|
+
"Do not rebuild, rewrite, recommit, or restore obsolete outputs when the worktree is clean.",
|
|
190
|
+
].join("\n");
|
|
191
|
+
const readOnlyVerificationState = {
|
|
192
|
+
goal: readOnlyVerificationGoal,
|
|
193
|
+
messages: [
|
|
194
|
+
toolMessage({
|
|
195
|
+
toolName: "run_command",
|
|
196
|
+
ok: true,
|
|
197
|
+
exitCode: 0,
|
|
198
|
+
args: { command: "git status --short" },
|
|
199
|
+
stdout: "",
|
|
200
|
+
goalRevision: 15,
|
|
201
|
+
projectMutationRevision: 23,
|
|
202
|
+
}),
|
|
203
|
+
],
|
|
204
|
+
meta: {
|
|
205
|
+
goalContract: {
|
|
206
|
+
version: 3,
|
|
207
|
+
revision: 15,
|
|
208
|
+
activeGoalRevision: 15,
|
|
209
|
+
taskGoal: "Create the editable deck, commit the focused repair, and verify it.",
|
|
210
|
+
activeGoal: readOnlyVerificationGoal,
|
|
211
|
+
currentRequest: readOnlyVerificationGoal,
|
|
212
|
+
currentPreview: readOnlyVerificationGoal,
|
|
213
|
+
history: [{ revision: 15, refreshExecutionContract: true }],
|
|
214
|
+
},
|
|
215
|
+
activeExecutionContract: {
|
|
216
|
+
revision: 15,
|
|
217
|
+
startedMutationRevision: 22,
|
|
218
|
+
requiresWorkspaceMutation: false,
|
|
219
|
+
requiresFileMutation: false,
|
|
220
|
+
requiresSourceGrounding: false,
|
|
221
|
+
requiredProjectCommands: ["git status --short"],
|
|
222
|
+
},
|
|
223
|
+
projectVerification: {
|
|
224
|
+
mutationRevision: 23,
|
|
225
|
+
requiredCommands: ["git status --short"],
|
|
226
|
+
},
|
|
227
|
+
durableGitActions: ["commit", "status"],
|
|
228
|
+
durableGitEvidence: [
|
|
229
|
+
{ action: "commit", goalRevision: 13, mutationRevision: 19 },
|
|
230
|
+
{ action: "status", goalRevision: 15, mutationRevision: 23 },
|
|
231
|
+
],
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
const readOnlyVerificationContract = completionTaskContract(
|
|
235
|
+
{ taskProfile: "slides" },
|
|
236
|
+
readOnlyVerificationState
|
|
237
|
+
);
|
|
238
|
+
assert(
|
|
239
|
+
readOnlyVerificationContract.requiresWorkspaceMutation === false &&
|
|
240
|
+
readOnlyVerificationContract.requiresFileMutation === false &&
|
|
241
|
+
readOnlyVerificationContract.requiresSourceGrounding === false,
|
|
242
|
+
"a verification-only continuation inherited stale mutation requirements from retained task context"
|
|
243
|
+
);
|
|
244
|
+
assert(
|
|
245
|
+
readOnlyVerificationContract.requiredGitActions.includes("commit") &&
|
|
246
|
+
Number(readOnlyVerificationContract.requiredGitRevision || 0) === 0 &&
|
|
247
|
+
Number(readOnlyVerificationContract.requiredGitMutationRevision || 0) === 0,
|
|
248
|
+
"a verification-only continuation demanded a new commit instead of accepting retained same-task Git evidence"
|
|
249
|
+
);
|
|
250
|
+
const readOnlyGitEvaluation = evaluateScsEvidence(
|
|
251
|
+
{
|
|
252
|
+
...readOnlyVerificationContract,
|
|
253
|
+
requiresExternalEvidence: false,
|
|
254
|
+
requiredEvidence: [],
|
|
255
|
+
requiredProjectCommands: [],
|
|
256
|
+
},
|
|
257
|
+
buildScsEvidenceLedger({ state: readOnlyVerificationState })
|
|
258
|
+
);
|
|
259
|
+
assert(
|
|
260
|
+
readOnlyVerificationState.messages.every(
|
|
261
|
+
(message) => !String(message.content || "").includes("git commit")
|
|
262
|
+
),
|
|
263
|
+
"read-only compaction regression accidentally retained the historical commit message"
|
|
264
|
+
);
|
|
265
|
+
assert(
|
|
266
|
+
readOnlyGitEvaluation.missingGitActions.length === 0,
|
|
267
|
+
"a prior verified same-task commit did not satisfy a read-only completion continuation"
|
|
268
|
+
);
|
|
269
|
+
|
|
185
270
|
const runLockConfig = {
|
|
186
271
|
sessionsDir: path.join(tempRoot, "run-lock-sessions"),
|
|
187
272
|
};
|
package/src/agent-runner.js
CHANGED
|
@@ -11319,6 +11319,19 @@ export function completionTaskContract(config = {}, state = {}) {
|
|
|
11319
11319
|
const currentContract = currentRequest
|
|
11320
11320
|
? deriveScsTaskContract({ goal: currentRequest, taskProfile })
|
|
11321
11321
|
: null;
|
|
11322
|
+
const authoritativeReadOnlyContinuation = Boolean(
|
|
11323
|
+
currentRequest &&
|
|
11324
|
+
refreshesExecutionContract &&
|
|
11325
|
+
activeExecutionContractIsAuthoritative &&
|
|
11326
|
+
activeExecutionContract.requiresWorkspaceMutation !== true &&
|
|
11327
|
+
activeExecutionContract.requiresFileMutation !== true &&
|
|
11328
|
+
activeExecutionContract.requiresSourceGrounding !== true &&
|
|
11329
|
+
currentContract?.requiresWorkspaceMutation !== true &&
|
|
11330
|
+
currentContract?.requiresFileMutation !== true &&
|
|
11331
|
+
currentContract?.requiresSourceGrounding !== true &&
|
|
11332
|
+
!(Array.isArray(currentContract?.requiredGitActions) &&
|
|
11333
|
+
currentContract.requiredGitActions.length > 0)
|
|
11334
|
+
);
|
|
11322
11335
|
if (
|
|
11323
11336
|
currentRequest &&
|
|
11324
11337
|
(refreshesExecutionContract || activeExecutionContractIsAuthoritative) &&
|
|
@@ -11383,12 +11396,15 @@ export function completionTaskContract(config = {}, state = {}) {
|
|
|
11383
11396
|
contract = {
|
|
11384
11397
|
...contract,
|
|
11385
11398
|
requiredEvidence: [...evidenceByCategory.values()],
|
|
11386
|
-
requiresWorkspaceMutation:
|
|
11387
|
-
|
|
11388
|
-
|
|
11389
|
-
requiresFileMutation:
|
|
11390
|
-
|
|
11391
|
-
|
|
11399
|
+
requiresWorkspaceMutation: authoritativeReadOnlyContinuation
|
|
11400
|
+
? false
|
|
11401
|
+
: Boolean(contract.requiresWorkspaceMutation || currentContract?.requiresWorkspaceMutation),
|
|
11402
|
+
requiresFileMutation: authoritativeReadOnlyContinuation
|
|
11403
|
+
? false
|
|
11404
|
+
: Boolean(contract.requiresFileMutation || currentContract?.requiresFileMutation),
|
|
11405
|
+
requiresSourceGrounding: authoritativeReadOnlyContinuation
|
|
11406
|
+
? false
|
|
11407
|
+
: Boolean(contract.requiresSourceGrounding || currentContract?.requiresSourceGrounding),
|
|
11392
11408
|
currentEvidenceCategories: [...currentEvidenceCategories],
|
|
11393
11409
|
currentEvidenceRevision: currentGoalRevision,
|
|
11394
11410
|
currentMutationBaseline: startedMutationRevision,
|
|
@@ -11414,14 +11430,22 @@ export function completionTaskContract(config = {}, state = {}) {
|
|
|
11414
11430
|
if (Array.isArray(contract.requiredGitActions) && contract.requiredGitActions.length) {
|
|
11415
11431
|
contract = {
|
|
11416
11432
|
...contract,
|
|
11417
|
-
requiredGitRevision:
|
|
11418
|
-
Number(contract.requiredGitRevision || 0)
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11433
|
+
requiredGitRevision: authoritativeReadOnlyContinuation
|
|
11434
|
+
? Number(contract.requiredGitRevision || 0)
|
|
11435
|
+
: Math.max(
|
|
11436
|
+
Number(contract.requiredGitRevision || 0),
|
|
11437
|
+
Number(goalContract.activeGoalRevision || goalContract.revision || 0)
|
|
11438
|
+
),
|
|
11439
|
+
requiredGitMutationRevision: authoritativeReadOnlyContinuation
|
|
11440
|
+
? Number(contract.requiredGitMutationRevision || 0)
|
|
11441
|
+
: Math.max(
|
|
11442
|
+
Number(contract.requiredGitMutationRevision || 0),
|
|
11443
|
+
Number(
|
|
11444
|
+
contract.projectMutationRevision ||
|
|
11445
|
+
state.meta?.projectVerification?.mutationRevision ||
|
|
11446
|
+
0
|
|
11447
|
+
)
|
|
11448
|
+
),
|
|
11425
11449
|
};
|
|
11426
11450
|
}
|
|
11427
11451
|
return contract;
|
package/src/scs-evidence.js
CHANGED
|
@@ -3359,7 +3359,20 @@ export function buildScsEvidenceLedger({ state = {}, context = {} } = {}) {
|
|
|
3359
3359
|
.slice(-80)
|
|
3360
3360
|
.map((item) => revalidateArtifactEvidence(item, state, context));
|
|
3361
3361
|
const verifiedItems = items.filter((item) => item?.verified !== false);
|
|
3362
|
-
const
|
|
3362
|
+
const durableGitEvidence = (
|
|
3363
|
+
Array.isArray(state.meta?.durableGitEvidence) ? state.meta.durableGitEvidence : []
|
|
3364
|
+
)
|
|
3365
|
+
.map((item) => ({
|
|
3366
|
+
action: String(item?.action || "").toLowerCase(),
|
|
3367
|
+
goalRevision: Math.max(0, Number(item?.goalRevision || 0)),
|
|
3368
|
+
mutationRevision: Math.max(0, Number(item?.mutationRevision || 0)),
|
|
3369
|
+
}))
|
|
3370
|
+
.filter((item) => item.action)
|
|
3371
|
+
.slice(-80);
|
|
3372
|
+
const categories = unique([
|
|
3373
|
+
...verifiedItems.map((item) => item.category),
|
|
3374
|
+
...(durableGitEvidence.length ? ["git"] : []),
|
|
3375
|
+
]);
|
|
3363
3376
|
const toolNames = unique(verifiedItems.map((item) => item.toolName).filter(Boolean));
|
|
3364
3377
|
const blockerEvents = events
|
|
3365
3378
|
.filter((event) => ["tool.blocked", "tool.failed"].includes(String(event?.type || "")))
|
|
@@ -3392,6 +3405,7 @@ export function buildScsEvidenceLedger({ state = {}, context = {} } = {}) {
|
|
|
3392
3405
|
toolNames,
|
|
3393
3406
|
blockerCount: blockers.length,
|
|
3394
3407
|
blockers,
|
|
3408
|
+
durableGitEvidence,
|
|
3395
3409
|
items: items.map((item, index) => ({
|
|
3396
3410
|
id: `e${String(index + 1).padStart(3, "0")}`,
|
|
3397
3411
|
...item,
|
|
@@ -3410,8 +3424,26 @@ export function evaluateScsEvidence(contract = {}, ledger = {}) {
|
|
|
3410
3424
|
0,
|
|
3411
3425
|
Number(contract.requiredGitMutationRevision || 0)
|
|
3412
3426
|
);
|
|
3427
|
+
const durableGitEvidence = (
|
|
3428
|
+
Array.isArray(ledger.durableGitEvidence) ? ledger.durableGitEvidence : []
|
|
3429
|
+
).filter(
|
|
3430
|
+
(item) =>
|
|
3431
|
+
item?.action &&
|
|
3432
|
+
(requiredGitRevision === 0 || Number(item?.goalRevision || 0) >= requiredGitRevision) &&
|
|
3433
|
+
(requiredGitMutationRevision === 0 ||
|
|
3434
|
+
Number(item?.mutationRevision || 0) >= requiredGitMutationRevision)
|
|
3435
|
+
);
|
|
3436
|
+
const observedGitEvidence = durableGitEvidence.length
|
|
3437
|
+
? durableGitEvidence.map((item) => ({
|
|
3438
|
+
category: "git",
|
|
3439
|
+
verified: true,
|
|
3440
|
+
gitAction: item.action,
|
|
3441
|
+
goalRevision: item.goalRevision,
|
|
3442
|
+
mutationRevision: item.mutationRevision,
|
|
3443
|
+
}))
|
|
3444
|
+
: ledgerItems;
|
|
3413
3445
|
const observedGitActionSequence =
|
|
3414
|
-
|
|
3446
|
+
observedGitEvidence
|
|
3415
3447
|
.filter(
|
|
3416
3448
|
(item) =>
|
|
3417
3449
|
item?.category === "git" &&
|