A computer is a storage whose data is its files, and they stay where they are. That is the whole idea: an agent working on a machine reads the disk it is on, rather than a copy of it.
const pc = await api.storage.get({ id: machineId });
await pc.files.list(); // what is in the workspace
await pc.files.write("notes/today.md", "…"); // write
await pc.files.read("notes/today.md"); // read back
await pc.files.mkdir("notes/archive");
await pc.files.move("notes/today.md", "notes/archive/today.md");
await pc.files.remove("notes/archive/today.md");pc = api.storage.get(id=machine_id)
pc.files.list() # what is in the workspace
pc.files.write("notes/today.md", "…") # write
pc.files.read("notes/today.md") # read back
pc.files.mkdir("notes/archive")
pc.files.move("notes/today.md", "notes/archive/today.md")
pc.files.remove("notes/archive/today.md")The full signatures are on LocalFiles.
Where these files are
In the workspace on that machine, under the SDK's own folder in the user's home directory. Paths you pass are relative to it, and a path cannot leave it.
Nothing of this reaches the server — which is also why saving to a computer through api.files is refused. If the machine goes, so do they.
It throws on anything else
| storage.type | What you get |
|---|---|
| filesystem | A LocalFiles. |
| phone | storage_is_phone — its files are in that browser. |
| database · object · browser | storage_not_local — use run(). |
Two different refusals on purpose: one says « wrong kind of storage », the other says « right idea, wrong place to ask from ». A phone's files exist; they are reachable from the page that holds them.
import { IaGenifyError } from "iagenify";
function filesOf(storage) {
try {
return storage.files;
} catch (err) {
if (err instanceof IaGenifyError && err.code === "storage_is_phone") {
return null; // reachable through the page, not from here
}
if (err instanceof IaGenifyError && err.code === "storage_not_local") {
return null; // its data is read through run()
}
throw err;
}
}def files_of(storage):
# None on a phone (reachable through the page, not from here)
# and on any storage that is not a computer (its data is read through run()).
return storage.filesIt is this machine's files, not any machine's
The accessor works on the process you are in. Holding a ConnectedStorage for a machine does not give you a remote filesystem — check machineId against the machine you are actually on before acting.
What an agent does with this
An agent given a computer as its machine reads and writes through exactly this. Which is why its tools are permissioned per category rather than per file: the boundary is the workspace, and the decision is yours at each step.