@hcu-lab.me/mcp-device 1.0.9 → 1.0.12
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/PRIVACY.md +21 -0
- package/README.md +58 -3
- package/SECURITY.md +67 -0
- package/config/revoked-approvals.json +1 -0
- package/control-plane/config/mcp-servers.example.toml +52 -0
- package/control-plane/config/mcp-servers.toml +52 -0
- package/control-plane/contracts/device-public-contract-v1.json +733 -0
- package/control-plane/scripts/GATEWAY-LICENSE.txt +7 -0
- package/control-plane/scripts/account-http.mjs +220 -0
- package/control-plane/scripts/account-store.mjs +368 -0
- package/control-plane/scripts/admin.mjs +68 -0
- package/control-plane/scripts/auth-session.mjs +411 -0
- package/control-plane/scripts/authenticated-mcp-wrapper.mjs +1281 -0
- package/control-plane/scripts/benchmark-command.mjs +9 -0
- package/control-plane/scripts/benchmark-mcp-catalog.mjs +174 -0
- package/control-plane/scripts/catalog-budget.mjs +87 -0
- package/control-plane/scripts/check-device-public-contract.mjs +20 -0
- package/control-plane/scripts/custom-tools/index.mjs +221 -0
- package/control-plane/scripts/custom-tools/path-utils.mjs +117 -0
- package/control-plane/scripts/custom-tools/response-utils.mjs +34 -0
- package/control-plane/scripts/dashboard-http.mjs +598 -0
- package/control-plane/scripts/device-access-policy.mjs +205 -0
- package/control-plane/scripts/device-admin.mjs +43 -0
- package/control-plane/scripts/device-audit.mjs +63 -0
- package/control-plane/scripts/device-broker.mjs +1461 -0
- package/control-plane/scripts/device-execution-tool-definitions.mjs +217 -0
- package/control-plane/scripts/device-inventory.mjs +128 -0
- package/control-plane/scripts/device-pairing-http.mjs +109 -0
- package/control-plane/scripts/device-pairing-store.mjs +245 -0
- package/control-plane/scripts/device-public-contract.mjs +165 -0
- package/control-plane/scripts/device-release.mjs +95 -0
- package/control-plane/scripts/device-secure-transport.mjs +128 -0
- package/control-plane/scripts/device-store.mjs +283 -0
- package/control-plane/scripts/device-usage.mjs +657 -0
- package/control-plane/scripts/embedded-device.mjs +149 -0
- package/control-plane/scripts/enduser-ui.mjs +45 -0
- package/control-plane/scripts/external-tool-broker.mjs +179 -0
- package/control-plane/scripts/oauth-authorization-server.mjs +589 -0
- package/control-plane/scripts/operator-dashboard-http.mjs +81 -0
- package/control-plane/scripts/project-inspection.mjs +227 -0
- package/control-plane/scripts/projects/project-id.mjs +69 -0
- package/control-plane/scripts/projects/trusted-roots-projects.mjs +375 -0
- package/control-plane/scripts/prompts/index.mjs +60 -0
- package/control-plane/scripts/remote-process-sessions.mjs +78 -0
- package/control-plane/scripts/remote-tool-result.mjs +9 -0
- package/control-plane/scripts/resources/index.mjs +166 -0
- package/control-plane/scripts/runtime-profile.mjs +54 -0
- package/control-plane/scripts/shell-tool-descriptor.mjs +17 -0
- package/control-plane/scripts/skill-source-safety.mjs +46 -0
- package/control-plane/scripts/skills/README.md +70 -0
- package/control-plane/scripts/skills/_upstream_licenses/anthropic-THIRD_PARTY_NOTICES.md +405 -0
- package/control-plane/scripts/skills/_upstream_licenses/hallmark-LICENSE.txt +21 -0
- package/control-plane/scripts/skills/_upstream_licenses/ponytail-LICENSE.txt +21 -0
- package/control-plane/scripts/skills/_upstream_licenses/stitch-skills-LICENSE.txt +201 -0
- package/control-plane/scripts/skills/_upstream_licenses/superpowers-LICENSE.txt +21 -0
- package/control-plane/scripts/skills/algorithmic-art/LICENSE.txt +202 -0
- package/control-plane/scripts/skills/algorithmic-art/SKILL.md +405 -0
- package/control-plane/scripts/skills/algorithmic-art/templates/generator_template.js +223 -0
- package/control-plane/scripts/skills/algorithmic-art/templates/viewer.html +599 -0
- package/control-plane/scripts/skills/brainstorming/SKILL.md +285 -0
- package/control-plane/scripts/skills/brainstorming/scripts/frame-template.html +213 -0
- package/control-plane/scripts/skills/brainstorming/scripts/helper.js +167 -0
- package/control-plane/scripts/skills/brainstorming/scripts/server.cjs +723 -0
- package/control-plane/scripts/skills/brainstorming/scripts/start-server.sh +209 -0
- package/control-plane/scripts/skills/brainstorming/scripts/stop-server.sh +120 -0
- package/control-plane/scripts/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/control-plane/scripts/skills/brainstorming/visual-companion.md +299 -0
- package/control-plane/scripts/skills/brand-guidelines/LICENSE.txt +202 -0
- package/control-plane/scripts/skills/brand-guidelines/SKILL.md +73 -0
- package/control-plane/scripts/skills/claude-api/LICENSE.txt +202 -0
- package/control-plane/scripts/skills/claude-api/SKILL.md +570 -0
- package/control-plane/scripts/skills/claude-api/csharp/claude-api/README.md +362 -0
- package/control-plane/scripts/skills/claude-api/csharp/claude-api/batches.md +14 -0
- package/control-plane/scripts/skills/claude-api/csharp/claude-api/files-api.md +25 -0
- package/control-plane/scripts/skills/claude-api/csharp/claude-api/streaming.md +28 -0
- package/control-plane/scripts/skills/claude-api/csharp/claude-api/tool-use.md +164 -0
- package/control-plane/scripts/skills/claude-api/curl/examples.md +256 -0
- package/control-plane/scripts/skills/claude-api/curl/managed-agents.md +371 -0
- package/control-plane/scripts/skills/claude-api/go/claude-api/README.md +188 -0
- package/control-plane/scripts/skills/claude-api/go/claude-api/files-api.md +23 -0
- package/control-plane/scripts/skills/claude-api/go/claude-api/streaming.md +43 -0
- package/control-plane/scripts/skills/claude-api/go/claude-api/tool-use.md +220 -0
- package/control-plane/scripts/skills/claude-api/go/managed-agents/README.md +564 -0
- package/control-plane/scripts/skills/claude-api/java/claude-api/README.md +238 -0
- package/control-plane/scripts/skills/claude-api/java/claude-api/files-api.md +27 -0
- package/control-plane/scripts/skills/claude-api/java/claude-api/streaming.md +24 -0
- package/control-plane/scripts/skills/claude-api/java/claude-api/tool-use.md +228 -0
- package/control-plane/scripts/skills/claude-api/java/managed-agents/README.md +443 -0
- package/control-plane/scripts/skills/claude-api/php/claude-api/README.md +174 -0
- package/control-plane/scripts/skills/claude-api/php/claude-api/batches.md +15 -0
- package/control-plane/scripts/skills/claude-api/php/claude-api/files-api.md +13 -0
- package/control-plane/scripts/skills/claude-api/php/claude-api/streaming.md +27 -0
- package/control-plane/scripts/skills/claude-api/php/claude-api/tool-use.md +253 -0
- package/control-plane/scripts/skills/claude-api/php/managed-agents/README.md +443 -0
- package/control-plane/scripts/skills/claude-api/python/claude-api/README.md +565 -0
- package/control-plane/scripts/skills/claude-api/python/claude-api/batches.md +198 -0
- package/control-plane/scripts/skills/claude-api/python/claude-api/files-api.md +170 -0
- package/control-plane/scripts/skills/claude-api/python/claude-api/sdk-upgrade.md +286 -0
- package/control-plane/scripts/skills/claude-api/python/claude-api/streaming.md +179 -0
- package/control-plane/scripts/skills/claude-api/python/claude-api/tool-use.md +627 -0
- package/control-plane/scripts/skills/claude-api/python/managed-agents/README.md +335 -0
- package/control-plane/scripts/skills/claude-api/ruby/claude-api/README.md +134 -0
- package/control-plane/scripts/skills/claude-api/ruby/claude-api/streaming.md +16 -0
- package/control-plane/scripts/skills/claude-api/ruby/claude-api/tool-use.md +41 -0
- package/control-plane/scripts/skills/claude-api/ruby/managed-agents/README.md +394 -0
- package/control-plane/scripts/skills/claude-api/shared/admin-api.md +179 -0
- package/control-plane/scripts/skills/claude-api/shared/agent-design.md +101 -0
- package/control-plane/scripts/skills/claude-api/shared/anthropic-cli.md +269 -0
- package/control-plane/scripts/skills/claude-api/shared/claude-platform-on-aws.md +59 -0
- package/control-plane/scripts/skills/claude-api/shared/cost-optimization.md +233 -0
- package/control-plane/scripts/skills/claude-api/shared/error-codes.md +262 -0
- package/control-plane/scripts/skills/claude-api/shared/live-sources.md +166 -0
- package/control-plane/scripts/skills/claude-api/shared/managed-agents-api-reference.md +455 -0
- package/control-plane/scripts/skills/claude-api/shared/managed-agents-client-patterns.md +220 -0
- package/control-plane/scripts/skills/claude-api/shared/managed-agents-core.md +359 -0
- package/control-plane/scripts/skills/claude-api/shared/managed-agents-environments.md +226 -0
- package/control-plane/scripts/skills/claude-api/shared/managed-agents-events.md +290 -0
- package/control-plane/scripts/skills/claude-api/shared/managed-agents-memory.md +201 -0
- package/control-plane/scripts/skills/claude-api/shared/managed-agents-multiagent.md +260 -0
- package/control-plane/scripts/skills/claude-api/shared/managed-agents-onboarding.md +82 -0
- package/control-plane/scripts/skills/claude-api/shared/managed-agents-outcomes.md +108 -0
- package/control-plane/scripts/skills/claude-api/shared/managed-agents-overview.md +77 -0
- package/control-plane/scripts/skills/claude-api/shared/managed-agents-scheduled-deployments.md +156 -0
- package/control-plane/scripts/skills/claude-api/shared/managed-agents-self-hosted-sandboxes.md +282 -0
- package/control-plane/scripts/skills/claude-api/shared/managed-agents-tools.md +504 -0
- package/control-plane/scripts/skills/claude-api/shared/managed-agents-webhooks.md +143 -0
- package/control-plane/scripts/skills/claude-api/shared/model-migration.md +1872 -0
- package/control-plane/scripts/skills/claude-api/shared/models.md +142 -0
- package/control-plane/scripts/skills/claude-api/shared/platform-availability.md +52 -0
- package/control-plane/scripts/skills/claude-api/shared/prompt-audit.md +223 -0
- package/control-plane/scripts/skills/claude-api/shared/prompt-caching.md +292 -0
- package/control-plane/scripts/skills/claude-api/shared/token-counting.md +56 -0
- package/control-plane/scripts/skills/claude-api/shared/tool-use-concepts.md +526 -0
- package/control-plane/scripts/skills/claude-api/typescript/claude-api/README.md +405 -0
- package/control-plane/scripts/skills/claude-api/typescript/claude-api/batches.md +106 -0
- package/control-plane/scripts/skills/claude-api/typescript/claude-api/files-api.md +98 -0
- package/control-plane/scripts/skills/claude-api/typescript/claude-api/streaming.md +178 -0
- package/control-plane/scripts/skills/claude-api/typescript/claude-api/tool-use.md +586 -0
- package/control-plane/scripts/skills/claude-api/typescript/managed-agents/README.md +359 -0
- package/control-plane/scripts/skills/dispatching-parallel-agents/SKILL.md +167 -0
- package/control-plane/scripts/skills/enhance-prompt/README.md +34 -0
- package/control-plane/scripts/skills/enhance-prompt/SKILL.md +204 -0
- package/control-plane/scripts/skills/enhance-prompt/references/KEYWORDS.md +114 -0
- package/control-plane/scripts/skills/executing-plans/SKILL.md +371 -0
- package/control-plane/scripts/skills/executing-plans/scripts/task-done +52 -0
- package/control-plane/scripts/skills/executing-plans/scripts/task-start +28 -0
- package/control-plane/scripts/skills/extract-design-md/SKILL.md +358 -0
- package/control-plane/scripts/skills/extract-design-md/examples/DESIGN.md +210 -0
- package/control-plane/scripts/skills/extract-design-md/references/angular.md +122 -0
- package/control-plane/scripts/skills/extract-design-md/references/plain-css.md +161 -0
- package/control-plane/scripts/skills/extract-design-md/references/react-tailwind.md +157 -0
- package/control-plane/scripts/skills/extract-design-md/references/svelte.md +101 -0
- package/control-plane/scripts/skills/extract-design-md/references/vue.md +107 -0
- package/control-plane/scripts/skills/finishing-a-development-branch/SKILL.md +225 -0
- package/control-plane/scripts/skills/frontend-design/LICENSE.txt +177 -0
- package/control-plane/scripts/skills/frontend-design/SKILL.md +71 -0
- package/control-plane/scripts/skills/hallmark/SKILL.md +558 -0
- package/control-plane/scripts/skills/hallmark/references/anti-patterns.md +418 -0
- package/control-plane/scripts/skills/hallmark/references/assets.md +406 -0
- package/control-plane/scripts/skills/hallmark/references/color.md +95 -0
- package/control-plane/scripts/skills/hallmark/references/component-cookbook.md +263 -0
- package/control-plane/scripts/skills/hallmark/references/components/c1-outlined-chip.md +12 -0
- package/control-plane/scripts/skills/hallmark/references/components/c2-inline-form-as-cta.md +16 -0
- package/control-plane/scripts/skills/hallmark/references/components/c3-typographic-link.md +8 -0
- package/control-plane/scripts/skills/hallmark/references/components/c4-sticky-bottom-bar.md +16 -0
- package/control-plane/scripts/skills/hallmark/references/components/f1-bento-grid.md +20 -0
- package/control-plane/scripts/skills/hallmark/references/components/f2-sticky-scroll-stack.md +20 -0
- package/control-plane/scripts/skills/hallmark/references/components/f3-tabular-spec-sheet.md +11 -0
- package/control-plane/scripts/skills/hallmark/references/components/f4-step-sequence.md +11 -0
- package/control-plane/scripts/skills/hallmark/references/components/f5-annotated-screenshot.md +11 -0
- package/control-plane/scripts/skills/hallmark/references/components/f6-product-card-grid.md +41 -0
- package/control-plane/scripts/skills/hallmark/references/components/ft1-mast-headed.md +13 -0
- package/control-plane/scripts/skills/hallmark/references/components/ft2-inline-rule-single-line.md +10 -0
- package/control-plane/scripts/skills/hallmark/references/components/ft3-index-style-category-list.md +12 -0
- package/control-plane/scripts/skills/hallmark/references/components/ft4-dense-typographic.md +10 -0
- package/control-plane/scripts/skills/hallmark/references/components/ft5-statement.md +21 -0
- package/control-plane/scripts/skills/hallmark/references/components/ft6-letter-close.md +19 -0
- package/control-plane/scripts/skills/hallmark/references/components/ft7-newsletter-first.md +27 -0
- package/control-plane/scripts/skills/hallmark/references/components/ft8-marquee-scroll.md +25 -0
- package/control-plane/scripts/skills/hallmark/references/components/h1-marquee.md +15 -0
- package/control-plane/scripts/skills/hallmark/references/components/h2-split-diptych.md +15 -0
- package/control-plane/scripts/skills/hallmark/references/components/h3-quote-led.md +11 -0
- package/control-plane/scripts/skills/hallmark/references/components/h4-stat-led.md +14 -0
- package/control-plane/scripts/skills/hallmark/references/components/h5-letter-hero.md +11 -0
- package/control-plane/scripts/skills/hallmark/references/components/h6-photographic-fold.md +16 -0
- package/control-plane/scripts/skills/hallmark/references/components/h7-demo-video-clipped-by-viewport-edge.md +27 -0
- package/control-plane/scripts/skills/hallmark/references/components/h8-mockup-split-browser-framed.md +23 -0
- package/control-plane/scripts/skills/hallmark/references/components/h9-custom-illustration-centerpiece.md +27 -0
- package/control-plane/scripts/skills/hallmark/references/components/n1-wordmark-2-links.md +12 -0
- package/control-plane/scripts/skills/hallmark/references/components/n10-floating-on-scroll-morph.md +19 -0
- package/control-plane/scripts/skills/hallmark/references/components/n11-mega-menu.md +40 -0
- package/control-plane/scripts/skills/hallmark/references/components/n12-banner-retract.md +34 -0
- package/control-plane/scripts/skills/hallmark/references/components/n13-inline-cmdk-pill.md +39 -0
- package/control-plane/scripts/skills/hallmark/references/components/n1b-saas-three-section.md +35 -0
- package/control-plane/scripts/skills/hallmark/references/components/n2-floating-chip.md +14 -0
- package/control-plane/scripts/skills/hallmark/references/components/n3-side-rail.md +14 -0
- package/control-plane/scripts/skills/hallmark/references/components/n4-hidden-behind-k.md +9 -0
- package/control-plane/scripts/skills/hallmark/references/components/n5-floating-pill.md +28 -0
- package/control-plane/scripts/skills/hallmark/references/components/n6-newspaper-masthead.md +24 -0
- package/control-plane/scripts/skills/hallmark/references/components/n7-brutal-slab.md +22 -0
- package/control-plane/scripts/skills/hallmark/references/components/n8-terminal-command.md +21 -0
- package/control-plane/scripts/skills/hallmark/references/components/n9-edge-aligned-minimal.md +17 -0
- package/control-plane/scripts/skills/hallmark/references/components/s1-left-margin-numbered.md +15 -0
- package/control-plane/scripts/skills/hallmark/references/components/s2-hanging.md +13 -0
- package/control-plane/scripts/skills/hallmark/references/components/s3-sticky-pinned.md +19 -0
- package/control-plane/scripts/skills/hallmark/references/components/s4-inline-no-break.md +11 -0
- package/control-plane/scripts/skills/hallmark/references/components/s5-bottom-anchored.md +13 -0
- package/control-plane/scripts/skills/hallmark/references/components/t1-pull-quote-with-marginalia.md +12 -0
- package/control-plane/scripts/skills/hallmark/references/components/t2-logo-wall-hairline.md +19 -0
- package/control-plane/scripts/skills/hallmark/references/components/t3-single-huge-quote.md +11 -0
- package/control-plane/scripts/skills/hallmark/references/components/t4-numbered-stat-strip.md +14 -0
- package/control-plane/scripts/skills/hallmark/references/contract.md +25 -0
- package/control-plane/scripts/skills/hallmark/references/copy.md +182 -0
- package/control-plane/scripts/skills/hallmark/references/custom-craft.md +626 -0
- package/control-plane/scripts/skills/hallmark/references/custom-theme.md +367 -0
- package/control-plane/scripts/skills/hallmark/references/design-md.md +116 -0
- package/control-plane/scripts/skills/hallmark/references/export-formats.md +329 -0
- package/control-plane/scripts/skills/hallmark/references/floating-nav.md +89 -0
- package/control-plane/scripts/skills/hallmark/references/genres/atmospheric.md +69 -0
- package/control-plane/scripts/skills/hallmark/references/genres/editorial.md +72 -0
- package/control-plane/scripts/skills/hallmark/references/genres/modern-minimal.md +71 -0
- package/control-plane/scripts/skills/hallmark/references/genres/playful.md +70 -0
- package/control-plane/scripts/skills/hallmark/references/hero-enrichment.md +475 -0
- package/control-plane/scripts/skills/hallmark/references/imagery-kit.md +170 -0
- package/control-plane/scripts/skills/hallmark/references/interaction-and-states.md +208 -0
- package/control-plane/scripts/skills/hallmark/references/layout-and-space.md +112 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/01-bento-grid.md +35 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/02-long-document.md +34 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/03-marquee-hero.md +31 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/04-stat-led.md +34 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/05-workbench.md +32 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/06-conversational-faq.md +33 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/07-manifesto.md +32 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/08-photographic.md +34 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/09-quote-led.md +32 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/10-specimen.md +32 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/11-catalogue.md +23 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/12-letter.md +23 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/13-index-first.md +23 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/14-narrative-workflow.md +23 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/15-split-studio.md +23 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/16-feature-stack.md +23 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/17-type-specimen.md +23 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/18-portfolio-grid.md +23 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/19-map-diagram.md +23 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/20-ecosystem-index.md +23 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures/21-component-playground.md +23 -0
- package/control-plane/scripts/skills/hallmark/references/macrostructures.md +89 -0
- package/control-plane/scripts/skills/hallmark/references/microinteractions.md +258 -0
- package/control-plane/scripts/skills/hallmark/references/motion.md +109 -0
- package/control-plane/scripts/skills/hallmark/references/preview-examples.md +49 -0
- package/control-plane/scripts/skills/hallmark/references/responsive.md +138 -0
- package/control-plane/scripts/skills/hallmark/references/slop-test.md +192 -0
- package/control-plane/scripts/skills/hallmark/references/structure.md +160 -0
- package/control-plane/scripts/skills/hallmark/references/study.md +509 -0
- package/control-plane/scripts/skills/hallmark/references/themes/carnival.md +301 -0
- package/control-plane/scripts/skills/hallmark/references/themes/cobalt.md +146 -0
- package/control-plane/scripts/skills/hallmark/references/themes/grid.md +161 -0
- package/control-plane/scripts/skills/hallmark/references/themes/hum.md +403 -0
- package/control-plane/scripts/skills/hallmark/references/themes/lumen.md +478 -0
- package/control-plane/scripts/skills/hallmark/references/typography.md +243 -0
- package/control-plane/scripts/skills/hallmark/references/upstream/recipes.md +186 -0
- package/control-plane/scripts/skills/hallmark/references/upstream/study-examples.md +176 -0
- package/control-plane/scripts/skills/hallmark/references/upstream/tokens.css +1221 -0
- package/control-plane/scripts/skills/hallmark/references/verbs/audit.md +25 -0
- package/control-plane/scripts/skills/hallmark/references/verbs/redesign.md +269 -0
- package/control-plane/scripts/skills/human-comms/SKILL.md +29 -0
- package/control-plane/scripts/skills/index.mjs +432 -0
- package/control-plane/scripts/skills/internal-comms/LICENSE.txt +202 -0
- package/control-plane/scripts/skills/internal-comms/SKILL.md +32 -0
- package/control-plane/scripts/skills/internal-comms/examples/3p-updates.md +47 -0
- package/control-plane/scripts/skills/internal-comms/examples/company-newsletter.md +65 -0
- package/control-plane/scripts/skills/internal-comms/examples/faq-answers.md +30 -0
- package/control-plane/scripts/skills/internal-comms/examples/general-comms.md +16 -0
- package/control-plane/scripts/skills/mcp-adapter.mjs +94 -0
- package/control-plane/scripts/skills/mcp-builder/LICENSE.txt +202 -0
- package/control-plane/scripts/skills/mcp-builder/SKILL.md +236 -0
- package/control-plane/scripts/skills/mcp-builder/reference/evaluation.md +602 -0
- package/control-plane/scripts/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
- package/control-plane/scripts/skills/mcp-builder/reference/node_mcp_server.md +970 -0
- package/control-plane/scripts/skills/mcp-builder/reference/python_mcp_server.md +719 -0
- package/control-plane/scripts/skills/mcp-builder/scripts/connections.py +151 -0
- package/control-plane/scripts/skills/mcp-builder/scripts/evaluation.py +373 -0
- package/control-plane/scripts/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/control-plane/scripts/skills/mcp-builder/scripts/requirements.txt +2 -0
- package/control-plane/scripts/skills/ponytail/SKILL.md +120 -0
- package/control-plane/scripts/skills/ponytail-audit/SKILL.md +41 -0
- package/control-plane/scripts/skills/ponytail-debt/SKILL.md +44 -0
- package/control-plane/scripts/skills/ponytail-gain/SKILL.md +50 -0
- package/control-plane/scripts/skills/ponytail-help/SKILL.md +71 -0
- package/control-plane/scripts/skills/ponytail-review/SKILL.md +57 -0
- package/control-plane/scripts/skills/receiving-code-review/SKILL.md +205 -0
- package/control-plane/scripts/skills/requesting-code-review/SKILL.md +95 -0
- package/control-plane/scripts/skills/requesting-code-review/code-reviewer.md +198 -0
- package/control-plane/scripts/skills/skill-creator/LICENSE.txt +202 -0
- package/control-plane/scripts/skills/skill-creator/SKILL.md +485 -0
- package/control-plane/scripts/skills/skill-creator/agents/analyzer.md +274 -0
- package/control-plane/scripts/skills/skill-creator/agents/comparator.md +202 -0
- package/control-plane/scripts/skills/skill-creator/agents/grader.md +223 -0
- package/control-plane/scripts/skills/skill-creator/assets/eval_review.html +146 -0
- package/control-plane/scripts/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/control-plane/scripts/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/control-plane/scripts/skills/skill-creator/references/schemas.md +430 -0
- package/control-plane/scripts/skills/skill-creator/scripts/__init__.py +0 -0
- package/control-plane/scripts/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/control-plane/scripts/skills/skill-creator/scripts/generate_report.py +326 -0
- package/control-plane/scripts/skills/skill-creator/scripts/improve_description.py +247 -0
- package/control-plane/scripts/skills/skill-creator/scripts/package_skill.py +136 -0
- package/control-plane/scripts/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/control-plane/scripts/skills/skill-creator/scripts/run_eval.py +310 -0
- package/control-plane/scripts/skills/skill-creator/scripts/run_loop.py +328 -0
- package/control-plane/scripts/skills/skill-creator/scripts/utils.py +47 -0
- package/control-plane/scripts/skills/slack-gif-creator/LICENSE.txt +202 -0
- package/control-plane/scripts/skills/slack-gif-creator/SKILL.md +254 -0
- package/control-plane/scripts/skills/slack-gif-creator/core/easing.py +234 -0
- package/control-plane/scripts/skills/slack-gif-creator/core/frame_composer.py +176 -0
- package/control-plane/scripts/skills/slack-gif-creator/core/gif_builder.py +269 -0
- package/control-plane/scripts/skills/slack-gif-creator/core/validators.py +136 -0
- package/control-plane/scripts/skills/slack-gif-creator/requirements.txt +4 -0
- package/control-plane/scripts/skills/sources.json +401 -0
- package/control-plane/scripts/skills/sources.lock.json +416 -0
- package/control-plane/scripts/skills/subagent-driven-development/SKILL.md +570 -0
- package/control-plane/scripts/skills/subagent-driven-development/implementer-prompt.md +154 -0
- package/control-plane/scripts/skills/subagent-driven-development/re-review-prompt.md +115 -0
- package/control-plane/scripts/skills/subagent-driven-development/scripts/review-package +53 -0
- package/control-plane/scripts/skills/subagent-driven-development/scripts/sdd-workspace +82 -0
- package/control-plane/scripts/skills/subagent-driven-development/scripts/task-brief +43 -0
- package/control-plane/scripts/skills/subagent-driven-development/task-reviewer-prompt.md +207 -0
- package/control-plane/scripts/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/control-plane/scripts/skills/systematic-debugging/SKILL.md +283 -0
- package/control-plane/scripts/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/control-plane/scripts/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/control-plane/scripts/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/control-plane/scripts/skills/systematic-debugging/find-polluter.sh +72 -0
- package/control-plane/scripts/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/control-plane/scripts/skills/systematic-debugging/test-academic.md +14 -0
- package/control-plane/scripts/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/control-plane/scripts/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/control-plane/scripts/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/control-plane/scripts/skills/test-driven-development/SKILL.md +330 -0
- package/control-plane/scripts/skills/test-driven-development/writing-good-tests.md +198 -0
- package/control-plane/scripts/skills/theme-factory/LICENSE.txt +202 -0
- package/control-plane/scripts/skills/theme-factory/SKILL.md +59 -0
- package/control-plane/scripts/skills/theme-factory/theme-showcase.pdf +0 -0
- package/control-plane/scripts/skills/theme-factory/themes/arctic-frost.md +19 -0
- package/control-plane/scripts/skills/theme-factory/themes/botanical-garden.md +19 -0
- package/control-plane/scripts/skills/theme-factory/themes/desert-rose.md +19 -0
- package/control-plane/scripts/skills/theme-factory/themes/forest-canopy.md +19 -0
- package/control-plane/scripts/skills/theme-factory/themes/golden-hour.md +19 -0
- package/control-plane/scripts/skills/theme-factory/themes/midnight-galaxy.md +19 -0
- package/control-plane/scripts/skills/theme-factory/themes/modern-minimalist.md +19 -0
- package/control-plane/scripts/skills/theme-factory/themes/ocean-depths.md +19 -0
- package/control-plane/scripts/skills/theme-factory/themes/sunset-boulevard.md +19 -0
- package/control-plane/scripts/skills/theme-factory/themes/tech-innovation.md +19 -0
- package/control-plane/scripts/skills/using-git-worktrees/SKILL.md +167 -0
- package/control-plane/scripts/skills/verification-before-completion/SKILL.md +120 -0
- package/control-plane/scripts/skills/web-artifacts-builder/LICENSE.txt +202 -0
- package/control-plane/scripts/skills/web-artifacts-builder/SKILL.md +74 -0
- package/control-plane/scripts/skills/web-artifacts-builder/scripts/bundle-artifact.sh +54 -0
- package/control-plane/scripts/skills/web-artifacts-builder/scripts/init-artifact.sh +322 -0
- package/control-plane/scripts/skills/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
- package/control-plane/scripts/skills/webapp-testing/LICENSE.txt +202 -0
- package/control-plane/scripts/skills/webapp-testing/SKILL.md +96 -0
- package/control-plane/scripts/skills/webapp-testing/examples/console_logging.py +35 -0
- package/control-plane/scripts/skills/webapp-testing/examples/element_discovery.py +40 -0
- package/control-plane/scripts/skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/control-plane/scripts/skills/webapp-testing/scripts/with_server.py +106 -0
- package/control-plane/scripts/skills/writing-plans/SKILL.md +192 -0
- package/control-plane/scripts/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/control-plane/scripts/skills/writing-skills/SKILL.md +681 -0
- package/control-plane/scripts/skills/writing-skills/anthropic-best-practices.md +1150 -0
- package/control-plane/scripts/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/control-plane/scripts/skills/writing-skills/graphviz-conventions.dot +172 -0
- package/control-plane/scripts/skills/writing-skills/persuasion-principles.md +187 -0
- package/control-plane/scripts/skills/writing-skills/render-graphs.js +169 -0
- package/control-plane/scripts/skills/writing-skills/testing-skills-with-subagents.md +384 -0
- package/control-plane/scripts/smoke-mcp-schemas.mjs +30 -0
- package/control-plane/scripts/surface-config.mjs +45 -0
- package/control-plane/scripts/sync-skills.mjs +370 -0
- package/control-plane/scripts/tool-metrics.mjs +74 -0
- package/control-plane/scripts/tool-risk.mjs +156 -0
- package/control-plane/scripts/tool-surface-stability.mjs +38 -0
- package/control-plane/scripts/upstreams/catalog-cache.mjs +28 -0
- package/control-plane/scripts/upstreams/config.mjs +158 -0
- package/control-plane/scripts/upstreams/diagnostics.mjs +21 -0
- package/control-plane/scripts/upstreams/http-client.mjs +67 -0
- package/control-plane/scripts/upstreams/manager.mjs +535 -0
- package/control-plane/scripts/upstreams/names.mjs +55 -0
- package/control-plane/scripts/upstreams/presets.mjs +60 -0
- package/control-plane/scripts/upstreams/resource-uri.mjs +29 -0
- package/control-plane/scripts/upstreams/stdio-client.mjs +73 -0
- package/control-plane/scripts/workspace-registry.mjs +147 -0
- package/dist/context/authorization.d.ts +5 -0
- package/dist/context/authorization.js +70 -0
- package/dist/context/capture.d.ts +46 -0
- package/dist/context/capture.js +187 -0
- package/dist/context/cli.d.ts +47 -0
- package/dist/context/cli.js +287 -0
- package/dist/context/device-adapter.d.ts +102 -0
- package/dist/context/device-adapter.js +79 -0
- package/dist/context/gateway.d.ts +354 -0
- package/dist/context/gateway.js +50 -0
- package/dist/context/graph.d.ts +63 -0
- package/dist/context/graph.js +214 -0
- package/dist/context/importer.d.ts +8 -0
- package/dist/context/importer.js +69 -0
- package/dist/context/indexer.d.ts +14 -0
- package/dist/context/indexer.js +57 -0
- package/dist/context/migrations/index.d.ts +4 -0
- package/dist/context/migrations/index.js +87 -0
- package/dist/context/redact.d.ts +15 -0
- package/dist/context/redact.js +43 -0
- package/dist/context/repositories.d.ts +9 -0
- package/dist/context/repositories.js +45 -0
- package/dist/context/search.d.ts +63 -0
- package/dist/context/search.js +207 -0
- package/dist/context/service.d.ts +278 -0
- package/dist/context/service.js +160 -0
- package/dist/context/store.d.ts +134 -0
- package/dist/context/store.js +722 -0
- package/dist/context/text.d.ts +4 -0
- package/dist/context/text.js +14 -0
- package/dist/context/tool-contract.d.ts +534 -0
- package/dist/context/tool-contract.js +45 -0
- package/dist/device/core.d.ts +29 -0
- package/dist/device/core.js +66 -0
- package/dist/device/device.d.ts +5 -0
- package/dist/device/device.js +94 -37
- package/dist/device/gateway-channel.d.ts +8 -1
- package/dist/device/gateway-channel.js +51 -3
- package/dist/device/gateway-tool-adapter.d.ts +11 -3
- package/dist/device/gateway-tool-adapter.js +141 -98
- package/dist/device/official-trust.d.ts +12 -0
- package/dist/device/official-trust.js +25 -1
- package/dist/device/runtime-owner.js +9 -1
- package/dist/distribution.d.ts +4 -0
- package/dist/distribution.js +8 -0
- package/dist/handlers/filesystem-handlers.js +53 -37
- package/dist/handlers/search-handlers.d.ts +1 -0
- package/dist/handlers/search-handlers.js +51 -1
- package/dist/log-palace/cli.d.ts +7 -0
- package/dist/log-palace/cli.js +89 -0
- package/dist/log-palace/formats.d.ts +26 -0
- package/dist/log-palace/formats.js +126 -0
- package/dist/log-palace/store.d.ts +129 -0
- package/dist/log-palace/store.js +856 -0
- package/dist/mcp-device.d.ts +1 -1
- package/dist/mcp-device.js +28 -6
- package/dist/npm-scripts/remote.js +1 -0
- package/dist/platform/activity-journal.d.ts +16 -0
- package/dist/platform/activity-journal.js +68 -0
- package/dist/platform/cli.d.ts +1 -0
- package/dist/platform/cli.js +300 -0
- package/dist/platform/coordination-lock.d.ts +45 -0
- package/dist/platform/coordination-lock.js +233 -0
- package/dist/platform/device-runtime.d.ts +16 -0
- package/dist/platform/device-runtime.js +83 -0
- package/dist/platform/knowledge-contract.d.ts +46 -0
- package/dist/platform/knowledge-contract.js +1 -0
- package/dist/platform/knowledge-mcp.d.ts +29 -0
- package/dist/platform/knowledge-mcp.js +95 -0
- package/dist/platform/knowledge-router.d.ts +64 -0
- package/dist/platform/knowledge-router.js +320 -0
- package/dist/platform/plugin-child.d.ts +1 -0
- package/dist/platform/plugin-child.js +115 -0
- package/dist/platform/plugin-contract.d.ts +76 -0
- package/dist/platform/plugin-contract.js +53 -0
- package/dist/platform/plugin-driver.d.ts +8 -0
- package/dist/platform/plugin-driver.js +443 -0
- package/dist/platform/plugin-host.d.ts +88 -0
- package/dist/platform/plugin-host.js +817 -0
- package/dist/platform/plugin-policy.d.ts +3 -0
- package/dist/platform/plugin-policy.js +29 -0
- package/dist/platform/plugin-services.d.ts +14 -0
- package/dist/platform/plugin-services.js +32 -0
- package/dist/platform/process-identity.d.ts +9 -0
- package/dist/platform/process-identity.js +68 -0
- package/dist/platform/runtime-lease.d.ts +4 -0
- package/dist/platform/runtime-lease.js +58 -0
- package/dist/platform/runtime-root.d.ts +9 -0
- package/dist/platform/runtime-root.js +61 -0
- package/dist/platform/state-backup.d.ts +92 -0
- package/dist/platform/state-backup.js +399 -0
- package/dist/plugins/reference/plugin.d.ts +3 -0
- package/dist/plugins/reference/plugin.js +13 -0
- package/dist/search-manager.d.ts +6 -0
- package/dist/search-manager.js +123 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.js +7 -3
- package/dist/terminal-manager.d.ts +16 -0
- package/dist/terminal-manager.js +137 -42
- package/dist/tool-dispatcher.d.ts +11 -0
- package/dist/tool-dispatcher.js +228 -0
- package/dist/tools/edit.js +72 -1
- package/dist/tools/filesystem.d.ts +1 -1
- package/dist/tools/filesystem.js +2 -2
- package/dist/tools/improved-process-tools.js +91 -108
- package/dist/tools/schemas.d.ts +94 -2
- package/dist/tools/schemas.js +20 -6
- package/dist/types.d.ts +8 -0
- package/dist/utils/output-budget.d.ts +6 -0
- package/dist/utils/output-budget.js +15 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +29 -6
- package/skills/mcp-device-context/SKILL.md +40 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { listCustomTools } from './custom-tools/index.mjs';
|
|
2
|
+
import { listDevicesToolDefinition } from './device-inventory.mjs';
|
|
3
|
+
import { buildShellExecuteAnnotations, buildShellExecuteDescription } from './shell-tool-descriptor.mjs';
|
|
4
|
+
import { applyToolRisk } from './tool-risk.mjs';
|
|
5
|
+
import { stableToolDefinition } from './tool-surface-stability.mjs';
|
|
6
|
+
|
|
7
|
+
export const DEVICE_EXECUTION_TOOL_NAMES = Object.freeze([
|
|
8
|
+
'read_text_file',
|
|
9
|
+
'write_file',
|
|
10
|
+
'edit_file',
|
|
11
|
+
'shell_execute',
|
|
12
|
+
'start_process',
|
|
13
|
+
'read_process_output',
|
|
14
|
+
'interact_with_process',
|
|
15
|
+
'terminate_process',
|
|
16
|
+
'image_preview',
|
|
17
|
+
'project_inspect'
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
export const DEVICE_PUBLIC_TOOL_NAMES = Object.freeze([
|
|
21
|
+
'list_devices',
|
|
22
|
+
'project_list',
|
|
23
|
+
...DEVICE_EXECUTION_TOOL_NAMES
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
export const shellExecuteSchema = {
|
|
27
|
+
type: 'object',
|
|
28
|
+
properties: {
|
|
29
|
+
command: { type: 'string', description: 'The system instruction to execute in the verified environment.' },
|
|
30
|
+
working_directory: { type: 'string', description: 'The target workspace for execution.' },
|
|
31
|
+
timeout_ms: { type: 'integer', minimum: 1, maximum: 28000, description: 'Optional one-shot execution timeout in milliseconds. Defaults to 28000; use start_process for longer work.' },
|
|
32
|
+
device_id: { type: 'string', minLength: 1, description: 'Owned online device that will execute this command.' }
|
|
33
|
+
},
|
|
34
|
+
required: ['command', 'working_directory', 'device_id'],
|
|
35
|
+
additionalProperties: false
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const processToolSchemas = {
|
|
39
|
+
start_process: {
|
|
40
|
+
type: 'object',
|
|
41
|
+
properties: {
|
|
42
|
+
command: { type: 'string', minLength: 1, description: 'Command to execute in a retained process session.' },
|
|
43
|
+
working_directory: { type: 'string', description: 'Trusted workspace directory for the process.' },
|
|
44
|
+
timeout_ms: { type: 'integer', minimum: 1, maximum: 30000, default: 10000, description: 'Foreground wait before yielding RUNNING. Does not kill the process.' },
|
|
45
|
+
device_id: { type: 'string', minLength: 1, description: 'Owned online device that will start the process. Follow-up calls use session_id only.' }
|
|
46
|
+
},
|
|
47
|
+
required: ['command', 'working_directory', 'device_id'],
|
|
48
|
+
additionalProperties: false
|
|
49
|
+
},
|
|
50
|
+
read_process_output: {
|
|
51
|
+
type: 'object',
|
|
52
|
+
properties: {
|
|
53
|
+
session_id: { type: 'string', minLength: 1 },
|
|
54
|
+
offset: { type: 'integer', minimum: 0 },
|
|
55
|
+
length: { type: 'integer', minimum: 1, maximum: 65536, default: 8192 }
|
|
56
|
+
},
|
|
57
|
+
required: ['session_id'],
|
|
58
|
+
additionalProperties: false
|
|
59
|
+
},
|
|
60
|
+
interact_with_process: {
|
|
61
|
+
type: 'object',
|
|
62
|
+
properties: {
|
|
63
|
+
session_id: { type: 'string', minLength: 1 },
|
|
64
|
+
input: { type: 'string', description: 'Raw stdin text; include a newline when the target program requires one.' },
|
|
65
|
+
timeout_ms: { type: 'integer', minimum: 0, maximum: 30000, default: 0, description: 'Optional wait after writing stdin. Does not kill the process.' }
|
|
66
|
+
},
|
|
67
|
+
required: ['session_id', 'input'],
|
|
68
|
+
additionalProperties: false
|
|
69
|
+
},
|
|
70
|
+
terminate_process: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
properties: { session_id: { type: 'string', minLength: 1 } },
|
|
73
|
+
required: ['session_id'],
|
|
74
|
+
additionalProperties: false
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const shellExecuteOutputSchema = {
|
|
79
|
+
type: 'object',
|
|
80
|
+
properties: {
|
|
81
|
+
workingDirectoryResolved: { type: 'string' },
|
|
82
|
+
exitCode: { type: 'number' },
|
|
83
|
+
stdout: { type: 'string' },
|
|
84
|
+
stderr: { type: 'string' },
|
|
85
|
+
timedOut: { type: 'boolean' },
|
|
86
|
+
stdoutTruncated: { type: 'boolean' },
|
|
87
|
+
stderrTruncated: { type: 'boolean' },
|
|
88
|
+
stdoutBytes: { type: 'number' },
|
|
89
|
+
stderrBytes: { type: 'number' },
|
|
90
|
+
stdoutSpillPath: {},
|
|
91
|
+
stderrSpillPath: {}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const FILESYSTEM_TOOL_DEFINITIONS = [
|
|
96
|
+
{
|
|
97
|
+
name: 'read_text_file',
|
|
98
|
+
description: 'Read a text file from one explicit owned online device. Use head or tail to bound large reads.',
|
|
99
|
+
inputSchema: {
|
|
100
|
+
type: 'object',
|
|
101
|
+
properties: {
|
|
102
|
+
path: { type: 'string' },
|
|
103
|
+
tail: { type: 'number', description: 'If provided, returns only the last N lines of the file.' },
|
|
104
|
+
head: { type: 'number', description: 'If provided, returns only the first N lines of the file.' }
|
|
105
|
+
},
|
|
106
|
+
required: ['path'],
|
|
107
|
+
additionalProperties: false
|
|
108
|
+
},
|
|
109
|
+
outputSchema: { type: 'object', properties: { content: { type: 'string' } }, required: ['content'], additionalProperties: false }
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'write_file',
|
|
113
|
+
description: 'Create or completely overwrite a text file on one explicit owned online device.',
|
|
114
|
+
inputSchema: {
|
|
115
|
+
type: 'object',
|
|
116
|
+
properties: { path: { type: 'string' }, content: { type: 'string' } },
|
|
117
|
+
required: ['path', 'content'],
|
|
118
|
+
additionalProperties: false
|
|
119
|
+
},
|
|
120
|
+
outputSchema: { type: 'object', properties: { content: { type: 'string' } }, required: ['content'], additionalProperties: false }
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'edit_file',
|
|
124
|
+
description: 'Make one exact guarded text replacement on one explicit owned online device.',
|
|
125
|
+
inputSchema: {
|
|
126
|
+
type: 'object',
|
|
127
|
+
properties: {
|
|
128
|
+
path: { type: 'string' },
|
|
129
|
+
old_text: { type: 'string', minLength: 1, description: 'Exact text to replace. No fuzzy matching is applied.' },
|
|
130
|
+
new_text: { type: 'string', description: 'Replacement text.' },
|
|
131
|
+
expected_replacements: { type: 'integer', minimum: 1, default: 1, description: 'Required exact occurrence count before mutation.' },
|
|
132
|
+
dry_run: { type: 'boolean', default: false, description: 'Validate without writing.' }
|
|
133
|
+
},
|
|
134
|
+
required: ['path', 'old_text', 'new_text'],
|
|
135
|
+
additionalProperties: false
|
|
136
|
+
},
|
|
137
|
+
outputSchema: { type: 'object', properties: { content: { type: 'string' } }, required: ['content'], additionalProperties: false }
|
|
138
|
+
}
|
|
139
|
+
];
|
|
140
|
+
|
|
141
|
+
const PROCESS_TOOL_DESCRIPTIONS = {
|
|
142
|
+
start_process: 'Start a command with retained bounded output. Short commands may complete immediately; long commands return RUNNING plus sessionId after timeout_ms without being killed.',
|
|
143
|
+
read_process_output: 'Read a bounded page of retained process output using absolute offset/length. Completed output remains available for a bounded retention period.',
|
|
144
|
+
interact_with_process: 'Write raw stdin to a running process session and optionally wait briefly for progress.',
|
|
145
|
+
terminate_process: 'Terminate a caller-owned running process session and its process tree where supported.'
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export function withRequiredDeviceId(inputSchema = {}) {
|
|
149
|
+
return {
|
|
150
|
+
...inputSchema,
|
|
151
|
+
type: 'object',
|
|
152
|
+
properties: {
|
|
153
|
+
...(inputSchema.properties || {}),
|
|
154
|
+
device_id: { type: 'string', minLength: 1, description: 'Owned online device that will perform this filesystem operation.' }
|
|
155
|
+
},
|
|
156
|
+
required: [...new Set([...(inputSchema.required || []), 'device_id'])]
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function filesystemToolMeta(tool) {
|
|
161
|
+
return stableToolDefinition(applyToolRisk({
|
|
162
|
+
...tool,
|
|
163
|
+
inputSchema: withRequiredDeviceId(tool.inputSchema),
|
|
164
|
+
name: tool.name,
|
|
165
|
+
description: tool.description
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function shellExecuteToolMeta() {
|
|
170
|
+
return stableToolDefinition(applyToolRisk({
|
|
171
|
+
name: 'shell_execute',
|
|
172
|
+
description: buildShellExecuteDescription(),
|
|
173
|
+
inputSchema: shellExecuteSchema,
|
|
174
|
+
outputSchema: shellExecuteOutputSchema,
|
|
175
|
+
annotations: buildShellExecuteAnnotations()
|
|
176
|
+
}));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export function listProcessTools() {
|
|
180
|
+
return Object.keys(processToolSchemas).map(name => applyToolRisk({
|
|
181
|
+
name,
|
|
182
|
+
description: PROCESS_TOOL_DESCRIPTIONS[name],
|
|
183
|
+
inputSchema: processToolSchemas[name]
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export function listStaticDeviceExecutionTools() {
|
|
188
|
+
const customByName = new Map(listCustomTools().map(tool => [tool.name, tool]));
|
|
189
|
+
const tools = [
|
|
190
|
+
...FILESYSTEM_TOOL_DEFINITIONS.map(filesystemToolMeta),
|
|
191
|
+
shellExecuteToolMeta(),
|
|
192
|
+
...listProcessTools(),
|
|
193
|
+
customByName.get('image_preview'),
|
|
194
|
+
customByName.get('project_inspect')
|
|
195
|
+
].filter(Boolean);
|
|
196
|
+
const byName = new Map(tools.map(tool => [tool.name, tool]));
|
|
197
|
+
return DEVICE_EXECUTION_TOOL_NAMES.map(name => {
|
|
198
|
+
const tool = byName.get(name);
|
|
199
|
+
if (!tool) throw new Error(`Missing static device execution tool definition: ${name}`);
|
|
200
|
+
return tool;
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export function listStaticDevicePublicTools() {
|
|
205
|
+
const customByName = new Map(listCustomTools().map(tool => [tool.name, tool]));
|
|
206
|
+
const tools = [
|
|
207
|
+
applyToolRisk(listDevicesToolDefinition()),
|
|
208
|
+
customByName.get('project_list'),
|
|
209
|
+
...listStaticDeviceExecutionTools()
|
|
210
|
+
].filter(Boolean);
|
|
211
|
+
const byName = new Map(tools.map(tool => [tool.name, tool]));
|
|
212
|
+
return DEVICE_PUBLIC_TOOL_NAMES.map(name => {
|
|
213
|
+
const tool = byName.get(name);
|
|
214
|
+
if (!tool) throw new Error(`Missing static device public tool definition: ${name}`);
|
|
215
|
+
return tool;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_LIMIT = 50;
|
|
4
|
+
const MAX_LIMIT = 100;
|
|
5
|
+
|
|
6
|
+
function deviceSelectionError(code, message) {
|
|
7
|
+
const error = new Error(`${code}: ${message}`);
|
|
8
|
+
error.code = code;
|
|
9
|
+
return error;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function pathStyleFromHint(pathHint) {
|
|
13
|
+
const hint = String(pathHint || '').trim();
|
|
14
|
+
if (!hint) throw deviceSelectionError('PATH_HINT_REQUIRED', 'path_hint is required.');
|
|
15
|
+
if (/^[A-Za-z]:[\\/]/.test(hint) || /^\\\\/.test(hint)) return 'windows';
|
|
16
|
+
if (hint.startsWith('/')) return 'posix';
|
|
17
|
+
throw deviceSelectionError('PATH_HINT_UNSUPPORTED', 'path_hint must be an absolute Windows or POSIX path.');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function selectDeviceForPathHint(devices, pathHint) {
|
|
21
|
+
const pathStyle = pathStyleFromHint(pathHint);
|
|
22
|
+
const matches = (Array.isArray(devices) ? devices : []).filter(device =>
|
|
23
|
+
Boolean(device?.online) &&
|
|
24
|
+
!device?.revoked &&
|
|
25
|
+
String(device?.pathStyle || '') === pathStyle
|
|
26
|
+
);
|
|
27
|
+
if (matches.length === 1) return matches[0];
|
|
28
|
+
if (matches.length === 0) {
|
|
29
|
+
throw deviceSelectionError('DEVICE_NOT_FOUND', `No owned online ${pathStyle} device matches path_hint.`);
|
|
30
|
+
}
|
|
31
|
+
throw deviceSelectionError('DEVICE_SELECTION_AMBIGUOUS', `Multiple owned online ${pathStyle} devices match path_hint; provide device_id explicitly.`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function boundedLimit(value) {
|
|
35
|
+
const limit = value === undefined ? DEFAULT_LIMIT : Number(value);
|
|
36
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > MAX_LIMIT) {
|
|
37
|
+
throw new Error(`limit must be an integer between 1 and ${MAX_LIMIT}`);
|
|
38
|
+
}
|
|
39
|
+
return limit;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function inventorySignature(devices) {
|
|
43
|
+
return createHash('sha256')
|
|
44
|
+
.update(JSON.stringify(devices.map(device => ({
|
|
45
|
+
deviceId: device?.deviceId || '',
|
|
46
|
+
online: Boolean(device?.online),
|
|
47
|
+
capabilities: Array.isArray(device?.capabilities) ? device.capabilities : []
|
|
48
|
+
}))))
|
|
49
|
+
.digest('hex')
|
|
50
|
+
.slice(0, 16);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function encodeCursor(offset, signature) {
|
|
54
|
+
return Buffer.from(JSON.stringify({ v: 1, offset, signature }), 'utf8').toString('base64url');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function decodeCursor(cursor, signature) {
|
|
58
|
+
if (!cursor) return 0;
|
|
59
|
+
let parsed;
|
|
60
|
+
try {
|
|
61
|
+
parsed = JSON.parse(Buffer.from(String(cursor), 'base64url').toString('utf8'));
|
|
62
|
+
} catch {
|
|
63
|
+
throw new Error('Invalid cursor: expected an opaque cursor returned by list_devices.');
|
|
64
|
+
}
|
|
65
|
+
if (parsed?.v !== 1 || parsed?.signature !== signature || !Number.isInteger(parsed?.offset) || parsed.offset < 0) {
|
|
66
|
+
throw new Error('Invalid or stale cursor: device inventory changed.');
|
|
67
|
+
}
|
|
68
|
+
return parsed.offset;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function listDevicesToolDefinition() {
|
|
72
|
+
return {
|
|
73
|
+
name: 'list_devices',
|
|
74
|
+
description: 'List currently paired device identities and bounded capability/status metadata. Forgotten devices are excluded; adding or removing devices does not change the MCP tool schema.',
|
|
75
|
+
inputSchema: {
|
|
76
|
+
type: 'object',
|
|
77
|
+
properties: {
|
|
78
|
+
cursor: { type: 'string', description: 'Opaque cursor returned by the previous page.' },
|
|
79
|
+
limit: { type: 'integer', minimum: 1, maximum: MAX_LIMIT, default: DEFAULT_LIMIT },
|
|
80
|
+
path_hint: { type: 'string', description: 'Optional absolute Windows/POSIX path hint. Returns selected_device_id only when exactly one owned online device is compatible.' }
|
|
81
|
+
},
|
|
82
|
+
additionalProperties: false
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function toWireDevice(device = {}) {
|
|
88
|
+
return {
|
|
89
|
+
device_id: device.deviceId || '',
|
|
90
|
+
device_name: device.deviceName || device.deviceId || '',
|
|
91
|
+
hostname: device.hostname || null,
|
|
92
|
+
platform: device.platform || null,
|
|
93
|
+
arch: device.arch || null,
|
|
94
|
+
path_style: device.pathStyle || null,
|
|
95
|
+
online: Boolean(device.online),
|
|
96
|
+
revoked: false,
|
|
97
|
+
agent_version: device.agentVersion || 'unknown',
|
|
98
|
+
capabilities: Array.isArray(device.capabilities) ? [...device.capabilities] : [],
|
|
99
|
+
connection_epoch: Number(device.connectionEpoch || 0),
|
|
100
|
+
connected_at: device.connectedAt || null,
|
|
101
|
+
last_seen_at: device.lastSeenAt || null,
|
|
102
|
+
account: device.account || { connected: false, label: null },
|
|
103
|
+
usage: device.usage ?? null,
|
|
104
|
+
schema: device.schema ?? null
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function paginateDeviceInventory(devices, options = {}) {
|
|
109
|
+
const sorted = [...(Array.isArray(devices) ? devices : [])]
|
|
110
|
+
.filter(device => !device?.revoked)
|
|
111
|
+
.sort((left, right) => String(left?.deviceId || '').localeCompare(String(right?.deviceId || '')));
|
|
112
|
+
const pathHint = String(options.path_hint || '').trim();
|
|
113
|
+
const selectedDevice = pathHint ? selectDeviceForPathHint(sorted, pathHint) : null;
|
|
114
|
+
const signature = inventorySignature(sorted);
|
|
115
|
+
const offset = decodeCursor(options.cursor, signature);
|
|
116
|
+
if (offset > sorted.length) throw new Error('Invalid or stale cursor: device offset is outside the current inventory.');
|
|
117
|
+
const limit = boundedLimit(options.limit);
|
|
118
|
+
const page = sorted.slice(offset, offset + limit).map(toWireDevice);
|
|
119
|
+
const nextOffset = offset + page.length;
|
|
120
|
+
const truncated = nextOffset < sorted.length;
|
|
121
|
+
return {
|
|
122
|
+
devices: page,
|
|
123
|
+
...(selectedDevice ? { selected_device_id: selectedDevice.deviceId } : {}),
|
|
124
|
+
truncated,
|
|
125
|
+
nextCursor: truncated ? encodeCursor(nextOffset, signature) : null,
|
|
126
|
+
total: sorted.length
|
|
127
|
+
};
|
|
128
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { escapeHtml, pageShell, quickGuide } from './enduser-ui.mjs';
|
|
2
|
+
|
|
3
|
+
function renderVerificationPage({ pairing, account, approved = false }) {
|
|
4
|
+
if (approved) {
|
|
5
|
+
return pageShell({ title: 'Device approved', body: `<section class="card"><h1>Device approved</h1><p><strong>${escapeHtml(pairing.deviceName)}</strong> is approved for ${escapeHtml(account.email)}.</p><p class="muted">Return to the device terminal. It can now finish enrollment.</p><div class="actions"><a class="button" href="/dashboard">Dashboard</a><a href="/pair">Pair another device</a></div></section>` });
|
|
6
|
+
}
|
|
7
|
+
return pageShell({ title: 'Approve device', body: `<section class="card"><h1>Approve device</h1><p class="muted">Confirm that this is the device you intended to pair.</p><p>Account: <strong>${escapeHtml(account.email)}</strong></p><p>Device: <strong>${escapeHtml(pairing.deviceName)}</strong><br><span class="muted">${escapeHtml(pairing.deviceId)}</span></p><p>Code: <strong>${escapeHtml(pairing.userCode)}</strong></p><form method="post" action="/device/verify"><input type="hidden" name="user_code" value="${escapeHtml(pairing.userCode)}"><button class="primary" type="submit">Approve device</button></form></section>` });
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function pairingStatePage(title, message, { status = 200, baseUrl = '' } = {}) {
|
|
11
|
+
return { status, html: pageShell({ title, body: `<section class="card"><h1>${escapeHtml(title)}</h1><p>${escapeHtml(message)}</p><div class="actions"><a class="button primary" href="/pair">Enter a code</a><a href="/help">Pairing help</a></div></section>${quickGuide(baseUrl)}` }) };
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function errorPayload(error, fallback = 'invalid_request') {
|
|
15
|
+
const message = String(error?.message || error || fallback);
|
|
16
|
+
return { error: fallback, error_description: message.slice(0, 240) };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function verificationReturnTo(_req, userCode) {
|
|
20
|
+
const code = encodeURIComponent(String(userCode || '').trim());
|
|
21
|
+
return `/device/verify?user_code=${code}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function installDevicePairingRoutes(app, { pairingStore, accountFromRequest, baseUrlFromRequest }) {
|
|
25
|
+
if (!app || !pairingStore || typeof accountFromRequest !== 'function') {
|
|
26
|
+
throw new Error('Device pairing routes require app, pairingStore, and accountFromRequest.');
|
|
27
|
+
}
|
|
28
|
+
const getBaseUrl = typeof baseUrlFromRequest === 'function' ? baseUrlFromRequest : req => `${req.protocol}://${req.get('host')}`;
|
|
29
|
+
|
|
30
|
+
app.get('/pair', (req, res) => {
|
|
31
|
+
const baseUrl = String(getBaseUrl(req) || '').replace(/\/+$/, '');
|
|
32
|
+
res.status(200).type('html').send(pageShell({ title: 'Pair a device', body: `<section class="card"><h1>Pair a device</h1><p class="muted">Start pairing on your device, then enter the code it shows.</p><form class="inline" method="get" action="/device/verify"><input name="user_code" autocomplete="one-time-code" placeholder="ABCD-EFGH" maxlength="9" required><button class="primary" type="submit">Continue</button></form></section>${quickGuide(baseUrl)}` }));
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
app.get('/help', (req, res) => {
|
|
36
|
+
const baseUrl = String(getBaseUrl(req) || '').replace(/\/+$/, '');
|
|
37
|
+
res.status(200).type('html').send(pageShell({ title: 'Help', body: `<section class="card"><h1>Device setup</h1><p>Point the device CLI at this gateway, sign in, approve the browser pairing code, then install the background service.</p><p class="muted">If a code expires, restart <code>mcp-device login</code> to get a new one.</p></section>${quickGuide(baseUrl)}` }));
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
app.post('/device/start', (req, res) => {
|
|
41
|
+
try {
|
|
42
|
+
if (String(req.body?.code_challenge_method || '') !== 'S256') {
|
|
43
|
+
res.status(400).json({ error: 'invalid_request', error_description: 'code_challenge_method must be S256.' });
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const started = pairingStore.start({ clientId: req.body?.client_id, deviceId: req.body?.device_id, deviceName: req.body?.device_name, publicKeyPem: req.body?.public_key_pem, codeChallenge: req.body?.code_challenge });
|
|
47
|
+
const baseUrl = String(getBaseUrl(req) || '').replace(/\/+$/, '');
|
|
48
|
+
const verificationUri = `${baseUrl}/device/verify`;
|
|
49
|
+
res.json({ device_code: started.deviceCode, user_code: started.userCode, verification_uri: verificationUri, verification_uri_complete: `${verificationUri}?user_code=${encodeURIComponent(started.userCode)}`, expires_in: started.expiresIn, interval: started.interval });
|
|
50
|
+
} catch (error) {
|
|
51
|
+
res.status(400).json(errorPayload(error));
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
app.get('/device/verify', (req, res) => {
|
|
56
|
+
const rawCode = String(req.query?.user_code || '').trim();
|
|
57
|
+
const baseUrl = String(getBaseUrl(req) || '').replace(/\/+$/, '');
|
|
58
|
+
if (!rawCode) {
|
|
59
|
+
const state = pairingStatePage('Enter the code from your device', 'Start pairing on your device first, then enter the code shown in its terminal.', { baseUrl });
|
|
60
|
+
res.status(state.status).type('html').send(state.html);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
const pairing = pairingStore.getStatusByUserCode(rawCode);
|
|
65
|
+
if (pairing.status === 'expired') {
|
|
66
|
+
const state = pairingStatePage('Pairing code expired', 'Restart device login to create a fresh pairing code.', { status: 410, baseUrl });
|
|
67
|
+
res.status(state.status).type('html').send(state.html);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const account = accountFromRequest(req);
|
|
71
|
+
if (!account) {
|
|
72
|
+
res.redirect(302, `/login?return_to=${encodeURIComponent(verificationReturnTo(req, pairing.userCode))}`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
res.status(200).type('html').send(renderVerificationPage({ pairing, account }));
|
|
76
|
+
} catch {
|
|
77
|
+
const state = pairingStatePage('Invalid pairing code', 'Check the code and try again, or restart device login to create a new code.', { status: 404, baseUrl });
|
|
78
|
+
res.status(state.status).type('html').send(state.html);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
app.post('/device/verify', (req, res) => {
|
|
83
|
+
try {
|
|
84
|
+
const pairing = pairingStore.getStatusByUserCode(req.body?.user_code);
|
|
85
|
+
const account = accountFromRequest(req);
|
|
86
|
+
if (!account) {
|
|
87
|
+
res.redirect(302, `/login?return_to=${encodeURIComponent(verificationReturnTo(req, pairing.userCode))}`);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const approvedPairing = pairingStore.approve({ userCode: pairing.userCode, accountId: account.accountId, accountLabel: account.email });
|
|
91
|
+
res.status(200).type('html').send(renderVerificationPage({ pairing: approvedPairing, account, approved: true }));
|
|
92
|
+
} catch (error) {
|
|
93
|
+
res.status(400).type('html').send(pageShell({ title: 'Pairing failed', body: `<section class="card"><h1>Pairing failed</h1><p>${escapeHtml(error?.message || error)}</p><a href="/pair">Try again</a></section>` }));
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
app.post('/device/poll', (req, res) => {
|
|
98
|
+
try {
|
|
99
|
+
const result = pairingStore.poll({ deviceCode: req.body?.device_code, clientId: req.body?.client_id, codeVerifier: req.body?.code_verifier });
|
|
100
|
+
if (result.status === 'authorization_pending') {
|
|
101
|
+
res.status(400).json({ error: 'authorization_pending' });
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
res.json({ enrollment_grant: result.enrollmentGrant, device_id: result.deviceId, account: result.account });
|
|
105
|
+
} catch (error) {
|
|
106
|
+
res.status(400).json(errorPayload(error, 'invalid_grant'));
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|