@dxos/plugin-debug 0.8.4-main.ae835ea → 0.8.4-main.bc674ce

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 (116) 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-77PKFLYV.mjs.map +7 -0
  5. package/dist/lib/browser/{SpaceGenerator-7Q7CX64P.mjs → SpaceGenerator-H33AEFGC.mjs} +226 -233
  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 +34 -39
  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 +2 -2
  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 +2 -5
  54. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  55. package/dist/types/src/components/Wireframe.d.ts +2 -2
  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/translations.d.ts +1 -1
  62. package/dist/types/src/types.d.ts +5 -0
  63. package/dist/types/src/types.d.ts.map +1 -1
  64. package/dist/types/tsconfig.tsbuildinfo +1 -1
  65. package/package.json +76 -70
  66. package/src/DebugPlugin.tsx +16 -31
  67. package/src/capabilities/app-graph-builder/app-graph-builder.ts +420 -0
  68. package/src/capabilities/app-graph-builder/index.ts +7 -0
  69. package/src/capabilities/index.ts +4 -6
  70. package/src/capabilities/react-context/index.ts +7 -0
  71. package/src/capabilities/react-context/react-context.tsx +20 -0
  72. package/src/capabilities/react-surface/index.ts +7 -0
  73. package/src/capabilities/react-surface/react-surface.tsx +409 -0
  74. package/src/capabilities/settings/index.ts +7 -0
  75. package/src/capabilities/settings/settings.ts +30 -0
  76. package/src/components/DebugGraph.tsx +4 -3
  77. package/src/components/DebugObjectPanel.tsx +4 -4
  78. package/src/components/DebugSettings.tsx +44 -18
  79. package/src/components/DevtoolsOverviewContainer.tsx +1 -1
  80. package/src/components/SpaceGenerator/ObjectGenerator.tsx +18 -19
  81. package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
  82. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +7 -5
  83. package/src/components/SpaceGenerator/SpaceGenerator.tsx +18 -13
  84. package/src/components/SpaceGenerator/presets.ts +217 -100
  85. package/src/components/Wireframe.tsx +4 -5
  86. package/src/components/index.ts +4 -1
  87. package/src/meta.ts +2 -2
  88. package/src/translations.ts +1 -1
  89. package/src/types.ts +8 -0
  90. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +0 -20
  91. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +0 -7
  92. package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs +0 -25
  93. package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs.map +0 -7
  94. package/dist/lib/browser/SpaceGenerator-7Q7CX64P.mjs.map +0 -7
  95. package/dist/lib/browser/app-graph-builder-RXWTHLEW.mjs +0 -588
  96. package/dist/lib/browser/app-graph-builder-RXWTHLEW.mjs.map +0 -7
  97. package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +0 -7
  98. package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +0 -7
  99. package/dist/lib/browser/react-context-P2YDWEWI.mjs +0 -16
  100. package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +0 -7
  101. package/dist/lib/browser/react-surface-4XGZUT3Z.mjs +0 -772
  102. package/dist/lib/browser/react-surface-4XGZUT3Z.mjs.map +0 -7
  103. package/dist/lib/browser/settings-SQXR3OAH.mjs +0 -22
  104. package/dist/lib/browser/settings-SQXR3OAH.mjs.map +0 -7
  105. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  106. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  107. package/dist/types/src/capabilities/react-context.d.ts +0 -8
  108. package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
  109. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  110. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  111. package/dist/types/src/capabilities/settings.d.ts +0 -4
  112. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  113. package/src/capabilities/app-graph-builder.ts +0 -431
  114. package/src/capabilities/react-context.tsx +0 -16
  115. package/src/capabilities/react-surface.tsx +0 -399
  116. package/src/capabilities/settings.ts +0 -19
@@ -7,10 +7,10 @@ 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
- import { sync } from '@dxos/plugin-inbox';
13
+ import { gmail } from '@dxos/plugin-inbox';
14
14
  import { Mailbox } from '@dxos/plugin-inbox/types';
