@lazyingart/agintiflow 0.20.307 → 0.20.308

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.307",
3
+ "version": "0.20.308",
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",
@@ -7471,6 +7471,212 @@ try {
7471
7471
  precommitDocumentQualityState.meta.completionEvidenceRepair === undefined,
7472
7472
  "a passing pre-commit document check did not clear its bounded repair marker"
7473
7473
  );
7474
+ const currentGoalGeneratedDocumentState = {
7475
+ goal:
7476
+ "Read TASK.md, produce a verified PDF memo for the current task, and commit only the intentional work.",
7477
+ messages: [],
7478
+ meta: {
7479
+ taskProfile: "writing",
7480
+ goalContract: {
7481
+ revision: 5,
7482
+ activeGoalRevision: 5,
7483
+ activeGoal:
7484
+ "Read TASK.md, produce a verified PDF memo for the current task, and commit only the intentional work.",
7485
+ },
7486
+ projectVerification: {
7487
+ mutationRevision: 12,
7488
+ privateMutationRevision: 0,
7489
+ mutationHistory: [
7490
+ {
7491
+ revision: 8,
7492
+ at: "2026-09-01T09:00:00.000Z",
7493
+ toolName: "run_command",
7494
+ paths: ["stale-root.pdf"],
7495
+ goalRevision: 4,
7496
+ },
7497
+ {
7498
+ revision: 11,
7499
+ at: "2026-09-01T09:05:00.000Z",
7500
+ toolName: "write_file",
7501
+ paths: ["daily_memo.tex"],
7502
+ goalRevision: 5,
7503
+ },
7504
+ {
7505
+ revision: 12,
7506
+ at: "2026-09-01T09:06:00.000Z",
7507
+ toolName: "run_command",
7508
+ paths: [
7509
+ "daily_memo.pdf",
7510
+ "daily_memo.aux",
7511
+ "/tmp/escape.pdf",
7512
+ ".env.pdf",
7513
+ "secrets/hidden.pdf",
7514
+ ],
7515
+ goalRevision: 5,
7516
+ },
7517
+ ],
7518
+ },
7519
+ },
7520
+ };
7521
+ let currentGoalDocumentValidatorInput = null;
7522
+ const currentGoalDocumentAssessment = await documentQualityCommitAssessment(
7523
+ currentGoalGeneratedDocumentState,
7524
+ "run_command",
7525
+ { command: "git add -- daily_memo.tex daily_memo.pdf && git commit -m memo" },
7526
+ {
7527
+ commandCwd: missingArtifactCommitWorkspace,
7528
+ taskProfile: "writing",
7529
+ documentArtifactValidator: async (input) => {
7530
+ currentGoalDocumentValidatorInput = input;
7531
+ return {
7532
+ ok: true,
7533
+ checked: true,
7534
+ artifacts: [{ path: "daily_memo.pdf" }],
7535
+ defects: [],
7536
+ reason: "Independent document checks passed for daily_memo.pdf.",
7537
+ };
7538
+ },
7539
+ }
7540
+ );
7541
+ assert(
7542
+ currentGoalDocumentAssessment?.ok === true &&
7543
+ currentGoalDocumentValidatorInput?.exactOutputPaths?.includes(
7544
+ "daily_memo.pdf"
7545
+ ) &&
7546
+ !currentGoalDocumentValidatorInput.exactOutputPaths.includes(
7547
+ "stale-root.pdf"
7548
+ ) &&
7549
+ !currentGoalDocumentValidatorInput.exactOutputPaths.includes(
7550
+ "daily_memo.aux"
7551
+ ) &&
7552
+ !currentGoalDocumentValidatorInput.exactOutputPaths.includes(
7553
+ "secrets/hidden.pdf"
7554
+ ),
7555
+ `a current-goal generated root PDF was not discovered safely for pre-commit validation: ${JSON.stringify(
7556
+ currentGoalDocumentValidatorInput
7557
+ )}`
7558
+ );
7559
+ const unrelatedRootWorkspace = path.join(
7560
+ tempRoot,
7561
+ "unrelated-root-document"
7562
+ );
7563
+ await fs.mkdir(unrelatedRootWorkspace, { recursive: true });
7564
+ await fs.writeFile(
7565
+ path.join(unrelatedRootWorkspace, "unrelated.pdf"),
7566
+ "pre-existing root PDF that the current goal did not create",
7567
+ "utf8"
7568
+ );
7569
+ const unrelatedRootDocumentState = {
7570
+ goal:
7571
+ "Produce a verified PDF artifact for this task and commit the intentional work.",
7572
+ messages: [],
7573
+ meta: {
7574
+ taskProfile: "writing",
7575
+ goalContract: {
7576
+ revision: 6,
7577
+ activeGoalRevision: 6,
7578
+ activeGoal:
7579
+ "Produce a verified PDF artifact for this task and commit the intentional work.",
7580
+ },
7581
+ projectVerification: {
7582
+ mutationRevision: 4,
7583
+ privateMutationRevision: 0,
7584
+ mutationHistory: [
7585
+ {
7586
+ revision: 3,
7587
+ at: "2026-09-01T09:10:00.000Z",
7588
+ toolName: "run_command",
7589
+ paths: ["unrelated.pdf"],
7590
+ goalRevision: 5,
7591
+ },
7592
+ {
7593
+ revision: 4,
7594
+ at: "2026-09-01T09:12:00.000Z",
7595
+ toolName: "write_file",
7596
+ paths: ["notes.tex"],
7597
+ goalRevision: 6,
7598
+ },
7599
+ ],
7600
+ },
7601
+ },
7602
+ };
7603
+ let unrelatedRootValidatorInput = null;
7604
+ const unrelatedRootAssessment = await documentQualityCommitAssessment(
7605
+ unrelatedRootDocumentState,
7606
+ "run_command",
7607
+ { command: "git add -- notes.tex && git commit -m notes" },
7608
+ {
7609
+ commandCwd: unrelatedRootWorkspace,
7610
+ taskProfile: "writing",
7611
+ documentArtifactValidator: async (input) => {
7612
+ unrelatedRootValidatorInput = input;
7613
+ return {
7614
+ ok: false,
7615
+ checked: true,
7616
+ artifacts: [],
7617
+ defects: [{ code: "missing-document-artifact" }],
7618
+ reason: "No readable DOCX or PDF artifact was found for the completed document task.",
7619
+ };
7620
+ },
7621
+ }
7622
+ );
7623
+ assert(
7624
+ unrelatedRootAssessment?.ok === false &&
7625
+ unrelatedRootAssessment.category === "document-quality-incomplete" &&
7626
+ !unrelatedRootValidatorInput?.exactOutputPaths?.includes(
7627
+ "unrelated.pdf"
7628
+ ),
7629
+ `an unrelated pre-existing root PDF was accepted as current-goal evidence: ${JSON.stringify(
7630
+ unrelatedRootValidatorInput
7631
+ )}`
7632
+ );
7633
+ const semanticGateDocumentState = structuredClone(
7634
+ currentGoalGeneratedDocumentState
7635
+ );
7636
+ semanticGateDocumentState.meta.scs = {
7637
+ taskContract: { exactInputPaths: ["TASK.md"] },
7638
+ };
7639
+ let semanticGateValidatorInput = null;
7640
+ const semanticGateAssessment = await documentQualityCommitAssessment(
7641
+ semanticGateDocumentState,
7642
+ "run_command",
7643
+ { command: "git add -- daily_memo.tex daily_memo.pdf && git commit -m memo" },
7644
+ {
7645
+ commandCwd: missingArtifactCommitWorkspace,
7646
+ taskProfile: "writing",
7647
+ documentArtifactValidator: async (input) => {
7648
+ semanticGateValidatorInput = input;
7649
+ return {
7650
+ ok: false,
7651
+ checked: true,
7652
+ artifacts: [{ path: "daily_memo.pdf" }],
7653
+ defects: [{
7654
+ code: "source-topic-coverage-incomplete",
7655
+ path: "daily_memo.pdf",
7656
+ message: "The memo omitted current source-status facts.",
7657
+ }],
7658
+ reason: "daily_memo.pdf: The memo omitted current source-status facts.",
7659
+ };
7660
+ },
7661
+ }
7662
+ );
7663
+ assert(
7664
+ semanticGateAssessment?.ok === false &&
7665
+ semanticGateAssessment.category === "document-quality-incomplete" &&
7666
+ semanticGateDocumentState.meta.completionEvidenceRepair
7667
+ ?.artifactQualityRepairRequired === true &&
7668
+ semanticGateDocumentState.meta.completionEvidenceRepair
7669
+ ?.documentArtifactGenerationRequired !== true &&
7670
+ semanticGateValidatorInput?.exactOutputPaths?.includes(
7671
+ "daily_memo.pdf"
7672
+ ) &&
7673
+ semanticGateValidatorInput?.exactInputPaths?.includes("TASK.md"),
7674
+ `current-goal artifact discovery bypassed source/status quality gates or reopened the missing-artifact loop: ${JSON.stringify({
7675
+ assessment: semanticGateAssessment,
7676
+ input: semanticGateValidatorInput,
7677
+ repair: semanticGateDocumentState.meta.completionEvidenceRepair,
7678
+ })}`
7679
+ );
7474
7680
  await fs.writeFile(
7475
7681
  path.join(missingArtifactCommitWorkspace, "TASK.md"),
7476
7682
  [
@@ -10257,6 +10257,7 @@ export async function documentQualityCommitAssessment(
10257
10257
  ? contract.exactOutputPaths
10258
10258
  : []),
10259
10259
  ...exactOutputPathsForState(state),
10260
+ ...currentGoalDocumentArtifactPathsForState(state),
10260
10261
  ...(Array.isArray(config.taskOwnedCommitPaths)
10261
10262
  ? config.taskOwnedCommitPaths
10262
10263
  : []),
@@ -14185,6 +14186,46 @@ function exactOutputPathsForState(state = {}) {
14185
14186
  ], exclusions).slice(0, 32);
14186
14187
  }
