// Podcasts' subscription list in and out (OPML; the coordinator, 7 Nov 2026).//// Both halves go through `object.act`. `import_opml { file }` takes the OPML// file's TEXT, read here from the file shared or picked and sent whole (as a// Goodreads export's CSV is); the core runs it on the phone, signed in or not// (owner, 12 Nov 2026: a signed-out phone is whole), reading every feed it// names that is not held, at most a hundred a run, into the phone's own copy.// `export_opml {}` asks the object to write the subscribed shows as a// document record the phone takes by sync and hands to the share sheet.// Every word either says is the core's own `said`.importFoundation/// The object's acts a subscription list goes through (`object.act`).publicenumPodcastActs {publicstaticlet importOpml = "import_opml"publicstaticlet exportOpml = "export_opml"/// The tool act on the Shows deck that runs `export_opml` (`tools.act`).publicstaticlet exportOpmlTool = "podcasts_export_opml"}/// What one `import_opml` run answered: the shows it made, how many feeds/// it left for another run, and its words.publicstructOpmlImported: Decodable, Equatable, Sendable {publicvar added: Intpublicvar already: Int/// Feeds the file names past this run's hundred, not yet asked.publicvar more: Int/// The shows this run made, in the file's order.publicvar podcasts: [String]publicvar said: Stringpublicinit(added: Int, already: Int, more: Int, podcasts: [String], said: String) {self.added = addedself.already = alreadyself.more = moreself.podcasts = podcastsself.said = said }}/// The subscription list through the object.publicstructPodcastSubscriptions: Sendable {privatelet core: any CottonCallingpublicinit(core: any CottonCalling) {self.core = core }/// One run of `import_opml` over the OPML file's text.publicfunc importOpml(_ text: String) asyncthrows -> OpmlImported {let request: [String: JSONValue] = ["act": .string(PodcastActs.importOpml), "args": .object(["file": .string(text)])]returntryawait core.call(CottonMethod.objectAct, request, as: OpmlImported.self) }/// The whole list brought in: a run, and another while the last one left/// feeds unasked and brought some in (a run that brings none in would/// leave the same ones again). `said` is told after each run, in the/// object's words; answers every run, the first first.publicfunc bring(_ text: String, said: (String) -> Void) asyncthrows -> [OpmlImported] {var runs = [tryawait importOpml(text)] said(runs[0].said)whilelet last = runs.last, last.more > 0, last.added > 0 {let run = tryawait importOpml(text) said(run.said) runs.append(run) }return runs }}