@lazyingart/agintiflow 0.20.313 → 0.20.314

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.313",
3
+ "version": "0.20.314",
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",
@@ -33,6 +33,19 @@ const groupBriefingContract = deriveScsTaskContract({
33
33
  ].join(" "),
34
34
  taskProfile: "research",
35
35
  });
36
+ const sourceIntakeAuditContract = deriveScsTaskContract({
37
+ goal: [
38
+ "Create one concise coherent Markdown report with exactly five numbered cases:",
39
+ "(1) a bare video has no publication;",
40
+ "(2) a current same-chat publish request authorizes only the exact referenced video through autopublish-video plus LazyEdit, while this audit performs no external action;",
41
+ "(3) Finder recovery remains evidence-limited;",
42
+ "(4) mp.weixin recovery never asks for browser verification;",
43
+ "(5) PDF/archive intake uses the guarded document reader.",
44
+ "Run only the focused existing unit test and write agent-result.json.",
45
+ "Do not send, publish, submit, upload, alter queues, or open a GUI.",
46
+ ].join(" "),
47
+ taskProfile: "auto",
48
+ });
36
49
  const scopedReadThenWriteRoot = fs.mkdtempSync(
37
50
  path.join(os.tmpdir(), "aginti-scoped-read-then-write-")
38
51
  );
@@ -83,6 +96,16 @@ assert.deepEqual(
83
96
  ["format:.pdf"],
84
97
  "an ordinary chat answer was incorrectly converted into a separate answer-key artifact"
85
98
  );
