@lazyingart/agintiflow 0.20.242 → 0.20.244

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.
@@ -10,6 +10,15 @@ Simple questions should stay on the fast path. A deep-research run spends more
10
10
  queries and model calls only when breadth, verification, and traceability add
11
11
  real value.
12
12
 
13
+ For a request that combines local workspace evidence with web research, the
14
+ outer agent first receives normal inspection tools. After it has read two
15
+ relevant files, or read one file plus inspected/searched the project, the next
16
+ research turn is constrained to `deep_research` and `finish`. This keeps local
17
+ notes authoritative without letting an agent silently replace a requested
18
+ multi-source review with ad hoc browsing. Tool history is scoped to the newest
19
+ genuine user request, so a completed research call from an older task does not
20
+ suppress a later correction or refresh.
21
+
13
22
  ## Architecture
14
23
 
15
24
  The implementation follows the strongest production patterns without making
@@ -205,7 +214,10 @@ To resume a partial or completed same-query run, pass the returned
205
214
  `refresh=true` is explicit. A transient run that retrieved zero allowed sources
206
215
  is marked failed, preserves its attempts, and retries retrieval on resume
207
216
  instead of caching an empty report as success. Checkpoint schema changes
208
- invalidate old cached runs automatically.
217
+ invalidate old cached runs automatically. The public tool result also carries
218
+ the research schema version; the outer session reuses a completed result only
219
+ when that version matches the installed engine. Versionless or older retained
220
+ results are refreshed instead of being presented as current evidence.
209
221
 
210
222
  `outputPath` is optional and must name a Markdown file inside the active
211
223
  workspace. Repository internals such as `.git`, dependency trees such as
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazyingart/agintiflow",
3
- "version": "0.20.242",
3
+ "version": "0.20.244",
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",
@@ -66,6 +66,7 @@
66
66
  "scripts/supervision-ledger.js",
67
67
  "scripts/smoke-supervision-ledger.js",
68
68
  "scripts/smoke-integration-production-mount.js",
69
+ "scripts/smoke-integration-production-runtime-bundle.js",
69
70
  "scripts/smoke-integration-storage-authority.js",
70
71
  "scripts/smoke-integration-retained-durable-common.js",
71
72
  "scripts/smoke-integration-retained-file-lock.js",
@@ -203,6 +204,7 @@
203
204
  "supervision:ledger": "node scripts/supervision-ledger.js",
204
205
  "smoke:supervision-ledger": "node scripts/smoke-supervision-ledger.js",
205
206
  "smoke:integration-production-mount": "node scripts/smoke-integration-production-mount.js",
207
+ "smoke:integration-production-runtime-bundle": "node scripts/smoke-integration-production-runtime-bundle.js",
206
208
  "smoke:integration-storage-authority": "node scripts/smoke-integration-storage-authority.js",
207
209
  "smoke:integration-retained-durable-common": "node scripts/smoke-integration-retained-durable-common.js",
208
210
  "smoke:integration-retained-file-lock": "node scripts/smoke-integration-retained-file-lock.js",
@@ -219,7 +221,7 @@
219
221
  "storage:migrate": "node bin/aginti-cli.js storage migrate",
220
222
  "publish:env": "node scripts/npm-publish-from-env.js publish --access public",
221
223
  "publish:env:whoami": "node scripts/npm-publish-from-env.js whoami",