14187
14188
 
14189
+ function currentGoalDocumentArtifactPathsForState(state = {}) {
14190
+ const verification = state.meta?.projectVerification || {};
14191
+ const history = Array.isArray(verification.mutationHistory)
14192
+ ? verification.mutationHistory
14193
+ : [];
14194
+ const currentGoalRevision = Math.max(
14195
+ 0,
14196
+ Number(state.meta?.goalContract?.revision || 0)
14197
+ );
14198
+ if (currentGoalRevision <= 0) return [];
14199
+ const candidates = [];
14200
+ const seen = new Set();
14201
+ for (const mutation of history) {
14202
+ if (Number(mutation?.goalRevision || 0) !== currentGoalRevision) continue;
14203
+ const paths = [
14204
+ ...(Array.isArray(mutation?.paths) ? mutation.paths : []),
14205
+ ...(Array.isArray(mutation?.projectMutationPaths)
14206
+ ? mutation.projectMutationPaths
14207
+ : []),
14208
+ ...(Array.isArray(mutation?.verifiedGeneratedOutputPaths)
14209
+ ? mutation.verifiedGeneratedOutputPaths
14210
+ : []),
14211
+ ];
14212
+ for (const value of paths) {
14213
+ const candidate = safeTaskOwnedCommitPath(value);
14214
+ if (
14215
+ !candidate ||
14216
+ !/\.(?:docx|pdf)$/iu.test(candidate) ||
14217
+ seen.has(candidate)
14218
+ ) {
14219
+ continue;
14220
+ }
14221
+ seen.add(candidate);
14222
+ candidates.push(candidate);
14223
+ if (candidates.length >= 16) return candidates;
14224
+ }
14225
+ }
14226
+ return candidates;
14227
+ }
14228
+
14188
14229
  function exactInputPathsForState(state = {}) {
14189
14230
  const scsInputPaths = Array.isArray(state.meta?.scs?.taskContract?.exactInputPaths)
14190
14231
  ? state.meta.scs.taskContract.exactInputPaths.filter(Boolean)
@@ -21389,6 +21430,7 @@ async function completionEvidenceDecision({ config, state, store, observers, ste
21389
21430
  const documentExactOutputPaths = [
21390
21431
  ...(assessment.contract?.exactOutputPaths || []),
21391
21432
  ...exactOutputPathsForState(state),
21433
+ ...currentGoalDocumentArtifactPathsForState(state),
21392
21434
  ];
21393
21435
  const documentContractText = `${completionContractGoal(config, state)}\n${candidateResult}`;
21394
21436
  const documentDeliverableRequested =