@lazyingart/agintiflow 0.20.250 → 0.20.251

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.
@@ -379,3 +379,32 @@ local report paths and existing-document revision language now count as local
379
379
  workspace intent, so surrounding research policy does not force a new deep
380
380
  research route. The phrase `page-safe` no longer creates a browser-evidence
381
381
  requirement. Focused routing/evidence smokes and the full npm suite pass.
382
+
383
+ ### Fresh current-turn command evidence on retained sessions
384
+
385
+ `security-labshare-035` exercised a long-lived LocalLLM security-repair
386
+ session after the target repository was already fixed, committed, and clean.
387
+ The follow-up prompt deliberately asked the agent not to edit or recommit. It
388
+ required only the exact hidden verifier and `git status --short`, while allowing
389
+ all other passing implementation and unit-test evidence to remain reusable.
390
+
391
+ Installed AgInTiFlow `0.20.250` incorrectly finished after `inspect_project`.
392
+ It reused the old verifier/status evidence and never executed either command in
393
+ the current turn. The defect was not model quality: the runtime had failed to
394
+ turn explicit commands in a concrete same-task interruption into a fresh,
395
+ revision-bound evidence obligation.
396
+
397
+ The runtime now records explicit current-turn commands in the active execution
398
+ contract and creates a fresh command batch for only that subset. Unrelated
399
+ passing evidence from the unchanged mutation revision remains valid, while old
400
+ runs of the newly requested commands cannot pre-complete the batch. Inline
401
+ command extraction also recognizes natural `verify`, `validate`, `check`,
402
+ `confirm`, and rerun wording in English and Chinese.
403
+
404
+ The same real session was replayed against the patched source at goal revision
405
+ `34`. Its event ledger records both commands under
406
+ `required-command-batch-3`: the exact external security contract returned
407
+ `security_labshare_contract: PASS`, and `git status --short` returned empty.
408
+ The target stayed at commit `2b35928` with no mutation. Focused planning,
409
+ truthful-completion, and dynamic-budget regressions pass, as does the complete
410
+ AgInTiFlow npm suite. The fix is released in AgInTiFlow `0.20.251`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazyingart/agintiflow",
3
- "version": "0.20.250",
3
+ "version": "0.20.251",
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",
@@ -2885,6 +2885,152 @@ try {
2885
2885
  "the goal contract did not separate durable task lineage from the active interruption"
2886
2886
  );
2887
2887
 
