@dxos/plugin-debug 0.8.4-main.7ace549 → 0.8.4-main.9735255

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 (111) hide show
  1. package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs +15 -0
  2. package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs.map +7 -0
  3. package/dist/lib/browser/DevtoolsOverviewContainer-77PKFLYV.mjs +19 -0
  4. package/dist/lib/browser/{DevtoolsOverviewContainer-JXVZVPHN.mjs.map → DevtoolsOverviewContainer-77PKFLYV.mjs.map} +1 -1
  5. package/dist/lib/browser/{SpaceGenerator-BED4UXGS.mjs → SpaceGenerator-H33AEFGC.mjs} +171 -171
  6. package/dist/lib/browser/SpaceGenerator-H33AEFGC.mjs.map +7 -0
  7. package/dist/lib/browser/app-graph-builder-LV73R7HR.mjs +598 -0
  8. package/dist/lib/browser/app-graph-builder-LV73R7HR.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-SRV2AIGJ.mjs → chunk-4UFQXPP7.mjs} +11 -1
  10. package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-WZFZ4ESO.mjs → chunk-A5H5GRV6.mjs} +1 -1
  12. package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +33 -38
  14. package/dist/lib/browser/index.mjs.map +4 -4
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/react-context-FSWBT3MH.mjs +17 -0
  17. package/dist/lib/browser/react-context-FSWBT3MH.mjs.map +7 -0
  18. package/dist/lib/browser/react-surface-2N6CPSHR.mjs +757 -0
  19. package/dist/lib/browser/react-surface-2N6CPSHR.mjs.map +7 -0
  20. package/dist/lib/browser/settings-KA4GN73K.mjs +31 -0
  21. package/dist/lib/browser/settings-KA4GN73K.mjs.map +7 -0
  22. package/dist/types/src/DebugPlugin.d.ts +2 -1
  23. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  24. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  25. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  26. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  27. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  28. package/dist/types/src/capabilities/index.d.ts +4 -8
  29. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  30. package/dist/types/src/capabilities/react-context/index.d.ts +7 -0
  31. package/dist/types/src/capabilities/react-context/index.d.ts.map +1 -0
  32. package/dist/types/src/capabilities/react-context/react-context.d.ts +10 -0
  33. package/dist/types/src/capabilities/react-context/react-context.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  35. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  36. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  37. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  38. package/dist/types/src/capabilities/settings/index.d.ts +3 -0
  39. package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
  40. package/dist/types/src/capabilities/settings/settings.d.ts +5 -0
  41. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
  42. package/dist/types/src/components/DebugGraph.d.ts +5 -4
  43. package/dist/types/src/components/DebugGraph.d.ts.map +1 -1
  44. package/dist/types/src/components/DebugObjectPanel.d.ts +1 -1
  45. package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
  46. package/dist/types/src/components/DebugSettings.d.ts +4 -2
  47. package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
  48. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +5 -5
  49. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  50. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +1 -1
  51. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  52. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
  53. package/dist/types/src/components/SpaceGenerator/presets.d.ts +1 -48
  54. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  55. package/dist/types/src/components/Wireframe.d.ts +1 -1
  56. package/dist/types/src/components/Wireframe.d.ts.map +1 -1
  57. package/dist/types/src/components/index.d.ts +4 -4
  58. package/dist/types/src/components/index.d.ts.map +1 -1
  59. package/dist/types/src/meta.d.ts +2 -2
  60. package/dist/types/src/meta.d.ts.map +1 -1
  61. package/dist/types/src/types.d.ts +5 -0
  62. package/dist/types/src/types.d.ts.map +1 -1
  63. package/dist/types/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +76 -71
  65. package/src/DebugPlugin.tsx +16 -31
  66. package/src/capabilities/app-graph-builder/app-graph-builder.ts +420 -0
  67. package/src/capabilities/app-graph-builder/index.ts +7 -0
  68. package/src/capabilities/index.ts +4 -6
  69. package/src/capabilities/react-context/index.ts +7 -0
  70. package/src/capabilities/react-context/react-context.tsx +20 -0
  71. package/src/capabilities/react-surface/index.ts +7 -0
  72. package/src/capabilities/react-surface/react-surface.tsx +409 -0
  73. package/src/capabilities/settings/index.ts +7 -0
  74. package/src/capabilities/settings/settings.ts +30 -0
  75. package/src/components/DebugGraph.tsx +4 -3
  76. package/src/components/DebugObjectPanel.tsx +4 -4
  77. package/src/components/DebugSettings.tsx +10 -5
  78. package/src/components/SpaceGenerator/ObjectGenerator.tsx +15 -16
  79. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +7 -5
  80. package/src/components/SpaceGenerator/SpaceGenerator.tsx +15 -10
  81. package/src/components/SpaceGenerator/presets.ts +134 -31
  82. package/src/components/Wireframe.tsx +2 -2
  83. package/src/components/index.ts +4 -1
  84. package/src/meta.ts +2 -2
  85. package/src/types.ts +8 -0
  86. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +0 -20
  87. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +0 -7
  88. package/dist/lib/browser/DevtoolsOverviewContainer-JXVZVPHN.mjs +0 -25
  89. package/dist/lib/browser/SpaceGenerator-BED4UXGS.mjs.map +0 -7
  90. package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs +0 -588
  91. package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs.map +0 -7
  92. package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +0 -7
  93. package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +0 -7
  94. package/dist/lib/browser/react-context-P2YDWEWI.mjs +0 -16
  95. package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +0 -7
  96. package/dist/lib/browser/react-surface-JM2H3RZI.mjs +0 -774
  97. package/dist/lib/browser/react-surface-JM2H3RZI.mjs.map +0 -7
  98. package/dist/lib/browser/settings-SQXR3OAH.mjs +0 -22
  99. package/dist/lib/browser/settings-SQXR3OAH.mjs.map +0 -7
  100. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  101. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  102. package/dist/types/src/capabilities/react-context.d.ts +0 -8
  103. package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
  104. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  105. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  106. package/dist/types/src/capabilities/settings.d.ts +0 -4
  107. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  108. package/src/capabilities/app-graph-builder.ts +0 -431
  109. package/src/capabilities/react-context.tsx +0 -16
  110. package/src/capabilities/react-surface.tsx +0 -418
  111. package/src/capabilities/settings.ts +0 -19
