@jigs.design/runtime 0.1.0 → 0.1.1
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.
- package/README.md +5 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/tree-store.d.ts +17 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,10 +6,10 @@ The layer the server and the browser share: the program format, the types on the
|
|
|
6
6
|
|
|
7
7
|
## Entry points
|
|
8
8
|
|
|
9
|
-
| Entry | What it holds
|
|
10
|
-
| ---------------------------- |
|
|
11
|
-
| `@jigs.design/runtime` | `Program`, `SessionEvent`, `Message`, `Diagnostic` and the other shared types; the frame protocol; the JSON checks the browser runs; `createTreeStore`; the image and link allowlists |
|
|
12
|
-
| `@jigs.design/runtime/frame` | The sandbox frame document, its content security policy,
|
|
9
|
+
| Entry | What it holds |
|
|
10
|
+
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| `@jigs.design/runtime` | `Program`, `SessionEvent`, `Message`, `Diagnostic` and the other shared types; the frame protocol (`HostMessage`, `FrameMessage`, `Op`); the JSON checks the browser runs; `createTreeStore` with its caps `MAX_NODES`, `MAX_OPS` and `MAX_TEXT`; the image and link allowlists |
|
|
12
|
+
| `@jigs.design/runtime/frame` | The sandbox frame document, its content security policy, the worker runtime, and `WATCHDOG_MS` and `HEARTBEAT_MS`. The server serves it |
|
|
13
13
|
|
|
14
14
|
## How a program runs
|
|
15
15
|
|
|
@@ -27,4 +27,4 @@ The server serves the frame document from its route. The frame starts a worker a
|
|
|
27
27
|
|
|
28
28
|
## Docs
|
|
29
29
|
|
|
30
|
-
[Sandbox](../../apps/docs/docs/react/sandbox.mdx) and [Packages](../../apps/docs/docs/packages/index.mdx).
|
|
30
|
+
[Sandbox](../../apps/docs/docs/react/sandbox.mdx), [Frame protocol](../../apps/docs/docs/renderers/protocol.mdx) and [Packages](../../apps/docs/docs/packages/index.mdx).
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import { frameSecurityPolicy } from "./frame-policy.js";
|
|
|
2
2
|
import { ChatBlock, ChatBlockStatus, ChildrenKind, ComponentSchema, Diagnostic, DiagnosticFix, Invalidation, JsonValue, Message, NumberPropSchema, PROGRAM_FORMAT, PickleErrorCode, PickleErrorData, ProcedureEntry, ProcedureKind, Program, PropSchema, SessionBody, SessionEvent, SessionOptions, Span, pickleErrorCodes } from "./types.js";
|
|
3
3
|
import { FrameMessage, HostMessage, MutationCall, MutationResult, Op, QueryRead, QueryResult, ROOT_ID, Row, RuntimeError, WireArg, WireValue, WorkerMessage } from "./protocol.js";
|
|
4
4
|
import { parseErrorData, parseInvalidations, parseProgram, parseSessionEvent } from "./parse.js";
|
|
5
|
-
import { TreeNode, TreeStore, createTreeStore } from "./tree-store.js";
|
|
5
|
+
import { MAX_NODES, MAX_OPS, MAX_TEXT, TreeNode, TreeStore, createTreeStore } from "./tree-store.js";
|
|
6
6
|
import { isAllowedImage, isAllowedLink, isImageHostEntry, normalizeImageHost } from "./urls.js";
|
|
7
|
-
export { type ChatBlock, type ChatBlockStatus, type ChildrenKind, type ComponentSchema, type Diagnostic, type DiagnosticFix, type FrameMessage, type HostMessage, type Invalidation, type JsonValue, type Message, type MutationCall, type MutationResult, type NumberPropSchema, type Op, PROGRAM_FORMAT, type PickleErrorCode, type PickleErrorData, type ProcedureEntry, type ProcedureKind, type Program, type PropSchema, type QueryRead, type QueryResult, ROOT_ID, type Row, type RuntimeError, type SessionBody, type SessionEvent, type SessionOptions, type Span, type TreeNode, type TreeStore, type WireArg, type WireValue, type WorkerMessage, createTreeStore, frameSecurityPolicy, isAllowedImage, isAllowedLink, isImageHostEntry, normalizeImageHost, parseErrorData, parseInvalidations, parseProgram, parseSessionEvent, pickleErrorCodes };
|
|
7
|
+
export { type ChatBlock, type ChatBlockStatus, type ChildrenKind, type ComponentSchema, type Diagnostic, type DiagnosticFix, type FrameMessage, type HostMessage, type Invalidation, type JsonValue, MAX_NODES, MAX_OPS, MAX_TEXT, type Message, type MutationCall, type MutationResult, type NumberPropSchema, type Op, PROGRAM_FORMAT, type PickleErrorCode, type PickleErrorData, type ProcedureEntry, type ProcedureKind, type Program, type PropSchema, type QueryRead, type QueryResult, ROOT_ID, type Row, type RuntimeError, type SessionBody, type SessionEvent, type SessionOptions, type Span, type TreeNode, type TreeStore, type WireArg, type WireValue, type WorkerMessage, createTreeStore, frameSecurityPolicy, isAllowedImage, isAllowedLink, isImageHostEntry, normalizeImageHost, parseErrorData, parseInvalidations, parseProgram, parseSessionEvent, pickleErrorCodes };
|
package/dist/index.js
CHANGED
|
@@ -3,5 +3,5 @@ import { ROOT_ID } from "./protocol.js";
|
|
|
3
3
|
import { frameSecurityPolicy } from "./frame-policy.js";
|
|
4
4
|
import { parseErrorData, parseInvalidations, parseProgram, parseSessionEvent } from "./parse.js";
|
|
5
5
|
import { isAllowedImage, isAllowedLink, isImageHostEntry, normalizeImageHost } from "./urls.js";
|
|
6
|
-
import { createTreeStore } from "./tree-store.js";
|
|
7
|
-
export { PROGRAM_FORMAT, ROOT_ID, createTreeStore, frameSecurityPolicy, isAllowedImage, isAllowedLink, isImageHostEntry, normalizeImageHost, parseErrorData, parseInvalidations, parseProgram, parseSessionEvent, pickleErrorCodes };
|
|
6
|
+
import { MAX_NODES, MAX_OPS, MAX_TEXT, createTreeStore } from "./tree-store.js";
|
|
7
|
+
export { MAX_NODES, MAX_OPS, MAX_TEXT, PROGRAM_FORMAT, ROOT_ID, createTreeStore, frameSecurityPolicy, isAllowedImage, isAllowedLink, isImageHostEntry, normalizeImageHost, parseErrorData, parseInvalidations, parseProgram, parseSessionEvent, pickleErrorCodes };
|
package/dist/tree-store.d.ts
CHANGED
|
@@ -22,6 +22,23 @@ export interface TreeStore {
|
|
|
22
22
|
setSchemas: (schemas: TreeSchemas) => void;
|
|
23
23
|
subscribe: (listener: () => void) => () => void;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Most nodes a tree may hold, the root aside. The runtime refuses to render
|
|
27
|
+
* more (it keeps its own copy of the number), so only a worker that broke out
|
|
28
|
+
* of the runtime gets past it here, and the store drops the creates over it.
|
|
29
|
+
* The count is what a whole message leaves: the runtime may create a row's
|
|
30
|
+
* new nodes before it removes the old ones further on, so mid-message the
|
|
31
|
+
* store may hold up to twice this (`MAX_DRAFT_NODES`).
|
|
32
|
+
*/
|
|
33
|
+
export declare const MAX_NODES = 10000;
|
|
34
|
+
/**
|
|
35
|
+
* Most ops one message may carry. A render of `MAX_NODES` nodes needs at most
|
|
36
|
+
* three per node (remove the old one, create and place the new one), so the
|
|
37
|
+
* runtime stays under it; a message over it is dropped whole.
|
|
38
|
+
*/
|
|
39
|
+
export declare const MAX_OPS: number;
|
|
40
|
+
/** Longest text a text node may hold, in UTF-16 code units, as for a string prop. */
|
|
41
|
+
export declare const MAX_TEXT = 10000;
|
|
25
42
|
/**
|
|
26
43
|
* The page's copy of the sandboxed UI, built from worker ops. Ops are
|
|
27
44
|
* untrusted: components the program did not declare and props that fail
|
package/package.json
CHANGED