@niscorp/nisc 0.3.3 → 0.4.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 (3) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +58 -0
  3. package/package.json +10 -10
package/AGENTS.md CHANGED
@@ -86,7 +86,7 @@ Pick per need; every piece works standalone. Nova is the only mandatory one for
86
86
  **Data**
87
87
 
88
88
  5. All data in and out of an action flows through its declared `endpoints`. Shaping is declared on the endpoint: a static request body is plain JSON; a body derived from the action's data is a Prism config, kept in a sibling `.prism.ts`. Prefer plain JSON when no mapping is required. Components never shape data.
89
- 6. Nova doesn't know Prism: the shell's injected `transform` is the socket that makes Prism endpoint configs work. Wire it once in setup, and fold ambient app context (the app's "today", the session's principal) into the source there — per session on the server under moss, in the shell factory in a client-degrade app — never into per-action data.
89
+ 6. Nova doesn't know Prism: the shell's injected `transform` is the socket that makes Prism endpoint configs work. Wire it once in setup, and fold ambient app context (the app's "today", the session's principal) into the source there — per session on the server under moss, in the shell factory in a client-degrade app — never into per-action data. The socket takes Prism's `evaluate` as it is (`transform: evaluate`), or a wrapper that adds to the source: `(config, source) => evaluate(config, { ...source, today })`. Hand `evaluate` the config object itself, never a copy of it and never one parsed again: it checks a config the first time it sees the object and only evaluates it after that. A test or a tool that must check everything on every call passes `{ check: 'always' }`. A config that is stored is compiled once and its IR executed (`compile`, `execute`).
90
90
  7. An endpoint is a contract, not an implementation (D1, D2). In-browser, server, or mixed — actions can't tell the difference, and must not be able to. Server functions are endpoints too: the manifest's `functions(session)` seam runs them in-process under the caller's policy. A client-side `fn` registry is the escape hatch for client-degrade apps, and discouraged elsewhere.
91
91
  7a. The manifest's three code seams are distinct, and app code goes in the one that describes it. `functions(session)` is for **endpoints** — things an action calls. `onSession(session)` is for per-shell code that is **not** an endpoint: an observer, a roster, an agent watching the screen. `runs` is the **sink** for model runs, fed by `session.recordRun`. Registering a handler nothing calls, to get code to run per session, is a lie about what that code is — use `onSession`. Both it and `functions` run before the shell finishes building, so neither may touch `session.shell` synchronously.
92
92
  8. Writes are endpoints fired by triggers, never inline mutations (D4). Identity and tenancy are stamped server-side from the session, never client-supplied: a form never carries `owner_id`. What a principal *is* beyond its id — a tenant, an org, a region — is the manifest's `scope(principal)` seam: moss always injects `{ userId }`, `scope` contributes the rest, and the merged set is what a behavior's `to:` resolves against at execute. The mapping is application knowledge, so the app supplies it; the values are injected server-side and unreferenceable by a request.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,63 @@
