@lazyingart/agintiflow 0.20.277 → 0.20.279

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.277",
3
+ "version": "0.20.279",
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,94 @@ 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 commit -m 'Complete retained repair'" },
199
+ stdout: "[main abcdef1] Complete retained repair\n 1 file changed, 1 insertion(+)",
200
+ goalRevision: 13,
201
+ projectMutationRevision: 19,
202
+ }),
203
+ toolMessage({
204
+ toolName: "run_command",
205
+ ok: true,
206
+ exitCode: 0,
207
+ args: { command: "git status --short" },
208
+ stdout: "",
209
+ goalRevision: 15,
210
+ projectMutationRevision: 23,
211
+ }),
212
+ ],
213
+ meta: {
214
+ goalContract: {
215
+ version: 3,
216
+ revision: 15,
217
+ activeGoalRevision: 15,
218
+ taskGoal: "Create the editable deck, commit the focused repair, and verify it.",
219
+ activeGoal: readOnlyVerificationGoal,
220
+ currentRequest: readOnlyVerificationGoal,
221
+ currentPreview: readOnlyVerificationGoal,
222
+ history: [{ revision: 15, refreshExecutionContract: true }],
223
+ },
224
+ activeExecutionContract: {
225
+ revision: 15,
226
+ startedMutationRevision: 22,
227
+ requiresWorkspaceMutation: false,
228
+ requiresFileMutation: false,
229
+ requiresSourceGrounding: false,
230
+ requiredProjectCommands: ["git status --short"],
231
+ },
232
+ projectVerification: {
233
+ mutationRevision: 23,
234
+ requiredCommands: ["git status --short"],
235
+ },
236
+ durableGitActions: ["commit", "status"],
237
+ durableGitEvidence: [
238
+ { action: "commit", goalRevision: 13, mutationRevision: 19 },
239
+ { action: "status", goalRevision: 15, mutationRevision: 23 },
240
+ ],
241
+ },
242
+ };
243
+ const readOnlyVerificationContract = completionTaskContract(
244
+ { taskProfile: "slides" },
245
+ readOnlyVerificationState
246
+ );
247
+ assert(
248
+ readOnlyVerificationContract.requiresWorkspaceMutation === false &&
249
+ readOnlyVerificationContract.requiresFileMutation === false &&
250
+ readOnlyVerificationContract.requiresSourceGrounding === false,
251
+ "a verification-only continuation inherited stale mutation requirements from retained task context"
252
+ );
253
+ assert(
254
+ readOnlyVerificationContract.requiredGitActions.includes("commit") &&
255
+ Number(readOnlyVerificationContract.requiredGitRevision || 0) === 0 &&
256
+ Number(readOnlyVerificationContract.requiredGitMutationRevision || 0) === 0,
257
+ "a verification-only continuation demanded a new commit instead of accepting retained same-task Git evidence"
258
+ );
259
+ const readOnlyGitEvaluation = evaluateScsEvidence(
260
+ {
261
+ ...readOnlyVerificationContract,
262
+ requiresExternalEvidence: false,
263
+ requiredEvidence: [],
264
+ requiredProjectCommands: [],
265
+ },
266
+ buildScsEvidenceLedger({ state: readOnlyVerificationState })
267
+ );
268
+ assert(
269
+ readOnlyGitEvaluation.missingGitActions.length === 0,
270
+ "a prior verified same-task commit did not satisfy a read-only completion continuation"
271
+ );
272
+
185
273
  const runLockConfig = {
186
274
  sessionsDir: path.join(tempRoot, "run-lock-sessions"),
187
275
  };
@@ -88,6 +88,18 @@ const pathWrappedImmutableSourceContract = deriveScsTaskContract({
88
88
  taskProfile: "slides",
89
89
  });
90
90
 