2888
+ const exactVerifier = "python3 /tmp/security_labshare_contract.py";
2889
+ const exactStatus = "git status --short";
2890
+ const retainedUnitTest = "python3 -m unittest discover -s tests -v";
2891
+ const freshCommandState = {
2892
+ goal: "Repair and verify the current security task.",
2893
+ plan: "The prior implementation and validation are complete.",
2894
+ messages: [
2895
+ toolMessage({
2896
+ ok: true,
2897
+ toolName: "run_command",
2898
+ args: { command: retainedUnitTest },
2899
+ exitCode: 0,
2900
+ stdout: "OK",
2901
+ projectMutationRevision: 7,
2902
+ goalRevision: 5,
2903
+ }),
2904
+ toolMessage({
2905
+ ok: true,
2906
+ toolName: "run_command",
2907
+ args: { command: exactVerifier },
2908
+ exitCode: 0,
2909
+ stdout: "security_labshare_contract: PASS",
2910
+ projectMutationRevision: 7,
2911
+ requiredCommandBatchId: "required-command-batch-2",
2912
+ requiredProjectCommand: exactVerifier,
2913
+ goalRevision: 5,
2914
+ }),
2915
+ toolMessage({
2916
+ ok: true,
2917
+ toolName: "run_command",
2918
+ args: { command: exactStatus },
2919
+ exitCode: 0,
2920
+ stdout: "",
2921
+ projectMutationRevision: 7,
2922
+ requiredCommandBatchId: "required-command-batch-2",
2923
+ requiredProjectCommand: exactStatus,
2924
+ goalRevision: 5,
2925
+ }),
2926
+ ],
2927
+ meta: {
2928
+ taskProfile: "security",
2929
+ goalContract: {
2930
+ version: 3,
2931
+ revision: 5,
2932
+ status: "completed",
2933
+ taskGoal: "Repair and verify the current security task.",
2934
+ activeGoal: "Repair and verify the current security task.",
2935
+ currentRequest: "Repair and verify the current security task.",
2936
+ history: [{ revision: 5, taskHash: "same-security-task" }],
2937
+ },
2938
+ projectVerification: {
2939
+ mutationRevision: 7,
2940
+ requiredCommands: [retainedUnitTest],
2941
+ contractRequiredCommands: [exactVerifier, exactStatus],
2942
+ requiredCommandBatchSequence: 2,
2943
+ requiredCommandBatch: {
2944
+ id: "required-command-batch-2",
2945
+ key: JSON.stringify([exactVerifier, exactStatus]),
2946
+ requiredCommands: [exactVerifier, exactStatus],
2947
+ goalRevision: 5,
2948
+ completedCommands: [exactVerifier, exactStatus],
2949
+ completedRuns: [
2950
+ { command: exactVerifier, mutationRevision: 7 },
2951
+ { command: exactStatus, mutationRevision: 7 },
2952
+ ],
2953
+ startedMutationRevision: 7,
2954
+ lastMutationRevision: 7,
2955
+ complete: true,
2956
+ },
2957
+ commandRuns: [{
2958
+ command: retainedUnitTest,
2959
+ mutationRevision: 7,
2960
+ ok: true,
2961
+ }],
2962
+ testRuns: [],
2963
+ },
2964
+ },
2965
+ };
2966
+ const freshCommandRequest =
2967
+ "Continue the same corrective task. Run `python3 /tmp/security_labshare_contract.py`, verify `git status --short`, and finish without editing or recommitting files.";
2968
+ const freshCommandUpdate = applyContinuationContractTransition(
2969
+ freshCommandState,
2970
+ freshCommandRequest,
2971
+ { at: "2026-08-26T04:00:00.000Z" }
2972
+ );
2973
+ assert(
2974
+ freshCommandUpdate?.preserveTaskBoundary && freshCommandUpdate?.refreshExecutionContract,
2975
+ "an explicit same-task command rerun did not refresh the execution contract"
2976
+ );
2977
+ assert(
2978
+ JSON.stringify(freshCommandState.meta.activeExecutionContract.requiredProjectCommands) ===
2979
+ JSON.stringify([exactVerifier, exactStatus]),
2980
+ "the current turn lost an explicitly verified inline command"
2981
+ );
2982
+ assert(
2983
+ freshCommandState.meta.projectVerification.requiredCommandBatch.goalRevision === 6,
2984
+ "the fresh command batch was not bound to the current goal revision"
2985
+ );
2986
+ assert(
2987
+ freshCommandState.meta.projectVerification.requiredCommandBatch.completedCommands.length === 0,
2988
+ "retained command evidence pre-completed a current-turn rerun obligation"
2989
+ );
2990
+ const freshCommandConfig = {
2991
+ taskProfile: "security",
2992
+ commandCwd: workspace,
2993
+ };
2994
+ let freshCommandRuntime = nextStepRuntimeConfig(freshCommandConfig, freshCommandState);
2995
+ assert(
2996
+ freshCommandRuntime.requiredProjectCommandPending === true,
2997
+ "the current-turn verifier was not marked pending"
2998
+ );
2999
+ assert(
3000
+ freshCommandRuntime.requiredProjectCommand === exactVerifier,
3001
+ "the first explicitly repeated command was not pending"
3002
+ );
3003
+ const verifierResult = {
3004
+ ok: true,
3005
+ toolName: "run_command",
3006
+ args: { command: exactVerifier },
3007
+ exitCode: 0,
3008
+ stdout: "security_labshare_contract: PASS",
3009
+ stderr: "",
3010
+ };
3011
+ recordProjectVerificationOutcome(freshCommandState, verifierResult, freshCommandConfig);
3012
+ freshCommandState.messages.push(toolMessage(verifierResult));
3013
+ freshCommandRuntime = nextStepRuntimeConfig(freshCommandConfig, freshCommandState);
3014
+ assert(
3015
+ freshCommandRuntime.requiredProjectCommand === exactStatus,
3016
+ "the second current-turn command was not retained after the verifier passed"
3017
+ );
3018
+ const statusResult = {
3019
+ ok: true,
3020
+ toolName: "run_command",
3021
+ args: { command: exactStatus },
3022
+ exitCode: 0,
3023
+ stdout: "",
3024
+ stderr: "",
3025
+ };
3026
+ recordProjectVerificationOutcome(freshCommandState, statusResult, freshCommandConfig);
3027
+ freshCommandState.messages.push(toolMessage(statusResult));
3028
+ freshCommandRuntime = nextStepRuntimeConfig(freshCommandConfig, freshCommandState);
3029
+ assert(
3030
+ freshCommandRuntime.requiredProjectCommandPending !== true,
3031
+ "the fresh command batch stayed pending after both exact commands passed"
3032
+ );
3033
+
2888
3034
  const bareContinuationState = {
2889
3035
  goal: concreteContinuation,
2890
3036
  plan: "Update both retained outputs, validate, and commit.",
@@ -3066,10 +3066,25 @@ export function resetSameTaskExecutionContract(state = {}, revision = 0) {
3066
3066
  removed.push(key);
3067
3067
  }
3068
3068
  state.plan = "";
3069
+ const activeRevision = Math.max(0, Number(revision || state.meta?.goalContract?.revision || 0));
3070
+ const currentRequest = String(state.meta?.goalContract?.currentRequest || state.goal || "").trim();
3071
+ const currentTurnCommands = normalizedRequiredProjectCommands(
3072
+ deriveScsTaskContract({
3073
+ goal: currentRequest,
3074
+ taskProfile: state.meta?.taskProfile || "auto",
3075
+ }).requiredProjectCommands
3076
+ );
3069
3077
  state.meta.activeExecutionContract = {
3070
- revision: Math.max(0, Number(revision || state.meta?.goalContract?.revision || 0)),
3078
+ revision: activeRevision,
3071
3079
  refreshedAt: new Date().toISOString(),
3080
+ requiredProjectCommands: currentTurnCommands,
3072
3081
  };
3082
+ const verification = state.meta.projectVerification;
3083
+ if (verification && typeof verification === "object" && currentTurnCommands.length) {
3084
+ startRequiredCommandBatch(verification, currentTurnCommands, {
3085
+ goalRevision: activeRevision,
3086
+ });
3087
+ }
3073
3088
  return removed;
3074
3089
  }
