terminal-pilot 0.0.21 → 0.0.23
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 +614 -250
- package/dist/cli.js.map +4 -4
- package/dist/commands/close-session.js +6 -4
- package/dist/commands/close-session.js.map +3 -3
- package/dist/commands/create-session.js +6 -4
- package/dist/commands/create-session.js.map +3 -3
- package/dist/commands/fill.js +6 -4
- package/dist/commands/fill.js.map +3 -3
- package/dist/commands/get-session.js +6 -4
- package/dist/commands/get-session.js.map +3 -3
- package/dist/commands/index.d.ts +35 -35
- package/dist/commands/index.js +97 -36
- package/dist/commands/index.js.map +4 -4
- package/dist/commands/install.js +74 -20
- package/dist/commands/install.js.map +4 -4
- package/dist/commands/installer.js +36 -2
- package/dist/commands/installer.js.map +4 -4
- package/dist/commands/list-sessions.js +6 -4
- package/dist/commands/list-sessions.js.map +3 -3
- package/dist/commands/press-key.js +6 -4
- package/dist/commands/press-key.js.map +3 -3
- package/dist/commands/read-history.js +6 -4
- package/dist/commands/read-history.js.map +3 -3
- package/dist/commands/read-screen.js +6 -4
- package/dist/commands/read-screen.js.map +3 -3
- package/dist/commands/resize.js +6 -4
- package/dist/commands/resize.js.map +3 -3
- package/dist/commands/runtime.js +6 -4
- package/dist/commands/runtime.js.map +3 -3
- package/dist/commands/screenshot.js +22 -8
- package/dist/commands/screenshot.js.map +4 -4
- package/dist/commands/send-signal.js +6 -4
- package/dist/commands/send-signal.js.map +3 -3
- package/dist/commands/type.js +6 -4
- package/dist/commands/type.js.map +3 -3
- package/dist/commands/uninstall.js +39 -5
- package/dist/commands/uninstall.js.map +4 -4
- package/dist/commands/wait-for-exit.js +6 -4
- package/dist/commands/wait-for-exit.js.map +3 -3
- package/dist/commands/wait-for.js +6 -4
- package/dist/commands/wait-for.js.map +3 -3
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +8 -0
- package/dist/errors.js.map +7 -0
- package/dist/index.js +8 -4
- package/dist/index.js.map +3 -3
- package/dist/terminal-pilot.js +6 -4
- package/dist/terminal-pilot.js.map +3 -3
- package/dist/terminal-session.js +6 -4
- package/dist/terminal-session.js.map +3 -3
- package/dist/testing/cli-repl.js +614 -250
- package/dist/testing/cli-repl.js.map +4 -4
- package/dist/testing/qa-cli.js +614 -250
- package/dist/testing/qa-cli.js.map +4 -4
- package/node_modules/@poe-code/agent-skill-config/dist/apply.js +2 -1
- package/node_modules/@poe-code/agent-skill-config/dist/bridge-active-skills.js +8 -9
- package/node_modules/@poe-code/agent-skill-config/dist/error-codes.d.ts +1 -0
- package/node_modules/@poe-code/agent-skill-config/dist/error-codes.js +5 -0
- package/node_modules/@poe-code/agent-skill-config/dist/git-exclude.js +18 -12
- package/node_modules/@poe-code/agent-skill-config/dist/templates.js +2 -1
- package/package.json +1 -1
package/dist/commands/index.d.ts
CHANGED
|
@@ -19,36 +19,6 @@ export { createTerminalPilotRuntime, SESSION_ENV_VAR } from "./runtime.js";
|
|
|
19
19
|
export type { TerminalPilotCommandServices, TerminalPilotRuntime } from "./runtime.js";
|
|
20
20
|
export declare function createTerminalPilotGroup(): import("toolcraft").Group<TerminalPilotCommandServices> & {
|
|
21
21
|
readonly __agentKitGroupTypeInfo: import("toolcraft").GroupTypeInfo<TerminalPilotCommandServices, "terminal-pilot", readonly [import("toolcraft").Command<TerminalPilotCommandServices, import("toolcraft").ObjectSchema<{
|
|
22
|
-
readonly agent: import("toolcraft").EnumSchema<[string, ...string[]]>;
|
|
23
|
-
readonly local: import("toolcraft").OptionalSchema<import("toolcraft").BooleanSchema>;
|
|
24
|
-
readonly global: import("toolcraft").OptionalSchema<import("toolcraft").BooleanSchema>;
|
|
25
|
-
}>, undefined, {
|
|
26
|
-
agent: string;
|
|
27
|
-
scope: "local" | "global";
|
|
28
|
-
skillPath: string;
|
|
29
|
-
}> & {
|
|
30
|
-
readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"install", import("toolcraft").ObjectSchema<{
|
|
31
|
-
readonly agent: import("toolcraft").EnumSchema<[string, ...string[]]>;
|
|
32
|
-
readonly local: import("toolcraft").OptionalSchema<import("toolcraft").BooleanSchema>;
|
|
33
|
-
readonly global: import("toolcraft").OptionalSchema<import("toolcraft").BooleanSchema>;
|
|
34
|
-
}>, {
|
|
35
|
-
agent: string;
|
|
36
|
-
scope: "local" | "global";
|
|
37
|
-
skillPath: string;
|
|
38
|
-
}, readonly ["cli"], undefined>;
|
|
39
|
-
}, import("toolcraft").Command<TerminalPilotCommandServices, import("toolcraft").ObjectSchema<{
|
|
40
|
-
readonly agent: import("toolcraft").EnumSchema<[string, ...string[]]>;
|
|
41
|
-
}>, undefined, {
|
|
42
|
-
agent: string;
|
|
43
|
-
removedSkillPaths: string[];
|
|
44
|
-
}> & {
|
|
45
|
-
readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"uninstall", import("toolcraft").ObjectSchema<{
|
|
46
|
-
readonly agent: import("toolcraft").EnumSchema<[string, ...string[]]>;
|
|
47
|
-
}>, {
|
|
48
|
-
agent: string;
|
|
49
|
-
removedSkillPaths: string[];
|
|
50
|
-
}, readonly ["cli"], undefined>;
|
|
51
|
-
}, import("toolcraft").Command<TerminalPilotCommandServices, import("toolcraft").ObjectSchema<{
|
|
52
22
|
readonly command: import("toolcraft").StringSchema;
|
|
53
23
|
readonly args: import("toolcraft").OptionalSchema<import("toolcraft").ArraySchema<import("toolcraft").StringSchema>>;
|
|
54
24
|
readonly session: import("toolcraft").OptionalSchema<import("toolcraft").StringSchema>;
|
|
@@ -238,10 +208,7 @@ export declare function createTerminalPilotGroup(): import("toolcraft").Group<Te
|
|
|
238
208
|
pid: number;
|
|
239
209
|
}>;
|
|
240
210
|
}, readonly ["cli", "mcp", "sdk"], undefined>;
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
export declare const terminalPilotGroup: Readonly<import("toolcraft").Group<TerminalPilotCommandServices> & {
|
|
244
|
-
readonly __agentKitGroupTypeInfo: import("toolcraft").GroupTypeInfo<TerminalPilotCommandServices, "terminal-pilot", readonly [import("toolcraft").Command<TerminalPilotCommandServices, import("toolcraft").ObjectSchema<{
|
|
211
|
+
}, import("toolcraft").Command<TerminalPilotCommandServices, import("toolcraft").ObjectSchema<{
|
|
245
212
|
readonly agent: import("toolcraft").EnumSchema<[string, ...string[]]>;
|
|
246
213
|
readonly local: import("toolcraft").OptionalSchema<import("toolcraft").BooleanSchema>;
|
|
247
214
|
readonly global: import("toolcraft").OptionalSchema<import("toolcraft").BooleanSchema>;
|
|
@@ -271,7 +238,10 @@ export declare const terminalPilotGroup: Readonly<import("toolcraft").Group<Term
|
|
|
271
238
|
agent: string;
|
|
272
239
|
removedSkillPaths: string[];
|
|
273
240
|
}, readonly ["cli"], undefined>;
|
|
274
|
-
},
|
|
241
|
+
}], readonly ["cli", "mcp", "sdk"], undefined>;
|
|
242
|
+
};
|
|
243
|
+
export declare const terminalPilotGroup: Readonly<import("toolcraft").Group<TerminalPilotCommandServices> & {
|
|
244
|
+
readonly __agentKitGroupTypeInfo: import("toolcraft").GroupTypeInfo<TerminalPilotCommandServices, "terminal-pilot", readonly [import("toolcraft").Command<TerminalPilotCommandServices, import("toolcraft").ObjectSchema<{
|
|
275
245
|
readonly command: import("toolcraft").StringSchema;
|
|
276
246
|
readonly args: import("toolcraft").OptionalSchema<import("toolcraft").ArraySchema<import("toolcraft").StringSchema>>;
|
|
277
247
|
readonly session: import("toolcraft").OptionalSchema<import("toolcraft").StringSchema>;
|
|
@@ -461,5 +431,35 @@ export declare const terminalPilotGroup: Readonly<import("toolcraft").Group<Term
|
|
|
461
431
|
pid: number;
|
|
462
432
|
}>;
|
|
463
433
|
}, readonly ["cli", "mcp", "sdk"], undefined>;
|
|
434
|
+
}, import("toolcraft").Command<TerminalPilotCommandServices, import("toolcraft").ObjectSchema<{
|
|
435
|
+
readonly agent: import("toolcraft").EnumSchema<[string, ...string[]]>;
|
|
436
|
+
readonly local: import("toolcraft").OptionalSchema<import("toolcraft").BooleanSchema>;
|
|
437
|
+
readonly global: import("toolcraft").OptionalSchema<import("toolcraft").BooleanSchema>;
|
|
438
|
+
}>, undefined, {
|
|
439
|
+
agent: string;
|
|
440
|
+
scope: "local" | "global";
|
|
441
|
+
skillPath: string;
|
|
442
|
+
}> & {
|
|
443
|
+
readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"install", import("toolcraft").ObjectSchema<{
|
|
444
|
+
readonly agent: import("toolcraft").EnumSchema<[string, ...string[]]>;
|
|
445
|
+
readonly local: import("toolcraft").OptionalSchema<import("toolcraft").BooleanSchema>;
|
|
446
|
+
readonly global: import("toolcraft").OptionalSchema<import("toolcraft").BooleanSchema>;
|
|
447
|
+
}>, {
|
|
448
|
+
agent: string;
|
|
449
|
+
scope: "local" | "global";
|
|
450
|
+
skillPath: string;
|
|
451
|
+
}, readonly ["cli"], undefined>;
|
|
452
|
+
}, import("toolcraft").Command<TerminalPilotCommandServices, import("toolcraft").ObjectSchema<{
|
|
453
|
+
readonly agent: import("toolcraft").EnumSchema<[string, ...string[]]>;
|
|
454
|
+
}>, undefined, {
|
|
455
|
+
agent: string;
|
|
456
|
+
removedSkillPaths: string[];
|
|
457
|
+
}> & {
|
|
458
|
+
readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"uninstall", import("toolcraft").ObjectSchema<{
|
|
459
|
+
readonly agent: import("toolcraft").EnumSchema<[string, ...string[]]>;
|
|
460
|
+
}>, {
|
|
461
|
+
agent: string;
|
|
462
|
+
removedSkillPaths: string[];
|
|
463
|
+
}, readonly ["cli"], undefined>;
|
|
464
464
|
}], readonly ["cli", "mcp", "sdk"], undefined>;
|
|
465
465
|
}>;
|
package/dist/commands/index.js
CHANGED
|
@@ -658,6 +658,11 @@ function consumeTerminatedString(input, index, allowBellTerminator) {
|
|
|
658
658
|
return input.length;
|
|
659
659
|
}
|
|
660
660
|
|
|
661
|
+
// src/errors.ts
|
|
662
|
+
function hasOwnErrorCode(error2, code) {
|
|
663
|
+
return error2 instanceof Error && Object.prototype.hasOwnProperty.call(error2, "code") && error2.code === code;
|
|
664
|
+
}
|
|
665
|
+
|
|
661
666
|
// src/terminal-buffer.ts
|
|
662
667
|
var RESET_SGR = "\x1B[0m";
|
|
663
668
|
var DEC_SPECIAL_GRAPHICS = {
|
|
@@ -1757,10 +1762,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
1757
1762
|
}
|
|
1758
1763
|
}
|
|
1759
1764
|
function isMissingFileError(error2) {
|
|
1760
|
-
|
|
1761
|
-
return false;
|
|
1762
|
-
}
|
|
1763
|
-
return "code" in error2 && error2.code === "ENOENT";
|
|
1765
|
+
return hasOwnErrorCode(error2, "ENOENT");
|
|
1764
1766
|
}
|
|
1765
1767
|
function matchPattern(buffer, pattern) {
|
|
1766
1768
|
const clean = normalizeHistoryBuffer(stripAnsi(buffer));
|
|
@@ -2130,6 +2132,11 @@ var claudeCodeAgent = {
|
|
|
2130
2132
|
aliases: ["claude"],
|
|
2131
2133
|
binaryName: "claude",
|
|
2132
2134
|
apiShapes: ["anthropic-messages"],
|
|
2135
|
+
otelCapture: {
|
|
2136
|
+
env: {
|
|
2137
|
+
CLAUDE_CODE_ENABLE_TELEMETRY: "1"
|
|
2138
|
+
}
|
|
2139
|
+
},
|
|
2133
2140
|
configPath: "~/.claude/settings.json",
|
|
2134
2141
|
branding: {
|
|
2135
2142
|
colors: {
|
|
@@ -2162,6 +2169,16 @@ var codexAgent = {
|
|
|
2162
2169
|
summary: "Configure Codex to use Poe as the model provider.",
|
|
2163
2170
|
binaryName: "codex",
|
|
2164
2171
|
apiShapes: ["openai-responses"],
|
|
2172
|
+
otelCapture: {
|
|
2173
|
+
args: (endpoint, content) => [
|
|
2174
|
+
"-c",
|
|
2175
|
+
`otel.trace_exporter={"otlp-http"={endpoint=${JSON.stringify(`${endpoint}/v1/traces`)},protocol="json"}}`,
|
|
2176
|
+
"-c",
|
|
2177
|
+
`otel.exporter={"otlp-http"={endpoint=${JSON.stringify(`${endpoint}/v1/logs`)},protocol="json"}}`,
|
|
2178
|
+
"-c",
|
|
2179
|
+
`otel.log_user_prompt=${content}`
|
|
2180
|
+
]
|
|
2181
|
+
},
|
|
2165
2182
|
configPath: "~/.codex/config.toml",
|
|
2166
2183
|
branding: {
|
|
2167
2184
|
colors: {
|
|
@@ -2197,6 +2214,11 @@ var openCodeAgent = {
|
|
|
2197
2214
|
summary: "Configure OpenCode CLI to use the Poe API.",
|
|
2198
2215
|
binaryName: "opencode",
|
|
2199
2216
|
apiShapes: ["openai-chat-completions"],
|
|
2217
|
+
otelCapture: {
|
|
2218
|
+
env: {
|
|
2219
|
+
OPENCODE_CONFIG_CONTENT: '{"experimental":{"openTelemetry":true}}'
|
|
2220
|
+
}
|
|
2221
|
+
},
|
|
2200
2222
|
configPath: "~/.config/opencode/config.json",
|
|
2201
2223
|
branding: {
|
|
2202
2224
|
colors: {
|
|
@@ -2232,6 +2254,7 @@ var gooseAgent = {
|
|
|
2232
2254
|
summary: "Block's open-source AI agent with ACP support.",
|
|
2233
2255
|
binaryName: "goose",
|
|
2234
2256
|
apiShapes: ["openai-chat-completions"],
|
|
2257
|
+
otelCapture: {},
|
|
2235
2258
|
configPath: "~/.config/goose/config.yaml",
|
|
2236
2259
|
branding: {
|
|
2237
2260
|
colors: {
|
|
@@ -2265,6 +2288,12 @@ function freezeAgent(agent) {
|
|
|
2265
2288
|
if (agent.apiShapes !== void 0) {
|
|
2266
2289
|
Object.freeze(agent.apiShapes);
|
|
2267
2290
|
}
|
|
2291
|
+
if (agent.otelCapture?.env !== void 0) {
|
|
2292
|
+
Object.freeze(agent.otelCapture.env);
|
|
2293
|
+
}
|
|
2294
|
+
if (agent.otelCapture !== void 0) {
|
|
2295
|
+
Object.freeze(agent.otelCapture);
|
|
2296
|
+
}
|
|
2268
2297
|
Object.freeze(agent.branding.colors);
|
|
2269
2298
|
Object.freeze(agent.branding);
|
|
2270
2299
|
return Object.freeze(agent);
|
|
@@ -2428,6 +2457,7 @@ var templateMutation = {
|
|
|
2428
2457
|
};
|
|
2429
2458
|
|
|
2430
2459
|
// ../config-mutations/src/execution/apply-mutation.ts
|
|
2460
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
2431
2461
|
import path4 from "node:path";
|
|
2432
2462
|
|
|
2433
2463
|
// ../toolcraft-design/src/internal/color-support.ts
|
|
@@ -3510,7 +3540,7 @@ function merge(base, patch) {
|
|
|
3510
3540
|
if (value === void 0) {
|
|
3511
3541
|
continue;
|
|
3512
3542
|
}
|
|
3513
|
-
const existing = result[key];
|
|
3543
|
+
const existing = hasConfigEntry(result, key) ? result[key] : void 0;
|
|
3514
3544
|
if (isConfigObject(existing) && isConfigObject(value)) {
|
|
3515
3545
|
setConfigEntry(result, key, merge(existing, value));
|
|
3516
3546
|
continue;
|
|
@@ -3638,7 +3668,7 @@ function merge2(base, patch) {
|
|
|
3638
3668
|
if (value === void 0) {
|
|
3639
3669
|
continue;
|
|
3640
3670
|
}
|
|
3641
|
-
const existing = result[key];
|
|
3671
|
+
const existing = hasConfigEntry(result, key) ? result[key] : void 0;
|
|
3642
3672
|
if (isConfigObject2(existing) && isConfigObject2(value)) {
|
|
3643
3673
|
setConfigEntry(result, key, merge2(existing, value));
|
|
3644
3674
|
continue;
|
|
@@ -3718,7 +3748,7 @@ function merge3(base, patch) {
|
|
|
3718
3748
|
if (value === void 0) {
|
|
3719
3749
|
continue;
|
|
3720
3750
|
}
|
|
3721
|
-
const existing = result[key];
|
|
3751
|
+
const existing = hasConfigEntry(result, key) ? result[key] : void 0;
|
|
3722
3752
|
if (isConfigObject3(existing) && isConfigObject3(value)) {
|
|
3723
3753
|
setConfigEntry(result, key, merge3(existing, value));
|
|
3724
3754
|
continue;
|
|
@@ -3853,9 +3883,14 @@ function resolvePath(rawPath, homeDir, pathMapper) {
|
|
|
3853
3883
|
return filename.length === 0 ? mappedDirectory : path3.join(mappedDirectory, filename);
|
|
3854
3884
|
}
|
|
3855
3885
|
|
|
3886
|
+
// ../config-mutations/src/error-codes.ts
|
|
3887
|
+
function hasOwnErrorCode2(error2, code) {
|
|
3888
|
+
return typeof error2 === "object" && error2 !== null && Object.prototype.hasOwnProperty.call(error2, "code") && error2.code === code;
|
|
3889
|
+
}
|
|
3890
|
+
|
|
3856
3891
|
// ../config-mutations/src/fs-utils.ts
|
|
3857
3892
|
function isNotFound(error2) {
|
|
3858
|
-
return
|
|
3893
|
+
return hasOwnErrorCode2(error2, "ENOENT");
|
|
3859
3894
|
}
|
|
3860
3895
|
async function readFileIfExists(fs3, target) {
|
|
3861
3896
|
try {
|
|
@@ -3904,6 +3939,7 @@ async function backupInvalidDocument(context, targetPath, content) {
|
|
|
3904
3939
|
return;
|
|
3905
3940
|
} catch (error2) {
|
|
3906
3941
|
if (!isAlreadyExists(error2)) {
|
|
3942
|
+
await context.fs.unlink(backupPath).catch(() => void 0);
|
|
3907
3943
|
throw error2;
|
|
3908
3944
|
}
|
|
3909
3945
|
attempt += 1;
|
|
@@ -3911,7 +3947,7 @@ async function backupInvalidDocument(context, targetPath, content) {
|
|
|
3911
3947
|
}
|
|
3912
3948
|
}
|
|
3913
3949
|
function isAlreadyExists(error2) {
|
|
3914
|
-
return
|
|
3950
|
+
return hasOwnErrorCode2(error2, "EEXIST");
|
|
3915
3951
|
}
|
|
3916
3952
|
async function assertRegularWriteTarget(context, targetPath) {
|
|
3917
3953
|
const boundary = path4.dirname(path4.resolve(context.homeDir));
|
|
@@ -3935,28 +3971,34 @@ async function assertRegularWriteTarget(context, targetPath) {
|
|
|
3935
3971
|
}
|
|
3936
3972
|
async function writeAtomically(context, targetPath, content) {
|
|
3937
3973
|
await assertRegularWriteTarget(context, targetPath);
|
|
3938
|
-
let attempt = 0;
|
|
3939
|
-
|
|
3940
|
-
|
|
3974
|
+
for (let attempt = 0; attempt < 10; attempt += 1) {
|
|
3975
|
+
const tempPath = `${targetPath}.mutation-tmp-${process.pid}-${randomUUID2()}`;
|
|
3976
|
+
let tempCreated = false;
|
|
3941
3977
|
try {
|
|
3978
|
+
await assertRegularWriteTarget(context, tempPath);
|
|
3942
3979
|
await context.fs.writeFile(tempPath, content, { encoding: "utf8", flag: "wx" });
|
|
3980
|
+
tempCreated = true;
|
|
3943
3981
|
await context.fs.rename(tempPath, targetPath);
|
|
3982
|
+
tempCreated = false;
|
|
3944
3983
|
return;
|
|
3945
3984
|
} catch (error2) {
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
void cleanupError;
|
|
3985
|
+
const alreadyExists = isAlreadyExists(error2);
|
|
3986
|
+
if (tempCreated || !alreadyExists) {
|
|
3987
|
+
try {
|
|
3988
|
+
await context.fs.unlink(tempPath);
|
|
3989
|
+
} catch (cleanupError) {
|
|
3990
|
+
if (!isNotFound(cleanupError)) {
|
|
3991
|
+
void cleanupError;
|
|
3992
|
+
}
|
|
3955
3993
|
}
|
|
3956
3994
|
}
|
|
3995
|
+
if (alreadyExists) {
|
|
3996
|
+
continue;
|
|
3997
|
+
}
|
|
3957
3998
|
throw error2;
|
|
3958
3999
|
}
|
|
3959
4000
|
}
|
|
4001
|
+
throw new Error(`Unable to create temporary mutation file for ${targetPath}.`);
|
|
3960
4002
|
}
|
|
3961
4003
|
function describeMutation(kind, targetPath) {
|
|
3962
4004
|
const displayPath = targetPath ?? "target";
|
|
@@ -4248,6 +4290,7 @@ async function applyBackup(mutation, context, options) {
|
|
|
4248
4290
|
break;
|
|
4249
4291
|
} catch (error2) {
|
|
4250
4292
|
if (!isAlreadyExists(error2)) {
|
|
4293
|
+
await context.fs.unlink(backupPath).catch(() => void 0);
|
|
4251
4294
|
throw error2;
|
|
4252
4295
|
}
|
|
4253
4296
|
attempt += 1;
|
|
@@ -4631,6 +4674,11 @@ async function executeMutation(mutation, context, options) {
|
|
|
4631
4674
|
}
|
|
4632
4675
|
}
|
|
4633
4676
|
|
|
4677
|
+
// ../agent-skill-config/src/error-codes.ts
|
|
4678
|
+
function hasOwnErrorCode3(error2, code) {
|
|
4679
|
+
return error2 instanceof Error && Object.prototype.hasOwnProperty.call(error2, "code") && error2.code === code;
|
|
4680
|
+
}
|
|
4681
|
+
|
|
4634
4682
|
// ../agent-skill-config/src/templates.ts
|
|
4635
4683
|
import { readFile, stat } from "node:fs/promises";
|
|
4636
4684
|
import path5 from "node:path";
|
|
@@ -4655,7 +4703,7 @@ async function pathExists2(fs3, targetPath) {
|
|
|
4655
4703
|
await fs3.stat(targetPath);
|
|
4656
4704
|
return true;
|
|
4657
4705
|
} catch (error2) {
|
|
4658
|
-
if (error2
|
|
4706
|
+
if (hasOwnErrorCode3(error2, "ENOENT")) {
|
|
4659
4707
|
return false;
|
|
4660
4708
|
}
|
|
4661
4709
|
throw error2;
|
|
@@ -4714,12 +4762,13 @@ import path6 from "node:path";
|
|
|
4714
4762
|
|
|
4715
4763
|
// ../agent-skill-config/src/git-exclude.ts
|
|
4716
4764
|
import { execFileSync } from "node:child_process";
|
|
4765
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
4717
4766
|
import * as fs from "node:fs";
|
|
4718
4767
|
import path7 from "node:path";
|
|
4719
4768
|
|
|
4720
4769
|
// ../agent-skill-config/src/bridge-active-skills.ts
|
|
4721
4770
|
import * as fs2 from "node:fs";
|
|
4722
|
-
import { createHash, randomUUID as
|
|
4771
|
+
import { createHash, randomUUID as randomUUID4 } from "node:crypto";
|
|
4723
4772
|
import path8 from "node:path";
|
|
4724
4773
|
|
|
4725
4774
|
// src/commands/installer.ts
|
|
@@ -4732,7 +4781,7 @@ var DEFAULT_INSTALL_SCOPE = "local";
|
|
|
4732
4781
|
var TERMINAL_PILOT_SKILL_NAME = "terminal-pilot";
|
|
4733
4782
|
var installableAgents = supportedAgents;
|
|
4734
4783
|
function isNotFoundError(error2) {
|
|
4735
|
-
return
|
|
4784
|
+
return hasOwnErrorCode(error2, "ENOENT");
|
|
4736
4785
|
}
|
|
4737
4786
|
function resolveInstallerServices(installer) {
|
|
4738
4787
|
return {
|
|
@@ -4963,7 +5012,7 @@ var resize = defineCommand({
|
|
|
4963
5012
|
});
|
|
4964
5013
|
|
|
4965
5014
|
// ../terminal-png/src/index.ts
|
|
4966
|
-
import { randomUUID as
|
|
5015
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
4967
5016
|
import { rename, rm, writeFile } from "node:fs/promises";
|
|
4968
5017
|
|
|
4969
5018
|
// ../terminal-png/src/ansi-parser.ts
|
|
@@ -5350,6 +5399,11 @@ function parseAnsi2(input) {
|
|
|
5350
5399
|
return buildRuns(lines, lineBreakStyles);
|
|
5351
5400
|
}
|
|
5352
5401
|
|
|
5402
|
+
// ../terminal-png/src/error-codes.ts
|
|
5403
|
+
function hasOwnErrorCode4(error2, code) {
|
|
5404
|
+
return typeof error2 === "object" && error2 !== null && Object.prototype.hasOwnProperty.call(error2, "code") && error2.code === code;
|
|
5405
|
+
}
|
|
5406
|
+
|
|
5353
5407
|
// ../terminal-png/src/png-renderer.ts
|
|
5354
5408
|
import { Resvg } from "@resvg/resvg-js";
|
|
5355
5409
|
|
|
@@ -5903,21 +5957,28 @@ async function renderTerminalPng(ansiText, options = {}) {
|
|
|
5903
5957
|
});
|
|
5904
5958
|
const png = renderPng(svg);
|
|
5905
5959
|
if (options.output) {
|
|
5906
|
-
const temporaryPath = `${options.output}.${
|
|
5960
|
+
const temporaryPath = `${options.output}.${randomUUID5()}.tmp`;
|
|
5961
|
+
let temporaryCreated = false;
|
|
5907
5962
|
try {
|
|
5908
5963
|
await writeFile(temporaryPath, png, { flag: "wx" });
|
|
5964
|
+
temporaryCreated = true;
|
|
5909
5965
|
await rename(temporaryPath, options.output);
|
|
5910
5966
|
} catch (error2) {
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5967
|
+
if (temporaryCreated || !isAlreadyExistsError(error2)) {
|
|
5968
|
+
try {
|
|
5969
|
+
await rm(temporaryPath, { force: true });
|
|
5970
|
+
} catch (cleanupError) {
|
|
5971
|
+
void cleanupError;
|
|
5972
|
+
}
|
|
5915
5973
|
}
|
|
5916
5974
|
throw error2;
|
|
5917
5975
|
}
|
|
5918
5976
|
}
|
|
5919
5977
|
return png;
|
|
5920
5978
|
}
|
|
5979
|
+
function isAlreadyExistsError(error2) {
|
|
5980
|
+
return error2 instanceof Error && hasOwnErrorCode4(error2, "EEXIST");
|
|
5981
|
+
}
|
|
5921
5982
|
|
|
5922
5983
|
// src/commands/screenshot.ts
|
|
5923
5984
|
var params11 = S.Object({
|
|
@@ -5980,7 +6041,7 @@ var type = defineCommand({
|
|
|
5980
6041
|
});
|
|
5981
6042
|
|
|
5982
6043
|
// src/commands/uninstall.ts
|
|
5983
|
-
import { randomUUID as
|
|
6044
|
+
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
5984
6045
|
var params14 = S.Object({
|
|
5985
6046
|
agent: S.Enum(installableAgents, {
|
|
5986
6047
|
description: "Agent to uninstall terminal-pilot from",
|
|
@@ -6016,7 +6077,7 @@ var uninstall = defineCommand({
|
|
|
6016
6077
|
if (!await folderExists(services.fs, skill.fullPath)) {
|
|
6017
6078
|
continue;
|
|
6018
6079
|
}
|
|
6019
|
-
const stagingPath = `${skill.fullPath}.removing-${
|
|
6080
|
+
const stagingPath = `${skill.fullPath}.removing-${randomUUID6()}`;
|
|
6020
6081
|
await services.fs.rename(skill.fullPath, stagingPath);
|
|
6021
6082
|
staged.push({ ...skill, stagingPath });
|
|
6022
6083
|
}
|
|
@@ -6042,7 +6103,7 @@ async function folderExists(fs3, folderPath) {
|
|
|
6042
6103
|
await fs3.stat(folderPath);
|
|
6043
6104
|
return true;
|
|
6044
6105
|
} catch (error2) {
|
|
6045
|
-
if (
|
|
6106
|
+
if (hasOwnErrorCode(error2, "ENOENT")) {
|
|
6046
6107
|
return false;
|
|
6047
6108
|
}
|
|
6048
6109
|
throw error2;
|
|
@@ -6096,8 +6157,6 @@ var waitForExit2 = defineCommand({
|
|
|
6096
6157
|
|
|
6097
6158
|
// src/commands/index.ts
|
|
6098
6159
|
var children = [
|
|
6099
|
-
install,
|
|
6100
|
-
uninstall,
|
|
6101
6160
|
createSession,
|
|
6102
6161
|
fill,
|
|
6103
6162
|
type,
|
|
@@ -6111,7 +6170,9 @@ var children = [
|
|
|
6111
6170
|
resize,
|
|
6112
6171
|
closeSession,
|
|
6113
6172
|
getSession,
|
|
6114
|
-
listSessions
|
|
6173
|
+
listSessions,
|
|
6174
|
+
install,
|
|
6175
|
+
uninstall
|
|
6115
6176
|
];
|
|
6116
6177
|
function createTerminalPilotGroup() {
|
|
6117
6178
|
return defineGroup({
|