@dxos/plugin-debug 0.8.4-main.1da679c → 0.8.4-main.21d9917

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 (120) 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-SB2YRVRT.mjs → SpaceGenerator-ZHVZWGM7.mjs} +287 -257
  6. package/dist/lib/browser/SpaceGenerator-ZHVZWGM7.mjs.map +7 -0
  7. package/dist/lib/browser/app-graph-builder-FBDRMMYF.mjs +597 -0
  8. package/dist/lib/browser/app-graph-builder-FBDRMMYF.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-AJA6RYN3.mjs → chunk-4UFQXPP7.mjs} +12 -2
  10. package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-A5H5GRV6.mjs +20 -0
  12. package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +35 -43
  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-W62RJ32U.mjs +757 -0
  19. package/dist/lib/browser/react-surface-W62RJ32U.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 +0 -1
  53. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
  54. package/dist/types/src/components/SpaceGenerator/presets.d.ts +2 -5
  55. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  56. package/dist/types/src/components/Wireframe.d.ts +2 -2
  57. package/dist/types/src/components/Wireframe.d.ts.map +1 -1
  58. package/dist/types/src/components/index.d.ts +4 -4
  59. package/dist/types/src/components/index.d.ts.map +1 -1
  60. package/dist/types/src/meta.d.ts +2 -3
  61. package/dist/types/src/meta.d.ts.map +1 -1
  62. package/dist/types/src/translations.d.ts +1 -1
  63. package/dist/types/src/types.d.ts +6 -1
  64. package/dist/types/src/types.d.ts.map +1 -1
  65. package/dist/types/tsconfig.tsbuildinfo +1 -1
  66. package/package.json +77 -72
  67. package/src/DebugPlugin.tsx +17 -33
  68. package/src/capabilities/app-graph-builder/app-graph-builder.ts +419 -0
  69. package/src/capabilities/app-graph-builder/index.ts +7 -0
  70. package/src/capabilities/index.ts +4 -6
  71. package/src/capabilities/react-context/index.ts +7 -0
  72. package/src/capabilities/react-context/react-context.tsx +20 -0
  73. package/src/capabilities/react-surface/index.ts +7 -0
  74. package/src/capabilities/react-surface/react-surface.tsx +409 -0
  75. package/src/capabilities/settings/index.ts +7 -0
  76. package/src/capabilities/settings/settings.ts +30 -0
  77. package/src/components/DebugGraph.tsx +4 -3
  78. package/src/components/DebugObjectPanel.tsx +6 -8
  79. package/src/components/DebugSettings.tsx +47 -21
  80. package/src/components/DebugStatus.tsx +2 -2
  81. package/src/components/DevtoolsOverviewContainer.tsx +1 -1
  82. package/src/components/SpaceGenerator/ObjectGenerator.tsx +26 -33
  83. package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
  84. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +10 -10
  85. package/src/components/SpaceGenerator/SpaceGenerator.tsx +21 -16
  86. package/src/components/SpaceGenerator/draw-util.ts +2 -2
  87. package/src/components/SpaceGenerator/presets.ts +243 -86
  88. package/src/components/Wireframe.tsx +4 -5
  89. package/src/components/index.ts +4 -1
  90. package/src/meta.ts +8 -7
  91. package/src/translations.ts +1 -1
  92. package/src/types.ts +9 -1
  93. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +0 -20
  94. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +0 -7
  95. package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs +0 -25
  96. package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs.map +0 -7
  97. package/dist/lib/browser/SpaceGenerator-SB2YRVRT.mjs.map +0 -7
  98. package/dist/lib/browser/app-graph-builder-7ODCSP7R.mjs +0 -587
  99. package/dist/lib/browser/app-graph-builder-7ODCSP7R.mjs.map +0 -7
  100. package/dist/lib/browser/chunk-5XPIRNQS.mjs +0 -18
  101. package/dist/lib/browser/chunk-5XPIRNQS.mjs.map +0 -7
  102. package/dist/lib/browser/chunk-AJA6RYN3.mjs.map +0 -7
  103. package/dist/lib/browser/react-context-Y537DXK5.mjs +0 -16
  104. package/dist/lib/browser/react-context-Y537DXK5.mjs.map +0 -7
  105. package/dist/lib/browser/react-surface-OP75RFNI.mjs +0 -773
  106. package/dist/lib/browser/react-surface-OP75RFNI.mjs.map +0 -7
  107. package/dist/lib/browser/settings-XAUQOU7I.mjs +0 -22
  108. package/dist/lib/browser/settings-XAUQOU7I.mjs.map +0 -7
  109. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  110. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  111. package/dist/types/src/capabilities/react-context.d.ts +0 -8
  112. package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
  113. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  114. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  115. package/dist/types/src/capabilities/settings.d.ts +0 -4
  116. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  117. package/src/capabilities/app-graph-builder.ts +0 -430
  118. package/src/capabilities/react-context.tsx +0 -16
  119. package/src/capabilities/react-surface.tsx +0 -398
  120. package/src/capabilities/settings.ts +0 -19
