pi-fabric 0.121.0 → 0.122.0
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/chunks/{chunk-WQFX6UWE.js → chunk-264TBT7A.js} +147 -30
- package/dist/chunks/chunk-264TBT7A.js.map +7 -0
- package/dist/chunks/{chunk-TBQPVF4K.js → chunk-3DXRQK44.js} +2 -2
- package/dist/chunks/{chunk-DJ4NEGPD.js → chunk-JG237YLN.js} +2 -2
- package/dist/chunks/{chunk-UEMGVZCB.js → chunk-S3IHVG32.js} +3 -1
- package/dist/chunks/chunk-S3IHVG32.js.map +7 -0
- package/dist/chunks/{chunk-XPRIFPNG.js → chunk-UVX4OOXH.js} +5 -5
- package/dist/commands/fabric-handler.js +1 -1
- package/dist/components/configuration.js +2 -2
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/extension-bootstrap.js +3 -2
- package/dist/extension-bootstrap.js.map +1 -1
- package/dist/fabric-exec-tool.d.ts.map +1 -1
- package/dist/fabric-runtime-state.js +6 -6
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/residency/host.js +4 -4
- package/dist/residency/pi-entry.js +4 -4
- package/dist/runtime/monty-runtime.js +1 -1
- package/dist/ui/pi-terminal-title.d.ts +18 -0
- package/dist/ui/pi-terminal-title.d.ts.map +1 -0
- package/dist/ui/settings-sections-presentation.d.ts.map +1 -1
- package/dist/ui/settings.js +10 -1
- package/dist/ui/settings.js.map +2 -2
- package/dist/ui/terminal-title.d.ts +39 -0
- package/dist/ui/terminal-title.d.ts.map +1 -0
- package/docs/configuration.md +2 -0
- package/docs/interface.md +4 -0
- package/package.json +1 -1
- package/dist/chunks/chunk-UEMGVZCB.js.map +0 -7
- package/dist/chunks/chunk-WQFX6UWE.js.map +0 -7
- /package/dist/chunks/{chunk-TBQPVF4K.js.map → chunk-3DXRQK44.js.map} +0 -0
- /package/dist/chunks/{chunk-DJ4NEGPD.js.map → chunk-JG237YLN.js.map} +0 -0
- /package/dist/chunks/{chunk-XPRIFPNG.js.map → chunk-UVX4OOXH.js.map} +0 -0
|
@@ -31,7 +31,8 @@ import {
|
|
|
31
31
|
import {
|
|
32
32
|
configureHighlighting,
|
|
33
33
|
highlightCode,
|
|
34
|
-
observePiTheme
|
|
34
|
+
observePiTheme,
|
|
35
|
+
observedThemeVariant
|
|
35
36
|
} from "./chunk-QNMQJNXE.js";
|
|
36
37
|
import {
|
|
37
38
|
activeStatuses,
|
|
@@ -114,6 +115,9 @@ import {
|
|
|
114
115
|
closeScratch,
|
|
115
116
|
createScratch
|
|
116
117
|
} from "./chunk-NUU6IUJU.js";
|
|
118
|
+
import {
|
|
119
|
+
hostSdkEntry
|
|
120
|
+
} from "./chunk-WJJXODAB.js";
|
|
117
121
|
import {
|
|
118
122
|
resolveAgentDir
|
|
119
123
|
} from "./chunk-PBDDXBHY.js";
|
|
@@ -125,7 +129,7 @@ import {
|
|
|
125
129
|
loadFabricConfig,
|
|
126
130
|
loadFabricConfigForScope,
|
|
127
131
|
resolveForegroundTools
|
|
128
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-S3IHVG32.js";
|
|
129
133
|
import {
|
|
130
134
|
defaultCodePreviewSettings
|
|
131
135
|
} from "./chunk-OKOHRXGF.js";
|
|
@@ -1621,6 +1625,110 @@ var FabricDirectToolApproval = class {
|
|
|
1621
1625
|
|
|
1622
1626
|
// src/fabric-exec-tool.ts
|
|
1623
1627
|
import { Container as Container2, Text as Text2 } from "@earendil-works/pi-tui";
|
|
1628
|
+
|
|
1629
|
+
// src/ui/pi-terminal-title.ts
|
|
1630
|
+
import fs from "node:fs";
|
|
1631
|
+
import path4 from "node:path";
|
|
1632
|
+
var DEFAULT_APP_TITLE = "\u03C0";
|
|
1633
|
+
var readHostManifest = (sdkEntry) => {
|
|
1634
|
+
let directory = path4.dirname(sdkEntry);
|
|
1635
|
+
for (let depth = 0; depth < 4; depth += 1) {
|
|
1636
|
+
const file = path4.join(directory, "package.json");
|
|
1637
|
+
if (fs.existsSync(file)) return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
1638
|
+
directory = path4.dirname(directory);
|
|
1639
|
+
}
|
|
1640
|
+
return void 0;
|
|
1641
|
+
};
|
|
1642
|
+
var piAppTitle = (sdkEntry = hostSdkEntry()) => {
|
|
1643
|
+
if (!sdkEntry) return DEFAULT_APP_TITLE;
|
|
1644
|
+
try {
|
|
1645
|
+
const manifest = readHostManifest(sdkEntry);
|
|
1646
|
+
const name = manifest?.piConfig?.name;
|
|
1647
|
+
return typeof name === "string" && name.trim() ? name.trim() : DEFAULT_APP_TITLE;
|
|
1648
|
+
} catch {
|
|
1649
|
+
return DEFAULT_APP_TITLE;
|
|
1650
|
+
}
|
|
1651
|
+
};
|
|
1652
|
+
var piTerminalTitle = (context) => {
|
|
1653
|
+
const directory = path4.basename(context.cwd) || context.cwd;
|
|
1654
|
+
let name;
|
|
1655
|
+
try {
|
|
1656
|
+
name = context.sessionManager.getSessionName()?.trim();
|
|
1657
|
+
} catch {
|
|
1658
|
+
name = void 0;
|
|
1659
|
+
}
|
|
1660
|
+
return name ? `${piAppTitle()} - ${name} - ${directory}` : `${piAppTitle()} - ${directory}`;
|
|
1661
|
+
};
|
|
1662
|
+
|
|
1663
|
+
// src/ui/terminal-title.ts
|
|
1664
|
+
var MAX_TERMINAL_TITLE_CHARS = 120;
|
|
1665
|
+
var terminalTitleText = (value) => {
|
|
1666
|
+
const text = safeText(value);
|
|
1667
|
+
if (text.length <= MAX_TERMINAL_TITLE_CHARS) return text;
|
|
1668
|
+
return `${Array.from(text).slice(0, MAX_TERMINAL_TITLE_CHARS - 1).join("").trimEnd()}\u2026`;
|
|
1669
|
+
};
|
|
1670
|
+
var plainTitleTheme = () => ({
|
|
1671
|
+
name: observedThemeVariant(),
|
|
1672
|
+
fg: (_color, text) => text,
|
|
1673
|
+
bold: (text) => text
|
|
1674
|
+
});
|
|
1675
|
+
var terminalCallTitle = (audit, core) => terminalTitleText(nestedCallTitle(
|
|
1676
|
+
audit,
|
|
1677
|
+
plainTitleTheme(),
|
|
1678
|
+
void 0,
|
|
1679
|
+
// A window title that counted seconds would flicker; the card keeps timing.
|
|
1680
|
+
core ? { cwd: core.cwd, settings: { ...core.settings, toolCallTiming: false } } : void 0
|
|
1681
|
+
));
|
|
1682
|
+
var liveRuns = /* @__PURE__ */ new Set();
|
|
1683
|
+
var applyTitle = (setTitle, text) => {
|
|
1684
|
+
try {
|
|
1685
|
+
setTitle(text);
|
|
1686
|
+
} catch {
|
|
1687
|
+
}
|
|
1688
|
+
};
|
|
1689
|
+
var withTerminalTitle = async (title, intent, body) => {
|
|
1690
|
+
title?.show(intent);
|
|
1691
|
+
try {
|
|
1692
|
+
return await body();
|
|
1693
|
+
} finally {
|
|
1694
|
+
await title?.restore();
|
|
1695
|
+
}
|
|
1696
|
+
};
|
|
1697
|
+
var FabricTerminalTitle = class {
|
|
1698
|
+
#setTitle;
|
|
1699
|
+
#base;
|
|
1700
|
+
#applied;
|
|
1701
|
+
#settled = false;
|
|
1702
|
+
constructor(options = {}) {
|
|
1703
|
+
this.#setTitle = options.setTitle;
|
|
1704
|
+
this.#base = options.base;
|
|
1705
|
+
}
|
|
1706
|
+
/** Show the latest nested call's display title, coalescing repeats. */
|
|
1707
|
+
show(title) {
|
|
1708
|
+
const setTitle = this.#setTitle;
|
|
1709
|
+
if (!setTitle || this.#settled) return;
|
|
1710
|
+
const text = terminalTitleText(title);
|
|
1711
|
+
if (!text || text === this.#applied) return;
|
|
1712
|
+
this.#applied = text;
|
|
1713
|
+
liveRuns.add(this);
|
|
1714
|
+
applyTitle(setTitle, text);
|
|
1715
|
+
}
|
|
1716
|
+
/** Hand the window title back to Pi once this run has stopped. */
|
|
1717
|
+
async restore() {
|
|
1718
|
+
if (this.#settled) return;
|
|
1719
|
+
this.#settled = true;
|
|
1720
|
+
if (this.#applied === void 0) return;
|
|
1721
|
+
liveRuns.delete(this);
|
|
1722
|
+
if (liveRuns.size > 0) return;
|
|
1723
|
+
const setTitle = this.#setTitle;
|
|
1724
|
+
const base = await this.#base?.();
|
|
1725
|
+
if (!setTitle || liveRuns.size > 0) return;
|
|
1726
|
+
const text = terminalTitleText(base);
|
|
1727
|
+
if (text) applyTitle(setTitle, text);
|
|
1728
|
+
}
|
|
1729
|
+
};
|
|
1730
|
+
|
|
1731
|
+
// src/fabric-exec-tool.ts
|
|
1624
1732
|
import { Type } from "typebox";
|
|
1625
1733
|
|
|
1626
1734
|
// src/failure-progress.ts
|
|
@@ -1638,8 +1746,8 @@ var formatFailureProgress = (trace) => {
|
|
|
1638
1746
|
);
|
|
1639
1747
|
if (completed.length === 0) return void 0;
|
|
1640
1748
|
const summaries = completed.slice(0, MAX_COMPLETED_CALLS).map((operation) => {
|
|
1641
|
-
const
|
|
1642
|
-
return typeof
|
|
1749
|
+
const path10 = operation.args.path;
|
|
1750
|
+
return typeof path10 === "string" ? `${operation.ref}(${compactPath(path10)})` : operation.ref;
|
|
1643
1751
|
});
|
|
1644
1752
|
const omitted = completed.length - summaries.length;
|
|
1645
1753
|
return [
|
|
@@ -1850,19 +1958,19 @@ var PartialResultObserver = class {
|
|
|
1850
1958
|
};
|
|
1851
1959
|
|
|
1852
1960
|
// src/output-budget.ts
|
|
1853
|
-
import
|
|
1854
|
-
import
|
|
1961
|
+
import fs2 from "node:fs/promises";
|
|
1962
|
+
import path5 from "node:path";
|
|
1855
1963
|
var MAX_FAILURE_MODEL_OUTPUT_CHARS = 2e4;
|
|
1856
1964
|
var modelOutputBudget = (configuredMaxChars, success) => success ? configuredMaxChars : Math.min(configuredMaxChars, MAX_FAILURE_MODEL_OUTPUT_CHARS);
|
|
1857
1965
|
var writeOutputArtifact = async (content) => {
|
|
1858
1966
|
const directory = createScratch("output");
|
|
1859
1967
|
try {
|
|
1860
|
-
const artifactPath =
|
|
1861
|
-
await
|
|
1968
|
+
const artifactPath = path5.join(directory, "output.txt");
|
|
1969
|
+
await fs2.writeFile(artifactPath, content, { encoding: "utf8", mode: 384, flag: "wx" });
|
|
1862
1970
|
closeScratch(directory);
|
|
1863
1971
|
return artifactPath;
|
|
1864
1972
|
} catch (error) {
|
|
1865
|
-
await
|
|
1973
|
+
await fs2.rm(directory, { recursive: true, force: true }).catch(() => void 0);
|
|
1866
1974
|
throw error;
|
|
1867
1975
|
}
|
|
1868
1976
|
};
|
|
@@ -2520,7 +2628,12 @@ ${preview}` : ""}${hiddenHint}`,
|
|
|
2520
2628
|
}
|
|
2521
2629
|
const runDisplay = normalizeRunDisplay(params.display);
|
|
2522
2630
|
const tokenBudget = "tokenBudget" in params && typeof params.tokenBudget === "number" ? params.tokenBudget : void 0;
|
|
2523
|
-
const
|
|
2631
|
+
const intentTitle = runDisplay?.name?.trim() || fabricExecTitleHintCached(code, python ? "python" : "typescript") || (python ? "Python program" : "Fabric");
|
|
2632
|
+
const liveTitle = state.config.ui.enabled && state.config.ui.terminalTitle && context.mode === "tui" && context.hasUI ? new FabricTerminalTitle({
|
|
2633
|
+
setTitle: (title) => context.ui.setTitle(title),
|
|
2634
|
+
base: () => piTerminalTitle(context)
|
|
2635
|
+
}) : void 0;
|
|
2636
|
+
const result = await withTerminalTitle(liveTitle, intentTitle, () => state.execution.execute({
|
|
2524
2637
|
code,
|
|
2525
2638
|
...strings ? { strings } : {},
|
|
2526
2639
|
signal,
|
|
@@ -2537,6 +2650,10 @@ ${preview}` : ""}${hiddenHint}`,
|
|
|
2537
2650
|
}
|
|
2538
2651
|
} : {},
|
|
2539
2652
|
onPartial(snapshot) {
|
|
2653
|
+
const latest = snapshot.audits.at(-1);
|
|
2654
|
+
liveTitle?.show(
|
|
2655
|
+
latest ? terminalCallTitle(latest, { cwd: context.cwd, settings: codePreviewSettings }) : intentTitle
|
|
2656
|
+
);
|
|
2540
2657
|
onUpdate?.({
|
|
2541
2658
|
content: [{ type: "text", text: snapshot.progress ?? "" }],
|
|
2542
2659
|
details: {
|
|
@@ -2546,7 +2663,7 @@ ${preview}` : ""}${hiddenHint}`,
|
|
|
2546
2663
|
}
|
|
2547
2664
|
});
|
|
2548
2665
|
}
|
|
2549
|
-
});
|
|
2666
|
+
}));
|
|
2550
2667
|
const selectedResultFormat = params.resultFormat ?? state.config.executor.resultFormat;
|
|
2551
2668
|
const boundarySessionId = context.sessionManager.getSessionId();
|
|
2552
2669
|
const pendingHandoff = await state.claimHandoff(
|
|
@@ -2673,8 +2790,8 @@ ${recoveryHint}` : ""}`,
|
|
|
2673
2790
|
};
|
|
2674
2791
|
|
|
2675
2792
|
// src/fabric-state.ts
|
|
2676
|
-
import
|
|
2677
|
-
import
|
|
2793
|
+
import fs3 from "node:fs";
|
|
2794
|
+
import path6 from "node:path";
|
|
2678
2795
|
|
|
2679
2796
|
// src/managed-host.ts
|
|
2680
2797
|
var REPLACEABLE = /* @__PURE__ */ new Set(["agents", "memory", "compact", "schema", "state", "mesh", "mcp"]);
|
|
@@ -2934,15 +3051,15 @@ var FabricState = class {
|
|
|
2934
3051
|
const sessionId = context.sessionManager.getSessionId();
|
|
2935
3052
|
if (resolveFabricIdentity(sessionId).identity.kind !== "main") return false;
|
|
2936
3053
|
const projectRoot = process.env.PI_FABRIC_PROJECT_ROOT ?? context.cwd;
|
|
2937
|
-
const meshRoot = process.env.PI_FABRIC_MESH_ROOT ?? (this.config.mesh.root ?
|
|
3054
|
+
const meshRoot = process.env.PI_FABRIC_MESH_ROOT ?? (this.config.mesh.root ? path6.resolve(projectRoot, this.config.mesh.root) : path6.join(projectRoot, ".pi", "fabric", "mesh"));
|
|
2938
3055
|
const fabricSessionId = process.env.PI_FABRIC_SESSION_ID?.trim() || sessionId;
|
|
2939
3056
|
const actorRoots = [
|
|
2940
|
-
|
|
2941
|
-
|
|
3057
|
+
path6.join(meshRoot, "actors"),
|
|
3058
|
+
path6.join(meshRoot, "actors", fabricSessionId)
|
|
2942
3059
|
];
|
|
2943
3060
|
return actorRoots.some((actorRoot) => {
|
|
2944
3061
|
try {
|
|
2945
|
-
const registry = JSON.parse(
|
|
3062
|
+
const registry = JSON.parse(fs3.readFileSync(path6.join(actorRoot, "actors.json"), "utf8"));
|
|
2946
3063
|
if (typeof registry !== "object" || registry === null || Array.isArray(registry)) return false;
|
|
2947
3064
|
const actors = registry.actors;
|
|
2948
3065
|
return Array.isArray(actors) && actors.some((value) => {
|
|
@@ -3435,7 +3552,7 @@ var classifyToolResult = (input) => {
|
|
|
3435
3552
|
|
|
3436
3553
|
// src/host-compatibility.ts
|
|
3437
3554
|
import { existsSync as existsSync2, readFileSync as readFileSync2, realpathSync as realpathSync2 } from "node:fs";
|
|
3438
|
-
import
|
|
3555
|
+
import path7 from "node:path";
|
|
3439
3556
|
var MINIMUM_PI_HOST_VERSION = "1.0.0";
|
|
3440
3557
|
var PI_HOST_PACKAGE_NAMES = /* @__PURE__ */ new Set([
|
|
3441
3558
|
"@earendil-works/pi-coding-agent",
|
|
@@ -3466,12 +3583,12 @@ var detectPiHostVersion = (cliPath = process.argv[1]) => {
|
|
|
3466
3583
|
if (!cliPath) return void 0;
|
|
3467
3584
|
let directory;
|
|
3468
3585
|
try {
|
|
3469
|
-
directory =
|
|
3586
|
+
directory = path7.dirname(realpathSync2(cliPath));
|
|
3470
3587
|
} catch {
|
|
3471
3588
|
return void 0;
|
|
3472
3589
|
}
|
|
3473
3590
|
while (true) {
|
|
3474
|
-
const manifestPath =
|
|
3591
|
+
const manifestPath = path7.join(directory, "package.json");
|
|
3475
3592
|
if (existsSync2(manifestPath)) {
|
|
3476
3593
|
try {
|
|
3477
3594
|
const manifest = JSON.parse(readFileSync2(manifestPath, "utf8"));
|
|
@@ -3481,7 +3598,7 @@ var detectPiHostVersion = (cliPath = process.argv[1]) => {
|
|
|
3481
3598
|
} catch {
|
|
3482
3599
|
}
|
|
3483
3600
|
}
|
|
3484
|
-
const parent =
|
|
3601
|
+
const parent = path7.dirname(directory);
|
|
3485
3602
|
if (parent === directory) return void 0;
|
|
3486
3603
|
directory = parent;
|
|
3487
3604
|
}
|
|
@@ -3494,7 +3611,7 @@ var piHostCompatibilityWarning = (version = detectPiHostVersion()) => {
|
|
|
3494
3611
|
};
|
|
3495
3612
|
|
|
3496
3613
|
// src/ui/controller.ts
|
|
3497
|
-
import
|
|
3614
|
+
import path8 from "node:path";
|
|
3498
3615
|
|
|
3499
3616
|
// src/ui/snapshot.ts
|
|
3500
3617
|
import { isDeepStrictEqual } from "node:util";
|
|
@@ -4835,7 +4952,7 @@ var FabricUiController = class {
|
|
|
4835
4952
|
logFile: actor.worker.logFile
|
|
4836
4953
|
};
|
|
4837
4954
|
}
|
|
4838
|
-
const retained = actor.lastRunId && actor.logDir ?
|
|
4955
|
+
const retained = actor.lastRunId && actor.logDir ? path8.join(actor.logDir, actor.lastRunId, "events.jsonl") : void 0;
|
|
4839
4956
|
if (retained) return { id: actor.id, status: actor.status, logFile: retained };
|
|
4840
4957
|
if (actor.sessionFile) {
|
|
4841
4958
|
return { id: actor.id, status: actor.status, logFile: actor.sessionFile };
|
|
@@ -5099,17 +5216,17 @@ var registerHandoffCompletionRenderer = (extension) => {
|
|
|
5099
5216
|
};
|
|
5100
5217
|
|
|
5101
5218
|
// src/extension.ts
|
|
5102
|
-
import
|
|
5219
|
+
import path9 from "node:path";
|
|
5103
5220
|
import { fileURLToPath } from "node:url";
|
|
5104
5221
|
var FABRIC_MANAGED_HOST_VERSION = 1;
|
|
5105
5222
|
function createFabricExtension(entryUrl) {
|
|
5106
|
-
const FABRIC_EXTENSION_ENTRY_PATH =
|
|
5107
|
-
const FABRIC_ENTRY_DIR =
|
|
5223
|
+
const FABRIC_EXTENSION_ENTRY_PATH = path9.resolve(fileURLToPath(entryUrl));
|
|
5224
|
+
const FABRIC_ENTRY_DIR = path9.dirname(FABRIC_EXTENSION_ENTRY_PATH);
|
|
5108
5225
|
const FABRIC_RUNTIME_PATHS = {
|
|
5109
5226
|
extension: FABRIC_EXTENSION_ENTRY_PATH,
|
|
5110
|
-
worker:
|
|
5111
|
-
residentHost:
|
|
5112
|
-
skills:
|
|
5227
|
+
worker: path9.join(FABRIC_ENTRY_DIR, "worker.js"),
|
|
5228
|
+
residentHost: path9.join(FABRIC_ENTRY_DIR, "residency", "launcher.js"),
|
|
5229
|
+
skills: path9.resolve(FABRIC_ENTRY_DIR, "..", "skillsets")
|
|
5113
5230
|
};
|
|
5114
5231
|
const FABRIC_SKILLS_DIR = FABRIC_RUNTIME_PATHS.skills;
|
|
5115
5232
|
const FABRIC_ENTRY_IDENTITY = captureLoadedFileIdentity(entryUrl);
|
|
@@ -6001,4 +6118,4 @@ export {
|
|
|
6001
6118
|
FABRIC_MANAGED_HOST_VERSION,
|
|
6002
6119
|
createFabricExtension
|
|
6003
6120
|
};
|
|
6004
|
-
//# sourceMappingURL=chunk-
|
|
6121
|
+
//# sourceMappingURL=chunk-264TBT7A.js.map
|