Repository Public MIT
1{2 "accessibility" : [3 "Status is always a symbol and a word; colour only reinforces it.",4 "Each task header and each step is one combined element (\"Group by topic, Running, Topic 3 of 5\"); running ones have the \"updates frequently\" trait.",5 "The progress bar is labelled with the task title and its value is \"2 of 5 steps completed\".",6 "Errors read \"Error: <message>\". The cancel button reads \"Cancel, <task title>\".",7 "The step list is a system `DisclosureGroup`: keyboard and VoiceOver expansion are the system's."8 ],9 "category" : "ai",10 "changelog" : [11 {12 "changes" : [13 "Release 1.1.0: see the project changelog."14 ],15 "date" : "2026-12-03",16 "version" : "1.1.0"17 },18 {19 "changes" : [20 "Initial release."21 ],22 "date" : "2026-12-02",23 "version" : "1.0.0"24 }25 ],26 "dependencies" : [27 {28 "id" : "glass-foundation",29 "version" : "1.1.0"30 }31 ],32 "description" : "Tasks and observable steps with status, progress, errors and cancellation.",33 "examples" : [34 {35 "code" : "import SwiftUI\nimport SPGlassKit\n\npublic struct GlassAgentPanelExample: GlassExample {\n public static let componentID = \"glass-agent-panel\"\n\n /// Fictitious tasks: nothing is executed, the example only edits these values.\n @State private var tasks = [\n GlassAgentTask(id: \"t1\", title: \"Prepare the sample weekly digest\", status: .running, steps: [\n GlassAgentStep(id: \"s1\", title: \"Collect sample notes\", status: .succeeded, detail: \"12 notes found\"),\n GlassAgentStep(id: \"s2\", title: \"Group by topic\", status: .running, detail: \"Topic 3 of 5\"),\n GlassAgentStep(id: \"s3\", title: \"Write the digest\", status: .pending),\n ]),\n GlassAgentTask(id: \"t2\", title: \"Rename sample files with a deliberately long task title that wraps over two lines\", status: .failed, steps: [\n GlassAgentStep(id: \"s1\", title: \"List files\", status: .succeeded),\n GlassAgentStep(id: \"s2\", title: \"Apply new names\", status: .failed, detail: \"4 of 9 renamed\", errorMessage: \"Sample failure: a file with this name already exists.\"),\n ]),\n GlassAgentTask(id: \"t3\", title: \"Translate sample page\", status: .succeeded, steps: [\n GlassAgentStep(id: \"s1\", title: \"Detect language\", status: .succeeded),\n GlassAgentStep(id: \"s2\", title: \"Translate\", status: .succeeded),\n ]),\n GlassAgentTask(id: \"t4\", title: \"Queued sample export\", status: .pending),\n GlassAgentTask(id: \"t5\", title: \"Sample clean-up\", status: .cancelled, steps: [\n GlassAgentStep(id: \"s1\", title: \"Scan\", status: .cancelled),\n ], errorMessage: nil),\n ]\n\n public init() {}\n\n public var body: some View {\n ScrollView {\n VStack(alignment: .leading, spacing: 12) {\n Text(\"Sample data · simulated tasks, no agent is running\")\n .font(.caption)\n .foregroundStyle(.secondary)\n GlassAgentPanel(tasks: tasks) { task in\n cancel(task.id)\n }\n GlassButton(\"Advance the running task\", systemImage: \"forward.frame\") { advance() }\n Divider()\n Text(\"No task\")\n .font(.headline)\n GlassAgentPanel(tasks: [])\n }\n .padding()\n }\n }\n\n private func cancel(_ id: String) {\n guard let index = tasks.firstIndex(where: { $0.id == id }) else { return }\n tasks[index].status = .cancelled\n for step in tasks[index].steps.indices where !tasks[index].steps[step].status.isTerminal {\n tasks[index].steps[step].status = .cancelled\n }\n }\n\n /// Completes the running step of the first running task and starts the next one.\n private func advance() {\n guard let index = tasks.firstIndex(where: { $0.status == .running }) else { return }\n if let running = tasks[index].steps.firstIndex(where: { $0.status == .running }) {\n tasks[index].steps[running].status = .succeeded\n }\n if let next = tasks[index].steps.firstIndex(where: { $0.status == .pending }) {\n tasks[index].steps[next].status = .running\n } else {\n tasks[index].status = .succeeded\n }\n }\n}\n\n#Preview(\"GlassAgentPanel\") { GlassAgentPanelExample().glassTheme(.obsidian) }\n",36 "title" : "GlassAgentPanel example"37 }38 ],39 "files" : [40 {41 "bytes" : 18345,42 "path" : "AI/AI/GlassAgentPanel.swift",43 "sha256" : "8217875e84f8ba64baf96e71cc306080840a8c294d772a350d172149ba8df83d"44 }45 ],46 "frameworks" : [4748 ],49 "id" : "glass-agent-panel",50 "kind" : "content-component",51 "license" : "MIT",52 "minimumOS" : {53 "iOS" : "26.0",54 "iPadOS" : "26.0",55 "macOS" : "26.0"56 },57 "name" : "GlassAgentPanel",58 "platforms" : [59 "iOS",60 "iPadOS",61 "macOS"62 ],63 "schemaVersion" : 1,64 "sha256" : "9f1fdbec04e33294640174822d0d1b2aa68a4b25ffef350086f436fee86fca98",65 "symbols" : [66 "GlassAgentStatus",67 "GlassAgentStep",68 "GlassAgentTask",69 "GlassAgentProgress",70 "GlassAgentPanel"71 ],72 "version" : "1.1.0"73}74