222
- "test": "npm run check && npm run smoke:integration-production-mount && npm run smoke:integration-storage-authority && npm run smoke:integration-retained-durable-common && npm run smoke:integration-retained-file-lock && npm run smoke:integration-retained-event-ledger && npm run smoke:integration-retained-event-ledger-bundle && npm run smoke:integration-retained-repository-kernel && npm run smoke:integration-retained-session-state-store && npm run smoke:integration-retained-native-session-repository-state && npm run smoke:integration-retained-native-execution-evidence && npm run smoke:integration-retained-runtime-repository-surface && npm run smoke:integration-retained-runtime-repository-phase-b && npm run smoke:integration-runtime-repository-contract && npm run smoke:integration-runtime-authority && npm run smoke:localllm-provider && npm run smoke:localllm-model-tiers && npm run smoke:localllm-code-routing && npm run smoke:local-failure-recovery && npm run smoke:localllm-auto-max && npm run smoke:local-resource-policy && npm run smoke:context-budget-recovery && npm run smoke:session-runtime && npm run smoke:runtime-core && npm run smoke:progressive-tools && npm run smoke:truthful-completion && npm run smoke:document-artifact-quality && npm run smoke:writing-specialist-routing && npm run eval:local-first-agent && npm run eval:provider-attribution && npm run smoke:runtime-compat && npm run smoke:autoupdate && npm run smoke:web-api && npm run smoke:math-rendering && npm run smoke:web-ui && npm run smoke:web-autostart && npm run smoke:webapp-command && npm run smoke:web-port-fallback && npm run smoke:docker-command && npm run smoke:coding-tools && npm run smoke:dynamic-step-budget && npm run smoke:execution-policy && npm run smoke:aaps-adapter && npm run smoke:auxiliary-tools && npm run smoke:perception-research && npm run smoke:deep-research && npm run smoke:public-research && npm run smoke:safe-chat && npm run smoke:auth && npm run smoke:agentlink && npm run smoke:canvas-artifacts && npm run smoke:capabilities && npm run smoke:mcp && npm run smoke:model-roles && npm run smoke:platform && npm run smoke:permission-modes && npm run smoke:skills && npm run smoke:skillmesh && npm run smoke:supervision-ledger && npm run smoke:tmux-tools && npm run smoke:long-jobs && npm run smoke:run-stdin && npm run smoke:cli-chat && npm run smoke:inbox",
224
+ "test": "npm run check && npm run smoke:integration-production-mount && npm run smoke:integration-production-runtime-bundle && npm run smoke:integration-storage-authority && npm run smoke:integration-retained-durable-common && npm run smoke:integration-retained-file-lock && npm run smoke:integration-retained-event-ledger && npm run smoke:integration-retained-event-ledger-bundle && npm run smoke:integration-retained-repository-kernel && npm run smoke:integration-retained-session-state-store && npm run smoke:integration-retained-native-session-repository-state && npm run smoke:integration-retained-native-execution-evidence && npm run smoke:integration-retained-runtime-repository-surface && npm run smoke:integration-retained-runtime-repository-phase-b && npm run smoke:integration-runtime-repository-contract && npm run smoke:integration-runtime-authority && npm run smoke:localllm-provider && npm run smoke:localllm-model-tiers && npm run smoke:localllm-code-routing && npm run smoke:local-failure-recovery && npm run smoke:localllm-auto-max && npm run smoke:local-resource-policy && npm run smoke:context-budget-recovery && npm run smoke:session-runtime && npm run smoke:runtime-core && npm run smoke:progressive-tools && npm run smoke:truthful-completion && npm run smoke:document-artifact-quality && npm run smoke:writing-specialist-routing && npm run eval:local-first-agent && npm run eval:provider-attribution && npm run smoke:runtime-compat && npm run smoke:autoupdate && npm run smoke:web-api && npm run smoke:math-rendering && npm run smoke:web-ui && npm run smoke:web-autostart && npm run smoke:webapp-command && npm run smoke:web-port-fallback && npm run smoke:docker-command && npm run smoke:coding-tools && npm run smoke:dynamic-step-budget && npm run smoke:execution-policy && npm run smoke:aaps-adapter && npm run smoke:auxiliary-tools && npm run smoke:perception-research && npm run smoke:deep-research && npm run smoke:public-research && npm run smoke:safe-chat && npm run smoke:auth && npm run smoke:agentlink && npm run smoke:canvas-artifacts && npm run smoke:capabilities && npm run smoke:mcp && npm run smoke:model-roles && npm run smoke:platform && npm run smoke:permission-modes && npm run smoke:skills && npm run smoke:skillmesh && npm run smoke:supervision-ledger && npm run smoke:tmux-tools && npm run smoke:long-jobs && npm run smoke:run-stdin && npm run smoke:cli-chat && npm run smoke:inbox",
223
225
  "pack:dry-run": "npm pack --dry-run",