99
+ assert.deepEqual(
100
+ sourceIntakeAuditContract.requiredArtifactKinds.map((item) => item.id),
101
+ ["format:.md"],
102
+ "a Markdown-only audit inferred PDF from a described PDF intake case"
103
+ );
104
+ assert.equal(
105
+ sourceIntakeAuditContract.requiredEvidence.some((item) => item.category === "publish"),
106
+ false,
107
+ "a read-only audit of a publish contract fabricated a publish action obligation"
108
+ );
86
109
  assert.deepEqual(
87
110
  educationArtifactContract.requiredArtifactKinds.map((item) => item.id).sort(),
88
111
  [
@@ -583,6 +583,7 @@ const REQUESTED_ARTIFACT_FORMATS = [
583
583
  { extension: ".pptx", pattern: /\b(?:pptx|powerpoint)\b/i, description: "editable PowerPoint deck" },
584
584
  { extension: ".odp", pattern: /\b(?:odp|open(?:office|document) presentation)\b/i, description: "editable ODP deck" },
585
585
  { extension: ".pdf", pattern: /\bpdf\b/i, description: "PDF document" },
586
+ { extension: ".md", pattern: /(?:\bmarkdown\b|\.md\b)/i, description: "Markdown document" },
586
587
  {
587
588
  extension: ".tex",
588
589
  pattern: /(?:\b(?:editable\s+)?(?:latex|tex)\s+source\b|\.tex\b)/i,
@@ -594,6 +595,64 @@ const REQUESTED_ARTIFACT_FORMATS = [
594
595
  { extension: ".svg", pattern: /\bsvg\b/i, description: "editable SVG image" },
595
596
  ];
596
597
 
598
+ function requestedArtifactFormatHasOutputIntent(source = "", format = {}) {
599
+ const extension = String(format.extension || "").toLocaleLowerCase("en-US");
600
+ if (!extension || !format.pattern) return false;
601
+ if (
602
+ inferExactOutputPaths(source).some(
603
+ (candidate) => path.extname(candidate).toLocaleLowerCase("en-US") === extension
604
+ )
605
+ ) {
606
+ return true;
607
+ }
608
+
609
+ const matcher = new RegExp(
610
+ format.pattern.source,
611
+ format.pattern.flags.includes("g") ? format.pattern.flags : `${format.pattern.flags}g`
612
+ );
613
+ const outputAction =
614
+ /\b(?:compile|convert|create|deliver|export|generate|keep|make|output|prepare|preserve|produce|provide|render|retain|return|reuse|save|send|write)\b/i;
615
+ const directRequest =
616
+ /\b(?:can|could|would|will)\s+you\b|\b(?:i|we)\s+(?:also\s+)?(?:need|want|would\s+like|request)\b|\b(?:please|kindly)\b/i;
617
+ for (const match of source.matchAll(matcher)) {
618
+ const index = Number(match.index || 0);
619
+ const clauseStart = Math.max(
620
+ source.lastIndexOf(".", index - 1),
621
+ source.lastIndexOf("!", index - 1),
622
+ source.lastIndexOf("?", index - 1),
623
+ source.lastIndexOf(";", index - 1),
624
+ source.lastIndexOf("。", index - 1),
625
+ source.lastIndexOf("!", index - 1),
626
+ source.lastIndexOf("?", index - 1),
627
+ source.lastIndexOf(";", index - 1),
628
+ source.lastIndexOf("\n", index - 1)
629
+ );
630
+ const nextBoundaries = [".", "!", "?", ";", "。", "!", "?", ";", "\n"]
631
+ .map((delimiter) => source.indexOf(delimiter, index + String(match[0] || "").length))
632
+ .filter((candidate) => candidate >= 0);
633
+ const clauseEnd = nextBoundaries.length ? Math.min(...nextBoundaries) : source.length;
634
+ const clause = source.slice(clauseStart + 1, clauseEnd);
635
+ const matchOffset = index - clauseStart - 1;
636
+ const before = clause.slice(Math.max(0, matchOffset - 180), matchOffset);
637
+ const after = clause.slice(matchOffset + String(match[0] || "").length, matchOffset + 120);
638
+ if (outputAction.test(before) || directRequest.test(before)) return true;
639
+ if (
640
+ /\b(?:as|into|to)\s+(?:an?\s+)?$/i.test(before) &&
641
+ /\b(?:compile|convert|export|render|save)\b/i.test(clause)
642
+ ) {
643
+ return true;
644
+ }
645
+ if (
646
+ /^\s*(?:output|deliverable|file|document|report|version|copy)\b/i.test(after) &&
647
+ outputAction.test(clause)
648
+ ) {
649
+ return true;
650
+ }
651
+ if (/^\s*(?:please|required|requested)\b/i.test(after)) return true;
652
+ }
653
+ return false;
654
+ }
655
+
597
656
  function artifactRequestHasOutputIntent(goal = "", taskProfile = "") {
598
657
  const source = stripForbiddenLanguage(String(goal || ""));
599
658
  return Boolean(
@@ -622,7 +681,7 @@ export function inferRequestedArtifactRequirements(goal = "", taskProfile = "")
622
681
  };
623
682
 
624
683
  for (const format of REQUESTED_ARTIFACT_FORMATS) {
625
- if (!format.pattern.test(source)) continue;
684
+ if (!requestedArtifactFormatHasOutputIntent(source, format)) continue;
626
685
  add({
627
686
  id: `format:${format.extension}`,
628
687
  kind: "format",
@@ -1456,6 +1515,41 @@ function requiresSourceGrounding(goal = "") {
1456
1515
  );
1457
1516
  }
1458
1517
 
1518
+ function goalRequestsPublishAction(goal = "") {
1519
+ const text = normalizedText(stripCompletedWorkNarration(stripForbiddenLanguage(goal)));
1520
+ const action =
1521
+ "(?:publish|deploy|submit|upload\\s+to|generate\\s+(?:a\\s+)?video|npm\\s+publish)";
1522
+ const release =
1523
+ "(?:release|ship)(?:\\s+(?:(?:the|this|that|a|an)\\s+)?(?:package|version|build|app|application|software|library|plugin|extension|product)|\\s+(?:to|on|via|through))|cut\\s+(?:a\\s+)?release";
1524
+ const clauses = text
1525
+ .split(/[\n.!?;,;。!?]+/u)
1526
+ .map((clause) => clause.trim())
1527
+ .filter(Boolean);
1528
+ for (const clause of clauses) {
1529
+ if (
1530
+ new RegExp(
1531
+ `^(?:(?:and|also|then|next|finally|please|kindly)\\s+)*(?:${action}|${release})\\b`,
1532
+ "i"
1533
+ ).test(clause)
1534
+ ) {
1535
+ return true;
1536
+ }
1537
+ if (
1538
+ new RegExp(
1539
+ `\\b(?:(?:can|could|would|will)\\s+you|(?:i|we)\\s+(?:need|want|would\\s+like)\\s+(?:you\\s+)?to|you\\s+(?:must|should|need\\s+to|have\\s+to)|please|kindly|then|next|finally)\\b[^.\\n;]{0,140}\\b(?:${action}|${release})\\b`,
1540
+ "i"
1541
+ ).test(clause)
1542
+ ) {
1543
+ return true;
1544
+ }
1545
+ }
1546
+ return (
1547
+ /(?:请|請|需要|必须|必須|帮我|幫我|立即|现在|現在)[^。;\n]{0,100}(?:发布|發布|部署|提交|上传|上傳|生成视频|生成影片)/u.test(
1548
+ text
1549
+ ) || /^(?:发布|發布|部署|提交|上传|上傳|生成视频|生成影片)/u.test(text)
1550
+ );
1551
+ }
1552
+
1459
1553
  function inferRequirementCategories(goal = "", taskProfile = "", acceptanceCriteria = []) {
1460
1554
  const positiveGoal = stripForbiddenLanguage(goal);
1461
1555
  const text = normalizedText(positiveGoal);
@@ -1531,16 +1625,7 @@ function inferRequirementCategories(goal = "", taskProfile = "", acceptanceCrite
1531
1625
  ) {
1532
1626
  categories.add("visual");
1533
1627
  }
1534
- const explicitPublishAction =
1535
- textHas(
1536
- text,
1537
- /\b(?:publish|deploy|submit|upload to|generate video|external service|npm publish)\b/
1538
- ) ||
1539
- textHas(
1540
- text,
1541
- /\b(?:release|ship)\s+(?:(?:the|this|that|a|an)\s+)?(?:package|version|build|app|application|software|library|plugin|extension|product)\b|\b(?:release|ship)\s+(?:to|on|via|through)\b|\bcut\s+(?:a\s+)?release\b/
1542
- ) ||
1543
- /发布|部署|提交|生成视频|外部服务/.test(text);
1628
+ const explicitPublishAction = goalRequestsPublishAction(positiveGoal);
1544
1629
  if (explicitPublishAction) {
1545
1630
  categories.add("publish");
1546
1631
  }