omp-fabric 1.27.2 → 1.28.1
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/CHANGELOG.md +51 -0
- package/README.md +1 -1
- package/dist/capture/interceptor.d.ts.map +1 -1
- package/dist/chunks/{chunk-OJZNMROB.js → chunk-4PPAWZM6.js} +36 -50
- package/dist/chunks/chunk-4PPAWZM6.js.map +7 -0
- package/dist/chunks/{chunk-KIH3KLZU.js → chunk-C2YMZNT5.js} +5 -5
- package/dist/chunks/chunk-C2YMZNT5.js.map +7 -0
- package/dist/chunks/chunk-CHXPTZUF.js +277 -0
- package/dist/chunks/chunk-CHXPTZUF.js.map +7 -0
- package/dist/chunks/chunk-CYNNPPN4.js +93 -0
- package/dist/chunks/chunk-CYNNPPN4.js.map +7 -0
- package/dist/chunks/{chunk-ANHZ3SWB.js → chunk-DGKGPZET.js} +9 -4
- package/dist/chunks/{chunk-ANHZ3SWB.js.map → chunk-DGKGPZET.js.map} +2 -2
- package/dist/chunks/{chunk-2BOZMRT5.js → chunk-FVNEGH4J.js} +32 -49
- package/dist/chunks/chunk-FVNEGH4J.js.map +7 -0
- package/dist/chunks/{chunk-CNCRWY4Q.js → chunk-GS6IWGXQ.js} +9 -1
- package/dist/chunks/chunk-GS6IWGXQ.js.map +7 -0
- package/dist/chunks/{chunk-7QKSPNXQ.js → chunk-V5FB7D4C.js} +3 -3
- package/dist/chunks/chunk-VDYGBL4Z.js +132 -0
- package/dist/chunks/chunk-VDYGBL4Z.js.map +7 -0
- package/dist/chunks/chunk-XVA63H6I.js +151 -0
- package/dist/chunks/chunk-XVA63H6I.js.map +7 -0
- package/dist/chunks/{chunk-NOZBB266.js → chunk-XZIQGFF7.js} +9 -13
- package/dist/chunks/chunk-XZIQGFF7.js.map +7 -0
- package/dist/chunks/{chunk-4XLJPEI4.js → chunk-ZJ7HHWW4.js} +20 -41
- package/dist/chunks/chunk-ZJ7HHWW4.js.map +7 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/core/approval-controller.d.ts.map +1 -1
- package/dist/fabric-exec-tool.d.ts.map +1 -1
- package/dist/fabric-runtime-state.js +5 -3
- package/dist/fabric-runtime-state.js.map +1 -1
- package/dist/host-compatibility.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +180 -170
- package/dist/index.js.map +3 -3
- package/dist/residency/host.js +3 -3
- package/dist/residency/omp-entry.js +3 -3
- package/dist/topology/participant-directory.d.ts.map +1 -1
- package/dist/ui/arc-group.d.ts +1 -1
- package/dist/ui/arc-group.d.ts.map +1 -1
- package/dist/ui/code-preview-shell.d.ts +2 -2
- package/dist/ui/code-preview-shell.d.ts.map +1 -1
- package/dist/ui/controller.d.ts.map +1 -1
- package/dist/ui/conversation-chrome.d.ts +1 -5
- package/dist/ui/conversation-chrome.d.ts.map +1 -1
- package/dist/ui/conversation-chrome.js +2 -2
- package/dist/ui/conversation-queue.d.ts +3 -2
- package/dist/ui/conversation-queue.d.ts.map +1 -1
- package/dist/ui/conversation-render.d.ts +19 -23
- package/dist/ui/conversation-render.d.ts.map +1 -1
- package/dist/ui/conversation.d.ts +7 -17
- package/dist/ui/conversation.d.ts.map +1 -1
- package/dist/ui/conversation.js +317 -318
- package/dist/ui/conversation.js.map +3 -3
- package/dist/ui/core-tool-render.d.ts +1 -1
- package/dist/ui/core-tool-render.d.ts.map +1 -1
- package/dist/ui/dashboard-detail.d.ts +4 -4
- package/dist/ui/dashboard-detail.d.ts.map +1 -1
- package/dist/ui/dashboard-fabric-graph.d.ts +1 -1
- package/dist/ui/dashboard-fabric-graph.d.ts.map +1 -1
- package/dist/ui/dashboard-presentation.d.ts +1 -1
- package/dist/ui/dashboard-presentation.d.ts.map +1 -1
- package/dist/ui/dashboard.d.ts +8 -8
- package/dist/ui/dashboard.d.ts.map +1 -1
- package/dist/ui/dashboard.js +206 -343
- package/dist/ui/dashboard.js.map +3 -3
- package/dist/ui/diff-background.d.ts +1 -1
- package/dist/ui/diff-background.d.ts.map +1 -1
- package/dist/ui/fabric-actor-delivery-selector.d.ts +4 -4
- package/dist/ui/fabric-actor-delivery-selector.d.ts.map +1 -1
- package/dist/ui/fabric-actor-tool-selector.d.ts +5 -6
- package/dist/ui/fabric-actor-tool-selector.d.ts.map +1 -1
- package/dist/ui/fabric-host-event-selector.d.ts +4 -4
- package/dist/ui/fabric-host-event-selector.d.ts.map +1 -1
- package/dist/ui/fabric-model-selector.d.ts +4 -6
- package/dist/ui/fabric-model-selector.d.ts.map +1 -1
- package/dist/ui/fabric-render.d.ts +6 -6
- package/dist/ui/fabric-render.d.ts.map +1 -1
- package/dist/ui/fabric-thinking-selector.d.ts +4 -7
- package/dist/ui/fabric-thinking-selector.d.ts.map +1 -1
- package/dist/ui/highlight.d.ts +2 -13
- package/dist/ui/highlight.d.ts.map +1 -1
- package/dist/ui/row-balance.d.ts +6 -6
- package/dist/ui/row-balance.d.ts.map +1 -1
- package/dist/ui/settings.d.ts +6 -3
- package/dist/ui/settings.d.ts.map +1 -1
- package/dist/ui/settings.js +239 -113
- package/dist/ui/settings.js.map +3 -3
- package/dist/ui/state-file-preview.d.ts +1 -1
- package/dist/ui/state-file-preview.d.ts.map +1 -1
- package/dist/ui/tui/host-term.d.ts +16 -0
- package/dist/ui/tui/host-term.d.ts.map +1 -0
- package/dist/ui/tui/input.d.ts +19 -0
- package/dist/ui/tui/input.d.ts.map +1 -0
- package/dist/ui/tui/rows.d.ts +24 -0
- package/dist/ui/tui/rows.d.ts.map +1 -0
- package/dist/ui/tui/select-list.d.ts +28 -0
- package/dist/ui/tui/select-list.d.ts.map +1 -0
- package/dist/ui/tui/settings-list.d.ts +38 -0
- package/dist/ui/tui/settings-list.d.ts.map +1 -0
- package/dist/ui/tui/text-field.d.ts +40 -0
- package/dist/ui/tui/text-field.d.ts.map +1 -0
- package/dist/ui/tui/view.d.ts +26 -0
- package/dist/ui/tui/view.d.ts.map +1 -0
- package/dist/ui/widget.d.ts +3 -3
- package/dist/ui/widget.d.ts.map +1 -1
- package/docs/configuration.md +2 -0
- package/docs/interface.md +16 -3
- package/package.json +13 -12
- package/dist/chunks/chunk-2BOZMRT5.js.map +0 -7
- package/dist/chunks/chunk-4XLJPEI4.js.map +0 -7
- package/dist/chunks/chunk-CNCRWY4Q.js.map +0 -7
- package/dist/chunks/chunk-G2IBGGBM.js +0 -42
- package/dist/chunks/chunk-G2IBGGBM.js.map +0 -7
- package/dist/chunks/chunk-KIH3KLZU.js.map +0 -7
- package/dist/chunks/chunk-NOZBB266.js.map +0 -7
- package/dist/chunks/chunk-OJZNMROB.js.map +0 -7
- package/dist/ui/symbol-theme.d.ts +0 -3
- package/dist/ui/symbol-theme.d.ts.map +0 -1
- /package/dist/chunks/{chunk-7QKSPNXQ.js.map → chunk-V5FB7D4C.js.map} +0 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// src/ui/tui/host-term.ts
|
|
2
|
+
var MODULES = [
|
|
3
|
+
{
|
|
4
|
+
key: "paint",
|
|
5
|
+
id: "@oh-my-pi/pi-tui/term/paint",
|
|
6
|
+
exports: ["defineRolePainter"],
|
|
7
|
+
loses: "mouse wheel scrolling",
|
|
8
|
+
load: () => import("@oh-my-pi/pi-tui/term/paint")
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
key: "widgets",
|
|
12
|
+
id: "@oh-my-pi/pi-tui/term/widgets",
|
|
13
|
+
exports: ["defineRoleWidget"],
|
|
14
|
+
loses: "mouse wheel scrolling",
|
|
15
|
+
load: () => import("@oh-my-pi/pi-tui/term/widgets")
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
key: "render",
|
|
19
|
+
id: "@oh-my-pi/pi-tui/term/render",
|
|
20
|
+
exports: ["renderBlock"],
|
|
21
|
+
loses: "previews drawn by host tool renderers",
|
|
22
|
+
load: () => import("@oh-my-pi/pi-tui/term/render")
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
key: "keymap",
|
|
26
|
+
id: "@oh-my-pi/pi-tui/term/keymap",
|
|
27
|
+
exports: ["widgetKeyMatches", "widgetActionOf"],
|
|
28
|
+
loses: "rebound widget keys (the default keys still work)",
|
|
29
|
+
load: () => import("@oh-my-pi/pi-tui/term/keymap")
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: "decoder",
|
|
33
|
+
id: "@oh-my-pi/pi-tui/driver/input/decoder",
|
|
34
|
+
exports: ["decodeInput"],
|
|
35
|
+
loses: "input that does not arrive as a host key event",
|
|
36
|
+
load: () => import("@oh-my-pi/pi-tui/driver/input/decoder")
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
var errorText = (error) => error instanceof Error ? error.message : String(error);
|
|
40
|
+
var loadHostTerm = async () => {
|
|
41
|
+
const term = {};
|
|
42
|
+
const missing = [];
|
|
43
|
+
const losses = /* @__PURE__ */ new Set();
|
|
44
|
+
await Promise.all(
|
|
45
|
+
MODULES.map(async (module) => {
|
|
46
|
+
try {
|
|
47
|
+
const loaded2 = await module.load();
|
|
48
|
+
const absent = module.exports.filter((name) => typeof loaded2[name] !== "function");
|
|
49
|
+
if (absent.length === 0) {
|
|
50
|
+
term[module.key] = loaded2;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
missing.push(`${module.id} (no export ${absent.join(", ")})`);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
missing.push(`${module.id} (${errorText(error)})`);
|
|
56
|
+
}
|
|
57
|
+
losses.add(module.loses);
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
return { term, missing: missing.sort(), losses: [...losses] };
|
|
61
|
+
};
|
|
62
|
+
var loaded = await loadHostTerm();
|
|
63
|
+
var hostTerm = () => loaded.term;
|
|
64
|
+
var hostTermDiagnostic = () => loaded.missing.length === 0 ? void 0 : `Fabric UI is running without host pi-tui internals: ${loaded.missing.join("; ")}. Views render as plain rows; unavailable: ${loaded.losses.join(", ")}.`;
|
|
65
|
+
|
|
66
|
+
// src/ui/tui/input.ts
|
|
67
|
+
var MODIFIED = /^(?:ctrl|alt|super)\+/;
|
|
68
|
+
var BRACKETED_PASTE = /^\x1b\[200~([\s\S]*)\x1b\[201~$/;
|
|
69
|
+
var DEFAULT_KEYS = {
|
|
70
|
+
"select.up": ["up"],
|
|
71
|
+
"select.down": ["down"],
|
|
72
|
+
"select.pageUp": ["pageUp"],
|
|
73
|
+
"select.pageDown": ["pageDown"],
|
|
74
|
+
"select.confirm": ["enter"],
|
|
75
|
+
"select.cancel": ["escape"],
|
|
76
|
+
"editor.selectAll": ["super+a"],
|
|
77
|
+
"editor.cursorUp": ["up"],
|
|
78
|
+
"editor.cursorDown": ["down"],
|
|
79
|
+
"editor.cursorLeft": ["left", "ctrl+b"],
|
|
80
|
+
"editor.cursorRight": ["right", "ctrl+f"],
|
|
81
|
+
"editor.cursorWordLeft": ["alt+left", "ctrl+left", "alt+b"],
|
|
82
|
+
"editor.cursorWordRight": ["alt+right", "ctrl+right", "alt+f"],
|
|
83
|
+
"editor.cursorLineStart": ["home", "ctrl+a"],
|
|
84
|
+
"editor.cursorLineEnd": ["end", "ctrl+e"],
|
|
85
|
+
"editor.pageUp": ["pageUp"],
|
|
86
|
+
"editor.pageDown": ["pageDown"],
|
|
87
|
+
"editor.deleteCharBackward": ["backspace"],
|
|
88
|
+
"editor.deleteCharForward": ["delete", "ctrl+d"],
|
|
89
|
+
"editor.deleteWordBackward": ["ctrl+w", "alt+backspace", "ctrl+backspace", "alt+super+backspace"],
|
|
90
|
+
"editor.deleteWordForward": ["alt+delete", "alt+d", "ctrl+delete", "alt+super+delete", "alt+super+d"],
|
|
91
|
+
"editor.deleteToLineStart": ["ctrl+u"],
|
|
92
|
+
"editor.deleteToLineEnd": ["ctrl+k"],
|
|
93
|
+
"editor.yank": ["ctrl+y"],
|
|
94
|
+
"editor.yankPop": ["alt+y"],
|
|
95
|
+
"editor.undo": ["ctrl+-", "ctrl+_"],
|
|
96
|
+
"editor.newLine": ["shift+enter", "ctrl+j"]
|
|
97
|
+
};
|
|
98
|
+
var lastHostKey;
|
|
99
|
+
var rememberHostKey = (key) => {
|
|
100
|
+
lastHostKey = key;
|
|
101
|
+
};
|
|
102
|
+
var decodeWithoutHost = (data) => {
|
|
103
|
+
if (lastHostKey?.raw === data) return [{ type: "key", key: lastHostKey }];
|
|
104
|
+
const paste = BRACKETED_PASTE.exec(data);
|
|
105
|
+
return paste ? [{ type: "paste", text: paste[1] }] : [];
|
|
106
|
+
};
|
|
107
|
+
var decodeTerminalInput = (data) => {
|
|
108
|
+
const decoder = hostTerm().decoder;
|
|
109
|
+
if (!decoder) return decodeWithoutHost(data);
|
|
110
|
+
const result = [];
|
|
111
|
+
for (const event of decoder.decodeInput(data)) {
|
|
112
|
+
if (event.type === "key" && event.key.kind !== "release") result.push({ type: "key", key: event.key });
|
|
113
|
+
else if (event.type === "paste") result.push({ type: "paste", text: event.paste.text });
|
|
114
|
+
}
|
|
115
|
+
return result;
|
|
116
|
+
};
|
|
117
|
+
var keyMatches = (key, action) => {
|
|
118
|
+
const keymap = hostTerm().keymap;
|
|
119
|
+
if (keymap) return keymap.widgetKeyMatches(key, action);
|
|
120
|
+
return key.kind !== "release" && DEFAULT_KEYS[action].includes(key.id);
|
|
121
|
+
};
|
|
122
|
+
var actionOf = (id, actions) => {
|
|
123
|
+
const keymap = hostTerm().keymap;
|
|
124
|
+
if (keymap) return keymap.widgetActionOf(id, actions);
|
|
125
|
+
return actions.find((action) => DEFAULT_KEYS[action].includes(id));
|
|
126
|
+
};
|
|
127
|
+
var keyOf = (data) => {
|
|
128
|
+
const events = decodeTerminalInput(data);
|
|
129
|
+
const first = events[0];
|
|
130
|
+
return events.length === 1 && first?.type === "key" ? first.key : void 0;
|
|
131
|
+
};
|
|
132
|
+
var isKey = (data, id) => keyOf(data)?.id === id;
|
|
133
|
+
var isAction = (data, action) => {
|
|
134
|
+
const key = keyOf(data);
|
|
135
|
+
return key !== void 0 && keyMatches(key, action);
|
|
136
|
+
};
|
|
137
|
+
var typedText = (key) => key.text !== void 0 && key.text !== "" && !MODIFIED.test(key.id) ? key.text : void 0;
|
|
138
|
+
|
|
139
|
+
export {
|
|
140
|
+
hostTerm,
|
|
141
|
+
hostTermDiagnostic,
|
|
142
|
+
rememberHostKey,
|
|
143
|
+
decodeTerminalInput,
|
|
144
|
+
keyMatches,
|
|
145
|
+
actionOf,
|
|
146
|
+
keyOf,
|
|
147
|
+
isKey,
|
|
148
|
+
isAction,
|
|
149
|
+
typedText
|
|
150
|
+
};
|
|
151
|
+
//# sourceMappingURL=chunk-XVA63H6I.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ui/tui/host-term.ts", "../../src/ui/tui/input.ts"],
|
|
4
|
+
"sourcesContent": ["type PaintApi = Pick<typeof import(\"@oh-my-pi/pi-tui/term/paint\"), \"defineRolePainter\">;\ntype WidgetsApi = Pick<typeof import(\"@oh-my-pi/pi-tui/term/widgets\"), \"defineRoleWidget\">;\ntype RenderApi = Pick<typeof import(\"@oh-my-pi/pi-tui/term/render\"), \"renderBlock\">;\ntype KeymapApi = Pick<typeof import(\"@oh-my-pi/pi-tui/term/keymap\"), \"widgetKeyMatches\" | \"widgetActionOf\">;\ntype DecoderApi = Pick<typeof import(\"@oh-my-pi/pi-tui/driver/input/decoder\"), \"decodeInput\">;\n\ninterface HostTerm {\n readonly paint?: PaintApi;\n readonly widgets?: WidgetsApi;\n readonly render?: RenderApi;\n readonly keymap?: KeymapApi;\n readonly decoder?: DecoderApi;\n}\n\ninterface HostTermModule {\n readonly key: keyof HostTerm;\n readonly id: string;\n readonly exports: readonly string[];\n readonly loses: string;\n readonly load: () => Promise<unknown>;\n}\n\nconst MODULES: readonly HostTermModule[] = [\n {\n key: \"paint\",\n id: \"@oh-my-pi/pi-tui/term/paint\",\n exports: [\"defineRolePainter\"],\n loses: \"mouse wheel scrolling\",\n load: () => import(\"@oh-my-pi/pi-tui/term/paint\"),\n },\n {\n key: \"widgets\",\n id: \"@oh-my-pi/pi-tui/term/widgets\",\n exports: [\"defineRoleWidget\"],\n loses: \"mouse wheel scrolling\",\n load: () => import(\"@oh-my-pi/pi-tui/term/widgets\"),\n },\n {\n key: \"render\",\n id: \"@oh-my-pi/pi-tui/term/render\",\n exports: [\"renderBlock\"],\n loses: \"previews drawn by host tool renderers\",\n load: () => import(\"@oh-my-pi/pi-tui/term/render\"),\n },\n {\n key: \"keymap\",\n id: \"@oh-my-pi/pi-tui/term/keymap\",\n exports: [\"widgetKeyMatches\", \"widgetActionOf\"],\n loses: \"rebound widget keys (the default keys still work)\",\n load: () => import(\"@oh-my-pi/pi-tui/term/keymap\"),\n },\n {\n key: \"decoder\",\n id: \"@oh-my-pi/pi-tui/driver/input/decoder\",\n exports: [\"decodeInput\"],\n loses: \"input that does not arrive as a host key event\",\n load: () => import(\"@oh-my-pi/pi-tui/driver/input/decoder\"),\n },\n];\n\nconst errorText = (error: unknown): string => (error instanceof Error ? error.message : String(error));\n\nconst loadHostTerm = async (): Promise<{ term: HostTerm; missing: string[]; losses: string[] }> => {\n const term: Record<string, unknown> = {};\n const missing: string[] = [];\n const losses = new Set<string>();\n await Promise.all(\n MODULES.map(async (module) => {\n try {\n const loaded = (await module.load()) as Record<string, unknown>;\n const absent = module.exports.filter((name) => typeof loaded[name] !== \"function\");\n if (absent.length === 0) {\n term[module.key] = loaded;\n return;\n }\n missing.push(`${module.id} (no export ${absent.join(\", \")})`);\n } catch (error) {\n missing.push(`${module.id} (${errorText(error)})`);\n }\n losses.add(module.loses);\n }),\n );\n return { term: term as HostTerm, missing: missing.sort(), losses: [...losses] };\n};\n\nconst loaded = await loadHostTerm();\n\nexport const hostTerm = (): HostTerm => loaded.term;\n\nexport const hostTermDiagnostic = (): string | undefined =>\n loaded.missing.length === 0\n ? undefined\n : `Fabric UI is running without host pi-tui internals: ${loaded.missing.join(\"; \")}. Views render as plain rows; unavailable: ${loaded.losses.join(\", \")}.`;\n", "import type { KeyEvent } from \"@oh-my-pi/pi-tui\";\nimport type { WidgetAction } from \"@oh-my-pi/pi-tui/term/keymap\";\nimport { hostTerm } from \"./host-term.js\";\n\ntype TerminalInput =\n | { readonly type: \"key\"; readonly key: KeyEvent }\n | { readonly type: \"paste\"; readonly text: string };\n\nconst MODIFIED = /^(?:ctrl|alt|super)\\+/;\nconst BRACKETED_PASTE = /^\\x1b\\[200~([\\s\\S]*)\\x1b\\[201~$/;\n\nconst DEFAULT_KEYS: Readonly<Record<WidgetAction, readonly string[]>> = {\n \"select.up\": [\"up\"],\n \"select.down\": [\"down\"],\n \"select.pageUp\": [\"pageUp\"],\n \"select.pageDown\": [\"pageDown\"],\n \"select.confirm\": [\"enter\"],\n \"select.cancel\": [\"escape\"],\n \"editor.selectAll\": [\"super+a\"],\n \"editor.cursorUp\": [\"up\"],\n \"editor.cursorDown\": [\"down\"],\n \"editor.cursorLeft\": [\"left\", \"ctrl+b\"],\n \"editor.cursorRight\": [\"right\", \"ctrl+f\"],\n \"editor.cursorWordLeft\": [\"alt+left\", \"ctrl+left\", \"alt+b\"],\n \"editor.cursorWordRight\": [\"alt+right\", \"ctrl+right\", \"alt+f\"],\n \"editor.cursorLineStart\": [\"home\", \"ctrl+a\"],\n \"editor.cursorLineEnd\": [\"end\", \"ctrl+e\"],\n \"editor.pageUp\": [\"pageUp\"],\n \"editor.pageDown\": [\"pageDown\"],\n \"editor.deleteCharBackward\": [\"backspace\"],\n \"editor.deleteCharForward\": [\"delete\", \"ctrl+d\"],\n \"editor.deleteWordBackward\": [\"ctrl+w\", \"alt+backspace\", \"ctrl+backspace\", \"alt+super+backspace\"],\n \"editor.deleteWordForward\": [\"alt+delete\", \"alt+d\", \"ctrl+delete\", \"alt+super+delete\", \"alt+super+d\"],\n \"editor.deleteToLineStart\": [\"ctrl+u\"],\n \"editor.deleteToLineEnd\": [\"ctrl+k\"],\n \"editor.yank\": [\"ctrl+y\"],\n \"editor.yankPop\": [\"alt+y\"],\n \"editor.undo\": [\"ctrl+-\", \"ctrl+_\"],\n \"editor.newLine\": [\"shift+enter\", \"ctrl+j\"],\n};\n\nlet lastHostKey: KeyEvent | undefined;\n\nexport const rememberHostKey = (key: KeyEvent): void => {\n lastHostKey = key;\n};\n\nconst decodeWithoutHost = (data: string): TerminalInput[] => {\n if (lastHostKey?.raw === data) return [{ type: \"key\", key: lastHostKey }];\n const paste = BRACKETED_PASTE.exec(data);\n return paste ? [{ type: \"paste\", text: paste[1]! }] : [];\n};\n\nexport const decodeTerminalInput = (data: string): TerminalInput[] => {\n const decoder = hostTerm().decoder;\n if (!decoder) return decodeWithoutHost(data);\n const result: TerminalInput[] = [];\n for (const event of decoder.decodeInput(data)) {\n if (event.type === \"key\" && event.key.kind !== \"release\") result.push({ type: \"key\", key: event.key });\n else if (event.type === \"paste\") result.push({ type: \"paste\", text: event.paste.text });\n }\n return result;\n};\n\nexport const keyMatches = (key: KeyEvent, action: WidgetAction): boolean => {\n const keymap = hostTerm().keymap;\n if (keymap) return keymap.widgetKeyMatches(key, action);\n return key.kind !== \"release\" && DEFAULT_KEYS[action].includes(key.id);\n};\n\nexport const actionOf = <A extends WidgetAction>(id: string, actions: readonly A[]): A | undefined => {\n const keymap = hostTerm().keymap;\n if (keymap) return keymap.widgetActionOf(id, actions);\n return actions.find((action) => DEFAULT_KEYS[action].includes(id));\n};\n\nexport const keyOf = (data: string): KeyEvent | undefined => {\n const events = decodeTerminalInput(data);\n const first = events[0];\n return events.length === 1 && first?.type === \"key\" ? first.key : undefined;\n};\n\nexport const isKey = (data: string, id: string): boolean => keyOf(data)?.id === id;\n\nexport const isAction = (data: string, action: WidgetAction): boolean => {\n const key = keyOf(data);\n return key !== undefined && keyMatches(key, action);\n};\n\nexport const typedText = (key: KeyEvent): string | undefined =>\n key.text !== undefined && key.text !== \"\" && !MODIFIED.test(key.id) ? key.text : undefined;\n"],
|
|
5
|
+
"mappings": ";AAsBA,IAAM,UAAqC;AAAA,EACzC;AAAA,IACE,KAA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AAyB,IAAY,YAAyC;AACpG,QAAM,SAAS,SAAS,EAAE;AAC1B,MAAI,OAAQ,QAAO,OAAO,eAAe,IAAI,OAAO;AACpD,SAAO,QAAQ,KAAK,CAAC,WAAW,aAAa,MAAM,EAAE,SAAS,EAAE,CAAC;AACnE;AAEO,IAAM,QAAQ,CAAC,SAAuC;AAC3D,QAAM,SAAS,oBAAoB,IAAI;AACvC,QAAM,QAAQ,OAAO,CAAC;AACtB,SAAO,OAAO,WAAW,KAAK,OAAO,SAAS,QAAQ,MAAM,MAAM;AACpE;AAEO,IAAM,QAAQ,CAAC,MAAc,OAAwB,MAAM,IAAI,GAAG,OAAO;AAEzE,IAAM,WAAW,CAAC,MAAc,WAAkC;AACvE,QAAM,MAAM,MAAM,IAAI;AACtB,SAAO,QAAQ,UAAa,WAAW,KAAK,MAAM;AACpD;AAEO,IAAM,YAAY,CAAC,QACxB,IAAI,SAAS,UAAa,IAAI,SAAS,MAAM,CAAC,SAAS,KAAK,IAAI,EAAE,IAAI,IAAI,OAAO;",
|
|
6
|
+
"names": ["loaded"]
|
|
7
|
+
}
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatTokens,
|
|
3
3
|
safeText
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-C2YMZNT5.js";
|
|
5
5
|
|
|
6
6
|
// src/ui/conversation-chrome.ts
|
|
7
7
|
import { homedir } from "node:os";
|
|
8
8
|
import path from "node:path";
|
|
9
|
-
import {
|
|
9
|
+
import { truncate, visibleWidth } from "@oh-my-pi/pi-tui/text/width";
|
|
10
10
|
async function readConversationAppearance(cwd, agentDir, projectTrusted) {
|
|
11
|
-
const [{ Settings }, { cfgHideThinkingBlock }
|
|
11
|
+
const [{ Settings }, { cfgHideThinkingBlock }] = await Promise.all([
|
|
12
12
|
import("@oh-my-pi/pi-coding-agent/config/settings"),
|
|
13
|
-
import("@oh-my-pi/pi-coding-agent/session/settings")
|
|
14
|
-
import("@oh-my-pi/pi-coding-agent/modes/settings")
|
|
13
|
+
import("@oh-my-pi/pi-coding-agent/session/settings")
|
|
15
14
|
]);
|
|
16
15
|
const settings = projectTrusted ? await Settings.loadReadOnly({ cwd, agentDir }) : Settings.isolated();
|
|
17
16
|
return {
|
|
18
17
|
editorPaddingX: 0,
|
|
19
|
-
|
|
20
|
-
codeBlockIndent: " ",
|
|
21
|
-
hideThinkingBlock: cfgHideThinkingBlock.get(settings) === true,
|
|
22
|
-
showImages: cfgTerminalShowImages.get(settings) === true
|
|
18
|
+
hideThinkingBlock: cfgHideThinkingBlock.get(settings) === true
|
|
23
19
|
};
|
|
24
20
|
}
|
|
25
21
|
var footerPath = (cwd) => {
|
|
@@ -45,11 +41,11 @@ function conversationFooter(target, theme, width) {
|
|
|
45
41
|
stats.push(target.contextWindow ? `?/${formatTokens(target.contextWindow)} ctx` : "ctx ?");
|
|
46
42
|
const model = safeText(target.model ?? `${target.runner ?? ""} model unavailable`).trim();
|
|
47
43
|
const thinking = target.thinking ? ` \u2022 ${safeText(target.thinking === "off" ? "thinking off" : target.thinking)}` : "";
|
|
48
|
-
const left =
|
|
49
|
-
const right =
|
|
44
|
+
const left = truncate(stats.join(" "), width);
|
|
45
|
+
const right = truncate(`${model}${thinking}`, Math.max(0, width - visibleWidth(left) - 2), "");
|
|
50
46
|
const gap = " ".repeat(Math.max(0, width - visibleWidth(left) - visibleWidth(right)));
|
|
51
47
|
return [
|
|
52
|
-
|
|
48
|
+
truncate(theme.fg("dim", pwd), width),
|
|
53
49
|
theme.fg("dim", `${left}${gap}${right}`)
|
|
54
50
|
];
|
|
55
51
|
}
|
|
@@ -58,4 +54,4 @@ export {
|
|
|
58
54
|
readConversationAppearance,
|
|
59
55
|
conversationFooter
|
|
60
56
|
};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
57
|
+
//# sourceMappingURL=chunk-XZIQGFF7.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ui/conversation-chrome.ts"],
|
|
4
|
+
"sourcesContent": ["import { homedir } from \"node:os\";\nimport path from \"node:path\";\nimport type { Theme } from \"@oh-my-pi/pi-tui/theme/contract\";\nimport { truncate, visibleWidth } from \"@oh-my-pi/pi-tui/text/width\";\nimport { formatTokens, safeText } from \"./format.js\";\nimport type { FabricConversationTarget } from \"./conversation.js\";\n\nexport interface FabricConversationAppearance {\n editorPaddingX: number;\n hideThinkingBlock?: boolean;\n}\n\n/** Read OMP appearance settings; cwd and agentDir apply only to trusted project loading. */\nexport async function readConversationAppearance(cwd: string, agentDir: string, projectTrusted: boolean): Promise<FabricConversationAppearance> {\n const [{ Settings }, { cfgHideThinkingBlock }] = await Promise.all([\n import(\"@oh-my-pi/pi-coding-agent/config/settings\"),\n import(\"@oh-my-pi/pi-coding-agent/session/settings\"),\n ]);\n const settings = projectTrusted\n ? await Settings.loadReadOnly({ cwd, agentDir })\n : Settings.isolated();\n return {\n editorPaddingX: 0,\n hideThinkingBlock: cfgHideThinkingBlock.get(settings) === true,\n };\n}\n\nconst footerPath = (cwd: string): string => {\n const home = homedir();\n if (cwd === home) return \"~\";\n return cwd.startsWith(`${home}${path.sep}`) ? `~${cwd.slice(home.length)}` : cwd;\n};\n\n/** Native-shaped footer backed by this participant, never by Main's session stats. */\nexport function conversationFooter(target: FabricConversationTarget | undefined, theme: Theme, width: number): string[] {\n if (!target || width <= 0) return [];\n const location = target.cwd ? footerPath(target.cwd) : \"cwd unavailable\";\n const branch = target.branch ? ` (${target.branch})` : \"\";\n const pwd = safeText(`${location}${branch} \u2022 ${target.name}`);\n const stats = [safeText(target.status)];\n if (target.usage) {\n const usage = target.usage;\n // Agent usage is run-scoped; actor values describe the current/last activation.\n stats.push(\"run\", `\u2191${formatTokens(usage.input)}`, `\u2193${formatTokens(usage.output)}`);\n if (usage.cacheRead > 0) stats.push(`R${formatTokens(usage.cacheRead)}`);\n if (usage.cacheWrite > 0) stats.push(`W${formatTokens(usage.cacheWrite)}`);\n if (Number.isFinite(usage.cost)) stats.push(`$${usage.cost.toFixed(3)}`);\n } else {\n stats.push(\"usage unavailable\");\n }\n // Cumulative run tokens are not current context occupancy. Do not invent a percentage.\n stats.push(target.contextWindow ? `?/${formatTokens(target.contextWindow)} ctx` : \"ctx ?\");\n const model = safeText(target.model ?? `${target.runner ?? \"\"} model unavailable`).trim();\n const thinking = target.thinking ? ` \u2022 ${safeText(target.thinking === \"off\" ? \"thinking off\" : target.thinking)}` : \"\";\n const left = truncate(stats.join(\" \"), width);\n const right = truncate(`${model}${thinking}`, Math.max(0, width - visibleWidth(left) - 2), \"\");\n const gap = \" \".repeat(Math.max(0, width - visibleWidth(left) - visibleWidth(right)));\n return [\n truncate(theme.fg(\"dim\", pwd), width),\n theme.fg(\"dim\", `${left}${gap}${right}`),\n ];\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;AAAA,SAAS,eAAe;AACxB,OAAO,UAAU;AAEjB,SAAS,UAAU,oBAAoB;AAUvC,eAAsB,2BAA2B,KAAa,UAAkB,gBAAgE;AAC9I,QAAM,CAAC,EAAE,SAAS,GAAG,EAAE,qBAAqB,CAAC,IAAI,MAAM,QAAQ,IAAI;AAAA,IACjE,OAAO,2CAA2C;AAAA,IAClD,OAAO,4CAA4C;AAAA,EACrD,CAAC;AACD,QAAM,WAAW,iBACb,MAAM,SAAS,aAAa,EAAE,KAAK,SAAS,CAAC,IAC7C,SAAS,SAAS;AACtB,SAAO;AAAA,IACL,gBAAgB;AAAA,IAChB,mBAAmB,qBAAqB,IAAI,QAAQ,MAAM;AAAA,EAC5D;AACF;AAEA,IAAM,aAAa,CAAC,QAAwB;AAC1C,QAAM,OAAO,QAAQ;AACrB,MAAI,QAAQ,KAAM,QAAO;AACzB,SAAO,IAAI,WAAW,GAAG,IAAI,GAAG,KAAK,GAAG,EAAE,IAAI,IAAI,IAAI,MAAM,KAAK,MAAM,CAAC,KAAK;AAC/E;AAGO,SAAS,mBAAmB,QAA8C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AAa,IAAI,IAAI,aAAa,KAAK,CAAC,CAAC;AACpF,SAAO;AAAA,IACL,SAAS,MAAM,GAAG,OAAO,GAAG,GAAG,KAAK;AAAA,IACpC,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,GAAG,GAAG,KAAK,EAAE;AAAA,EACzC;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -304,22 +304,12 @@ var ansi256ToRgb = (index) => {
|
|
|
304
304
|
const gray = 8 + 10 * (Math.min(index, 255) - 232);
|
|
305
305
|
return { r: gray, g: gray, b: gray };
|
|
306
306
|
};
|
|
307
|
-
var parseAnsiBgColor = (sequence) => {
|
|
308
|
-
const truecolor = sequence.match(/\x1b\[4?8;2;(\d+);(\d+);(\d+)m/);
|
|
309
|
-
if (truecolor) {
|
|
310
|
-
return { r: Number(truecolor[1]), g: Number(truecolor[2]), b: Number(truecolor[3]) };
|
|
311
|
-
}
|
|
312
|
-
const indexed = sequence.match(/\x1b\[4?8;5;(\d+)m/);
|
|
313
|
-
if (indexed) return ansi256ToRgb(Number(indexed[1]));
|
|
314
|
-
return void 0;
|
|
315
|
-
};
|
|
316
307
|
var relativeLuminance = ({ r, g, b }) => (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;
|
|
317
308
|
var classifyOmpTheme = (theme, env = process.env) => {
|
|
318
309
|
const name = theme?.name?.trim().toLowerCase();
|
|
319
310
|
if (name === "light") return "light";
|
|
320
311
|
if (name === "dark") return "dark";
|
|
321
|
-
|
|
322
|
-
if (background) return relativeLuminance(background) >= 0.5 ? "light" : "dark";
|
|
312
|
+
if (theme?.dark !== void 0) return theme.dark ? "dark" : "light";
|
|
323
313
|
const colorFgBg = env.COLORFGBG;
|
|
324
314
|
if (colorFgBg) {
|
|
325
315
|
const index = colorFgBg.split(";").map((part) => Number.parseInt(part, 10)).filter((part) => Number.isInteger(part) && part >= 0 && part <= 255).at(-1);
|
|
@@ -972,7 +962,7 @@ var formatToolCallDuration = (startedAt, endedAt) => {
|
|
|
972
962
|
import { diffLines } from "diff";
|
|
973
963
|
|
|
974
964
|
// src/ui/diff-background.ts
|
|
975
|
-
import {
|
|
965
|
+
import { truncate, visibleWidth } from "@oh-my-pi/pi-tui/text/width";
|
|
976
966
|
var DIFF_ADD_MARKER = "\0PI_DIFF_ADD\0";
|
|
977
967
|
var DIFF_REMOVE_MARKER = "\0PI_DIFF_REMOVE\0";
|
|
978
968
|
var markDiffLine = (kind, line) => (kind === "add" ? DIFF_ADD_MARKER : DIFF_REMOVE_MARKER) + line;
|
|
@@ -1016,11 +1006,9 @@ var fallbackDiffBg = (kind, intensity) => {
|
|
|
1016
1006
|
return intensity === "medium" ? "\x1B[48;2;78;36;40m" : "\x1B[48;2;50;24;30m";
|
|
1017
1007
|
};
|
|
1018
1008
|
var deriveDiffBg = (kind, theme, intensity) => {
|
|
1019
|
-
const
|
|
1020
|
-
const fg = themed?.getFgAnsi?.(kind === "add" ? "toolDiffAdded" : "toolDiffRemoved");
|
|
1021
|
-
const fgRgb = parseAnsiRgb(fg ?? "");
|
|
1009
|
+
const fgRgb = themeRgb(theme, kind === "add" ? "toolDiffAdded" : "toolDiffRemoved");
|
|
1022
1010
|
if (!fgRgb) return void 0;
|
|
1023
|
-
const base =
|
|
1011
|
+
const base = themeRgb(theme, kind === "add" ? "toolSuccessBg" : "toolErrorBg") ?? themeRgb(theme, "toolSuccessBg") ?? (observedThemeVariant() === "light" ? { r: 255, g: 255, b: 255 } : { r: 0, g: 0, b: 0 });
|
|
1024
1012
|
return `\x1B[48;2;${Math.round(base.r + (fgRgb.r - base.r) * intensity)};${Math.round(base.g + (fgRgb.g - base.g) * intensity)};${Math.round(base.b + (fgRgb.b - base.b) * intensity)}m`;
|
|
1025
1013
|
};
|
|
1026
1014
|
var PRINTABLE_ASCII_RE = /^[\x20-\x7e]*$/;
|
|
@@ -1068,7 +1056,7 @@ var wrapDiffAnsiToWidth = (text, width, maxRows = 3, continuationPrefix = "") =>
|
|
|
1068
1056
|
rowWidth = 0;
|
|
1069
1057
|
}
|
|
1070
1058
|
if (segmentWidth > width && rowWidth === 0) {
|
|
1071
|
-
const clipped =
|
|
1059
|
+
const clipped = truncate(segment, width, "");
|
|
1072
1060
|
if (clipped) {
|
|
1073
1061
|
row += clipped;
|
|
1074
1062
|
rowWidth += visibleWidth(clipped);
|
|
@@ -1088,12 +1076,12 @@ var wrapDiffAnsiToWidth = (text, width, maxRows = 3, continuationPrefix = "") =>
|
|
|
1088
1076
|
};
|
|
1089
1077
|
var truncateWrappedRow = (row, rowWidth, width) => {
|
|
1090
1078
|
if (rowWidth <= width && TRUNCATION_SAFE_RE.test(row)) return row;
|
|
1091
|
-
return
|
|
1079
|
+
return truncate(row, width, "");
|
|
1092
1080
|
};
|
|
1093
1081
|
var truncateLastRow = (rows, width) => {
|
|
1094
1082
|
const last = rows.at(-1) ?? "";
|
|
1095
1083
|
if (visibleWidth(last) >= width && width > 1) {
|
|
1096
|
-
rows[rows.length - 1] =
|
|
1084
|
+
rows[rows.length - 1] = truncate(last, width - 1, "") + "\u203A";
|
|
1097
1085
|
}
|
|
1098
1086
|
return rows;
|
|
1099
1087
|
};
|
|
@@ -1124,12 +1112,10 @@ var updateAnsiState = (current, sequence) => {
|
|
|
1124
1112
|
return current + sequence;
|
|
1125
1113
|
};
|
|
1126
1114
|
var replaceAnsi = (current, pattern, replacement) => current.replace(pattern, "") + replacement;
|
|
1127
|
-
var
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
if (indexed) return ansi256ToRgb(Number(indexed[1]));
|
|
1132
|
-
return void 0;
|
|
1115
|
+
var themeRgb = (theme, key) => {
|
|
1116
|
+
if (!theme?.has(key)) return void 0;
|
|
1117
|
+
const match = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(theme.hex(key));
|
|
1118
|
+
return match ? { r: Number.parseInt(match[1], 16), g: Number.parseInt(match[2], 16), b: Number.parseInt(match[3], 16) } : void 0;
|
|
1133
1119
|
};
|
|
1134
1120
|
|
|
1135
1121
|
// src/ui/word-diff/normalize.ts
|
|
@@ -3423,7 +3409,7 @@ var renderDiff = (diff, filePath, theme, options, limitOverride) => {
|
|
|
3423
3409
|
const safe = escapeControlChars3(raw);
|
|
3424
3410
|
const trimmed = safe.trim();
|
|
3425
3411
|
if (trimmed === "...") return theme.fg("muted", " --- unchanged lines hidden ---");
|
|
3426
|
-
if (trimmed.startsWith("@@")) return theme.fg("accent", theme.
|
|
3412
|
+
if (trimmed.startsWith("@@")) return theme.fg("accent", theme.style("strong", safe));
|
|
3427
3413
|
if (trimmed.startsWith("---") || trimmed.startsWith("+++") || trimmed.startsWith("diff ") || trimmed.startsWith("index ")) {
|
|
3428
3414
|
return theme.fg("muted", safe);
|
|
3429
3415
|
}
|
|
@@ -3970,7 +3956,7 @@ var renderCoreToolBody = (audit, theme, options) => {
|
|
|
3970
3956
|
var coreToolTitle = (audit, theme, options) => {
|
|
3971
3957
|
observeOmpTheme(theme);
|
|
3972
3958
|
if (!coreToolRendererEnabled(audit, options.settings) || !audit.tool) return null;
|
|
3973
|
-
const title = theme.fg("toolTitle", theme.
|
|
3959
|
+
const title = theme.fg("toolTitle", theme.style("strong", audit.tool));
|
|
3974
3960
|
const timing = options.settings.toolCallTiming ? formatToolCallDuration(audit.startedAt, audit.endedAt) : void 0;
|
|
3975
3961
|
const filePath = argString(audit, "path") ?? "";
|
|
3976
3962
|
if (audit.tool === "bash") {
|
|
@@ -4030,12 +4016,8 @@ var coreToolTitle = (audit, theme, options) => {
|
|
|
4030
4016
|
|
|
4031
4017
|
// src/ui/fabric-render.ts
|
|
4032
4018
|
import { createHash } from "node:crypto";
|
|
4033
|
-
import {
|
|
4034
|
-
|
|
4035
|
-
truncateToWidth as truncateToWidth2,
|
|
4036
|
-
visibleWidth as visibleWidth2,
|
|
4037
|
-
wrapTextWithAnsi
|
|
4038
|
-
} from "@oh-my-pi/pi-tui";
|
|
4019
|
+
import { getKeybindings } from "@oh-my-pi/pi-coding-agent/config/keybindings/keybindings";
|
|
4020
|
+
import { truncate as truncate2, visibleWidth as visibleWidth2, wrap } from "@oh-my-pi/pi-tui/text/width";
|
|
4039
4021
|
var configuredDiffWrapRows = Number.parseInt(
|
|
4040
4022
|
process.env.CODE_PREVIEW_DIFF_WRAP_ROWS ?? "",
|
|
4041
4023
|
10
|
|
@@ -4094,7 +4076,7 @@ var safeTerminalText = (value) => value.replace(/[\u0000-\u0008\u000b-\u001f\u00
|
|
|
4094
4076
|
return `\\x${code}`;
|
|
4095
4077
|
});
|
|
4096
4078
|
var truncateBoundedLine = (line, width) => {
|
|
4097
|
-
const truncated =
|
|
4079
|
+
const truncated = truncate2(line, width, "");
|
|
4098
4080
|
if (visibleWidth2(line) <= width) return truncated;
|
|
4099
4081
|
if (truncated.endsWith(FULL_SGR_RESET)) {
|
|
4100
4082
|
return truncated.slice(0, -FULL_SGR_RESET.length) + TEXT_SGR_RESET;
|
|
@@ -4128,10 +4110,7 @@ var BoundedLineList = class _BoundedLineList {
|
|
|
4128
4110
|
const { kind, line } = parseMarkedDiffLine(rawLine);
|
|
4129
4111
|
if (!kind) {
|
|
4130
4112
|
const continuationIndent = width > 2 ? " " : "";
|
|
4131
|
-
const wrapped =
|
|
4132
|
-
line,
|
|
4133
|
-
Math.max(1, width - visibleWidth2(continuationIndent))
|
|
4134
|
-
);
|
|
4113
|
+
const wrapped = wrap(line, Math.max(1, width - visibleWidth2(continuationIndent)));
|
|
4135
4114
|
if (wrapped.length === 0) wrapped.push("");
|
|
4136
4115
|
const limit = Math.max(1, this.wrapRowLimit ?? wrapped.length);
|
|
4137
4116
|
const kept = wrapped.slice(0, limit);
|
|
@@ -4210,7 +4189,7 @@ var visibleMulticallAudits = (audits, expanded) => {
|
|
|
4210
4189
|
function expandHint(theme) {
|
|
4211
4190
|
let keys = [];
|
|
4212
4191
|
try {
|
|
4213
|
-
keys = getKeybindings().
|
|
4192
|
+
keys = getKeybindings().keysFor(EXPAND_KEYBINDING);
|
|
4214
4193
|
} catch {
|
|
4215
4194
|
keys = [];
|
|
4216
4195
|
}
|
|
@@ -4560,7 +4539,7 @@ var nestedCallTitleText = (audit, theme, invalidate, core) => {
|
|
|
4560
4539
|
const provider = audit.provider ?? ref.split(".")[0] ?? ref;
|
|
4561
4540
|
const tool = audit.tool ?? ref.split(".")[1] ?? ref;
|
|
4562
4541
|
const toolLabel = provider === "judgment" && tool === "ask" ? "judgment.ask" : tool;
|
|
4563
|
-
const title = theme.fg("toolTitle", theme.
|
|
4542
|
+
const title = theme.fg("toolTitle", theme.style("strong", toolLabel));
|
|
4564
4543
|
const args = audit.args ?? {};
|
|
4565
4544
|
const providerDetail = providerCallDetail(
|
|
4566
4545
|
provider,
|
|
@@ -5112,4 +5091,4 @@ export {
|
|
|
5112
5091
|
formatJsonAsYaml,
|
|
5113
5092
|
formatFabricValue
|
|
5114
5093
|
};
|
|
5115
|
-
//# sourceMappingURL=chunk-
|
|
5094
|
+
//# sourceMappingURL=chunk-ZJ7HHWW4.js.map
|