toolcraft 0.0.17 → 0.0.18
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.d.ts +2 -0
- package/dist/cli.js +833 -124
- package/dist/error-report.d.ts +39 -0
- package/dist/error-report.js +330 -0
- package/dist/human-in-loop/approval-tasks.js +11 -8
- package/dist/human-in-loop/approvals-commands.js +21 -20
- package/dist/human-in-loop/default-provider.js +5 -3
- package/dist/human-in-loop/runner.js +45 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +55 -35
- package/dist/json-schema-converter.d.ts +1 -0
- package/dist/json-schema-converter.js +102 -52
- package/dist/mcp-proxy.d.ts +1 -0
- package/dist/mcp-proxy.js +13 -6
- package/dist/mcp.d.ts +2 -0
- package/dist/mcp.js +131 -55
- package/dist/sdk.d.ts +4 -2
- package/dist/sdk.js +132 -48
- package/dist/source-snippet.d.ts +8 -0
- package/dist/source-snippet.js +42 -0
- package/dist/stack-trim.d.ts +4 -0
- package/dist/stack-trim.js +70 -0
- package/dist/suggest.d.ts +4 -0
- package/dist/suggest.js +46 -0
- package/dist/user-error.d.ts +3 -0
- package/dist/user-error.js +7 -1
- package/dist/validation-errors.d.ts +5 -0
- package/dist/validation-errors.js +18 -0
- package/node_modules/@poe-code/design-system/dist/components/help-formatter-plain.d.ts +1 -0
- package/node_modules/@poe-code/design-system/dist/components/help-formatter-plain.js +1 -1
- package/node_modules/@poe-code/design-system/dist/components/text.d.ts +1 -0
- package/node_modules/@poe-code/design-system/dist/components/text.js +8 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/buffer.js +8 -1
- package/node_modules/@poe-code/design-system/dist/dashboard/keymap.d.ts +5 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/keymap.js +146 -12
- package/node_modules/@poe-code/design-system/dist/dashboard/terminal.js +31 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/types.d.ts +1 -0
- package/node_modules/@poe-code/design-system/dist/explorer/actions.d.ts +16 -0
- package/node_modules/@poe-code/design-system/dist/explorer/actions.js +39 -0
- package/node_modules/@poe-code/design-system/dist/explorer/demo.d.ts +13 -0
- package/node_modules/@poe-code/design-system/dist/explorer/demo.js +297 -0
- package/node_modules/@poe-code/design-system/dist/explorer/events.d.ts +61 -0
- package/node_modules/@poe-code/design-system/dist/explorer/events.js +1 -0
- package/node_modules/@poe-code/design-system/dist/explorer/filter.d.ts +10 -0
- package/node_modules/@poe-code/design-system/dist/explorer/filter.js +95 -0
- package/node_modules/@poe-code/design-system/dist/explorer/index.d.ts +8 -0
- package/node_modules/@poe-code/design-system/dist/explorer/index.js +8 -0
- package/node_modules/@poe-code/design-system/dist/explorer/jobs.d.ts +7 -0
- package/node_modules/@poe-code/design-system/dist/explorer/jobs.js +59 -0
- package/node_modules/@poe-code/design-system/dist/explorer/keymap.d.ts +21 -0
- package/node_modules/@poe-code/design-system/dist/explorer/keymap.js +363 -0
- package/node_modules/@poe-code/design-system/dist/explorer/layout.d.ts +20 -0
- package/node_modules/@poe-code/design-system/dist/explorer/layout.js +73 -0
- package/node_modules/@poe-code/design-system/dist/explorer/reducer.d.ts +9 -0
- package/node_modules/@poe-code/design-system/dist/explorer/reducer.js +704 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/detail.d.ts +4 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/detail.js +96 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/footer.d.ts +4 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/footer.js +49 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/header.d.ts +4 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/header.js +56 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/index.d.ts +8 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/index.js +61 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/list.d.ts +4 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/list.js +106 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/modal.d.ts +3 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/modal.js +91 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/test-fixtures.d.ts +8 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/test-fixtures.js +156 -0
- package/node_modules/@poe-code/design-system/dist/explorer/runtime.d.ts +2 -0
- package/node_modules/@poe-code/design-system/dist/explorer/runtime.js +282 -0
- package/node_modules/@poe-code/design-system/dist/explorer/runtime.test-helpers.d.ts +50 -0
- package/node_modules/@poe-code/design-system/dist/explorer/runtime.test-helpers.js +101 -0
- package/node_modules/@poe-code/design-system/dist/explorer/state.d.ts +130 -0
- package/node_modules/@poe-code/design-system/dist/explorer/state.js +87 -0
- package/node_modules/@poe-code/design-system/dist/explorer/theme.d.ts +27 -0
- package/node_modules/@poe-code/design-system/dist/explorer/theme.js +97 -0
- package/node_modules/@poe-code/design-system/dist/index.d.ts +3 -0
- package/node_modules/@poe-code/design-system/dist/index.js +3 -0
- package/node_modules/@poe-code/design-system/package.json +1 -0
- package/package.json +6 -2
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const HEADER_HEIGHT = 3;
|
|
2
|
+
const FOOTER_HEIGHT = 1;
|
|
3
|
+
export function computeExplorerLayout(opts) {
|
|
4
|
+
const cols = normalizeSize(opts.cols);
|
|
5
|
+
const rows = normalizeSize(opts.rows);
|
|
6
|
+
const mode = resolveMode(cols);
|
|
7
|
+
const footerHeight = rows > 0 ? Math.min(FOOTER_HEIGHT, rows) : 0;
|
|
8
|
+
const headerHeight = Math.min(HEADER_HEIGHT, Math.max(0, rows - footerHeight));
|
|
9
|
+
const contentY = headerHeight;
|
|
10
|
+
const contentHeight = Math.max(0, rows - headerHeight - footerHeight);
|
|
11
|
+
const footerY = headerHeight + contentHeight;
|
|
12
|
+
const header = { x: 0, y: 0, width: cols, height: headerHeight };
|
|
13
|
+
const footer = { x: 0, y: footerY, width: cols, height: footerHeight };
|
|
14
|
+
if (mode === "too-narrow" || mode === "narrow-list-only") {
|
|
15
|
+
return {
|
|
16
|
+
mode,
|
|
17
|
+
header,
|
|
18
|
+
list: { x: 0, y: contentY, width: cols, height: contentHeight },
|
|
19
|
+
detail: { x: 0, y: contentY + contentHeight, width: 0, height: 0 },
|
|
20
|
+
footer
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
if (opts.detailHidden === true) {
|
|
24
|
+
return {
|
|
25
|
+
mode,
|
|
26
|
+
header,
|
|
27
|
+
list: { x: 0, y: contentY, width: cols, height: contentHeight },
|
|
28
|
+
detail: { x: cols, y: contentY, width: 0, height: contentHeight },
|
|
29
|
+
footer
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
if (mode === "narrow-vertical") {
|
|
33
|
+
const listHeight = Math.ceil(contentHeight / 2);
|
|
34
|
+
const detailHeight = contentHeight - listHeight;
|
|
35
|
+
return {
|
|
36
|
+
mode,
|
|
37
|
+
header,
|
|
38
|
+
list: { x: 0, y: contentY, width: cols, height: listHeight },
|
|
39
|
+
detail: { x: 0, y: contentY + listHeight, width: cols, height: detailHeight },
|
|
40
|
+
footer
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const listWidth = mode === "wide" ? Math.floor((cols * 5) / 12) : Math.floor((cols * 2) / 5);
|
|
44
|
+
const detailWidth = cols - listWidth;
|
|
45
|
+
return {
|
|
46
|
+
mode,
|
|
47
|
+
header,
|
|
48
|
+
list: { x: 0, y: contentY, width: listWidth, height: contentHeight },
|
|
49
|
+
detail: { x: listWidth, y: contentY, width: detailWidth, height: contentHeight },
|
|
50
|
+
footer
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function resolveMode(cols) {
|
|
54
|
+
if (cols < 40) {
|
|
55
|
+
return "too-narrow";
|
|
56
|
+
}
|
|
57
|
+
if (cols < 80) {
|
|
58
|
+
return "narrow-list-only";
|
|
59
|
+
}
|
|
60
|
+
if (cols < 100) {
|
|
61
|
+
return "narrow-vertical";
|
|
62
|
+
}
|
|
63
|
+
if (cols < 120) {
|
|
64
|
+
return "medium";
|
|
65
|
+
}
|
|
66
|
+
return "wide";
|
|
67
|
+
}
|
|
68
|
+
function normalizeSize(value) {
|
|
69
|
+
if (!Number.isFinite(value)) {
|
|
70
|
+
return 0;
|
|
71
|
+
}
|
|
72
|
+
return Math.max(0, Math.floor(value));
|
|
73
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ActionRuntimeHandles } from "./actions.js";
|
|
2
|
+
import type { Effect, ExplorerEvent } from "./events.js";
|
|
3
|
+
import { type ExplorerState } from "./state.js";
|
|
4
|
+
type StepResult = {
|
|
5
|
+
state: ExplorerState;
|
|
6
|
+
effects: Effect[];
|
|
7
|
+
};
|
|
8
|
+
export declare function step(state: ExplorerState, event: ExplorerEvent, runtimeHandles?: ActionRuntimeHandles): StepResult;
|
|
9
|
+
export {};
|