toolcraft 0.0.23 → 0.0.25

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.
Files changed (152) hide show
  1. package/README.md +2 -2
  2. package/dist/cli.compile-check.js +1 -0
  3. package/dist/cli.d.ts +1 -0
  4. package/dist/cli.js +50 -13
  5. package/dist/error-report.js +32 -3
  6. package/dist/human-in-loop/approval-tasks.d.ts +1 -0
  7. package/dist/human-in-loop/approval-tasks.js +7 -5
  8. package/dist/human-in-loop/approvals-commands.js +51 -8
  9. package/dist/human-in-loop/runner.js +24 -19
  10. package/dist/human-in-loop/state-machine.d.ts +3 -3
  11. package/dist/human-in-loop/state-machine.js +13 -5
  12. package/dist/index.d.ts +5 -0
  13. package/dist/index.js +6 -1
  14. package/dist/mcp-proxy.js +85 -19
  15. package/dist/mcp.compile-check.js +1 -0
  16. package/dist/mcp.d.ts +1 -0
  17. package/dist/mcp.js +50 -8
  18. package/dist/renderer.js +119 -13
  19. package/dist/sdk.compile-check.js +1 -0
  20. package/dist/sdk.d.ts +1 -0
  21. package/dist/sdk.js +56 -11
  22. package/node_modules/@poe-code/agent-defs/dist/registry.d.ts +1 -1
  23. package/node_modules/@poe-code/agent-defs/dist/registry.js +22 -11
  24. package/node_modules/@poe-code/agent-defs/package.json +1 -1
  25. package/node_modules/@poe-code/agent-human-in-loop/dist/providers/osascript-script.js +5 -1
  26. package/node_modules/@poe-code/agent-human-in-loop/dist/providers/osascript.js +1 -1
  27. package/node_modules/@poe-code/agent-human-in-loop/package.json +1 -1
  28. package/node_modules/@poe-code/agent-mcp-config/dist/apply.d.ts +1 -1
  29. package/node_modules/@poe-code/agent-mcp-config/dist/apply.js +41 -92
  30. package/node_modules/@poe-code/agent-mcp-config/dist/configs.js +4 -1
  31. package/node_modules/@poe-code/agent-mcp-config/dist/shapes.d.ts +14 -2
  32. package/node_modules/@poe-code/agent-mcp-config/dist/shapes.js +11 -4
  33. package/node_modules/@poe-code/agent-mcp-config/package.json +1 -1
  34. package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.js +200 -22
  35. package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.js +7 -1
  36. package/node_modules/@poe-code/config-mutations/dist/formats/index.js +1 -1
  37. package/node_modules/@poe-code/config-mutations/dist/formats/json.js +11 -7
  38. package/node_modules/@poe-code/config-mutations/dist/formats/object.d.ts +4 -0
  39. package/node_modules/@poe-code/config-mutations/dist/formats/object.js +27 -0
  40. package/node_modules/@poe-code/config-mutations/dist/formats/toml.js +12 -9
  41. package/node_modules/@poe-code/config-mutations/dist/formats/yaml.js +12 -9
  42. package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.d.ts +11 -1
  43. package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.js +10 -1
  44. package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.js +25 -1
  45. package/node_modules/@poe-code/config-mutations/dist/types.d.ts +12 -2
  46. package/node_modules/@poe-code/config-mutations/package.json +1 -1
  47. package/node_modules/@poe-code/design-system/dist/acp/components.js +3 -1
  48. package/node_modules/@poe-code/design-system/dist/components/browser.d.ts +1 -1
  49. package/node_modules/@poe-code/design-system/dist/components/browser.js +6 -1
  50. package/node_modules/@poe-code/design-system/dist/components/color.js +9 -8
  51. package/node_modules/@poe-code/design-system/dist/components/command-errors.js +3 -2
  52. package/node_modules/@poe-code/design-system/dist/components/detail-card.d.ts +22 -0
  53. package/node_modules/@poe-code/design-system/dist/components/detail-card.js +69 -0
  54. package/node_modules/@poe-code/design-system/dist/components/help-formatter.js +88 -11
  55. package/node_modules/@poe-code/design-system/dist/components/index.d.ts +1 -1
  56. package/node_modules/@poe-code/design-system/dist/components/index.js +1 -1
  57. package/node_modules/@poe-code/design-system/dist/components/table.d.ts +2 -0
  58. package/node_modules/@poe-code/design-system/dist/components/table.js +82 -5
  59. package/node_modules/@poe-code/design-system/dist/components/template.d.ts +4 -0
  60. package/node_modules/@poe-code/design-system/dist/components/template.js +198 -32
  61. package/node_modules/@poe-code/design-system/dist/components/text.js +29 -5
  62. package/node_modules/@poe-code/design-system/dist/dashboard/ansi.d.ts +2 -2
  63. package/node_modules/@poe-code/design-system/dist/dashboard/ansi.js +77 -32
  64. package/node_modules/@poe-code/design-system/dist/dashboard/buffer.js +28 -5
  65. package/node_modules/@poe-code/design-system/dist/dashboard/components/output-pane.js +45 -28
  66. package/node_modules/@poe-code/design-system/dist/dashboard/terminal-width.d.ts +4 -0
  67. package/node_modules/@poe-code/design-system/dist/dashboard/terminal-width.js +71 -0
  68. package/node_modules/@poe-code/design-system/dist/dashboard/types.d.ts +1 -0
  69. package/node_modules/@poe-code/design-system/dist/explorer/events.d.ts +6 -0
  70. package/node_modules/@poe-code/design-system/dist/explorer/reducer.js +32 -10
  71. package/node_modules/@poe-code/design-system/dist/explorer/render/detail.js +3 -0
  72. package/node_modules/@poe-code/design-system/dist/explorer/runtime.js +57 -6
  73. package/node_modules/@poe-code/design-system/dist/explorer/state.d.ts +1 -0
  74. package/node_modules/@poe-code/design-system/dist/explorer/state.js +12 -15
  75. package/node_modules/@poe-code/design-system/dist/index.d.ts +3 -1
  76. package/node_modules/@poe-code/design-system/dist/index.js +2 -1
  77. package/node_modules/@poe-code/design-system/dist/prompts/primitives/intro.js +2 -1
  78. package/node_modules/@poe-code/design-system/dist/prompts/primitives/log.js +8 -5
  79. package/node_modules/@poe-code/design-system/dist/prompts/primitives/note.js +1 -1
  80. package/node_modules/@poe-code/design-system/dist/static/menu.js +8 -2
  81. package/node_modules/@poe-code/design-system/dist/static/spinner.js +10 -4
  82. package/node_modules/@poe-code/design-system/dist/terminal-markdown/parser/frontmatter.js +9 -2
  83. package/node_modules/@poe-code/design-system/dist/terminal-markdown/renderer.js +19 -2
  84. package/node_modules/@poe-code/design-system/package.json +2 -1
  85. package/node_modules/@poe-code/process-runner/dist/docker/args.d.ts +1 -0
  86. package/node_modules/@poe-code/process-runner/dist/docker/args.js +11 -3
  87. package/node_modules/@poe-code/process-runner/dist/docker/docker-execution-env.js +377 -130
  88. package/node_modules/@poe-code/process-runner/dist/docker/docker-runner.js +78 -10
  89. package/node_modules/@poe-code/process-runner/dist/docker/env-file.d.ts +6 -0
  90. package/node_modules/@poe-code/process-runner/dist/docker/env-file.js +49 -0
  91. package/node_modules/@poe-code/process-runner/dist/host/host-execution-env.js +3 -2
  92. package/node_modules/@poe-code/process-runner/dist/host/host-runner.js +21 -5
  93. package/node_modules/@poe-code/process-runner/dist/index.d.ts +1 -0
  94. package/node_modules/@poe-code/process-runner/dist/index.js +1 -0
  95. package/node_modules/@poe-code/process-runner/dist/testing/mock-runner.js +30 -8
  96. package/node_modules/@poe-code/process-runner/dist/types.d.ts +6 -0
  97. package/node_modules/@poe-code/process-runner/dist/workspace-transfer.d.ts +61 -0
  98. package/node_modules/@poe-code/process-runner/dist/workspace-transfer.js +503 -0
  99. package/node_modules/@poe-code/process-runner/package.json +1 -1
  100. package/node_modules/@poe-code/task-list/README.md +0 -2
  101. package/node_modules/@poe-code/task-list/dist/backends/gh-issues-client.js +3 -0
  102. package/node_modules/@poe-code/task-list/dist/backends/gh-issues-sync.js +89 -59
  103. package/node_modules/@poe-code/task-list/dist/backends/gh-issues.d.ts +9 -3
  104. package/node_modules/@poe-code/task-list/dist/backends/gh-issues.js +460 -99
  105. package/node_modules/@poe-code/task-list/dist/backends/markdown-dir.js +156 -154
  106. package/node_modules/@poe-code/task-list/dist/backends/utils.d.ts +2 -0
  107. package/node_modules/@poe-code/task-list/dist/backends/utils.js +79 -0
  108. package/node_modules/@poe-code/task-list/dist/backends/yaml-file.js +120 -132
  109. package/node_modules/@poe-code/task-list/dist/index.d.ts +3 -1
  110. package/node_modules/@poe-code/task-list/dist/index.js +2 -0
  111. package/node_modules/@poe-code/task-list/dist/move.d.ts +2 -0
  112. package/node_modules/@poe-code/task-list/dist/move.js +215 -0
  113. package/node_modules/@poe-code/task-list/dist/open.js +3 -4
  114. package/node_modules/@poe-code/task-list/dist/state-machine.js +3 -1
  115. package/node_modules/@poe-code/task-list/dist/state.js +9 -0
  116. package/node_modules/@poe-code/task-list/dist/types.d.ts +48 -13
  117. package/node_modules/@poe-code/task-list/package.json +1 -2
  118. package/node_modules/auth-store/dist/create-secret-store.js +4 -1
  119. package/node_modules/auth-store/dist/encrypted-file-store.d.ts +8 -0
  120. package/node_modules/auth-store/dist/encrypted-file-store.js +104 -8
  121. package/node_modules/auth-store/dist/index.d.ts +1 -1
  122. package/node_modules/auth-store/dist/keychain-store.d.ts +4 -1
  123. package/node_modules/auth-store/dist/keychain-store.js +18 -16
  124. package/node_modules/auth-store/dist/provider-store.d.ts +5 -1
  125. package/node_modules/auth-store/dist/provider-store.js +55 -7
  126. package/node_modules/auth-store/dist/types.d.ts +3 -1
  127. package/node_modules/auth-store/package.json +2 -1
  128. package/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.js +46 -15
  129. package/node_modules/mcp-oauth/dist/client/loopback-authorization.js +49 -12
  130. package/node_modules/mcp-oauth/dist/client/token-endpoint.js +6 -1
  131. package/node_modules/mcp-oauth/dist/server/jwks-token-verifier.js +1 -1
  132. package/node_modules/mcp-oauth/package.json +1 -0
  133. package/node_modules/tiny-mcp-client/.turbo/turbo-build.log +1 -1
  134. package/node_modules/tiny-mcp-client/dist/internal.d.ts +9 -4
  135. package/node_modules/tiny-mcp-client/dist/internal.js +244 -66
  136. package/node_modules/tiny-mcp-client/dist/oauth-discovery.d.ts +1 -1
  137. package/node_modules/tiny-mcp-client/dist/oauth-discovery.js +4 -7
  138. package/node_modules/tiny-mcp-client/package.json +2 -1
  139. package/node_modules/tiny-mcp-client/src/http-oauth.integration.test.ts +1 -1
  140. package/node_modules/tiny-mcp-client/src/http-oauth.test.ts +46 -0
  141. package/node_modules/tiny-mcp-client/src/internal.ts +287 -76
  142. package/node_modules/tiny-mcp-client/src/mcp-client-sdk.test.ts +32 -0
  143. package/node_modules/tiny-mcp-client/src/mcp-client-tiny-stdio-test-server-tools.test.ts +1 -1
  144. package/node_modules/tiny-mcp-client/src/oauth-discovery.ts +5 -10
  145. package/node_modules/tiny-mcp-client/src/transports.test.ts +588 -6
  146. package/package.json +10 -12
  147. package/node_modules/@poe-code/file-lock/README.md +0 -52
  148. package/node_modules/@poe-code/file-lock/dist/index.d.ts +0 -1
  149. package/node_modules/@poe-code/file-lock/dist/index.js +0 -1
  150. package/node_modules/@poe-code/file-lock/dist/lock.d.ts +0 -27
  151. package/node_modules/@poe-code/file-lock/dist/lock.js +0 -203
  152. package/node_modules/@poe-code/file-lock/package.json +0 -23
