pi-fabric 0.92.37 → 0.92.39
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/dist/agents/completion-inbox.d.ts.map +1 -1
- package/dist/agents/transports/process-utils.d.ts.map +1 -1
- package/dist/capture/interceptor.d.ts.map +1 -1
- package/dist/chunks/{chunk-XL5NI6KH.js → chunk-45QTPCE7.js} +2 -2
- package/dist/chunks/{chunk-IZSVDLWG.js → chunk-5NZ4EZ47.js} +1 -1
- package/dist/chunks/{chunk-X7G62ZGH.js → chunk-7BG5COXB.js} +8 -3
- package/dist/chunks/{chunk-X7G62ZGH.js.map → chunk-7BG5COXB.js.map} +2 -2
- package/dist/chunks/{chunk-RDJDJJET.js → chunk-7VAZ4N43.js} +2 -2
- package/dist/chunks/{chunk-2NG7VFJZ.js → chunk-A3W4ERB3.js} +2 -2
- package/dist/chunks/chunk-A3W4ERB3.js.map +7 -0
- package/dist/chunks/{chunk-3ALJY5MG.js → chunk-JCI2ZIFR.js} +2 -2
- package/dist/chunks/{chunk-JJZFNBB7.js → chunk-MQG5QKGI.js} +2 -2
- package/dist/chunks/{chunk-NTKI5NUE.js → chunk-NPEPBSQP.js} +4 -4
- package/dist/chunks/{chunk-V6RU7BGE.js → chunk-OHJJTXMP.js} +2 -2
- package/dist/chunks/{chunk-2462VF6I.js → chunk-SZUXWOO7.js} +1 -1
- package/dist/chunks/chunk-SZUXWOO7.js.map +7 -0
- package/dist/chunks/{chunk-CIODQX77.js → chunk-WIC446CZ.js} +2 -2
- package/dist/chunks/{chunk-OPEOIVF6.js → chunk-XKRZHYH3.js} +2 -2
- package/dist/compaction/hook.js +2 -2
- package/dist/components/configuration.js +2 -2
- package/dist/core/shell-jobs.d.ts.map +1 -1
- package/dist/fabric-exec-tool.d.ts.map +1 -1
- package/dist/fabric-runtime-state.js +47 -44
- package/dist/fabric-runtime-state.js.map +2 -2
- package/dist/index.js +72 -17
- package/dist/index.js.map +3 -3
- package/dist/jev.js +1 -1
- package/dist/providers/jev-provider.js +1 -1
- package/dist/repeat-guard.d.ts +29 -0
- package/dist/repeat-guard.d.ts.map +1 -0
- package/dist/residency/host.js +7 -7
- package/dist/residency/pi-entry.js +7 -7
- package/dist/runtime/monty-runtime.js +1 -1
- package/dist/runtime/node-process-runtime.js +2 -2
- package/dist/runtime/typescript-kernel.js +2 -2
- package/dist/ui/dashboard.js +2 -2
- package/dist/ui/fabric-code-parser.d.ts.map +1 -1
- package/dist/ui/settings.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-2462VF6I.js.map +0 -7
- package/dist/chunks/chunk-2NG7VFJZ.js.map +0 -7
- /package/dist/chunks/{chunk-XL5NI6KH.js.map → chunk-45QTPCE7.js.map} +0 -0
- /package/dist/chunks/{chunk-IZSVDLWG.js.map → chunk-5NZ4EZ47.js.map} +0 -0
- /package/dist/chunks/{chunk-RDJDJJET.js.map → chunk-7VAZ4N43.js.map} +0 -0
- /package/dist/chunks/{chunk-3ALJY5MG.js.map → chunk-JCI2ZIFR.js.map} +0 -0
- /package/dist/chunks/{chunk-JJZFNBB7.js.map → chunk-MQG5QKGI.js.map} +0 -0
- /package/dist/chunks/{chunk-NTKI5NUE.js.map → chunk-NPEPBSQP.js.map} +0 -0
- /package/dist/chunks/{chunk-V6RU7BGE.js.map → chunk-OHJJTXMP.js.map} +0 -0
- /package/dist/chunks/{chunk-CIODQX77.js.map → chunk-WIC446CZ.js.map} +0 -0
- /package/dist/chunks/{chunk-OPEOIVF6.js.map → chunk-XKRZHYH3.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
singleCallProgressLine,
|
|
32
32
|
spinnerFrame,
|
|
33
33
|
updateSpinner
|
|
34
|
-
} from "./chunks/chunk-
|
|
34
|
+
} from "./chunks/chunk-7VAZ4N43.js";
|
|
35
35
|
import {
|
|
36
36
|
configureHighlighting,
|
|
37
37
|
highlightCode,
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
restoreBorrowedInPlaceMain,
|
|
72
72
|
settleInPlacePrewalk,
|
|
73
73
|
withTrajectoryRearmDirective
|
|
74
|
-
} from "./chunks/chunk-
|
|
74
|
+
} from "./chunks/chunk-45QTPCE7.js";
|
|
75
75
|
import {
|
|
76
76
|
AgentTranscriptReader,
|
|
77
77
|
countNewlines,
|
|
@@ -202,7 +202,7 @@ import {
|
|
|
202
202
|
import {
|
|
203
203
|
awaitPeerSettle,
|
|
204
204
|
buildPeerCards
|
|
205
|
-
} from "./chunks/chunk-
|
|
205
|
+
} from "./chunks/chunk-XKRZHYH3.js";
|
|
206
206
|
import {
|
|
207
207
|
resolveAgentDir
|
|
208
208
|
} from "./chunks/chunk-PXAICAUT.js";
|
|
@@ -213,7 +213,7 @@ import {
|
|
|
213
213
|
loadFabricConfig,
|
|
214
214
|
loadFabricConfigForScope,
|
|
215
215
|
saveFabricConfig
|
|
216
|
-
} from "./chunks/chunk-
|
|
216
|
+
} from "./chunks/chunk-A3W4ERB3.js";
|
|
217
217
|
import {
|
|
218
218
|
defaultCodePreviewSettings
|
|
219
219
|
} from "./chunks/chunk-OKOHRXGF.js";
|
|
@@ -226,10 +226,10 @@ import {
|
|
|
226
226
|
fabricExecTitleHintCached,
|
|
227
227
|
normalizeRunDisplay,
|
|
228
228
|
registerCompactionHook
|
|
229
|
-
} from "./chunks/chunk-
|
|
229
|
+
} from "./chunks/chunk-MQG5QKGI.js";
|
|
230
230
|
import {
|
|
231
231
|
fabricWriteBindings
|
|
232
|
-
} from "./chunks/chunk-
|
|
232
|
+
} from "./chunks/chunk-SZUXWOO7.js";
|
|
233
233
|
import "./chunks/chunk-KAD7UWT2.js";
|
|
234
234
|
import "./chunks/chunk-ZDNGXLEC.js";
|
|
235
235
|
import {
|
|
@@ -568,6 +568,7 @@ var registerFabricActorHostEventObservers = (pi, observer) => {
|
|
|
568
568
|
|
|
569
569
|
// src/capture/interceptor.ts
|
|
570
570
|
import { existsSync, readdirSync, readFileSync, realpathSync } from "node:fs";
|
|
571
|
+
import { createRequire } from "node:module";
|
|
571
572
|
import path from "node:path";
|
|
572
573
|
import { pathToFileURL } from "node:url";
|
|
573
574
|
var HUB_SYMBOL = Symbol.for("pi-fabric.registered-tool-capture.v1");
|
|
@@ -632,21 +633,15 @@ var captureHub = (Runner) => {
|
|
|
632
633
|
};
|
|
633
634
|
return hub;
|
|
634
635
|
};
|
|
635
|
-
var
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
let directory;
|
|
639
|
-
try {
|
|
640
|
-
directory = path.dirname(realpathSync(cliPath));
|
|
641
|
-
} catch {
|
|
642
|
-
return void 0;
|
|
643
|
-
}
|
|
636
|
+
var PI_PACKAGE_NAME = "@earendil-works/pi-coding-agent";
|
|
637
|
+
var piPackageRootAbove = (startDirectory) => {
|
|
638
|
+
let directory = startDirectory;
|
|
644
639
|
while (directory !== path.dirname(directory)) {
|
|
645
640
|
const manifestPath = path.join(directory, "package.json");
|
|
646
641
|
if (existsSync(manifestPath)) {
|
|
647
642
|
try {
|
|
648
643
|
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
649
|
-
if (manifest.name ===
|
|
644
|
+
if (manifest.name === PI_PACKAGE_NAME) return directory;
|
|
650
645
|
} catch {
|
|
651
646
|
}
|
|
652
647
|
}
|
|
@@ -654,10 +649,40 @@ var hostPackageRoot = () => {
|
|
|
654
649
|
}
|
|
655
650
|
return void 0;
|
|
656
651
|
};
|
|
652
|
+
var hostPackageRoot = () => {
|
|
653
|
+
const cliPath = process.argv[1];
|
|
654
|
+
if (!cliPath) return void 0;
|
|
655
|
+
try {
|
|
656
|
+
return piPackageRootAbove(path.dirname(realpathSync(cliPath)));
|
|
657
|
+
} catch {
|
|
658
|
+
return void 0;
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
var entryRealmPackageRoot = () => {
|
|
662
|
+
const cliPath = process.argv[1];
|
|
663
|
+
if (!cliPath) return void 0;
|
|
664
|
+
let entryDirectory;
|
|
665
|
+
try {
|
|
666
|
+
entryDirectory = path.dirname(realpathSync(cliPath));
|
|
667
|
+
} catch {
|
|
668
|
+
return void 0;
|
|
669
|
+
}
|
|
670
|
+
const searchPaths = createRequire(path.join(entryDirectory, "probe.js")).resolve.paths(PI_PACKAGE_NAME);
|
|
671
|
+
for (const searchPath of searchPaths ?? []) {
|
|
672
|
+
const manifestPath = path.join(searchPath, PI_PACKAGE_NAME, "package.json");
|
|
673
|
+
if (!existsSync(manifestPath)) continue;
|
|
674
|
+
try {
|
|
675
|
+
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
676
|
+
if (manifest.name === PI_PACKAGE_NAME) return path.join(searchPath, PI_PACKAGE_NAME);
|
|
677
|
+
} catch {
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
return void 0;
|
|
681
|
+
};
|
|
657
682
|
var extensionRunnerConstructors = async () => {
|
|
658
683
|
const constructors = /* @__PURE__ */ new Set();
|
|
659
684
|
const packageRoots = new Set(
|
|
660
|
-
[process.env.PI_PACKAGE_DIR, hostPackageRoot()].filter(
|
|
685
|
+
[process.env.PI_PACKAGE_DIR, hostPackageRoot(), entryRealmPackageRoot()].filter(
|
|
661
686
|
(root) => typeof root === "string" && Boolean(root)
|
|
662
687
|
)
|
|
663
688
|
);
|
|
@@ -2403,6 +2428,25 @@ var prepareFabricExecArguments = (input, kernel = "typescript") => {
|
|
|
2403
2428
|
return prepared;
|
|
2404
2429
|
};
|
|
2405
2430
|
|
|
2431
|
+
// src/repeat-guard.ts
|
|
2432
|
+
var FABRIC_REPEAT_WARN = 3;
|
|
2433
|
+
var FABRIC_REPEAT_BLOCK = 6;
|
|
2434
|
+
var fabricRepeatWarnText = (count, blockAt) => `[circuit-breaker] identical fabric_exec code has now run ${count} times in a row; at ${blockAt} identical runs will be blocked. Change the approach or finish your turn.`;
|
|
2435
|
+
var fabricRepeatBlockText = (count) => `Circuit breaker: this exact fabric_exec code has now executed ${count} times in a row and was blocked. Re-running identical code adds no information. Summarize what you already know and finish your turn; if the call is genuinely required, change the code materially.`;
|
|
2436
|
+
var FabricRepeatGuard = class {
|
|
2437
|
+
constructor(warnAt, blockAt) {
|
|
2438
|
+
this.warnAt = warnAt;
|
|
2439
|
+
this.blockAt = blockAt;
|
|
2440
|
+
}
|
|
2441
|
+
#code;
|
|
2442
|
+
#count = 0;
|
|
2443
|
+
observe(code) {
|
|
2444
|
+
this.#count = code === this.#code ? this.#count + 1 : 1;
|
|
2445
|
+
this.#code = code;
|
|
2446
|
+
return { count: this.#count, blocked: this.#count >= this.blockAt, warn: this.#count >= this.warnAt };
|
|
2447
|
+
}
|
|
2448
|
+
};
|
|
2449
|
+
|
|
2406
2450
|
// src/runtime/core-tool-properties.ts
|
|
2407
2451
|
var CORE_TOOL_NAMES = Object.keys(
|
|
2408
2452
|
PI_CORE_COMPATIBILITY_ARGUMENT_TYPE_NAMES
|
|
@@ -2714,6 +2758,7 @@ var countLabel = (count, singular) => `${count} ${count === 1 ? singular : `${si
|
|
|
2714
2758
|
var createFabricExecTool = (state, codePreviewSettings, pendingHandoffs, decorateShell = withCodePreviewShell, toolDisplay) => {
|
|
2715
2759
|
const python = toolKernel(state) === "python";
|
|
2716
2760
|
const monty = python && state.config.executor.pythonRuntime === "monty";
|
|
2761
|
+
const repeatGuard = new FabricRepeatGuard(FABRIC_REPEAT_WARN, FABRIC_REPEAT_BLOCK);
|
|
2717
2762
|
return decorateShell(
|
|
2718
2763
|
defineTool({
|
|
2719
2764
|
name: "fabric_exec",
|
|
@@ -3292,6 +3337,14 @@ ${preview}` : ""}${hiddenHint}`,
|
|
|
3292
3337
|
await state.ensure(context);
|
|
3293
3338
|
const joined = Array.isArray(params.code) ? params.code.join("\n") : params.code;
|
|
3294
3339
|
const code = state.config.executor.kernel === "python" ? joined : repairFabricGuestCode(joined);
|
|
3340
|
+
const repeat = repeatGuard.observe(code);
|
|
3341
|
+
if (repeat.blocked) {
|
|
3342
|
+
return {
|
|
3343
|
+
content: [{ type: "text", text: fabricRepeatBlockText(repeat.count) }],
|
|
3344
|
+
isError: true,
|
|
3345
|
+
details: void 0
|
|
3346
|
+
};
|
|
3347
|
+
}
|
|
3295
3348
|
const runDisplay = normalizeRunDisplay(params.display);
|
|
3296
3349
|
const strings = resolveFabricExecPayloads(params);
|
|
3297
3350
|
const tokenBudget = "tokenBudget" in params && typeof params.tokenBudget === "number" ? params.tokenBudget : void 0;
|
|
@@ -3341,6 +3394,7 @@ ${preview}` : ""}${hiddenHint}`,
|
|
|
3341
3394
|
if (fullFormattedValue.text) fullSections.push(fullFormattedValue.text);
|
|
3342
3395
|
if (result.error) fullSections.push(`Runtime error: ${result.error}`);
|
|
3343
3396
|
if (failureProgress) fullSections.push(failureProgress);
|
|
3397
|
+
if (repeat.warn) fullSections.push(fabricRepeatWarnText(repeat.count, FABRIC_REPEAT_BLOCK));
|
|
3344
3398
|
const fullRawOutput = fullSections.join("\n\n");
|
|
3345
3399
|
const outputBudget = modelOutputBudget(
|
|
3346
3400
|
state.config.executor.maxOutputChars,
|
|
@@ -3357,6 +3411,7 @@ ${preview}` : ""}${hiddenHint}`,
|
|
|
3357
3411
|
if (formattedValue.text) sections.push(formattedValue.text);
|
|
3358
3412
|
if (result.error) sections.push(`Runtime error: ${result.error}`);
|
|
3359
3413
|
if (failureProgress) sections.push(failureProgress);
|
|
3414
|
+
if (repeat.warn) sections.push(fabricRepeatWarnText(repeat.count, FABRIC_REPEAT_BLOCK));
|
|
3360
3415
|
const rawOutput = sections.join("\n\n");
|
|
3361
3416
|
const outputFormat = formattedValue.language && formattedValue.text && (result.logs.length === 0 || !outputWillTruncate) ? formattedValue.language : void 0;
|
|
3362
3417
|
const outputFormatStartLine = result.logs.length > 0 ? countNewlines(logPrefix) + 2 : 0;
|