Un computer è un archivio cui i dati sono i suoi files, e sta in cui si trovano. Itèa è l'idea: un agente che lavora in una macchina lee il disco che è, invece di una copia di esso.
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")Le firmes complete sono in LocalFiles.
Onde si trovano questi files
Nel l'area di lavoro di que la macchina, sotto il SDK doptenzion del directory home del utente. I sentieri che passa sono relativi a lui, e un sentiero non lo può lasciare.
Nada di questo arriva al server — e è anche il motivo per cui salvare in un computer a través de api.files è negat. Se la macchina va, lo stesso fa.
Tira a ningun altro
| storage.type | Ce te da |
|---|---|
| sistema de fiches | Uns Fichies Locales. |
| telefono | storage_is_phone — i suoi files sono in quel browser. |
| Base de données · objeto · navegador | storage_not_local — use run(). |
Due renies differentes intenzional: uno dice «tipo errat de stoccatura», l'altro dice «idea de destra, luogo errat da chieder». I files di un telefono existit; sono raggiungibili da la pagina che li detiene.
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.filesSono i files di questa macchina, non di ninguna macchina
L'accessor opera sul processo in cui sei. Tenendo un ConnectedStorage for a machine non ti da un sistema de files remoto — verifica machineId contra la machine in cui realmente sta in antena.
Ce fa un agent con questo
Un agente dato un computer come suo machine legge e scrie exactamente attraverso questo. E è per questo che i suoi utensili sono permessi per categoria e non per file: la limite è l'espazio di lavoro, e la decisione è tua a cada step.