@lazyingart/agintiflow 0.20.306 → 0.20.307
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.
|
|
3
|
+
"version": "0.20.307",
|
|
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",
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "../src/agent-runner.js";
|
|
12
12
|
import { resolveRuntimeConfig } from "../src/config.js";
|
|
13
13
|
import { SessionStore } from "../src/session-store.js";
|
|
14
|
-
import { finishResultClaimsIncompleteWork } from "../src/scs-evidence.js";
|
|
14
|
+
import { deriveScsTaskContract, finishResultClaimsIncompleteWork } from "../src/scs-evidence.js";
|
|
15
15
|
|
|
16
16
|
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
17
17
|
const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "agintiflow-truthful-completion-"));
|
|
@@ -198,6 +198,9 @@ async function runCase({
|
|
|
198
198
|
id,
|
|
199
199
|
goal,
|
|
200
200
|
taskProfile = "auto",
|
|
201
|
+
provider = "openai",
|
|
202
|
+
model = "scripted-model",
|
|
203
|
+
routingMode = "manual",
|
|
201
204
|
responses,
|
|
202
205
|
allowShellTool = false,
|
|
203
206
|
allowFileTools = false,
|
|
@@ -205,6 +208,9 @@ async function runCase({
|
|
|
205
208
|
executionTier = "",
|
|
206
209
|
maxOutputTokens = undefined,
|
|
207
210
|
resume = false,
|
|
211
|
+
runtimePatch = undefined,
|
|
212
|
+
expectedRuntimeRevision = undefined,
|
|
213
|
+
providerReadinessMode = undefined,
|
|
208
214
|
setup = null,
|
|
209
215
|
scsActive = false,
|
|
210
216
|
}) {
|
|
@@ -215,11 +221,20 @@ async function runCase({
|
|
|
215
221
|
if (typeof setup === "function") await setup(workspace);
|
|
216
222
|
const calls = [];
|
|
217
223
|
const client = scriptedClient([...responses], calls);
|
|
224
|
+
const factoryConfigs = [];
|
|
225
|
+
const clientFactory = async (runtimeConfig = {}) => {
|
|
226
|
+
factoryConfigs.push({
|
|
227
|
+
provider: runtimeConfig.provider,
|
|
228
|
+
model: runtimeConfig.model,
|
|
229
|
+
});
|
|
230
|
+
return client;
|
|
231
|
+
};
|
|
232
|
+
clientFactory.agintiDeterministicTest = true;
|
|
218
233
|
const config = resolveRuntimeConfig(
|
|
219
234
|
{
|
|
220
|
-
provider
|
|
221
|
-
routingMode
|
|
222
|
-
model
|
|
235
|
+
provider,
|
|
236
|
+
routingMode,
|
|
237
|
+
model,
|
|
223
238
|
goal,
|
|
224
239
|
taskProfile,
|
|
225
240
|
executionTier,
|
|
@@ -236,9 +251,9 @@ async function runCase({
|
|
|
236
251
|
{
|
|
237
252
|
baseDir: workspace,
|
|
238
253
|
packageDir: repoRoot,
|
|
239
|
-
provider
|
|
240
|
-
routingMode
|
|
241
|
-
model
|
|
254
|
+
provider,
|
|
255
|
+
routingMode,
|
|
256
|
+
model,
|
|
242
257
|
executionTier,
|
|
243
258
|
sessionId: id,
|
|
244
259
|
resume: resume ? id : "",
|
|
@@ -255,13 +270,13 @@ async function runCase({
|
|
|
255
270
|
allowMcpTools: false,
|
|
256
271
|
allowParallelScouts: false,
|
|
257
272
|
enableScs: scsActive ? "auto" : "off",
|
|
258
|
-
clientFactory
|
|
273
|
+
clientFactory,
|
|
259
274
|
}
|
|
260
275
|
);
|
|
261
276
|
Object.assign(config, {
|
|
262
277
|
apiKey: "scripted-test-only",
|
|
263
278
|
resume: resume ? id : "",
|
|
264
|
-
clientFactory
|
|
279
|
+
clientFactory,
|
|
265
280
|
sessionsDir,
|
|
266
281
|
projectSessionsDir,
|
|
267
282
|
useDockerSandbox: false,
|
|
@@ -283,17 +298,51 @@ async function runCase({
|
|
|
283
298
|
: undefined,
|
|
284
299
|
modelTimeoutMs: 1_000,
|
|
285
300
|
...(executionTier ? { executionTier, executionPolicy: { tier: executionTier, requiresPlan: false, reason: "Scripted completion smoke." } } : {}),
|
|
301
|
+
...(providerReadinessMode ? { providerReadinessMode } : {}),
|
|
302
|
+
...(runtimePatch ? { runtimePatch } : {}),
|
|
303
|
+
...(expectedRuntimeRevision !== undefined ? { expectedRuntimeRevision } : {}),
|
|
286
304
|
});
|
|
287
305
|
const result = await runAgent(config);
|
|
288
306
|
const store = new SessionStore(sessionsDir, id, { projectRoot: workspace, commandCwd: workspace, projectSessionsDir });
|
|
289
307
|
return {
|
|
290
308
|
result,
|
|
291
309
|
calls,
|
|
310
|
+
factoryConfigs,
|
|
292
311
|
events: await store.loadEvents(),
|
|
293
312
|
state: await store.loadState(),
|
|
294
313
|
};
|
|
295
314
|
}
|
|
296
315
|
|
|
316
|
+
function providerRuntimePatch(provider, model) {
|
|
317
|
+
return {
|
|
318
|
+
provider,
|
|
319
|
+
model,
|
|
320
|
+
routingMode: "manual",
|
|
321
|
+
routeProvider: provider,
|
|
322
|
+
routeModel: model,
|
|
323
|
+
mainProvider: provider,
|
|
324
|
+
mainModel: model,
|
|
325
|
+
spareProvider: provider,
|
|
326
|
+
spareModel: model,
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function scopedTaskGoal(request, artifactRoot) {
|
|
331
|
+
return [
|
|
332
|
+
"User request:",
|
|
333
|
+
request,
|
|
334
|
+
"",
|
|
335
|
+
`AGINTI_EVIDENCE_SCOPE_JSON: ${JSON.stringify({
|
|
336
|
+
mode: "task",
|
|
337
|
+
request,
|
|
338
|
+
artifact_root: artifactRoot,
|
|
339
|
+
})}`,
|
|
340
|
+
"",
|
|
341
|
+
"Artifact contract:",
|
|
342
|
+
"- If no file is produced, use an empty artifacts list.",
|
|
343
|
+
].join("\n");
|
|
344
|
+
}
|
|
345
|
+
|
|
297
346
|
try {
|
|
298
347
|
const explanation = await runCase({
|
|
299
348
|
id: "ordinary-explanation",
|
|
@@ -410,6 +459,125 @@ try {
|
|
|
410
459
|
assert.equal(quotedChatClassification.result.result, '{"intent":"generation_only","publish":false}');
|
|
411
460
|
assert(!quotedChatClassification.events.some((event) => event.type === "completion.evidence_rejected"));
|
|
412
461
|
|
|
462
|
+
const providerSwitchSessionId = "provider-switch-resume-contract";
|
|
463
|
+
const providerSwitchFirstTurn = await runCase({
|
|
464
|
+
id: providerSwitchSessionId,
|
|
465
|
+
goal: "Create provider-switch-proof.md with the exact text provider switch proof.",
|
|
466
|
+
taskProfile: "auto",
|
|
467
|
+
provider: "localllm",
|
|
468
|
+
model: "localllm-fast",
|
|
469
|
+
providerReadinessMode: "deterministic-test",
|
|
470
|
+
allowFileTools: true,
|
|
471
|
+
responses: [
|
|
472
|
+
assistant("", [
|
|
473
|
+
toolCall("write-provider-switch-proof", "write_file", {
|
|
474
|
+
path: "provider-switch-proof.md",
|
|
475
|
+
mode: "create",
|
|
476
|
+
content: "provider switch proof\n",
|
|
477
|
+
}),
|
|
478
|
+
]),
|
|
479
|
+
assistant("", [
|
|
480
|
+
toolCall("finish-provider-switch-proof", "finish", {
|
|
481
|
+
result: "Created provider-switch-proof.md.",
|
|
482
|
+
}),
|
|
483
|
+
]),
|
|
484
|
+
],
|
|
485
|
+
});
|
|
486
|
+
assert.equal(providerSwitchFirstTurn.result.stopped, undefined);
|
|
487
|
+
assert.equal(providerSwitchFirstTurn.state.meta?.runtimeConfig?.provider, "localllm");
|
|
488
|
+
assert.equal(providerSwitchFirstTurn.state.meta?.runtimeConfig?.model, "localllm-fast");
|
|
489
|
+
|
|
490
|
+
const providerSwitchSecondTurn = await runCase({
|
|
491
|
+
id: providerSwitchSessionId,
|
|
492
|
+
goal: "Resume this exact session with the default provider and return exactly: DEEPSEEK_RESUME_OK",
|
|
493
|
+
taskProfile: "auto",
|
|
494
|
+
provider: "deepseek",
|
|
495
|
+
model: "deepseek-v4-flash",
|
|
496
|
+
resume: true,
|
|
497
|
+
runtimePatch: providerRuntimePatch("deepseek", "deepseek-v4-flash"),
|
|
498
|
+
expectedRuntimeRevision: providerSwitchFirstTurn.state.meta.runtimeConfig.revision,
|
|
499
|
+
responses: [
|
|
500
|
+
assistant("", [
|
|
501
|
+
toolCall("finish-provider-switch-deepseek", "finish", {
|
|
502
|
+
result: "DEEPSEEK_RESUME_OK",
|
|
503
|
+
}),
|
|
504
|
+
]),
|
|
505
|
+
],
|
|
506
|
+
});
|
|
507
|
+
assert.equal(providerSwitchSecondTurn.result.stopped, undefined);
|
|
508
|
+
assert.equal(providerSwitchSecondTurn.result.result, "DEEPSEEK_RESUME_OK");
|
|
509
|
+
assert.equal(providerSwitchSecondTurn.state.meta?.runtimeConfig?.provider, "deepseek");
|
|
510
|
+
assert.equal(providerSwitchSecondTurn.state.meta?.runtimeConfig?.model, "deepseek-v4-flash");
|
|
511
|
+
assert.equal(
|
|
512
|
+
providerSwitchSecondTurn.events.filter(
|
|
513
|
+
(event) => event.type === "session.runtime_resolved" && event.data?.provider === "deepseek"
|
|
514
|
+
).length,
|
|
515
|
+
1,
|
|
516
|
+
"explicit DeepSeek resume did not persist a provider switch"
|
|
517
|
+
);
|
|
518
|
+
|
|
519
|
+
const forcedLocalRequest =
|
|
520
|
+
"Resume this exact session and return exactly: LOCALLLM_FORCED_RESUME_OK Do not create or modify any file.";
|
|
521
|
+
const forcedLocalGoal = scopedTaskGoal(
|
|
522
|
+
forcedLocalRequest,
|
|
523
|
+
path.join(tempRoot, "artifacts", "provider-switch-resume-contract")
|
|
524
|
+
);
|
|
525
|
+
const forcedLocalContract = deriveScsTaskContract({ goal: forcedLocalGoal, taskProfile: "auto" });
|
|
526
|
+
assert.equal(
|
|
527
|
+
forcedLocalContract.requiresExternalEvidence,
|
|
528
|
+
false,
|
|
529
|
+
"a forbidden file-mutation clause made a pure response-only resume require external evidence"
|
|
530
|
+
);
|
|
531
|
+
assert.deepEqual(forcedLocalContract.requiredEvidence, []);
|
|
532
|
+
assert.deepEqual(forcedLocalContract.exactOutputPaths, []);
|
|
533
|
+
assert(
|
|
534
|
+
forcedLocalContract.forbiddenActions.some((item) => /create or modify any file/i.test(item)),
|
|
535
|
+
"forbidden file mutation was not retained as a guardrail"
|
|
536
|
+
);
|
|
537
|
+
|
|
538
|
+
const forcedLocalResume = await runCase({
|
|
539
|
+
id: providerSwitchSessionId,
|
|
540
|
+
goal: forcedLocalGoal,
|
|
541
|
+
taskProfile: "auto",
|
|
542
|
+
provider: "localllm",
|
|
543
|
+
model: "localllm-fast",
|
|
544
|
+
providerReadinessMode: "deterministic-test",
|
|
545
|
+
resume: true,
|
|
546
|
+
runtimePatch: providerRuntimePatch("localllm", "localllm-fast"),
|
|
547
|
+
expectedRuntimeRevision: providerSwitchSecondTurn.state.meta.runtimeConfig.revision,
|
|
548
|
+
responses: [
|
|
549
|
+
assistant("", [
|
|
550
|
+
toolCall("finish-provider-switch-localllm", "finish", {
|
|
551
|
+
result: "LOCALLLM_FORCED_RESUME_OK",
|
|
552
|
+
}),
|
|
553
|
+
]),
|
|
554
|
+
],
|
|
555
|
+
});
|
|
556
|
+
assert.equal(forcedLocalResume.result.stopped, undefined);
|
|
557
|
+
assert.equal(forcedLocalResume.result.result, "LOCALLLM_FORCED_RESUME_OK");
|
|
558
|
+
assert.equal(forcedLocalResume.calls.length, 1);
|
|
559
|
+
assert.deepEqual(forcedLocalResume.factoryConfigs, [{ provider: "localllm", model: "localllm-fast" }]);
|
|
560
|
+
assert.equal(forcedLocalResume.state.meta?.runtimeConfig?.provider, "localllm");
|
|
561
|
+
assert.equal(forcedLocalResume.state.meta?.runtimeConfig?.model, "localllm-fast");
|
|
562
|
+
assert.equal(
|
|
563
|
+
forcedLocalResume.events.filter(
|
|
564
|
+
(event) =>
|
|
565
|
+
event.type === "session.runtime_resolved" &&
|
|
566
|
+
event.data?.provider === "localllm" &&
|
|
567
|
+
event.data?.model === "localllm-fast"
|
|
568
|
+
).length,
|
|
569
|
+
1,
|
|
570
|
+
"explicit LocalLLM resume did not persist the forced provider/model switch"
|
|
571
|
+
);
|
|
572
|
+
assert(
|
|
573
|
+
!forcedLocalResume.events.some(
|
|
574
|
+
(event) =>
|
|
575
|
+
event.type === "completion.evidence_rejected" &&
|
|
576
|
+
/ledger is empty/i.test(String(event.data?.reason || ""))
|
|
577
|
+
),
|
|
578
|
+
"pure LocalLLM resume was rejected for missing external evidence"
|
|
579
|
+
);
|
|
580
|
+
|
|
413
581
|
const proseOnlyAction = await runCase({
|
|
414
582
|
id: "prose-only-action",
|
|
415
583
|
goal: "Run pwd and report the output.",
|
package/src/scs-evidence.js
CHANGED
|
@@ -2059,7 +2059,8 @@ export function deriveScsTaskContract({ goal = "", taskProfile = "", acceptanceC
|
|
|
2059
2059
|
if (requiredGitActions.length && !requirementCategories.includes("git")) {
|
|
2060
2060
|
requirementCategories.push("git");
|
|
2061
2061
|
}
|
|
2062
|
-
const requiresExternalEvidence =
|
|
2062
|
+
const requiresExternalEvidence =
|
|
2063
|
+
requirementCategories.length > 0 || requiredToolCalls.length > 0 || goalRequiresEvidence(positiveEvidenceGoal, taskProfile);
|
|
2063
2064
|
const requiredEvidence = requirementCategories.map((category) => ({
|
|
2064
2065
|
id: category,
|
|
2065
2066
|
category,
|