claudecode-omc 5.6.5 → 5.6.7
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/.local/commands/code-review.md +416 -0
- package/.local/commands/pr.md +250 -0
- package/.local/commands/prp-pr.md +244 -0
- package/.local/guidelines/CLAUDE.md +47 -0
- package/.local/skills/h5-to-swiftui/SKILL.md +201 -0
- package/.local/skills/h5-to-swiftui/assets/calibration/README.md +176 -0
- package/.local/skills/h5-to-swiftui/assets/calibration/h5-twin/index.html +52 -0
- package/.local/skills/h5-to-swiftui/assets/calibration/h5-twin/style.css +133 -0
- package/.local/skills/h5-to-swiftui/assets/calibration/swiftui-twin/Package.swift +26 -0
- package/.local/skills/h5-to-swiftui/assets/calibration/swiftui-twin/Sources/CalibrationScreen/CalibrationScreen.swift +142 -0
- package/.local/skills/h5-to-swiftui/assets/calibration/swiftui-twin-divergent/Package.swift +32 -0
- package/.local/skills/h5-to-swiftui/assets/calibration/swiftui-twin-divergent/Sources/CalibrationScreenDivergent/CalibrationScreenDivergent.swift +122 -0
- package/.local/skills/h5-to-swiftui/assets/calibration/tokens.json +42 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/index.html +14 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/package.json +20 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/public/api/articles/001.json +96 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/public/api/articles/index.json +89 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/App.jsx +22 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/App.module.css +11 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/components/ArticleCard.jsx +53 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/components/ArticleCard.module.css +139 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/components/NavBar.jsx +37 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/components/NavBar.module.css +72 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/components/TagCloud.jsx +30 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/components/TagCloud.module.css +50 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/components/TrendChart.jsx +159 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/components/TrendChart.module.css +21 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/main.jsx +12 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/screens/ArticleScreen.jsx +182 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/screens/ArticleScreen.module.css +294 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/screens/FeedScreen.jsx +147 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/screens/FeedScreen.module.css +161 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/styles/global.css +50 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/src/styles/tokens.css +103 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-react/vite.config.js +6 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-vanilla/data/tasks.js +67 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-vanilla/index.html +26 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-vanilla/router.js +73 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-vanilla/screens/detail.js +164 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-vanilla/screens/home.js +53 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-vanilla/screens/list.js +87 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-vanilla/styles/app.css +342 -0
- package/.local/skills/h5-to-swiftui/assets/sample-h5-vanilla/styles/tokens.css +68 -0
- package/.local/skills/h5-to-swiftui/references/css-to-swiftui-map.md +205 -0
- package/.local/skills/h5-to-swiftui/references/design-token-extraction.md +209 -0
- package/.local/skills/h5-to-swiftui/references/high-risk-triage.md +209 -0
- package/.local/skills/h5-to-swiftui/references/render-equivalence-calibration.md +193 -0
- package/.local/skills/h5-to-swiftui/references/stack-detection.md +160 -0
- package/.local/skills/h5-to-swiftui/references/visual-diff-loop-protocol.md +365 -0
- package/.local/skills/h5-to-swiftui/scripts/_calib-consts.mjs +150 -0
- package/.local/skills/h5-to-swiftui/scripts/_imglib.mjs +547 -0
- package/.local/skills/h5-to-swiftui/scripts/_provenance.mjs +123 -0
- package/.local/skills/h5-to-swiftui/scripts/calibrate-render.mjs +625 -0
- package/.local/skills/h5-to-swiftui/scripts/capture-reference.mjs +386 -0
- package/.local/skills/h5-to-swiftui/scripts/detect-stack.mjs +305 -0
- package/.local/skills/h5-to-swiftui/scripts/evaluate-convergence.mjs +1093 -0
- package/.local/skills/h5-to-swiftui/scripts/extract-tokens.mjs +600 -0
- package/.local/skills/h5-to-swiftui/scripts/mark-overlay.mjs +379 -0
- package/.local/skills/h5-to-swiftui/scripts/pixel-diff.mjs +530 -0
- package/.local/skills/h5-to-swiftui/scripts/sim-screenshot.sh +544 -0
- package/bundled/manifest.json +4 -4
- package/bundled/upstream/anthropic-skills/skills/algorithmic-art/LICENSE.txt +1 -1
- package/bundled/upstream/anthropic-skills/skills/brand-guidelines/LICENSE.txt +1 -1
- package/bundled/upstream/anthropic-skills/skills/canvas-design/LICENSE.txt +1 -1
- package/bundled/upstream/anthropic-skills/skills/claude-api/LICENSE.txt +1 -1
- package/bundled/upstream/anthropic-skills/skills/claude-api/SKILL.md +120 -58
- package/bundled/upstream/anthropic-skills/skills/claude-api/curl/examples.md +9 -9
- package/bundled/upstream/anthropic-skills/skills/claude-api/curl/managed-agents.md +336 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/go/managed-agents/README.md +561 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/java/claude-api.md +2 -2
- package/bundled/upstream/anthropic-skills/skills/claude-api/java/managed-agents/README.md +442 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/php/claude-api.md +10 -10
- package/bundled/upstream/anthropic-skills/skills/claude-api/php/managed-agents/README.md +435 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/README.md +16 -16
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/batches.md +3 -3
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/files-api.md +3 -3
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/streaming.md +7 -7
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/tool-use.md +19 -19
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/managed-agents/README.md +332 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/ruby/claude-api.md +4 -4
- package/bundled/upstream/anthropic-skills/skills/claude-api/ruby/managed-agents/README.md +389 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/agent-design.md +101 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/error-codes.md +11 -4
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/live-sources.md +60 -48
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-api-reference.md +372 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-client-patterns.md +209 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-core.md +220 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-environments.md +211 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-events.md +195 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-memory.md +197 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-multiagent.md +99 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-onboarding.md +114 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-outcomes.md +106 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-overview.md +67 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-tools.md +315 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-webhooks.md +110 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/model-migration.md +779 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/models.md +16 -14
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/prompt-caching.md +45 -2
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/tool-use-concepts.md +28 -6
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/README.md +15 -15
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/batches.md +2 -2
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/files-api.md +1 -1
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/streaming.md +5 -5
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/tool-use.md +15 -15
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/managed-agents/README.md +359 -0
- package/bundled/upstream/anthropic-skills/skills/internal-comms/LICENSE.txt +1 -1
- package/bundled/upstream/anthropic-skills/skills/mcp-builder/LICENSE.txt +1 -1
- package/bundled/upstream/anthropic-skills/skills/skill-creator/LICENSE.txt +1 -1
- package/bundled/upstream/anthropic-skills/skills/slack-gif-creator/LICENSE.txt +1 -1
- package/bundled/upstream/anthropic-skills/skills/theme-factory/LICENSE.txt +1 -1
- package/bundled/upstream/anthropic-skills/skills/web-artifacts-builder/LICENSE.txt +1 -1
- package/bundled/upstream/anthropic-skills/skills/webapp-testing/LICENSE.txt +1 -1
- package/bundled/upstream/ecc/.omc-source/bundle.json +2 -3
- package/bundled/upstream/ecc/.omc-source/manifests/.claude-plugin/marketplace.json +4 -4
- package/bundled/upstream/ecc/agents/a11y-architect.md +10 -2
- package/bundled/upstream/ecc/agents/architect.md +9 -0
- package/bundled/upstream/ecc/agents/build-error-resolver.md +9 -0
- package/bundled/upstream/ecc/agents/chief-of-staff.md +9 -0
- package/bundled/upstream/ecc/agents/code-architect.md +9 -0
- package/bundled/upstream/ecc/agents/code-explorer.md +10 -1
- package/bundled/upstream/ecc/agents/code-reviewer.md +87 -1
- package/bundled/upstream/ecc/agents/code-simplifier.md +9 -0
- package/bundled/upstream/ecc/agents/comment-analyzer.md +10 -1
- package/bundled/upstream/ecc/agents/conversation-analyzer.md +9 -0
- package/bundled/upstream/ecc/agents/cpp-build-resolver.md +9 -0
- package/bundled/upstream/ecc/agents/cpp-reviewer.md +9 -0
- package/bundled/upstream/ecc/agents/csharp-reviewer.md +9 -0
- package/bundled/upstream/ecc/agents/dart-build-resolver.md +9 -0
- package/bundled/upstream/ecc/agents/database-reviewer.md +9 -0
- package/bundled/upstream/ecc/agents/django-build-resolver.md +252 -0
- package/bundled/upstream/ecc/agents/django-reviewer.md +169 -0
- package/bundled/upstream/ecc/agents/doc-updater.md +9 -0
- package/bundled/upstream/ecc/agents/docs-lookup.md +9 -0
- package/bundled/upstream/ecc/agents/e2e-runner.md +9 -0
- package/bundled/upstream/ecc/agents/fastapi-reviewer.md +79 -0
- package/bundled/upstream/ecc/agents/flutter-reviewer.md +9 -0
- package/bundled/upstream/ecc/agents/fsharp-reviewer.md +109 -0
- package/bundled/upstream/ecc/agents/gan-evaluator.md +9 -0
- package/bundled/upstream/ecc/agents/gan-generator.md +9 -0
- package/bundled/upstream/ecc/agents/gan-planner.md +9 -0
- package/bundled/upstream/ecc/agents/go-build-resolver.md +9 -0
- package/bundled/upstream/ecc/agents/go-reviewer.md +9 -0
- package/bundled/upstream/ecc/agents/harmonyos-app-resolver.md +182 -0
- package/bundled/upstream/ecc/agents/harness-optimizer.md +9 -0
- package/bundled/upstream/ecc/agents/healthcare-reviewer.md +9 -0
- package/bundled/upstream/ecc/agents/homelab-architect.md +107 -0
- package/bundled/upstream/ecc/agents/java-build-resolver.md +133 -11
- package/bundled/upstream/ecc/agents/java-reviewer.md +130 -32
- package/bundled/upstream/ecc/agents/kotlin-build-resolver.md +9 -0
- package/bundled/upstream/ecc/agents/kotlin-reviewer.md +9 -0
- package/bundled/upstream/ecc/agents/loop-operator.md +9 -0
- package/bundled/upstream/ecc/agents/mle-reviewer.md +162 -0
- package/bundled/upstream/ecc/agents/network-architect.md +106 -0
- package/bundled/upstream/ecc/agents/network-config-reviewer.md +106 -0
- package/bundled/upstream/ecc/agents/network-troubleshooter.md +128 -0
- package/bundled/upstream/ecc/agents/opensource-forker.md +9 -0
- package/bundled/upstream/ecc/agents/opensource-packager.md +9 -0
- package/bundled/upstream/ecc/agents/opensource-sanitizer.md +9 -0
- package/bundled/upstream/ecc/agents/performance-optimizer.md +9 -0
- package/bundled/upstream/ecc/agents/planner.md +9 -0
- package/bundled/upstream/ecc/agents/pr-test-analyzer.md +9 -0
- package/bundled/upstream/ecc/agents/python-reviewer.md +9 -0
- package/bundled/upstream/ecc/agents/pytorch-build-resolver.md +12 -3
- package/bundled/upstream/ecc/agents/refactor-cleaner.md +9 -0
- package/bundled/upstream/ecc/agents/rust-build-resolver.md +9 -0
- package/bundled/upstream/ecc/agents/rust-reviewer.md +9 -0
- package/bundled/upstream/ecc/agents/security-reviewer.md +9 -0
- package/bundled/upstream/ecc/agents/seo-specialist.md +10 -1
- package/bundled/upstream/ecc/agents/silent-failure-hunter.md +9 -0
- package/bundled/upstream/ecc/agents/swift-build-resolver.md +170 -0
- package/bundled/upstream/ecc/agents/swift-reviewer.md +116 -0
- package/bundled/upstream/ecc/agents/tdd-guide.md +9 -0
- package/bundled/upstream/ecc/agents/type-design-analyzer.md +10 -1
- package/bundled/upstream/ecc/agents/typescript-reviewer.md +9 -0
- package/bundled/upstream/ecc/commands/auto-update.md +28 -0
- package/bundled/upstream/ecc/commands/build-fix.md +4 -0
- package/bundled/upstream/ecc/commands/checkpoint.md +4 -0
- package/bundled/upstream/ecc/commands/code-review.md +3 -3
- package/bundled/upstream/ecc/commands/cost-report.md +107 -0
- package/bundled/upstream/ecc/commands/cpp-build.md +1 -1
- package/bundled/upstream/ecc/commands/cpp-test.md +1 -1
- package/bundled/upstream/ecc/commands/ecc-guide.md +93 -0
- package/bundled/upstream/ecc/commands/fastapi-review.md +39 -0
- package/bundled/upstream/ecc/commands/flutter-build.md +1 -1
- package/bundled/upstream/ecc/commands/flutter-test.md +1 -1
- package/bundled/upstream/ecc/commands/gan-build.md +4 -0
- package/bundled/upstream/ecc/commands/gan-design.md +4 -0
- package/bundled/upstream/ecc/commands/go-build.md +1 -1
- package/bundled/upstream/ecc/commands/go-test.md +1 -1
- package/bundled/upstream/ecc/commands/harness-audit.md +4 -0
- package/bundled/upstream/ecc/commands/jira.md +2 -2
- package/bundled/upstream/ecc/commands/kotlin-build.md +1 -1
- package/bundled/upstream/ecc/commands/kotlin-test.md +1 -1
- package/bundled/upstream/ecc/commands/learn.md +4 -0
- package/bundled/upstream/ecc/commands/loop-start.md +4 -0
- package/bundled/upstream/ecc/commands/loop-status.md +54 -1
- package/bundled/upstream/ecc/commands/model-route.md +4 -0
- package/bundled/upstream/ecc/commands/multi-backend.md +4 -0
- package/bundled/upstream/ecc/commands/multi-execute.md +4 -0
- package/bundled/upstream/ecc/commands/multi-frontend.md +4 -0
- package/bundled/upstream/ecc/commands/multi-plan.md +4 -0
- package/bundled/upstream/ecc/commands/multi-workflow.md +4 -0
- package/bundled/upstream/ecc/commands/plan-prd.md +160 -0
- package/bundled/upstream/ecc/commands/plan.md +96 -13
- package/bundled/upstream/ecc/commands/pm2.md +4 -0
- package/bundled/upstream/ecc/commands/pr.md +184 -0
- package/bundled/upstream/ecc/commands/project-init.md +86 -0
- package/bundled/upstream/ecc/commands/python-review.md +1 -1
- package/bundled/upstream/ecc/commands/quality-gate.md +4 -0
- package/bundled/upstream/ecc/commands/refactor-clean.md +4 -0
- package/bundled/upstream/ecc/commands/rust-build.md +1 -1
- package/bundled/upstream/ecc/commands/rust-test.md +1 -1
- package/bundled/upstream/ecc/commands/security-scan.md +92 -0
- package/bundled/upstream/ecc/commands/sessions.md +6 -6
- package/bundled/upstream/ecc/commands/skill-health.md +3 -3
- package/bundled/upstream/ecc/commands/test-coverage.md +4 -0
- package/bundled/upstream/ecc/commands/update-codemaps.md +4 -0
- package/bundled/upstream/ecc/commands/update-docs.md +4 -0
- package/bundled/upstream/ecc/skills/accessibility/SKILL.md +1 -1
- package/bundled/upstream/ecc/skills/agent-architecture-audit/SKILL.md +256 -0
- package/bundled/upstream/ecc/skills/agent-payment-x402/SKILL.md +49 -3
- package/bundled/upstream/ecc/skills/agentic-os/SKILL.md +387 -0
- package/bundled/upstream/ecc/skills/angular-developer/SKILL.md +154 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/angular-animations.md +160 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/angular-aria.md +410 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/cli.md +86 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/component-harnesses.md +59 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/component-styling.md +91 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/components.md +117 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/creating-services.md +97 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/data-resolvers.md +69 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/define-routes.md +67 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/defining-providers.md +72 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/di-fundamentals.md +120 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/e2e-testing.md +56 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/effects.md +83 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/hierarchical-injectors.md +43 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/host-elements.md +80 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/injection-context.md +63 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/inputs.md +101 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/linked-signal.md +59 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/loading-strategies.md +61 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/mcp.md +108 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/navigate-to-routes.md +69 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/outputs.md +86 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/reactive-forms.md +122 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/rendering-strategies.md +44 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/resource.md +77 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/route-animations.md +56 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/route-guards.md +52 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/router-lifecycle.md +45 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/router-testing.md +87 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/show-routes-with-outlets.md +68 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/signal-forms.md +795 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/signals-overview.md +94 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/tailwind-css.md +69 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/template-driven-forms.md +114 -0
- package/bundled/upstream/ecc/skills/angular-developer/references/testing-fundamentals.md +65 -0
- package/bundled/upstream/ecc/skills/autonomous-agent-harness/SKILL.md +6 -0
- package/bundled/upstream/ecc/skills/backend-patterns/SKILL.md +8 -45
- package/bundled/upstream/ecc/skills/cisco-ios-patterns/SKILL.md +163 -0
- package/bundled/upstream/ecc/skills/configure-ecc/SKILL.md +31 -14
- package/bundled/upstream/ecc/skills/continuous-learning/SKILL.md +10 -2
- package/bundled/upstream/ecc/skills/continuous-learning-v2/SKILL.md +19 -5
- package/bundled/upstream/ecc/skills/continuous-learning-v2/agents/observer-loop.sh +44 -4
- package/bundled/upstream/ecc/skills/continuous-learning-v2/agents/observer.md +4 -4
- package/bundled/upstream/ecc/skills/continuous-learning-v2/agents/start-observer.sh +5 -1
- package/bundled/upstream/ecc/skills/continuous-learning-v2/hooks/observe.sh +21 -5
- package/bundled/upstream/ecc/skills/continuous-learning-v2/scripts/detect-project.sh +58 -13
- package/bundled/upstream/ecc/skills/continuous-learning-v2/scripts/instinct-cli.py +97 -4
- package/bundled/upstream/ecc/skills/continuous-learning-v2/scripts/lib/homunculus-dir.sh +31 -0
- package/bundled/upstream/ecc/skills/continuous-learning-v2/scripts/migrate-homunculus.sh +62 -0
- package/bundled/upstream/ecc/skills/continuous-learning-v2/scripts/test_parse_instinct.py +34 -0
- package/bundled/upstream/ecc/skills/cost-tracking/SKILL.md +147 -0
- package/bundled/upstream/ecc/skills/deep-research/SKILL.md +4 -0
- package/bundled/upstream/ecc/skills/defi-amm-security/SKILL.md +6 -0
- package/bundled/upstream/ecc/skills/django-celery/SKILL.md +457 -0
- package/bundled/upstream/ecc/skills/ecc-guide/SKILL.md +189 -0
- package/bundled/upstream/ecc/skills/error-handling/SKILL.md +376 -0
- package/bundled/upstream/ecc/skills/exa-search/SKILL.md +4 -0
- package/bundled/upstream/ecc/skills/fal-ai-media/SKILL.md +4 -0
- package/bundled/upstream/ecc/skills/fastapi-patterns/SKILL.md +327 -0
- package/bundled/upstream/ecc/skills/flox-environments/SKILL.md +496 -0
- package/bundled/upstream/ecc/skills/frontend-design-direction/SKILL.md +92 -0
- package/bundled/upstream/ecc/skills/frontend-slides/animation-patterns.md +122 -0
- package/bundled/upstream/ecc/skills/frontend-slides/html-template.md +419 -0
- package/bundled/upstream/ecc/skills/frontend-slides/scripts/export-pdf.sh +418 -0
- package/bundled/upstream/ecc/skills/frontend-slides/scripts/extract-pptx.py +96 -0
- package/bundled/upstream/ecc/skills/frontend-slides/viewport-base.css +153 -0
- package/bundled/upstream/ecc/skills/fsharp-testing/SKILL.md +280 -0
- package/bundled/upstream/ecc/skills/gateguard/SKILL.md +4 -0
- package/bundled/upstream/ecc/skills/hermes-imports/SKILL.md +88 -0
- package/bundled/upstream/ecc/skills/homelab-network-readiness/SKILL.md +169 -0
- package/bundled/upstream/ecc/skills/homelab-network-setup/SKILL.md +129 -0
- package/bundled/upstream/ecc/skills/homelab-pihole-dns/SKILL.md +274 -0
- package/bundled/upstream/ecc/skills/homelab-vlan-segmentation/SKILL.md +311 -0
- package/bundled/upstream/ecc/skills/homelab-wireguard-vpn/SKILL.md +305 -0
- package/bundled/upstream/ecc/skills/ios-icon-gen/SKILL.md +157 -0
- package/bundled/upstream/ecc/skills/ios-icon-gen/scripts/generate_icons.swift +258 -0
- package/bundled/upstream/ecc/skills/ios-icon-gen/scripts/iconify_gen.sh +235 -0
- package/bundled/upstream/ecc/skills/java-coding-standards/SKILL.md +241 -5
- package/bundled/upstream/ecc/skills/make-interfaces-feel-better/SKILL.md +151 -0
- package/bundled/upstream/ecc/skills/mle-workflow/SKILL.md +346 -0
- package/bundled/upstream/ecc/skills/motion-advanced/SKILL.md +596 -0
- package/bundled/upstream/ecc/skills/motion-foundations/SKILL.md +299 -0
- package/bundled/upstream/ecc/skills/motion-patterns/SKILL.md +435 -0
- package/bundled/upstream/ecc/skills/motion-ui/SKILL.md +575 -0
- package/bundled/upstream/ecc/skills/mysql-patterns/SKILL.md +412 -0
- package/bundled/upstream/ecc/skills/netmiko-ssh-automation/SKILL.md +173 -0
- package/bundled/upstream/ecc/skills/network-bgp-diagnostics/SKILL.md +167 -0
- package/bundled/upstream/ecc/skills/network-config-validation/SKILL.md +210 -0
- package/bundled/upstream/ecc/skills/network-interface-health/SKILL.md +152 -0
- package/bundled/upstream/ecc/skills/openclaw-persona-forge/SKILL.md +1 -9
- package/bundled/upstream/ecc/skills/plan-orchestrate/SKILL.md +262 -0
- package/bundled/upstream/ecc/skills/prisma-patterns/SKILL.md +371 -0
- package/bundled/upstream/ecc/skills/production-audit/SKILL.md +206 -0
- package/bundled/upstream/ecc/skills/prompt-optimizer/SKILL.md +24 -400
- package/bundled/upstream/ecc/skills/quarkus-patterns/SKILL.md +722 -0
- package/bundled/upstream/ecc/skills/quarkus-security/SKILL.md +467 -0
- package/bundled/upstream/ecc/skills/quarkus-tdd/SKILL.md +811 -0
- package/bundled/upstream/ecc/skills/quarkus-verification/SKILL.md +479 -0
- package/bundled/upstream/ecc/skills/redis-patterns/SKILL.md +403 -0
- package/bundled/upstream/ecc/skills/scientific-db-pubmed-database/SKILL.md +175 -0
- package/bundled/upstream/ecc/skills/scientific-db-uspto-database/SKILL.md +177 -0
- package/bundled/upstream/ecc/skills/scientific-pkg-gget/SKILL.md +166 -0
- package/bundled/upstream/ecc/skills/scientific-thinking-literature-review/SKILL.md +192 -0
- package/bundled/upstream/ecc/skills/scientific-thinking-scholar-evaluation/SKILL.md +160 -0
- package/bundled/upstream/ecc/skills/search-first/SKILL.md +23 -2
- package/bundled/upstream/ecc/skills/security-review/SKILL.md +10 -2
- package/bundled/upstream/ecc/skills/skill-comply/scripts/runner.py +28 -3
- package/bundled/upstream/ecc/skills/skill-comply/tests/test_runner.py +172 -0
- package/bundled/upstream/ecc/skills/skill-scout/SKILL.md +140 -0
- package/bundled/upstream/ecc/skills/skill-stocktake/SKILL.md +1 -0
- package/bundled/upstream/ecc/skills/strategic-compact/SKILL.md +2 -2
- package/bundled/upstream/ecc/skills/tinystruct-patterns/SKILL.md +203 -0
- package/bundled/upstream/ecc/skills/tinystruct-patterns/references/architecture.md +90 -0
- package/bundled/upstream/ecc/skills/tinystruct-patterns/references/data-handling.md +60 -0
- package/bundled/upstream/ecc/skills/tinystruct-patterns/references/database.md +99 -0
- package/bundled/upstream/ecc/skills/tinystruct-patterns/references/routing.md +64 -0
- package/bundled/upstream/ecc/skills/tinystruct-patterns/references/system-usage.md +97 -0
- package/bundled/upstream/ecc/skills/tinystruct-patterns/references/testing.md +72 -0
- package/bundled/upstream/ecc/skills/ui-to-vue/SKILL.md +134 -0
- package/bundled/upstream/ecc/skills/vite-patterns/SKILL.md +449 -0
- package/bundled/upstream/ecc/skills/windows-desktop-e2e/SKILL.md +788 -0
- package/bundled/upstream/ecc/skills/x-api/SKILL.md +4 -0
- package/bundled/upstream/oh-my-claudecode/.omc-source/bundle.json +20 -0
- package/bundled/upstream/oh-my-claudecode/agents/analyst.md +2 -1
- package/bundled/upstream/oh-my-claudecode/agents/architect.md +2 -1
- package/bundled/upstream/oh-my-claudecode/agents/code-reviewer.md +26 -7
- package/bundled/upstream/oh-my-claudecode/agents/critic.md +2 -1
- package/bundled/upstream/oh-my-claudecode/agents/debugger.md +2 -1
- package/bundled/upstream/oh-my-claudecode/agents/designer.md +14 -1
- package/bundled/upstream/oh-my-claudecode/agents/document-specialist.md +1 -1
- package/bundled/upstream/oh-my-claudecode/agents/executor.md +2 -1
- package/bundled/upstream/oh-my-claudecode/agents/explore.md +2 -1
- package/bundled/upstream/oh-my-claudecode/agents/git-master.md +2 -1
- package/bundled/upstream/oh-my-claudecode/agents/planner.md +2 -1
- package/bundled/upstream/oh-my-claudecode/agents/qa-tester.md +2 -1
- package/bundled/upstream/oh-my-claudecode/agents/scientist.md +2 -1
- package/bundled/upstream/oh-my-claudecode/agents/security-reviewer.md +2 -1
- package/bundled/upstream/oh-my-claudecode/agents/test-engineer.md +2 -1
- package/bundled/upstream/oh-my-claudecode/agents/tracer.md +2 -1
- package/bundled/upstream/oh-my-claudecode/agents/verifier.md +2 -1
- package/bundled/upstream/oh-my-claudecode/agents/writer.md +2 -1
- package/bundled/upstream/oh-my-claudecode/skills/AGENTS.md +4 -3
- package/bundled/upstream/oh-my-claudecode/skills/ai-slop-cleaner/SKILL.md +12 -0
- package/bundled/upstream/oh-my-claudecode/skills/deep-dive/SKILL.md +69 -13
- package/bundled/upstream/oh-my-claudecode/skills/deep-interview/SKILL.md +176 -63
- package/bundled/upstream/oh-my-claudecode/skills/learner/SKILL.md +3 -1
- package/bundled/upstream/oh-my-claudecode/skills/omc-doctor/SKILL.md +22 -3
- package/bundled/upstream/oh-my-claudecode/skills/omc-reference/SKILL.md +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/omc-setup/phases/01-install-claude-md.md +2 -2
- package/bundled/upstream/oh-my-claudecode/skills/omc-setup/phases/02-configure.md +45 -2
- package/bundled/upstream/oh-my-claudecode/skills/omc-setup/phases/03-integrations.md +46 -5
- package/bundled/upstream/oh-my-claudecode/skills/plan/SKILL.md +19 -17
- package/bundled/upstream/oh-my-claudecode/skills/project-session-manager/lib/config.sh +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/project-session-manager/lib/parse.sh +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/project-session-manager/lib/providers/azure-devops.sh +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/project-session-manager/lib/providers/bitbucket.sh +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/project-session-manager/lib/providers/gitea.sh +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/project-session-manager/lib/providers/github.sh +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/project-session-manager/lib/providers/gitlab.sh +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/project-session-manager/lib/providers/interface.sh +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/project-session-manager/lib/providers/jira.sh +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/project-session-manager/lib/session.sh +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/project-session-manager/lib/tmux.sh +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/project-session-manager/lib/worktree.sh +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/project-session-manager/psm.sh +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/project-session-manager/tests/test-psm-prompt-injection.sh +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/ralph/SKILL.md +8 -8
- package/bundled/upstream/oh-my-claudecode/skills/ralplan/SKILL.md +9 -5
- package/bundled/upstream/oh-my-claudecode/skills/skill/SKILL.md +6 -6
- package/bundled/upstream/oh-my-claudecode/skills/skillify/SKILL.md +19 -3
- package/bundled/upstream/oh-my-claudecode/skills/trace/SKILL.md +3 -1
- package/bundled/upstream/oh-my-claudecode/skills/ultrawork/SKILL.md +20 -7
- package/bundled/upstream/superpowers/.omc-source/bundle.json +21 -0
- package/bundled/upstream/superpowers/hooks/hooks-cursor.json +1 -1
- package/bundled/upstream/superpowers/skills/executing-plans/SKILL.md +1 -1
- package/bundled/upstream/superpowers/skills/finishing-a-development-branch/SKILL.md +93 -42
- package/bundled/upstream/superpowers/skills/requesting-code-review/SKILL.md +7 -9
- package/bundled/upstream/superpowers/skills/requesting-code-review/code-reviewer.md +107 -85
- package/bundled/upstream/superpowers/skills/subagent-driven-development/SKILL.md +3 -1
- package/bundled/upstream/superpowers/skills/subagent-driven-development/code-quality-reviewer-prompt.md +2 -3
- package/bundled/upstream/superpowers/skills/systematic-debugging/CREATION-LOG.md +1 -1
- package/bundled/upstream/superpowers/skills/systematic-debugging/root-cause-tracing.md +1 -1
- package/bundled/upstream/superpowers/skills/using-git-worktrees/SKILL.md +95 -98
- package/bundled/upstream/superpowers/skills/using-superpowers/references/codex-tools.md +7 -48
- package/bundled/upstream/superpowers/skills/using-superpowers/references/copilot-tools.md +1 -11
- package/bundled/upstream/superpowers/skills/using-superpowers/references/gemini-tools.md +21 -3
- package/bundled/upstream/superpowers/skills/writing-plans/SKILL.md +1 -1
- package/package.json +1 -1
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/agent-sdk/README.md +0 -355
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/agent-sdk/patterns.md +0 -359
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/agent-sdk/README.md +0 -297
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/agent-sdk/patterns.md +0 -209
- package/bundled/upstream/ecc/commands/agent-sort.md +0 -23
- package/bundled/upstream/ecc/commands/claw.md +0 -23
- package/bundled/upstream/ecc/commands/context-budget.md +0 -23
- package/bundled/upstream/ecc/commands/devfleet.md +0 -23
- package/bundled/upstream/ecc/commands/docs.md +0 -23
- package/bundled/upstream/ecc/commands/e2e.md +0 -268
- package/bundled/upstream/ecc/commands/eval.md +0 -23
- package/bundled/upstream/ecc/commands/orchestrate.md +0 -135
- package/bundled/upstream/ecc/commands/prompt-optimize.md +0 -23
- package/bundled/upstream/ecc/commands/rules-distill.md +0 -20
- package/bundled/upstream/ecc/commands/tdd.md +0 -231
- package/bundled/upstream/ecc/commands/verify.md +0 -23
- package/bundled/upstream/ecc/skills/claude-api/SKILL.md +0 -337
- package/bundled/upstream/ecc/skills/frontend-design/SKILL.md +0 -145
- package/bundled/upstream/superpowers/agents/code-reviewer.md +0 -48
- package/bundled/upstream/superpowers/commands/brainstorm.md +0 -5
- package/bundled/upstream/superpowers/commands/execute-plan.md +0 -5
- package/bundled/upstream/superpowers/commands/write-plan.md +0 -5
package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-client-patterns.md
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# Managed Agents — Common Client Patterns
|
|
2
|
+
|
|
3
|
+
Patterns you'll write on the client side when driving a Managed Agent session, grounded in working SDK examples.
|
|
4
|
+
|
|
5
|
+
Code samples are TypeScript — Python and cURL follow the same shape; see `python/managed-agents/README.md` and `curl/managed-agents.md` for equivalents.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Lossless stream reconnect
|
|
10
|
+
|
|
11
|
+
**Problem:** SSE has no replay. If the connection drops mid-session, a naive reconnect re-opens the stream from "now" and you silently miss every event emitted in between.
|
|
12
|
+
|
|
13
|
+
**Solution:** on reconnect, fetch the full event history via `events.list()` *before* consuming the live stream, and dedupe on event ID as the live stream catches up.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
const seenEventIds = new Set<string>()
|
|
17
|
+
const stream = await client.beta.sessions.events.stream(session.id)
|
|
18
|
+
|
|
19
|
+
// Stream is now open and buffering server-side. Read history first.
|
|
20
|
+
for await (const event of client.beta.sessions.events.list(session.id)) {
|
|
21
|
+
seenEventIds.add(event.id)
|
|
22
|
+
handle(event)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Tail the live stream. Dedupe only gates handle() — terminal checks must run
|
|
26
|
+
// even for already-seen events, or a terminal event that was in the history
|
|
27
|
+
// response gets skipped by `continue` and the loop never exits.
|
|
28
|
+
for await (const event of stream) {
|
|
29
|
+
if (!seenEventIds.has(event.id)) {
|
|
30
|
+
seenEventIds.add(event.id)
|
|
31
|
+
handle(event)
|
|
32
|
+
}
|
|
33
|
+
if (event.type === 'session.status_terminated') break
|
|
34
|
+
if (event.type === 'session.status_idle' && event.stop_reason.type !== 'requires_action') break
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 2. `processed_at` — queued vs processed
|
|
41
|
+
|
|
42
|
+
Every event on the stream carries `processed_at` (ISO 8601). For client-sent events (`user.message`, `user.interrupt`, `user.tool_confirmation`, `user.custom_tool_result`) it's `null` when the event has been queued but not yet picked up by the agent, and populated once the agent processes it. The same event appears on the stream twice — once with `processed_at: null`, once with a timestamp.
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
for await (const event of stream) {
|
|
46
|
+
if (event.type === 'user.message') {
|
|
47
|
+
if (event.processed_at == null) onQueued(event.id)
|
|
48
|
+
else onProcessed(event.id, event.processed_at)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Use this to drive pending → acknowledged UI state for anything you send. How you map a locally-rendered optimistic message to the server-assigned `event.id` is application-specific (typically via the return value of `events.send()` or FIFO ordering).
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 3. Interrupt a running session
|
|
58
|
+
|
|
59
|
+
Send `user.interrupt` as a normal event. The session keeps running until it reaches a safe boundary, then goes idle.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
await client.beta.sessions.events.send(session.id, {
|
|
63
|
+
events: [{ type: 'user.interrupt' }],
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
// Drain until the session is truly done — see Pattern 5 for the full gate.
|
|
67
|
+
for await (const event of stream) {
|
|
68
|
+
if (event.type === 'session.status_terminated') break
|
|
69
|
+
if (
|
|
70
|
+
event.type === 'session.status_idle' &&
|
|
71
|
+
event.stop_reason.type !== 'requires_action'
|
|
72
|
+
) break
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Reference: `interrupt.ts` — sends the interrupt the moment it sees `span.model_request_start`, drains to idle, then verifies via `sessions.retrieve()`.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 4. `tool_confirmation` round-trip
|
|
81
|
+
|
|
82
|
+
When the agent has `permission_policy: { type: 'always_ask' }`, any call to that tool fires an `agent.tool_use` event with `evaluated_permission === 'ask'` and the session goes idle waiting for a decision. Respond with `user.tool_confirmation`.
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
for await (const event of stream) {
|
|
86
|
+
if (event.type === 'agent.tool_use' && event.evaluated_permission === 'ask') {
|
|
87
|
+
await client.beta.sessions.events.send(session.id, {
|
|
88
|
+
events: [{
|
|
89
|
+
type: 'user.tool_confirmation',
|
|
90
|
+
tool_use_id: event.id, // not a toolu_ id — use event.id
|
|
91
|
+
result: 'allow', // or 'deny'
|
|
92
|
+
// deny_message: '...', // optional, only with result: 'deny'
|
|
93
|
+
}],
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Key points:
|
|
100
|
+
- `tool_use_id` is `event.id` (typically `sevt_...`), **not** a `toolu_...` ID.
|
|
101
|
+
- `result` is `'allow' | 'deny'`. Use `deny_message` to tell the model *why* you denied — it gets surfaced back to the agent.
|
|
102
|
+
- Multiple pending tools: respond once per `agent.tool_use` event with `evaluated_permission === 'ask'`.
|
|
103
|
+
|
|
104
|
+
Reference: `tool-permissions.ts`.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## 5. Correct idle-break gate
|
|
109
|
+
|
|
110
|
+
Do not break on `session.status_idle` alone. The session goes idle transiently — e.g. between parallel tool executions, while waiting for a `user.tool_confirmation`, or while awaiting a `user.custom_tool_result`. Break when idle with a terminal `stop_reason`, or on `session.status_terminated`.
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
for await (const event of stream) {
|
|
114
|
+
handle(event)
|
|
115
|
+
if (event.type === 'session.status_terminated') break
|
|
116
|
+
if (event.type === 'session.status_idle') {
|
|
117
|
+
if (event.stop_reason.type === 'requires_action') continue // waiting on you — handle it
|
|
118
|
+
break // end_turn or retries_exhausted — both terminal
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`stop_reason.type` values on `session.status_idle`:
|
|
124
|
+
- `requires_action` — agent is waiting on a client-side event (tool confirmation, custom tool result). Handle it, don't break.
|
|
125
|
+
- `retries_exhausted` — terminal failure. Break, then check `sessions.retrieve()` for the error state.
|
|
126
|
+
- `end_turn` — normal completion.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## 6. Post-idle status-write race
|
|
131
|
+
|
|
132
|
+
The SSE stream emits `session.status_idle` slightly before the session's queryable status reflects it. Clients that break on idle and immediately call `sessions.delete()` or `sessions.archive()` will intermittently 400 with "cannot delete/archive while running."
|
|
133
|
+
|
|
134
|
+
Poll before cleanup:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
let s
|
|
138
|
+
for (let i = 0; i < 10; i++) {
|
|
139
|
+
s = await client.beta.sessions.retrieve(session.id)
|
|
140
|
+
if (s.status !== 'running') break
|
|
141
|
+
await new Promise(r => setTimeout(r, 200))
|
|
142
|
+
}
|
|
143
|
+
if (s?.status !== 'running') {
|
|
144
|
+
await client.beta.sessions.archive(session.id)
|
|
145
|
+
} // else: still running after 2s — don't archive, let it settle or escalate
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 7. Stream-first, then send
|
|
151
|
+
|
|
152
|
+
Always open the stream **before** sending the kickoff event. Otherwise the agent may process the event and emit the first events before your consumer is attached, and you'll miss them.
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
const stream = await client.beta.sessions.events.stream(session.id)
|
|
156
|
+
await client.beta.sessions.events.send(session.id, {
|
|
157
|
+
events: [{ type: 'user.message', content: [{ type: 'text', text: 'Hello' }] }],
|
|
158
|
+
})
|
|
159
|
+
for await (const event of stream) { /* ... */ }
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The `Promise.all([stream, send])` shape works too, but stream-first is simpler and has the same effect — the stream starts buffering the moment it's opened.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 8. File-mount gotchas
|
|
167
|
+
|
|
168
|
+
**The mounted resource has a different `file_id` than the file you uploaded.** Session creation makes a session-scoped copy.
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
const uploaded = await client.beta.files.upload({ file })
|
|
172
|
+
// uploaded.id → the original file
|
|
173
|
+
const session = await client.beta.sessions.create({
|
|
174
|
+
/* ... */
|
|
175
|
+
resources: [{ type: 'file', file_id: uploaded.id, mount_path: '/workspace/data.csv' }],
|
|
176
|
+
})
|
|
177
|
+
// session.resources[0].file_id !== uploaded.id ← different IDs
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Delete the original via `files.delete(uploaded.id)`; the session-scoped copy is garbage-collected with the session. `mount_path` must be absolute — see `shared/managed-agents-environments.md`.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 9. Secrets for non-MCP APIs and CLIs — keep them host-side via custom tools
|
|
185
|
+
|
|
186
|
+
**Problem:** you want the agent to call a third-party API or run a CLI that needs a secret (API key, token, service-account credential), but there is currently no way to set environment variables inside the session container, and vaults currently hold MCP credentials only — they are not exposed to the container's shell. So `curl`, installed CLIs, or SDK clients running via the `bash` tool have no first-class place to read a secret from.
|
|
187
|
+
|
|
188
|
+
**Solution:** move the authenticated call to your side. Declare a custom tool on the agent; when the agent emits `agent.custom_tool_use`, your orchestrator (the process reading the SSE stream) executes the call with its own credentials and responds with `user.custom_tool_result`. The container never sees the key.
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
// Agent template: declare the tool, no credentials
|
|
192
|
+
tools: [{ type: 'custom', name: 'linear_graphql', input_schema: { /* query, vars */ } }]
|
|
193
|
+
|
|
194
|
+
// Orchestrator: handle the call with host-side creds
|
|
195
|
+
for await (const event of stream) {
|
|
196
|
+
if (event.type === 'agent.custom_tool_use' && event.name === 'linear_graphql') {
|
|
197
|
+
const result = await linear.request(event.input.query, event.input.vars) // host's key
|
|
198
|
+
await client.beta.sessions.events.send(session.id, {
|
|
199
|
+
events: [{ type: 'user.custom_tool_result', tool_use_id: event.id, result }],
|
|
200
|
+
})
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Same shape works for `gh` CLI, local eval scripts, or anything else that needs host-side auth or binaries.
|
|
206
|
+
|
|
207
|
+
**Security note:** this does not expose a public endpoint. `agent.custom_tool_use` arrives on the SSE stream your orchestrator already holds open with your Anthropic API key, and `user.custom_tool_result` goes back via `events.send()` under the same key. Your orchestrator is a client, not a server — nothing unauthenticated is listening.
|
|
208
|
+
|
|
209
|
+
**Do not embed API keys in the system prompt or user messages as a workaround.** Prompts and messages are stored in the session's event history, returned by `events.list()`, and included in compaction summaries — a secret placed there is durably persisted and readable via the API for the life of the session.
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# Managed Agents — Core Concepts
|
|
2
|
+
|
|
3
|
+
## Architecture
|
|
4
|
+
|
|
5
|
+
Managed Agents is built around four core concepts:
|
|
6
|
+
|
|
7
|
+
| Concept | Endpoint | What it is |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| **Agent** | `/v1/agents` | A persisted, versioned object defining the agent's capabilities and persona: model, system prompt, tools, MCP servers, skills. **Must be created before starting a session.** See the Agents section below. |
|
|
10
|
+
| **Session** | `/v1/sessions` | A stateful interaction with an agent. References a pre-created agent by ID + an environment + initial instructions. Produces an event stream. |
|
|
11
|
+
| **Environment** | `/v1/environments` | A template defining the configuration for container provisioning. |
|
|
12
|
+
| **Container** | N/A | An isolated compute instance where the agent's **tools** execute (bash, file ops, code). The agent loop does not run here — it runs on Anthropic's orchestration layer and acts on the container via tool calls. |
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
┌─────────────────────────────────────┐
|
|
16
|
+
│ Anthropic orchestration layer │
|
|
17
|
+
Agent (config) ───────▶│ (agent loop: Claude + tool calls) │
|
|
18
|
+
└──────────────┬──────────────────────┘
|
|
19
|
+
│ tool calls
|
|
20
|
+
▼
|
|
21
|
+
Environment (template) ──▶ Container (tool execution workspace)
|
|
22
|
+
│
|
|
23
|
+
Session ─┤
|
|
24
|
+
├── Resources (files, repos, memory stores — attached at startup)
|
|
25
|
+
├── Vault IDs (MCP credential references)
|
|
26
|
+
└── Conversation (event stream in/out)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
> **Agent creation is a prerequisite.** Sessions reference a pre-created agent by ID — `model`/`system`/`tools` live on the agent object, never on the session. Every flow starts with `POST /v1/agents`.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Session Lifecycle
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
rescheduling → running ↔ idle → terminated
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
| Status | Description |
|
|
40
|
+
| -------------- | ------------------------------------------------------------------ |
|
|
41
|
+
| `idle` | Agent has finished the current task, and is awaiting input. It's either waiting for input to continue working via a `user.message` or blocked awaiting a `user.custom_tool_result` or `user.tool_confirmation`. The `stop_reason` attached contains more information about why the Agent has stopped working. |
|
|
42
|
+
| `running` | Session has starting running, and the Agent is actively doing work. |
|
|
43
|
+
| `rescheduling` | Session is (re)scheduling after a retryable error has occurred, ready to be picked up by the orchestration system. |
|
|
44
|
+
| `terminated` | Session has terminated, entering an irreversible and unusable state. |
|
|
45
|
+
|
|
46
|
+
- Events can be sent when the session is `running` or `idle`. Messages are queued and processed in order.
|
|
47
|
+
- The agent transitions `idle → running` when it receives a new event, then back to `idle` when done.
|
|
48
|
+
- Errors surface as `session.error` events in the stream, not as a status value.
|
|
49
|
+
|
|
50
|
+
### Built-in session features
|
|
51
|
+
|
|
52
|
+
- **Context compaction** — if you approach max context, the API automatically condenses session history to keep the interaction going
|
|
53
|
+
- **Prompt caching** — historical repeated tokens are cached, reducing processing time and cost
|
|
54
|
+
- **Extended thinking** — on by default, returned as `agent.thinking` events
|
|
55
|
+
|
|
56
|
+
### Session operations
|
|
57
|
+
|
|
58
|
+
| Operation | Notes |
|
|
59
|
+
|---|---|
|
|
60
|
+
| List / fetch | Paginated list or single resource by ID |
|
|
61
|
+
| Update | Only `title` is updatable |
|
|
62
|
+
| Archive | Session becomes **read-only**. Not reversible. |
|
|
63
|
+
| Delete | Permanently deletes session, event history, container, and checkpoints. |
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Sessions
|
|
68
|
+
|
|
69
|
+
A session is a running agent instance inside an environment.
|
|
70
|
+
|
|
71
|
+
### Session Object
|
|
72
|
+
|
|
73
|
+
Key fields returned by the API:
|
|
74
|
+
|
|
75
|
+
| Field | Type | Description |
|
|
76
|
+
| --------------- | -------- | --------------------------------------------------- |
|
|
77
|
+
| `type` | string | Always `"session"` |
|
|
78
|
+
| `id` | string | Unique session ID |
|
|
79
|
+
| `title` | string | Human-readable title |
|
|
80
|
+
| `status` | string | `idle`, `running`, `rescheduling`, `terminated` |
|
|
81
|
+
| `created_at` | string | ISO 8601 timestamp |
|
|
82
|
+
| `updated_at` | string | ISO 8601 timestamp |
|
|
83
|
+
| `archived_at` | string | ISO 8601 timestamp (nullable) |
|
|
84
|
+
| `environment_id` | string | Environment ID |
|
|
85
|
+
| `agent` | object | Agent configuration |
|
|
86
|
+
| `resources` | array | Attached files, repos, and memory stores |
|
|
87
|
+
| `metadata` | object | User-provided key-value pairs (max 8 keys) |
|
|
88
|
+
| `usage` | object | Token usage statistics |
|
|
89
|
+
|
|
90
|
+
### Creating a session
|
|
91
|
+
|
|
92
|
+
**A session is meaningless without an agent.** Sessions reference a pre-created agent by ID. Create the agent first via `agents.create()`, then reference it:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
// 1. Create the agent (reusable, versioned)
|
|
96
|
+
const agent = await client.beta.agents.create(
|
|
97
|
+
{
|
|
98
|
+
name: "Coding Assistant",
|
|
99
|
+
model: "claude-opus-4-7",
|
|
100
|
+
system: "You are a helpful coding agent.",
|
|
101
|
+
tools: [{ type: "agent_toolset_20260401"}],
|
|
102
|
+
},
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
// 2. Start a session that references it
|
|
106
|
+
const session = await client.beta.sessions.create(
|
|
107
|
+
{
|
|
108
|
+
agent: agent.id, // string shorthand → latest version. Or: { type: "agent", id: agent.id, version: agent.version }
|
|
109
|
+
environment_id: environmentId,
|
|
110
|
+
title: "Hello World Session",
|
|
111
|
+
},
|
|
112
|
+
);
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Session creation parameters:**
|
|
116
|
+
|
|
117
|
+
| Field | Type | Required | Description |
|
|
118
|
+
| --------------- | -------- | -------- | ---------------------------------------------- |
|
|
119
|
+
| `agent` | string or object | **Yes** | String shorthand `"agent_abc123"` (latest version) or `{type: "agent", id, version}` |
|
|
120
|
+
| `environment_id`| string | **Yes** | Environment ID |
|
|
121
|
+
| `title` | string | No | Human-readable name (appears in logs/dashboards) |
|
|
122
|
+
| `resources` | array | No | Files, GitHub repos, or memory stores, attached to the container at startup. Memory stores are session-create-only (not addable via `resources.add()`). |
|
|
123
|
+
| `vault_ids` | array | No | Vault IDs (`vlt_*`) — MCP credentials with auto-refresh. See `shared/managed-agents-tools.md` → Vaults. |
|
|
124
|
+
| `metadata` | object | No | User-provided key-value pairs |
|
|
125
|
+
|
|
126
|
+
**Agent configuration fields** (passed to `agents.create()`, not `sessions.create()`):
|
|
127
|
+
|
|
128
|
+
| Field | Type | Required | Description |
|
|
129
|
+
| ------------- | -------- | -------- | ---------------------------------------------- |
|
|
130
|
+
| `name` | string | **Yes** | Human-readable name (1-256 chars) |
|
|
131
|
+
| `model` | string or object | **Yes** | Claude model ID (bare string, or `{id, speed}` object). All Claude 4.5+ models supported. |
|
|
132
|
+
| `system` | string | No | System prompt — defines the agent's behavior (up to 100K chars) |
|
|
133
|
+
| `tools` | array | No | Encompasses three kinds: (1) pre-built Claude Agent tools (`agent_toolset_20260401`), (2) MCP tools (`mcp_toolset`), and (3) custom client-side tools. Max 128. |
|
|
134
|
+
| `mcp_servers` | array | No | MCP server connections — standardized third-party capabilities (e.g. GitHub, Asana). Max 20, unique names. See `shared/managed-agents-tools.md` → MCP Servers. |
|
|
135
|
+
| `skills` | array | No | Customized "best-practices" context with progressive disclosure. Max 20. See `shared/managed-agents-tools.md` → Skills. |
|
|
136
|
+
| `description` | string | No | Description of the agent (up to 2048 chars) |
|
|
137
|
+
| `multiagent` | object | No | `{type: "coordinator", agents: [...]}` — roster this agent may delegate to. See `shared/managed-agents-multiagent.md`. |
|
|
138
|
+
| `metadata` | object | No | Arbitrary key-value pairs (max 16, keys ≤64 chars, values ≤512 chars) |
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Agents
|
|
143
|
+
|
|
144
|
+
**This is where every Managed Agents flow begins.** The agent object is a persisted, versioned configuration — you create it once, then reference it by ID every time you start a session. No agent → no session.
|
|
145
|
+
|
|
146
|
+
### Agent Object
|
|
147
|
+
|
|
148
|
+
The API is **flat** — `model`, `system`, `tools` etc. are top-level fields, not wrapped in an `agent:{}` sub-object.
|
|
149
|
+
|
|
150
|
+
| Field | Type | Required | Description |
|
|
151
|
+
| ------------------ | -------- | -------- | -------------------------------------------------- |
|
|
152
|
+
| `name` | string | Yes | Human-readable name |
|
|
153
|
+
| `model` | string | Yes | Claude model ID |
|
|
154
|
+
| `system` | string | No | System prompt |
|
|
155
|
+
| `tools` | array | No | Agent toolset / MCP toolset / custom tools |
|
|
156
|
+
| `mcp_servers` | array | No | MCP server connections |
|
|
157
|
+
| `skills` | array | No | Skill references (max 20) |
|
|
158
|
+
| `description` | string | No | Description of the agent |
|
|
159
|
+
| `multiagent` | object | No | Coordinator roster — see `shared/managed-agents-multiagent.md` |
|
|
160
|
+
| `metadata` | object | No | Arbitrary key-value pairs |
|
|
161
|
+
|
|
162
|
+
### Lifecycle: create once, run many, update in place
|
|
163
|
+
|
|
164
|
+
The agent is a **persistent resource**, not a per-run parameter. The intended pattern:
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
┌─ setup (once) ─────────┐ ┌─ runtime (every invocation) ─┐
|
|
168
|
+
│ agents.create() │ │ sessions.create( │
|
|
169
|
+
│ → store agent_id │ ──→ │ agent={type:..., id: ID} │
|
|
170
|
+
│ in config/env/db │ │ ) │
|
|
171
|
+
└────────────────────────┘ └──────────────────────────────┘
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Anti-pattern:** calling `agents.create()` at the top of every script run. This accumulates orphaned agent objects, pays create latency on every invocation, and defeats the versioning model. If you see `agents.create()` in a function that's called per-request or per-cron-tick, that's wrong — hoist it to one-time setup and persist the ID.
|
|
175
|
+
|
|
176
|
+
### Versioning
|
|
177
|
+
|
|
178
|
+
Each `POST /v1/agents/{id}` (update) creates a new immutable version (numeric timestamp, e.g. `1772585501101368014`). The agent's history is append-only — you can't edit a past version.
|
|
179
|
+
|
|
180
|
+
**Why version:**
|
|
181
|
+
- **Reproducibility** — pin a session to a known-good config: `{type: "agent", id, version: 3}`
|
|
182
|
+
- **Safe iteration** — update the agent without breaking sessions already running on the old version
|
|
183
|
+
- **Rollback** — if a new system prompt regresses, pin new sessions back to the prior version while you debug
|
|
184
|
+
|
|
185
|
+
**`version` is optional.** Omit it (or use the string shorthand `agent="agent_abc123"`) to get the latest version at session-creation time. Pass it explicitly (`{type: "agent", id, version: N}`) to pin for reproducibility.
|
|
186
|
+
|
|
187
|
+
**Getting the version to pin:** `agents.create()` and `agents.update()` both return `version` in the response. Store it alongside `agent_id`. To fetch the current latest for an existing agent: `GET /v1/agents/{id}` → `.version`.
|
|
188
|
+
|
|
189
|
+
**When to update vs create new:** Update (`POST /v1/agents/{id}`) when it's conceptually the same agent with tweaked behavior (better prompt, extra tool). Create a new agent when it's a different persona/purpose. Rule of thumb: if you'd give it the same `name`, update.
|
|
190
|
+
|
|
191
|
+
### Agent Endpoints
|
|
192
|
+
|
|
193
|
+
| Operation | Method | Path |
|
|
194
|
+
| ---------------- | -------- | ------------------------------------- |
|
|
195
|
+
| Create | `POST` | `/v1/agents` |
|
|
196
|
+
| List | `GET` | `/v1/agents` |
|
|
197
|
+
| Get | `GET` | `/v1/agents/{id}` |
|
|
198
|
+
| Update | `POST` | `/v1/agents/{id}` |
|
|
199
|
+
| Archive | `POST` | `/v1/agents/{id}/archive` |
|
|
200
|
+
|
|
201
|
+
> ⚠️ **Archive is permanent.** Archiving makes the agent read-only: existing sessions continue to run, but **new sessions cannot reference it**, and there is no unarchive. Since agents have no `delete`, this is the terminal lifecycle state. Never archive a production agent as routine cleanup — confirm with the user first.
|
|
202
|
+
|
|
203
|
+
### Using an Agent in a Session
|
|
204
|
+
|
|
205
|
+
Reference the agent by string ID (latest version) or by object with an explicit version:
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
# String shorthand — uses the agent's latest version
|
|
209
|
+
session = client.beta.sessions.create(
|
|
210
|
+
agent=agent.id,
|
|
211
|
+
environment_id=environment_id,
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
# Or pin to a specific version (int)
|
|
215
|
+
session = client.beta.sessions.create(
|
|
216
|
+
agent={"type": "agent", "id": agent.id, "version": agent.version},
|
|
217
|
+
environment_id=environment_id,
|
|
218
|
+
)
|
|
219
|
+
```
|
|
220
|
+
|
package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-environments.md
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# Managed Agents — Environments & Resources
|
|
2
|
+
|
|
3
|
+
## Environments
|
|
4
|
+
|
|
5
|
+
Creating a session requires an `environment_id`. Environments are **reusable configuration templates** for spinning up containers in Anthropic's infrastructure — you might create different environments for different use cases (e.g. data visualization vs web development, with different package sets). Anthropic handles scaling, container lifecycle, and work orchestration.
|
|
6
|
+
|
|
7
|
+
**Environment names must be unique.** Creating an environment with an existing name returns 409.
|
|
8
|
+
|
|
9
|
+
### Networking
|
|
10
|
+
|
|
11
|
+
| Network Policy | Description |
|
|
12
|
+
| ------------------------------- | ------------------------------------------------------------- |
|
|
13
|
+
| `unrestricted` | Full egress (except legal blocklist) |
|
|
14
|
+
| `package_managers_and_custom` | Package managers + custom `allowed_hosts` |
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"networking": {
|
|
19
|
+
"type": "package_managers_and_custom",
|
|
20
|
+
"allowed_hosts": ["api.example.com"]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**MCP caveat:** If using restricted networking, make sure `allowed_hosts` includes your MCP server domains. Otherwise the container can't reach them and tools silently fail.
|
|
26
|
+
|
|
27
|
+
### Creating an environment
|
|
28
|
+
|
|
29
|
+
The SDK adds `managed-agents-2026-04-01` automatically. TypeScript:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
const env = await client.beta.environments.create({
|
|
33
|
+
name: "my_env",
|
|
34
|
+
config: {
|
|
35
|
+
type: "cloud",
|
|
36
|
+
networking: { type: "unrestricted" },
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Environment CRUD
|
|
42
|
+
|
|
43
|
+
| Operation | Method | Path | Notes |
|
|
44
|
+
| ---------------- | -------- | ------------------------------------------ | ----- |
|
|
45
|
+
| Create | `POST` | `/v1/environments` | |
|
|
46
|
+
| List | `GET` | `/v1/environments` | Paginated (`limit`, `after_id`, `before_id`) |
|
|
47
|
+
| Get | `GET` | `/v1/environments/{id}` | |
|
|
48
|
+
| Update | `POST` | `/v1/environments/{id}` | Changes apply only to **new** containers; existing sessions keep their original config |
|
|
49
|
+
| Delete | `DELETE` | `/v1/environments/{id}` | Returns 204. |
|
|
50
|
+
| Archive | `POST` | `/v1/environments/{id}/archive` | Makes it **read-only**; existing sessions continue, new sessions cannot reference it. No unarchive — terminal state. |
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Resources
|
|
55
|
+
|
|
56
|
+
Attach files, GitHub repositories, and memory stores to a session. **Session creation blocks until all resources are mounted** — the container won't go `running` until every file and repo is in place. Max **999 file resources** per session. Multiple GitHub repositories per session are supported. For `type: "memory_store"` resources (persistent cross-session memory — max 8 per session), see `shared/managed-agents-memory.md`.
|
|
57
|
+
|
|
58
|
+
### File Uploads (input — host → agent)
|
|
59
|
+
|
|
60
|
+
Upload a file first via the Files API, then reference by `file_id` + `mount_path`:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
// 1. Upload
|
|
64
|
+
const file = await client.beta.files.upload({
|
|
65
|
+
file: fs.createReadStream("data.csv"),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// 2. Attach as a session resource
|
|
69
|
+
const session = await client.beta.sessions.create({
|
|
70
|
+
agent: agent.id,
|
|
71
|
+
environment_id: envId,
|
|
72
|
+
resources: [
|
|
73
|
+
{ type: "file", file_id: file.id, mount_path: "/workspace/data.csv" }
|
|
74
|
+
],
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**`mount_path` is required** and must be absolute. Parent directories are created automatically. Agent working directory defaults to `/workspace`. Files are mounted read-only — the agent writes modified versions to new paths.
|
|
79
|
+
|
|
80
|
+
### Session outputs (output — agent → host)
|
|
81
|
+
|
|
82
|
+
The agent can write files to `/mnt/session/outputs/` during a session. These are automatically captured by the Files API and can be listed and downloaded afterwards:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
// After the turn completes, list output files scoped to this session:
|
|
86
|
+
for await (const f of client.beta.files.list({
|
|
87
|
+
scope_id: session.id,
|
|
88
|
+
betas: ["managed-agents-2026-04-01"],
|
|
89
|
+
})) {
|
|
90
|
+
console.log(f.filename, f.size_bytes);
|
|
91
|
+
const resp = await client.beta.files.download(f.id);
|
|
92
|
+
const text = await resp.text();
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Requirements:**
|
|
97
|
+
- The `write` tool (or `bash`) must be enabled for the agent to create output files.
|
|
98
|
+
- Session-scoped `files.list` / `files.download` captures outputs written to `/mnt/session/outputs/`.
|
|
99
|
+
- The filter parameter is **`scope_id`** (REST query param `?scope_id=<session_id>`). The SDK's files resource auto-adds only the `files-api-2025-04-14` header, so pass `betas: ["managed-agents-2026-04-01"]` explicitly (or both headers on raw HTTP) — without it the API may reject `scope_id` as an unknown field. Requires `@anthropic-ai/sdk` ≥ 0.88.0 / `anthropic` (Python) ≥ 0.92.0 — older versions don't type `scope_id`. The `ant` CLI does **not** expose this flag yet; use the SDK or curl.
|
|
100
|
+
- Pass the session ID returned by `sessions.create()` verbatim (e.g. `sesn_011CZx...`) — the API validates the prefix.
|
|
101
|
+
- There's a brief indexing lag (~1–3s) between `session.status_idle` and output files appearing in `files.list`. Retry once or twice if empty.
|
|
102
|
+
|
|
103
|
+
> **Fallback when `scope_id` filtering is unavailable** (older SDK, or endpoint returns an error): send a follow-up `user.message` asking the agent to `read` each file under `/mnt/session/outputs/` and return the contents. The agent streams the file bodies back as `agent.message` text. This works for text files only and costs output tokens — use it to unblock, not as the primary path.
|
|
104
|
+
|
|
105
|
+
This gives you a bidirectional file bridge: upload reference data in, download agent artifacts out.
|
|
106
|
+
|
|
107
|
+
### GitHub Repositories
|
|
108
|
+
|
|
109
|
+
Clones a GitHub repository into the session container during initialization, before the agent begins execution. The agent can read, edit, commit, and push via `bash` (`git`). Multiple repositories per session are supported — add one `resources` entry per repo. Repositories are cached, so future sessions that use the same repository start faster.
|
|
110
|
+
|
|
111
|
+
Repositories are attached for the lifetime of the session — to change which repositories are mounted, create a new session. You **can** rotate a repository's `authorization_token` on a running session via `client.beta.sessions.resources.update(resource_id, {session_id, authorization_token})`; the resource `id` is returned at session creation and by `resources.list()`.
|
|
112
|
+
|
|
113
|
+
**Fields:**
|
|
114
|
+
|
|
115
|
+
| Field | Required | Notes |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| `type` | ✅ | `"github_repository"` |
|
|
118
|
+
| `url` | ✅ | The GitHub repository URL |
|
|
119
|
+
| `authorization_token` | ✅ | GitHub Personal Access Token with repository access. **Never echoed in API responses.** |
|
|
120
|
+
| `mount_path` | ❌ | Path where the repository will be cloned. Defaults to `/workspace/<repo-name>`. |
|
|
121
|
+
| `checkout` | ❌ | `{type: "branch", name: "..."}` or `{type: "commit", sha: "..."}`. Defaults to the repo's default branch. |
|
|
122
|
+
|
|
123
|
+
**Token permission levels** (fine-grained PATs):
|
|
124
|
+
- `Contents: Read` — clone only
|
|
125
|
+
- `Contents: Read and write` — push changes and create pull requests
|
|
126
|
+
|
|
127
|
+
**How auth works:** `authorization_token` is never placed inside the container. `git pull` / `git push` and GitHub REST calls against the attached repository are routed through an Anthropic-side git proxy that injects the token after the request leaves the sandbox. Code running in the container — including anything the agent writes — cannot read or exfiltrate it.
|
|
128
|
+
|
|
129
|
+
> ‼️ **To generate pull requests** you also need GitHub **MCP server** access — the `github_repository` resource gives filesystem + git access only. See `shared/managed-agents-tools.md` → MCP Servers. The PR workflow is: edit files in the mounted repo → push branch via `bash` (authenticated via the git proxy using `authorization_token`) → create PR via the MCP `create_pull_request` tool (authenticated via the vault).
|
|
130
|
+
|
|
131
|
+
**TypeScript:**
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
// 1. Create the agent — declare GitHub MCP (no auth here)
|
|
135
|
+
const agent = await client.beta.agents.create(
|
|
136
|
+
{
|
|
137
|
+
name: 'GitHub Agent',
|
|
138
|
+
model: 'claude-opus-4-7',
|
|
139
|
+
mcp_servers: [
|
|
140
|
+
{ type: 'url', name: 'github', url: 'https://api.githubcopilot.com/mcp/' },
|
|
141
|
+
],
|
|
142
|
+
tools: [
|
|
143
|
+
{ type: 'agent_toolset_20260401', default_config: { enabled: true } },
|
|
144
|
+
{ type: 'mcp_toolset', mcp_server_name: 'github' },
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
// 2. Start a session — attach vault for MCP auth + mount the repo
|
|
150
|
+
const session = await client.beta.sessions.create({
|
|
151
|
+
agent: agent.id,
|
|
152
|
+
environment_id: envId,
|
|
153
|
+
vault_ids: [vaultId], // vault contains the GitHub MCP OAuth credential
|
|
154
|
+
resources: [
|
|
155
|
+
{
|
|
156
|
+
type: 'github_repository',
|
|
157
|
+
url: 'https://github.com/owner/repo',
|
|
158
|
+
authorization_token: process.env.GITHUB_TOKEN, // repo clone token (≠ MCP auth)
|
|
159
|
+
checkout: { type: 'branch', name: 'main' },
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Python:**
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
import os
|
|
169
|
+
|
|
170
|
+
agent = client.beta.agents.create(
|
|
171
|
+
name="GitHub Agent",
|
|
172
|
+
model="claude-opus-4-7",
|
|
173
|
+
mcp_servers=[{
|
|
174
|
+
"type": "url",
|
|
175
|
+
"name": "github",
|
|
176
|
+
"url": "https://api.githubcopilot.com/mcp/",
|
|
177
|
+
}],
|
|
178
|
+
tools=[
|
|
179
|
+
{"type": "agent_toolset_20260401", "default_config": {"enabled": True}},
|
|
180
|
+
{"type": "mcp_toolset", "mcp_server_name": "github"},
|
|
181
|
+
],
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
session = client.beta.sessions.create(
|
|
185
|
+
agent=agent.id,
|
|
186
|
+
environment_id=env_id,
|
|
187
|
+
vault_ids=[vault_id], # vault contains the GitHub MCP OAuth credential
|
|
188
|
+
resources=[{
|
|
189
|
+
"type": "github_repository",
|
|
190
|
+
"url": "https://github.com/owner/repo",
|
|
191
|
+
"authorization_token": os.environ["GITHUB_TOKEN"], # repo clone token (≠ MCP auth)
|
|
192
|
+
"checkout": {"type": "branch", "name": "main"},
|
|
193
|
+
}],
|
|
194
|
+
)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Files API
|
|
200
|
+
|
|
201
|
+
Upload and manage files for use as session resources, and download files the agent wrote to `/mnt/session/outputs/`.
|
|
202
|
+
|
|
203
|
+
| Operation | Method | Path | SDK |
|
|
204
|
+
| ---------------- | -------- | ------------------------------------- | --- |
|
|
205
|
+
| Upload | `POST` | `/v1/files` | `client.beta.files.upload({ file })` |
|
|
206
|
+
| List | `GET` | `/v1/files?scope_id=...` | `client.beta.files.list({ scope_id, betas: ["managed-agents-2026-04-01"] })` |
|
|
207
|
+
| Get Metadata | `GET` | `/v1/files/{id}` | `client.beta.files.retrieveMetadata(id)` |
|
|
208
|
+
| Download | `GET` | `/v1/files/{id}/content` | `client.beta.files.download(id)` → `Response` |
|
|
209
|
+
| Delete | `DELETE` | `/v1/files/{id}` | `client.beta.files.delete(id)` |
|
|
210
|
+
|
|
211
|
+
The `scope_id` filter on List scopes the results to files written to `/mnt/session/outputs/` by that session. Without the filter, you get all files uploaded to your account.
|