@@ -3,9 +3,10 @@
3
3
  //
4
4
 
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+ import * as Effect from 'effect/Effect';
6
7
  import React from 'react';
7
8
 
8
- import { IntentPlugin } from '@dxos/app-framework';
9
+ import { OperationPlugin } from '@dxos/app-framework';
9
10
  import { withPluginManager } from '@dxos/app-framework/testing';
10
11
  import { ClientPlugin } from '@dxos/plugin-client';
11
12
  import { useSpaces } from '@dxos/react-client/echo';
@@ -32,11 +33,12 @@ const meta = {
32
33
  withPluginManager({
33
34
  plugins: [
34
35
  ClientPlugin({
35
- onClientInitialized: async ({ client }) => {
36
- await client.halo.createIdentity();
37
- },
36
+ onClientInitialized: ({ client }) =>
37
+ Effect.gen(function* () {
38
+ yield* Effect.promise(() => client.halo.createIdentity());
39
+ }),
38
40
  }),
39
- IntentPlugin(),
41
+ OperationPlugin(),
40
42
  ],
41
43
  }),
42
44
  ],
@@ -4,9 +4,9 @@
4
4
 
5
5
  import React, { useCallback, useMemo, useState } from 'react';
6
6
 
7
- import { useIntentDispatcher } from '@dxos/app-framework/react';
7
+ import { useOperationInvoker } from '@dxos/app-framework/react';
8
8
  import { ComputeGraph } from '@dxos/conductor';
9
- import { Filter, Obj } from '@dxos/echo';
9
+ import { Filter, Obj, type Type } from '@dxos/echo';
10
10
  import { Markdown } from '@dxos/plugin-markdown/types';
11
11
  import { Sheet } from '@dxos/plugin-sheet/types';
12
12
  import { Diagram } from '@dxos/plugin-sketch/types';
@@ -23,36 +23,40 @@ import { SchemaTable } from './SchemaTable';
23
23
 
24
24
  export type SpaceGeneratorProps = {
25
25
  space: Space;
26
- onCreateObjects?: (objects: Obj.Any[]) => void;
26
+ onCreateObjects?: (objects: Obj.Unknown[]) => void;
27
27
  };
