// A tool act whose answer names a document the object wrote (Podcasts'// Export OPML, `{ document, shows, said }`; the coordinator, 7 Nov 2026): its// words are said at once, and the document comes by sync. Once its row is// here, its file is asked of this phone's store — `media.share`, a photo's// own Share, which fetches the file from the object when it is not here and// answers `share_file` — and handed to the share sheet under the name the// object gave it, never its key's.importCottonKitimportCottonValuesimportFoundation@MainActorenumDocumentShare {/// The table a document is, and the columns read off it.staticlet table = "document"staticlet fileColumn = "storage_path"staticlet nameColumn = "original_name"/// The file of document `id`, once its row has come and its file is on/// this phone; nil when the row never came (the words already said stand).staticfunc file(_ id: String, store: (any Records)?, core: any CottonCalling) asyncthrows -> URL? {guardawaitRecordLanding.arrived(RecordLink(table: table, id: id), in: store),let row = tryawait store?.get(table: table, id: id),let key = row.values[fileColumn].flatMap(AttachmentValue.read)?.refelse { returnnil }let shared = tryawait core.call(CottonMethod.mediaShare, ["key": key], as: MediaShared.self)let kept = URL(fileURLWithPath: shared.path)guardlet name = row.values[nameColumn]?.text, name != kept.lastPathComponent else { return kept }// Named as the object named it, in a folder of its own.let folder = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString, isDirectory: true)tryFileManager.default.createDirectory(at: folder, withIntermediateDirectories: true)let named = folder.appendingPathComponent(name)tryFileManager.default.copyItem(at: kept, to: named)return named }/// `media.share`'s answer: where the file is on this phone.privatestructMediaShared: Decodable {let path: String }}