15
15
  import { Markdown } from '@dxos/plugin-markdown/types';
16
16
  import { type Space } from '@dxos/react-client/echo';
@@ -36,7 +36,8 @@ import {
36
36
  pointsToRect,
37
37
  rectToPoints,
38
38
  } from '@dxos/react-ui-canvas-editor';
39
- import { DataType, createView } from '@dxos/schema';
39
+ import { View } from '@dxos/schema';
40
+ import { Message, Organization, Person, Project } from '@dxos/types';
40
41
  import { range, trim } from '@dxos/util';
41
42
 
42
43
  import { type ObjectGenerator } from './ObjectGenerator';
@@ -49,32 +50,39 @@ export enum PresetName {
49
50
  CHAT_GPT = 'chat-gpt-text',
50
51
  // EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
51
52
  OBJECT_CHANGE_QUEUE = 'objectChange-queue',
52
- FOREX_FUNCTION_CALL = 'forex-function-call',
53
53
  TIMER_TICK_QUEUE = 'timerTick-queue',
54
+ FOREX_FUNCTION_CALL = 'forex-function-call',
54
55
  DISCORD_MESSAGES = 'discord-messages',
55
56
  // KANBAN_QUEUE = 'kanban-queue',
56
57
  }
57
58
 
58
59
  export const generator = () => ({
59
- schemas: [CanvasBoardType, Trigger.Trigger],
60
+ schemas: [CanvasBoardType, Trigger.Trigger] as any[],
60
61
  types: Object.values(PresetName).map((name) => ({ typename: name })),
61
62
  items: [
62
63
  [
63
64
  PresetName.DXOS_TEAM,
64
65
  async (space, n, cb) => {
65
66
  const objects = range(n, () => {
66
- const tag = space.db.add(Tag.make({ label: 'Investor' }));
67
- const tagDxn = Obj.getDXN(tag).toString();
68
-
69
- const org = space.db.add(Obj.make(DataType.Organization, { name: 'DXOS', website: 'https://dxos.org' }));
70
-
67
+ const org = space.db.add(
68
+ Obj.make(Organization.Organization, {
69
+ name: 'DXOS',
70
+ website: 'https://dxos.org',
71
+ }),
72
+ );
71
73
  const doc = space.db.add(
72
- Markdown.makeDocument({
74
+ Markdown.make({
73
75
  name: 'DXOS Research',
74
76
  content: 'DXOS builds Composer, an open-source AI-powered malleable application.',
75
77
  }),
76
78
  );
77
- Obj.getMeta(doc).tags = [tagDxn];
79
+
80
+ const tag = space.db.add(Tag.make({ label: 'Investor' }));
81
+ const tagDxn = Obj.getDXN(tag).toString();
82
+ Obj.change(doc, (d) => {
83
+ Obj.getMeta(d).tags = [tagDxn];
84
+ });
85
+
78
86
  // space.db.add(
79
87
  // Relation.make(HasSubject, {
80
88
  // [Relation.Source]: doc,
@@ -83,13 +91,25 @@ export const generator = () => ({
83
91
  // }),
84
92
  // );
85
93
 
94
+ space.db.add(Obj.make(Person.Person, { fullName: 'Rich', organization: Ref.make(org) }, { tags: [tagDxn] }));
95
+ space.db.add(
96
+ Obj.make(Person.Person, {
97
+ fullName: 'Josiah',
98
+ organization: Ref.make(org),
99
+ }),
100
+ );
86
101
  space.db.add(
87
- Obj.make(DataType.Person, { fullName: 'Rich', organization: Ref.make(org) }, { tags: [tagDxn] }),
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
+ }),
88
112
  );
89
- space.db.add(Obj.make(DataType.Person, { fullName: 'Josiah', organization: Ref.make(org) }));
90
- space.db.add(Obj.make(DataType.Person, { fullName: 'Dima', organization: Ref.make(org) }));
91
- space.db.add(Obj.make(DataType.Person, { fullName: 'Mykola', organization: Ref.make(org) }));
92
- space.db.add(Obj.make(DataType.Person, { fullName: 'Will', organization: Ref.make(org) }));
93
113
 
94
114
  return doc;
95
115
  });
@@ -105,36 +125,38 @@ export const generator = () => ({
105
125
  const tagDxn = Obj.getDXN(tag).toString();
106
126
 
107
127
  const objects = range(n, () => {
108
- const contactsQuery = Query.select(Filter.type(DataType.Person)).select(Filter.tag(tagDxn));
109
- const organizationsQuery = Query.select(Filter.type(DataType.Organization)).select(Filter.tag(tagDxn));
128
+ const contactsQuery = Query.select(Filter.type(Person.Person)).select(Filter.tag(tagDxn));
129
+ const organizationsQuery = Query.select(Filter.type(Organization.Organization)).select(Filter.tag(tagDxn));
110
130
  const notesQuery = Query.select(Filter.type(Markdown.Document)).select(Filter.tag(tagDxn));
111
131
 
112
- const emailSyncTrigger = Trigger.make({
113
- enabled: true,
114
- spec: {
115
- kind: 'timer',
116
- cron: '* * * * *', // Every minute.
117
- },
118
- function: Ref.make(serializeFunction(sync)),
119
- input: {
120
- mailboxId: Obj.getDXN(mailbox).toString(),
121
- },
122
- });
123
- space.db.add(emailSyncTrigger);
124
-
125
- const contactExtractionTrigger = Trigger.make({
126
- enabled: true,
127
- // TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
128
- spec: {
129
- kind: 'queue',
130
- queue: mailbox.queue.dxn.toString(),
131
- },
132
- function: Ref.make(serializeFunction(EntityExtraction.extract)),
133
- input: {
134
- source: '{{event.item}}',
135
- },
136
- });
137
- space.db.add(contactExtractionTrigger);
132
+ space.db.add(
133
+ Trigger.make({
134
+ enabled: true,
135
+ spec: {
136
+ kind: 'timer',
137
+ cron: '* * * * *', // Every minute.
138
+ },
139
+ function: Ref.make(serializeFunction(gmail.sync)),
140
+ input: {
141
+ mailboxId: Obj.getDXN(mailbox).toString(),
142
+ },
143
+ }),
144
+ );
145
+
146
+ space.db.add(
147
+ Trigger.make({
148
+ enabled: true,
149
+ // TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
150
+ spec: {
151
+ kind: 'queue',
152
+ queue: mailbox.queue.dxn.toString(),
153
+ },
154
+ function: Ref.make(serializeFunction(EntityExtraction.extract)),
155
+ input: {
156
+ source: '{{event.item}}',
157
+ },
158
+ }),
159
+ );
138
160
 
139
161
  const researchPrompt = space.db.add(
140
162
  Prompt.make({
@@ -156,55 +178,71 @@ export const generator = () => ({
156
178
  }),
157
179
  );
158
180
 
159
- const researchTrigger = Trigger.make({
160
- enabled: true,
161
- spec: {
162
- kind: 'subscription',
163
- query: {
164
- ast: organizationsQuery.ast,
181
+ space.db.add(
182
+ Trigger.make({
183
+ enabled: true,
184
+ spec: {
185
+ kind: 'subscription',
186
+ query: {
187
+ ast: organizationsQuery.ast,
188
+ },
165
189
  },
166
- },
167
- function: Ref.make(serializeFunction(Agent.prompt)),
168
- input: {
169
- prompt: Ref.make(researchPrompt),
170
- input: '{{event.subject}}',
171
- },
172
- });
173
- space.db.add(researchTrigger);
190
+ function: Ref.make(serializeFunction(Agent.prompt)),
191
+ input: {
192
+ prompt: Ref.make(researchPrompt),
193
+ input: '{{event.subject}}',
194
+ },
195
+ }),
196
+ );
174
197
 
175
- const mailboxView = createView({
176
- name: 'Mailbox',
198
+ const mailboxView = View.make({
177
199
  query: Query.select(
178
- Filter.type(DataType.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
  }),
182
- jsonSchema: Type.toJsonSchema(DataType.Message),
183
- presentation: Obj.make(DataType.Collection, { objects: [] }),
206
+ jsonSchema: Type.toJsonSchema(Message.Message),
184
207
  });
185
- const contactsView = createView({
186
- name: 'Contacts',
208
+ const contactsView = View.make({
187
209
  query: contactsQuery,
188
- jsonSchema: Type.toJsonSchema(DataType.Person),
189
- presentation: Obj.make(DataType.Collection, { objects: [] }),
210
+ jsonSchema: Type.toJsonSchema(Person.Person),
190
211
  });
191
- const organizationsView = createView({
192
- name: 'Organizations',
212
+ const organizationsView = View.make({
193
213
  query: organizationsQuery,
194
- jsonSchema: Type.toJsonSchema(DataType.Organization),
195
- presentation: Obj.make(DataType.Collection, { objects: [] }),
214
+ jsonSchema: Type.toJsonSchema(Organization.Organization),
196
215
  });
197
- const notesView = createView({
198
- name: 'Notes',
216
+ const notesView = View.make({
199
217
  query: notesQuery,
200
218
  jsonSchema: Type.toJsonSchema(Markdown.Document),
201
- presentation: Obj.make(DataType.Collection, { objects: [] }),
202
219
  });
203
220
 
204
221
  return space.db.add(
205
- DataType.makeProject({
222
+ Project.make({
206
223
  name: 'Investor Research',
207
- collections: [mailboxView, contactsView, organizationsView, notesView].map((view) => Ref.make(view)),
224
+ columns: [
225
+ {
226
+ name: 'Mailbox',
227
+ view: Ref.make(mailboxView),
228
+ order: [],
229
+ },
230
+ {
231
+ name: 'Contacts',
232
+ view: Ref.make(contactsView),
233
+ order: [],
234
+ },
235
+ {
236
+ name: 'Organizations',
237
+ view: Ref.make(organizationsView),
238
+ order: [],
239
+ },
240
+ {
241
+ name: 'Notes',
242
+ view: Ref.make(notesView),
243
+ order: [],
244
+ },
245
+ ],
208
246
  }),
209
247
  );
210
248
  });
@@ -233,10 +271,24 @@ export const generator = () => ({
233
271
  const append = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
234
272
 
235
273
  builder
236
- .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
+ })
237
280
  .createEdge({ source: gpt.id, target: text.id, output: 'text' })
238
- .createEdge({ source: queueId.id, target: append.id, input: 'id' })
239
- .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
+ });
240
292
 
241
293
  functionTrigger = triggerShape.functionTrigger!.target!;
242
294
  });
@@ -261,7 +313,7 @@ export const generator = () => ({
261
313
  'subscription',
262
314
  (triggerSpec) =>
263
315
  (triggerSpec.query = {
264
- 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>,
265
317
  }),
266
318
  'type',
267
319
  );
@@ -374,8 +426,17 @@ export const generator = () => ({
374
426
  builder
375
427
  .createEdge({ source: chat.id, target: gpt.id, input: 'prompt' })
376
428
  .createEdge({ source: gpt.id, target: text.id, output: 'text' })
377
- .createEdge({ source: queueId.id, target: append.id, input: 'id' })
378
- .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
+ });
379
440
  });
380
441
 
381
442
  const computeModel = createComputeGraph(canvasModel);
@@ -499,9 +560,21 @@ export const generator = () => ({
499
560
  const view = canvasModel.createNode(createSurface(position({ x: 12, y: 0 })));
500
561
 
501
562
  builder
502
- .createEdge({ source: sourceCurrency.id, target: converter.id, input: 'from' })
503
- .createEdge({ source: targetCurrency.id, target: converter.id, input: 'to' })
504
- .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
+ });
505
578
  });
506
579
 
507
580
  const computeModel = createComputeGraph(canvasModel);
@@ -529,7 +602,10 @@ export const generator = () => ({
529
602
  const trigger = canvasModel.createNode(triggerShape);
530
603
  // DXOS dev-null channel.
531
604
  const channelId = canvasModel.createNode(
532
- createConstant({ value: '1088569858767212554', ...position({ x: -10, y: 0 }) }),
605
+ createConstant({
606
+ value: '1088569858767212554',
607
+ ...position({ x: -10, y: 0 }),
608
+ }),
533
609
  );
534
610
  const queueId = canvasModel.createNode(
535
611
  createConstant({
@@ -542,11 +618,31 @@ export const generator = () => ({
542
618
  const queue = canvasModel.createNode(createQueue(position({ x: 0, y: 12 })));
543
619
 
544
620
  builder
545
- .createEdge({ source: trigger.id, target: converter.id, input: 'tick' })
546
- .createEdge({ source: channelId.id, target: converter.id, input: 'channelId' })
547
- .createEdge({ source: queueId.id, target: converter.id, input: 'queueId' })
548
- .createEdge({ source: converter.id, target: view.id, output: 'newMessages' })
549
- .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
+ });
550
646
 
551
647
  functionTrigger = triggerShape.functionTrigger!.target!;
552
648
  });
@@ -616,7 +712,7 @@ export const generator = () => ({
616
712
  const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
617
713
  space: Space,
618
714
  triggerKind: SpecType,
619
- initSpec: (spec: Extract<Trigger.Spec, { kind: SpecType }>) => void,
715
+ initSpec: (spec: Obj.Mutable<Extract<Trigger.Spec, { kind: SpecType }>>) => void,
620
716
  triggerOutputName: string,
621
717
  ) => {
622
718
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
@@ -649,7 +745,12 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
649
745
  builder
650
746
  .createEdge({ source: queueId.id, target: append.id, input: 'id' })
651
747
  .createEdge({ source: template.id, target: append.id, input: 'items' })
652
- .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
+ })
653
754
  .createEdge({
654
755
  source: random.id,
655
756
  target: template.id,
@@ -659,13 +760,16 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
659
760
  functionTrigger = triggerShape.functionTrigger!.target!;
660
761
  const triggerSpec = functionTrigger.spec;
661
762
  invariant(triggerSpec && triggerSpec.kind === triggerKind, 'No trigger spec.');
662
- initSpec(triggerSpec as any);
763
+ Obj.change(functionTrigger, (ft) => {
764
+ initSpec(ft.spec as any);
765
+ });
663
766
  });
664
767
 
665
768
  const computeModel = createComputeGraph(canvasModel);
666
769
 
667
770
  const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
668
771
  invariant(templateComputeNode, 'Template compute node was not created.');
772
+ // NOTE: These are plain object mutations during model construction, not ECHO object mutations.
669
773
  templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
670
774
  templateComputeNode.inputSchema = Type.toJsonSchema(Schema.Struct({ type: Schema.String, changeId: Schema.String }));
671
775
  attachTrigger(functionTrigger, computeModel);
@@ -705,15 +809,25 @@ const setupQueue = (
705
809
 
706
810
  const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
707
811
  invariant(functionTrigger);
708
- functionTrigger.function = Ref.make(computeModel.root);
709
812
  const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
710
- functionTrigger.inputNodeId = inputNode.id;
813
+ Obj.change(functionTrigger, (t) => {
814
+ t.function = Ref.make(computeModel.root);
815
+ t.inputNodeId = inputNode.id;
816
+ });
711
817
  };
712
818
 
713
- 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
+ };
714
825
 
715
826
  const rawPosition = (args: RawPositionInput) => {
716
- 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
+ };
717
831
  };
718
832
 
719
833
  const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
@@ -721,7 +835,10 @@ const position = (rect: { x: number; y: number; width?: number; height?: number
721
835
  const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
722
836
  const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
723
837
  if (width && height) {
724
- return { center: { x, y }, size: width && height ? { width, height } : undefined };
838
+ return {
839
+ center: { x, y },
840
+ size: width && height ? { width, height } : undefined,
841
+ };
725
842
  } else {
726
843
  return { center: { x, y } };
727
844
  }
@@ -5,22 +5,21 @@
5
5
  import React from 'react';
6
6
  import { useResizeDetector } from 'react-resize-detector';
7
7
 
8
- import { type Obj } from '@dxos/echo';
9
- import { fullyQualifiedId } from '@dxos/react-client/echo';
8
+ import { Obj } from '@dxos/echo';
10
9
  import { type ThemedClassName } from '@dxos/react-ui';
11
10
  import { useAttentionAttributes } from '@dxos/react-ui-attention';
12
11
  import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
13
- import { mx } from '@dxos/react-ui-theme';
12
+ import { mx } from '@dxos/ui-theme';
14
13
 
15
14
  // TODO(burdon): Create generic container with wireframe mode.
16
15
  export type WireframeProps = ThemedClassName<{
16
+ object: Obj.Unknown;
17
17
  label?: string;
18
- object: Obj.Any;
19
18
  }>;
20
19
 
21
20
  // TODO(burdon): Make focusable and attendable with input.
22
21
  export const Wireframe = ({ classNames, label, object }: WireframeProps) => {
23
- const attentionAttrs = useAttentionAttributes(fullyQualifiedId(object));
22
+ const attentionAttrs = useAttentionAttributes(Obj.getDXN(object).toString());
24
23
  const { width, height, ref } = useResizeDetector();
25
24
 
26
25
  return (
@@ -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`
@@ -16,7 +16,7 @@ export const translations = [
16
16
  'mutation period': 'Mutation period',
17
17
  'open devtools label': 'Open DevTools',
18
18
  'devtools label': 'DevTools',
19
- 'devtools overview label': 'DevTools Stats',
19
+ 'devtools overview label': 'Stats',
20
20
  'debug label': 'Debug',
21
21
  'debug app graph label': 'App Graph',
22
22
  'settings show debug panel': 'Show Debug panel.',
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";
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-EPD6EWT5.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/DevtoolsOverviewContainer.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Surface } from '@dxos/app-framework';\nimport { StatsPanel, useStats } from '@dxos/devtools';\n\nexport const DevtoolsOverviewContainer = () => {\n const [stats, refreshStats] = useStats();\n\n return (\n <StatsPanel stats={stats} onRefresh={refreshStats}>\n <Surface role='devtools-overview' />\n </StatsPanel>\n );\n};\n\nexport default DevtoolsOverviewContainer;\n"],
5
- "mappings": ";;AAIA,OAAOA,WAAW;AAElB,SAASC,eAAe;AACxB,SAASC,YAAYC,gBAAgB;AAE9B,IAAMC,4BAA4B,MAAA;;;AACvC,UAAM,CAACC,OAAOC,YAAAA,IAAgBC,SAAAA;AAE9B,WACE,sBAAA,cAACC,YAAAA;MAAWH;MAAcI,WAAWH;OACnC,sBAAA,cAACI,SAAAA;MAAQC,MAAK;;;;;AAGpB;AAEA,IAAA,oCAAeP;",
6
- "names": ["React", "Surface", "StatsPanel", "useStats", "DevtoolsOverviewContainer", "stats", "refreshStats", "useStats", "StatsPanel", "onRefresh", "Surface", "role"]
7
- }