oh-my-opencode 5.1.83 → 5.1.86
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/.agents/command/remove-deadcode.md +1 -1
- package/.agents/skills/remove-deadcode/SKILL.md +1 -1
- package/.agents/skills/work-with-pr/SKILL.md +2 -2
- package/.opencode/command/remove-deadcode.md +1 -1
- package/.opencode/skills/work-with-pr/SKILL.md +2 -2
- package/THIRD-PARTY-NOTICES.md +9 -3
- package/dist/cli/cli-program.d.ts +3 -0
- package/dist/cli/index.js +1197 -1008
- package/dist/cli/service-auth/devices.d.ts +5 -2
- package/dist/cli-node/index.js +1197 -1008
- package/dist/config/schema/agent-names.d.ts +1 -0
- package/dist/index.js +194 -213
- package/dist/skills/browser/SKILL.md +100 -91
- package/dist/skills/browser/references/commands.md +92 -27
- package/dist/skills/browser/references/desktop.md +22 -0
- package/dist/skills/browser/references/install.md +18 -0
- package/dist/skills/browser/references/owned-engine/README.md +7 -2
- package/dist/skills/browser/references/owned-engine/frames-and-humans.md +9 -2
- package/dist/skills/browser/references/owned-engine/network.md +13 -7
- package/dist/skills/browser/references/recipes/1password.md +6 -2
- package/dist/skills/browser/runtime/omowright/index.js +15 -15
- package/dist/skills/browser/runtime/omowright/manifest.json +4 -4
- package/dist/skills/debugging/SKILL.md +1 -1
- package/dist/skills/debugging/references/tools/browser-qa.md +1 -1
- package/dist/skills/git/SKILL.md +62 -0
- package/dist/skills/git/agents/openai.yaml +13 -0
- package/dist/skills/github/SKILL.md +94 -0
- package/dist/skills/github/references/branch-rules.md +129 -0
- package/dist/skills/github/references/evidence-attachments.md +16 -0
- package/dist/skills/github/references/repo-setup.md +152 -0
- package/dist/skills/github/references/waiting.md +52 -0
- package/dist/skills/github/references/workflows.md +161 -0
- package/dist/skills/github/scripts/cli.ts +8 -0
- package/dist/skills/github/scripts/package.json +12 -0
- package/dist/skills/github/scripts/sdk.ts +11 -0
- package/dist/skills/github/scripts/src/account.ts +243 -0
- package/dist/skills/github/scripts/src/actions-write.ts +86 -0
- package/dist/skills/github/scripts/src/actions.ts +210 -0
- package/dist/skills/github/scripts/src/attestations.ts +136 -0
- package/dist/skills/github/scripts/src/blake2b.ts +102 -0
- package/dist/skills/github/scripts/src/branch-protection.ts +192 -0
- package/dist/skills/github/scripts/src/caches.ts +105 -0
- package/dist/skills/github/scripts/src/checks.ts +107 -0
- package/dist/skills/github/scripts/src/codespaces.ts +230 -0
- package/dist/skills/github/scripts/src/conversation-lock.ts +50 -0
- package/dist/skills/github/scripts/src/discussion-list.ts +126 -0
- package/dist/skills/github/scripts/src/discussion-lookup.ts +127 -0
- package/dist/skills/github/scripts/src/discussions.ts +234 -0
- package/dist/skills/github/scripts/src/env.ts +100 -0
- package/dist/skills/github/scripts/src/errors.ts +79 -0
- package/dist/skills/github/scripts/src/fields.ts +27 -0
- package/dist/skills/github/scripts/src/gist-shape.ts +58 -0
- package/dist/skills/github/scripts/src/gists-write.ts +130 -0
- package/dist/skills/github/scripts/src/gists.ts +118 -0
- package/dist/skills/github/scripts/src/git-auth.ts +46 -0
- package/dist/skills/github/scripts/src/http.ts +159 -0
- package/dist/skills/github/scripts/src/issue-develop.ts +118 -0
- package/dist/skills/github/scripts/src/issues-extra.ts +135 -0
- package/dist/skills/github/scripts/src/issues-write.ts +174 -0
- package/dist/skills/github/scripts/src/issues.ts +156 -0
- package/dist/skills/github/scripts/src/keys.ts +176 -0
- package/dist/skills/github/scripts/src/labels.ts +209 -0
- package/dist/skills/github/scripts/src/merge.ts +115 -0
- package/dist/skills/github/scripts/src/poly1305.ts +22 -0
- package/dist/skills/github/scripts/src/pr-checkout.ts +92 -0
- package/dist/skills/github/scripts/src/pr-view.ts +106 -0
- package/dist/skills/github/scripts/src/project-fields.ts +144 -0
- package/dist/skills/github/scripts/src/project-item-edit.ts +153 -0
- package/dist/skills/github/scripts/src/project-items.ts +191 -0
- package/dist/skills/github/scripts/src/project-links.ts +104 -0
- package/dist/skills/github/scripts/src/project-ref.ts +145 -0
- package/dist/skills/github/scripts/src/project-state.ts +99 -0
- package/dist/skills/github/scripts/src/projects.ts +158 -0
- package/dist/skills/github/scripts/src/pulls-extra.ts +165 -0
- package/dist/skills/github/scripts/src/pulls-read.ts +176 -0
- package/dist/skills/github/scripts/src/pulls-review.ts +206 -0
- package/dist/skills/github/scripts/src/pulls-write.ts +187 -0
- package/dist/skills/github/scripts/src/raw.ts +78 -0
- package/dist/skills/github/scripts/src/read.ts +77 -0
- package/dist/skills/github/scripts/src/release-assets.ts +111 -0
- package/dist/skills/github/scripts/src/release-download.ts +151 -0
- package/dist/skills/github/scripts/src/release-write.ts +197 -0
- package/dist/skills/github/scripts/src/repo-admin.ts +112 -0
- package/dist/skills/github/scripts/src/repo-content.ts +187 -0
- package/dist/skills/github/scripts/src/repo-create.ts +139 -0
- package/dist/skills/github/scripts/src/repo-extras.ts +217 -0
- package/dist/skills/github/scripts/src/repo-list.ts +143 -0
- package/dist/skills/github/scripts/src/repo-settings.ts +176 -0
- package/dist/skills/github/scripts/src/repo-sync.ts +81 -0
- package/dist/skills/github/scripts/src/repo-url.ts +104 -0
- package/dist/skills/github/scripts/src/repos.ts +87 -0
- package/dist/skills/github/scripts/src/ruleset-shape.ts +96 -0
- package/dist/skills/github/scripts/src/rulesets-write.ts +124 -0
- package/dist/skills/github/scripts/src/rulesets.ts +80 -0
- package/dist/skills/github/scripts/src/run-download.ts +88 -0
- package/dist/skills/github/scripts/src/salsa20.ts +97 -0
- package/dist/skills/github/scripts/src/scopes.ts +165 -0
- package/dist/skills/github/scripts/src/sealed-box.ts +75 -0
- package/dist/skills/github/scripts/src/search-commits.ts +114 -0
- package/dist/skills/github/scripts/src/search.ts +116 -0
- package/dist/skills/github/scripts/src/secrets.ts +131 -0
- package/dist/skills/github/scripts/src/snappy.ts +57 -0
- package/dist/skills/github/scripts/src/status-search.ts +55 -0
- package/dist/skills/github/scripts/src/transfer.ts +97 -0
- package/dist/skills/github/scripts/src/types.ts +75 -0
- package/dist/skills/github/scripts/src/variables.ts +86 -0
- package/dist/skills/github/scripts/src/wait.ts +164 -0
- package/dist/skills/github/scripts/src/wire.ts +159 -0
- package/dist/skills/github/scripts/src/workflows.ts +144 -0
- package/dist/skills/github/scripts/src/zip.ts +104 -0
- package/dist/skills/github/scripts/surface.ts +106 -0
- package/dist/skills/github/scripts/vendor/surface/SOURCE.json +15 -0
- package/dist/skills/github/scripts/vendor/surface/cli.ts +203 -0
- package/dist/skills/github/scripts/vendor/surface/flags.ts +195 -0
- package/dist/skills/github/scripts/vendor/surface/help.ts +89 -0
- package/dist/skills/github/scripts/vendor/surface/http.ts +180 -0
- package/dist/skills/github/scripts/vendor/surface/index.ts +44 -0
- package/dist/skills/github/scripts/vendor/surface/mcp.ts +241 -0
- package/dist/skills/github/scripts/vendor/surface/schema.ts +200 -0
- package/dist/skills/github/scripts/vendor/surface/stdio.ts +54 -0
- package/dist/skills/github/scripts/vendor/surface/surface.ts +250 -0
- package/dist/skills/github/scripts/vendor/surface/tools.ts +80 -0
- package/dist/skills/programming/SKILL.md +51 -320
- package/dist/skills/programming/references/go/README.md +1 -0
- package/dist/skills/programming/references/python/README.md +21 -3
- package/dist/skills/programming/references/python/error-handling.md +14 -0
- package/dist/skills/programming/references/rust/README.md +5 -1
- package/dist/skills/programming/references/typescript/README.md +9 -3
- package/dist/skills/programming/references/typescript/error-handling.md +18 -0
- package/dist/skills/ultimate-browsing/SKILL.md +1 -1
- package/dist/skills/ulw-execute/SKILL.md +1 -1
- package/dist/skills/visual-qa/references/browser-setup.md +5 -5
- package/dist/tui.js +32 -29
- package/package.json +28 -26
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +2 -2
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +8711 -172
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +8660 -121
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/src/posthog.ts +5 -0
- package/packages/omo-codex/plugin/components/telemetry/tsconfig.json +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +3 -3
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/package-lock.json +12 -12
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/shared/src/config-loader.ts +15 -1
- package/packages/omo-codex/plugin/skills/browser/SKILL.md +100 -91
- package/packages/omo-codex/plugin/skills/browser/references/commands.md +92 -27
- package/packages/omo-codex/plugin/skills/browser/references/desktop.md +22 -0
- package/packages/omo-codex/plugin/skills/browser/references/install.md +18 -0
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/README.md +7 -2
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/frames-and-humans.md +9 -2
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/network.md +13 -7
- package/packages/omo-codex/plugin/skills/browser/references/recipes/1password.md +6 -2
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/index.js +15 -15
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +4 -4
- package/packages/omo-codex/plugin/skills/debugging/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/debugging/references/tools/browser-qa.md +1 -1
- package/packages/omo-codex/plugin/skills/git/SKILL.md +62 -0
- package/packages/omo-codex/plugin/skills/git/agents/openai.yaml +13 -0
- package/packages/omo-codex/plugin/skills/github/SKILL.md +94 -0
- package/packages/omo-codex/plugin/skills/github/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/github/references/branch-rules.md +129 -0
- package/packages/omo-codex/plugin/skills/github/references/evidence-attachments.md +16 -0
- package/packages/omo-codex/plugin/skills/github/references/repo-setup.md +152 -0
- package/packages/omo-codex/plugin/skills/github/references/waiting.md +52 -0
- package/packages/omo-codex/plugin/skills/github/references/workflows.md +161 -0
- package/packages/omo-codex/plugin/skills/github/scripts/cli.ts +8 -0
- package/packages/omo-codex/plugin/skills/github/scripts/package.json +12 -0
- package/packages/omo-codex/plugin/skills/github/scripts/sdk.ts +11 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/account.ts +243 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/actions-write.ts +86 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/actions.ts +210 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/attestations.ts +136 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/blake2b.ts +102 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/branch-protection.ts +192 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/caches.ts +105 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/checks.ts +107 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/codespaces.ts +230 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/conversation-lock.ts +50 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/discussion-list.ts +126 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/discussion-lookup.ts +127 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/discussions.ts +234 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/env.ts +100 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/errors.ts +79 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/fields.ts +27 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/gist-shape.ts +58 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/gists-write.ts +130 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/gists.ts +118 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/git-auth.ts +46 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/http.ts +159 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/issue-develop.ts +118 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/issues-extra.ts +135 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/issues-write.ts +174 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/issues.ts +156 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/keys.ts +176 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/labels.ts +209 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/merge.ts +115 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/poly1305.ts +22 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/pr-checkout.ts +92 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/pr-view.ts +106 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/project-fields.ts +144 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/project-item-edit.ts +153 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/project-items.ts +191 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/project-links.ts +104 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/project-ref.ts +145 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/project-state.ts +99 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/projects.ts +158 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-extra.ts +165 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-read.ts +176 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-review.ts +206 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-write.ts +187 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/raw.ts +78 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/read.ts +77 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/release-assets.ts +111 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/release-download.ts +151 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/release-write.ts +197 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repo-admin.ts +112 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repo-content.ts +187 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repo-create.ts +139 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repo-extras.ts +217 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repo-list.ts +143 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repo-settings.ts +176 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repo-sync.ts +81 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repo-url.ts +104 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repos.ts +87 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/ruleset-shape.ts +96 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/rulesets-write.ts +124 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/rulesets.ts +80 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/run-download.ts +88 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/salsa20.ts +97 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/scopes.ts +165 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/sealed-box.ts +75 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/search-commits.ts +114 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/search.ts +116 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/secrets.ts +131 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/snappy.ts +57 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/status-search.ts +55 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/transfer.ts +97 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/types.ts +75 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/variables.ts +86 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/wait.ts +164 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/wire.ts +159 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/workflows.ts +144 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/zip.ts +104 -0
- package/packages/omo-codex/plugin/skills/github/scripts/surface.ts +106 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/SOURCE.json +15 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/cli.ts +203 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/flags.ts +195 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/help.ts +89 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/http.ts +180 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/index.ts +44 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/mcp.ts +241 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/schema.ts +200 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/stdio.ts +54 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/surface.ts +250 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/tools.ts +80 -0
- package/packages/omo-codex/plugin/skills/programming/SKILL.md +51 -320
- package/packages/omo-codex/plugin/skills/programming/references/go/README.md +1 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/README.md +21 -3
- package/packages/omo-codex/plugin/skills/programming/references/python/error-handling.md +14 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust/README.md +5 -1
- package/packages/omo-codex/plugin/skills/programming/references/typescript/README.md +9 -3
- package/packages/omo-codex/plugin/skills/programming/references/typescript/error-handling.md +18 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-execute/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +3 -3
- package/packages/omo-codex/plugin/skills/visual-qa/references/browser-setup.md +5 -5
- package/packages/omo-codex/plugin/test/sync-skills-codex-compatibility.test.mjs +1 -1
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +2 -1
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +5 -5
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +21279 -20738
- package/packages/shared-skills/skills/browser/SKILL.md +100 -91
- package/packages/shared-skills/skills/browser/references/commands.md +92 -27
- package/packages/shared-skills/skills/browser/references/desktop.md +22 -0
- package/packages/shared-skills/skills/browser/references/install.md +18 -0
- package/packages/shared-skills/skills/browser/references/owned-engine/README.md +7 -2
- package/packages/shared-skills/skills/browser/references/owned-engine/frames-and-humans.md +9 -2
- package/packages/shared-skills/skills/browser/references/owned-engine/network.md +13 -7
- package/packages/shared-skills/skills/browser/references/recipes/1password.md +6 -2
- package/packages/shared-skills/skills/browser/runtime/omowright/index.js +15 -15
- package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +4 -4
- package/packages/shared-skills/skills/debugging/SKILL.md +1 -1
- package/packages/shared-skills/skills/debugging/references/tools/browser-qa.md +1 -1
- package/packages/shared-skills/skills/git/SKILL.md +62 -0
- package/packages/shared-skills/skills/git/agents/openai.yaml +13 -0
- package/packages/shared-skills/skills/github/SKILL.md +94 -0
- package/packages/shared-skills/skills/github/references/branch-rules.md +129 -0
- package/packages/shared-skills/skills/github/references/evidence-attachments.md +16 -0
- package/packages/shared-skills/skills/github/references/repo-setup.md +152 -0
- package/packages/shared-skills/skills/github/references/waiting.md +52 -0
- package/packages/shared-skills/skills/github/references/workflows.md +161 -0
- package/packages/shared-skills/skills/github/scripts/cli.ts +8 -0
- package/packages/shared-skills/skills/github/scripts/package.json +12 -0
- package/packages/shared-skills/skills/github/scripts/sdk.ts +11 -0
- package/packages/shared-skills/skills/github/scripts/src/account.ts +243 -0
- package/packages/shared-skills/skills/github/scripts/src/actions-write.ts +86 -0
- package/packages/shared-skills/skills/github/scripts/src/actions.ts +210 -0
- package/packages/shared-skills/skills/github/scripts/src/attestations.ts +136 -0
- package/packages/shared-skills/skills/github/scripts/src/blake2b.ts +102 -0
- package/packages/shared-skills/skills/github/scripts/src/branch-protection.ts +192 -0
- package/packages/shared-skills/skills/github/scripts/src/caches.ts +105 -0
- package/packages/shared-skills/skills/github/scripts/src/checks.ts +107 -0
- package/packages/shared-skills/skills/github/scripts/src/codespaces.ts +230 -0
- package/packages/shared-skills/skills/github/scripts/src/conversation-lock.ts +50 -0
- package/packages/shared-skills/skills/github/scripts/src/discussion-list.ts +126 -0
- package/packages/shared-skills/skills/github/scripts/src/discussion-lookup.ts +127 -0
- package/packages/shared-skills/skills/github/scripts/src/discussions.ts +234 -0
- package/packages/shared-skills/skills/github/scripts/src/env.ts +100 -0
- package/packages/shared-skills/skills/github/scripts/src/errors.ts +79 -0
- package/packages/shared-skills/skills/github/scripts/src/fields.ts +27 -0
- package/packages/shared-skills/skills/github/scripts/src/gist-shape.ts +58 -0
- package/packages/shared-skills/skills/github/scripts/src/gists-write.ts +130 -0
- package/packages/shared-skills/skills/github/scripts/src/gists.ts +118 -0
- package/packages/shared-skills/skills/github/scripts/src/git-auth.ts +46 -0
- package/packages/shared-skills/skills/github/scripts/src/http.ts +159 -0
- package/packages/shared-skills/skills/github/scripts/src/issue-develop.ts +118 -0
- package/packages/shared-skills/skills/github/scripts/src/issues-extra.ts +135 -0
- package/packages/shared-skills/skills/github/scripts/src/issues-write.ts +174 -0
- package/packages/shared-skills/skills/github/scripts/src/issues.ts +156 -0
- package/packages/shared-skills/skills/github/scripts/src/keys.ts +176 -0
- package/packages/shared-skills/skills/github/scripts/src/labels.ts +209 -0
- package/packages/shared-skills/skills/github/scripts/src/merge.ts +115 -0
- package/packages/shared-skills/skills/github/scripts/src/poly1305.ts +22 -0
- package/packages/shared-skills/skills/github/scripts/src/pr-checkout.ts +92 -0
- package/packages/shared-skills/skills/github/scripts/src/pr-view.ts +106 -0
- package/packages/shared-skills/skills/github/scripts/src/project-fields.ts +144 -0
- package/packages/shared-skills/skills/github/scripts/src/project-item-edit.ts +153 -0
- package/packages/shared-skills/skills/github/scripts/src/project-items.ts +191 -0
- package/packages/shared-skills/skills/github/scripts/src/project-links.ts +104 -0
- package/packages/shared-skills/skills/github/scripts/src/project-ref.ts +145 -0
- package/packages/shared-skills/skills/github/scripts/src/project-state.ts +99 -0
- package/packages/shared-skills/skills/github/scripts/src/projects.ts +158 -0
- package/packages/shared-skills/skills/github/scripts/src/pulls-extra.ts +165 -0
- package/packages/shared-skills/skills/github/scripts/src/pulls-read.ts +176 -0
- package/packages/shared-skills/skills/github/scripts/src/pulls-review.ts +206 -0
- package/packages/shared-skills/skills/github/scripts/src/pulls-write.ts +187 -0
- package/packages/shared-skills/skills/github/scripts/src/raw.ts +78 -0
- package/packages/shared-skills/skills/github/scripts/src/read.ts +77 -0
- package/packages/shared-skills/skills/github/scripts/src/release-assets.ts +111 -0
- package/packages/shared-skills/skills/github/scripts/src/release-download.ts +151 -0
- package/packages/shared-skills/skills/github/scripts/src/release-write.ts +197 -0
- package/packages/shared-skills/skills/github/scripts/src/repo-admin.ts +112 -0
- package/packages/shared-skills/skills/github/scripts/src/repo-content.ts +187 -0
- package/packages/shared-skills/skills/github/scripts/src/repo-create.ts +139 -0
- package/packages/shared-skills/skills/github/scripts/src/repo-extras.ts +217 -0
- package/packages/shared-skills/skills/github/scripts/src/repo-list.ts +143 -0
- package/packages/shared-skills/skills/github/scripts/src/repo-settings.ts +176 -0
- package/packages/shared-skills/skills/github/scripts/src/repo-sync.ts +81 -0
- package/packages/shared-skills/skills/github/scripts/src/repo-url.ts +104 -0
- package/packages/shared-skills/skills/github/scripts/src/repos.ts +87 -0
- package/packages/shared-skills/skills/github/scripts/src/ruleset-shape.ts +96 -0
- package/packages/shared-skills/skills/github/scripts/src/rulesets-write.ts +124 -0
- package/packages/shared-skills/skills/github/scripts/src/rulesets.ts +80 -0
- package/packages/shared-skills/skills/github/scripts/src/run-download.ts +88 -0
- package/packages/shared-skills/skills/github/scripts/src/salsa20.ts +97 -0
- package/packages/shared-skills/skills/github/scripts/src/scopes.ts +165 -0
- package/packages/shared-skills/skills/github/scripts/src/sealed-box.ts +75 -0
- package/packages/shared-skills/skills/github/scripts/src/search-commits.ts +114 -0
- package/packages/shared-skills/skills/github/scripts/src/search.ts +116 -0
- package/packages/shared-skills/skills/github/scripts/src/secrets.ts +131 -0
- package/packages/shared-skills/skills/github/scripts/src/snappy.ts +57 -0
- package/packages/shared-skills/skills/github/scripts/src/status-search.ts +55 -0
- package/packages/shared-skills/skills/github/scripts/src/transfer.ts +97 -0
- package/packages/shared-skills/skills/github/scripts/src/types.ts +75 -0
- package/packages/shared-skills/skills/github/scripts/src/variables.ts +86 -0
- package/packages/shared-skills/skills/github/scripts/src/wait.ts +164 -0
- package/packages/shared-skills/skills/github/scripts/src/wire.ts +159 -0
- package/packages/shared-skills/skills/github/scripts/src/workflows.ts +144 -0
- package/packages/shared-skills/skills/github/scripts/src/zip.ts +104 -0
- package/packages/shared-skills/skills/github/scripts/surface.ts +106 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/SOURCE.json +15 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/cli.ts +203 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/flags.ts +195 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/help.ts +89 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/http.ts +180 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/index.ts +44 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/mcp.ts +241 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/schema.ts +200 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/stdio.ts +54 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/surface.ts +250 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/tools.ts +80 -0
- package/packages/shared-skills/skills/programming/SKILL.md +51 -320
- package/packages/shared-skills/skills/programming/references/go/README.md +1 -0
- package/packages/shared-skills/skills/programming/references/python/README.md +21 -3
- package/packages/shared-skills/skills/programming/references/python/error-handling.md +14 -0
- package/packages/shared-skills/skills/programming/references/rust/README.md +5 -1
- package/packages/shared-skills/skills/programming/references/typescript/README.md +9 -3
- package/packages/shared-skills/skills/programming/references/typescript/error-handling.md +18 -0
- package/packages/shared-skills/skills/ultimate-browsing/SKILL.md +1 -1
- package/packages/shared-skills/skills/ulw-execute/SKILL.md +1 -1
- package/packages/shared-skills/skills/visual-qa/references/browser-setup.md +5 -5
- package/dist/skills/git-master/SKILL.md +0 -114
- package/dist/skills/git-master/agents/openai.yaml +0 -13
- package/packages/omo-codex/plugin/skills/git-master/SKILL.md +0 -114
- package/packages/omo-codex/plugin/skills/git-master/agents/openai.yaml +0 -13
- package/packages/shared-skills/skills/git-master/SKILL.md +0 -114
- package/packages/shared-skills/skills/git-master/agents/openai.yaml +0 -13
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
// The MCP server for a surface, independent of transport. It is dual-era: a request carrying
|
|
2
|
+
// `_meta["io.modelcontextprotocol/protocolVersion"]` is served statelessly under the 2026-07-28
|
|
3
|
+
// revision (no handshake, `server/discover`), and an `initialize` request opens the legacy,
|
|
4
|
+
// handshake-based revisions (2025-11-25 and earlier) for the rest of that connection.
|
|
5
|
+
import {
|
|
6
|
+
describeError,
|
|
7
|
+
internalError,
|
|
8
|
+
redactFields,
|
|
9
|
+
redactValue,
|
|
10
|
+
type SurfaceDefinition,
|
|
11
|
+
type Ops,
|
|
12
|
+
} from "./surface.ts";
|
|
13
|
+
import { servedEntries, toolName, toolOf, type McpOptions } from "./tools.ts";
|
|
14
|
+
|
|
15
|
+
export { toolName, type McpOptions, type Tool } from "./tools.ts";
|
|
16
|
+
|
|
17
|
+
export const MODERN_VERSIONS = ["2026-07-28"] as const;
|
|
18
|
+
export const LEGACY_VERSIONS = [
|
|
19
|
+
"2025-11-25",
|
|
20
|
+
"2025-06-18",
|
|
21
|
+
"2025-03-26",
|
|
22
|
+
"2024-11-05",
|
|
23
|
+
] as const;
|
|
24
|
+
const META = "io.modelcontextprotocol/";
|
|
25
|
+
|
|
26
|
+
export const ERRORS = {
|
|
27
|
+
parse: -32700,
|
|
28
|
+
invalidRequest: -32600,
|
|
29
|
+
methodNotFound: -32601,
|
|
30
|
+
invalidParams: -32602,
|
|
31
|
+
internal: -32603,
|
|
32
|
+
headerMismatch: -32020,
|
|
33
|
+
unsupportedVersion: -32022,
|
|
34
|
+
} as const;
|
|
35
|
+
|
|
36
|
+
type Message = { readonly [key: string]: unknown };
|
|
37
|
+
export type Reply = { readonly jsonrpc: "2.0"; readonly id: unknown } & Message;
|
|
38
|
+
/** Per connection: stdio has one, each legacy HTTP request is its own. */
|
|
39
|
+
export type Connection = { legacy: string | undefined };
|
|
40
|
+
|
|
41
|
+
const isObject = (value: unknown): value is Message =>
|
|
42
|
+
typeof value === "object" && value !== null && !Array.isArray(value);
|
|
43
|
+
|
|
44
|
+
class Refusal {
|
|
45
|
+
readonly code: number;
|
|
46
|
+
readonly message: string;
|
|
47
|
+
constructor(code: number, message: string) {
|
|
48
|
+
this.code = code;
|
|
49
|
+
this.message = message;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const failure = (
|
|
54
|
+
id: unknown,
|
|
55
|
+
code: number,
|
|
56
|
+
message: string,
|
|
57
|
+
data?: unknown,
|
|
58
|
+
): Reply => ({
|
|
59
|
+
jsonrpc: "2.0",
|
|
60
|
+
id: id ?? null,
|
|
61
|
+
error: { code, message, ...(data === undefined ? {} : { data }) },
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export const mcpHandler = <O extends Ops>(
|
|
65
|
+
surface: SurfaceDefinition<O>,
|
|
66
|
+
options: McpOptions = {},
|
|
67
|
+
) => {
|
|
68
|
+
const served = servedEntries(surface, options);
|
|
69
|
+
const byName = new Map(served.map((entry) => [toolName(entry.path), entry]));
|
|
70
|
+
const tools = served.map(toolOf);
|
|
71
|
+
const serverInfo = { name: surface.name, version: surface.version };
|
|
72
|
+
const instructions =
|
|
73
|
+
surface.instructions === undefined
|
|
74
|
+
? {}
|
|
75
|
+
: { instructions: surface.instructions };
|
|
76
|
+
|
|
77
|
+
const call = async (params: Message): Promise<Message | Refusal> => {
|
|
78
|
+
const name = params["name"];
|
|
79
|
+
const entry = typeof name === "string" ? byName.get(name) : undefined;
|
|
80
|
+
if (entry === undefined)
|
|
81
|
+
return new Refusal(ERRORS.invalidParams, `Unknown tool: ${String(name)}`);
|
|
82
|
+
try {
|
|
83
|
+
// Redacted before it is serialized, so the text and the structured copy carry the same value.
|
|
84
|
+
const value = await redactValue(
|
|
85
|
+
surface.redact,
|
|
86
|
+
await entry.op.invoke(params["arguments"] ?? {}),
|
|
87
|
+
);
|
|
88
|
+
const text =
|
|
89
|
+
value === undefined ? "null" : JSON.stringify(value, null, 2);
|
|
90
|
+
return {
|
|
91
|
+
content: [{ type: "text", text }],
|
|
92
|
+
...(isObject(value) ? { structuredContent: value } : {}),
|
|
93
|
+
isError: false,
|
|
94
|
+
};
|
|
95
|
+
} catch (error) {
|
|
96
|
+
// Any thrown value is wrapped, never rethrown, so its text still reaches the redactor; the
|
|
97
|
+
// instanceof check itself is guarded, because it throws for a revoked or trapped Proxy.
|
|
98
|
+
let reported: Error;
|
|
99
|
+
try {
|
|
100
|
+
reported = error instanceof Error ? error : internalError(error);
|
|
101
|
+
} catch {
|
|
102
|
+
reported = internalError(error);
|
|
103
|
+
}
|
|
104
|
+
const { kind, message, hint } = describeError(reported);
|
|
105
|
+
const said = `${kind}: ${message}${hint === undefined ? "" : `\nhint: ${hint}`}`;
|
|
106
|
+
return { content: [{ type: "text", text: said }], isError: true };
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const serve = async (
|
|
111
|
+
method: string,
|
|
112
|
+
params: Message,
|
|
113
|
+
modern: boolean,
|
|
114
|
+
): Promise<Message | Refusal> => {
|
|
115
|
+
switch (method) {
|
|
116
|
+
case "ping":
|
|
117
|
+
return {};
|
|
118
|
+
case "tools/list":
|
|
119
|
+
return modern
|
|
120
|
+
? { tools, ttlMs: 300_000, cacheScope: "public" }
|
|
121
|
+
: { tools };
|
|
122
|
+
case "tools/call":
|
|
123
|
+
return call(params);
|
|
124
|
+
default:
|
|
125
|
+
return new Refusal(
|
|
126
|
+
ERRORS.methodNotFound,
|
|
127
|
+
`Method not found: ${method}`,
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const respond = (
|
|
133
|
+
id: unknown,
|
|
134
|
+
result: Message | Refusal,
|
|
135
|
+
modern: boolean,
|
|
136
|
+
): Reply => {
|
|
137
|
+
if (result instanceof Refusal)
|
|
138
|
+
return failure(id, result.code, result.message);
|
|
139
|
+
if (!modern) return { jsonrpc: "2.0", id, result };
|
|
140
|
+
return {
|
|
141
|
+
jsonrpc: "2.0",
|
|
142
|
+
id,
|
|
143
|
+
result: {
|
|
144
|
+
resultType: "complete",
|
|
145
|
+
...result,
|
|
146
|
+
_meta: { [`${META}serverInfo`]: serverInfo },
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const answer = async (
|
|
152
|
+
message: unknown,
|
|
153
|
+
connection: Connection,
|
|
154
|
+
): Promise<Reply | undefined> => {
|
|
155
|
+
if (!isObject(message) || message["jsonrpc"] !== "2.0") {
|
|
156
|
+
return failure(
|
|
157
|
+
isObject(message) ? message["id"] : null,
|
|
158
|
+
ERRORS.invalidRequest,
|
|
159
|
+
"Invalid Request",
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
const { id, method } = message;
|
|
163
|
+
const params = isObject(message["params"]) ? message["params"] : {};
|
|
164
|
+
if (typeof method !== "string") return undefined;
|
|
165
|
+
if (!("id" in message)) return undefined;
|
|
166
|
+
if (method === "initialize") {
|
|
167
|
+
const asked = params["protocolVersion"];
|
|
168
|
+
const version =
|
|
169
|
+
LEGACY_VERSIONS.find((each) => each === asked) ?? LEGACY_VERSIONS[0];
|
|
170
|
+
connection.legacy = version;
|
|
171
|
+
return respond(
|
|
172
|
+
id,
|
|
173
|
+
{
|
|
174
|
+
protocolVersion: version,
|
|
175
|
+
capabilities: { tools: { listChanged: false } },
|
|
176
|
+
serverInfo,
|
|
177
|
+
...instructions,
|
|
178
|
+
},
|
|
179
|
+
false,
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
const meta = isObject(params["_meta"]) ? params["_meta"] : {};
|
|
183
|
+
const version = meta[`${META}protocolVersion`];
|
|
184
|
+
if (version === undefined && connection.legacy !== undefined)
|
|
185
|
+
return respond(id, await serve(method, params, false), false);
|
|
186
|
+
if (
|
|
187
|
+
typeof version !== "string" ||
|
|
188
|
+
!isObject(meta[`${META}clientCapabilities`])
|
|
189
|
+
) {
|
|
190
|
+
return failure(
|
|
191
|
+
id,
|
|
192
|
+
ERRORS.invalidParams,
|
|
193
|
+
`Invalid params: _meta must carry ${META}protocolVersion and ${META}clientCapabilities (or send initialize first; supported: ${[...MODERN_VERSIONS, ...LEGACY_VERSIONS].join(", ")})`,
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
if (!MODERN_VERSIONS.some((each) => each === version)) {
|
|
197
|
+
return failure(
|
|
198
|
+
id,
|
|
199
|
+
ERRORS.unsupportedVersion,
|
|
200
|
+
"Unsupported protocol version",
|
|
201
|
+
{ supported: [...MODERN_VERSIONS], requested: version },
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
if (method === "server/discover") {
|
|
205
|
+
return respond(
|
|
206
|
+
id,
|
|
207
|
+
{
|
|
208
|
+
supportedVersions: [...MODERN_VERSIONS],
|
|
209
|
+
capabilities: { tools: {} },
|
|
210
|
+
...instructions,
|
|
211
|
+
ttlMs: 300_000,
|
|
212
|
+
cacheScope: "public",
|
|
213
|
+
},
|
|
214
|
+
true,
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
return respond(id, await serve(method, params, true), true);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/** A reply with the surface's redactor applied; a transport uses it for the replies it builds itself. */
|
|
221
|
+
const redact = async (reply: Reply): Promise<Reply> => {
|
|
222
|
+
const cleaned = await redactFields(surface.redact, reply);
|
|
223
|
+
return { ...cleaned, jsonrpc: "2.0", id: cleaned["id"] };
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* One JSON-RPC message in; the reply out, or undefined for a notification or a response. Every
|
|
228
|
+
* reply passes the surface's redactor here, protocol errors that echo the caller's input included.
|
|
229
|
+
*/
|
|
230
|
+
const handle = async (
|
|
231
|
+
message: unknown,
|
|
232
|
+
connection: Connection,
|
|
233
|
+
): Promise<Reply | undefined> => {
|
|
234
|
+
const reply = await answer(message, connection);
|
|
235
|
+
return reply === undefined ? undefined : redact(reply);
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
return { tools, handle, redact };
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
export type McpHandler = ReturnType<typeof mcpHandler>;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// A small JSON Schema builder. Each builder returns the JSON Schema itself (what MCP tools/list
|
|
2
|
+
// and the CLI's --help show) plus a TypeScript type for it, so one definition types the SDK,
|
|
3
|
+
// validates CLI and MCP input, and documents every surface. `s.json<T>(schema)` wraps a schema
|
|
4
|
+
// written elsewhere (an OpenRPC document, say) under a type you name.
|
|
5
|
+
|
|
6
|
+
export type JsonSchema = { readonly [keyword: string]: unknown };
|
|
7
|
+
|
|
8
|
+
declare const carried: unique symbol;
|
|
9
|
+
|
|
10
|
+
/** A JSON Schema that carries the TypeScript type `T` of the values it accepts. */
|
|
11
|
+
export type Schema<T, Optional extends boolean = false> = {
|
|
12
|
+
readonly json: JsonSchema;
|
|
13
|
+
readonly optional: Optional;
|
|
14
|
+
readonly [carried]?: () => T;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type Infer<S> = S extends Schema<infer T, boolean> ? T : never;
|
|
18
|
+
|
|
19
|
+
export type Shape = { readonly [property: string]: Schema<unknown, boolean> };
|
|
20
|
+
|
|
21
|
+
type OptionalKeys<P extends Shape> = {
|
|
22
|
+
[K in keyof P]: P[K] extends Schema<unknown, true> ? K : never;
|
|
23
|
+
}[keyof P];
|
|
24
|
+
type Simplify<T> = { [K in keyof T]: T[K] } & {};
|
|
25
|
+
|
|
26
|
+
export type ObjectOf<P extends Shape> = Simplify<
|
|
27
|
+
{ readonly [K in Exclude<keyof P, OptionalKeys<P>>]: Infer<P[K]> } & {
|
|
28
|
+
readonly [K in OptionalKeys<P>]?: Infer<P[K]> | undefined;
|
|
29
|
+
}
|
|
30
|
+
>;
|
|
31
|
+
|
|
32
|
+
export type Doc = {
|
|
33
|
+
readonly description?: string;
|
|
34
|
+
readonly title?: string;
|
|
35
|
+
/** A secret value: emitted as `writeOnly`, and the CLI takes it only through `--input`, never as an argument. */
|
|
36
|
+
readonly secret?: boolean;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const described = (doc: Doc = {}): JsonSchema => ({
|
|
40
|
+
...(doc.title === undefined ? {} : { title: doc.title }),
|
|
41
|
+
...(doc.description === undefined ? {} : { description: doc.description }),
|
|
42
|
+
...(doc.secret === true ? { writeOnly: true } : {}),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const make = <T>(json: JsonSchema): Schema<T> => ({ json, optional: false });
|
|
46
|
+
|
|
47
|
+
export const s = {
|
|
48
|
+
string: (doc?: Doc): Schema<string> =>
|
|
49
|
+
make({ type: "string", ...described(doc) }),
|
|
50
|
+
number: (doc?: Doc): Schema<number> =>
|
|
51
|
+
make({ type: "number", ...described(doc) }),
|
|
52
|
+
integer: (doc?: Doc): Schema<number> =>
|
|
53
|
+
make({ type: "integer", ...described(doc) }),
|
|
54
|
+
boolean: (doc?: Doc): Schema<boolean> =>
|
|
55
|
+
make({ type: "boolean", ...described(doc) }),
|
|
56
|
+
unknown: (doc?: Doc): Schema<unknown> => make(described(doc)),
|
|
57
|
+
enum: <const V extends readonly [string, ...string[]]>(
|
|
58
|
+
values: V,
|
|
59
|
+
doc?: Doc,
|
|
60
|
+
): Schema<V[number]> =>
|
|
61
|
+
make({ type: "string", enum: values, ...described(doc) }),
|
|
62
|
+
array: <T>(items: Schema<T, boolean>, doc?: Doc): Schema<readonly T[]> =>
|
|
63
|
+
make({ type: "array", items: items.json, ...described(doc) }),
|
|
64
|
+
record: <T>(
|
|
65
|
+
values: Schema<T, boolean>,
|
|
66
|
+
doc?: Doc,
|
|
67
|
+
): Schema<Readonly<Record<string, T>>> =>
|
|
68
|
+
make({
|
|
69
|
+
type: "object",
|
|
70
|
+
additionalProperties: values.json,
|
|
71
|
+
...described(doc),
|
|
72
|
+
}),
|
|
73
|
+
object: <const P extends Shape>(
|
|
74
|
+
properties: P,
|
|
75
|
+
doc?: Doc,
|
|
76
|
+
): Schema<ObjectOf<P>> => {
|
|
77
|
+
const entries = Object.entries(properties);
|
|
78
|
+
return make({
|
|
79
|
+
type: "object",
|
|
80
|
+
properties: Object.fromEntries(
|
|
81
|
+
entries.map(([name, value]) => [name, value.json]),
|
|
82
|
+
),
|
|
83
|
+
required: entries
|
|
84
|
+
.filter(([, value]) => !value.optional)
|
|
85
|
+
.map(([name]) => name),
|
|
86
|
+
additionalProperties: false,
|
|
87
|
+
...described(doc),
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
optional: <T>(inner: Schema<T, boolean>): Schema<T, true> => ({
|
|
91
|
+
json: inner.json,
|
|
92
|
+
optional: true,
|
|
93
|
+
}),
|
|
94
|
+
/** A schema written elsewhere, typed as `T`. Validation covers the keywords `problems` reads. */
|
|
95
|
+
json: <T>(json: JsonSchema): Schema<T> => make(json),
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const isObject = (
|
|
99
|
+
value: unknown,
|
|
100
|
+
): value is { readonly [key: string]: unknown } =>
|
|
101
|
+
typeof value === "object" && value !== null && !Array.isArray(value);
|
|
102
|
+
|
|
103
|
+
const typeOf = (value: unknown): string => {
|
|
104
|
+
if (value === null) return "null";
|
|
105
|
+
if (Array.isArray(value)) return "array";
|
|
106
|
+
if (typeof value === "number")
|
|
107
|
+
return Number.isInteger(value) ? "integer" : "number";
|
|
108
|
+
return typeof value;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const fits = (kind: unknown, value: unknown): boolean => {
|
|
112
|
+
const actual = typeOf(value);
|
|
113
|
+
return kind === actual || (kind === "number" && actual === "integer");
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const listOf = (value: unknown): readonly unknown[] =>
|
|
117
|
+
Array.isArray(value) ? value : [];
|
|
118
|
+
|
|
119
|
+
const resolve = (schema: JsonSchema, root: JsonSchema): JsonSchema => {
|
|
120
|
+
const ref = schema["$ref"];
|
|
121
|
+
if (typeof ref !== "string" || !ref.startsWith("#/")) return schema;
|
|
122
|
+
let at: unknown = root;
|
|
123
|
+
for (const part of ref.slice(2).split("/"))
|
|
124
|
+
at = isObject(at) ? at[part] : undefined;
|
|
125
|
+
return isObject(at) ? resolve(at, root) : {};
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const walk = (
|
|
129
|
+
schema: JsonSchema,
|
|
130
|
+
value: unknown,
|
|
131
|
+
path: string,
|
|
132
|
+
root: JsonSchema,
|
|
133
|
+
): string[] => {
|
|
134
|
+
const here = resolve(schema, root);
|
|
135
|
+
const kind = here["type"];
|
|
136
|
+
if (kind !== undefined) {
|
|
137
|
+
const kinds = Array.isArray(kind) ? kind : [kind];
|
|
138
|
+
if (!kinds.some((each) => fits(each, value))) {
|
|
139
|
+
return [`${path}: expected ${kinds.join(" or ")}, got ${typeOf(value)}`];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (Array.isArray(here["enum"]) && !here["enum"].includes(value)) {
|
|
143
|
+
return [
|
|
144
|
+
`${path}: expected one of ${here["enum"].map((v) => JSON.stringify(v)).join(", ")}`,
|
|
145
|
+
];
|
|
146
|
+
}
|
|
147
|
+
if ("const" in here && here["const"] !== value) {
|
|
148
|
+
return [`${path}: expected ${JSON.stringify(here["const"])}`];
|
|
149
|
+
}
|
|
150
|
+
const anyOf = [...listOf(here["anyOf"]), ...listOf(here["oneOf"])].filter(
|
|
151
|
+
isObject,
|
|
152
|
+
);
|
|
153
|
+
if (
|
|
154
|
+
anyOf.length > 0 &&
|
|
155
|
+
anyOf.every((each) => walk(each, value, path, root).length > 0)
|
|
156
|
+
) {
|
|
157
|
+
return [`${path}: matches none of the allowed shapes`];
|
|
158
|
+
}
|
|
159
|
+
const all = listOf(here["allOf"])
|
|
160
|
+
.filter(isObject)
|
|
161
|
+
.flatMap((each) => walk(each, value, path, root));
|
|
162
|
+
if (Array.isArray(value) && isObject(here["items"])) {
|
|
163
|
+
const items = here["items"];
|
|
164
|
+
return [
|
|
165
|
+
...all,
|
|
166
|
+
...value.flatMap((item, at) => walk(items, item, `${path}[${at}]`, root)),
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
if (!isObject(value)) return all;
|
|
170
|
+
const properties = isObject(here["properties"]) ? here["properties"] : {};
|
|
171
|
+
const missing = listOf(here["required"])
|
|
172
|
+
.filter(
|
|
173
|
+
(name): name is string =>
|
|
174
|
+
typeof name === "string" && value[name] === undefined,
|
|
175
|
+
)
|
|
176
|
+
.map((name) => `${path}.${name}: required`);
|
|
177
|
+
const extra = here["additionalProperties"];
|
|
178
|
+
const fields = Object.entries(value).flatMap(([name, field]) => {
|
|
179
|
+
const declared = properties[name];
|
|
180
|
+
if (isObject(declared))
|
|
181
|
+
return field === undefined
|
|
182
|
+
? []
|
|
183
|
+
: walk(declared, field, `${path}.${name}`, root);
|
|
184
|
+
if (extra === false) return [`${path}.${name}: not a known field`];
|
|
185
|
+
return isObject(extra) ? walk(extra, field, `${path}.${name}`, root) : [];
|
|
186
|
+
});
|
|
187
|
+
return [...all, ...missing, ...fields];
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
/** What is wrong with `value` against `schema`; empty when it fits. `$ref`s resolve in `root`. */
|
|
191
|
+
export const problems = (
|
|
192
|
+
schema: JsonSchema,
|
|
193
|
+
value: unknown,
|
|
194
|
+
root: JsonSchema = schema,
|
|
195
|
+
): string[] => walk(schema, value, "input", root);
|
|
196
|
+
|
|
197
|
+
export const conforms = <T>(
|
|
198
|
+
schema: Schema<T, boolean>,
|
|
199
|
+
value: unknown,
|
|
200
|
+
): value is T => problems(schema.json, value).length === 0;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// The stdio binding: one JSON-RPC message per line in, one per line out. Requests run
|
|
2
|
+
// concurrently and answer in the order they finish; the server ends when its input ends and
|
|
3
|
+
// every request in flight has answered. Nothing but MCP messages goes to `write`.
|
|
4
|
+
import { ERRORS, type Connection, type McpHandler } from "./mcp.ts";
|
|
5
|
+
|
|
6
|
+
export type StdioStreams = {
|
|
7
|
+
readonly input: ReadableStream<Uint8Array>;
|
|
8
|
+
readonly write: (line: string) => void;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const serveStdio = async (
|
|
12
|
+
handler: McpHandler,
|
|
13
|
+
streams: StdioStreams,
|
|
14
|
+
): Promise<void> => {
|
|
15
|
+
const connection: Connection = { legacy: undefined };
|
|
16
|
+
const inFlight = new Set<Promise<void>>();
|
|
17
|
+
const answer = async (line: string): Promise<void> => {
|
|
18
|
+
let message: unknown;
|
|
19
|
+
try {
|
|
20
|
+
message = JSON.parse(line);
|
|
21
|
+
} catch {
|
|
22
|
+
streams.write(
|
|
23
|
+
JSON.stringify({
|
|
24
|
+
jsonrpc: "2.0",
|
|
25
|
+
id: null,
|
|
26
|
+
error: { code: ERRORS.parse, message: "Parse error" },
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const reply = await handler.handle(message, connection);
|
|
32
|
+
if (reply !== undefined) streams.write(JSON.stringify(reply));
|
|
33
|
+
};
|
|
34
|
+
const decoder = new TextDecoder();
|
|
35
|
+
let pending = "";
|
|
36
|
+
const take = (text: string): void => {
|
|
37
|
+
pending += text;
|
|
38
|
+
let end = pending.indexOf("\n");
|
|
39
|
+
while (end >= 0) {
|
|
40
|
+
const line = pending.slice(0, end).trim();
|
|
41
|
+
pending = pending.slice(end + 1);
|
|
42
|
+
if (line !== "") {
|
|
43
|
+
const work = answer(line);
|
|
44
|
+
inFlight.add(work);
|
|
45
|
+
void work.finally(() => inFlight.delete(work));
|
|
46
|
+
}
|
|
47
|
+
end = pending.indexOf("\n");
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
for await (const chunk of streams.input)
|
|
51
|
+
take(decoder.decode(chunk, { stream: true }));
|
|
52
|
+
take(`${decoder.decode()}\n`);
|
|
53
|
+
await Promise.all(inFlight);
|
|
54
|
+
};
|