toolcraft 0.0.26 → 0.0.33
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.compile-check.js +7 -1
- package/dist/cli.d.ts +9 -1
- package/dist/cli.js +134 -62
- package/dist/design.d.ts +1 -0
- package/dist/design.js +1 -0
- package/dist/error-codes.d.ts +1 -0
- package/dist/error-codes.js +6 -0
- package/dist/error-report.js +99 -29
- package/dist/human-in-loop/approvals-commands.js +2 -1
- package/dist/human-in-loop/runner.js +2 -2
- package/dist/index.d.ts +6 -2
- package/dist/json-schema-converter.js +12 -1
- package/dist/mcp-proxy.js +26 -9
- package/dist/mcp.js +55 -4
- package/dist/renderer.js +1 -1
- package/dist/schema-scope.js +22 -1
- package/dist/sdk.js +51 -3
- package/dist/source-snippet.js +1 -1
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-code.js +5 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/codex.js +10 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/cursor.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/cursor.js +15 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/goose.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/index.d.ts +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/index.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/opencode.js +5 -0
- package/node_modules/@poe-code/agent-defs/dist/index.d.ts +2 -2
- package/node_modules/@poe-code/agent-defs/dist/index.js +1 -1
- package/node_modules/@poe-code/agent-defs/dist/registry.js +8 -1
- package/node_modules/@poe-code/agent-defs/dist/specifier.js +7 -3
- package/node_modules/@poe-code/agent-defs/dist/types.d.ts +5 -0
- package/node_modules/@poe-code/agent-human-in-loop/dist/providers/osascript.js +7 -1
- package/node_modules/@poe-code/agent-mcp-config/dist/configs.js +6 -0
- package/node_modules/@poe-code/config-mutations/dist/error-codes.d.ts +1 -0
- package/node_modules/@poe-code/config-mutations/dist/error-codes.js +6 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.js +25 -15
- package/node_modules/@poe-code/config-mutations/dist/formats/json.js +1 -1
- package/node_modules/@poe-code/config-mutations/dist/formats/toml.js +1 -1
- package/node_modules/@poe-code/config-mutations/dist/formats/yaml.js +1 -1
- package/node_modules/@poe-code/config-mutations/dist/fs-utils.js +2 -4
- package/node_modules/@poe-code/config-mutations/dist/template/render.js +1 -1
- package/node_modules/@poe-code/config-mutations/package.json +1 -1
- package/node_modules/@poe-code/process-runner/dist/host/host-execution-env.js +18 -5
- package/node_modules/@poe-code/process-runner/dist/host/host-runner.js +38 -4
- package/node_modules/@poe-code/process-runner/dist/workspace-transfer.js +8 -2
- package/node_modules/@poe-code/task-list/dist/backends/gh-issues-sync.js +18 -7
- package/node_modules/@poe-code/task-list/dist/backends/markdown-dir.js +13 -6
- package/node_modules/@poe-code/task-list/dist/backends/utils.js +15 -10
- package/node_modules/@poe-code/task-list/dist/backends/yaml-file.js +39 -22
- package/node_modules/@poe-code/task-list/dist/move.js +4 -1
- package/node_modules/@poe-code/task-list/dist/open.js +42 -20
- package/node_modules/@poe-code/task-list/dist/state-machine.js +8 -5
- package/node_modules/auth-store/dist/create-secret-store.js +6 -1
- package/node_modules/auth-store/dist/encrypted-file-store.d.ts +1 -1
- package/node_modules/auth-store/dist/encrypted-file-store.js +32 -28
- package/node_modules/auth-store/dist/error-codes.d.ts +1 -0
- package/node_modules/auth-store/dist/error-codes.js +5 -0
- package/node_modules/auth-store/dist/keychain-store.js +23 -8
- package/node_modules/mcp-oauth/dist/client/auth-store-session-store.js +17 -5
- package/node_modules/mcp-oauth/dist/client/authorization-state.js +21 -8
- package/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.js +128 -55
- package/node_modules/mcp-oauth/dist/client/token-endpoint.js +27 -17
- package/node_modules/mcp-oauth/dist/server/jwks-token-verifier.js +43 -22
- package/node_modules/toolcraft-design/README.md +148 -0
- package/node_modules/toolcraft-design/dist/components/catalog.d.ts +26 -0
- package/node_modules/toolcraft-design/dist/components/catalog.js +94 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/index.d.ts +2 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/index.js +1 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/components/footer.js +1 -2
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/components/output-pane.js +16 -19
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/components/stats-pane.js +1 -15
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/demo.js +2 -2
- package/node_modules/toolcraft-design/dist/explorer/theme.js +29 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/index.d.ts +7 -1
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/index.js +4 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/internal/theme-detect.d.ts +1 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/internal/theme-detect.js +28 -6
- package/node_modules/toolcraft-design/dist/internal/theme-state.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/internal/theme-state.js +35 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/theme.d.ts +1 -1
- package/node_modules/toolcraft-design/dist/prompts/theme.js +15 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/parser/frontmatter.js +50 -0
- package/node_modules/toolcraft-design/dist/tokens/brand.d.ts +5 -0
- package/node_modules/toolcraft-design/dist/tokens/brand.js +5 -0
- package/node_modules/toolcraft-design/dist/tokens/colors.d.ts +37 -0
- package/node_modules/toolcraft-design/dist/tokens/colors.js +85 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/tokens/index.d.ts +2 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/tokens/index.js +1 -0
- package/node_modules/toolcraft-design/package.json +42 -0
- package/package.json +10 -6
- package/node_modules/@poe-code/design-system/dist/explorer/theme.js +0 -97
- package/node_modules/@poe-code/design-system/dist/prompts/theme.js +0 -12
- package/node_modules/@poe-code/design-system/dist/tokens/colors.d.ts +0 -35
- package/node_modules/@poe-code/design-system/dist/tokens/colors.js +0 -34
- package/node_modules/@poe-code/design-system/package.json +0 -29
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/acp/components.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/acp/components.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/acp/index.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/acp/index.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/acp/writer.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/acp/writer.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/browser.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/browser.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/color.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/color.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/command-errors.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/command-errors.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/detail-card.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/detail-card.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/help-formatter-plain.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/help-formatter-plain.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/help-formatter.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/help-formatter.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/logger.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/logger.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/symbols.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/symbols.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/table.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/table.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/template.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/template.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/text.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/text.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/ansi.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/ansi.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/buffer.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/buffer.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/components/border.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/components/border.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/components/footer.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/components/output-pane.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/components/stats-pane.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/dashboard.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/dashboard.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/demo.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/demo.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/index.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/index.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/keymap.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/keymap.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/layout.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/layout.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/should-use-dashboard.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/should-use-dashboard.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/snapshot.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/snapshot.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/store.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/store.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/terminal-width.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/terminal-width.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/terminal.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/terminal.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/types.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/types.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/actions.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/actions.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/demo.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/events.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/events.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/filter.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/filter.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/index.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/index.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/jobs.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/jobs.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/keymap.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/keymap.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/layout.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/layout.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/reducer.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/reducer.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/detail.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/detail.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/footer.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/footer.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/header.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/header.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/index.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/index.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/list.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/list.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/modal.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/modal.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/test-fixtures.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/test-fixtures.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/text.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/text.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/runtime.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/runtime.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/runtime.test-helpers.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/runtime.test-helpers.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/state.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/state.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/theme.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/internal/color-support.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/internal/color-support.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/internal/output-format.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/internal/output-format.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/internal/strip-ansi.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/internal/strip-ansi.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/index.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/index.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/cancel.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/cancel.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/intro.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/intro.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/log.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/log.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/note.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/note.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/outro.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/outro.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/spinner.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/spinner.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/static/index.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/static/index.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/static/menu.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/static/menu.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/static/spinner.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/static/spinner.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/ast.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/ast.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/demo-content.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/demo-content.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/index.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/index.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/parser/block.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/parser/block.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/parser/frontmatter.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/parser/inline.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/parser/inline.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/parser.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/parser.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/renderer.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/renderer.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/testing/theme-render-fixture.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/testing/theme-render-fixture.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/tokens/spacing.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/tokens/spacing.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/tokens/typography.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/tokens/typography.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/tokens/widths.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/tokens/widths.js +0 -0
package/dist/error-report.js
CHANGED
|
@@ -116,6 +116,25 @@ function redactValue(value) {
|
|
|
116
116
|
}
|
|
117
117
|
return `<set, ${value.length} chars>`;
|
|
118
118
|
}
|
|
119
|
+
function collectStringLeaves(value, output) {
|
|
120
|
+
if (typeof value === "string") {
|
|
121
|
+
if (value.length > 0) {
|
|
122
|
+
output.add(value);
|
|
123
|
+
}
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (Array.isArray(value)) {
|
|
127
|
+
for (const entry of value) {
|
|
128
|
+
collectStringLeaves(entry, output);
|
|
129
|
+
}
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (isPlainObject(value)) {
|
|
133
|
+
for (const entry of Object.values(value)) {
|
|
134
|
+
collectStringLeaves(entry, output);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
119
138
|
function schemaSecretValue(schema) {
|
|
120
139
|
const unwrapped = unwrapOptional(schema);
|
|
121
140
|
if (unwrapped.kind === "string" || unwrapped.kind === "number") {
|
|
@@ -155,6 +174,52 @@ function redactParams(params, command) {
|
|
|
155
174
|
}
|
|
156
175
|
return redactParamsValue(params, command.params, "");
|
|
157
176
|
}
|
|
177
|
+
function collectSensitiveParamValues(value, schema, name, output) {
|
|
178
|
+
if (shouldRedactParam(name, schema)) {
|
|
179
|
+
collectStringLeaves(value, output);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const unwrapped = unwrapOptional(schema);
|
|
183
|
+
if (unwrapped.kind === "object" && isPlainObject(value)) {
|
|
184
|
+
for (const [key, childValue] of Object.entries(value)) {
|
|
185
|
+
const childSchema = unwrapped.shape[key];
|
|
186
|
+
if (childSchema !== undefined) {
|
|
187
|
+
collectSensitiveParamValues(childValue, childSchema, key, output);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (unwrapped.kind === "array" && Array.isArray(value)) {
|
|
193
|
+
for (const entry of value) {
|
|
194
|
+
collectSensitiveParamValues(entry, unwrapped.item, name, output);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function createReportStringRedactor(context, env) {
|
|
199
|
+
const values = new Set();
|
|
200
|
+
for (const value of Object.values(context.secrets ?? {})) {
|
|
201
|
+
if (value !== undefined && value.length > 0) {
|
|
202
|
+
values.add(value);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
for (const [name, secret] of Object.entries(context.command?.secrets ?? {})) {
|
|
206
|
+
const value = context.secrets?.[name] ?? env[secret.env];
|
|
207
|
+
if (value !== undefined && value.length > 0) {
|
|
208
|
+
values.add(value);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (context.command !== undefined) {
|
|
212
|
+
collectSensitiveParamValues(context.params, context.command.params, "", values);
|
|
213
|
+
}
|
|
214
|
+
const orderedValues = [...values].sort((left, right) => right.length - left.length);
|
|
215
|
+
return (value) => {
|
|
216
|
+
let redacted = value;
|
|
217
|
+
for (const secretValue of orderedValues) {
|
|
218
|
+
redacted = redacted.split(secretValue).join("<redacted>");
|
|
219
|
+
}
|
|
220
|
+
return redacted;
|
|
221
|
+
};
|
|
222
|
+
}
|
|
158
223
|
function commandSecretEnvNames(secrets) {
|
|
159
224
|
if (secrets === undefined) {
|
|
160
225
|
return [];
|
|
@@ -203,7 +268,7 @@ function redactArgv(argv, options) {
|
|
|
203
268
|
function stableJson(value) {
|
|
204
269
|
return JSON.stringify(value, null, 2) ?? "undefined";
|
|
205
270
|
}
|
|
206
|
-
function redactStructuredErrorField(name, value) {
|
|
271
|
+
function redactStructuredErrorField(name, value, redactString) {
|
|
207
272
|
if (typeof value === "string") {
|
|
208
273
|
const redactedHeaderValue = redactHttpHeaderValue(name, value);
|
|
209
274
|
if (redactedHeaderValue !== value) {
|
|
@@ -212,23 +277,27 @@ function redactStructuredErrorField(name, value) {
|
|
|
212
277
|
if (isSensitiveName(name)) {
|
|
213
278
|
return "<redacted>";
|
|
214
279
|
}
|
|
280
|
+
return redactString(value);
|
|
215
281
|
}
|
|
216
282
|
if (Array.isArray(value)) {
|
|
217
|
-
return value.map((entry) => redactStructuredErrorField(name, entry));
|
|
283
|
+
return value.map((entry) => redactStructuredErrorField(name, entry, redactString));
|
|
218
284
|
}
|
|
219
285
|
if (isPlainObject(value)) {
|
|
220
|
-
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [
|
|
286
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [
|
|
287
|
+
key,
|
|
288
|
+
redactStructuredErrorField(key, entry, redactString)
|
|
289
|
+
]));
|
|
221
290
|
}
|
|
222
291
|
return value;
|
|
223
292
|
}
|
|
224
|
-
function ownStructuredFields(error) {
|
|
293
|
+
function ownStructuredFields(error, redactString) {
|
|
225
294
|
const fields = {};
|
|
226
295
|
for (const key of Object.keys(error)) {
|
|
227
296
|
if (key === "name" || key === "message" || key === "stack" || key === "cause") {
|
|
228
297
|
continue;
|
|
229
298
|
}
|
|
230
299
|
Object.defineProperty(fields, key, {
|
|
231
|
-
value: redactStructuredErrorField(key, error[key]),
|
|
300
|
+
value: redactStructuredErrorField(key, error[key], redactString),
|
|
232
301
|
enumerable: true,
|
|
233
302
|
configurable: true,
|
|
234
303
|
writable: true
|
|
@@ -236,47 +305,47 @@ function ownStructuredFields(error) {
|
|
|
236
305
|
}
|
|
237
306
|
return fields;
|
|
238
307
|
}
|
|
239
|
-
function formatStackChain(error) {
|
|
308
|
+
function formatStackChain(error, redactString) {
|
|
240
309
|
const lines = [];
|
|
241
310
|
let current = error;
|
|
242
311
|
let index = 0;
|
|
243
312
|
while (current !== undefined) {
|
|
244
313
|
if (current instanceof Error) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
: `Caused by: ${current.stack ?? String(current)}`);
|
|
314
|
+
const stack = current.stack ?? String(current);
|
|
315
|
+
lines.push(redactString(index === 0 ? stack : `Caused by: ${stack}`));
|
|
248
316
|
current = current.cause;
|
|
249
317
|
}
|
|
250
318
|
else {
|
|
251
|
-
|
|
319
|
+
const message = String(current);
|
|
320
|
+
lines.push(redactString(index === 0 ? message : `Caused by: ${message}`));
|
|
252
321
|
current = undefined;
|
|
253
322
|
}
|
|
254
323
|
index += 1;
|
|
255
324
|
}
|
|
256
325
|
return lines.join("\n");
|
|
257
326
|
}
|
|
258
|
-
function formatHeaderValue(name, value) {
|
|
259
|
-
return redactHttpHeaderValue(name, value);
|
|
327
|
+
function formatHeaderValue(name, value, redactString) {
|
|
328
|
+
return redactString(redactHttpHeaderValue(name, value));
|
|
260
329
|
}
|
|
261
|
-
function formatHeaders(headers) {
|
|
330
|
+
function formatHeaders(headers, redactString) {
|
|
262
331
|
return Object.entries(headers)
|
|
263
|
-
.map(([name, value]) => `${name}: ${formatHeaderValue(name, value)}`)
|
|
332
|
+
.map(([name, value]) => `${name}: ${formatHeaderValue(name, value, redactString)}`)
|
|
264
333
|
.join("\n");
|
|
265
334
|
}
|
|
266
|
-
function formatBody(body) {
|
|
335
|
+
function formatBody(body, redactString) {
|
|
267
336
|
const redactedBody = redactHttpBody(body);
|
|
268
337
|
if (typeof redactedBody === "string") {
|
|
269
|
-
return redactedBody;
|
|
338
|
+
return redactString(redactedBody);
|
|
270
339
|
}
|
|
271
|
-
return stableJson(redactedBody);
|
|
340
|
+
return redactString(stableJson(redactedBody));
|
|
272
341
|
}
|
|
273
|
-
function formatHttpTranscript(error) {
|
|
342
|
+
function formatHttpTranscript(error, redactString) {
|
|
274
343
|
const requestLines = [
|
|
275
344
|
`${error.request.method} ${error.request.url}`,
|
|
276
|
-
formatHeaders(error.request.headers)
|
|
345
|
+
formatHeaders(error.request.headers, redactString)
|
|
277
346
|
].filter((line) => line.length > 0);
|
|
278
347
|
if (error.request.body !== undefined) {
|
|
279
|
-
requestLines.push("", formatBody(error.request.body));
|
|
348
|
+
requestLines.push("", formatBody(error.request.body, redactString));
|
|
280
349
|
}
|
|
281
350
|
return [
|
|
282
351
|
"Request:",
|
|
@@ -284,9 +353,9 @@ function formatHttpTranscript(error) {
|
|
|
284
353
|
"",
|
|
285
354
|
"Response:",
|
|
286
355
|
`${error.response.status} ${error.response.statusText}`,
|
|
287
|
-
formatHeaders(error.response.headers),
|
|
356
|
+
formatHeaders(error.response.headers, redactString),
|
|
288
357
|
"",
|
|
289
|
-
formatBody(error.response.body)
|
|
358
|
+
formatBody(error.response.body, redactString)
|
|
290
359
|
].join("\n");
|
|
291
360
|
}
|
|
292
361
|
function resolveToolcraftVersion(version) {
|
|
@@ -297,9 +366,10 @@ function resolveToolcraftVersion(version) {
|
|
|
297
366
|
function buildReport(context) {
|
|
298
367
|
const env = context.env ?? process.env;
|
|
299
368
|
const error = context.error;
|
|
369
|
+
const redactString = createReportStringRedactor(context, env);
|
|
300
370
|
const errorName = error instanceof Error ? error.name : typeof error;
|
|
301
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
302
|
-
const structuredFields = error instanceof Error ? ownStructuredFields(error) : {};
|
|
371
|
+
const errorMessage = redactString(error instanceof Error ? error.message : String(error));
|
|
372
|
+
const structuredFields = error instanceof Error ? ownStructuredFields(error, redactString) : {};
|
|
303
373
|
const secretLines = Object.entries(context.command?.secrets ?? {}).map(([name, secret]) => {
|
|
304
374
|
const value = context.secrets?.[name] ?? env[secret.env];
|
|
305
375
|
return `${secret.env}=${redactValue(value)}`;
|
|
@@ -313,7 +383,7 @@ function buildReport(context) {
|
|
|
313
383
|
`platform: ${process.platform} ${process.arch}`,
|
|
314
384
|
"",
|
|
315
385
|
"Argv",
|
|
316
|
-
stableJson(redactArgv(context.argv, { command: context.command, secrets: context.secrets })),
|
|
386
|
+
redactString(stableJson(redactArgv(context.argv, { command: context.command, secrets: context.secrets }))),
|
|
317
387
|
"",
|
|
318
388
|
"Resolved Secrets",
|
|
319
389
|
...(secretLines.length === 0 ? ["<none>"] : secretLines),
|
|
@@ -324,19 +394,19 @@ function buildReport(context) {
|
|
|
324
394
|
: context.commandPath,
|
|
325
395
|
"",
|
|
326
396
|
"Parsed Params",
|
|
327
|
-
stableJson(redactParams(context.params, context.command)),
|
|
397
|
+
redactString(stableJson(redactParams(context.params, context.command))),
|
|
328
398
|
"",
|
|
329
399
|
"Error",
|
|
330
400
|
`name: ${errorName}`,
|
|
331
401
|
`message: ${errorMessage}`,
|
|
332
402
|
"structured fields:",
|
|
333
|
-
stableJson(structuredFields),
|
|
403
|
+
redactString(stableJson(structuredFields)),
|
|
334
404
|
"",
|
|
335
405
|
"Stack",
|
|
336
|
-
formatStackChain(error)
|
|
406
|
+
formatStackChain(error, redactString)
|
|
337
407
|
];
|
|
338
408
|
if (hasHttpContext(error)) {
|
|
339
|
-
lines.push("", "HTTP Transcript", formatHttpTranscript(error));
|
|
409
|
+
lines.push("", "HTTP Transcript", formatHttpTranscript(error, redactString));
|
|
340
410
|
}
|
|
341
411
|
return `${lines.join("\n")}\n`;
|
|
342
412
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TaskNotFoundError } from "@poe-code/task-list";
|
|
2
2
|
import { S } from "toolcraft-schema";
|
|
3
|
+
import { hasOwnErrorCode } from "../error-codes.js";
|
|
3
4
|
import { UserError, defineCommand, defineGroup } from "../index.js";
|
|
4
5
|
import { ensureApprovalList } from "./approval-tasks.js";
|
|
5
6
|
import { runApproval } from "./runner.js";
|
|
@@ -231,5 +232,5 @@ function escapeMarkdownCell(value) {
|
|
|
231
232
|
return value.replaceAll("|", "\\|");
|
|
232
233
|
}
|
|
233
234
|
function isMissingStateError(error) {
|
|
234
|
-
return
|
|
235
|
+
return hasOwnErrorCode(error, "ENOENT");
|
|
235
236
|
}
|
|
@@ -184,8 +184,8 @@ function createHandlerContext(command, params) {
|
|
|
184
184
|
function createFs() {
|
|
185
185
|
return {
|
|
186
186
|
readFile: async (path, encoding = "utf8") => readFile(path, { encoding }),
|
|
187
|
-
writeFile: async (path, contents) => {
|
|
188
|
-
await writeFile(path, contents);
|
|
187
|
+
writeFile: async (path, contents, options) => {
|
|
188
|
+
await writeFile(path, contents, options);
|
|
189
189
|
},
|
|
190
190
|
exists: async (path) => {
|
|
191
191
|
try {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { McpServerConfig } from "@poe-code/agent-mcp-config";
|
|
2
2
|
import type { ObjectSchema, Static } from "toolcraft-schema";
|
|
3
|
-
import type { LoggerOutput, RenderTableOptions, ThemePalette } from "
|
|
3
|
+
import type { LoggerOutput, RenderTableOptions, ThemePalette } from "toolcraft-design";
|
|
4
4
|
import { ApprovalDeclinedError } from "./human-in-loop/types.js";
|
|
5
5
|
import type { HumanInLoopConfig, HumanInLoopPending, HumanInLoopRuntimeOptions } from "./human-in-loop/types.js";
|
|
6
6
|
import { ToolcraftBugError, UserError } from "./user-error.js";
|
|
@@ -33,7 +33,11 @@ export type InferSecrets<TSecrets extends SecretDeclarations | undefined> = TSec
|
|
|
33
33
|
} : Record<string, never>;
|
|
34
34
|
export interface HandlerFs {
|
|
35
35
|
readFile(path: string, encoding?: BufferEncoding): Promise<string>;
|
|
36
|
-
writeFile(path: string, contents: string
|
|
36
|
+
writeFile(path: string, contents: string, options?: {
|
|
37
|
+
encoding?: BufferEncoding;
|
|
38
|
+
flag?: string;
|
|
39
|
+
mode?: number;
|
|
40
|
+
}): Promise<void>;
|
|
37
41
|
exists(path: string): Promise<boolean>;
|
|
38
42
|
lstat(path: string): Promise<{
|
|
39
43
|
isSymbolicLink(): boolean;
|
|
@@ -152,7 +152,7 @@ function convertObjectSchema(schema, root, options) {
|
|
|
152
152
|
"properties",
|
|
153
153
|
key
|
|
154
154
|
]);
|
|
155
|
-
shape
|
|
155
|
+
setOwnShapeProperty(shape, key, requiredKeys.has(key) ? convertedProperty : S.Optional(convertedProperty));
|
|
156
156
|
}
|
|
157
157
|
return applyMetadata(S.Object(shape, {
|
|
158
158
|
...(typeof normalizedSchema.schema.additionalProperties === "boolean"
|
|
@@ -162,6 +162,14 @@ function convertObjectSchema(schema, root, options) {
|
|
|
162
162
|
nullable: options.nullable ?? normalizedSchema.nullable
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
|
+
function setOwnShapeProperty(shape, key, value) {
|
|
166
|
+
Object.defineProperty(shape, key, {
|
|
167
|
+
configurable: true,
|
|
168
|
+
enumerable: true,
|
|
169
|
+
writable: true,
|
|
170
|
+
value
|
|
171
|
+
});
|
|
172
|
+
}
|
|
165
173
|
function createCommonOptions(schema, nullable, defaultValue) {
|
|
166
174
|
return {
|
|
167
175
|
...(schema.description === undefined ? {} : { description: schema.description }),
|
|
@@ -408,6 +416,9 @@ function resolveLocalRef(root, ref) {
|
|
|
408
416
|
if (!isPlainObject(current)) {
|
|
409
417
|
return undefined;
|
|
410
418
|
}
|
|
419
|
+
if (!Object.prototype.hasOwnProperty.call(current, segment)) {
|
|
420
|
+
return undefined;
|
|
421
|
+
}
|
|
411
422
|
current = current[segment];
|
|
412
423
|
}
|
|
413
424
|
return isPlainObject(current) ? current : undefined;
|
package/dist/mcp-proxy.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import { lstat, mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
2
|
+
import { lstat, mkdir, readFile, rename, unlink, writeFile } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
|
-
import { createLogger } from "
|
|
5
|
+
import { createLogger } from "toolcraft-design";
|
|
6
6
|
import { HttpTransport, McpClient, StdioTransport } from "tiny-mcp-client";
|
|
7
|
+
import { hasOwnErrorCode } from "./error-codes.js";
|
|
7
8
|
import { convertJsonSchema } from "./json-schema-converter.js";
|
|
8
9
|
const GROUP_CONFIG_SYMBOL_DESCRIPTION = "toolcraft.group.config";
|
|
9
10
|
const MCP_PROXY_SCHEMA_URL = "https://poe-platform.github.io/poe-code/schemas/toolcraft/mcp-proxy.schema.json";
|
|
@@ -175,8 +176,7 @@ async function readCache(cachePath) {
|
|
|
175
176
|
};
|
|
176
177
|
}
|
|
177
178
|
catch (error) {
|
|
178
|
-
|
|
179
|
-
if (code === "ENOENT" || error instanceof SyntaxError) {
|
|
179
|
+
if (hasOwnErrorCode(error, "ENOENT") || error instanceof SyntaxError) {
|
|
180
180
|
return undefined;
|
|
181
181
|
}
|
|
182
182
|
return undefined;
|
|
@@ -185,14 +185,31 @@ async function readCache(cachePath) {
|
|
|
185
185
|
async function writeCache(cachePath, cache) {
|
|
186
186
|
const directory = path.dirname(cachePath);
|
|
187
187
|
const tempPath = `${cachePath}.tmp-${randomUUID()}`;
|
|
188
|
+
let tempCreated = false;
|
|
188
189
|
await assertCachePathHasNoSymlinks(cachePath);
|
|
189
190
|
await assertCachePathHasNoSymlinks(tempPath);
|
|
190
191
|
await mkdir(directory, { recursive: true });
|
|
191
192
|
await assertCachePathHasNoSymlinks(directory);
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
try {
|
|
194
|
+
await writeFile(tempPath, `${JSON.stringify(cache, null, 2)}\n`, {
|
|
195
|
+
encoding: "utf8",
|
|
196
|
+
flag: "wx"
|
|
197
|
+
});
|
|
198
|
+
tempCreated = true;
|
|
199
|
+
await assertCachePathHasNoSymlinks(tempPath);
|
|
200
|
+
await assertCachePathHasNoSymlinks(cachePath);
|
|
201
|
+
await rename(tempPath, cachePath);
|
|
202
|
+
tempCreated = false;
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
if (tempCreated || !isAlreadyExistsError(error)) {
|
|
206
|
+
await unlink(tempPath).catch(() => undefined);
|
|
207
|
+
}
|
|
208
|
+
throw error;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function isAlreadyExistsError(error) {
|
|
212
|
+
return hasOwnErrorCode(error, "EEXIST");
|
|
196
213
|
}
|
|
197
214
|
async function fetchCache(name, config) {
|
|
198
215
|
const logger = createLogger((message) => {
|
|
@@ -402,7 +419,7 @@ async function assertCachePathHasNoSymlinks(filePath) {
|
|
|
402
419
|
}
|
|
403
420
|
}
|
|
404
421
|
catch (error) {
|
|
405
|
-
if (error
|
|
422
|
+
if (!hasOwnErrorCode(error, "ENOENT")) {
|
|
406
423
|
throw error;
|
|
407
424
|
}
|
|
408
425
|
}
|
package/dist/mcp.js
CHANGED
|
@@ -93,8 +93,8 @@ function isPlainObject(value) {
|
|
|
93
93
|
function createFs() {
|
|
94
94
|
return {
|
|
95
95
|
readFile: async (path, encoding = "utf8") => readFile(path, { encoding }),
|
|
96
|
-
writeFile: async (path, contents) => {
|
|
97
|
-
await writeFile(path, contents);
|
|
96
|
+
writeFile: async (path, contents, options) => {
|
|
97
|
+
await writeFile(path, contents, options);
|
|
98
98
|
},
|
|
99
99
|
exists: async (path) => {
|
|
100
100
|
try {
|
|
@@ -356,6 +356,48 @@ function validateSchemaValue(schema, value, casing, label, errors) {
|
|
|
356
356
|
return value.map((item, index) => validateSchemaValue(unwrappedSchema.item, item, casing, `${label}[${index}]`, errors));
|
|
357
357
|
case "object":
|
|
358
358
|
return validateObjectSchema(unwrappedSchema, value, casing, label, errors);
|
|
359
|
+
case "json":
|
|
360
|
+
return value;
|
|
361
|
+
case "record": {
|
|
362
|
+
if (!isPlainObject(value)) {
|
|
363
|
+
errors.push({
|
|
364
|
+
path: label,
|
|
365
|
+
message: `Invalid value for "${label}". Expected an object, got ${describeReceived(value)}.`
|
|
366
|
+
});
|
|
367
|
+
return value;
|
|
368
|
+
}
|
|
369
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
370
|
+
key,
|
|
371
|
+
validateSchemaValue(unwrappedSchema.value, item, casing, `${label}.${key}`, errors)
|
|
372
|
+
]));
|
|
373
|
+
}
|
|
374
|
+
case "oneOf": {
|
|
375
|
+
if (!isPlainObject(value)) {
|
|
376
|
+
return value;
|
|
377
|
+
}
|
|
378
|
+
const discriminatorKey = formatSegment(unwrappedSchema.discriminator, casing);
|
|
379
|
+
const discriminator = value[discriminatorKey];
|
|
380
|
+
const branch = typeof discriminator === "string" ? unwrappedSchema.branches[discriminator] : undefined;
|
|
381
|
+
if (branch === undefined) {
|
|
382
|
+
return value;
|
|
383
|
+
}
|
|
384
|
+
const { [discriminatorKey]: ignoredDiscriminator, ...branchValue } = value;
|
|
385
|
+
void ignoredDiscriminator;
|
|
386
|
+
return {
|
|
387
|
+
[unwrappedSchema.discriminator]: discriminator,
|
|
388
|
+
...validateObjectSchema(branch, branchValue, casing, label, errors)
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
case "union": {
|
|
392
|
+
if (!isPlainObject(value)) {
|
|
393
|
+
return value;
|
|
394
|
+
}
|
|
395
|
+
const branch = unwrappedSchema.branches.find((candidate) => Object.keys(candidate.shape).every((key) => candidate.shape[key]?.kind === "optional" ||
|
|
396
|
+
Object.prototype.hasOwnProperty.call(value, formatSegment(key, casing))));
|
|
397
|
+
return branch === undefined
|
|
398
|
+
? value
|
|
399
|
+
: validateObjectSchema(branch, value, casing, label, errors);
|
|
400
|
+
}
|
|
359
401
|
}
|
|
360
402
|
}
|
|
361
403
|
function validateObjectSchema(schema, value, casing, label, errors) {
|
|
@@ -373,6 +415,15 @@ function validateObjectSchema(schema, value, casing, label, errors) {
|
|
|
373
415
|
}
|
|
374
416
|
for (const key of Object.keys(value)) {
|
|
375
417
|
if (!expectedKeys.has(key)) {
|
|
418
|
+
if (schema.additionalProperties === true) {
|
|
419
|
+
Object.defineProperty(result, key, {
|
|
420
|
+
value: value[key],
|
|
421
|
+
enumerable: true,
|
|
422
|
+
configurable: true,
|
|
423
|
+
writable: true
|
|
424
|
+
});
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
376
427
|
const fieldLabel = label.length === 0 ? key : `${label}.${key}`;
|
|
377
428
|
errors.push({
|
|
378
429
|
path: fieldLabel,
|
|
@@ -557,7 +608,7 @@ function createDeferredMCPServer(root, options) {
|
|
|
557
608
|
}
|
|
558
609
|
export function createMCPServer(roots, options) {
|
|
559
610
|
const normalizedRoot = normalizeRoots(roots);
|
|
560
|
-
const root = options.approvals ===
|
|
611
|
+
const root = options.approvals === true ? mergeApprovalsGroup(normalizedRoot) : normalizedRoot;
|
|
561
612
|
if (!hasMcpProxyGroups(root)) {
|
|
562
613
|
return createResolvedMCPServer(root, options);
|
|
563
614
|
}
|
|
@@ -566,7 +617,7 @@ export function createMCPServer(roots, options) {
|
|
|
566
617
|
export async function runMCP(roots, options) {
|
|
567
618
|
enableSourceMaps();
|
|
568
619
|
const normalizedRoot = normalizeRoots(roots);
|
|
569
|
-
const root = options.approvals ===
|
|
620
|
+
const root = options.approvals === true ? mergeApprovalsGroup(normalizedRoot) : normalizedRoot;
|
|
570
621
|
await resolveMcpProxies(root, { projectRoot: options.projectRoot });
|
|
571
622
|
const server = createResolvedMCPServer(root, options);
|
|
572
623
|
await server.listen();
|
package/dist/renderer.js
CHANGED
package/dist/schema-scope.js
CHANGED
|
@@ -21,14 +21,35 @@ export function filterSchemaForScope(schema, scope) {
|
|
|
21
21
|
case "number":
|
|
22
22
|
case "boolean":
|
|
23
23
|
case "enum":
|
|
24
|
+
case "json":
|
|
24
25
|
return schema;
|
|
26
|
+
case "record": {
|
|
27
|
+
const value = filterSchemaForScope(schema.value, scope);
|
|
28
|
+
return value === undefined ? undefined : { ...schema, value };
|
|
29
|
+
}
|
|
30
|
+
case "oneOf":
|
|
31
|
+
return {
|
|
32
|
+
...schema,
|
|
33
|
+
branches: Object.fromEntries(Object.entries(schema.branches).flatMap(([name, branch]) => {
|
|
34
|
+
const filtered = filterSchemaForScope(branch, scope);
|
|
35
|
+
return filtered?.kind === "object" ? [[name, filtered]] : [];
|
|
36
|
+
}))
|
|
37
|
+
};
|
|
38
|
+
case "union":
|
|
39
|
+
return {
|
|
40
|
+
...schema,
|
|
41
|
+
branches: schema.branches.flatMap((branch) => {
|
|
42
|
+
const filtered = filterSchemaForScope(branch, scope);
|
|
43
|
+
return filtered?.kind === "object" ? [filtered] : [];
|
|
44
|
+
})
|
|
45
|
+
};
|
|
25
46
|
case "object":
|
|
26
47
|
return {
|
|
27
48
|
...schema,
|
|
28
49
|
shape: Object.fromEntries(Object.entries(schema.shape).flatMap(([key, childSchema]) => {
|
|
29
50
|
const filtered = filterSchemaForScope(childSchema, scope);
|
|
30
51
|
return filtered === undefined ? [] : [[key, filtered]];
|
|
31
|
-
}))
|
|
52
|
+
}))
|
|
32
53
|
};
|
|
33
54
|
}
|
|
34
55
|
}
|
package/dist/sdk.js
CHANGED
|
@@ -74,8 +74,8 @@ function isPlainObject(value) {
|
|
|
74
74
|
function createFs() {
|
|
75
75
|
return {
|
|
76
76
|
readFile: async (path, encoding = "utf8") => readFile(path, { encoding }),
|
|
77
|
-
writeFile: async (path, contents) => {
|
|
78
|
-
await writeFile(path, contents);
|
|
77
|
+
writeFile: async (path, contents, options) => {
|
|
78
|
+
await writeFile(path, contents, options);
|
|
79
79
|
},
|
|
80
80
|
exists: async (path) => {
|
|
81
81
|
try {
|
|
@@ -179,6 +179,45 @@ function validateSchemaValue(schema, value, label, errors) {
|
|
|
179
179
|
return value.map((item, index) => validateSchemaValue(unwrappedSchema.item, item, `${label}[${index}]`, errors));
|
|
180
180
|
case "object":
|
|
181
181
|
return validateObjectSchema(unwrappedSchema, value, label, errors);
|
|
182
|
+
case "json":
|
|
183
|
+
return value;
|
|
184
|
+
case "record": {
|
|
185
|
+
if (!isPlainObject(value)) {
|
|
186
|
+
errors.push({
|
|
187
|
+
path: label,
|
|
188
|
+
message: `Invalid value for "${label}". Expected an object, got ${describeReceived(value)}.`
|
|
189
|
+
});
|
|
190
|
+
return value;
|
|
191
|
+
}
|
|
192
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
193
|
+
key,
|
|
194
|
+
validateSchemaValue(unwrappedSchema.value, item, `${label}.${key}`, errors)
|
|
195
|
+
]));
|
|
196
|
+
}
|
|
197
|
+
case "oneOf": {
|
|
198
|
+
if (!isPlainObject(value)) {
|
|
199
|
+
return value;
|
|
200
|
+
}
|
|
201
|
+
const discriminator = value[unwrappedSchema.discriminator];
|
|
202
|
+
const branch = typeof discriminator === "string" ? unwrappedSchema.branches[discriminator] : undefined;
|
|
203
|
+
if (branch === undefined) {
|
|
204
|
+
return value;
|
|
205
|
+
}
|
|
206
|
+
const { [unwrappedSchema.discriminator]: ignoredDiscriminator, ...branchValue } = value;
|
|
207
|
+
void ignoredDiscriminator;
|
|
208
|
+
return {
|
|
209
|
+
[unwrappedSchema.discriminator]: discriminator,
|
|
210
|
+
...validateObjectSchema(branch, branchValue, label, errors)
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
case "union": {
|
|
214
|
+
if (!isPlainObject(value)) {
|
|
215
|
+
return value;
|
|
216
|
+
}
|
|
217
|
+
const branch = unwrappedSchema.branches.find((candidate) => Object.keys(candidate.shape).every((key) => candidate.shape[key]?.kind === "optional" ||
|
|
218
|
+
Object.prototype.hasOwnProperty.call(value, formatSegment(key))));
|
|
219
|
+
return branch === undefined ? value : validateObjectSchema(branch, value, label, errors);
|
|
220
|
+
}
|
|
182
221
|
}
|
|
183
222
|
}
|
|
184
223
|
function validateObjectSchema(schema, value, label, errors) {
|
|
@@ -196,6 +235,15 @@ function validateObjectSchema(schema, value, label, errors) {
|
|
|
196
235
|
}
|
|
197
236
|
for (const key of Object.keys(value)) {
|
|
198
237
|
if (!expectedKeys.has(key)) {
|
|
238
|
+
if (schema.additionalProperties === true) {
|
|
239
|
+
Object.defineProperty(result, key, {
|
|
240
|
+
value: value[key],
|
|
241
|
+
enumerable: true,
|
|
242
|
+
configurable: true,
|
|
243
|
+
writable: true
|
|
244
|
+
});
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
199
247
|
const fieldLabel = label.length === 0 ? key : `${label}.${key}`;
|
|
200
248
|
errors.push({
|
|
201
249
|
path: fieldLabel,
|
|
@@ -266,7 +314,7 @@ function defineMember(target, key, value) {
|
|
|
266
314
|
}
|
|
267
315
|
export function createSDK(root, options = {}) {
|
|
268
316
|
enableSourceMaps();
|
|
269
|
-
const mergedRoot = options.approvals ===
|
|
317
|
+
const mergedRoot = options.approvals === true ? mergeApprovalsGroup(root) : root;
|
|
270
318
|
if (!hasMcpProxyGroups(mergedRoot)) {
|
|
271
319
|
return createResolvedSDK(mergedRoot, options);
|
|
272
320
|
}
|
package/dist/source-snippet.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { text } from "
|
|
1
|
+
import { text } from "toolcraft-design";
|
|
2
2
|
export function renderSourceSnippet(opts) {
|
|
3
3
|
const lines = opts.source.replaceAll("\r\n", "\n").replaceAll("\r", "\n").split("\n");
|
|
4
4
|
const line = clampInteger(opts.line, 1, Math.max(lines.length, 1));
|
|
@@ -6,6 +6,11 @@ export const claudeCodeAgent = {
|
|
|
6
6
|
aliases: ["claude"],
|
|
7
7
|
binaryName: "claude",
|
|
8
8
|
apiShapes: ["anthropic-messages"],
|
|
9
|
+
otelCapture: {
|
|
10
|
+
env: {
|
|
11
|
+
CLAUDE_CODE_ENABLE_TELEMETRY: "1"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
9
14
|
configPath: "~/.claude/settings.json",
|
|
10
15
|
branding: {
|
|
11
16
|
colors: {
|
|
@@ -5,6 +5,16 @@ export const codexAgent = {
|
|
|
5
5
|
summary: "Configure Codex to use Poe as the model provider.",
|
|
6
6
|
binaryName: "codex",
|
|
7
7
|
apiShapes: ["openai-responses"],
|
|
8
|
+
otelCapture: {
|
|
9
|
+
args: (endpoint, content) => [
|
|
10
|
+
"-c",
|
|
11
|
+
`otel.trace_exporter={"otlp-http"={endpoint=${JSON.stringify(`${endpoint}/v1/traces`)},protocol="json"}}`,
|
|
12
|
+
"-c",
|
|
13
|
+
`otel.exporter={"otlp-http"={endpoint=${JSON.stringify(`${endpoint}/v1/logs`)},protocol="json"}}`,
|
|
14
|
+
"-c",
|
|
15
|
+
`otel.log_user_prompt=${content}`
|
|
16
|
+
]
|
|
17
|
+
},
|
|
8
18
|
configPath: "~/.codex/config.toml",
|
|
9
19
|
branding: {
|
|
10
20
|
colors: {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const cursorAgent = {
|
|
2
|
+
id: "cursor",
|
|
3
|
+
name: "cursor",
|
|
4
|
+
aliases: ["cursor-agent"],
|
|
5
|
+
label: "Cursor",
|
|
6
|
+
summary: "Cursor's CLI coding agent.",
|
|
7
|
+
binaryName: "cursor-agent",
|
|
8
|
+
configPath: "~/.cursor/cli-config.json",
|
|
9
|
+
branding: {
|
|
10
|
+
colors: {
|
|
11
|
+
dark: "#FFFFFF",
|
|
12
|
+
light: "#000000"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|