224
226
  "smoke:capabilities": "node scripts/smoke-capabilities.js"
225
227
  },
@@ -125,57 +125,94 @@ const sentPlan = capturedPayload.messages.map((message) => message.content || ""
125
125
  assert.ok(sentPlan.includes(HEAD), "plan request lost the exact task head");
126
126
  assert.ok(sentPlan.includes(TAIL), "plan request lost the latest task tail");
127
127
 
128
+ const compactionState = {
129
+ goal: hugeGoal,
130
+ plan: "Use the existing routine and verify its artifact.",
131
+ messages: [
132
+ { role: "system", content: "SYSTEM-HEAD\n" + "policy ".repeat(10000) + "\nSYSTEM-TAIL" },
133
+ { role: "user", content: "first request" },
134
+ {
135
+ role: "user",
136
+ content:
137
+ "The runtime proactively compacted a long agent history before the provider context became inefficient or unstable. OLD-COMPACTION-MUST-NOT-RECUR",
138
+ },
139
+ {
140
+ role: "assistant",
141
+ content: "",
142
+ tool_calls: [
143
+ {
144
+ id: "deep-research-complete",
145
+ type: "function",
146
+ function: {
147
+ name: "deep_research",
148
+ arguments: '{"query":"reliability evidence","outputPath":"reports/reliability.md"}',
149
+ },
150
+ },
151
+ ],
152
+ },
153
+ {
154
+ role: "tool",
155
+ tool_call_id: "deep-research-complete",
156
+ content: JSON.stringify({
157
+ ok: true,
158
+ toolName: "deep_research",
159
+ version: 14,
160
+ researchId: "reliability-evidence-v14",
161
+ status: "completed",
162
+ stage: "completed",
163
+ reportPath: "reports/reliability.md",
164
+ artifactPath: ".aginti/deep-research-reliability.json",
165
+ queryCount: 10,
166
+ sourceCount: 16,
167
+ coverage: { requiredFirstPartyVerified: true },
168
+ audit: { citationCoverage: 1 },
169
+ }),
170
+ },
171
+ {
172
+ role: "tool",
173
+ content: JSON.stringify({
174
+ ok: true,
175
+ toolName: "read_file",
176
+ path: "/evidence/Musia/SKILL.md",
177
+ bytes: 2048,
178
+ sha256: "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
179
+ contentTruncated: false,
180
+ content: [
181
+ "---",
182
+ "name: musia-music-production",
183
+ "description: Create and review songs through the established Musia production workflow.",
184
+ "---",
185
+ "# Musia Music Production",
186
+ "Use the existing CLI and preserve the reviewed song artifacts.",
187
+ ].join("\n"),
188
+ commandEvidence: [{ command: "node bin/musia.js doctor --json" }],
189
+ pathEvidence: [{ path: "bin/musia.js" }],
190
+ }),
191
+ },
192
+ {
193
+ role: "tool",
194
+ content: JSON.stringify({
195
+ ok: true,
196
+ toolName: "list_files",
197
+ path: "/evidence/LALACHAN/scripts",
198
+ entries: [{ path: "scripts/xyq_cdp_browser.py" }, { path: "scripts/wait_downloaded_mp4.sh" }],
199
+ }),
200
+ },
201
+ { role: "user", content: "latest interruption: send the finished PDF to this exact chat" },
202
+ ],
203
+ };
128
204
  const runtimeMessages = buildContextBudgetCompactionMessages(
129
- {
130
- goal: hugeGoal,
131
- plan: "Use the existing routine and verify its artifact.",
132
- messages: [
133
- { role: "system", content: "SYSTEM-HEAD\n" + "policy ".repeat(10000) + "\nSYSTEM-TAIL" },
134
- { role: "user", content: "first request" },
135
- {
136
- role: "user",
137
- content:
138
- "The runtime proactively compacted a long agent history before the provider context became inefficient or unstable. OLD-COMPACTION-MUST-NOT-RECUR",
139
- },
140
- {
141
- role: "tool",
142
- content: JSON.stringify({
143
- ok: true,
144
- toolName: "read_file",
145
- path: "/evidence/Musia/SKILL.md",
146
- bytes: 2048,
147
- sha256: "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
148
- contentTruncated: false,
149
- content: [
150
- "---",
151
- "name: musia-music-production",
152
- "description: Create and review songs through the established Musia production workflow.",
153
- "---",
154
- "# Musia Music Production",
155
- "Use the existing CLI and preserve the reviewed song artifacts.",
156
- ].join("\n"),
157
- commandEvidence: [{ command: "node bin/musia.js doctor --json" }],
158
- pathEvidence: [{ path: "bin/musia.js" }],
159
- }),
160
- },
161
- {
162
- role: "tool",
163
- content: JSON.stringify({
164
- ok: true,
165
- toolName: "list_files",
166
- path: "/evidence/LALACHAN/scripts",
167
- entries: [{ path: "scripts/xyq_cdp_browser.py" }, { path: "scripts/wait_downloaded_mp4.sh" }],
168
- }),
169
- },
170
- { role: "user", content: "latest interruption: send the finished PDF to this exact chat" },
171
- ],
172
- },
205
+ compactionState,
173
206
  config,
174
207
  { title: "", url: "" },
175
208
  3,
176
209
  { reason: "test context recovery" }
177
210
  );
178
211
  const runtimeText = runtimeMessages.map((message) => message.content || "").join("\n");
212
+ const retainedNativeDeepResearch = runtimeMessages.find((message) =>
213
+ Array.isArray(message.tool_calls) &&
214
+ message.tool_calls.some((call) => call?.function?.name === "deep_research")
215
+ );
179
216
  assert.ok(
180
217
  estimateMessageTokens(runtimeMessages) <= 12288,
181
218
  "runtime compaction exceeded the bounded LocalLLM retry target"
@@ -193,8 +230,27 @@ assert.ok(runtimeText.includes("sha256=1234567890abcdef"));
193
230
  assert.ok(runtimeText.includes("content=complete"));
194
231
  assert.ok(runtimeText.includes("node bin/musia.js doctor --json"));
195
232
  assert.ok(runtimeText.includes("scripts/xyq_cdp_browser.py"));
233
+ assert.ok(retainedNativeDeepResearch, "native compaction lost the completed deep_research call");
234
+ assert.ok(runtimeText.includes("reliability-evidence-v14"));
235
+ assert.ok(runtimeText.includes('"version":14'));
196
236
  assert.ok(!runtimeText.includes("OLD-COMPACTION-MUST-NOT-RECUR"));
197
237
  assert.match(runtimeText, /Do not reread a listed source solely because compaction occurred/);
198
238
  assert.match(runtimeText, /never restart a full-file read loop after compaction/);
199
239
 
240
+ const deepSeekRuntimeMessages = buildContextBudgetCompactionMessages(
241
+ compactionState,
242
+ { ...config, provider: "deepseek", model: "deepseek-chat" },
243
+ { title: "", url: "" },
244
+ 3,
245
+ { reason: "test DeepSeek context recovery" }
246
+ );
247
+ const deepSeekRuntimeText = deepSeekRuntimeMessages.map((message) => message.content || "").join("\n");
248
+ assert.ok(deepSeekRuntimeText.includes("Tool: deep_research"));
249
+ assert.ok(deepSeekRuntimeText.includes("reliability-evidence-v14"));
250
+ assert.ok(deepSeekRuntimeText.includes('"version":14'));
251
+ assert.ok(
252
+ estimateMessageTokens(deepSeekRuntimeMessages) <= 12288,
253
+ "DeepSeek runtime compaction exceeded the bounded retry target"
254
+ );
255
+
200
256
  console.log("context budget recovery smoke passed");
@@ -3,7 +3,7 @@ import fs from "node:fs/promises";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
5
 
6
- import { auditResearchSynthesis, deepResearch } from "../src/deep-research.js";
6
+ import { auditResearchSynthesis, deepResearch, RESEARCH_VERSION } from "../src/deep-research.js";
7
7
  import { checkToolUse } from "../src/guardrails.js";
8
8
  import { flushHousekeeping } from "../src/housekeeping.js";
9
9
  import { requestNextStep, toolChoiceForProvider } from "../src/model-client.js";
@@ -59,6 +59,50 @@ async function main() {
59
59
  !shouldStartWithDeepResearch(localEvidenceGoal),
60
60
  "local-source research incorrectly forced deep_research before workspace inspection"
61
61
  );
62
+ const inspectedLocalEvidenceMessages = [
63
+ { role: "user", content: localEvidenceGoal },
64
+ {
65
+ role: "assistant",
66
+ tool_calls: [{ id: "inspect-notes", function: { name: "read_file", arguments: '{"path":"PROJECT_NOTES.md"}' } }],
67
+ },
68
+ {
69
+ role: "assistant",
70
+ tool_calls: [{ id: "inspect-sources", function: { name: "read_file", arguments: '{"path":"sources.json"}' } }],
71
+ },
72
+ ];
73
+ assert(
74
+ shouldStartWithDeepResearch(localEvidenceGoal, inspectedLocalEvidenceMessages),
75
+ "local-source research did not enter bounded deep research after workspace inspection"
76
+ );
77
+ assert(
78
+ !shouldStartWithDeepResearch(localEvidenceGoal, [
79
+ ...inspectedLocalEvidenceMessages,
80
+ {
81
+ role: "assistant",
82
+ tool_calls: [{ id: "current-research", function: { name: "deep_research", arguments: "{}" } }],
83
+ },
84
+ ]),
85
+ "the current request repeated deep research after already requesting it"
86
+ );
87
+ assert(
88
+ shouldStartWithDeepResearch(localEvidenceGoal, [
89
+ ...inspectedLocalEvidenceMessages,
90
+ {
91
+ role: "assistant",
92
+ tool_calls: [{ id: "old-research", function: { name: "deep_research", arguments: "{}" } }],
93
+ },
94
+ { role: "user", content: "Refresh this evidence review because the current report quality is not acceptable." },
95
+ {
96
+ role: "assistant",
97
+ tool_calls: [{ id: "refresh-report", function: { name: "read_file", arguments: '{"path":"agent-reliability-evidence-review.md"}' } }],
98
+ },
99
+ {
100
+ role: "assistant",
101
+ tool_calls: [{ id: "refresh-sources", function: { name: "read_file", arguments: '{"path":"sources.json"}' } }],
102
+ },
103
+ ]),
104
+ "a completed research call from an older user intent suppressed a fresh bounded research pass"
105
+ );
62
106
  assert(
63
107
  shouldStartWithDeepResearch("Write a deep web research report comparing three primary papers."),
64
108
  "standalone deep research no longer starts with the bounded research workflow"
@@ -509,6 +553,7 @@ async function main() {
509
553
  },
510
554
  store
511
555
  );
556
+ assert(research.version === RESEARCH_VERSION, "deep research did not expose its result-schema version");
512
557
  assert(research.ok && research.sourceCount === 2, `deep research failed: ${research.error || "unknown"}`);
513
558
  assert(
514
559
  researchSearchProviders.length === 2 && researchSearchProviders.every((provider) => provider === "multi"),
@@ -4,6 +4,7 @@ import os from "node:os";
4
4
  import path from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { runAgent } from "../src/agent-runner.js";
7
+ import { RESEARCH_VERSION } from "../src/deep-research.js";
7
8
  import { resolveRuntimeConfig } from "../src/config.js";
8
9
  import { classifyCommand, evaluateCommandPolicy } from "../src/command-policy.js";
9
10
  import {
@@ -4338,6 +4339,7 @@ try {
4338
4339
  {
4339
4340
  ok: true,
4340
4341
  toolName: "deep_research",
4342
+ version: RESEARCH_VERSION,
4341
4343
  researchId: "research-one",
4342
4344
  status: "completed",
4343
4345
  reportPath: path.join(workspace, "report.md"),
@@ -4354,6 +4356,16 @@ try {
4354
4356
  reusedResearch?.duplicateSuppressed && reusedResearch.reportPath === path.join(workspace, "report.md"),
4355
4357
  "same-goal deep research did not reuse an already completed exact report"
4356
4358
  );
4359
+ completedResearchState.meta.completedDeepResearch[0].result.version = RESEARCH_VERSION - 1;
4360
+ assert(
4361
+ completedDeepResearchReuse(
4362
+ completedResearchState,
4363
+ { query: "A model-expanded query", outputPath: "report.md", refresh: true },
4364
+ { commandCwd: workspace }
4365
+ ) === null,
4366
+ "a stale deep-research engine result was reused after the report contract changed"
4367
+ );
4368
+ completedResearchState.meta.completedDeepResearch[0].result.version = RESEARCH_VERSION;
4357
4369
  completedResearchState.meta.goalContract = { revision: 2, currentHash: "goal-two" };
4358
4370
  assert(
4359
4371
  completedDeepResearchReuse(
@@ -547,6 +547,7 @@ async function verifyPackagedBinAndScriptClosure() {
547
547
  "scripts/eval-provider-attribution.js",
548
548
  "scripts/smoke-context-budget-recovery.js",
549
549
  "scripts/smoke-integration-production-mount.js",
550
+ "scripts/smoke-integration-production-runtime-bundle.js",
550
551
  ]) {
551
552
  assert.equal(packageJson.files.includes(requiredFile), true);
552
553
  }
@@ -1087,6 +1088,38 @@ async function main() {
1087
1088
  "INTEGRATION_CREDENTIAL_SOURCE_FORBIDDEN"
1088
1089
  );
1089
1090
 
1091
+ let cliCheckOutput = "";
1092
+ await withCanonicalCredentialFixture(async () => {
1093
+ const summary = await integrationCliMain(["check", "--config", configPath], {
1094
+ env: { CREDENTIALS_DIRECTORY: INTEGRATION_SYSTEMD_CREDENTIALS_DIRECTORY },
1095
+ stdout: { write(chunk) { cliCheckOutput += String(chunk); } },
1096
+ });
1097
+ assert.equal(summary.status, "checked-disabled");
1098
+ assert.equal(summary.capability?.enabled, false);
1099
+ assert.equal(summary.implementationReady, false);
1100
+ assert.equal(typeof summary.runtimeBundle?.healthy, "boolean");
1101
+ assert.equal(summary.runtimeBundle?.implementationReady, false);
1102
+ assert.equal(summary.runtimeBundle?.capabilityEnabled, false);
1103
+ assert.equal(summary.runtimeBundle?.httpServingEnabled, false);
1104
+ if (summary.runtimeBundle.healthy) {
1105
+ assert.equal(summary.runtimeBundle.firstBlocker?.component, "idempotencyStore");
1106
+ assert.equal(
1107
+ summary.runtimeBundle.firstBlocker?.code,
1108
+ "INTEGRATION_DESCRIPTOR_BOUND_IDEMPOTENCY_UNAVAILABLE"
1109
+ );
1110
+ } else {
1111
+ assert.equal(summary.runtimeBundle.firstBlocker?.component, "storageAuthority");
1112
+ assert.match(
1113
+ summary.runtimeBundle.firstBlocker?.code || "",
1114
+ /^INTEGRATION_STORAGE_/u
1115
+ );
1116
+ }
1117
+ assert.deepEqual(
1118
+ JSON.parse(cliCheckOutput.trim()),
1119
+ JSON.parse(JSON.stringify(summary))
1120
+ );
1121
+ });
1122
+
1090
1123
  const cliServePort = await unusedLoopbackPort();
1091
1124
  const cliServeConfigPath = path.join(tempRoot, "integration-serve.json");
1092
1125
  await fs.writeFile(