@arkitektio/bsx 4.0.0 → 4.1.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 (55) hide show
  1. package/dist/bsx/references.d.ts.map +1 -1
  2. package/dist/bsx/references.js +17 -4
  3. package/dist/bsx/references.js.map +1 -1
  4. package/dist/renderer/BlokRenderer.d.ts +3 -1
  5. package/dist/renderer/BlokRenderer.d.ts.map +1 -1
  6. package/dist/renderer/BlokRenderer.js +5 -1
  7. package/dist/renderer/BlokRenderer.js.map +1 -1
  8. package/dist/renderer/bloks/control.d.ts +1 -0
  9. package/dist/renderer/bloks/control.d.ts.map +1 -1
  10. package/dist/renderer/bloks/control.js +10 -0
  11. package/dist/renderer/bloks/control.js.map +1 -1
  12. package/dist/renderer/bloks/run/components.d.ts.map +1 -1
  13. package/dist/renderer/bloks/run/components.js +6 -2
  14. package/dist/renderer/bloks/run/components.js.map +1 -1
  15. package/dist/renderer/bloks/run/host.d.ts +2 -0
  16. package/dist/renderer/bloks/run/host.d.ts.map +1 -1
  17. package/dist/renderer/bloks/run/host.js.map +1 -1
  18. package/dist/renderer/runtime/context.d.ts +1 -0
  19. package/dist/renderer/runtime/context.d.ts.map +1 -1
  20. package/dist/renderer/runtime/context.js +4 -0
  21. package/dist/renderer/runtime/context.js.map +1 -1
  22. package/dist/renderer/runtime/hooks.d.ts.map +1 -1
  23. package/dist/renderer/runtime/hooks.js +1 -0
  24. package/dist/renderer/runtime/hooks.js.map +1 -1
  25. package/dist/renderer/runtime/resolution.d.ts +1 -0
  26. package/dist/renderer/runtime/resolution.d.ts.map +1 -1
  27. package/dist/renderer/runtime/resolution.js +13 -2
  28. package/dist/renderer/runtime/resolution.js.map +1 -1
  29. package/dist/renderer/runtime/types.d.ts +5 -0
  30. package/dist/renderer/runtime/types.d.ts.map +1 -1
  31. package/dist/spec/bsx_v2.json +287 -0
  32. package/dist/spec/catalogs/base@2.json +12 -0
  33. package/dist/spec/catalogs/base@2.json.js +12 -0
  34. package/dist/spec/vocabulary.d.ts +1 -1
  35. package/dist/spec/vocabulary.d.ts.map +1 -1
  36. package/dist/spec/vocabulary.js +1 -1
  37. package/dist/spec/vocabulary.js.map +1 -1
  38. package/dist/spec/vocabulary.json +11 -3
  39. package/dist/spec/vocabulary.json.js +11 -3
  40. package/package.json +1 -1
  41. package/src/bsx/references.ts +18 -4
  42. package/src/renderer/BlokRenderer.tsx +8 -0
  43. package/src/renderer/bloks/control.tsx +15 -0
  44. package/src/renderer/bloks/run/components.tsx +7 -1
  45. package/src/renderer/bloks/run/host.tsx +2 -0
  46. package/src/renderer/bloks/run/space.test.tsx +67 -0
  47. package/src/renderer/runtime/context.tsx +5 -0
  48. package/src/renderer/runtime/hooks.ts +1 -0
  49. package/src/renderer/runtime/resolution.test.ts +8 -0
  50. package/src/renderer/runtime/resolution.ts +11 -2
  51. package/src/renderer/runtime/types.ts +5 -0
  52. package/src/spec/bsx_v2.json +287 -0
  53. package/src/spec/catalogs/base@2.json +12 -0
  54. package/src/spec/vocabulary.json +11 -3
  55. package/src/spec/vocabulary.ts +2 -2
@@ -170,6 +170,14 @@ export const blokContextOf = (component: string): string | null => loadVocabular
170
170
  /** Props whose value is the blok's dependency keys, written out (not paths): each must be a dependency. */
171
171
  const DEPENDENCY_KEY_PROPS = new Set(['Placed.dep', 'Route.through']);
172
172
 
