Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLIFFVM_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.0
0.4.1
2 changes: 1 addition & 1 deletion docs/c1f-error.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ so `failed` names only properties whose CURRENT result is the failure. `x is Err

Loop safety: the class entry wakes the readers of the class list (`x is Error`, `instances('Error')`) but none of the entity's own getters; an entity's class entry flips at most twice (gain, lose) in one run, and a third flip waits for the end of the run.

`entity_read` and `entity_query` with `full: true` or `props` show a failed property as `Error: <reason>`; `run_cliff` answers an Error as `Error: <reason>` (an error result) and a null with a reason as `null: <reason>` (not an error). The JSON routes read named properties and show an Error as null.
`entity_read` and `entity_query` show no value; `run_cliff` answers an Error as `Error: <reason>` (an error result) and a null with a reason as `null: <reason>` (not an error). The JSON routes read named properties and show an Error as null.
The browser page's entity JSON (`cliffvm:src/web.rs`) carries `parents` and `failed`.
2 changes: 1 addition & 1 deletion docs/cliffvm.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ SINCE and the layout budget (no source of them on this seat; no marking conventi
The previous turn's error line is `THE PREVIOUS TURN ENDED WITH AN ERROR: <eid of the turn's :response entity> - <its summary>` (`ChatResponse.summary` is its whole text; no cap). A banner whose `text` is null never stalls a turn: the banner slot of the system prompt reads `BANNER ERROR: ... (the reason: <why(...)>)` and points at `Help:banner` (`chat_turn.c1f`, `banner_slot`; the builtin `why(x)` is the reason of a null as text). Tests: `banner_1143.rs`, `chat_process.rs` (`a_banner_without_text...`, `the_banner_shows_the_previous_errors_entity...`), `seat_process.rs` (`a_fresh_seats_banner...`, `a_pack_the_model_loads...`, the restart test: a model pack survives a restart and the banner is born once), `help_1143.rs` (every `Help:banner` example).
**The continuity watchdog** (`membrane/packs/watchdog.c1f`; specs `tests/specs/watchdog.json`): an optional pack, not in `apps/barest.packs`; the model loads it by writing its text to `Pack:watchdog`. `Pin:<slug> {kind, text, done}` is something that must survive turns. A checkpoint (`Watchdog:main.checkpoint = <a new number>`, or `Cron:watchdog` every 10 minutes, seeded by `Boot.started` unless a schedule is already there) writes `Snap:s<n> {at, pins, words, prev}` (the open pins and `Banner:work.words`; the last three are kept) and compares with the snapshot before it: a pin that lost its text without `done` writes `Alert:vanished-<pin>`, and notes that shrank to under half (from more than 80 characters) write `Alert:wipe`, which names the snapshot that holds the old notes. An `Alert` stays until `ack = true`. `Watchdog:main.banner` (the alerts, the open pins, the previous exchange) is a section for the model's own `Banner.text`; the pack does not define `Banner.text` itself, because a pack in `membrane/packs` cannot import `default_banner` (an app pack).

**Bare ids** (`door_tools.c1f`): `entity_read` and `entity_write` take `Banner:admin:main` for `membrane::Banner:admin:main` when only the `membrane::` row exists (an id with its own row, or no twin, is used as written); `entity_query name~:` stays a literal prefix.
**Bare ids** (`cliffvm:src/vm.rs` `twin_key`, cliffvm 0.4.1; `door_tools.c1f` `mc_w_id`): a read of an id with no `::` that no entity holds (loaded, stored or collected) goes to `membrane::<id>` when that entity exists: `${...}`, `run_cliff`, `meta`, `entity_read` and `is`. The bare entity wins when both exist, an id with a namespace in front is never mapped, an id found in neither place is the same reasoned null as before, and a getter that read an unheld bare id is also dirty when its twin is born or changes. `entity_write` names its target the same way (the twin when only the twin exists; an id with its own row, or no twin, is used as written). `entity_query` lists ids with their `membrane::` prefix; `name~:` stays a literal prefix.

