@hcu-lab.me/mcp-device 1.0.10 → 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 +57 -2
- 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 -1
- package/dist/device/device.js +87 -39
- 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 +9 -0
- package/dist/device/gateway-tool-adapter.js +20 -1
- 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/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.js +27 -5
- 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/server.js +5 -1
- package/dist/terminal-manager.d.ts +7 -0
- package/dist/terminal-manager.js +10 -0
- package/dist/tool-dispatcher.js +5 -1
- package/dist/tools/improved-process-tools.js +4 -0
- package/dist/types.d.ts +1 -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,253 @@
|
|
|
1
|
+
# Tool Use - PHP
|
|
2
|
+
|
|
3
|
+
For conceptual overview (tool definitions, tool choice, tips), see [shared/tool-use-concepts.md](../../shared/tool-use-concepts.md).
|
|
4
|
+
|
|
5
|
+
## Tool Use
|
|
6
|
+
|
|
7
|
+
### Tool Runner (Beta)
|
|
8
|
+
|
|
9
|
+
**Beta:** The PHP SDK provides a tool runner via `$client->beta->messages->toolRunner()`. Define tools with `BetaRunnableTool` - a definition array plus a `run` closure:
|
|
10
|
+
|
|
11
|
+
```php
|
|
12
|
+
use Anthropic\Lib\Tools\BetaRunnableTool;
|
|
13
|
+
|
|
14
|
+
$weatherTool = new BetaRunnableTool(
|
|
15
|
+
definition: [
|
|
16
|
+
'name' => 'get_weather',
|
|
17
|
+
'description' => 'Get the current weather for a location.',
|
|
18
|
+
'inputSchema' => [
|
|
19
|
+
'type' => 'object',
|
|
20
|
+
'properties' => [
|
|
21
|
+
'location' => ['type' => 'string', 'description' => 'City and state'],
|
|
22
|
+
],
|
|
23
|
+
'required' => ['location'],
|
|
24
|
+
],
|
|
25
|
+
],
|
|
26
|
+
run: function (array $input): string {
|
|
27
|
+
return "The weather in {$input['location']} is sunny and 72°F.";
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
$runner = $client->beta->messages->toolRunner(
|
|
32
|
+
maxTokens: 16000,
|
|
33
|
+
messages: [['role' => 'user', 'content' => 'What is the weather in Paris?']],
|
|
34
|
+
model: 'claude-opus-5',
|
|
35
|
+
tools: [$weatherTool],
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
foreach ($runner as $message) {
|
|
39
|
+
foreach ($message->content as $block) {
|
|
40
|
+
if ($block->type === 'text') {
|
|
41
|
+
echo $block->text;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Manual Loop
|
|
48
|
+
|
|
49
|
+
Tools are passed as arrays. **The SDK uses camelCase keys** (`inputSchema`, `toolUseID`, `stopReason`) and auto-maps to the API's snake_case on the wire - since v0.5.0. See [shared tool use concepts](../../shared/tool-use-concepts.md) for the loop pattern.
|
|
50
|
+
|
|
51
|
+
```php
|
|
52
|
+
use Anthropic\Messages\ToolUseBlock;
|
|
53
|
+
|
|
54
|
+
$tools = [
|
|
55
|
+
[
|
|
56
|
+
'name' => 'get_weather',
|
|
57
|
+
'description' => 'Get the current weather in a given location',
|
|
58
|
+
'inputSchema' => [ // camelCase, not input_schema
|
|
59
|
+
'type' => 'object',
|
|
60
|
+
'properties' => [
|
|
61
|
+
'location' => ['type' => 'string', 'description' => 'City and state'],
|
|
62
|
+
],
|
|
63
|
+
'required' => ['location'],
|
|
64
|
+
],
|
|
65
|
+
],
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
$messages = [['role' => 'user', 'content' => 'What is the weather in SF?']];
|
|
69
|
+
|
|
70
|
+
$response = $client->messages->create(
|
|
71
|
+
model: 'claude-opus-5',
|
|
72
|
+
maxTokens: 16000,
|
|
73
|
+
tools: $tools,
|
|
74
|
+
messages: $messages,
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
while ($response->stopReason === 'tool_use') { // camelCase property
|
|
78
|
+
$toolResults = [];
|
|
79
|
+
foreach ($response->content as $block) {
|
|
80
|
+
if ($block instanceof ToolUseBlock) {
|
|
81
|
+
// $block->name : string - tool name to dispatch on
|
|
82
|
+
// $block->input : array<string,mixed> - parsed JSON input
|
|
83
|
+
// $block->id : string - pass back as toolUseID
|
|
84
|
+
$result = executeYourTool($block->name, $block->input);
|
|
85
|
+
$toolResults[] = [
|
|
86
|
+
'type' => 'tool_result',
|
|
87
|
+
'toolUseID' => $block->id, // camelCase, not tool_use_id
|
|
88
|
+
'content' => $result,
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Append assistant turn + user turn with tool results
|
|
94
|
+
$messages[] = ['role' => 'assistant', 'content' => $response->content];
|
|
95
|
+
$messages[] = ['role' => 'user', 'content' => $toolResults];
|
|
96
|
+
|
|
97
|
+
$response = $client->messages->create(
|
|
98
|
+
model: 'claude-opus-5',
|
|
99
|
+
maxTokens: 16000,
|
|
100
|
+
tools: $tools,
|
|
101
|
+
messages: $messages,
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Final text response
|
|
106
|
+
foreach ($response->content as $block) {
|
|
107
|
+
if ($block->type === 'text') {
|
|
108
|
+
echo $block->text;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`$block->type === 'tool_use'` also works; `instanceof ToolUseBlock` narrows for PHPStan.
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Structured Outputs
|
|
119
|
+
|
|
120
|
+
### Using StructuredOutputModel (Recommended)
|
|
121
|
+
|
|
122
|
+
Define a PHP class implementing `StructuredOutputModel` and pass it as `outputConfig`:
|
|
123
|
+
|
|
124
|
+
```php
|
|
125
|
+
use Anthropic\Lib\Contracts\StructuredOutputModel;
|
|
126
|
+
use Anthropic\Lib\Concerns\StructuredOutputModelTrait;
|
|
127
|
+
use Anthropic\Lib\Attributes\Constrained;
|
|
128
|
+
|
|
129
|
+
class Person implements StructuredOutputModel
|
|
130
|
+
{
|
|
131
|
+
use StructuredOutputModelTrait;
|
|
132
|
+
|
|
133
|
+
#[Constrained(description: 'Full name')]
|
|
134
|
+
public string $name;
|
|
135
|
+
|
|
136
|
+
public int $age;
|
|
137
|
+
|
|
138
|
+
public ?string $email = null; // nullable = optional field
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
$message = $client->messages->create(
|
|
142
|
+
model: 'claude-opus-5',
|
|
143
|
+
maxTokens: 16000,
|
|
144
|
+
messages: [['role' => 'user', 'content' => 'Generate a profile for Alice, age 30']],
|
|
145
|
+
outputConfig: ['format' => Person::class],
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
$person = $message->parsedOutput(); // Person instance
|
|
149
|
+
echo $person->name;
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Types are inferred from PHP type hints. Use `#[Constrained(description: '...')]` to add descriptions. Nullable properties (`?string`) become optional fields.
|
|
153
|
+
|
|
154
|
+
### Raw Schema
|
|
155
|
+
|
|
156
|
+
```php
|
|
157
|
+
$message = $client->messages->create(
|
|
158
|
+
model: 'claude-opus-5',
|
|
159
|
+
maxTokens: 16000,
|
|
160
|
+
messages: [['role' => 'user', 'content' => 'Extract: John (john@co.com), Enterprise plan']],
|
|
161
|
+
outputConfig: [
|
|
162
|
+
'format' => [
|
|
163
|
+
'type' => 'json_schema',
|
|
164
|
+
'schema' => [
|
|
165
|
+
'type' => 'object',
|
|
166
|
+
'properties' => [
|
|
167
|
+
'name' => ['type' => 'string'],
|
|
168
|
+
'email' => ['type' => 'string'],
|
|
169
|
+
'plan' => ['type' => 'string'],
|
|
170
|
+
],
|
|
171
|
+
'required' => ['name', 'email', 'plan'],
|
|
172
|
+
'additionalProperties' => false,
|
|
173
|
+
],
|
|
174
|
+
],
|
|
175
|
+
],
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
// First text block contains valid JSON
|
|
179
|
+
foreach ($message->content as $block) {
|
|
180
|
+
if ($block->type === 'text') {
|
|
181
|
+
$data = json_decode($block->text, true);
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Beta Features & Anthropic-Defined Tools
|
|
190
|
+
|
|
191
|
+
**`betas:` is NOT a param on `$client->messages->create()`** - it only exists on the beta namespace. Use it for features that need an explicit opt-in header:
|
|
192
|
+
|
|
193
|
+
```php
|
|
194
|
+
use Anthropic\Beta\Messages\BetaRequestMCPServerURLDefinition;
|
|
195
|
+
|
|
196
|
+
$response = $client->beta->messages->create(
|
|
197
|
+
model: 'claude-opus-5',
|
|
198
|
+
maxTokens: 16000,
|
|
199
|
+
mcpServers: [
|
|
200
|
+
BetaRequestMCPServerURLDefinition::with(
|
|
201
|
+
name: 'my-server',
|
|
202
|
+
url: 'https://example.com/mcp',
|
|
203
|
+
),
|
|
204
|
+
],
|
|
205
|
+
betas: ['mcp-client-2025-11-20'], // only valid on ->beta->messages
|
|
206
|
+
messages: [['role' => 'user', 'content' => 'Use the MCP tools']],
|
|
207
|
+
);
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Task budgets
|
|
211
|
+
|
|
212
|
+
```php
|
|
213
|
+
$response = $client->beta->messages->create(
|
|
214
|
+
model: 'claude-opus-5',
|
|
215
|
+
maxTokens: 16000,
|
|
216
|
+
outputConfig: ['taskBudget' => ['type' => 'tokens', 'total' => 64000]],
|
|
217
|
+
tools: [...],
|
|
218
|
+
messages: [...],
|
|
219
|
+
betas: ['task-budgets-2026-03-13'],
|
|
220
|
+
);
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Cache diagnostics
|
|
224
|
+
|
|
225
|
+
Pass the previous response's `id` on the next request; print the `diagnostics` object on the response:
|
|
226
|
+
|
|
227
|
+
```php
|
|
228
|
+
$r2 = $client->beta->messages->create(
|
|
229
|
+
model: 'claude-opus-5', maxTokens: 1024,
|
|
230
|
+
diagnostics: ['previousMessageId' => $r1->id],
|
|
231
|
+
betas: ['cache-diagnosis-2026-04-07'],
|
|
232
|
+
messages: [...],
|
|
233
|
+
);
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Anthropic-defined tools** (bash, web_search, text_editor, code_execution) are GA and work on both paths. Of these, web_search and code_execution are server-executed; bash and text_editor are client-executed (you handle the `tool_use` locally) - `Anthropic\Messages\ToolBash20250124` / `WebSearchTool20260209` / `ToolTextEditor20250728` / `CodeExecutionTool20260120` for non-beta, `Anthropic\Beta\Messages\BetaToolBash20250124` / `BetaWebSearchTool20260209` / `BetaToolTextEditor20250728` / `BetaCodeExecutionTool20260120` for beta. No `betas:` header needed for these.
|
|
237
|
+
|
|
238
|
+
### Tool search (non-beta, server-side)
|
|
239
|
+
|
|
240
|
+
```php
|
|
241
|
+
tools: [
|
|
242
|
+
['type' => 'tool_search_tool_regex_20251119', 'name' => 'tool_search_tool_regex'],
|
|
243
|
+
['name' => 'get_weather', 'description' => '...', 'inputSchema' => [...], 'deferLoading' => true],
|
|
244
|
+
// ... other user tools with 'deferLoading' => true
|
|
245
|
+
],
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Memory tool (non-beta, client-executed)
|
|
249
|
+
|
|
250
|
+
Declare `['type' => 'memory_20250818', 'name' => 'memory']`. Handle the `tool_use` by reading/writing files under a fixed `/memories` directory. **Validate every model-supplied path**: resolve to its canonical form and verify it remains within the memory directory; reject traversal (`..`, symlinks) - see `shared/tool-use-concepts.md` § Client-Side Tools.
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
# Managed Agents - PHP
|
|
2
|
+
|
|
3
|
+
> **Bindings not shown here:** This README covers the most common managed-agents flows for PHP. If you need a class, method, namespace, field, or behavior that isn't shown, WebFetch the PHP SDK repo **or the relevant docs page** from `shared/live-sources.md` rather than guess. Do not extrapolate from cURL shapes or another language's SDK.
|
|
4
|
+
|
|
5
|
+
> **Agents are persistent - create once, reference by ID.** Store the agent ID returned by `$client->beta->agents->create` and pass it to every subsequent `->sessions->create`; do not call `agents->create` in the request path. **Recommended:** define agents and environments as version-controlled YAML applied with the `ant` CLI - see `shared/anthropic-cli.md` (its live-docs URL is in `shared/live-sources.md`). The CLI owns the control plane (create/update); your code owns the data plane (sessions with the stored ID). The examples below show in-code creation for when you must provision programmatically; in production the create call belongs in setup, not in the request path.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
composer require "anthropic-ai/sdk" "guzzlehttp/guzzle:^7"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Client Initialization
|
|
14
|
+
|
|
15
|
+
```php
|
|
16
|
+
use Anthropic\Client;
|
|
17
|
+
|
|
18
|
+
// Default (uses ANTHROPIC_API_KEY env var)
|
|
19
|
+
$client = new Client();
|
|
20
|
+
|
|
21
|
+
// Explicit API key
|
|
22
|
+
$client = new Client(apiKey: 'your-api-key');
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Create an Environment
|
|
28
|
+
|
|
29
|
+
```php
|
|
30
|
+
$environment = $client->beta->environments->create(
|
|
31
|
+
name: 'my-dev-env',
|
|
32
|
+
config: ['type' => 'cloud', 'networking' => ['type' => 'unrestricted']],
|
|
33
|
+
);
|
|
34
|
+
echo "Environment ID: {$environment->id}\n"; // env_...
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Create an Agent (required first step)
|
|
40
|
+
|
|
41
|
+
> Warning: **There is no inline agent config.** `model`/`system`/`tools` live on the agent object, not the session. Always start with `$client->beta->agents->create()` - the session takes either `agent: $agent->id` or the typed `BetaManagedAgentsAgentParams::with(type: 'agent', id: $agent->id, version: $agent->version)`.
|
|
42
|
+
|
|
43
|
+
### Minimal
|
|
44
|
+
|
|
45
|
+
```php
|
|
46
|
+
use Anthropic\Beta\Agents\BetaManagedAgentsAgentToolset20260401Params;
|
|
47
|
+
|
|
48
|
+
// 1. Create the agent (reusable, versioned)
|
|
49
|
+
$agent = $client->beta->agents->create(
|
|
50
|
+
name: 'Coding Assistant',
|
|
51
|
+
model: 'claude-opus-5',
|
|
52
|
+
system: 'You are a helpful coding assistant.',
|
|
53
|
+
tools: [
|
|
54
|
+
BetaManagedAgentsAgentToolset20260401Params::with(
|
|
55
|
+
type: 'agent_toolset_20260401',
|
|
56
|
+
),
|
|
57
|
+
],
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
// 2. Start a session
|
|
61
|
+
$session = $client->beta->sessions->create(
|
|
62
|
+
agent: ['type' => 'agent', 'id' => $agent->id, 'version' => $agent->version],
|
|
63
|
+
environmentID: $environment->id,
|
|
64
|
+
title: 'Quickstart session',
|
|
65
|
+
);
|
|
66
|
+
echo "Session ID: {$session->id}\n";
|
|
67
|
+
echo "Trace: https://platform.claude.com/workspaces/default/sessions/{$session->id}\n"; // swap 'default' for your workspace ID if the API key is not in the Default workspace
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Updating an Agent
|
|
71
|
+
|
|
72
|
+
Updates create new versions; the agent object is immutable per version.
|
|
73
|
+
|
|
74
|
+
```php
|
|
75
|
+
$updatedAgent = $client->beta->agents->update(
|
|
76
|
+
$agent->id,
|
|
77
|
+
version: $agent->version,
|
|
78
|
+
system: 'You are a helpful coding agent. Always write tests.',
|
|
79
|
+
);
|
|
80
|
+
echo "New version: {$updatedAgent->version}\n";
|
|
81
|
+
|
|
82
|
+
// List all versions
|
|
83
|
+
foreach ($client->beta->agents->versions->list($agent->id)->pagingEachItem() as $version) {
|
|
84
|
+
echo "Version {$version->version}: {$version->updatedAt->format(DateTimeInterface::ATOM)}\n";
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Archive the agent
|
|
88
|
+
$archived = $client->beta->agents->archive($agent->id);
|
|
89
|
+
echo "Archived at: {$archived->archivedAt->format(DateTimeInterface::ATOM)}\n";
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Send a User Message
|
|
95
|
+
|
|
96
|
+
```php
|
|
97
|
+
$client->beta->sessions->events->send(
|
|
98
|
+
$session->id,
|
|
99
|
+
events: [
|
|
100
|
+
[
|
|
101
|
+
'type' => 'user.message',
|
|
102
|
+
'content' => [['type' => 'text', 'text' => 'Review the auth module']],
|
|
103
|
+
],
|
|
104
|
+
],
|
|
105
|
+
);
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
> Tip: **Stream-first:** Open the stream *before* (or concurrently with) sending the message. The stream only delivers events that occur after it opens - stream-after-send means early events arrive buffered in one batch. See [Steering Patterns](../../shared/managed-agents-events.md#steering-patterns).
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Stream Events (SSE)
|
|
113
|
+
|
|
114
|
+
> Note: **Streaming transporter:** PHP's default buffered PSR-18 client never returns for the open-ended session event stream. Use a streaming Guzzle transporter for `streamStream()` calls - other calls keep the default client.
|
|
115
|
+
|
|
116
|
+
```php
|
|
117
|
+
$streamingClient = new GuzzleHttp\Client(['stream' => true]);
|
|
118
|
+
|
|
119
|
+
// Open the stream first, then send the user message
|
|
120
|
+
$stream = $client->beta->sessions->events->streamStream(
|
|
121
|
+
$session->id,
|
|
122
|
+
requestOptions: ['transporter' => $streamingClient],
|
|
123
|
+
);
|
|
124
|
+
$client->beta->sessions->events->send(
|
|
125
|
+
$session->id,
|
|
126
|
+
events: [
|
|
127
|
+
[
|
|
128
|
+
'type' => 'user.message',
|
|
129
|
+
'content' => [['type' => 'text', 'text' => 'Summarize the repo README']],
|
|
130
|
+
],
|
|
131
|
+
],
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
foreach ($stream as $event) {
|
|
135
|
+
match ($event->type) {
|
|
136
|
+
'agent.message' => array_walk(
|
|
137
|
+
$event->content,
|
|
138
|
+
static fn($block) => $block->type === 'text' ? print($block->text) : null,
|
|
139
|
+
),
|
|
140
|
+
'agent.tool_use' => print("\n[Using tool: {$event->name}]\n"),
|
|
141
|
+
'session.error' => printf("\n[Error: %s]", $event->error?->message ?? 'unknown'),
|
|
142
|
+
default => null,
|
|
143
|
+
};
|
|
144
|
+
if ($event->type === 'session.status_idle' || $event->type === 'session.error') {
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
$stream->close();
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Reconnecting and Tailing
|
|
152
|
+
|
|
153
|
+
When reconnecting mid-session, list past events first to dedupe, then tail live events:
|
|
154
|
+
|
|
155
|
+
```php
|
|
156
|
+
$stream = $client->beta->sessions->events->streamStream(
|
|
157
|
+
$session->id,
|
|
158
|
+
requestOptions: ['transporter' => $streamingClient],
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
// Stream is open and buffering. List history before tailing live.
|
|
162
|
+
$seenEventIds = [];
|
|
163
|
+
foreach ($client->beta->sessions->events->list($session->id)->pagingEachItem() as $event) {
|
|
164
|
+
$seenEventIds[$event->id] = true;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Tail live events, skipping anything already seen
|
|
168
|
+
foreach ($stream as $event) {
|
|
169
|
+
if (isset($seenEventIds[$event->id])) {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
$seenEventIds[$event->id] = true;
|
|
173
|
+
match ($event->type) {
|
|
174
|
+
'agent.message' => array_walk(
|
|
175
|
+
$event->content,
|
|
176
|
+
static fn($block) => $block->type === 'text' ? print($block->text) : null,
|
|
177
|
+
),
|
|
178
|
+
default => null,
|
|
179
|
+
};
|
|
180
|
+
if ($event->type === 'session.status_idle') {
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
$stream->close();
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Provide Custom Tool Result
|
|
190
|
+
|
|
191
|
+
> Note: The PHP managed-agents bindings for `user.custom_tool_result` are not yet documented in this skill or in the apps source examples. Refer to `shared/managed-agents-events.md` for the wire format and the `anthropic-ai/sdk` PHP repository for the corresponding params.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Poll Events
|
|
196
|
+
|
|
197
|
+
```php
|
|
198
|
+
foreach ($client->beta->sessions->events->list($session->id)->pagingEachItem() as $event) {
|
|
199
|
+
echo "{$event->type}: {$event->id}\n";
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Upload a File
|
|
206
|
+
|
|
207
|
+
> Note: **PHP file upload:** The PHP SDK's beta managed-agents file upload binding is not shown in the apps source examples; the canonical PHP example uses raw cURL against `POST /v1/files`. If your codebase prefers the SDK, WebFetch the `anthropic-ai/sdk` PHP repository for the latest binding before writing code.
|
|
208
|
+
|
|
209
|
+
```php
|
|
210
|
+
use Anthropic\Beta\Sessions\BetaManagedAgentsFileResourceParams;
|
|
211
|
+
|
|
212
|
+
// Raw cURL upload (canonical example from the apps source)
|
|
213
|
+
$csvPath = 'data.csv';
|
|
214
|
+
$ch = curl_init('https://api.anthropic.com/v1/files');
|
|
215
|
+
curl_setopt_array($ch, [
|
|
216
|
+
CURLOPT_RETURNTRANSFER => true,
|
|
217
|
+
CURLOPT_POST => true,
|
|
218
|
+
CURLOPT_HTTPHEADER => [
|
|
219
|
+
'x-api-key: ' . getenv('ANTHROPIC_API_KEY'),
|
|
220
|
+
'anthropic-version: 2023-06-01',
|
|
221
|
+
'anthropic-beta: files-api-2025-04-14',
|
|
222
|
+
],
|
|
223
|
+
CURLOPT_POSTFIELDS => ['file' => new CURLFile($csvPath, 'text/csv', 'data.csv')],
|
|
224
|
+
]);
|
|
225
|
+
$file = json_decode(curl_exec($ch));
|
|
226
|
+
echo "File ID: {$file->id}\n";
|
|
227
|
+
|
|
228
|
+
// Mount in a session
|
|
229
|
+
$session = $client->beta->sessions->create(
|
|
230
|
+
agent: $agent->id,
|
|
231
|
+
environmentID: $environment->id,
|
|
232
|
+
resources: [
|
|
233
|
+
BetaManagedAgentsFileResourceParams::with(
|
|
234
|
+
type: 'file',
|
|
235
|
+
fileID: $file->id,
|
|
236
|
+
mountPath: '/workspace/data.csv',
|
|
237
|
+
),
|
|
238
|
+
],
|
|
239
|
+
);
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Add and Manage Resources on an Existing Session
|
|
243
|
+
|
|
244
|
+
```php
|
|
245
|
+
// Attach an additional file to an open session
|
|
246
|
+
$resource = $client->beta->sessions->resources->add(
|
|
247
|
+
$session->id,
|
|
248
|
+
type: 'file',
|
|
249
|
+
fileID: $file->id,
|
|
250
|
+
);
|
|
251
|
+
echo "{$resource->id}\n"; // "sesrsc_01ABC..."
|
|
252
|
+
|
|
253
|
+
// List resources on the session
|
|
254
|
+
$listed = $client->beta->sessions->resources->list($session->id);
|
|
255
|
+
foreach ($listed->data as $entry) {
|
|
256
|
+
echo "{$entry->id} {$entry->type}\n";
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Detach a resource
|
|
260
|
+
$client->beta->sessions->resources->delete($resource->id, sessionID: $session->id);
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## List and Download Session Files
|
|
266
|
+
|
|
267
|
+
```php
|
|
268
|
+
$files = $client->beta->files->list(
|
|
269
|
+
scopeID: 'sesn_abc123',
|
|
270
|
+
betas: ['managed-agents-2026-04-01'],
|
|
271
|
+
);
|
|
272
|
+
$content = $client->beta->files->download($files->data[0]->id);
|
|
273
|
+
file_put_contents('output.txt', $content);
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Session Management
|
|
279
|
+
|
|
280
|
+
```php
|
|
281
|
+
// List environments
|
|
282
|
+
$environments = $client->beta->environments->list();
|
|
283
|
+
|
|
284
|
+
// Retrieve a specific environment
|
|
285
|
+
$env = $client->beta->environments->retrieve($environment->id);
|
|
286
|
+
|
|
287
|
+
// Archive an environment (read-only, existing sessions continue)
|
|
288
|
+
$client->beta->environments->archive($environment->id);
|
|
289
|
+
|
|
290
|
+
// Delete an environment (only if no sessions reference it)
|
|
291
|
+
$client->beta->environments->delete($environment->id);
|
|
292
|
+
|
|
293
|
+
// Delete a session
|
|
294
|
+
$client->beta->sessions->delete($session->id);
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## MCP Server Integration
|
|
300
|
+
|
|
301
|
+
```php
|
|
302
|
+
use Anthropic\Beta\Agents\BetaManagedAgentsAgentToolset20260401Params;
|
|
303
|
+
use Anthropic\Beta\Agents\BetaManagedAgentsMCPToolsetParams;
|
|
304
|
+
use Anthropic\Beta\Agents\BetaManagedAgentsURLMCPServerParams;
|
|
305
|
+
use Anthropic\Beta\Sessions\BetaManagedAgentsAgentParams;
|
|
306
|
+
|
|
307
|
+
// Agent declares MCP server (no auth here - auth goes in a vault)
|
|
308
|
+
$agent = $client->beta->agents->create(
|
|
309
|
+
name: 'GitHub Assistant',
|
|
310
|
+
model: 'claude-opus-5',
|
|
311
|
+
mcpServers: [
|
|
312
|
+
BetaManagedAgentsURLMCPServerParams::with(
|
|
313
|
+
type: 'url',
|
|
314
|
+
name: 'github',
|
|
315
|
+
url: 'https://api.githubcopilot.com/mcp/',
|
|
316
|
+
),
|
|
317
|
+
],
|
|
318
|
+
tools: [
|
|
319
|
+
BetaManagedAgentsAgentToolset20260401Params::with(type: 'agent_toolset_20260401'),
|
|
320
|
+
BetaManagedAgentsMCPToolsetParams::with(
|
|
321
|
+
type: 'mcp_toolset',
|
|
322
|
+
mcpServerName: 'github',
|
|
323
|
+
),
|
|
324
|
+
],
|
|
325
|
+
);
|
|
326
|
+
|
|
327
|
+
// Session attaches vault(s) containing credentials for those MCP server URLs
|
|
328
|
+
$session = $client->beta->sessions->create(
|
|
329
|
+
agent: BetaManagedAgentsAgentParams::with(
|
|
330
|
+
type: 'agent',
|
|
331
|
+
id: $agent->id,
|
|
332
|
+
version: $agent->version,
|
|
333
|
+
),
|
|
334
|
+
environmentID: $environment->id,
|
|
335
|
+
vaultIDs: [$vault->id],
|
|
336
|
+
);
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
See `shared/managed-agents-tools.md` §Vaults for creating vaults and adding credentials.
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## Vaults
|
|
344
|
+
|
|
345
|
+
```php
|
|
346
|
+
// Create a vault
|
|
347
|
+
$vault = $client->beta->vaults->create(
|
|
348
|
+
displayName: 'Alice',
|
|
349
|
+
metadata: ['external_user_id' => 'usr_abc123'],
|
|
350
|
+
);
|
|
351
|
+
echo $vault->id . "\n"; // "vlt_01ABC..."
|
|
352
|
+
|
|
353
|
+
// Add an OAuth credential
|
|
354
|
+
$credential = $client->beta->vaults->credentials->create(
|
|
355
|
+
vaultID: $vault->id,
|
|
356
|
+
displayName: "Alice's Slack",
|
|
357
|
+
auth: [
|
|
358
|
+
'type' => 'mcp_oauth',
|
|
359
|
+
'mcp_server_url' => 'https://mcp.slack.com/mcp',
|
|
360
|
+
'access_token' => 'xoxp-...',
|
|
361
|
+
'expires_at' => '2026-04-15T00:00:00Z',
|
|
362
|
+
'refresh' => [
|
|
363
|
+
'token_endpoint' => 'https://slack.com/api/oauth.v2.access',
|
|
364
|
+
'client_id' => '1234567890.0987654321',
|
|
365
|
+
'scope' => 'channels:read chat:write',
|
|
366
|
+
'refresh_token' => 'xoxe-1-...',
|
|
367
|
+
'token_endpoint_auth' => [
|
|
368
|
+
'type' => 'client_secret_post',
|
|
369
|
+
'client_secret' => 'abc123...',
|
|
370
|
+
],
|
|
371
|
+
],
|
|
372
|
+
],
|
|
373
|
+
);
|
|
374
|
+
|
|
375
|
+
// Rotate the credential (e.g., after a token refresh)
|
|
376
|
+
$client->beta->vaults->credentials->update(
|
|
377
|
+
$credential->id,
|
|
378
|
+
vaultID: $vault->id,
|
|
379
|
+
auth: [
|
|
380
|
+
'type' => 'mcp_oauth',
|
|
381
|
+
'access_token' => 'xoxp-new-...',
|
|
382
|
+
'expires_at' => '2026-05-15T00:00:00Z',
|
|
383
|
+
'refresh' => ['refresh_token' => 'xoxe-1-new-...'],
|
|
384
|
+
],
|
|
385
|
+
);
|
|
386
|
+
|
|
387
|
+
// Archive a vault
|
|
388
|
+
$client->beta->vaults->archive($vault->id);
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
## GitHub Repository Integration
|
|
394
|
+
|
|
395
|
+
Mount a GitHub repository as a session resource (a vault holds the GitHub MCP credential):
|
|
396
|
+
|
|
397
|
+
```php
|
|
398
|
+
$session = $client->beta->sessions->create(
|
|
399
|
+
agent: $agent->id,
|
|
400
|
+
environmentID: $environment->id,
|
|
401
|
+
vaultIDs: [$vault->id],
|
|
402
|
+
resources: [
|
|
403
|
+
[
|
|
404
|
+
'type' => 'github_repository',
|
|
405
|
+
'url' => 'https://github.com/org/repo',
|
|
406
|
+
'mount_path' => '/workspace/repo',
|
|
407
|
+
'authorization_token' => 'ghp_your_github_token',
|
|
408
|
+
],
|
|
409
|
+
],
|
|
410
|
+
);
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
Multiple repositories on the same session:
|
|
414
|
+
|
|
415
|
+
```php
|
|
416
|
+
$resources = [
|
|
417
|
+
[
|
|
418
|
+
'type' => 'github_repository',
|
|
419
|
+
'url' => 'https://github.com/org/frontend',
|
|
420
|
+
'mount_path' => '/workspace/frontend',
|
|
421
|
+
'authorization_token' => 'ghp_your_github_token',
|
|
422
|
+
],
|
|
423
|
+
[
|
|
424
|
+
'type' => 'github_repository',
|
|
425
|
+
'url' => 'https://github.com/org/backend',
|
|
426
|
+
'mount_path' => '/workspace/backend',
|
|
427
|
+
'authorization_token' => 'ghp_your_github_token',
|
|
428
|
+
],
|
|
429
|
+
];
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
Rotating a repository's authorization token:
|
|
433
|
+
|
|
434
|
+
```php
|
|
435
|
+
$listed = $client->beta->sessions->resources->list($session->id);
|
|
436
|
+
$repoResourceId = $listed->data[0]->id;
|
|
437
|
+
|
|
438
|
+
$client->beta->sessions->resources->update(
|
|
439
|
+
$repoResourceId,
|
|
440
|
+
sessionID: $session->id,
|
|
441
|
+
authorizationToken: 'ghp_your_new_github_token',
|
|
442
|
+
);
|
|
443
|
+
```
|