terminal-pilot 0.0.9 → 0.0.11
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/cli.js +214 -48
- package/dist/cli.js.map +4 -4
- package/dist/commands/close-session.js +11 -2
- package/dist/commands/close-session.js.map +2 -2
- package/dist/commands/create-session.js +11 -2
- package/dist/commands/create-session.js.map +2 -2
- package/dist/commands/fill.js +11 -2
- package/dist/commands/fill.js.map +2 -2
- package/dist/commands/get-session.js +11 -2
- package/dist/commands/get-session.js.map +2 -2
- package/dist/commands/index.js +131 -7
- package/dist/commands/index.js.map +4 -4
- package/dist/commands/install.js +123 -7
- package/dist/commands/install.js.map +4 -4
- package/dist/commands/installer.js +41 -1
- package/dist/commands/installer.js.map +3 -3
- package/dist/commands/list-sessions.js +11 -2
- package/dist/commands/list-sessions.js.map +2 -2
- package/dist/commands/press-key.js +11 -2
- package/dist/commands/press-key.js.map +2 -2
- package/dist/commands/read-history.js +11 -2
- package/dist/commands/read-history.js.map +2 -2
- package/dist/commands/read-screen.js +11 -2
- package/dist/commands/read-screen.js.map +2 -2
- package/dist/commands/resize.js +11 -2
- package/dist/commands/resize.js.map +2 -2
- package/dist/commands/runtime.js +8 -0
- package/dist/commands/runtime.js.map +2 -2
- package/dist/commands/screenshot.js +11 -2
- package/dist/commands/screenshot.js.map +2 -2
- package/dist/commands/send-signal.js +11 -2
- package/dist/commands/send-signal.js.map +2 -2
- package/dist/commands/type.js +11 -2
- package/dist/commands/type.js.map +2 -2
- package/dist/commands/uninstall.js +44 -3
- package/dist/commands/uninstall.js.map +3 -3
- package/dist/commands/wait-for-exit.js +11 -2
- package/dist/commands/wait-for-exit.js.map +2 -2
- package/dist/commands/wait-for.js +11 -2
- package/dist/commands/wait-for.js.map +2 -2
- package/dist/index.js +8 -0
- package/dist/index.js.map +2 -2
- package/dist/terminal-buffer.d.ts +1 -0
- package/dist/terminal-buffer.js +8 -0
- package/dist/terminal-buffer.js.map +2 -2
- package/dist/terminal-pilot.js +8 -0
- package/dist/terminal-pilot.js.map +2 -2
- package/dist/terminal-session.js +8 -0
- package/dist/terminal-session.js.map +2 -2
- package/dist/testing/cli-repl.js +214 -48
- package/dist/testing/cli-repl.js.map +4 -4
- package/dist/testing/qa-cli.js +214 -48
- package/dist/testing/qa-cli.js.map +4 -4
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -639,14 +639,27 @@ function renderTable(options) {
|
|
|
639
639
|
|
|
640
640
|
// ../design-system/src/acp/components.ts
|
|
641
641
|
import chalk7 from "chalk";
|
|
642
|
+
|
|
643
|
+
// ../design-system/src/acp/writer.ts
|
|
644
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
645
|
+
var storage = new AsyncLocalStorage2();
|
|
646
|
+
|
|
647
|
+
// ../design-system/src/acp/components.ts
|
|
642
648
|
var AGENT_PREFIX = `${chalk7.green.bold("\u2713")} agent: `;
|
|
643
649
|
|
|
650
|
+
// ../design-system/src/dashboard/buffer.ts
|
|
651
|
+
import chalk8 from "chalk";
|
|
652
|
+
|
|
653
|
+
// ../design-system/src/dashboard/terminal.ts
|
|
654
|
+
import readline from "node:readline";
|
|
655
|
+
import { PassThrough } from "node:stream";
|
|
656
|
+
|
|
644
657
|
// ../design-system/src/prompts/index.ts
|
|
645
|
-
import
|
|
658
|
+
import chalk15 from "chalk";
|
|
646
659
|
import * as clack from "@clack/prompts";
|
|
647
660
|
|
|
648
661
|
// ../design-system/src/prompts/primitives/cancel.ts
|
|
649
|
-
import
|
|
662
|
+
import chalk9 from "chalk";
|
|
650
663
|
|
|
651
664
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
652
665
|
var import_sisteransi = __toESM(require_src(), 1);
|
|
@@ -676,16 +689,16 @@ function cancel(msg = "") {
|
|
|
676
689
|
if (resolveOutputFormat() !== "terminal") {
|
|
677
690
|
return;
|
|
678
691
|
}
|
|
679
|
-
process.stdout.write(`${
|
|
692
|
+
process.stdout.write(`${chalk9.gray("\u2514")} ${chalk9.red(msg)}
|
|
680
693
|
|
|
681
694
|
`);
|
|
682
695
|
}
|
|
683
696
|
|
|
684
697
|
// ../design-system/src/prompts/primitives/intro.ts
|
|
685
|
-
import
|
|
698
|
+
import chalk10 from "chalk";
|
|
686
699
|
|
|
687
700
|
// ../design-system/src/prompts/primitives/note.ts
|
|
688
|
-
import
|
|
701
|
+
import chalk11 from "chalk";
|
|
689
702
|
function getVisibleWidth(value) {
|
|
690
703
|
return stripAnsi(value).length;
|
|
691
704
|
}
|
|
@@ -696,15 +709,15 @@ function renderTerminalNote(message2, title) {
|
|
|
696
709
|
visibleTitle.length,
|
|
697
710
|
...contentLines.map((line) => getVisibleWidth(line))
|
|
698
711
|
) + 2;
|
|
699
|
-
const titleLine = `${
|
|
712
|
+
const titleLine = `${chalk11.green("\u25C7")} ${chalk11.reset(title ?? "")} ${chalk11.gray(
|
|
700
713
|
`${"\u2500".repeat(Math.max(contentWidth - visibleTitle.length - 1, 1))}\u256E`
|
|
701
714
|
)}`;
|
|
702
715
|
const content = contentLines.map((line) => {
|
|
703
716
|
const padding = " ".repeat(contentWidth - getVisibleWidth(line));
|
|
704
|
-
return `${
|
|
717
|
+
return `${chalk11.gray("\u2502")} ${line}${padding}${chalk11.gray("\u2502")}`;
|
|
705
718
|
});
|
|
706
|
-
const bottom =
|
|
707
|
-
return [
|
|
719
|
+
const bottom = chalk11.gray(`\u251C${"\u2500".repeat(contentWidth + 2)}\u256F`);
|
|
720
|
+
return [chalk11.gray("\u2502"), titleLine, ...content, bottom].join("\n");
|
|
708
721
|
}
|
|
709
722
|
function note(message2, title) {
|
|
710
723
|
const format = resolveOutputFormat();
|
|
@@ -735,13 +748,13 @@ function note(message2, title) {
|
|
|
735
748
|
}
|
|
736
749
|
|
|
737
750
|
// ../design-system/src/prompts/primitives/outro.ts
|
|
738
|
-
import
|
|
751
|
+
import chalk12 from "chalk";
|
|
739
752
|
|
|
740
753
|
// ../design-system/src/prompts/primitives/spinner.ts
|
|
741
|
-
import
|
|
754
|
+
import chalk14 from "chalk";
|
|
742
755
|
|
|
743
756
|
// ../design-system/src/static/spinner.ts
|
|
744
|
-
import
|
|
757
|
+
import chalk13 from "chalk";
|
|
745
758
|
|
|
746
759
|
// ../design-system/src/prompts/index.ts
|
|
747
760
|
async function select2(opts) {
|
|
@@ -755,7 +768,7 @@ async function confirm2(opts) {
|
|
|
755
768
|
}
|
|
756
769
|
|
|
757
770
|
// ../design-system/src/static/menu.ts
|
|
758
|
-
import
|
|
771
|
+
import chalk16 from "chalk";
|
|
759
772
|
|
|
760
773
|
// ../cmdkit/src/index.ts
|
|
761
774
|
import { fileURLToPath } from "node:url";
|
|
@@ -804,10 +817,11 @@ var S = {
|
|
|
804
817
|
...options
|
|
805
818
|
};
|
|
806
819
|
},
|
|
807
|
-
Object(shape) {
|
|
820
|
+
Object(shape, options = {}) {
|
|
808
821
|
return {
|
|
809
822
|
kind: "object",
|
|
810
|
-
shape
|
|
823
|
+
shape,
|
|
824
|
+
...options
|
|
811
825
|
};
|
|
812
826
|
},
|
|
813
827
|
Optional(inner) {
|
|
@@ -1191,6 +1205,14 @@ function getCommandSourcePath(command) {
|
|
|
1191
1205
|
return command[commandSourcePathSymbol];
|
|
1192
1206
|
}
|
|
1193
1207
|
|
|
1208
|
+
// ../cmdkit/src/number-schema.ts
|
|
1209
|
+
function isValidNumberSchemaValue(value, schema) {
|
|
1210
|
+
return typeof value === "number" && Number.isFinite(value) && (schema.jsonType !== "integer" || Number.isInteger(value));
|
|
1211
|
+
}
|
|
1212
|
+
function getExpectedNumberDescription(schema) {
|
|
1213
|
+
return schema.jsonType === "integer" ? "an integer" : "a number";
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1194
1216
|
// ../cmdkit/src/renderer.ts
|
|
1195
1217
|
function isObject(value) {
|
|
1196
1218
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -1541,8 +1563,10 @@ function parseScalarValue(value, schema, label) {
|
|
|
1541
1563
|
return value;
|
|
1542
1564
|
case "number": {
|
|
1543
1565
|
const parsed = Number(value);
|
|
1544
|
-
if (!
|
|
1545
|
-
throw new InvalidArgumentError(
|
|
1566
|
+
if (!isValidNumberSchemaValue(parsed, schema)) {
|
|
1567
|
+
throw new InvalidArgumentError(
|
|
1568
|
+
`Invalid value for "${label}". Expected ${getExpectedNumberDescription(schema)}.`
|
|
1569
|
+
);
|
|
1546
1570
|
}
|
|
1547
1571
|
return parsed;
|
|
1548
1572
|
}
|
|
@@ -1630,6 +1654,9 @@ function resolveHelpOutput(argv) {
|
|
|
1630
1654
|
if (value === "rich" || value === "md" || value === "json") {
|
|
1631
1655
|
return value;
|
|
1632
1656
|
}
|
|
1657
|
+
if (value === "markdown") {
|
|
1658
|
+
return "md";
|
|
1659
|
+
}
|
|
1633
1660
|
continue;
|
|
1634
1661
|
}
|
|
1635
1662
|
if (token.startsWith("--output=")) {
|
|
@@ -1637,6 +1664,9 @@ function resolveHelpOutput(argv) {
|
|
|
1637
1664
|
if (value === "rich" || value === "md" || value === "json") {
|
|
1638
1665
|
return value;
|
|
1639
1666
|
}
|
|
1667
|
+
if (value === "markdown") {
|
|
1668
|
+
return "md";
|
|
1669
|
+
}
|
|
1640
1670
|
}
|
|
1641
1671
|
}
|
|
1642
1672
|
return "rich";
|
|
@@ -1645,7 +1675,7 @@ function isNodeVisibleInScope(node, scope) {
|
|
|
1645
1675
|
if (node.kind === "command") {
|
|
1646
1676
|
return node.scope.includes(scope);
|
|
1647
1677
|
}
|
|
1648
|
-
return getVisibleChildren(node, scope).length > 0 || Boolean(node.default && node.default.scope.includes(scope));
|
|
1678
|
+
return getVisibleChildren(node, scope).length > 0 || Boolean(node.default && node.default.scope.includes(scope)) || node.scope === void 0 || node.scope.includes(scope);
|
|
1649
1679
|
}
|
|
1650
1680
|
function getVisibleChildren(group, scope) {
|
|
1651
1681
|
return group.children.filter((child) => isNodeVisibleInScope(child, scope));
|
|
@@ -1887,10 +1917,10 @@ function createNodeCommand(node, casing, execute) {
|
|
|
1887
1917
|
});
|
|
1888
1918
|
return command;
|
|
1889
1919
|
}
|
|
1890
|
-
|
|
1891
|
-
if (visibleChildren.length === 0 && node.default === void 0) {
|
|
1920
|
+
if (!isNodeVisibleInScope(node, "cli")) {
|
|
1892
1921
|
return null;
|
|
1893
1922
|
}
|
|
1923
|
+
const visibleChildren = node.children.map((child) => createNodeCommand(child, casing, execute)).filter((child) => child !== null);
|
|
1894
1924
|
const group = new CommanderCommand(node.name);
|
|
1895
1925
|
if (node.description !== void 0) {
|
|
1896
1926
|
group.description(node.description);
|
|
@@ -1909,7 +1939,10 @@ function addGlobalOptions(command) {
|
|
|
1909
1939
|
if (value === "rich" || value === "md" || value === "json") {
|
|
1910
1940
|
return value;
|
|
1911
1941
|
}
|
|
1912
|
-
|
|
1942
|
+
if (value === "markdown") {
|
|
1943
|
+
return "md";
|
|
1944
|
+
}
|
|
1945
|
+
throw new InvalidArgumentError('Invalid value for "--output". Expected one of: rich, md, markdown, json.');
|
|
1913
1946
|
}).option("--verbose", "Print stack traces for unexpected errors.");
|
|
1914
1947
|
}
|
|
1915
1948
|
function setNestedValue(target, path6, value) {
|
|
@@ -1987,20 +2020,22 @@ async function promptForField(field) {
|
|
|
1987
2020
|
}
|
|
1988
2021
|
return parseScalarValue(entered, field.schema, field.displayPath);
|
|
1989
2022
|
}
|
|
1990
|
-
function resolveOutput(
|
|
1991
|
-
if (
|
|
1992
|
-
return
|
|
2023
|
+
function resolveOutput(resolvedFlags) {
|
|
2024
|
+
if (resolvedFlags.json === true) {
|
|
2025
|
+
return "json";
|
|
2026
|
+
}
|
|
2027
|
+
if (resolvedFlags.output !== void 0) {
|
|
2028
|
+
return resolvedFlags.output;
|
|
1993
2029
|
}
|
|
1994
2030
|
return "rich";
|
|
1995
2031
|
}
|
|
2032
|
+
var DESIGN_SYSTEM_OUTPUT_BY_MODE = {
|
|
2033
|
+
rich: "terminal",
|
|
2034
|
+
md: "markdown",
|
|
2035
|
+
json: "json"
|
|
2036
|
+
};
|
|
1996
2037
|
function toDesignSystemOutput(output) {
|
|
1997
|
-
|
|
1998
|
-
return "markdown";
|
|
1999
|
-
}
|
|
2000
|
-
if (output === "json") {
|
|
2001
|
-
return "json";
|
|
2002
|
-
}
|
|
2003
|
-
return "terminal";
|
|
2038
|
+
return DESIGN_SYSTEM_OUTPUT_BY_MODE[output];
|
|
2004
2039
|
}
|
|
2005
2040
|
async function withOutputFormat2(output, fn) {
|
|
2006
2041
|
const previous = process.env.OUTPUT_FORMAT;
|
|
@@ -2009,7 +2044,11 @@ async function withOutputFormat2(output, fn) {
|
|
|
2009
2044
|
try {
|
|
2010
2045
|
return await fn();
|
|
2011
2046
|
} finally {
|
|
2012
|
-
|
|
2047
|
+
if (previous === void 0) {
|
|
2048
|
+
delete process.env.OUTPUT_FORMAT;
|
|
2049
|
+
} else {
|
|
2050
|
+
process.env.OUTPUT_FORMAT = previous;
|
|
2051
|
+
}
|
|
2013
2052
|
resetOutputFormatCache();
|
|
2014
2053
|
}
|
|
2015
2054
|
}
|
|
@@ -2057,6 +2096,9 @@ function describeExpectedPresetValue(schema) {
|
|
|
2057
2096
|
return `a ${schema.kind}`;
|
|
2058
2097
|
}
|
|
2059
2098
|
function validatePresetScalarValue(value, schema, fieldPath, presetPath) {
|
|
2099
|
+
if (value === null && schema.nullable === true) {
|
|
2100
|
+
return null;
|
|
2101
|
+
}
|
|
2060
2102
|
switch (schema.kind) {
|
|
2061
2103
|
case "string":
|
|
2062
2104
|
if (typeof value !== "string") {
|
|
@@ -2064,7 +2106,7 @@ function validatePresetScalarValue(value, schema, fieldPath, presetPath) {
|
|
|
2064
2106
|
}
|
|
2065
2107
|
return value;
|
|
2066
2108
|
case "number":
|
|
2067
|
-
if (
|
|
2109
|
+
if (!isValidNumberSchemaValue(value, schema)) {
|
|
2068
2110
|
break;
|
|
2069
2111
|
}
|
|
2070
2112
|
return value;
|
|
@@ -2482,7 +2524,7 @@ async function resolveParams(fields, positionalValues, optionValues, presetPath,
|
|
|
2482
2524
|
}
|
|
2483
2525
|
return params17;
|
|
2484
2526
|
}
|
|
2485
|
-
function
|
|
2527
|
+
function getResolvedFlags(command) {
|
|
2486
2528
|
const flags = command.optsWithGlobals();
|
|
2487
2529
|
return flags;
|
|
2488
2530
|
}
|
|
@@ -2494,9 +2536,10 @@ async function executeCommand(state, services, requirementOptions) {
|
|
|
2494
2536
|
getTheme,
|
|
2495
2537
|
note
|
|
2496
2538
|
};
|
|
2497
|
-
const
|
|
2498
|
-
const
|
|
2499
|
-
const
|
|
2539
|
+
const optionValues = state.actionCommand.optsWithGlobals();
|
|
2540
|
+
const resolvedFlags = optionValues;
|
|
2541
|
+
const output = resolveOutput(resolvedFlags);
|
|
2542
|
+
const shouldPrompt = !resolvedFlags.yes && Boolean(process.stdin.isTTY);
|
|
2500
2543
|
const runtime = await resolveFixtureRuntime(state.command, services, requirementOptions);
|
|
2501
2544
|
const preflightContext = {
|
|
2502
2545
|
...runtime.services,
|
|
@@ -2513,15 +2556,15 @@ async function executeCommand(state, services, requirementOptions) {
|
|
|
2513
2556
|
const params17 = await resolveParams(
|
|
2514
2557
|
state.fields,
|
|
2515
2558
|
state.positionalValues,
|
|
2516
|
-
|
|
2517
|
-
|
|
2559
|
+
optionValues,
|
|
2560
|
+
resolvedFlags.preset,
|
|
2518
2561
|
shouldPrompt
|
|
2519
2562
|
);
|
|
2520
2563
|
const context = {
|
|
2521
2564
|
...preflightContext,
|
|
2522
2565
|
params: params17
|
|
2523
2566
|
};
|
|
2524
|
-
if (state.command.confirm && !
|
|
2567
|
+
if (state.command.confirm && !resolvedFlags.yes && process.stdin.isTTY) {
|
|
2525
2568
|
for (const field of state.fields) {
|
|
2526
2569
|
const value = field.path.reduce(
|
|
2527
2570
|
(current, segment) => current && typeof current === "object" ? current[segment] : void 0,
|
|
@@ -2597,7 +2640,7 @@ async function runCLI(roots, options = {}) {
|
|
|
2597
2640
|
try {
|
|
2598
2641
|
await executeCommand(state, services, requirementOptions);
|
|
2599
2642
|
} catch (error2) {
|
|
2600
|
-
handleRunError(error2, Boolean(
|
|
2643
|
+
handleRunError(error2, Boolean(getResolvedFlags(state.actionCommand).verbose));
|
|
2601
2644
|
}
|
|
2602
2645
|
};
|
|
2603
2646
|
for (const child of root.children) {
|
|
@@ -2712,6 +2755,7 @@ var TerminalBuffer = class {
|
|
|
2712
2755
|
_state = 0 /* Normal */;
|
|
2713
2756
|
_csiParams = "";
|
|
2714
2757
|
_csiPrivate = "";
|
|
2758
|
+
_autoWrap = true;
|
|
2715
2759
|
_style = createDefaultStyleState();
|
|
2716
2760
|
_styleSequence = "";
|
|
2717
2761
|
displayBuffer;
|
|
@@ -2839,6 +2883,9 @@ var TerminalBuffer = class {
|
|
|
2839
2883
|
const p1 = params17[1] ?? 0;
|
|
2840
2884
|
if (this._csiPrivate === "?") {
|
|
2841
2885
|
if (final === "h" || final === "l") {
|
|
2886
|
+
if (params17.includes(7)) {
|
|
2887
|
+
this._autoWrap = final === "h";
|
|
2888
|
+
}
|
|
2842
2889
|
if (params17.includes(1049)) {
|
|
2843
2890
|
if (final === "h") {
|
|
2844
2891
|
this._screen = this._makeScreen(this._cols, this._rows);
|
|
@@ -3053,6 +3100,10 @@ var TerminalBuffer = class {
|
|
|
3053
3100
|
} else if (code >= 32 && code !== 127) {
|
|
3054
3101
|
this._setChar(this._cursorY, this._cursorX, ch);
|
|
3055
3102
|
this._cursorX++;
|
|
3103
|
+
if (!this._autoWrap) {
|
|
3104
|
+
this._cursorX = Math.min(this._cursorX, this._cols - 1);
|
|
3105
|
+
return;
|
|
3106
|
+
}
|
|
3056
3107
|
if (this._cursorX >= this._cols) {
|
|
3057
3108
|
this._cursorX = 0;
|
|
3058
3109
|
this._newline();
|
|
@@ -3967,13 +4018,46 @@ var kimiAgent = {
|
|
|
3967
4018
|
}
|
|
3968
4019
|
};
|
|
3969
4020
|
|
|
4021
|
+
// ../agent-defs/src/agents/goose.ts
|
|
4022
|
+
var gooseAgent = {
|
|
4023
|
+
id: "goose",
|
|
4024
|
+
name: "goose",
|
|
4025
|
+
label: "Goose",
|
|
4026
|
+
summary: "Block's open-source AI agent with ACP support.",
|
|
4027
|
+
binaryName: "goose",
|
|
4028
|
+
configPath: "~/.config/goose/config.yaml",
|
|
4029
|
+
branding: {
|
|
4030
|
+
colors: {
|
|
4031
|
+
dark: "#FF6B35",
|
|
4032
|
+
light: "#E85D26"
|
|
4033
|
+
}
|
|
4034
|
+
}
|
|
4035
|
+
};
|
|
4036
|
+
|
|
4037
|
+
// ../agent-defs/src/agents/poe-agent.ts
|
|
4038
|
+
var poeAgentAgent = {
|
|
4039
|
+
id: "poe-agent",
|
|
4040
|
+
name: "poe-agent",
|
|
4041
|
+
label: "Poe Agent",
|
|
4042
|
+
summary: "Run one-shot prompts with the built-in Poe agent runtime.",
|
|
4043
|
+
configPath: "~/.poe-code/config.json",
|
|
4044
|
+
branding: {
|
|
4045
|
+
colors: {
|
|
4046
|
+
dark: "#A465F7",
|
|
4047
|
+
light: "#7A3FD3"
|
|
4048
|
+
}
|
|
4049
|
+
}
|
|
4050
|
+
};
|
|
4051
|
+
|
|
3970
4052
|
// ../agent-defs/src/registry.ts
|
|
3971
4053
|
var allAgents = [
|
|
3972
4054
|
claudeCodeAgent,
|
|
3973
4055
|
claudeDesktopAgent,
|
|
3974
4056
|
codexAgent,
|
|
3975
4057
|
openCodeAgent,
|
|
3976
|
-
kimiAgent
|
|
4058
|
+
kimiAgent,
|
|
4059
|
+
gooseAgent,
|
|
4060
|
+
poeAgentAgent
|
|
3977
4061
|
];
|
|
3978
4062
|
var lookup = /* @__PURE__ */ new Map();
|
|
3979
4063
|
for (const agent of allAgents) {
|
|
@@ -4005,6 +4089,10 @@ var agentSkillConfigs = {
|
|
|
4005
4089
|
opencode: {
|
|
4006
4090
|
globalSkillDir: "~/.config/opencode/skills",
|
|
4007
4091
|
localSkillDir: ".opencode/skills"
|
|
4092
|
+
},
|
|
4093
|
+
goose: {
|
|
4094
|
+
globalSkillDir: "~/.agents/skills",
|
|
4095
|
+
localSkillDir: ".agents/skills"
|
|
4008
4096
|
}
|
|
4009
4097
|
};
|
|
4010
4098
|
var supportedAgents = Object.keys(agentSkillConfigs);
|
|
@@ -4268,14 +4356,92 @@ var tomlFormat = {
|
|
|
4268
4356
|
prune: prune2
|
|
4269
4357
|
};
|
|
4270
4358
|
|
|
4359
|
+
// ../config-mutations/src/formats/yaml.ts
|
|
4360
|
+
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
4361
|
+
function isConfigObject3(value) {
|
|
4362
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4363
|
+
}
|
|
4364
|
+
function parse5(content) {
|
|
4365
|
+
if (!content || content.trim() === "") {
|
|
4366
|
+
return {};
|
|
4367
|
+
}
|
|
4368
|
+
const parsed = parseYaml(content);
|
|
4369
|
+
if (parsed === null || parsed === void 0) {
|
|
4370
|
+
return {};
|
|
4371
|
+
}
|
|
4372
|
+
if (!isConfigObject3(parsed)) {
|
|
4373
|
+
throw new Error("Expected YAML object.");
|
|
4374
|
+
}
|
|
4375
|
+
return parsed;
|
|
4376
|
+
}
|
|
4377
|
+
function serialize3(obj) {
|
|
4378
|
+
const serialized = stringifyYaml(obj);
|
|
4379
|
+
return serialized.endsWith("\n") ? serialized : `${serialized}
|
|
4380
|
+
`;
|
|
4381
|
+
}
|
|
4382
|
+
function merge3(base, patch) {
|
|
4383
|
+
const result = { ...base };
|
|
4384
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
4385
|
+
if (value === void 0) {
|
|
4386
|
+
continue;
|
|
4387
|
+
}
|
|
4388
|
+
const existing = result[key];
|
|
4389
|
+
if (isConfigObject3(existing) && isConfigObject3(value)) {
|
|
4390
|
+
result[key] = merge3(existing, value);
|
|
4391
|
+
continue;
|
|
4392
|
+
}
|
|
4393
|
+
result[key] = value;
|
|
4394
|
+
}
|
|
4395
|
+
return result;
|
|
4396
|
+
}
|
|
4397
|
+
function prune3(obj, shape) {
|
|
4398
|
+
let changed = false;
|
|
4399
|
+
const result = { ...obj };
|
|
4400
|
+
for (const [key, pattern] of Object.entries(shape)) {
|
|
4401
|
+
if (!(key in result)) {
|
|
4402
|
+
continue;
|
|
4403
|
+
}
|
|
4404
|
+
const current = result[key];
|
|
4405
|
+
if (isConfigObject3(pattern) && Object.keys(pattern).length === 0) {
|
|
4406
|
+
delete result[key];
|
|
4407
|
+
changed = true;
|
|
4408
|
+
continue;
|
|
4409
|
+
}
|
|
4410
|
+
if (isConfigObject3(pattern) && isConfigObject3(current)) {
|
|
4411
|
+
const { changed: childChanged, result: childResult } = prune3(current, pattern);
|
|
4412
|
+
if (childChanged) {
|
|
4413
|
+
changed = true;
|
|
4414
|
+
}
|
|
4415
|
+
if (Object.keys(childResult).length === 0) {
|
|
4416
|
+
delete result[key];
|
|
4417
|
+
} else {
|
|
4418
|
+
result[key] = childResult;
|
|
4419
|
+
}
|
|
4420
|
+
continue;
|
|
4421
|
+
}
|
|
4422
|
+
delete result[key];
|
|
4423
|
+
changed = true;
|
|
4424
|
+
}
|
|
4425
|
+
return { changed, result };
|
|
4426
|
+
}
|
|
4427
|
+
var yamlFormat = {
|
|
4428
|
+
parse: parse5,
|
|
4429
|
+
serialize: serialize3,
|
|
4430
|
+
merge: merge3,
|
|
4431
|
+
prune: prune3
|
|
4432
|
+
};
|
|
4433
|
+
|
|
4271
4434
|
// ../config-mutations/src/formats/index.ts
|
|
4272
4435
|
var formatRegistry = {
|
|
4273
4436
|
json: jsonFormat,
|
|
4274
|
-
toml: tomlFormat
|
|
4437
|
+
toml: tomlFormat,
|
|
4438
|
+
yaml: yamlFormat
|
|
4275
4439
|
};
|
|
4276
4440
|
var extensionMap = {
|
|
4277
4441
|
".json": "json",
|
|
4278
|
-
".toml": "toml"
|
|
4442
|
+
".toml": "toml",
|
|
4443
|
+
".yaml": "yaml",
|
|
4444
|
+
".yml": "yaml"
|
|
4279
4445
|
};
|
|
4280
4446
|
function getConfigFormat(pathOrFormat) {
|
|
4281
4447
|
if (pathOrFormat in formatRegistry) {
|
|
@@ -4424,7 +4590,7 @@ function pruneKeysByPrefix(table, prefix) {
|
|
|
4424
4590
|
}
|
|
4425
4591
|
return result;
|
|
4426
4592
|
}
|
|
4427
|
-
function
|
|
4593
|
+
function isConfigObject4(value) {
|
|
4428
4594
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4429
4595
|
}
|
|
4430
4596
|
function mergeWithPruneByPrefix(base, patch, pruneByPrefix) {
|
|
@@ -4433,7 +4599,7 @@ function mergeWithPruneByPrefix(base, patch, pruneByPrefix) {
|
|
|
4433
4599
|
for (const [key, value] of Object.entries(patch)) {
|
|
4434
4600
|
const current = result[key];
|
|
4435
4601
|
const prefix = prefixMap[key];
|
|
4436
|
-
if (
|
|
4602
|
+
if (isConfigObject4(current) && isConfigObject4(value)) {
|
|
4437
4603
|
if (prefix) {
|
|
4438
4604
|
const pruned = pruneKeysByPrefix(current, prefix);
|
|
4439
4605
|
result[key] = { ...pruned, ...value };
|
|
@@ -5457,7 +5623,7 @@ function applySgr(style, paramsText) {
|
|
|
5457
5623
|
}
|
|
5458
5624
|
return nextStyle;
|
|
5459
5625
|
}
|
|
5460
|
-
function
|
|
5626
|
+
function parseAnsi2(input) {
|
|
5461
5627
|
const runs = [];
|
|
5462
5628
|
let style = createDefaultStyle();
|
|
5463
5629
|
let textStart = 0;
|
|
@@ -5992,7 +6158,7 @@ function formatNumber(value) {
|
|
|
5992
6158
|
|
|
5993
6159
|
// ../terminal-png/src/index.ts
|
|
5994
6160
|
async function renderTerminalPng(ansiText, options = {}) {
|
|
5995
|
-
const runs =
|
|
6161
|
+
const runs = parseAnsi2(ansiText);
|
|
5996
6162
|
const svg = renderSvg(runs, {
|
|
5997
6163
|
padding: options.padding,
|
|
5998
6164
|
window: options.window
|