@@ -2,14 +2,15 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
 
7
- import { RESEARCH_BLUEPRINT, ResearchOn, agent } from '@dxos/assistant-testing';
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, Relation, Type } from '@dxos/echo';
11
- import { FunctionTrigger, type TriggerKind, type TriggerType, serializeFunction } from '@dxos/functions';
10
+ import { DXN, Filter, Key, Obj, Query, Ref, Tag, Type } from '@dxos/echo';
11
+ import { Trigger, serializeFunction } from '@dxos/functions';
12
12
  import { invariant } from '@dxos/invariant';
13
+ import { gmail } from '@dxos/plugin-inbox';
13
14
  import { Mailbox } from '@dxos/plugin-inbox/types';
14
15
  import { Markdown } from '@dxos/plugin-markdown/types';
15
16
  import { type Space } from '@dxos/react-client/echo';
@@ -35,8 +36,9 @@ import {
35
36
  pointsToRect,
36
37
  rectToPoints,
37
38
  } from '@dxos/react-ui-canvas-editor';
38
- import { DataType, createView } from '@dxos/schema';
39
- import { range } from '@dxos/util';
39
+ import { View } from '@dxos/schema';
40
+ import { Message, Organization, Person, Project } from '@dxos/types';
41
+ import { range, trim } from '@dxos/util';
40
42
 
41
43
  import { type ObjectGenerator } from './ObjectGenerator';
42
44
 
@@ -48,43 +50,66 @@ export enum PresetName {
48
50
  CHAT_GPT = 'chat-gpt-text',
49
51
  // EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
50
52
  OBJECT_CHANGE_QUEUE = 'objectChange-queue',
51
- FOREX_FUNCTION_CALL = 'forex-function-call',
52
53
  TIMER_TICK_QUEUE = 'timerTick-queue',
54
+ FOREX_FUNCTION_CALL = 'forex-function-call',
53
55
  DISCORD_MESSAGES = 'discord-messages',
54
56
  // KANBAN_QUEUE = 'kanban-queue',
55
57
  }
56
58
 
