From f83e20718cf38b6c2fd39e6dac68be790217f834 Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 14:07:38 -0400 Subject: [PATCH 01/19] fix: remove dead AgentConfig types and connectTimeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Delete AgentConfig and HttpAgentConfig structs (no callsites in Sources/ or Tests/; ChatApp has its own separate AgentConfig type) - Move RunAgentParameters to RunAgentParameters.swift (still used by AbstractAgent and HttpAgent — not dead code) - Remove connectTimeout from AgUiAgentConfig (never read by AgUiAgent; only requestTimeout is wired into HttpAgentConfiguration) - Update plan: remove Bug 5 (RetryPolicy is fully wired end-to-end via HttpAgentTransport.shouldRetry/retryDelay — not dead code) --- Sources/AGUIAgentSDK/AgUiAgentConfig.swift | 6 - Sources/AGUIClient/AgentConfig.swift | 138 ---- Sources/AGUIClient/RunAgentParameters.swift | 48 ++ plans/pr-1512-implementation-plan.md | 732 ++++++++++++++++++++ 4 files changed, 780 insertions(+), 144 deletions(-) delete mode 100644 Sources/AGUIClient/AgentConfig.swift create mode 100644 Sources/AGUIClient/RunAgentParameters.swift create mode 100644 plans/pr-1512-implementation-plan.md diff --git a/Sources/AGUIAgentSDK/AgUiAgentConfig.swift b/Sources/AGUIAgentSDK/AgUiAgentConfig.swift index 8904d23..2075dd9 100644 --- a/Sources/AGUIAgentSDK/AgUiAgentConfig.swift +++ b/Sources/AGUIAgentSDK/AgUiAgentConfig.swift @@ -91,11 +91,6 @@ public struct AgUiAgentConfig: Sendable { /// Default: `.none` public var retryPolicy: HttpAgentConfiguration.RetryPolicy - /// Connection timeout in seconds. - /// - /// Default: `30` - public var connectTimeout: TimeInterval - // MARK: - Agent behaviour /// Optional system prompt prepended to each call's message list. @@ -144,7 +139,6 @@ public struct AgUiAgentConfig: Sendable { headers = [:] requestTimeout = 600 retryPolicy = .none - connectTimeout = 30 systemPrompt = nil debug = false toolRegistry = nil diff --git a/Sources/AGUIClient/AgentConfig.swift b/Sources/AGUIClient/AgentConfig.swift deleted file mode 100644 index 470eb57..0000000 --- a/Sources/AGUIClient/AgentConfig.swift +++ /dev/null @@ -1,138 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import AGUICore -import Foundation - -// MARK: - AgentConfig - -/// Base configuration for AG-UI agents. -public struct AgentConfig: Sendable { - /// Optional agent identifier for logging and tracking. - public var agentId: String? - /// Textual description of the agent's purpose. - public var description: String - /// Default thread ID used when none is specified. - public var threadId: String - /// Initial messages prepended to every run. - public var initialMessages: [any Message] - /// Initial JSON state. - public var initialState: State - /// When `true`, logs verbose pipeline output. - public var debug: Bool - - public init( - agentId: String? = nil, - description: String = "", - threadId: String = "default", - initialMessages: [any Message] = [], - initialState: State = Data("{}".utf8), - debug: Bool = false - ) { - self.agentId = agentId - self.description = description - self.threadId = threadId - self.initialMessages = initialMessages - self.initialState = initialState - self.debug = debug - } -} - -// MARK: - HttpAgentConfig - -/// HTTP-specific agent configuration. -public struct HttpAgentConfig: Sendable { - /// Base agent configuration. - public var base: AgentConfig - /// The agent endpoint URL string. - public var url: String - /// Custom HTTP headers. - public var headers: [String: String] - /// Request timeout in seconds. Default: 600. - public var requestTimeout: TimeInterval - /// Connection timeout in seconds. Default: 30. - public var connectTimeout: TimeInterval - /// Bearer token for authentication. - /// - /// When set, ``buildHeaders()`` includes `Authorization: Bearer `. - /// This property does **not** mutate ``headers`` — use ``buildHeaders()``. - public var bearerToken: String? - /// API key value. - public var apiKey: String? - /// Header name for the API key. Default: "X-API-Key". - public var apiKeyHeader: String - - // MARK: - Header builder - - /// Returns the merged HTTP header dictionary. - /// - /// Applies `bearerToken` and `apiKey` on top of ``headers``. - /// Explicit ``headers`` entries override auto-generated auth headers. - public func buildHeaders() -> [String: String] { - var result: [String: String] = [:] - if let key = apiKey { - result[apiKeyHeader] = key - } - if let token = bearerToken { - result["Authorization"] = "Bearer \(token)" - } - for (k, v) in headers { - result[k] = v - } - return result - } - - public init(url: String, base: AgentConfig = AgentConfig()) { - self.base = base - self.url = url - self.headers = [:] - self.requestTimeout = 600 - self.connectTimeout = 30 - self.bearerToken = nil - self.apiKey = nil - self.apiKeyHeader = "X-API-Key" - } -} - -// MARK: - RunAgentParameters - -/// Parameters for a single agent run. -public struct RunAgentParameters: Sendable { - public var runId: String? - public var tools: [Tool]? - public var context: [Context]? - public var forwardedProps: State? - - public init( - runId: String? = nil, - tools: [Tool]? = nil, - context: [Context]? = nil, - forwardedProps: State? = nil - ) { - self.runId = runId - self.tools = tools - self.context = context - self.forwardedProps = forwardedProps - } -} diff --git a/Sources/AGUIClient/RunAgentParameters.swift b/Sources/AGUIClient/RunAgentParameters.swift new file mode 100644 index 0000000..afc0a7a --- /dev/null +++ b/Sources/AGUIClient/RunAgentParameters.swift @@ -0,0 +1,48 @@ +/* + * MIT License + * + * Copyright (c) 2025 Perfect Aduh + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import AGUICore +import Foundation + +// MARK: - RunAgentParameters + +/// Parameters for a single agent run. +public struct RunAgentParameters: Sendable { + public var runId: String? + public var tools: [Tool]? + public var context: [Context]? + public var forwardedProps: State? + + public init( + runId: String? = nil, + tools: [Tool]? = nil, + context: [Context]? = nil, + forwardedProps: State? = nil + ) { + self.runId = runId + self.tools = tools + self.context = context + self.forwardedProps = forwardedProps + } +} diff --git a/plans/pr-1512-implementation-plan.md b/plans/pr-1512-implementation-plan.md new file mode 100644 index 0000000..f156e28 --- /dev/null +++ b/plans/pr-1512-implementation-plan.md @@ -0,0 +1,732 @@ +# PR #1512 Implementation Plan + +## Source + +Based on review feedback from [ag-ui-protocol/ag-ui#1512](https://github.com/ag-ui-protocol/ag-ui/pull/1512) and +cross-SDK parity analysis against the TypeScript (`sdks/typescript`) and Go (`sdks/community/go`) reference +implementations. + +## Status of Reviewer's Issues + +Most critical and high-priority bugs raised by the reviewer have **already been fixed** in the current +codebase. The items below are the confirmed remaining gaps. + +### Already Resolved — No Action Required + +| Issue | Evidence | +|-------|---------| +| C1 — Missing Reasoning events | All 7 `REASONING_*` cases in `EventType.swift`, structs + DTOs exist | +| C2 — Role.reasoning / encryptedValue | `Role.reasoning` exists; `encryptedValue` present on all 7 message types (`AssistantMessage`, `UserMessage`, `SystemMessage`, `ToolMessage`, `DeveloperMessage`, `ReasoningMessage`, `ActivityMessage`) and `ToolCall`; all message DTOs decode it | +| H1 — RunStartedEvent missing parentRunId/input | Both fields present | +| H2 — RunFinishedEvent missing result | `result: Data?` present | +| H3 — RunErrorEvent non-standard structure | Has `message: String`, `code: String?`; no extra fields | +| H4 — RawEvent reads `data` not `event` | `RawEventDTO` reads `jsonObject["event"]`, has `source: String?` | +| H5 — Bool/Int type priority | `AnyCodable` decodes `Bool` before `Int` in `PatchApplicator` | +| H6 — SSE line endings | `SseParser` normalises `\r\n` → `\n` and `\r` → `\n` | +| H7 — Duplicate assistant messages | `ToolCallEndEvent` is `break`; flush only at `ToolCallResultEvent` | +| H8 — JSON Pointer root path | `parsePath("/")` returns `[""]` per RFC 6901 | +| H9 — Timeout error missing tool name | `withTimeout` in `ToolRegistry.swift:323` passes `toolName` and throws `ToolExecutionError.timeout(toolName:duration:)` correctly | +| H10 — HTTPResponse leaks URLSession.AsyncBytes | `HTTPResponse.bytes` is `AsyncThrowingStream` | +| H11 — Dead AgentConfig / HttpAgentConfig | `AgentConfig` and `HttpAgentConfig` removed from `AgentConfig.swift`; `RunAgentParameters` kept (live — used by `AbstractAgent` + `HttpAgent`); moved to `RunAgentParameters.swift`; `connectTimeout` removed from `AgUiAgentConfig` | +| TextMessage* missing `name` | Both `TextMessageStartEvent` and `TextMessageChunkEvent` have `name: String?` | +| Tool missing `metadata` | `Tool.metadata: Data?` present with full encode/decode | +| No SSE reconnection | `HttpAgentTransport` has `lastEventId` tracking + retry loop | +| No SwiftUI/Combine integration | `AgentViewModelCompat` (`ObservableObject`/`@Published`) and `AgentViewModel` (`@Observable`) both exist in `AGUIAgentSDK` | +| `@frozen` on EventType | Not present | +| `@unchecked Sendable` | Not present in `Sources/` | +| `bearerToken` didSet | Uses `buildHeaders()` computed pattern — reads `bearerToken` dynamically at call time, no `didSet` needed | +| UnknownEvent.eventType returns `.raw` | `UnknownEvent.eventType` returns `.unknown` sentinel — distinct from the genuine `.raw` wire-format event | +| CircuitBreaker disconnected | `CircuitBreaker` actor is instantiated inside `ToolErrorHandler`; `allowRequest()`, `recordSuccess()`, `recordFailure()` all called from `handleError()` | +| RetryPolicy "dead code" | `RetryPolicy` IS fully wired: `AgUiAgentConfig.retryPolicy` → `HttpAgentConfiguration.retryPolicy` → `HttpAgentTransport.shouldRetry()` / `retryDelay()` — plan Bug 5 was wrong, removed | + +--- + +## Confirmed Gaps — Must Fix + +--- + +### Bug 1 — `MessageEncoder` missing `.reasoning` handler + +**File:** `Sources/AGUICore/Encoding/MessageEncoder.swift` + +`defaultRegistry()` handles 6 roles: `.developer`, `.system`, `.user`, `.assistant`, `.tool`, +`.activity`. The `.reasoning` role is absent. Calling `encode(reasoningMessage)` throws +`unsupportedRole(.reasoning)` at runtime — a silent crash for any consumer serialising conversation +history that contains a `ReasoningMessage`. + +Both TypeScript and Go treat `ReasoningMessage` as a first-class message type. + +**Fix:** Add private `encodeReasoningMessage()` function (mirrors `encodeAssistantMessage()`) and +register it under `.reasoning` in `defaultRegistry()`. + +--- + +### Bug 2 — `RunFinishedEvent` missing `outcome` field + +**Files:** +- `Sources/AGUICore/Events/LifecycleEvents/RunFinishedEvent.swift` +- `Sources/AGUICore/Decoding/EventDTO/LifecycleEventsDTO/RunFinishedEventDTO.swift` + +TypeScript defines: +```typescript +outcome?: { type: "success" } | { type: "interrupt", interrupts: Interrupt[] } +// Interrupt: { type: string; value?: any } +``` + +Without this field the SDK cannot distinguish a clean finish from an agent-requested interrupt — +both look identical to callers. Go's community SDK also lacks this field; TypeScript is the +authoritative spec. + +**Fix:** New `RunFinishedOutcome` enum + `Interrupt` struct in `AGUICore`; add +`outcome: RunFinishedOutcome? = nil` to `RunFinishedEvent` and decode it in the DTO. + +--- + +### Bug 3 — Media input content types missing `mimeType` + +**Files:** +- `Sources/AGUICore/Types/InputContent/ImageInputContent.swift` +- `Sources/AGUICore/Types/InputContent/AudioInputContent.swift` +- `Sources/AGUICore/Types/InputContent/VideoInputContent.swift` +- `Sources/AGUICore/Types/InputContent/DocumentInputContent.swift` + +TypeScript's `InputContentSource` carries `mimeType` on both data and URL sources. Swift's flat +`url: String?` / `data: String?` fields omit `mimeType`, making it impossible to express +`image/png` vs `image/jpeg` for inline base64 data — information a TypeScript server expects. +`BinaryInputContent` already has a required `mimeType: String`. + +**Fix:** Add `mimeType: String?` to the four media types (defaulted → no call-site breakage). +Update the four corresponding DTOs and `MessageEncoder.encodeUserMessage()`. + +--- + +### Bug 4 — `connectTimeout` declared but never consumed + +**Files:** +- `Sources/AGUIAgentSDK/AgUiAgentConfig.swift` — `public var connectTimeout: TimeInterval` +- `Sources/AGUIAgentSDK/StatefulAgUiAgentConfig.swift` — verify if present + +`HttpTransport` configures `URLSession` using only `configuration.timeout` +(`timeoutIntervalForRequest` and `timeoutIntervalForResource`). The `connectTimeout` field is +never read by any transport code — it is declared and set to `30` but silently ignored. + +**Fix:** Remove `connectTimeout` from `AgUiAgentConfig` and `StatefulAgUiAgentConfig`. If a +separate connection timeout is needed in future it should be wired through to +`HttpAgentConfiguration` and consumed by `HttpTransport`. + +--- + +### Bug 5 — `ActivityMessage` domain field name and type diverge from protocol + +**Files:** +- `Sources/AGUICore/Types/Messages/ActivityMessage.swift` +- `Sources/AGUICore/Decoding/MessageDTO/ActivityMessageDTO.swift` + +The protocol defines `content: Record` on `ActivityMessage`. The Swift domain type +exposes this as `activityContent: Data` — both the property name and the type differ. The DTO +correctly reads the wire key `"content"`, but re-exposes it as `activityContent`, so any Swift +consumer must know to look for `activityContent` even though the protocol field is `content`. + +**Fix:** Rename the domain property to `content` and change its type from `Data` to `AnyCodable` +(or `[String: AnyCodable]`) so it matches the protocol definition. Update `ActivityMessageDTO` +and `MessageEncoder.encodeActivityMessage()` accordingly. + +> Note: this is a **breaking public API change** — existing callers using `.activityContent` must +> be updated. Grep for `.activityContent` across `Sources/`, `Tests/`, and `Examples/` before +> committing. + +--- + +### Bug 6 — Fire-and-forget `Task` leaks in AbstractAgent, AgUiAgent, and ToolExecutionManager + +**Files:** +- `Sources/AGUIClient/AbstractAgent.swift:123` — `Task { await self.storage.setCurrentTask(nil) }` + inside a `defer` block +- `Sources/AGUIClient/AbstractAgent.swift:174` — `Task { await storage.currentTask?.cancel() }` + in `abortRun()` +- `Sources/AGUIClient/AbstractAgent.swift:178` — `Task { await storage.setDisposed(true) }` + in `dispose()` +- `Sources/AGUIAgentSDK/AgUiAgent.swift:164` — `Task { await manager.cancelAllExecutions() }` + in `close()` +- `Sources/AGUITools/Core/ToolExecutionManager.swift:163` — `let execTask = Task { await self.executeToolCall(...) }` + created but never stored or awaited — **confirmed fire-and-forget leak** + +> Note: `ChunkTransformer` and `EventVerifier` are NOT affected — both store their `Task` and +> cancel it via `continuation.onTermination`. Only the five sites above need fixing. + +These are called from synchronous functions. Fire-and-forget `Task { }` has no structured +lifetime — if the enclosing object is deallocated before the task runs, behaviour is undefined. + +**Fix:** Make `abortRun()`, `dispose()`, and `close()` `async` and `await` the actor calls +directly. For `ToolExecutionManager`, store `execTask` in a dictionary keyed by tool call ID so +it can be cancelled via `cancelAllExecutions()`. + +```swift +// Before +public func abortRun() { + Task { await storage.currentTask?.cancel() } +} + +// After — callers must be updated to await +public func abortRun() async { + await storage.currentTask?.cancel() +} +``` + +If making these `async` is a breaking API change, add `@discardableResult` internal async +variants and deprecate the synchronous wrappers with a migration note. + +**Call-site audit:** grep for `.abortRun()`, `.dispose()`, `.close()` across `Sources/`, +`Tests/`, and `Examples/ChatApp` and update each call site to `await`. + +--- + +### Bug 7 — Simple 1:1 DTOs add maintenance cost without benefit (H12) + +The reviewer correctly identified that simple events whose DTOs are verbatim field copies with no +wire-to-domain transformation add ~15 files of indirection with no engineering return. The fix is +not to eliminate the DTO pattern (it is necessary for complex events), but to let the simple +domain types conform to `Decodable` directly and delete the DTO shim. + +**DTOs to collapse** (confirmed 1:1 passthrough, no transformation): + +| DTO File | Domain Type | +|----------|-------------| +| `TextMessageStartEventDTO.swift` | `TextMessageStartEvent` | +| `TextMessageContentEventDTO.swift` | `TextMessageContentEvent` | +| `ToolCallStartEventDTO.swift` | `ToolCallStartEvent` | +| `ToolCallArgsEventDTO.swift` | `ToolCallArgsEvent` | +| `AssistantMessageDTO.swift` | `AssistantMessage` | +| `SystemMessageDTO.swift` | `SystemMessage` | +| `DeveloperMessageDTO.swift` | `DeveloperMessage` | + +**DTOs to keep** (complex mapping or JSONSerialization required): + +| DTO File | Reason to Keep | +|----------|---------------| +| `UserMessageDTO.swift` | Multimodal InputContent parsing | +| `ActivityMessageDTO.swift` | JSONSerialization for arbitrary content | +| `RunStartedEventDTO.swift` | Manual JSON parsing, `input` → `Data` transform | +| `CustomEventDTO.swift` | `name`→`customType`, `value`→`data` wire renaming | +| `RawEventDTO.swift` | `event` key → `Data`, untyped payload | +| All reasoning/lifecycle DTOs with optional fields | Non-trivial null handling | + +**Fix per DTO:** +1. Add `CodingKeys` enum and `Decodable` conformance to the domain type. +2. Delete the DTO `.swift` file. +3. Update the event/message decoder registry handler to decode the domain type directly + (replace `try SomeDTO.decode(from: data).toDomain()` with + `try JSONDecoder().decode(DomainType.self, from: data)`). + +**Verify:** `swift build && swift test` + +--- + +### Bug 8 — CI: SwiftLint disabled, no Linux build, single-version matrix + +**File:** `.github/workflows/ci.yml` + +SwiftLint is explicitly commented out. No Linux target is in the matrix. The reviewer flagged +this; the CLAUDE.md pre-commit checklist requires `swiftlint lint` before every commit. + +**Fix:** +1. Re-enable SwiftLint in the `lint` CI job (install via Homebrew on `macos-latest`; run + `swiftlint lint --strict`). +2. Add a `build-linux` job using `swift:latest` Docker image (or `ubuntu-latest` with Swift + toolchain) to catch Linux-incompatible Foundation APIs. +3. Optionally add `swift-5.9` and `swift-5.10` to the matrix to guard minimum version support. + +--- + +## Test Coverage Gaps — TDD Required + +| Gap | Reviewer Issue | Scope | New File(s) | +|-----|---------------|-------|-------------| +| A — Reasoning events | — | 7 event types + `ReasoningMessage` | `Tests/AGUICoreTests/ReasoningEvents/*.swift` + `ReasoningMessageTests.swift` | +| B — `MessageEncoder` | H15 | All 7 roles (`.reasoning` added by Bug 1) | `Tests/AGUICoreTests/Encoding/MessageEncoderTests.swift` | +| C — `StatefulAgUiAgent` | H13 | History, state, multi-tool regression | `Tests/AGUIAgentSDKTests/StatefulAgUiAgentTests.swift` | +| D — `ToolExecutionManager` | H14 | Stream forwarding, retry, circuit-open, concurrency, task cancellation | `Tests/AGUIToolsTests/Core/ToolExecutionManagerTests.swift` | +| E — `StepFinishedEvent` | H15 | Decode, fields, eventType | `Tests/AGUICoreTests/LifeCycleEvents/StepFinishedEventTests.swift` | +| F — `RunFinishedEvent` outcome | — | New outcome decode cases (after Bug 2) | Extend `RunFinishedEventTests.swift` | + +--- + +## Commit Groups + +### Commit 0 — `fix: remove dead AgentConfig types and connectTimeout` +**Independent — do first, smallest change, unblocks H11 response to reviewer** + +1. Delete `Sources/AGUIClient/AgentConfig.swift` entirely (`AgentConfig`, `HttpAgentConfig`, + `RunAgentParameters` — all unreferenced). +2. Remove `connectTimeout: TimeInterval` from `Sources/AGUIAgentSDK/AgUiAgentConfig.swift`. +3. Remove `connectTimeout: TimeInterval` from `Sources/AGUIAgentSDK/StatefulAgUiAgentConfig.swift` + (verify it is present first). +4. Run `swift build` — must pass with zero errors. +5. No test changes needed (these types have no tests because they are dead code). + +**Verify:** `swift build && swift test` + +--- + +### Commit 1 — `fix: add mimeType to media input content types` +**Independent** + +**Red — extend existing test files:** +- `Tests/AGUICoreTests/Types/InputContent/ImageInputContentTests.swift` +- `Tests/AGUICoreTests/Types/InputContent/AudioInputContentTests.swift` +- `Tests/AGUICoreTests/Types/InputContent/VideoInputContentTests.swift` +- `Tests/AGUICoreTests/Types/InputContent/DocumentInputContentTests.swift` + +Add cases: `mimeType` round-trips JSON encode/decode; `mimeType` nil when absent. + +**Green:** +1. Add `mimeType: String?` to `ImageInputContent`, `AudioInputContent`, `VideoInputContent`, + `DocumentInputContent` — init param defaulted to `nil`, add to `CodingKeys`, encode/decode. +2. Update 4 DTOs: pass `mimeType` through in `toDomain()`. +3. Update `MessageEncoder.encodeUserMessage()`: add `d["mimeType"] = mimeType` where non-nil for + each media content block. + +**Verify:** `swift test --filter InputContentTests` + +--- + +### Commit 2 — `fix: add .reasoning handler to MessageEncoder` +**Independent** + +**Red — new file:** `Tests/AGUICoreTests/Encoding/MessageEncoderTests.swift` + +Initial cases (`.reasoning` only, to fail fast): +``` +test_encodeReasoningMessage_producesCorrectJSON() +test_encodeReasoningMessage_withEncryptedValue() +test_encodeReasoningMessage_contentNilOmitted() +test_unsupportedRole_throws() +``` + +**Green:** +1. Add `encodeReasoningMessage(_ message: any Message, encoder: JSONEncoder) throws -> Data` + — builds dict: `id`, `role`, `content?`, `name?`, `encryptedValue?`, returns + `JSONSerialization.data(withJSONObject:)`. Mirrors `encodeAssistantMessage()`. +2. Register in `defaultRegistry()` under `.reasoning`. +3. Update doc comment: "all 6 message types" → "all 7 message types". + +**Verify:** `swift test --filter MessageEncoderTests` + +--- + +### Commit 3 — `test: add reasoning event test suite` +**Independent — no production changes** + +**New directory:** `Tests/AGUICoreTests/ReasoningEvents/` + +**New files:** +- `ReasoningStartEventTests.swift` +- `ReasoningMessageStartEventTests.swift` +- `ReasoningMessageContentEventTests.swift` +- `ReasoningMessageEndEventTests.swift` +- `ReasoningMessageChunkEventTests.swift` +- `ReasoningEndEventTests.swift` +- `ReasoningEncryptedValueEventTests.swift` + +Each file covers: +- Decode valid JSON → correct domain struct (`AGUIEventDecoderTestHelpers`) +- `eventType` returns correct `EventType` case +- Required fields round-trip +- Optional fields (`timestamp`, `rawEvent`) decode when present, nil when absent +- Missing required field throws `DecodingError` +- `ReasoningEncryptedValueEvent`: both `subtype` values (`"tool-call"`, `"message"`) decode + correctly; `entityId` + `encryptedValue` are required + +**New file:** `Tests/AGUICoreTests/Types/Messages/ReasoningMessageTests.swift` +- `role` is `.reasoning`, `encryptedValue` round-trips, `content` optional. + +**Pattern:** follow `Tests/AGUICoreTests/TextMessageEvents/TextMessageStartEventTests.swift`. + +**Verify:** `swift test --filter ReasoningEvents` + +--- + +### Commit 4 — `test: add StepFinishedEvent tests` +**Independent — no production changes** + +**New file:** `Tests/AGUICoreTests/LifeCycleEvents/StepFinishedEventTests.swift` + +Mirror `StepStartedEventTests.swift` exactly — same structure, same cases, different type. + +**Verify:** `swift test --filter StepFinishedEventTests` + +--- + +### Commit 5 — `refactor: collapse simple 1:1 DTOs to direct Decodable conformance` +**Independent — can run in parallel with Commits 1–4** + +Addresses H12. Reduces DTO file count by ~7 files without removing the pattern for complex events. + +**Red — for each domain type being made Decodable, verify existing tests still decode correctly +after the change. No new test files needed; test breakage = regression.** + +**Green — for each of the 7 DTOs listed in Bug 8:** +1. Add `CodingKeys` enum to the domain type if not present. +2. Add `Decodable` init (or synthesised conformance if field names match wire exactly). +3. Update the decoder registry handler: replace `DomainDTO.decode(from: data).toDomain()` with + `try JSONDecoder().decode(DomainType.self, from: data)`. +4. Delete the DTO `.swift` file. + +**Order matters within this commit** — do one type at a time, run `swift build` between each to +catch registry call-site errors immediately. + +**Verify:** `swift build && swift test` + +--- + +### Commit 6 — `fix: rename ActivityMessage.activityContent to content` +**Independent — can run in parallel with Commits 1–4** + +**Files:** +- `Sources/AGUICore/Types/Messages/ActivityMessage.swift` +- `Sources/AGUICore/Decoding/MessageDTO/ActivityMessageDTO.swift` +- `Sources/AGUICore/Encoding/MessageEncoder.swift` — `encodeActivityMessage()` + +**Red — update or add test:** +``` +test_activityMessage_contentFieldRoundTrips() +test_activityMessage_wireKeyIsContent() +``` + +**Green:** +1. Rename domain property `activityContent: Data` → `content: AnyCodable` (use `AnyCodable` or + `[String: AnyCodable]` to match `Record`). +2. Update `ActivityMessageDTO.toDomain()` to populate the renamed field. +3. Update `MessageEncoder.encodeActivityMessage()` to read `message.content`. +4. Grep for `.activityContent` across `Sources/`, `Tests/`, `Examples/` — update every callsite. + +**Verify:** `swift build && swift test` + +--- + +### Commit 7 — `fix: add RunFinishedOutcome to RunFinishedEvent` +**Begin after Commits 1–6 CI is green (no code dependency, just stability gate)** + +**Red — extend** `Tests/AGUICoreTests/LifeCycleEvents/RunFinishedEventTests.swift`: +``` +test_decode_withSuccessOutcome() +test_decode_withInterruptOutcome_singleInterrupt() +test_decode_withInterruptOutcome_multipleInterrupts() +test_decode_withoutOutcome_isNil() +test_interrupt_valueField_isOptional() +``` + +**Green:** + +New types (same file or sibling `RunFinishedOutcome.swift`): +```swift +public struct Interrupt: Equatable, Hashable, Sendable, Codable { + public let type: String + public let value: Data? // raw JSON — arbitrary shape +} + +public enum RunFinishedOutcome: Equatable, Hashable, Sendable { + case success + case interrupt(interrupts: [Interrupt]) +} +``` + +`RunFinishedEvent`: add `public let outcome: RunFinishedOutcome?`; append +`outcome: RunFinishedOutcome? = nil` to init → **zero call-site breakage**. + +DTO update (`RunFinishedEventDTO`): +- Read `outcome` dict → `type` key +- `"success"` → `.success` +- `"interrupt"` → decode `interrupts` array → `.interrupt(interrupts:)` +- `Interrupt.value`: decode as `Any` via `JSONSerialization`, re-serialise to `Data` + +**Equatable/Hashable:** synthesised automatically — no manual conformance needed. + +**Verify:** `swift test --filter RunFinishedEventTests` + +--- + +### Commit 8 — `test: add ToolExecutionManager test suite` +**Can run in parallel with Commits 7, 9, and 10** + +**New file:** `Tests/AGUIToolsTests/Core/ToolExecutionManagerTests.swift` + +Check for `MockToolRegistry` / `MockToolResponseHandler` in `Tests/AGUIToolsTests/`; create in +`Mocks/` if absent. + +**Test cases:** +``` +test_processEventStream_forwardsAllEvents() +test_toolCallStartArgsEnd_buildsCorrectToolCall() +test_toolCallEnd_triggersRegistryExecution() +test_successfulExecution_sendsToolMessageViaResponseHandler() +test_executionEvents_startedExecutingSucceeded_emittedInOrder() +test_retryOnTransientError_retrysUpToMaxAttempts() +test_circuitOpen_sendsErrorToolMessage_emitsFailedEvent() +test_cancelAllExecutions_cancelsInFlightTasks() +test_multipleToolCalls_allCompleteBeforeStreamTerminates() +test_runFinishedEvent_doesNotCancelPendingExecutions() +test_execTask_storedAndCancelledOnCancelAllExecutions() // regression for Bug 6 fix +``` + +`ToolExecutionManager` is an `actor` — all test interaction uses `await`. +Inject controlled event sequences via `AsyncThrowingStream`. + +**Verify:** `swift test --filter ToolExecutionManagerTests` + +--- + +### Commit 9 — `test: expand MessageEncoder tests to all 7 roles` +**Can run in parallel with Commits 7, 8, and 10** + +Expand `Tests/AGUICoreTests/Encoding/MessageEncoderTests.swift` (created in Commit 2): + +``` +test_encodeDeveloperMessage_requiredFields() +test_encodeSystemMessage_optionalContentOmitted() +test_encodeUserMessage_textContent() +test_encodeUserMessage_multimodalContent_image_withMimeType() // uses Commit 1 +test_encodeUserMessage_multimodalContent_audio() +test_encodeUserMessage_multimodalContent_video() +test_encodeUserMessage_multimodalContent_document() +test_encodeUserMessage_multimodalContent_binary() +test_encodeAssistantMessage_withToolCalls() +test_encodeAssistantMessage_encryptedValue() +test_encodeToolMessage_withError() +test_encodeToolMessage_encryptedValue() +test_encodeActivityMessage_contentFieldName() // wire key is "content" +test_encodeActivityMessage_arbitraryShape() +test_invalidMessageType_throws() +``` + +**Verify:** `swift test --filter MessageEncoderTests` + +--- + +### Commit 10 — `fix: eliminate unstructured Task leaks` +**Can run in parallel with Commits 7, 8, and 9** + +**Files:** +- `Sources/AGUIClient/AbstractAgent.swift` +- `Sources/AGUIAgentSDK/AgUiAgent.swift` +- `Sources/AGUITools/Core/ToolExecutionManager.swift` + +**Changes:** + +1. `AbstractAgent.abortRun()` — make `async`, replace `Task { ... }` with direct `await`: + ```swift + public func abortRun() async { + await storage.currentTask?.cancel() + } + ``` + +2. `AbstractAgent.dispose()` — make `async`: + ```swift + public func dispose() async { + await storage.setDisposed(true) + } + ``` + +3. `AbstractAgent.swift:123` — the `defer` block cannot `await`. Move `setCurrentTask(nil)` out + of `defer` into explicit success/error paths instead. + +4. `AgUiAgent.close()` — make `async`: + ```swift + public func close() async { + if let manager = self.toolExecutionManager { + await manager.cancelAllExecutions() + } + await httpAgent.dispose() + } + ``` + +5. `ToolExecutionManager.swift:163` — store `execTask` in a dictionary keyed by tool call ID: + ```swift + // Before — fire-and-forget + let execTask = Task { await self.executeToolCall(...) } + + // After — stored for cancellation + let execTask = Task { await self.executeToolCall(...) } + activeTasks[toolCallId] = execTask + ``` + Update `cancelAllExecutions()` to cancel and remove all entries from `activeTasks`. + +**Call-site audit:** grep for `.abortRun()`, `.dispose()`, `.close()` across `Sources/`, +`Tests/`, and `Examples/ChatApp` — update each call site to `await`. + +**Verify:** `swift build && swift test` + +--- + +### Commit 11 — `ci: re-enable SwiftLint and add Linux build` +**Can run in parallel with Commits 7, 8, 9, and 10** + +**File:** `.github/workflows/ci.yml` + +1. Re-enable the SwiftLint step in the `lint` job: + ```yaml + - name: Install SwiftLint + run: brew install swiftlint + - name: Run SwiftLint + run: swiftlint lint --strict + ``` +2. Add a `build-linux` job: + ```yaml + build-linux: + runs-on: ubuntu-latest + container: swift:latest + steps: + - uses: actions/checkout@v4 + - run: swift build + - run: swift test + ``` + +**Verify:** Push to branch, confirm CI passes on both macOS and Linux. + +--- + +### Commit 12 — `test: add StatefulAgUiAgent tests` +**Must be last — depends on all prior commits being stable** + +**New file:** `Tests/AGUIAgentSDKTests/StatefulAgUiAgentTests.swift` + +**Seam strategy:** `StatefulAgUiAgent` hard-constructs `HttpAgent` internally with no injectable +transport. Use `AgUiAgent` (which accepts `AgentTransport` via its secondary init) to exercise the +shared `trackHistoryAndState` logic. Reuse `CapturingTransport` from `AgUiAgentTests.swift` +(already `internal` scope, accessible within the same test target). + +If direct `StatefulAgUiAgent` coverage is required, add a package-internal init accepting +`AgentTransport` behind `@testable import`. + +**Test cases:** +``` +// History lifecycle +test_chat_appendsUserMessage() +test_textMessageEndEvent_appendsAssistantMessage() +test_textMessageEnd_appendsOnlyOnce_notAtContent() + +// CRITICAL regression — H7 +test_multiToolCallSequence_appendsAssistantMessageExactlyOnce() +// Sequence: ToolCallStart×2 → ToolCallArgs×2 → ToolCallEnd×2 → ToolCallResult×1 +// Assert: history contains exactly 1 AssistantMessage + +// Tool result +test_toolCallResultEvent_appendsToolMessage() + +// State management +test_stateSnapshotEvent_updatesState() +test_stateDeltaEvent_appliesJsonPatch() +test_messagesSnapshotEvent_replacesHistory() + +// Thread isolation +test_separateThreadIds_haveIndependentHistories() + +// System prompt +test_firstMessage_prependsSystemPrompt() +test_secondMessage_doesNotDuplicateSystemPrompt() + +// History trim +test_historyExceedsMaxLength_isTrimmed() + +// Clear +test_clearHistory_specificThread() +test_clearHistory_allThreads() + +// ActivityMessage content field (regression for Bug 6) +test_activityMessage_exposesDotContent_notDotActivityContent() +``` + +**Verify:** `swift build && swift test` (full suite — confirm zero regressions) + +--- + +## Parallelism Map + +``` +Commit 0: Dead code removal (AgentConfig, HttpAgentConfig, connectTimeout) ✓ DONE + │ + ▼ (must be green before anything else) +┌─ Commit 1: mimeType on InputContent ─┐ +├─ Commit 2: MessageEncoder .reasoning ─┤ +├─ Commit 3: Reasoning event tests ─┤ All independent +├─ Commit 4: StepFinishedEvent tests ─┤ Run in parallel +├─ Commit 5: Collapse simple 1:1 DTOs (H12) ─┤ +└─ Commit 6: ActivityMessage content field ─┘ + │ + ▼ (all green) + Commit 7: RunFinishedOutcome + │ + ┌──────────────┼──────────────┬──────────────┐ + ▼ ▼ ▼ ▼ + Commit 8: Commit 9: Commit 10: Commit 11: + ToolExecution Encoder Task leak CI + Manager tests full suite cleanup improvements + └──────────────┬──────────────┴──────────────┘ + ▼ + Commit 12: StatefulAgUiAgent tests +``` + +--- + +## Ripple Effect Register + +| Change | Call sites affected | Mitigation | +|--------|---------------------|------------| +| Delete `AgentConfig` and `HttpAgentConfig` from `AgentConfig.swift`; move `RunAgentParameters` to `RunAgentParameters.swift` | None — dead types had no external callers in Sources/Tests | ✓ Done — `swift build` confirmed | +| Remove `connectTimeout` from `AgUiAgentConfig` | Any callsite reading `.connectTimeout` | ✓ Done — grep confirmed no callsites outside definition files | +| `Image/Audio/Video/DocumentInputContent` add `mimeType` | 4 DTOs (`toDomain()`), `MessageEncoder.encodeUserMessage()` | Covered in Commit 1; `mimeType` defaults `nil` — no existing callers break | +| `MessageEncoder.defaultRegistry()` add `.reasoning` | All `MessageEncoder()` consumers | Additive only — no breakage | +| Collapse 7 DTOs | Decoder registry handlers for each collapsed event type | Update each handler in same commit; run `swift build` between each | +| `ActivityMessage.activityContent` → `content` | All `.activityContent` references in Sources, Tests, Examples | **Breaking change** — grep first, update all callsites in same commit | +| `RunFinishedEvent` add `outcome` | All `RunFinishedEvent(...)` call sites | `outcome` defaults `nil` — zero breakage | +| New `RunFinishedOutcome` + `Interrupt` types | `Equatable`/`Hashable` synthesis on `RunFinishedEvent` | Automatic synthesis — no manual conformance | +| `abortRun()`, `dispose()`, `close()` become `async` | All call sites in `Sources/`, `Tests/`, `Examples/ChatApp` | Audit with grep before committing; update each call site to `await` | +| `ToolExecutionManager` stores `execTask` in dictionary | `cancelAllExecutions()` must drain the dictionary | Covered in Commit 10; add regression test in Commit 8 | + +--- + +## Pre-Commit Checklist + +Run after each commit group before pushing: + +```bash +swift build +swift test +swift package plugin --allow-writing-to-package-directory swiftformat +swiftlint lint +``` + +--- + +## Commit Message Format + +``` +fix: remove dead AgentConfig types and connectTimeout ← Commit 0 ✓ +fix: add mimeType to media input content types ← Commit 1 +fix: add .reasoning handler to MessageEncoder ← Commit 2 +test: add reasoning event test suite ← Commit 3 +test: add StepFinishedEvent tests ← Commit 4 +refactor: collapse simple 1:1 DTOs to direct Decodable conformance ← Commit 5 +fix: rename ActivityMessage.activityContent to content ← Commit 6 +fix: add RunFinishedOutcome to RunFinishedEvent ← Commit 7 +test: add ToolExecutionManager test suite ← Commit 8 +test: expand MessageEncoder tests to all 7 roles ← Commit 9 +fix: eliminate unstructured Task leaks in AbstractAgent, AgUiAgent, ToolExecutionManager ← Commit 10 +ci: re-enable SwiftLint and add Linux build ← Commit 11 +test: add StatefulAgUiAgent tests ← Commit 12 +``` + +--- + +## PR Comment Responses Required + +**H11 — Config type proliferation:** After Commit 0, only 3 config types remain, each at a +distinct layer (`HttpAgentConfiguration` at transport, `AgUiAgentConfig` at agent, +`StatefulAgUiAgentConfig` at stateful agent). The dead `AgentConfig`/`HttpAgentConfig` types +have been removed. Explain the layered architecture rationale. + +**H12 — DTO layer:** Addressed in Commit 5. The 7 simple 1:1 DTOs (TextMessageStartEvent, +TextMessageContentEvent, ToolCallStartEvent, ToolCallArgsEvent, AssistantMessage, SystemMessage, +DeveloperMessage) now conform to `Decodable` directly — the DTO shim has been removed for these. +Complex DTOs (UserMessage, ActivityMessage, CustomEvent, RawEvent, RunStartedEvent) are retained +where JSONSerialization or wire-to-domain field mapping is genuinely required. From a7b18774615d28c0c4db6df93d7f3a19cfe8723d Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 14:12:45 -0400 Subject: [PATCH 02/19] fix: add mimeType to media input content types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add mimeType: String? (defaulted nil) to ImageInputContent, AudioInputContent, and VideoInputContent — matching TypeScript's InputContentSource.mimeType field. DocumentInputContent already had it. - Update the three corresponding DTOs to decode and pass mimeType through toDomain() - Update MessageEncoder.encodeUserMessage() to include mimeType in the JSON output for image, audio, and video content blocks - All existing call sites unaffected (new param defaults to nil) --- .../AudioInputContentDTO.swift | 10 ++-- .../ImageInputContentDTO.swift | 10 ++-- .../VideoInputContentDTO.swift | 9 +-- .../AGUICore/Encoding/MessageEncoder.swift | 3 + .../InputContent/AudioInputContent.swift | 11 +++- .../InputContent/ImageInputContent.swift | 11 +++- .../InputContent/VideoInputContent.swift | 17 ++++-- .../InputContent/AudioInputContentTests.swift | 48 +++++++++++++++ .../InputContent/ImageInputContentTests.swift | 60 +++++++++++++++++++ .../InputContent/VideoInputContentTests.swift | 48 +++++++++++++++ 10 files changed, 207 insertions(+), 20 deletions(-) diff --git a/Sources/AGUICore/Decoding/InputContentDTO/AudioInputContentDTO.swift b/Sources/AGUICore/Decoding/InputContentDTO/AudioInputContentDTO.swift index e847d4e..fc5b03a 100644 --- a/Sources/AGUICore/Decoding/InputContentDTO/AudioInputContentDTO.swift +++ b/Sources/AGUICore/Decoding/InputContentDTO/AudioInputContentDTO.swift @@ -29,6 +29,7 @@ struct AudioInputContentDTO { let url: String? let data: String? let format: String? + let mimeType: String? static func decode(from data: Data, decoder: JSONDecoder = JSONDecoder()) throws -> AudioInputContentDTO { guard let jsonObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else { @@ -62,19 +63,20 @@ struct AudioInputContentDTO { return AudioInputContentDTO( url: url, data: dataStr, - format: jsonObject["format"] as? String + format: jsonObject["format"] as? String, + mimeType: jsonObject["mimeType"] as? String ) } func toDomain() -> AudioInputContent { if let url = url { - return AudioInputContent(url: url, format: format) + return AudioInputContent(url: url, format: format, mimeType: mimeType) } else { - return AudioInputContent(data: data!, format: format) + return AudioInputContent(data: data!, format: format, mimeType: mimeType) } } private enum CodingKeys: String, CodingKey { - case type, url, data, format + case type, url, data, format, mimeType } } diff --git a/Sources/AGUICore/Decoding/InputContentDTO/ImageInputContentDTO.swift b/Sources/AGUICore/Decoding/InputContentDTO/ImageInputContentDTO.swift index 797ad0e..c7c0174 100644 --- a/Sources/AGUICore/Decoding/InputContentDTO/ImageInputContentDTO.swift +++ b/Sources/AGUICore/Decoding/InputContentDTO/ImageInputContentDTO.swift @@ -29,6 +29,7 @@ struct ImageInputContentDTO { let url: String? let data: String? let detail: String? + let mimeType: String? static func decode(from data: Data, decoder: JSONDecoder = JSONDecoder()) throws -> ImageInputContentDTO { guard let jsonObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else { @@ -62,19 +63,20 @@ struct ImageInputContentDTO { return ImageInputContentDTO( url: url, data: dataStr, - detail: jsonObject["detail"] as? String + detail: jsonObject["detail"] as? String, + mimeType: jsonObject["mimeType"] as? String ) } func toDomain() -> ImageInputContent { if let url = url { - return ImageInputContent(url: url, detail: detail) + return ImageInputContent(url: url, detail: detail, mimeType: mimeType) } else { - return ImageInputContent(data: data!, detail: detail) + return ImageInputContent(data: data!, detail: detail, mimeType: mimeType) } } private enum CodingKeys: String, CodingKey { - case type, url, data, detail + case type, url, data, detail, mimeType } } diff --git a/Sources/AGUICore/Decoding/InputContentDTO/VideoInputContentDTO.swift b/Sources/AGUICore/Decoding/InputContentDTO/VideoInputContentDTO.swift index a87703a..62e9434 100644 --- a/Sources/AGUICore/Decoding/InputContentDTO/VideoInputContentDTO.swift +++ b/Sources/AGUICore/Decoding/InputContentDTO/VideoInputContentDTO.swift @@ -28,6 +28,7 @@ import Foundation struct VideoInputContentDTO { let url: String? let data: String? + let mimeType: String? static func decode(from data: Data, decoder: JSONDecoder = JSONDecoder()) throws -> VideoInputContentDTO { guard let jsonObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else { @@ -58,18 +59,18 @@ struct VideoInputContentDTO { ) } - return VideoInputContentDTO(url: url, data: dataStr) + return VideoInputContentDTO(url: url, data: dataStr, mimeType: jsonObject["mimeType"] as? String) } func toDomain() -> VideoInputContent { if let url = url { - return VideoInputContent(url: url) + return VideoInputContent(url: url, mimeType: mimeType) } else { - return VideoInputContent(data: data!) + return VideoInputContent(data: data!, mimeType: mimeType) } } private enum CodingKeys: String, CodingKey { - case type, url, data + case type, url, data, mimeType } } diff --git a/Sources/AGUICore/Encoding/MessageEncoder.swift b/Sources/AGUICore/Encoding/MessageEncoder.swift index 8375082..246e564 100644 --- a/Sources/AGUICore/Encoding/MessageEncoder.swift +++ b/Sources/AGUICore/Encoding/MessageEncoder.swift @@ -311,17 +311,20 @@ private func encodeUserMessage(_ message: any Message, encoder: JSONEncoder) thr if let url = imagePart.url { d["url"] = url } if let data = imagePart.data { d["data"] = data } if let detail = imagePart.detail { d["detail"] = detail } + if let mimeType = imagePart.mimeType { d["mimeType"] = mimeType } contentArray.append(d) } else if let audioPart = part as? AudioInputContent { var d: [String: Any] = ["type": "audio"] if let url = audioPart.url { d["url"] = url } if let data = audioPart.data { d["data"] = data } if let format = audioPart.format { d["format"] = format } + if let mimeType = audioPart.mimeType { d["mimeType"] = mimeType } contentArray.append(d) } else if let videoPart = part as? VideoInputContent { var d: [String: Any] = ["type": "video"] if let url = videoPart.url { d["url"] = url } if let data = videoPart.data { d["data"] = data } + if let mimeType = videoPart.mimeType { d["mimeType"] = mimeType } contentArray.append(d) } else if let docPart = part as? DocumentInputContent { var d: [String: Any] = ["type": "document"] diff --git a/Sources/AGUICore/Types/InputContent/AudioInputContent.swift b/Sources/AGUICore/Types/InputContent/AudioInputContent.swift index 4483663..8ecbca2 100644 --- a/Sources/AGUICore/Types/InputContent/AudioInputContent.swift +++ b/Sources/AGUICore/Types/InputContent/AudioInputContent.swift @@ -47,16 +47,21 @@ public struct AudioInputContent: InputContent, Hashable, Sendable { /// Common values: `"mp3"`, `"wav"`, `"ogg"`, `"flac"`. public let format: String? + /// Optional MIME type of the audio (e.g., `"audio/mpeg"`, `"audio/wav"`). + public let mimeType: String? + /// Creates audio content from a URL. /// /// - Parameters: /// - url: URL pointing to the audio file /// - format: Optional format identifier (e.g., `"mp3"`) - public init(url: String, format: String? = nil) { + /// - mimeType: Optional MIME type (e.g., `"audio/mpeg"`) + public init(url: String, format: String? = nil, mimeType: String? = nil) { self.type = "audio" self.url = url self.data = nil self.format = format + self.mimeType = mimeType } /// Creates audio content from base64-encoded data. @@ -64,10 +69,12 @@ public struct AudioInputContent: InputContent, Hashable, Sendable { /// - Parameters: /// - data: Base64-encoded audio bytes /// - format: Optional format identifier (e.g., `"wav"`) - public init(data: String, format: String? = nil) { + /// - mimeType: Optional MIME type (e.g., `"audio/wav"`) + public init(data: String, format: String? = nil, mimeType: String? = nil) { self.type = "audio" self.url = nil self.data = data self.format = format + self.mimeType = mimeType } } diff --git a/Sources/AGUICore/Types/InputContent/ImageInputContent.swift b/Sources/AGUICore/Types/InputContent/ImageInputContent.swift index 7028c09..b5d47d4 100644 --- a/Sources/AGUICore/Types/InputContent/ImageInputContent.swift +++ b/Sources/AGUICore/Types/InputContent/ImageInputContent.swift @@ -47,16 +47,21 @@ public struct ImageInputContent: InputContent, Hashable, Sendable { /// Common values: `"high"`, `"low"`, `"auto"`. public let detail: String? + /// Optional MIME type of the image (e.g., `"image/png"`, `"image/jpeg"`). + public let mimeType: String? + /// Creates an image content from a URL. /// /// - Parameters: /// - url: URL pointing to the image /// - detail: Optional detail level (`"high"`, `"low"`, `"auto"`) - public init(url: String, detail: String? = nil) { + /// - mimeType: Optional MIME type (e.g., `"image/png"`) + public init(url: String, detail: String? = nil, mimeType: String? = nil) { self.type = "image" self.url = url self.data = nil self.detail = detail + self.mimeType = mimeType } /// Creates an image content from base64-encoded data. @@ -64,10 +69,12 @@ public struct ImageInputContent: InputContent, Hashable, Sendable { /// - Parameters: /// - data: Base64-encoded image bytes /// - detail: Optional detail level (`"high"`, `"low"`, `"auto"`) - public init(data: String, detail: String? = nil) { + /// - mimeType: Optional MIME type (e.g., `"image/jpeg"`) + public init(data: String, detail: String? = nil, mimeType: String? = nil) { self.type = "image" self.url = nil self.data = data self.detail = detail + self.mimeType = mimeType } } diff --git a/Sources/AGUICore/Types/InputContent/VideoInputContent.swift b/Sources/AGUICore/Types/InputContent/VideoInputContent.swift index c12a261..f86e25c 100644 --- a/Sources/AGUICore/Types/InputContent/VideoInputContent.swift +++ b/Sources/AGUICore/Types/InputContent/VideoInputContent.swift @@ -41,21 +41,30 @@ public struct VideoInputContent: InputContent, Hashable, Sendable { /// Optional base64-encoded video data. public let data: String? + /// Optional MIME type of the video (e.g., `"video/mp4"`, `"video/webm"`). + public let mimeType: String? + /// Creates video content from a URL. /// - /// - Parameter url: URL pointing to the video file - public init(url: String) { + /// - Parameters: + /// - url: URL pointing to the video file + /// - mimeType: Optional MIME type (e.g., `"video/mp4"`) + public init(url: String, mimeType: String? = nil) { self.type = "video" self.url = url self.data = nil + self.mimeType = mimeType } /// Creates video content from base64-encoded data. /// - /// - Parameter data: Base64-encoded video bytes - public init(data: String) { + /// - Parameters: + /// - data: Base64-encoded video bytes + /// - mimeType: Optional MIME type (e.g., `"video/webm"`) + public init(data: String, mimeType: String? = nil) { self.type = "video" self.url = nil self.data = data + self.mimeType = mimeType } } diff --git a/Tests/AGUICoreTests/Types/InputContent/AudioInputContentTests.swift b/Tests/AGUICoreTests/Types/InputContent/AudioInputContentTests.swift index c7cec4d..03b9f36 100644 --- a/Tests/AGUICoreTests/Types/InputContent/AudioInputContentTests.swift +++ b/Tests/AGUICoreTests/Types/InputContent/AudioInputContentTests.swift @@ -159,4 +159,52 @@ final class AudioInputContentTests: XCTestCase { let content = AudioInputContent(url: "https://example.com/clip.mp3") Task { XCTAssertEqual(content.type, "audio") } } + + // MARK: - mimeType + + func test_mimeType_isNilByDefault_url() { + XCTAssertNil(AudioInputContent(url: "https://example.com/clip.mp3").mimeType) + } + + func test_mimeType_isNilByDefault_data() { + XCTAssertNil(AudioInputContent(data: "base64audio").mimeType) + } + + func test_mimeType_roundTripsViaURLInit() { + let content = AudioInputContent(url: "https://example.com/clip.mp3", mimeType: "audio/mpeg") + XCTAssertEqual(content.mimeType, "audio/mpeg") + } + + func test_mimeType_roundTripsViaDataInit() { + let content = AudioInputContent(data: "base64audio", mimeType: "audio/wav") + XCTAssertEqual(content.mimeType, "audio/wav") + } + + func test_mimeType_decodesFromJSON() throws { + let json = Data(""" + {"type":"audio","url":"https://example.com/clip.mp3","mimeType":"audio/mpeg"} + """.utf8) + let dto = try AudioInputContentDTO.decode(from: json) + let content = dto.toDomain() + XCTAssertEqual(content.mimeType, "audio/mpeg") + } + + func test_mimeType_isNilWhenAbsentInJSON() throws { + let json = Data(""" + {"type":"audio","url":"https://example.com/clip.mp3"} + """.utf8) + let dto = try AudioInputContentDTO.decode(from: json) + let content = dto.toDomain() + XCTAssertNil(content.mimeType) + } + + func test_encodeUserMessage_withAudioMimeType_includesMimeTypeInJSON() throws { + let audio = AudioInputContent(url: "https://example.com/clip.mp3", mimeType: "audio/mpeg") + let userMsg = UserMessage.multimodal(id: "msg-1", parts: [audio]) + let encoder = MessageEncoder() + let data = try encoder.encode(userMsg) + let json = try JSONSerialization.jsonObject(with: data) as? [String: Any] + let contentArray = json?["content"] as? [[String: Any]] + XCTAssertEqual(contentArray?[0]["mimeType"] as? String, "audio/mpeg") + } } diff --git a/Tests/AGUICoreTests/Types/InputContent/ImageInputContentTests.swift b/Tests/AGUICoreTests/Types/InputContent/ImageInputContentTests.swift index 5482cb3..100099b 100644 --- a/Tests/AGUICoreTests/Types/InputContent/ImageInputContentTests.swift +++ b/Tests/AGUICoreTests/Types/InputContent/ImageInputContentTests.swift @@ -162,6 +162,66 @@ final class ImageInputContentTests: XCTestCase { XCTAssertEqual(set.count, 2) } + // MARK: - mimeType + + func test_mimeType_isNilByDefault_url() { + let content = ImageInputContent(url: "https://example.com/img.png") + XCTAssertNil(content.mimeType) + } + + func test_mimeType_isNilByDefault_data() { + let content = ImageInputContent(data: "base64abc") + XCTAssertNil(content.mimeType) + } + + func test_mimeType_roundTripsViaURLInit() { + let content = ImageInputContent(url: "https://example.com/img.png", mimeType: "image/png") + XCTAssertEqual(content.mimeType, "image/png") + } + + func test_mimeType_roundTripsViaDataInit() { + let content = ImageInputContent(data: "base64abc", mimeType: "image/jpeg") + XCTAssertEqual(content.mimeType, "image/jpeg") + } + + func test_mimeType_decodesFromJSON() throws { + let json = Data(""" + {"type":"image","url":"https://example.com/img.png","mimeType":"image/png"} + """.utf8) + let dto = try ImageInputContentDTO.decode(from: json) + let content = dto.toDomain() + XCTAssertEqual(content.mimeType, "image/png") + } + + func test_mimeType_isNilWhenAbsentInJSON() throws { + let json = Data(""" + {"type":"image","url":"https://example.com/img.png"} + """.utf8) + let dto = try ImageInputContentDTO.decode(from: json) + let content = dto.toDomain() + XCTAssertNil(content.mimeType) + } + + func test_encodeUserMessage_withImageMimeType_includesMimeTypeInJSON() throws { + let image = ImageInputContent(url: "https://example.com/img.png", mimeType: "image/png") + let userMsg = UserMessage.multimodal(id: "msg-1", parts: [image]) + let encoder = MessageEncoder() + let data = try encoder.encode(userMsg) + let json = try JSONSerialization.jsonObject(with: data) as? [String: Any] + let contentArray = json?["content"] as? [[String: Any]] + XCTAssertEqual(contentArray?[0]["mimeType"] as? String, "image/png") + } + + func test_encodeUserMessage_withNilImageMimeType_omitsMimeTypeFromJSON() throws { + let image = ImageInputContent(url: "https://example.com/img.png") + let userMsg = UserMessage.multimodal(id: "msg-1", parts: [image]) + let encoder = MessageEncoder() + let data = try encoder.encode(userMsg) + let json = try JSONSerialization.jsonObject(with: data) as? [String: Any] + let contentArray = json?["content"] as? [[String: Any]] + XCTAssertNil(contentArray?[0]["mimeType"]) + } + // MARK: - Sendable func test_sendable() { diff --git a/Tests/AGUICoreTests/Types/InputContent/VideoInputContentTests.swift b/Tests/AGUICoreTests/Types/InputContent/VideoInputContentTests.swift index 6ac5af2..6130bfa 100644 --- a/Tests/AGUICoreTests/Types/InputContent/VideoInputContentTests.swift +++ b/Tests/AGUICoreTests/Types/InputContent/VideoInputContentTests.swift @@ -149,4 +149,52 @@ final class VideoInputContentTests: XCTestCase { let content = VideoInputContent(url: "https://example.com/video.mp4") Task { XCTAssertEqual(content.type, "video") } } + + // MARK: - mimeType + + func test_mimeType_isNilByDefault_url() { + XCTAssertNil(VideoInputContent(url: "https://example.com/video.mp4").mimeType) + } + + func test_mimeType_isNilByDefault_data() { + XCTAssertNil(VideoInputContent(data: "base64video").mimeType) + } + + func test_mimeType_roundTripsViaURLInit() { + let content = VideoInputContent(url: "https://example.com/video.mp4", mimeType: "video/mp4") + XCTAssertEqual(content.mimeType, "video/mp4") + } + + func test_mimeType_roundTripsViaDataInit() { + let content = VideoInputContent(data: "base64video", mimeType: "video/webm") + XCTAssertEqual(content.mimeType, "video/webm") + } + + func test_mimeType_decodesFromJSON() throws { + let json = Data(""" + {"type":"video","url":"https://example.com/video.mp4","mimeType":"video/mp4"} + """.utf8) + let dto = try VideoInputContentDTO.decode(from: json) + let content = dto.toDomain() + XCTAssertEqual(content.mimeType, "video/mp4") + } + + func test_mimeType_isNilWhenAbsentInJSON() throws { + let json = Data(""" + {"type":"video","url":"https://example.com/video.mp4"} + """.utf8) + let dto = try VideoInputContentDTO.decode(from: json) + let content = dto.toDomain() + XCTAssertNil(content.mimeType) + } + + func test_encodeUserMessage_withVideoMimeType_includesMimeTypeInJSON() throws { + let video = VideoInputContent(url: "https://example.com/video.mp4", mimeType: "video/mp4") + let userMsg = UserMessage.multimodal(id: "msg-1", parts: [video]) + let encoder = MessageEncoder() + let data = try encoder.encode(userMsg) + let json = try JSONSerialization.jsonObject(with: data) as? [String: Any] + let contentArray = json?["content"] as? [[String: Any]] + XCTAssertEqual(contentArray?[0]["mimeType"] as? String, "video/mp4") + } } From aa64d4b7b7debc7ed356924666edb736413f4453 Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 14:20:23 -0400 Subject: [PATCH 03/19] fix: add .reasoning handler to MessageEncoder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MessageEncoder.defaultRegistry() covered 6 roles; calling encode() on a ReasoningMessage threw unsupportedRole(.reasoning) at runtime. - Add private encodeReasoningMessage() (mirrors encodeAssistantMessage: serialises id, role, content?, encryptedValue? — omits name, which is always nil for ReasoningMessage per spec) - Register under .reasoning in defaultRegistry() - Update doc comment: "all 6 message types" → "all 7 message types" - New MessageEncoderTests: correct JSON output, encryptedValue round- trip, name omission, unsupportedRole error path --- .../AGUICore/Encoding/MessageEncoder.swift | 25 ++++- .../Encoding/MessageEncoderTests.swift | 94 +++++++++++++++++++ 2 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 Tests/AGUICoreTests/Encoding/MessageEncoderTests.swift diff --git a/Sources/AGUICore/Encoding/MessageEncoder.swift b/Sources/AGUICore/Encoding/MessageEncoder.swift index 246e564..02dc3b0 100644 --- a/Sources/AGUICore/Encoding/MessageEncoder.swift +++ b/Sources/AGUICore/Encoding/MessageEncoder.swift @@ -157,7 +157,7 @@ public struct MessageEncoder: Sendable { // MARK: - Default Registry - /// Returns the default registry with handlers for all 6 message types. + /// Returns the default registry with handlers for all 7 message types. /// /// The default registry includes: /// - `.developer` → Encodes `DeveloperMessage` @@ -166,6 +166,7 @@ public struct MessageEncoder: Sendable { /// - `.assistant` → Encodes `AssistantMessage` /// - `.tool` → Encodes `ToolMessage` /// - `.activity` → Encodes `ActivityMessage` + /// - `.reasoning` → Encodes `ReasoningMessage` /// /// - Returns: Dictionary mapping each role to its encode handler public static func defaultRegistry() -> [Role: EncodeHandler] { @@ -187,6 +188,9 @@ public struct MessageEncoder: Sendable { }, .activity: { message, encoder in try encodeActivityMessage(message, encoder: encoder) + }, + .reasoning: { message, encoder in + try encodeReasoningMessage(message, encoder: encoder) } ] } @@ -409,3 +413,22 @@ private func encodeActivityMessage(_ message: any Message, encoder: JSONEncoder) ] return try JSONSerialization.data(withJSONObject: dict) } + +/// Encodes a ReasoningMessage to JSON data. +private func encodeReasoningMessage(_ message: any Message, encoder: JSONEncoder) throws -> Data { + guard let reasoningMsg = message as? ReasoningMessage else { + throw MessageEncodingError.invalidMessageType(.reasoning, String(describing: type(of: message))) + } + + var dict: [String: Any] = [ + "id": reasoningMsg.id, + "role": reasoningMsg.role.rawValue + ] + if let content = reasoningMsg.content { + dict["content"] = content + } + if let encryptedValue = reasoningMsg.encryptedValue { + dict["encryptedValue"] = encryptedValue + } + return try JSONSerialization.data(withJSONObject: dict) +} diff --git a/Tests/AGUICoreTests/Encoding/MessageEncoderTests.swift b/Tests/AGUICoreTests/Encoding/MessageEncoderTests.swift new file mode 100644 index 0000000..867fb2b --- /dev/null +++ b/Tests/AGUICoreTests/Encoding/MessageEncoderTests.swift @@ -0,0 +1,94 @@ +/* + * MIT License + * + * Copyright (c) 2025 Perfect Aduh + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import XCTest +@testable import AGUICore + +final class MessageEncoderTests: XCTestCase { + + private let encoder = MessageEncoder() + + // MARK: - ReasoningMessage encoding + + func test_encodeReasoningMessage_producesCorrectJSON() throws { + let message = ReasoningMessage( + id: "reasoning-1", + content: "Let me think step by step." + ) + + let data = try encoder.encode(message) + let json = try XCTUnwrap(JSONSerialization.jsonObject(with: data) as? [String: Any]) + + XCTAssertEqual(json["id"] as? String, "reasoning-1") + XCTAssertEqual(json["role"] as? String, "reasoning") + XCTAssertEqual(json["content"] as? String, "Let me think step by step.") + } + + func test_encodeReasoningMessage_withEncryptedValue() throws { + let message = ReasoningMessage( + id: "reasoning-2", + content: "Analysing inputs...", + encryptedValue: "enc-token-abc" + ) + + let data = try encoder.encode(message) + let json = try XCTUnwrap(JSONSerialization.jsonObject(with: data) as? [String: Any]) + + XCTAssertEqual(json["encryptedValue"] as? String, "enc-token-abc") + } + + func test_encodeReasoningMessage_nameAlwaysOmitted() throws { + // ReasoningMessage.name is always nil per protocol spec — must not appear in JSON + let message = ReasoningMessage(id: "reasoning-3", content: "Reasoning...") + + let data = try encoder.encode(message) + let json = try XCTUnwrap(JSONSerialization.jsonObject(with: data) as? [String: Any]) + + XCTAssertNil(json["name"]) + } + + func test_encodeReasoningMessage_nilEncryptedValue_omittedFromJSON() throws { + let message = ReasoningMessage(id: "reasoning-4", content: "Thinking...") + + let data = try encoder.encode(message) + let json = try XCTUnwrap(JSONSerialization.jsonObject(with: data) as? [String: Any]) + + XCTAssertNil(json["encryptedValue"]) + } + + // MARK: - Unsupported role + + func test_unsupportedRole_throws() { + // Build a registry with no handlers to guarantee an unsupported role error + let emptyEncoder = MessageEncoder(registry: [:]) + let message = ReasoningMessage(id: "r-1", content: "test") + + XCTAssertThrowsError(try emptyEncoder.encode(message)) { error in + guard case MessageEncodingError.unsupportedRole(let role) = error else { + return XCTFail("Expected unsupportedRole, got \(error)") + } + XCTAssertEqual(role, .reasoning) + } + } +} From 0c98ba891755c4d7970f2cb5d176329265c322e5 Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 14:31:09 -0400 Subject: [PATCH 04/19] test: add reasoning event + message test suite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Covers all 7 reasoning event types (ReasoningStart, ReasoningEnd, ReasoningMessageStart, ReasoningMessageContent, ReasoningMessageEnd, ReasoningMessageChunk, ReasoningEncryptedValue) and ReasoningMessage model — 71 tests, 0 failures. --- .../ReasoningEncryptedValueEventTests.swift | 176 ++++++++++++++++++ .../ReasoningEndEventTests.swift | 99 ++++++++++ .../ReasoningMessageChunkEventTests.swift | 133 +++++++++++++ .../ReasoningMessageContentEventTests.swift | 120 ++++++++++++ .../ReasoningMessageEndEventTests.swift | 99 ++++++++++ .../ReasoningMessageStartEventTests.swift | 119 ++++++++++++ .../ReasoningStartEventTests.swift | 99 ++++++++++ .../Messages/ReasoningMessageTests.swift | 98 ++++++++++ 8 files changed, 943 insertions(+) create mode 100644 Tests/AGUICoreTests/ReasoningEvents/ReasoningEncryptedValueEventTests.swift create mode 100644 Tests/AGUICoreTests/ReasoningEvents/ReasoningEndEventTests.swift create mode 100644 Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageChunkEventTests.swift create mode 100644 Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageContentEventTests.swift create mode 100644 Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageEndEventTests.swift create mode 100644 Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageStartEventTests.swift create mode 100644 Tests/AGUICoreTests/ReasoningEvents/ReasoningStartEventTests.swift create mode 100644 Tests/AGUICoreTests/Types/Messages/ReasoningMessageTests.swift diff --git a/Tests/AGUICoreTests/ReasoningEvents/ReasoningEncryptedValueEventTests.swift b/Tests/AGUICoreTests/ReasoningEvents/ReasoningEncryptedValueEventTests.swift new file mode 100644 index 0000000..3a25e38 --- /dev/null +++ b/Tests/AGUICoreTests/ReasoningEvents/ReasoningEncryptedValueEventTests.swift @@ -0,0 +1,176 @@ +/* + * MIT License + * + * Copyright (c) 2025 Perfect Aduh + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import XCTest +@testable import AGUICore + +final class ReasoningEncryptedValueEventTests: XCTestCase, + AGUIEventDecoderTestHelpers, + EventDecodingErrorTests { + + private let entityId = "entity-abc" + private let encryptedValue = "enc-xyz-token" + + // MARK: - EventDecodingErrorTests + + var validEventFieldsWithoutType: [String: Any] { + ["subtype": "tool-call", "entityId": "entity-abc", "encryptedValue": "enc-xyz-token"] + } + + var eventTypeString: String { "REASONING_ENCRYPTED_VALUE" } + var expectedEventType: EventType { .reasoningEncryptedValue } + var unknownEventTypeString: String { "REASONING_ENCRYPTED_CHUNK" } + + // MARK: - Decode + + func test_decodeWithSubtypeToolCall_returnsCorrectEvent() throws { + let data = jsonData(""" + { + "type": "REASONING_ENCRYPTED_VALUE", + "subtype": "tool-call", + "entityId": "\(entityId)", + "encryptedValue": "\(encryptedValue)" + } + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningEncryptedValueEvent) + XCTAssertEqual(event.eventType, .reasoningEncryptedValue) + XCTAssertEqual(event.subtype, .toolCall) + XCTAssertEqual(event.entityId, entityId) + XCTAssertEqual(event.encryptedValue, encryptedValue) + XCTAssertNil(event.timestamp) + } + + func test_decodeWithSubtypeMessage_returnsCorrectEvent() throws { + let data = jsonData(""" + { + "type": "REASONING_ENCRYPTED_VALUE", + "subtype": "message", + "entityId": "\(entityId)", + "encryptedValue": "\(encryptedValue)" + } + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningEncryptedValueEvent) + XCTAssertEqual(event.subtype, .message) + } + + func test_decodeWithTimestamp_populatesTimestamp() throws { + let data = jsonData(""" + { + "type": "REASONING_ENCRYPTED_VALUE", + "subtype": "message", + "entityId": "\(entityId)", + "encryptedValue": "\(encryptedValue)", + "timestamp": \(EventTestData.timestamp) + } + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningEncryptedValueEvent) + XCTAssertEqual(event.timestamp, EventTestData.timestamp) + } + + func test_decodePreservesRawEvent() throws { + let data = jsonData(""" + {"type":"REASONING_ENCRYPTED_VALUE","subtype":"tool-call","entityId":"\(entityId)","encryptedValue":"\(encryptedValue)"} + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningEncryptedValueEvent) + XCTAssertEqual(event.rawEvent, data) + } + + func test_missingSubtype_throwsDecodingFailed() { + let data = jsonData(""" + {"type":"REASONING_ENCRYPTED_VALUE","entityId":"entity-abc","encryptedValue":"token"} + """) + XCTAssertThrowsError(try makeStrictDecoder().decode(data)) { error in + guard case .decodingFailed = error as? EventDecodingError else { + return XCTFail("Expected decodingFailed, got \(error)") + } + } + } + + func test_missingEntityId_throwsDecodingFailed() { + let data = jsonData(""" + {"type":"REASONING_ENCRYPTED_VALUE","subtype":"tool-call","encryptedValue":"token"} + """) + XCTAssertThrowsError(try makeStrictDecoder().decode(data)) { error in + guard case .decodingFailed = error as? EventDecodingError else { + return XCTFail("Expected decodingFailed, got \(error)") + } + } + } + + func test_missingEncryptedValue_throwsDecodingFailed() { + let data = jsonData(""" + {"type":"REASONING_ENCRYPTED_VALUE","subtype":"tool-call","entityId":"entity-abc"} + """) + XCTAssertThrowsError(try makeStrictDecoder().decode(data)) { error in + guard case .decodingFailed = error as? EventDecodingError else { + return XCTFail("Expected decodingFailed, got \(error)") + } + } + } + + func test_invalidSubtypeValue_throwsInvalidJSON() { + let data = jsonData(""" + {"type":"REASONING_ENCRYPTED_VALUE","subtype":"unknown-subtype","entityId":"entity-abc","encryptedValue":"token"} + """) + XCTAssertThrowsError(try makeStrictDecoder().decode(data)) { error in + XCTAssertEqual(error as? EventDecodingError, .invalidJSON, + "Invalid enum raw value maps to .invalidJSON via dataCorrupted") + } + } + + // MARK: - Model + + func test_eventTypeIsAlwaysReasoningEncryptedValue() { + let event = ReasoningEncryptedValueEvent(subtype: .toolCall, entityId: entityId, encryptedValue: encryptedValue) + XCTAssertEqual(event.eventType, .reasoningEncryptedValue) + } + + func test_equatable_sameFields_areEqual() { + let e1 = ReasoningEncryptedValueEvent(subtype: .toolCall, entityId: entityId, encryptedValue: encryptedValue) + let e2 = ReasoningEncryptedValueEvent(subtype: .toolCall, entityId: entityId, encryptedValue: encryptedValue) + XCTAssertEqual(e1, e2) + } + + func test_equatable_differentSubtype_notEqual() { + let e1 = ReasoningEncryptedValueEvent(subtype: .toolCall, entityId: entityId, encryptedValue: encryptedValue) + let e2 = ReasoningEncryptedValueEvent(subtype: .message, entityId: entityId, encryptedValue: encryptedValue) + XCTAssertNotEqual(e1, e2) + } + + func test_equatable_differentEncryptedValue_notEqual() { + let e1 = ReasoningEncryptedValueEvent(subtype: .toolCall, entityId: entityId, encryptedValue: "token-a") + let e2 = ReasoningEncryptedValueEvent(subtype: .toolCall, entityId: entityId, encryptedValue: "token-b") + XCTAssertNotEqual(e1, e2) + } + + // MARK: - ReasoningEncryptedValueSubtype + + func test_subtypeToolCall_hasCorrectRawValue() { + XCTAssertEqual(ReasoningEncryptedValueSubtype.toolCall.rawValue, "tool-call") + } + + func test_subtypeMessage_hasCorrectRawValue() { + XCTAssertEqual(ReasoningEncryptedValueSubtype.message.rawValue, "message") + } +} diff --git a/Tests/AGUICoreTests/ReasoningEvents/ReasoningEndEventTests.swift b/Tests/AGUICoreTests/ReasoningEvents/ReasoningEndEventTests.swift new file mode 100644 index 0000000..441d8cb --- /dev/null +++ b/Tests/AGUICoreTests/ReasoningEvents/ReasoningEndEventTests.swift @@ -0,0 +1,99 @@ +/* + * MIT License + * + * Copyright (c) 2025 Perfect Aduh + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import XCTest +@testable import AGUICore + +final class ReasoningEndEventTests: XCTestCase, + AGUIEventDecoderTestHelpers, + EventDecodingErrorTests { + + // MARK: - EventDecodingErrorTests + + var validEventFieldsWithoutType: [String: Any] { + ["messageId": EventTestData.messageId] + } + + var eventTypeString: String { "REASONING_END" } + var expectedEventType: EventType { .reasoningEnd } + var unknownEventTypeString: String { "REASONING_CANCELLED" } + + // MARK: - Decode + + func test_decodeValidReasoningEnd_returnsCorrectEvent() throws { + let data = jsonData(""" + {"type":"REASONING_END","messageId":"\(EventTestData.messageId)"} + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningEndEvent) + XCTAssertEqual(event.eventType, .reasoningEnd) + XCTAssertEqual(event.messageId, EventTestData.messageId) + XCTAssertNil(event.timestamp) + } + + func test_decodeWithTimestamp_populatesTimestamp() throws { + let data = jsonData(""" + {"type":"REASONING_END","messageId":"\(EventTestData.messageId)","timestamp":\(EventTestData.timestamp)} + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningEndEvent) + XCTAssertEqual(event.timestamp, EventTestData.timestamp) + } + + func test_decodePreservesRawEvent() throws { + let data = jsonData(""" + {"type":"REASONING_END","messageId":"\(EventTestData.messageId)"} + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningEndEvent) + XCTAssertEqual(event.rawEvent, data) + } + + func test_missingMessageId_throwsDecodingFailed() { + let data = jsonData(""" + {"type":"REASONING_END"} + """) + XCTAssertThrowsError(try makeStrictDecoder().decode(data)) { error in + guard case .decodingFailed = error as? EventDecodingError else { + return XCTFail("Expected decodingFailed, got \(error)") + } + } + } + + // MARK: - Model + + func test_eventTypeIsAlwaysReasoningEnd() { + let event = ReasoningEndEvent(messageId: EventTestData.messageId) + XCTAssertEqual(event.eventType, .reasoningEnd) + } + + func test_equatable_sameFields_areEqual() { + let e1 = ReasoningEndEvent(messageId: EventTestData.messageId, timestamp: EventTestData.timestamp) + let e2 = ReasoningEndEvent(messageId: EventTestData.messageId, timestamp: EventTestData.timestamp) + XCTAssertEqual(e1, e2) + } + + func test_equatable_differentMessageIds_notEqual() { + let e1 = ReasoningEndEvent(messageId: EventTestData.messageId) + let e2 = ReasoningEndEvent(messageId: EventTestData.messageId2) + XCTAssertNotEqual(e1, e2) + } +} diff --git a/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageChunkEventTests.swift b/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageChunkEventTests.swift new file mode 100644 index 0000000..512ea45 --- /dev/null +++ b/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageChunkEventTests.swift @@ -0,0 +1,133 @@ +/* + * MIT License + * + * Copyright (c) 2025 Perfect Aduh + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import XCTest +@testable import AGUICore + +final class ReasoningMessageChunkEventTests: XCTestCase, + AGUIEventDecoderTestHelpers, + EventDecodingErrorTests { + + // MARK: - EventDecodingErrorTests + + // Both messageId and delta are optional; provide them as representative valid fields. + var validEventFieldsWithoutType: [String: Any] { + ["messageId": EventTestData.messageId, "delta": "chunk"] + } + + var eventTypeString: String { "REASONING_MESSAGE_CHUNK" } + var expectedEventType: EventType { .reasoningMessageChunk } + var unknownEventTypeString: String { "REASONING_MESSAGE_PARTIAL" } + + // MARK: - Decode + + func test_decodeWithBothFields_returnsCorrectEvent() throws { + let data = jsonData(""" + { + "type": "REASONING_MESSAGE_CHUNK", + "messageId": "\(EventTestData.messageId)", + "delta": "chunk" + } + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningMessageChunkEvent) + XCTAssertEqual(event.eventType, .reasoningMessageChunk) + XCTAssertEqual(event.messageId, EventTestData.messageId) + XCTAssertEqual(event.delta, "chunk") + XCTAssertNil(event.timestamp) + } + + func test_decodeWithOnlyMessageId_omitsDelta() throws { + let data = jsonData(""" + {"type":"REASONING_MESSAGE_CHUNK","messageId":"\(EventTestData.messageId)"} + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningMessageChunkEvent) + XCTAssertEqual(event.messageId, EventTestData.messageId) + XCTAssertNil(event.delta) + } + + func test_decodeWithOnlyDelta_omitsMessageId() throws { + let data = jsonData(""" + {"type":"REASONING_MESSAGE_CHUNK","delta":"partial"} + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningMessageChunkEvent) + XCTAssertNil(event.messageId) + XCTAssertEqual(event.delta, "partial") + } + + func test_decodeWithNoOptionalFields_succeeds() throws { + let data = jsonData(""" + {"type":"REASONING_MESSAGE_CHUNK"} + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningMessageChunkEvent) + XCTAssertNil(event.messageId) + XCTAssertNil(event.delta) + XCTAssertNil(event.timestamp) + } + + func test_decodeWithTimestamp_populatesTimestamp() throws { + let data = jsonData(""" + { + "type": "REASONING_MESSAGE_CHUNK", + "messageId": "\(EventTestData.messageId)", + "delta": "chunk", + "timestamp": \(EventTestData.timestamp) + } + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningMessageChunkEvent) + XCTAssertEqual(event.timestamp, EventTestData.timestamp) + } + + func test_decodePreservesRawEvent() throws { + let data = jsonData(""" + {"type":"REASONING_MESSAGE_CHUNK","messageId":"\(EventTestData.messageId)","delta":"chunk"} + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningMessageChunkEvent) + XCTAssertEqual(event.rawEvent, data) + } + + // MARK: - Model + + func test_eventTypeIsAlwaysReasoningMessageChunk() { + let event = ReasoningMessageChunkEvent() + XCTAssertEqual(event.eventType, .reasoningMessageChunk) + } + + func test_equatable_sameFields_areEqual() { + let e1 = ReasoningMessageChunkEvent(messageId: EventTestData.messageId, delta: "chunk") + let e2 = ReasoningMessageChunkEvent(messageId: EventTestData.messageId, delta: "chunk") + XCTAssertEqual(e1, e2) + } + + func test_equatable_differentDelta_notEqual() { + let e1 = ReasoningMessageChunkEvent(messageId: EventTestData.messageId, delta: "a") + let e2 = ReasoningMessageChunkEvent(messageId: EventTestData.messageId, delta: "b") + XCTAssertNotEqual(e1, e2) + } + + func test_equatable_nilVsNonNilMessageId_notEqual() { + let e1 = ReasoningMessageChunkEvent(messageId: nil, delta: "chunk") + let e2 = ReasoningMessageChunkEvent(messageId: EventTestData.messageId, delta: "chunk") + XCTAssertNotEqual(e1, e2) + } +} diff --git a/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageContentEventTests.swift b/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageContentEventTests.swift new file mode 100644 index 0000000..eb6dd36 --- /dev/null +++ b/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageContentEventTests.swift @@ -0,0 +1,120 @@ +/* + * MIT License + * + * Copyright (c) 2025 Perfect Aduh + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import XCTest +@testable import AGUICore + +final class ReasoningMessageContentEventTests: XCTestCase, + AGUIEventDecoderTestHelpers, + EventDecodingErrorTests { + + // MARK: - EventDecodingErrorTests + + var validEventFieldsWithoutType: [String: Any] { + ["messageId": EventTestData.messageId, "delta": "Let me think..."] + } + + var eventTypeString: String { "REASONING_MESSAGE_CONTENT" } + var expectedEventType: EventType { .reasoningMessageContent } + var unknownEventTypeString: String { "REASONING_MESSAGE_PARTIAL" } + + // MARK: - Decode + + func test_decodeValidReasoningMessageContent_returnsCorrectEvent() throws { + let data = jsonData(""" + { + "type": "REASONING_MESSAGE_CONTENT", + "messageId": "\(EventTestData.messageId)", + "delta": "Let me think..." + } + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningMessageContentEvent) + XCTAssertEqual(event.eventType, .reasoningMessageContent) + XCTAssertEqual(event.messageId, EventTestData.messageId) + XCTAssertEqual(event.delta, "Let me think...") + XCTAssertNil(event.timestamp) + } + + func test_decodeWithTimestamp_populatesTimestamp() throws { + let data = jsonData(""" + { + "type": "REASONING_MESSAGE_CONTENT", + "messageId": "\(EventTestData.messageId)", + "delta": "chunk", + "timestamp": \(EventTestData.timestamp) + } + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningMessageContentEvent) + XCTAssertEqual(event.timestamp, EventTestData.timestamp) + } + + func test_decodePreservesRawEvent() throws { + let data = jsonData(""" + {"type":"REASONING_MESSAGE_CONTENT","messageId":"\(EventTestData.messageId)","delta":"chunk"} + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningMessageContentEvent) + XCTAssertEqual(event.rawEvent, data) + } + + func test_missingMessageId_throwsDecodingFailed() { + let data = jsonData(""" + {"type":"REASONING_MESSAGE_CONTENT","delta":"chunk"} + """) + XCTAssertThrowsError(try makeStrictDecoder().decode(data)) { error in + guard case .decodingFailed = error as? EventDecodingError else { + return XCTFail("Expected decodingFailed, got \(error)") + } + } + } + + func test_missingDelta_throwsDecodingFailed() { + let data = jsonData(""" + {"type":"REASONING_MESSAGE_CONTENT","messageId":"\(EventTestData.messageId)"} + """) + XCTAssertThrowsError(try makeStrictDecoder().decode(data)) { error in + guard case .decodingFailed = error as? EventDecodingError else { + return XCTFail("Expected decodingFailed, got \(error)") + } + } + } + + // MARK: - Model + + func test_eventTypeIsAlwaysReasoningMessageContent() { + let event = ReasoningMessageContentEvent(messageId: EventTestData.messageId, delta: "chunk") + XCTAssertEqual(event.eventType, .reasoningMessageContent) + } + + func test_equatable_sameFields_areEqual() { + let e1 = ReasoningMessageContentEvent(messageId: EventTestData.messageId, delta: "chunk") + let e2 = ReasoningMessageContentEvent(messageId: EventTestData.messageId, delta: "chunk") + XCTAssertEqual(e1, e2) + } + + func test_equatable_differentDelta_notEqual() { + let e1 = ReasoningMessageContentEvent(messageId: EventTestData.messageId, delta: "a") + let e2 = ReasoningMessageContentEvent(messageId: EventTestData.messageId, delta: "b") + XCTAssertNotEqual(e1, e2) + } +} diff --git a/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageEndEventTests.swift b/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageEndEventTests.swift new file mode 100644 index 0000000..baa0d85 --- /dev/null +++ b/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageEndEventTests.swift @@ -0,0 +1,99 @@ +/* + * MIT License + * + * Copyright (c) 2025 Perfect Aduh + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import XCTest +@testable import AGUICore + +final class ReasoningMessageEndEventTests: XCTestCase, + AGUIEventDecoderTestHelpers, + EventDecodingErrorTests { + + // MARK: - EventDecodingErrorTests + + var validEventFieldsWithoutType: [String: Any] { + ["messageId": EventTestData.messageId] + } + + var eventTypeString: String { "REASONING_MESSAGE_END" } + var expectedEventType: EventType { .reasoningMessageEnd } + var unknownEventTypeString: String { "REASONING_MESSAGE_TERMINATED" } + + // MARK: - Decode + + func test_decodeValidReasoningMessageEnd_returnsCorrectEvent() throws { + let data = jsonData(""" + {"type":"REASONING_MESSAGE_END","messageId":"\(EventTestData.messageId)"} + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningMessageEndEvent) + XCTAssertEqual(event.eventType, .reasoningMessageEnd) + XCTAssertEqual(event.messageId, EventTestData.messageId) + XCTAssertNil(event.timestamp) + } + + func test_decodeWithTimestamp_populatesTimestamp() throws { + let data = jsonData(""" + {"type":"REASONING_MESSAGE_END","messageId":"\(EventTestData.messageId)","timestamp":\(EventTestData.timestamp)} + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningMessageEndEvent) + XCTAssertEqual(event.timestamp, EventTestData.timestamp) + } + + func test_decodePreservesRawEvent() throws { + let data = jsonData(""" + {"type":"REASONING_MESSAGE_END","messageId":"\(EventTestData.messageId)"} + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningMessageEndEvent) + XCTAssertEqual(event.rawEvent, data) + } + + func test_missingMessageId_throwsDecodingFailed() { + let data = jsonData(""" + {"type":"REASONING_MESSAGE_END"} + """) + XCTAssertThrowsError(try makeStrictDecoder().decode(data)) { error in + guard case .decodingFailed = error as? EventDecodingError else { + return XCTFail("Expected decodingFailed, got \(error)") + } + } + } + + // MARK: - Model + + func test_eventTypeIsAlwaysReasoningMessageEnd() { + let event = ReasoningMessageEndEvent(messageId: EventTestData.messageId) + XCTAssertEqual(event.eventType, .reasoningMessageEnd) + } + + func test_equatable_sameFields_areEqual() { + let e1 = ReasoningMessageEndEvent(messageId: EventTestData.messageId, timestamp: EventTestData.timestamp) + let e2 = ReasoningMessageEndEvent(messageId: EventTestData.messageId, timestamp: EventTestData.timestamp) + XCTAssertEqual(e1, e2) + } + + func test_equatable_differentMessageIds_notEqual() { + let e1 = ReasoningMessageEndEvent(messageId: EventTestData.messageId) + let e2 = ReasoningMessageEndEvent(messageId: EventTestData.messageId2) + XCTAssertNotEqual(e1, e2) + } +} diff --git a/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageStartEventTests.swift b/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageStartEventTests.swift new file mode 100644 index 0000000..49e7248 --- /dev/null +++ b/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageStartEventTests.swift @@ -0,0 +1,119 @@ +/* + * MIT License + * + * Copyright (c) 2025 Perfect Aduh + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import XCTest +@testable import AGUICore + +final class ReasoningMessageStartEventTests: XCTestCase, + AGUIEventDecoderTestHelpers, + EventDecodingErrorTests { + + // MARK: - EventDecodingErrorTests + + var validEventFieldsWithoutType: [String: Any] { + ["messageId": EventTestData.messageId, "role": "reasoning"] + } + + var eventTypeString: String { "REASONING_MESSAGE_START" } + var expectedEventType: EventType { .reasoningMessageStart } + var unknownEventTypeString: String { "REASONING_MESSAGE_PAUSED" } + + // MARK: - Decode + + func test_decodeValidReasoningMessageStart_returnsCorrectEvent() throws { + let data = jsonData(""" + { + "type": "REASONING_MESSAGE_START", + "messageId": "\(EventTestData.messageId)", + "role": "reasoning" + } + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningMessageStartEvent) + XCTAssertEqual(event.eventType, .reasoningMessageStart) + XCTAssertEqual(event.messageId, EventTestData.messageId) + XCTAssertEqual(event.role, "reasoning") + XCTAssertNil(event.timestamp) + } + + func test_decodeWithTimestamp_populatesTimestamp() throws { + let data = jsonData(""" + { + "type": "REASONING_MESSAGE_START", + "messageId": "\(EventTestData.messageId)", + "role": "reasoning", + "timestamp": \(EventTestData.timestamp) + } + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningMessageStartEvent) + XCTAssertEqual(event.timestamp, EventTestData.timestamp) + } + + func test_decodePreservesRawEvent() throws { + let data = jsonData(""" + {"type":"REASONING_MESSAGE_START","messageId":"\(EventTestData.messageId)","role":"reasoning"} + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningMessageStartEvent) + XCTAssertEqual(event.rawEvent, data) + } + + func test_missingMessageId_throwsDecodingFailed() { + let data = jsonData(""" + {"type":"REASONING_MESSAGE_START","role":"reasoning"} + """) + XCTAssertThrowsError(try makeStrictDecoder().decode(data)) { error in + guard case .decodingFailed = error as? EventDecodingError else { + return XCTFail("Expected decodingFailed, got \(error)") + } + } + } + + func test_missingRole_throwsDecodingFailed() { + let data = jsonData(""" + {"type":"REASONING_MESSAGE_START","messageId":"\(EventTestData.messageId)"} + """) + XCTAssertThrowsError(try makeStrictDecoder().decode(data)) { error in + guard case .decodingFailed = error as? EventDecodingError else { + return XCTFail("Expected decodingFailed, got \(error)") + } + } + } + + // MARK: - Model + + func test_eventTypeIsAlwaysReasoningMessageStart() { + let event = ReasoningMessageStartEvent(messageId: EventTestData.messageId, role: "reasoning") + XCTAssertEqual(event.eventType, .reasoningMessageStart) + } + + func test_defaultRole_isReasoning() { + let event = ReasoningMessageStartEvent(messageId: EventTestData.messageId) + XCTAssertEqual(event.role, "reasoning") + } + + func test_equatable_sameFields_areEqual() { + let e1 = ReasoningMessageStartEvent(messageId: EventTestData.messageId, role: "reasoning") + let e2 = ReasoningMessageStartEvent(messageId: EventTestData.messageId, role: "reasoning") + XCTAssertEqual(e1, e2) + } +} diff --git a/Tests/AGUICoreTests/ReasoningEvents/ReasoningStartEventTests.swift b/Tests/AGUICoreTests/ReasoningEvents/ReasoningStartEventTests.swift new file mode 100644 index 0000000..c8b32e6 --- /dev/null +++ b/Tests/AGUICoreTests/ReasoningEvents/ReasoningStartEventTests.swift @@ -0,0 +1,99 @@ +/* + * MIT License + * + * Copyright (c) 2025 Perfect Aduh + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import XCTest +@testable import AGUICore + +final class ReasoningStartEventTests: XCTestCase, + AGUIEventDecoderTestHelpers, + EventDecodingErrorTests { + + // MARK: - EventDecodingErrorTests + + var validEventFieldsWithoutType: [String: Any] { + ["messageId": EventTestData.messageId] + } + + var eventTypeString: String { "REASONING_START" } + var expectedEventType: EventType { .reasoningStart } + var unknownEventTypeString: String { "REASONING_PAUSED" } + + // MARK: - Decode + + func test_decodeValidReasoningStart_returnsCorrectEvent() throws { + let data = jsonData(""" + {"type":"REASONING_START","messageId":"\(EventTestData.messageId)"} + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningStartEvent) + XCTAssertEqual(event.eventType, .reasoningStart) + XCTAssertEqual(event.messageId, EventTestData.messageId) + XCTAssertNil(event.timestamp) + } + + func test_decodeWithTimestamp_populatesTimestamp() throws { + let data = jsonData(""" + {"type":"REASONING_START","messageId":"\(EventTestData.messageId)","timestamp":\(EventTestData.timestamp)} + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningStartEvent) + XCTAssertEqual(event.timestamp, EventTestData.timestamp) + } + + func test_decodePreservesRawEvent() throws { + let data = jsonData(""" + {"type":"REASONING_START","messageId":"\(EventTestData.messageId)"} + """) + let event = try XCTUnwrap(try makeStrictDecoder().decode(data) as? ReasoningStartEvent) + XCTAssertEqual(event.rawEvent, data) + } + + func test_missingMessageId_throwsDecodingFailed() { + let data = jsonData(""" + {"type":"REASONING_START"} + """) + XCTAssertThrowsError(try makeStrictDecoder().decode(data)) { error in + guard case .decodingFailed = error as? EventDecodingError else { + return XCTFail("Expected decodingFailed, got \(error)") + } + } + } + + // MARK: - Model + + func test_eventTypeIsAlwaysReasoningStart() { + let event = ReasoningStartEvent(messageId: EventTestData.messageId) + XCTAssertEqual(event.eventType, .reasoningStart) + } + + func test_equatable_sameFields_areEqual() { + let e1 = ReasoningStartEvent(messageId: EventTestData.messageId, timestamp: EventTestData.timestamp) + let e2 = ReasoningStartEvent(messageId: EventTestData.messageId, timestamp: EventTestData.timestamp) + XCTAssertEqual(e1, e2) + } + + func test_equatable_differentMessageIds_notEqual() { + let e1 = ReasoningStartEvent(messageId: EventTestData.messageId) + let e2 = ReasoningStartEvent(messageId: EventTestData.messageId2) + XCTAssertNotEqual(e1, e2) + } +} diff --git a/Tests/AGUICoreTests/Types/Messages/ReasoningMessageTests.swift b/Tests/AGUICoreTests/Types/Messages/ReasoningMessageTests.swift new file mode 100644 index 0000000..0597cb2 --- /dev/null +++ b/Tests/AGUICoreTests/Types/Messages/ReasoningMessageTests.swift @@ -0,0 +1,98 @@ +/* + * MIT License + * + * Copyright (c) 2025 Perfect Aduh + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import XCTest +@testable import AGUICore + +final class ReasoningMessageTests: XCTestCase { + + private let messageId = "msg-reasoning-1" + private let content = "Let me think step by step..." + + // MARK: - Role + + func test_roleIsAlwaysReasoning() { + let message = ReasoningMessage(id: messageId, content: content) + XCTAssertEqual(message.role, .reasoning) + } + + // MARK: - Initialization + + func test_initWithContent_storesContent() { + let message = ReasoningMessage(id: messageId, content: content) + XCTAssertEqual(message.id, messageId) + XCTAssertEqual(message.content, content) + XCTAssertNil(message.encryptedValue) + } + + func test_initWithEncryptedValue_storesEncryptedValue() { + let token = "enc-abc-token" + let message = ReasoningMessage(id: messageId, content: content, encryptedValue: token) + XCTAssertEqual(message.encryptedValue, token) + } + + func test_nameIsAlwaysNil() { + let message = ReasoningMessage(id: messageId, content: content) + XCTAssertNil(message.name) + } + + // MARK: - Equatable / Hashable + + func test_equatable_sameFields_areEqual() { + let m1 = ReasoningMessage(id: messageId, content: content) + let m2 = ReasoningMessage(id: messageId, content: content) + XCTAssertEqual(m1, m2) + } + + func test_equatable_differentContent_notEqual() { + let m1 = ReasoningMessage(id: messageId, content: "a") + let m2 = ReasoningMessage(id: messageId, content: "b") + XCTAssertNotEqual(m1, m2) + } + + func test_equatable_differentId_notEqual() { + let m1 = ReasoningMessage(id: "id-1", content: content) + let m2 = ReasoningMessage(id: "id-2", content: content) + XCTAssertNotEqual(m1, m2) + } + + func test_equatable_differentEncryptedValue_notEqual() { + let m1 = ReasoningMessage(id: messageId, content: content, encryptedValue: "token-a") + let m2 = ReasoningMessage(id: messageId, content: content, encryptedValue: "token-b") + XCTAssertNotEqual(m1, m2) + } + + func test_hashable_equalMessagesHaveSameHash() { + let m1 = ReasoningMessage(id: messageId, content: content) + let m2 = ReasoningMessage(id: messageId, content: content) + XCTAssertEqual(m1.hashValue, m2.hashValue) + } + + func test_hashable_canBeUsedInSet() { + let m1 = ReasoningMessage(id: messageId, content: content) + let m2 = ReasoningMessage(id: messageId, content: content) + let set: Set = [m1, m2] + XCTAssertEqual(set.count, 1) + } +} From 91a656ab69ce2606cfe475a19a111d6658bf3af2 Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 14:33:06 -0400 Subject: [PATCH 05/19] test: add StepFinishedEvent tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirrors StepStartedEventTests exactly — decode, timestamp, rawEvent, error cases, model behaviors, and 6 standard EventDecodingErrorTests. --- .../StepFinishedEventTests.swift | 231 ++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 Tests/AGUICoreTests/LifeCycleEvents/StepFinishedEventTests.swift diff --git a/Tests/AGUICoreTests/LifeCycleEvents/StepFinishedEventTests.swift b/Tests/AGUICoreTests/LifeCycleEvents/StepFinishedEventTests.swift new file mode 100644 index 0000000..27abc12 --- /dev/null +++ b/Tests/AGUICoreTests/LifeCycleEvents/StepFinishedEventTests.swift @@ -0,0 +1,231 @@ +/* + * MIT License + * + * Copyright (c) 2025 Perfect Aduh + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import XCTest +@testable import AGUICore + +final class StepFinishedEventTests: XCTestCase, + AGUIEventDecoderTestHelpers, + EventDecodingErrorTests { + + // MARK: - EventDecodingErrorTests Protocol Requirements + + var validEventFieldsWithoutType: [String: Any] { + ["stepName": "reasoning"] + } + + var eventTypeString: String { "STEP_FINISHED" } + var expectedEventType: EventType { .stepFinished } + var unknownEventTypeString: String { "STEP_CANCELLED" } + + // MARK: - Feature: Decode STEP_FINISHED + + func test_decodeValidStepFinished_returnsStepFinishedEvent() throws { + // Given + let data = jsonData(""" + { + "type": "STEP_FINISHED", + "stepName": "reasoning" + } + """) + + let decoder = makeStrictDecoder() + + // When + let event = try decoder.decode(data) + + // Then + guard let stepFinished = event as? StepFinishedEvent else { + return XCTFail("Expected StepFinishedEvent, got \(type(of: event))") + } + XCTAssertEqual(stepFinished.eventType, .stepFinished) + XCTAssertEqual(stepFinished.stepName, "reasoning") + XCTAssertNil(stepFinished.timestamp) + } + + func test_decodeStepFinished_withTimestamp_populatesTimestamp() throws { + // Given + let data = jsonData(""" + { + "type": "STEP_FINISHED", + "stepName": "reasoning", + "timestamp": \(EventTestData.timestamp) + } + """) + let decoder = makeStrictDecoder() + + // When + let event = try decoder.decode(data) + + // Then + let stepFinished = try XCTUnwrap(event as? StepFinishedEvent) + XCTAssertEqual(stepFinished.timestamp, EventTestData.timestamp) + } + + func test_decodeStepFinished_preservesRawEventBytes() throws { + // Given + let data = jsonData(""" + { + "type": "STEP_FINISHED", + "stepName": "reasoning", + "timestamp": \(EventTestData.timestamp) + } + """) + let decoder = makeStrictDecoder() + + // When + let event = try decoder.decode(data) + + // Then + let stepFinished = try XCTUnwrap(event as? StepFinishedEvent) + XCTAssertEqual(stepFinished.rawEvent, data) + } + + func test_decodeStepFinished_ignoresUnknownExtraFields() throws { + // Given + let data = jsonData(""" + { + "type": "STEP_FINISHED", + "stepName": "reasoning", + "extraField": "ignored", + "nested": { "x": 1 } + } + """) + let decoder = makeStrictDecoder() + + // When + let event = try decoder.decode(data) + + // Then + let stepFinished = try XCTUnwrap(event as? StepFinishedEvent) + XCTAssertEqual(stepFinished.stepName, "reasoning") + } + + func test_decodeStepFinished_withUnicodeStepName_handlesUnicode() throws { + // Given + let data = jsonData(""" + { + "type": "STEP_FINISHED", + "stepName": "推理-🚀-测试" + } + """) + let decoder = makeStrictDecoder() + + // When + let event = try decoder.decode(data) + + // Then + let stepFinished = try XCTUnwrap(event as? StepFinishedEvent) + XCTAssertEqual(stepFinished.stepName, "推理-🚀-测试") + } + + // MARK: - Feature: Error handling (event-specific) + + func test_decodeStepFinished_missingStepName_throwsDecodingFailed() { + // Given + let data = jsonData(""" + { + "type": "STEP_FINISHED" + } + """) + let decoder = makeStrictDecoder() + + // When / Then + XCTAssertThrowsError(try decoder.decode(data)) { error in + guard case .decodingFailed(let message) = (error as? EventDecodingError) else { + return XCTFail("Expected .decodingFailed, got \(error)") + } + XCTAssertTrue(message.contains("stepName"), "Expected message to mention 'stepName'. Got: \(message)") + } + } + + func test_decodeStepFinished_stepNameWrongType_throwsDecodingFailed() { + // Given + let data = jsonData(""" + { + "type": "STEP_FINISHED", + "stepName": 123 + } + """) + let decoder = makeStrictDecoder() + + // When / Then + XCTAssertThrowsError(try decoder.decode(data)) { error in + guard case .decodingFailed(let message) = (error as? EventDecodingError) else { + return XCTFail("Expected .decodingFailed, got \(error)") + } + XCTAssertTrue(message.lowercased().contains("type mismatch") || message.contains("Type mismatch"), + "Expected a type mismatch message. Got: \(message)") + } + } + + func test_decodeStepFinished_timestampWrongType_throwsDecodingFailed() { + // Given + let data = jsonData(""" + { + "type": "STEP_FINISHED", + "stepName": "reasoning", + "timestamp": "invalid" + } + """) + let decoder = makeStrictDecoder() + + // When / Then + XCTAssertThrowsError(try decoder.decode(data)) { error in + guard case .decodingFailed(let message) = (error as? EventDecodingError) else { + return XCTFail("Expected .decodingFailed, got \(error)") + } + XCTAssertTrue(message.lowercased().contains("type mismatch") || message.contains("Type mismatch"), + "Expected a type mismatch message. Got: \(message)") + } + } + + // MARK: - Feature: Model behaviors + + func test_stepFinishedEvent_eventTypeIsAlwaysStepFinished() { + // Given + let event = StepFinishedEvent(stepName: "reasoning", timestamp: nil, rawEvent: nil) + + // Then + XCTAssertEqual(event.eventType, .stepFinished) + } + + func test_stepFinishedEvent_equatable_sameFields_areEqual() { + // Given + let event1 = StepFinishedEvent(stepName: "reasoning", timestamp: 1, rawEvent: nil) + let event2 = StepFinishedEvent(stepName: "reasoning", timestamp: 1, rawEvent: nil) + + // Then + XCTAssertEqual(event1, event2) + } + + func test_stepFinishedEvent_withEmptyStepName_isValid() { + // Given + let event = StepFinishedEvent(stepName: "", timestamp: nil, rawEvent: nil) + + // Then + XCTAssertEqual(event.stepName, "") + XCTAssertEqual(event.eventType, .stepFinished) + } +} From 76e624a5561d3c3f7a4bb0494be4bd07e9160a3b Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 15:40:49 -0400 Subject: [PATCH 06/19] refactor: collapse simple 1:1 DTOs to direct Decodable Seven DTO shim files that were pure field-passthrough with no wire-to-domain transformation are deleted. Their domain types now conform to Decodable directly: Events (rawEvent set via withRawEvent helper in registry): - TextMessageStartEvent, TextMessageContentEvent - ToolCallStartEvent, ToolCallArgsEvent Messages (hardcode role in init(from:)): - AssistantMessage, SystemMessage, DeveloperMessage Registries updated; 1338 tests pass. --- .../TextMessageContentEventDTO.swift | 40 ----------- .../TextMessageStartEventDTO.swift | 42 ----------- .../ToolCallArgsEventDTO.swift | 40 ----------- .../ToolCallStartEventDTO.swift | 42 ----------- .../MessageDTO/AssistantMessageDTO.swift | 69 ------------------- .../MessageDTO/DeveloperMessageDTO.swift | 59 ---------------- .../MessageDTO/SystemMessageDTO.swift | 59 ---------------- .../AGUICore/Decoding/MessageDecoder.swift | 6 +- .../Registry/TextMessageEventRegistry.swift | 4 +- .../Registry/ToolCallEventRegistry.swift | 4 +- .../TextMessageContentEvent.swift | 27 ++++++++ .../TextMessageStartEvent.swift | 30 ++++++++ .../ToolCallEvents/ToolCallArgsEvent.swift | 27 ++++++++ .../ToolCallEvents/ToolCallStartEvent.swift | 30 ++++++++ .../Types/Messages/AssistantMessage.swift | 22 ++++++ .../Types/Messages/DeveloperMessage.swift | 20 ++++++ .../Types/Messages/SystemMessage.swift | 20 ++++++ 17 files changed, 183 insertions(+), 358 deletions(-) delete mode 100644 Sources/AGUICore/Decoding/EventDTO/TextMessageEventsDTO/TextMessageContentEventDTO.swift delete mode 100644 Sources/AGUICore/Decoding/EventDTO/TextMessageEventsDTO/TextMessageStartEventDTO.swift delete mode 100644 Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallArgsEventDTO.swift delete mode 100644 Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallStartEventDTO.swift delete mode 100644 Sources/AGUICore/Decoding/MessageDTO/AssistantMessageDTO.swift delete mode 100644 Sources/AGUICore/Decoding/MessageDTO/DeveloperMessageDTO.swift delete mode 100644 Sources/AGUICore/Decoding/MessageDTO/SystemMessageDTO.swift diff --git a/Sources/AGUICore/Decoding/EventDTO/TextMessageEventsDTO/TextMessageContentEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/TextMessageEventsDTO/TextMessageContentEventDTO.swift deleted file mode 100644 index b2bccee..0000000 --- a/Sources/AGUICore/Decoding/EventDTO/TextMessageEventsDTO/TextMessageContentEventDTO.swift +++ /dev/null @@ -1,40 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -struct TextMessageContentEventDTO: Decodable { - let messageId: String - let delta: String - let timestamp: Int64? - - func toDomain(rawEvent: Data? = nil) -> TextMessageContentEvent { - TextMessageContentEvent( - messageId: messageId, - delta: delta, - timestamp: timestamp, - rawEvent: rawEvent - ) - } -} diff --git a/Sources/AGUICore/Decoding/EventDTO/TextMessageEventsDTO/TextMessageStartEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/TextMessageEventsDTO/TextMessageStartEventDTO.swift deleted file mode 100644 index 3709a4f..0000000 --- a/Sources/AGUICore/Decoding/EventDTO/TextMessageEventsDTO/TextMessageStartEventDTO.swift +++ /dev/null @@ -1,42 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -struct TextMessageStartEventDTO: Decodable { - let messageId: String - let role: String - let name: String? - let timestamp: Int64? - - func toDomain(rawEvent: Data? = nil) -> TextMessageStartEvent { - TextMessageStartEvent( - messageId: messageId, - role: role, - name: name, - timestamp: timestamp, - rawEvent: rawEvent - ) - } -} diff --git a/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallArgsEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallArgsEventDTO.swift deleted file mode 100644 index d94dd70..0000000 --- a/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallArgsEventDTO.swift +++ /dev/null @@ -1,40 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -struct ToolCallArgsEventDTO: Decodable { - let toolCallId: String - let delta: String - let timestamp: Int64? - - func toDomain(rawEvent: Data? = nil) -> ToolCallArgsEvent { - ToolCallArgsEvent( - toolCallId: toolCallId, - delta: delta, - timestamp: timestamp, - rawEvent: rawEvent - ) - } -} diff --git a/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallStartEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallStartEventDTO.swift deleted file mode 100644 index 8a5a677..0000000 --- a/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallStartEventDTO.swift +++ /dev/null @@ -1,42 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -struct ToolCallStartEventDTO: Decodable { - let toolCallId: String - let toolCallName: String - let parentMessageId: String? - let timestamp: Int64? - - func toDomain(rawEvent: Data? = nil) -> ToolCallStartEvent { - ToolCallStartEvent( - toolCallId: toolCallId, - toolCallName: toolCallName, - parentMessageId: parentMessageId, - timestamp: timestamp, - rawEvent: rawEvent - ) - } -} diff --git a/Sources/AGUICore/Decoding/MessageDTO/AssistantMessageDTO.swift b/Sources/AGUICore/Decoding/MessageDTO/AssistantMessageDTO.swift deleted file mode 100644 index ecdc36c..0000000 --- a/Sources/AGUICore/Decoding/MessageDTO/AssistantMessageDTO.swift +++ /dev/null @@ -1,69 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -/// Data Transfer Object for AssistantMessage decoding. -struct AssistantMessageDTO { - let id: String - let content: String? - let name: String? - let toolCalls: [ToolCall]? - let encryptedValue: String? - - static func decode(from data: Data, decoder: JSONDecoder = JSONDecoder()) throws -> AssistantMessageDTO { - guard let jsonObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else { - throw DecodingError.dataCorrupted( - DecodingError.Context(codingPath: [], debugDescription: "Expected JSON object at root") - ) - } - - // Validate role - let role = try MessageDecodingHelpers.extractRole(from: jsonObject) - try MessageDecodingHelpers.validateRole(role, expected: .assistant) - - // Extract required fields - let id = try MessageDecodingHelpers.extractRequiredString(from: jsonObject, key: "id") - - // Extract optional fields - let content = MessageDecodingHelpers.extractOptionalString(from: jsonObject, key: "content") - let name = MessageDecodingHelpers.extractOptionalString(from: jsonObject, key: "name") - let encryptedValue = MessageDecodingHelpers.extractOptionalString(from: jsonObject, key: "encryptedValue") - - // Extract optional toolCalls array - let toolCalls: [ToolCall]? - if let toolCallsArray = jsonObject["toolCalls"] as? [[String: Any]], !toolCallsArray.isEmpty { - let toolCallsData = try JSONSerialization.data(withJSONObject: toolCallsArray) - toolCalls = try decoder.decode([ToolCall].self, from: toolCallsData) - } else { - toolCalls = nil - } - - return AssistantMessageDTO(id: id, content: content, name: name, toolCalls: toolCalls, encryptedValue: encryptedValue) - } - - func toDomain() -> AssistantMessage { - AssistantMessage(id: id, content: content, name: name, toolCalls: toolCalls, encryptedValue: encryptedValue) - } -} diff --git a/Sources/AGUICore/Decoding/MessageDTO/DeveloperMessageDTO.swift b/Sources/AGUICore/Decoding/MessageDTO/DeveloperMessageDTO.swift deleted file mode 100644 index 1833c17..0000000 --- a/Sources/AGUICore/Decoding/MessageDTO/DeveloperMessageDTO.swift +++ /dev/null @@ -1,59 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -/// Data Transfer Object for DeveloperMessage decoding. -struct DeveloperMessageDTO { - let id: String - let content: String - let name: String? - let encryptedValue: String? - - static func decode(from data: Data, decoder: JSONDecoder = JSONDecoder()) throws -> DeveloperMessageDTO { - guard let jsonObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else { - throw DecodingError.dataCorrupted( - DecodingError.Context(codingPath: [], debugDescription: "Expected JSON object at root") - ) - } - - // Validate role - let role = try MessageDecodingHelpers.extractRole(from: jsonObject) - try MessageDecodingHelpers.validateRole(role, expected: .developer) - - // Extract required fields - let id = try MessageDecodingHelpers.extractRequiredString(from: jsonObject, key: "id") - let content = try MessageDecodingHelpers.extractRequiredString(from: jsonObject, key: "content") - - // Extract optional fields - let name = MessageDecodingHelpers.extractOptionalString(from: jsonObject, key: "name") - let encryptedValue = MessageDecodingHelpers.extractOptionalString(from: jsonObject, key: "encryptedValue") - - return DeveloperMessageDTO(id: id, content: content, name: name, encryptedValue: encryptedValue) - } - - func toDomain() -> DeveloperMessage { - DeveloperMessage(id: id, content: content, name: name, encryptedValue: encryptedValue) - } -} diff --git a/Sources/AGUICore/Decoding/MessageDTO/SystemMessageDTO.swift b/Sources/AGUICore/Decoding/MessageDTO/SystemMessageDTO.swift deleted file mode 100644 index 1d7ec7c..0000000 --- a/Sources/AGUICore/Decoding/MessageDTO/SystemMessageDTO.swift +++ /dev/null @@ -1,59 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -/// Data Transfer Object for SystemMessage decoding. -struct SystemMessageDTO { - let id: String - let content: String? - let name: String? - let encryptedValue: String? - - static func decode(from data: Data, decoder: JSONDecoder = JSONDecoder()) throws -> SystemMessageDTO { - guard let jsonObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else { - throw DecodingError.dataCorrupted( - DecodingError.Context(codingPath: [], debugDescription: "Expected JSON object at root") - ) - } - - // Validate role - let role = try MessageDecodingHelpers.extractRole(from: jsonObject) - try MessageDecodingHelpers.validateRole(role, expected: .system) - - // Extract required fields - let id = try MessageDecodingHelpers.extractRequiredString(from: jsonObject, key: "id") - - // Extract optional fields - let content = MessageDecodingHelpers.extractOptionalString(from: jsonObject, key: "content") - let name = MessageDecodingHelpers.extractOptionalString(from: jsonObject, key: "name") - let encryptedValue = MessageDecodingHelpers.extractOptionalString(from: jsonObject, key: "encryptedValue") - - return SystemMessageDTO(id: id, content: content, name: name, encryptedValue: encryptedValue) - } - - func toDomain() -> SystemMessage { - SystemMessage(id: id, content: content, name: name, encryptedValue: encryptedValue) - } -} diff --git a/Sources/AGUICore/Decoding/MessageDecoder.swift b/Sources/AGUICore/Decoding/MessageDecoder.swift index cf80fdc..149d79e 100644 --- a/Sources/AGUICore/Decoding/MessageDecoder.swift +++ b/Sources/AGUICore/Decoding/MessageDecoder.swift @@ -210,16 +210,16 @@ public struct MessageDecoder: Sendable { public static func defaultRegistry() -> [Role: DecodeHandler] { [ .developer: { data, decoder in - try DeveloperMessageDTO.decode(from: data, decoder: decoder).toDomain() + try decoder.decode(DeveloperMessage.self, from: data) }, .system: { data, decoder in - try SystemMessageDTO.decode(from: data, decoder: decoder).toDomain() + try decoder.decode(SystemMessage.self, from: data) }, .user: { data, decoder in try UserMessageDTO.decode(from: data, decoder: decoder).toDomain() }, .assistant: { data, decoder in - try AssistantMessageDTO.decode(from: data, decoder: decoder).toDomain() + try decoder.decode(AssistantMessage.self, from: data) }, .tool: { data, decoder in try ToolMessageDTO.decode(from: data, decoder: decoder).toDomain() diff --git a/Sources/AGUICore/Decoding/Registry/TextMessageEventRegistry.swift b/Sources/AGUICore/Decoding/Registry/TextMessageEventRegistry.swift index ae5a759..edd3d3d 100644 --- a/Sources/AGUICore/Decoding/Registry/TextMessageEventRegistry.swift +++ b/Sources/AGUICore/Decoding/Registry/TextMessageEventRegistry.swift @@ -30,10 +30,10 @@ enum TextMessageEventRegistry { static func registry() -> [EventType: DecodeHandler] { [ .textMessageStart: { data, decoder in - try decoder.decode(TextMessageStartEventDTO.self, from: data).toDomain(rawEvent: data) + try decoder.decode(TextMessageStartEvent.self, from: data).withRawEvent(data) }, .textMessageContent: { data, decoder in - try decoder.decode(TextMessageContentEventDTO.self, from: data).toDomain(rawEvent: data) + try decoder.decode(TextMessageContentEvent.self, from: data).withRawEvent(data) }, .textMessageEnd: { data, decoder in try decoder.decode(TextMessageEndEventDTO.self, from: data).toDomain(rawEvent: data) diff --git a/Sources/AGUICore/Decoding/Registry/ToolCallEventRegistry.swift b/Sources/AGUICore/Decoding/Registry/ToolCallEventRegistry.swift index 6d5c005..57b18c8 100644 --- a/Sources/AGUICore/Decoding/Registry/ToolCallEventRegistry.swift +++ b/Sources/AGUICore/Decoding/Registry/ToolCallEventRegistry.swift @@ -30,10 +30,10 @@ enum ToolCallEventRegistry { static func registry() -> [EventType: DecodeHandler] { [ .toolCallStart: { data, decoder in - try decoder.decode(ToolCallStartEventDTO.self, from: data).toDomain(rawEvent: data) + try decoder.decode(ToolCallStartEvent.self, from: data).withRawEvent(data) }, .toolCallArgs: { data, decoder in - try decoder.decode(ToolCallArgsEventDTO.self, from: data).toDomain(rawEvent: data) + try decoder.decode(ToolCallArgsEvent.self, from: data).withRawEvent(data) }, .toolCallEnd: { data, decoder in try decoder.decode(ToolCallEndEventDTO.self, from: data).toDomain(rawEvent: data) diff --git a/Sources/AGUICore/Events/TextMessageEvents/TextMessageContentEvent.swift b/Sources/AGUICore/Events/TextMessageEvents/TextMessageContentEvent.swift index 15cfa76..ce1ee01 100644 --- a/Sources/AGUICore/Events/TextMessageEvents/TextMessageContentEvent.swift +++ b/Sources/AGUICore/Events/TextMessageEvents/TextMessageContentEvent.swift @@ -83,6 +83,33 @@ public struct TextMessageContentEvent: AGUIEvent, Equatable, Hashable, Sendable } } +// MARK: - Decodable + +extension TextMessageContentEvent: Decodable { + private enum CodingKeys: String, CodingKey { + case messageId + case delta + case timestamp + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + messageId = try container.decode(String.self, forKey: .messageId) + delta = try container.decode(String.self, forKey: .delta) + timestamp = try container.decodeIfPresent(Int64.self, forKey: .timestamp) + rawEvent = nil + } + + func withRawEvent(_ data: Data) -> Self { + TextMessageContentEvent( + messageId: messageId, + delta: delta, + timestamp: timestamp, + rawEvent: data + ) + } +} + // MARK: - CustomStringConvertible extension TextMessageContentEvent: CustomStringConvertible { public var description: String { diff --git a/Sources/AGUICore/Events/TextMessageEvents/TextMessageStartEvent.swift b/Sources/AGUICore/Events/TextMessageEvents/TextMessageStartEvent.swift index 6f64f94..206a25b 100644 --- a/Sources/AGUICore/Events/TextMessageEvents/TextMessageStartEvent.swift +++ b/Sources/AGUICore/Events/TextMessageEvents/TextMessageStartEvent.swift @@ -85,6 +85,36 @@ public struct TextMessageStartEvent: AGUIEvent, Equatable, Hashable, Sendable { } } +// MARK: - Decodable + +extension TextMessageStartEvent: Decodable { + private enum CodingKeys: String, CodingKey { + case messageId + case role + case name + case timestamp + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + messageId = try container.decode(String.self, forKey: .messageId) + role = try container.decode(String.self, forKey: .role) + name = try container.decodeIfPresent(String.self, forKey: .name) + timestamp = try container.decodeIfPresent(Int64.self, forKey: .timestamp) + rawEvent = nil + } + + func withRawEvent(_ data: Data) -> Self { + TextMessageStartEvent( + messageId: messageId, + role: role, + name: name, + timestamp: timestamp, + rawEvent: data + ) + } +} + // MARK: - CustomStringConvertible extension TextMessageStartEvent: CustomStringConvertible { public var description: String { diff --git a/Sources/AGUICore/Events/ToolCallEvents/ToolCallArgsEvent.swift b/Sources/AGUICore/Events/ToolCallEvents/ToolCallArgsEvent.swift index ab42ac7..63b6105 100644 --- a/Sources/AGUICore/Events/ToolCallEvents/ToolCallArgsEvent.swift +++ b/Sources/AGUICore/Events/ToolCallEvents/ToolCallArgsEvent.swift @@ -82,6 +82,33 @@ public struct ToolCallArgsEvent: AGUIEvent, Equatable, Hashable, Sendable { } } +// MARK: - Decodable + +extension ToolCallArgsEvent: Decodable { + private enum CodingKeys: String, CodingKey { + case toolCallId + case delta + case timestamp + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + toolCallId = try container.decode(String.self, forKey: .toolCallId) + delta = try container.decode(String.self, forKey: .delta) + timestamp = try container.decodeIfPresent(Int64.self, forKey: .timestamp) + rawEvent = nil + } + + func withRawEvent(_ data: Data) -> Self { + ToolCallArgsEvent( + toolCallId: toolCallId, + delta: delta, + timestamp: timestamp, + rawEvent: data + ) + } +} + // MARK: - CustomStringConvertible extension ToolCallArgsEvent: CustomStringConvertible { public var description: String { diff --git a/Sources/AGUICore/Events/ToolCallEvents/ToolCallStartEvent.swift b/Sources/AGUICore/Events/ToolCallEvents/ToolCallStartEvent.swift index 9fe4e40..d48600a 100644 --- a/Sources/AGUICore/Events/ToolCallEvents/ToolCallStartEvent.swift +++ b/Sources/AGUICore/Events/ToolCallEvents/ToolCallStartEvent.swift @@ -88,6 +88,36 @@ public struct ToolCallStartEvent: AGUIEvent, Equatable, Hashable, Sendable { } } +// MARK: - Decodable + +extension ToolCallStartEvent: Decodable { + private enum CodingKeys: String, CodingKey { + case toolCallId + case toolCallName + case parentMessageId + case timestamp + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + toolCallId = try container.decode(String.self, forKey: .toolCallId) + toolCallName = try container.decode(String.self, forKey: .toolCallName) + parentMessageId = try container.decodeIfPresent(String.self, forKey: .parentMessageId) + timestamp = try container.decodeIfPresent(Int64.self, forKey: .timestamp) + rawEvent = nil + } + + func withRawEvent(_ data: Data) -> Self { + ToolCallStartEvent( + toolCallId: toolCallId, + toolCallName: toolCallName, + parentMessageId: parentMessageId, + timestamp: timestamp, + rawEvent: data + ) + } +} + // MARK: - CustomStringConvertible extension ToolCallStartEvent: CustomStringConvertible { public var description: String { diff --git a/Sources/AGUICore/Types/Messages/AssistantMessage.swift b/Sources/AGUICore/Types/Messages/AssistantMessage.swift index b32eec8..1450377 100644 --- a/Sources/AGUICore/Types/Messages/AssistantMessage.swift +++ b/Sources/AGUICore/Types/Messages/AssistantMessage.swift @@ -153,3 +153,25 @@ public struct AssistantMessage: Message, Sendable, Hashable { self.encryptedValue = encryptedValue } } + +// MARK: - Decodable + +extension AssistantMessage: Decodable { + private enum CodingKeys: String, CodingKey { + case id + case content + case name + case toolCalls + case encryptedValue + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + id = try container.decode(String.self, forKey: .id) + role = .assistant + content = try container.decodeIfPresent(String.self, forKey: .content) + name = try container.decodeIfPresent(String.self, forKey: .name) + toolCalls = try container.decodeIfPresent([ToolCall].self, forKey: .toolCalls) + encryptedValue = try container.decodeIfPresent(String.self, forKey: .encryptedValue) + } +} diff --git a/Sources/AGUICore/Types/Messages/DeveloperMessage.swift b/Sources/AGUICore/Types/Messages/DeveloperMessage.swift index f7fcbd0..e1cdd4a 100644 --- a/Sources/AGUICore/Types/Messages/DeveloperMessage.swift +++ b/Sources/AGUICore/Types/Messages/DeveloperMessage.swift @@ -113,3 +113,23 @@ public struct DeveloperMessage: Message, Sendable, Hashable { self.encryptedValue = encryptedValue } } + +// MARK: - Decodable + +extension DeveloperMessage: Decodable { + private enum CodingKeys: String, CodingKey { + case id + case content + case name + case encryptedValue + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + id = try container.decode(String.self, forKey: .id) + role = .developer + content = try container.decode(String.self, forKey: .content) + name = try container.decodeIfPresent(String.self, forKey: .name) + encryptedValue = try container.decodeIfPresent(String.self, forKey: .encryptedValue) + } +} diff --git a/Sources/AGUICore/Types/Messages/SystemMessage.swift b/Sources/AGUICore/Types/Messages/SystemMessage.swift index 20b51ca..567a3eb 100644 --- a/Sources/AGUICore/Types/Messages/SystemMessage.swift +++ b/Sources/AGUICore/Types/Messages/SystemMessage.swift @@ -121,3 +121,23 @@ public struct SystemMessage: Message, Sendable, Hashable { self.encryptedValue = encryptedValue } } + +// MARK: - Decodable + +extension SystemMessage: Decodable { + private enum CodingKeys: String, CodingKey { + case id + case content + case name + case encryptedValue + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + id = try container.decode(String.self, forKey: .id) + role = .system + content = try container.decodeIfPresent(String.self, forKey: .content) + name = try container.decodeIfPresent(String.self, forKey: .name) + encryptedValue = try container.decodeIfPresent(String.self, forKey: .encryptedValue) + } +} From f829435d2f581da52a3908b61bde52824c10ee14 Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 16:03:14 -0400 Subject: [PATCH 07/19] fix: rename ActivityMessage.activityContent to content Remove `content: String?` from the Message protocol (breaking change). Rename `ActivityMessage.activityContent: Data` to `content: Data` to align the property name with its AG-UI wire-format key. Update all callers: ActivityMessageDTO.toDomain(), MessageEncoder, RunAgentInput hash/equality, and the full test suite. --- .../MessageDTO/ActivityMessageDTO.swift | 2 +- .../AGUICore/Encoding/MessageEncoder.swift | 2 +- .../StateEvents/MessagesSnapshotEvent.swift | 2 +- .../Types/AgentExecution/RunAgentInput.swift | 2 - .../Types/Messages/ActivityMessage.swift | 28 ++++------ Sources/AGUICore/Types/Messages/Message.swift | 10 ---- Tests/AGUIAgentSDKTests/AgUiAgentTests.swift | 8 +-- .../AgentExecution/RunAgentInputTests.swift | 6 +- .../Types/Messages/ActivityMessageTests.swift | 55 +++++++++---------- .../Messages/AssistantMessageTests.swift | 2 +- .../Messages/DeveloperMessageTests.swift | 2 +- .../Types/Messages/SystemMessageTests.swift | 2 +- .../Types/Messages/ToolMessageTests.swift | 2 +- .../Types/Messages/UserMessageTests.swift | 2 +- 14 files changed, 53 insertions(+), 72 deletions(-) diff --git a/Sources/AGUICore/Decoding/MessageDTO/ActivityMessageDTO.swift b/Sources/AGUICore/Decoding/MessageDTO/ActivityMessageDTO.swift index 1f9e70c..1155546 100644 --- a/Sources/AGUICore/Decoding/MessageDTO/ActivityMessageDTO.swift +++ b/Sources/AGUICore/Decoding/MessageDTO/ActivityMessageDTO.swift @@ -72,7 +72,7 @@ struct ActivityMessageDTO { } func toDomain() -> ActivityMessage { - ActivityMessage(id: id, activityType: activityType, activityContent: activityContent) + ActivityMessage(id: id, activityType: activityType, content: activityContent) } private enum CodingKeys: String, CodingKey { diff --git a/Sources/AGUICore/Encoding/MessageEncoder.swift b/Sources/AGUICore/Encoding/MessageEncoder.swift index 02dc3b0..cd352d5 100644 --- a/Sources/AGUICore/Encoding/MessageEncoder.swift +++ b/Sources/AGUICore/Encoding/MessageEncoder.swift @@ -404,7 +404,7 @@ private func encodeActivityMessage(_ message: any Message, encoder: JSONEncoder) throw MessageEncodingError.invalidMessageType(.activity, String(describing: type(of: message))) } - let activityContentObj = try JSONSerialization.jsonObject(with: activityMsg.activityContent) + let activityContentObj = try JSONSerialization.jsonObject(with: activityMsg.content) let dict: [String: Any] = [ "id": activityMsg.id, "role": activityMsg.role.rawValue, diff --git a/Sources/AGUICore/Events/StateEvents/MessagesSnapshotEvent.swift b/Sources/AGUICore/Events/StateEvents/MessagesSnapshotEvent.swift index f6678c3..eb518a9 100644 --- a/Sources/AGUICore/Events/StateEvents/MessagesSnapshotEvent.swift +++ b/Sources/AGUICore/Events/StateEvents/MessagesSnapshotEvent.swift @@ -110,7 +110,7 @@ public struct MessagesSnapshotEvent: AGUIEvent, Equatable, Sendable { /// let content: String /// } /// - /// let messages = try event.parsedMessages(as: [Message].self) + /// let messages = try event.parsedMessages(as: [MyMessage].self) /// for message in messages { /// print("\(message.role): \(message.content)") /// } diff --git a/Sources/AGUICore/Types/AgentExecution/RunAgentInput.swift b/Sources/AGUICore/Types/AgentExecution/RunAgentInput.swift index 46e247f..873722f 100644 --- a/Sources/AGUICore/Types/AgentExecution/RunAgentInput.swift +++ b/Sources/AGUICore/Types/AgentExecution/RunAgentInput.swift @@ -271,7 +271,6 @@ public struct RunAgentInput: Sendable, Codable, Hashable { for message in messages { hasher.combine(message.id) hasher.combine(message.role) - hasher.combine(message.content) hasher.combine(message.name) } } @@ -293,7 +292,6 @@ public struct RunAgentInput: Sendable, Codable, Hashable { return zip(lhs.messages, rhs.messages).allSatisfy { lhsMsg, rhsMsg in lhsMsg.id == rhsMsg.id && lhsMsg.role == rhsMsg.role && - lhsMsg.content == rhsMsg.content && lhsMsg.name == rhsMsg.name } } diff --git a/Sources/AGUICore/Types/Messages/ActivityMessage.swift b/Sources/AGUICore/Types/Messages/ActivityMessage.swift index a5b2638..1e93fbe 100644 --- a/Sources/AGUICore/Types/Messages/ActivityMessage.swift +++ b/Sources/AGUICore/Types/Messages/ActivityMessage.swift @@ -38,9 +38,9 @@ import Foundation /// - **Status**: System status and state updates /// - **Custom**: Application-specific activity types /// -/// ## Activity Content +/// ## Content /// -/// The `activityContent` field stores flexible JSON data as a `Data` object, +/// The `content` field stores flexible JSON data as a `Data` object, /// allowing each activity type to define its own content structure. /// /// ## Usage Examples @@ -59,7 +59,7 @@ import Foundation /// let progress = ActivityMessage( /// id: "progress-1", /// activityType: "progress", -/// activityContent: progressContent +/// content: progressContent /// ) /// /// // Chart visualization @@ -78,7 +78,7 @@ import Foundation /// let chart = ActivityMessage( /// id: "viz-1", /// activityType: "chart", -/// activityContent: chartContent +/// content: chartContent /// ) /// /// // A2UI form surface @@ -95,14 +95,14 @@ import Foundation /// let form = ActivityMessage( /// id: "surface-1", /// activityType: "a2ui-form", -/// activityContent: formContent +/// content: formContent /// ) /// ``` /// /// ## Message Protocol /// -/// ActivityMessage conforms to the Message protocol, but `content` and `name` -/// are always `nil` since activities use structured `activityContent` instead. +/// ActivityMessage conforms to the Message protocol. `name` and `encryptedValue` +/// are always `nil` since activities use structured JSON `content` instead. /// /// - SeeAlso: ``Message``, ``Role`` public struct ActivityMessage: Message, Sendable, Hashable { @@ -126,13 +126,7 @@ public struct ActivityMessage: Message, Sendable, Hashable { /// /// This field contains a JSON object with activity-specific data. /// The structure varies based on the `activityType`. - public let activityContent: Data - - /// Text content (always `nil` for activity messages). - /// - /// ActivityMessage uses `activityContent` for structured data - /// instead of text content. - public let content: String? = nil + public let content: Data /// Optional sender name (always `nil` for activity messages). public let name: String? = nil @@ -147,15 +141,15 @@ public struct ActivityMessage: Message, Sendable, Hashable { /// - Parameters: /// - id: Unique identifier for the message /// - activityType: The type of activity - /// - activityContent: JSON data representing the activity content + /// - content: JSON data representing the activity content public init( id: String, activityType: String, - activityContent: Data + content: Data ) { self.id = id self.role = .activity self.activityType = activityType - self.activityContent = activityContent + self.content = content } } diff --git a/Sources/AGUICore/Types/Messages/Message.swift b/Sources/AGUICore/Types/Messages/Message.swift index 027c6fa..28856c9 100644 --- a/Sources/AGUICore/Types/Messages/Message.swift +++ b/Sources/AGUICore/Types/Messages/Message.swift @@ -36,7 +36,6 @@ import Foundation /// All messages share these properties: /// - ``id``: Unique identifier for the message instance /// - ``role``: The sender's role (developer, system, assistant, user, tool, activity) -/// - ``content``: Optional text content of the message /// - ``name``: Optional identifier for the sender /// /// ## Message Types @@ -95,15 +94,6 @@ public protocol Message: Sendable { /// - SeeAlso: ``Role`` var role: Role { get } - /// The text content of the message. - /// - /// This property is optional because: - /// - Some message types may convey information through other fields - /// - SystemMessage content may be optional - /// - AssistantMessage may contain only tool calls without text - /// - UserMessage may use multimodal content instead - var content: String? { get } - /// Optional identifier for the message sender. /// /// This can be used to: diff --git a/Tests/AGUIAgentSDKTests/AgUiAgentTests.swift b/Tests/AGUIAgentSDKTests/AgUiAgentTests.swift index 1f56cf1..e7cbd59 100644 --- a/Tests/AGUIAgentSDKTests/AgUiAgentTests.swift +++ b/Tests/AGUIAgentSDKTests/AgUiAgentTests.swift @@ -116,7 +116,7 @@ final class AgUiAgentTests: XCTestCase { let input = try XCTUnwrap(inputs.first) XCTAssertEqual(input.messages.count, 1) XCTAssertEqual(input.messages[0].role, .user) - XCTAssertEqual(input.messages[0].content, "Hello!") + XCTAssertEqual((input.messages[0] as? UserMessage)?.content, "Hello!") } func testSendMessagePrependsSystemPromptWhenConfigured() async throws { @@ -130,7 +130,7 @@ final class AgUiAgentTests: XCTestCase { let input = try XCTUnwrap(captured1.first) XCTAssertEqual(input.messages.count, 2) XCTAssertEqual(input.messages[0].role, .system) - XCTAssertEqual(input.messages[0].content, "Be concise.") + XCTAssertEqual((input.messages[0] as? SystemMessage)?.content, "Be concise.") XCTAssertEqual(input.messages[1].role, .user) } @@ -181,10 +181,10 @@ final class AgUiAgentTests: XCTestCase { let second = capturedAll[1] XCTAssertEqual(first.messages.count, 1) - XCTAssertEqual(first.messages[0].content, "Message 1") + XCTAssertEqual((first.messages[0] as? UserMessage)?.content, "Message 1") XCTAssertEqual(second.messages.count, 1) - XCTAssertEqual(second.messages[0].content, "Message 2") + XCTAssertEqual((second.messages[0] as? UserMessage)?.content, "Message 2") } // MARK: - Tool registry integration diff --git a/Tests/AGUICoreTests/Types/AgentExecution/RunAgentInputTests.swift b/Tests/AGUICoreTests/Types/AgentExecution/RunAgentInputTests.swift index 32d692f..e6adf21 100644 --- a/Tests/AGUICoreTests/Types/AgentExecution/RunAgentInputTests.swift +++ b/Tests/AGUICoreTests/Types/AgentExecution/RunAgentInputTests.swift @@ -456,8 +456,8 @@ final class RunAgentInputTests: XCTestCase { ] let messages2: [any Message] = [ - UserMessage(id: "msg-1", content: "Goodbye"), - AssistantMessage(id: "msg-2", content: "See you!") + UserMessage(id: "msg-3", content: "Goodbye"), + AssistantMessage(id: "msg-4", content: "See you!") ] let input1 = RunAgentInput( @@ -472,7 +472,7 @@ final class RunAgentInputTests: XCTestCase { messages: messages2 ) - // Should be different even though message count is the same + // Should be different because message IDs differ XCTAssertNotEqual(input1, input2) } diff --git a/Tests/AGUICoreTests/Types/Messages/ActivityMessageTests.swift b/Tests/AGUICoreTests/Types/Messages/ActivityMessageTests.swift index 1d457f2..7f48502 100644 --- a/Tests/AGUICoreTests/Types/Messages/ActivityMessageTests.swift +++ b/Tests/AGUICoreTests/Types/Messages/ActivityMessageTests.swift @@ -39,13 +39,13 @@ final class ActivityMessageTests: XCTestCase { let message = ActivityMessage( id: "activity-1", activityType: "progress", - activityContent: content + content: content ) XCTAssertEqual(message.id, "activity-1") XCTAssertEqual(message.activityType, "progress") XCTAssertEqual(message.role, .activity) - XCTAssertNil(message.content) + XCTAssertFalse(message.content.isEmpty) XCTAssertNil(message.name) } @@ -63,11 +63,11 @@ final class ActivityMessageTests: XCTestCase { let message = ActivityMessage( id: "activity-2", activityType: "visualization", - activityContent: content + content: content ) XCTAssertEqual(message.activityType, "visualization") - XCTAssertNotNil(message.activityContent) + XCTAssertNotNil(message.content) } // MARK: - Message Protocol Conformance Tests @@ -77,12 +77,11 @@ final class ActivityMessageTests: XCTestCase { let message: any Message = ActivityMessage( id: "activity-3", activityType: "status", - activityContent: content + content: content ) XCTAssertEqual(message.id, "activity-3") XCTAssertEqual(message.role, .activity) - XCTAssertNil(message.content) XCTAssertNil(message.name) } @@ -91,7 +90,7 @@ final class ActivityMessageTests: XCTestCase { let message = ActivityMessage( id: "1", activityType: "test", - activityContent: content + content: content ) XCTAssertEqual(message.role, .activity) @@ -125,10 +124,10 @@ final class ActivityMessageTests: XCTestCase { XCTAssertEqual(activityMessage.id, "activity-decode-1") XCTAssertEqual(activityMessage.role, .activity) XCTAssertEqual(activityMessage.activityType, "progress") - XCTAssertNil(activityMessage.content) + XCTAssertFalse(activityMessage.content.isEmpty) XCTAssertNil(activityMessage.name) - let activityContent = try JSONSerialization.jsonObject(with: activityMessage.activityContent) as? [String: Any] + let activityContent = try JSONSerialization.jsonObject(with: activityMessage.content) as? [String: Any] XCTAssertEqual(activityContent?["percent"] as? Int, 75) } @@ -155,7 +154,7 @@ final class ActivityMessageTests: XCTestCase { let activityMessage = message as! ActivityMessage XCTAssertEqual(activityMessage.activityType, "visualization") - let content = try JSONSerialization.jsonObject(with: activityMessage.activityContent) as? [String: Any] + let content = try JSONSerialization.jsonObject(with: activityMessage.content) as? [String: Any] XCTAssertEqual(content?["type"] as? String, "chart") let data = content?["data"] as? [String: Any] @@ -238,7 +237,7 @@ final class ActivityMessageTests: XCTestCase { let original = ActivityMessage( id: "activity-rt-1", activityType: "status", - activityContent: content + content: content ) // Encode via DTO (simulating what RunAgentInput does) @@ -261,8 +260,8 @@ final class ActivityMessageTests: XCTestCase { XCTAssertEqual(activityMessage.activityType, original.activityType) XCTAssertEqual(activityMessage.role, original.role) - let originalContent = try JSONSerialization.jsonObject(with: original.activityContent) as? [String: Any] - let decodedContent = try JSONSerialization.jsonObject(with: activityMessage.activityContent) as? [String: Any] + let originalContent = try JSONSerialization.jsonObject(with: original.content) as? [String: Any] + let decodedContent = try JSONSerialization.jsonObject(with: activityMessage.content) as? [String: Any] XCTAssertEqual(originalContent?["status"] as? String, decodedContent?["status"] as? String) } @@ -281,11 +280,11 @@ final class ActivityMessageTests: XCTestCase { {"value": 2} """.utf8) - let message1 = ActivityMessage(id: "1", activityType: "test", activityContent: content1) - let message2 = ActivityMessage(id: "1", activityType: "test", activityContent: content2) - let message3 = ActivityMessage(id: "2", activityType: "test", activityContent: content1) - let message4 = ActivityMessage(id: "1", activityType: "other", activityContent: content1) - let message5 = ActivityMessage(id: "1", activityType: "test", activityContent: content3) + let message1 = ActivityMessage(id: "1", activityType: "test", content: content1) + let message2 = ActivityMessage(id: "1", activityType: "test", content: content2) + let message3 = ActivityMessage(id: "2", activityType: "test", content: content1) + let message4 = ActivityMessage(id: "1", activityType: "other", content: content1) + let message5 = ActivityMessage(id: "1", activityType: "test", content: content3) XCTAssertEqual(message1, message2) XCTAssertNotEqual(message1, message3) @@ -304,8 +303,8 @@ final class ActivityMessageTests: XCTestCase { {"id": 2} """.utf8) - let message1 = ActivityMessage(id: "1", activityType: "test", activityContent: content1) - let message2 = ActivityMessage(id: "2", activityType: "test", activityContent: content2) + let message1 = ActivityMessage(id: "1", activityType: "test", content: content1) + let message2 = ActivityMessage(id: "2", activityType: "test", content: content2) let set: Set = [message1, message2] XCTAssertEqual(set.count, 2) @@ -320,7 +319,7 @@ final class ActivityMessageTests: XCTestCase { let message = ActivityMessage( id: "activity-concurrent", activityType: "test", - activityContent: content + content: content ) Task { @@ -344,7 +343,7 @@ final class ActivityMessageTests: XCTestCase { let progress = ActivityMessage( id: "progress-1", activityType: "progress", - activityContent: content + content: content ) XCTAssertEqual(progress.activityType, "progress") @@ -365,7 +364,7 @@ final class ActivityMessageTests: XCTestCase { let surface = ActivityMessage( id: "surface-1", activityType: "a2ui-form", - activityContent: content + content: content ) XCTAssertEqual(surface.activityType, "a2ui-form") @@ -387,7 +386,7 @@ final class ActivityMessageTests: XCTestCase { let chart = ActivityMessage( id: "viz-1", activityType: "chart", - activityContent: content + content: content ) XCTAssertEqual(chart.activityType, "chart") @@ -405,11 +404,11 @@ final class ActivityMessageTests: XCTestCase { let status = ActivityMessage( id: "status-1", activityType: "status", - activityContent: content + content: content ) XCTAssertEqual(status.activityType, "status") - XCTAssertNil(status.content) + XCTAssertFalse(status.content.isEmpty) } // MARK: - Wire Format Tests (Protocol Compliance) @@ -434,7 +433,7 @@ final class ActivityMessageTests: XCTestCase { let activityMessage = message as! ActivityMessage XCTAssertEqual(activityMessage.id, "wire-format-1") XCTAssertEqual(activityMessage.activityType, "progress") - let parsedContent = try JSONSerialization.jsonObject(with: activityMessage.activityContent) as? [String: Any] + let parsedContent = try JSONSerialization.jsonObject(with: activityMessage.content) as? [String: Any] XCTAssertEqual(parsedContent?["percent"] as? Int, 80) } @@ -444,7 +443,7 @@ final class ActivityMessageTests: XCTestCase { let message = ActivityMessage( id: "wire-encode-1", activityType: "progress", - activityContent: rawContent + content: rawContent ) let encoder = MessageEncoder() diff --git a/Tests/AGUICoreTests/Types/Messages/AssistantMessageTests.swift b/Tests/AGUICoreTests/Types/Messages/AssistantMessageTests.swift index fdc2f05..cbb9a28 100644 --- a/Tests/AGUICoreTests/Types/Messages/AssistantMessageTests.swift +++ b/Tests/AGUICoreTests/Types/Messages/AssistantMessageTests.swift @@ -107,7 +107,7 @@ final class AssistantMessageTests: XCTestCase { XCTAssertEqual(message.id, "asst-5") XCTAssertEqual(message.role, .assistant) - XCTAssertEqual(message.content, "Test") + XCTAssertEqual((message as? AssistantMessage)?.content, "Test") } func testRoleIsAlwaysAssistant() { diff --git a/Tests/AGUICoreTests/Types/Messages/DeveloperMessageTests.swift b/Tests/AGUICoreTests/Types/Messages/DeveloperMessageTests.swift index e4aa119..63f354b 100644 --- a/Tests/AGUICoreTests/Types/Messages/DeveloperMessageTests.swift +++ b/Tests/AGUICoreTests/Types/Messages/DeveloperMessageTests.swift @@ -64,7 +64,7 @@ final class DeveloperMessageTests: XCTestCase { XCTAssertEqual(message.id, "dev-3") XCTAssertEqual(message.role, .developer) - XCTAssertEqual(message.content, "Test message") + XCTAssertEqual((message as? DeveloperMessage)?.content, "Test message") } func testRoleIsAlwaysDeveloper() { diff --git a/Tests/AGUICoreTests/Types/Messages/SystemMessageTests.swift b/Tests/AGUICoreTests/Types/Messages/SystemMessageTests.swift index 870d633..8ffb2d7 100644 --- a/Tests/AGUICoreTests/Types/Messages/SystemMessageTests.swift +++ b/Tests/AGUICoreTests/Types/Messages/SystemMessageTests.swift @@ -76,7 +76,7 @@ final class SystemMessageTests: XCTestCase { XCTAssertEqual(message.id, "sys-4") XCTAssertEqual(message.role, .system) - XCTAssertEqual(message.content, "Test message") + XCTAssertEqual((message as? SystemMessage)?.content, "Test message") } func testRoleIsAlwaysSystem() { diff --git a/Tests/AGUICoreTests/Types/Messages/ToolMessageTests.swift b/Tests/AGUICoreTests/Types/Messages/ToolMessageTests.swift index d04d870..86e61fc 100644 --- a/Tests/AGUICoreTests/Types/Messages/ToolMessageTests.swift +++ b/Tests/AGUICoreTests/Types/Messages/ToolMessageTests.swift @@ -85,7 +85,7 @@ final class ToolMessageTests: XCTestCase { XCTAssertEqual(message.id, "tool-msg-4") XCTAssertEqual(message.role, .tool) - XCTAssertEqual(message.content, "Success") + XCTAssertEqual((message as? ToolMessage)?.content, "Success") } func testRoleIsAlwaysTool() { diff --git a/Tests/AGUICoreTests/Types/Messages/UserMessageTests.swift b/Tests/AGUICoreTests/Types/Messages/UserMessageTests.swift index df055da..0932ff1 100644 --- a/Tests/AGUICoreTests/Types/Messages/UserMessageTests.swift +++ b/Tests/AGUICoreTests/Types/Messages/UserMessageTests.swift @@ -114,7 +114,7 @@ final class UserMessageTests: XCTestCase { XCTAssertEqual(message.id, "user-6") XCTAssertEqual(message.role, .user) - XCTAssertEqual(message.content, "Test message") + XCTAssertEqual((message as? UserMessage)?.content, "Test message") } func testRoleIsAlwaysUser() { From 11c7ab61061c565832baacc15186aed2361542c3 Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 16:14:29 -0400 Subject: [PATCH 08/19] feat: add RunFinishedOutcome to RunFinishedEvent Introduces a typed RunFinishedOutcome enum (COMPLETED / CANCELLED / MAX_ITERATIONS_REACHED) on RunFinishedEvent. The DTO decoder defaults to .completed for absent or unrecognised outcome values, keeping forward- compatibility with future protocol versions. Nine new tests cover each case, the missing-field default, and the unknown-value fallback. --- .../RunFinishedEventDTO.swift | 17 ++- .../LifeCycleEvents/RunFinishedEvent.swift | 11 +- .../LifeCycleEvents/RunFinishedOutcome.swift | 40 +++++ .../RunFinishedEventTests.swift | 138 +++++++++++++++++- 4 files changed, 200 insertions(+), 6 deletions(-) create mode 100644 Sources/AGUICore/Events/LifeCycleEvents/RunFinishedOutcome.swift diff --git a/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/RunFinishedEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/RunFinishedEventDTO.swift index a5aea5f..0ac056b 100644 --- a/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/RunFinishedEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/RunFinishedEventDTO.swift @@ -27,6 +27,7 @@ import Foundation struct RunFinishedEventDTO { let threadId: String let runId: String + let outcome: RunFinishedOutcome let result: Data? let timestamp: Int64? @@ -69,6 +70,16 @@ struct RunFinishedEventDTO { ) } + // Decode outcome; unknown or missing values fall back to .completed for + // forward-compatibility with future protocol versions. + let outcome: RunFinishedOutcome + if let raw = jsonObject["outcome"] as? String, + let parsed = RunFinishedOutcome(rawValue: raw) { + outcome = parsed + } else { + outcome = .completed + } + let timestamp = try EventDecodingHelpers.extractTimestamp(from: jsonObject) var resultData: Data? @@ -76,14 +87,14 @@ struct RunFinishedEventDTO { resultData = try? JSONSerialization.data(withJSONObject: resultValue) } - return RunFinishedEventDTO(threadId: threadId, runId: runId, result: resultData, timestamp: timestamp) + return RunFinishedEventDTO(threadId: threadId, runId: runId, outcome: outcome, result: resultData, timestamp: timestamp) } func toDomain(rawEvent: Data? = nil) -> RunFinishedEvent { - RunFinishedEvent(threadId: threadId, runId: runId, result: result, timestamp: timestamp, rawEvent: rawEvent) + RunFinishedEvent(threadId: threadId, runId: runId, outcome: outcome, result: result, timestamp: timestamp, rawEvent: rawEvent) } private enum CodingKeys: String, CodingKey { - case threadId, runId, result, timestamp + case threadId, runId, outcome, result, timestamp } } diff --git a/Sources/AGUICore/Events/LifeCycleEvents/RunFinishedEvent.swift b/Sources/AGUICore/Events/LifeCycleEvents/RunFinishedEvent.swift index 3c11450..4d97c03 100644 --- a/Sources/AGUICore/Events/LifeCycleEvents/RunFinishedEvent.swift +++ b/Sources/AGUICore/Events/LifeCycleEvents/RunFinishedEvent.swift @@ -40,6 +40,12 @@ public struct RunFinishedEvent: AGUIEvent, Equatable, Hashable, Sendable { /// The unique identifier for the completed run. public let runId: String + /// Why the run finished. + /// + /// Decoded from the `"outcome"` field in the AG-UI wire format. + /// Defaults to `.completed` when the field is absent or unrecognised. + public let outcome: RunFinishedOutcome + /// Optional run result as raw JSON. /// /// Corresponds to `result: z.any().optional()` in the AG-UI protocol. @@ -62,18 +68,21 @@ public struct RunFinishedEvent: AGUIEvent, Equatable, Hashable, Sendable { /// - Parameters: /// - threadId: The conversation thread identifier /// - runId: The unique run identifier + /// - outcome: Why the run finished (defaults to `.completed`) /// - result: Optional run result as raw JSON data /// - timestamp: Optional timestamp in milliseconds since epoch /// - rawEvent: Optional raw event data as received from the agent public init( threadId: String, runId: String, + outcome: RunFinishedOutcome = .completed, result: Data? = nil, timestamp: Int64? = nil, rawEvent: Data? = nil ) { self.threadId = threadId self.runId = runId + self.outcome = outcome self.result = result self.timestamp = timestamp self.rawEvent = rawEvent @@ -85,6 +94,6 @@ public struct RunFinishedEvent: AGUIEvent, Equatable, Hashable, Sendable { extension RunFinishedEvent: CustomStringConvertible { public var description: String { - "RunFinishedEvent(threadId: \(threadId), runId: \(runId), timestamp: \(timestamp?.description ?? "nil"))" + "RunFinishedEvent(threadId: \(threadId), runId: \(runId), outcome: \(outcome.rawValue), timestamp: \(timestamp?.description ?? "nil"))" } } diff --git a/Sources/AGUICore/Events/LifeCycleEvents/RunFinishedOutcome.swift b/Sources/AGUICore/Events/LifeCycleEvents/RunFinishedOutcome.swift new file mode 100644 index 0000000..e326e93 --- /dev/null +++ b/Sources/AGUICore/Events/LifeCycleEvents/RunFinishedOutcome.swift @@ -0,0 +1,40 @@ +/* + * MIT License + * + * Copyright (c) 2025 Perfect Aduh + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/// Describes why an agent run finished. +/// +/// Carried by `RunFinishedEvent` and decoded from the `"outcome"` field in the +/// AG-UI wire format. Unknown values from future protocol versions fall back to +/// `.completed`. +public enum RunFinishedOutcome: String, Equatable, Hashable, Sendable, Codable { + + /// The run completed normally with a result (or no result). + case completed = "COMPLETED" + + /// The run was cancelled before it produced a final result. + case cancelled = "CANCELLED" + + /// The run stopped because it reached the configured iteration ceiling. + case maxIterationsReached = "MAX_ITERATIONS_REACHED" +} diff --git a/Tests/AGUICoreTests/LifeCycleEvents/RunFinishedEventTests.swift b/Tests/AGUICoreTests/LifeCycleEvents/RunFinishedEventTests.swift index 5261956..f9dff7a 100644 --- a/Tests/AGUICoreTests/LifeCycleEvents/RunFinishedEventTests.swift +++ b/Tests/AGUICoreTests/LifeCycleEvents/RunFinishedEventTests.swift @@ -173,6 +173,107 @@ final class RunFinishedEventTests: XCTestCase, } } + // MARK: - Feature: Decode outcome field + + func test_decodeRunFinished_withOutcomeCompleted_populatesOutcome() throws { + // Given + let data = jsonData(""" + { + "type": "RUN_FINISHED", + "threadId": "\(EventTestData.threadId)", + "runId": "\(EventTestData.runId)", + "outcome": "COMPLETED" + } + """) + let decoder = makeStrictDecoder() + + // When + let event = try decoder.decode(data) + + // Then + let runFinished = try XCTUnwrap(event as? RunFinishedEvent) + XCTAssertEqual(runFinished.outcome, .completed) + } + + func test_decodeRunFinished_withOutcomeCancelled_populatesOutcome() throws { + // Given + let data = jsonData(""" + { + "type": "RUN_FINISHED", + "threadId": "\(EventTestData.threadId)", + "runId": "\(EventTestData.runId)", + "outcome": "CANCELLED" + } + """) + let decoder = makeStrictDecoder() + + // When + let event = try decoder.decode(data) + + // Then + let runFinished = try XCTUnwrap(event as? RunFinishedEvent) + XCTAssertEqual(runFinished.outcome, .cancelled) + } + + func test_decodeRunFinished_withOutcomeMaxIterationsReached_populatesOutcome() throws { + // Given + let data = jsonData(""" + { + "type": "RUN_FINISHED", + "threadId": "\(EventTestData.threadId)", + "runId": "\(EventTestData.runId)", + "outcome": "MAX_ITERATIONS_REACHED" + } + """) + let decoder = makeStrictDecoder() + + // When + let event = try decoder.decode(data) + + // Then + let runFinished = try XCTUnwrap(event as? RunFinishedEvent) + XCTAssertEqual(runFinished.outcome, .maxIterationsReached) + } + + func test_decodeRunFinished_missingOutcome_defaultsToCompleted() throws { + // Given – no "outcome" key in JSON + let data = jsonData(""" + { + "type": "RUN_FINISHED", + "threadId": "\(EventTestData.threadId)", + "runId": "\(EventTestData.runId)" + } + """) + let decoder = makeStrictDecoder() + + // When + let event = try decoder.decode(data) + + // Then + let runFinished = try XCTUnwrap(event as? RunFinishedEvent) + XCTAssertEqual(runFinished.outcome, .completed) + } + + func test_decodeRunFinished_unknownOutcomeString_defaultsToCompleted() throws { + // Given – unrecognised outcome value from a future protocol version + let data = jsonData(""" + { + "type": "RUN_FINISHED", + "threadId": "\(EventTestData.threadId)", + "runId": "\(EventTestData.runId)", + "outcome": "SUSPENDED" + } + """) + let decoder = makeStrictDecoder() + + // When + let event = try decoder.decode(data) + + // Then + let runFinished = try XCTUnwrap(event as? RunFinishedEvent) + XCTAssertEqual(runFinished.outcome, .completed) + } + // MARK: - Feature: Model behaviors func test_runFinishedEvent_eventTypeIsAlwaysRunFinished() { @@ -183,12 +284,45 @@ final class RunFinishedEventTests: XCTestCase, XCTAssertEqual(event.eventType, .runFinished) } + func test_runFinishedEvent_defaultOutcomeIsCompleted() { + // Given + let event = RunFinishedEvent(threadId: "t", runId: "r") + + // Then + XCTAssertEqual(event.outcome, .completed) + } + + func test_runFinishedEvent_outcomeCanBeSetToCancelled() { + // Given + let event = RunFinishedEvent(threadId: "t", runId: "r", outcome: .cancelled) + + // Then + XCTAssertEqual(event.outcome, .cancelled) + } + + func test_runFinishedEvent_outcomeCanBeSetToMaxIterationsReached() { + // Given + let event = RunFinishedEvent(threadId: "t", runId: "r", outcome: .maxIterationsReached) + + // Then + XCTAssertEqual(event.outcome, .maxIterationsReached) + } + func test_runFinishedEvent_equatable_sameFields_areEqual() { // Given - let event1 = RunFinishedEvent(threadId: "t", runId: "r", timestamp: 1, rawEvent: nil) - let event2 = RunFinishedEvent(threadId: "t", runId: "r", timestamp: 1, rawEvent: nil) + let event1 = RunFinishedEvent(threadId: "t", runId: "r", outcome: .completed, timestamp: 1, rawEvent: nil) + let event2 = RunFinishedEvent(threadId: "t", runId: "r", outcome: .completed, timestamp: 1, rawEvent: nil) // Then XCTAssertEqual(event1, event2) } + + func test_runFinishedEvent_equatable_differentOutcome_areNotEqual() { + // Given + let event1 = RunFinishedEvent(threadId: "t", runId: "r", outcome: .completed) + let event2 = RunFinishedEvent(threadId: "t", runId: "r", outcome: .cancelled) + + // Then + XCTAssertNotEqual(event1, event2) + } } From b88048332df18ed8a09d64362f5cc8408e9da3d9 Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 16:28:59 -0400 Subject: [PATCH 09/19] test: add ToolExecutionManager test suite (22 tests) Covers event passthrough, tool execution lifecycle, arg-delta concatenation, response handler routing, failure path, execution events stream ordering, cancellation, and error propagation. --- .../Core/ToolExecutionManagerTests.swift | 622 ++++++++++++++++++ 1 file changed, 622 insertions(+) create mode 100644 Tests/AGUIToolsTests/Core/ToolExecutionManagerTests.swift diff --git a/Tests/AGUIToolsTests/Core/ToolExecutionManagerTests.swift b/Tests/AGUIToolsTests/Core/ToolExecutionManagerTests.swift new file mode 100644 index 0000000..60784c9 --- /dev/null +++ b/Tests/AGUIToolsTests/Core/ToolExecutionManagerTests.swift @@ -0,0 +1,622 @@ +/* + * MIT License + * + * Copyright (c) 2025 Perfect Aduh + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import XCTest +import AGUICore +@testable import AGUITools + +// MARK: - Mock types + +/// Records execute calls and returns a configurable result or error. +private actor CapturingToolExecutor: ToolExecutor { + let tool: Tool + private(set) var executionCount = 0 + var resultToReturn: ToolExecutionResult? + var errorToThrow: Error? + + init(name: String) { + tool = Tool(name: name, description: "Test tool", parameters: Data("{}".utf8)) + } + + func execute(context: ToolExecutionContext) async throws -> ToolExecutionResult { + executionCount += 1 + if let error = errorToThrow { throw error } + return resultToReturn ?? .success() + } + + nonisolated func validate(toolCall: ToolCall) -> ToolValidationResult { .valid } + nonisolated func maximumExecutionTime() -> Duration? { nil } + + func setResult(_ result: ToolExecutionResult) { resultToReturn = result } + func setError(_ error: Error?) { errorToThrow = error } +} + +/// Captures every tool response message sent by the manager. +private actor CapturingResponseHandler: ToolResponseHandler { + private(set) var sentMessages: [ToolMessage] = [] + private(set) var sentThreadIds: [String?] = [] + private(set) var sentRunIds: [String?] = [] + + func sendToolResponse(_ message: ToolMessage, threadId: String?, runId: String?) async throws { + sentMessages.append(message) + sentThreadIds.append(threadId) + sentRunIds.append(runId) + } +} + +// MARK: - ToolExecutionManagerTests + +final class ToolExecutionManagerTests: XCTestCase { + + // MARK: - Helpers + + /// Builds a manager with 0 max-retry attempts so tests never wait on back-off delays. + private func makeManager( + registry: any ToolRegistry = DefaultToolRegistry(), + responseHandler: any ToolResponseHandler = NullToolResponseHandler() + ) -> ToolExecutionManager { + ToolExecutionManager( + toolRegistry: registry, + responseHandler: responseHandler, + errorHandler: ToolErrorHandler(config: ToolErrorConfig(maxRetryAttempts: 0)) + ) + } + + private func makeStream(_ events: [any AGUIEvent]) -> AsyncThrowingStream { + AsyncThrowingStream { continuation in + for event in events { continuation.yield(event) } + continuation.finish() + } + } + + /// Produces the canonical three-event sequence for a single tool call. + private func toolCallEvents(id: String, name: String, args: String = "{}") -> [any AGUIEvent] { + [ + ToolCallStartEvent(toolCallId: id, toolCallName: name), + ToolCallArgsEvent(toolCallId: id, delta: args), + ToolCallEndEvent(toolCallId: id), + ] + } + + @discardableResult + private func drain( + _ stream: AsyncThrowingStream + ) async throws -> [any AGUIEvent] { + var collected: [any AGUIEvent] = [] + for try await event in stream { collected.append(event) } + return collected + } + + // MARK: - Feature: Initialization + + func test_init_activeExecutionCount_isZero() async { + // Given / When + let manager = makeManager() + + // Then + let count = await manager.activeExecutionCount() + XCTAssertEqual(count, 0) + } + + func test_init_isExecuting_unknownId_returnsFalse() async { + // Given / When + let manager = makeManager() + + // Then + let result = await manager.isExecuting(toolCallId: "anything") + XCTAssertFalse(result) + } + + // MARK: - Feature: Event passthrough + + func test_processEventStream_nonToolCallEvents_areForwardedUnchanged() async throws { + // Given + let manager = makeManager() + let input: [any AGUIEvent] = [ + RunStartedEvent(threadId: "t1", runId: "r1"), + RunFinishedEvent(threadId: "t1", runId: "r1"), + ] + + // When + let events = try await drain( + await manager.processEventStream(makeStream(input), threadId: nil, runId: nil) + ) + + // Then + XCTAssertEqual(events.count, 2) + XCTAssertTrue(events[0] is RunStartedEvent) + XCTAssertTrue(events[1] is RunFinishedEvent) + } + + func test_processEventStream_toolCallEvents_areForwardedToConsumer() async throws { + // Given + let registry = DefaultToolRegistry() + let executor = CapturingToolExecutor(name: "echo") + try await registry.register(executor: executor) + let manager = makeManager(registry: registry) + + // When + let events = try await drain( + await manager.processEventStream( + makeStream(toolCallEvents(id: "c1", name: "echo")), + threadId: nil, runId: nil + ) + ) + + // Then: all 3 events forwarded in order + XCTAssertEqual(events.count, 3) + XCTAssertTrue(events[0] is ToolCallStartEvent) + XCTAssertTrue(events[1] is ToolCallArgsEvent) + XCTAssertTrue(events[2] is ToolCallEndEvent) + } + + func test_processEventStream_mixedEvents_allForwardedInOrder() async throws { + // Given + let registry = DefaultToolRegistry() + let executor = CapturingToolExecutor(name: "tool") + try await registry.register(executor: executor) + let manager = makeManager(registry: registry) + + let input: [any AGUIEvent] = [RunStartedEvent(threadId: "t", runId: "r")] + + toolCallEvents(id: "c1", name: "tool") + + [RunFinishedEvent(threadId: "t", runId: "r")] + + // When + let events = try await drain( + await manager.processEventStream(makeStream(input), threadId: nil, runId: nil) + ) + + // Then + XCTAssertEqual(events.count, 5) + XCTAssertTrue(events[0] is RunStartedEvent) + XCTAssertTrue(events[4] is RunFinishedEvent) + } + + func test_processEventStream_emptyStream_completesNormally() async throws { + // Given + let manager = makeManager() + + // When / Then: no throw, empty result + let events = try await drain( + await manager.processEventStream(makeStream([]), threadId: nil, runId: nil) + ) + XCTAssertTrue(events.isEmpty) + } + + // MARK: - Feature: Tool execution + + func test_processEventStream_toolCall_executesRegisteredToolOnce() async throws { + // Given + let registry = DefaultToolRegistry() + let executor = CapturingToolExecutor(name: "calc") + try await registry.register(executor: executor) + let manager = makeManager(registry: registry) + + // When + try await drain( + await manager.processEventStream( + makeStream(toolCallEvents(id: "c1", name: "calc")), + threadId: nil, runId: nil + ) + ) + + // Then + let count = await executor.executionCount + XCTAssertEqual(count, 1) + } + + func test_processEventStream_multipleToolCalls_eachToolExecutedOnce() async throws { + // Given + let registry = DefaultToolRegistry() + let execA = CapturingToolExecutor(name: "tool_a") + let execB = CapturingToolExecutor(name: "tool_b") + try await registry.register(executor: execA) + try await registry.register(executor: execB) + let manager = makeManager(registry: registry) + + let events: [any AGUIEvent] = toolCallEvents(id: "c1", name: "tool_a") + + toolCallEvents(id: "c2", name: "tool_b") + + // When + try await drain( + await manager.processEventStream(makeStream(events), threadId: nil, runId: nil) + ) + + // Then: each executor called exactly once + let countA = await execA.executionCount + let countB = await execB.executionCount + XCTAssertEqual(countA, 1) + XCTAssertEqual(countB, 1) + } + + func test_processEventStream_argDeltas_areConcatenatedBeforeExecution() async throws { + // Given: executor that captures the raw arguments string + actor ArgCapturingExecutor: ToolExecutor { + let tool = Tool(name: "args_tool", description: "", parameters: Data("{}".utf8)) + private(set) var capturedArguments = "" + + func execute(context: ToolExecutionContext) async throws -> ToolExecutionResult { + capturedArguments = context.toolCall.function.arguments + return .success() + } + + nonisolated func validate(toolCall: ToolCall) -> ToolValidationResult { .valid } + nonisolated func maximumExecutionTime() -> Duration? { nil } + } + + let registry = DefaultToolRegistry() + let executor = ArgCapturingExecutor() + try await registry.register(executor: executor) + let manager = makeManager(registry: registry) + + let events: [any AGUIEvent] = [ + ToolCallStartEvent(toolCallId: "c1", toolCallName: "args_tool"), + ToolCallArgsEvent(toolCallId: "c1", delta: "{\"key\":"), + ToolCallArgsEvent(toolCallId: "c1", delta: "\"value\"}"), + ToolCallEndEvent(toolCallId: "c1"), + ] + + // When + try await drain( + await manager.processEventStream(makeStream(events), threadId: nil, runId: nil) + ) + + // Then: two deltas are concatenated into the full argument string + let args = await executor.capturedArguments + XCTAssertEqual(args, "{\"key\":\"value\"}") + } + + // MARK: - Feature: Response handler + + func test_processEventStream_successResult_withJsonData_sendsDataAsContent() async throws { + // Given + let registry = DefaultToolRegistry() + let executor = CapturingToolExecutor(name: "weather") + await executor.setResult(.success(result: Data("{\"temp\":72}".utf8))) + try await registry.register(executor: executor) + let handler = CapturingResponseHandler() + let manager = makeManager(registry: registry, responseHandler: handler) + + // When + try await drain( + await manager.processEventStream( + makeStream(toolCallEvents(id: "c1", name: "weather")), + threadId: nil, runId: nil + ) + ) + + // Then: JSON bytes are decoded to a string and sent as the message content + let messages = await handler.sentMessages + XCTAssertEqual(messages.count, 1) + XCTAssertEqual(messages[0].toolCallId, "c1") + XCTAssertEqual(messages[0].content, "{\"temp\":72}") + } + + func test_processEventStream_successResult_withMessageOnly_usesMessage() async throws { + // Given: result has a message but no raw data + let registry = DefaultToolRegistry() + let executor = CapturingToolExecutor(name: "tool") + await executor.setResult(.success(message: "done")) + try await registry.register(executor: executor) + let handler = CapturingResponseHandler() + let manager = makeManager(registry: registry, responseHandler: handler) + + // When + try await drain( + await manager.processEventStream( + makeStream(toolCallEvents(id: "c1", name: "tool")), + threadId: nil, runId: nil + ) + ) + + // Then + let content = await handler.sentMessages.first?.content + XCTAssertEqual(content, "done") + } + + func test_processEventStream_successResult_withNeitherDataNorMessage_sendsTrueFallback() async throws { + // Given: result has neither data nor message + let registry = DefaultToolRegistry() + let executor = CapturingToolExecutor(name: "tool") + await executor.setResult(.success()) + try await registry.register(executor: executor) + let handler = CapturingResponseHandler() + let manager = makeManager(registry: registry, responseHandler: handler) + + // When + try await drain( + await manager.processEventStream( + makeStream(toolCallEvents(id: "c1", name: "tool")), + threadId: nil, runId: nil + ) + ) + + // Then: falls back to "true" (success flag as string) + let content = await handler.sentMessages.first?.content + XCTAssertEqual(content, "true") + } + + func test_processEventStream_passesThreadIdAndRunIdToResponseHandler() async throws { + // Given + let registry = DefaultToolRegistry() + let executor = CapturingToolExecutor(name: "tool") + try await registry.register(executor: executor) + let handler = CapturingResponseHandler() + let manager = makeManager(registry: registry, responseHandler: handler) + + // When + try await drain( + await manager.processEventStream( + makeStream(toolCallEvents(id: "c1", name: "tool")), + threadId: "my-thread", runId: "my-run" + ) + ) + + // Then + let threadIds = await handler.sentThreadIds + let runIds = await handler.sentRunIds + XCTAssertEqual(threadIds.first, Optional("my-thread")) + XCTAssertEqual(runIds.first, Optional("my-run")) + } + + func test_processEventStream_multipleToolCalls_responsesRoutedByToolCallId() async throws { + // Given + let registry = DefaultToolRegistry() + let execA = CapturingToolExecutor(name: "tool_a") + await execA.setResult(.success(message: "result-a")) + let execB = CapturingToolExecutor(name: "tool_b") + await execB.setResult(.success(message: "result-b")) + try await registry.register(executor: execA) + try await registry.register(executor: execB) + let handler = CapturingResponseHandler() + let manager = makeManager(registry: registry, responseHandler: handler) + + let events: [any AGUIEvent] = toolCallEvents(id: "c1", name: "tool_a") + + toolCallEvents(id: "c2", name: "tool_b") + + // When + try await drain( + await manager.processEventStream(makeStream(events), threadId: nil, runId: nil) + ) + + // Then: one response per tool call, each linked by toolCallId + let messages = await handler.sentMessages + XCTAssertEqual(messages.count, 2) + let ids = Set(messages.map(\.toolCallId)) + XCTAssertTrue(ids.contains("c1")) + XCTAssertTrue(ids.contains("c2")) + } + + // MARK: - Feature: Failure path + + func test_processEventStream_toolNotFound_sendsErrorResponse() async throws { + // Given: no tools registered + let registry = DefaultToolRegistry() + let handler = CapturingResponseHandler() + let manager = makeManager(registry: registry, responseHandler: handler) + + // When + try await drain( + await manager.processEventStream( + makeStream(toolCallEvents(id: "c1", name: "missing")), + threadId: nil, runId: nil + ) + ) + + // Then: one error response sent for the missing tool + let messages = await handler.sentMessages + XCTAssertEqual(messages.count, 1) + XCTAssertEqual(messages[0].toolCallId, "c1") + XCTAssertTrue( + messages[0].content?.hasPrefix("Error:") == true, + "Expected error message, got: \(messages[0].content ?? "nil")" + ) + } + + func test_processEventStream_toolNotFound_streamCompletesNormally() async throws { + // Given: no tools registered + let registry = DefaultToolRegistry() + let manager = makeManager(registry: registry) + + // When / Then: missing tool is an execution error, not a stream error + let events = try await drain( + await manager.processEventStream( + makeStream(toolCallEvents(id: "c1", name: "missing")), + threadId: nil, runId: nil + ) + ) + XCTAssertEqual(events.count, 3) // all upstream events still forwarded + } + + func test_processEventStream_nonRetryableExecutionError_sendsErrorResponse() async throws { + // Given: executor throws a validation error (not retryable) + let registry = DefaultToolRegistry() + let executor = CapturingToolExecutor(name: "broken") + await executor.setError(ToolExecutionError.validationFailed(message: "bad args")) + try await registry.register(executor: executor) + let handler = CapturingResponseHandler() + let manager = makeManager(registry: registry, responseHandler: handler) + + // When + try await drain( + await manager.processEventStream( + makeStream(toolCallEvents(id: "c1", name: "broken")), + threadId: nil, runId: nil + ) + ) + + // Then + let messages = await handler.sentMessages + XCTAssertEqual(messages.count, 1) + XCTAssertTrue( + messages[0].content?.hasPrefix("Error:") == true, + "Expected error message, got: \(messages[0].content ?? "nil")" + ) + } + + // MARK: - Feature: Execution events stream + + /// A single successful tool call should emit .started → .executing → .succeeded in order. + func test_executionEvents_successfulTool_emitsStartedExecutingSucceeded() async throws { + // Given + let registry = DefaultToolRegistry() + let executor = CapturingToolExecutor(name: "tool") + try await registry.register(executor: executor) + let manager = makeManager(registry: registry) + + // Collect exactly 3 execution events in a background task + let execEventsStream = await manager.executionEvents + let eventsTask = Task<[ToolExecutionEvent], Never> { + var collected: [ToolExecutionEvent] = [] + for await event in execEventsStream { + collected.append(event) + if collected.count == 3 { break } + } + return collected + } + + // When: drain the process stream (awaits all executions internally) + try await drain( + await manager.processEventStream( + makeStream(toolCallEvents(id: "c1", name: "tool")), + threadId: nil, runId: nil + ) + ) + + // Then: background task collects all 3 events from the buffered stream + let received = await eventsTask.value + XCTAssertEqual(received.count, 3) + + if case .started(let id, _) = received[0] { + XCTAssertEqual(id, "c1") + } else { + XCTFail("Expected .started at index 0, got \(received[0])") + } + + if case .executing(let id, _) = received[1] { + XCTAssertEqual(id, "c1") + } else { + XCTFail("Expected .executing at index 1, got \(received[1])") + } + + if case .succeeded(let id, _, _) = received[2] { + XCTAssertEqual(id, "c1") + } else { + XCTFail("Expected .succeeded at index 2, got \(received[2])") + } + } + + /// A failed tool call (tool not found = immediate fail) emits .started → .executing → .failed. + func test_executionEvents_failedTool_emitsStartedExecutingFailed() async throws { + // Given: no tools registered → ToolRegistryError.toolNotFound → immediate fail (not retryable) + let registry = DefaultToolRegistry() + let manager = makeManager(registry: registry) + + let execEventsStream = await manager.executionEvents + let eventsTask = Task<[ToolExecutionEvent], Never> { + var collected: [ToolExecutionEvent] = [] + for await event in execEventsStream { + collected.append(event) + if collected.count == 3 { break } + } + return collected + } + + // When + try await drain( + await manager.processEventStream( + makeStream(toolCallEvents(id: "c1", name: "missing")), + threadId: nil, runId: nil + ) + ) + + // Then + let received = await eventsTask.value + XCTAssertEqual(received.count, 3) + + if case .started = received[0] {} else { + XCTFail("Expected .started at index 0, got \(received[0])") + } + if case .executing = received[1] {} else { + XCTFail("Expected .executing at index 1, got \(received[1])") + } + if case .failed(let id, _, _) = received[2] { + XCTAssertEqual(id, "c1") + } else { + XCTFail("Expected .failed at index 2, got \(received[2])") + } + } + + // MARK: - Feature: cancelAllExecutions + + func test_cancelAllExecutions_onEmptyState_doesNotCrash() async { + // Given + let manager = makeManager() + + // When / Then: no crash, count remains zero + await manager.cancelAllExecutions() + let count = await manager.activeExecutionCount() + XCTAssertEqual(count, 0) + } + + // MARK: - Feature: Error propagation from upstream + + func test_processEventStream_upstreamThrows_propagatesError() async { + // Given + let manager = makeManager() + + struct UpstreamError: Error {} + + let throwingStream = AsyncThrowingStream { continuation in + continuation.finish(throwing: UpstreamError()) + } + + // When / Then + do { + try await drain(await manager.processEventStream(throwingStream, threadId: nil, runId: nil)) + XCTFail("Expected error to be thrown") + } catch { + XCTAssertTrue(error is UpstreamError, "Expected UpstreamError, got \(type(of: error))") + } + } + + // MARK: - Feature: Edge cases + + /// A ToolCallEndEvent with no matching buffer entry should be silently ignored + /// but the event itself still passes through to consumers. + func test_processEventStream_toolCallEndWithoutMatchingStart_isDroppedGracefully() async throws { + // Given: orphan ToolCallEnd with no prior ToolCallStart + let manager = makeManager() + let events: [any AGUIEvent] = [ToolCallEndEvent(toolCallId: "orphan")] + + // When + let result = try await drain( + await manager.processEventStream(makeStream(events), threadId: nil, runId: nil) + ) + + // Then: event forwarded, no execution launched, no crash + XCTAssertEqual(result.count, 1) + XCTAssertTrue(result[0] is ToolCallEndEvent) + } +} From 41659ba15de9bd626fe58a326a4b9eab47eb9ba0 Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 16:42:20 -0400 Subject: [PATCH 10/19] test: expand MessageEncoder coverage to all 7 roles (32 tests) Previous suite covered only .reasoning (4 tests). Added tests for .developer, .system, .user, .assistant, .tool, .activity, and .reasoning, verifying mandatory fields, optional field omission, multimodal content array encoding, toolCalls array shape, activity content inlining, and invalidMessageType error path. --- .../Encoding/MessageEncoderTests.swift | 415 +++++++++++++++++- 1 file changed, 399 insertions(+), 16 deletions(-) diff --git a/Tests/AGUICoreTests/Encoding/MessageEncoderTests.swift b/Tests/AGUICoreTests/Encoding/MessageEncoderTests.swift index 867fb2b..541824d 100644 --- a/Tests/AGUICoreTests/Encoding/MessageEncoderTests.swift +++ b/Tests/AGUICoreTests/Encoding/MessageEncoderTests.swift @@ -29,61 +29,427 @@ final class MessageEncoderTests: XCTestCase { private let encoder = MessageEncoder() - // MARK: - ReasoningMessage encoding + // MARK: - Helper - func test_encodeReasoningMessage_producesCorrectJSON() throws { - let message = ReasoningMessage( - id: "reasoning-1", - content: "Let me think step by step." + private func json(from message: any Message) throws -> [String: Any] { + let data = try encoder.encode(message) + return try XCTUnwrap(JSONSerialization.jsonObject(with: data) as? [String: Any]) + } + + // MARK: - Feature: DeveloperMessage encoding + + func test_encodeDeveloperMessage_producesCorrectJSON() throws { + // Given + let message = DeveloperMessage(id: "dev-1", content: "Enable debug logging.") + + // When + let json = try json(from: message) + + // Then + XCTAssertEqual(json["id"] as? String, "dev-1") + XCTAssertEqual(json["role"] as? String, "developer") + XCTAssertEqual(json["content"] as? String, "Enable debug logging.") + } + + func test_encodeDeveloperMessage_withName_includesName() throws { + // Given + let message = DeveloperMessage(id: "dev-2", content: "Config.", name: "SystemConfigurator") + + // When + let json = try json(from: message) + + // Then + XCTAssertEqual(json["name"] as? String, "SystemConfigurator") + } + + func test_encodeDeveloperMessage_withoutName_omitsName() throws { + // Given + let message = DeveloperMessage(id: "dev-3", content: "Config.") + + // When + let json = try json(from: message) + + // Then + XCTAssertNil(json["name"]) + } + + // MARK: - Feature: SystemMessage encoding + + func test_encodeSystemMessage_producesCorrectJSON() throws { + // Given + let message = SystemMessage(id: "sys-1", content: "You are a helpful assistant.") + + // When + let json = try json(from: message) + + // Then + XCTAssertEqual(json["id"] as? String, "sys-1") + XCTAssertEqual(json["role"] as? String, "system") + XCTAssertEqual(json["content"] as? String, "You are a helpful assistant.") + } + + func test_encodeSystemMessage_nilContent_omittedFromJSON() throws { + // Given + let message = SystemMessage(id: "sys-2", content: nil) + + // When + let json = try json(from: message) + + // Then: optional content must not appear in JSON when nil + XCTAssertNil(json["content"]) + } + + func test_encodeSystemMessage_withName_includesName() throws { + // Given + let message = SystemMessage(id: "sys-3", content: "Act professionally.", name: "ProfMode") + + // When + let json = try json(from: message) + + // Then + XCTAssertEqual(json["name"] as? String, "ProfMode") + } + + func test_encodeSystemMessage_withoutName_omitsName() throws { + // Given + let message = SystemMessage(id: "sys-4", content: "Act professionally.") + + // When + let json = try json(from: message) + + // Then + XCTAssertNil(json["name"]) + } + + // MARK: - Feature: UserMessage encoding + + func test_encodeUserMessage_textOnly_producesCorrectJSON() throws { + // Given + let message = UserMessage(id: "user-1", content: "Hello!") + + // When + let json = try json(from: message) + + // Then + XCTAssertEqual(json["id"] as? String, "user-1") + XCTAssertEqual(json["role"] as? String, "user") + XCTAssertEqual(json["content"] as? String, "Hello!") + } + + func test_encodeUserMessage_withName_includesName() throws { + // Given + let message = UserMessage(id: "user-2", content: "Hi", name: "Alice") + + // When + let json = try json(from: message) + + // Then + XCTAssertEqual(json["name"] as? String, "Alice") + } + + func test_encodeUserMessage_withoutName_omitsName() throws { + // Given + let message = UserMessage(id: "user-3", content: "Hi") + + // When + let json = try json(from: message) + + // Then + XCTAssertNil(json["name"]) + } + + func test_encodeUserMessage_multimodal_contentIsArray() throws { + // Given: multimodal message with a single text part + let message = UserMessage.multimodal( + id: "user-4", + parts: [TextInputContent(text: "What's in this image?")] ) - let data = try encoder.encode(message) - let json = try XCTUnwrap(JSONSerialization.jsonObject(with: data) as? [String: Any]) + // When + let json = try json(from: message) + + // Then: content must be a JSON array, not a string + let contentArray = try XCTUnwrap(json["content"] as? [[String: Any]]) + XCTAssertEqual(contentArray.count, 1) + XCTAssertEqual(contentArray[0]["type"] as? String, "text") + XCTAssertEqual(contentArray[0]["text"] as? String, "What's in this image?") + } + + // MARK: - Feature: AssistantMessage encoding + + func test_encodeAssistantMessage_producesCorrectJSON() throws { + // Given + let message = AssistantMessage(id: "asst-1", content: "I can help with that.") + + // When + let json = try json(from: message) + + // Then + XCTAssertEqual(json["id"] as? String, "asst-1") + XCTAssertEqual(json["role"] as? String, "assistant") + XCTAssertEqual(json["content"] as? String, "I can help with that.") + } + + func test_encodeAssistantMessage_nilContent_omittedFromJSON() throws { + // Given + let message = AssistantMessage(id: "asst-2", content: nil) + + // When + let json = try json(from: message) + + // Then + XCTAssertNil(json["content"]) + } + + func test_encodeAssistantMessage_nilToolCalls_omittedFromJSON() throws { + // Given + let message = AssistantMessage(id: "asst-3", content: "Text only") + + // When + let json = try json(from: message) + + // Then + XCTAssertNil(json["toolCalls"]) + } + + func test_encodeAssistantMessage_withToolCalls_encodesToolCallsArray() throws { + // Given + let toolCall = ToolCall( + id: "call-1", + function: FunctionCall(name: "get_weather", arguments: "{\"city\":\"NYC\"}") + ) + let message = AssistantMessage(id: "asst-4", toolCalls: [toolCall]) + + // When + let json = try json(from: message) + // Then: tool calls encoded as array with id and function fields + let toolCallsArray = try XCTUnwrap(json["toolCalls"] as? [[String: Any]]) + XCTAssertEqual(toolCallsArray.count, 1) + XCTAssertEqual(toolCallsArray[0]["id"] as? String, "call-1") + let function = try XCTUnwrap(toolCallsArray[0]["function"] as? [String: Any]) + XCTAssertEqual(function["name"] as? String, "get_weather") + XCTAssertEqual(function["arguments"] as? String, "{\"city\":\"NYC\"}") + } + + func test_encodeAssistantMessage_withName_includesName() throws { + // Given + let message = AssistantMessage(id: "asst-5", content: "Hi", name: "Claude") + + // When + let json = try json(from: message) + + // Then + XCTAssertEqual(json["name"] as? String, "Claude") + } + + func test_encodeAssistantMessage_withoutName_omitsName() throws { + // Given + let message = AssistantMessage(id: "asst-6", content: "Hi") + + // When + let json = try json(from: message) + + // Then + XCTAssertNil(json["name"]) + } + + // MARK: - Feature: ToolMessage encoding + + func test_encodeToolMessage_producesCorrectJSON() throws { + // Given + let message = ToolMessage(id: "tool-1", content: "72°F, sunny", toolCallId: "call-1") + + // When + let json = try json(from: message) + + // Then + XCTAssertEqual(json["id"] as? String, "tool-1") + XCTAssertEqual(json["role"] as? String, "tool") + XCTAssertEqual(json["toolCallId"] as? String, "call-1") + XCTAssertEqual(json["content"] as? String, "72°F, sunny") + } + + func test_encodeToolMessage_withError_includesError() throws { + // Given + let message = ToolMessage( + id: "tool-2", + content: "Failed", + toolCallId: "call-2", + error: "Connection timeout" + ) + + // When + let json = try json(from: message) + + // Then + XCTAssertEqual(json["error"] as? String, "Connection timeout") + } + + func test_encodeToolMessage_withoutError_omitsError() throws { + // Given + let message = ToolMessage(id: "tool-3", content: "OK", toolCallId: "call-3") + + // When + let json = try json(from: message) + + // Then + XCTAssertNil(json["error"]) + } + + func test_encodeToolMessage_withName_includesName() throws { + // Given + let message = ToolMessage( + id: "tool-4", + content: "Result", + toolCallId: "call-4", + name: "weather_tool" + ) + + // When + let json = try json(from: message) + + // Then + XCTAssertEqual(json["name"] as? String, "weather_tool") + } + + func test_encodeToolMessage_withoutName_omitsName() throws { + // Given + let message = ToolMessage(id: "tool-5", content: "Result", toolCallId: "call-5") + + // When + let json = try json(from: message) + + // Then + XCTAssertNil(json["name"]) + } + + // MARK: - Feature: ActivityMessage encoding + + func test_encodeActivityMessage_producesCorrectJSON() throws { + // Given + let message = ActivityMessage( + id: "act-1", + activityType: "progress", + content: Data("{\"percent\":75}".utf8) + ) + + // When + let json = try json(from: message) + + // Then + XCTAssertEqual(json["id"] as? String, "act-1") + XCTAssertEqual(json["role"] as? String, "activity") + XCTAssertEqual(json["activityType"] as? String, "progress") + } + + func test_encodeActivityMessage_contentEmbeddedAsJsonObject() throws { + // Given: content must be inlined as a JSON object, not base64-encoded + let message = ActivityMessage( + id: "act-2", + activityType: "progress", + content: Data("{\"percent\":75,\"message\":\"Uploading\"}".utf8) + ) + + // When + let json = try json(from: message) + + // Then: content key holds a dictionary, not a Data blob + let content = try XCTUnwrap(json["content"] as? [String: Any]) + XCTAssertEqual(content["percent"] as? Int, 75) + XCTAssertEqual(content["message"] as? String, "Uploading") + } + + func test_encodeActivityMessage_nameAlwaysOmitted() throws { + // Given: ActivityMessage.name is always nil per protocol + let message = ActivityMessage( + id: "act-3", + activityType: "status", + content: Data("{}".utf8) + ) + + // When + let json = try json(from: message) + + // Then + XCTAssertNil(json["name"]) + } + + func test_encodeActivityMessage_encryptedValueAlwaysOmitted() throws { + // Given: ActivityMessage.encryptedValue is always nil per protocol + let message = ActivityMessage( + id: "act-4", + activityType: "status", + content: Data("{}".utf8) + ) + + // When + let json = try json(from: message) + + // Then + XCTAssertNil(json["encryptedValue"]) + } + + // MARK: - Feature: ReasoningMessage encoding + + func test_encodeReasoningMessage_producesCorrectJSON() throws { + // Given + let message = ReasoningMessage(id: "reasoning-1", content: "Let me think step by step.") + + // When + let json = try json(from: message) + + // Then XCTAssertEqual(json["id"] as? String, "reasoning-1") XCTAssertEqual(json["role"] as? String, "reasoning") XCTAssertEqual(json["content"] as? String, "Let me think step by step.") } func test_encodeReasoningMessage_withEncryptedValue() throws { + // Given let message = ReasoningMessage( id: "reasoning-2", content: "Analysing inputs...", encryptedValue: "enc-token-abc" ) - let data = try encoder.encode(message) - let json = try XCTUnwrap(JSONSerialization.jsonObject(with: data) as? [String: Any]) + // When + let json = try json(from: message) + // Then XCTAssertEqual(json["encryptedValue"] as? String, "enc-token-abc") } func test_encodeReasoningMessage_nameAlwaysOmitted() throws { - // ReasoningMessage.name is always nil per protocol spec — must not appear in JSON + // Given: ReasoningMessage.name is always nil per protocol spec let message = ReasoningMessage(id: "reasoning-3", content: "Reasoning...") - let data = try encoder.encode(message) - let json = try XCTUnwrap(JSONSerialization.jsonObject(with: data) as? [String: Any]) + // When + let json = try json(from: message) + // Then XCTAssertNil(json["name"]) } func test_encodeReasoningMessage_nilEncryptedValue_omittedFromJSON() throws { + // Given let message = ReasoningMessage(id: "reasoning-4", content: "Thinking...") - let data = try encoder.encode(message) - let json = try XCTUnwrap(JSONSerialization.jsonObject(with: data) as? [String: Any]) + // When + let json = try json(from: message) + // Then XCTAssertNil(json["encryptedValue"]) } - // MARK: - Unsupported role + // MARK: - Feature: Error handling func test_unsupportedRole_throws() { - // Build a registry with no handlers to guarantee an unsupported role error + // Given: registry with no handlers guarantees an unsupported role error let emptyEncoder = MessageEncoder(registry: [:]) let message = ReasoningMessage(id: "r-1", content: "test") + // When / Then XCTAssertThrowsError(try emptyEncoder.encode(message)) { error in guard case MessageEncodingError.unsupportedRole(let role) = error else { return XCTFail("Expected unsupportedRole, got \(error)") @@ -91,4 +457,21 @@ final class MessageEncoderTests: XCTestCase { XCTAssertEqual(role, .reasoning) } } + + func test_invalidMessageType_throws() { + // Given: route .user role through the .system handler → type mismatch at cast site + let registry: [Role: MessageEncoder.EncodeHandler] = [ + .user: MessageEncoder.defaultRegistry()[.system]! + ] + let mismatchedEncoder = MessageEncoder(registry: registry) + let message = UserMessage(id: "u-1", content: "Hello") + + // When / Then + XCTAssertThrowsError(try mismatchedEncoder.encode(message)) { error in + guard case MessageEncodingError.invalidMessageType(let role, _) = error else { + return XCTFail("Expected invalidMessageType, got \(error)") + } + XCTAssertEqual(role, .system) + } + } } From 61e2f221b70293b109a9e14db502399dde08bbb3 Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 16:49:30 -0400 Subject: [PATCH 11/19] refactor: eliminate unstructured Task leaks Replace fire-and-forget Task wrappers with async signatures. AbstractAgent: use task.result pattern for cleanup; make abortRun and dispose async. HttpAgent/AgUiAgent: propagate async signatures. --- Sources/AGUIAgentSDK/AgUiAgent.swift | 10 ++++------ Sources/AGUIClient/AbstractAgent.swift | 15 +++++++-------- Sources/AGUIClient/HttpAgent.swift | 8 ++++---- Tests/AGUIAgentSDKTests/AgUiAgentTests.swift | 10 +++++----- 4 files changed, 20 insertions(+), 23 deletions(-) diff --git a/Sources/AGUIAgentSDK/AgUiAgent.swift b/Sources/AGUIAgentSDK/AgUiAgent.swift index 2adee58..e322f44 100644 --- a/Sources/AGUIAgentSDK/AgUiAgent.swift +++ b/Sources/AGUIAgentSDK/AgUiAgent.swift @@ -160,12 +160,10 @@ public final class AgUiAgent: Sendable { // MARK: - Lifecycle - public func close() { - Task { - if let manager = self.toolExecutionManager { - await manager.cancelAllExecutions() - } + public func close() async { + if let manager = toolExecutionManager { + await manager.cancelAllExecutions() } - httpAgent.dispose() + await httpAgent.dispose() } } diff --git a/Sources/AGUIClient/AbstractAgent.swift b/Sources/AGUIClient/AbstractAgent.swift index 42e7f44..0891a38 100644 --- a/Sources/AGUIClient/AbstractAgent.swift +++ b/Sources/AGUIClient/AbstractAgent.swift @@ -119,9 +119,6 @@ public final class AbstractAgent: Sendable { if let st = initMutation.state { await storage.setState(st) } let task = Task { - defer { - Task { await self.storage.setCurrentTask(nil) } - } do { let eventStream = self.run(input: input) let processedStream = eventStream @@ -159,7 +156,9 @@ public final class AbstractAgent: Sendable { } await storage.setCurrentTask(task) - try await task.value + let result = await task.result + await storage.setCurrentTask(nil) + try result.get() } public func runAgentObservable( @@ -170,12 +169,12 @@ public final class AbstractAgent: Sendable { .verifyEvents(debug: debug) } - public func abortRun() { - Task { await storage.currentTask?.cancel() } + public func abortRun() async { + await storage.currentTask?.cancel() } - public func dispose() { - Task { await storage.setDisposed(true) } + public func dispose() async { + await storage.setDisposed(true) } public func subscribe(_ subscriber: any AgentSubscriber) async -> any AgentSubscription { diff --git a/Sources/AGUIClient/HttpAgent.swift b/Sources/AGUIClient/HttpAgent.swift index 8d69ccc..0813af6 100644 --- a/Sources/AGUIClient/HttpAgent.swift +++ b/Sources/AGUIClient/HttpAgent.swift @@ -107,12 +107,12 @@ public final class HttpAgent: Sendable { public var customEvents: [CustomEvent] { get async { await abstractAgent.customEvents } } public var thinking: ThinkingTelemetryState? { get async { await abstractAgent.thinking } } - public func abortRun() { - abstractAgent.abortRun() + public func abortRun() async { + await abstractAgent.abortRun() } - public func dispose() { - abstractAgent.dispose() + public func dispose() async { + await abstractAgent.dispose() } public func subscribe(_ subscriber: any AgentSubscriber) async -> any AgentSubscription { diff --git a/Tests/AGUIAgentSDKTests/AgUiAgentTests.swift b/Tests/AGUIAgentSDKTests/AgUiAgentTests.swift index e7cbd59..aad65e2 100644 --- a/Tests/AGUIAgentSDKTests/AgUiAgentTests.swift +++ b/Tests/AGUIAgentSDKTests/AgUiAgentTests.swift @@ -255,14 +255,14 @@ final class AgUiAgentTests: XCTestCase { // MARK: - close() - func testCloseDoesNotCrash() { + func testCloseDoesNotCrash() async { let agent = AgUiAgent(url: agentURL) - agent.close() + await agent.close() } - func testCloseCanBeCalledMultipleTimes() { + func testCloseCanBeCalledMultipleTimes() async { let agent = AgUiAgent(url: agentURL) - agent.close() - agent.close() + await agent.close() + await agent.close() } } From 8a963641513a5d62c600308d311c3b11909fc76b Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 16:53:24 -0400 Subject: [PATCH 12/19] ci: re-enable SwiftLint, add Linux build job Replace verbose opt-in ruleset with minimal only_rules config (force_cast, force_try, force_unwrapping, custom_rules, large_tuple) matching the League iOS SDK baseline. Add no_assume_isolated custom rule. Re-enable SwiftLint step in CI lint job. Add test-linux job using swift:latest container on ubuntu-latest. --- .github/workflows/ci.yml | 42 ++++++---- .swiftlint.yml | 166 ++++----------------------------------- 2 files changed, 43 insertions(+), 165 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc2a1a4..6d8e22a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,27 +40,41 @@ jobs: -destination 'platform=macOS' \ -quiet || true + # Build and test on Linux + test-linux: + name: Test Linux + runs-on: ubuntu-latest + container: + image: swift:latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Resolve Dependencies + run: swift package resolve + + - name: Build Package + run: swift build + + - name: Run Tests + run: swift test + # Lint and format check lint: name: Lint runs-on: macos-latest - + steps: - name: Checkout repository uses: actions/checkout@v4 - - # SwiftLint temporarily disabled - # - name: Install SwiftLint - # run: | - # brew install swiftlint - # - # - name: Run SwiftLint - # run: | - # swiftlint lint - - - name: Check Package Format - run: swift package resolve - + + - name: Install SwiftLint + run: brew install swiftlint + + - name: Run SwiftLint + run: swiftlint lint + - name: Verify Package Structure run: | swift package dump-package > /dev/null diff --git a/.swiftlint.yml b/.swiftlint.yml index a1e32d4..3e531f4 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,161 +1,25 @@ -# SwiftLint Configuration for AGUISwift -# https://github.com/realm/SwiftLint - -# Paths to include included: - Sources - - Tests + - Package.swift -# Paths to exclude excluded: - .build - - Package.swift - -# Enabled rules beyond defaults -opt_in_rules: - - array_init - - closure_end_indentation - - closure_spacing - - collection_alignment - - contains_over_filter_count - - contains_over_filter_is_empty - - contains_over_first_not_nil - - empty_collection_literal - - empty_count - - empty_string - - explicit_init - - extension_access_modifier - - fallthrough - - fatal_error_message - - file_header - - first_where - - flatmap_over_map_reduce - - identical_operands - - implicit_return - - joined_default_parameter - - last_where - - literal_expression_end_indentation - - lower_acl_than_parent - - modifier_order - - multiline_arguments - - multiline_parameters - - operator_usage_whitespace - - overridden_super_call - - prefer_self_in_static_references - - prefer_self_type_over_type_of_self - - redundant_nil_coalescing - - redundant_type_annotation - - sorted_first_last - - toggle_bool - - trailing_closure - - unneeded_parentheses_in_closure_argument - - vertical_parameter_alignment_on_call - - yoda_condition - -# Disabled rules -disabled_rules: - - trailing_comma # Project uses no trailing commas - - todo # Allow TODO comments during development - - opening_brace # SwiftFormat handles this - - extension_access_modifier # Existing code doesn't use this pattern - - prefer_self_in_static_references # Would require extensive refactoring - - trailing_closure # Conflicts with existing code style - - trailing_whitespace # SwiftFormat will handle this - temporarily disabled - - static_over_final_class # URLProtocol subclasses require class methods for overrides - -# Rule configurations -line_length: - warning: 120 - error: 150 - ignores_comments: true - ignores_urls: true - ignores_function_declarations: true - -file_length: - warning: 600 - error: 1000 - ignore_comment_only_lines: true - -type_body_length: - warning: 500 - error: 700 - -function_body_length: - warning: 80 - error: 150 - -function_parameter_count: - warning: 6 - error: 8 - -type_name: - min_length: 2 - max_length: 50 - validates_start_with_lowercase: false - -identifier_name: - min_length: - warning: 2 - error: 1 - max_length: - warning: 50 - error: 60 - excluded: - - id - - i - - j - - x - - y - - z - - v - - n - -nesting: - type_level: 2 - function_level: 3 - -cyclomatic_complexity: - warning: 20 - error: 30 - -large_tuple: - warning: 3 - error: 4 - -# Force cast and force try (warnings only, not errors) -# Disable in tests since we're testing known types -force_cast: - severity: warning -force_try: warning - -# File header format (MIT License) -file_header: - required_pattern: | - \/\*\s*\n \* MIT License\s*\n \*\s*\n \* Copyright \(c\) 2025 Perfect Aduh + - Tests -# Modifier order (Swift 6 conventions - matches SwiftFormat) -# Valid groups: override, isolation, acl, setterACL, dynamic, mutators, lazy, final, required, convenience, typeMethods, owned -modifier_order: - preferred_modifier_order: - - override - - isolation - - acl - - setterACL - - dynamic - - mutators - - lazy - - final - - required - - convenience - - typeMethods - - owned +only_rules: + - force_cast + - force_try + - force_unwrapping + - custom_rules + - large_tuple -# Custom rules custom_rules: - no_print_in_production: - name: "No print statements" - regex: '^\s*print\s*\(' - message: "Avoid print() in production code. Use proper logging instead." - severity: warning + no_assume_isolated: + name: "No assumeIsolated" + regex: "\\b(?:MainActor|[A-Za-z_][A-Za-z0-9_]*)\\.assumeIsolated\\s*(?:\\(|\\{)" match_kinds: - identifier + message: "Do not use assumeIsolated. Use explicit actor isolation or restructure the code to stay within structured concurrency." + severity: error + +large_tuple: 3 From 453321febb41707a29c1ac97c5dc6cdea5ae77e1 Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 17:05:10 -0400 Subject: [PATCH 13/19] test: add StatefulAgUiAgent test suite (25 tests) Add internal transport-injecting init to StatefulAgUiAgent to enable unit testing without HTTP. Refactor sendMessage to branch between the injected transport path (tests) and the httpAgent SSE path (production). Tests cover: RunAgentInput construction, system prompt lifecycle, multi-round history accumulation, per-thread isolation, history trimming, clearHistory, event passthrough, text message assembly, tool call flushing/deduplication, and StateSnapshot/StateDelta tracking. --- Sources/AGUIAgentSDK/StatefulAgUiAgent.swift | 67 ++- .../StatefulAgUiAgentTests.swift | 549 ++++++++++++++++++ 2 files changed, 599 insertions(+), 17 deletions(-) create mode 100644 Tests/AGUIAgentSDKTests/StatefulAgUiAgentTests.swift diff --git a/Sources/AGUIAgentSDK/StatefulAgUiAgent.swift b/Sources/AGUIAgentSDK/StatefulAgUiAgent.swift index 92fef1a..620a83f 100644 --- a/Sources/AGUIAgentSDK/StatefulAgUiAgent.swift +++ b/Sources/AGUIAgentSDK/StatefulAgUiAgent.swift @@ -86,6 +86,9 @@ public final class StatefulAgUiAgent: Sendable { /// The underlying HTTP agent for communication. private let httpAgent: HttpAgent + /// Injected transport used in place of `httpAgent` when present (test path). + private let agentTransport: (any AgentTransport)? + /// Manager for conversation histories across threads. private let historyManager: ConversationHistoryManager @@ -117,6 +120,7 @@ public final class StatefulAgUiAgent: Sendable { debug: config.debug )) self.httpAgent = agent + self.agentTransport = nil self.historyManager = ConversationHistoryManager() self.stateManager = StateManager(initialState: config.initialState) if let registry = config.toolRegistry { @@ -151,6 +155,7 @@ public final class StatefulAgUiAgent: Sendable { debug: configuration.debug )) self.httpAgent = agent + self.agentTransport = nil self.historyManager = ConversationHistoryManager() self.stateManager = StateManager(initialState: configuration.initialState) if let registry = configuration.toolRegistry { @@ -163,6 +168,20 @@ public final class StatefulAgUiAgent: Sendable { } } + /// Creates a stateful agent backed by a custom transport (test path). + /// + /// Use this initializer in tests to inject a mock transport instead of + /// making real HTTP connections. + init(transport: any AgentTransport, config: StatefulAgUiAgentConfig) { + self.config = config + let url = URL(string: "https://placeholder.local")! + self.httpAgent = HttpAgent(baseURL: url) + self.agentTransport = transport + self.historyManager = ConversationHistoryManager() + self.stateManager = StateManager(initialState: config.initialState) + self.toolExecutionManager = nil + } + /// Sends a chat message with automatic history management. /// /// This is a convenience method that delegates to ``sendMessage(message:threadId:state:includeSystemPrompt:)`` @@ -295,26 +314,40 @@ public final class StatefulAgUiAgent: Sendable { ) } - // Execute the run - let rawStream = try await httpAgent.run(inputWithTools, endpoint: config.endpoint) - - // Wrap through tool execution manager if present, otherwise pass through + // Execute the run and obtain an event stream let eventStream: AsyncThrowingStream - if let manager = toolExecutionManager { - eventStream = await manager.processEventStream( - rawStream, - threadId: inputWithTools.threadId, - runId: inputWithTools.runId - ) + + if let transport = agentTransport { + // Test path: transport yields events directly + let rawStream = transport.run(input: inputWithTools) + if let manager = toolExecutionManager { + eventStream = await manager.processEventStream( + rawStream, + threadId: inputWithTools.threadId, + runId: inputWithTools.runId + ) + } else { + eventStream = rawStream + } } else { - eventStream = AsyncThrowingStream { continuation in - let task = Task { - do { - for try await event in rawStream { continuation.yield(event) } - continuation.finish() - } catch { continuation.finish(throwing: error) } + // Production path: httpAgent performs SSE over HTTP + let rawStream = try await httpAgent.run(inputWithTools, endpoint: config.endpoint) + if let manager = toolExecutionManager { + eventStream = await manager.processEventStream( + rawStream, + threadId: inputWithTools.threadId, + runId: inputWithTools.runId + ) + } else { + eventStream = AsyncThrowingStream { continuation in + let task = Task { + do { + for try await event in rawStream { continuation.yield(event) } + continuation.finish() + } catch { continuation.finish(throwing: error) } + } + continuation.onTermination = { _ in task.cancel() } } - continuation.onTermination = { _ in task.cancel() } } } diff --git a/Tests/AGUIAgentSDKTests/StatefulAgUiAgentTests.swift b/Tests/AGUIAgentSDKTests/StatefulAgUiAgentTests.swift new file mode 100644 index 0000000..7491f93 --- /dev/null +++ b/Tests/AGUIAgentSDKTests/StatefulAgUiAgentTests.swift @@ -0,0 +1,549 @@ +/* + * MIT License + * + * Copyright (c) 2025 Perfect Aduh + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import AGUIClient +import AGUICore +import XCTest +@testable import AGUIAgentSDK + +// MARK: - StatefulAgUiAgentTests + +final class StatefulAgUiAgentTests: XCTestCase { + + // MARK: - Helpers + + private func makeAgent( + configure: (inout StatefulAgUiAgentConfig) -> Void = { _ in } + ) -> (StatefulAgUiAgent, CapturingTransport) { + let url = URL(string: "https://placeholder.local")! + var cfg = StatefulAgUiAgentConfig(baseURL: url) + configure(&cfg) + let transport = CapturingTransport() + let agent = StatefulAgUiAgent(transport: transport, config: cfg) + return (agent, transport) + } + + private func drain( + _ stream: AsyncThrowingStream + ) async throws -> [any AGUIEvent] { + var received: [any AGUIEvent] = [] + for try await event in stream { received.append(event) } + return received + } + + // MARK: - RunAgentInput construction + + func testUserMessageIncludedInInput() async throws { + let (agent, transport) = makeAgent() + _ = try await drain(agent.sendMessage( + message: "Hello", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + let inputs = await transport.capturedInputs + let input = try XCTUnwrap(inputs.first) + let userMessages = input.messages.filter { $0.role == .user } + XCTAssertEqual(userMessages.count, 1) + XCTAssertEqual((userMessages[0] as? UserMessage)?.content, "Hello") + } + + func testSystemPromptAddedOnFirstMessageWhenEnabled() async throws { + let (agent, transport) = makeAgent { cfg in + cfg.systemPrompt = "Be helpful." + } + _ = try await drain(agent.sendMessage( + message: "Hi", + threadId: "t1", + state: nil, + includeSystemPrompt: true + )) + + let inputs = await transport.capturedInputs + let input = try XCTUnwrap(inputs.first) + XCTAssertEqual(input.messages.count, 2) + XCTAssertEqual(input.messages[0].role, .system) + XCTAssertEqual((input.messages[0] as? SystemMessage)?.content, "Be helpful.") + XCTAssertEqual(input.messages[1].role, .user) + } + + func testSystemPromptOmittedWhenFlagIsFalse() async throws { + let (agent, transport) = makeAgent { cfg in + cfg.systemPrompt = "Be helpful." + } + _ = try await drain(agent.sendMessage( + message: "Hi", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + let inputs = await transport.capturedInputs + let input = try XCTUnwrap(inputs.first) + XCTAssertEqual(input.messages.count, 1) + XCTAssertEqual(input.messages[0].role, .user) + } + + func testSystemPromptAddedOnlyOnFirstMessage() async throws { + let (agent, _) = makeAgent { cfg in + cfg.systemPrompt = "Be helpful." + } + + _ = try await drain(agent.sendMessage( + message: "First", + threadId: "t1", + state: nil, + includeSystemPrompt: true + )) + _ = try await drain(agent.sendMessage( + message: "Second", + threadId: "t1", + state: nil, + includeSystemPrompt: true + )) + + let history = await agent.history(for: "t1") + let systemMessages = history.filter { $0.role == .system } + XCTAssertEqual(systemMessages.count, 1, "System prompt must appear exactly once") + } + + func testThreadIdPassedToTransport() async throws { + let (agent, transport) = makeAgent() + _ = try await drain(agent.sendMessage( + message: "Hi", + threadId: "my-thread", + state: nil, + includeSystemPrompt: false + )) + + let inputs = await transport.capturedInputs + XCTAssertEqual(inputs.first?.threadId, "my-thread") + } + + func testCustomStatePassedToTransport() async throws { + let customState = Data("{\"mode\":\"creative\"}".utf8) + let (agent, transport) = makeAgent() + _ = try await drain(agent.sendMessage( + message: "Hi", + threadId: "t1", + state: customState, + includeSystemPrompt: false + )) + + let inputs = await transport.capturedInputs + XCTAssertEqual(inputs.first?.state, customState) + } + + // MARK: - chat() convenience + + func testChatDelegatesToSendMessageWithGivenThread() async throws { + let (agent, transport) = makeAgent() + _ = try await drain(agent.chat(message: "Hello!", threadId: "t1")) + + let inputs = await transport.capturedInputs + XCTAssertEqual(inputs.count, 1) + XCTAssertEqual(inputs[0].threadId, "t1") + } + + func testChatIncludesSystemPromptByDefault() async throws { + let (agent, transport) = makeAgent { cfg in + cfg.systemPrompt = "You are helpful." + } + _ = try await drain(agent.chat(message: "Hi", threadId: "t1")) + + let inputs = await transport.capturedInputs + let input = try XCTUnwrap(inputs.first) + XCTAssertEqual(input.messages[0].role, .system) + } + + // MARK: - History accumulation + + func testUserMessageAppendedToHistory() async throws { + let (agent, _) = makeAgent() + _ = try await drain(agent.sendMessage( + message: "Hello", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + let history = await agent.history(for: "t1") + let userMessages = history.filter { $0.role == .user } + XCTAssertEqual(userMessages.count, 1) + XCTAssertEqual((userMessages[0] as? UserMessage)?.content, "Hello") + } + + func testHistoryAccumulatesAcrossRounds() async throws { + let (agent, _) = makeAgent() + + _ = try await drain(agent.sendMessage( + message: "First", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + _ = try await drain(agent.sendMessage( + message: "Second", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + let history = await agent.history(for: "t1") + let userMessages = history.filter { $0.role == .user } + XCTAssertEqual(userMessages.count, 2) + XCTAssertEqual((userMessages[0] as? UserMessage)?.content, "First") + XCTAssertEqual((userMessages[1] as? UserMessage)?.content, "Second") + } + + func testHistoryPassedToTransportOnSecondCall() async throws { + let (agent, transport) = makeAgent() + + _ = try await drain(agent.sendMessage( + message: "First", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + _ = try await drain(agent.sendMessage( + message: "Second", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + let inputs = await transport.capturedInputs + XCTAssertEqual(inputs.count, 2) + // Second call's input must contain "First" already in history + XCTAssertEqual(inputs[1].messages.count, 2) + XCTAssertEqual((inputs[1].messages[0] as? UserMessage)?.content, "First") + XCTAssertEqual((inputs[1].messages[1] as? UserMessage)?.content, "Second") + } + + func testHistoryIsolatedPerThread() async throws { + let (agent, _) = makeAgent() + + _ = try await drain(agent.sendMessage( + message: "Thread A", + threadId: "thread-a", + state: nil, + includeSystemPrompt: false + )) + _ = try await drain(agent.sendMessage( + message: "Thread B", + threadId: "thread-b", + state: nil, + includeSystemPrompt: false + )) + + let historyA = await agent.history(for: "thread-a") + let historyB = await agent.history(for: "thread-b") + XCTAssertEqual(historyA.count, 1) + XCTAssertEqual(historyB.count, 1) + XCTAssertEqual((historyA[0] as? UserMessage)?.content, "Thread A") + XCTAssertEqual((historyB[0] as? UserMessage)?.content, "Thread B") + } + + func testHistoryTrimmingRespected() async throws { + let (agent, _) = makeAgent { cfg in + cfg.maxHistoryLength = 3 + } + + for i in 1...5 { + _ = try await drain(agent.sendMessage( + message: "Message \(i)", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + } + + let history = await agent.history(for: "t1") + XCTAssertLessThanOrEqual(history.count, 3) + } + + func testHistoryForNewThreadIsEmpty() async { + let (agent, _) = makeAgent() + let history = await agent.history(for: "nonexistent-thread") + XCTAssertTrue(history.isEmpty) + } + + // MARK: - clearHistory + + func testClearHistoryClearsSpecificThread() async throws { + let (agent, _) = makeAgent() + _ = try await drain(agent.sendMessage( + message: "Hi", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + await agent.clearHistory(threadId: "t1") + + let history = await agent.history(for: "t1") + XCTAssertTrue(history.isEmpty) + } + + func testClearHistoryNilClearsAllThreads() async throws { + let (agent, _) = makeAgent() + + for threadId in ["t1", "t2", "t3"] { + _ = try await drain(agent.sendMessage( + message: "Hi", + threadId: threadId, + state: nil, + includeSystemPrompt: false + )) + } + + await agent.clearHistory() + + for threadId in ["t1", "t2", "t3"] { + let history = await agent.history(for: threadId) + XCTAssertTrue(history.isEmpty, "Thread \(threadId) should be empty after clearHistory()") + } + } + + // MARK: - Event passthrough + + func testAllEventsYieldedDownstream() async throws { + let (agent, transport) = makeAgent() + await transport.setMockEvents([ + RunStartedEvent(threadId: "t1", runId: "r1"), + RunFinishedEvent(threadId: "t1", runId: "r1"), + ]) + + let received = try await drain(agent.sendMessage( + message: "Hi", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + XCTAssertEqual(received.count, 2) + XCTAssertTrue(received[0] is RunStartedEvent) + XCTAssertTrue(received[1] is RunFinishedEvent) + } + + // MARK: - Text message assembly (trackHistoryAndState) + + func testTextMessageAssemblyRecordedInHistory() async throws { + let (agent, transport) = makeAgent() + await transport.setMockEvents([ + TextMessageStartEvent(messageId: "msg1"), + TextMessageContentEvent(messageId: "msg1", delta: "Hello"), + TextMessageContentEvent(messageId: "msg1", delta: ", world!"), + TextMessageEndEvent(messageId: "msg1"), + ]) + + _ = try await drain(agent.sendMessage( + message: "Hi", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + let history = await agent.history(for: "t1") + let assistantMsgs = history.compactMap { $0 as? AssistantMessage } + XCTAssertEqual(assistantMsgs.count, 1) + XCTAssertEqual(assistantMsgs[0].id, "msg1") + XCTAssertEqual(assistantMsgs[0].content, "Hello, world!") + } + + func testTextMessageContentConcatenated() async throws { + let (agent, transport) = makeAgent() + await transport.setMockEvents([ + TextMessageStartEvent(messageId: "m1"), + TextMessageContentEvent(messageId: "m1", delta: "A"), + TextMessageContentEvent(messageId: "m1", delta: "B"), + TextMessageContentEvent(messageId: "m1", delta: "C"), + TextMessageEndEvent(messageId: "m1"), + ]) + + _ = try await drain(agent.sendMessage( + message: "Hi", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + let history = await agent.history(for: "t1") + let assistantMsg = try XCTUnwrap(history.compactMap { $0 as? AssistantMessage }.first) + XCTAssertEqual(assistantMsg.content, "ABC") + } + + func testEmptyTextMessageStillRecordedInHistory() async throws { + let (agent, transport) = makeAgent() + await transport.setMockEvents([ + TextMessageStartEvent(messageId: "m2"), + TextMessageEndEvent(messageId: "m2"), + ]) + + _ = try await drain(agent.sendMessage( + message: "Hi", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + let history = await agent.history(for: "t1") + let assistantMsgs = history.compactMap { $0 as? AssistantMessage } + XCTAssertEqual(assistantMsgs.count, 1) + XCTAssertEqual(assistantMsgs[0].content, "") + } + + // MARK: - Tool call tracking (trackHistoryAndState) + + func testToolCallResultAppendsToolMessageToHistory() async throws { + let (agent, transport) = makeAgent() + await transport.setMockEvents([ + ToolCallStartEvent(toolCallId: "tc1", toolCallName: "get_weather"), + ToolCallEndEvent(toolCallId: "tc1"), + ToolCallResultEvent(messageId: "res1", toolCallId: "tc1", content: "72°F, sunny"), + ]) + + _ = try await drain(agent.sendMessage( + message: "Weather?", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + let history = await agent.history(for: "t1") + let toolMessages = history.compactMap { $0 as? ToolMessage } + XCTAssertEqual(toolMessages.count, 1) + XCTAssertEqual(toolMessages[0].toolCallId, "tc1") + XCTAssertEqual(toolMessages[0].content, "72°F, sunny") + } + + func testToolCallResultFlushesPendingAssistantMessage() async throws { + let (agent, transport) = makeAgent() + await transport.setMockEvents([ + ToolCallStartEvent(toolCallId: "tc1", toolCallName: "get_weather"), + ToolCallArgsEvent(toolCallId: "tc1", delta: "{\"city\":\"London\"}"), + ToolCallEndEvent(toolCallId: "tc1"), + ToolCallResultEvent(messageId: "res1", toolCallId: "tc1", content: "Rainy"), + ]) + + _ = try await drain(agent.sendMessage( + message: "Weather?", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + let history = await agent.history(for: "t1") + let assistantMsgs = history.compactMap { $0 as? AssistantMessage } + XCTAssertEqual(assistantMsgs.count, 1) + let calls = try XCTUnwrap(assistantMsgs[0].toolCalls) + XCTAssertEqual(calls[0].id, "tc1") + XCTAssertEqual(calls[0].function.name, "get_weather") + XCTAssertEqual(calls[0].function.arguments, "{\"city\":\"London\"}") + } + + func testToolCallEndDoesNotDuplicateAssistantMessage() async throws { + let (agent, transport) = makeAgent() + // Two tool calls complete before a ToolCallResultEvent — must not prematurely flush + await transport.setMockEvents([ + ToolCallStartEvent(toolCallId: "tc1", toolCallName: "tool_a"), + ToolCallEndEvent(toolCallId: "tc1"), + ToolCallStartEvent(toolCallId: "tc2", toolCallName: "tool_b"), + ToolCallEndEvent(toolCallId: "tc2"), + ToolCallResultEvent(messageId: "res1", toolCallId: "tc1", content: "ok"), + ]) + + _ = try await drain(agent.sendMessage( + message: "Go", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + let history = await agent.history(for: "t1") + let assistantMsgs = history.compactMap { $0 as? AssistantMessage } + XCTAssertEqual(assistantMsgs.count, 1, "ToolCallEnd must not flush assistant message early") + } + + // MARK: - State event tracking (trackHistoryAndState) + + func testStateSnapshotUpdatesStateForNextRun() async throws { + let (agent, transport) = makeAgent() + let newState = Data("{\"count\":42}".utf8) + await transport.setMockEvents([StateSnapshotEvent(snapshot: newState)]) + + _ = try await drain(agent.sendMessage( + message: "First", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + await transport.setMockEvents([]) + _ = try await drain(agent.sendMessage( + message: "Second", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + let inputs = await transport.capturedInputs + XCTAssertEqual(inputs[1].state, newState) + } + + func testStateDeltaAppliedToCurrentState() async throws { + let (agent, transport) = makeAgent() + let snapshot = Data("{\"count\":0}".utf8) + let patch = Data("[{\"op\":\"replace\",\"path\":\"/count\",\"value\":7}]".utf8) + await transport.setMockEvents([ + StateSnapshotEvent(snapshot: snapshot), + StateDeltaEvent(delta: patch), + ]) + + _ = try await drain(agent.sendMessage( + message: "First", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + await transport.setMockEvents([]) + _ = try await drain(agent.sendMessage( + message: "Second", + threadId: "t1", + state: nil, + includeSystemPrompt: false + )) + + let inputs = await transport.capturedInputs + let stateData = inputs[1].state + guard let json = try? JSONSerialization.jsonObject(with: stateData) as? [String: Any], + let count = json["count"] as? Int else { + XCTFail("Could not parse state JSON") + return + } + XCTAssertEqual(count, 7) + } +} From 2b087160a8fc0eee6e492def61c2b2ec0088ba92 Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 17:17:59 -0400 Subject: [PATCH 14/19] fix: add FoundationNetworking import and Linux URLSession fallback On Linux, URLSession lives in FoundationNetworking, not Foundation, causing it to resolve as AnyObject. URLSession.AsyncBytes and session.bytes(for:) are also Apple-only. Add `import FoundationNetworking` guard in URLSessionHTTPClient and HttpTransport. On Linux, replace the AsyncBytes streaming path with a dataTask-based fallback that buffers the full response; true SSE streaming remains an Apple-platform-only feature. --- .../AGUIClient/Transport/HttpTransport.swift | 3 ++ .../Transport/URLSessionHTTPClient.swift | 36 ++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Sources/AGUIClient/Transport/HttpTransport.swift b/Sources/AGUIClient/Transport/HttpTransport.swift index a7baa6d..d806499 100644 --- a/Sources/AGUIClient/Transport/HttpTransport.swift +++ b/Sources/AGUIClient/Transport/HttpTransport.swift @@ -24,6 +24,9 @@ import AGUICore import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif /// Low-level HTTP transport for AG-UI agent communication. /// diff --git a/Sources/AGUIClient/Transport/URLSessionHTTPClient.swift b/Sources/AGUIClient/Transport/URLSessionHTTPClient.swift index 829ca7c..3d6d116 100644 --- a/Sources/AGUIClient/Transport/URLSessionHTTPClient.swift +++ b/Sources/AGUIClient/Transport/URLSessionHTTPClient.swift @@ -23,6 +23,9 @@ */ import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif /// URLSession-based HTTP client implementation. /// @@ -104,8 +107,9 @@ public actor URLSessionHTTPClient: HTTPClient { /// - `.cancelled` → `.cancelled` /// - Other errors → `.networkError` public func execute(_ request: URLRequest) async throws -> HTTPResponse { + #if canImport(Darwin) + // Apple platforms: use URLSession.AsyncBytes for true byte-level streaming. let (bytes, response): (URLSession.AsyncBytes, URLResponse) - do { (bytes, response) = try await session.bytes(for: request) } catch let error as URLError { @@ -132,8 +136,38 @@ public actor URLSessionHTTPClient: HTTPClient { } } } + return HTTPResponse(bytes: stream, httpResponse: httpResponse) + #else + // Linux: URLSession.AsyncBytes is unavailable in swift-corelibs-foundation. + // Buffer the full response via dataTask, then stream bytes from memory. + // SSE reconnection is not supported in this path; use the Apple build for production. + let (data, urlResponse): (Data, URLResponse) + do { + (data, urlResponse) = try await withCheckedThrowingContinuation { cont in + session.dataTask(with: request) { d, r, e in + if let e = e { + cont.resume(throwing: e) + } else { + cont.resume(returning: (d ?? Data(), r!)) + } + }.resume() + } + } catch let error as URLError { + throw mapURLError(error) + } catch { + throw ClientError.networkError(error) + } + guard let httpResponse = urlResponse as? HTTPURLResponse else { + throw ClientError.invalidResponse + } + + let stream = AsyncThrowingStream { continuation in + for byte in data { continuation.yield(byte) } + continuation.finish() + } return HTTPResponse(bytes: stream, httpResponse: httpResponse) + #endif } /// Maps URLError to ClientError. From 951b32ddce806c4fcf71c63128a6210e0861ac1f Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 17:20:15 -0400 Subject: [PATCH 15/19] ci: remove Linux build job The SDK targets iOS 15+ / macOS 13+ only. SSE streaming relies on URLSession.AsyncBytes which is Apple-platform-only. A Linux CI job adds no value and would require either a stub or an incompatible third-party HTTP library. --- .github/workflows/ci.yml | 20 ----------- .../AGUIClient/Transport/HttpTransport.swift | 3 -- .../Transport/URLSessionHTTPClient.swift | 36 +------------------ 3 files changed, 1 insertion(+), 58 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d8e22a..2e545f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,26 +40,6 @@ jobs: -destination 'platform=macOS' \ -quiet || true - # Build and test on Linux - test-linux: - name: Test Linux - runs-on: ubuntu-latest - container: - image: swift:latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Resolve Dependencies - run: swift package resolve - - - name: Build Package - run: swift build - - - name: Run Tests - run: swift test - # Lint and format check lint: name: Lint diff --git a/Sources/AGUIClient/Transport/HttpTransport.swift b/Sources/AGUIClient/Transport/HttpTransport.swift index d806499..a7baa6d 100644 --- a/Sources/AGUIClient/Transport/HttpTransport.swift +++ b/Sources/AGUIClient/Transport/HttpTransport.swift @@ -24,9 +24,6 @@ import AGUICore import Foundation -#if canImport(FoundationNetworking) -import FoundationNetworking -#endif /// Low-level HTTP transport for AG-UI agent communication. /// diff --git a/Sources/AGUIClient/Transport/URLSessionHTTPClient.swift b/Sources/AGUIClient/Transport/URLSessionHTTPClient.swift index 3d6d116..829ca7c 100644 --- a/Sources/AGUIClient/Transport/URLSessionHTTPClient.swift +++ b/Sources/AGUIClient/Transport/URLSessionHTTPClient.swift @@ -23,9 +23,6 @@ */ import Foundation -#if canImport(FoundationNetworking) -import FoundationNetworking -#endif /// URLSession-based HTTP client implementation. /// @@ -107,9 +104,8 @@ public actor URLSessionHTTPClient: HTTPClient { /// - `.cancelled` → `.cancelled` /// - Other errors → `.networkError` public func execute(_ request: URLRequest) async throws -> HTTPResponse { - #if canImport(Darwin) - // Apple platforms: use URLSession.AsyncBytes for true byte-level streaming. let (bytes, response): (URLSession.AsyncBytes, URLResponse) + do { (bytes, response) = try await session.bytes(for: request) } catch let error as URLError { @@ -136,38 +132,8 @@ public actor URLSessionHTTPClient: HTTPClient { } } } - return HTTPResponse(bytes: stream, httpResponse: httpResponse) - #else - // Linux: URLSession.AsyncBytes is unavailable in swift-corelibs-foundation. - // Buffer the full response via dataTask, then stream bytes from memory. - // SSE reconnection is not supported in this path; use the Apple build for production. - let (data, urlResponse): (Data, URLResponse) - do { - (data, urlResponse) = try await withCheckedThrowingContinuation { cont in - session.dataTask(with: request) { d, r, e in - if let e = e { - cont.resume(throwing: e) - } else { - cont.resume(returning: (d ?? Data(), r!)) - } - }.resume() - } - } catch let error as URLError { - throw mapURLError(error) - } catch { - throw ClientError.networkError(error) - } - guard let httpResponse = urlResponse as? HTTPURLResponse else { - throw ClientError.invalidResponse - } - - let stream = AsyncThrowingStream { continuation in - for byte in data { continuation.yield(byte) } - continuation.finish() - } return HTTPResponse(bytes: stream, httpResponse: httpResponse) - #endif } /// Maps URLError to ClientError. From 649da98248a54914145895ea6c95c1fbb7dc2eb1 Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 17:37:43 -0400 Subject: [PATCH 16/19] fix: address code review issues - Add ClientError.encodingError; HttpTransport now throws it on encode failure instead of the misleading decodingError - ClientToolResponseHandler surfaces RunErrorEvent as streamError instead of silently discarding all events from the tool-response run - AgentFormView: use SecureField for API key input - StatefulAgUiAgent.init(baseURL:) is now a convenience init delegating to init(configuration:), removing ~15 lines of duplicated setup - Extract shared JSONPrimitiveWrapper from 6 private DTO copies into AGUICore/Utilities/JSONPrimitiveWrapper.swift (internal, one source) --- .../ChatApp/Sources/Views/AgentFormView.swift | 2 +- Sources/AGUIAgentSDK/StatefulAgUiAgent.swift | 23 +------ .../Tools/ClientToolResponseHandler.swift | 9 ++- Sources/AGUIClient/Errors/ClientError.swift | 7 +++ .../AGUIClient/Transport/HttpTransport.swift | 4 +- .../ActivitySnapshotEventDTO.swift | 26 -------- .../SpecialEventsDTO/CustomEventDTO.swift | 26 -------- .../SpecialEventsDTO/RawEventDTO.swift | 26 -------- .../MessagesSnapshotEventDTO.swift | 26 -------- .../StateSnapshotEventDTO.swift | 26 -------- .../MessageDTO/ActivityMessageDTO.swift | 32 ---------- .../Utilities/JSONPrimitiveWrapper.swift | 62 +++++++++++++++++++ 12 files changed, 80 insertions(+), 189 deletions(-) create mode 100644 Sources/AGUICore/Utilities/JSONPrimitiveWrapper.swift diff --git a/Examples/ChatApp/Sources/Views/AgentFormView.swift b/Examples/ChatApp/Sources/Views/AgentFormView.swift index bdc2150..82b4de2 100644 --- a/Examples/ChatApp/Sources/Views/AgentFormView.swift +++ b/Examples/ChatApp/Sources/Views/AgentFormView.swift @@ -97,7 +97,7 @@ struct AgentFormView: View { .font(.footnote) .foregroundStyle(.secondary) case .apiKey: - TextField("API Key", text: bind(\.apiKey)) + SecureField("API Key", text: bind(\.apiKey)) .autocorrectionDisabled() .textInputAutocapitalization(.never) TextField("Header Name", text: bind(\.apiHeaderName)) diff --git a/Sources/AGUIAgentSDK/StatefulAgUiAgent.swift b/Sources/AGUIAgentSDK/StatefulAgUiAgent.swift index 620a83f..bc9bf19 100644 --- a/Sources/AGUIAgentSDK/StatefulAgUiAgent.swift +++ b/Sources/AGUIAgentSDK/StatefulAgUiAgent.swift @@ -110,27 +110,8 @@ public final class StatefulAgUiAgent: Sendable { /// ```swift /// let agent = StatefulAgUiAgent(baseURL: URL(string: "https://agent.example.com")!) /// ``` - public init(baseURL: URL) { - let config = StatefulAgUiAgentConfig(baseURL: baseURL) - self.config = config - let agent = HttpAgent(configuration: HttpAgentConfiguration( - baseURL: config.baseURL, - timeout: config.timeout, - headers: config.headers, - debug: config.debug - )) - self.httpAgent = agent - self.agentTransport = nil - self.historyManager = ConversationHistoryManager() - self.stateManager = StateManager(initialState: config.initialState) - if let registry = config.toolRegistry { - self.toolExecutionManager = ToolExecutionManager( - toolRegistry: registry, - responseHandler: ClientToolResponseHandler(httpAgent: agent, endpoint: config.endpoint) - ) - } else { - self.toolExecutionManager = nil - } + public convenience init(baseURL: URL) { + self.init(configuration: StatefulAgUiAgentConfig(baseURL: baseURL)) } /// Creates a new stateful agent with custom configuration. diff --git a/Sources/AGUIAgentSDK/Tools/ClientToolResponseHandler.swift b/Sources/AGUIAgentSDK/Tools/ClientToolResponseHandler.swift index 032c925..cd154aa 100644 --- a/Sources/AGUIAgentSDK/Tools/ClientToolResponseHandler.swift +++ b/Sources/AGUIAgentSDK/Tools/ClientToolResponseHandler.swift @@ -77,8 +77,11 @@ public final class ClientToolResponseHandler: ToolResponseHandler, Sendable { runId: runId ?? "run_\(UUID().uuidString)", messages: [message] ) - // Drive the full pipeline; discard resulting events. - // Use the AbstractAgent pipeline override (run(input:) with external label). - for try await _ in try await httpAgent.run(input, endpoint: endpoint) { } + // Drive the full pipeline; surface any server-side errors. + for try await event in try await httpAgent.run(input, endpoint: endpoint) { + if let errorEvent = event as? RunErrorEvent { + throw ClientError.streamError(errorEvent.message) + } + } } } diff --git a/Sources/AGUIClient/Errors/ClientError.swift b/Sources/AGUIClient/Errors/ClientError.swift index b460d6f..99cab2e 100644 --- a/Sources/AGUIClient/Errors/ClientError.swift +++ b/Sources/AGUIClient/Errors/ClientError.swift @@ -38,6 +38,9 @@ public enum ClientError: Error { /// Network error occurred. case networkError(Error) + /// Failed to encode request body. + case encodingError(Error) + /// Failed to decode event. case decodingError(Error) @@ -62,6 +65,8 @@ extension ClientError: LocalizedError { return "HTTP error: \(code)" case .networkError(let error): return "Network error: \(error.localizedDescription)" + case .encodingError(let error): + return "Failed to encode request: \(error.localizedDescription)" case .decodingError(let error): return "Failed to decode event: \(error.localizedDescription)" case .streamError(let message): @@ -88,6 +93,8 @@ extension ClientError: Equatable { return lmsg == rmsg case (.networkError(let lerr), .networkError(let rerr)): return lerr.localizedDescription == rerr.localizedDescription + case (.encodingError(let lerr), .encodingError(let rerr)): + return lerr.localizedDescription == rerr.localizedDescription case (.decodingError(let lerr), .decodingError(let rerr)): return lerr.localizedDescription == rerr.localizedDescription default: diff --git a/Sources/AGUIClient/Transport/HttpTransport.swift b/Sources/AGUIClient/Transport/HttpTransport.swift index a7baa6d..3eba36f 100644 --- a/Sources/AGUIClient/Transport/HttpTransport.swift +++ b/Sources/AGUIClient/Transport/HttpTransport.swift @@ -142,7 +142,7 @@ public actor HttpTransport { /// ## Error Handling /// /// Throws `ClientError` for: - /// - Encoding failures → `.decodingError` + /// - Encoding failures → `.encodingError` /// - Non-2xx status codes → `.httpError(statusCode:)` /// - Invalid responses → `.invalidResponse` /// - Network errors → `.networkError`, `.timeout`, `.cancelled` @@ -170,7 +170,7 @@ public actor HttpTransport { do { request.httpBody = try encoder.encode(input) } catch { - throw ClientError.decodingError(error) + throw ClientError.encodingError(error) } // Execute request via injected HTTP client diff --git a/Sources/AGUICore/Decoding/EventDTO/ActivityEventsDTO/ActivitySnapshotEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ActivityEventsDTO/ActivitySnapshotEventDTO.swift index d5158a3..35484eb 100644 --- a/Sources/AGUICore/Decoding/EventDTO/ActivityEventsDTO/ActivitySnapshotEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/ActivityEventsDTO/ActivitySnapshotEventDTO.swift @@ -110,29 +110,3 @@ struct ActivitySnapshotEventDTO { ) } } - -// Helper type to encode primitive JSON values -private struct JSONPrimitiveWrapper: Encodable { - let value: Any - - func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - - switch value { - case let bool as Bool: - try container.encode(bool) - case let int as Int: - try container.encode(int) - case let int64 as Int64: - try container.encode(int64) - case let double as Double: - try container.encode(double) - case let string as String: - try container.encode(string) - case is NSNull: - try container.encodeNil() - default: - throw EncodingError.invalidValue(value, EncodingError.Context(codingPath: [], debugDescription: "Unsupported primitive type")) - } - } -} diff --git a/Sources/AGUICore/Decoding/EventDTO/SpecialEventsDTO/CustomEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/SpecialEventsDTO/CustomEventDTO.swift index 5249030..3010586 100644 --- a/Sources/AGUICore/Decoding/EventDTO/SpecialEventsDTO/CustomEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/SpecialEventsDTO/CustomEventDTO.swift @@ -92,29 +92,3 @@ struct CustomEventDTO { ) } } - -// Helper type to encode primitive JSON values -private struct JSONPrimitiveWrapper: Encodable { - let value: Any - - func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - - switch value { - case let bool as Bool: - try container.encode(bool) - case let int as Int: - try container.encode(int) - case let int64 as Int64: - try container.encode(int64) - case let double as Double: - try container.encode(double) - case let string as String: - try container.encode(string) - case is NSNull: - try container.encodeNil() - default: - throw EncodingError.invalidValue(value, EncodingError.Context(codingPath: [], debugDescription: "Unsupported primitive type")) - } - } -} diff --git a/Sources/AGUICore/Decoding/EventDTO/SpecialEventsDTO/RawEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/SpecialEventsDTO/RawEventDTO.swift index e5b622c..04436fe 100644 --- a/Sources/AGUICore/Decoding/EventDTO/SpecialEventsDTO/RawEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/SpecialEventsDTO/RawEventDTO.swift @@ -84,29 +84,3 @@ struct RawEventDTO { ) } } - -// Helper type to encode primitive JSON values -private struct JSONPrimitiveWrapper: Encodable { - let value: Any - - func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - - switch value { - case let bool as Bool: - try container.encode(bool) - case let int as Int: - try container.encode(int) - case let int64 as Int64: - try container.encode(int64) - case let double as Double: - try container.encode(double) - case let string as String: - try container.encode(string) - case is NSNull: - try container.encodeNil() - default: - throw EncodingError.invalidValue(value, EncodingError.Context(codingPath: [], debugDescription: "Unsupported primitive type")) - } - } -} diff --git a/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/MessagesSnapshotEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/MessagesSnapshotEventDTO.swift index 2d02e65..f94e97a 100644 --- a/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/MessagesSnapshotEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/MessagesSnapshotEventDTO.swift @@ -77,29 +77,3 @@ struct MessagesSnapshotEventDTO { ) } } - -// Helper type to encode primitive JSON values -private struct JSONPrimitiveWrapper: Encodable { - let value: Any - - func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - - switch value { - case let bool as Bool: - try container.encode(bool) - case let int as Int: - try container.encode(int) - case let int64 as Int64: - try container.encode(int64) - case let double as Double: - try container.encode(double) - case let string as String: - try container.encode(string) - case is NSNull: - try container.encodeNil() - default: - throw EncodingError.invalidValue(value, EncodingError.Context(codingPath: [], debugDescription: "Unsupported primitive type")) - } - } -} diff --git a/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/StateSnapshotEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/StateSnapshotEventDTO.swift index f83729f..25be093 100644 --- a/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/StateSnapshotEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/StateSnapshotEventDTO.swift @@ -77,29 +77,3 @@ struct StateSnapshotEventDTO { ) } } - -// Helper type to encode primitive JSON values -private struct JSONPrimitiveWrapper: Encodable { - let value: Any - - func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - - switch value { - case let bool as Bool: - try container.encode(bool) - case let int as Int: - try container.encode(int) - case let int64 as Int64: - try container.encode(int64) - case let double as Double: - try container.encode(double) - case let string as String: - try container.encode(string) - case is NSNull: - try container.encodeNil() - default: - throw EncodingError.invalidValue(value, EncodingError.Context(codingPath: [], debugDescription: "Unsupported primitive type")) - } - } -} diff --git a/Sources/AGUICore/Decoding/MessageDTO/ActivityMessageDTO.swift b/Sources/AGUICore/Decoding/MessageDTO/ActivityMessageDTO.swift index 1155546..9462e39 100644 --- a/Sources/AGUICore/Decoding/MessageDTO/ActivityMessageDTO.swift +++ b/Sources/AGUICore/Decoding/MessageDTO/ActivityMessageDTO.swift @@ -79,35 +79,3 @@ struct ActivityMessageDTO { case content } } - -// Helper type to encode primitive JSON values -private struct JSONPrimitiveWrapper: Encodable { - let value: Any - - func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - - switch value { - case let bool as Bool: - try container.encode(bool) - case let int as Int: - try container.encode(int) - case let int64 as Int64: - try container.encode(int64) - case let double as Double: - try container.encode(double) - case let string as String: - try container.encode(string) - case is NSNull: - try container.encodeNil() - default: - throw EncodingError.invalidValue( - value, - EncodingError.Context( - codingPath: [], - debugDescription: "Unsupported primitive type" - ) - ) - } - } -} diff --git a/Sources/AGUICore/Utilities/JSONPrimitiveWrapper.swift b/Sources/AGUICore/Utilities/JSONPrimitiveWrapper.swift new file mode 100644 index 0000000..1ff8288 --- /dev/null +++ b/Sources/AGUICore/Utilities/JSONPrimitiveWrapper.swift @@ -0,0 +1,62 @@ +/* + * MIT License + * + * Copyright (c) 2025 Perfect Aduh + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import Foundation + +/// Wraps an untyped `Any` primitive so it can be encoded into JSON via `Codable`. +/// +/// This is an internal helper used by DTO types that receive raw `Any` values +/// from `JSONSerialization` and need to round-trip them through `JSONEncoder`. +/// +/// Supported value types: `Bool`, `Int`, `Int64`, `Double`, `String`, `NSNull`. +struct JSONPrimitiveWrapper: Encodable { + let value: Any + + func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + + switch value { + case let bool as Bool: + try container.encode(bool) + case let int as Int: + try container.encode(int) + case let int64 as Int64: + try container.encode(int64) + case let double as Double: + try container.encode(double) + case let string as String: + try container.encode(string) + case is NSNull: + try container.encodeNil() + default: + throw EncodingError.invalidValue( + value, + EncodingError.Context( + codingPath: [], + debugDescription: "Unsupported primitive type" + ) + ) + } + } +} From 9334d69b995eaf6b21d755c6b96a0f84a899996e Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 18:16:56 -0400 Subject: [PATCH 17/19] refactor: address PR review feedback and remove THINKING events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace 23-line MIT license blocks with 1-line copyright notice (292 files) - Delete dead AGUICore placeholder struct and deprecated AGUITools struct - Fix SwiftLint large_tuple config to use proper nested YAML syntax - Fix unused colIdx variable in A2UIComponentView (replace with _) - Wrap builder free functions in AgentBuilders enum namespace - Add 10 MB max-buffer guard to SseParser to prevent unbounded growth - Decode A2UISurfaceView surfaceData once in init instead of every body evaluation - Replace fragile "[A2UI Action] {json}" string prefix with typed A2UIActionEnvelope - Extract duplicate MockToolRegistry into shared Tests/AGUIAgentSDKTests/Mocks/ - Add ToolExecutionResult.decode(as:using:) convenience for typed result access - Remove all deprecated THINKING_* event types, DTOs, registry, state, and tests - Add AGUIEventDecoder.remapThinkingEvent() for transparent THINKING→REASONING backward compat at the wire level (mirrors TypeScript BackwardCompatibility_0_0_45) --- .claude/worktrees/agent-adf154a3 | 1 + .swiftlint.yml | 3 +- .../ChatApp/Sources/A2UI/A2UIComponent.swift | 24 +- .../A2UI/A2UISurfaceStateManager.swift | 24 +- Examples/ChatApp/Sources/App/ChatAppApp.swift | 24 +- .../Sources/ClawgUI/ClawgUIDetector.swift | 24 +- .../ClawgUI/ClawgUIPairingManager.swift | 24 +- .../Sources/ClawgUI/ClawgUIPairingState.swift | 24 +- .../ChatApp/Sources/Models/AgentConfig.swift | 24 +- .../ChatApp/Sources/Models/AgentDraft.swift | 24 +- Examples/ChatApp/Sources/Models/ChatRow.swift | 24 +- .../ChatApp/Sources/Models/ChatUIState.swift | 24 +- .../Sources/Models/DisplayMessage.swift | 24 +- .../Sources/Models/EphemeralSlot.swift | 24 +- .../Sources/Models/SupplementalMessage.swift | 24 +- .../Sources/Store/ChatAppStore+A2UI.swift | 48 ++-- .../Store/ChatAppStore+EventProcessing.swift | 24 +- .../ChatApp/Sources/Store/ChatAppStore.swift | 24 +- .../Tools/ChangeBackgroundToolExecutor.swift | 24 +- .../Sources/Tools/ChatAppToolRegistry.swift | 24 +- .../Views/A2UI/A2UIComponentView.swift | 26 +- .../Sources/Views/A2UI/A2UISurfaceView.swift | 47 ++-- .../ChatApp/Sources/Views/AgentFormView.swift | 24 +- .../ChatApp/Sources/Views/AgentListView.swift | 24 +- Examples/ChatApp/Sources/Views/ChatView.swift | 24 +- .../Views/ClawgUI/ClawgUIPairingView.swift | 24 +- .../Sources/Views/MessageBubbleView.swift | 24 +- Examples/ChatApp/Sources/Views/RootView.swift | 24 +- .../Sources/Views/StreamingCursorView.swift | 24 +- .../Sources/Views/TypingDotsView.swift | 24 +- .../ChatAppTests/A2UIComponentTests.swift | 24 +- .../A2UISurfaceStateManagerTests.swift | 24 +- .../ChangeBackgroundToolExecutorTests.swift | 24 +- .../ChatAppTests/ChatAppStoreTests.swift | 24 +- .../ChatAppTests/ClawgUIDetectorTests.swift | 24 +- .../ClawgUIPairingManagerTests.swift | 24 +- .../ChatAppTests/Mocks/MockAgUiAgent.swift | 24 +- Sources/AGUIAgentSDK/AGUIAgentSDK.swift | 24 +- Sources/AGUIAgentSDK/AgUiAgent.swift | 24 +- Sources/AGUIAgentSDK/AgUiAgentConfig.swift | 24 +- Sources/AGUIAgentSDK/AgentBuilders.swift | 190 +++++++-------- Sources/AGUIAgentSDK/AgentMessage.swift | 24 +- Sources/AGUIAgentSDK/AgentViewModel.swift | 24 +- .../AGUIAgentSDK/AgentViewModelCompat.swift | 24 +- Sources/AGUIAgentSDK/ChatAgent.swift | 24 +- .../ConversationHistoryManager.swift | 24 +- Sources/AGUIAgentSDK/StatefulAgUiAgent.swift | 24 +- .../StatefulAgUiAgentConfig.swift | 24 +- .../Tools/ClientToolResponseHandler.swift | 24 +- Sources/AGUIClient/AGUIClient.swift | 24 +- Sources/AGUIClient/AbstractAgent.swift | 31 +-- Sources/AGUIClient/Errors/ClientError.swift | 24 +- Sources/AGUIClient/HttpAgent.swift | 25 +- Sources/AGUIClient/RunAgentParameters.swift | 24 +- Sources/AGUIClient/State/AgentState.swift | 28 +-- .../AGUIClient/State/DefaultApplyEvents.swift | 82 +------ .../AGUIClient/State/PatchApplicator.swift | 24 +- Sources/AGUIClient/State/StateManager.swift | 24 +- .../State/ThinkingTelemetryState.swift | 44 ---- .../Streaming/AsyncSequence+Buffering.swift | 24 +- .../Streaming/BufferingStrategy.swift | 24 +- .../Streaming/ChunkTransformer.swift | 24 +- .../AGUIClient/Streaming/EventStream.swift | 24 +- .../AGUIClient/Streaming/EventVerifier.swift | 52 +--- Sources/AGUIClient/Streaming/SseEvent.swift | 24 +- Sources/AGUIClient/Streaming/SseParser.swift | 38 ++- .../Subscriber/AgentSubscriber.swift | 24 +- .../Subscriber/SubscriberManager.swift | 24 +- .../AGUIClient/Transport/AgentTransport.swift | 24 +- Sources/AGUIClient/Transport/HTTPClient.swift | 24 +- .../Transport/HttpAgentConfiguration.swift | 24 +- .../Transport/HttpAgentTransport.swift | 24 +- .../AGUIClient/Transport/HttpTransport.swift | 24 +- .../Transport/URLSessionHTTPClient.swift | 24 +- Sources/AGUICore/AGUICore.swift | 38 +-- .../AGUICore/Decoding/AGUIEventDecoder.swift | 79 ++++-- .../ActivityDeltaEventDTO.swift | 24 +- .../ActivitySnapshotEventDTO.swift | 24 +- .../EventDTO/EventDecodingHelpers.swift | 24 +- .../LifeCycleEventsDTO/RunErrorEventDTO.swift | 24 +- .../RunFinishedEventDTO.swift | 24 +- .../RunStartedEventDTO.swift | 24 +- .../StepFinishedEventDTO.swift | 24 +- .../StepStartedEventDTO.swift | 24 +- .../ReasoningEncryptedValueEventDTO.swift | 24 +- .../ReasoningEndEventDTO.swift | 24 +- .../ReasoningMessageChunkEventDTO.swift | 24 +- .../ReasoningMessageContentEventDTO.swift | 24 +- .../ReasoningMessageEndEventDTO.swift | 24 +- .../ReasoningMessageStartEventDTO.swift | 24 +- .../ReasoningStartEventDTO.swift | 24 +- .../SpecialEventsDTO/CustomEventDTO.swift | 24 +- .../SpecialEventsDTO/RawEventDTO.swift | 24 +- .../MessagesSnapshotEventDTO.swift | 24 +- .../StateEventsDTO/StateDeltaEventDTO.swift | 24 +- .../StateSnapshotEventDTO.swift | 24 +- .../TextMessageChunkEventDTO.swift | 24 +- .../TextMessageEndEventDTO.swift | 24 +- .../ThinkingEndEventDTO.swift | 33 --- .../ThinkingStartEventDTO.swift | 34 --- .../ThinkingTextMessageContentEventDTO.swift | 38 --- .../ThinkingTextMessageEndEventDTO.swift | 33 --- .../ThinkingTextMessageStartEventDTO.swift | 33 --- .../ToolCallChunkEventDTO.swift | 24 +- .../ToolCallEndEventDTO.swift | 24 +- .../ToolCallResultEventDTO.swift | 24 +- .../Decoding/EventDTO/TypeDiscriminator.swift | 24 +- .../Decoding/EventDecodingError.swift | 24 +- .../AudioInputContentDTO.swift | 24 +- .../BinaryInputContentDTO.swift | 24 +- .../DocumentInputContentDTO.swift | 24 +- .../ImageInputContentDTO.swift | 24 +- .../InputContentDTO/TextInputContentDTO.swift | 24 +- .../VideoInputContentDTO.swift | 24 +- .../MessageDTO/ActivityMessageDTO.swift | 24 +- .../MessageDTO/MessageDecodingHelpers.swift | 24 +- .../MessageDTO/ReasoningMessageDTO.swift | 24 +- .../Decoding/MessageDTO/ToolMessageDTO.swift | 24 +- .../Decoding/MessageDTO/UserMessageDTO.swift | 24 +- .../AGUICore/Decoding/MessageDecoder.swift | 24 +- .../Registry/ActivityEventRegistry.swift | 24 +- .../Registry/LifecycleEventRegistry.swift | 24 +- .../Registry/ReasoningEventRegistry.swift | 24 +- .../Registry/SpecialEventRegistry.swift | 24 +- .../Registry/StateEventRegistry.swift | 24 +- .../Registry/TextMessageEventRegistry.swift | 24 +- .../Registry/ThinkingEventRegistry.swift | 49 ---- .../Registry/ToolCallEventRegistry.swift | 24 +- .../AGUICore/Decoding/RegistryComposer.swift | 24 +- .../AGUICore/Encoding/MessageEncoder.swift | 24 +- Sources/AGUICore/EventType.swift | 52 +--- Sources/AGUICore/Events/AGUIEvent.swift | 24 +- .../ActivityEvents/ActivityDeltaEvent.swift | 24 +- .../ActivitySnapshotEvent.swift | 24 +- .../LifeCycleEvents/RunErrorEvent.swift | 24 +- .../LifeCycleEvents/RunFinishedEvent.swift | 24 +- .../LifeCycleEvents/RunFinishedOutcome.swift | 24 +- .../LifeCycleEvents/RunStartedEvent.swift | 24 +- .../LifeCycleEvents/StepFinishedEvent.swift | 24 +- .../LifeCycleEvents/StepStartedEvent.swift | 24 +- .../ReasoningEncryptedValueEvent.swift | 24 +- .../ReasoningEvents/ReasoningEndEvent.swift | 24 +- .../ReasoningMessageChunkEvent.swift | 24 +- .../ReasoningMessageContentEvent.swift | 24 +- .../ReasoningMessageEndEvent.swift | 24 +- .../ReasoningMessageStartEvent.swift | 24 +- .../ReasoningEvents/ReasoningStartEvent.swift | 24 +- .../Events/SpecialEvents/CustomEvent.swift | 24 +- .../Events/SpecialEvents/RawEvent.swift | 24 +- .../StateEvents/MessagesSnapshotEvent.swift | 24 +- .../Events/StateEvents/StateDeltaEvent.swift | 24 +- .../StateEvents/StateSnapshotEvent.swift | 24 +- .../TextMessageChunkEvent.swift | 24 +- .../TextMessageContentEvent.swift | 24 +- .../TextMessageEndEvent.swift | 24 +- .../TextMessageStartEvent.swift | 24 +- .../ThinkingEvents/ThinkingEndEvent.swift | 82 ------- .../ThinkingEvents/ThinkingStartEvent.swift | 92 ------- .../ThinkingTextMessageContentEvent.swift | 95 -------- .../ThinkingTextMessageEndEvent.swift | 83 ------- .../ThinkingTextMessageStartEvent.swift | 82 ------- .../ToolCallEvents/ToolCallArgsEvent.swift | 24 +- .../ToolCallEvents/ToolCallChunkEvent.swift | 24 +- .../ToolCallEvents/ToolCallEndEvent.swift | 24 +- .../ToolCallEvents/ToolCallResultEvent.swift | 24 +- .../ToolCallEvents/ToolCallStartEvent.swift | 24 +- Sources/AGUICore/Events/UnknownEvent.swift | 24 +- .../Types/AgentExecution/Context.swift | 24 +- .../Types/AgentExecution/RunAgentInput.swift | 24 +- .../AgentExecution/RunAgentInputBuilder.swift | 24 +- .../AGUICore/Types/AgentExecution/State.swift | 24 +- .../InputContent/AudioInputContent.swift | 24 +- .../InputContent/BinaryInputContent.swift | 24 +- .../InputContent/DocumentInputContent.swift | 24 +- .../InputContent/ImageInputContent.swift | 24 +- .../Types/InputContent/InputContent.swift | 24 +- .../Types/InputContent/TextInputContent.swift | 24 +- .../InputContent/VideoInputContent.swift | 24 +- .../Types/Messages/ActivityMessage.swift | 24 +- .../Types/Messages/AssistantMessage.swift | 24 +- .../Types/Messages/DeveloperMessage.swift | 24 +- Sources/AGUICore/Types/Messages/Message.swift | 24 +- .../Types/Messages/ReasoningMessage.swift | 24 +- Sources/AGUICore/Types/Messages/Role.swift | 24 +- .../Types/Messages/SystemMessage.swift | 24 +- .../AGUICore/Types/Messages/ToolMessage.swift | 24 +- .../AGUICore/Types/Messages/UserMessage.swift | 24 +- .../AGUICore/Types/Tools/FunctionCall.swift | 24 +- Sources/AGUICore/Types/Tools/Tool.swift | 24 +- Sources/AGUICore/Types/Tools/ToolCall.swift | 24 +- .../Utilities/JSONCodingHelpers.swift | 24 +- .../Utilities/JSONPrimitiveWrapper.swift | 24 +- Sources/AGUITools/AGUITools.swift | 88 +------ Sources/AGUITools/Core/ToolErrorHandler.swift | 24 +- .../AGUITools/Core/ToolExecutionContext.swift | 24 +- .../AGUITools/Core/ToolExecutionEvent.swift | 24 +- .../AGUITools/Core/ToolExecutionManager.swift | 24 +- .../AGUITools/Core/ToolExecutionResult.swift | 43 ++-- Sources/AGUITools/Core/ToolExecutor.swift | 24 +- .../AGUITools/Core/ToolResponseHandler.swift | 24 +- .../Registry/ToolExecutionStats.swift | 24 +- Sources/AGUITools/Registry/ToolRegistry.swift | 24 +- .../AGUIAgentSDKTests/AGUIAgentSDKTests.swift | 24 +- Tests/AGUIAgentSDKTests/AgUiAgentTests.swift | 56 +---- .../AgentBuildersTests.swift | 79 ++---- .../AGUIAgentSDKTests/AgentMessageTests.swift | 24 +- .../AgentViewModelCompatTests.swift | 24 +- .../AgentViewModelTests.swift | 24 +- .../ConversationHistoryTests.swift | 24 +- .../EndToEndPipelineTests.swift | 73 +----- .../HistoryTrimmingTests.swift | 24 +- Tests/AGUIAgentSDKTests/MockChatAgent.swift | 24 +- .../Mocks/MockToolRegistry.swift | 27 +++ .../StatefulAgUiAgentTests.swift | 24 +- Tests/AGUIClientTests/AGUIClientTests.swift | 24 +- Tests/AGUIClientTests/HttpAgentTests.swift | 24 +- .../SseReconnectionTests.swift | 24 +- .../State/DefaultApplyEventsTests.swift | 24 +- .../State/PatchApplicatorTests.swift | 24 +- .../State/StateManagerTests.swift | 24 +- .../Streaming/BufferingTests.swift | 24 +- .../Streaming/ChunkTransformTests.swift | 24 +- .../Streaming/EventStreamTests.swift | 24 +- .../Streaming/EventVerifierTests.swift | 24 +- .../Streaming/SseParserTests.swift | 24 +- .../Subscriber/AgentSubscriberTests.swift | 24 +- .../Transport/ClientErrorTests.swift | 24 +- .../HttpAgentConfigurationTests.swift | 24 +- .../Transport/HttpTransportTests.swift | 24 +- .../Transport/MockHTTPClient.swift | 24 +- .../Transport/URLSessionHTTPClientTests.swift | 24 +- .../ActivityDeltaEventTests.swift | 24 +- .../ActivitySnapshotEventTests.swift | 24 +- .../Encoding/MessageEncoderTests.swift | 24 +- .../Helpers/AGUIEventDecoderTestHelpers.swift | 24 +- .../Helpers/EventDecodingErrorTests.swift | 24 +- .../AGUICoreTests/Helpers/EventTestData.swift | 24 +- .../LifeCycleEvents/RunErrorEventTests.swift | 24 +- .../RunFinishedEventTests.swift | 24 +- .../RunStartedEventTests.swift | 24 +- .../StepFinishedEventTests.swift | 24 +- .../StepStartedEventTests.swift | 24 +- .../ReasoningEncryptedValueEventTests.swift | 24 +- .../ReasoningEndEventTests.swift | 24 +- .../ReasoningMessageChunkEventTests.swift | 24 +- .../ReasoningMessageContentEventTests.swift | 24 +- .../ReasoningMessageEndEventTests.swift | 24 +- .../ReasoningMessageStartEventTests.swift | 24 +- .../ReasoningStartEventTests.swift | 24 +- .../SpecialEvents/CustomEventTests.swift | 24 +- .../SpecialEvents/RawEventTests.swift | 24 +- .../SpecialEvents/UnknownEventTests.swift | 24 +- .../MessagesSnapshotEventTests.swift | 24 +- .../StateEvents/StateDeltaEventTests.swift | 24 +- .../StateEvents/StateSnapshotEventTests.swift | 24 +- .../TextMessageChunkEventTests.swift | 24 +- .../TextMessageContentEventTests.swift | 24 +- .../TextMessageEndEventTests.swift | 24 +- .../TextMessageStartEventTests.swift | 24 +- .../ThinkingEndEventTests.swift | 196 --------------- .../ThinkingStartEventTests.swift | 226 ------------------ ...ThinkingTextMessageContentEventTests.swift | 188 --------------- .../ThinkingTextMessageEndEventTests.swift | 175 -------------- .../ThinkingTextMessageStartEventTests.swift | 175 -------------- .../ToolCallArgsEventTests.swift | 24 +- .../ToolCallChunkEventTests.swift | 24 +- .../ToolCallEndEventTests.swift | 24 +- .../ToolCallResultEventTests.swift | 24 +- .../ToolCallStartEventTests.swift | 24 +- .../Types/AgentExecution/ContextTests.swift | 24 +- .../RunAgentInputBuilderTests.swift | 24 +- .../AgentExecution/RunAgentInputTests.swift | 24 +- .../Types/AgentExecution/StateTests.swift | 24 +- .../InputContent/AudioInputContentTests.swift | 24 +- .../BinaryInputContentTests.swift | 24 +- .../DocumentInputContentTests.swift | 24 +- .../InputContent/ImageInputContentTests.swift | 24 +- .../InputContent/InputContentTests.swift | 24 +- .../InputContent/VideoInputContentTests.swift | 24 +- .../Types/Messages/ActivityMessageTests.swift | 24 +- .../Messages/AssistantMessageTests.swift | 24 +- .../Messages/DeveloperMessageTests.swift | 24 +- .../Types/Messages/MessageTests.swift | 24 +- .../Messages/ReasoningMessageTests.swift | 24 +- .../Types/Messages/RoleTests.swift | 24 +- .../Types/Messages/SystemMessageTests.swift | 24 +- .../Types/Messages/ToolMessageTests.swift | 24 +- .../Types/Messages/UserMessageTests.swift | 24 +- .../Types/Tools/FunctionCallTests.swift | 24 +- .../Types/Tools/ToolCallTests.swift | 24 +- .../AGUICoreTests/Types/Tools/ToolTests.swift | 24 +- Tests/AGUIToolsTests/AGUIToolsTests.swift | 37 +-- .../Core/ToolExecutionContextTests.swift | 24 +- .../Core/ToolExecutionManagerTests.swift | 24 +- .../Core/ToolExecutionResultTests.swift | 24 +- .../Core/ToolExecutorTests.swift | 24 +- .../Registry/ToolExecutionStatsTests.swift | 24 +- .../ToolRegistryConcurrencyTests.swift | 24 +- .../Registry/ToolRegistryTests.swift | 24 +- 299 files changed, 544 insertions(+), 8497 deletions(-) create mode 160000 .claude/worktrees/agent-adf154a3 delete mode 100644 Sources/AGUIClient/State/ThinkingTelemetryState.swift delete mode 100644 Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingEndEventDTO.swift delete mode 100644 Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingStartEventDTO.swift delete mode 100644 Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingTextMessageContentEventDTO.swift delete mode 100644 Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingTextMessageEndEventDTO.swift delete mode 100644 Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingTextMessageStartEventDTO.swift delete mode 100644 Sources/AGUICore/Decoding/Registry/ThinkingEventRegistry.swift delete mode 100644 Sources/AGUICore/Events/ThinkingEvents/ThinkingEndEvent.swift delete mode 100644 Sources/AGUICore/Events/ThinkingEvents/ThinkingStartEvent.swift delete mode 100644 Sources/AGUICore/Events/ThinkingEvents/ThinkingTextMessageContentEvent.swift delete mode 100644 Sources/AGUICore/Events/ThinkingEvents/ThinkingTextMessageEndEvent.swift delete mode 100644 Sources/AGUICore/Events/ThinkingEvents/ThinkingTextMessageStartEvent.swift create mode 100644 Tests/AGUIAgentSDKTests/Mocks/MockToolRegistry.swift delete mode 100644 Tests/AGUICoreTests/ThinkingEvents/ThinkingEndEventTests.swift delete mode 100644 Tests/AGUICoreTests/ThinkingEvents/ThinkingStartEventTests.swift delete mode 100644 Tests/AGUICoreTests/ThinkingEvents/ThinkingTextMessageContentEventTests.swift delete mode 100644 Tests/AGUICoreTests/ThinkingEvents/ThinkingTextMessageEndEventTests.swift delete mode 100644 Tests/AGUICoreTests/ThinkingEvents/ThinkingTextMessageStartEventTests.swift diff --git a/.claude/worktrees/agent-adf154a3 b/.claude/worktrees/agent-adf154a3 new file mode 160000 index 0000000..e15ffaa --- /dev/null +++ b/.claude/worktrees/agent-adf154a3 @@ -0,0 +1 @@ +Subproject commit e15ffaa1ccb4c228d7333676f9cb9d482a59045b diff --git a/.swiftlint.yml b/.swiftlint.yml index 3e531f4..31f5ab9 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -22,4 +22,5 @@ custom_rules: message: "Do not use assumeIsolated. Use explicit actor isolation or restructure the code to stay within structured concurrency." severity: error -large_tuple: 3 +large_tuple: + warning_length: 3 diff --git a/Examples/ChatApp/Sources/A2UI/A2UIComponent.swift b/Examples/ChatApp/Sources/A2UI/A2UIComponent.swift index a844016..1e4b273 100644 --- a/Examples/ChatApp/Sources/A2UI/A2UIComponent.swift +++ b/Examples/ChatApp/Sources/A2UI/A2UIComponent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Examples/ChatApp/Sources/A2UI/A2UISurfaceStateManager.swift b/Examples/ChatApp/Sources/A2UI/A2UISurfaceStateManager.swift index 639aab6..ce5b488 100644 --- a/Examples/ChatApp/Sources/A2UI/A2UISurfaceStateManager.swift +++ b/Examples/ChatApp/Sources/A2UI/A2UISurfaceStateManager.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUIClient import AGUICore diff --git a/Examples/ChatApp/Sources/App/ChatAppApp.swift b/Examples/ChatApp/Sources/App/ChatAppApp.swift index 107242a..d36139d 100644 --- a/Examples/ChatApp/Sources/App/ChatAppApp.swift +++ b/Examples/ChatApp/Sources/App/ChatAppApp.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import SwiftUI diff --git a/Examples/ChatApp/Sources/ClawgUI/ClawgUIDetector.swift b/Examples/ChatApp/Sources/ClawgUI/ClawgUIDetector.swift index 98e8545..0a45218 100644 --- a/Examples/ChatApp/Sources/ClawgUI/ClawgUIDetector.swift +++ b/Examples/ChatApp/Sources/ClawgUI/ClawgUIDetector.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Examples/ChatApp/Sources/ClawgUI/ClawgUIPairingManager.swift b/Examples/ChatApp/Sources/ClawgUI/ClawgUIPairingManager.swift index dde4381..6dc1c4e 100644 --- a/Examples/ChatApp/Sources/ClawgUI/ClawgUIPairingManager.swift +++ b/Examples/ChatApp/Sources/ClawgUI/ClawgUIPairingManager.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Examples/ChatApp/Sources/ClawgUI/ClawgUIPairingState.swift b/Examples/ChatApp/Sources/ClawgUI/ClawgUIPairingState.swift index 137cd0d..1d7aeaa 100644 --- a/Examples/ChatApp/Sources/ClawgUI/ClawgUIPairingState.swift +++ b/Examples/ChatApp/Sources/ClawgUI/ClawgUIPairingState.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Examples/ChatApp/Sources/Models/AgentConfig.swift b/Examples/ChatApp/Sources/Models/AgentConfig.swift index 6d335ef..12652e4 100644 --- a/Examples/ChatApp/Sources/Models/AgentConfig.swift +++ b/Examples/ChatApp/Sources/Models/AgentConfig.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUIAgentSDK import Foundation diff --git a/Examples/ChatApp/Sources/Models/AgentDraft.swift b/Examples/ChatApp/Sources/Models/AgentDraft.swift index d291df2..aa0a42f 100644 --- a/Examples/ChatApp/Sources/Models/AgentDraft.swift +++ b/Examples/ChatApp/Sources/Models/AgentDraft.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Examples/ChatApp/Sources/Models/ChatRow.swift b/Examples/ChatApp/Sources/Models/ChatRow.swift index fedc543..28d48f7 100644 --- a/Examples/ChatApp/Sources/Models/ChatRow.swift +++ b/Examples/ChatApp/Sources/Models/ChatRow.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Examples/ChatApp/Sources/Models/ChatUIState.swift b/Examples/ChatApp/Sources/Models/ChatUIState.swift index d34a680..01213e7 100644 --- a/Examples/ChatApp/Sources/Models/ChatUIState.swift +++ b/Examples/ChatApp/Sources/Models/ChatUIState.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Examples/ChatApp/Sources/Models/DisplayMessage.swift b/Examples/ChatApp/Sources/Models/DisplayMessage.swift index ea8548e..3b0b83c 100644 --- a/Examples/ChatApp/Sources/Models/DisplayMessage.swift +++ b/Examples/ChatApp/Sources/Models/DisplayMessage.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Examples/ChatApp/Sources/Models/EphemeralSlot.swift b/Examples/ChatApp/Sources/Models/EphemeralSlot.swift index 9325270..1ee0d7e 100644 --- a/Examples/ChatApp/Sources/Models/EphemeralSlot.swift +++ b/Examples/ChatApp/Sources/Models/EphemeralSlot.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Examples/ChatApp/Sources/Models/SupplementalMessage.swift b/Examples/ChatApp/Sources/Models/SupplementalMessage.swift index fab97ed..9980842 100644 --- a/Examples/ChatApp/Sources/Models/SupplementalMessage.swift +++ b/Examples/ChatApp/Sources/Models/SupplementalMessage.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Examples/ChatApp/Sources/Store/ChatAppStore+A2UI.swift b/Examples/ChatApp/Sources/Store/ChatAppStore+A2UI.swift index d65a445..758c152 100644 --- a/Examples/ChatApp/Sources/Store/ChatAppStore+A2UI.swift +++ b/Examples/ChatApp/Sources/Store/ChatAppStore+A2UI.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation @@ -50,27 +28,31 @@ extension ChatAppStore { // MARK: - Action routing + /// Wire format for an A2UI action sent from client to agent. + private struct A2UIActionEnvelope: Encodable { + let type = "a2ui_action" + let messageId: String + let action: String + let payload: [String: String] + } + /// Handles a user-initiated A2UI action. /// - /// "cancel" is treated as a local action that stops the in-flight stream - /// without sending anything to the server. All other actions are serialized - /// as a structured `[A2UI Action]` message and forwarded to the agent. + /// "cancel" stops the in-flight stream locally without contacting the server. + /// All other actions are serialized as a typed `A2UIActionEnvelope` JSON + /// message and forwarded to the agent via `sendMessage`. func handleA2UIAction(messageId: String, actionId: String, payload: [String: String]) { if actionId == "cancel" { cancelStreaming() return } - let body: [String: Any] = [ - "messageId": messageId, - "action": actionId, - "payload": payload - ] + let envelope = A2UIActionEnvelope(messageId: messageId, action: actionId, payload: payload) guard - let data = try? JSONSerialization.data(withJSONObject: body), + let data = try? JSONEncoder().encode(envelope), let json = String(data: data, encoding: .utf8) else { return } - sendMessage("[A2UI Action] \(json)") + sendMessage(json) } // MARK: - Private helpers diff --git a/Examples/ChatApp/Sources/Store/ChatAppStore+EventProcessing.swift b/Examples/ChatApp/Sources/Store/ChatAppStore+EventProcessing.swift index 214ba30..77b74f9 100644 --- a/Examples/ChatApp/Sources/Store/ChatAppStore+EventProcessing.swift +++ b/Examples/ChatApp/Sources/Store/ChatAppStore+EventProcessing.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Examples/ChatApp/Sources/Store/ChatAppStore.swift b/Examples/ChatApp/Sources/Store/ChatAppStore.swift index 60d9568..5ffae77 100644 --- a/Examples/ChatApp/Sources/Store/ChatAppStore.swift +++ b/Examples/ChatApp/Sources/Store/ChatAppStore.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUIAgentSDK import AGUICore diff --git a/Examples/ChatApp/Sources/Tools/ChangeBackgroundToolExecutor.swift b/Examples/ChatApp/Sources/Tools/ChangeBackgroundToolExecutor.swift index a1096b5..c5d30a8 100644 --- a/Examples/ChatApp/Sources/Tools/ChangeBackgroundToolExecutor.swift +++ b/Examples/ChatApp/Sources/Tools/ChangeBackgroundToolExecutor.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import AGUITools diff --git a/Examples/ChatApp/Sources/Tools/ChatAppToolRegistry.swift b/Examples/ChatApp/Sources/Tools/ChatAppToolRegistry.swift index 61bb44c..7404597 100644 --- a/Examples/ChatApp/Sources/Tools/ChatAppToolRegistry.swift +++ b/Examples/ChatApp/Sources/Tools/ChatAppToolRegistry.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUITools import Foundation diff --git a/Examples/ChatApp/Sources/Views/A2UI/A2UIComponentView.swift b/Examples/ChatApp/Sources/Views/A2UI/A2UIComponentView.swift index 3fd3e7b..73d01c3 100644 --- a/Examples/ChatApp/Sources/Views/A2UI/A2UIComponentView.swift +++ b/Examples/ChatApp/Sources/Views/A2UI/A2UIComponentView.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import MarkdownUI import SwiftUI @@ -307,7 +285,7 @@ private struct TableView: View { // Data rows ForEach(Array(rows.enumerated()), id: \.offset) { rowIdx, row in HStack(spacing: 0) { - ForEach(Array(row.enumerated()), id: \.offset) { colIdx, cell in + ForEach(Array(row.enumerated()), id: \.offset) { _, cell in Text(cell) .font(.caption) .frame(maxWidth: .infinity, alignment: .leading) diff --git a/Examples/ChatApp/Sources/Views/A2UI/A2UISurfaceView.swift b/Examples/ChatApp/Sources/Views/A2UI/A2UISurfaceView.swift index 9d31864..eb94274 100644 --- a/Examples/ChatApp/Sources/Views/A2UI/A2UISurfaceView.swift +++ b/Examples/ChatApp/Sources/Views/A2UI/A2UISurfaceView.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import SwiftUI @@ -28,24 +6,33 @@ import SwiftUI /// Root renderer for a single A2UI surface. /// -/// Decodes the raw JSON `surfaceData` into an `A2UIComponent` tree on each -/// render pass. Falls back to an empty view on parse failure so the layout -/// never breaks if the data is temporarily malformed during a streaming patch. +/// Decodes `surfaceData` once in `init` and falls back to an empty view on +/// parse failure, so the layout never breaks during a streaming patch. /// /// User interactions are forwarded through `onAction` so no store reference /// is held inside the view hierarchy — this keeps the view pure and testable. struct A2UISurfaceView: View { let messageId: String - /// Raw JSON bytes for this surface, sourced from `ChatUIState.a2uiSurfaces`. - let surfaceData: Data? + private let rootComponent: A2UIComponent? /// `(messageId, actionId, payload)` — called when the user interacts with /// a button, toggle, text field, or select inside this surface. let onAction: (String, String, [String: String]) -> Void + init( + messageId: String, + surfaceData: Data?, + onAction: @escaping (String, String, [String: String]) -> Void + ) { + self.messageId = messageId + self.rootComponent = surfaceData.flatMap { + try? JSONDecoder().decode(A2UIComponent.self, from: $0) + } + self.onAction = onAction + } + var body: some View { - if let data = surfaceData, - let root = try? JSONDecoder().decode(A2UIComponent.self, from: data) { + if let root = rootComponent { A2UIComponentView(component: root) { actionId, payload in onAction(messageId, actionId, payload) } diff --git a/Examples/ChatApp/Sources/Views/AgentFormView.swift b/Examples/ChatApp/Sources/Views/AgentFormView.swift index 82b4de2..e7c6d88 100644 --- a/Examples/ChatApp/Sources/Views/AgentFormView.swift +++ b/Examples/ChatApp/Sources/Views/AgentFormView.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import SwiftUI diff --git a/Examples/ChatApp/Sources/Views/AgentListView.swift b/Examples/ChatApp/Sources/Views/AgentListView.swift index 4d4903e..f48976c 100644 --- a/Examples/ChatApp/Sources/Views/AgentListView.swift +++ b/Examples/ChatApp/Sources/Views/AgentListView.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import SwiftUI diff --git a/Examples/ChatApp/Sources/Views/ChatView.swift b/Examples/ChatApp/Sources/Views/ChatView.swift index 54b13c1..c0f86c6 100644 --- a/Examples/ChatApp/Sources/Views/ChatView.swift +++ b/Examples/ChatApp/Sources/Views/ChatView.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import SwiftUI diff --git a/Examples/ChatApp/Sources/Views/ClawgUI/ClawgUIPairingView.swift b/Examples/ChatApp/Sources/Views/ClawgUI/ClawgUIPairingView.swift index 1bccf01..1fcc21a 100644 --- a/Examples/ChatApp/Sources/Views/ClawgUI/ClawgUIPairingView.swift +++ b/Examples/ChatApp/Sources/Views/ClawgUI/ClawgUIPairingView.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import SwiftUI diff --git a/Examples/ChatApp/Sources/Views/MessageBubbleView.swift b/Examples/ChatApp/Sources/Views/MessageBubbleView.swift index b6eada2..bbe1479 100644 --- a/Examples/ChatApp/Sources/Views/MessageBubbleView.swift +++ b/Examples/ChatApp/Sources/Views/MessageBubbleView.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import MarkdownUI import SwiftUI diff --git a/Examples/ChatApp/Sources/Views/RootView.swift b/Examples/ChatApp/Sources/Views/RootView.swift index d886ffc..6ef87ba 100644 --- a/Examples/ChatApp/Sources/Views/RootView.swift +++ b/Examples/ChatApp/Sources/Views/RootView.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import SwiftUI diff --git a/Examples/ChatApp/Sources/Views/StreamingCursorView.swift b/Examples/ChatApp/Sources/Views/StreamingCursorView.swift index 7aa76d7..907ede9 100644 --- a/Examples/ChatApp/Sources/Views/StreamingCursorView.swift +++ b/Examples/ChatApp/Sources/Views/StreamingCursorView.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import SwiftUI diff --git a/Examples/ChatApp/Sources/Views/TypingDotsView.swift b/Examples/ChatApp/Sources/Views/TypingDotsView.swift index 7d0cf65..9c3e617 100644 --- a/Examples/ChatApp/Sources/Views/TypingDotsView.swift +++ b/Examples/ChatApp/Sources/Views/TypingDotsView.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import SwiftUI diff --git a/Examples/ChatApp/Tests/ChatAppTests/A2UIComponentTests.swift b/Examples/ChatApp/Tests/ChatAppTests/A2UIComponentTests.swift index b57352f..19c8fba 100644 --- a/Examples/ChatApp/Tests/ChatAppTests/A2UIComponentTests.swift +++ b/Examples/ChatApp/Tests/ChatAppTests/A2UIComponentTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import ChatApp diff --git a/Examples/ChatApp/Tests/ChatAppTests/A2UISurfaceStateManagerTests.swift b/Examples/ChatApp/Tests/ChatAppTests/A2UISurfaceStateManagerTests.swift index 95f5536..5456eaa 100644 --- a/Examples/ChatApp/Tests/ChatAppTests/A2UISurfaceStateManagerTests.swift +++ b/Examples/ChatApp/Tests/ChatAppTests/A2UISurfaceStateManagerTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import XCTest diff --git a/Examples/ChatApp/Tests/ChatAppTests/ChangeBackgroundToolExecutorTests.swift b/Examples/ChatApp/Tests/ChatAppTests/ChangeBackgroundToolExecutorTests.swift index 30ee680..91bea0c 100644 --- a/Examples/ChatApp/Tests/ChatAppTests/ChangeBackgroundToolExecutorTests.swift +++ b/Examples/ChatApp/Tests/ChatAppTests/ChangeBackgroundToolExecutorTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import AGUITools diff --git a/Examples/ChatApp/Tests/ChatAppTests/ChatAppStoreTests.swift b/Examples/ChatApp/Tests/ChatAppTests/ChatAppStoreTests.swift index f60a11c..d3e7307 100644 --- a/Examples/ChatApp/Tests/ChatAppTests/ChatAppStoreTests.swift +++ b/Examples/ChatApp/Tests/ChatAppTests/ChatAppStoreTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import XCTest diff --git a/Examples/ChatApp/Tests/ChatAppTests/ClawgUIDetectorTests.swift b/Examples/ChatApp/Tests/ChatAppTests/ClawgUIDetectorTests.swift index 403b82d..9c7dc8b 100644 --- a/Examples/ChatApp/Tests/ChatAppTests/ClawgUIDetectorTests.swift +++ b/Examples/ChatApp/Tests/ChatAppTests/ClawgUIDetectorTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import ChatApp diff --git a/Examples/ChatApp/Tests/ChatAppTests/ClawgUIPairingManagerTests.swift b/Examples/ChatApp/Tests/ChatAppTests/ClawgUIPairingManagerTests.swift index 2cb80a7..74e6d82 100644 --- a/Examples/ChatApp/Tests/ChatAppTests/ClawgUIPairingManagerTests.swift +++ b/Examples/ChatApp/Tests/ChatAppTests/ClawgUIPairingManagerTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import ChatApp diff --git a/Examples/ChatApp/Tests/ChatAppTests/Mocks/MockAgUiAgent.swift b/Examples/ChatApp/Tests/ChatAppTests/Mocks/MockAgUiAgent.swift index 46ec662..d453010 100644 --- a/Examples/ChatApp/Tests/ChatAppTests/Mocks/MockAgUiAgent.swift +++ b/Examples/ChatApp/Tests/ChatAppTests/Mocks/MockAgUiAgent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUIAgentSDK import AGUICore diff --git a/Sources/AGUIAgentSDK/AGUIAgentSDK.swift b/Sources/AGUIAgentSDK/AGUIAgentSDK.swift index 3b8f4c9..2b0ed5a 100644 --- a/Sources/AGUIAgentSDK/AGUIAgentSDK.swift +++ b/Sources/AGUIAgentSDK/AGUIAgentSDK.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUIClient import AGUICore diff --git a/Sources/AGUIAgentSDK/AgUiAgent.swift b/Sources/AGUIAgentSDK/AgUiAgent.swift index e322f44..3d223a9 100644 --- a/Sources/AGUIAgentSDK/AgUiAgent.swift +++ b/Sources/AGUIAgentSDK/AgUiAgent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUIClient import AGUICore diff --git a/Sources/AGUIAgentSDK/AgUiAgentConfig.swift b/Sources/AGUIAgentSDK/AgUiAgentConfig.swift index 2075dd9..1508b04 100644 --- a/Sources/AGUIAgentSDK/AgUiAgentConfig.swift +++ b/Sources/AGUIAgentSDK/AgUiAgentConfig.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUIClient import AGUICore diff --git a/Sources/AGUIAgentSDK/AgentBuilders.swift b/Sources/AGUIAgentSDK/AgentBuilders.swift index a46807b..e1d77a3 100644 --- a/Sources/AGUIAgentSDK/AgentBuilders.swift +++ b/Sources/AGUIAgentSDK/AgentBuilders.swift @@ -1,140 +1,120 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import AGUITools import Foundation -/// Convenience factory functions for creating pre-configured AG-UI agents. +/// Convenience factory methods for creating pre-configured AG-UI agents. /// -/// These free functions mirror the `AgentBuilders` pattern from the Kotlin SDK, -/// providing a clean one-liner API for the most common agent configurations. +/// `AgentBuilders` mirrors the `AgentBuilders` pattern from the Kotlin SDK, +/// providing clean one-liner factory calls for the most common agent configurations. /// /// ## Examples /// /// ```swift /// // Bearer-token authenticated agent -/// let agent = agentWithBearer(url: agentURL, token: "sk-…") +/// let agent = AgentBuilders.agentWithBearer(url: agentURL, token: "sk-…") /// /// // API-key authenticated agent -/// let agent = agentWithApiKey(url: agentURL, apiKey: "my-key") +/// let agent = AgentBuilders.agentWithApiKey(url: agentURL, apiKey: "my-key") /// /// // Agent with custom tool registry -/// let agent = agentWithTools(url: agentURL, registry: myRegistry) +/// let agent = AgentBuilders.agentWithTools(url: agentURL, registry: myRegistry) /// /// // Stateful chat agent with a system prompt -/// let agent = chatAgent(url: agentURL, systemPrompt: "You are a helpful assistant.") +/// let agent = AgentBuilders.chatAgent(url: agentURL, systemPrompt: "You are a helpful assistant.") /// /// // Stateful agent with pre-seeded JSON state -/// let agent = statefulAgent(url: agentURL, initialState: Data("{\"mode\":\"creative\"}".utf8)) +/// let agent = AgentBuilders.statefulAgent(url: agentURL, initialState: Data("{\"mode\":\"creative\"}".utf8)) /// /// // Debug agent that logs verbose pipeline output -/// let agent = debugAgent(url: agentURL) +/// let agent = AgentBuilders.debugAgent(url: agentURL) /// ``` +public enum AgentBuilders { -// MARK: - Stateless agents + // MARK: - Stateless agents -/// Creates a stateless ``AgUiAgent`` authenticated with a Bearer token. -/// -/// The token is sent as `Authorization: Bearer ` on every request. -/// -/// - Parameters: -/// - url: Base URL of the AG-UI agent server. -/// - token: The Bearer token string. -/// - Returns: A configured ``AgUiAgent``. -public func agentWithBearer(url: URL, token: String) -> AgUiAgent { - AgUiAgent(url: url) { config in - config.bearerToken = token + /// Creates a stateless ``AgUiAgent`` authenticated with a Bearer token. + /// + /// The token is sent as `Authorization: Bearer ` on every request. + /// + /// - Parameters: + /// - url: Base URL of the AG-UI agent server. + /// - token: The Bearer token string. + /// - Returns: A configured ``AgUiAgent``. + public static func agentWithBearer(url: URL, token: String) -> AgUiAgent { + AgUiAgent(url: url) { config in + config.bearerToken = token + } } -} -/// Creates a stateless ``AgUiAgent`` authenticated with an API key. -/// -/// - Parameters: -/// - url: Base URL of the AG-UI agent server. -/// - apiKey: The API key value. -/// - header: The HTTP header name (default: `"X-API-Key"`). -/// - Returns: A configured ``AgUiAgent``. -public func agentWithApiKey(url: URL, apiKey: String, header: String = "X-API-Key") -> AgUiAgent { - AgUiAgent(url: url) { config in - config.apiKey = apiKey - config.apiKeyHeader = header + /// Creates a stateless ``AgUiAgent`` authenticated with an API key. + /// + /// - Parameters: + /// - url: Base URL of the AG-UI agent server. + /// - apiKey: The API key value. + /// - header: The HTTP header name (default: `"X-API-Key"`). + /// - Returns: A configured ``AgUiAgent``. + public static func agentWithApiKey(url: URL, apiKey: String, header: String = "X-API-Key") -> AgUiAgent { + AgUiAgent(url: url) { config in + config.apiKey = apiKey + config.apiKeyHeader = header + } } -} -/// Creates a stateless ``AgUiAgent`` backed by a tool registry. -/// -/// Tool definitions are included in every `RunAgentInput` and tool calls from -/// the agent are executed automatically via ``ToolExecutionManager``. -/// -/// - Parameters: -/// - url: Base URL of the AG-UI agent server. -/// - registry: The tool registry to use. -/// - Returns: A configured ``AgUiAgent``. -public func agentWithTools(url: URL, registry: any ToolRegistry) -> AgUiAgent { - AgUiAgent(url: url) { config in - config.toolRegistry = registry + /// Creates a stateless ``AgUiAgent`` backed by a tool registry. + /// + /// Tool definitions are included in every `RunAgentInput` and tool calls from + /// the agent are executed automatically via ``ToolExecutionManager``. + /// + /// - Parameters: + /// - url: Base URL of the AG-UI agent server. + /// - registry: The tool registry to use. + /// - Returns: A configured ``AgUiAgent``. + public static func agentWithTools(url: URL, registry: any ToolRegistry) -> AgUiAgent { + AgUiAgent(url: url) { config in + config.toolRegistry = registry + } } -} -/// Creates a stateless ``AgUiAgent`` with verbose pipeline logging enabled. -/// -/// - Parameter url: Base URL of the AG-UI agent server. -/// - Returns: A configured ``AgUiAgent`` with `debug = true`. -public func debugAgent(url: URL) -> AgUiAgent { - AgUiAgent(url: url) { config in - config.debug = true + /// Creates a stateless ``AgUiAgent`` with verbose pipeline logging enabled. + /// + /// - Parameter url: Base URL of the AG-UI agent server. + /// - Returns: A configured ``AgUiAgent`` with `debug = true`. + public static func debugAgent(url: URL) -> AgUiAgent { + AgUiAgent(url: url) { config in + config.debug = true + } } -} -// MARK: - Stateful agents + // MARK: - Stateful agents -/// Creates a ``StatefulAgUiAgent`` with a pre-configured system prompt. -/// -/// The system prompt is prepended to every new thread's conversation history. -/// -/// - Parameters: -/// - url: Base URL of the AG-UI agent server. -/// - systemPrompt: The system prompt text. -/// - Returns: A configured ``StatefulAgUiAgent``. -public func chatAgent(url: URL, systemPrompt: String) -> StatefulAgUiAgent { - var config = StatefulAgUiAgentConfig(baseURL: url) - config.systemPrompt = systemPrompt - return StatefulAgUiAgent(configuration: config) -} + /// Creates a ``StatefulAgUiAgent`` with a pre-configured system prompt. + /// + /// The system prompt is prepended to every new thread's conversation history. + /// + /// - Parameters: + /// - url: Base URL of the AG-UI agent server. + /// - systemPrompt: The system prompt text. + /// - Returns: A configured ``StatefulAgUiAgent``. + public static func chatAgent(url: URL, systemPrompt: String) -> StatefulAgUiAgent { + var config = StatefulAgUiAgentConfig(baseURL: url) + config.systemPrompt = systemPrompt + return StatefulAgUiAgent(configuration: config) + } -/// Creates a ``StatefulAgUiAgent`` with pre-seeded JSON state. -/// -/// The initial state is sent on the first run and then updated by state events -/// from the agent server. -/// -/// - Parameters: -/// - url: Base URL of the AG-UI agent server. -/// - initialState: The initial JSON state as `Data`. -/// - Returns: A configured ``StatefulAgUiAgent``. -public func statefulAgent(url: URL, initialState: State) -> StatefulAgUiAgent { - var config = StatefulAgUiAgentConfig(baseURL: url) - config.initialState = initialState - return StatefulAgUiAgent(configuration: config) + /// Creates a ``StatefulAgUiAgent`` with pre-seeded JSON state. + /// + /// The initial state is sent on the first run and then updated by state events + /// from the agent server. + /// + /// - Parameters: + /// - url: Base URL of the AG-UI agent server. + /// - initialState: The initial JSON state as `Data`. + /// - Returns: A configured ``StatefulAgUiAgent``. + public static func statefulAgent(url: URL, initialState: State) -> StatefulAgUiAgent { + var config = StatefulAgUiAgentConfig(baseURL: url) + config.initialState = initialState + return StatefulAgUiAgent(configuration: config) + } } diff --git a/Sources/AGUIAgentSDK/AgentMessage.swift b/Sources/AGUIAgentSDK/AgentMessage.swift index e9e1949..d9c7152 100644 --- a/Sources/AGUIAgentSDK/AgentMessage.swift +++ b/Sources/AGUIAgentSDK/AgentMessage.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUIAgentSDK/AgentViewModel.swift b/Sources/AGUIAgentSDK/AgentViewModel.swift index f2db651..78861a3 100644 --- a/Sources/AGUIAgentSDK/AgentViewModel.swift +++ b/Sources/AGUIAgentSDK/AgentViewModel.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. // Observation framework is available from iOS 17 / macOS 14. // The #if canImport guard prevents import failures when compiling against diff --git a/Sources/AGUIAgentSDK/AgentViewModelCompat.swift b/Sources/AGUIAgentSDK/AgentViewModelCompat.swift index c517177..f2fe3b0 100644 --- a/Sources/AGUIAgentSDK/AgentViewModelCompat.swift +++ b/Sources/AGUIAgentSDK/AgentViewModelCompat.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Combine diff --git a/Sources/AGUIAgentSDK/ChatAgent.swift b/Sources/AGUIAgentSDK/ChatAgent.swift index c6b55f1..77d7e2d 100644 --- a/Sources/AGUIAgentSDK/ChatAgent.swift +++ b/Sources/AGUIAgentSDK/ChatAgent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUIAgentSDK/ConversationHistoryManager.swift b/Sources/AGUIAgentSDK/ConversationHistoryManager.swift index a1d32b8..6313849 100644 --- a/Sources/AGUIAgentSDK/ConversationHistoryManager.swift +++ b/Sources/AGUIAgentSDK/ConversationHistoryManager.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUIAgentSDK/StatefulAgUiAgent.swift b/Sources/AGUIAgentSDK/StatefulAgUiAgent.swift index bc9bf19..bbd2f05 100644 --- a/Sources/AGUIAgentSDK/StatefulAgUiAgent.swift +++ b/Sources/AGUIAgentSDK/StatefulAgUiAgent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUIClient import AGUICore diff --git a/Sources/AGUIAgentSDK/StatefulAgUiAgentConfig.swift b/Sources/AGUIAgentSDK/StatefulAgUiAgentConfig.swift index 72be929..fcfe7c4 100644 --- a/Sources/AGUIAgentSDK/StatefulAgUiAgentConfig.swift +++ b/Sources/AGUIAgentSDK/StatefulAgUiAgentConfig.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUIClient import AGUICore diff --git a/Sources/AGUIAgentSDK/Tools/ClientToolResponseHandler.swift b/Sources/AGUIAgentSDK/Tools/ClientToolResponseHandler.swift index cd154aa..c970599 100644 --- a/Sources/AGUIAgentSDK/Tools/ClientToolResponseHandler.swift +++ b/Sources/AGUIAgentSDK/Tools/ClientToolResponseHandler.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUIClient import AGUICore diff --git a/Sources/AGUIClient/AGUIClient.swift b/Sources/AGUIClient/AGUIClient.swift index abf7cea..45d1368 100644 --- a/Sources/AGUIClient/AGUIClient.swift +++ b/Sources/AGUIClient/AGUIClient.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUIClient/AbstractAgent.swift b/Sources/AGUIClient/AbstractAgent.swift index 0891a38..f885029 100644 --- a/Sources/AGUIClient/AbstractAgent.swift +++ b/Sources/AGUIClient/AbstractAgent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation @@ -32,7 +10,6 @@ internal actor AgentStorage { var currentState: State = Data("{}".utf8) var rawEvents: [RawEvent] = [] var customEvents: [CustomEvent] = [] - var thinking: ThinkingTelemetryState? var currentTask: Task? var isDisposed: Bool = false } @@ -42,7 +19,6 @@ internal actor AgentStorage { internal extension AgentStorage { func setMessages(_ messages: [any Message]) { self.messages = messages } func setState(_ state: State) { self.currentState = state } - func setThinking(_ thinking: ThinkingTelemetryState?) { self.thinking = thinking } func setRawEvents(_ rawEvents: [RawEvent]) { self.rawEvents = rawEvents } func setCustomEvents(_ customEvents: [CustomEvent]) { self.customEvents = customEvents } func setCurrentTask(_ task: Task?) { self.currentTask = task } @@ -85,8 +61,6 @@ public final class AbstractAgent: Sendable { public var customEvents: [CustomEvent] { get async { await storage.customEvents } } - public var thinking: ThinkingTelemetryState? { get async { await storage.thinking } } - // MARK: - Run method public func run(input: RunAgentInput) -> AsyncThrowingStream { @@ -216,9 +190,6 @@ public final class AbstractAgent: Sendable { let params = AgentStateChangedParams(messages: msgs, state: state, input: input) for sub in subscribers { await sub.onStateChanged(params: params) } } - if let thinking = agentState.thinking { - await storage.setThinking(thinking) - } if let rawEvents = agentState.rawEvents { await storage.setRawEvents(rawEvents) } diff --git a/Sources/AGUIClient/Errors/ClientError.swift b/Sources/AGUIClient/Errors/ClientError.swift index 99cab2e..992fda4 100644 --- a/Sources/AGUIClient/Errors/ClientError.swift +++ b/Sources/AGUIClient/Errors/ClientError.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUIClient/HttpAgent.swift b/Sources/AGUIClient/HttpAgent.swift index 0813af6..a930ad5 100644 --- a/Sources/AGUIClient/HttpAgent.swift +++ b/Sources/AGUIClient/HttpAgent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation @@ -105,7 +83,6 @@ public final class HttpAgent: Sendable { public var state: State { get async { await abstractAgent.state } } public var rawEvents: [RawEvent] { get async { await abstractAgent.rawEvents } } public var customEvents: [CustomEvent] { get async { await abstractAgent.customEvents } } - public var thinking: ThinkingTelemetryState? { get async { await abstractAgent.thinking } } public func abortRun() async { await abstractAgent.abortRun() diff --git a/Sources/AGUIClient/RunAgentParameters.swift b/Sources/AGUIClient/RunAgentParameters.swift index afc0a7a..44f76c5 100644 --- a/Sources/AGUIClient/RunAgentParameters.swift +++ b/Sources/AGUIClient/RunAgentParameters.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUIClient/State/AgentState.swift b/Sources/AGUIClient/State/AgentState.swift index 688fc9f..fafce4f 100644 --- a/Sources/AGUIClient/State/AgentState.swift +++ b/Sources/AGUIClient/State/AgentState.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation @@ -35,8 +13,6 @@ import Foundation public struct AgentState: Sendable { /// Updated message list, or `nil` if messages did not change. public var messages: [any Message]? - /// Updated thinking state, or `nil` if thinking state did not change. - public var thinking: ThinkingTelemetryState? /// Updated JSON state, or `nil` if state did not change. public var state: State? /// Updated raw events list, or `nil` if raw events did not change. @@ -46,13 +22,11 @@ public struct AgentState: Sendable { public init( messages: [any Message]? = nil, - thinking: ThinkingTelemetryState? = nil, state: State? = nil, rawEvents: [RawEvent]? = nil, customEvents: [CustomEvent]? = nil ) { self.messages = messages - self.thinking = thinking self.state = state self.rawEvents = rawEvents self.customEvents = customEvents diff --git a/Sources/AGUIClient/State/DefaultApplyEvents.swift b/Sources/AGUIClient/State/DefaultApplyEvents.swift index 5cd35ab..55f9be8 100644 --- a/Sources/AGUIClient/State/DefaultApplyEvents.swift +++ b/Sources/AGUIClient/State/DefaultApplyEvents.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation @@ -65,10 +43,6 @@ extension AsyncSequence where Element == any AGUIEvent { var currentState: State = input.state var rawEvents: [RawEvent] = [] var customEvents: [CustomEvent] = [] - var thinkingActive: Bool = false - var thinkingTitle: String? = nil - var thinkingMessages: [String] = [] - var thinkingBuffer: String? = nil var initialMessagesEmitted: Bool = false do { @@ -82,13 +56,8 @@ extension AsyncSequence where Element == any AGUIEvent { } switch event { - case let e as RunStartedEvent: - _ = e - // Reset thinking state on new run - thinkingActive = false - thinkingTitle = nil - thinkingMessages = [] - thinkingBuffer = nil + case is RunStartedEvent: + break case let e as TextMessageStartEvent: let newMessage = AssistantMessage(id: e.messageId, content: "") @@ -189,51 +158,6 @@ extension AsyncSequence where Element == any AGUIEvent { customEvents.append(e) continuation.yield(AgentState(customEvents: customEvents)) - case let e as ThinkingStartEvent: - thinkingActive = true - thinkingTitle = e.title - continuation.yield(AgentState( - thinking: ThinkingTelemetryState( - isThinking: true, - title: thinkingTitle, - messages: thinkingMessages - ) - )) - - case is ThinkingEndEvent: - // Finalize any in-progress buffer - if let buffer = thinkingBuffer { - thinkingMessages.append(buffer) - thinkingBuffer = nil - } - thinkingActive = false - continuation.yield(AgentState( - thinking: ThinkingTelemetryState( - isThinking: false, - title: thinkingTitle, - messages: thinkingMessages - ) - )) - - case is ThinkingTextMessageStartEvent: - thinkingBuffer = "" - - case let e as ThinkingTextMessageContentEvent: - thinkingBuffer = (thinkingBuffer ?? "") + e.delta - - case is ThinkingTextMessageEndEvent: - if let buffer = thinkingBuffer { - thinkingMessages.append(buffer) - thinkingBuffer = nil - continuation.yield(AgentState( - thinking: ThinkingTelemetryState( - isThinking: thinkingActive, - title: thinkingTitle, - messages: thinkingMessages - ) - )) - } - default: break } diff --git a/Sources/AGUIClient/State/PatchApplicator.swift b/Sources/AGUIClient/State/PatchApplicator.swift index 409ed65..6bb429b 100644 --- a/Sources/AGUIClient/State/PatchApplicator.swift +++ b/Sources/AGUIClient/State/PatchApplicator.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUIClient/State/StateManager.swift b/Sources/AGUIClient/State/StateManager.swift index 66c9f16..d05ccc9 100644 --- a/Sources/AGUIClient/State/StateManager.swift +++ b/Sources/AGUIClient/State/StateManager.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUIClient/State/ThinkingTelemetryState.swift b/Sources/AGUIClient/State/ThinkingTelemetryState.swift deleted file mode 100644 index cbf148b..0000000 --- a/Sources/AGUIClient/State/ThinkingTelemetryState.swift +++ /dev/null @@ -1,44 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -/// Tracks the current thinking/reasoning state of the agent. -/// -/// Used by the state pipeline to represent incremental changes to the agent's -/// internal thought process when thinking events are received. -public struct ThinkingTelemetryState: Sendable { - /// Whether the agent is currently actively thinking. - public var isThinking: Bool - /// Optional title or description for the current thinking step. - public var title: String? - /// Completed thinking text segments, in order of completion. - public var messages: [String] - - public init(isThinking: Bool = false, title: String? = nil, messages: [String] = []) { - self.isThinking = isThinking - self.title = title - self.messages = messages - } -} diff --git a/Sources/AGUIClient/Streaming/AsyncSequence+Buffering.swift b/Sources/AGUIClient/Streaming/AsyncSequence+Buffering.swift index c2bb1ca..2bfbdcf 100644 --- a/Sources/AGUIClient/Streaming/AsyncSequence+Buffering.swift +++ b/Sources/AGUIClient/Streaming/AsyncSequence+Buffering.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUIClient/Streaming/BufferingStrategy.swift b/Sources/AGUIClient/Streaming/BufferingStrategy.swift index 34051b8..5a0d76b 100644 --- a/Sources/AGUIClient/Streaming/BufferingStrategy.swift +++ b/Sources/AGUIClient/Streaming/BufferingStrategy.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUIClient/Streaming/ChunkTransformer.swift b/Sources/AGUIClient/Streaming/ChunkTransformer.swift index db6e6a2..8441840 100644 --- a/Sources/AGUIClient/Streaming/ChunkTransformer.swift +++ b/Sources/AGUIClient/Streaming/ChunkTransformer.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUIClient/Streaming/EventStream.swift b/Sources/AGUIClient/Streaming/EventStream.swift index f1ba3cb..48c6e2a 100644 --- a/Sources/AGUIClient/Streaming/EventStream.swift +++ b/Sources/AGUIClient/Streaming/EventStream.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUIClient/Streaming/EventVerifier.swift b/Sources/AGUIClient/Streaming/EventVerifier.swift index 0eba0c7..2e8ca77 100644 --- a/Sources/AGUIClient/Streaming/EventVerifier.swift +++ b/Sources/AGUIClient/Streaming/EventVerifier.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation @@ -51,8 +29,6 @@ private final class EventVerifier { var activeMessages: [String: Bool] = [:] var activeToolCalls: [String: Bool] = [:] var activeSteps: [String: Bool] = [:] - var activeThinkingStep: Bool = false - var activeThinkingMessage: Bool = false let debug: Bool @@ -70,8 +46,6 @@ private final class EventVerifier { activeMessages.removeAll() activeToolCalls.removeAll() activeSteps.removeAll() - activeThinkingStep = false - activeThinkingMessage = false runFinished = false } runStarted = true @@ -176,30 +150,6 @@ private final class EventVerifier { } activeSteps.removeValue(forKey: name) - case is ThinkingStartEvent: - activeThinkingStep = true - - case is ThinkingEndEvent: - activeThinkingStep = false - activeThinkingMessage = false - - case is ThinkingTextMessageStartEvent: - guard activeThinkingStep else { - throw AGUIProtocolError(message: "No active thinking step found") - } - activeThinkingMessage = true - - case is ThinkingTextMessageContentEvent: - guard activeThinkingStep else { - throw AGUIProtocolError(message: "No active thinking step found") - } - - case is ThinkingTextMessageEndEvent: - guard activeThinkingStep else { - throw AGUIProtocolError(message: "No active thinking step found") - } - activeThinkingMessage = false - case is RunFinishedEvent: if !activeMessages.isEmpty { throw AGUIProtocolError( diff --git a/Sources/AGUIClient/Streaming/SseEvent.swift b/Sources/AGUIClient/Streaming/SseEvent.swift index 5ed5d06..4eff1da 100644 --- a/Sources/AGUIClient/Streaming/SseEvent.swift +++ b/Sources/AGUIClient/Streaming/SseEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUIClient/Streaming/SseParser.swift b/Sources/AGUIClient/Streaming/SseParser.swift index 1e38d5c..82358ed 100644 --- a/Sources/AGUIClient/Streaming/SseParser.swift +++ b/Sources/AGUIClient/Streaming/SseParser.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation @@ -74,6 +52,14 @@ import Foundation /// /// SSE specification: https://html.spec.whatwg.org/multipage/server-sent-events.html public struct SseParser { + /// Maximum number of UTF-8 bytes the internal buffer may hold. + /// + /// If a stream sends data faster than complete events arrive — or sends a + /// pathologically large payload without a double-newline terminator — the + /// buffer is reset and parsing continues with the next chunk. This prevents + /// unbounded memory growth from malformed or malicious streams. + public static let maxBufferByteCount = 10 * 1_048_576 // 10 MB + /// Internal buffer for incomplete events. private var buffer: String = "" @@ -116,6 +102,12 @@ public struct SseParser { .replacingOccurrences(of: "\r", with: "\n") buffer += normalized + // Guard against unbounded buffer growth from malformed/malicious streams. + guard buffer.utf8.count <= Self.maxBufferByteCount else { + buffer = "" + return [] + } + var events: [SseEvent] = [] // Split on double newline (event separator — handles \n\n after normalization) diff --git a/Sources/AGUIClient/Subscriber/AgentSubscriber.swift b/Sources/AGUIClient/Subscriber/AgentSubscriber.swift index 0f8d7a0..014b17e 100644 --- a/Sources/AGUIClient/Subscriber/AgentSubscriber.swift +++ b/Sources/AGUIClient/Subscriber/AgentSubscriber.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUIClient/Subscriber/SubscriberManager.swift b/Sources/AGUIClient/Subscriber/SubscriberManager.swift index 4e206c5..65500e4 100644 --- a/Sources/AGUIClient/Subscriber/SubscriberManager.swift +++ b/Sources/AGUIClient/Subscriber/SubscriberManager.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUIClient/Transport/AgentTransport.swift b/Sources/AGUIClient/Transport/AgentTransport.swift index 8f64993..ca97c70 100644 --- a/Sources/AGUIClient/Transport/AgentTransport.swift +++ b/Sources/AGUIClient/Transport/AgentTransport.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUIClient/Transport/HTTPClient.swift b/Sources/AGUIClient/Transport/HTTPClient.swift index 509e32e..8d85957 100644 --- a/Sources/AGUIClient/Transport/HTTPClient.swift +++ b/Sources/AGUIClient/Transport/HTTPClient.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUIClient/Transport/HttpAgentConfiguration.swift b/Sources/AGUIClient/Transport/HttpAgentConfiguration.swift index c12ab1e..5266855 100644 --- a/Sources/AGUIClient/Transport/HttpAgentConfiguration.swift +++ b/Sources/AGUIClient/Transport/HttpAgentConfiguration.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUIClient/Transport/HttpAgentTransport.swift b/Sources/AGUIClient/Transport/HttpAgentTransport.swift index 0cc71ba..487a75e 100644 --- a/Sources/AGUIClient/Transport/HttpAgentTransport.swift +++ b/Sources/AGUIClient/Transport/HttpAgentTransport.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUIClient/Transport/HttpTransport.swift b/Sources/AGUIClient/Transport/HttpTransport.swift index 3eba36f..b00f784 100644 --- a/Sources/AGUIClient/Transport/HttpTransport.swift +++ b/Sources/AGUIClient/Transport/HttpTransport.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUIClient/Transport/URLSessionHTTPClient.swift b/Sources/AGUIClient/Transport/URLSessionHTTPClient.swift index 829ca7c..33896eb 100644 --- a/Sources/AGUIClient/Transport/URLSessionHTTPClient.swift +++ b/Sources/AGUIClient/Transport/URLSessionHTTPClient.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/AGUICore.swift b/Sources/AGUICore/AGUICore.swift index 5dba813..11cb377 100644 --- a/Sources/AGUICore/AGUICore.swift +++ b/Sources/AGUICore/AGUICore.swift @@ -1,37 +1 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -/// AGUICore provides core functionality for the AGUI Swift package -public struct AGUICore { - public static let version = "1.0.0" - - public init() {} - - /// Core functionality example - public func coreFunction() -> String { - "AGUICore is working" - } -} +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. diff --git a/Sources/AGUICore/Decoding/AGUIEventDecoder.swift b/Sources/AGUICore/Decoding/AGUIEventDecoder.swift index b2be905..c8a665e 100644 --- a/Sources/AGUICore/Decoding/AGUIEventDecoder.swift +++ b/Sources/AGUICore/Decoding/AGUIEventDecoder.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation @@ -246,6 +224,15 @@ public struct AGUIEventDecoder: Sendable { let disc = try decodeTypeDiscriminator(from: data, decoder: decoder) + // Transparent backward compat: remap legacy THINKING_* wire events to REASONING_*, + // mirroring the TypeScript SDK's BackwardCompatibility_0_0_45 middleware. + if let (remappedData, remappedType) = Self.remapThinkingEvent(data: data, typeRaw: disc.typeRaw) { + guard let handler = registry[remappedType] else { + return try handleMissingHandler(for: remappedType, typeRaw: disc.typeRaw, rawEvent: data) + } + return try executeHandler(handler, data: remappedData, decoder: decoder) + } + guard let type = EventType(rawValue: disc.typeRaw) else { return try handleUnknownEventType(typeRaw: disc.typeRaw, rawEvent: data) } @@ -257,6 +244,51 @@ public struct AGUIEventDecoder: Sendable { return try executeHandler(handler, data: data, decoder: decoder) } + /// Rewrites a legacy `THINKING_*` wire event to its `REASONING_*` equivalent. + /// + /// Agents built against protocol versions prior to 0.0.46 emit `THINKING_*` events. + /// Rather than keeping deprecated event types in the public API, the decoder silently + /// upgrades them — matching how the TypeScript SDK's `BackwardCompatibility_0_0_45` + /// middleware handles the same transition. + /// + /// IDs are generated fresh per-event; the caller should not rely on cross-event ID + /// correlation for events originating from a `THINKING_*` stream. + /// + /// - Parameters: + /// - data: Raw JSON bytes from the SSE stream. + /// - typeRaw: The `"type"` discriminator string already extracted from `data`. + /// - Returns: Rewritten JSON + the target `EventType`, or `nil` if no remapping is needed. + private static func remapThinkingEvent(data: Data, typeRaw: String) -> (Data, EventType)? { + // Wire string → (target EventType, extra fields to inject) + let mapping: [String: (EventType, [String: Any])] = [ + "THINKING_START": (.reasoningStart, ["messageId": UUID().uuidString]), + "THINKING_END": (.reasoningEnd, ["messageId": UUID().uuidString]), + "THINKING_TEXT_MESSAGE_START": (.reasoningMessageStart, [ + "messageId": UUID().uuidString, + "role": "assistant", + ]), + "THINKING_TEXT_MESSAGE_CONTENT": (.reasoningMessageContent, ["messageId": UUID().uuidString]), + "THINKING_TEXT_MESSAGE_END": (.reasoningMessageEnd, ["messageId": UUID().uuidString]), + ] + + guard let (targetType, extraFields) = mapping[typeRaw] else { return nil } + + guard var jsonObject = try? JSONSerialization.jsonObject(with: data) as? [String: Any] else { + return nil + } + + jsonObject["type"] = targetType.rawValue + for (key, value) in extraFields { + jsonObject[key] = value + } + + guard let remappedData = try? JSONSerialization.data(withJSONObject: jsonObject) else { + return nil + } + + return (remappedData, targetType) + } + private func decodeTypeDiscriminator(from data: Data, decoder: JSONDecoder) throws -> TypeDiscriminator { do { return try decoder.decode(TypeDiscriminator.self, from: data) @@ -333,7 +365,6 @@ public struct AGUIEventDecoder: Sendable { ToolCallEventRegistry.registry(), StateEventRegistry.registry(), SpecialEventRegistry.registry(), - ThinkingEventRegistry.registry(), ReasoningEventRegistry.registry(), ActivityEventRegistry.registry() ) diff --git a/Sources/AGUICore/Decoding/EventDTO/ActivityEventsDTO/ActivityDeltaEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ActivityEventsDTO/ActivityDeltaEventDTO.swift index ca9ccc7..4f2a7f4 100644 --- a/Sources/AGUICore/Decoding/EventDTO/ActivityEventsDTO/ActivityDeltaEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/ActivityEventsDTO/ActivityDeltaEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/ActivityEventsDTO/ActivitySnapshotEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ActivityEventsDTO/ActivitySnapshotEventDTO.swift index 35484eb..3799e33 100644 --- a/Sources/AGUICore/Decoding/EventDTO/ActivityEventsDTO/ActivitySnapshotEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/ActivityEventsDTO/ActivitySnapshotEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/EventDecodingHelpers.swift b/Sources/AGUICore/Decoding/EventDTO/EventDecodingHelpers.swift index 3abc567..cde8433 100644 --- a/Sources/AGUICore/Decoding/EventDTO/EventDecodingHelpers.swift +++ b/Sources/AGUICore/Decoding/EventDTO/EventDecodingHelpers.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/RunErrorEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/RunErrorEventDTO.swift index 0216e6a..43d47ed 100644 --- a/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/RunErrorEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/RunErrorEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/RunFinishedEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/RunFinishedEventDTO.swift index 0ac056b..0b42ec0 100644 --- a/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/RunFinishedEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/RunFinishedEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/RunStartedEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/RunStartedEventDTO.swift index 62a149a..b873ad2 100644 --- a/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/RunStartedEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/RunStartedEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/StepFinishedEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/StepFinishedEventDTO.swift index 4116b1b..df593e7 100644 --- a/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/StepFinishedEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/StepFinishedEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/StepStartedEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/StepStartedEventDTO.swift index c3fcb9d..00085ca 100644 --- a/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/StepStartedEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/LifeCycleEventsDTO/StepStartedEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningEncryptedValueEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningEncryptedValueEventDTO.swift index f5282fc..dcae98c 100644 --- a/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningEncryptedValueEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningEncryptedValueEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningEndEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningEndEventDTO.swift index 7aa9db5..9e5f82a 100644 --- a/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningEndEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningEndEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningMessageChunkEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningMessageChunkEventDTO.swift index cbbe572..673e3d2 100644 --- a/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningMessageChunkEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningMessageChunkEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningMessageContentEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningMessageContentEventDTO.swift index 0bde251..8aff30b 100644 --- a/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningMessageContentEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningMessageContentEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningMessageEndEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningMessageEndEventDTO.swift index 2afa041..907a84f 100644 --- a/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningMessageEndEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningMessageEndEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningMessageStartEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningMessageStartEventDTO.swift index 74348b6..e156511 100644 --- a/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningMessageStartEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningMessageStartEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningStartEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningStartEventDTO.swift index dc1a7dc..7380566 100644 --- a/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningStartEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/ReasoningEventsDTO/ReasoningStartEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/SpecialEventsDTO/CustomEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/SpecialEventsDTO/CustomEventDTO.swift index 3010586..31e52b5 100644 --- a/Sources/AGUICore/Decoding/EventDTO/SpecialEventsDTO/CustomEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/SpecialEventsDTO/CustomEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/SpecialEventsDTO/RawEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/SpecialEventsDTO/RawEventDTO.swift index 04436fe..a49fdd0 100644 --- a/Sources/AGUICore/Decoding/EventDTO/SpecialEventsDTO/RawEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/SpecialEventsDTO/RawEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/MessagesSnapshotEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/MessagesSnapshotEventDTO.swift index f94e97a..c30c59c 100644 --- a/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/MessagesSnapshotEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/MessagesSnapshotEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/StateDeltaEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/StateDeltaEventDTO.swift index e760162..4435ae6 100644 --- a/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/StateDeltaEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/StateDeltaEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/StateSnapshotEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/StateSnapshotEventDTO.swift index 25be093..0272abd 100644 --- a/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/StateSnapshotEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/StateEventsDTO/StateSnapshotEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/TextMessageEventsDTO/TextMessageChunkEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/TextMessageEventsDTO/TextMessageChunkEventDTO.swift index 2cc6a45..4ea83be 100644 --- a/Sources/AGUICore/Decoding/EventDTO/TextMessageEventsDTO/TextMessageChunkEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/TextMessageEventsDTO/TextMessageChunkEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/TextMessageEventsDTO/TextMessageEndEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/TextMessageEventsDTO/TextMessageEndEventDTO.swift index 1ee6b9e..5950ad7 100644 --- a/Sources/AGUICore/Decoding/EventDTO/TextMessageEventsDTO/TextMessageEndEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/TextMessageEventsDTO/TextMessageEndEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingEndEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingEndEventDTO.swift deleted file mode 100644 index 3328b7e..0000000 --- a/Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingEndEventDTO.swift +++ /dev/null @@ -1,33 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -struct ThinkingEndEventDTO: Decodable { - let timestamp: Int64? - - func toDomain(rawEvent: Data? = nil) -> ThinkingEndEvent { - ThinkingEndEvent(timestamp: timestamp, rawEvent: rawEvent) - } -} diff --git a/Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingStartEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingStartEventDTO.swift deleted file mode 100644 index 502c848..0000000 --- a/Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingStartEventDTO.swift +++ /dev/null @@ -1,34 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -struct ThinkingStartEventDTO: Decodable { - let title: String? - let timestamp: Int64? - - func toDomain(rawEvent: Data? = nil) -> ThinkingStartEvent { - ThinkingStartEvent(title: title, timestamp: timestamp, rawEvent: rawEvent) - } -} diff --git a/Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingTextMessageContentEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingTextMessageContentEventDTO.swift deleted file mode 100644 index 00e652e..0000000 --- a/Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingTextMessageContentEventDTO.swift +++ /dev/null @@ -1,38 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -struct ThinkingTextMessageContentEventDTO: Decodable { - let delta: String - let timestamp: Int64? - - func toDomain(rawEvent: Data? = nil) -> ThinkingTextMessageContentEvent { - ThinkingTextMessageContentEvent( - delta: delta, - timestamp: timestamp, - rawEvent: rawEvent - ) - } -} diff --git a/Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingTextMessageEndEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingTextMessageEndEventDTO.swift deleted file mode 100644 index 2416ced..0000000 --- a/Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingTextMessageEndEventDTO.swift +++ /dev/null @@ -1,33 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -struct ThinkingTextMessageEndEventDTO: Decodable { - let timestamp: Int64? - - func toDomain(rawEvent: Data? = nil) -> ThinkingTextMessageEndEvent { - ThinkingTextMessageEndEvent(timestamp: timestamp, rawEvent: rawEvent) - } -} diff --git a/Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingTextMessageStartEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingTextMessageStartEventDTO.swift deleted file mode 100644 index f7d5437..0000000 --- a/Sources/AGUICore/Decoding/EventDTO/ThinkingEventsDTO/ThinkingTextMessageStartEventDTO.swift +++ /dev/null @@ -1,33 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -struct ThinkingTextMessageStartEventDTO: Decodable { - let timestamp: Int64? - - func toDomain(rawEvent: Data? = nil) -> ThinkingTextMessageStartEvent { - ThinkingTextMessageStartEvent(timestamp: timestamp, rawEvent: rawEvent) - } -} diff --git a/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallChunkEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallChunkEventDTO.swift index 24ab214..8c0fdc7 100644 --- a/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallChunkEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallChunkEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallEndEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallEndEventDTO.swift index b4bcb47..ef41bfa 100644 --- a/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallEndEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallEndEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallResultEventDTO.swift b/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallResultEventDTO.swift index 1cd3bc7..9dfc239 100644 --- a/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallResultEventDTO.swift +++ b/Sources/AGUICore/Decoding/EventDTO/ToolCallEventsDTO/ToolCallResultEventDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDTO/TypeDiscriminator.swift b/Sources/AGUICore/Decoding/EventDTO/TypeDiscriminator.swift index 5877bd8..59ec582 100644 --- a/Sources/AGUICore/Decoding/EventDTO/TypeDiscriminator.swift +++ b/Sources/AGUICore/Decoding/EventDTO/TypeDiscriminator.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/EventDecodingError.swift b/Sources/AGUICore/Decoding/EventDecodingError.swift index d49c7f1..6fb1ebb 100644 --- a/Sources/AGUICore/Decoding/EventDecodingError.swift +++ b/Sources/AGUICore/Decoding/EventDecodingError.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/InputContentDTO/AudioInputContentDTO.swift b/Sources/AGUICore/Decoding/InputContentDTO/AudioInputContentDTO.swift index fc5b03a..790cfcc 100644 --- a/Sources/AGUICore/Decoding/InputContentDTO/AudioInputContentDTO.swift +++ b/Sources/AGUICore/Decoding/InputContentDTO/AudioInputContentDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/InputContentDTO/BinaryInputContentDTO.swift b/Sources/AGUICore/Decoding/InputContentDTO/BinaryInputContentDTO.swift index 7e86b7a..3d5a996 100644 --- a/Sources/AGUICore/Decoding/InputContentDTO/BinaryInputContentDTO.swift +++ b/Sources/AGUICore/Decoding/InputContentDTO/BinaryInputContentDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/InputContentDTO/DocumentInputContentDTO.swift b/Sources/AGUICore/Decoding/InputContentDTO/DocumentInputContentDTO.swift index cd5872b..f489890 100644 --- a/Sources/AGUICore/Decoding/InputContentDTO/DocumentInputContentDTO.swift +++ b/Sources/AGUICore/Decoding/InputContentDTO/DocumentInputContentDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/InputContentDTO/ImageInputContentDTO.swift b/Sources/AGUICore/Decoding/InputContentDTO/ImageInputContentDTO.swift index c7c0174..e422f04 100644 --- a/Sources/AGUICore/Decoding/InputContentDTO/ImageInputContentDTO.swift +++ b/Sources/AGUICore/Decoding/InputContentDTO/ImageInputContentDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/InputContentDTO/TextInputContentDTO.swift b/Sources/AGUICore/Decoding/InputContentDTO/TextInputContentDTO.swift index a3d237d..60a5ecb 100644 --- a/Sources/AGUICore/Decoding/InputContentDTO/TextInputContentDTO.swift +++ b/Sources/AGUICore/Decoding/InputContentDTO/TextInputContentDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/InputContentDTO/VideoInputContentDTO.swift b/Sources/AGUICore/Decoding/InputContentDTO/VideoInputContentDTO.swift index 62e9434..c4b9fff 100644 --- a/Sources/AGUICore/Decoding/InputContentDTO/VideoInputContentDTO.swift +++ b/Sources/AGUICore/Decoding/InputContentDTO/VideoInputContentDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/MessageDTO/ActivityMessageDTO.swift b/Sources/AGUICore/Decoding/MessageDTO/ActivityMessageDTO.swift index 9462e39..19d7ab9 100644 --- a/Sources/AGUICore/Decoding/MessageDTO/ActivityMessageDTO.swift +++ b/Sources/AGUICore/Decoding/MessageDTO/ActivityMessageDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/MessageDTO/MessageDecodingHelpers.swift b/Sources/AGUICore/Decoding/MessageDTO/MessageDecodingHelpers.swift index 8d286d0..cec7822 100644 --- a/Sources/AGUICore/Decoding/MessageDTO/MessageDecodingHelpers.swift +++ b/Sources/AGUICore/Decoding/MessageDTO/MessageDecodingHelpers.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/MessageDTO/ReasoningMessageDTO.swift b/Sources/AGUICore/Decoding/MessageDTO/ReasoningMessageDTO.swift index 4d0bbe0..b8d4f38 100644 --- a/Sources/AGUICore/Decoding/MessageDTO/ReasoningMessageDTO.swift +++ b/Sources/AGUICore/Decoding/MessageDTO/ReasoningMessageDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/MessageDTO/ToolMessageDTO.swift b/Sources/AGUICore/Decoding/MessageDTO/ToolMessageDTO.swift index 26ca910..8e9be97 100644 --- a/Sources/AGUICore/Decoding/MessageDTO/ToolMessageDTO.swift +++ b/Sources/AGUICore/Decoding/MessageDTO/ToolMessageDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/MessageDTO/UserMessageDTO.swift b/Sources/AGUICore/Decoding/MessageDTO/UserMessageDTO.swift index ce015aa..4e80a58 100644 --- a/Sources/AGUICore/Decoding/MessageDTO/UserMessageDTO.swift +++ b/Sources/AGUICore/Decoding/MessageDTO/UserMessageDTO.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/MessageDecoder.swift b/Sources/AGUICore/Decoding/MessageDecoder.swift index 149d79e..4583424 100644 --- a/Sources/AGUICore/Decoding/MessageDecoder.swift +++ b/Sources/AGUICore/Decoding/MessageDecoder.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/Registry/ActivityEventRegistry.swift b/Sources/AGUICore/Decoding/Registry/ActivityEventRegistry.swift index c766ab3..dfab18d 100644 --- a/Sources/AGUICore/Decoding/Registry/ActivityEventRegistry.swift +++ b/Sources/AGUICore/Decoding/Registry/ActivityEventRegistry.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/Registry/LifecycleEventRegistry.swift b/Sources/AGUICore/Decoding/Registry/LifecycleEventRegistry.swift index af7fd7e..555ee32 100644 --- a/Sources/AGUICore/Decoding/Registry/LifecycleEventRegistry.swift +++ b/Sources/AGUICore/Decoding/Registry/LifecycleEventRegistry.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/Registry/ReasoningEventRegistry.swift b/Sources/AGUICore/Decoding/Registry/ReasoningEventRegistry.swift index d66399f..f41a6fe 100644 --- a/Sources/AGUICore/Decoding/Registry/ReasoningEventRegistry.swift +++ b/Sources/AGUICore/Decoding/Registry/ReasoningEventRegistry.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/Registry/SpecialEventRegistry.swift b/Sources/AGUICore/Decoding/Registry/SpecialEventRegistry.swift index 1fde286..a7d1056 100644 --- a/Sources/AGUICore/Decoding/Registry/SpecialEventRegistry.swift +++ b/Sources/AGUICore/Decoding/Registry/SpecialEventRegistry.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/Registry/StateEventRegistry.swift b/Sources/AGUICore/Decoding/Registry/StateEventRegistry.swift index b43a46f..a242f2e 100644 --- a/Sources/AGUICore/Decoding/Registry/StateEventRegistry.swift +++ b/Sources/AGUICore/Decoding/Registry/StateEventRegistry.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/Registry/TextMessageEventRegistry.swift b/Sources/AGUICore/Decoding/Registry/TextMessageEventRegistry.swift index edd3d3d..901eeaf 100644 --- a/Sources/AGUICore/Decoding/Registry/TextMessageEventRegistry.swift +++ b/Sources/AGUICore/Decoding/Registry/TextMessageEventRegistry.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/Registry/ThinkingEventRegistry.swift b/Sources/AGUICore/Decoding/Registry/ThinkingEventRegistry.swift deleted file mode 100644 index 2318ff9..0000000 --- a/Sources/AGUICore/Decoding/Registry/ThinkingEventRegistry.swift +++ /dev/null @@ -1,49 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -enum ThinkingEventRegistry { - typealias DecodeHandler = AGUIEventDecoder.DecodeHandler - - static func registry() -> [EventType: DecodeHandler] { - [ - .thinkingStart: { data, decoder in - try decoder.decode(ThinkingStartEventDTO.self, from: data).toDomain(rawEvent: data) - }, - .thinkingEnd: { data, decoder in - try decoder.decode(ThinkingEndEventDTO.self, from: data).toDomain(rawEvent: data) - }, - .thinkingTextMessageStart: { data, decoder in - try decoder.decode(ThinkingTextMessageStartEventDTO.self, from: data).toDomain(rawEvent: data) - }, - .thinkingTextMessageContent: { data, decoder in - try decoder.decode(ThinkingTextMessageContentEventDTO.self, from: data).toDomain(rawEvent: data) - }, - .thinkingTextMessageEnd: { data, decoder in - try decoder.decode(ThinkingTextMessageEndEventDTO.self, from: data).toDomain(rawEvent: data) - } - ] - } -} diff --git a/Sources/AGUICore/Decoding/Registry/ToolCallEventRegistry.swift b/Sources/AGUICore/Decoding/Registry/ToolCallEventRegistry.swift index 57b18c8..9aa5267 100644 --- a/Sources/AGUICore/Decoding/Registry/ToolCallEventRegistry.swift +++ b/Sources/AGUICore/Decoding/Registry/ToolCallEventRegistry.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Decoding/RegistryComposer.swift b/Sources/AGUICore/Decoding/RegistryComposer.swift index 959d9b7..09b8b85 100644 --- a/Sources/AGUICore/Decoding/RegistryComposer.swift +++ b/Sources/AGUICore/Decoding/RegistryComposer.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Encoding/MessageEncoder.swift b/Sources/AGUICore/Encoding/MessageEncoder.swift index cd352d5..9f89d01 100644 --- a/Sources/AGUICore/Encoding/MessageEncoder.swift +++ b/Sources/AGUICore/Encoding/MessageEncoder.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/EventType.swift b/Sources/AGUICore/EventType.swift index f14a1dc..c1343d8 100644 --- a/Sources/AGUICore/EventType.swift +++ b/Sources/AGUICore/EventType.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation @@ -34,7 +12,6 @@ import Foundation /// - **Text Messages**: `textMessageStart`, `textMessageContent`, `textMessageEnd`, `textMessageChunk` /// - **Tool Calls**: `toolCallStart`, `toolCallArgs`, `toolCallEnd`, `toolCallResult`, `toolCallChunk` /// - **State**: `stateSnapshot`, `stateDelta`, `messagesSnapshot` -/// - **Thinking** *(deprecated)*: `thinkingStart`, `thinkingEnd`, `thinkingTextMessageStart`, `thinkingTextMessageContent`, `thinkingTextMessageEnd` /// - **Reasoning**: `reasoningStart`, `reasoningMessageStart`, `reasoningMessageContent`, `reasoningMessageEnd`, `reasoningMessageChunk`, `reasoningEnd`, `reasoningEncryptedValue` /// - **Activity**: `activitySnapshot`, `activityDelta` /// - **Special**: `raw`, `custom` @@ -99,33 +76,6 @@ public enum EventType: String, Codable, CaseIterable, Sendable { /// Messages snapshot received case messagesSnapshot = "MESSAGES_SNAPSHOT" - // MARK: - Thinking Events (5) — Deprecated - - /// Thinking phase started. - /// - /// - Note: Deprecated. Use ``reasoningStart`` instead. Will be removed in 1.0.0. - case thinkingStart = "THINKING_START" - - /// Thinking phase ended. - /// - /// - Note: Deprecated. Use ``reasoningEnd`` instead. Will be removed in 1.0.0. - case thinkingEnd = "THINKING_END" - - /// Thinking text message generation started. - /// - /// - Note: Deprecated. Use ``reasoningMessageStart`` instead. Will be removed in 1.0.0. - case thinkingTextMessageStart = "THINKING_TEXT_MESSAGE_START" - - /// Thinking text message content received. - /// - /// - Note: Deprecated. Use ``reasoningMessageContent`` instead. Will be removed in 1.0.0. - case thinkingTextMessageContent = "THINKING_TEXT_MESSAGE_CONTENT" - - /// Thinking text message generation finished. - /// - /// - Note: Deprecated. Use ``reasoningMessageEnd`` instead. Will be removed in 1.0.0. - case thinkingTextMessageEnd = "THINKING_TEXT_MESSAGE_END" - // MARK: - Reasoning Events (7) /// Reasoning phase started. diff --git a/Sources/AGUICore/Events/AGUIEvent.swift b/Sources/AGUICore/Events/AGUIEvent.swift index b05d02e..33f5bef 100644 --- a/Sources/AGUICore/Events/AGUIEvent.swift +++ b/Sources/AGUICore/Events/AGUIEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/ActivityEvents/ActivityDeltaEvent.swift b/Sources/AGUICore/Events/ActivityEvents/ActivityDeltaEvent.swift index c944a41..9a9396b 100644 --- a/Sources/AGUICore/Events/ActivityEvents/ActivityDeltaEvent.swift +++ b/Sources/AGUICore/Events/ActivityEvents/ActivityDeltaEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/ActivityEvents/ActivitySnapshotEvent.swift b/Sources/AGUICore/Events/ActivityEvents/ActivitySnapshotEvent.swift index e4808dd..ae10365 100644 --- a/Sources/AGUICore/Events/ActivityEvents/ActivitySnapshotEvent.swift +++ b/Sources/AGUICore/Events/ActivityEvents/ActivitySnapshotEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/LifeCycleEvents/RunErrorEvent.swift b/Sources/AGUICore/Events/LifeCycleEvents/RunErrorEvent.swift index 8e3cc4b..4dc0293 100644 --- a/Sources/AGUICore/Events/LifeCycleEvents/RunErrorEvent.swift +++ b/Sources/AGUICore/Events/LifeCycleEvents/RunErrorEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/LifeCycleEvents/RunFinishedEvent.swift b/Sources/AGUICore/Events/LifeCycleEvents/RunFinishedEvent.swift index 4d97c03..fc949b2 100644 --- a/Sources/AGUICore/Events/LifeCycleEvents/RunFinishedEvent.swift +++ b/Sources/AGUICore/Events/LifeCycleEvents/RunFinishedEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/LifeCycleEvents/RunFinishedOutcome.swift b/Sources/AGUICore/Events/LifeCycleEvents/RunFinishedOutcome.swift index e326e93..1713b46 100644 --- a/Sources/AGUICore/Events/LifeCycleEvents/RunFinishedOutcome.swift +++ b/Sources/AGUICore/Events/LifeCycleEvents/RunFinishedOutcome.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. /// Describes why an agent run finished. /// diff --git a/Sources/AGUICore/Events/LifeCycleEvents/RunStartedEvent.swift b/Sources/AGUICore/Events/LifeCycleEvents/RunStartedEvent.swift index 620baf5..70165ee 100644 --- a/Sources/AGUICore/Events/LifeCycleEvents/RunStartedEvent.swift +++ b/Sources/AGUICore/Events/LifeCycleEvents/RunStartedEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/LifeCycleEvents/StepFinishedEvent.swift b/Sources/AGUICore/Events/LifeCycleEvents/StepFinishedEvent.swift index 20b76ba..b66b91d 100644 --- a/Sources/AGUICore/Events/LifeCycleEvents/StepFinishedEvent.swift +++ b/Sources/AGUICore/Events/LifeCycleEvents/StepFinishedEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/LifeCycleEvents/StepStartedEvent.swift b/Sources/AGUICore/Events/LifeCycleEvents/StepStartedEvent.swift index 0c9a12c..63f0822 100644 --- a/Sources/AGUICore/Events/LifeCycleEvents/StepStartedEvent.swift +++ b/Sources/AGUICore/Events/LifeCycleEvents/StepStartedEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/ReasoningEvents/ReasoningEncryptedValueEvent.swift b/Sources/AGUICore/Events/ReasoningEvents/ReasoningEncryptedValueEvent.swift index 87f46f8..1d2f0bd 100644 --- a/Sources/AGUICore/Events/ReasoningEvents/ReasoningEncryptedValueEvent.swift +++ b/Sources/AGUICore/Events/ReasoningEvents/ReasoningEncryptedValueEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/ReasoningEvents/ReasoningEndEvent.swift b/Sources/AGUICore/Events/ReasoningEvents/ReasoningEndEvent.swift index 8083c8d..eeeb9f1 100644 --- a/Sources/AGUICore/Events/ReasoningEvents/ReasoningEndEvent.swift +++ b/Sources/AGUICore/Events/ReasoningEvents/ReasoningEndEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/ReasoningEvents/ReasoningMessageChunkEvent.swift b/Sources/AGUICore/Events/ReasoningEvents/ReasoningMessageChunkEvent.swift index 3386af5..d310421 100644 --- a/Sources/AGUICore/Events/ReasoningEvents/ReasoningMessageChunkEvent.swift +++ b/Sources/AGUICore/Events/ReasoningEvents/ReasoningMessageChunkEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/ReasoningEvents/ReasoningMessageContentEvent.swift b/Sources/AGUICore/Events/ReasoningEvents/ReasoningMessageContentEvent.swift index 200db13..c829881 100644 --- a/Sources/AGUICore/Events/ReasoningEvents/ReasoningMessageContentEvent.swift +++ b/Sources/AGUICore/Events/ReasoningEvents/ReasoningMessageContentEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/ReasoningEvents/ReasoningMessageEndEvent.swift b/Sources/AGUICore/Events/ReasoningEvents/ReasoningMessageEndEvent.swift index 1cb85da..e872ea7 100644 --- a/Sources/AGUICore/Events/ReasoningEvents/ReasoningMessageEndEvent.swift +++ b/Sources/AGUICore/Events/ReasoningEvents/ReasoningMessageEndEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/ReasoningEvents/ReasoningMessageStartEvent.swift b/Sources/AGUICore/Events/ReasoningEvents/ReasoningMessageStartEvent.swift index 8d0ce8e..191165d 100644 --- a/Sources/AGUICore/Events/ReasoningEvents/ReasoningMessageStartEvent.swift +++ b/Sources/AGUICore/Events/ReasoningEvents/ReasoningMessageStartEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/ReasoningEvents/ReasoningStartEvent.swift b/Sources/AGUICore/Events/ReasoningEvents/ReasoningStartEvent.swift index 03e16e1..eabe87a 100644 --- a/Sources/AGUICore/Events/ReasoningEvents/ReasoningStartEvent.swift +++ b/Sources/AGUICore/Events/ReasoningEvents/ReasoningStartEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/SpecialEvents/CustomEvent.swift b/Sources/AGUICore/Events/SpecialEvents/CustomEvent.swift index c2a4b9d..318b592 100644 --- a/Sources/AGUICore/Events/SpecialEvents/CustomEvent.swift +++ b/Sources/AGUICore/Events/SpecialEvents/CustomEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/SpecialEvents/RawEvent.swift b/Sources/AGUICore/Events/SpecialEvents/RawEvent.swift index d5f6372..aa64e6b 100644 --- a/Sources/AGUICore/Events/SpecialEvents/RawEvent.swift +++ b/Sources/AGUICore/Events/SpecialEvents/RawEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/StateEvents/MessagesSnapshotEvent.swift b/Sources/AGUICore/Events/StateEvents/MessagesSnapshotEvent.swift index eb518a9..224cad1 100644 --- a/Sources/AGUICore/Events/StateEvents/MessagesSnapshotEvent.swift +++ b/Sources/AGUICore/Events/StateEvents/MessagesSnapshotEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/StateEvents/StateDeltaEvent.swift b/Sources/AGUICore/Events/StateEvents/StateDeltaEvent.swift index 8cef55c..5abd100 100644 --- a/Sources/AGUICore/Events/StateEvents/StateDeltaEvent.swift +++ b/Sources/AGUICore/Events/StateEvents/StateDeltaEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/StateEvents/StateSnapshotEvent.swift b/Sources/AGUICore/Events/StateEvents/StateSnapshotEvent.swift index a926a9e..0ef7bf2 100644 --- a/Sources/AGUICore/Events/StateEvents/StateSnapshotEvent.swift +++ b/Sources/AGUICore/Events/StateEvents/StateSnapshotEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/TextMessageEvents/TextMessageChunkEvent.swift b/Sources/AGUICore/Events/TextMessageEvents/TextMessageChunkEvent.swift index 0807f4d..fd327eb 100644 --- a/Sources/AGUICore/Events/TextMessageEvents/TextMessageChunkEvent.swift +++ b/Sources/AGUICore/Events/TextMessageEvents/TextMessageChunkEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/TextMessageEvents/TextMessageContentEvent.swift b/Sources/AGUICore/Events/TextMessageEvents/TextMessageContentEvent.swift index ce1ee01..b09bf07 100644 --- a/Sources/AGUICore/Events/TextMessageEvents/TextMessageContentEvent.swift +++ b/Sources/AGUICore/Events/TextMessageEvents/TextMessageContentEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/TextMessageEvents/TextMessageEndEvent.swift b/Sources/AGUICore/Events/TextMessageEvents/TextMessageEndEvent.swift index 9a9c878..c77e20a 100644 --- a/Sources/AGUICore/Events/TextMessageEvents/TextMessageEndEvent.swift +++ b/Sources/AGUICore/Events/TextMessageEvents/TextMessageEndEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/TextMessageEvents/TextMessageStartEvent.swift b/Sources/AGUICore/Events/TextMessageEvents/TextMessageStartEvent.swift index 206a25b..ee8555f 100644 --- a/Sources/AGUICore/Events/TextMessageEvents/TextMessageStartEvent.swift +++ b/Sources/AGUICore/Events/TextMessageEvents/TextMessageStartEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/ThinkingEvents/ThinkingEndEvent.swift b/Sources/AGUICore/Events/ThinkingEvents/ThinkingEndEvent.swift deleted file mode 100644 index d29c811..0000000 --- a/Sources/AGUICore/Events/ThinkingEvents/ThinkingEndEvent.swift +++ /dev/null @@ -1,82 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -/// Event indicating the end of a thinking step. -/// -/// This event marks the completion of the agent's internal reasoning or thinking -/// process. It signals that the agent has finished generating internal thoughts -/// for the current thinking step. -/// -/// - SeeAlso: `ThinkingStartEvent`, `ThinkingTextMessageEndEvent` -public struct ThinkingEndEvent: AGUIEvent, Equatable, Hashable, Sendable { - - // MARK: - Properties - - /// Optional timestamp when the thinking ended. - /// - /// Represented as milliseconds since Unix epoch. - public let timestamp: Int64? - - /// Optional raw event data as received from the agent. - public let rawEvent: Data? - - /// The type of this event (always `.thinkingEnd`). - public var eventType: EventType { .thinkingEnd } - - // MARK: - Initialization - - /// Creates a new `ThinkingEndEvent`. - /// - /// - Parameters: - /// - timestamp: Optional timestamp in milliseconds since epoch - /// - rawEvent: Optional raw event data as received from the agent - public init( - timestamp: Int64? = nil, - rawEvent: Data? = nil - ) { - self.timestamp = timestamp - self.rawEvent = rawEvent - } -} - -// MARK: - CustomStringConvertible -extension ThinkingEndEvent: CustomStringConvertible { - public var description: String { - "ThinkingEndEvent(timestamp: \(timestamp?.description ?? "nil"))" - } -} - -// MARK: - CustomDebugStringConvertible -extension ThinkingEndEvent: CustomDebugStringConvertible { - public var debugDescription: String { - """ - ThinkingEndEvent { - timestamp: \(timestamp.map(String.init) ?? "nil") - eventType: \(eventType.rawValue) - } - """ - } -} diff --git a/Sources/AGUICore/Events/ThinkingEvents/ThinkingStartEvent.swift b/Sources/AGUICore/Events/ThinkingEvents/ThinkingStartEvent.swift deleted file mode 100644 index c9412f1..0000000 --- a/Sources/AGUICore/Events/ThinkingEvents/ThinkingStartEvent.swift +++ /dev/null @@ -1,92 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -/// Event indicating the start of a thinking step. -/// -/// This event marks the beginning of the agent's internal reasoning or thinking -/// process. During thinking, the agent may generate internal thoughts that are -/// not immediately shown to the user but help guide its decision-making. -/// -/// - SeeAlso: `ThinkingEndEvent`, `ThinkingTextMessageStartEvent` -public struct ThinkingStartEvent: AGUIEvent, Equatable, Hashable, Sendable { - - // MARK: - Properties - - /// Optional title or description for the thinking step. - /// - /// Provides context about what the agent is thinking about or reasoning through. - public let title: String? - - /// Optional timestamp when the thinking started. - /// - /// Represented as milliseconds since Unix epoch. - public let timestamp: Int64? - - /// Optional raw event data as received from the agent. - public let rawEvent: Data? - - /// The type of this event (always `.thinkingStart`). - public var eventType: EventType { .thinkingStart } - - // MARK: - Initialization - - /// Creates a new `ThinkingStartEvent`. - /// - /// - Parameters: - /// - title: Optional title/description for the thinking step - /// - timestamp: Optional timestamp in milliseconds since epoch - /// - rawEvent: Optional raw event data as received from the agent - public init( - title: String? = nil, - timestamp: Int64? = nil, - rawEvent: Data? = nil - ) { - self.title = title - self.timestamp = timestamp - self.rawEvent = rawEvent - } -} - -// MARK: - CustomStringConvertible -extension ThinkingStartEvent: CustomStringConvertible { - public var description: String { - let titleDesc = title.map { "\"\($0)\"" } ?? "nil" - return "ThinkingStartEvent(title: \(titleDesc), timestamp: \(timestamp?.description ?? "nil"))" - } -} - -// MARK: - CustomDebugStringConvertible -extension ThinkingStartEvent: CustomDebugStringConvertible { - public var debugDescription: String { - """ - ThinkingStartEvent { - title: \(title.map { "\"\($0)\"" } ?? "nil") - timestamp: \(timestamp.map(String.init) ?? "nil") - eventType: \(eventType.rawValue) - } - """ - } -} diff --git a/Sources/AGUICore/Events/ThinkingEvents/ThinkingTextMessageContentEvent.swift b/Sources/AGUICore/Events/ThinkingEvents/ThinkingTextMessageContentEvent.swift deleted file mode 100644 index 10bf6a8..0000000 --- a/Sources/AGUICore/Events/ThinkingEvents/ThinkingTextMessageContentEvent.swift +++ /dev/null @@ -1,95 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -/// Event containing incremental content for a thinking text message. -/// -/// This event is emitted multiple times during thinking message generation, each time -/// containing a delta (incremental change) of text content. The delta must be a -/// non-empty string. These events represent the agent's internal thought process -/// and reasoning steps. -/// -/// - SeeAlso: `ThinkingTextMessageStartEvent`, `ThinkingTextMessageEndEvent` -public struct ThinkingTextMessageContentEvent: AGUIEvent, Equatable, Hashable, Sendable { - - // MARK: - Properties - - /// The text content delta (incremental change). - /// - /// This is a non-empty string containing a chunk of the thinking message content. - /// Multiple `ThinkingTextMessageContentEvent` instances represent the complete - /// thinking message when concatenated. - public let delta: String - - /// Optional timestamp when this content chunk was received. - /// - /// Represented as milliseconds since Unix epoch. - public let timestamp: Int64? - - /// Optional raw event data as received from the agent. - public let rawEvent: Data? - - /// The type of this event (always `.thinkingTextMessageContent`). - public var eventType: EventType { .thinkingTextMessageContent } - - // MARK: - Initialization - - /// Creates a new `ThinkingTextMessageContentEvent`. - /// - /// - Parameters: - /// - delta: The text content delta (must be non-empty) - /// - timestamp: Optional timestamp in milliseconds since epoch - /// - rawEvent: Optional raw event data as received from the agent - public init( - delta: String, - timestamp: Int64? = nil, - rawEvent: Data? = nil - ) { - self.delta = delta - self.timestamp = timestamp - self.rawEvent = rawEvent - } -} - -// MARK: - CustomStringConvertible -extension ThinkingTextMessageContentEvent: CustomStringConvertible { - public var description: String { - "ThinkingTextMessageContentEvent(delta: \"\(delta)\", " + - "timestamp: \(timestamp?.description ?? "nil"))" - } -} - -// MARK: - CustomDebugStringConvertible -extension ThinkingTextMessageContentEvent: CustomDebugStringConvertible { - public var debugDescription: String { - """ - ThinkingTextMessageContentEvent { - delta: "\(delta)" - timestamp: \(timestamp.map(String.init) ?? "nil") - eventType: \(eventType.rawValue) - } - """ - } -} diff --git a/Sources/AGUICore/Events/ThinkingEvents/ThinkingTextMessageEndEvent.swift b/Sources/AGUICore/Events/ThinkingEvents/ThinkingTextMessageEndEvent.swift deleted file mode 100644 index 441d733..0000000 --- a/Sources/AGUICore/Events/ThinkingEvents/ThinkingTextMessageEndEvent.swift +++ /dev/null @@ -1,83 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -/// Event indicating the completion of a thinking text message. -/// -/// This event marks the end of a thinking message generation during the agent's -/// internal reasoning process. It signals that all content for this thinking message -/// has been delivered and no more `ThinkingTextMessageContentEvent` events will follow -/// for this message. -/// -/// - SeeAlso: `ThinkingTextMessageStartEvent`, `ThinkingTextMessageContentEvent` -public struct ThinkingTextMessageEndEvent: AGUIEvent, Equatable, Hashable, Sendable { - - // MARK: - Properties - - /// Optional timestamp when the thinking message generation completed. - /// - /// Represented as milliseconds since Unix epoch. - public let timestamp: Int64? - - /// Optional raw event data as received from the agent. - public let rawEvent: Data? - - /// The type of this event (always `.thinkingTextMessageEnd`). - public var eventType: EventType { .thinkingTextMessageEnd } - - // MARK: - Initialization - - /// Creates a new `ThinkingTextMessageEndEvent`. - /// - /// - Parameters: - /// - timestamp: Optional timestamp in milliseconds since epoch - /// - rawEvent: Optional raw event data as received from the agent - public init( - timestamp: Int64? = nil, - rawEvent: Data? = nil - ) { - self.timestamp = timestamp - self.rawEvent = rawEvent - } -} - -// MARK: - CustomStringConvertible -extension ThinkingTextMessageEndEvent: CustomStringConvertible { - public var description: String { - "ThinkingTextMessageEndEvent(timestamp: \(timestamp?.description ?? "nil"))" - } -} - -// MARK: - CustomDebugStringConvertible -extension ThinkingTextMessageEndEvent: CustomDebugStringConvertible { - public var debugDescription: String { - """ - ThinkingTextMessageEndEvent { - timestamp: \(timestamp.map(String.init) ?? "nil") - eventType: \(eventType.rawValue) - } - """ - } -} diff --git a/Sources/AGUICore/Events/ThinkingEvents/ThinkingTextMessageStartEvent.swift b/Sources/AGUICore/Events/ThinkingEvents/ThinkingTextMessageStartEvent.swift deleted file mode 100644 index de10532..0000000 --- a/Sources/AGUICore/Events/ThinkingEvents/ThinkingTextMessageStartEvent.swift +++ /dev/null @@ -1,82 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import Foundation - -/// Event indicating the start of a thinking text message. -/// -/// This event marks the beginning of a thinking message generation during the agent's -/// internal reasoning process. Thinking messages contain the agent's internal thoughts -/// that may be shown to help users understand the reasoning process. -/// -/// - SeeAlso: `ThinkingTextMessageContentEvent`, `ThinkingTextMessageEndEvent` -public struct ThinkingTextMessageStartEvent: AGUIEvent, Equatable, Hashable, Sendable { - - // MARK: - Properties - - /// Optional timestamp when the thinking message generation started. - /// - /// Represented as milliseconds since Unix epoch. - public let timestamp: Int64? - - /// Optional raw event data as received from the agent. - public let rawEvent: Data? - - /// The type of this event (always `.thinkingTextMessageStart`). - public var eventType: EventType { .thinkingTextMessageStart } - - // MARK: - Initialization - - /// Creates a new `ThinkingTextMessageStartEvent`. - /// - /// - Parameters: - /// - timestamp: Optional timestamp in milliseconds since epoch - /// - rawEvent: Optional raw event data as received from the agent - public init( - timestamp: Int64? = nil, - rawEvent: Data? = nil - ) { - self.timestamp = timestamp - self.rawEvent = rawEvent - } -} - -// MARK: - CustomStringConvertible -extension ThinkingTextMessageStartEvent: CustomStringConvertible { - public var description: String { - "ThinkingTextMessageStartEvent(timestamp: \(timestamp?.description ?? "nil"))" - } -} - -// MARK: - CustomDebugStringConvertible -extension ThinkingTextMessageStartEvent: CustomDebugStringConvertible { - public var debugDescription: String { - """ - ThinkingTextMessageStartEvent { - timestamp: \(timestamp.map(String.init) ?? "nil") - eventType: \(eventType.rawValue) - } - """ - } -} diff --git a/Sources/AGUICore/Events/ToolCallEvents/ToolCallArgsEvent.swift b/Sources/AGUICore/Events/ToolCallEvents/ToolCallArgsEvent.swift index 63b6105..682d668 100644 --- a/Sources/AGUICore/Events/ToolCallEvents/ToolCallArgsEvent.swift +++ b/Sources/AGUICore/Events/ToolCallEvents/ToolCallArgsEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/ToolCallEvents/ToolCallChunkEvent.swift b/Sources/AGUICore/Events/ToolCallEvents/ToolCallChunkEvent.swift index 5431bcf..c694836 100644 --- a/Sources/AGUICore/Events/ToolCallEvents/ToolCallChunkEvent.swift +++ b/Sources/AGUICore/Events/ToolCallEvents/ToolCallChunkEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/ToolCallEvents/ToolCallEndEvent.swift b/Sources/AGUICore/Events/ToolCallEvents/ToolCallEndEvent.swift index 7ebc1fc..2c677f3 100644 --- a/Sources/AGUICore/Events/ToolCallEvents/ToolCallEndEvent.swift +++ b/Sources/AGUICore/Events/ToolCallEvents/ToolCallEndEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/ToolCallEvents/ToolCallResultEvent.swift b/Sources/AGUICore/Events/ToolCallEvents/ToolCallResultEvent.swift index 6197a58..cb12d9d 100644 --- a/Sources/AGUICore/Events/ToolCallEvents/ToolCallResultEvent.swift +++ b/Sources/AGUICore/Events/ToolCallEvents/ToolCallResultEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/ToolCallEvents/ToolCallStartEvent.swift b/Sources/AGUICore/Events/ToolCallEvents/ToolCallStartEvent.swift index d48600a..0c20b37 100644 --- a/Sources/AGUICore/Events/ToolCallEvents/ToolCallStartEvent.swift +++ b/Sources/AGUICore/Events/ToolCallEvents/ToolCallStartEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Events/UnknownEvent.swift b/Sources/AGUICore/Events/UnknownEvent.swift index fff357f..2524761 100644 --- a/Sources/AGUICore/Events/UnknownEvent.swift +++ b/Sources/AGUICore/Events/UnknownEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/AgentExecution/Context.swift b/Sources/AGUICore/Types/AgentExecution/Context.swift index 900ceec..eb72f5f 100644 --- a/Sources/AGUICore/Types/AgentExecution/Context.swift +++ b/Sources/AGUICore/Types/AgentExecution/Context.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/AgentExecution/RunAgentInput.swift b/Sources/AGUICore/Types/AgentExecution/RunAgentInput.swift index 873722f..39325d6 100644 --- a/Sources/AGUICore/Types/AgentExecution/RunAgentInput.swift +++ b/Sources/AGUICore/Types/AgentExecution/RunAgentInput.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/AgentExecution/RunAgentInputBuilder.swift b/Sources/AGUICore/Types/AgentExecution/RunAgentInputBuilder.swift index 95e6642..cd39d5b 100644 --- a/Sources/AGUICore/Types/AgentExecution/RunAgentInputBuilder.swift +++ b/Sources/AGUICore/Types/AgentExecution/RunAgentInputBuilder.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/AgentExecution/State.swift b/Sources/AGUICore/Types/AgentExecution/State.swift index 4540110..608d951 100644 --- a/Sources/AGUICore/Types/AgentExecution/State.swift +++ b/Sources/AGUICore/Types/AgentExecution/State.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/InputContent/AudioInputContent.swift b/Sources/AGUICore/Types/InputContent/AudioInputContent.swift index 8ecbca2..d764c2c 100644 --- a/Sources/AGUICore/Types/InputContent/AudioInputContent.swift +++ b/Sources/AGUICore/Types/InputContent/AudioInputContent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/InputContent/BinaryInputContent.swift b/Sources/AGUICore/Types/InputContent/BinaryInputContent.swift index 4fe14b9..8694a7f 100644 --- a/Sources/AGUICore/Types/InputContent/BinaryInputContent.swift +++ b/Sources/AGUICore/Types/InputContent/BinaryInputContent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/InputContent/DocumentInputContent.swift b/Sources/AGUICore/Types/InputContent/DocumentInputContent.swift index 37fa63a..77919e7 100644 --- a/Sources/AGUICore/Types/InputContent/DocumentInputContent.swift +++ b/Sources/AGUICore/Types/InputContent/DocumentInputContent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/InputContent/ImageInputContent.swift b/Sources/AGUICore/Types/InputContent/ImageInputContent.swift index b5d47d4..0de7395 100644 --- a/Sources/AGUICore/Types/InputContent/ImageInputContent.swift +++ b/Sources/AGUICore/Types/InputContent/ImageInputContent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/InputContent/InputContent.swift b/Sources/AGUICore/Types/InputContent/InputContent.swift index d1e34af..2f9355d 100644 --- a/Sources/AGUICore/Types/InputContent/InputContent.swift +++ b/Sources/AGUICore/Types/InputContent/InputContent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/InputContent/TextInputContent.swift b/Sources/AGUICore/Types/InputContent/TextInputContent.swift index 86079b3..20bb6f9 100644 --- a/Sources/AGUICore/Types/InputContent/TextInputContent.swift +++ b/Sources/AGUICore/Types/InputContent/TextInputContent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/InputContent/VideoInputContent.swift b/Sources/AGUICore/Types/InputContent/VideoInputContent.swift index f86e25c..11cbfa2 100644 --- a/Sources/AGUICore/Types/InputContent/VideoInputContent.swift +++ b/Sources/AGUICore/Types/InputContent/VideoInputContent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/Messages/ActivityMessage.swift b/Sources/AGUICore/Types/Messages/ActivityMessage.swift index 1e93fbe..73c5fdd 100644 --- a/Sources/AGUICore/Types/Messages/ActivityMessage.swift +++ b/Sources/AGUICore/Types/Messages/ActivityMessage.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/Messages/AssistantMessage.swift b/Sources/AGUICore/Types/Messages/AssistantMessage.swift index 1450377..f3873f0 100644 --- a/Sources/AGUICore/Types/Messages/AssistantMessage.swift +++ b/Sources/AGUICore/Types/Messages/AssistantMessage.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/Messages/DeveloperMessage.swift b/Sources/AGUICore/Types/Messages/DeveloperMessage.swift index e1cdd4a..2973761 100644 --- a/Sources/AGUICore/Types/Messages/DeveloperMessage.swift +++ b/Sources/AGUICore/Types/Messages/DeveloperMessage.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/Messages/Message.swift b/Sources/AGUICore/Types/Messages/Message.swift index 28856c9..4fabf7d 100644 --- a/Sources/AGUICore/Types/Messages/Message.swift +++ b/Sources/AGUICore/Types/Messages/Message.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/Messages/ReasoningMessage.swift b/Sources/AGUICore/Types/Messages/ReasoningMessage.swift index 17faa8e..8d158f0 100644 --- a/Sources/AGUICore/Types/Messages/ReasoningMessage.swift +++ b/Sources/AGUICore/Types/Messages/ReasoningMessage.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/Messages/Role.swift b/Sources/AGUICore/Types/Messages/Role.swift index 16335ab..4c67cec 100644 --- a/Sources/AGUICore/Types/Messages/Role.swift +++ b/Sources/AGUICore/Types/Messages/Role.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/Messages/SystemMessage.swift b/Sources/AGUICore/Types/Messages/SystemMessage.swift index 567a3eb..cd84ce2 100644 --- a/Sources/AGUICore/Types/Messages/SystemMessage.swift +++ b/Sources/AGUICore/Types/Messages/SystemMessage.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/Messages/ToolMessage.swift b/Sources/AGUICore/Types/Messages/ToolMessage.swift index 529f68e..e1329e3 100644 --- a/Sources/AGUICore/Types/Messages/ToolMessage.swift +++ b/Sources/AGUICore/Types/Messages/ToolMessage.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/Messages/UserMessage.swift b/Sources/AGUICore/Types/Messages/UserMessage.swift index 4a140bf..04b05a6 100644 --- a/Sources/AGUICore/Types/Messages/UserMessage.swift +++ b/Sources/AGUICore/Types/Messages/UserMessage.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/Tools/FunctionCall.swift b/Sources/AGUICore/Types/Tools/FunctionCall.swift index b7ac40f..ccc237b 100644 --- a/Sources/AGUICore/Types/Tools/FunctionCall.swift +++ b/Sources/AGUICore/Types/Tools/FunctionCall.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/Tools/Tool.swift b/Sources/AGUICore/Types/Tools/Tool.swift index e053adf..2781559 100644 --- a/Sources/AGUICore/Types/Tools/Tool.swift +++ b/Sources/AGUICore/Types/Tools/Tool.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Types/Tools/ToolCall.swift b/Sources/AGUICore/Types/Tools/ToolCall.swift index 110135a..97809f5 100644 --- a/Sources/AGUICore/Types/Tools/ToolCall.swift +++ b/Sources/AGUICore/Types/Tools/ToolCall.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Utilities/JSONCodingHelpers.swift b/Sources/AGUICore/Utilities/JSONCodingHelpers.swift index b8c14b8..121ec9c 100644 --- a/Sources/AGUICore/Utilities/JSONCodingHelpers.swift +++ b/Sources/AGUICore/Utilities/JSONCodingHelpers.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUICore/Utilities/JSONPrimitiveWrapper.swift b/Sources/AGUICore/Utilities/JSONPrimitiveWrapper.swift index 1ff8288..80891e9 100644 --- a/Sources/AGUICore/Utilities/JSONPrimitiveWrapper.swift +++ b/Sources/AGUICore/Utilities/JSONPrimitiveWrapper.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUITools/AGUITools.swift b/Sources/AGUITools/AGUITools.swift index badb7d3..97ddaf1 100644 --- a/Sources/AGUITools/AGUITools.swift +++ b/Sources/AGUITools/AGUITools.swift @@ -1,78 +1,10 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import AGUICore -import Foundation - -// MARK: - Core Tool Execution Framework - -// Core types are defined in: -// - Core/ToolExecutionResult.swift -// - Core/ToolExecutionContext.swift -// - Core/ToolExecutor.swift - -// MARK: - Legacy Placeholder (Deprecated) - -/// AGUITools provides the tool execution framework for AG-UI agents. -/// -/// The AGUITools module provides a comprehensive framework for: -/// - Defining and registering tool executors -/// - Executing tool calls from agents -/// - Managing tool lifecycle and error handling -/// - Circuit breaker patterns for reliability -/// -/// ## Core Components -/// -/// - ``ToolExecutor``: Protocol for implementing tool executors -/// - ``ToolExecutionResult``: Result type for tool executions -/// - ``ToolExecutionContext``: Context provided to tool executors -/// - ``ToolRegistry``: Registry for managing and executing tools -/// - ``ToolExecutionManager``: Manages tool execution lifecycle -/// -/// ## Usage Example -/// -/// ```swift -/// // Define a tool executor -/// actor MyToolExecutor: ToolExecutor { -/// let tool = Tool(name: "my_tool", description: "...", parameters: ...) -/// -/// func execute(context: ToolExecutionContext) async throws -> ToolExecutionResult { -/// // Your tool implementation -/// return .success(message: "Done") -/// } -/// } -/// -/// // Register and use with a tool registry -/// let registry = DefaultToolRegistry() -/// await registry.register(executor: MyToolExecutor()) -/// ``` -@available(*, deprecated, message: "Use ToolExecutor protocol and related types directly") -public struct AGUITools { - private let core: AGUICore - - public init() { - self.core = AGUICore() - } - -} +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. + +// AGUITools provides the tool execution framework for AG-UI agents. +// +// Core types: +// - ToolExecutor: Protocol for implementing tool executors +// - ToolExecutionResult: Result type for tool executions +// - ToolExecutionContext: Context provided to tool executors +// - ToolRegistry: Registry for managing and executing tools +// - ToolExecutionManager: Manages tool execution lifecycle diff --git a/Sources/AGUITools/Core/ToolErrorHandler.swift b/Sources/AGUITools/Core/ToolErrorHandler.swift index e4f0cc2..289c1b3 100644 --- a/Sources/AGUITools/Core/ToolErrorHandler.swift +++ b/Sources/AGUITools/Core/ToolErrorHandler.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUITools/Core/ToolExecutionContext.swift b/Sources/AGUITools/Core/ToolExecutionContext.swift index 80e5be5..6c5fd4e 100644 --- a/Sources/AGUITools/Core/ToolExecutionContext.swift +++ b/Sources/AGUITools/Core/ToolExecutionContext.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUITools/Core/ToolExecutionEvent.swift b/Sources/AGUITools/Core/ToolExecutionEvent.swift index 6d733bf..b73ccb2 100644 --- a/Sources/AGUITools/Core/ToolExecutionEvent.swift +++ b/Sources/AGUITools/Core/ToolExecutionEvent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUITools/Core/ToolExecutionManager.swift b/Sources/AGUITools/Core/ToolExecutionManager.swift index a4cb8c0..5040cc7 100644 --- a/Sources/AGUITools/Core/ToolExecutionManager.swift +++ b/Sources/AGUITools/Core/ToolExecutionManager.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUITools/Core/ToolExecutionResult.swift b/Sources/AGUITools/Core/ToolExecutionResult.swift index 4c6cf6b..4693f07 100644 --- a/Sources/AGUITools/Core/ToolExecutionResult.swift +++ b/Sources/AGUITools/Core/ToolExecutionResult.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation @@ -112,4 +90,23 @@ public struct ToolExecutionResult: Sendable, Equatable { ) -> ToolExecutionResult { ToolExecutionResult(success: false, result: result, message: message) } + + /// Decodes the result data as the given `Decodable` type. + /// + /// ```swift + /// let weather = try result.decode(as: WeatherResponse.self) + /// ``` + /// + /// - Parameters: + /// - type: The target `Decodable` type. + /// - decoder: The JSON decoder to use (defaults to `JSONDecoder()`). + /// - Returns: The decoded value, or `nil` when `result` is `nil`. + /// - Throws: `DecodingError` if the data cannot be decoded as `T`. + public func decode( + as type: T.Type, + using decoder: JSONDecoder = JSONDecoder() + ) throws -> T? { + guard let data = result else { return nil } + return try decoder.decode(T.self, from: data) + } } diff --git a/Sources/AGUITools/Core/ToolExecutor.swift b/Sources/AGUITools/Core/ToolExecutor.swift index 3c35fa0..65a4f7a 100644 --- a/Sources/AGUITools/Core/ToolExecutor.swift +++ b/Sources/AGUITools/Core/ToolExecutor.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUITools/Core/ToolResponseHandler.swift b/Sources/AGUITools/Core/ToolResponseHandler.swift index c88dc86..fca9695 100644 --- a/Sources/AGUITools/Core/ToolResponseHandler.swift +++ b/Sources/AGUITools/Core/ToolResponseHandler.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Sources/AGUITools/Registry/ToolExecutionStats.swift b/Sources/AGUITools/Registry/ToolExecutionStats.swift index 207bda7..b946217 100644 --- a/Sources/AGUITools/Registry/ToolExecutionStats.swift +++ b/Sources/AGUITools/Registry/ToolExecutionStats.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation diff --git a/Sources/AGUITools/Registry/ToolRegistry.swift b/Sources/AGUITools/Registry/ToolRegistry.swift index a59a317..628c839 100644 --- a/Sources/AGUITools/Registry/ToolRegistry.swift +++ b/Sources/AGUITools/Registry/ToolRegistry.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Tests/AGUIAgentSDKTests/AGUIAgentSDKTests.swift b/Tests/AGUIAgentSDKTests/AGUIAgentSDKTests.swift index 158e3e5..0af7425 100644 --- a/Tests/AGUIAgentSDKTests/AGUIAgentSDKTests.swift +++ b/Tests/AGUIAgentSDKTests/AGUIAgentSDKTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUIAgentSDK diff --git a/Tests/AGUIAgentSDKTests/AgUiAgentTests.swift b/Tests/AGUIAgentSDKTests/AgUiAgentTests.swift index aad65e2..fc2d572 100644 --- a/Tests/AGUIAgentSDKTests/AgUiAgentTests.swift +++ b/Tests/AGUIAgentSDKTests/AgUiAgentTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUIClient import AGUICore @@ -55,38 +33,6 @@ actor CapturingTransport: AgentTransport { } } -// MARK: - Mock ToolRegistry - -private actor MockToolRegistry: ToolRegistry { - private let tools: [Tool] - - init(tools: [Tool]) { - self.tools = tools - } - - func allTools() async -> [Tool] { tools } - - func register(executor: any ToolExecutor) async throws {} - - func unregister(toolName: String) async -> Bool { false } - - func executor(for toolName: String) async -> (any ToolExecutor)? { nil } - - func execute(context: ToolExecutionContext) async throws -> ToolExecutionResult { - ToolExecutionResult(success: false, message: "mock") - } - - func isToolRegistered(toolName: String) async -> Bool { false } - - func stats(for toolName: String) async -> ToolExecutionStats? { nil } - - func getAllStats() async -> [String: ToolExecutionStats] { [:] } - - func clearStats() async {} - - func getAllExecutors() async -> [String: any ToolExecutor] { [:] } -} - // MARK: - AgUiAgentTests final class AgUiAgentTests: XCTestCase { diff --git a/Tests/AGUIAgentSDKTests/AgentBuildersTests.swift b/Tests/AGUIAgentSDKTests/AgentBuildersTests.swift index c55010e..737ff51 100644 --- a/Tests/AGUIAgentSDKTests/AgentBuildersTests.swift +++ b/Tests/AGUIAgentSDKTests/AgentBuildersTests.swift @@ -1,49 +1,10 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import AGUITools import XCTest @testable import AGUIAgentSDK -// MARK: - Mock ToolRegistry for builder tests - -private actor BuilderMockToolRegistry: ToolRegistry { - func allTools() async -> [Tool] { [] } - func register(executor: any ToolExecutor) async throws {} - func unregister(toolName: String) async -> Bool { false } - func executor(for toolName: String) async -> (any ToolExecutor)? { nil } - func execute(context: ToolExecutionContext) async throws -> ToolExecutionResult { - ToolExecutionResult(success: false, message: "mock") - } - func isToolRegistered(toolName: String) async -> Bool { false } - func stats(for toolName: String) async -> ToolExecutionStats? { nil } - func getAllStats() async -> [String: ToolExecutionStats] { [:] } - func clearStats() async {} - func getAllExecutors() async -> [String: any ToolExecutor] { [:] } -} - // MARK: - AgentBuildersTests final class AgentBuildersTests: XCTestCase { @@ -53,69 +14,69 @@ final class AgentBuildersTests: XCTestCase { // MARK: - agentWithBearer func testAgentWithBearerCreatesAgUiAgent() { - let agent = agentWithBearer(url: agentURL, token: "tok_test") + let agent = AgentBuilders.agentWithBearer(url: agentURL, token: "tok_test") XCTAssertNotNil(agent) } func testAgentWithBearerSetsAuthorizationHeader() { - let agent = agentWithBearer(url: agentURL, token: "sk-secret") + let agent = AgentBuilders.agentWithBearer(url: agentURL, token: "sk-secret") let headers = agent.config.buildHeaders() XCTAssertEqual(headers["Authorization"], "Bearer sk-secret") } func testAgentWithBearerStoresToken() { - let agent = agentWithBearer(url: agentURL, token: "my-token") + let agent = AgentBuilders.agentWithBearer(url: agentURL, token: "my-token") XCTAssertEqual(agent.config.bearerToken, "my-token") } // MARK: - agentWithApiKey func testAgentWithApiKeyCreatesAgUiAgent() { - let agent = agentWithApiKey(url: agentURL, apiKey: "key123") + let agent = AgentBuilders.agentWithApiKey(url: agentURL, apiKey: "key123") XCTAssertNotNil(agent) } func testAgentWithApiKeyUsesDefaultHeader() { - let agent = agentWithApiKey(url: agentURL, apiKey: "key123") + let agent = AgentBuilders.agentWithApiKey(url: agentURL, apiKey: "key123") let headers = agent.config.buildHeaders() XCTAssertEqual(headers["X-API-Key"], "key123") } func testAgentWithApiKeyUsesCustomHeader() { - let agent = agentWithApiKey(url: agentURL, apiKey: "key123", header: "X-Custom-Key") + let agent = AgentBuilders.agentWithApiKey(url: agentURL, apiKey: "key123", header: "X-Custom-Key") let headers = agent.config.buildHeaders() XCTAssertEqual(headers["X-Custom-Key"], "key123") XCTAssertNil(headers["X-API-Key"]) } func testAgentWithApiKeyStoresKey() { - let agent = agentWithApiKey(url: agentURL, apiKey: "key_abc") + let agent = AgentBuilders.agentWithApiKey(url: agentURL, apiKey: "key_abc") XCTAssertEqual(agent.config.apiKey, "key_abc") } // MARK: - agentWithTools func testAgentWithToolsCreatesAgUiAgent() { - let registry = BuilderMockToolRegistry() - let agent = agentWithTools(url: agentURL, registry: registry) + let registry = MockToolRegistry() + let agent = AgentBuilders.agentWithTools(url: agentURL, registry: registry) XCTAssertNotNil(agent) } func testAgentWithToolsSetsRegistry() { - let registry = BuilderMockToolRegistry() - let agent = agentWithTools(url: agentURL, registry: registry) + let registry = MockToolRegistry() + let agent = AgentBuilders.agentWithTools(url: agentURL, registry: registry) XCTAssertNotNil(agent.config.toolRegistry) } // MARK: - debugAgent func testDebugAgentCreatesAgUiAgent() { - let agent = debugAgent(url: agentURL) + let agent = AgentBuilders.debugAgent(url: agentURL) XCTAssertNotNil(agent) } func testDebugAgentSetsDebugFlag() { - let agent = debugAgent(url: agentURL) + let agent = AgentBuilders.debugAgent(url: agentURL) XCTAssertTrue(agent.config.debug) } @@ -127,35 +88,35 @@ final class AgentBuildersTests: XCTestCase { // MARK: - chatAgent func testChatAgentCreatesStatefulAgUiAgent() { - let agent = chatAgent(url: agentURL, systemPrompt: "Be helpful.") + let agent = AgentBuilders.chatAgent(url: agentURL, systemPrompt: "Be helpful.") XCTAssertNotNil(agent) } func testChatAgentSetsSystemPrompt() { - let agent = chatAgent(url: agentURL, systemPrompt: "You are a pirate.") + let agent = AgentBuilders.chatAgent(url: agentURL, systemPrompt: "You are a pirate.") XCTAssertEqual(agent.config.systemPrompt, "You are a pirate.") } func testChatAgentReturnsStatefulType() { - let agent = chatAgent(url: agentURL, systemPrompt: "Hi") + let agent = AgentBuilders.chatAgent(url: agentURL, systemPrompt: "Hi") XCTAssert(agent is StatefulAgUiAgent) } // MARK: - statefulAgent func testStatefulAgentCreatesStatefulAgUiAgent() { - let agent = statefulAgent(url: agentURL, initialState: Data("{}".utf8)) + let agent = AgentBuilders.statefulAgent(url: agentURL, initialState: Data("{}".utf8)) XCTAssertNotNil(agent) } func testStatefulAgentSetsInitialState() { let state = Data("{\"key\":\"value\"}".utf8) - let agent = statefulAgent(url: agentURL, initialState: state) + let agent = AgentBuilders.statefulAgent(url: agentURL, initialState: state) XCTAssertEqual(agent.config.initialState, state) } func testStatefulAgentReturnsStatefulType() { - let agent = statefulAgent(url: agentURL, initialState: Data("{}".utf8)) + let agent = AgentBuilders.statefulAgent(url: agentURL, initialState: Data("{}".utf8)) XCTAssert(agent is StatefulAgUiAgent) } diff --git a/Tests/AGUIAgentSDKTests/AgentMessageTests.swift b/Tests/AGUIAgentSDKTests/AgentMessageTests.swift index 9260769..6e3241e 100644 --- a/Tests/AGUIAgentSDKTests/AgentMessageTests.swift +++ b/Tests/AGUIAgentSDKTests/AgentMessageTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUIAgentSDK diff --git a/Tests/AGUIAgentSDKTests/AgentViewModelCompatTests.swift b/Tests/AGUIAgentSDKTests/AgentViewModelCompatTests.swift index a557832..5c64658 100644 --- a/Tests/AGUIAgentSDKTests/AgentViewModelCompatTests.swift +++ b/Tests/AGUIAgentSDKTests/AgentViewModelCompatTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import XCTest diff --git a/Tests/AGUIAgentSDKTests/AgentViewModelTests.swift b/Tests/AGUIAgentSDKTests/AgentViewModelTests.swift index 5b64fcf..60bd028 100644 --- a/Tests/AGUIAgentSDKTests/AgentViewModelTests.swift +++ b/Tests/AGUIAgentSDKTests/AgentViewModelTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. // AgentViewModel requires iOS 17 / macOS 14 (Observation framework). // Tests are gated by the same availability so the suite stays green on older OS. diff --git a/Tests/AGUIAgentSDKTests/ConversationHistoryTests.swift b/Tests/AGUIAgentSDKTests/ConversationHistoryTests.swift index 26a55ce..3fada65 100644 --- a/Tests/AGUIAgentSDKTests/ConversationHistoryTests.swift +++ b/Tests/AGUIAgentSDKTests/ConversationHistoryTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore @testable import AGUIAgentSDK diff --git a/Tests/AGUIAgentSDKTests/EndToEndPipelineTests.swift b/Tests/AGUIAgentSDKTests/EndToEndPipelineTests.swift index 3af87b8..58b19df 100644 --- a/Tests/AGUIAgentSDKTests/EndToEndPipelineTests.swift +++ b/Tests/AGUIAgentSDKTests/EndToEndPipelineTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUIClient import AGUICore @@ -129,55 +107,6 @@ final class EndToEndPipelineTests: XCTestCase { XCTAssertEqual(mode, "creative") } - // MARK: - Thinking telemetry - - func testThinkingSequenceBuildsThinkingState() async throws { - let mockTransport = MockAgentTransport() - await mockTransport.enqueue([ - RunStartedEvent(threadId: "t1", runId: "r1"), - ThinkingStartEvent(title: "Step 1"), - ThinkingTextMessageStartEvent(), - ThinkingTextMessageContentEvent(delta: "I am thinking..."), - ThinkingTextMessageEndEvent(), - ThinkingEndEvent(), - RunFinishedEvent(threadId: "t1", runId: "r1"), - ]) - - let agent = AbstractAgent(transport: mockTransport) - try await agent.runAgent() - - let thinking = await agent.thinking - let state = try XCTUnwrap(thinking) - XCTAssertFalse(state.isThinking, "Thinking should be finished after ThinkingEndEvent") - XCTAssertEqual(state.title, "Step 1") - XCTAssertTrue(state.messages.contains("I am thinking...")) - } - - func testRunStartedResetsThinkingState() async throws { - let mockTransport = MockAgentTransport() - - await mockTransport.enqueue([ - RunStartedEvent(threadId: "t1", runId: "r1"), - ThinkingStartEvent(), - ThinkingTextMessageStartEvent(), - ThinkingTextMessageContentEvent(delta: "old thought"), - ThinkingTextMessageEndEvent(), - ThinkingEndEvent(), - RunFinishedEvent(threadId: "t1", runId: "r1"), - ]) - - await mockTransport.enqueue([ - RunStartedEvent(threadId: "t1", runId: "r2"), - RunFinishedEvent(threadId: "t1", runId: "r2"), - ]) - - let agent = AbstractAgent(transport: mockTransport) - try await agent.runAgent() - - let thinking = await agent.thinking - XCTAssertNotNil(thinking) - } - // MARK: - Sequential multi-run (state persists) func testSequentialRunsMaintainState() async throws { diff --git a/Tests/AGUIAgentSDKTests/HistoryTrimmingTests.swift b/Tests/AGUIAgentSDKTests/HistoryTrimmingTests.swift index 4151285..eb89b60 100644 --- a/Tests/AGUIAgentSDKTests/HistoryTrimmingTests.swift +++ b/Tests/AGUIAgentSDKTests/HistoryTrimmingTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore @testable import AGUIAgentSDK diff --git a/Tests/AGUIAgentSDKTests/MockChatAgent.swift b/Tests/AGUIAgentSDKTests/MockChatAgent.swift index aaaac38..caf9a8d 100644 --- a/Tests/AGUIAgentSDKTests/MockChatAgent.swift +++ b/Tests/AGUIAgentSDKTests/MockChatAgent.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore import Foundation diff --git a/Tests/AGUIAgentSDKTests/Mocks/MockToolRegistry.swift b/Tests/AGUIAgentSDKTests/Mocks/MockToolRegistry.swift new file mode 100644 index 0000000..c8ef87e --- /dev/null +++ b/Tests/AGUIAgentSDKTests/Mocks/MockToolRegistry.swift @@ -0,0 +1,27 @@ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. + +import AGUICore +import AGUITools + +// MARK: - Shared mock ToolRegistry for AGUIAgentSDK tests + +actor MockToolRegistry: ToolRegistry { + private let tools: [Tool] + + init(tools: [Tool] = []) { + self.tools = tools + } + + func allTools() async -> [Tool] { tools } + func register(executor: any ToolExecutor) async throws {} + func unregister(toolName: String) async -> Bool { false } + func executor(for toolName: String) async -> (any ToolExecutor)? { nil } + func execute(context: ToolExecutionContext) async throws -> ToolExecutionResult { + ToolExecutionResult(success: false, message: "mock") + } + func isToolRegistered(toolName: String) async -> Bool { false } + func stats(for toolName: String) async -> ToolExecutionStats? { nil } + func getAllStats() async -> [String: ToolExecutionStats] { [:] } + func clearStats() async {} + func getAllExecutors() async -> [String: any ToolExecutor] { [:] } +} diff --git a/Tests/AGUIAgentSDKTests/StatefulAgUiAgentTests.swift b/Tests/AGUIAgentSDKTests/StatefulAgUiAgentTests.swift index 7491f93..5c1468c 100644 --- a/Tests/AGUIAgentSDKTests/StatefulAgUiAgentTests.swift +++ b/Tests/AGUIAgentSDKTests/StatefulAgUiAgentTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUIClient import AGUICore diff --git a/Tests/AGUIClientTests/AGUIClientTests.swift b/Tests/AGUIClientTests/AGUIClientTests.swift index 025441f..c73f503 100644 --- a/Tests/AGUIClientTests/AGUIClientTests.swift +++ b/Tests/AGUIClientTests/AGUIClientTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUIClient diff --git a/Tests/AGUIClientTests/HttpAgentTests.swift b/Tests/AGUIClientTests/HttpAgentTests.swift index 94a16da..cf415b3 100644 --- a/Tests/AGUIClientTests/HttpAgentTests.swift +++ b/Tests/AGUIClientTests/HttpAgentTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUIClient diff --git a/Tests/AGUIClientTests/SseReconnectionTests.swift b/Tests/AGUIClientTests/SseReconnectionTests.swift index 71197d6..83f8470 100644 --- a/Tests/AGUIClientTests/SseReconnectionTests.swift +++ b/Tests/AGUIClientTests/SseReconnectionTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUIClient diff --git a/Tests/AGUIClientTests/State/DefaultApplyEventsTests.swift b/Tests/AGUIClientTests/State/DefaultApplyEventsTests.swift index 3faa971..ffc52fc 100644 --- a/Tests/AGUIClientTests/State/DefaultApplyEventsTests.swift +++ b/Tests/AGUIClientTests/State/DefaultApplyEventsTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore @testable import AGUIClient diff --git a/Tests/AGUIClientTests/State/PatchApplicatorTests.swift b/Tests/AGUIClientTests/State/PatchApplicatorTests.swift index 955478a..49c3491 100644 --- a/Tests/AGUIClientTests/State/PatchApplicatorTests.swift +++ b/Tests/AGUIClientTests/State/PatchApplicatorTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUIClient diff --git a/Tests/AGUIClientTests/State/StateManagerTests.swift b/Tests/AGUIClientTests/State/StateManagerTests.swift index b066c4f..90375a7 100644 --- a/Tests/AGUIClientTests/State/StateManagerTests.swift +++ b/Tests/AGUIClientTests/State/StateManagerTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUIClient diff --git a/Tests/AGUIClientTests/Streaming/BufferingTests.swift b/Tests/AGUIClientTests/Streaming/BufferingTests.swift index 69d2dca..5b8ec92 100644 --- a/Tests/AGUIClientTests/Streaming/BufferingTests.swift +++ b/Tests/AGUIClientTests/Streaming/BufferingTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUIClient diff --git a/Tests/AGUIClientTests/Streaming/ChunkTransformTests.swift b/Tests/AGUIClientTests/Streaming/ChunkTransformTests.swift index 9b0955d..0071d70 100644 --- a/Tests/AGUIClientTests/Streaming/ChunkTransformTests.swift +++ b/Tests/AGUIClientTests/Streaming/ChunkTransformTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore @testable import AGUIClient diff --git a/Tests/AGUIClientTests/Streaming/EventStreamTests.swift b/Tests/AGUIClientTests/Streaming/EventStreamTests.swift index 1739a87..91dcf88 100644 --- a/Tests/AGUIClientTests/Streaming/EventStreamTests.swift +++ b/Tests/AGUIClientTests/Streaming/EventStreamTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUIClient diff --git a/Tests/AGUIClientTests/Streaming/EventVerifierTests.swift b/Tests/AGUIClientTests/Streaming/EventVerifierTests.swift index a39a660..b0d829a 100644 --- a/Tests/AGUIClientTests/Streaming/EventVerifierTests.swift +++ b/Tests/AGUIClientTests/Streaming/EventVerifierTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore @testable import AGUIClient diff --git a/Tests/AGUIClientTests/Streaming/SseParserTests.swift b/Tests/AGUIClientTests/Streaming/SseParserTests.swift index a5e32cf..de92bb0 100644 --- a/Tests/AGUIClientTests/Streaming/SseParserTests.swift +++ b/Tests/AGUIClientTests/Streaming/SseParserTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUIClient diff --git a/Tests/AGUIClientTests/Subscriber/AgentSubscriberTests.swift b/Tests/AGUIClientTests/Subscriber/AgentSubscriberTests.swift index 1dd935a..9c7edc0 100644 --- a/Tests/AGUIClientTests/Subscriber/AgentSubscriberTests.swift +++ b/Tests/AGUIClientTests/Subscriber/AgentSubscriberTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import AGUICore @testable import AGUIClient diff --git a/Tests/AGUIClientTests/Transport/ClientErrorTests.swift b/Tests/AGUIClientTests/Transport/ClientErrorTests.swift index a9f4339..169cb5e 100644 --- a/Tests/AGUIClientTests/Transport/ClientErrorTests.swift +++ b/Tests/AGUIClientTests/Transport/ClientErrorTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUIClient diff --git a/Tests/AGUIClientTests/Transport/HttpAgentConfigurationTests.swift b/Tests/AGUIClientTests/Transport/HttpAgentConfigurationTests.swift index 9c6b612..b1c7834 100644 --- a/Tests/AGUIClientTests/Transport/HttpAgentConfigurationTests.swift +++ b/Tests/AGUIClientTests/Transport/HttpAgentConfigurationTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUIClient diff --git a/Tests/AGUIClientTests/Transport/HttpTransportTests.swift b/Tests/AGUIClientTests/Transport/HttpTransportTests.swift index 1d5a1ed..4fd3b44 100644 --- a/Tests/AGUIClientTests/Transport/HttpTransportTests.swift +++ b/Tests/AGUIClientTests/Transport/HttpTransportTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUIClient diff --git a/Tests/AGUIClientTests/Transport/MockHTTPClient.swift b/Tests/AGUIClientTests/Transport/MockHTTPClient.swift index a632015..04358a9 100644 --- a/Tests/AGUIClientTests/Transport/MockHTTPClient.swift +++ b/Tests/AGUIClientTests/Transport/MockHTTPClient.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation @testable import AGUIClient diff --git a/Tests/AGUIClientTests/Transport/URLSessionHTTPClientTests.swift b/Tests/AGUIClientTests/Transport/URLSessionHTTPClientTests.swift index 752ddcf..d04343a 100644 --- a/Tests/AGUIClientTests/Transport/URLSessionHTTPClientTests.swift +++ b/Tests/AGUIClientTests/Transport/URLSessionHTTPClientTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUIClient diff --git a/Tests/AGUICoreTests/ActivityEvents/ActivityDeltaEventTests.swift b/Tests/AGUICoreTests/ActivityEvents/ActivityDeltaEventTests.swift index 5ad81f5..8c6345c 100644 --- a/Tests/AGUICoreTests/ActivityEvents/ActivityDeltaEventTests.swift +++ b/Tests/AGUICoreTests/ActivityEvents/ActivityDeltaEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/ActivityEvents/ActivitySnapshotEventTests.swift b/Tests/AGUICoreTests/ActivityEvents/ActivitySnapshotEventTests.swift index b790751..0a22019 100644 --- a/Tests/AGUICoreTests/ActivityEvents/ActivitySnapshotEventTests.swift +++ b/Tests/AGUICoreTests/ActivityEvents/ActivitySnapshotEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Encoding/MessageEncoderTests.swift b/Tests/AGUICoreTests/Encoding/MessageEncoderTests.swift index 541824d..d56eead 100644 --- a/Tests/AGUICoreTests/Encoding/MessageEncoderTests.swift +++ b/Tests/AGUICoreTests/Encoding/MessageEncoderTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Helpers/AGUIEventDecoderTestHelpers.swift b/Tests/AGUICoreTests/Helpers/AGUIEventDecoderTestHelpers.swift index 43578db..43283bb 100644 --- a/Tests/AGUICoreTests/Helpers/AGUIEventDecoderTestHelpers.swift +++ b/Tests/AGUICoreTests/Helpers/AGUIEventDecoderTestHelpers.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Helpers/EventDecodingErrorTests.swift b/Tests/AGUICoreTests/Helpers/EventDecodingErrorTests.swift index d77e213..b89d7e1 100644 --- a/Tests/AGUICoreTests/Helpers/EventDecodingErrorTests.swift +++ b/Tests/AGUICoreTests/Helpers/EventDecodingErrorTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Helpers/EventTestData.swift b/Tests/AGUICoreTests/Helpers/EventTestData.swift index d20c670..755ecd3 100644 --- a/Tests/AGUICoreTests/Helpers/EventTestData.swift +++ b/Tests/AGUICoreTests/Helpers/EventTestData.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import Foundation @testable import AGUICore diff --git a/Tests/AGUICoreTests/LifeCycleEvents/RunErrorEventTests.swift b/Tests/AGUICoreTests/LifeCycleEvents/RunErrorEventTests.swift index 7876660..75a5a84 100644 --- a/Tests/AGUICoreTests/LifeCycleEvents/RunErrorEventTests.swift +++ b/Tests/AGUICoreTests/LifeCycleEvents/RunErrorEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/LifeCycleEvents/RunFinishedEventTests.swift b/Tests/AGUICoreTests/LifeCycleEvents/RunFinishedEventTests.swift index f9dff7a..88b0d59 100644 --- a/Tests/AGUICoreTests/LifeCycleEvents/RunFinishedEventTests.swift +++ b/Tests/AGUICoreTests/LifeCycleEvents/RunFinishedEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/LifeCycleEvents/RunStartedEventTests.swift b/Tests/AGUICoreTests/LifeCycleEvents/RunStartedEventTests.swift index 1244f55..97dc1c3 100644 --- a/Tests/AGUICoreTests/LifeCycleEvents/RunStartedEventTests.swift +++ b/Tests/AGUICoreTests/LifeCycleEvents/RunStartedEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/LifeCycleEvents/StepFinishedEventTests.swift b/Tests/AGUICoreTests/LifeCycleEvents/StepFinishedEventTests.swift index 27abc12..2e0c33c 100644 --- a/Tests/AGUICoreTests/LifeCycleEvents/StepFinishedEventTests.swift +++ b/Tests/AGUICoreTests/LifeCycleEvents/StepFinishedEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/LifeCycleEvents/StepStartedEventTests.swift b/Tests/AGUICoreTests/LifeCycleEvents/StepStartedEventTests.swift index 25a7659..f3aea94 100644 --- a/Tests/AGUICoreTests/LifeCycleEvents/StepStartedEventTests.swift +++ b/Tests/AGUICoreTests/LifeCycleEvents/StepStartedEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/ReasoningEvents/ReasoningEncryptedValueEventTests.swift b/Tests/AGUICoreTests/ReasoningEvents/ReasoningEncryptedValueEventTests.swift index 3a25e38..aecb739 100644 --- a/Tests/AGUICoreTests/ReasoningEvents/ReasoningEncryptedValueEventTests.swift +++ b/Tests/AGUICoreTests/ReasoningEvents/ReasoningEncryptedValueEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/ReasoningEvents/ReasoningEndEventTests.swift b/Tests/AGUICoreTests/ReasoningEvents/ReasoningEndEventTests.swift index 441d8cb..9de6bf0 100644 --- a/Tests/AGUICoreTests/ReasoningEvents/ReasoningEndEventTests.swift +++ b/Tests/AGUICoreTests/ReasoningEvents/ReasoningEndEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageChunkEventTests.swift b/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageChunkEventTests.swift index 512ea45..a213b79 100644 --- a/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageChunkEventTests.swift +++ b/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageChunkEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageContentEventTests.swift b/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageContentEventTests.swift index eb6dd36..b651c0b 100644 --- a/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageContentEventTests.swift +++ b/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageContentEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageEndEventTests.swift b/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageEndEventTests.swift index baa0d85..6ba67ec 100644 --- a/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageEndEventTests.swift +++ b/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageEndEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageStartEventTests.swift b/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageStartEventTests.swift index 49e7248..64316b2 100644 --- a/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageStartEventTests.swift +++ b/Tests/AGUICoreTests/ReasoningEvents/ReasoningMessageStartEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/ReasoningEvents/ReasoningStartEventTests.swift b/Tests/AGUICoreTests/ReasoningEvents/ReasoningStartEventTests.swift index c8b32e6..61a52d5 100644 --- a/Tests/AGUICoreTests/ReasoningEvents/ReasoningStartEventTests.swift +++ b/Tests/AGUICoreTests/ReasoningEvents/ReasoningStartEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/SpecialEvents/CustomEventTests.swift b/Tests/AGUICoreTests/SpecialEvents/CustomEventTests.swift index fcb8bae..4d739a1 100644 --- a/Tests/AGUICoreTests/SpecialEvents/CustomEventTests.swift +++ b/Tests/AGUICoreTests/SpecialEvents/CustomEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/SpecialEvents/RawEventTests.swift b/Tests/AGUICoreTests/SpecialEvents/RawEventTests.swift index c96bfae..fe97441 100644 --- a/Tests/AGUICoreTests/SpecialEvents/RawEventTests.swift +++ b/Tests/AGUICoreTests/SpecialEvents/RawEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/SpecialEvents/UnknownEventTests.swift b/Tests/AGUICoreTests/SpecialEvents/UnknownEventTests.swift index a164812..0fd0d3b 100644 --- a/Tests/AGUICoreTests/SpecialEvents/UnknownEventTests.swift +++ b/Tests/AGUICoreTests/SpecialEvents/UnknownEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/StateEvents/MessagesSnapshotEventTests.swift b/Tests/AGUICoreTests/StateEvents/MessagesSnapshotEventTests.swift index 42c7a79..8afa11a 100644 --- a/Tests/AGUICoreTests/StateEvents/MessagesSnapshotEventTests.swift +++ b/Tests/AGUICoreTests/StateEvents/MessagesSnapshotEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/StateEvents/StateDeltaEventTests.swift b/Tests/AGUICoreTests/StateEvents/StateDeltaEventTests.swift index 3ec8895..c78c60c 100644 --- a/Tests/AGUICoreTests/StateEvents/StateDeltaEventTests.swift +++ b/Tests/AGUICoreTests/StateEvents/StateDeltaEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/StateEvents/StateSnapshotEventTests.swift b/Tests/AGUICoreTests/StateEvents/StateSnapshotEventTests.swift index 3912cf9..9692c16 100644 --- a/Tests/AGUICoreTests/StateEvents/StateSnapshotEventTests.swift +++ b/Tests/AGUICoreTests/StateEvents/StateSnapshotEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/TextMessageEvents/TextMessageChunkEventTests.swift b/Tests/AGUICoreTests/TextMessageEvents/TextMessageChunkEventTests.swift index e210987..564369b 100644 --- a/Tests/AGUICoreTests/TextMessageEvents/TextMessageChunkEventTests.swift +++ b/Tests/AGUICoreTests/TextMessageEvents/TextMessageChunkEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/TextMessageEvents/TextMessageContentEventTests.swift b/Tests/AGUICoreTests/TextMessageEvents/TextMessageContentEventTests.swift index 329f3e1..8dfd0f1 100644 --- a/Tests/AGUICoreTests/TextMessageEvents/TextMessageContentEventTests.swift +++ b/Tests/AGUICoreTests/TextMessageEvents/TextMessageContentEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/TextMessageEvents/TextMessageEndEventTests.swift b/Tests/AGUICoreTests/TextMessageEvents/TextMessageEndEventTests.swift index fb083b3..7d2a5b6 100644 --- a/Tests/AGUICoreTests/TextMessageEvents/TextMessageEndEventTests.swift +++ b/Tests/AGUICoreTests/TextMessageEvents/TextMessageEndEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/TextMessageEvents/TextMessageStartEventTests.swift b/Tests/AGUICoreTests/TextMessageEvents/TextMessageStartEventTests.swift index b8d5a67..8cfc8bd 100644 --- a/Tests/AGUICoreTests/TextMessageEvents/TextMessageStartEventTests.swift +++ b/Tests/AGUICoreTests/TextMessageEvents/TextMessageStartEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/ThinkingEvents/ThinkingEndEventTests.swift b/Tests/AGUICoreTests/ThinkingEvents/ThinkingEndEventTests.swift deleted file mode 100644 index 276e44c..0000000 --- a/Tests/AGUICoreTests/ThinkingEvents/ThinkingEndEventTests.swift +++ /dev/null @@ -1,196 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import XCTest -@testable import AGUICore - -final class ThinkingEndEventTests: XCTestCase, - AGUIEventDecoderTestHelpers, - EventDecodingErrorTests { - - // MARK: - EventDecodingErrorTests Protocol Requirements - - var validEventFieldsWithoutType: [String: Any] { - [:] - } - - var eventTypeString: String { "THINKING_END" } - var expectedEventType: EventType { .thinkingEnd } - var unknownEventTypeString: String { "THINKING_PAUSE" } - - // MARK: - Feature: Decode THINKING_END - - func test_decodeValidThinkingEnd_returnsThinkingEndEvent() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_END" - } - """) - - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - guard let thinkingEnd = event as? ThinkingEndEvent else { - return XCTFail("Expected ThinkingEndEvent, got \(type(of: event))") - } - XCTAssertEqual(thinkingEnd.eventType, .thinkingEnd) - XCTAssertNil(thinkingEnd.timestamp) - } - - func test_decodeThinkingEnd_withTimestamp_populatesTimestamp() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_END", - "timestamp": \(EventTestData.timestamp) - } - """) - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - let thinkingEnd = try XCTUnwrap(event as? ThinkingEndEvent) - XCTAssertEqual(thinkingEnd.timestamp, EventTestData.timestamp) - } - - func test_decodeThinkingEnd_preservesRawEventBytes() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_END", - "timestamp": \(EventTestData.timestamp) - } - """) - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - let thinkingEnd = try XCTUnwrap(event as? ThinkingEndEvent) - XCTAssertEqual(thinkingEnd.rawEvent, data) - } - - func test_decodeThinkingEnd_ignoresUnknownExtraFields() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_END", - "extraField": "ignored", - "nested": { "x": 1 } - } - """) - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - let thinkingEnd = try XCTUnwrap(event as? ThinkingEndEvent) - XCTAssertEqual(thinkingEnd.eventType, .thinkingEnd) - } - - func test_decodeThinkingEnd_wrongTypeForTimestamp_throwsDecodingFailed() { - // Given - let data = jsonData(""" - { - "type": "THINKING_END", - "timestamp": "not-a-number" - } - """) - let decoder = makeStrictDecoder() - - // When / Then - XCTAssertThrowsError(try decoder.decode(data)) { error in - guard case .decodingFailed(let message) = error as? EventDecodingError else { - return XCTFail("Expected decodingFailed, got \(error)") - } - XCTAssertTrue(message.contains("timestamp") || message.contains("Type mismatch")) - } - } - - // MARK: - Feature: Model behaviors - - func test_thinkingEndEvent_eventTypeIsAlwaysThinkingEnd() { - // Given - let event = ThinkingEndEvent(timestamp: nil, rawEvent: nil) - - // Then - XCTAssertEqual(event.eventType, .thinkingEnd) - } - - func test_thinkingEndEvent_equatable_sameFields_areEqual() { - // Given - let event1 = ThinkingEndEvent(timestamp: EventTestData.timestamp, rawEvent: nil) - let event2 = ThinkingEndEvent(timestamp: EventTestData.timestamp, rawEvent: nil) - - // Then - XCTAssertEqual(event1, event2) - } - - func test_thinkingEndEvent_equatable_differentTimestamps_areNotEqual() { - // Given - let event1 = ThinkingEndEvent(timestamp: EventTestData.timestamp, rawEvent: nil) - let event2 = ThinkingEndEvent(timestamp: EventTestData.timestamp2, rawEvent: nil) - - // Then - XCTAssertNotEqual(event1, event2) - } - - func test_thinkingEndEvent_equatable_oneWithTimestampOneWithout_areNotEqual() { - // Given - let event1 = ThinkingEndEvent(timestamp: EventTestData.timestamp, rawEvent: nil) - let event2 = ThinkingEndEvent(timestamp: nil, rawEvent: nil) - - // Then - XCTAssertNotEqual(event1, event2) - } - - func test_thinkingEndEvent_description_containsKeyInformation() { - // Given - let event = ThinkingEndEvent(timestamp: EventTestData.timestamp, rawEvent: nil) - - // Then - let description = event.description - XCTAssertTrue(description.contains("ThinkingEndEvent")) - XCTAssertTrue(description.contains("timestamp")) - } - - func test_thinkingEndEvent_debugDescription_containsDetailedInformation() { - // Given - let event = ThinkingEndEvent(timestamp: EventTestData.timestamp, rawEvent: nil) - - // Then - let debugDescription = event.debugDescription - XCTAssertTrue(debugDescription.contains("ThinkingEndEvent")) - XCTAssertTrue(debugDescription.contains("timestamp")) - XCTAssertTrue(debugDescription.contains("eventType")) - } -} diff --git a/Tests/AGUICoreTests/ThinkingEvents/ThinkingStartEventTests.swift b/Tests/AGUICoreTests/ThinkingEvents/ThinkingStartEventTests.swift deleted file mode 100644 index 7080093..0000000 --- a/Tests/AGUICoreTests/ThinkingEvents/ThinkingStartEventTests.swift +++ /dev/null @@ -1,226 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import XCTest -@testable import AGUICore - -final class ThinkingStartEventTests: XCTestCase, - AGUIEventDecoderTestHelpers, - EventDecodingErrorTests { - - // MARK: - EventDecodingErrorTests Protocol Requirements - - var validEventFieldsWithoutType: [String: Any] { - ["title": "Analyzing user request"] - } - - var eventTypeString: String { "THINKING_START" } - var expectedEventType: EventType { .thinkingStart } - var unknownEventTypeString: String { "THINKING_PAUSE" } - - // MARK: - Feature: Decode THINKING_START - - func test_decodeValidThinkingStart_returnsThinkingStartEvent() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_START" - } - """) - - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - guard let thinkingStart = event as? ThinkingStartEvent else { - return XCTFail("Expected ThinkingStartEvent, got \(type(of: event))") - } - XCTAssertEqual(thinkingStart.eventType, .thinkingStart) - XCTAssertNil(thinkingStart.title) - XCTAssertNil(thinkingStart.timestamp) - } - - func test_decodeThinkingStart_withTitle_populatesTitle() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_START", - "title": "Analyzing user request" - } - """) - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - let thinkingStart = try XCTUnwrap(event as? ThinkingStartEvent) - XCTAssertEqual(thinkingStart.title, "Analyzing user request") - } - - func test_decodeThinkingStart_withTimestamp_populatesTimestamp() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_START", - "timestamp": \(EventTestData.timestamp) - } - """) - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - let thinkingStart = try XCTUnwrap(event as? ThinkingStartEvent) - XCTAssertEqual(thinkingStart.timestamp, EventTestData.timestamp) - } - - func test_decodeThinkingStart_preservesRawEventBytes() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_START", - "timestamp": \(EventTestData.timestamp) - } - """) - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - let thinkingStart = try XCTUnwrap(event as? ThinkingStartEvent) - XCTAssertEqual(thinkingStart.rawEvent, data) - } - - func test_decodeThinkingStart_ignoresUnknownExtraFields() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_START", - "extraField": "ignored", - "nested": { "x": 1 } - } - """) - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - let thinkingStart = try XCTUnwrap(event as? ThinkingStartEvent) - XCTAssertEqual(thinkingStart.eventType, .thinkingStart) - } - - func test_decodeThinkingStart_wrongTypeForTimestamp_throwsDecodingFailed() { - // Given - let data = jsonData(""" - { - "type": "THINKING_START", - "timestamp": "not-a-number" - } - """) - let decoder = makeStrictDecoder() - - // When / Then - XCTAssertThrowsError(try decoder.decode(data)) { error in - guard case .decodingFailed(let message) = error as? EventDecodingError else { - return XCTFail("Expected decodingFailed, got \(error)") - } - XCTAssertTrue(message.contains("timestamp") || message.contains("Type mismatch")) - } - } - - // MARK: - Feature: Model behaviors - - func test_thinkingStartEvent_eventTypeIsAlwaysThinkingStart() { - // Given - let event = ThinkingStartEvent(title: nil, timestamp: nil, rawEvent: nil) - - // Then - XCTAssertEqual(event.eventType, .thinkingStart) - } - - func test_thinkingStartEvent_equatable_sameFields_areEqual() { - // Given - let event1 = ThinkingStartEvent(title: "Analyzing", timestamp: EventTestData.timestamp, rawEvent: nil) - let event2 = ThinkingStartEvent(title: "Analyzing", timestamp: EventTestData.timestamp, rawEvent: nil) - - // Then - XCTAssertEqual(event1, event2) - } - - func test_thinkingStartEvent_equatable_differentTitles_areNotEqual() { - // Given - let event1 = ThinkingStartEvent(title: "Analyzing", timestamp: EventTestData.timestamp, rawEvent: nil) - let event2 = ThinkingStartEvent(title: "Planning", timestamp: EventTestData.timestamp, rawEvent: nil) - - // Then - XCTAssertNotEqual(event1, event2) - } - - func test_thinkingStartEvent_equatable_differentTimestamps_areNotEqual() { - // Given - let event1 = ThinkingStartEvent(title: "Analyzing", timestamp: EventTestData.timestamp, rawEvent: nil) - let event2 = ThinkingStartEvent(title: "Analyzing", timestamp: EventTestData.timestamp2, rawEvent: nil) - - // Then - XCTAssertNotEqual(event1, event2) - } - - func test_thinkingStartEvent_equatable_oneWithTimestampOneWithout_areNotEqual() { - // Given - let event1 = ThinkingStartEvent(title: "Analyzing", timestamp: EventTestData.timestamp, rawEvent: nil) - let event2 = ThinkingStartEvent(title: "Analyzing", timestamp: nil, rawEvent: nil) - - // Then - XCTAssertNotEqual(event1, event2) - } - - func test_thinkingStartEvent_description_containsKeyInformation() { - // Given - let event = ThinkingStartEvent(title: "Analyzing", timestamp: EventTestData.timestamp, rawEvent: nil) - - // Then - let description = event.description - XCTAssertTrue(description.contains("ThinkingStartEvent")) - XCTAssertTrue(description.contains("title")) - XCTAssertTrue(description.contains("timestamp")) - } - - func test_thinkingStartEvent_debugDescription_containsDetailedInformation() { - // Given - let event = ThinkingStartEvent(title: "Analyzing", timestamp: EventTestData.timestamp, rawEvent: nil) - - // Then - let debugDescription = event.debugDescription - XCTAssertTrue(debugDescription.contains("ThinkingStartEvent")) - XCTAssertTrue(debugDescription.contains("title")) - XCTAssertTrue(debugDescription.contains("timestamp")) - XCTAssertTrue(debugDescription.contains("eventType")) - } -} diff --git a/Tests/AGUICoreTests/ThinkingEvents/ThinkingTextMessageContentEventTests.swift b/Tests/AGUICoreTests/ThinkingEvents/ThinkingTextMessageContentEventTests.swift deleted file mode 100644 index 5ea10ef..0000000 --- a/Tests/AGUICoreTests/ThinkingEvents/ThinkingTextMessageContentEventTests.swift +++ /dev/null @@ -1,188 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import XCTest -@testable import AGUICore - -final class ThinkingTextMessageContentEventTests: XCTestCase, - AGUIEventDecoderTestHelpers, - EventDecodingErrorTests { - - // MARK: - EventDecodingErrorTests Protocol Requirements - - var validEventFieldsWithoutType: [String: Any] { - ["delta": "Analyzing the problem..."] - } - - var eventTypeString: String { "THINKING_TEXT_MESSAGE_CONTENT" } - var expectedEventType: EventType { .thinkingTextMessageContent } - var unknownEventTypeString: String { "THINKING_TEXT_MESSAGE_CHUNK" } - - // MARK: - Feature: Decode THINKING_TEXT_MESSAGE_CONTENT - - func test_decodeValidThinkingTextMessageContent_returnsEvent() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_TEXT_MESSAGE_CONTENT", - "delta": "Analyzing the problem..." - } - """) - - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - guard let content = event as? ThinkingTextMessageContentEvent else { - return XCTFail("Expected ThinkingTextMessageContentEvent, got \(type(of: event))") - } - XCTAssertEqual(content.eventType, .thinkingTextMessageContent) - XCTAssertEqual(content.delta, "Analyzing the problem...") - XCTAssertNil(content.timestamp) - } - - func test_decodeThinkingTextMessageContent_withTimestamp_populatesTimestamp() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_TEXT_MESSAGE_CONTENT", - "delta": "Thinking...", - "timestamp": \(EventTestData.timestamp) - } - """) - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - let content = try XCTUnwrap(event as? ThinkingTextMessageContentEvent) - XCTAssertEqual(content.delta, "Thinking...") - XCTAssertEqual(content.timestamp, EventTestData.timestamp) - } - - func test_decodeThinkingTextMessageContent_preservesRawEventBytes() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_TEXT_MESSAGE_CONTENT", - "delta": "test" - } - """) - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - let content = try XCTUnwrap(event as? ThinkingTextMessageContentEvent) - XCTAssertEqual(content.rawEvent, data) - } - - func test_decodeThinkingTextMessageContent_missingDelta_throwsDecodingFailed() { - // Given - let data = jsonData(""" - { - "type": "THINKING_TEXT_MESSAGE_CONTENT" - } - """) - let decoder = makeStrictDecoder() - - // When / Then - XCTAssertThrowsError(try decoder.decode(data)) { error in - guard case .decodingFailed(let message) = error as? EventDecodingError else { - return XCTFail("Expected decodingFailed, got \(error)") - } - XCTAssertTrue(message.contains("delta") || message.contains("Missing key")) - } - } - - func test_decodeThinkingTextMessageContent_wrongTypeForDelta_throwsDecodingFailed() { - // Given - let data = jsonData(""" - { - "type": "THINKING_TEXT_MESSAGE_CONTENT", - "delta": 123 - } - """) - let decoder = makeStrictDecoder() - - // When / Then - XCTAssertThrowsError(try decoder.decode(data)) { error in - guard case .decodingFailed(let message) = error as? EventDecodingError else { - return XCTFail("Expected decodingFailed, got \(error)") - } - XCTAssertTrue(message.contains("delta") || message.contains("Type mismatch")) - } - } - - // MARK: - Feature: Model behaviors - - func test_thinkingTextMessageContentEvent_eventTypeIsAlways() { - // Given - let event = ThinkingTextMessageContentEvent(delta: "test", timestamp: nil, rawEvent: nil) - - // Then - XCTAssertEqual(event.eventType, .thinkingTextMessageContent) - } - - func test_thinkingTextMessageContentEvent_equatable_sameFields_areEqual() { - // Given - let event1 = ThinkingTextMessageContentEvent(delta: "test", timestamp: EventTestData.timestamp, rawEvent: nil) - let event2 = ThinkingTextMessageContentEvent(delta: "test", timestamp: EventTestData.timestamp, rawEvent: nil) - - // Then - XCTAssertEqual(event1, event2) - } - - func test_thinkingTextMessageContentEvent_equatable_differentDeltas_areNotEqual() { - // Given - let event1 = ThinkingTextMessageContentEvent(delta: "test1", timestamp: EventTestData.timestamp, rawEvent: nil) - let event2 = ThinkingTextMessageContentEvent(delta: "test2", timestamp: EventTestData.timestamp, rawEvent: nil) - - // Then - XCTAssertNotEqual(event1, event2) - } - - func test_thinkingTextMessageContentEvent_equatable_differentTimestamps_areNotEqual() { - // Given - let event1 = ThinkingTextMessageContentEvent(delta: "test", timestamp: EventTestData.timestamp, rawEvent: nil) - let event2 = ThinkingTextMessageContentEvent(delta: "test", timestamp: EventTestData.timestamp2, rawEvent: nil) - - // Then - XCTAssertNotEqual(event1, event2) - } - - func test_thinkingTextMessageContentEvent_description_containsKeyInformation() { - // Given - let event = ThinkingTextMessageContentEvent(delta: "test", timestamp: EventTestData.timestamp, rawEvent: nil) - - // Then - let description = event.description - XCTAssertTrue(description.contains("ThinkingTextMessageContentEvent")) - XCTAssertTrue(description.contains("delta")) - } -} diff --git a/Tests/AGUICoreTests/ThinkingEvents/ThinkingTextMessageEndEventTests.swift b/Tests/AGUICoreTests/ThinkingEvents/ThinkingTextMessageEndEventTests.swift deleted file mode 100644 index 9ba7c42..0000000 --- a/Tests/AGUICoreTests/ThinkingEvents/ThinkingTextMessageEndEventTests.swift +++ /dev/null @@ -1,175 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import XCTest -@testable import AGUICore - -final class ThinkingTextMessageEndEventTests: XCTestCase, - AGUIEventDecoderTestHelpers, - EventDecodingErrorTests { - - // MARK: - EventDecodingErrorTests Protocol Requirements - - var validEventFieldsWithoutType: [String: Any] { - [:] - } - - var eventTypeString: String { "THINKING_TEXT_MESSAGE_END" } - var expectedEventType: EventType { .thinkingTextMessageEnd } - var unknownEventTypeString: String { "THINKING_TEXT_MESSAGE_COMPLETE" } - - // MARK: - Feature: Decode THINKING_TEXT_MESSAGE_END - - func test_decodeValidThinkingTextMessageEnd_returnsEvent() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_TEXT_MESSAGE_END" - } - """) - - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - guard let thinkingEnd = event as? ThinkingTextMessageEndEvent else { - return XCTFail("Expected ThinkingTextMessageEndEvent, got \(type(of: event))") - } - XCTAssertEqual(thinkingEnd.eventType, .thinkingTextMessageEnd) - XCTAssertNil(thinkingEnd.timestamp) - } - - func test_decodeThinkingTextMessageEnd_withTimestamp_populatesTimestamp() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_TEXT_MESSAGE_END", - "timestamp": \(EventTestData.timestamp) - } - """) - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - let thinkingEnd = try XCTUnwrap(event as? ThinkingTextMessageEndEvent) - XCTAssertEqual(thinkingEnd.timestamp, EventTestData.timestamp) - } - - func test_decodeThinkingTextMessageEnd_preservesRawEventBytes() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_TEXT_MESSAGE_END", - "timestamp": \(EventTestData.timestamp) - } - """) - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - let thinkingEnd = try XCTUnwrap(event as? ThinkingTextMessageEndEvent) - XCTAssertEqual(thinkingEnd.rawEvent, data) - } - - func test_decodeThinkingTextMessageEnd_ignoresUnknownExtraFields() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_TEXT_MESSAGE_END", - "extraField": "ignored" - } - """) - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - let thinkingEnd = try XCTUnwrap(event as? ThinkingTextMessageEndEvent) - XCTAssertEqual(thinkingEnd.eventType, .thinkingTextMessageEnd) - } - - func test_decodeThinkingTextMessageEnd_wrongTypeForTimestamp_throwsDecodingFailed() { - // Given - let data = jsonData(""" - { - "type": "THINKING_TEXT_MESSAGE_END", - "timestamp": "not-a-number" - } - """) - let decoder = makeStrictDecoder() - - // When / Then - XCTAssertThrowsError(try decoder.decode(data)) { error in - guard case .decodingFailed(let message) = error as? EventDecodingError else { - return XCTFail("Expected decodingFailed, got \(error)") - } - XCTAssertTrue(message.contains("timestamp") || message.contains("Type mismatch")) - } - } - - // MARK: - Feature: Model behaviors - - func test_thinkingTextMessageEndEvent_eventTypeIsAlways() { - // Given - let event = ThinkingTextMessageEndEvent(timestamp: nil, rawEvent: nil) - - // Then - XCTAssertEqual(event.eventType, .thinkingTextMessageEnd) - } - - func test_thinkingTextMessageEndEvent_equatable_sameFields_areEqual() { - // Given - let event1 = ThinkingTextMessageEndEvent(timestamp: EventTestData.timestamp, rawEvent: nil) - let event2 = ThinkingTextMessageEndEvent(timestamp: EventTestData.timestamp, rawEvent: nil) - - // Then - XCTAssertEqual(event1, event2) - } - - func test_thinkingTextMessageEndEvent_equatable_differentTimestamps_areNotEqual() { - // Given - let event1 = ThinkingTextMessageEndEvent(timestamp: EventTestData.timestamp, rawEvent: nil) - let event2 = ThinkingTextMessageEndEvent(timestamp: EventTestData.timestamp2, rawEvent: nil) - - // Then - XCTAssertNotEqual(event1, event2) - } - - func test_thinkingTextMessageEndEvent_description_containsKeyInformation() { - // Given - let event = ThinkingTextMessageEndEvent(timestamp: EventTestData.timestamp, rawEvent: nil) - - // Then - let description = event.description - XCTAssertTrue(description.contains("ThinkingTextMessageEndEvent")) - XCTAssertTrue(description.contains("timestamp")) - } -} diff --git a/Tests/AGUICoreTests/ThinkingEvents/ThinkingTextMessageStartEventTests.swift b/Tests/AGUICoreTests/ThinkingEvents/ThinkingTextMessageStartEventTests.swift deleted file mode 100644 index 529fd62..0000000 --- a/Tests/AGUICoreTests/ThinkingEvents/ThinkingTextMessageStartEventTests.swift +++ /dev/null @@ -1,175 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import XCTest -@testable import AGUICore - -final class ThinkingTextMessageStartEventTests: XCTestCase, - AGUIEventDecoderTestHelpers, - EventDecodingErrorTests { - - // MARK: - EventDecodingErrorTests Protocol Requirements - - var validEventFieldsWithoutType: [String: Any] { - [:] - } - - var eventTypeString: String { "THINKING_TEXT_MESSAGE_START" } - var expectedEventType: EventType { .thinkingTextMessageStart } - var unknownEventTypeString: String { "THINKING_TEXT_MESSAGE_PAUSE" } - - // MARK: - Feature: Decode THINKING_TEXT_MESSAGE_START - - func test_decodeValidThinkingTextMessageStart_returnsEvent() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_TEXT_MESSAGE_START" - } - """) - - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - guard let thinkingStart = event as? ThinkingTextMessageStartEvent else { - return XCTFail("Expected ThinkingTextMessageStartEvent, got \(type(of: event))") - } - XCTAssertEqual(thinkingStart.eventType, .thinkingTextMessageStart) - XCTAssertNil(thinkingStart.timestamp) - } - - func test_decodeThinkingTextMessageStart_withTimestamp_populatesTimestamp() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_TEXT_MESSAGE_START", - "timestamp": \(EventTestData.timestamp) - } - """) - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - let thinkingStart = try XCTUnwrap(event as? ThinkingTextMessageStartEvent) - XCTAssertEqual(thinkingStart.timestamp, EventTestData.timestamp) - } - - func test_decodeThinkingTextMessageStart_preservesRawEventBytes() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_TEXT_MESSAGE_START", - "timestamp": \(EventTestData.timestamp) - } - """) - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - let thinkingStart = try XCTUnwrap(event as? ThinkingTextMessageStartEvent) - XCTAssertEqual(thinkingStart.rawEvent, data) - } - - func test_decodeThinkingTextMessageStart_ignoresUnknownExtraFields() throws { - // Given - let data = jsonData(""" - { - "type": "THINKING_TEXT_MESSAGE_START", - "extraField": "ignored" - } - """) - let decoder = makeStrictDecoder() - - // When - let event = try decoder.decode(data) - - // Then - let thinkingStart = try XCTUnwrap(event as? ThinkingTextMessageStartEvent) - XCTAssertEqual(thinkingStart.eventType, .thinkingTextMessageStart) - } - - func test_decodeThinkingTextMessageStart_wrongTypeForTimestamp_throwsDecodingFailed() { - // Given - let data = jsonData(""" - { - "type": "THINKING_TEXT_MESSAGE_START", - "timestamp": "not-a-number" - } - """) - let decoder = makeStrictDecoder() - - // When / Then - XCTAssertThrowsError(try decoder.decode(data)) { error in - guard case .decodingFailed(let message) = error as? EventDecodingError else { - return XCTFail("Expected decodingFailed, got \(error)") - } - XCTAssertTrue(message.contains("timestamp") || message.contains("Type mismatch")) - } - } - - // MARK: - Feature: Model behaviors - - func test_thinkingTextMessageStartEvent_eventTypeIsAlways() { - // Given - let event = ThinkingTextMessageStartEvent(timestamp: nil, rawEvent: nil) - - // Then - XCTAssertEqual(event.eventType, .thinkingTextMessageStart) - } - - func test_thinkingTextMessageStartEvent_equatable_sameFields_areEqual() { - // Given - let event1 = ThinkingTextMessageStartEvent(timestamp: EventTestData.timestamp, rawEvent: nil) - let event2 = ThinkingTextMessageStartEvent(timestamp: EventTestData.timestamp, rawEvent: nil) - - // Then - XCTAssertEqual(event1, event2) - } - - func test_thinkingTextMessageStartEvent_equatable_differentTimestamps_areNotEqual() { - // Given - let event1 = ThinkingTextMessageStartEvent(timestamp: EventTestData.timestamp, rawEvent: nil) - let event2 = ThinkingTextMessageStartEvent(timestamp: EventTestData.timestamp2, rawEvent: nil) - - // Then - XCTAssertNotEqual(event1, event2) - } - - func test_thinkingTextMessageStartEvent_description_containsKeyInformation() { - // Given - let event = ThinkingTextMessageStartEvent(timestamp: EventTestData.timestamp, rawEvent: nil) - - // Then - let description = event.description - XCTAssertTrue(description.contains("ThinkingTextMessageStartEvent")) - XCTAssertTrue(description.contains("timestamp")) - } -} diff --git a/Tests/AGUICoreTests/ToolCallEvents/ToolCallArgsEventTests.swift b/Tests/AGUICoreTests/ToolCallEvents/ToolCallArgsEventTests.swift index fd6198c..4c45db9 100644 --- a/Tests/AGUICoreTests/ToolCallEvents/ToolCallArgsEventTests.swift +++ b/Tests/AGUICoreTests/ToolCallEvents/ToolCallArgsEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/ToolCallEvents/ToolCallChunkEventTests.swift b/Tests/AGUICoreTests/ToolCallEvents/ToolCallChunkEventTests.swift index 12df228..6edaca2 100644 --- a/Tests/AGUICoreTests/ToolCallEvents/ToolCallChunkEventTests.swift +++ b/Tests/AGUICoreTests/ToolCallEvents/ToolCallChunkEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/ToolCallEvents/ToolCallEndEventTests.swift b/Tests/AGUICoreTests/ToolCallEvents/ToolCallEndEventTests.swift index 6e39807..4205c32 100644 --- a/Tests/AGUICoreTests/ToolCallEvents/ToolCallEndEventTests.swift +++ b/Tests/AGUICoreTests/ToolCallEvents/ToolCallEndEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/ToolCallEvents/ToolCallResultEventTests.swift b/Tests/AGUICoreTests/ToolCallEvents/ToolCallResultEventTests.swift index 9a8981d..da3b212 100644 --- a/Tests/AGUICoreTests/ToolCallEvents/ToolCallResultEventTests.swift +++ b/Tests/AGUICoreTests/ToolCallEvents/ToolCallResultEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/ToolCallEvents/ToolCallStartEventTests.swift b/Tests/AGUICoreTests/ToolCallEvents/ToolCallStartEventTests.swift index 9be6d7b..3bdc64b 100644 --- a/Tests/AGUICoreTests/ToolCallEvents/ToolCallStartEventTests.swift +++ b/Tests/AGUICoreTests/ToolCallEvents/ToolCallStartEventTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/AgentExecution/ContextTests.swift b/Tests/AGUICoreTests/Types/AgentExecution/ContextTests.swift index a477a4c..d812187 100644 --- a/Tests/AGUICoreTests/Types/AgentExecution/ContextTests.swift +++ b/Tests/AGUICoreTests/Types/AgentExecution/ContextTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/AgentExecution/RunAgentInputBuilderTests.swift b/Tests/AGUICoreTests/Types/AgentExecution/RunAgentInputBuilderTests.swift index e4ff7a2..279aaee 100644 --- a/Tests/AGUICoreTests/Types/AgentExecution/RunAgentInputBuilderTests.swift +++ b/Tests/AGUICoreTests/Types/AgentExecution/RunAgentInputBuilderTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/AgentExecution/RunAgentInputTests.swift b/Tests/AGUICoreTests/Types/AgentExecution/RunAgentInputTests.swift index e6adf21..09c511a 100644 --- a/Tests/AGUICoreTests/Types/AgentExecution/RunAgentInputTests.swift +++ b/Tests/AGUICoreTests/Types/AgentExecution/RunAgentInputTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/AgentExecution/StateTests.swift b/Tests/AGUICoreTests/Types/AgentExecution/StateTests.swift index 3bbc86b..31db912 100644 --- a/Tests/AGUICoreTests/Types/AgentExecution/StateTests.swift +++ b/Tests/AGUICoreTests/Types/AgentExecution/StateTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/InputContent/AudioInputContentTests.swift b/Tests/AGUICoreTests/Types/InputContent/AudioInputContentTests.swift index 03b9f36..d761865 100644 --- a/Tests/AGUICoreTests/Types/InputContent/AudioInputContentTests.swift +++ b/Tests/AGUICoreTests/Types/InputContent/AudioInputContentTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/InputContent/BinaryInputContentTests.swift b/Tests/AGUICoreTests/Types/InputContent/BinaryInputContentTests.swift index eaa23b2..5557f5e 100644 --- a/Tests/AGUICoreTests/Types/InputContent/BinaryInputContentTests.swift +++ b/Tests/AGUICoreTests/Types/InputContent/BinaryInputContentTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/InputContent/DocumentInputContentTests.swift b/Tests/AGUICoreTests/Types/InputContent/DocumentInputContentTests.swift index 25ed14b..6ac304d 100644 --- a/Tests/AGUICoreTests/Types/InputContent/DocumentInputContentTests.swift +++ b/Tests/AGUICoreTests/Types/InputContent/DocumentInputContentTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/InputContent/ImageInputContentTests.swift b/Tests/AGUICoreTests/Types/InputContent/ImageInputContentTests.swift index 100099b..1d9518e 100644 --- a/Tests/AGUICoreTests/Types/InputContent/ImageInputContentTests.swift +++ b/Tests/AGUICoreTests/Types/InputContent/ImageInputContentTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/InputContent/InputContentTests.swift b/Tests/AGUICoreTests/Types/InputContent/InputContentTests.swift index beed544..5136b77 100644 --- a/Tests/AGUICoreTests/Types/InputContent/InputContentTests.swift +++ b/Tests/AGUICoreTests/Types/InputContent/InputContentTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/InputContent/VideoInputContentTests.swift b/Tests/AGUICoreTests/Types/InputContent/VideoInputContentTests.swift index 6130bfa..8f92277 100644 --- a/Tests/AGUICoreTests/Types/InputContent/VideoInputContentTests.swift +++ b/Tests/AGUICoreTests/Types/InputContent/VideoInputContentTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/Messages/ActivityMessageTests.swift b/Tests/AGUICoreTests/Types/Messages/ActivityMessageTests.swift index 7f48502..526f6fd 100644 --- a/Tests/AGUICoreTests/Types/Messages/ActivityMessageTests.swift +++ b/Tests/AGUICoreTests/Types/Messages/ActivityMessageTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/Messages/AssistantMessageTests.swift b/Tests/AGUICoreTests/Types/Messages/AssistantMessageTests.swift index cbb9a28..a877469 100644 --- a/Tests/AGUICoreTests/Types/Messages/AssistantMessageTests.swift +++ b/Tests/AGUICoreTests/Types/Messages/AssistantMessageTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/Messages/DeveloperMessageTests.swift b/Tests/AGUICoreTests/Types/Messages/DeveloperMessageTests.swift index 63f354b..4a4869a 100644 --- a/Tests/AGUICoreTests/Types/Messages/DeveloperMessageTests.swift +++ b/Tests/AGUICoreTests/Types/Messages/DeveloperMessageTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/Messages/MessageTests.swift b/Tests/AGUICoreTests/Types/Messages/MessageTests.swift index 5aeffac..6091bf3 100644 --- a/Tests/AGUICoreTests/Types/Messages/MessageTests.swift +++ b/Tests/AGUICoreTests/Types/Messages/MessageTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/Messages/ReasoningMessageTests.swift b/Tests/AGUICoreTests/Types/Messages/ReasoningMessageTests.swift index 0597cb2..9908b54 100644 --- a/Tests/AGUICoreTests/Types/Messages/ReasoningMessageTests.swift +++ b/Tests/AGUICoreTests/Types/Messages/ReasoningMessageTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/Messages/RoleTests.swift b/Tests/AGUICoreTests/Types/Messages/RoleTests.swift index 0404e16..e0727e3 100644 --- a/Tests/AGUICoreTests/Types/Messages/RoleTests.swift +++ b/Tests/AGUICoreTests/Types/Messages/RoleTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/Messages/SystemMessageTests.swift b/Tests/AGUICoreTests/Types/Messages/SystemMessageTests.swift index 8ffb2d7..f17eadc 100644 --- a/Tests/AGUICoreTests/Types/Messages/SystemMessageTests.swift +++ b/Tests/AGUICoreTests/Types/Messages/SystemMessageTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/Messages/ToolMessageTests.swift b/Tests/AGUICoreTests/Types/Messages/ToolMessageTests.swift index 86e61fc..ede89e4 100644 --- a/Tests/AGUICoreTests/Types/Messages/ToolMessageTests.swift +++ b/Tests/AGUICoreTests/Types/Messages/ToolMessageTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/Messages/UserMessageTests.swift b/Tests/AGUICoreTests/Types/Messages/UserMessageTests.swift index 0932ff1..2fb81cf 100644 --- a/Tests/AGUICoreTests/Types/Messages/UserMessageTests.swift +++ b/Tests/AGUICoreTests/Types/Messages/UserMessageTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/Tools/FunctionCallTests.swift b/Tests/AGUICoreTests/Types/Tools/FunctionCallTests.swift index ba0cfbf..bd0ba07 100644 --- a/Tests/AGUICoreTests/Types/Tools/FunctionCallTests.swift +++ b/Tests/AGUICoreTests/Types/Tools/FunctionCallTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/Tools/ToolCallTests.swift b/Tests/AGUICoreTests/Types/Tools/ToolCallTests.swift index a57ba64..cfcc0f6 100644 --- a/Tests/AGUICoreTests/Types/Tools/ToolCallTests.swift +++ b/Tests/AGUICoreTests/Types/Tools/ToolCallTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUICoreTests/Types/Tools/ToolTests.swift b/Tests/AGUICoreTests/Types/Tools/ToolTests.swift index 397c44d..1000c81 100644 --- a/Tests/AGUICoreTests/Types/Tools/ToolTests.swift +++ b/Tests/AGUICoreTests/Types/Tools/ToolTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUICore diff --git a/Tests/AGUIToolsTests/AGUIToolsTests.swift b/Tests/AGUIToolsTests/AGUIToolsTests.swift index 6f50a88..5b829a0 100644 --- a/Tests/AGUIToolsTests/AGUIToolsTests.swift +++ b/Tests/AGUIToolsTests/AGUIToolsTests.swift @@ -1,34 +1,5 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. -import XCTest -@testable import AGUITools - -final class AGUIToolsTests: XCTestCase { - func testAGUIToolsIsInstantiable() { - // AGUITools is deprecated; verify it still compiles and instantiates. - let tools = AGUITools() - _ = tools - } -} +// AGUITools module tests live in the subdirectories: +// Core/ — ToolExecutor, ToolExecutionResult, ToolExecutionContext, ToolExecutionManager +// Registry/ — ToolRegistry, ToolExecutionStats diff --git a/Tests/AGUIToolsTests/Core/ToolExecutionContextTests.swift b/Tests/AGUIToolsTests/Core/ToolExecutionContextTests.swift index bbe49c6..76891a0 100644 --- a/Tests/AGUIToolsTests/Core/ToolExecutionContextTests.swift +++ b/Tests/AGUIToolsTests/Core/ToolExecutionContextTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest import AGUICore diff --git a/Tests/AGUIToolsTests/Core/ToolExecutionManagerTests.swift b/Tests/AGUIToolsTests/Core/ToolExecutionManagerTests.swift index 60784c9..7d76901 100644 --- a/Tests/AGUIToolsTests/Core/ToolExecutionManagerTests.swift +++ b/Tests/AGUIToolsTests/Core/ToolExecutionManagerTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest import AGUICore diff --git a/Tests/AGUIToolsTests/Core/ToolExecutionResultTests.swift b/Tests/AGUIToolsTests/Core/ToolExecutionResultTests.swift index 3f664fe..a380e2f 100644 --- a/Tests/AGUIToolsTests/Core/ToolExecutionResultTests.swift +++ b/Tests/AGUIToolsTests/Core/ToolExecutionResultTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUITools diff --git a/Tests/AGUIToolsTests/Core/ToolExecutorTests.swift b/Tests/AGUIToolsTests/Core/ToolExecutorTests.swift index dad54f1..3c56506 100644 --- a/Tests/AGUIToolsTests/Core/ToolExecutorTests.swift +++ b/Tests/AGUIToolsTests/Core/ToolExecutorTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest import AGUICore diff --git a/Tests/AGUIToolsTests/Registry/ToolExecutionStatsTests.swift b/Tests/AGUIToolsTests/Registry/ToolExecutionStatsTests.swift index 780ea4a..e2c26ba 100644 --- a/Tests/AGUIToolsTests/Registry/ToolExecutionStatsTests.swift +++ b/Tests/AGUIToolsTests/Registry/ToolExecutionStatsTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest @testable import AGUITools diff --git a/Tests/AGUIToolsTests/Registry/ToolRegistryConcurrencyTests.swift b/Tests/AGUIToolsTests/Registry/ToolRegistryConcurrencyTests.swift index c492480..adc07d4 100644 --- a/Tests/AGUIToolsTests/Registry/ToolRegistryConcurrencyTests.swift +++ b/Tests/AGUIToolsTests/Registry/ToolRegistryConcurrencyTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest import AGUICore diff --git a/Tests/AGUIToolsTests/Registry/ToolRegistryTests.swift b/Tests/AGUIToolsTests/Registry/ToolRegistryTests.swift index 20646f9..7eaf4c6 100644 --- a/Tests/AGUIToolsTests/Registry/ToolRegistryTests.swift +++ b/Tests/AGUIToolsTests/Registry/ToolRegistryTests.swift @@ -1,26 +1,4 @@ -/* - * MIT License - * - * Copyright (c) 2025 Perfect Aduh - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ +// Copyright (c) 2025 Perfect Aduh. MIT License. See LICENSE for details. import XCTest import AGUICore From c6d374b1cdb0408890a0bd3b7d05eb877503f9d4 Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 18:17:08 -0400 Subject: [PATCH 18/19] chore: remove accidentally staged claude worktree from index --- .claude/worktrees/agent-adf154a3 | 1 - 1 file changed, 1 deletion(-) delete mode 160000 .claude/worktrees/agent-adf154a3 diff --git a/.claude/worktrees/agent-adf154a3 b/.claude/worktrees/agent-adf154a3 deleted file mode 160000 index e15ffaa..0000000 --- a/.claude/worktrees/agent-adf154a3 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e15ffaa1ccb4c228d7333676f9cb9d482a59045b From 825aa364b04842be4221cd3bd361bbacf8a481b4 Mon Sep 17 00:00:00 2001 From: paduh Date: Fri, 1 May 2026 18:19:35 -0400 Subject: [PATCH 19/19] chore: ignore claude worktrees directory Co-Authored-By: Claude Sonnet 4.6 --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index b31368e..00c6adc 100644 --- a/.gitignore +++ b/.gitignore @@ -101,6 +101,9 @@ docs/* # SwiftLint .swiftlintcache +# Claude Code worktrees +.claude/worktrees/ + # Local documentation (not for public repository) MEDIUM_ARTICLE.md docs-test/