@niscorp/moss 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +144 -0
  2. package/DESIGN.md +77 -40
  3. package/DOCS.md +673 -78
  4. package/README.md +2 -2
  5. package/dist/chunk-3DCTQKPQ.cjs +943 -0
  6. package/dist/chunk-3DCTQKPQ.cjs.map +1 -0
  7. package/dist/{chunk-WKBH3UMB.js → chunk-3T422CCN.js} +9 -3
  8. package/dist/chunk-3T422CCN.js.map +1 -0
  9. package/dist/chunk-6XC2MD7S.js +906 -0
  10. package/dist/chunk-6XC2MD7S.js.map +1 -0
  11. package/dist/{chunk-D3YZIAYV.cjs → chunk-I4UOWER3.cjs} +11 -5
  12. package/dist/chunk-I4UOWER3.cjs.map +1 -0
  13. package/dist/{chunk-VBWNHF4H.cjs → chunk-PVZMCEBX.cjs} +4 -3
  14. package/dist/chunk-PVZMCEBX.cjs.map +1 -0
  15. package/dist/{chunk-NSK7QSSG.js → chunk-QAHDSRPK.js} +4 -3
  16. package/dist/chunk-QAHDSRPK.js.map +1 -0
  17. package/dist/{chunk-R66WUKGC.cjs → chunk-TMDKNZYL.cjs} +2169 -1319
  18. package/dist/chunk-TMDKNZYL.cjs.map +1 -0
  19. package/dist/{chunk-V5YMJL7Z.js → chunk-YZILOVCR.js} +2147 -1295
  20. package/dist/chunk-YZILOVCR.js.map +1 -0
  21. package/dist/document-BYAY-Qle.d.ts +381 -0
  22. package/dist/document-DAE71J27.d.cts +381 -0
  23. package/dist/{index-B411sK9M.d.cts → index-CSEo7Tys.d.cts} +5 -0
  24. package/dist/{index-B411sK9M.d.ts → index-CSEo7Tys.d.ts} +5 -0
  25. package/dist/index.cjs +17 -17
  26. package/dist/index.d.cts +8 -10
  27. package/dist/index.d.ts +8 -10
  28. package/dist/index.js +3 -3
  29. package/dist/integrations.cjs +3 -3
  30. package/dist/integrations.d.cts +1 -1
  31. package/dist/integrations.d.ts +1 -1
  32. package/dist/integrations.js +1 -1
  33. package/dist/node.cjs +8 -8
  34. package/dist/node.d.cts +3 -4
  35. package/dist/node.d.ts +3 -4
  36. package/dist/node.js +4 -4
  37. package/dist/tide.d.cts +1 -1
  38. package/dist/tide.d.ts +1 -1
  39. package/dist/unverified.cjs +3 -3
  40. package/dist/unverified.js +2 -2
  41. package/dist/vite.cjs +9 -9
  42. package/dist/vite.d.cts +6 -1
  43. package/dist/vite.d.ts +6 -1
  44. package/dist/vite.js +4 -4
  45. package/package.json +13 -13
  46. package/dist/app-CUnDcXQu.d.ts +0 -143
  47. package/dist/app-CdANzi2q.d.cts +0 -143
  48. package/dist/chunk-D3YZIAYV.cjs.map +0 -1
  49. package/dist/chunk-NSK7QSSG.js.map +0 -1
  50. package/dist/chunk-PWUO4RET.js +0 -374
  51. package/dist/chunk-PWUO4RET.js.map +0 -1
  52. package/dist/chunk-R2YPQHQH.cjs +0 -383
  53. package/dist/chunk-R2YPQHQH.cjs.map +0 -1
  54. package/dist/chunk-R66WUKGC.cjs.map +0 -1
  55. package/dist/chunk-V5YMJL7Z.js.map +0 -1
  56. package/dist/chunk-VBWNHF4H.cjs.map +0 -1
  57. package/dist/chunk-WKBH3UMB.js.map +0 -1
  58. package/dist/document-D7nroBww.d.cts +0 -169
  59. package/dist/document-DeTPGBil.d.ts +0 -169
package/CHANGELOG.md CHANGED
@@ -1,5 +1,149 @@
1
1
  # @niscorp/moss
2
2
 