28
28
 
29
29
  export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps) => {
30
- const { dispatchPromise: dispatch } = useIntentDispatcher();
30
+ const { invokePromise } = useOperationInvoker();
31
31
  const client = useClient();
32
32
  const staticTypes = [Markdown.Document, Diagram.Diagram, Sheet.Sheet, ComputeGraph]; // TODO(burdon): Make extensible.
33
- const recordTypes = [Organization.Organization, Person.Person, Task.Task];
33
+ const recordTypes: Type.Obj.Any[] = [Organization.Organization, Person.Person, Task.Task];
34
34
  const [count, setCount] = useState(1);
35
35
  const [info, setInfo] = useState<any>({});
36
36
  const presets = useMemo(() => generator(), []);
37
37
 
38
+ // Register types.
39
+ useAsyncEffect(async () => {
40
+ await client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);
41
+ }, [client]);
42
+
38
43
  // Create type generators.
39
44
  const typeMap = useMemo(() => {
40
- client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);
41
45
  const recordGenerators = new Map<string, ObjectGenerator<any>>(
42
- recordTypes.map((type) => [type.typename, createGenerator(client, dispatch, type as any)]),
46
+ recordTypes.map((type) => [type.typename, createGenerator(client, invokePromise, type)]),
43
47
  );
44
48
 
45
49
  return new Map([...staticGenerators, ...presets.items, ...recordGenerators]);
46
- }, [client, recordTypes]);
50
+ }, [client, recordTypes, invokePromise]);
47
51
 
48
52
  // Query space to get info.
49
53
  const updateInfo = async () => {
50
54
  // Create schema map.
51
55
  const echoSchema = await space.db.schemaRegistry.query().run();
52
- const staticSchema = space.db.graph.schemaRegistry.schemas;
56
+ const staticSchema = await space.db.graph.schemaRegistry.query().run();
53
57
 
54
58
  // Create object map.
55
- const { objects } = await space.db.query(Filter.everything()).run();
59
+ const objects = await space.db.query(Filter.everything()).run();
56
60
  const objectMap = sortKeys(
57
61
  objects.reduce<Record<string, number>>((map, obj) => {
58
62
  const type = Obj.getTypename(obj);
@@ -60,6 +64,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
60
64
  const count = map[type] ?? 0;
61
65
  map[type] = count + 1;
62
66
  }
67
+
63
68
  return map;
64
69
  }, {}),
65
70
  );
@@ -7,7 +7,7 @@ import * as Schema from 'effect/Schema';
7
7
  import { Agent, EntityExtraction, ResearchBlueprint } from '@dxos/assistant-toolkit';
8
8
  import { Prompt } from '@dxos/blueprints';
9
9
  import { type ComputeGraphModel, NODE_INPUT } from '@dxos/conductor';
10
- import { DXN, Filter, Key, Obj, Query, Ref, Tag, Type } from '@dxos/echo';
10
+ import { DXN, Filter, Key, Obj, Query, type QueryAST, Ref, Tag, Type } from '@dxos/echo';
11
11
  import { Trigger, serializeFunction } from '@dxos/functions';
12
12
  import { invariant } from '@dxos/invariant';
13
13
  import { gmail } from '@dxos/plugin-inbox';
@@ -57,14 +57,19 @@ export enum PresetName {
57
57
  }
58
58
 
