メインコンテンツへスキップ

ARC 2.0.0-beta.28

Data and AFS

Use AFS paths, mounts, seed, and collection declarations from a Blocklet without binding the product contract to a storage engine.

For a Blocklet, AFS is the public data boundary: paths, operations, and declared capabilities. A provider may use files, SQLite, object storage, or a remote service internally. That choice is not the application contract.

This page covers Blocklet-side integration. Core AFS operations and provider authoring live on the AFS board.

How a Blocklet meets AFS

MechanismWhere declaredRole
Package files as readonly treeBuilt into dist/.afs/manifest.jsonStatic package assets addressable as a tree
mountsblocklet.yamlAttach providers at absolute targets (/ash, custom modules, …)
seed/Package directory + optional instance.seedFirst-run material for instance data
replicatedblocklet.yamlCollection ownership/copy contracts
sites.bindingsblocklet.yamlMap HTTP paths to AFS paths + AUP pages
networkReadblocklet.yamlAllow network-origin reads of selected /instance/**
indexblocklet.yamlIndex domains for search over declared paths

Package tree vs /instance

Path familyMeaning
Package root / /packages projectionImmutable (for a version) application assets
/instanceInstance-scoped data space when the package needs one
/user / caller overlaysUser-scoped data when scope and session model require them

arc blocklet build reports the instance posture:

text
# basic recipe
instance: stateless

# minimal-app recipe
instance: requires /instance DID Space

Rules:

  1. If the package needs /instance and no real DID Space is bound, stateful features must fail closed — do not pretend seed files are a live instance space.
  2. seed/ is initialization input, not a substitute for a bound instance DID Space after first run.
  3. Local HTTP 200 on a static or shell page does not prove /instance writes succeeded.

Mounts

Declare only providers the package uses:

yaml
mounts:
  - uri: "ash://"
    target: /ash
    required: true

Or a local module:

yaml
mounts:
  - module: "./providers/my-provider"
    target: /my
    required: true

Optional fields include ops (whitelist), aup (recipe scan path anchored at $PROGRAM_DIR or $DATA_DIR), seed (copy package files into a cold mount), and shared.

Inspect what the convention scanner sees:

bash
arc blocklet dev ./demo-min
# Mount: agents/app-agent → /agents/app-agent
# Mount: pages → /pages

Seed and settings

Complete-app recipes generate seed/settings/… JSON and AUP shells. Treat them as package defaults for instance initialization. Changing seed changes the package; changing live instance settings changes instance data.

Replicated collections (reference pattern)

Discuss Kit declares collections under replicated: (posts, comments, anon) with canonical, copy, minRole, readRole, and delete rules. That pattern is a reference implementation of replicated discussion data — not a claim that every historical product surface is platformized.

Read Discuss Kit lineage for scope and limits. Study the live manifest in the ARC tree at blocklets/discuss-kit/blocklet.yaml (read-only reference).

Bindings: URL → AFS → page

Example shape (Discuss Kit):

yaml
sites:
  - name: discuss-kit
    domains:
      - discuss-kit.localhost
    bindings:
      - id: posts-list
        path: "/posts"
        afs: "/instance/app/content/posts"
        page: index
      - id: post-detail
        path: "/posts/{slug}"
        afs: "/instance/app/content/posts/{slug}"
        page: detail

Use bindings when the product URL is a first-class map onto instance content. For pure Web Device static sites, prefer .route/web + pages/ as in Build a first site.

NeedAFS page
Operations and capability boundaryCore contract
List vs query vs searchSearch and query
Provider authoringAuthor a provider / Providers
Local inspection commandsLocal inspection

Hard boundaries

DoDo not
Address data via AFS pathsPromise a specific SQL schema as the public API
Declare mounts the package needsMount host-global paths without understanding scope
Mark /instance-dependent features clearlyClaim seed files alone prove multi-user instance data
Link AFS board for op catalogsDuplicate the full AFS op reference here