@arkitektio/bsx 6.7.0 → 6.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.
- package/dist/bsx/declared.d.ts +10 -3
- package/dist/bsx/declared.d.ts.map +1 -1
- package/dist/bsx/declared.js +14 -3
- package/dist/bsx/declared.js.map +1 -1
- package/dist/bsx/expr.d.ts +5 -3
- package/dist/bsx/expr.d.ts.map +1 -1
- package/dist/bsx/expr.js +18 -7
- package/dist/bsx/expr.js.map +1 -1
- package/dist/bsx/language.d.ts.map +1 -1
- package/dist/bsx/language.js +3 -2
- package/dist/bsx/language.js.map +1 -1
- package/dist/bsx/parse.d.ts.map +1 -1
- package/dist/bsx/parse.js +23 -6
- package/dist/bsx/parse.js.map +1 -1
- package/dist/bsx/print.d.ts.map +1 -1
- package/dist/bsx/print.js +10 -3
- package/dist/bsx/print.js.map +1 -1
- package/dist/bsx/references.d.ts.map +1 -1
- package/dist/bsx/references.js +59 -21
- package/dist/bsx/references.js.map +1 -1
- package/dist/renderer/bloks/control.js +4 -4
- package/dist/renderer/bloks/control.js.map +1 -1
- package/dist/spec/bsx_v2.json +813 -19
- package/dist/spec/catalogs/base@4.json +7 -5
- package/dist/spec/catalogs/base@4.json.js +7 -5
- package/dist/spec/vocabulary.d.ts +2 -0
- package/dist/spec/vocabulary.d.ts.map +1 -1
- package/dist/spec/vocabulary.js +2 -0
- package/dist/spec/vocabulary.js.map +1 -1
- package/dist/spec/vocabulary.json +14 -12
- package/dist/spec/vocabulary.json.js +14 -12
- package/package.json +1 -1
- package/src/bsx/declared.ts +16 -5
- package/src/bsx/expr.ts +17 -8
- package/src/bsx/infer.test.ts +1 -1
- package/src/bsx/language.test.ts +17 -16
- package/src/bsx/language.ts +3 -2
- package/src/bsx/parse.ts +23 -4
- package/src/bsx/print.ts +9 -2
- package/src/bsx/references.test.ts +6 -6
- package/src/bsx/references.ts +60 -19
- package/src/renderer/bloks/control.tsx +5 -5
- package/src/spec/bsx_v2.json +813 -19
- package/src/spec/catalogs/base@4.json +7 -5
- package/src/spec/spec.test.ts +1 -1
- package/src/spec/vocabulary.json +14 -12
- package/src/spec/vocabulary.ts +4 -0
|
@@ -263,7 +263,7 @@
|
|
|
263
263
|
{
|
|
264
264
|
"name": "dependencies",
|
|
265
265
|
"group": "language",
|
|
266
|
-
"description": "Declares the dependencies of one of the app's own
|
|
266
|
+
"description": "Declares the dependencies of one action, for an agent blok one of the app's own, for a custom blok one of an agent it is bound to: read and called through its key (cells.<dependency>), picked by the viewer, and handed to a run of that action with `with <key>`. A child of <Blok>; draws nothing.",
|
|
267
267
|
"context": "PANEL",
|
|
268
268
|
"children_context": null,
|
|
269
269
|
"inherits_context": true,
|
|
@@ -282,11 +282,12 @@
|
|
|
282
282
|
"key": "like",
|
|
283
283
|
"kind": "STRING",
|
|
284
284
|
"required": true,
|
|
285
|
-
"description": "The action whose dependencies they are: self.<action>."
|
|
285
|
+
"description": "The action whose dependencies they are: self.<action>, in a custom blok agents.<name>.<action>."
|
|
286
286
|
}
|
|
287
287
|
],
|
|
288
288
|
"kinds": [
|
|
289
|
-
"agent"
|
|
289
|
+
"agent",
|
|
290
|
+
"custom"
|
|
290
291
|
],
|
|
291
292
|
"since": 3
|
|
292
293
|
},
|
|
@@ -10614,7 +10615,7 @@
|
|
|
10614
10615
|
{
|
|
10615
10616
|
"name": "deppicker",
|
|
10616
10617
|
"group": "run",
|
|
10617
|
-
"description": "The ready-made picker of the agent a declared dependency is bound to: the agents that fit, the chosen one shown, always changeable.
|
|
10618
|
+
"description": "The ready-made picker of the agent a declared dependency is bound to: the agents that fit, the chosen one shown, always changeable. In an agent or a custom blok.",
|
|
10618
10619
|
"context": "PANEL",
|
|
10619
10620
|
"children_context": null,
|
|
10620
10621
|
"inherits_context": false,
|
|
@@ -10631,7 +10632,8 @@
|
|
|
10631
10632
|
}
|
|
10632
10633
|
],
|
|
10633
10634
|
"kinds": [
|
|
10634
|
-
"agent"
|
|
10635
|
+
"agent",
|
|
10636
|
+
"custom"
|
|
10635
10637
|
],
|
|
10636
10638
|
"since": 3
|
|
10637
10639
|
},
|
package/src/spec/spec.test.ts
CHANGED
|
@@ -49,7 +49,7 @@ describe('the synced vocabulary', () => {
|
|
|
49
49
|
expect(vocabulary.callKinds).not.toContain('query_refetch');
|
|
50
50
|
expect(vocabulary.records.query.fields.map(field => field.key)).toContain('fetching_more');
|
|
51
51
|
expect(Object.keys(vocabulary.theme.dataAttributes).sort()).toEqual(['busy', 'stale']);
|
|
52
|
-
expect([vocabulary.vocab, vocabulary.minor]).toEqual([2,
|
|
52
|
+
expect([vocabulary.vocab, vocabulary.minor]).toEqual([2, 7]);
|
|
53
53
|
expect(vocabulary.baseCatalog).toBe('https://arkitekt.live/catalogs/base/v4');
|
|
54
54
|
expect(Object.values(vocabulary.bundledCatalogs)).toEqual(['catalogs/base@4.json', 'catalogs/orkestrator@1.json']);
|
|
55
55
|
expect(vocabulary.hostParts).toEqual(['args', 'arg', 'deps', 'dep', 'ask', 'returns', 'status', 'timeline', 'label', 'description', 'message', 'control', 'field']);
|
package/src/spec/vocabulary.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"vocab": 2,
|
|
3
|
-
"minor":
|
|
3
|
+
"minor": 7,
|
|
4
4
|
"description": "The blok language, version 2: what a blok may read, call and store. The spec's parser, the server (rekuest_core, takt) and the renderer (orkestrator) load this file or are generated from it. The design is the blok-vocab-v2 proposal of 2026-10-25. Three layers, each versioned on its own: this language (vocab, and minor for what it gained since); the base catalog, everything every renderer draws; and the app catalogs that extend it with what one frontend draws beyond (see catalogs). A server holds a blok to the language alone, never to a catalog: whoever draws a blok checks it against the catalog it has, and an author's tooling checks it when asked.",
|
|
5
5
|
"roots": {
|
|
6
6
|
"data": {
|
|
7
7
|
"self": "The agent the blok belongs to: the declaring agent (agent blok), the sending agent (task blok), the executing agent (action blok). Shorthand for deps.self.",
|
|
8
|
-
"deps": "deps.<key>: an agent
|
|
8
|
+
"deps": "deps.<key>: an agent a run of an action uses: the action's own dependencies (task, action and assign bloks), or the ones a blok declares for an action with <dependencies> (read through its key: cells.<dependency>, stored deps.cells__<dependency>). A custom blok's bound agents are written agents.<key> and stored deps.<key>.",
|
|
9
|
+
"agents": "agents.<key>: an agent a custom blok is bound to where it is materialized. Only a custom blok writes it; it is stored deps.<key>.",
|
|
9
10
|
"queries": "queries.<name>: a declared query's record (status, value, error, refetching, fetching_more).",
|
|
10
11
|
"subscriptions": "subscriptions.<name>: a declared subscription's record (status, value, error); value is the latest payload, or the last `keep` payloads.",
|
|
11
12
|
"args": "args.<key>: what the blok is opened on: the item for an agent or custom blok, the task's args for a task or action blok, the form's other arguments as they are filled in for a port blok (read only).",
|
|
@@ -23,9 +24,9 @@
|
|
|
23
24
|
"functions": ["cmp", "logic", "math", "str", "list", "obj", "val", "fmt", "time", "ui", "query"],
|
|
24
25
|
"future": ["mutations"]
|
|
25
26
|
},
|
|
26
|
-
"reserved": ["self", "deps", "queries", "subscriptions", "args", "task", "assign", "port", "event", "viewer", "then", "error", "cmp", "logic", "math", "str", "list", "obj", "val", "fmt", "time", "ui", "query", "mutations"],
|
|
27
|
+
"reserved": ["self", "deps", "agents", "queries", "subscriptions", "args", "task", "assign", "port", "event", "viewer", "then", "error", "cmp", "logic", "math", "str", "list", "obj", "val", "fmt", "time", "ui", "query", "mutations"],
|
|
27
28
|
"agent_segments": {
|
|
28
|
-
"description": "What follows an agent (self or
|
|
29
|
+
"description": "What follows an agent (self, deps.<key> or agents.<key>): .<state>.<field> is state, .tasks.<action> the latest task of that action, .assets.<name> one of the agent's assets; deps.<key>.<action>(...) calls it.",
|
|
29
30
|
"tasks": "tasks",
|
|
30
31
|
"assets": "assets",
|
|
31
32
|
"fields": {"id": "The agent's id (a query variable: deps.robot.id).", "name": "The agent's name.", "connected": "Whether the agent is connected right now (true or false)."},
|
|
@@ -39,8 +40,8 @@
|
|
|
39
40
|
"contexts": ["PANEL", "SCENE", "LOGO"]
|
|
40
41
|
},
|
|
41
42
|
"custom": {
|
|
42
|
-
"description": "Built by a user and materialized onto agents
|
|
43
|
-
"roots": ["
|
|
43
|
+
"description": "Built by a user and materialized onto agents, each read as agents.<key>. What a run of one of their actions uses it may declare with <dependencies key like=\"agents.<key>.<action>\" />.",
|
|
44
|
+
"roots": ["agents", "args", "queries", "subscriptions", "viewer", "then"],
|
|
44
45
|
"locals": true,
|
|
45
46
|
"contexts": ["PANEL", "SCENE"]
|
|
46
47
|
},
|
|
@@ -94,10 +95,10 @@
|
|
|
94
95
|
"chrome": ["PANEL", "SCENE"],
|
|
95
96
|
"declarations": {
|
|
96
97
|
"description": "What a blok owns, declared in its tree. Each is stored as a node of its own and draws nothing.",
|
|
97
|
-
"local": "<local name=\"x\" default={...} persist kind=... />: a local (see locals). It comes before every other child of its parent and is in scope in its parent's subtree only; inside a foreach there is one per item. Every attribute but name is a literal: a port field (kind, identifier, nullable, choices, children, label, description, default, ...), persist, or like=\"self.<action>.<arg>\" / like=\"deps.<key>.<action>.<arg>\" (the port of that argument, resolved where the blok is mounted).",
|
|
98
|
+
"local": "<local name=\"x\" default={...} persist kind=... />: a local (see locals). It comes before every other child of its parent and is in scope in its parent's subtree only; inside a foreach there is one per item. Every attribute but name is a literal: a port field (kind, identifier, nullable, choices, children, label, description, default, ...), persist, or like=\"self.<action>.<arg>\" / like=\"deps.<key>.<action>.<arg>\" (the port of that argument, resolved where the blok is mounted; a custom blok writes like=\"agents.<key>.<action>.<arg>\").",
|
|
98
99
|
"query": "<query name=\"x\" service=\"mikro\" document=\"query (...) {...}\" poll={5} more=\"items\"><var key=\"k\" value={...} /></query>: a declared read, queries.<name>. A child of <Blok>, before its content.",
|
|
99
100
|
"subscription": "<subscription name=\"x\" service=\"mikro\" document=\"subscription (...) {...}\" keep={10} history=\"q\"><var key=\"k\" value={...} /></subscription>: a declared stream, subscriptions.<name>. A child of <Blok>, before its content.",
|
|
100
|
-
"dependencies": "<dependencies key=\"cells\" like=\"self.<action>\" />: the dependencies of one of the app's own actions, for an agent blok to read, call and hand to a run of it. Each is read through the key, bare: cells.<dependency>.<state>.<field>, cells.<dependency>.<action>(...), cells.<dependency>.connected (stored as the blok's dependency deps.cells__<dependency>). cells.options.<dependency> lists the agents that fit one ({id, name, connected, picked}) and cells.pick(<dependency>: <agent id>) binds it; <deppicker key=\"cells.<dependency>\" /> is the ready-made picker. Which agent each is bound to is the viewer's own choice, kept on their device and never on a server; until they choose it is seeded once, with the agent the latest run of the action had, else the only one that fits. A child of <Blok>, after its locals and before what reads through it; an agent blok only. An action whose dependency is called options or pick cannot be read through one.",
|
|
101
|
+
"dependencies": "<dependencies key=\"cells\" like=\"self.<action>\" />: the dependencies of one of the app's own actions, for an agent blok to read, call and hand to a run of it. A custom blok declares those of an action of an agent it is bound to: like=\"agents.<name>.<action>\" (stored deps.<name>.<action>). Each is read through the key, bare: cells.<dependency>.<state>.<field>, cells.<dependency>.<action>(...), cells.<dependency>.connected (stored as the blok's dependency deps.cells__<dependency>). cells.options.<dependency> lists the agents that fit one ({id, name, connected, picked}) and cells.pick(<dependency>: <agent id>) binds it; <deppicker key=\"cells.<dependency>\" /> is the ready-made picker. Which agent each is bound to is the viewer's own choice, kept on their device and never on a server; until they choose it is seeded once, with the agent the latest run of the action had, else the only one that fits. A child of <Blok>, after its locals and before what reads through it; an agent blok only. An action whose dependency is called options or pick cannot be read through one.",
|
|
101
102
|
"var": "<var key=\"k\" value={expression or literal} />: one variable of a query or subscription; an expression over args, blok-level locals and agents."
|
|
102
103
|
}
|
|
103
104
|
},
|
|
@@ -360,7 +361,7 @@
|
|
|
360
361
|
"calls": {
|
|
361
362
|
"description": "What a prop or an argument may hold besides a literal, a path or a util call.",
|
|
362
363
|
"kinds": {
|
|
363
|
-
"agent_call": "A task call: self.<action>(...) or deps.<key>.<action>(...), only as a callback's one thing, optionally named with `into <name>` (stored as the prop's declares_value). A call to
|
|
364
|
+
"agent_call": "A task call: self.<action>(...) or deps.<key>.<action>(...) (in a custom blok agents.<key>.<action>(...)), only as a callback's one thing, optionally named with `into <name>` (stored as the prop's declares_value). A call to the agent a <dependencies> names may say `with <key>` before `into`: the run gets the agents the blok's <dependencies key=\"<key>\" /> are bound to (stored as the call's given: <key>); a dependency nobody bound resolves as it always does. A kind that says calls: false (a port blok) holds none.",
|
|
364
365
|
"util_call": "A pure function, or an effect (ui.copy, task.answer, assign.start, port.set, query.refetch, query.fetch_more) as a callback's one thing."
|
|
365
366
|
},
|
|
366
367
|
"reserved_kinds": {
|
|
@@ -476,21 +477,22 @@
|
|
|
476
477
|
"callback.await": {"level": "error", "message": "A callback does not await; a control is busy while its call's task runs."},
|
|
477
478
|
"callback.nested": {"level": "error", "message": "{what} runs only as a callback's one thing, not inside an expression.", "hint": "Move {what} into a callback prop of its own (onClick={{...}}); an expression only reads."},
|
|
478
479
|
"callback.positional": {"level": "error", "message": "{call}: a task call names its arguments (name: value)."},
|
|
479
|
-
"callback.with": {"level": "error", "message": "with hands a task call
|
|
480
|
+
"callback.with": {"level": "error", "message": "with hands a task call the dependencies the blok declares for that action: `self.<action>(...) with <key>`, in a custom blok `agents.<name>.<action>(...) with <key>`.", "hint": "Write `self.<action>(name: value) with cells into run`, where the blok declares <dependencies key=\"cells\" like=\"self.<action>\" />."},
|
|
480
481
|
"callback.into": {"level": "error", "message": "into names the record of a task call: `<call> into <name>`.", "hint": "Write `deps.<key>.<action>(name: value) into run`, then read run.running, run.returns.<port>."},
|
|
481
482
|
"callback.not_callback": {"level": "error", "message": "{key} of <{component}> is not a callback prop, so it cannot hold {what}.", "hint": "Use a callback prop of <{component}> (the catalog lists them as CALLBACK), or compute {key} without a call."},
|
|
482
483
|
"callback.unbound": {"level": "error", "message": "{key} of <{component}> is a callback prop: it holds one task call or one effect (queries.<name>.refetch(), queries.<name>.fetch_more(...), ui.copy, task.answer, assign.start, port.set).", "hint": "Give {key} a task call (deps.<key>.<action>(name: value)) or one effect, not a value."},
|
|
483
484
|
"callback.event_field": {"level": "error", "message": "event has no field {field!r} in {key} of <{component}> (its fields: {fields}).", "hint": "Read one of the fields listed for {key}: {fields}."},
|
|
484
485
|
"roots.unknown": {"level": "error", "message": "{path} reads {root!r}, which is no root, local, loop variable or record of this blok.", "hint": "Read a root this blok has (deps.<key>, args.<key>, queries.<name>, ...), a declared local, a foreach let or index, or an into record."},
|
|
485
486
|
"roots.not_in_kind": {"level": "error", "message": "{path}: a{n} {kind} blok has no {root!r} (it reads {roots}).", "hint": "Read one of {roots} instead."},
|
|
487
|
+
"roots.custom_deps": {"level": "error", "message": "{path}: a custom blok reads an agent it is bound to as agents.<key>, not deps.<key>.", "hint": "Write agents.<key> instead: the same path, from agents."},
|
|
486
488
|
"roots.reserved": {"level": "error", "message": "{name!r} is reserved: no local, let, index or into may use it."},
|
|
487
489
|
"roots.shadow": {"level": "error", "message": "{name!r} is declared twice: as {first} and as {second}."},
|
|
488
490
|
"roots.event_outside_callback": {"level": "error", "message": "{path} reads event outside a callback.", "hint": "Read event only inside a callback prop; outside one, bind a control to a local and read the local."},
|
|
489
491
|
"roots.error_outside_boundary": {"level": "error", "message": "{path} reads error outside an <error> slot.", "hint": "Read error only inside the <error> slot of a <suspense>."},
|
|
490
492
|
"roots.whole": {"level": "error", "message": "{path} reads {root!r} whole; read one of it ({root}.<name>).", "hint": "Read a field of it, as {root}.<name>."},
|
|
491
|
-
"dependencies.position": {"level": "error", "message": "<dependencies> {key!r} is declared at {at}: dependencies are declared as a child of the <Blok> of an agent blok.", "hint": "Move it to the top of the <Blok>, after its locals; an action's
|
|
493
|
+
"dependencies.position": {"level": "error", "message": "<dependencies> {key!r} is declared at {at}: dependencies are declared as a child of the <Blok> of an agent or custom blok.", "hint": "Move it to the top of the <Blok>, after its locals; an action's dependencies are declared where it is mounted."},
|
|
492
494
|
"dependencies.key": {"level": "error", "message": "<dependencies> ({node}) {problem}.", "hint": "Write <dependencies key=\"cells\" like=\"self.<action>\" />: a plain key, declared once."},
|
|
493
|
-
"dependencies.like": {"level": "error", "message": "<dependencies> {key!r}: like={like!r} {problem}.", "hint": "like names one of the app's own
|
|
495
|
+
"dependencies.like": {"level": "error", "message": "<dependencies> {key!r}: like={like!r} {problem}.", "hint": "like names an action that has dependencies: one of the app's own (self.<action>), in a custom blok one of an agent it is bound to (agents.<name>.<action>)."},
|
|
494
496
|
"with.mismatch": {"level": "error", "message": "{path}: {key!r} is the dependencies of {of}, not of {action}.", "hint": "Declare <dependencies key=... like=\"self.{action}\" /> and hand that over."},
|
|
495
497
|
"deps.unknown": {"level": "error", "message": "{path}: {key!r} is not a dependency of the blok (its dependencies: {keys}). Fix: {hint}."},
|
|
496
498
|
"deps.unknown_state": {"level": "error", "message": "{path}: {key!r} has no state {state!r} (its states: {states}).", "hint": "Read one of the states listed, or add the agent that has it as a dependency."},
|
package/src/spec/vocabulary.ts
CHANGED
|
@@ -66,6 +66,10 @@ export type VocabKind = {
|
|
|
66
66
|
calls: boolean;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
+
/** Whether a blok of this kind holds the stored `root`: a custom blok's `agents` is stored `deps`. */
|
|
70
|
+
export const kindReads = (kind: VocabKind, root: string): boolean =>
|
|
71
|
+
kind.roots.includes(root) || (root === 'deps' && kind.roots.includes('agents'));
|
|
72
|
+
|
|
69
73
|
/** The row of `kind` in `context`: its own, or the narrower one it has there (vocabulary `kinds.<kind>.in`). */
|
|
70
74
|
export const kindIn = (kind: VocabKind, context: string): VocabKind => kind.within[context as BlokContextName] ?? kind;
|
|
71
75
|
|