SPB Git

Repository Public MIT

manifest.json 5.1 KB 67 lines json

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        "Initial release."14      ],15      "date" : "2026-12-02",16      "version" : "1.0.0"17    }18  ],19  "dependencies" : [20    {21      "id" : "glass-foundation",22      "version" : "1.0.0"23    }24  ],25  "description" : "Tasks and observable steps with status, progress, errors and cancellation.",26  "examples" : [27    {28      "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",29      "title" : "GlassAgentPanel example"30    }31  ],32  "files" : [33    {34      "bytes" : 11513,35      "path" : "AI/AI/GlassAgentPanel.swift",36      "sha256" : "5ff2eff9a1a3d7606f7f14151e8915f12dd9b1c03ae56b09901b052587e19f9a"37    }38  ],39  "frameworks" : [4041  ],42  "id" : "glass-agent-panel",43  "kind" : "content-component",44  "license" : "MIT",45  "minimumOS" : {46    "iOS" : "26.0",47    "iPadOS" : "26.0",48    "macOS" : "26.0"49  },50  "name" : "GlassAgentPanel",51  "platforms" : [52    "iOS",53    "iPadOS",54    "macOS"55  ],56  "schemaVersion" : 1,57  "sha256" : "25208f54548793771f95a343c2d7e54e8523088b568d0faeb073afa2ead9a65d",58  "symbols" : [59    "GlassAgentStatus",60    "GlassAgentStep",61    "GlassAgentTask",62    "GlassAgentProgress",63    "GlassAgentPanel"64  ],65  "version" : "1.0.0"66}67
Files main
Menu

Theme