57
59
  export const generator = () => ({
58
- schemas: [CanvasBoardType, FunctionTrigger],
60
+ schemas: [CanvasBoardType, Trigger.Trigger] as any[],
59
61
  types: Object.values(PresetName).map((name) => ({ typename: name })),
60
62
  items: [
61
63
  [
62
64
  PresetName.DXOS_TEAM,
63
65
  async (space, n, cb) => {
64
66
  const objects = range(n, () => {
65
- const org = space.db.add(Obj.make(DataType.Organization, { name: 'DXOS', website: 'https://dxos.org' }));
66
-
67
+ const org = space.db.add(
68
+ Obj.make(Organization.Organization, {
69
+ name: 'DXOS',
70
+ website: 'https://dxos.org',
71
+ }),
72
+ );
67
73
  const doc = space.db.add(
68
- Markdown.makeDocument({
74
+ Markdown.make({
69
75
  name: 'DXOS Research',
70
76
  content: 'DXOS builds Composer, an open-source AI-powered malleable application.',
71
77
  }),
72
78
  );
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
+
86
+ // space.db.add(
87
+ // Relation.make(HasSubject, {
88
+ // [Relation.Source]: doc,
89
+ // [Relation.Target]: org,
90
+ // completedAt: new Date().toISOString(),
91
+ // }),
92
+ // );
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
+ );
73
101
  space.db.add(
74
- Relation.make(ResearchOn, {
75
- [Relation.Source]: doc,
76
- [Relation.Target]: org,
77
- completedAt: new Date().toISOString(),
102
+ Obj.make(Person.Person, {
103
+ fullName: 'Dima',
104
+ organization: Ref.make(org),
78
105
  }),
79
106
  );
80
-
81
107
  space.db.add(
82
- Obj.make(DataType.Person, { fullName: 'Rich', jobTitle: 'investor', organization: Ref.make(org) }),
108
+ Obj.make(Person.Person, {
109
+ fullName: 'Mykola',
110
+ organization: Ref.make(org),
111
+ }),
83
112
  );
84
- space.db.add(Obj.make(DataType.Person, { fullName: 'Josiah', organization: Ref.make(org) }));
85
- space.db.add(Obj.make(DataType.Person, { fullName: 'Dima', organization: Ref.make(org) }));
86
- space.db.add(Obj.make(DataType.Person, { fullName: 'Mykola', organization: Ref.make(org) }));
87
- space.db.add(Obj.make(DataType.Person, { fullName: 'Will', organization: Ref.make(org) }));
88
113
 
89
114
  return doc;
90
115
  });
@@ -96,12 +121,42 @@ export const generator = () => ({
96
121
  PresetName.ORG_RESEARCH_PROJECT,
97
122
  async (space, n, cb) => {
98
123
  const mailbox = await space.db.query(Filter.type(Mailbox.Mailbox)).first();
124
+ const tag = await space.db.query(Filter.type(Tag.Tag, { label: 'Investor' })).first();
125
+ const tagDxn = Obj.getDXN(tag).toString();
99
126
 
100
127
  const objects = range(n, () => {
101
- // TODO(wittjosiah): Move filter to another property.
102
- const contactsQuery = Query.select(Filter.type(DataType.Person, { jobTitle: 'investor' }));
103
- const organizationsQuery = contactsQuery.reference('organization');
104
- const notesQuery = organizationsQuery.targetOf(ResearchOn).source();
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));
130
+ const notesQuery = Query.select(Filter.type(Markdown.Document)).select(Filter.tag(tagDxn));
131
+
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
+ );
105
160
 
106
161
  const researchPrompt = space.db.add(
107
162
  Prompt.make({
@@ -114,62 +169,84 @@ export const generator = () => ({
114
169
 
115
170
  // TODO(dmaretskyi): This mocks research (returns pre-baked result), the actual research might take compute minutes.
116
171
  // Remove the mock prompt to do the actual research.
117
- instructions:
118
- 'Research the organization provided as input. Create a research note for it at the end. NOTE: Do mocked reseach (set mockSearch to true).',
119
- blueprints: [Ref.make(RESEARCH_BLUEPRINT)],
172
+ instructions: trim`
173
+ Research the organization provided as input.
174
+ Create a research note for it at the end.
175
+ NOTE: Do mocked reseach (set mockSearch to true).
176
+ `,
177
+ blueprints: [Ref.make(ResearchBlueprint)],
120
178
  }),
121
179
  );
122
180
 
123
- const researchTrigger = Obj.make(FunctionTrigger, {
124
- enabled: true,
125
- spec: {
126
- kind: 'subscription',
127
- query: organizationsQuery.ast,
128
- },
129
- function: Ref.make(serializeFunction(agent)),
130
- input: {
131
- prompt: Ref.make(researchPrompt),
132
- input: '{{event.subject}}',
133
- },
134
- });
135
- space.db.add(researchTrigger);
181
+ space.db.add(
182
+ Trigger.make({
183
+ enabled: true,
184
+ spec: {
185
+ kind: 'subscription',
186
+ query: {
187
+ ast: organizationsQuery.ast,
188
+ },
189
+ },
190
+ function: Ref.make(serializeFunction(Agent.prompt)),
191
+ input: {
192
+ prompt: Ref.make(researchPrompt),
193
+ input: '{{event.subject}}',
194
+ },
195
+ }),
196
+ );
136
197
 
137
- const mailboxView = createView({
138
- name: 'Mailbox',
198
+ const mailboxView = View.make({
139
199
  query: Query.select(
140
- Filter.type(DataType.Message, { properties: { labels: Filter.contains('investor') } }),
200
+ Filter.type(Message.Message, {
201
+ properties: { labels: Filter.contains('investor') },
202
+ }),
141
203
  ).options({
142
204
  queues: [mailbox.queue.dxn.toString()],
143
205
  }),
144
- jsonSchema: Type.toJsonSchema(DataType.Message),
145
- presentation: Obj.make(DataType.Collection, { objects: [] }),
206
+ jsonSchema: Type.toJsonSchema(Message.Message),
146
207
  });
147
- const contactsView = createView({
148
- name: 'Contacts',
208
+ const contactsView = View.make({
149
209
  query: contactsQuery,
150
- jsonSchema: Type.toJsonSchema(DataType.Person),
151
- presentation: Obj.make(DataType.Collection, { objects: [] }),
210
+ jsonSchema: Type.toJsonSchema(Person.Person),
152
211
  });
153
- const organizationsView = createView({
154
- name: 'Organizations',
212
+ const organizationsView = View.make({
155
213
  query: organizationsQuery,
156
- jsonSchema: Type.toJsonSchema(DataType.Organization),
157
- presentation: Obj.make(DataType.Collection, { objects: [] }),
214
+ jsonSchema: Type.toJsonSchema(Organization.Organization),
158
215
  });
159
- const notesView = createView({
160
- name: 'Notes',
216
+ const notesView = View.make({
161
217
  query: notesQuery,
162
218
  jsonSchema: Type.toJsonSchema(Markdown.Document),
163
- presentation: Obj.make(DataType.Collection, { objects: [] }),
164
219
  });
165
220
 
166
221
  return space.db.add(
167
- DataType.makeProject({
222
+ Project.make({
168
223
  name: 'Investor Research',
169
- 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
+ ],
170
246
  }),
171
247
  );
172
248
  });
249
+
173
250
  cb?.(objects.flat());
174
251
  return objects.flat();
175
252
  },
@@ -180,7 +257,7 @@ export const generator = () => ({
180
257
  const objects = range(n, () => {
181
258
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
182
259
 
183
- let functionTrigger: FunctionTrigger | undefined;
260
+ let functionTrigger: Trigger.Trigger | undefined;
184
261
  canvasModel.builder.call((builder) => {
185
262
  const gpt = canvasModel.createNode(createGpt(position({ x: 0, y: -14 })));
186
263
  const triggerShape = createTrigger({
@@ -194,10 +271,24 @@ export const generator = () => ({
194
271
  const append = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
195
272
 
196
273
  builder
197
- .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
+ })
198
280
  .createEdge({ source: gpt.id, target: text.id, output: 'text' })
199
- .createEdge({ source: queueId.id, target: append.id, input: 'id' })
200
- .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
+ });
201
292
 
202
293
  functionTrigger = triggerShape.functionTrigger!.target!;
203
294
  });
@@ -220,7 +311,10 @@ export const generator = () => ({
220
311
  const { canvasModel, computeModel } = createQueueSinkPreset(
221
312
  space,
222
313
  'subscription',
223
- (triggerSpec) => (triggerSpec.query = Query.select(Filter.typename('dxos.org/type/Chess')).ast),
314
+ (triggerSpec) =>
315
+ (triggerSpec.query = {
316
+ ast: Query.select(Filter.typename('dxos.org/type/Chess')).ast,
317
+ }),
224
318
  'type',
225
319
  );
226
320
  return addToSpace(PresetName.OBJECT_CHANGE_QUEUE, space, canvasModel, computeModel);
@@ -332,8 +426,17 @@ export const generator = () => ({
332
426
  builder
333
427
  .createEdge({ source: chat.id, target: gpt.id, input: 'prompt' })
334
428
  .createEdge({ source: gpt.id, target: text.id, output: 'text' })
335
- .createEdge({ source: queueId.id, target: append.id, input: 'id' })
336
- .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
+ });
337
440
  });
338
441
 
339
442
  const computeModel = createComputeGraph(canvasModel);
@@ -457,9 +560,21 @@ export const generator = () => ({
457
560
  const view = canvasModel.createNode(createSurface(position({ x: 12, y: 0 })));
458
561
 
459
562
  builder
460
- .createEdge({ source: sourceCurrency.id, target: converter.id, input: 'from' })
461
- .createEdge({ source: targetCurrency.id, target: converter.id, input: 'to' })
462
- .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
+ });
463
578
  });
464
579
 
465
580
  const computeModel = createComputeGraph(canvasModel);
@@ -477,7 +592,7 @@ export const generator = () => ({
477
592
  const objects = range(n, () => {
478
593
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
479
594
 
480
- let functionTrigger: FunctionTrigger | undefined;
595
+ let functionTrigger: Trigger.Trigger | undefined;
481
596
  canvasModel.builder.call((builder) => {
482
597
  const triggerShape = createTrigger({
483
598
  spaceId: space.id,
@@ -487,7 +602,10 @@ export const generator = () => ({
487
602
  const trigger = canvasModel.createNode(triggerShape);
488
603
  // DXOS dev-null channel.
489
604
  const channelId = canvasModel.createNode(
490
- createConstant({ value: '1088569858767212554', ...position({ x: -10, y: 0 }) }),
605
+ createConstant({
606
+ value: '1088569858767212554',
607
+ ...position({ x: -10, y: 0 }),
608
+ }),
491
609
  );
492
610
  const queueId = canvasModel.createNode(
493
611
  createConstant({
@@ -500,11 +618,31 @@ export const generator = () => ({
500
618
  const queue = canvasModel.createNode(createQueue(position({ x: 0, y: 12 })));
501
619
 
502
620
  builder
503
- .createEdge({ source: trigger.id, target: converter.id, input: 'tick' })
504
- .createEdge({ source: channelId.id, target: converter.id, input: 'channelId' })
505
- .createEdge({ source: queueId.id, target: converter.id, input: 'queueId' })
506
- .createEdge({ source: converter.id, target: view.id, output: 'newMessages' })
507
- .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
+ });
508
646
 
509
647
  functionTrigger = triggerShape.functionTrigger!.target!;
510
648
  });
@@ -571,10 +709,10 @@ export const generator = () => ({
571
709
  ] as [PresetName, ObjectGenerator<any>][],
572
710
  });
573
711
 
574
- const createQueueSinkPreset = <SpecType extends TriggerKind>(
712
+ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
575
713
  space: Space,
576
714
  triggerKind: SpecType,
577
- initSpec: (spec: Extract<TriggerType, { kind: SpecType }>) => void,
715
+ initSpec: (spec: Extract<Trigger.Spec, { kind: SpecType }>) => void,
578
716
  triggerOutputName: string,
579
717
  ) => {
580
718
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
@@ -586,7 +724,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
586
724
  }),
587
725
  );
588
726
 
589
- let functionTrigger: FunctionTrigger | undefined;
727
+ let functionTrigger: Trigger.Trigger | undefined;
590
728
  canvasModel.builder.call((builder) => {
591
729
  const triggerShape = createTrigger({
592
730
  spaceId: space.id,
@@ -607,7 +745,12 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
607
745
  builder
608
746
  .createEdge({ source: queueId.id, target: append.id, input: 'id' })
609
747
  .createEdge({ source: template.id, target: append.id, input: 'items' })
610
- .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
+ })
611
754
  .createEdge({
612
755
  source: random.id,
613
756
  target: template.id,
@@ -624,6 +767,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
624
767
 
625
768
  const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
626
769
  invariant(templateComputeNode, 'Template compute node was not created.');
770
+ // NOTE: These are plain object mutations during model construction, not ECHO object mutations.
627
771
  templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
628
772
  templateComputeNode.inputSchema = Type.toJsonSchema(Schema.Struct({ type: Schema.String, changeId: Schema.String }));
629
773
  attachTrigger(functionTrigger, computeModel);
@@ -661,17 +805,27 @@ const setupQueue = (
661
805
  return { queue, queueId };
662
806
  };
663
807
 
664
- const attachTrigger = (functionTrigger: FunctionTrigger | undefined, computeModel: ComputeGraphModel) => {
808
+ const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
665
809
  invariant(functionTrigger);
666
- functionTrigger.function = Ref.make(computeModel.root);
667
810
  const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
668
- functionTrigger.inputNodeId = inputNode.id;
811
+ Obj.change(functionTrigger, (t) => {
812
+ t.function = Ref.make(computeModel.root);
813
+ t.inputNodeId = inputNode.id;
814
+ });
669
815
  };
670
816
 
671
- type RawPositionInput = { centerX: number; centerY: number; width: number; height: number };
817
+ type RawPositionInput = {
818
+ centerX: number;
819
+ centerY: number;
820
+ width: number;
821
+ height: number;
822
+ };
672
823
 
673
824
  const rawPosition = (args: RawPositionInput) => {
674
- return { center: { x: args.centerX, y: args.centerY }, size: { width: args.width, height: args.height } };
825
+ return {
826
+ center: { x: args.centerX, y: args.centerY },
827
+ size: { width: args.width, height: args.height },
828
+ };
675
829
  };
676
830
 
677
831
  const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
@@ -679,7 +833,10 @@ const position = (rect: { x: number; y: number; width?: number; height?: number
679
833
  const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
680
834
  const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
681
835
  if (width && height) {
682
- return { center: { x, y }, size: width && height ? { width, height } : undefined };
836
+ return {
837
+ center: { x, y },
838
+ size: width && height ? { width, height } : undefined,
839
+ };
683
840
  } else {
684
841
  return { center: { x, y } };
685
842
  }
@@ -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,15 +2,16 @@
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
+ import { trim } from '@dxos/util';
6
7
 
7
- export const DEBUG_PLUGIN = 'dxos.org/plugin/debug';
8
-
9
- export const meta: PluginMeta = {
10
- id: DEBUG_PLUGIN,
8
+ export const meta: Plugin.Meta = {
9
+ id: 'dxos.org/plugin/debug',
11
10
  name: 'Debug',
12
- description:
13
- 'The debug plugin is useful for troubleshooting inside of Composer. You can also use the Debug plugin to create test data inside of sheets or tables or explore pre-built automations. Non-technical users will likely not spend much time here, but this plugin is invaluable for developers and technical users.',
11
+ description: trim`
12
+ Comprehensive developer toolkit for troubleshooting applications, generating test data, and exploring automation capabilities.
13
+ Inspect objects, monitor events, and debug plugin behavior in real-time.
14
+ `,
14
15
  icon: 'ph--bug--regular',
15
16
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-debug',
16
17
  screenshots: ['https://dxos.network/plugin-details-debug-dark.png'],
@@ -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 { Schema } from 'effect';
5
+ import { type Atom } from '@effect-atom/atom-react';
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
- }