الجسور

& لا شيء

files: { list, read, write, mkdir, move, remove }

مساحة عمل لا يحتاج المحرك إلى امتلاكها. ستة وظائف، نفس شكل ملفات الحاسوب الخاص به - وكل أداة ملف تمر من خلالها.

6 operationsall requiredsame shape as LocalFiles
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

الـ ستّة

const bridge = {
  async list(dir, { recursive } = {}) { /* → [{ name, path, type, size, mimeType, modifiedAt }] */ },
  async read(path)                    { /* → { …item, content } — string or bytes */ },
  async write(path, content)          { /* → item */ },
  async mkdir(path)                   { /* → item */ },
  async move(from, to)                { /* → item */ },
  async remove(path)                  { /* → { ok: true } */ },
};
class Bridge:
    def list(self, dir="", *, recursive=False): ...   # → [{"name", "path", "type", "size"}]
    def read(self, path): ...                         # → {…item, "content"} — str or bytes
    def write(self, path, content): ...               # → item
    def mkdir(self, path): ...                        # → item
    def move(self, source, destination): ...          # → item
    def remove(self, path): ...                       # → {"ok": True}

هو مُتَوَدَّدُ محارف محليةشكله الخاص: أي شيء مكتوب ضد واحد يعمل ضد الآخر، والعامل لا يستطيع أن يعرف ما لديه.

مطلوب أن تكون جميع ست ست وظائف

جسر مفقود واحد مرفوض في الخلق مع files_requiredفَنَصْفُ نِظَامِ ٱلْمَلَفِ سَيَخْفُرُ فِي ٱلْوَقْتِ ٱلْأَوَّلِ أَنَّ ٱلْأَدْوَةَ أَنْ تَحْتَاجَ إِلَى ٱلْأَرْضِ ٱلْفَقِيدَةَ ، وَهِيَ أَسْوَأُ مَوْقِتٍ لِتَعْرِفَهَا .

ما يتوقعه المحرك منهم

مالسبب
المسارات نسبية، مع إلى الأمامكل أداة تمررهم بدون تغيير
لا يمكن المسار ترك حيز العملالجسر هو الحدود - فرضه.
read لا شيءالمحرك يقرر ما الذي يُربط من النوع.
يجري بدء مع a do listالنسخ، صندوق إعادة التدوير ومجلة الجلسة يجب أن تبقى بعيدة عن الطريق.
جاريpath_not_found and not_a_folder are understood; anything else surfaces as the tool's failure.

كل شيء يمر عبره

read, write, edit, glob, grep:: وسائط الإعلام، نقطة نقطة نقطة نقطة نقطة - عقد عدد الدورات لا يوجد مسار ثان للملفات - وهو ما يجعل متصفح الهاتف يخزن مساحة عمل كاملة بدلا من مساحة جزئية.

يمكن أن يكون الجسر بعيد

// Each operation is streamed to the page that holds the files,
// run there, and answered back.
const phoneBridge = () => Object.fromEntries(
  ["list", "read", "write", "mkdir", "move", "remove"].map((op) => [
    op,
    (...args) => askThePage({ op, args }),      // resolves when the page answers
  ]),
);
# Each operation is sent to whatever holds the files, run there, and answered back
class PhoneBridge:
    def __getattr__(self, op):
        if op not in ("list", "read", "write", "mkdir", "move", "remove"):
            raise AttributeError(op)
        return lambda *args, **kwargs: ask_the_page({"op": op, "args": args, "kwargs": kwargs})

أعطها مهلة من وقتك الخاص: صفحة توقف عن الرد من شأنها أن تترك التنفيذ إلى أجل غير مسمى. رفض الوعد ينهي نداء الأداة بخطأ يمكن للنموذج أن يعمل عليه.

إنها تُدعى كثيراً

A single grep walks the tree. A checkpoint reads every file it records. A remote bridge should batch or cache where it can — the engine makes no attempt to be frugal, because on a disk it does not need to be.