@lazyingart/agintiflow 0.20.309 → 0.20.311

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.309",
3
+ "version": "0.20.311",
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",
@@ -5,8 +5,10 @@ import os from "node:os";
5
5
  import path from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import {
8
+ completionRequirementCoverageInstruction,
8
9
  continuationExecutionContractDirective,
9
10
  removeSupersededCompletionRepairInstructions,
11
+ repositorySourcePrecedenceInstruction,
10
12
  runAgent,
11
13
  } from "../src/agent-runner.js";
12
14
  import { resolveRuntimeConfig } from "../src/config.js";
@@ -17,6 +19,43 @@ const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."
17
19
  const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "agintiflow-truthful-completion-"));
18
20
  process.env.AGINTIFLOW_HOME = path.join(tempRoot, "home");
19
21
 
22
+ const completionCoverageInstruction = completionRequirementCoverageInstruction();
23
+ assert.match(completionCoverageInstruction, /requirement by requirement/i);
24
+ assert.match(completionCoverageInstruction, /Every distinct subject/i);
25
+ assert.match(completionCoverageInstruction, /authoritative structured routine/i);
26
+ assert.match(completionCoverageInstruction, /every relevant section/i);
27
+ assert.match(completionCoverageInstruction, /instead of summarizing only failures or only successes/i);
28
+
29
+ const sourcePrecedenceInstruction = repositorySourcePrecedenceInstruction();
30
+ assert.match(sourcePrecedenceInstruction, /current direct user request/i);
31
+ assert.match(sourcePrecedenceInstruction, /closest project instructions/i);
32
+ assert.match(sourcePrecedenceInstruction, /most specific current implementation and tests/i);
33
+ assert.match(sourcePrecedenceInstruction, /stale guides/i);
34
+ assert.match(sourcePrecedenceInstruction, /AGENTS\.md/i);
35
+
36
+ const readOnlyContractAuditGoal = `
37
+ Audit the current source-intake contract and cover an ordinary video, a hypothetical
38
+ same-chat publish request, a Finder card, and a document attachment. Do not send any
39
+ message, publish anything, alter a queue, open a browser, or modify configuration.
40
+ `;
41
+ const readOnlyContractAudit = deriveScsTaskContract({
42
+ goal: readOnlyContractAuditGoal,
43
+ taskProfile: "auto",
44
+ });
45
+ assert.equal(readOnlyContractAudit.readOnlyReadiness, true);
46
+ assert(
47
+ !readOnlyContractAudit.requiredEvidence.some((item) => item.category === "publish"),
48
+ "a hypothetical publish case inside a forbidden read-only contract audit required live publish evidence"
49
+ );
50
+ assert(
51
+ !readOnlyContractAudit.requiredEvidence.some((item) => item.category === "browser"),
52
+ "a forbidden browser action inside a read-only contract audit required browser evidence"
53
+ );
54
+ assert(
55
+ readOnlyContractAudit.forbiddenActions.some((item) => /publish anything/i.test(item)),
56
+ "the read-only audit lost its explicit publish prohibition"
57
+ );
58
+
20
59
  assert.equal(
21
60
  finishResultClaimsIncompleteWork(
22
61
  "The report is complete and the verification that was previously paused now passes. No work remains."
@@ -2969,6 +2969,14 @@ function usesFocusedRuntimePrompt(config = {}) {
2969
2969
  return config.executionTier === "focused" && !config.scsActive;
2970
2970
  }
2971
2971
 
2972
+ export function completionRequirementCoverageInstruction() {
2973
+ return "Before finishing, check the current user request requirement by requirement. Every distinct subject, requested action, and deliverable must be completed, answered, deliberately grouped under one verified shared state, or named with a concrete blocker. When an authoritative structured routine returns named sections relevant to the request, report every relevant section instead of summarizing only failures or only successes.";
2974
+ }
2975
+
2976
+ export function repositorySourcePrecedenceInstruction() {
2977
+ return "Treat the current direct user request and the closest project instructions as authoritative. When describing an existing contract, inspect the most specific current implementation and tests, reconcile conflicting documentation, and never let examples, stale guides, or historical notes override AGENTS.md or current code. State any unresolved conflict instead of choosing silently.";
2978
+ }
2979
+
2972
2980
  function focusedCapabilityContext(config = {}) {
2973
2981
  return [
2974
2982
  config.allowFileTools
@@ -3012,6 +3020,8 @@ function buildFocusedRuntimeMessages({
3012
3020
  "You are AgInTiFlow, a persistent tool-capable agent.",
3013
3021
  "Answer ordinary conversation directly. For executable work, act through the smallest relevant routine or tool, verify in proportion to risk, then stop.",
3014
3022
  "Treat queued user input as a safe-boundary interruption: preserve every material requirement, merge related consecutive messages, revise the durable goal, and never repeat a completed external side effect.",
3023
+ completionRequirementCoverageInstruction(),
3024
+ repositorySourcePrecedenceInstruction(),
3015
3025
  "Established project routines are capabilities to invoke, not workflows to reimplement. Discover more context only when the current task needs it.",
3016
3026
  formatBehaviorContractForPrompt({ mode: "focused" }),
3017
3027
  languageInstruction(config.language || "en"),
@@ -3230,6 +3240,8 @@ async function createInitialState(config, sessionId) {
3230
3240
  : "For website/app/code/LaTeX/Python/C/shell tasks, create or edit real workspace files, run available build/compile/test commands, and surface artifacts through the canvas when useful.",
3231
3241
  "For LaTeX/PDF tasks, check existing latexmk/pdflatex first and compile with the available host or Docker TeX toolchain before installing packages or rebuilding the sandbox.",
3232
3242
  "For research or web-search tasks, use browser tools or safe shell network tools when the current policy allows; cite or save useful sources in workspace notes when the task needs traceability.",
3243
+ completionRequirementCoverageInstruction(),
3244
+ repositorySourcePrecedenceInstruction(),
3233
3245
  browserStateReconciliationGuidance(),
3234
3246
  isRetainedWorkspaceProfile(config)
3235
3247
  ? "Choose descriptive non-conflicting workspace paths for durable outputs."
@@ -454,6 +454,13 @@ function normalizeWrappedNegativePrefixes(goal = "") {
454
454
  );
455
455
  }
456
456
 
457
+ function normalizeSoftLineWraps(goal = "") {
458
+ return normalizeWrappedNegativePrefixes(goal).replace(
459
+ /([A-Za-z0-9,])[ \t]*\r?\n[ \t]*(?=[a-z])/g,
460
+ "$1 "
461
+ );
462
+ }
463
+
457
464
  function inferExactOutputPaths(goal = "") {
458
465
  const paths = [];
459
466
  const lines = String(goal || "").split(/\n/);
@@ -1406,10 +1413,17 @@ function isReadOnlyReadinessTask(goal = "") {
1406
1413
  /\b(?:readiness|capability)\s+(?:audit|check|report|assessment)\b/i.test(text) ||
1407
1414
  /\bwhether\s+(?:i|we|the\s+(?:agent|system))\s+can\b/i.test(text) ||
1408
1415
  /只读检查|只讀檢查|就绪检查|就緒檢查|能力检查|能力檢查|检查是否|檢查是否/.test(text);
1416
+ const contractAuditSignal =
1417
+ /\b(?:audit|inspect|review|assess|document|report\s+on)\s+(?:the\s+)?(?:current\s+)?[^.\n;]{0,140}\b(?:contract|policy|behavio(?:u)?r|workflow|implementation|routine|routing|readiness|capabilit(?:y|ies))\b/i.test(
1418
+ text
1419
+ ) ||
1420
+ /(?:审计|審計|检查|檢查|审查|審查|评估|評估|记录|記錄)[^。;\n]{0,120}(?:契约|契約|策略|行为|行為|流程|实现|實現|例程|路由|就绪|就緒|能力)/.test(
1421
+ text
1422
+ );
1409
1423
  const noActionSignal =
1410
- /\b(?:do not|don't|dont|never|without)\b[^.\n;]{0,260}\b(?:generate|submit|upload|publish|deploy|log in|login|restart|edit|modify|delete|purchase|pay)\b/i.test(text) ||
1424
+ /\b(?:do not|don't|dont|never|without)\b[^.\n;]{0,260}\b(?:send|generate|submit|upload|publish|deploy|open|browse|focus|restart|alter|change|edit|modify|write|mutate|delete|purchase|pay|log in|login)\b/i.test(text) ||
1411
1425
  /(?:不要|禁止)[^。\n;]{0,260}(?:生成|提交|上传|上傳|发布|發布|部署|登录|登入|重启|重啟|编辑|編輯|修改|删除|刪除|购买|購買|支付)/.test(text);
1412
- return readinessSignal && noActionSignal;
1426
+ return (readinessSignal || contractAuditSignal) && noActionSignal;
1413
1427
  }
1414
1428
 
1415
1429
  function requiresSourceGrounding(goal = "") {
@@ -1550,7 +1564,7 @@ function inferRequirementCategories(goal = "", taskProfile = "", acceptanceCrite
1550
1564
  }
1551
1565
 
1552
1566
  function inferForbiddenActions(goal = "") {
1553
- const text = String(goal || "");
1567
+ const text = normalizeSoftLineWraps(goal);
1554
1568
  const forbidden = [];
1555
1569
  const isAction = (value = "") =>
1556
1570
  /\b(use|open|click|browse|browser|upload|attach|submit|publish|deploy|run|execute|install|delete|remove|commit|push|call|api|alter|chang(?:e|ing)|edit(?:ing)?|fix(?:ing)?|modif(?:y|ying)|patch(?:ing)?|repair(?:ing)?|rewrit(?:e|ing)|send(?:ing)?|touch(?:ing)?|writ(?:e|ing))\b/i.test(
@@ -1601,7 +1615,7 @@ function inferRequiredToolCalls(goal = "") {
1601
1615
  }
1602
1616
 
1603
1617
  function stripForbiddenLanguage(goal = "") {
1604
- return normalizeWrappedNegativePrefixes(goal)
1618
+ return normalizeSoftLineWraps(goal)
1605
1619
  .replace(/\b(do not|don't|dont|must not|should not|never|no need to)\s+([^.\n;]+)/gi, "")
1606
1620
  .replace(/\bwithout\s+([^.,:\uFF1A\n;]+)/gi, "")
1607
1621
  .replace(/不要([^。\n;]+)/g, "")