**Storage modes** (#1143, operator 2026-11-13; `seat-tests/tests/storage_1143.rs`, `lazy_boot_1143.rs`): a class has one of three modes, declared by the pack that OWNS the class in its header, one class per line, like `IMPORT`
(`docs/c1f-layers.md`, "Header lines"). The mode is by the entity's own class (its eid's; `membrane::Chat:message:1` is `Chat`):
Expand Down
2 changes: 1 addition & 1 deletion membrane/apps/barest.c1f/help/brain.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ When the owner has given the chat to a brain program (the minds setting `chat` n

A change line that names `Chat:main:message:<id>` (or `Chat:session:<sid>:message:<id>` for a session) is a person speaking. The line points at the change and does not carry the words: read the message to see them.

- `run_cliff {code: "${'<message id>'}['text']"}` is what the person wrote (`<message id>` is the id exactly as `entity_query` lists it).
- `run_cliff {code: "${'<message id>'}['text']"}` is what the person wrote (`<message id>` is the id as `entity_query` lists it; the seat's own prefix, the part before `::`, may be left off).
- The conversation so far is the other `ChatMessage` entities (`entity_query {q: "kind:ChatMessage"}` lists them, and one `run_cliff` reads the text of many: `${['<id1>', '<id2>']}['text']`): search them before you say you do not know something.

## Answer
Expand Down
2 changes: 2 additions & 0 deletions membrane/apps/barest.c1f/help/c1f.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ P.picked getter: ${this.ids}.tags[this.at]
P.names getter: meta('Lamp:a')['properties']
```

An id with no `::` that no entity holds reads the entity of that name under the seat's own prefix: `entity_query` lists ids with the prefix (`<prefix>::Lamp:a`), and `Lamp:a` reads the same entity. An entity that holds the bare id wins; an id with another namespace in front is never mapped; an id found nowhere is absent. A write names the id you give it.

A long list is cheaper in one builtin than in a comprehension (a builtin is one step, a comprehension pays per item): `vmean(ids)` is the mean of the unit vectors `v`
of a list of entities (an id with no vector is skipped), and `group_by(rows, key, ['col'])` also totals each named column per group:

Expand Down
2 changes: 1 addition & 1 deletion membrane/apps/barest.c1f/ui/fieldvm_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ function __wbg_get_imports() {
__wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
throw new Error(getStringFromWasm0(arg0, arg1));
},
__wbg_now_e8df5f72b2d3d892: function() {
__wbg_now_43a6fda0c927f2d0: function() {
const ret = Date.now();
return ret;
},
Expand Down
Binary file modified membrane/apps/barest.c1f/ui/fieldvm_core_bg.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion membrane/apps/barest.c1f/ui/fieldvm_version.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// written by native/build-web.sh: the wasm build the loader asks for (a cache key)
export const WASM_VERSION = "0e7d29aac8e0";
export const WASM_VERSION = "3934ee5bcef2";
7 changes: 4 additions & 3 deletions membrane/packs/door_tools.c1f
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ Request.mc_tools getter: [{'name': 'entity_query', 'description': 'enumerate ent
Request.mc_w_spec getter: strip(str(${this.mc_args}['spec'] or ''))
Request.mc_w_prop getter: strip(str(${this.mc_args}['prop'] or ''))
-- A bare id names the `membrane::` one when only that exists: the chat's own entities (Chat:main, Banner:admin:main, ...) are spelled with that
-- namespace in their packs, and a bare spelling of one of them reaches it instead of creating a second entity. An id that already has a row,
-- namespace in their packs, and a bare spelling of one of them reaches it instead of creating a second entity. The engine does the mapping
-- (cliffvm 0.4.1: a read of a bare id nobody holds goes to the `membrane::` twin) and `eid` answers the id it read: an id that already has a row,
-- or has no `membrane::` twin, is used as written.
Request.mc_w_id getter: ('membrane::' + this.mc_w_spec) if ${'membrane::' + this.mc_w_spec}['eid'] != None and ${this.mc_w_spec}['eid'] == None else this.mc_w_spec
Request.mc_w_id getter: str(${this.mc_w_spec}['eid']) if ${this.mc_w_spec}['eid'] != None else this.mc_w_spec
-- DEATH BY NULL (operator, 2026-11-14): `entity_write {spec: 'Stop:3', value: null}` with NO prop destroys the entity, the mirror of a birth (`Stop:3 = None`); a Pack unloads. The key
-- `value` must be there and null: a call that merely forgets the prop is still refused.
Request.mc_w_kill getter: this.mc_w_prop == '' and 'value' in this.mc_args and ${this.mc_args}['value'] == None
Expand Down Expand Up @@ -290,7 +291,7 @@ Cliff.said on-setter cliff-peer-finish:

-- ---- entity_read: the store's row (stored properties, a failed property shown as `Error: <reason>` through the entity's `failed`) or one property through the field ---------------------------------------------------
Request.mc_r_spec getter: strip(str(${this.mc_args}['spec'] or ''))
Request.mc_r_id getter: ('membrane::' + this.mc_r_spec) if ${'membrane::' + this.mc_r_spec}['eid'] != None and ${this.mc_r_spec}['eid'] == None else this.mc_r_spec
Request.mc_r_id getter: str(${this.mc_r_spec}['eid']) if ${this.mc_r_spec}['eid'] != None else this.mc_r_spec
Request.mc_r_bad getter: 'entity_read needs spec (the entity\'s id)' if this.mc_r_spec == '' else None
Request.mc_r_meta getter: meta(this.mc_r_id) if this.mc_tool == 'entity_read' and this.mc_r_bad == None else None
-- A WHOLE READ PRINTS NO VALUES (operator, 2026-11-24): `entity_read` is `meta(spec)` printed: class, parents, property names, getter names, setter names. A chat message's views hold its tool results several times over, and a model that reads a message for its text must not receive them; a value is read with run_cliff, `<entity>[name]`.
Expand Down
4 changes: 2 additions & 2 deletions seat-tests/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion seat-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ bin = []
store = []

[dependencies]
cliffvm = { version = "=0.4.0", features = ["bin"] }
cliffvm = { version = "=0.4.1", features = ["bin"] }
serde_json = { version = "1", features = ["preserve_order", "float_roundtrip"] }
rusqlite = { version = "0.32", features = ["bundled"] }
rcgen = { version = "0.14.10", default-features = false, features = ["ring", "pem"] }
Expand Down
15 changes: 15 additions & 0 deletions seat-tests/tests/footguns_door_1143.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,18 @@ fn the_door_refuses_what_it_used_to_accept_silently_and_says_why() {
write(port, "Pack:fgq", "text", J::Null);
assert_eq!(read(port, "Pack:fgq", "state"), "removed");
}

#[test]
fn a_bare_id_reads_the_entity_the_seat_lists_under_its_own_prefix() {
// the seat lists its entities as `membrane::<Class>:<key>`; a model that drops the prefix still reads the entity (cliffvm 0.4.1), the exact id reads it as before, an id nobody holds is absent
let dir = setup("bareid");
let run = start(&dir, false, &[]);
let port = run.port;
let t = write(port, "membrane::Thing:bt1", "n", json!(3));
assert!(t.starts_with("wrote"), "{t}");
assert_eq!(read(port, "membrane::Thing:bt1", "n"), "3", "the exact id");
assert_eq!(read(port, "Thing:bt1", "n"), "3", "the bare id");
let q = rpc_x(port, None, "entity_query", json!({"q": "kind:Thing"}));
assert!(q.contains("membrane::Thing:bt1"), "the index lists the id with its prefix: {q}");
assert!(read(port, "Thing:bt-none", "n").starts_with("null: absent"), "{}", read(port, "Thing:bt-none", "n"));
}
Loading