3
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2076f80: `session.draft.add` is what `session.draft.put` was. **Breaking.**
8
+
9
+ BREAKING — approved by moccadroid, 2026-10-18: rename `session.draft.put(...)` to `session.draft.add(...)`. Nothing else about it changes: it takes what `save` takes, what is added is in that one shell when the add answers, and `save`, `discard`, `show`, `remove` and `list` are as they were.
10
+
11
+ - cdc89cc: `server.checkFunctions()` reads the app's functions and refuses what is wrong with them before anyone is served. **Breaking.**
12
+
13
+ BREAKING — approved by moccadroid, 2026-10-18: `serve` of `@niscorp/moss/node`, and `nisc dev`, `nisc build`, `nisc check` and `nisc start`, refuse to come up on an action that calls a function the app has no function of, a charter `functions` deny that matches nothing, or two functions under one id. An app that hands a function only to signed-in sessions, with a shipped action calling it, hands it to every session (the function refuses whom it must), or is refused.
14
+
15
+ An app's functions are known only once a session is: `functions(session)` is called for each shell, and a session hook may reach for the server object, which the app holds only once `createServer` has answered. So the check is the app's to call, once it holds the server and before it listens; `serve` of `@niscorp/moss/node` calls it, and so do `nisc dev`, `nisc build`, `nisc check` and `nisc start` after the project's `boot`; each closes what it built where it refuses. It builds nobody's shell once, after everything is in force, and drops it. What that call returned is checked, and it refuses on:
16
+ - **an action, or a fragment a shell ships, that calls a function the app does not have**: `"home" calls "auth.leave", which the app has no function of`. Before, the call failed when a person pressed the button. An app with no `functions` has none. A set of actions handed over while the app runs is held to the same at that refresh.
17
+ - **a charter `functions` deny that matches nothing**: `Charter is incoherent over the app’s functions — refusing to serve:`.
18
+ - **two functions under one id**: `moss: functions(session) returned "auth.leave" twice.`
19
+
20
+ What the charter only warns of (a grant that names no function, a function no role grants), the functions with no description, and a map of handlers are said at that point, once.
21
+
22
+ The cost is one anonymous shell built, as any visitor who is not signed in causes. Every check reads nobody's functions: an app that hands a function only to signed-in sessions is refused where an action calls it.
23
+
24
+ ### Patch Changes
25
+
26
+ - edd3271: `session.answerIntent(writers, asked)` also replays a query that exists: `asked` may be `{ fingerprint, context }`.
27
+
28
+ It is answered as the caller, as an intent is, with what vex knows of the query: the context keys it binds, the ones the call left out (`meta.missingContext`), its warnings. The wire answers a replay with the rows alone. A model that proves a query before it builds on it learns from this why a replay came back empty.
29
+
30
+ - f461b98: What a person generated and nobody has used for long enough is deleted, with `runtime.artifactsUnusedMs`.
31
+ - A version of an artifact a person saved is stamped as used (`artifacts.last_used_at`, migration `nisc.moss/6`) when a shell is built for them, once an hour at most, through the same vex entries and row rule as the save itself.
32
+ - A sweep runs as the server comes up and then every hour: every artifact of a person whose newest version was neither saved nor used within `artifactsUnusedMs` is deleted, every version of it, and the saves left empty with them. What is published for everybody (`*`) never ages; what the build ships is not a row.
33
+ - Without the setting nothing is deleted. `0` or less refuses the boot.
34
+ - The sweep is one raw statement in moss (`data/aging.ts`), entered in the raw-SQL ledger: vex keeps every statement of its own to one principal's rows, and the sweep crosses them all.
35
+
36
+ - 37422bf: `server.defaults(publisher)` publishes every kind a person saves: an action, a fragment and a read, beside a layout.
37
+ - **An action or a fragment is given its id by whoever publishes it**, as a shipped one has one: `server.defaults(who).save([{ kind: 'action', id: 'promo', body }])`. One without an id is refused (`moss: a published action is given its id by whoever publishes it: name it.`), and so is one under `generated.`. The charter grants it by that id: a new id needs a grant, and one that is a shipped action's or fragment's replaces the build's for everybody until it is reset.
38
+ - **A read vex wrote is published under its fingerprint**, `save([{ kind: 'read', id: '<fingerprint>' }])`, and is answered to everybody, nobody signed in included, after what the caller saved themselves. One under the fingerprint of a shipped entry is refused. A generated action anybody saves may replay it.
39
+ - **Checked as a person's save is, as the publisher, and then as a manifest.** An action's `fn:` calls are ones the publisher's roles grant and its reads ones they may replay; then the whole set in force is verified as a set handed over is, and a holder whose roles do not grant a call refuses the publish: `Publish refused — actions call functions the app does not have, or that their holders’ charter does not grant:`.
40
+ - **A default that no longer passes under a new build is left out, and the build's copies stand**, with a line said once per read of the rows: `[moss] what is published for everybody is left out, and the build’s copies stand: …`.
41
+ - `publishedArtifacts(saved, publisher)` of the running manifest takes who publishes, for the roles and reads a publish is held to; `server.defaults` resolves them from the publisher's principal.
42
+
43
+ - Updated dependencies [63b9ab5]
44
+ - Updated dependencies [6a62604]
45
+ - @niscorp/nova@0.5.0
46
+
47
+ ## 0.7.0
48
+
49
+ ### Minor Changes
50
+
51
+ - e9b987e: Moss holds an app's entries itself, in memory, and copies none into `vex_cache`. `server.replaceEntries(source, entries)` hands a set of entries over while a server runs. **Breaking.**
52
+
53
+ BREAKING — approved by moccadroid, 2026-10-12: an app that runs a vex engine of its own over `runtime.cache` gives that engine the entries it replays (`seedCache(cache, entries)`), and an app that wrote an entry into that table for moss to serve hands it over with `server.replaceEntries(source, entries)`.
54
+ - **Where a fingerprint resolves.** The entries an app ships are read from the build at every boot and held by the running manifest, compiled as vex replays them. The engine asks it first, and the cache table (`vex_cache`, or what `runtime.cache` hands over) only for what vex wrote itself while the app runs, such as a query `session.answerIntent` wrote. A boot still refuses an entry vex cannot run.
55
+ - **Nothing is copied into the cache table, and a row in it that no request wrote is not replayed.** Until now every entry was written there at each boot, and a replay resolved in the table. Moss now answers from the table only for a row vex wrote for a request (it carries that request's hash). The rows an earlier release wrote stay where they are and are answered from no longer: an entry the app stopped shipping is refused (`cache_miss`), where it went on answering before. Moss deletes none of them.
56
+ - **`server.replaceEntries(source, entries)`** is new, and is to entries what `server.replaceActions` is to actions: a named set, replaced whole, checked before it is taken (the schema the manifest's entries are read by, vex's authoring lint for a write, the reach it declares), frozen, and this process's alone. An entry of a set is replayed in place of one the app shipped under the same fingerprint.
57
+ - **The list of fingerprints** a feature or a discovery is told of holds the entries in force and the queries vex wrote. An app whose `runtime.cache` could not list its rows (vex's tiered cache) was told of none; it is told of the entries in force now.
58
+ - **`nisc migrate`** is as it was. Its pass for an entry that already did not fit before a run asks the cache table for a copy of that entry. Moss writes no such copy from this release on, so in a database only moss writes to, an entry first shipped from now on gets no pass. A copy an earlier release wrote, or one the app writes itself for an engine of its own, still gives one.
59
+ - **What a discovery says of an entry of the app.** `createdAt` is when this process compiled it, and `lastUsedAt` is not said: a replay of an entry moss holds stamps nothing. Both came from the row in the table before.
60
+ - **The refusal for a set that is not the caller's** says `the set "…"` where it said `the set of actions "…"`: a set holds entries too.
61
+ - The CLI and `@niscorp/nisc` change in the moss they bring; `AGENTS.md` says where entries are held.
62
+
63
+ - fc96c47: `functions(session)` returns a list of `FunctionDefinition`, `{ id, description, execute }`, and `session.functions()` lists each function a session may call with its description.
64
+
65
+ ```ts
66
+ functions: (session) => [
67
+ {
68
+ id: 'notes.archive',
69
+ description: 'Archives one of the person’s notes. Send { id }.',
70
+ execute: async ({ id }, signal) => archive(session, id, signal),
71
+ },
72
+ ],
73
+ ```
74
+
75
+ - **`id`** is what the charter's `functions` and every `fn:` endpoint name. **`execute`** is what an `fn:` endpoint calls, `(data, signal) => Promise<unknown>`, as a handler in the map was. **`description`** says what it does and what to send, for the model that writes a call to it: `session.functions()` answers `[{ id: 'notes.archive', description: '…' }]`.
76
+ - **Two functions under one id are refused** when a shell is built: `moss: functions(session) returned "auth.leave" twice.`
77
+ - **A map of handlers by id still works, and is deprecated.** The first shell a process builds says once what to change, read off what that session was given: `[moss] functions(session) returned a map of handlers, which is deprecated: return a list of { id, description, execute }.`, or, for a list, `[moss] functions with no description: auth.leave. Give each a description.` An empty description counts as none; such a function, and one given by a map, is listed by its id alone.
78
+ - `FunctionDefinition` is exported, for a helper that returns some of an app's functions.
79
+
80
+ For whoever upgrades an app, person or agent: turn the map into a list, one `{ id, description, execute }` for each handler, the id being its key; a helper that returns part of the map returns part of the list, and the parts are joined with `[...a, ...b]`. Write each description as what the function does and what to send.
81
+
82
+ - 9e6a7c3: The charter decides which of an app's functions a principal may call. **Breaking.**
83
+
84
+ BREAKING — approved by moccadroid, 2026-10-14: give every role of the charter a `functions` part, the functions its actions call, or `functions: ['*']` to keep calling all of them; a role written as a list (`member: ['home', 'settings']`) becomes `member: { actions: ['home', 'settings'], functions: [...] }`.
85
+ - **A shell holds only the functions its principal's roles grant** (`functions`, beside `actions`, `data` and `layouts`, with the same globs, `extends` and `deny`). A role with no `functions` may call none. Before, every shell held every function. A living shell follows the roles an adopt answers, as its actions do.
86
+ - **The boot is refused, with the list of what to grant**, where a role on its own, a combination people wear, or `public` holds an action (or the shells ship a fragment) that calls a function its grants miss: `"member" hold "chrome.topbar", which calls "auth.leave": their functions do not grant it`. A name with a template in it is decided when it is called.
87
+ - **`'*'` is said at boot**: `role "member" allows every function ('*'): the generated actions of the people who hold it, or a role that extends it, may call any it does not deny`.
88
+ - **A grant that names no function** (a typo) is said at the first shell a process builds, with a deny that matches nothing and a function no role grants: the names of the app's functions are known once `functions(session)` has run, and are read as that first session's.
89
+ - **A generated action or fragment may call a function its owner's roles grant**, named written out; one they do not grant is refused when it is saved and left out when a shell is built. `session.functions()` lists the functions a session may call, `{ id, description? }`, for the model that writes one.
90
+ - `@niscorp/charter` has the `functions` section, and `verifyCharter` checks it where a `functions` universe is handed in.
91
+
92
+ For whoever upgrades an app, person or agent: boot it. The refusal lists, per role combination, each function an action calls that the charter does not grant. Add those names to the `functions` of the role that holds the action, or `['*']` to the roles whose people may call everything. This is the app's permissions table: write it deliberately, and do not generate it.
93
+
94
+ - b7fabdb: Moss keeps every action's layout in the shell's layout store, under `action/<id>`. A layout that changes now reaches a screen that is already open. **Breaking.**
95
+
96
+ BREAKING — approved by moccadroid, 2026-10-12 (`action/`) and 2026-10-13 (`frame`, `canvas/`): a manifest's `layoutStore` declares no name beginning with `action/` or `canvas/` and not the name `frame`, no action's layout and no layout variant names one of those by ref, and code that takes the whole shell (`unverifiedShell(session)`) to read an action's layout off a definition reads it from the layout store (`shell.layoutStore.get('action/<id>')`).
97
+ - **An open screen follows a layout that changed, with its data kept.** A set of actions handed over with `server.replaceActions` used to reach only a screen opened afterwards: an instance that was open kept the layout it was opened with. What an open instance still keeps is the rest of its definition (its data's shape, its endpoints, its triggers).
98
+ - **Where the layout is kept does not show to an app.** An app writes an action's layout in its definition as before. `server.actions()` answers it as written, and so does a definition read off a session's shell (`session.shell.getRuntime(id).definition`), with the layout the screen is drawn with now in place. Inside nova's own shell, which `unverifiedShell(session)` hands out, the definition names its layout by `{ ref: 'action/<id>' }` and the store holds the layout, or the layout variant the person's roles hold. An action with no layout, or one whose `layout` is the name of a stored layout, is handed over as it is.
99
+ - **A session's shell hands out its layout store to read.** `set` and `delete` on `session.shell.layoutStore` throw, as `setLayout` does. They went through before.
100
+ - **`action/` is moss's in a layout store.** A manifest whose `layoutStore` declares a name beginning with it, in the app's shell or in a page, refuses the boot and says where. So does an action's layout or a layout variant that names one, at boot and when a set of actions is handed over: a layout cannot be drawn inside itself.
101
+ - **The layout of an action that leaves a shell is taken out of its store.**
102
+ - **The shell's own layout and a canvas's are kept in the store too**, under `frame` and `canvas/<id>`, and the shell draws each by that name. An app writes `layout` and a canvas's `actionLayout` as before, and a screen is drawn as before; one that is the name of a stored layout is handed over as it is. A manifest whose `layoutStore` declares `frame`, or a name beginning with `canvas/`, in the app's shell or in a page, refuses the boot and says where. So does an action's layout or a layout variant that names one of them, at boot and when a set of actions is handed over. A layout is named by a node that is `{ ref }` and nothing else: a `ref` a component carries, on its node or in its props, names none.
103
+ - **Whether a page can still do something is read through every ref.** A layout a screen names by `{ ref }` is read where the store holds it, so a two-way bound field in a stored layout the app names itself makes its page live. It was missed before, and such a page was reported as a file.
104
+ - The CLI and `@niscorp/nisc` change in the moss they bring.
105
+
106
+ ### Patch Changes
107
+
108
+ - 0a7beae: Moss's source has a module for what the running app consists of, `artifactory`. Nothing an app imports, calls or is handed changes.
109
+ - What is in force while a server runs, what a set of roles holds of it, and the clock of the generation pointer are in `artifactory`, where they were in `manifest`. `manifest` keeps the app as it is handed over: its types, its schema and its verification.
110
+ - `DESIGN.md`, "How the code is laid out", says which module answers what.
111
+
112
+ - 4dc982a: Moss keeps what was generated while the app runs for the person who saved it (a layout, an action, a fragment), and a layout an app publishes for everybody.
113
+ - **`session.artifacts`, on the session an app's functions are handed.** `save`, `list`, `history`, `restore` and `reset`. A layout is saved for the action it is for (`{ kind: 'layout', body: { ref: 'action/<id>', layout, use? } }`). It is the session's principal's alone, gets its id from moss, and is drawn on their screens while it is marked `use: true`; their open screens follow at once, with their data kept. Who may save is the charter's: the function that calls it is the app's, and the charter says who holds the action that calls that function. A session nobody is signed in to saves nothing.
114
+ - **A row is its principal's, and vex keeps it so.** Moss reads and writes the two tables as the caller, under one row rule: a caller reads and writes only the rows whose `principal` is their `userId`, and a row they insert or update carries it. No call names whose rows are meant. The same rule is part of the policy an app's charter compiles to, so a role that is granted the tables, by name or by a wildcard, reaches its own rows there and nobody else's. A row of `artifact_saves` is moss's alone to make: an app's entry that inserts or updates one is refused. An app's `behaviors` that name `artifacts` or `artifact_saves` refuse the boot.
115
+ - **`server.defaults(publisher)`, on the server: what is published for everybody.** The same five calls and the same body. A published layout is drawn for everybody who holds its action; every living shell adopts it at once, and every other process follows the generation pointer, which a publish moves. It is kept as the rows of one principal no caller is (`*`), under the same row rule, with who published in `created_by`. No session can publish: only the app's own server code reaches the call, and the charter says who holds the action that makes it. One read of what is published answers every shell a process builds: a boot makes it, and the first shell after a publish there or a move of the pointer makes it again.
116
+ - **`session.artifacts` also keeps an action and a fragment** (`kind: 'action'`, `kind: 'fragment'`). Moss gives the id, `generated.` and a uuid; a body that names another is refused. It is its owner's alone: it is in the shells built for them and in nobody else's, and in no catalog. What it defines replays reads and calls the functions its owner's roles grant: each endpoint is a `POST` to the app's vex route naming one fingerprint of a read the app ships or was handed and its owner may replay, or of a read vex wrote that its owner saved, or an `fn:` endpoint to a function its owner's roles grant (see the charter's `functions`); a write, a query a model wrote that nobody saved and every other address are refused, and so is a generated action that opens an action its owner does not hold. Moss checks the artifact; once it is in a shell it is an action or a fragment like any other, on nova's channels and in nova's merge of a fragment into the action it is wrapped around. It is checked at the save and at every shell, and one that no longer passes is left out with a line. `session.actions`, and the `actions` the `inputs` and `seeds` hooks are handed, are the ids the shell was built with, so they hold a principal's generated actions too.
117
+ - **`session.draft`, on the same session: what is being generated in one shell, before it is saved.** `put` takes what `save` takes, runs the same check with the draft laid over what is in force and against what that one shell can draw, and answers when that shell has it, so a function puts an action and opens it on its next line. `list`, `remove` and `discard`; each put or removal is a numbered step, and `show(step)` has the shell show the draft as it was after it; `save` is one save of all of it under the ids it had. A draft is in no other shell, is saved nowhere, and is gone when its shell is.
118
+ - **An id beginning with `generated.` is moss's to give.** A boot and `replaceActions` refuse an action under one, and the manifest's parse refuses a shell's fragment under one.
119
+ - **No caller's `userId` is `*`, and no caller's scope carries `artifactSavedBy`.** For one whose sign-in or `scope` says either, no shell is built and `/api/vex` answers 500.
120
+ - **Under an action's ref a shell draws**, the first of these there is: the person's own layout marked in use, the layout variant their roles hold, the published layout marked in use, the build's.
121
+ - **Every save is a version, and moss changes and deletes none.** Going back to a version is a new save that holds a copy of it; a reset is a new save that says none is in force, and the layout under it is drawn again.
122
+ - **A layout is checked when it is saved and when a shell is built**: its shape, that the action it is for has a layout of its own and is held by whom it is saved for, its components against what the app's shells have, that it names no ref moss keeps a layout under (`action/…`, `canvas/…`, `frame`), and what nova's audit finds of its action with the layout in place and not of the action as it is built. A save is refused with a sentence. A saved layout that no longer passes is left out with a line in the log, and what is under it is drawn.
123
+ - **Two tables, in migration `nisc.moss/5`: `artifact_saves` and `artifacts`.** A deployment that boots with `migrations: 'verify'` runs `nisc migrate` first, as for every migration. An app whose database already has a table by either name renames its own before it takes this release.
124
+ - **The fabric carries one more message, `adopt`**: it names a principal and tells a process to bring the shells it holds for them level. A process that runs an earlier release drops it as a message it does not know, as it drops every such message.
125
+ - **The layouts of the app's own shell are saved the same way: its own under `ref: 'frame'`, a canvas's under `ref: 'canvas/<id>'`**, by a session for its principal and by `server.defaults` for everybody. The app's own shell draws the person's own in use, else the published one, else the one its manifest declares; their open screen follows at once. A page draws the layout it declares. A shell manifest with no `layout`, or a canvas with no `actionLayout` of its own, has none to take the place of, and a save for it is refused. It is checked as a layout for an action is, against the components of the app's own shell and without nova's audit. A frame that leaves a canvas of the shell out is saved as it is: that canvas is drawn nowhere.
126
+ - **A canvas that only a layout's slot draws goes when the slot goes.** Nova gives a shell a canvas when something is first pushed onto it. Where a layout in force for a principal holds a canvas slot with a written-out `canvasId` for a canvas their shell's manifest does not declare, and then no layout does (the saved layout was reset, the action left the shell), an open shell loses that canvas with what is mounted on it. It stayed before, drawn nowhere. The canvases a manifest declares are never taken out, and moss gives a shell none.
127
+ - **A read vex wrote is kept the same way** (`{ kind: 'read', id: 'fp_…' }`, no body): moss takes the query and the Prism config of its mapping from vex's table. It is answered to the person who saved it and to nobody else (never to a caller nobody is signed in for), held to vex's limits as a query vex wrote is, it survives a schema change that does not touch what it reads, and their generated actions may replay it. One whose query no longer runs is left out with a line, with the generated actions that replay it. Moss's data layer hands vex's table only what vex wrote for a request: a saved read vex replays is not copied into it.
128
+ - Not built yet: publishing an action, a fragment or a read; a layout of a page's shell.
129
+ - The CLI and `@niscorp/nisc` change in the moss they bring. `AGENTS.md` gains rule 7b: how a layout, an action or a fragment generated while the app runs is saved or kept in a draft, how a layout is published for everybody, and that the charter decides who may do either.
130
+
131
+ - c7c4f9b: A nova shell keeps actions and fragments in one registry. **Breaking.**
132
+
133
+ BREAKING — approved by moccadroid, 2026-10-13: `shell.registerFragment` is gone, and an action and a fragment no longer share an id.
134
+ - **`shell.registerAction(definition)` takes an action or a fragment**, told apart by the fragment's `kind: 'fragment'`, and **`shell.removeAction(id)` takes either out**. There was no call to take a fragment out. Taken out, a fragment is unknown to a later `with: [...]`; an instance that was opened with it keeps the definition it was composed into, and `back` skips a position that was opened with it, as it skips one it cannot put back.
135
+ - **A fragment handed to `createShell` is validated**, as an action is: one that does not parse throws `DefinitionValidationError` at construction. Only `registerFragment` validated one before.
136
+ - **An id names an action or a fragment, never both.** `createShell` and `registerAction` throw `DefinitionValidationError` for an id that is already the other kind's.
137
+ - Opening a fragment by itself still throws `UnknownActionError`, and a `with: [...]` that names an action still throws `UnknownFragmentError`. `ShellConfig` keeps `actions` and `fragments`.
138
+ - **Moss:** a fragment that is no longer answered for a principal is taken out of their open shell, as an action is. A boot, and a set of actions handed over, refuse an action under the id of a fragment a shell ships. On a session's own shell, `registerAction` (refused there as before) is the one call that would take a fragment.
139
+
140
+ **What to change:** `shell.registerFragment(fragment)` becomes `shell.registerAction(fragment)`. Give an action and a fragment that share an id two ids.
141
+
142
+ - Updated dependencies [c7c4f9b]
143
+ - Updated dependencies [4068f98]
144
+ - @niscorp/nova@0.4.0
145
+ - @niscorp/vex@0.4.0
146
+
3
147
  ## 0.6.0
4
148
 
5
149
  ### Minor Changes
package/DESIGN.md CHANGED
@@ -39,8 +39,8 @@ app.
39
39
  ### 2. Deployment is a data operation
40
40
 
41
41
  Every field of the manifest is an authored artifact — the charter, the action
42
- definitions, the layout variants, the prewarmed API surface, the shell's
43
- canvases. Publishing a change is a write to that data; moss derives the rest.
42
+ definitions, the layout variants, the entries that are its API surface, the
43
+ shell's canvases. Publishing a change is a write to that data; moss derives the rest.
44
44
  Consequences:
45
45
 
46
46
  - **No version skew.** The shell and the definitions it runs live server-side;
@@ -52,9 +52,10 @@ Consequences:
52
52
  *"crm.quotes → gained by: sales, intern, ray."* A human approves that.
53
53
 
54
54
  Today the manifest is what the app handed `createServer`: read by a schema,
55
- then frozen, so an edit to it throws. One part of it changes while a server
56
- runs, through one door: a set of actions is handed over
57
- (`server.replaceActions`) and verified before it is taken. The artifact library
55
+ then frozen, so an edit to it throws. Two parts of it change while a server
56
+ runs, each through one door: a set of actions is handed over
57
+ (`server.replaceActions`), a set of entries (`server.replaceEntries`), and
58
+ each is verified before it is taken. The artifact library
58
59
  that makes publish a runtime write for every artifact is specified and unbuilt
59
60
  (see below). The mechanism is already the function it needs to be: what a set
60
61
  of roles holds, and the policy it reads and writes under, are derived from what
@@ -62,20 +63,46 @@ is in force and dropped when that changes, so there is no invalidation
62
63
  protocol; a pointer in the database tells every other process that it did.
63
64
  The pointer tells them *that*, not *what*: another process reads again the
64
65
  sets of actions it has a loader for (the ones a feature keeps in rows), and a
65
- set handed to one process with `replaceActions` and no loader is that
66
- process's alone. A library every process reads is the part that is unbuilt.
66
+ set handed to one process with `replaceActions` or `replaceEntries` and no
67
+ loader is that process's alone. A library every process reads is the part that is unbuilt.
67
68
 
68
69
  And there is one place it will be asked. Everything a shell loads that
69
70
  somebody authored (its actions, its frame and layout store, its fragments, the
70
71
  entries its reads replay) is answered by the running manifest in one function,
71
- for a shell and a set of roles (`src/manifest/artifacts.ts`). A shell is built
72
+ for a shell and a principal with their roles (`artifactsFor`, `src/artifactory/running.ts`). A shell is built
72
73
  from that answer and adopts it: an adopt puts in place the actions that are
73
- held now, and the frame, each `{ ref }` of the layout store and each fragment
74
- that the answer says differently from the last time. (The canvases are what a
75
- shell starts with: an adopt does not take them again, a reset does.) The
76
- entries vex replays are seeded from what
77
- the running manifest holds; nothing else in moss reads one of the four off
78
- what the app handed over.
74
+ held now, and each `{ ref }` of the layout store and each fragment that the
75
+ answer says differently from the last time. Every layout the shell draws is
76
+ one of those refs, under the name of what draws it: the answer holds an
77
+ action's in the layout store under `action/<id>`, and the definition names
78
+ it; the shell's own is under `frame` and a canvas's under `canvas/<id>`
79
+ (`shellWithStoredLayouts`, `src/artifactory/artifacts.ts`). So a layout is changed by setting
80
+ a ref, which a screen that is open follows with its data kept, and not by
81
+ registering the action again, which only a screen opened afterwards sees. It
82
+ is also how a saved layout reaches a screen: under an action's ref the answer
83
+ holds the principal's own layout that is marked in use, else the layout
84
+ variant their roles hold, else the one published for everybody, else the
85
+ build's. The first two tables of the
86
+ library are built for that: a row for each save and a row for each version it
87
+ holds, never changed (`src/artifactory/saves.ts`). A row is its principal's,
88
+ and vex keeps it so. What is published for everybody is the rows of one
89
+ principal no caller is, under that same rule: publishing is the save a person
90
+ makes, made by the app's own server code as that principal
91
+ (`server.defaults`), and no second mechanism. An action or a fragment
92
+ somebody generated is a row of theirs too: it is added to what their shell is
93
+ built from, under an id moss gave it, and it may only replay reads its owner
94
+ may replay (`src/artifactory/generated.ts`). A layout saved under `frame` or
95
+ `canvas/<id>` takes the place of that layout of the app's own shell, a
96
+ person's own over the published one over the build's; a page draws the ones
97
+ it declares. (The
98
+ canvases a manifest declares are what a shell starts with: an adopt does not
99
+ take them again, a reset does. Nova gives a shell a canvas when something is
100
+ first pushed onto it; an adopt takes out one the manifest does not declare
101
+ once no layout in force holds a slot for it, where one did: `slottedCanvases`,
102
+ `src/artifactory/artifacts.ts`.) The
103
+ entries vex replays it asks the running manifest for as well, before its own
104
+ cache table; nothing else in moss reads one of the four off what the app
105
+ handed over.
79
106
 
80
107
  ### 3. One gate, every kind of principal
81
108
 
@@ -117,9 +144,9 @@ against the wire alone (`src/terminal/targets.ts`).
117
144
  The organizing principle: an app hands over **artifacts** and an
118
145
  **environment**, and everything mechanical is *derived* — never configured.
119
146
 
120
- - The **data layer** stands up from what's present: the database's seeded
121
- `vex_cache` is the API surface (nothing is generated), and the grantable set
122
- is the introspected schema × vex's verb leaves. No table list is authored.
147
+ - The **data layer** stands up from what's present: the app's entries are the
148
+ API surface (nothing is generated), and the grantable set is the
149
+ introspected schema × vex's verb leaves. No table list is authored.
123
150
  - **Per-principal resolution** is the charter applied at login: roles from the
124
151
  app's `identity` seam or its assignment rows, granted action ids (with a
125
152
  content-hash version token), the compiled vex scope policy, and the granted
@@ -159,8 +186,8 @@ open.)
159
186
  Per-principal UI difference is existence (ring 1) or a served variant (ring 2),