91
+ const wrappedNegativeVerificationOnlyContract = deriveScsTaskContract({
92
+ goal: [
93
+ "Continue the exact active presentation task from its clean committed state.",
94
+ "The prior run completed the task-owned repository repair.",
95
+ "Do not start over and do",
96
+ "not modify source_brief.md, measurements.csv, prompt.txt, or TASK.md.",
97
+ "Do not rebuild, rewrite, recommit, or otherwise mutate the repository.",
98
+ "Read build_deck.py and TASK.md, run the exact validator, and finish from the retained evidence.",
99
+ ].join("\n"),
100
+ taskProfile: "slides",
101
+ });
102
+
91
103
  const recoveryInstructionContract = deriveScsTaskContract({
92
104
  goal: [
93
105
  "Use the retained source and these two failures: the tests invoke ../service_ctl.py, while `python3 service_ctl.py start --state-dir .runtime` fails. Preserve the lifecycle assertions rather than replacing them, repair service_ctl.py, and remove the accidental untracked resume-after-git-baseline-recovery-dev-prompt.txt.",
@@ -201,6 +213,26 @@ for (const contract of [
201
213
  "a negative action or its governed path list lost protection across a line wrap"
202
214
  );
203
215
  }
216
+ assert.deepEqual(
217
+ wrappedNegativeVerificationOnlyContract.excludedOutputPaths.sort(),
218
+ ["TASK.md", "measurements.csv", "prompt.txt", "source_brief.md"].sort(),
219
+ "a line-wrapped 'do not' prefix lost its immutable source exclusions"
220
+ );
221
+ assert.deepEqual(
222
+ wrappedNegativeVerificationOnlyContract.exactOutputPaths,
223
+ [],
224
+ "a verification-only continuation inferred exact outputs from a wrapped negative clause"
225
+ );
226
+ assert.equal(
227
+ wrappedNegativeVerificationOnlyContract.requiresWorkspaceMutation,
228
+ false,
229
+ "a verification-only continuation with a wrapped negative prefix required workspace mutation"
230
+ );
231
+ assert.equal(
232
+ wrappedNegativeVerificationOnlyContract.requiresFileMutation,
233
+ false,
234
+ "a verification-only continuation with a wrapped negative prefix required file mutation"
235
+ );
204
236
  assert(
205
237
  recoveryInstructionContract.excludedOutputPaths.includes("resume-after-git-baseline-recovery-dev-prompt.txt") &&
206
238
  !recoveryInstructionContract.exactOutputPaths.includes("resume-after-git-baseline-recovery-dev-prompt.txt"),
@@ -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: Boolean(
11387
- contract.requiresWorkspaceMutation || currentContract?.requiresWorkspaceMutation
11388
- ),
11389
- requiresFileMutation: Boolean(
11390
- contract.requiresFileMutation || currentContract?.requiresFileMutation
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: Math.max(
11418
- Number(contract.requiredGitRevision || 0),
11419
- Number(goalContract.activeGoalRevision || goalContract.revision || 0)
11420
- ),
11421
- requiredGitMutationRevision: Math.max(
11422
- Number(contract.requiredGitMutationRevision || 0),
11423
- Number(contract.projectMutationRevision || state.meta?.projectVerification?.mutationRevision || 0)
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;
@@ -412,6 +412,13 @@ function forbiddenTails(text = "") {
412
412
  return tails;
413
413
  }
414
414
 
415
+ function normalizeWrappedNegativePrefixes(goal = "") {
416
+ return String(goal || "").replace(
417
+ /\b(do|must|should)\s*\r?\n\s*not\b/giu,
418
+ "$1 not"
419
+ );
420
+ }
421
+
415
422
  function inferExactOutputPaths(goal = "") {
416
423
  const paths = [];
417
424
  const lines = String(goal || "").split(/\n/);
@@ -557,7 +564,7 @@ export function inferExplicitlyExcludedOutputPaths(goal = "") {
557
564
  `(?=\\S{1,260}\\.(?:${extensionPattern})\\b)`,
558
565
  "giu"
559
566
  );
560
- const source = String(goal || "")
567
+ const source = normalizeWrappedNegativePrefixes(goal)
561
568
  .replace(/([,,、])\s*\r?\n\s*/gu, "$1 ")
562
569
  .replace(wrappedNegativeAction, "$1 ")
563
570
  .replace(wrappedNegativePath, "$1 ");
@@ -1065,7 +1072,7 @@ function codeProfileRequiresCommand(goal = "") {
1065
1072
  }
1066
1073
 
1067
1074
  function goalRequestsWorkspaceMutation(goal = "", taskProfile = "") {
1068
- const text = normalizedText(stripForbiddenLanguage(goal));
1075
+ const text = normalizedText(stripCompletedWorkNarration(stripForbiddenLanguage(goal)));
1069
1076
  if (String(taskProfile || "").trim().toLowerCase() === "review") {
1070
1077
  return /\b(?:append|copy|create|delete|edit|fix|implement|modify|move|patch|refactor|remove|rename|repair|replace|rewrite|save|update|write)\b/.test(
1071
1078
  text
@@ -1080,7 +1087,7 @@ function goalRequestsWorkspaceMutation(goal = "", taskProfile = "") {
1080
1087
  }
1081
1088
 
1082
1089
  function goalRequestsFileMutation(goal = "", taskProfile = "") {
1083
- const text = normalizedText(stripForbiddenLanguage(goal));
1090
+ const text = normalizedText(stripCompletedWorkNarration(stripForbiddenLanguage(goal)));
1084
1091
  if (!goalRequestsWorkspaceMutation(text, taskProfile)) return false;
1085
1092
  return (
1086
1093
  /\b(?:code|codebase|document(?:ation)?|files?|notes?|path|readme|repo(?:sitory)?|script|source|workspace)\b/.test(
@@ -1301,13 +1308,35 @@ function inferRequiredToolCalls(goal = "") {
1301
1308
  }
1302
1309
 
1303
1310
  function stripForbiddenLanguage(goal = "") {
1304
- return String(goal || "")
1305
- .replace(/\b(do not|don't|dont|never|no need to)\s+([^.\n;]+)/gi, "")
1311
+ return normalizeWrappedNegativePrefixes(goal)
1312
+ .replace(/\b(do not|don't|dont|must not|should not|never|no need to)\s+([^.\n;]+)/gi, "")
1306
1313
  .replace(/\bwithout\s+([^.,\n;]+)/gi, "")
1307
1314
  .replace(/不要([^。\n;]+)/g, "")
1308
1315
  .replace(/禁止([^。\n;]+)/g, "");
1309
1316
  }
1310
1317
 
1318
+ function stripCompletedWorkNarration(goal = "") {
1319
+ const completedAction =
1320
+ "(?:completed?|finished|performed|applied|committed|repaired|fixed|rebuilt|rewrote|generated|created|updated|modified|patched|moved|relocated)";
1321
+ const priorActor =
1322
+ "(?:(?:the\\s+)?(?:prior|previous|earlier|last)\\s+(?:run|turn|attempt|session|agent|worker)|(?:it|this|that)\\s+(?:was|has\\s+been))";
1323
+ return String(goal || "")
1324
+ .replace(
1325
+ new RegExp(
1326
+ `\\b${priorActor}\\b[^.!?;;。!?\\n]{0,300}\\b${completedAction}\\b[^.!?;;。!?\\n]*`,
1327
+ "gi"
1328
+ ),
1329
+ ""
1330
+ )
1331
+ .replace(
1332
+ new RegExp(
1333
+ `\\b(?:already|previously|earlier)\\b[^.!?;;。!?\\n]{0,180}\\b${completedAction}\\b[^.!?;;。!?\\n]*`,
1334
+ "gi"
1335
+ ),
1336
+ ""
1337
+ );
1338
+ }
1339
+
1311
1340
  function parseAgintiEvidenceScopeMatch(goal = "") {
1312
1341
  const matches = [
1313
1342
  ...String(goal || "").matchAll(/^AGINTI_EVIDENCE_SCOPE_JSON:\s*(\{[^\n]+\})\s*$/gm),