UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

44 lines • 4.19 kB
import { GSlidesAccessor } from '../../accessor/gslides.ts'; import type { GoogleConfig } from '../../core/google/config.ts'; import type { DeltaHook } from '../../events/base.ts'; import type { FileStat, PathSpec } from '../../types.ts'; import { type DirListing } from '../../types.ts'; import { BaseVFS } from '../base.ts'; import type { RedactedSchema } from '../secrets.ts'; import type { ConfigState, Handed } from '../types.ts'; import { GSlidesConfig } from './config.ts'; export declare const VFS_MD = "```text\n{prefix}\n owned/ # presentations you created\n <YYYY-MM-DD>_<title>__<presentation-id>.gslide.json\n shared/ # presentations others shared with you\n <YYYY-MM-DD>_<title>__<presentation-id>.gslide.json\n```\n\n- `<YYYY-MM-DD>` is the file's `modifiedTime`, so a date glob such as\n `2026-05-*` narrows by it.\n- `<title>` is sanitized: spaces and any character outside\n `[A-Za-z0-9_.-]` become `_`, at most 100 characters.\n- `<presentation-id>` is the Google Slides presentation id.\n- `shared/` holds presentations shared with you by others; ones you own\n and shared with others are still in `owned/`.\n\nA `.gslide.json` matches the Google Slides API `presentations.get`\nresponse:\n\n```jsonc\n{\n \"presentationId\": \"...\",\n \"title\": \"...\",\n \"pageSize\": { \"width\": {...}, \"height\": {...} },\n \"slides\": [\n { // one element per slide\n \"objectId\": \"...\",\n \"pageElements\": [\n {\n \"objectId\": \"...\",\n \"shape\": {\n \"shapeType\": \"TEXT_BOX\",\n \"text\": {\n \"textElements\": [\n { \"textRun\": { \"content\": \"the actual text\\n\",\n \"style\": {...} } }\n ]\n }\n }\n },\n { \"image\": {...} },\n { \"table\": {...} }\n ]\n }\n ],\n \"masters\": [...],\n \"layouts\": [...]\n}\n```\n\nUseful `jq` paths:\n\n```jq\n.title\n.slides | length # slide count\n.slides[].pageElements[].shape.text.textElements[].textRun.content # all text\n.slides[0].objectId\n```\n\nDelete, on a `write` path:\n\n```sh\nrm {prefix}/owned/<file>.gslide.json # deletes it from Drive for good\nrm -f <path> # ignores a missing file\n```\n\nOnly `.gslide.json` files can be removed; `owned/` and `shared/` cannot.\n\nRename to a new title, on a `write` path:\n\n```sh\nmv {prefix}/owned/<date>_<old>__<id>.gslide.json \\\n {prefix}/owned/<date>_<new>__<id>.gslide.json\n```\n\nKeep the folder, the date and the id, and spell the title the way the\nlisting does (spaces become `_`); any other name is refused."; export declare class GSlidesVFS extends BaseVFS { readonly name: string; readonly cachesReads: boolean; readonly indexTtl: number; readonly readRevalidatable: boolean; vfsMd: string; readonly wholeWordSearch: boolean; readonly config: GSlidesConfig; readonly accessor: GSlidesAccessor; constructor(config: GSlidesConfig); readonly handed: { readonly unlink: readonly ["entry"]; readonly rename: readonly ["entry"]; }; readonly renderers: Readonly<Record<string, string>>; /** * Whether this VFS answers `name`; with no walk limit it reads every * file rather than ask the service's search. */ supports(name: string): boolean; filesContaining(path: PathSpec, text: string, opts: { wholeWord: boolean; ignoreCase: boolean; }): Promise<PathSpec[] | null>; readdir(path: PathSpec): Promise<FileStat[] | DirListing>; /** Render the file as the JSON its `.gslide.json` name holds. */ readDeck(path: PathSpec, _handed?: Handed, offset?: number, size?: number | null): Promise<Uint8Array>; stat(path: PathSpec): Promise<FileStat>; unlink(path: PathSpec, handed?: Handed): Promise<void>; rename(src: PathSpec, dst: PathSpec, handed?: Handed): Promise<void>; deltaHook(): DeltaHook; getState(): Promise<ConfigState<RedactedSchema<typeof GoogleConfig>>>; } //# sourceMappingURL=gslides.d.ts.map