1
1
  # @niscorp/nisc
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f834f3f: `evaluate` checks a config object once and only evaluates it after that; `prismTransform` is gone. **Breaking.**
8
+
9
+ BREAKING — approved by moccadroid, 2026-10-09: replace `prismTransform` with `evaluate` (`transform: evaluate`), and pass limits as `{ limits: … }`.
10
+
11
+ Prism had three ways to run a config, and the one a host was told to hand to its seam (`prismTransform`) was the one that reported worst, while the hosts on a hot path each wrapped `evaluate`, which checked the config on every call. There are two now, with one job each.
12
+
13
+ **`evaluate(config, source, options?)`** — for a config a program holds.
14
+ - The first time it is handed a config object it checks it and keeps its tree; the second time it prepares the tree as `compile` would; from then on a call only evaluates. Four fields picked and renamed, the same config object again: 3.5 µs before, 0.4 µs now. A nested choice on two fields: 18 µs before, 0.7 µs now. A config that is a new object on every call costs what it did.
15
+ - It is kept **by the object**: a config changed in place after its first call is not read again. Hand over a new object.
16
+ - Both arguments are `unknown`, so it is what a host's transform seam takes: `createTide({ transform: evaluate })`, `createUpgrader(grammars, { transform: evaluate })`.
17
+ - The third argument is `{ limits?, check? }`. Limits were the third argument themselves: `evaluate(config, source, { maxSteps: 100 })` is now `evaluate(config, source, { limits: { maxSteps: 100 } })`.
18
+ - `check: 'always'` is for writing a config, for tests and for tools: nothing is kept, the config is checked on every call, and the source must be plain JSON (a source holding `undefined`, a function, a `Date` or a non-finite number is refused with `E_TYPE`).
19
+ - An invalid config is a `PrismError` (`E_SCHEMA`) naming the part that is wrong, however deep the config. `prismTransform` threw zod's own error, and a `RangeError` for a config nested far past the limit.
20
+
21
+ `evaluateSafe` takes the same arguments.
22
+
23
+ **`compile` and `execute`** — for a config that is stored. Unchanged.
24
+
25
+ **`prismTransform` is removed**, from `@niscorp/prism` and from `@niscorp/prism/migrations`. What it added over `evaluate` was a check that the source is plain JSON; that check is now `check: 'always'`, and a seam's source is taken as it is.
26
+
27
+ **moss, nova, vex, loom, nisc, create-nisc and the cli move with it.** Each has Prism as a peer or a dependency, or has one of those that do, and a Prism at 0.3 is outside the range their last versions accept: an app takes them together. Nothing in vex, loom or the cli changed beyond that range.
28
+
29
+ moss's shell and nova's `$prism` binding called `evaluate` on every use and so paid the check each time: an endpoint's request and response under moss, and a `$prism` value on each draw and for each row of a list, are 8 to 45 times faster for the configs measured. tide's and strata's documentation name `evaluate` where they named `prismTransform`.
30
+
31
+ **What to change**
32
+ - `import { prismTransform } from '@niscorp/prism'` or `'@niscorp/prism/migrations'` → `import { evaluate } from '@niscorp/prism'`, and `transform: prismTransform` → `transform: evaluate`. Every app made by `create-nisc` has this in `src/dev/strata.ts`; the app's typecheck and `npm run strata` both stop on that line until it is changed.
33
+ - A third argument of limits becomes `{ limits: … }`.
34
+ - A wrapper that parsed the config before calling `evaluate` (`evaluate(ConfigSchema.parse(config), …)`) makes a new object on every call and so is checked on every call: hand `evaluate` the config itself.
35
+ - Code that changes a config object in place and evaluates it again must hand over a new object, or pass `{ check: 'always' }`.
36
+ - A host that relied on `prismTransform` refusing a source that is not plain JSON checks it itself, or passes `{ check: 'always' }`.
37
+
38
+ ### Patch Changes
39
+
40
+ - Updated dependencies [023bcf9]
41
+ - Updated dependencies [1db6df4]
42
+ - Updated dependencies [6d098e4]
43
+ - Updated dependencies [8b4d97e]
44
+ - Updated dependencies [f834f3f]
45
+ - Updated dependencies [b084e30]
46
+ - Updated dependencies [663d724]
47
+ - Updated dependencies [6512d91]
48
+ - Updated dependencies [7d682b9]
49
+ - Updated dependencies [d2e9d22]
50
+ - Updated dependencies [e0e8abc]
51
+ - Updated dependencies [7fe1135]
52
+ - @niscorp/prism@0.3.0
53
+ - @niscorp/moss@0.4.0
54
+ - @niscorp/nova@0.3.0
55
+ - @niscorp/vex@0.3.0
56
+ - @niscorp/loom@0.3.0
57
+ - @niscorp/cli@0.4.0
58
+ - @niscorp/tide@0.1.5
59
+ - @niscorp/strata@0.1.5
60
+
3
61
  ## 0.3.3
4
62
 
5
63
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@niscorp/nisc",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "The nisc platform as one known-compatible set: every @niscorp package, each pinned to the exact version it was released with.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -20,17 +20,17 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@niscorp/charter": "0.1.2",
23
- "@niscorp/cli": "0.3.2",
23
+ "@niscorp/cli": "0.4.0",
24
+ "@niscorp/loom": "0.3.0",
25
+ "@niscorp/moss": "0.4.0",
24
26
  "@niscorp/cortex": "0.1.3",
25
- "@niscorp/loom": "0.2.2",
26
- "@niscorp/moss": "0.3.3",
27
- "@niscorp/nova": "0.2.2",
28
- "@niscorp/prism": "0.2.2",
29
- "@niscorp/strata": "0.1.4",
30
- "@niscorp/tide": "0.1.4",
31
- "@niscorp/vex": "0.2.3",
27
+ "@niscorp/nova": "0.3.0",
32
28
  "@niscorp/signal": "0.1.3",
33
- "@niscorp/solid": "0.1.2"
29
+ "@niscorp/solid": "0.1.2",
30
+ "@niscorp/strata": "0.1.5",
31
+ "@niscorp/prism": "0.3.0",
32
+ "@niscorp/tide": "0.1.5",
33
+ "@niscorp/vex": "0.3.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "zod": "^4.2.0"