Apps
Packages
A package is components and islands another author wrote, which a site can use. This page says how one is added, what a person sees before approving it, what the build enforces, what an agent may and may not do, and what none of it proves.
The short version: a package is code someone else wrote. Approval is a disclosure, not a safety review. The lock file is the thing that holds the decision, and it needs code review like any other file that changes what runs.
What a package is
An npm or git dependency at an exact version or commit, with a manifest, culm-package.json:
{
"name": "shop", // 1 to 32 characters: lower-case letters, digits, dashes
"version": "1.0.0",
"schema": 2, // the Culm document schema its pieces are written for
"components": [
{ "name": "price-table", "file": "price-table.json", "settings": [] },
],
"islands": [{ "name": "stock", "file": "islands/stock.js" }], // the descriptor is islands/stock.json beside it
"sources": [{ "name": "products", "guide": "The products on sale." }],
"note": "A price table with a live stock badge.",
}A package's pieces cannot offer a tool or acts. A package with a key named tool anywhere in a JSON file other than the manifest and npm's package.json is refused (POLICY_VIOLATION), even where the key is meant as something else, and no operation can add one to a package's component later. acts on a node of a piece are refused too, when the package is added and again when it is approved or loaded: a package's island is framed there, and only an in-page island can offer acts. A package's islands may declare acts: a site offers one only where a node the site itself writes runs that island in the page, which needs trusted (below). Each act's name must be a plain token, 1 to 40 ASCII letters, digits, ., _ or -. A package island's file may not be one whose descriptor would be package.json or culm-package.json.
A package declares no backends, origins or live sources: it names the sources it needs, and the site binds them to its own backends. A piece that declares a backend, a live source or an origin, a live setting that names a backend, or a package.json with dependencies, is refused when the package is added. So is a package that could run code at install, because a packages/* workspace glob would link it and npm would run it: a package.json that holds scripts (even an empty one, or only test), devDependencies, bin, directories.bin or gypfile, or a root file named binding.gyp in any letter case, or any file under a node_modules folder (or named node_modules) in any letter case. A root package.json in any letter case is judged the same way, and one that is not a JSON object is refused too (INVALID_DOCUMENT); a package.json below the root is refused whatever it holds. Remove them to publish a data package. Its pieces may still hold link addresses, and its JavaScript any address; the facts list what is found, and the approval screen shows the code. It cannot declare a backend, a grant, trust or a plug-in; the manifest has no such keys. An older schema is migrated in memory when it is read; the files are never touched.
A data package is not a code plug-in. A data package, the subject of this page, is added by culm add, approved by a person and read as files. A code plug-in is a package named in culm.json's plugins and installed with npm: Culm imports it and runs it with your rights, with no approval step. A code plug-in whose real package root or entry file is inside the project and outside <project>/node_modules is refused (folder-sites.md).
The plug-in API version is 2. A code plug-in (a package named in culm.json's plugins) whose api list does not hold 2 is refused at load, and the problem (INVALID_DOCUMENT) names it. A data package declares no api: Culm makes that declaration itself.
Check one while you write it: in a folder with a culm-package.json, culm check validates the package and prints its facts. It does not measure.
Adding one
culm add shop@1.0.0
culm add "git+https://example.com/shop.git#<40 hex characters>"The spec is an exact pin: name@x.y.z, or
git+https://…#<40-hex commit>(a person may also use git+ssh:// and git+file:///). A range, a tag, a branch or a bare name is refused before any process starts.
add fetches with npm pack --ignore-scripts, so none of the package's scripts run, then reads the archive itself and copies its files into packages/<name>/, all but its package.json: that file is judged and then dropped, so a workspace glob does not link the folder and a package cannot take the place of a real dependency by having its name. The fingerprint and the lock are of what is written. (A copy added earlier, with the file, still matches its lock; adding it again drops it. But such a copy is invalid on load when it was approved and that file holds scripts, devDependencies, bin, directories.bin, gypfile or lists a dependency (dependencies, optionalDependencies, peerDependencies), and adding it again is refused while the published package still holds them. The way out: delete packages/<name>/package.json by hand, then run culm approve <name>. A copy that holds a package.json below its root, or a folder of that name, fails to load too.) Nothing is installed and nothing of the package runs. The archive is checked before and after it is unpacked: only a plain tar of plain files and folders, every name under package/, no link of any kind, no absolute path or .., at most 10 MB packed, 64 MB unpacked, 1,000 entries. The files are then read once as bytes, and the facts, the hashes and the fingerprint all come from those bytes.
add writes culm.lock.json, one entry for each package: where it is from, its version, its fingerprint (a SHA-256 over every file's path and hash), each file's hash, its facts. An add never writes an approval. Adding a new version over an approved one leaves the old approval in place, pointing at the old bytes, so the package is not approved until a person approves again.
Limits of the fetch:
Registry fetches use the person's .npmrc. npm is the person's own: its registry, its authentication and its cache apply to culm add, and a name can come from a private registry.
The archive reader was tested with the tar that ships with macOS (bsdtar). GNU tar is unverified.
The check does not make the package good. It makes the files plain files.
Approval
culm approve shopculm approve prints what the package holds and asks for its name, typed. It is a disclosure screen:
the name, version, source, fingerprint;
the facts, computed from the files: whether it holds JavaScript and how many bytes, the sources it asks for, every address it holds, its dependencies, and how many forms, frames, outside links and fixed overlays its pieces hold;
the acts each of its islands declares, with class and description (an agent's add_package reply carries at most 32 of them, cut and labelled);
the author's note, labelled as the author's;
what changed since the earlier approval, if there was one, and what differs from what culm add copied if the bytes were edited since;
the file list, and the whole text of every .js, .mjs, .cjs and .html file (and of an .svg that has script). Control characters, escapes and invisible or direction-changing characters are shown as \u{hex}, so a module cannot hide itself on a terminal.
If the files change while the person decides, nothing is written ("changed while you were deciding"). Approval writes the fingerprint of exactly what was shown.
Approval is disclosure, not a safety review
The facts are heuristics. hasJs, the addresses, the form counts and the rest err toward more, and they cannot see everything. A string built in JavaScript ('https://' + host) is not an address to a scanner. Once a package holds JavaScript, its address list is not complete. The screen shows the code for that reason: read it.
Approval does not review the code. It records that a person was shown it. A package with a bug, or malice the person did not spot, is approved all the same.
An approved package's code runs in a frame by default and can leak what it is granted (islands.md). It can do more if the person marks it trusted.
Who can approve
The decision belongs to a person at a terminal, and the guarantee is exactly this: no MCP tool, flag, environment variable or pipe approves; an agent with a shell and a pseudo-terminal could still type the package name, as it could edit culm.lock.json by hand.
Concretely: culm approve checks that both standard input and standard output are terminals before it reads or shows anything. With either not a terminal it exits 2 and writes nothing. There is no --yes, no environment variable and no option that skips the question; the arguments are checked by name and a --yes or -y is an unknown option. The answer must be the package name, typed. A library function, approvePackage(dir, name, confirm), takes the callback a product's own screen supplies; it is the product's responsibility to ask a person.
What this does not stop: anything that has a shell can run culm approve under a pseudo-terminal and type the name, and anything that can write files can edit culm.lock.json and culm.json. Protect the project folder as you protect its source, and review changes to culm.lock.json and culm.json like code.
The lock file needs code review
culm.lock.json and packages/ decide what code the site carries. Commit both, and review every diff to them as you would a dependency bump with its source: a changed fingerprint, an approved entry that appears, a new from. The build checks the bytes against the lock, so a change in packages/ with no change in the lock fails the build; but a person who edits the lock and the files together has approved them. The check protects against accident and against a caller that cannot write the lock; it does not protect against a caller that can.
Using one
culm.json holds a person's words about each package, written by hand:
{
"packages": {
"shop": {
"sources": { "products": "products" }, // the package's source -> the site's source
"trusted": true, // optional; see below
},
},
}and a page uses a component as
{ "use": "shop/price-table", "id": "pt1", "plan": "Pro" }, which is package/component (no dot, so it never meets a piece path). A package's island is drawn by its name, as { "kind": "island", "props": { "island": "stock", … } }.
Sources are bound by hand. Every source a package asks for must be bound in culm.json to a source site.json declares. A person also writes the grants in site.json that let its framed islands read them.
Source name mapping is a limitation. A package's ctx.load('products') is not translated to the site's name for it: the broker's grant table holds the site's names. A package's source name must therefore equal the name of the site's source it is bound to. Bind products to products. Binding it to a differently named source makes the grant name the other name and the frame's load fail at the broker.
trusted: true only permits. It lets an island of the package run in the page when a node asks for it with run: "in-page". The default stays a frame. trusted is read only from culm.json, only for a package that is approved and whose bytes match, and only when it is exactly true. A package cannot set it, and no operation writes it. A node that asks for run: "in-page" on an island of a package that is not trusted fails the build and names the package; on a page with sign-in the message adds that code in the page can read the key.
culm.json's packages is judged where it is written: an unknown package, an unknown key, a trusted that is not true, a source the package does not ask for are each a located problem. Nothing is dropped silently.
What the build enforces
An unapproved package that nothing uses builds, with a notice ("waiting for approval", and the command). It is inert.
An unapproved package that a page uses fails the build (POLICY_VIOLATION, naming the package and culm approve <name>).
A package whose files differ from the approved ones by one byte fails the build, used or not: a changed byte, an added or removed file, a dot file, a folder of its own, a link. The message names the package and both fingerprints.
An approved package whose sources are not bound fails every build, used or not, because an approved package's components are all loaded whether or not a page uses them. The problem is located in culm.json, which the tools treat as a registry problem, so culm mcp and culm schema also stop for it. Bind the sources, or remove the package folder and its lock entry.
Builds never fetch: build is offline.
Every file of a used package is an input of the build's identity, so a changed and re-approved package is another build.
Each node a package's component puts on a page carries its package in the source map (origin), not in the document: Origin.package = { name, version } is on the source map, because the document's own origin is the block origin.
Previous