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/testing/qa-cli.js
CHANGED
|
@@ -718,14 +718,27 @@ function renderTable(options) {
|
|
|
718
718
|
|
|
719
719
|
// ../design-system/src/acp/components.ts
|
|
720
720
|
import chalk7 from "chalk";
|
|
721
|
+
|
|
722
|
+
// ../design-system/src/acp/writer.ts
|
|
723
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
724
|
+
var storage = new AsyncLocalStorage2();
|
|
725
|
+
|
|
726
|
+
// ../design-system/src/acp/components.ts
|
|
721
727
|
var AGENT_PREFIX = `${chalk7.green.bold("\u2713")} agent: `;
|
|
722
728
|
|
|
729
|
+
// ../design-system/src/dashboard/buffer.ts
|
|
730
|
+
import chalk8 from "chalk";
|
|
731
|
+
|
|
732
|
+
// ../design-system/src/dashboard/terminal.ts
|
|
733
|
+
import readline from "node:readline";
|
|
734
|
+
import { PassThrough } from "node:stream";
|
|
735
|
+
|
|
723
736
|
// ../design-system/src/prompts/index.ts
|
|
724
|
-
import
|
|
737
|
+
import chalk15 from "chalk";
|
|
725
738
|
import * as clack from "@clack/prompts";
|
|
726
739
|
|
|
727
740
|
// ../design-system/src/prompts/primitives/cancel.ts
|
|
728
|
-
import
|
|
741
|
+
import chalk9 from "chalk";
|
|
729
742
|
|
|
730
743
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
731
744
|
var import_sisteransi = __toESM(require_src(), 1);
|
|
@@ -755,16 +768,16 @@ function cancel(msg = "") {
|
|
|
755
768
|
if (resolveOutputFormat() !== "terminal") {
|
|
756
769
|
return;
|
|
757
770
|
}
|
|
758
|
-
process.stdout.write(`${
|
|
771
|
+
process.stdout.write(`${chalk9.gray("\u2514")} ${chalk9.red(msg)}
|
|
759
772
|
|
|
760
773
|
`);
|
|
761
774
|
}
|
|
762
775
|
|
|
763
776
|
// ../design-system/src/prompts/primitives/intro.ts
|
|
764
|
-
import
|
|
777
|
+
import chalk10 from "chalk";
|
|
765
778
|
|
|
766
779
|
// ../design-system/src/prompts/primitives/note.ts
|
|
767
|
-
import
|
|
780
|
+
import chalk11 from "chalk";
|
|
768
781
|
function getVisibleWidth(value) {
|
|
769
782
|
return stripAnsi2(value).length;
|
|
770
783
|
}
|
|
@@ -775,15 +788,15 @@ function renderTerminalNote(message2, title) {
|
|
|
775
788
|
visibleTitle.length,
|
|
776
789
|
...contentLines.map((line) => getVisibleWidth(line))
|
|
777
790
|
) + 2;
|
|
778
|
-
const titleLine = `${
|
|
791
|
+
const titleLine = `${chalk11.green("\u25C7")} ${chalk11.reset(title ?? "")} ${chalk11.gray(
|
|
779
792
|
`${"\u2500".repeat(Math.max(contentWidth - visibleTitle.length - 1, 1))}\u256E`
|
|
780
793
|
)}`;
|
|
781
794
|
const content = contentLines.map((line) => {
|
|
782
795
|
const padding = " ".repeat(contentWidth - getVisibleWidth(line));
|
|
783
|
-
return `${
|
|
796
|
+
return `${chalk11.gray("\u2502")} ${line}${padding}${chalk11.gray("\u2502")}`;
|
|
784
797
|
});
|
|
785
|
-
const bottom =
|
|
786
|
-
return [
|
|
798
|
+
const bottom = chalk11.gray(`\u251C${"\u2500".repeat(contentWidth + 2)}\u256F`);
|
|
799
|
+
return [chalk11.gray("\u2502"), titleLine, ...content, bottom].join("\n");
|
|
787
800
|
}
|
|
788
801
|
function note(message2, title) {
|
|
789
802
|
const format = resolveOutputFormat();
|
|
@@ -814,13 +827,13 @@ function note(message2, title) {
|
|
|
814
827
|
}
|
|
815
828
|
|
|
816
829
|
// ../design-system/src/prompts/primitives/outro.ts
|
|
817
|
-
import
|
|
830
|
+
import chalk12 from "chalk";
|
|
818
831
|
|
|
819
832
|
// ../design-system/src/prompts/primitives/spinner.ts
|
|
820
|
-
import
|
|
833
|
+
import chalk14 from "chalk";
|
|
821
834
|
|
|
822
835
|
// ../design-system/src/static/spinner.ts
|
|
823
|
-
import
|
|
836
|
+
import chalk13 from "chalk";
|
|
824
837
|
|
|
825
838
|
// ../design-system/src/prompts/index.ts
|
|
826
839
|
async function select2(opts) {
|
|
@@ -834,7 +847,7 @@ async function confirm2(opts) {
|
|
|
834
847
|
}
|
|
835
848
|
|
|
836
849
|
// ../design-system/src/static/menu.ts
|
|
837
|
-
import
|
|
850
|
+
import chalk16 from "chalk";
|
|
838
851
|
|
|
839
852
|
// ../cmdkit/src/index.ts
|
|
840
853
|
import { fileURLToPath } from "node:url";
|
|
@@ -883,10 +896,11 @@ var S = {
|
|
|
883
896
|
...options
|
|
884
897
|
};
|
|
885
898
|
},
|
|
886
|
-
Object(shape) {
|
|
899
|
+
Object(shape, options = {}) {
|
|
887
900
|
return {
|
|
888
901
|
kind: "object",
|
|
889
|
-
shape
|
|
902
|
+
shape,
|
|
903
|
+
...options
|
|
890
904
|
};
|
|
891
905
|
},
|
|
892
906
|
Optional(inner) {
|
|
@@ -1270,6 +1284,14 @@ function getCommandSourcePath(command) {
|
|
|
1270
1284
|
return command[commandSourcePathSymbol];
|
|
1271
1285
|
}
|
|
1272
1286
|
|
|
1287
|
+
// ../cmdkit/src/number-schema.ts
|
|
1288
|
+
function isValidNumberSchemaValue(value, schema) {
|
|
1289
|
+
return typeof value === "number" && Number.isFinite(value) && (schema.jsonType !== "integer" || Number.isInteger(value));
|
|
1290
|
+
}
|
|
1291
|
+
function getExpectedNumberDescription(schema) {
|
|
1292
|
+
return schema.jsonType === "integer" ? "an integer" : "a number";
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1273
1295
|
// ../cmdkit/src/renderer.ts
|
|
1274
1296
|
function isObject(value) {
|
|
1275
1297
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -1620,8 +1642,10 @@ function parseScalarValue(value, schema, label) {
|
|
|
1620
1642
|
return value;
|
|
1621
1643
|
case "number": {
|
|
1622
1644
|
const parsed = Number(value);
|
|
1623
|
-
if (!
|
|
1624
|
-
throw new InvalidArgumentError(
|
|
1645
|
+
if (!isValidNumberSchemaValue(parsed, schema)) {
|
|
1646
|
+
throw new InvalidArgumentError(
|
|
1647
|
+
`Invalid value for "${label}". Expected ${getExpectedNumberDescription(schema)}.`
|
|
1648
|
+
);
|
|
1625
1649
|
}
|
|
1626
1650
|
return parsed;
|
|
1627
1651
|
}
|
|
@@ -1709,6 +1733,9 @@ function resolveHelpOutput(argv) {
|
|
|
1709
1733
|
if (value === "rich" || value === "md" || value === "json") {
|
|
1710
1734
|
return value;
|
|
1711
1735
|
}
|
|
1736
|
+
if (value === "markdown") {
|
|
1737
|
+
return "md";
|
|
1738
|
+
}
|
|
1712
1739
|
continue;
|
|
1713
1740
|
}
|
|
1714
1741
|
if (token.startsWith("--output=")) {
|
|
@@ -1716,6 +1743,9 @@ function resolveHelpOutput(argv) {
|
|
|
1716
1743
|
if (value === "rich" || value === "md" || value === "json") {
|
|
1717
1744
|
return value;
|
|
1718
1745
|
}
|
|
1746
|
+
if (value === "markdown") {
|
|
1747
|
+
return "md";
|
|
1748
|
+
}
|
|
1719
1749
|
}
|
|
1720
1750
|
}
|
|
1721
1751
|
return "rich";
|
|
@@ -1724,7 +1754,7 @@ function isNodeVisibleInScope(node, scope) {
|
|
|
1724
1754
|
if (node.kind === "command") {
|
|
1725
1755
|
return node.scope.includes(scope);
|
|
1726
1756
|
}
|
|
1727
|
-
return getVisibleChildren(node, scope).length > 0 || Boolean(node.default && node.default.scope.includes(scope));
|
|
1757
|
+
return getVisibleChildren(node, scope).length > 0 || Boolean(node.default && node.default.scope.includes(scope)) || node.scope === void 0 || node.scope.includes(scope);
|
|
1728
1758
|
}
|
|
1729
1759
|
function getVisibleChildren(group, scope) {
|
|
1730
1760
|
return group.children.filter((child) => isNodeVisibleInScope(child, scope));
|
|
@@ -1966,10 +1996,10 @@ function createNodeCommand(node, casing, execute) {
|
|
|
1966
1996
|
});
|
|
1967
1997
|
return command;
|
|
1968
1998
|
}
|
|
1969
|
-
|
|
1970
|
-
if (visibleChildren.length === 0 && node.default === void 0) {
|
|
1999
|
+
if (!isNodeVisibleInScope(node, "cli")) {
|
|
1971
2000
|
return null;
|
|
1972
2001
|
}
|
|
2002
|
+
const visibleChildren = node.children.map((child) => createNodeCommand(child, casing, execute)).filter((child) => child !== null);
|
|
1973
2003
|
const group = new CommanderCommand(node.name);
|
|
1974
2004
|
if (node.description !== void 0) {
|
|
1975
2005
|
group.description(node.description);
|
|
@@ -1988,7 +2018,10 @@ function addGlobalOptions(command) {
|
|
|
1988
2018
|
if (value === "rich" || value === "md" || value === "json") {
|
|
1989
2019
|
return value;
|
|
1990
2020
|
}
|
|
1991
|
-
|
|
2021
|
+
if (value === "markdown") {
|
|
2022
|
+
return "md";
|
|
2023
|
+
}
|
|
2024
|
+
throw new InvalidArgumentError('Invalid value for "--output". Expected one of: rich, md, markdown, json.');
|
|
1992
2025
|
}).option("--verbose", "Print stack traces for unexpected errors.");
|
|
1993
2026
|
}
|
|
1994
2027
|
function setNestedValue(target, path7, value) {
|
|
@@ -2066,20 +2099,22 @@ async function promptForField(field) {
|
|
|
2066
2099
|
}
|
|
2067
2100
|
return parseScalarValue(entered, field.schema, field.displayPath);
|
|
2068
2101
|
}
|
|
2069
|
-
function resolveOutput(
|
|
2070
|
-
if (
|
|
2071
|
-
return
|
|
2102
|
+
function resolveOutput(resolvedFlags) {
|
|
2103
|
+
if (resolvedFlags.json === true) {
|
|
2104
|
+
return "json";
|
|
2105
|
+
}
|
|
2106
|
+
if (resolvedFlags.output !== void 0) {
|
|
2107
|
+
return resolvedFlags.output;
|
|
2072
2108
|
}
|
|
2073
2109
|
return "rich";
|
|
2074
2110
|
}
|
|
2111
|
+
var DESIGN_SYSTEM_OUTPUT_BY_MODE = {
|
|
2112
|
+
rich: "terminal",
|
|
2113
|
+
md: "markdown",
|
|
2114
|
+
json: "json"
|
|
2115
|
+
};
|
|
2075
2116
|
function toDesignSystemOutput(output) {
|
|
2076
|
-
|
|
2077
|
-
return "markdown";
|
|
2078
|
-
}
|
|
2079
|
-
if (output === "json") {
|
|
2080
|
-
return "json";
|
|
2081
|
-
}
|
|
2082
|
-
return "terminal";
|
|
2117
|
+
return DESIGN_SYSTEM_OUTPUT_BY_MODE[output];
|
|
2083
2118
|
}
|
|
2084
2119
|
async function withOutputFormat2(output, fn) {
|
|
2085
2120
|
const previous = process.env.OUTPUT_FORMAT;
|
|
@@ -2088,7 +2123,11 @@ async function withOutputFormat2(output, fn) {
|
|
|
2088
2123
|
try {
|
|
2089
2124
|
return await fn();
|
|
2090
2125
|
} finally {
|
|
2091
|
-
|
|
2126
|
+
if (previous === void 0) {
|
|
2127
|
+
delete process.env.OUTPUT_FORMAT;
|
|
2128
|
+
} else {
|
|
2129
|
+
process.env.OUTPUT_FORMAT = previous;
|
|
2130
|
+
}
|
|
2092
2131
|
resetOutputFormatCache();
|
|
2093
2132
|
}
|
|
2094
2133
|
}
|
|
@@ -2136,6 +2175,9 @@ function describeExpectedPresetValue(schema) {
|
|
|
2136
2175
|
return `a ${schema.kind}`;
|
|
2137
2176
|
}
|
|
2138
2177
|
function validatePresetScalarValue(value, schema, fieldPath, presetPath) {
|
|
2178
|
+
if (value === null && schema.nullable === true) {
|
|
2179
|
+
return null;
|
|
2180
|
+
}
|
|
2139
2181
|
switch (schema.kind) {
|
|
2140
2182
|
case "string":
|
|
2141
2183
|
if (typeof value !== "string") {
|
|
@@ -2143,7 +2185,7 @@ function validatePresetScalarValue(value, schema, fieldPath, presetPath) {
|
|
|
2143
2185
|
}
|
|
2144
2186
|
return value;
|
|
2145
2187
|
case "number":
|
|
2146
|
-
if (
|
|
2188
|
+
if (!isValidNumberSchemaValue(value, schema)) {
|
|
2147
2189
|
break;
|
|
2148
2190
|
}
|
|
2149
2191
|
return value;
|
|
@@ -2561,7 +2603,7 @@ async function resolveParams(fields, positionalValues, optionValues, presetPath,
|
|
|
2561
2603
|
}
|
|
2562
2604
|
return params17;
|
|
2563
2605
|
}
|
|
2564
|
-
function
|
|
2606
|
+
function getResolvedFlags(command) {
|
|
2565
2607
|
const flags = command.optsWithGlobals();
|
|
2566
2608
|
return flags;
|
|
2567
2609
|
}
|
|
@@ -2573,9 +2615,10 @@ async function executeCommand(state, services, requirementOptions) {
|
|
|
2573
2615
|
getTheme,
|
|
2574
2616
|
note
|
|
2575
2617
|
};
|
|
2576
|
-
const
|
|
2577
|
-
const
|
|
2578
|
-
const
|
|
2618
|
+
const optionValues = state.actionCommand.optsWithGlobals();
|
|
2619
|
+
const resolvedFlags = optionValues;
|
|
2620
|
+
const output = resolveOutput(resolvedFlags);
|
|
2621
|
+
const shouldPrompt = !resolvedFlags.yes && Boolean(process.stdin.isTTY);
|
|
2579
2622
|
const runtime = await resolveFixtureRuntime(state.command, services, requirementOptions);
|
|
2580
2623
|
const preflightContext = {
|
|
2581
2624
|
...runtime.services,
|
|
@@ -2592,15 +2635,15 @@ async function executeCommand(state, services, requirementOptions) {
|
|
|
2592
2635
|
const params17 = await resolveParams(
|
|
2593
2636
|
state.fields,
|
|
2594
2637
|
state.positionalValues,
|
|
2595
|
-
|
|
2596
|
-
|
|
2638
|
+
optionValues,
|
|
2639
|
+
resolvedFlags.preset,
|
|
2597
2640
|
shouldPrompt
|
|
2598
2641
|
);
|
|
2599
2642
|
const context = {
|
|
2600
2643
|
...preflightContext,
|
|
2601
2644
|
params: params17
|
|
2602
2645
|
};
|
|
2603
|
-
if (state.command.confirm && !
|
|
2646
|
+
if (state.command.confirm && !resolvedFlags.yes && process.stdin.isTTY) {
|
|
2604
2647
|
for (const field of state.fields) {
|
|
2605
2648
|
const value = field.path.reduce(
|
|
2606
2649
|
(current, segment) => current && typeof current === "object" ? current[segment] : void 0,
|
|
@@ -2676,7 +2719,7 @@ async function runCLI(roots, options = {}) {
|
|
|
2676
2719
|
try {
|
|
2677
2720
|
await executeCommand(state, services, requirementOptions);
|
|
2678
2721
|
} catch (error2) {
|
|
2679
|
-
handleRunError(error2, Boolean(
|
|
2722
|
+
handleRunError(error2, Boolean(getResolvedFlags(state.actionCommand).verbose));
|
|
2680
2723
|
}
|
|
2681
2724
|
};
|
|
2682
2725
|
for (const child of root.children) {
|
|
@@ -2718,6 +2761,7 @@ var TerminalBuffer = class {
|
|
|
2718
2761
|
_state = 0 /* Normal */;
|
|
2719
2762
|
_csiParams = "";
|
|
2720
2763
|
_csiPrivate = "";
|
|
2764
|
+
_autoWrap = true;
|
|
2721
2765
|
_style = createDefaultStyleState();
|
|
2722
2766
|
_styleSequence = "";
|
|
2723
2767
|
displayBuffer;
|
|
@@ -2845,6 +2889,9 @@ var TerminalBuffer = class {
|
|
|
2845
2889
|
const p1 = params17[1] ?? 0;
|
|
2846
2890
|
if (this._csiPrivate === "?") {
|
|
2847
2891
|
if (final === "h" || final === "l") {
|
|
2892
|
+
if (params17.includes(7)) {
|
|
2893
|
+
this._autoWrap = final === "h";
|
|
2894
|
+
}
|
|
2848
2895
|
if (params17.includes(1049)) {
|
|
2849
2896
|
if (final === "h") {
|
|
2850
2897
|
this._screen = this._makeScreen(this._cols, this._rows);
|
|
@@ -3059,6 +3106,10 @@ var TerminalBuffer = class {
|
|
|
3059
3106
|
} else if (code >= 32 && code !== 127) {
|
|
3060
3107
|
this._setChar(this._cursorY, this._cursorX, ch);
|
|
3061
3108
|
this._cursorX++;
|
|
3109
|
+
if (!this._autoWrap) {
|
|
3110
|
+
this._cursorX = Math.min(this._cursorX, this._cols - 1);
|
|
3111
|
+
return;
|
|
3112
|
+
}
|
|
3062
3113
|
if (this._cursorX >= this._cols) {
|
|
3063
3114
|
this._cursorX = 0;
|
|
3064
3115
|
this._newline();
|
|
@@ -3980,13 +4031,46 @@ var kimiAgent = {
|
|
|
3980
4031
|
}
|
|
3981
4032
|
};
|
|
3982
4033
|
|
|
4034
|
+
// ../agent-defs/src/agents/goose.ts
|
|
4035
|
+
var gooseAgent = {
|
|
4036
|
+
id: "goose",
|
|
4037
|
+
name: "goose",
|
|
4038
|
+
label: "Goose",
|
|
4039
|
+
summary: "Block's open-source AI agent with ACP support.",
|
|
4040
|
+
binaryName: "goose",
|
|
4041
|
+
configPath: "~/.config/goose/config.yaml",
|
|
4042
|
+
branding: {
|
|
4043
|
+
colors: {
|
|
4044
|
+
dark: "#FF6B35",
|
|
4045
|
+
light: "#E85D26"
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
};
|
|
4049
|
+
|
|
4050
|
+
// ../agent-defs/src/agents/poe-agent.ts
|
|
4051
|
+
var poeAgentAgent = {
|
|
4052
|
+
id: "poe-agent",
|
|
4053
|
+
name: "poe-agent",
|
|
4054
|
+
label: "Poe Agent",
|
|
4055
|
+
summary: "Run one-shot prompts with the built-in Poe agent runtime.",
|
|
4056
|
+
configPath: "~/.poe-code/config.json",
|
|
4057
|
+
branding: {
|
|
4058
|
+
colors: {
|
|
4059
|
+
dark: "#A465F7",
|
|
4060
|
+
light: "#7A3FD3"
|
|
4061
|
+
}
|
|
4062
|
+
}
|
|
4063
|
+
};
|
|
4064
|
+
|
|
3983
4065
|
// ../agent-defs/src/registry.ts
|
|
3984
4066
|
var allAgents = [
|
|
3985
4067
|
claudeCodeAgent,
|
|
3986
4068
|
claudeDesktopAgent,
|
|
3987
4069
|
codexAgent,
|
|
3988
4070
|
openCodeAgent,
|
|
3989
|
-
kimiAgent
|
|
4071
|
+
kimiAgent,
|
|
4072
|
+
gooseAgent,
|
|
4073
|
+
poeAgentAgent
|
|
3990
4074
|
];
|
|
3991
4075
|
var lookup = /* @__PURE__ */ new Map();
|
|
3992
4076
|
for (const agent of allAgents) {
|
|
@@ -4018,6 +4102,10 @@ var agentSkillConfigs = {
|
|
|
4018
4102
|
opencode: {
|
|
4019
4103
|
globalSkillDir: "~/.config/opencode/skills",
|
|
4020
4104
|
localSkillDir: ".opencode/skills"
|
|
4105
|
+
},
|
|
4106
|
+
goose: {
|
|
4107
|
+
globalSkillDir: "~/.agents/skills",
|
|
4108
|
+
localSkillDir: ".agents/skills"
|
|
4021
4109
|
}
|
|
4022
4110
|
};
|
|
4023
4111
|
var supportedAgents = Object.keys(agentSkillConfigs);
|
|
@@ -4281,14 +4369,92 @@ var tomlFormat = {
|
|
|
4281
4369
|
prune: prune2
|
|
4282
4370
|
};
|
|
4283
4371
|
|
|
4372
|
+
// ../config-mutations/src/formats/yaml.ts
|
|
4373
|
+
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
4374
|
+
function isConfigObject3(value) {
|
|
4375
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4376
|
+
}
|
|
4377
|
+
function parse5(content) {
|
|
4378
|
+
if (!content || content.trim() === "") {
|
|
4379
|
+
return {};
|
|
4380
|
+
}
|
|
4381
|
+
const parsed = parseYaml(content);
|
|
4382
|
+
if (parsed === null || parsed === void 0) {
|
|
4383
|
+
return {};
|
|
4384
|
+
}
|
|
4385
|
+
if (!isConfigObject3(parsed)) {
|
|
4386
|
+
throw new Error("Expected YAML object.");
|
|
4387
|
+
}
|
|
4388
|
+
return parsed;
|
|
4389
|
+
}
|
|
4390
|
+
function serialize3(obj) {
|
|
4391
|
+
const serialized = stringifyYaml(obj);
|
|
4392
|
+
return serialized.endsWith("\n") ? serialized : `${serialized}
|
|
4393
|
+
`;
|
|
4394
|
+
}
|
|
4395
|
+
function merge3(base, patch) {
|
|
4396
|
+
const result = { ...base };
|
|
4397
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
4398
|
+
if (value === void 0) {
|
|
4399
|
+
continue;
|
|
4400
|
+
}
|
|
4401
|
+
const existing = result[key];
|
|
4402
|
+
if (isConfigObject3(existing) && isConfigObject3(value)) {
|
|
4403
|
+
result[key] = merge3(existing, value);
|
|
4404
|
+
continue;
|
|
4405
|
+
}
|
|
4406
|
+
result[key] = value;
|
|
4407
|
+
}
|
|
4408
|
+
return result;
|
|
4409
|
+
}
|
|
4410
|
+
function prune3(obj, shape) {
|
|
4411
|
+
let changed = false;
|
|
4412
|
+
const result = { ...obj };
|
|
4413
|
+
for (const [key, pattern] of Object.entries(shape)) {
|
|
4414
|
+
if (!(key in result)) {
|
|
4415
|
+
continue;
|
|
4416
|
+
}
|
|
4417
|
+
const current = result[key];
|
|
4418
|
+
if (isConfigObject3(pattern) && Object.keys(pattern).length === 0) {
|
|
4419
|
+
delete result[key];
|
|
4420
|
+
changed = true;
|
|
4421
|
+
continue;
|
|
4422
|
+
}
|
|
4423
|
+
if (isConfigObject3(pattern) && isConfigObject3(current)) {
|
|
4424
|
+
const { changed: childChanged, result: childResult } = prune3(current, pattern);
|
|
4425
|
+
if (childChanged) {
|
|
4426
|
+
changed = true;
|
|
4427
|
+
}
|
|
4428
|
+
if (Object.keys(childResult).length === 0) {
|
|
4429
|
+
delete result[key];
|
|
4430
|
+
} else {
|
|
4431
|
+
result[key] = childResult;
|
|
4432
|
+
}
|
|
4433
|
+
continue;
|
|
4434
|
+
}
|
|
4435
|
+
delete result[key];
|
|
4436
|
+
changed = true;
|
|
4437
|
+
}
|
|
4438
|
+
return { changed, result };
|
|
4439
|
+
}
|
|
4440
|
+
var yamlFormat = {
|
|
4441
|
+
parse: parse5,
|
|
4442
|
+
serialize: serialize3,
|
|
4443
|
+
merge: merge3,
|
|
4444
|
+
prune: prune3
|
|
4445
|
+
};
|
|
4446
|
+
|
|
4284
4447
|
// ../config-mutations/src/formats/index.ts
|
|
4285
4448
|
var formatRegistry = {
|
|
4286
4449
|
json: jsonFormat,
|
|
4287
|
-
toml: tomlFormat
|
|
4450
|
+
toml: tomlFormat,
|
|
4451
|
+
yaml: yamlFormat
|
|
4288
4452
|
};
|
|
4289
4453
|
var extensionMap = {
|
|
4290
4454
|
".json": "json",
|
|
4291
|
-
".toml": "toml"
|
|
4455
|
+
".toml": "toml",
|
|
4456
|
+
".yaml": "yaml",
|
|
4457
|
+
".yml": "yaml"
|
|
4292
4458
|
};
|
|
4293
4459
|
function getConfigFormat(pathOrFormat) {
|
|
4294
4460
|
if (pathOrFormat in formatRegistry) {
|
|
@@ -4437,7 +4603,7 @@ function pruneKeysByPrefix(table, prefix) {
|
|
|
4437
4603
|
}
|
|
4438
4604
|
return result;
|
|
4439
4605
|
}
|
|
4440
|
-
function
|
|
4606
|
+
function isConfigObject4(value) {
|
|
4441
4607
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4442
4608
|
}
|
|
4443
4609
|
function mergeWithPruneByPrefix(base, patch, pruneByPrefix) {
|
|
@@ -4446,7 +4612,7 @@ function mergeWithPruneByPrefix(base, patch, pruneByPrefix) {
|
|
|
4446
4612
|
for (const [key, value] of Object.entries(patch)) {
|
|
4447
4613
|
const current = result[key];
|
|
4448
4614
|
const prefix = prefixMap[key];
|
|
4449
|
-
if (
|
|
4615
|
+
if (isConfigObject4(current) && isConfigObject4(value)) {
|
|
4450
4616
|
if (prefix) {
|
|
4451
4617
|
const pruned = pruneKeysByPrefix(current, prefix);
|
|
4452
4618
|
result[key] = { ...pruned, ...value };
|
|
@@ -5470,7 +5636,7 @@ function applySgr(style, paramsText) {
|
|
|
5470
5636
|
}
|
|
5471
5637
|
return nextStyle;
|
|
5472
5638
|
}
|
|
5473
|
-
function
|
|
5639
|
+
function parseAnsi2(input) {
|
|
5474
5640
|
const runs = [];
|
|
5475
5641
|
let style = createDefaultStyle();
|
|
5476
5642
|
let textStart = 0;
|
|
@@ -6005,7 +6171,7 @@ function formatNumber(value) {
|
|
|
6005
6171
|
|
|
6006
6172
|
// ../terminal-png/src/index.ts
|
|
6007
6173
|
async function renderTerminalPng(ansiText, options = {}) {
|
|
6008
|
-
const runs =
|
|
6174
|
+
const runs = parseAnsi2(ansiText);
|
|
6009
6175
|
const svg = renderSvg(runs, {
|
|
6010
6176
|
padding: options.padding,
|
|
6011
6177
|
window: options.window
|