@useconvoy/cli 0.48.0
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/LICENSE +90 -0
- package/README.md +495 -0
- package/dist/bin/convoy.d.ts +2 -0
- package/dist/bin/convoy.js +129 -0
- package/dist/bin/convoy.js.map +1 -0
- package/dist/marketplace/.claude-plugin/marketplace.json +14 -0
- package/dist/marketplace/opensana/.claude-plugin/plugin.json +5 -0
- package/dist/marketplace/opensana/README.md +90 -0
- package/dist/marketplace/opensana/skills/tasks/SKILL.md +133 -0
- package/dist/marketplace/opensana/skills/tasks/references/mcp-setup.md +164 -0
- package/dist/src/agent/app/chunk-flush-buffer.d.ts +35 -0
- package/dist/src/agent/app/chunk-flush-buffer.js +133 -0
- package/dist/src/agent/app/chunk-flush-buffer.js.map +1 -0
- package/dist/src/agent/app/chunk-scrub.d.ts +9 -0
- package/dist/src/agent/app/chunk-scrub.js +120 -0
- package/dist/src/agent/app/chunk-scrub.js.map +1 -0
- package/dist/src/agent/app/interaction-router.d.ts +16 -0
- package/dist/src/agent/app/interaction-router.js +29 -0
- package/dist/src/agent/app/interaction-router.js.map +1 -0
- package/dist/src/agent/app/runner.d.ts +41 -0
- package/dist/src/agent/app/runner.js +353 -0
- package/dist/src/agent/app/runner.js.map +1 -0
- package/dist/src/agent/app/runtime-config.d.ts +3 -0
- package/dist/src/agent/app/runtime-config.js +4 -0
- package/dist/src/agent/app/runtime-config.js.map +1 -0
- package/dist/src/agent/app/thread-attachment-cache.d.ts +17 -0
- package/dist/src/agent/app/thread-attachment-cache.js +124 -0
- package/dist/src/agent/app/thread-attachment-cache.js.map +1 -0
- package/dist/src/agent/app/thread-processor.d.ts +40 -0
- package/dist/src/agent/app/thread-processor.js +792 -0
- package/dist/src/agent/app/thread-processor.js.map +1 -0
- package/dist/src/agent/app/worktree-op-processor.d.ts +27 -0
- package/dist/src/agent/app/worktree-op-processor.js +173 -0
- package/dist/src/agent/app/worktree-op-processor.js.map +1 -0
- package/dist/src/agent/runtimes/agent-instructions.d.ts +16 -0
- package/dist/src/agent/runtimes/agent-instructions.js +33 -0
- package/dist/src/agent/runtimes/agent-instructions.js.map +1 -0
- package/dist/src/agent/runtimes/claudeCode/continuation.d.ts +1 -0
- package/dist/src/agent/runtimes/claudeCode/continuation.js +30 -0
- package/dist/src/agent/runtimes/claudeCode/continuation.js.map +1 -0
- package/dist/src/agent/runtimes/claudeCode/detect.d.ts +12 -0
- package/dist/src/agent/runtimes/claudeCode/detect.js +109 -0
- package/dist/src/agent/runtimes/claudeCode/detect.js.map +1 -0
- package/dist/src/agent/runtimes/claudeCode/interactions.d.ts +13 -0
- package/dist/src/agent/runtimes/claudeCode/interactions.js +167 -0
- package/dist/src/agent/runtimes/claudeCode/interactions.js.map +1 -0
- package/dist/src/agent/runtimes/claudeCode/models.d.ts +3 -0
- package/dist/src/agent/runtimes/claudeCode/models.js +16 -0
- package/dist/src/agent/runtimes/claudeCode/models.js.map +1 -0
- package/dist/src/agent/runtimes/claudeCode/prompts.d.ts +1 -0
- package/dist/src/agent/runtimes/claudeCode/prompts.js +5 -0
- package/dist/src/agent/runtimes/claudeCode/prompts.js.map +1 -0
- package/dist/src/agent/runtimes/claudeCode/runner.d.ts +32 -0
- package/dist/src/agent/runtimes/claudeCode/runner.js +941 -0
- package/dist/src/agent/runtimes/claudeCode/runner.js.map +1 -0
- package/dist/src/agent/runtimes/claudeCode/runtime.d.ts +2 -0
- package/dist/src/agent/runtimes/claudeCode/runtime.js +126 -0
- package/dist/src/agent/runtimes/claudeCode/runtime.js.map +1 -0
- package/dist/src/agent/runtimes/claudeCode/streaming.d.ts +8 -0
- package/dist/src/agent/runtimes/claudeCode/streaming.js +88 -0
- package/dist/src/agent/runtimes/claudeCode/streaming.js.map +1 -0
- package/dist/src/agent/runtimes/codex/app-server-rpc.d.ts +26 -0
- package/dist/src/agent/runtimes/codex/app-server-rpc.js +109 -0
- package/dist/src/agent/runtimes/codex/app-server-rpc.js.map +1 -0
- package/dist/src/agent/runtimes/codex/app-server-runner.d.ts +59 -0
- package/dist/src/agent/runtimes/codex/app-server-runner.js +688 -0
- package/dist/src/agent/runtimes/codex/app-server-runner.js.map +1 -0
- package/dist/src/agent/runtimes/codex/commands.d.ts +23 -0
- package/dist/src/agent/runtimes/codex/commands.js +25 -0
- package/dist/src/agent/runtimes/codex/commands.js.map +1 -0
- package/dist/src/agent/runtimes/codex/detect.d.ts +5 -0
- package/dist/src/agent/runtimes/codex/detect.js +17 -0
- package/dist/src/agent/runtimes/codex/detect.js.map +1 -0
- package/dist/src/agent/runtimes/codex/models.d.ts +2 -0
- package/dist/src/agent/runtimes/codex/models.js +4 -0
- package/dist/src/agent/runtimes/codex/models.js.map +1 -0
- package/dist/src/agent/runtimes/codex/runner.d.ts +46 -0
- package/dist/src/agent/runtimes/codex/runner.js +298 -0
- package/dist/src/agent/runtimes/codex/runner.js.map +1 -0
- package/dist/src/agent/runtimes/codex/runtime.d.ts +10 -0
- package/dist/src/agent/runtimes/codex/runtime.js +73 -0
- package/dist/src/agent/runtimes/codex/runtime.js.map +1 -0
- package/dist/src/agent/runtimes/contracts.d.ts +215 -0
- package/dist/src/agent/runtimes/contracts.js +33 -0
- package/dist/src/agent/runtimes/contracts.js.map +1 -0
- package/dist/src/agent/runtimes/cursor/commands.d.ts +7 -0
- package/dist/src/agent/runtimes/cursor/commands.js +39 -0
- package/dist/src/agent/runtimes/cursor/commands.js.map +1 -0
- package/dist/src/agent/runtimes/cursor/detect.d.ts +17 -0
- package/dist/src/agent/runtimes/cursor/detect.js +54 -0
- package/dist/src/agent/runtimes/cursor/detect.js.map +1 -0
- package/dist/src/agent/runtimes/cursor/models.d.ts +9 -0
- package/dist/src/agent/runtimes/cursor/models.js +97 -0
- package/dist/src/agent/runtimes/cursor/models.js.map +1 -0
- package/dist/src/agent/runtimes/cursor/runner.d.ts +36 -0
- package/dist/src/agent/runtimes/cursor/runner.js +293 -0
- package/dist/src/agent/runtimes/cursor/runner.js.map +1 -0
- package/dist/src/agent/runtimes/cursor/runtime.d.ts +2 -0
- package/dist/src/agent/runtimes/cursor/runtime.js +48 -0
- package/dist/src/agent/runtimes/cursor/runtime.js.map +1 -0
- package/dist/src/agent/runtimes/cursor/streaming.d.ts +8 -0
- package/dist/src/agent/runtimes/cursor/streaming.js +78 -0
- package/dist/src/agent/runtimes/cursor/streaming.js.map +1 -0
- package/dist/src/agent/runtimes/debug.d.ts +8 -0
- package/dist/src/agent/runtimes/debug.js +19 -0
- package/dist/src/agent/runtimes/debug.js.map +1 -0
- package/dist/src/agent/runtimes/message-format.d.ts +6 -0
- package/dist/src/agent/runtimes/message-format.js +31 -0
- package/dist/src/agent/runtimes/message-format.js.map +1 -0
- package/dist/src/agent/runtimes/opencode/client.d.ts +82 -0
- package/dist/src/agent/runtimes/opencode/client.js +109 -0
- package/dist/src/agent/runtimes/opencode/client.js.map +1 -0
- package/dist/src/agent/runtimes/opencode/detect.d.ts +18 -0
- package/dist/src/agent/runtimes/opencode/detect.js +100 -0
- package/dist/src/agent/runtimes/opencode/detect.js.map +1 -0
- package/dist/src/agent/runtimes/opencode/json.d.ts +4 -0
- package/dist/src/agent/runtimes/opencode/json.js +17 -0
- package/dist/src/agent/runtimes/opencode/json.js.map +1 -0
- package/dist/src/agent/runtimes/opencode/runner.d.ts +50 -0
- package/dist/src/agent/runtimes/opencode/runner.js +598 -0
- package/dist/src/agent/runtimes/opencode/runner.js.map +1 -0
- package/dist/src/agent/runtimes/opencode/runtime.d.ts +9 -0
- package/dist/src/agent/runtimes/opencode/runtime.js +82 -0
- package/dist/src/agent/runtimes/opencode/runtime.js.map +1 -0
- package/dist/src/agent/runtimes/opencode/server.d.ts +36 -0
- package/dist/src/agent/runtimes/opencode/server.js +210 -0
- package/dist/src/agent/runtimes/opencode/server.js.map +1 -0
- package/dist/src/agent/runtimes/opencode/streaming.d.ts +7 -0
- package/dist/src/agent/runtimes/opencode/streaming.js +47 -0
- package/dist/src/agent/runtimes/opencode/streaming.js.map +1 -0
- package/dist/src/agent/runtimes/registry.d.ts +10 -0
- package/dist/src/agent/runtimes/registry.js +48 -0
- package/dist/src/agent/runtimes/registry.js.map +1 -0
- package/dist/src/agent/sdk/adapters/adapter-interface.d.ts +2 -0
- package/dist/src/agent/sdk/adapters/adapter-interface.js +4 -0
- package/dist/src/agent/sdk/adapters/adapter-interface.js.map +1 -0
- package/dist/src/agent/sdk/adapters/claude/claude-adapter.d.ts +9 -0
- package/dist/src/agent/sdk/adapters/claude/claude-adapter.js +95 -0
- package/dist/src/agent/sdk/adapters/claude/claude-adapter.js.map +1 -0
- package/dist/src/agent/sdk/adapters/codex/codex-adapter.d.ts +10 -0
- package/dist/src/agent/sdk/adapters/codex/codex-adapter.js +87 -0
- package/dist/src/agent/sdk/adapters/codex/codex-adapter.js.map +1 -0
- package/dist/src/agent/sdk/adapters/executable-resolution.d.ts +2 -0
- package/dist/src/agent/sdk/adapters/executable-resolution.js +50 -0
- package/dist/src/agent/sdk/adapters/executable-resolution.js.map +1 -0
- package/dist/src/agent/sdk/adapters/generic/generic-subprocess-adapter.d.ts +11 -0
- package/dist/src/agent/sdk/adapters/generic/generic-subprocess-adapter.js +61 -0
- package/dist/src/agent/sdk/adapters/generic/generic-subprocess-adapter.js.map +1 -0
- package/dist/src/agent/sdk/adapters/provider-registry.d.ts +8 -0
- package/dist/src/agent/sdk/adapters/provider-registry.js +32 -0
- package/dist/src/agent/sdk/adapters/provider-registry.js.map +1 -0
- package/dist/src/agent/sdk/constants.d.ts +5 -0
- package/dist/src/agent/sdk/constants.js +29 -0
- package/dist/src/agent/sdk/constants.js.map +1 -0
- package/dist/src/agent/sdk/index.d.ts +2 -0
- package/dist/src/agent/sdk/index.js +2 -0
- package/dist/src/agent/sdk/index.js.map +1 -0
- package/dist/src/agent/sdk/run-handle.d.ts +22 -0
- package/dist/src/agent/sdk/run-handle.js +90 -0
- package/dist/src/agent/sdk/run-handle.js.map +1 -0
- package/dist/src/agent/sdk/runtime/isolation-env.d.ts +9 -0
- package/dist/src/agent/sdk/runtime/isolation-env.js +39 -0
- package/dist/src/agent/sdk/runtime/isolation-env.js.map +1 -0
- package/dist/src/agent/sdk/runtime/line-parser.d.ts +11 -0
- package/dist/src/agent/sdk/runtime/line-parser.js +59 -0
- package/dist/src/agent/sdk/runtime/line-parser.js.map +1 -0
- package/dist/src/agent/sdk/runtime/output-pump.d.ts +20 -0
- package/dist/src/agent/sdk/runtime/output-pump.js +88 -0
- package/dist/src/agent/sdk/runtime/output-pump.js.map +1 -0
- package/dist/src/agent/sdk/runtime/process-group.d.ts +9 -0
- package/dist/src/agent/sdk/runtime/process-group.js +69 -0
- package/dist/src/agent/sdk/runtime/process-group.js.map +1 -0
- package/dist/src/agent/sdk/runtime/provider-supervisor-entrypoint.d.ts +1 -0
- package/dist/src/agent/sdk/runtime/provider-supervisor-entrypoint.js +3 -0
- package/dist/src/agent/sdk/runtime/provider-supervisor-entrypoint.js.map +1 -0
- package/dist/src/agent/sdk/runtime/provider-supervisor.d.ts +1 -0
- package/dist/src/agent/sdk/runtime/provider-supervisor.js +190 -0
- package/dist/src/agent/sdk/runtime/provider-supervisor.js.map +1 -0
- package/dist/src/agent/sdk/runtime/spawn-process.d.ts +7 -0
- package/dist/src/agent/sdk/runtime/spawn-process.js +16 -0
- package/dist/src/agent/sdk/runtime/spawn-process.js.map +1 -0
- package/dist/src/agent/sdk/runtime/spawn-supervised-process.d.ts +17 -0
- package/dist/src/agent/sdk/runtime/spawn-supervised-process.js +203 -0
- package/dist/src/agent/sdk/runtime/spawn-supervised-process.js.map +1 -0
- package/dist/src/agent/sdk/runtime/supervisor-protocol.d.ts +29 -0
- package/dist/src/agent/sdk/runtime/supervisor-protocol.js +90 -0
- package/dist/src/agent/sdk/runtime/supervisor-protocol.js.map +1 -0
- package/dist/src/agent/sdk/runtime/timeouts.d.ts +24 -0
- package/dist/src/agent/sdk/runtime/timeouts.js +65 -0
- package/dist/src/agent/sdk/runtime/timeouts.js.map +1 -0
- package/dist/src/agent/sdk/session-manager.d.ts +38 -0
- package/dist/src/agent/sdk/session-manager.js +557 -0
- package/dist/src/agent/sdk/session-manager.js.map +1 -0
- package/dist/src/agent/sdk/transport/json-stream-decoder.d.ts +6 -0
- package/dist/src/agent/sdk/transport/json-stream-decoder.js +29 -0
- package/dist/src/agent/sdk/transport/json-stream-decoder.js.map +1 -0
- package/dist/src/agent/sdk/transport/line-text-decoder.d.ts +6 -0
- package/dist/src/agent/sdk/transport/line-text-decoder.js +9 -0
- package/dist/src/agent/sdk/transport/line-text-decoder.js.map +1 -0
- package/dist/src/agent/sdk/transport/pty-contract.d.ts +12 -0
- package/dist/src/agent/sdk/transport/pty-contract.js +2 -0
- package/dist/src/agent/sdk/transport/pty-contract.js.map +1 -0
- package/dist/src/agent/sdk/types.d.ts +194 -0
- package/dist/src/agent/sdk/types.js +2 -0
- package/dist/src/agent/sdk/types.js.map +1 -0
- package/dist/src/agent/sdk/versioning/provider-version.d.ts +9 -0
- package/dist/src/agent/sdk/versioning/provider-version.js +41 -0
- package/dist/src/agent/sdk/versioning/provider-version.js.map +1 -0
- package/dist/src/cli.d.ts +7 -0
- package/dist/src/cli.js +56 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/commands/config/command.d.ts +2 -0
- package/dist/src/commands/config/command.js +150 -0
- package/dist/src/commands/config/command.js.map +1 -0
- package/dist/src/commands/connect/command.d.ts +4 -0
- package/dist/src/commands/connect/command.js +19 -0
- package/dist/src/commands/connect/command.js.map +1 -0
- package/dist/src/commands/connect/workflow.d.ts +92 -0
- package/dist/src/commands/connect/workflow.js +381 -0
- package/dist/src/commands/connect/workflow.js.map +1 -0
- package/dist/src/commands/devcontainer/command.d.ts +2 -0
- package/dist/src/commands/devcontainer/command.js +49 -0
- package/dist/src/commands/devcontainer/command.js.map +1 -0
- package/dist/src/commands/devcontainer/install.d.ts +46 -0
- package/dist/src/commands/devcontainer/install.js +107 -0
- package/dist/src/commands/devcontainer/install.js.map +1 -0
- package/dist/src/commands/init/config/claude-mcp.d.ts +27 -0
- package/dist/src/commands/init/config/claude-mcp.js +56 -0
- package/dist/src/commands/init/config/claude-mcp.js.map +1 -0
- package/dist/src/commands/init/config/codex-mcp.d.ts +12 -0
- package/dist/src/commands/init/config/codex-mcp.js +83 -0
- package/dist/src/commands/init/config/codex-mcp.js.map +1 -0
- package/dist/src/commands/init/config/opencode-mcp.d.ts +16 -0
- package/dist/src/commands/init/config/opencode-mcp.js +55 -0
- package/dist/src/commands/init/config/opencode-mcp.js.map +1 -0
- package/dist/src/commands/init/errors.d.ts +3 -0
- package/dist/src/commands/init/errors.js +7 -0
- package/dist/src/commands/init/errors.js.map +1 -0
- package/dist/src/commands/init/index.d.ts +9 -0
- package/dist/src/commands/init/index.js +10 -0
- package/dist/src/commands/init/index.js.map +1 -0
- package/dist/src/commands/init/io/file-copy.d.ts +18 -0
- package/dist/src/commands/init/io/file-copy.js +129 -0
- package/dist/src/commands/init/io/file-copy.js.map +1 -0
- package/dist/src/commands/init/marketplace.d.ts +8 -0
- package/dist/src/commands/init/marketplace.js +25 -0
- package/dist/src/commands/init/marketplace.js.map +1 -0
- package/dist/src/commands/init/mcp-service.d.ts +2 -0
- package/dist/src/commands/init/mcp-service.js +66 -0
- package/dist/src/commands/init/mcp-service.js.map +1 -0
- package/dist/src/commands/init/parsers.d.ts +4 -0
- package/dist/src/commands/init/parsers.js +40 -0
- package/dist/src/commands/init/parsers.js.map +1 -0
- package/dist/src/commands/init/prompts.d.ts +4 -0
- package/dist/src/commands/init/prompts.js +72 -0
- package/dist/src/commands/init/prompts.js.map +1 -0
- package/dist/src/commands/init/skill-service.d.ts +2 -0
- package/dist/src/commands/init/skill-service.js +36 -0
- package/dist/src/commands/init/skill-service.js.map +1 -0
- package/dist/src/commands/init/summary.d.ts +2 -0
- package/dist/src/commands/init/summary.js +22 -0
- package/dist/src/commands/init/summary.js.map +1 -0
- package/dist/src/commands/init/targets/claude.d.ts +4 -0
- package/dist/src/commands/init/targets/claude.js +178 -0
- package/dist/src/commands/init/targets/claude.js.map +1 -0
- package/dist/src/commands/init/targets/codex.d.ts +4 -0
- package/dist/src/commands/init/targets/codex.js +75 -0
- package/dist/src/commands/init/targets/codex.js.map +1 -0
- package/dist/src/commands/init/targets/driver.d.ts +28 -0
- package/dist/src/commands/init/targets/driver.js +2 -0
- package/dist/src/commands/init/targets/driver.js.map +1 -0
- package/dist/src/commands/init/targets/opencode.d.ts +4 -0
- package/dist/src/commands/init/targets/opencode.js +77 -0
- package/dist/src/commands/init/targets/opencode.js.map +1 -0
- package/dist/src/commands/init/targets/registry.d.ts +4 -0
- package/dist/src/commands/init/targets/registry.js +15 -0
- package/dist/src/commands/init/targets/registry.js.map +1 -0
- package/dist/src/commands/init/types.d.ts +30 -0
- package/dist/src/commands/init/types.js +7 -0
- package/dist/src/commands/init/types.js.map +1 -0
- package/dist/src/commands/init.d.ts +3 -0
- package/dist/src/commands/init.js +143 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/keys/command.d.ts +2 -0
- package/dist/src/commands/keys/command.js +154 -0
- package/dist/src/commands/keys/command.js.map +1 -0
- package/dist/src/commands/labels/create.d.ts +2 -0
- package/dist/src/commands/labels/create.js +31 -0
- package/dist/src/commands/labels/create.js.map +1 -0
- package/dist/src/commands/labels/delete.d.ts +2 -0
- package/dist/src/commands/labels/delete.js +51 -0
- package/dist/src/commands/labels/delete.js.map +1 -0
- package/dist/src/commands/labels/formatters.d.ts +4 -0
- package/dist/src/commands/labels/formatters.js +6 -0
- package/dist/src/commands/labels/formatters.js.map +1 -0
- package/dist/src/commands/labels/index.d.ts +2 -0
- package/dist/src/commands/labels/index.js +13 -0
- package/dist/src/commands/labels/index.js.map +1 -0
- package/dist/src/commands/labels/list.d.ts +2 -0
- package/dist/src/commands/labels/list.js +29 -0
- package/dist/src/commands/labels/list.js.map +1 -0
- package/dist/src/commands/labels/resolve.d.ts +9 -0
- package/dist/src/commands/labels/resolve.js +23 -0
- package/dist/src/commands/labels/resolve.js.map +1 -0
- package/dist/src/commands/labels/update.d.ts +2 -0
- package/dist/src/commands/labels/update.js +37 -0
- package/dist/src/commands/labels/update.js.map +1 -0
- package/dist/src/commands/lists/constants.d.ts +7 -0
- package/dist/src/commands/lists/constants.js +14 -0
- package/dist/src/commands/lists/constants.js.map +1 -0
- package/dist/src/commands/lists/create.d.ts +2 -0
- package/dist/src/commands/lists/create.js +45 -0
- package/dist/src/commands/lists/create.js.map +1 -0
- package/dist/src/commands/lists/index.d.ts +2 -0
- package/dist/src/commands/lists/index.js +10 -0
- package/dist/src/commands/lists/index.js.map +1 -0
- package/dist/src/commands/lists/list.d.ts +2 -0
- package/dist/src/commands/lists/list.js +66 -0
- package/dist/src/commands/lists/list.js.map +1 -0
- package/dist/src/commands/lists/resolve.d.ts +11 -0
- package/dist/src/commands/lists/resolve.js +24 -0
- package/dist/src/commands/lists/resolve.js.map +1 -0
- package/dist/src/commands/lists/update.d.ts +2 -0
- package/dist/src/commands/lists/update.js +61 -0
- package/dist/src/commands/lists/update.js.map +1 -0
- package/dist/src/commands/login/command.d.ts +8 -0
- package/dist/src/commands/login/command.js +20 -0
- package/dist/src/commands/login/command.js.map +1 -0
- package/dist/src/commands/orgs/index.d.ts +2 -0
- package/dist/src/commands/orgs/index.js +6 -0
- package/dist/src/commands/orgs/index.js.map +1 -0
- package/dist/src/commands/orgs/list.d.ts +2 -0
- package/dist/src/commands/orgs/list.js +29 -0
- package/dist/src/commands/orgs/list.js.map +1 -0
- package/dist/src/commands/paths/command.d.ts +2 -0
- package/dist/src/commands/paths/command.js +90 -0
- package/dist/src/commands/paths/command.js.map +1 -0
- package/dist/src/commands/profiles/index.d.ts +2 -0
- package/dist/src/commands/profiles/index.js +6 -0
- package/dist/src/commands/profiles/index.js.map +1 -0
- package/dist/src/commands/profiles/list.d.ts +2 -0
- package/dist/src/commands/profiles/list.js +50 -0
- package/dist/src/commands/profiles/list.js.map +1 -0
- package/dist/src/commands/project-agents/create.d.ts +2 -0
- package/dist/src/commands/project-agents/create.js +53 -0
- package/dist/src/commands/project-agents/create.js.map +1 -0
- package/dist/src/commands/project-agents/index.d.ts +2 -0
- package/dist/src/commands/project-agents/index.js +10 -0
- package/dist/src/commands/project-agents/index.js.map +1 -0
- package/dist/src/commands/project-agents/list.d.ts +2 -0
- package/dist/src/commands/project-agents/list.js +30 -0
- package/dist/src/commands/project-agents/list.js.map +1 -0
- package/dist/src/commands/project-agents/parsers.d.ts +16 -0
- package/dist/src/commands/project-agents/parsers.js +80 -0
- package/dist/src/commands/project-agents/parsers.js.map +1 -0
- package/dist/src/commands/project-agents/update.d.ts +2 -0
- package/dist/src/commands/project-agents/update.js +74 -0
- package/dist/src/commands/project-agents/update.js.map +1 -0
- package/dist/src/commands/projects/index.d.ts +2 -0
- package/dist/src/commands/projects/index.js +6 -0
- package/dist/src/commands/projects/index.js.map +1 -0
- package/dist/src/commands/projects/list.d.ts +2 -0
- package/dist/src/commands/projects/list.js +41 -0
- package/dist/src/commands/projects/list.js.map +1 -0
- package/dist/src/commands/prompts/create.d.ts +2 -0
- package/dist/src/commands/prompts/create.js +48 -0
- package/dist/src/commands/prompts/create.js.map +1 -0
- package/dist/src/commands/prompts/formatters.d.ts +4 -0
- package/dist/src/commands/prompts/formatters.js +7 -0
- package/dist/src/commands/prompts/formatters.js.map +1 -0
- package/dist/src/commands/prompts/index.d.ts +2 -0
- package/dist/src/commands/prompts/index.js +11 -0
- package/dist/src/commands/prompts/index.js.map +1 -0
- package/dist/src/commands/prompts/list.d.ts +2 -0
- package/dist/src/commands/prompts/list.js +34 -0
- package/dist/src/commands/prompts/list.js.map +1 -0
- package/dist/src/commands/prompts/parsers.d.ts +9 -0
- package/dist/src/commands/prompts/parsers.js +12 -0
- package/dist/src/commands/prompts/parsers.js.map +1 -0
- package/dist/src/commands/prompts/resolve.d.ts +17 -0
- package/dist/src/commands/prompts/resolve.js +43 -0
- package/dist/src/commands/prompts/resolve.js.map +1 -0
- package/dist/src/commands/prompts/update.d.ts +2 -0
- package/dist/src/commands/prompts/update.js +58 -0
- package/dist/src/commands/prompts/update.js.map +1 -0
- package/dist/src/commands/setup/command.d.ts +2 -0
- package/dist/src/commands/setup/command.js +15 -0
- package/dist/src/commands/setup/command.js.map +1 -0
- package/dist/src/commands/setup/prompts.d.ts +66 -0
- package/dist/src/commands/setup/prompts.js +199 -0
- package/dist/src/commands/setup/prompts.js.map +1 -0
- package/dist/src/commands/setup/workflow.d.ts +17 -0
- package/dist/src/commands/setup/workflow.js +141 -0
- package/dist/src/commands/setup/workflow.js.map +1 -0
- package/dist/src/commands/status/command.d.ts +2 -0
- package/dist/src/commands/status/command.js +83 -0
- package/dist/src/commands/status/command.js.map +1 -0
- package/dist/src/commands/task-types/index.d.ts +2 -0
- package/dist/src/commands/task-types/index.js +6 -0
- package/dist/src/commands/task-types/index.js.map +1 -0
- package/dist/src/commands/task-types/list.d.ts +2 -0
- package/dist/src/commands/task-types/list.js +32 -0
- package/dist/src/commands/task-types/list.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/comments/add.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/comments/add.js +32 -0
- package/dist/src/commands/tasks/artifacts/comments/add.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/comments/formatters.d.ts +7 -0
- package/dist/src/commands/tasks/artifacts/comments/formatters.js +32 -0
- package/dist/src/commands/tasks/artifacts/comments/formatters.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/comments/index.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/comments/index.js +13 -0
- package/dist/src/commands/tasks/artifacts/comments/index.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/comments/list.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/comments/list.js +24 -0
- package/dist/src/commands/tasks/artifacts/comments/list.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/comments/parsers.d.ts +6 -0
- package/dist/src/commands/tasks/artifacts/comments/parsers.js +8 -0
- package/dist/src/commands/tasks/artifacts/comments/parsers.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/comments/reply.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/comments/reply.js +23 -0
- package/dist/src/commands/tasks/artifacts/comments/reply.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/comments/resolve.d.ts +3 -0
- package/dist/src/commands/tasks/artifacts/comments/resolve.js +26 -0
- package/dist/src/commands/tasks/artifacts/comments/resolve.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/create.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/create.js +63 -0
- package/dist/src/commands/tasks/artifacts/create.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/delete.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/delete.js +27 -0
- package/dist/src/commands/tasks/artifacts/delete.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/get.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/get.js +54 -0
- package/dist/src/commands/tasks/artifacts/get.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/index.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/index.js +18 -0
- package/dist/src/commands/tasks/artifacts/index.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/list.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/list.js +31 -0
- package/dist/src/commands/tasks/artifacts/list.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/parsers.d.ts +13 -0
- package/dist/src/commands/tasks/artifacts/parsers.js +24 -0
- package/dist/src/commands/tasks/artifacts/parsers.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/replace.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/replace.js +62 -0
- package/dist/src/commands/tasks/artifacts/replace.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/update.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/update.js +55 -0
- package/dist/src/commands/tasks/artifacts/update.js.map +1 -0
- package/dist/src/commands/tasks/attach.d.ts +2 -0
- package/dist/src/commands/tasks/attach.js +70 -0
- package/dist/src/commands/tasks/attach.js.map +1 -0
- package/dist/src/commands/tasks/attachments/delete.d.ts +2 -0
- package/dist/src/commands/tasks/attachments/delete.js +61 -0
- package/dist/src/commands/tasks/attachments/delete.js.map +1 -0
- package/dist/src/commands/tasks/attachments/download.d.ts +2 -0
- package/dist/src/commands/tasks/attachments/download.js +42 -0
- package/dist/src/commands/tasks/attachments/download.js.map +1 -0
- package/dist/src/commands/tasks/attachments/formatters.d.ts +5 -0
- package/dist/src/commands/tasks/attachments/formatters.js +18 -0
- package/dist/src/commands/tasks/attachments/formatters.js.map +1 -0
- package/dist/src/commands/tasks/attachments/index.d.ts +2 -0
- package/dist/src/commands/tasks/attachments/index.js +11 -0
- package/dist/src/commands/tasks/attachments/index.js.map +1 -0
- package/dist/src/commands/tasks/attachments/list.d.ts +2 -0
- package/dist/src/commands/tasks/attachments/list.js +36 -0
- package/dist/src/commands/tasks/attachments/list.js.map +1 -0
- package/dist/src/commands/tasks/attachments/resolve.d.ts +6 -0
- package/dist/src/commands/tasks/attachments/resolve.js +15 -0
- package/dist/src/commands/tasks/attachments/resolve.js.map +1 -0
- package/dist/src/commands/tasks/attachments/transfer.d.ts +11 -0
- package/dist/src/commands/tasks/attachments/transfer.js +71 -0
- package/dist/src/commands/tasks/attachments/transfer.js.map +1 -0
- package/dist/src/commands/tasks/comments/add.d.ts +2 -0
- package/dist/src/commands/tasks/comments/add.js +44 -0
- package/dist/src/commands/tasks/comments/add.js.map +1 -0
- package/dist/src/commands/tasks/comments/index.d.ts +2 -0
- package/dist/src/commands/tasks/comments/index.js +6 -0
- package/dist/src/commands/tasks/comments/index.js.map +1 -0
- package/dist/src/commands/tasks/create.d.ts +2 -0
- package/dist/src/commands/tasks/create.js +77 -0
- package/dist/src/commands/tasks/create.js.map +1 -0
- package/dist/src/commands/tasks/delete.d.ts +2 -0
- package/dist/src/commands/tasks/delete.js +31 -0
- package/dist/src/commands/tasks/delete.js.map +1 -0
- package/dist/src/commands/tasks/formatters.d.ts +25 -0
- package/dist/src/commands/tasks/formatters.js +40 -0
- package/dist/src/commands/tasks/formatters.js.map +1 -0
- package/dist/src/commands/tasks/get.d.ts +2 -0
- package/dist/src/commands/tasks/get.js +94 -0
- package/dist/src/commands/tasks/get.js.map +1 -0
- package/dist/src/commands/tasks/hydrate.d.ts +20 -0
- package/dist/src/commands/tasks/hydrate.js +47 -0
- package/dist/src/commands/tasks/hydrate.js.map +1 -0
- package/dist/src/commands/tasks/index.d.ts +2 -0
- package/dist/src/commands/tasks/index.js +33 -0
- package/dist/src/commands/tasks/index.js.map +1 -0
- package/dist/src/commands/tasks/links.d.ts +4 -0
- package/dist/src/commands/tasks/links.js +121 -0
- package/dist/src/commands/tasks/links.js.map +1 -0
- package/dist/src/commands/tasks/list.d.ts +2 -0
- package/dist/src/commands/tasks/list.js +47 -0
- package/dist/src/commands/tasks/list.js.map +1 -0
- package/dist/src/commands/tasks/move-to-list.d.ts +2 -0
- package/dist/src/commands/tasks/move-to-list.js +41 -0
- package/dist/src/commands/tasks/move-to-list.js.map +1 -0
- package/dist/src/commands/tasks/move.d.ts +2 -0
- package/dist/src/commands/tasks/move.js +61 -0
- package/dist/src/commands/tasks/move.js.map +1 -0
- package/dist/src/commands/tasks/parsers.d.ts +22 -0
- package/dist/src/commands/tasks/parsers.js +118 -0
- package/dist/src/commands/tasks/parsers.js.map +1 -0
- package/dist/src/commands/tasks/refs.d.ts +2 -0
- package/dist/src/commands/tasks/refs.js +89 -0
- package/dist/src/commands/tasks/refs.js.map +1 -0
- package/dist/src/commands/tasks/resolve.d.ts +20 -0
- package/dist/src/commands/tasks/resolve.js +57 -0
- package/dist/src/commands/tasks/resolve.js.map +1 -0
- package/dist/src/commands/tasks/search.d.ts +2 -0
- package/dist/src/commands/tasks/search.js +110 -0
- package/dist/src/commands/tasks/search.js.map +1 -0
- package/dist/src/commands/tasks/update.d.ts +2 -0
- package/dist/src/commands/tasks/update.js +101 -0
- package/dist/src/commands/tasks/update.js.map +1 -0
- package/dist/src/commands/test-helpers.d.ts +2 -0
- package/dist/src/commands/test-helpers.js +6 -0
- package/dist/src/commands/test-helpers.js.map +1 -0
- package/dist/src/commands/threads/create.d.ts +2 -0
- package/dist/src/commands/threads/create.js +99 -0
- package/dist/src/commands/threads/create.js.map +1 -0
- package/dist/src/commands/threads/formatters.d.ts +10 -0
- package/dist/src/commands/threads/formatters.js +17 -0
- package/dist/src/commands/threads/formatters.js.map +1 -0
- package/dist/src/commands/threads/get.d.ts +2 -0
- package/dist/src/commands/threads/get.js +53 -0
- package/dist/src/commands/threads/get.js.map +1 -0
- package/dist/src/commands/threads/index.d.ts +2 -0
- package/dist/src/commands/threads/index.js +14 -0
- package/dist/src/commands/threads/index.js.map +1 -0
- package/dist/src/commands/threads/list.d.ts +2 -0
- package/dist/src/commands/threads/list.js +69 -0
- package/dist/src/commands/threads/list.js.map +1 -0
- package/dist/src/commands/threads/messages.d.ts +2 -0
- package/dist/src/commands/threads/messages.js +59 -0
- package/dist/src/commands/threads/messages.js.map +1 -0
- package/dist/src/commands/threads/parsers.d.ts +5 -0
- package/dist/src/commands/threads/parsers.js +19 -0
- package/dist/src/commands/threads/parsers.js.map +1 -0
- package/dist/src/commands/threads/send.d.ts +2 -0
- package/dist/src/commands/threads/send.js +49 -0
- package/dist/src/commands/threads/send.js.map +1 -0
- package/dist/src/commands/threads/spawn-target.d.ts +29 -0
- package/dist/src/commands/threads/spawn-target.js +62 -0
- package/dist/src/commands/threads/spawn-target.js.map +1 -0
- package/dist/src/convex/_generated/ai/ai-files.state.json +6 -0
- package/dist/src/convex/_generated/ai/guidelines.md +371 -0
- package/dist/src/convex/_generated/api.d.ts +598 -0
- package/dist/src/convex/_generated/api.js +23 -0
- package/dist/src/convex/_generated/dataModel.d.ts +60 -0
- package/dist/src/convex/_generated/server.d.ts +143 -0
- package/dist/src/convex/_generated/server.js +93 -0
- package/dist/src/lib/argv.d.ts +1 -0
- package/dist/src/lib/argv.js +7 -0
- package/dist/src/lib/argv.js.map +1 -0
- package/dist/src/lib/browser-login.d.ts +43 -0
- package/dist/src/lib/browser-login.js +216 -0
- package/dist/src/lib/browser-login.js.map +1 -0
- package/dist/src/lib/config/convex-client.d.ts +41 -0
- package/dist/src/lib/config/convex-client.js +53 -0
- package/dist/src/lib/config/convex-client.js.map +1 -0
- package/dist/src/lib/config/index.d.ts +7 -0
- package/dist/src/lib/config/index.js +13 -0
- package/dist/src/lib/config/index.js.map +1 -0
- package/dist/src/lib/config/profile.d.ts +40 -0
- package/dist/src/lib/config/profile.js +155 -0
- package/dist/src/lib/config/profile.js.map +1 -0
- package/dist/src/lib/config/provider-keys.d.ts +47 -0
- package/dist/src/lib/config/provider-keys.js +97 -0
- package/dist/src/lib/config/provider-keys.js.map +1 -0
- package/dist/src/lib/config/toml.d.ts +78 -0
- package/dist/src/lib/config/toml.js +228 -0
- package/dist/src/lib/config/toml.js.map +1 -0
- package/dist/src/lib/config/types.d.ts +98 -0
- package/dist/src/lib/config/types.js +65 -0
- package/dist/src/lib/config/types.js.map +1 -0
- package/dist/src/lib/config/validate.d.ts +30 -0
- package/dist/src/lib/config/validate.js +66 -0
- package/dist/src/lib/config/validate.js.map +1 -0
- package/dist/src/lib/connect-events.d.ts +42 -0
- package/dist/src/lib/connect-events.js +65 -0
- package/dist/src/lib/connect-events.js.map +1 -0
- package/dist/src/lib/constants.d.ts +20 -0
- package/dist/src/lib/constants.js +27 -0
- package/dist/src/lib/constants.js.map +1 -0
- package/dist/src/lib/content-type.d.ts +1 -0
- package/dist/src/lib/content-type.js +27 -0
- package/dist/src/lib/content-type.js.map +1 -0
- package/dist/src/lib/convex-error.d.ts +12 -0
- package/dist/src/lib/convex-error.js +33 -0
- package/dist/src/lib/convex-error.js.map +1 -0
- package/dist/src/lib/git/checkpoint.d.ts +74 -0
- package/dist/src/lib/git/checkpoint.js +210 -0
- package/dist/src/lib/git/checkpoint.js.map +1 -0
- package/dist/src/lib/git/exec.d.ts +23 -0
- package/dist/src/lib/git/exec.js +46 -0
- package/dist/src/lib/git/exec.js.map +1 -0
- package/dist/src/lib/git/file-index.d.ts +8 -0
- package/dist/src/lib/git/file-index.js +125 -0
- package/dist/src/lib/git/file-index.js.map +1 -0
- package/dist/src/lib/git/index.d.ts +5 -0
- package/dist/src/lib/git/index.js +6 -0
- package/dist/src/lib/git/index.js.map +1 -0
- package/dist/src/lib/git/repo.d.ts +32 -0
- package/dist/src/lib/git/repo.js +95 -0
- package/dist/src/lib/git/repo.js.map +1 -0
- package/dist/src/lib/git/worktrees.d.ts +49 -0
- package/dist/src/lib/git/worktrees.js +97 -0
- package/dist/src/lib/git/worktrees.js.map +1 -0
- package/dist/src/lib/global-options.d.ts +3 -0
- package/dist/src/lib/global-options.js +8 -0
- package/dist/src/lib/global-options.js.map +1 -0
- package/dist/src/lib/id.d.ts +3 -0
- package/dist/src/lib/id.js +14 -0
- package/dist/src/lib/id.js.map +1 -0
- package/dist/src/lib/one-shot-command.d.ts +7 -0
- package/dist/src/lib/one-shot-command.js +30 -0
- package/dist/src/lib/one-shot-command.js.map +1 -0
- package/dist/src/lib/one-shot-config.d.ts +3 -0
- package/dist/src/lib/one-shot-config.js +7 -0
- package/dist/src/lib/one-shot-config.js.map +1 -0
- package/dist/src/lib/output.d.ts +10 -0
- package/dist/src/lib/output.js +27 -0
- package/dist/src/lib/output.js.map +1 -0
- package/dist/src/lib/pagination.d.ts +16 -0
- package/dist/src/lib/pagination.js +45 -0
- package/dist/src/lib/pagination.js.map +1 -0
- package/dist/src/lib/parsers.d.ts +2 -0
- package/dist/src/lib/parsers.js +21 -0
- package/dist/src/lib/parsers.js.map +1 -0
- package/dist/src/lib/project-resolution.d.ts +41 -0
- package/dist/src/lib/project-resolution.js +84 -0
- package/dist/src/lib/project-resolution.js.map +1 -0
- package/dist/src/lib/pull-requests.d.ts +47 -0
- package/dist/src/lib/pull-requests.js +305 -0
- package/dist/src/lib/pull-requests.js.map +1 -0
- package/dist/src/lib/skill-install-guidance.d.ts +5 -0
- package/dist/src/lib/skill-install-guidance.js +41 -0
- package/dist/src/lib/skill-install-guidance.js.map +1 -0
- package/dist/src/lib/text-input.d.ts +18 -0
- package/dist/src/lib/text-input.js +36 -0
- package/dist/src/lib/text-input.js.map +1 -0
- package/dist/src/lib/thread-attachments.d.ts +21 -0
- package/dist/src/lib/thread-attachments.js +104 -0
- package/dist/src/lib/thread-attachments.js.map +1 -0
- package/dist/src/lib/url.d.ts +13 -0
- package/dist/src/lib/url.js +25 -0
- package/dist/src/lib/url.js.map +1 -0
- package/dist/src/lib/version.d.ts +2 -0
- package/dist/src/lib/version.js +33 -0
- package/dist/src/lib/version.js.map +1 -0
- package/dist/templates/devcontainer/Dockerfile +95 -0
- package/dist/templates/devcontainer/README.md +129 -0
- package/dist/templates/devcontainer/devcontainer.json +92 -0
- package/dist/templates/devcontainer/init-firewall.sh +271 -0
- package/package.json +79 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import * as os from "node:os";
|
|
4
|
+
import * as TOML from "smol-toml";
|
|
5
|
+
import { CONFIG_DIR_NAME, CONFIG_FILE_NAME } from "../constants.js";
|
|
6
|
+
import { ConfigFileSchema, } from "./types.js";
|
|
7
|
+
const CONFIG_DIR = path.join(os.homedir(), CONFIG_DIR_NAME);
|
|
8
|
+
const CONFIG_FILE = path.join(CONFIG_DIR, CONFIG_FILE_NAME);
|
|
9
|
+
/**
|
|
10
|
+
* Ensure the config directory exists
|
|
11
|
+
*/
|
|
12
|
+
function ensureConfigDir() {
|
|
13
|
+
if (!fs.existsSync(CONFIG_DIR)) {
|
|
14
|
+
fs.mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get the path to the config file
|
|
19
|
+
*/
|
|
20
|
+
export function getConfigPath() {
|
|
21
|
+
return CONFIG_FILE;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Check if config file exists
|
|
25
|
+
*/
|
|
26
|
+
export function configExists() {
|
|
27
|
+
return fs.existsSync(CONFIG_FILE);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Read the config file
|
|
31
|
+
* Returns empty config if file doesn't exist
|
|
32
|
+
*/
|
|
33
|
+
export function readConfig() {
|
|
34
|
+
if (!fs.existsSync(CONFIG_FILE)) {
|
|
35
|
+
return { profiles: {} };
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const content = fs.readFileSync(CONFIG_FILE, "utf-8");
|
|
39
|
+
const parsed = TOML.parse(content);
|
|
40
|
+
const validated = ConfigFileSchema.safeParse(parsed);
|
|
41
|
+
if (!validated.success) {
|
|
42
|
+
console.warn(`Warning: Invalid config file format. Some entries may be ignored.`);
|
|
43
|
+
// Return a minimal valid config
|
|
44
|
+
return { profiles: {} };
|
|
45
|
+
}
|
|
46
|
+
return validated.data;
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
console.warn(`Warning: Failed to read config file: ${error instanceof Error ? error.message : String(error)}`);
|
|
50
|
+
return { profiles: {} };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Write the config file
|
|
55
|
+
*/
|
|
56
|
+
export function writeConfig(config) {
|
|
57
|
+
ensureConfigDir();
|
|
58
|
+
// Build TOML structure
|
|
59
|
+
const tomlData = {};
|
|
60
|
+
// Add settings if present
|
|
61
|
+
if (config.settings) {
|
|
62
|
+
tomlData.settings = config.settings;
|
|
63
|
+
}
|
|
64
|
+
// Add profiles
|
|
65
|
+
if (Object.keys(config.profiles).length > 0) {
|
|
66
|
+
tomlData.profiles = config.profiles;
|
|
67
|
+
}
|
|
68
|
+
// Add provider keys
|
|
69
|
+
if (config.keys && Object.keys(config.keys).length > 0) {
|
|
70
|
+
tomlData.keys = config.keys;
|
|
71
|
+
}
|
|
72
|
+
const content = TOML.stringify(tomlData);
|
|
73
|
+
fs.writeFileSync(CONFIG_FILE, content, { mode: 0o600 });
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get a profile by key
|
|
77
|
+
*/
|
|
78
|
+
export function getProfileByKey(key) {
|
|
79
|
+
const config = readConfig();
|
|
80
|
+
return config.profiles[key];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Set a profile by key
|
|
84
|
+
*/
|
|
85
|
+
export function setProfile(key, profile) {
|
|
86
|
+
const config = readConfig();
|
|
87
|
+
config.profiles[key] = profile;
|
|
88
|
+
writeConfig(config);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Delete a profile by key
|
|
92
|
+
*/
|
|
93
|
+
export function deleteProfileByKey(key) {
|
|
94
|
+
const config = readConfig();
|
|
95
|
+
if (config.profiles[key]) {
|
|
96
|
+
delete config.profiles[key];
|
|
97
|
+
writeConfig(config);
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* List all profiles
|
|
104
|
+
*/
|
|
105
|
+
export function listAllProfiles() {
|
|
106
|
+
const config = readConfig();
|
|
107
|
+
return Object.entries(config.profiles).map(([key, profile]) => ({
|
|
108
|
+
key,
|
|
109
|
+
profile,
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Add a path to an existing profile.
|
|
114
|
+
* No-op if the path is already present.
|
|
115
|
+
*/
|
|
116
|
+
export function addPathToProfile(key, newPath) {
|
|
117
|
+
const config = readConfig();
|
|
118
|
+
const profile = config.profiles[key];
|
|
119
|
+
if (!profile) {
|
|
120
|
+
throw new Error(`Profile "${key}" not found`);
|
|
121
|
+
}
|
|
122
|
+
const resolved = path.resolve(newPath);
|
|
123
|
+
if (profile.paths.some((p) => path.resolve(p) === resolved)) {
|
|
124
|
+
return; // already present
|
|
125
|
+
}
|
|
126
|
+
profile.paths.push(resolved);
|
|
127
|
+
writeConfig(config);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Remove a path from an existing profile.
|
|
131
|
+
* Throws if it's the last path (min 1 required).
|
|
132
|
+
*/
|
|
133
|
+
export function removePathFromProfile(key, targetPath) {
|
|
134
|
+
const config = readConfig();
|
|
135
|
+
const profile = config.profiles[key];
|
|
136
|
+
if (!profile) {
|
|
137
|
+
throw new Error(`Profile "${key}" not found`);
|
|
138
|
+
}
|
|
139
|
+
const resolved = path.resolve(targetPath);
|
|
140
|
+
const idx = profile.paths.findIndex((p) => path.resolve(p) === resolved);
|
|
141
|
+
if (idx === -1) {
|
|
142
|
+
throw new Error(`Path "${targetPath}" not found in profile "${key}"`);
|
|
143
|
+
}
|
|
144
|
+
if (profile.paths.length <= 1) {
|
|
145
|
+
throw new Error(`Cannot remove last path from profile "${key}"`);
|
|
146
|
+
}
|
|
147
|
+
profile.paths.splice(idx, 1);
|
|
148
|
+
writeConfig(config);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* List all stored provider keys
|
|
152
|
+
*/
|
|
153
|
+
export function listProviderKeys() {
|
|
154
|
+
const config = readConfig();
|
|
155
|
+
return Object.entries(config.keys ?? {}).map(([name, key]) => ({ name, key }));
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Get a provider key by name
|
|
159
|
+
*/
|
|
160
|
+
export function getProviderKey(name) {
|
|
161
|
+
const config = readConfig();
|
|
162
|
+
return config.keys?.[name];
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Create or overwrite a provider key
|
|
166
|
+
*/
|
|
167
|
+
export function setProviderKey(name, key) {
|
|
168
|
+
const config = readConfig();
|
|
169
|
+
config.keys = { ...config.keys, [name]: key };
|
|
170
|
+
writeConfig(config);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Delete a provider key. Throws if any profile still references it.
|
|
174
|
+
*/
|
|
175
|
+
export function deleteProviderKey(name) {
|
|
176
|
+
const config = readConfig();
|
|
177
|
+
if (!config.keys?.[name]) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
const usedBy = Object.entries(config.profiles)
|
|
181
|
+
.filter(([, profile]) => profile.provider_key === name)
|
|
182
|
+
.map(([key]) => key);
|
|
183
|
+
if (usedBy.length > 0) {
|
|
184
|
+
throw new Error(`Key "${name}" is used by profile(s): ${usedBy.join(", ")}. Unassign it first with 'convoy keys unassign --profile <key>'.`);
|
|
185
|
+
}
|
|
186
|
+
delete config.keys[name];
|
|
187
|
+
writeConfig(config);
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Assign a provider key to a profile (or clear with undefined).
|
|
192
|
+
*/
|
|
193
|
+
export function setProfileProviderKey(profileKey, keyName) {
|
|
194
|
+
const config = readConfig();
|
|
195
|
+
const profile = config.profiles[profileKey];
|
|
196
|
+
if (!profile) {
|
|
197
|
+
throw new Error(`Profile "${profileKey}" not found`);
|
|
198
|
+
}
|
|
199
|
+
if (keyName !== undefined && !config.keys?.[keyName]) {
|
|
200
|
+
throw new Error(`Provider key "${keyName}" not found. Run 'convoy keys list'.`);
|
|
201
|
+
}
|
|
202
|
+
if (keyName === undefined) {
|
|
203
|
+
delete profile.provider_key;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
profile.provider_key = keyName;
|
|
207
|
+
}
|
|
208
|
+
writeConfig(config);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Get the default profile name from settings
|
|
212
|
+
*/
|
|
213
|
+
export function getDefaultProfileKey() {
|
|
214
|
+
const config = readConfig();
|
|
215
|
+
return config.settings?.default_profile;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Set the default profile in settings
|
|
219
|
+
*/
|
|
220
|
+
export function setDefaultProfile(key) {
|
|
221
|
+
const config = readConfig();
|
|
222
|
+
if (!config.settings) {
|
|
223
|
+
config.settings = {};
|
|
224
|
+
}
|
|
225
|
+
config.settings.default_profile = key;
|
|
226
|
+
writeConfig(config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AM,GAAG,UAAU,EAAE,CAAC;IAC5B,OAAO,MAAM,CAAC,QAAQ,EAAE,eAAe,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACrB,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC;IACvB,CAAC;IACD,MAAM,CAAC,QAAQ,CAAC,eAAe,GAAG,GAAG,CAAC;IACtC,WAAW,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* A stored model-provider entry (`[keys.<name>]` in config.toml). Assigned to profiles
|
|
4
|
+
* via `provider_key`; never sent to the backend.
|
|
5
|
+
*
|
|
6
|
+
* `anthropic` is credential-free: it pins agents to this machine's Claude sign-in, which
|
|
7
|
+
* is how a profile opts out of inherited Bedrock/Mantle flags.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ProviderKeySchema: z.ZodObject<{
|
|
10
|
+
provider: z.ZodEnum<{
|
|
11
|
+
bedrock: "bedrock";
|
|
12
|
+
mantle: "mantle";
|
|
13
|
+
anthropic: "anthropic";
|
|
14
|
+
}>;
|
|
15
|
+
token: z.ZodOptional<z.ZodString>;
|
|
16
|
+
region: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type ProviderKey = z.infer<typeof ProviderKeySchema>;
|
|
19
|
+
/**
|
|
20
|
+
* Profile stored in config.toml
|
|
21
|
+
* Contains all connection info for a project/folder
|
|
22
|
+
*/
|
|
23
|
+
export declare const ProfileSchema: z.ZodObject<{
|
|
24
|
+
name: z.ZodString;
|
|
25
|
+
url: z.ZodString;
|
|
26
|
+
api_key: z.ZodString;
|
|
27
|
+
project_id: z.ZodString;
|
|
28
|
+
paths: z.ZodArray<z.ZodString>;
|
|
29
|
+
streaming: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
isolated: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
concurrency: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
provider_key: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export type Profile = z.infer<typeof ProfileSchema>;
|
|
35
|
+
/**
|
|
36
|
+
* Settings section in config.toml
|
|
37
|
+
*/
|
|
38
|
+
export declare const SettingsSchema: z.ZodObject<{
|
|
39
|
+
default_profile: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export type Settings = z.infer<typeof SettingsSchema>;
|
|
42
|
+
/**
|
|
43
|
+
* Full config.toml file structure
|
|
44
|
+
*/
|
|
45
|
+
export declare const ConfigFileSchema: z.ZodObject<{
|
|
46
|
+
settings: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
default_profile: z.ZodOptional<z.ZodString>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
profiles: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
url: z.ZodString;
|
|
52
|
+
api_key: z.ZodString;
|
|
53
|
+
project_id: z.ZodString;
|
|
54
|
+
paths: z.ZodArray<z.ZodString>;
|
|
55
|
+
streaming: z.ZodOptional<z.ZodBoolean>;
|
|
56
|
+
isolated: z.ZodOptional<z.ZodBoolean>;
|
|
57
|
+
concurrency: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
provider_key: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, z.core.$strip>>>;
|
|
60
|
+
keys: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
61
|
+
provider: z.ZodEnum<{
|
|
62
|
+
bedrock: "bedrock";
|
|
63
|
+
mantle: "mantle";
|
|
64
|
+
anthropic: "anthropic";
|
|
65
|
+
}>;
|
|
66
|
+
token: z.ZodOptional<z.ZodString>;
|
|
67
|
+
region: z.ZodOptional<z.ZodString>;
|
|
68
|
+
}, z.core.$strip>>>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export type ConfigFile = z.infer<typeof ConfigFileSchema>;
|
|
71
|
+
/**
|
|
72
|
+
* Merged config from all sources
|
|
73
|
+
*/
|
|
74
|
+
export interface ResolvedConfig {
|
|
75
|
+
convexUrl?: string;
|
|
76
|
+
projectId?: string;
|
|
77
|
+
profile?: string;
|
|
78
|
+
apiKey?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Resolved config with required credentials
|
|
82
|
+
*/
|
|
83
|
+
export interface RequiredConfig {
|
|
84
|
+
convexUrl: string;
|
|
85
|
+
apiKey: string;
|
|
86
|
+
projectId?: string;
|
|
87
|
+
profile?: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* CLI option overrides (from --url, --api-key, etc.)
|
|
91
|
+
* Highest priority in config resolution
|
|
92
|
+
*/
|
|
93
|
+
export interface CliOverrides {
|
|
94
|
+
url?: string;
|
|
95
|
+
apiKey?: string;
|
|
96
|
+
profile?: string;
|
|
97
|
+
projectId?: string;
|
|
98
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// Config Types (config.toml)
|
|
4
|
+
// =============================================================================
|
|
5
|
+
/**
|
|
6
|
+
* A stored model-provider entry (`[keys.<name>]` in config.toml). Assigned to profiles
|
|
7
|
+
* via `provider_key`; never sent to the backend.
|
|
8
|
+
*
|
|
9
|
+
* `anthropic` is credential-free: it pins agents to this machine's Claude sign-in, which
|
|
10
|
+
* is how a profile opts out of inherited Bedrock/Mantle flags.
|
|
11
|
+
*/
|
|
12
|
+
export const ProviderKeySchema = z
|
|
13
|
+
.object({
|
|
14
|
+
provider: z.enum(["bedrock", "mantle", "anthropic"]),
|
|
15
|
+
/** Injected as AWS_BEARER_TOKEN_BEDROCK; unused by `anthropic`. */
|
|
16
|
+
token: z.string().min(1).optional(),
|
|
17
|
+
/** Injected as AWS_REGION when set; unused by `anthropic`. */
|
|
18
|
+
region: z.string().optional(),
|
|
19
|
+
})
|
|
20
|
+
.superRefine((key, ctx) => {
|
|
21
|
+
if (key.provider !== "anthropic" && key.token === undefined) {
|
|
22
|
+
ctx.addIssue({
|
|
23
|
+
code: "custom",
|
|
24
|
+
path: ["token"],
|
|
25
|
+
message: `Provider "${key.provider}" requires a token`,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Profile stored in config.toml
|
|
31
|
+
* Contains all connection info for a project/folder
|
|
32
|
+
*/
|
|
33
|
+
export const ProfileSchema = z.object({
|
|
34
|
+
name: z.string(),
|
|
35
|
+
url: z.string().url(),
|
|
36
|
+
api_key: z.string(),
|
|
37
|
+
project_id: z.string(),
|
|
38
|
+
paths: z.array(z.string()).min(1),
|
|
39
|
+
/**
|
|
40
|
+
* Default for partial (delta) event streaming; `--buffered` turns it off
|
|
41
|
+
* for a run. On when omitted (OS-1659).
|
|
42
|
+
*/
|
|
43
|
+
streaming: z.boolean().optional(),
|
|
44
|
+
/** OS-sandbox agents to this profile's paths (OS-1242); `--isolated` flag wins. */
|
|
45
|
+
isolated: z.boolean().optional(),
|
|
46
|
+
/** Max simultaneous thread workers; `--concurrency` wins. */
|
|
47
|
+
concurrency: z.number().int().min(1).max(50).optional(),
|
|
48
|
+
/** Name of a `[keys.<name>]` entry; absent → the machine's own Claude config. */
|
|
49
|
+
provider_key: z.string().optional(),
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Settings section in config.toml
|
|
53
|
+
*/
|
|
54
|
+
export const SettingsSchema = z.object({
|
|
55
|
+
default_profile: z.string().optional(),
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Full config.toml file structure
|
|
59
|
+
*/
|
|
60
|
+
export const ConfigFileSchema = z.object({
|
|
61
|
+
settings: SettingsSchema.optional(),
|
|
62
|
+
profiles: z.record(z.string(), ProfileSchema).default({}),
|
|
63
|
+
keys: z.record(z.string(), ProviderKeySchema).optional(),
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/lib/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gFAAgF;AAChF,6BAA6B;AAC7B,gFAAgF;AAEhF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IACpD,mEAAmE;IACnE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACnC,8DAA8D;IAC9D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC;KACD,WAAW,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACxB,IAAI,GAAG,CAAC,QAAQ,KAAK,WAAW,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC5D,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,OAAO,CAAC;YACf,OAAO,EAAE,aAAa,GAAG,CAAC,QAAQ,oBAAoB;SACvD,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC;AAIL;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,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|
|
4
|
+
*/
|
|
5
|
+
export declare class ConfigError extends Error {
|
|
6
|
+
readonly hint?: string | undefined;
|
|
7
|
+
constructor(message: string, hint?: string | undefined);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Validate that credentials are present in the config
|
|
11
|
+
* Throws ConfigError if validation fails
|
|
12
|
+
*/
|
|
13
|
+
export declare function requireCredentials(config: ResolvedConfig): asserts config is RequiredConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Validate that a project is configured
|
|
16
|
+
* Throws ConfigError if validation fails
|
|
17
|
+
*/
|
|
18
|
+
export declare function requireProject(config: ResolvedConfig): asserts config is RequiredConfig & {
|
|
19
|
+
projectId: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Handle a ConfigError by printing a user-friendly message and exiting
|
|
23
|
+
* Returns the exit code (for testing) or exits the process
|
|
24
|
+
*/
|
|
25
|
+
export declare function handleConfigError(error: unknown, exit?: boolean): number;
|
|
26
|
+
/**
|
|
27
|
+
* Run a validation function and handle ConfigError with user-friendly output
|
|
28
|
+
* Usage: withConfigError(() => requireCredentials(config))
|
|
29
|
+
*/
|
|
30
|
+
export declare function withConfigError<T>(fn: () => T): T;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
/**
|
|
3
|
+
* Custom error for configuration issues
|
|
4
|
+
*/
|
|
5
|
+
export class ConfigError extends Error {
|
|
6
|
+
hint;
|
|
7
|
+
constructor(message, hint) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.hint = hint;
|
|
10
|
+
this.name = "ConfigError";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Validate that credentials are present in the config
|
|
15
|
+
* Throws ConfigError if validation fails
|
|
16
|
+
*/
|
|
17
|
+
export function requireCredentials(config) {
|
|
18
|
+
if (!config.convexUrl) {
|
|
19
|
+
throw new ConfigError("No Convex URL configured", "Run 'convoy setup' to configure a profile");
|
|
20
|
+
}
|
|
21
|
+
if (!config.apiKey) {
|
|
22
|
+
throw new ConfigError("No API key configured", "Run 'convoy setup' to configure a profile");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Validate that a project is configured
|
|
27
|
+
* Throws ConfigError if validation fails
|
|
28
|
+
*/
|
|
29
|
+
export function requireProject(config) {
|
|
30
|
+
requireCredentials(config);
|
|
31
|
+
if (!config.projectId) {
|
|
32
|
+
throw new ConfigError("No project configured", "Run 'convoy setup' to configure a profile with a project");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Handle a ConfigError by printing a user-friendly message and exiting
|
|
37
|
+
* Returns the exit code (for testing) or exits the process
|
|
38
|
+
*/
|
|
39
|
+
export function handleConfigError(error, exit = true) {
|
|
40
|
+
if (error instanceof ConfigError) {
|
|
41
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
42
|
+
if (error.hint) {
|
|
43
|
+
console.log(chalk.dim(error.hint));
|
|
44
|
+
}
|
|
45
|
+
if (exit) {
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
return 1;
|
|
49
|
+
}
|
|
50
|
+
// Re-throw non-ConfigError errors
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Run a validation function and handle ConfigError with user-friendly output
|
|
55
|
+
* Usage: withConfigError(() => requireCredentials(config))
|
|
56
|
+
*/
|
|
57
|
+
export function withConfigError(fn) {
|
|
58
|
+
try {
|
|
59
|
+
return fn();
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
handleConfigError(error);
|
|
63
|
+
throw error; // unreachable but satisfies TS
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../src/lib/config/validate.ts"],"names":[],"mappings":"AAA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;QAClB,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IAED,kCAAkC;IAClC,MAAM,KAAK,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAI,EAAW;IAC5C,IAAI,CAAC;QACH,OAAO,EAAE,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACzB,MAAM,KAAK,CAAC,CAAC,+BAA+B;IAC9C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NDJSON event stream for `convoy connect --json` — the sidecar contract a supervisor
|
|
3
|
+
* consumes. See docs/specs/cli-sidecar-contract.md.
|
|
4
|
+
*
|
|
5
|
+
* Module-level singleton: emit calls are no-ops unless enabled, so the non-`--json` path
|
|
6
|
+
* and existing tests are unaffected.
|
|
7
|
+
*/
|
|
8
|
+
/** OS-779 per-profile status vocabulary. */
|
|
9
|
+
export type ConnectStatus = "connecting" | "online" | "retrying" | "blocked" | "failed";
|
|
10
|
+
export type ThreadPhase = "claimed" | "streaming" | "completed" | "failed" | "released";
|
|
11
|
+
export type ConnectEvent = {
|
|
12
|
+
event: "status";
|
|
13
|
+
status: ConnectStatus;
|
|
14
|
+
message?: string;
|
|
15
|
+
sessionId?: string;
|
|
16
|
+
} | {
|
|
17
|
+
event: "thread";
|
|
18
|
+
phase: ThreadPhase;
|
|
19
|
+
threadId: string;
|
|
20
|
+
error?: string;
|
|
21
|
+
};
|
|
22
|
+
/** Exit codes a supervisor can classify (see spec). */
|
|
23
|
+
export declare const EXIT_CLEAN = 0;
|
|
24
|
+
export declare const EXIT_FATAL = 1;
|
|
25
|
+
export declare const EXIT_SESSION_REPLACED = 3;
|
|
26
|
+
type EventWriter = (line: string) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Reserve stdout for NDJSON events. Human log lines move to stderr
|
|
29
|
+
* (console.info/debug too — they also default to stdout).
|
|
30
|
+
*/
|
|
31
|
+
export declare function enableConnectEvents(customWriter?: EventWriter): void;
|
|
32
|
+
/** Test-only: restore console and silence the emitter. */
|
|
33
|
+
export declare function disableConnectEvents(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Exit once stdout has drained. process.exit() does not flush pipe-buffered
|
|
36
|
+
* stdout, so a terminal event emitted right before it can be lost under a
|
|
37
|
+
* supervisor; queueing an empty write behind the event and exiting from its
|
|
38
|
+
* callback guarantees delivery (1s fallback in case stdout never drains).
|
|
39
|
+
*/
|
|
40
|
+
export declare function exitAfterFlush(code: number): void;
|
|
41
|
+
export declare function emitConnectEvent(event: ConnectEvent): void;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NDJSON event stream for `convoy connect --json` — the sidecar contract a supervisor
|
|
3
|
+
* consumes. See docs/specs/cli-sidecar-contract.md.
|
|
4
|
+
*
|
|
5
|
+
* Module-level singleton: emit calls are no-ops unless enabled, so the non-`--json` path
|
|
6
|
+
* and existing tests are unaffected.
|
|
7
|
+
*/
|
|
8
|
+
/** Exit codes a supervisor can classify (see spec). */
|
|
9
|
+
export const EXIT_CLEAN = 0;
|
|
10
|
+
export const EXIT_FATAL = 1;
|
|
11
|
+
export const EXIT_SESSION_REPLACED = 3;
|
|
12
|
+
let writer = null;
|
|
13
|
+
let lastStatus = null;
|
|
14
|
+
let originalConsole = null;
|
|
15
|
+
/**
|
|
16
|
+
* Reserve stdout for NDJSON events. Human log lines move to stderr
|
|
17
|
+
* (console.info/debug too — they also default to stdout).
|
|
18
|
+
*/
|
|
19
|
+
export function enableConnectEvents(customWriter) {
|
|
20
|
+
writer = customWriter ?? ((line) => process.stdout.write(`${line}\n`));
|
|
21
|
+
lastStatus = null;
|
|
22
|
+
// ponytail: global console→stderr redirect instead of a central logger;
|
|
23
|
+
// introduce one if anything besides connect ever needs stdout in json mode.
|
|
24
|
+
if (!originalConsole) {
|
|
25
|
+
originalConsole = { log: console.log, info: console.info, debug: console.debug };
|
|
26
|
+
console.log = console.info = console.debug = (...args) => console.error(...args);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** Test-only: restore console and silence the emitter. */
|
|
30
|
+
export function disableConnectEvents() {
|
|
31
|
+
writer = null;
|
|
32
|
+
lastStatus = null;
|
|
33
|
+
if (originalConsole) {
|
|
34
|
+
console.log = originalConsole.log;
|
|
35
|
+
console.info = originalConsole.info;
|
|
36
|
+
console.debug = originalConsole.debug;
|
|
37
|
+
originalConsole = null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Exit once stdout has drained. process.exit() does not flush pipe-buffered
|
|
42
|
+
* stdout, so a terminal event emitted right before it can be lost under a
|
|
43
|
+
* supervisor; queueing an empty write behind the event and exiting from its
|
|
44
|
+
* callback guarantees delivery (1s fallback in case stdout never drains).
|
|
45
|
+
*/
|
|
46
|
+
export function exitAfterFlush(code) {
|
|
47
|
+
const fallback = setTimeout(() => process.exit(code), 1000);
|
|
48
|
+
process.stdout.write("", () => {
|
|
49
|
+
clearTimeout(fallback);
|
|
50
|
+
process.exit(code);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
export function emitConnectEvent(event) {
|
|
54
|
+
if (!writer)
|
|
55
|
+
return;
|
|
56
|
+
if (event.event === "status") {
|
|
57
|
+
// Dedupe repeats (a healthy heartbeat every 30s must not re-emit
|
|
58
|
+
// "online"); transitions always emit.
|
|
59
|
+
if (event.status === lastStatus)
|
|
60
|
+
return;
|
|
61
|
+
lastStatus = event.status;
|
|
62
|
+
}
|
|
63
|
+
writer(JSON.stringify({ v: 1, ts: Date.now(), ...event }));
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=connect-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-events.js","sourceRoot":"","sources":["../../../src/lib/connect-events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,u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ED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IAC5D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE;QAC5B,YAAY,CAAC,QAAQ,CAAC,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAmB;IAClD,IAAI,CAAC,MAAM;QAAE,OAAO;IACpB,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC7B,iEAAiE;QACjE,sCAAsC;QACtC,IAAI,KAAK,CAAC,MAAM,KAAK,UAAU;YAAE,OAAO;QACxC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;IAC5B,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized constants for the CLI
|
|
3
|
+
*/
|
|
4
|
+
/** Expected prefix for user API keys */
|
|
5
|
+
export declare const API_KEY_PREFIX = "sk_user_";
|
|
6
|
+
/** Config directory name (under home) */
|
|
7
|
+
export declare const CONFIG_DIR_NAME = ".config/opensana";
|
|
8
|
+
/** Config file name */
|
|
9
|
+
export declare const CONFIG_FILE_NAME = "config.toml";
|
|
10
|
+
/** Env var for Convex URL override */
|
|
11
|
+
export declare const ENV_URL = "OPENSANA_URL";
|
|
12
|
+
/** Env var for direct API key */
|
|
13
|
+
export declare const ENV_API_KEY = "OPENSANA_API_KEY";
|
|
14
|
+
/** Env var for profile name */
|
|
15
|
+
export declare const ENV_PROFILE = "OPENSANA_PROFILE";
|
|
16
|
+
/**
|
|
17
|
+
* Env var set ON the spawned coding runtime (not read by the CLI): the
|
|
18
|
+
* OpenSana thread ID the run belongs to (OS-1223).
|
|
19
|
+
*/
|
|
20
|
+
export declare const ENV_THREAD_ID = "OPENSANA_THREAD_ID";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized constants for the CLI
|
|
3
|
+
*/
|
|
4
|
+
/** Expected prefix for user API keys */
|
|
5
|
+
export const API_KEY_PREFIX = "sk_user_";
|
|
6
|
+
// =============================================================================
|
|
7
|
+
// Config File Names
|
|
8
|
+
// =============================================================================
|
|
9
|
+
/** Config directory name (under home) */
|
|
10
|
+
export const CONFIG_DIR_NAME = ".config/opensana";
|
|
11
|
+
/** Config file name */
|
|
12
|
+
export const CONFIG_FILE_NAME = "config.toml";
|
|
13
|
+
// =============================================================================
|
|
14
|
+
// Environment Variable Names
|
|
15
|
+
// =============================================================================
|
|
16
|
+
/** Env var for Convex URL override */
|
|
17
|
+
export const ENV_URL = "OPENSANA_URL";
|
|
18
|
+
/** Env var for direct API key */
|
|
19
|
+
export const ENV_API_KEY = "OPENSANA_API_KEY";
|
|
20
|
+
/** Env var for profile name */
|
|
21
|
+
export const ENV_PROFILE = "OPENSANA_PROFILE";
|
|
22
|
+
/**
|
|
23
|
+
* Env var set ON the spawned coding runtime (not read by the CLI): the
|
|
24
|
+
* OpenSana thread ID the run belongs to (OS-1223).
|
|
25
|
+
*/
|
|
26
|
+
export const ENV_THREAD_ID = "OPENSANA_THREAD_ID";
|
|
27
|
+
//# sourceMappingURL=constants.js.map
|