3075
3090
 
@@ -4289,10 +4304,27 @@ function effectiveRequiredProjectCommands(state = {}, verification = {}, config
4289
4304
 
4290
4305
  function currentRequiredCommandBatch(verification = {}, requiredCommands = []) {
4291
4306
  const batch = verification.requiredCommandBatch;
4292
- const key = requiredCommandBatchKey(requiredCommands);
4293
- if (!batch || typeof batch !== "object" || !key || batch.key !== key || !batch.id) return null;
4307
+ const effectiveCommands = normalizedRequiredProjectCommands(requiredCommands);
4308
+ const batchCommands = normalizedRequiredProjectCommands(
4309
+ Array.isArray(batch?.requiredCommands)
4310
+ ? batch.requiredCommands
4311
+ : batch?.key === requiredCommandBatchKey(effectiveCommands)
4312
+ ? effectiveCommands
4313
+ : []
4314
+ );
4315
+ if (
4316
+ !batch ||
4317
+ typeof batch !== "object" ||
4318
+ !batch.id ||
4319
+ !batchCommands.length ||
4320
+ batch.key !== requiredCommandBatchKey(batchCommands) ||
4321
+ batchCommands.some((command) => !effectiveCommands.includes(command))
4322
+ ) {
4323
+ return null;
4324
+ }
4294
4325
  return {
4295
4326
  ...batch,
4327
+ requiredCommands: batchCommands,
4296
4328
  completedCommands: Array.isArray(batch.completedCommands)
4297
4329
  ? batch.completedCommands.map(normalizeProjectCommand).filter(Boolean)
4298
4330
  : [],
@@ -4307,13 +4339,20 @@ function currentRequiredCommandBatch(verification = {}, requiredCommands = []) {
4307
4339
  };
4308
4340
  }
4309
4341
 
4310
- function startRequiredCommandBatch(verification = {}, requiredCommands = []) {
4342
+ function startRequiredCommandBatch(
4343
+ verification = {},
4344
+ requiredCommands = [],
4345
+ { goalRevision = 0 } = {}
4346
+ ) {
4347
+ const normalizedCommands = normalizedRequiredProjectCommands(requiredCommands);
4311
4348
  const sequence = Math.max(0, Number(verification.requiredCommandBatchSequence || 0)) + 1;
4312
4349
  verification.requiredCommandBatchSequence = sequence;
4313
4350
  const revision = Math.max(0, Number(verification.mutationRevision || 0));
4314
4351
  const batch = {
4315
4352
  id: `required-command-batch-${sequence}`,
4316
- key: requiredCommandBatchKey(requiredCommands),
4353
+ key: requiredCommandBatchKey(normalizedCommands),
4354
+ requiredCommands: normalizedCommands,
4355
+ goalRevision: Math.max(0, Number(goalRevision || 0)),
4317
4356
  completedCommands: [],
4318
4357
  completedRuns: [],
4319
4358
  startedMutationRevision: revision + 1,
@@ -4474,7 +4513,7 @@ function requiredCommandRunIsCurrent(
4474
4513
  if (!required || !commandMatches) return false;
4475
4514
  const requiredCommands = verificationRequiredProjectCommands(verification);
4476
4515
  const batch = currentRequiredCommandBatch(verification, requiredCommands);
4477
- if (batch?.id) {
4516
+ if (batch?.id && batch.requiredCommands.includes(required)) {
4478
4517
  const accepted = batch.completedRuns.find((item) => item.command === required);
4479
4518
  return Boolean(
4480
4519
  accepted &&
@@ -4597,21 +4636,45 @@ export function recordProjectVerificationOutcome(state = {}, toolResult = {}, co
4597
4636
  commandCanMutateProjectContent(mutationCommand, commandPolicy)
4598
4637
  );
4599
4638
  let requiredBatch = currentRequiredCommandBatch(verification, requiredCommands);
4639
+ const activeExecutionContract = state.meta?.activeExecutionContract;
4640
+ const activeTurnCommands =
4641
+ Number(activeExecutionContract?.revision || 0) ===
4642
+ Number(state.meta?.goalContract?.revision || 0)
4643
+ ? normalizedRequiredProjectCommands(activeExecutionContract?.requiredProjectCommands)
4644
+ : [];
4645
+ if (
4646
+ !requiredBatch &&
4647
+ requiredCommand &&
4648
+ activeTurnCommands.includes(requiredCommand)
4649
+ ) {
4650
+ requiredBatch = startRequiredCommandBatch(verification, activeTurnCommands, {
4651
+ goalRevision: state.meta?.goalContract?.revision || 0,
4652
+ });
4653
+ }
4654
+ let batchRequiredCommands = requiredBatch?.requiredCommands || requiredCommands;
4600
4655
  if (projectContentMutation) {
4601
4656
  delete state.meta.verifiedCompletionCandidate;
4602
4657
  if (
4603
4658
  requiredCommand &&
4659
+ batchRequiredCommands.includes(requiredCommand) &&
4604
4660
  (!requiredBatch ||
4605
4661
  requiredBatch.complete ||
4606
4662
  requiredBatch.completedCommands.includes(requiredCommand))
4607
4663
  ) {
4608
- requiredBatch = startRequiredCommandBatch(verification, requiredCommands);
4664
+ requiredBatch = startRequiredCommandBatch(verification, batchRequiredCommands, {
4665
+ goalRevision: state.meta?.goalContract?.revision || 0,
4666
+ });
4667
+ batchRequiredCommands = requiredBatch.requiredCommands;
4609
4668
  }
4610
4669
  verification.mutationRevision += 1;
4611
- if (requiredCommand && requiredBatch) {
4670
+ if (
4671
+ requiredCommand &&
4672
+ requiredBatch &&
4673
+ requiredBatch.requiredCommands.includes(requiredCommand)
4674
+ ) {
4612
4675
  invalidateRequiredBatchValidations(
4613
4676
  requiredBatch,
4614
- requiredCommands,
4677
+ requiredBatch.requiredCommands,
4615
4678
  config,
4616
4679
  requiredCommand
4617
4680
  );
@@ -4640,17 +4703,19 @@ export function recordProjectVerificationOutcome(state = {}, toolResult = {}, co
4640
4703
  };
4641
4704
  if (requiredCommand && commandSucceeded) {
4642
4705
  if (!requiredBatch && requiredMutatingCommands.length === 0) {
4643
- requiredBatch = startRequiredCommandBatch(verification, requiredCommands);
4706
+ requiredBatch = startRequiredCommandBatch(verification, requiredCommands, {
4707
+ goalRevision: state.meta?.goalContract?.revision || 0,
4708
+ });
4644
4709
  requiredBatch.startedMutationRevision = verification.mutationRevision;
4645
4710
  requiredBatch.lastMutationRevision = verification.mutationRevision;
4646
4711
  }
4647
- if (requiredBatch) {
4712
+ if (requiredBatch?.requiredCommands.includes(requiredCommand)) {
4648
4713
  recordRequiredBatchRun(
4649
4714
  requiredBatch,
4650
4715
  requiredCommand,
4651
4716
  verification.mutationRevision
4652
4717
  );
4653
- requiredBatch.complete = requiredCommands.every((candidate) =>
4718
+ requiredBatch.complete = requiredBatch.requiredCommands.every((candidate) =>
4654
4719
  requiredBatch.completedCommands.includes(candidate)
4655
4720
  );
4656
4721
  verification.requiredCommandBatch = requiredBatch;
@@ -980,9 +980,9 @@ function prefixRequestsInlineCommandExecution(prefix = "") {
980
980
  while (preamble.test(clause)) clause = clause.replace(preamble, "").trim();
981
981
  clause = clause.replace(/(?:[::]|--?)\s*$/, "").trim();
982
982
  return (
983
- /^(?:run|execute|invoke|launch)(?:\s+(?:(?:the|this|that)\s+)?(?:following\s+)?command(?:\s+named)?)?\s*$/i.test(
983
+ /^(?:run|rerun|re-run|execute|invoke|launch|verify|validate|check|confirm)(?:\s+(?:(?:the|this|that)\s+)?(?:following\s+)?command(?:\s+named)?)?\s*$/i.test(
984
984
  clause
985
- ) || /^(?:运行|運行|执行|執行|调用|調用)\s*$/.test(clause)
985
+ ) || /^(?:运行|運行|执行|執行|调用|調用|验证|驗證|检查|檢查|确认|確認)\s*$/.test(clause)
986
986
  );
987
987
  }
988
988
 
@@ -1239,9 +1239,19 @@ export function augmentScsTaskContractWithProjectVerification(contract = {}, sta
1239
1239
  ...verificationRequiredProjectCommands,
1240
1240
  ].map(normalizeProjectCommand).filter(Boolean)).slice(0, 24);
1241
1241
  const requiredCommandBatch = verification.requiredCommandBatch;
1242
+ const batchRequiredCommands = unique(
1243
+ (Array.isArray(requiredCommandBatch?.requiredCommands)
1244
+ ? requiredCommandBatch.requiredCommands
1245
+ : requiredCommandBatch?.key === JSON.stringify(requiredProjectCommands)
1246
+ ? requiredProjectCommands
1247
+ : [])
1248
+ .map(normalizeProjectCommand)
1249
+ .filter((command) => command && requiredProjectCommands.includes(command))
1250
+ );
1242
1251
  const requiredProjectCommandBatchId =
1243
1252
  requiredCommandBatch &&
1244
- requiredCommandBatch.key === JSON.stringify(requiredProjectCommands) &&
1253
+ batchRequiredCommands.length > 0 &&
1254
+ requiredCommandBatch.key === JSON.stringify(batchRequiredCommands) &&
1245
1255
  requiredCommandBatch.id
1246
1256
  ? String(requiredCommandBatch.id)
1247
1257
  : "";
@@ -1286,7 +1296,7 @@ export function augmentScsTaskContractWithProjectVerification(contract = {}, sta
1286
1296
  requiredProjectCommands,
1287
1297
  requiredProjectCommandBatchId,
1288
1298
  requiredProjectCommandBatchCommands: requiredProjectCommandBatchId
1289
- ? requiredProjectCommands
1299
+ ? batchRequiredCommands
1290
1300
  : [],
1291
1301
  requiredProjectCommandRuns,
1292
1302
  projectMutationRevision: mutationRevision,