toolcraft 0.0.136 → 0.0.138
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/composition.json +7 -2
- package/dist/cli.js +55 -34
- package/dist/composition.json +7 -2
- package/dist/human-in-loop/approvals-commands.js +18 -28
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/renderer.js +4 -1
- package/dist/user-error.d.ts +8 -0
- package/dist/user-error.js +10 -0
- package/node_modules/@poe-code/agent-defs/README.md +14 -1
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-code.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-desktop.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/codex.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/cursor.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/gemini-cli.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/goose.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/kimi.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/opencode.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/pi.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/poe-agent.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/capabilities.d.ts +14 -0
- package/node_modules/@poe-code/agent-defs/dist/capabilities.js +63 -0
- package/node_modules/@poe-code/agent-defs/dist/index.d.ts +2 -1
- package/node_modules/@poe-code/agent-defs/dist/index.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/registry.js +3 -0
- package/node_modules/@poe-code/agent-defs/dist/types.d.ts +7 -0
- package/node_modules/@poe-code/frontmatter/README.md +3 -0
- package/node_modules/@poe-code/frontmatter/dist/index.d.ts +1 -1
- package/node_modules/@poe-code/frontmatter/dist/index.js +1 -1
- package/node_modules/@poe-code/frontmatter/dist/parse.d.ts +9 -0
- package/node_modules/@poe-code/frontmatter/dist/parse.js +16 -0
- package/node_modules/@poe-code/process-runner/dist/docker/docker-execution-env.js +20 -8
- package/node_modules/@poe-code/process-runner/dist/host/host-execution-env.js +1 -0
- package/node_modules/@poe-code/process-runner/dist/types.d.ts +2 -0
- package/node_modules/@poe-code/task-list/dist/backends/gh-issues-client.js +4 -0
- 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/node_modules/tiny-stdio-mcp-server/dist/composition.json +1 -1
- package/node_modules/toolcraft-design/dist/acp/components.d.ts +8 -1
- package/node_modules/toolcraft-design/dist/acp/components.js +11 -6
- package/node_modules/toolcraft-design/dist/acp/index.d.ts +1 -0
- package/node_modules/toolcraft-design/dist/components/command-errors.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/components/command-errors.js +8 -2
- package/node_modules/toolcraft-design/dist/components/index.d.ts +1 -1
- package/node_modules/toolcraft-design/dist/components/index.js +1 -1
- package/node_modules/toolcraft-design/dist/components/table.d.ts +1 -0
- package/node_modules/toolcraft-design/dist/components/table.js +52 -5
- package/node_modules/toolcraft-design/dist/components/template.d.ts +9 -0
- package/node_modules/toolcraft-design/dist/components/template.js +27 -2
- package/node_modules/toolcraft-design/dist/index.d.ts +2 -2
- package/node_modules/toolcraft-design/dist/index.js +2 -2
- package/node_modules/toolcraft-design/dist/prompts/interactive/core.d.ts +5 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/core.js +15 -1
- package/node_modules/toolcraft-design/dist/prompts/primitives/spinner.js +1 -1
- package/node_modules/toolcraft-schema/package.json +1 -1
- package/package.json +6 -4
|
@@ -5,6 +5,15 @@ export interface RenderTemplateOptions {
|
|
|
5
5
|
validate?: boolean;
|
|
6
6
|
yield?: string;
|
|
7
7
|
}
|
|
8
|
+
export declare class TemplateParseError extends Error {
|
|
9
|
+
readonly description: string;
|
|
10
|
+
readonly line: number;
|
|
11
|
+
readonly column: number;
|
|
12
|
+
constructor(description: string, position: {
|
|
13
|
+
line: number;
|
|
14
|
+
column: number;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
8
17
|
export declare function renderTemplate(template: string, view: Record<string, unknown>, options?: RenderTemplateOptions): string;
|
|
9
18
|
export declare function getTemplatePartialNames(template: string): string[];
|
|
10
19
|
export declare function resolveTemplatePartials(template: string, partials: Record<string, string>): string;
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
const MAX_PARTIAL_DEPTH = 100;
|
|
2
|
+
const MAX_TAG_EXCERPT_LENGTH = 40;
|
|
3
|
+
export class TemplateParseError extends Error {
|
|
4
|
+
description;
|
|
5
|
+
line;
|
|
6
|
+
column;
|
|
7
|
+
constructor(description, position) {
|
|
8
|
+
super(`${description} at line ${position.line}, column ${position.column}`);
|
|
9
|
+
this.name = "TemplateParseError";
|
|
10
|
+
this.description = description;
|
|
11
|
+
this.line = position.line;
|
|
12
|
+
this.column = position.column;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
2
15
|
const HTML_ESCAPE = {
|
|
3
16
|
"&": "&",
|
|
4
17
|
"<": "<",
|
|
@@ -114,13 +127,13 @@ function parseTag(template, open) {
|
|
|
114
127
|
if (template.startsWith("{{{", open)) {
|
|
115
128
|
const close = template.indexOf("}}}", open + 3);
|
|
116
129
|
if (close === -1) {
|
|
117
|
-
throw
|
|
130
|
+
throw unclosedTagError(template, open, "}}}");
|
|
118
131
|
}
|
|
119
132
|
return { kind: "unescaped", name: template.slice(open + 3, close).trim(), end: close + 3 };
|
|
120
133
|
}
|
|
121
134
|
const close = template.indexOf("}}", open + 2);
|
|
122
135
|
if (close === -1) {
|
|
123
|
-
throw
|
|
136
|
+
throw unclosedTagError(template, open, "}}");
|
|
124
137
|
}
|
|
125
138
|
const raw = template.slice(open + 2, close).trim();
|
|
126
139
|
const sigil = raw[0];
|
|
@@ -142,6 +155,18 @@ function parseTag(template, open) {
|
|
|
142
155
|
return { kind: "delimiter", name, end };
|
|
143
156
|
return { kind: "name", name: raw, end };
|
|
144
157
|
}
|
|
158
|
+
function unclosedTagError(template, open, expected) {
|
|
159
|
+
const before = template.slice(0, open);
|
|
160
|
+
const lineEnd = template.indexOf("\n", open);
|
|
161
|
+
const opened = template.slice(open, lineEnd === -1 ? template.length : lineEnd).trimEnd();
|
|
162
|
+
const tag = opened.length > MAX_TAG_EXCERPT_LENGTH
|
|
163
|
+
? `${opened.slice(0, MAX_TAG_EXCERPT_LENGTH)}...`
|
|
164
|
+
: opened;
|
|
165
|
+
return new TemplateParseError(`Unclosed tag "${tag}": expected "${expected}"`, {
|
|
166
|
+
line: before.split("\n").length,
|
|
167
|
+
column: open - (before.lastIndexOf("\n") + 1) + 1
|
|
168
|
+
});
|
|
169
|
+
}
|
|
145
170
|
function getStandalone(template, tagStart, tagEnd, kind) {
|
|
146
171
|
if (!["section", "inverted", "close", "comment", "partial", "delimiter"].includes(kind)) {
|
|
147
172
|
return undefined;
|
|
@@ -17,7 +17,7 @@ export * as helpFormatterPlain from "./components/help-formatter-plain.js";
|
|
|
17
17
|
export type { CommandInfo, OptionInfo, FormatColumnsOptions, HelpToken, HelpTokenRole } from "./components/help-formatter.js";
|
|
18
18
|
export { formatCommandNotFound } from "./components/command-errors.js";
|
|
19
19
|
export { formatCommandNotFoundPanel } from "./components/command-errors.js";
|
|
20
|
-
export { renderTable } from "./components/table.js";
|
|
20
|
+
export { loggerTableWidth, renderTable } from "./components/table.js";
|
|
21
21
|
export type { TableColumn, RenderTableOptions } from "./components/table.js";
|
|
22
22
|
export { renderFileChanges } from "./components/file-changes.js";
|
|
23
23
|
export type { FileChange, FileChangeDisplayMode, FileChangeKind, FileChangeOutputFormat, RenderFileChangesOptions } from "./components/file-changes.js";
|
|
@@ -29,7 +29,7 @@ export { renderInspectorCard } from "./components/inspector-card.js";
|
|
|
29
29
|
export type { InspectorField, InspectorSection, RenderInspectorCardOptions } from "./components/inspector-card.js";
|
|
30
30
|
export { renderResourceBrowser } from "./components/resource-browser.js";
|
|
31
31
|
export type { RenderResourceBrowserOptions, ResourceBrowserGroup, ResourceBrowserItem } from "./components/resource-browser.js";
|
|
32
|
-
export { getTemplatePartialNames, renderTemplate, resolveTemplatePartials } from "./components/template.js";
|
|
32
|
+
export { TemplateParseError, getTemplatePartialNames, renderTemplate, resolveTemplatePartials } from "./components/template.js";
|
|
33
33
|
export type { RenderTemplateOptions, TemplateEscape } from "./components/template.js";
|
|
34
34
|
export { openExternal } from "./components/browser.js";
|
|
35
35
|
export * as acp from "./acp/index.js";
|
|
@@ -14,13 +14,13 @@ export { helpFormatter, formatColumns, formatCommand, formatUsage, formatOption,
|
|
|
14
14
|
export * as helpFormatterPlain from "./components/help-formatter-plain.js";
|
|
15
15
|
export { formatCommandNotFound } from "./components/command-errors.js";
|
|
16
16
|
export { formatCommandNotFoundPanel } from "./components/command-errors.js";
|
|
17
|
-
export { renderTable } from "./components/table.js";
|
|
17
|
+
export { loggerTableWidth, renderTable } from "./components/table.js";
|
|
18
18
|
export { renderFileChanges } from "./components/file-changes.js";
|
|
19
19
|
export { renderCatalog } from "./components/catalog.js";
|
|
20
20
|
export { renderDetailCard } from "./components/detail-card.js";
|
|
21
21
|
export { renderInspectorCard } from "./components/inspector-card.js";
|
|
22
22
|
export { renderResourceBrowser } from "./components/resource-browser.js";
|
|
23
|
-
export { getTemplatePartialNames, renderTemplate, resolveTemplatePartials } from "./components/template.js";
|
|
23
|
+
export { TemplateParseError, getTemplatePartialNames, renderTemplate, resolveTemplatePartials } from "./components/template.js";
|
|
24
24
|
export { openExternal } from "./components/browser.js";
|
|
25
25
|
// ACP rendering
|
|
26
26
|
export * as acp from "./acp/index.js";
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { EventEmitter } from "node:events";
|
|
2
2
|
import { CANCEL } from "./cancel-symbol.js";
|
|
3
3
|
export type PromptStateName = "initial" | "active" | "submit" | "cancel" | "error";
|
|
4
|
+
/**
|
|
5
|
+
* Builds the non-TTY rejection message, naming the documented `--yes` flag for the
|
|
6
|
+
* command being run and keeping `POE_NO_PROMPT=1` as the secondary CI alternative.
|
|
7
|
+
*/
|
|
8
|
+
export declare function nonTtyPromptMessage(argv?: string[]): string;
|
|
4
9
|
export interface PromptState<Value> {
|
|
5
10
|
state: PromptStateName;
|
|
6
11
|
value: Value | undefined;
|
|
@@ -22,6 +22,20 @@ const cursor = {
|
|
|
22
22
|
const erase = {
|
|
23
23
|
down: "\x1b[J"
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Builds the non-TTY rejection message, naming the documented `--yes` flag for the
|
|
27
|
+
* command being run and keeping `POE_NO_PROMPT=1` as the secondary CI alternative.
|
|
28
|
+
*/
|
|
29
|
+
export function nonTtyPromptMessage(argv = process.argv) {
|
|
30
|
+
const tokens = [];
|
|
31
|
+
for (const arg of argv.slice(2)) {
|
|
32
|
+
if (arg.startsWith("-"))
|
|
33
|
+
break;
|
|
34
|
+
tokens.push(arg);
|
|
35
|
+
}
|
|
36
|
+
const retry = [...tokens, "--yes"].join(" ");
|
|
37
|
+
return `Interactive prompt requires a TTY. Re-run with \`${retry}\` to accept defaults non-interactively, or set POE_NO_PROMPT=1 in CI.`;
|
|
38
|
+
}
|
|
25
39
|
export class Prompt extends EventEmitter {
|
|
26
40
|
state = "initial";
|
|
27
41
|
value;
|
|
@@ -92,7 +106,7 @@ export class Prompt extends EventEmitter {
|
|
|
92
106
|
});
|
|
93
107
|
}
|
|
94
108
|
promptNonTty() {
|
|
95
|
-
return Promise.reject(new Error(
|
|
109
|
+
return Promise.reject(new Error(nonTtyPromptMessage()));
|
|
96
110
|
}
|
|
97
111
|
readNonTtyLine() {
|
|
98
112
|
return new Promise((resolve) => {
|
|
@@ -33,7 +33,7 @@ export function spinner() {
|
|
|
33
33
|
}
|
|
34
34
|
fallback = process.env.POE_NO_SPINNER === "1" || !process.stdout.isTTY;
|
|
35
35
|
if (fallback) {
|
|
36
|
-
process.stdout.write(`${currentMessage}\n`);
|
|
36
|
+
process.stdout.write(`${color.gray("│")} ${currentMessage}\n`);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
frameIndex = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolcraft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.138",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -100,8 +100,8 @@
|
|
|
100
100
|
"test": "cd ../.. && vitest run packages/toolcraft/src",
|
|
101
101
|
"test:unit": "cd ../.. && vitest run packages/toolcraft/src",
|
|
102
102
|
"lint": "cd ../.. && eslint packages/toolcraft/src --ext ts && tsc -p packages/toolcraft/tsconfig.json --noEmit",
|
|
103
|
-
"prepack": "node ../../scripts/manage-bundled-workspace-deps.mjs prepare . toolcraft-schema toolcraft-design @poe-code/frontmatter @poe-code/agent-mcp-config @poe-code/agent-human-in-loop @poe-code/task-list @poe-code/agent-defs @poe-code/config-mutations @poe-code/process-runner mcp-oauth-server tiny-http-mcp-server tiny-mcp-client tiny-stdio-mcp-server auth-store jose fast-string-width fast-wrap-ansi ignore jsonc-parser sisteransi smol-toml yaml",
|
|
104
|
-
"postpack": "node ../../scripts/manage-bundled-workspace-deps.mjs cleanup . toolcraft-schema toolcraft-design @poe-code/frontmatter @poe-code/agent-mcp-config @poe-code/agent-human-in-loop @poe-code/task-list @poe-code/agent-defs @poe-code/config-mutations @poe-code/process-runner mcp-oauth-server tiny-http-mcp-server tiny-mcp-client tiny-stdio-mcp-server auth-store jose fast-string-width fast-wrap-ansi ignore jsonc-parser sisteransi smol-toml yaml"
|
|
103
|
+
"prepack": "node ../../scripts/manage-bundled-workspace-deps.mjs prepare . toolcraft-schema toolcraft-design @poe-code/frontmatter @poe-code/agent-mcp-config @poe-code/agent-human-in-loop @poe-code/task-list @poe-code/agent-defs @poe-code/config-mutations @poe-code/user-error @poe-code/process-runner mcp-oauth-server tiny-http-mcp-server tiny-mcp-client tiny-stdio-mcp-server auth-store jose fast-string-width fast-wrap-ansi ignore jsonc-parser sisteransi smol-toml yaml",
|
|
104
|
+
"postpack": "node ../../scripts/manage-bundled-workspace-deps.mjs cleanup . toolcraft-schema toolcraft-design @poe-code/frontmatter @poe-code/agent-mcp-config @poe-code/agent-human-in-loop @poe-code/task-list @poe-code/agent-defs @poe-code/config-mutations @poe-code/user-error @poe-code/process-runner mcp-oauth-server tiny-http-mcp-server tiny-mcp-client tiny-stdio-mcp-server auth-store jose fast-string-width fast-wrap-ansi ignore jsonc-parser sisteransi smol-toml yaml"
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
107
|
"commander": "^13.1.0",
|
|
@@ -137,6 +137,7 @@
|
|
|
137
137
|
"@poe-code/task-list",
|
|
138
138
|
"@poe-code/agent-defs",
|
|
139
139
|
"@poe-code/config-mutations",
|
|
140
|
+
"@poe-code/user-error",
|
|
140
141
|
"@poe-code/process-runner",
|
|
141
142
|
"mcp-oauth-server",
|
|
142
143
|
"tiny-http-mcp-server",
|
|
@@ -153,7 +154,7 @@
|
|
|
153
154
|
"yaml"
|
|
154
155
|
],
|
|
155
156
|
"optionalDependencies": {
|
|
156
|
-
"toolcraft-schema": "0.0.
|
|
157
|
+
"toolcraft-schema": "0.0.138",
|
|
157
158
|
"toolcraft-design": "*",
|
|
158
159
|
"@poe-code/frontmatter": "*",
|
|
159
160
|
"@poe-code/agent-mcp-config": "*",
|
|
@@ -161,6 +162,7 @@
|
|
|
161
162
|
"@poe-code/task-list": "*",
|
|
162
163
|
"@poe-code/agent-defs": "*",
|
|
163
164
|
"@poe-code/config-mutations": "*",
|
|
165
|
+
"@poe-code/user-error": "*",
|
|
164
166
|
"@poe-code/process-runner": "*",
|
|
165
167
|
"mcp-oauth-server": "*",
|
|
166
168
|
"tiny-http-mcp-server": "*",
|