terminal-pilot 0.0.49 → 0.0.50
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 +1 -1
- package/dist/composition.json +1 -1
- package/dist/testing/cli-repl.js +1 -1
- package/dist/testing/qa-cli.js +1 -1
- package/node_modules/@poe-code/user-error/README.md +56 -0
- package/node_modules/@poe-code/user-error/dist/index.d.ts +17 -0
- package/node_modules/@poe-code/user-error/dist/index.js +21 -0
- package/node_modules/@poe-code/user-error/package.json +24 -0
- package/package.json +2 -1
package/dist/cli.js
CHANGED
|
@@ -15246,7 +15246,7 @@ function sleep2(ms) {
|
|
|
15246
15246
|
// src/cli.ts
|
|
15247
15247
|
configureTheme({ brand: "green", label: "Terminal Pilot" });
|
|
15248
15248
|
function getBundledPackageVersion() {
|
|
15249
|
-
return true ? "0.0.
|
|
15249
|
+
return true ? "0.0.50" : void 0;
|
|
15250
15250
|
}
|
|
15251
15251
|
var pilotOptionsWithValues = /* @__PURE__ */ new Set([
|
|
15252
15252
|
"--session",
|
package/dist/composition.json
CHANGED
package/dist/testing/cli-repl.js
CHANGED
|
@@ -15249,7 +15249,7 @@ function sleep2(ms) {
|
|
|
15249
15249
|
// src/cli.ts
|
|
15250
15250
|
configureTheme({ brand: "green", label: "Terminal Pilot" });
|
|
15251
15251
|
function getBundledPackageVersion() {
|
|
15252
|
-
return true ? "0.0.
|
|
15252
|
+
return true ? "0.0.50" : void 0;
|
|
15253
15253
|
}
|
|
15254
15254
|
var pilotOptionsWithValues = /* @__PURE__ */ new Set([
|
|
15255
15255
|
"--session",
|
package/dist/testing/qa-cli.js
CHANGED
|
@@ -15256,7 +15256,7 @@ function sleep2(ms) {
|
|
|
15256
15256
|
// src/cli.ts
|
|
15257
15257
|
configureTheme({ brand: "green", label: "Terminal Pilot" });
|
|
15258
15258
|
function getBundledPackageVersion() {
|
|
15259
|
-
return true ? "0.0.
|
|
15259
|
+
return true ? "0.0.50" : void 0;
|
|
15260
15260
|
}
|
|
15261
15261
|
var pilotOptionsWithValues = /* @__PURE__ */ new Set([
|
|
15262
15262
|
"--session",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @poe-code/user-error
|
|
2
|
+
|
|
3
|
+
The shared user-error type every workspace package throws for expected user
|
|
4
|
+
mistakes, and the guard the CLI renders them with.
|
|
5
|
+
|
|
6
|
+
`src/cli/errors.ts` cannot be imported from `packages/*`, so package code used to
|
|
7
|
+
throw a plain `Error` for recoverable conditions. `src/cli/bootstrap.ts` then
|
|
8
|
+
treated each one as a crash: an `Error:` prefix plus a `See logs at
|
|
9
|
+
~/.poe-code/logs/errors.log` pointer to a log that adds nothing for a typo. This
|
|
10
|
+
package gives packages a classification the CLI honours.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { UserError, isUserError } from "@poe-code/user-error";
|
|
16
|
+
|
|
17
|
+
throw new UserError('Unknown agent "clyde". Try: claude, codex, gemini.');
|
|
18
|
+
|
|
19
|
+
throw new UserError("No API key found.", {
|
|
20
|
+
hint: "Create one at https://poe.com/api_key",
|
|
21
|
+
cause: readError
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
if (isUserError(error)) {
|
|
25
|
+
// render the message as guidance: no stack trace, no log pointer
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Throw a `UserError` when the user can fix the condition themselves, and say how:
|
|
30
|
+
name the value that was rejected and the valid ones, the path that was searched,
|
|
31
|
+
or the URL that issues the key. Keep plain `Error` for genuine failures — those
|
|
32
|
+
should reach the log.
|
|
33
|
+
|
|
34
|
+
## Public API
|
|
35
|
+
|
|
36
|
+
- `UserError`: `Error` subclass with `name === "UserError"` and an optional
|
|
37
|
+
`hint` for the recovery step. Accepts the standard `cause` option.
|
|
38
|
+
- `isUserError(error)`: true for a `UserError` **or** any `Error` whose `name` is
|
|
39
|
+
`"UserError"`.
|
|
40
|
+
|
|
41
|
+
## Cross-bundle recognition
|
|
42
|
+
|
|
43
|
+
`isUserError` matches on `error.name`, not `instanceof`. `toolcraft` publishes its
|
|
44
|
+
own `UserError` (`packages/toolcraft/src/user-error.ts`) as a separately released
|
|
45
|
+
framework, and an instance crossing a bundle boundary fails `instanceof` against
|
|
46
|
+
this package's class. Name matching recognises both, and mirrors the existing
|
|
47
|
+
`isSilentError()` precedent in `src/cli/errors.ts`. toolcraft deliberately does
|
|
48
|
+
not depend on this package — the coupling would run the wrong way.
|
|
49
|
+
|
|
50
|
+
## Config Options
|
|
51
|
+
|
|
52
|
+
This package reads no configuration.
|
|
53
|
+
|
|
54
|
+
## Environment Variables
|
|
55
|
+
|
|
56
|
+
This package reads no environment variables.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An expected user mistake: bad input, a missing file, an unknown id, absent
|
|
3
|
+
* credentials. Thrown where the condition is detected so the CLI can render the
|
|
4
|
+
* message as guidance instead of dressing it in system-failure chrome.
|
|
5
|
+
*/
|
|
6
|
+
export declare class UserError extends Error {
|
|
7
|
+
readonly hint?: string;
|
|
8
|
+
constructor(message: string, options?: ErrorOptions & {
|
|
9
|
+
hint?: string;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Detects user errors by name as well as identity, so an instance created in
|
|
14
|
+
* another bundle (toolcraft publishes its own `UserError`) is still recognised
|
|
15
|
+
* where `instanceof` would fail.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isUserError(error: unknown): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An expected user mistake: bad input, a missing file, an unknown id, absent
|
|
3
|
+
* credentials. Thrown where the condition is detected so the CLI can render the
|
|
4
|
+
* message as guidance instead of dressing it in system-failure chrome.
|
|
5
|
+
*/
|
|
6
|
+
export class UserError extends Error {
|
|
7
|
+
hint;
|
|
8
|
+
constructor(message, options) {
|
|
9
|
+
super(message, options);
|
|
10
|
+
this.name = "UserError";
|
|
11
|
+
this.hint = options?.hint;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Detects user errors by name as well as identity, so an instance created in
|
|
16
|
+
* another bundle (toolcraft publishes its own `UserError`) is still recognised
|
|
17
|
+
* where `instanceof` would fail.
|
|
18
|
+
*/
|
|
19
|
+
export function isUserError(error) {
|
|
20
|
+
return error instanceof Error && error.name === "UserError";
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "node ../../scripts/guard-package-dist.mjs && tsc"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/poe-platform/poe-code.git",
|
|
22
|
+
"directory": "packages/user-error"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "terminal-pilot",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.50",
|
|
4
4
|
"description": "Playwright-like SDK and CLI for automating interactive CLI apps through a real PTY",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
"optionalDependencies": {
|
|
86
86
|
"@poe-code/agent-defs": "*",
|
|
87
87
|
"@poe-code/config-mutations": "*",
|
|
88
|
+
"@poe-code/user-error": "*",
|
|
88
89
|
"toolcraft-design": "*",
|
|
89
90
|
"@poe-code/frontmatter": "*"
|
|
90
91
|
},
|