59
59
  export const generator = () => ({
60
- schemas: [CanvasBoardType, Trigger.Trigger],
60
+ schemas: [CanvasBoardType, Trigger.Trigger] as any[],
61
61
  types: Object.values(PresetName).map((name) => ({ typename: name })),
62
62
  items: [
63
63
  [
64
64
  PresetName.DXOS_TEAM,
65
65
  async (space, n, cb) => {
66
66
  const objects = range(n, () => {
67
- const org = space.db.add(Obj.make(Organization.Organization, { name: 'DXOS', website: 'https://dxos.org' }));
67
+ const org = space.db.add(
68
+ Obj.make(Organization.Organization, {
69
+ name: 'DXOS',
70
+ website: 'https://dxos.org',
71
+ }),
72
+ );
68
73
  const doc = space.db.add(
69
74
  Markdown.make({
70
75
  name: 'DXOS Research',
@@ -74,7 +79,9 @@ export const generator = () => ({
74
79
 
75
80
  const tag = space.db.add(Tag.make({ label: 'Investor' }));
76
81
  const tagDxn = Obj.getDXN(tag).toString();
77
- Obj.getMeta(doc).tags = [tagDxn];
82
+ Obj.change(doc, (d) => {
83
+ Obj.getMeta(d).tags = [tagDxn];
84
+ });
78
85
 
79
86
  // space.db.add(
80
87
  // Relation.make(HasSubject, {
@@ -85,9 +92,24 @@ export const generator = () => ({
85
92
  // );
86
93
 
87
94
  space.db.add(Obj.make(Person.Person, { fullName: 'Rich', organization: Ref.make(org) }, { tags: [tagDxn] }));
88
- space.db.add(Obj.make(Person.Person, { fullName: 'Josiah', organization: Ref.make(org) }));
89
- space.db.add(Obj.make(Person.Person, { fullName: 'Dima', organization: Ref.make(org) }));
90
- space.db.add(Obj.make(Person.Person, { fullName: 'Mykola', organization: Ref.make(org) }));
95
+ space.db.add(
96
+ Obj.make(Person.Person, {
97
+ fullName: 'Josiah',
98
+ organization: Ref.make(org),
99
+ }),
100
+ );
101
+ space.db.add(
102
+ Obj.make(Person.Person, {
103
+ fullName: 'Dima',
104
+ organization: Ref.make(org),
105
+ }),
106
+ );
107
+ space.db.add(
108
+ Obj.make(Person.Person, {
109
+ fullName: 'Mykola',
110
+ organization: Ref.make(org),
111
+ }),
112
+ );
91
113
 
92
114
  return doc;
93
115
  });
@@ -175,7 +197,9 @@ export const generator = () => ({
175
197
 
176
198
  const mailboxView = View.make({
177
199
  query: Query.select(
178
- Filter.type(Message.Message, { properties: { labels: Filter.contains('investor') } }),
200
+ Filter.type(Message.Message, {
201
+ properties: { labels: Filter.contains('investor') },
202
+ }),
179
203
  ).options({
180
204
  queues: [mailbox.queue.dxn.toString()],
181
205
  }),
@@ -247,10 +271,24 @@ export const generator = () => ({
247
271
  const append = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
248
272
 
249
273
  builder
250
- .createEdge({ source: trigger.id, target: gpt.id, input: 'prompt', output: 'bodyText' })
274
+ .createEdge({
275
+ source: trigger.id,
276
+ target: gpt.id,
277
+ input: 'prompt',
278
+ output: 'bodyText',
279
+ })
251
280
  .createEdge({ source: gpt.id, target: text.id, output: 'text' })
252
- .createEdge({ source: queueId.id, target: append.id, input: 'id' })
253
- .createEdge({ source: gpt.id, target: append.id, output: 'messages', input: 'items' });
281
+ .createEdge({
282
+ source: queueId.id,
283
+ target: append.id,
284
+ input: 'id',
285
+ })
286
+ .createEdge({
287
+ source: gpt.id,
288
+ target: append.id,
289
+ output: 'messages',
290
+ input: 'items',
291
+ });
254
292
 
255
293
  functionTrigger = triggerShape.functionTrigger!.target!;
256
294
  });
@@ -275,7 +313,7 @@ export const generator = () => ({
275
313
  'subscription',
276
314
  (triggerSpec) =>
277
315
  (triggerSpec.query = {
278
- ast: Query.select(Filter.typename('dxos.org/type/Chess')).ast,
316
+ ast: Query.select(Filter.typename('dxos.org/type/Chess')).ast as Obj.Mutable<QueryAST.Query>,
279
317
  }),
280
318
  'type',
281
319
  );
@@ -388,8 +426,17 @@ export const generator = () => ({
388
426
  builder
389
427
  .createEdge({ source: chat.id, target: gpt.id, input: 'prompt' })
390
428
  .createEdge({ source: gpt.id, target: text.id, output: 'text' })
391
- .createEdge({ source: queueId.id, target: append.id, input: 'id' })
392
- .createEdge({ source: gpt.id, target: append.id, output: 'messages', input: 'items' });
429
+ .createEdge({
430
+ source: queueId.id,
431
+ target: append.id,
432
+ input: 'id',
433
+ })
434
+ .createEdge({
435
+ source: gpt.id,
436
+ target: append.id,
437
+ output: 'messages',
438
+ input: 'items',
439
+ });
393
440
  });
394
441
 
395
442
  const computeModel = createComputeGraph(canvasModel);
@@ -513,9 +560,21 @@ export const generator = () => ({
513
560
  const view = canvasModel.createNode(createSurface(position({ x: 12, y: 0 })));
514
561
 
515
562
  builder
516
- .createEdge({ source: sourceCurrency.id, target: converter.id, input: 'from' })
517
- .createEdge({ source: targetCurrency.id, target: converter.id, input: 'to' })
518
- .createEdge({ source: converter.id, target: view.id, output: 'rate' });
563
+ .createEdge({
564
+ source: sourceCurrency.id,
565
+ target: converter.id,
566
+ input: 'from',
567
+ })
568
+ .createEdge({
569
+ source: targetCurrency.id,
570
+ target: converter.id,
571
+ input: 'to',
572
+ })
573
+ .createEdge({
574
+ source: converter.id,
575
+ target: view.id,
576
+ output: 'rate',
577
+ });
519
578
  });
520
579
 
521
580
  const computeModel = createComputeGraph(canvasModel);
@@ -543,7 +602,10 @@ export const generator = () => ({
543
602
  const trigger = canvasModel.createNode(triggerShape);
544
603
  // DXOS dev-null channel.
545
604
  const channelId = canvasModel.createNode(
546
- createConstant({ value: '1088569858767212554', ...position({ x: -10, y: 0 }) }),
605
+ createConstant({
606
+ value: '1088569858767212554',
607
+ ...position({ x: -10, y: 0 }),
608
+ }),
547
609
  );
548
610
  const queueId = canvasModel.createNode(
549
611
  createConstant({
@@ -556,11 +618,31 @@ export const generator = () => ({
556
618
  const queue = canvasModel.createNode(createQueue(position({ x: 0, y: 12 })));
557
619
 
558
620
  builder
559
- .createEdge({ source: trigger.id, target: converter.id, input: 'tick' })
560
- .createEdge({ source: channelId.id, target: converter.id, input: 'channelId' })
561
- .createEdge({ source: queueId.id, target: converter.id, input: 'queueId' })
562
- .createEdge({ source: converter.id, target: view.id, output: 'newMessages' })
563
- .createEdge({ source: queueId.id, target: queue.id, input: 'input' });
621
+ .createEdge({
622
+ source: trigger.id,
623
+ target: converter.id,
624
+ input: 'tick',
625
+ })
626
+ .createEdge({
627
+ source: channelId.id,
628
+ target: converter.id,
629
+ input: 'channelId',
630
+ })
631
+ .createEdge({
632
+ source: queueId.id,
633
+ target: converter.id,
634
+ input: 'queueId',
635
+ })
636
+ .createEdge({
637
+ source: converter.id,
638
+ target: view.id,
639
+ output: 'newMessages',
640
+ })
641
+ .createEdge({
642
+ source: queueId.id,
643
+ target: queue.id,
644
+ input: 'input',
645
+ });
564
646
 
565
647
  functionTrigger = triggerShape.functionTrigger!.target!;
566
648
  });
@@ -630,7 +712,7 @@ export const generator = () => ({
630
712
  const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
631
713
  space: Space,
632
714
  triggerKind: SpecType,
633
- initSpec: (spec: Extract<Trigger.Spec, { kind: SpecType }>) => void,
715
+ initSpec: (spec: Obj.Mutable<Extract<Trigger.Spec, { kind: SpecType }>>) => void,
634
716
  triggerOutputName: string,
635
717
  ) => {
636
718
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
@@ -663,7 +745,12 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
663
745
  builder
664
746
  .createEdge({ source: queueId.id, target: append.id, input: 'id' })
665
747
  .createEdge({ source: template.id, target: append.id, input: 'items' })
666
- .createEdge({ source: trigger.id, target: template.id, output: triggerOutputName, input: 'type' })
748
+ .createEdge({
749
+ source: trigger.id,
750
+ target: template.id,
751
+ output: triggerOutputName,
752
+ input: 'type',
753
+ })
667
754
  .createEdge({
668
755
  source: random.id,
669
756
  target: template.id,
@@ -673,13 +760,16 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
673
760
  functionTrigger = triggerShape.functionTrigger!.target!;
674
761
  const triggerSpec = functionTrigger.spec;
675
762
  invariant(triggerSpec && triggerSpec.kind === triggerKind, 'No trigger spec.');
676
- initSpec(triggerSpec as any);
763
+ Obj.change(functionTrigger, (ft) => {
764
+ initSpec(ft.spec as any);
765
+ });
677
766
  });
678
767
 
679
768
  const computeModel = createComputeGraph(canvasModel);
680
769
 
681
770
  const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
682
771
  invariant(templateComputeNode, 'Template compute node was not created.');
772
+ // NOTE: These are plain object mutations during model construction, not ECHO object mutations.
683
773
  templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
684
774
  templateComputeNode.inputSchema = Type.toJsonSchema(Schema.Struct({ type: Schema.String, changeId: Schema.String }));
685
775
  attachTrigger(functionTrigger, computeModel);
@@ -719,15 +809,25 @@ const setupQueue = (
719
809
 
720
810
  const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
721
811
  invariant(functionTrigger);
722
- functionTrigger.function = Ref.make(computeModel.root);
723
812
  const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
724
- functionTrigger.inputNodeId = inputNode.id;
813
+ Obj.change(functionTrigger, (t) => {
814
+ t.function = Ref.make(computeModel.root);
815
+ t.inputNodeId = inputNode.id;
816
+ });
725
817
  };
726
818
 
727
- type RawPositionInput = { centerX: number; centerY: number; width: number; height: number };
819
+ type RawPositionInput = {
820
+ centerX: number;
821
+ centerY: number;
822
+ width: number;
823
+ height: number;
824
+ };
728
825
 
729
826
  const rawPosition = (args: RawPositionInput) => {
730
- return { center: { x: args.centerX, y: args.centerY }, size: { width: args.width, height: args.height } };
827
+ return {
828
+ center: { x: args.centerX, y: args.centerY },
829
+ size: { width: args.width, height: args.height },
830
+ };
731
831
  };
732
832
 
733
833
  const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
@@ -735,7 +835,10 @@ const position = (rect: { x: number; y: number; width?: number; height?: number
735
835
  const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
736
836
  const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
737
837
  if (width && height) {
738
- return { center: { x, y }, size: width && height ? { width, height } : undefined };
838
+ return {
839
+ center: { x, y },
840
+ size: width && height ? { width, height } : undefined,
841
+ };
739
842
  } else {
740
843
  return { center: { x, y } };
741
844
  }
@@ -9,12 +9,12 @@ import { Obj } from '@dxos/echo';
9
9
  import { type ThemedClassName } from '@dxos/react-ui';
10
10
  import { useAttentionAttributes } from '@dxos/react-ui-attention';
11
11
  import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
12
- import { mx } from '@dxos/react-ui-theme';
12
+ import { mx } from '@dxos/ui-theme';
13
13
 
14
14
  // TODO(burdon): Create generic container with wireframe mode.
15
15
  export type WireframeProps = ThemedClassName<{
16
+ object: Obj.Unknown;
16
17
  label?: string;
17
- object: Obj.Any;
18
18
  }>;
19
19
 
20
20
  // TODO(burdon): Make focusable and attendable with input.
@@ -3,8 +3,11 @@
3
3
  //
4
4
 
5
5
  import { lazy } from 'react';
6
+ import { type FC } from 'react';
6
7
 
7
- export const DebugGraph = lazy(() => import('./DebugGraph'));
8
+ import { type DebugGraphProps } from './DebugGraph';
9
+
10
+ export const DebugGraph: ReturnType<typeof lazy<FC<DebugGraphProps>>> = lazy(() => import('./DebugGraph'));
8
11
  export const DevtoolsOverviewContainer = lazy(() => import('./DevtoolsOverviewContainer'));
9
12
  export const SpaceGenerator = lazy(() => import('./SpaceGenerator'));
10
13
 
package/src/meta.ts CHANGED
@@ -2,10 +2,10 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { type Plugin } from '@dxos/app-framework';
6
6
  import { trim } from '@dxos/util';
7
7
 
8
- export const meta: PluginMeta = {
8
+ export const meta: Plugin.Meta = {
9
9
  id: 'dxos.org/plugin/debug',
10
10
  name: 'Debug',
11
11
  description: trim`
package/src/types.ts CHANGED
@@ -2,11 +2,15 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
+ import { type Atom } from '@effect-atom/atom-react';
5
6
  import * as Schema from 'effect/Schema';
6
7
  import { type Context, createContext } from 'react';
7
8
 
9
+ import { Capability } from '@dxos/app-framework';
8
10
  import type { TimerCallback, TimerOptions } from '@dxos/async';
9
11
 
12
+ import { meta } from './meta';
13
+
10
14
  export type DebugContextType = {
11
15
  running: boolean;
12
16
  start: (cb: TimerCallback, options: TimerOptions) => void;
@@ -27,6 +31,10 @@ export const DebugSettingsSchema = Schema.mutable(
27
31
 
28
32
  export interface DebugSettingsProps extends Schema.Schema.Type<typeof DebugSettingsSchema> {}
29
33
 
34
+ export namespace DebugCapabilities {
35
+ export const Settings = Capability.make<Atom.Writable<DebugSettingsProps>>(`${meta.id}/capability/settings`);
36
+ }
37
+
30
38
  export namespace Devtools {
31
39
  // TODO(wittjosiah): Cannot use slashes in ids until we have a router which decouples ids from url paths.
32
40
  export const id = 'dxos.org.plugin.debug.devtools';
@@ -1,20 +0,0 @@
1
- // src/components/DebugGraph.tsx
2
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
3
- import React from "react";
4
- import { Tree } from "@dxos/devtools";
5
- var DebugGraph = ({ graph, root }) => {
6
- var _effect = _useSignals();
7
- try {
8
- return /* @__PURE__ */ React.createElement(Tree, {
9
- data: graph.toJSON(root)
10
- });
11
- } finally {
12
- _effect.f();
13
- }
14
- };
15
- var DebugGraph_default = DebugGraph;
16
- export {
17
- DebugGraph,
18
- DebugGraph_default as default
19
- };
20
- //# sourceMappingURL=DebugGraph-EDOH6R2G.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/DebugGraph.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { Tree } from '@dxos/devtools';\nimport { type Graph } from '@dxos/plugin-graph';\n\nexport const DebugGraph: FC<{ graph: Graph; root: string }> = ({ graph, root }) => {\n return <Tree data={graph.toJSON(root)} />;\n};\n\nexport default DebugGraph;\n"],
5
- "mappings": ";;AAIA,OAAOA,WAAwB;AAE/B,SAASC,YAAY;AAGd,IAAMC,aAAiD,CAAC,EAAEC,OAAOC,KAAI,MAAE;;;AAC5E,WAAO,sBAAA,cAACC,MAAAA;MAAKC,MAAMH,MAAMI,OAAOH,IAAAA;;;;;AAClC;AAEA,IAAA,qBAAeF;",
6
- "names": ["React", "Tree", "DebugGraph", "graph", "root", "Tree", "data", "toJSON"]
7
- }
@@ -1,25 +0,0 @@
1
- // src/components/DevtoolsOverviewContainer.tsx
2
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
3
- import React from "react";
4
- import { Surface } from "@dxos/app-framework/react";
5
- import { StatsPanel, useStats } from "@dxos/devtools";
6
- var DevtoolsOverviewContainer = () => {
7
- var _effect = _useSignals();
8
- try {
9
- const [stats, refreshStats] = useStats();
10
- return /* @__PURE__ */ React.createElement(StatsPanel, {
11
- stats,
12
- onRefresh: refreshStats
13
- }, /* @__PURE__ */ React.createElement(Surface, {
14
- role: "devtools-overview"
15
- }));
16
- } finally {
17
- _effect.f();
18
- }
19
- };
20
- var DevtoolsOverviewContainer_default = DevtoolsOverviewContainer;
21
- export {
22
- DevtoolsOverviewContainer,
23
- DevtoolsOverviewContainer_default as default
24
- };
25
- //# sourceMappingURL=DevtoolsOverviewContainer-JXVZVPHN.mjs.map