173
+ /** The kinds that have a run's dependencies: an action's own bloks, for a run and for starting one. */
174
+ const RUN_KINDS: readonly string[] = ['action', 'assign'];
175
+ const ASSIGN_KIND = 'assign';
176
+ /** The form of the run's arguments, placed by an assign blok. */
177
+ const ARGS_COMPONENT = 'args';
178
+ /** Starts the run an assign blok prepares. */
179
+ const START_EFFECT = 'assign.start';
180
+
173
181
  const OPEN_IDENTIFIER = '*';
174
182
  const ITEM = '...';
175
183
  const TOAST_COMPONENT = 'Toast';
@@ -313,7 +321,7 @@ const DIGITS = /^[0-9]+$/;
313
321
  * - an agent blok has none: ``agent bloks read only `self` ``.
314
322
  */
315
323
  export const dependencyHint = (key: string, kind: BlokKind): string => {
316
- if (kind === 'action' || kind === 'action_logo') return `add a dependency parameter \`${key}\` to the action`;
324
+ if (kind === 'action' || kind === 'assign' || kind === 'action_logo') return `add a dependency parameter \`${key}\` to the action`;
317
325
  if (kind === 'agent') return 'agent bloks read only `self`';
318
326
  return `dependencies=[AgentDependencyInput(key="${key}")]`;
319
327
  };
@@ -567,6 +575,9 @@ class Checker {
567
575
  this.shadowed.add(node.component);
568
576
  this.add('catalog.shadow', node.id, {component: node.component, catalog: shadow.catalog, module: shadow.module, winner: shadow.winner});
569
577
  }
578
+ if (node.component === ARGS_COMPONENT && this.scope.kind !== ASSIGN_KIND) {
579
+ this.add('assign.kind', node.id, {what: '<args>', n: article(this.scope.kind), kind: this.scope.kind});
580
+ }
570
581
  for (const prop of node.props ?? []) this.checkProp(node, prop, spec);
571
582
  }
572
583
 