160
187
  never a runtime capability flag in a layout. A layout variant (`NiscApp.layouts`)
161
188
  is `{ action, layout }` under a minted id; the charter's `layouts` section
162
- selects who holds which. At shell build, moss substitutes the granted variant's
163
- layout onto the definition *before* the shell exists, so every downstream render
189
+ selects who holds which. At shell build, moss puts the granted variant's
190
+ layout where that action's layout is kept *before* the shell exists, so every downstream render
164
191
  and serialize is already per-principal and the terminal renders what it is served
165
192
  — nothing on the wire says why a button is absent. The base layout is the floor
166
193
  (the least-privileged holder's shape); variants enrich upward as grants, so
@@ -180,23 +207,27 @@ entry.
180
207
  1. **Who is calling?** `identity`: a token is a principal (the deployment's
181
208
  verifier, moss's stored credential, the browser's cookie and its seal), and
182
209
  a principal is a record (roles, scope values, what is installed for them).
183
- 2. **What exists for them?** `manifest`: what the app handed over, read by a
184
- schema and frozen; what it consists of right now, with one writer; whether
185
- that may be served; and what a set of roles holds of it. Every artifact a
210
+ 2. **What exists for them?** `artifactory`: what the app consists of right
211
+ now, with one writer, and what a set of roles holds of it. Every artifact a
186
212
  shell is handed is asked of it: the actions, the frame and the layout
187
- store, the fragments and the entries, in one answer for a shell and a set
188
- of roles, and read off the app by nothing else. Of the entries it is the
189
- source and not the only holder: see `data`, next.
213
+ store, the fragments and the entries, in one answer for a shell and a
214
+ principal, and read off the app by nothing else. It keeps what somebody
215
+ saved while the app runs (a layout, today) and answers it in the same
216
+ place. It is the one holder of the
217
+ entries too: the ones the app shipped and each set handed over, compiled as
218
+ vex replays them. It stands on `manifest`,
219
+ the app as it was handed over: the types an app is written in, the schema
220
+ it is read by and frozen under, and the one verification of whether what
221
+ is in force may be served.
190
222
  3. **What may they read and write?** `data`: the vex engine, the policy a set
191
- of roles reads and writes under, the routes, a seeded entry run as a
192
- charter role, and the tables with their migration. The engine's cache is
193
- the second place the app's entries are held. The running manifest's list
194
- is copied into it once, at boot; from then on a replay, and the list of
195
- fingerprints, resolve in the cache and the manifest is not asked; and the
196
- cache holds what the list does not, a query written for an intent while
197
- the app runs and any row it held before this boot. So what a fingerprint
198
- resolves to is decided in `data` today, and what an action, a layout or a
199
- fragment resolves to in `manifest`.
223
+ of roles reads and writes under, the routes, an entry run as a charter
224
+ role, and the tables with their migration. The engine's cache asks the
225
+ artifactory for a fingerprint first, through two functions the server
226
+ hands it, and its own table (`vex_cache`) for what the artifactory does not
227
+ hold: a query written for an intent while the app runs. Nothing is copied
228
+ into that table, and a copy an earlier release left in it is not replayed.
229
+ So what a fingerprint resolves to is decided in `artifactory`, as what an
230
+ action, a layout or a fragment resolves to is.
200
231
  4. **What are they looking at?** `shells`: the shell host, one shell's build,
201
232
  the stream of frames, and the screen read without attaching.
202
233
  5. **How does it reach them?** `socket` for the live wire, `documents` for a
@@ -247,6 +278,7 @@ this is a copy of it:
247
278
  | `feature` | `runtime` |
248
279
  | `identity` | `runtime`, `protocol` |
249
280
  | `manifest` | `identity`, `feature` |
281
+ | `artifactory` | `identity`, `manifest` |
250
282
  | `data` | `runtime`, `identity`, `manifest` |
251
283
  | `shells` | `runtime`, `protocol`, `manifest`, `data` |
252
284
  | `socket` | `runtime`, `protocol`, `identity`, `shells` |
@@ -260,8 +292,12 @@ this is a copy of it:
260
292
 
261
293
  The table has no cycle, and what it leaves out is as deliberate as what it
262
294
  names. `shells` does not import `identity`: who somebody is, it is told.
263
- `socket` does not import `manifest`: what somebody holds is a function it is
264
- handed. `integrations` does not import `data`: what it reads and writes it
295
+ `socket` does not import `artifactory`: what somebody holds is a function it
296
+ is handed. `artifactory` and `data` do not import each other: the generation
297
+ pointer's row is `data`'s, when it moves is the artifactory's, the entries
298
+ over the artifactory's two tables are written by the artifactory and replayed
299
+ by `data`, and each reaches the other as functions the server hands over. `integrations` does not
300
+ import `data`: what it reads and writes it
265
301
  authors as vex entries and replays through a seam. Nor `manifest`: what it
266
302
  asks about a bundle before letting it in (does a layout fit the kit, which
267
303
  chains of steps never end) it asks through two seams. A feature imports `feature`, and `runtime` for where a span
@@ -285,7 +321,8 @@ that made the table:
285
321
  | Table | Whose | Where its statements are written | What is somewhere else, and why |
286
322
  |---|---|---|---|
287
323
  | `sessions` | `identity` | `identity/sessions.ts`: five statements straight to the pool, before anybody is signed in | Its table is made in `data`'s one migration run, from a sequence `identity` declares |
288
- | `moss_generation` | `data` | `data/own-entries.ts`: two entries, one that reads and one that moves | `manifest` decides when it moves (`manifest/generation.ts`), through a function `data` hands over |
324
+ | `moss_generation` | `data` | `data/own-entries.ts`: two entries, one that reads and one that moves | `artifactory` decides when it moves (`artifactory/generation.ts`), through a function `data` hands over |
325
+ | `artifact_saves`, `artifacts` | `artifactory` | `artifactory/saves.ts`: three vex entries and the row rule they run under, replayed through a function `data` hands over (`Data.artifactEntries`) | The two tables are made by the core's sequence (`data/tables.ts`, `nisc.moss/5`). Their rows are somebody's, unlike the pointer's: the entries are replayed with the caller's scope, and vex keeps every read and write to the rows whose `principal` is the caller's `userId`. What is published for everybody is the rows of the principal `*`, replayed with that as the `userId` by the server's own code and by no caller. Moss updates and deletes no row, so a stored body is not rewritten when a grammar moves: it is brought to the current grammars where it is read |
289
326
  | `integrations`, `integration_actions` | the `integrations` feature | `integrations/entries.ts`: vex entries, replayed through the seam the feature is handed | The two tables are made by the core's own sequence (`data/tables.ts`, `nisc.moss`): that is the history every database has run, and it is not edited. The documents stored in `integration_actions` are brought to the current grammars by `data`, which holds the pool, when the feature asks through its seam |
290
327
 
291
328
  `data` holds the engine and the one ledgered migration run, so every owner's
@@ -826,7 +863,7 @@ nothing.
826
863
  | Temptation | Refusal |
827
864
  |---|---|
828
865
  | An auth provider | BYO identity. Who somebody is, the app decides at its own door (magic link is the default strategy); the server only asks who a token is. Moss does keep a credential an app may use for that: `mintSession` stores a token by its hash once the app has decided, and `'dev-open'` trusts an unsigned one for a harness. Neither decides anything. |
829
- | A framework | An assembly point. The intelligence lives in the artifacts; the server resolves, serves, pushes, enforces. Its core is ten modules, each one question or the wiring, and an eleventh that runs it on Node (*How the code is laid out*). |
866
+ | A framework | An assembly point. The intelligence lives in the artifacts; the server resolves, serves, pushes, enforces. Its core is eleven modules, each one question or the wiring, and a twelfth that runs it on Node (*How the code is laid out*). |
830
867
  | A place where policy hides | Every opinion it enforces is a readable artifact: charter, scope policy, assertion. No annotations, no interceptor magic. |
831
868
  | A second way to do anything | Reads are vex, writes are vex, compute is functions, UI is actions, permissions are the charter. Moss's core adds no vocabulary of its own, and holds itself to the same: the rows it keeps it reads and writes through vex entries, and the statements left outside vex are counted, each with its reason (`pnpm check:raw-sql`). |
832
869
  | A web framework | A page is a shell manifest at a path; a drawn document is a first frame delivered early. No file-system routes, no layouts-of-layouts, no loaders, and no chain of middleware for an app to configure (one gate may be laid over the operator prefix, `runtime.operatorGate`). A page's `<head>` is not managed either: it is a node in a layout, written into the document like the rest of the screen. The template, the route and the kit are the app's. |
@@ -851,9 +888,9 @@ On the record, so nothing reads as finished that isn't:
851
888
  context management for models — one mechanism, two products.
852
889
  - **Scale-out** beyond sticky sessions pinned by session id. What crosses
853
890
  processes today is invalidation only: `refresh` moves a generation pointer
854
- every process polls (`src/manifest/generation.ts` holds the clock; the row is
891
+ every process polls (`src/artifactory/generation.ts` holds the clock; the row is
855
892
  read and moved through vex, `src/data/own-entries.ts`), and an optional fabric
856
- (`runtime.fabric`, `src/server/signals.ts`) carries identity invalidations and nudges.
893
+ (`runtime.fabric`, `src/server/signals.ts`) carries identity invalidations, nudges, and the word to adopt for one principal.
857
894
  A set of actions does not cross: a process that follows the pointer reads
858
895
  again the sets it has a loader for, and a set handed to another process
859
896
  with `replaceActions` alone never reaches it (DOCS.md, "Many processes").