Files
Jarvis/packages/MCP/Package.swift
james.maesandClaude Opus 4.7 13c8033028 feat(09-02): add VisionRouter dispatch + post-response escalation + voice-turn tracking (BLOCKER-2)
- ReplayEvent: new .escalationAttempt(turnId:kind:) case with .t1ToT2 EscalationKind (D-02 marker, distinct from AGENT-09 stream_truncated)
- ReplayEventKind: new .escalationAttempt = "escalation_attempt" rawvalue
- AgentOrchestrator: constructor gains optional visionRouter: VisionRouter? = nil
- runTurn pre-stream: route image-bearing turns through VisionRouter, swap provider, track imageBearingTurns (D-01, D-16)
- runTurnLoop: multimodal stream overload for image-bearing turns; assistantTextSoFar accumulator on .textDelta
- runTurnLoop .endTurn arm: post-response evaluatePostResponse hook, .escalateToT2 → discard T1 message, swap to T2, continue outer (WARNING-3 LOCKED labeled-loop strategy); records .escalationAttempt under SAME turnId (D-02)
- BLOCKER-2: voiceOriginatedTurns Set<TurnID> + recordVoiceTurn(_:) populator + turnSourceWasVoice(_:) public accessor (Plan 4 voice subscriber will gate emitTurnEnded on this)
- turnHadImage(_:) public accessor (Plan 2 frame-attach release subscriber consumer)
- AgentCore + Replay + MCP packages bumped from .v13 to .v14 (cascade — JarvisVision is .v14, project deployment target was already 14.0)
- MockLLMProvider extended with multimodal stream overload + RecordedCall.images
- 6 AgentOrchestratorVisionDispatchTests + 3 AgentOrchestratorVoiceTurnTrackingTests + 3 EscalationAttemptMarkerTests
- All 63 existing AgentOrchestratorTests still pass; all 30 Replay tests pass; orchestrator-events single-consumer grep gate exits 0

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 18:49:25 -05:00

83 lines
3.8 KiB
Swift

// swift-tools-version:6.0
//
// Package: JarvisMCP
//
// IMPORTANT: We name the LIBRARY/TARGET `JarvisMCP` (not `MCP`) to avoid the
// name collision with the official `modelcontextprotocol/swift-sdk` library,
// which already exports a public library product named `MCP`. Mirrors the
// `JarvisLogging` pattern in `packages/Logging`. Source layout still lives
// under `Sources/MCP/` per the plan's file_modified paths.
//
// Plan: 05-01 (mcp-client-stdio-transport)
import PackageDescription
let package = Package(
name: "JarvisMCP",
// Plan 09-02 cascade — bumped from v13 to v14 because MCP depends on
// AgentCore, which now requires macOS 14 (JarvisVision dependency in
// AgentOrchestrator's vision-dispatch path).
platforms: [.macOS(.v14)],
products: [
.library(name: "JarvisMCP", targets: ["JarvisMCP"]),
// Plan 07-05 deviation (Rule 3, blocking): ChildSpawnGate is hoisted
// into its own target so packages/Vision can import it for the
// vllm-mlx sidecar without pulling AgentOrchestrator transitively
// through JarvisMCP (VISION-03 boundary). Same gate singleton —
// both JarvisMCP helpers and VllmMlxSidecar route through it.
.library(name: "JarvisChildSpawn", targets: ["JarvisChildSpawn"]),
],
dependencies: [
// Pin SDK at exact 0.12.0 (no range float — pre-1.0 SDK).
.package(url: "https://github.com/modelcontextprotocol/swift-sdk", exact: "0.12.0"),
.package(path: "../Logging"),
// Plan 05-04: ASYMMETRIC dep on AgentCore (MCP→AgentCore only; never
// the reverse). MCPToolDispatcher imports AgentCore for `ToolUseRequest`
// and AgentOrchestrator for the `ToolDispatcher` protocol it conforms
// to. AgentCore intentionally does NOT depend on MCP — the
// orchestrator is provider-agnostic and only sees the protocol.
.package(path: "../AgentCore"),
// Plan 05-05 deviation (Rule 3, blocking): Sources `import
// Logging` (swift-log) directly. SPM tolerated implicit
// transitive visibility through JarvisLogging; the Xcode
// framework linker is stricter and needs the explicit dep so
// JarvisMCP.framework links cleanly when consumed by App target.
.package(url: "https://github.com/apple/swift-log.git", from: "1.5.0"),
],
targets: [
// Plan 07-05: standalone target for ChildSpawnGate so VISION-03
// consumers can depend on it without pulling AgentOrchestrator.
.target(
name: "JarvisChildSpawn",
dependencies: [
.product(name: "Logging", package: "swift-log"),
],
path: "Sources/JarvisChildSpawn",
swiftSettings: [.swiftLanguageMode(.v6)]
),
.target(
name: "JarvisMCP",
dependencies: [
.product(name: "MCP", package: "swift-sdk"),
.product(name: "JarvisLogging", package: "Logging"),
.product(name: "AgentCore", package: "AgentCore"),
.product(name: "AgentOrchestrator", package: "AgentCore"),
.product(name: "Logging", package: "swift-log"),
"JarvisChildSpawn",
],
path: "Sources/MCP",
swiftSettings: [.swiftLanguageMode(.v6)]
),
.testTarget(
name: "JarvisMCPTests",
dependencies: ["JarvisMCP", "JarvisChildSpawn"],
path: "Tests/MCPTests",
// Exclude the MockHelper fixture sub-package from the test target so
// SPM doesn't try to compile its `main.swift` as part of the test target.
// The MockHelper is built separately at test setUp via `swift build`.
exclude: ["Fixtures"],
swiftSettings: [.swiftLanguageMode(.v6)]
),
]
)