@@ -609,7 +620,7 @@ class Checker {
609
620
 
610
621
  /** A ``Placed dep`` or ``Route through`` names dependencies of the blok, written out as keys. */
611
622
  private checkDependencyKeys(node: BlokComponentNode, prop: BlokComponentProp): void {
612
- if (this.scope.kind !== 'action') {
623
+ if (!RUN_KINDS.includes(this.scope.kind)) {
613
624
  this.add('space.kind', node.id, {component: node.component, n: article(this.scope.kind), kind: this.scope.kind}, prop.key);
614
625
  return;
615
626
  }
@@ -672,9 +683,12 @@ class Checker {
672
683
  }
673
684
  }
674
685
  }
686
+ if (prop.util_call?.operation === START_EFFECT && this.scope.kind !== ASSIGN_KIND) {
687
+ this.add('assign.kind', node.id, {what: 'assign.start()', n: article(this.scope.kind), kind: this.scope.kind}, prop.key);
688
+ }
675
689
  if (DEPENDENCY_KEY_PROPS.has(`${node.component}.${prop.key}`)) this.checkDependencyKeys(node, prop);
676
- if (node.component === 'Space' && prop.key === 'room' && this.scope.kind !== 'action') {
677
- // A Space places the run's dependencies: only an action's own blok has a run.
690
+ if (node.component === 'Space' && prop.key === 'room' && !RUN_KINDS.includes(this.scope.kind)) {
691
+ // A Space places the run's dependencies: only an action's own blok (for a run, or for starting one) has them.
678
692
  this.add('space.kind', node.id, {component: node.component, n: article(this.scope.kind), kind: this.scope.kind}, prop.key);
679
693
  }
680
694
  if (node.component === TOAST_COMPONENT && prop.key === TOAST_TASK_PROP) {
@@ -82,6 +82,8 @@ type BlokRendererProps = {
82
82
  readExecutor?: BlokReadExecutor;
83
83
  /** Answers the open ask of `task` (`task.answer(values)`). */
84
84
  answerTask?: (values: Record<string, unknown>) => unknown;
85
+ /** Starts the run an assign blok prepares (`assign.start()`). */
86
+ startRun?: () => unknown;
85
87
  /** Where `persist` components keep their state by id; none: they keep nothing. */
86
88
  componentState?: BlokComponentStateStore | null;
87
89
  children?: React.ReactNode;
@@ -145,6 +147,7 @@ export default function BlokRenderer({
145
147
  subscriptions = NO_SUBSCRIPTIONS,
146
148
  readExecutor,
147
149
  answerTask,
150
+ startRun,
148
151
  componentState = null,
149
152
  children,
150
153
  }: BlokRendererProps) {
@@ -198,6 +201,7 @@ export default function BlokRenderer({
198
201
  statuses: unboundDependencies?.length ? {...statuses, ...unboundDependencyStatuses(unboundDependencies)} : statuses,
199
202
  travelAt,
200
203
  answerTask,
204
+ startRun,
201
205
  });
202
206
  return store;
203
207
  });
@@ -221,6 +225,10 @@ export default function BlokRenderer({
221
225
  runtimeStore.getState().setAnswerTask(answerTask);
222
226
  }, [answerTask, runtimeStore]);
223
227
 
228
+ useEffect(() => {
229
+ runtimeStore.getState().setStartRun(startRun);
230
+ }, [startRun, runtimeStore]);
231
+
224
232
  useEffect(() => {
225
233
  if (keptRoots) runtimeStore.getState().setKeptRoots(keptRoots);
226
234
  }, [keptRoots, runtimeStore]);
@@ -420,6 +420,20 @@ export const Ask = createBlokComponent(
420
420
  () => <>{useBlokRunHost().renderAsk()}</>,
421
421
  );
422
422
 
423
+ /* -------------------------------------------------------------------------- */
424
+ /* args */
425
+ /* -------------------------------------------------------------------------- */
426
+
427
+ export const Args = createBlokComponent(
428
+ {
429
+ name: 'args',
430
+ schema: z
431
+ .object({})
432
+ .describe("The arguments of the run an assign blok starts, as a form generated from the action's ports: filled in right here, read as `args.<key>`."),
433
+ },
434
+ () => <>{useBlokRunHost().renderArgs?.() ?? null}</>,
435
+ );
436
+
423
437
  export const controlBlokComponents = [
424
438
  Foreach,
425
439
  If,
@@ -433,4 +447,5 @@ export const controlBlokComponents = [
433
447
  Fallback,
434
448
  ErrorSlot,
435
449
  Ask,
450
+ Args,
436
451
  ];
@@ -87,6 +87,12 @@ const ArrangeToggle = ({arranging, onChange}: {arranging: boolean; onChange: (ar
87
87
  </div>
88
88
  );
89
89
 
90
+ /** Says so when a `Space` names no room. Rendered inside the scene: a notice needs the scene's store, which the frame opens. */
91
+ const RoomNotice = ({reference}: {reference: string}) => {
92
+ useSceneNotice(reference ? null : 'A space without a room', 'Name the room (`room="room:lab"`): where devices stand is kept by it.');
93
+ return null;
94
+ };
95
+
90
96
  const SpaceRender: BlokRender<Contracts['Space']> = ({component, buildChild}) => {
91
97
  const blok = useBlok(component, spaceSchema);
92
98
  const reference = useValue(blok.room) ?? '';
@@ -96,10 +102,10 @@ const SpaceRender: BlokRender<Contracts['Space']> = ({component, buildChild}) =>
96
102
  // Only a room the viewer may keep can be arranged, and never while viewing the past.
97
103
  const canArrange = room.save !== undefined && !still;
98
104
  const moving = arranging && canArrange;
99
- useSceneNotice(reference ? null : 'A space without a room', 'Name the room (`room="room:lab"`): where devices stand is kept by it.');
100
105
 
101
106
  const children = (
102
107
  <RoomProvider room={room} arranging={moving}>
108
+ <RoomNotice reference={reference} />
103
109
  <BlokSceneInertProvider value={moving}>
104
110
  <Children component={component} buildChild={buildChild} />
105
111
  </BlokSceneInertProvider>
@@ -21,6 +21,8 @@ export type BlokRunHost = {
21
21
  agentsFor: (key: string) => readonly BlokRunAgent[];
22
22
  /** The run's open ask, answered in place (answering resumes the run); nothing while none is open. */
23
23
  renderAsk: () => React.ReactNode;
24
+ /** The form of the arguments of the run an assign blok starts (`<args />`); absent where no run is being started. */
25
+ renderArgs?: () => React.ReactNode;
24
26
  };
25
27
 
26
28
  const NO_AGENTS: readonly BlokRunAgent[] = Object.freeze([]);
@@ -0,0 +1,67 @@
1
+ // @vitest-environment jsdom
2
+ import * as React from 'react';
3
+ import {render, screen} from '@testing-library/react';
4
+ import {describe, expect, it, vi} from 'vitest';
5
+ import BlokRenderer from '../../BlokRenderer';
6
+ import {BlokRunHostProvider, BlokSpaceHostProvider, type BlokRunHost, type BlokSpaceHost} from './host';
7
+ import {testCatalog} from '../testing';
8
+
9
+ // No WebGL in jsdom: the canvas holds nothing here. What is checked is the frame
10
+ // around it, which a standalone Space opens itself.
11
+ vi.mock('@react-three/fiber', async importOriginal => ({
12
+ ...(await importOriginal<typeof import('@react-three/fiber')>()),
13
+ Canvas: () => <div data-testid="canvas" />,
14
+ }));
15
+
16
+ const prop = (key: string, value: unknown) => ({key, static_value: value});
17
+
18
+ const space = (room: string) => [
19
+ {id: 'root', component: 'Space', props: [prop('room', room)], children: [{id: 'robot', component: 'Placed', props: [prop('dep', 'robot')]}]},
20
+ ];
21
+
22
+ const host = (canSave: boolean): BlokSpaceHost => ({
23
+ useRoom: () => ({poseOf: () => null, ...(canSave ? {save: () => undefined} : {})}),
24
+ renderAgent: () => null,
25
+ });
26
+
27
+ const mount = (canSave: boolean, room = 'room:lab') =>
28
+ render(
29
+ <BlokSpaceHostProvider value={host(canSave)}>
30
+ <BlokRenderer catalog={testCatalog()} uiComponents={space(room)} />
31
+ </BlokSpaceHostProvider>,
32
+ );
33
+
34
+ describe('a space shown on its own', () => {
35
+ it('opens a scene of its own, with Arrange where the host keeps poses', () => {
36
+ mount(true);
37
+ expect(screen.getByTestId('canvas')).toBeTruthy();
38
+ expect(screen.getByRole('button', {name: /arrange/i})).toBeTruthy();
39
+ });
40
+
41
+ it('offers no Arrange where the viewer may not keep a pose', () => {
42
+ mount(false);
43
+ expect(screen.getByTestId('canvas')).toBeTruthy();
44
+ expect(screen.queryByRole('button', {name: /arrange/i})).toBeNull();
45
+ });
46
+
47
+ it('renders with an empty room too: its notice belongs to the scene it opens', () => {
48
+ mount(true, '');
49
+ expect(screen.getByTestId('canvas')).toBeTruthy();
50
+ });
51
+ });
52
+
53
+ describe('the argument form an assign blok places', () => {
54
+ it('draws what the host gives for <args />, and nothing without a host', () => {
55
+ const tree = [{id: 'root', component: 'Html', children: [{id: 'form', component: 'args'}]}];
56
+ const run: BlokRunHost = {agentsFor: () => [], renderAsk: () => null, renderArgs: () => <div data-testid="args-form" />};
57
+ const hosted = render(
58
+ <BlokRunHostProvider value={run}>
59
+ <BlokRenderer catalog={testCatalog()} uiComponents={tree} />
60
+ </BlokRunHostProvider>,
61
+ );
62
+ expect(hosted.getByTestId('args-form')).toBeTruthy();
63
+ hosted.unmount();
64
+ const bare = render(<BlokRenderer catalog={testCatalog()} uiComponents={tree} />);
65
+ expect(bare.queryByTestId('args-form')).toBeNull();
66
+ });
67
+ });
@@ -150,6 +150,7 @@ export const createBlokRuntimeStore = (config?: {
150
150
  statuses?: Readonly<Record<string, BlokSourceStatus>>;
151
151
  travelAt?: string | null;
152
152
  answerTask?: (values: Record<string, unknown>) => unknown;
153
+ startRun?: () => unknown;
153
154
  }): BlokRuntimeStore => {
154
155
  const initialDataModel = config?.initialDataModel;
155
156
  const keptValues = config?.keptValues ?? {};
@@ -173,6 +174,7 @@ export const createBlokRuntimeStore = (config?: {
173
174
  refetchQuery: undefined,
174
175
  fetchMoreQuery: undefined,
175
176
  answerTask: config?.answerTask,
177
+ startRun: config?.startRun,
176
178
  setStatus: (path, status) => {
177
179
  const key = canonicalStatusPath(path);
178
180
  set(currentState => {
@@ -209,6 +211,9 @@ export const createBlokRuntimeStore = (config?: {
209
211
  setAnswerTask: answer => {
210
212
  set({answerTask: answer});
211
213
  },
214
+ setStartRun: start => {
215
+ set({startRun: start});
216
+ },
212
217
  setInitialDataModel: nextInitialDataModel => {
213
218
  set(currentState => {
214
219
  if (Object.is(currentState.initialDataModel, nextInitialDataModel)) {
@@ -194,6 +194,7 @@ const createLiveResolutionContext = (
194
194
  refetchQuery: name => store.getState().refetchQuery?.(name),
195
195
  fetchMoreQuery: (name, variables) => store.getState().fetchMoreQuery?.(name, variables),
196
196
  answerTask: values => store.getState().answerTask?.(values),
197
+ startRun: () => store.getState().startRun?.(),
197
198
  travelling: store.getState().travelAt !== null,
198
199
  invokeFunction: (name, args, options) => store.getState().invokeFunction(name, args, options),
199
200
  dispatchAction: (action, component, observe) =>
@@ -433,6 +433,14 @@ describe("a callback does exactly one thing (v2)", () => {
433
433
  expect(answerTask).toHaveBeenCalledWith({image: "7"});
434
434
  });
435
435
 
436
+ it("starts the run an assign blok prepares with assign.start, where a host starts one", () => {
437
+ const startRun = vi.fn(() => "starting");
438
+ const call = {type: "util" as const, call: {operation: "assign.start", arguments: []}};
439
+ expect(runActionCall(call, createContext({}, {startRun}), component)).toEqual({ok: true, value: "starting"});
440
+ expect(startRun).toHaveBeenCalledTimes(1);
441
+ expect(runActionCall(call, createContext({}), component).ok).toBe(false);
442
+ });
443
+
436
444
  it("refuses a pure function as a callback", () => {
437
445
  const result = runActionCall({type: "util", call: {operation: "str.upper", arguments: []}}, createContext({}), component);
438
446
  expect(result.ok).toBe(false);
@@ -390,6 +390,7 @@ const resolvePropValue = (
390
390
  /** The effects a callback may hold besides a task call (vocabulary functions flagged `effect`). */
391
391
  export const COPY_EFFECT = 'ui.copy';
392
392
  export const ANSWER_EFFECT = 'task.answer';
393
+ export const START_EFFECT = 'assign.start';
393
394
  export const REFETCH_EFFECT = 'query.refetch';
394
395
  export const FETCH_MORE_EFFECT = 'query.fetch_more';
395
396
 
@@ -414,7 +415,9 @@ const getPropActionCall = (
414
415
 
415
416
  /** Whether a callback is a command: it is refused while the blok shows the past. */
416
417
  export const isCommand = (actionCall: BlokActionCall | undefined): boolean =>
417
- actionCall !== undefined && (actionCall.type === 'agent' || (actionCall.type === 'util' && actionCall.call.operation === ANSWER_EFFECT));
418
+ actionCall !== undefined &&
419
+ (actionCall.type === 'agent' ||
420
+ (actionCall.type === 'util' && (actionCall.call.operation === ANSWER_EFFECT || actionCall.call.operation === START_EFFECT)));
418
421
 
419
422
  const copyToClipboard = (value: unknown): void => {
420
423
  const text = value === null || value === undefined ? '' : typeof value === 'string' ? value : JSON.stringify(value);
@@ -506,9 +509,15 @@ const runActionCall = (
506
509
  );
507
510
  return {ok: true, value: answered};
508
511
  }
512
+ if (operation === START_EFFECT) {
513
+ if (context.travelling) return {ok: true, value: undefined};
514
+ if (!context.startRun) return {ok: false, error: 'assign.start: nothing here starts a run.'};
515
+ // What the host returns (a promise, while the run is being started) keeps the control busy.
516
+ return {ok: true, value: context.startRun()};
517
+ }
509
518
  return {
510
519
  ok: false,
511
- error: `${operation} is not a callback's one thing: a callback holds one task call or one effect (queries.<name>.refetch(), queries.<name>.fetch_more(...), ui.copy, task.answer).`,
520
+ error: `${operation} is not a callback's one thing: a callback holds one task call or one effect (queries.<name>.refetch(), queries.<name>.fetch_more(...), ui.copy, task.answer, assign.start).`,
512
521
  };
513
522
  };
514
523
 
@@ -214,6 +214,8 @@ export type BlokResolutionContext = {
214
214
  fetchMoreQuery?: (name: string, variables: Record<string, unknown>) => void;
215
215
  /** Answers the open ask of `task` (`task.answer(values)`). */
216
216
  answerTask?: (values: Record<string, unknown>) => unknown;
217
+ /** Starts the run an assign blok prepares (`assign.start()`); undefined where the host starts none. */
218
+ startRun?: () => unknown;
217
219
  /** Set while the blok shows a moment in the past: no command runs. */
218
220
  travelling?: boolean;
219
221
  resolvePath: (path: string) => string;
@@ -248,11 +250,14 @@ export type BlokRuntimeContext = {
248
250
  fetchMoreQuery: ((name: string, variables: Record<string, unknown>) => void) | undefined;
249
251
  /** Answers the open ask of `task`; set by a host that holds one. */
250
252
  answerTask: ((values: Record<string, unknown>) => unknown) | undefined;
253
+ /** Starts the run an assign blok prepares; set by a host that can start one. */
254
+ startRun: (() => unknown) | undefined;
251
255
  setStatus: (path: string, status: BlokSourceStatus | null) => void;
252
256
  setTravelAt: (at: string | null) => void;
253
257
  setRefetchQuery: (refetch: ((name: string) => void) | undefined) => void;
254
258
  setFetchMoreQuery: (fetchMore: ((name: string, variables: Record<string, unknown>) => void) | undefined) => void;
255
259
  setAnswerTask: (answer: ((values: Record<string, unknown>) => unknown) | undefined) => void;
260
+ setStartRun: (start: (() => unknown) | undefined) => void;
256
261
  agentMappingStateUpdates: BlokAgentMappingStateUpdates;
257
262
  invokeFunction: BlokInvokeFunctionHandler;
258
263
  dispatchAction: BlokDispatchActionHandler;
@@ -1490,6 +1490,14 @@
1490
1490
  "accepts_children": false,
1491
1491
  "catalog": "scene@1"
1492
1492
  },
1493
+ "args": {
1494
+ "text_prop": null,
1495
+ "context": "HTML",
1496
+ "children_context": null,
1497
+ "inherits_context": false,
1498
+ "accepts_children": false,
1499
+ "catalog": "base@2"
1500
+ },
1493
1501
  "ask": {
1494
1502
  "text_prop": null,
1495
1503
  "context": "HTML",
@@ -8659,6 +8667,285 @@
8659
8667
  "space.kind"
8660
8668
  ]
8661
8669
  },
8670
+ {
8671
+ "name": "an assign blok",
8672
+ "source": "<Html><Card><Text>{args.slides}</Text><args /><Button onClick={assign.start()}>Start</Button></Card></Html>",
8673
+ "tree": {
8674
+ "id": "Html[0]",
8675
+ "component": "Html",
8676
+ "children": [
8677
+ {
8678
+ "id": "Html[0]/Card[0]",
8679
+ "component": "Card",
8680
+ "children": [
8681
+ {
8682
+ "id": "Html[0]/Card[0]/Text[0]",
8683
+ "component": "Text",
8684
+ "props": [
8685
+ {
8686
+ "key": "text",
8687
+ "dynamic_value": {
8688
+ "path": "args.slides"
8689
+ }
8690
+ }
8691
+ ]
8692
+ },
8693
+ {
8694
+ "id": "Html[0]/Card[0]/args[0]",
8695
+ "component": "args"
8696
+ },
8697
+ {
8698
+ "id": "Html[0]/Card[0]/Button[0]",
8699
+ "component": "Button",
8700
+ "props": [
8701
+ {
8702
+ "key": "onClick",
8703
+ "util_call": {
8704
+ "operation": "assign.start"
8705
+ }
8706
+ },
8707
+ {
8708
+ "key": "label",
8709
+ "static_value": "Start"
8710
+ }
8711
+ ]
8712
+ }
8713
+ ]
8714
+ }
8715
+ ]
8716
+ },
8717
+ "scope": {
8718
+ "kind": "assign",
8719
+ "context": "HTML",
8720
+ "dependencies": [
8721
+ {
8722
+ "key": "robot",
8723
+ "action_dependencies": [
8724
+ {
8725
+ "key": "move_to",
8726
+ "demand": {
8727
+ "arg_matches": [
8728
+ {
8729
+ "key": "position"
8730
+ }
8731
+ ],
8732
+ "return_matches": [
8733
+ {
8734
+ "key": "arrived"
8735
+ }
8736
+ ]
8737
+ }
8738
+ }
8739
+ ],
8740
+ "state_dependencies": [
8741
+ {
8742
+ "key": "arm",
8743
+ "demand": {
8744
+ "matches": [
8745
+ {
8746
+ "key": "joints",
8747
+ "kind": "LIST"
8748
+ },
8749
+ {
8750
+ "key": "mode",
8751
+ "kind": "STRING"
8752
+ }
8753
+ ]
8754
+ }
8755
+ }
8756
+ ]
8757
+ }
8758
+ ],
8759
+ "locals": [],
8760
+ "queries": [],
8761
+ "subscriptions": [],
8762
+ "args": [
8763
+ "slides"
8764
+ ],
8765
+ "catalogs": [],
8766
+ "catalog": true,
8767
+ "module": null
8768
+ },
8769
+ "resolved": {
8770
+ "locals": []
8771
+ },
8772
+ "codes": []
8773
+ },
8774
+ {
8775
+ "name": "an assign blok places the run's dependencies",
8776
+ "source": "<Html><Space room=\"room:lab\"><Placed dep=\"robot\" /></Space></Html>",
8777
+ "tree": {
8778
+ "id": "Html[0]",
8779
+ "component": "Html",
8780
+ "children": [
8781
+ {
8782
+ "id": "Html[0]/Space[0]",
8783
+ "component": "Space",
8784
+ "props": [
8785
+ {
8786
+ "key": "room",
8787
+ "static_value": "room:lab"
8788
+ }
8789
+ ],
8790
+ "children": [
8791
+ {
8792
+ "id": "Html[0]/Space[0]/Placed[0]",
8793
+ "component": "Placed",
8794
+ "props": [
8795
+ {
8796
+ "key": "dep",
8797
+ "static_value": "robot"
8798
+ }
8799
+ ]
8800
+ }
8801
+ ]
8802
+ }
8803
+ ]
8804
+ },
8805
+ "scope": {
8806
+ "kind": "assign",
8807
+ "context": "HTML",
8808
+ "dependencies": [
8809
+ {
8810
+ "key": "robot",
8811
+ "action_dependencies": [
8812
+ {
8813
+ "key": "move_to",
8814
+ "demand": {
8815
+ "arg_matches": [
8816
+ {
8817
+ "key": "position"
8818
+ }
8819
+ ],
8820
+ "return_matches": [
8821
+ {
8822
+ "key": "arrived"
8823
+ }
8824
+ ]
8825
+ }
8826
+ }
8827
+ ],
8828
+ "state_dependencies": [
8829
+ {
8830
+ "key": "arm",
8831
+ "demand": {
8832
+ "matches": [
8833
+ {
8834
+ "key": "joints",
8835
+ "kind": "LIST"
8836
+ },
8837
+ {
8838
+ "key": "mode",
8839
+ "kind": "STRING"
8840
+ }
8841
+ ]
8842
+ }
8843
+ }
8844
+ ]
8845
+ }
8846
+ ],
8847
+ "locals": [],
8848
+ "queries": [],
8849
+ "subscriptions": [],
8850
+ "args": null,
8851
+ "catalogs": [],
8852
+ "catalog": true,
8853
+ "module": null
8854
+ },
8855
+ "resolved": {
8856
+ "locals": []
8857
+ },
8858
+ "codes": []
8859
+ },
8860
+ {
8861
+ "name": "an assign blok has no task",
8862
+ "source": "<Html><Text>{task.status}</Text></Html>",
8863
+ "tree": {
8864
+ "id": "Html[0]",
8865
+ "component": "Html",
8866
+ "children": [
8867
+ {
8868
+ "id": "Html[0]/Text[0]",
8869
+ "component": "Text",
8870
+ "props": [
8871
+ {
8872
+ "key": "text",
8873
+ "dynamic_value": {
8874
+ "path": "task.status"
8875
+ }
8876
+ }
8877
+ ]
8878
+ }
8879
+ ]
8880
+ },
8881
+ "scope": {
8882
+ "kind": "assign",
8883
+ "context": "HTML",
8884
+ "dependencies": [],
8885
+ "locals": [],
8886
+ "queries": [],
8887
+ "subscriptions": [],
8888
+ "args": null,
8889
+ "catalogs": [],
8890
+ "catalog": true,
8891
+ "module": null
8892
+ },
8893
+ "resolved": {
8894
+ "locals": []
8895
+ },
8896
+ "codes": [
8897
+ "roots.not_in_kind"
8898
+ ]
8899
+ },
8900
+ {
8901
+ "name": "starting a run is an assign blok's",
8902
+ "source": "<Html><args /><Button onClick={assign.start()}>Start</Button></Html>",
8903
+ "tree": {
8904
+ "id": "Html[0]",
8905
+ "component": "Html",
8906
+ "children": [
8907
+ {
8908
+ "id": "Html[0]/args[0]",
8909
+ "component": "args"
8910
+ },
8911
+ {
8912
+ "id": "Html[0]/Button[0]",
8913
+ "component": "Button",
8914
+ "props": [
8915
+ {
8916
+ "key": "onClick",
8917
+ "util_call": {
8918
+ "operation": "assign.start"
8919
+ }
8920
+ },
8921
+ {
8922
+ "key": "label",
8923
+ "static_value": "Start"
8924
+ }
8925
+ ]
8926
+ }
8927
+ ]
8928
+ },
8929
+ "scope": {
8930
+ "kind": "action",
8931
+ "context": "HTML",
8932
+ "dependencies": [],
8933
+ "locals": [],
8934
+ "queries": [],
8935
+ "subscriptions": [],
8936
+ "args": null,
8937
+ "catalogs": [],
8938
+ "catalog": true,
8939
+ "module": null
8940
+ },
8941
+ "resolved": {
8942
+ "locals": []
8943
+ },
8944
+ "codes": [
8945
+ "assign.kind",
8946
+ "assign.kind"
8947
+ ]
8948
+ },
8662
8949
  {
8663
8950
  "name": "an unknown component",
8664
8951
  "source": "<Html><Frobnicator /></Html>",
@@ -17,6 +17,18 @@
17
17
  "text_prop": null,
18
18
  "props": []
19
19
  },
20
+ {
21
+ "name": "args",
22
+ "description": "The arguments of the run an assign blok starts, as the form the action's ports generate: filled in right here, and read as `args.<key>`. Without it the host shows the form beside the blok. An assign blok only.",
23
+ "context": "HTML",
24
+ "children_context": null,
25
+ "inherits_context": false,
26
+ "accepts_children": false,
27
+ "downstream_of": [],
28
+ "not_downstream_of": [],
29
+ "text_prop": null,
30
+ "props": []
31
+ },
20
32
  {
21
33
  "name": "ask",
22
34
  "description": "The open ask of the task this blok is about (`task.ask`), as the form its ports generate: answered right here, which resumes the task. Shows nothing while no ask is open. Replaces TaskAsk.",