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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { fileMutation, runMutations, templateMutation } from "@poe-code/config-mutations";
|
|
2
2
|
import { resolveAgentSupport } from "./configs.js";
|
|
3
|
+
import { hasOwnErrorCode } from "./error-codes.js";
|
|
3
4
|
import { createTemplateLoader } from "./templates.js";
|
|
4
5
|
export class UnsupportedAgentError extends Error {
|
|
5
6
|
constructor(agentId) {
|
|
@@ -23,7 +24,7 @@ async function pathExists(fs, targetPath) {
|
|
|
23
24
|
return true;
|
|
24
25
|
}
|
|
25
26
|
catch (error) {
|
|
26
|
-
if (error
|
|
27
|
+
if (hasOwnErrorCode(error, "ENOENT")) {
|
|
27
28
|
return false;
|
|
28
29
|
}
|
|
29
30
|
throw error;
|
|
@@ -2,21 +2,19 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import { createHash, randomUUID } from "node:crypto";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { getAgentConfig, resolveAgentSupport, resolveSkillDir, supportedAgents } from "./configs.js";
|
|
5
|
+
import { hasOwnErrorCode } from "./error-codes.js";
|
|
5
6
|
import { appendExcludeBlock, removeExcludeBlock } from "./git-exclude.js";
|
|
6
7
|
import { resolveSkillReference } from "./resolve-skill-reference.js";
|
|
7
8
|
const activeTargets = new Map();
|
|
8
9
|
const manifestStates = new WeakMap();
|
|
9
10
|
const ownershipFileName = ".poe-code-bridge-owner";
|
|
10
|
-
function isNodeError(error) {
|
|
11
|
-
return error instanceof Error && "code" in error;
|
|
12
|
-
}
|
|
13
11
|
function pathExists(targetPath) {
|
|
14
12
|
try {
|
|
15
13
|
fs.statSync(targetPath);
|
|
16
14
|
return true;
|
|
17
15
|
}
|
|
18
16
|
catch (error) {
|
|
19
|
-
if (
|
|
17
|
+
if (hasOwnErrorCode(error, "ENOENT")) {
|
|
20
18
|
return false;
|
|
21
19
|
}
|
|
22
20
|
throw error;
|
|
@@ -36,7 +34,7 @@ function assertNoSymbolicLink(targetPath) {
|
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
catch (error) {
|
|
39
|
-
if (
|
|
37
|
+
if (hasOwnErrorCode(error, "ENOENT")) {
|
|
40
38
|
return;
|
|
41
39
|
}
|
|
42
40
|
throw error;
|
|
@@ -48,7 +46,7 @@ function isDirectory(targetPath) {
|
|
|
48
46
|
return fs.statSync(targetPath).isDirectory();
|
|
49
47
|
}
|
|
50
48
|
catch (error) {
|
|
51
|
-
if (
|
|
49
|
+
if (hasOwnErrorCode(error, "ENOENT")) {
|
|
52
50
|
return false;
|
|
53
51
|
}
|
|
54
52
|
throw error;
|
|
@@ -137,7 +135,7 @@ function hasOwnershipToken(targetPath, token) {
|
|
|
137
135
|
return fs.readFileSync(ownershipPath(targetPath), "utf8") === token;
|
|
138
136
|
}
|
|
139
137
|
catch (error) {
|
|
140
|
-
if (
|
|
138
|
+
if (hasOwnErrorCode(error, "ENOENT")) {
|
|
141
139
|
return false;
|
|
142
140
|
}
|
|
143
141
|
throw error;
|
|
@@ -161,8 +159,9 @@ function removeDirectoryIfEmpty(targetPath) {
|
|
|
161
159
|
fs.rmdirSync(targetPath);
|
|
162
160
|
}
|
|
163
161
|
catch (error) {
|
|
164
|
-
if (
|
|
165
|
-
(error
|
|
162
|
+
if (hasOwnErrorCode(error, "ENOENT") ||
|
|
163
|
+
hasOwnErrorCode(error, "ENOTEMPTY") ||
|
|
164
|
+
hasOwnErrorCode(error, "EEXIST")) {
|
|
166
165
|
return;
|
|
167
166
|
}
|
|
168
167
|
throw error;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function hasOwnErrorCode(error: unknown, code: string): boolean;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
2
3
|
import * as fs from "node:fs";
|
|
3
4
|
import path from "node:path";
|
|
5
|
+
import { hasOwnErrorCode } from "./error-codes.js";
|
|
4
6
|
const defaultMarkerPrefix = "poe-code-spawn-skills";
|
|
5
7
|
function defaultGitDirRunner(cwd) {
|
|
6
8
|
try {
|
|
@@ -15,7 +17,6 @@ function defaultGitDirRunner(cwd) {
|
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
let gitDirRunner = defaultGitDirRunner;
|
|
18
|
-
let tempFileCounter = 0;
|
|
19
20
|
export function setGitDirRunnerForTest(runner) {
|
|
20
21
|
const previous = gitDirRunner;
|
|
21
22
|
gitDirRunner = runner;
|
|
@@ -46,14 +47,14 @@ function readExcludeFile(excludePath) {
|
|
|
46
47
|
return fs.readFileSync(excludePath, "utf8");
|
|
47
48
|
}
|
|
48
49
|
catch (error) {
|
|
49
|
-
if (
|
|
50
|
+
if (hasOwnErrorCode(error, "ENOENT")) {
|
|
50
51
|
return undefined;
|
|
51
52
|
}
|
|
52
53
|
throw error;
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
-
return error
|
|
56
|
+
function isAlreadyExistsError(error) {
|
|
57
|
+
return hasOwnErrorCode(error, "EEXIST");
|
|
57
58
|
}
|
|
58
59
|
function assertNoSymbolicLink(targetPath) {
|
|
59
60
|
const parsed = path.parse(path.resolve(targetPath));
|
|
@@ -69,7 +70,7 @@ function assertNoSymbolicLink(targetPath) {
|
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
catch (error) {
|
|
72
|
-
if (
|
|
73
|
+
if (hasOwnErrorCode(error, "ENOENT")) {
|
|
73
74
|
return;
|
|
74
75
|
}
|
|
75
76
|
throw error;
|
|
@@ -80,17 +81,22 @@ function writeExcludeFile(excludePath, content) {
|
|
|
80
81
|
assertNoSymbolicLink(excludePath);
|
|
81
82
|
fs.mkdirSync(path.dirname(excludePath), { recursive: true });
|
|
82
83
|
assertNoSymbolicLink(excludePath);
|
|
83
|
-
const tempPath = `${excludePath}.poe-code-${process.pid}-${
|
|
84
|
+
const tempPath = `${excludePath}.poe-code-${process.pid}-${randomUUID()}.tmp`;
|
|
85
|
+
let tempCreated = false;
|
|
84
86
|
try {
|
|
85
|
-
|
|
87
|
+
assertNoSymbolicLink(tempPath);
|
|
88
|
+
fs.writeFileSync(tempPath, content, { encoding: "utf8", flag: "wx" });
|
|
89
|
+
tempCreated = true;
|
|
86
90
|
fs.renameSync(tempPath, excludePath);
|
|
87
91
|
}
|
|
88
92
|
catch (error) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
if (tempCreated || !isAlreadyExistsError(error)) {
|
|
94
|
+
try {
|
|
95
|
+
fs.rmSync(tempPath, { force: true });
|
|
96
|
+
}
|
|
97
|
+
catch (cleanupError) {
|
|
98
|
+
void cleanupError;
|
|
99
|
+
}
|
|
94
100
|
}
|
|
95
101
|
throw error;
|
|
96
102
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFile, stat } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { hasOwnErrorCode } from "./error-codes.js";
|
|
4
5
|
const TEMPLATE_IDS = ["poe-generate.md", "terminal-pilot.md"];
|
|
5
6
|
const cache = new Map();
|
|
6
7
|
async function pathExists(target) {
|
|
@@ -9,7 +10,7 @@ async function pathExists(target) {
|
|
|
9
10
|
return true;
|
|
10
11
|
}
|
|
11
12
|
catch (error) {
|
|
12
|
-
if (error
|
|
13
|
+
if (hasOwnErrorCode(error, "ENOENT")) {
|
|
13
14
|
return false;
|
|
14
15
|
}
|
|
15
16
|
throw error;
|