@@ -2,13 +2,19 @@ import { color } from "../components/color.js";
2
2
  import { symbols } from "../components/symbols.js";
3
3
  import { resolveOutputFormat } from "../internal/output-format.js";
4
4
  import { getTheme } from "../internal/theme-detect.js";
5
+ function renderMarkdownInline(value) {
6
+ return value.replaceAll("\r\n", " ").replaceAll("\n", " ").replaceAll("\r", " ");
7
+ }
5
8
  export function renderMenu(opts) {
6
9
  const format = resolveOutputFormat();
7
10
  const selectedIndex = opts.selectedIndex ?? 0;
11
+ if (!Number.isInteger(selectedIndex) || !Number.isFinite(selectedIndex)) {
12
+ throw new Error("selectedIndex must be a finite integer.");
13
+ }
8
14
  if (format === "markdown") {
9
15
  return [
10
- `**${opts.message}**`,
11
- ...opts.options.map((option, index) => `- [${index === selectedIndex ? "x" : " "}] ${option.label}`)
16
+ `**${renderMarkdownInline(opts.message)}**`,
17
+ ...opts.options.map((option, index) => `- [${index === selectedIndex ? "x" : " "}] ${renderMarkdownInline(option.label)}`)
12
18
  ].join("\n");
13
19
  }
14
20
  if (format === "json") {
@@ -1,7 +1,7 @@
1
1
  import { color } from "../components/color.js";
2
2
  import { symbols } from "../components/symbols.js";
3
3
  import { resolveOutputFormat } from "../internal/output-format.js";
4
- export const SPINNER_FRAMES = ["◒", "◐", "◓", "◑"];
4
+ export const SPINNER_FRAMES = Object.freeze(["◒", "◐", "◓", "◑"]);
5
5
  export function renderSpinnerFrame(options) {
6
6
  const format = resolveOutputFormat();
7
7
  if (format === "markdown") {
@@ -16,22 +16,28 @@ export function renderSpinnerFrame(options) {
16
16
  })}\n`;
17
17
  }
18
18
  const frame = options.frame ?? 0;
19
- const spinnerChar = color.magenta(SPINNER_FRAMES[frame % SPINNER_FRAMES.length]);
19
+ const index = ((frame % SPINNER_FRAMES.length) + SPINNER_FRAMES.length) % SPINNER_FRAMES.length;
20
+ const spinnerChar = color.magenta(SPINNER_FRAMES[index]);
20
21
  const timerSuffix = options.timer ? color.dim(` [${options.timer}]`) : "";
21
22
  const bar = color.gray(symbols.bar);
22
23
  return `${spinnerChar} ${options.message}${timerSuffix}\n${bar}`;
23
24
  }
25
+ function renderMarkdownInline(value) {
26
+ return value.replaceAll("\r\n", " ").replaceAll("\n", " ").replaceAll("\r", " ");
27
+ }
24
28
  export function renderSpinnerStopped(options) {
25
29
  const format = resolveOutputFormat();
26
30
  if (format === "markdown") {
27
- return `- ${options.message}${options.timer ? ` [${options.timer}]` : ""}\n`;
31
+ return `- ${renderMarkdownInline(options.message)}${options.timer ? ` [${renderMarkdownInline(options.timer)}]` : ""}\n`;
28
32
  }
29
33
  if (format === "json") {
30
34
  return `${JSON.stringify({
31
35
  type: "spinner",
32
36
  state: "stopped",
33
37
  message: options.message,
34
- ...(options.timer ? { timer: options.timer } : {})
38
+ code: options.code ?? 0,
39
+ ...(options.timer ? { timer: options.timer } : {}),
40
+ ...(options.subtext ? { subtext: options.subtext } : {})
35
41
  })}\n`;
36
42
  }
37
43
  const code = options.code ?? 0;
@@ -32,7 +32,12 @@ class YamlSubsetParser {
32
32
  throw new FrontmatterParseError("Invalid mapping entry.");
33
33
  }
34
34
  this.position += 1;
35
- result[entry.key] = this.readEntryValue(entry, expectedIndent);
35
+ Object.defineProperty(result, entry.key, {
36
+ configurable: true,
37
+ enumerable: true,
38
+ value: this.readEntryValue(entry, expectedIndent),
39
+ writable: true
40
+ });
36
41
  }
37
42
  return result;
38
43
  }
@@ -345,8 +350,10 @@ function sliceFrontmatterBlock(content, start, end) {
345
350
  function startsWithFrontmatterFence(value) {
346
351
  return (value.startsWith("---\n") ||
347
352
  value.startsWith("---\r\n") ||
353
+ value.startsWith("---\r") ||
348
354
  value.startsWith("\uFEFF---\n") ||
349
- value.startsWith("\uFEFF---\r\n"));
355
+ value.startsWith("\uFEFF---\r\n") ||
356
+ value.startsWith("\uFEFF---\r"));
350
357
  }
351
358
  function stripBom(value) {
352
359
  return value.startsWith("\uFEFF") ? value.slice(1) : value;
@@ -6,7 +6,11 @@ import { typography } from "../tokens/typography.js";
6
6
  import { widths } from "../tokens/widths.js";
7
7
  const lineChar = "─";
8
8
  export function render(ast, options = {}) {
9
- const width = Math.max(1, options.width ?? process.stdout.columns ?? widths.maxLine);
9
+ const requestedWidth = options.width ?? process.stdout.columns ?? widths.maxLine;
10
+ if (!Number.isFinite(requestedWidth) || requestedWidth <= 0) {
11
+ throw new Error("width must be a positive finite number.");
12
+ }
13
+ const width = Math.max(1, requestedWidth);
10
14
  const context = {
11
15
  width,
12
16
  showFrontmatter: options.showFrontmatter ?? false,
@@ -215,7 +219,20 @@ function formatFrontmatterValue(value) {
215
219
  if (typeof value === "number" || typeof value === "boolean") {
216
220
  return String(value);
217
221
  }
218
- return JSON.stringify(value);
222
+ const ancestors = [];
223
+ return JSON.stringify(value, function (_key, nestedValue) {
224
+ if (typeof nestedValue !== "object" || nestedValue === null) {
225
+ return nestedValue;
226
+ }
227
+ while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) {
228
+ ancestors.pop();
229
+ }
230
+ if (ancestors.includes(nestedValue)) {
231
+ return "[Circular]";
232
+ }
233
+ ancestors.push(nestedValue);
234
+ return nestedValue;
235
+ });
219
236
  }
220
237
  function renderHtml(node, context) {
221
238
  const value = stripHtmlTags(node.value).trim();
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@poe-code/design-system",
3
3
  "version": "0.0.2",
4
+ "private": true,
4
5
  "type": "module",
5
6
  "main": "dist/index.js",
6
7
  "types": "dist/index.d.ts",
7
8
  "scripts": {
8
- "build": "tsc",
9
+ "build": "node ../../scripts/guard-package-dist.mjs && tsc",
9
10
  "postbuild": "node scripts/smoke-built-exports.cjs",
10
11
  "lint": "cd ../.. && eslint packages/design-system --ext ts && tsc -p packages/design-system/tsconfig.json --noEmit",
11
12
  "test": "cd ../.. && vitest run $(rg --files packages/design-system/src -g '*.test.ts' | sort | tr '\\n' ' ')",
@@ -1,2 +1,3 @@
1
1
  import type { DockerRunArgs } from "../types.js";
2
+ export declare function buildDockerEnvArgs(input: Pick<DockerRunArgs, "env" | "envFilePath">): string[];
2
3
  export declare function buildDockerRunArgs(input: DockerRunArgs): string[];
@@ -1,4 +1,14 @@
1
1
  import path from "node:path";
2
+ export function buildDockerEnvArgs(input) {
3
+ const keys = Object.keys(input.env ?? {});
4
+ if (keys.length === 0) {
5
+ return [];
6
+ }
7
+ if (input.envFilePath !== undefined) {
8
+ return ["--env-file", input.envFilePath];
9
+ }
10
+ return keys.flatMap((key) => ["-e", key]);
11
+ }
2
12
  export function buildDockerRunArgs(input) {
3
13
  const args = [input.engine];
4
14
  if (input.engine === "docker" && input.context) {
@@ -21,9 +31,7 @@ export function buildDockerRunArgs(input) {
21
31
  if (input.cwd !== undefined) {
22
32
  args.push("-w", input.cwd);
23
33
  }
24
- for (const [key, value] of Object.entries(input.env ?? {})) {
25
- args.push("-e", `${key}=${value}`);
26
- }
34
+ args.push(...buildDockerEnvArgs(input));
27
35
  for (const mount of input.mounts) {
28
36
  const volume = `${path.resolve(mount.source)}:${mount.target}${mount.readonly ? ":ro" : ""}`;
29
37
  args.push("-v", volume);