@dxos/plugin-debug 0.8.4-main.1f223c7 → 0.8.4-main.2244d791bb

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-2C6XMJ3L.mjs +19 -0
  4. package/dist/lib/browser/DevtoolsOverviewContainer-2C6XMJ3L.mjs.map +7 -0
  5. package/dist/lib/browser/{SpaceGenerator-SRCIEELZ.mjs → SpaceGenerator-B4A7J26E.mjs} +312 -261
  6. package/dist/lib/browser/SpaceGenerator-B4A7J26E.mjs.map +7 -0
  7. package/dist/lib/browser/app-graph-builder-DEBTVBQG.mjs +599 -0
  8. package/dist/lib/browser/app-graph-builder-DEBTVBQG.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 +36 -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-I3USIAF6.mjs +17 -0
  17. package/dist/lib/browser/react-context-I3USIAF6.mjs.map +7 -0
  18. package/dist/lib/browser/react-surface-ADOU5663.mjs +758 -0
  19. package/dist/lib/browser/react-surface-ADOU5663.mjs.map +7 -0
  20. package/dist/lib/browser/settings-SLTQJJNF.mjs +32 -0
  21. package/dist/lib/browser/settings-SLTQJJNF.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 +6 -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 +78 -71
  67. package/src/DebugPlugin.tsx +18 -33
  68. package/src/capabilities/app-graph-builder/app-graph-builder.ts +421 -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 +411 -0
  75. package/src/capabilities/settings/index.ts +7 -0
  76. package/src/capabilities/settings/settings.ts +31 -0
  77. package/src/components/DebugGraph.tsx +4 -3
  78. package/src/components/DebugObjectPanel.tsx +6 -9
  79. package/src/components/DebugSettings.tsx +61 -35
  80. package/src/components/DebugStatus.tsx +2 -2
  81. package/src/components/DevtoolsOverviewContainer.tsx +2 -2
  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 +35 -31
  86. package/src/components/SpaceGenerator/draw-util.ts +2 -2
  87. package/src/components/SpaceGenerator/presets.ts +264 -89
  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-SRCIEELZ.mjs.map +0 -7
  98. package/dist/lib/browser/app-graph-builder-JTIEFOWZ.mjs +0 -587
  99. package/dist/lib/browser/app-graph-builder-JTIEFOWZ.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-NVAGLAJD.mjs +0 -16
  104. package/dist/lib/browser/react-context-NVAGLAJD.mjs.map +0 -7
  105. package/dist/lib/browser/react-surface-HQPOGG33.mjs +0 -773
  106. package/dist/lib/browser/react-surface-HQPOGG33.mjs.map +0 -7
  107. package/dist/lib/browser/settings-LSSWLM5I.mjs +0 -22
  108. package/dist/lib/browser/settings-LSSWLM5I.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,13 +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 { ResearchOn, research } from '@dxos/assistant-testing';
7
+ import { AgentFunctions, EntityExtractionFunctions, ResearchBlueprint } from '@dxos/assistant-toolkit';
8
+ import { Prompt } from '@dxos/blueprints';
8
9
  import { type ComputeGraphModel, NODE_INPUT } from '@dxos/conductor';
9
- import { DXN, Filter, Key, Obj, Query, Ref, Relation, Type } from '@dxos/echo';
10
- import { FunctionTrigger, type TriggerKind, type TriggerType, serializeFunction } from '@dxos/functions';
10
+ import { DXN, Filter, Key, Obj, Query, type QueryAST, Ref, Tag, Type } from '@dxos/echo';
11
+ import { Trigger, serializeFunction } from '@dxos/functions';
11
12
  import { invariant } from '@dxos/invariant';
13
+ import { GmailFunctions } from '@dxos/plugin-inbox';
12
14
  import { Mailbox } from '@dxos/plugin-inbox/types';
13
15
  import { Markdown } from '@dxos/plugin-markdown/types';
14
16
  import { type Space } from '@dxos/react-client/echo';
@@ -27,15 +29,10 @@ import {
27
29
  createText,
28
30
  createTrigger,
29
31
  } from '@dxos/react-ui-canvas-compute';
30
- import {
31
- CanvasBoardType,
32
- CanvasGraphModel,
33
- pointMultiply,
34
- pointsToRect,
35
- rectToPoints,
36
- } from '@dxos/react-ui-canvas-editor';
37
- import { DataType, createView } from '@dxos/schema';
38
- import { range } from '@dxos/util';
32
+ import { CanvasBoard, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from '@dxos/react-ui-canvas-editor';
33
+ import { View } from '@dxos/schema';
34
+ import { Message, Organization, Person, Pipeline } from '@dxos/types';
35
+ import { range, trim } from '@dxos/util';
39
36
 
40
37
  import { type ObjectGenerator } from './ObjectGenerator';
41
38
 
@@ -47,43 +44,66 @@ export enum PresetName {
47
44
  CHAT_GPT = 'chat-gpt-text',
48
45
  // EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
49
46
  OBJECT_CHANGE_QUEUE = 'objectChange-queue',
50
- FOREX_FUNCTION_CALL = 'forex-function-call',
51
47
  TIMER_TICK_QUEUE = 'timerTick-queue',
48
+ FOREX_FUNCTION_CALL = 'forex-function-call',
52
49
  DISCORD_MESSAGES = 'discord-messages',
53
50
  // KANBAN_QUEUE = 'kanban-queue',
54
51
  }
55
52
 
56
53
  export const generator = () => ({
57
- schemas: [CanvasBoardType, FunctionTrigger],
54
+ schemas: [CanvasBoard.CanvasBoard, Trigger.Trigger] as any[],
58
55
  types: Object.values(PresetName).map((name) => ({ typename: name })),
59
56
  items: [
60
57
  [
61
58
  PresetName.DXOS_TEAM,
62
59
  async (space, n, cb) => {
63
60
  const objects = range(n, () => {
64
- const org = space.db.add(Obj.make(DataType.Organization, { name: 'DXOS', website: 'https://dxos.org' }));
65
-
61
+ const org = space.db.add(
62
+ Obj.make(Organization.Organization, {
63
+ name: 'DXOS',
64
+ website: 'https://dxos.org',
65
+ }),
66
+ );
66
67
  const doc = space.db.add(
67
- Markdown.makeDocument({
68
+ Markdown.make({
68
69
  name: 'DXOS Research',
69
70
  content: 'DXOS builds Composer, an open-source AI-powered malleable application.',
70
71
  }),
71
72
  );
73
+
74
+ const tag = space.db.add(Tag.make({ label: 'Investor' }));
75
+ const tagDxn = Obj.getDXN(tag).toString();
76
+ Obj.change(doc, (d) => {
77
+ Obj.getMeta(d).tags = [tagDxn];
78
+ });
79
+
80
+ // space.db.add(
81
+ // Relation.make(HasSubject, {
82
+ // [Relation.Source]: doc,
83
+ // [Relation.Target]: org,
84
+ // completedAt: new Date().toISOString(),
85
+ // }),
86
+ // );
87
+
88
+ space.db.add(Obj.make(Person.Person, { fullName: 'Rich', organization: Ref.make(org) }, { tags: [tagDxn] }));
72
89
  space.db.add(
73
- Relation.make(ResearchOn, {
74
- [Relation.Source]: doc,
75
- [Relation.Target]: org,
76
- completedAt: new Date().toISOString(),
90
+ Obj.make(Person.Person, {
91
+ fullName: 'Josiah',
92
+ organization: Ref.make(org),
77
93
  }),
78
94
  );
79
-
80
95
  space.db.add(
81
- Obj.make(DataType.Person, { fullName: 'Rich', jobTitle: 'investor', organization: Ref.make(org) }),
96
+ Obj.make(Person.Person, {
97
+ fullName: 'Dima',
98
+ organization: Ref.make(org),
99
+ }),
100
+ );
101
+ space.db.add(
102
+ Obj.make(Person.Person, {
103
+ fullName: 'Mykola',
104
+ organization: Ref.make(org),
105
+ }),
82
106
  );
83
- space.db.add(Obj.make(DataType.Person, { fullName: 'Josiah', organization: Ref.make(org) }));
84
- space.db.add(Obj.make(DataType.Person, { fullName: 'Dima', organization: Ref.make(org) }));
85
- space.db.add(Obj.make(DataType.Person, { fullName: 'Mykola', organization: Ref.make(org) }));
86
- space.db.add(Obj.make(DataType.Person, { fullName: 'Will', organization: Ref.make(org) }));
87
107
 
88
108
  return doc;
89
109
  });
@@ -95,59 +115,132 @@ export const generator = () => ({
95
115
  PresetName.ORG_RESEARCH_PROJECT,
96
116
  async (space, n, cb) => {
97
117
  const mailbox = await space.db.query(Filter.type(Mailbox.Mailbox)).first();
118
+ const tag = await space.db.query(Filter.type(Tag.Tag, { label: 'Investor' })).first();
119
+ const tagDxn = Obj.getDXN(tag).toString();
98
120
 
99
121
  const objects = range(n, () => {
100
- // TODO(wittjosiah): Move filter to another property.
101
- const contactsQuery = Query.select(Filter.type(DataType.Person, { jobTitle: 'investor' }));
102
- const organizationsQuery = contactsQuery.reference('organization');
103
- const notesQuery = organizationsQuery.targetOf(ResearchOn).source();
104
-
105
- const researchTrigger = Obj.make(FunctionTrigger, {
106
- function: Ref.make(serializeFunction(research)),
107
- spec: {
108
- kind: 'subscription',
109
- query: organizationsQuery.ast,
110
- },
111
- enabled: true,
112
- });
113
- space.db.add(researchTrigger);
122
+ const contactsQuery = Query.select(Filter.type(Person.Person)).select(Filter.tag(tagDxn));
123
+ const organizationsQuery = Query.select(Filter.type(Organization.Organization)).select(Filter.tag(tagDxn));
124
+ const notesQuery = Query.select(Filter.type(Markdown.Document)).select(Filter.tag(tagDxn));
125
+
126
+ space.db.add(
127
+ Trigger.make({
128
+ enabled: true,
129
+ spec: {
130
+ kind: 'timer',
131
+ cron: '* * * * *', // Every minute.
132
+ },
133
+ function: Ref.make(serializeFunction(GmailFunctions.Sync)),
134
+ input: {
135
+ mailbox: Ref.make(mailbox),
136
+ },
137
+ }),
138
+ );
139
+
140
+ space.db.add(
141
+ Trigger.make({
142
+ enabled: true,
143
+ // TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
144
+ spec: {
145
+ kind: 'queue',
146
+ queue: mailbox.queue.dxn.toString(),
147
+ },
148
+ function: Ref.make(serializeFunction(EntityExtractionFunctions.Extract)),
149
+ input: {
150
+ source: '{{event.item}}',
151
+ },
152
+ }),
153
+ );
154
+
155
+ const researchPrompt = space.db.add(
156
+ Prompt.make({
157
+ name: 'Research',
158
+ description: 'Research organization',
159
+ input: Schema.Struct({
160
+ org: Schema.Any,
161
+ }),
162
+ output: Schema.Any,
163
+
164
+ // TODO(dmaretskyi): This mocks research (returns pre-baked result), the actual research might take compute minutes.
165
+ // Remove the mock prompt to do the actual research.
166
+ instructions: trim`
167
+ Research the organization provided as input.
168
+ Create a research note for it at the end.
169
+ NOTE: Do mocked reseach (set mockSearch to true).
170
+ `,
171
+ blueprints: [Ref.make(ResearchBlueprint.make())],
172
+ }),
173
+ );
174
+
175
+ space.db.add(
176
+ Trigger.make({
177
+ enabled: true,
178
+ spec: {
179
+ kind: 'subscription',
180
+ query: {
181
+ ast: organizationsQuery.ast,
182
+ },
183
+ },
184
+ function: Ref.make(serializeFunction(AgentFunctions.Prompt)),
185
+ input: {
186
+ prompt: Ref.make(researchPrompt),
187
+ input: '{{event.subject}}',
188
+ },
189
+ }),
190
+ );
114
191
 
115
- const mailboxView = createView({
116
- name: 'Mailbox',
192
+ const mailboxView = View.make({
117
193
  query: Query.select(
118
- Filter.type(DataType.Message, { properties: { labels: Filter.contains('investor') } }),
194
+ Filter.type(Message.Message, {
195
+ properties: { labels: Filter.contains('investor') },
196
+ }),
119
197
  ).options({
120
198
  queues: [mailbox.queue.dxn.toString()],
121
199
  }),
122
- jsonSchema: Type.toJsonSchema(DataType.Message),
123
- presentation: Obj.make(DataType.Collection, { objects: [] }),
200
+ jsonSchema: Type.toJsonSchema(Message.Message),
124
201
  });
125
- const contactsView = createView({
126
- name: 'Contacts',
202
+ const contactsView = View.make({
127
203
  query: contactsQuery,
128
- jsonSchema: Type.toJsonSchema(DataType.Person),
129
- presentation: Obj.make(DataType.Collection, { objects: [] }),
204
+ jsonSchema: Type.toJsonSchema(Person.Person),
130
205
  });
131
- const organizationsView = createView({
132
- name: 'Organizations',
206
+ const organizationsView = View.make({
133
207
  query: organizationsQuery,
134
- jsonSchema: Type.toJsonSchema(DataType.Organization),
135
- presentation: Obj.make(DataType.Collection, { objects: [] }),
208
+ jsonSchema: Type.toJsonSchema(Organization.Organization),
136
209
  });
137
- const notesView = createView({
138
- name: 'Notes',
210
+ const notesView = View.make({
139
211
  query: notesQuery,
140
212
  jsonSchema: Type.toJsonSchema(Markdown.Document),
141
- presentation: Obj.make(DataType.Collection, { objects: [] }),
142
213
  });
143
214
 
144
215
  return space.db.add(
145
- DataType.makeProject({
216
+ Pipeline.make({
146
217
  name: 'Investor Research',
147
- collections: [mailboxView, contactsView, organizationsView, notesView].map((view) => Ref.make(view)),
218
+ columns: [
219
+ {
220
+ name: 'Mailbox',
221
+ view: Ref.make(mailboxView),
222
+ order: [],
223
+ },
224
+ {
225
+ name: 'Contacts',
226
+ view: Ref.make(contactsView),
227
+ order: [],
228
+ },
229
+ {
230
+ name: 'Organizations',
231
+ view: Ref.make(organizationsView),
232
+ order: [],
233
+ },
234
+ {
235
+ name: 'Notes',
236
+ view: Ref.make(notesView),
237
+ order: [],
238
+ },
239
+ ],
148
240
  }),
149
241
  );
150
242
  });
243
+
151
244
  cb?.(objects.flat());
152
245
  return objects.flat();
153
246
  },
@@ -158,7 +251,7 @@ export const generator = () => ({
158
251
  const objects = range(n, () => {
159
252
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
160
253
 
161
- let functionTrigger: FunctionTrigger | undefined;
254
+ let functionTrigger: Trigger.Trigger | undefined;
162
255
  canvasModel.builder.call((builder) => {
163
256
  const gpt = canvasModel.createNode(createGpt(position({ x: 0, y: -14 })));
164
257
  const triggerShape = createTrigger({
@@ -172,10 +265,24 @@ export const generator = () => ({
172
265
  const append = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
173
266
 
174
267
  builder
175
- .createEdge({ source: trigger.id, target: gpt.id, input: 'prompt', output: 'bodyText' })
268
+ .createEdge({
269
+ source: trigger.id,
270
+ target: gpt.id,
271
+ input: 'prompt',
272
+ output: 'bodyText',
273
+ })
176
274
  .createEdge({ source: gpt.id, target: text.id, output: 'text' })
177
- .createEdge({ source: queueId.id, target: append.id, input: 'id' })
178
- .createEdge({ source: gpt.id, target: append.id, output: 'messages', input: 'items' });
275
+ .createEdge({
276
+ source: queueId.id,
277
+ target: append.id,
278
+ input: 'id',
279
+ })
280
+ .createEdge({
281
+ source: gpt.id,
282
+ target: append.id,
283
+ output: 'messages',
284
+ input: 'items',
285
+ });
179
286
 
180
287
  functionTrigger = triggerShape.functionTrigger!.target!;
181
288
  });
@@ -198,7 +305,10 @@ export const generator = () => ({
198
305
  const { canvasModel, computeModel } = createQueueSinkPreset(
199
306
  space,
200
307
  'subscription',
201
- (triggerSpec) => (triggerSpec.query = Query.select(Filter.typename('dxos.org/type/Chess')).ast),
308
+ (triggerSpec) =>
309
+ (triggerSpec.query = {
310
+ ast: Query.select(Filter.typename('dxos.org/type/Chess')).ast as Obj.Mutable<QueryAST.Query>,
311
+ }),
202
312
  'type',
203
313
  );
204
314
  return addToSpace(PresetName.OBJECT_CHANGE_QUEUE, space, canvasModel, computeModel);
@@ -310,8 +420,17 @@ export const generator = () => ({
310
420
  builder
311
421
  .createEdge({ source: chat.id, target: gpt.id, input: 'prompt' })
312
422
  .createEdge({ source: gpt.id, target: text.id, output: 'text' })
313
- .createEdge({ source: queueId.id, target: append.id, input: 'id' })
314
- .createEdge({ source: gpt.id, target: append.id, output: 'messages', input: 'items' });
423
+ .createEdge({
424
+ source: queueId.id,
425
+ target: append.id,
426
+ input: 'id',
427
+ })
428
+ .createEdge({
429
+ source: gpt.id,
430
+ target: append.id,
431
+ output: 'messages',
432
+ input: 'items',
433
+ });
315
434
  });
316
435
 
317
436
  const computeModel = createComputeGraph(canvasModel);
@@ -435,9 +554,21 @@ export const generator = () => ({
435
554
  const view = canvasModel.createNode(createSurface(position({ x: 12, y: 0 })));
436
555
 
437
556
  builder
438
- .createEdge({ source: sourceCurrency.id, target: converter.id, input: 'from' })
439
- .createEdge({ source: targetCurrency.id, target: converter.id, input: 'to' })
440
- .createEdge({ source: converter.id, target: view.id, output: 'rate' });
557
+ .createEdge({
558
+ source: sourceCurrency.id,
559
+ target: converter.id,
560
+ input: 'from',
561
+ })
562
+ .createEdge({
563
+ source: targetCurrency.id,
564
+ target: converter.id,
565
+ input: 'to',
566
+ })
567
+ .createEdge({
568
+ source: converter.id,
569
+ target: view.id,
570
+ output: 'rate',
571
+ });
441
572
  });
442
573
 
443
574
  const computeModel = createComputeGraph(canvasModel);
@@ -455,7 +586,7 @@ export const generator = () => ({
455
586
  const objects = range(n, () => {
456
587
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
457
588
 
458
- let functionTrigger: FunctionTrigger | undefined;
589
+ let functionTrigger: Trigger.Trigger | undefined;
459
590
  canvasModel.builder.call((builder) => {
460
591
  const triggerShape = createTrigger({
461
592
  spaceId: space.id,
@@ -465,7 +596,10 @@ export const generator = () => ({
465
596
  const trigger = canvasModel.createNode(triggerShape);
466
597
  // DXOS dev-null channel.
467
598
  const channelId = canvasModel.createNode(
468
- createConstant({ value: '1088569858767212554', ...position({ x: -10, y: 0 }) }),
599
+ createConstant({
600
+ value: '1088569858767212554',
601
+ ...position({ x: -10, y: 0 }),
602
+ }),
469
603
  );
470
604
  const queueId = canvasModel.createNode(
471
605
  createConstant({
@@ -478,11 +612,31 @@ export const generator = () => ({
478
612
  const queue = canvasModel.createNode(createQueue(position({ x: 0, y: 12 })));
479
613
 
480
614
  builder
481
- .createEdge({ source: trigger.id, target: converter.id, input: 'tick' })
482
- .createEdge({ source: channelId.id, target: converter.id, input: 'channelId' })
483
- .createEdge({ source: queueId.id, target: converter.id, input: 'queueId' })
484
- .createEdge({ source: converter.id, target: view.id, output: 'newMessages' })
485
- .createEdge({ source: queueId.id, target: queue.id, input: 'input' });
615
+ .createEdge({
616
+ source: trigger.id,
617
+ target: converter.id,
618
+ input: 'tick',
619
+ })
620
+ .createEdge({
621
+ source: channelId.id,
622
+ target: converter.id,
623
+ input: 'channelId',
624
+ })
625
+ .createEdge({
626
+ source: queueId.id,
627
+ target: converter.id,
628
+ input: 'queueId',
629
+ })
630
+ .createEdge({
631
+ source: converter.id,
632
+ target: view.id,
633
+ output: 'newMessages',
634
+ })
635
+ .createEdge({
636
+ source: queueId.id,
637
+ target: queue.id,
638
+ input: 'input',
639
+ });
486
640
 
487
641
  functionTrigger = triggerShape.functionTrigger!.target!;
488
642
  });
@@ -549,10 +703,10 @@ export const generator = () => ({
549
703
  ] as [PresetName, ObjectGenerator<any>][],
550
704
  });
551
705
 
552
- const createQueueSinkPreset = <SpecType extends TriggerKind>(
706
+ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
553
707
  space: Space,
554
708
  triggerKind: SpecType,
555
- initSpec: (spec: Extract<TriggerType, { kind: SpecType }>) => void,
709
+ initSpec: (spec: Obj.Mutable<Extract<Trigger.Spec, { kind: SpecType }>>) => void,
556
710
  triggerOutputName: string,
557
711
  ) => {
558
712
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
@@ -564,7 +718,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
564
718
  }),
565
719
  );
566
720
 
567
- let functionTrigger: FunctionTrigger | undefined;
721
+ let functionTrigger: Trigger.Trigger | undefined;
568
722
  canvasModel.builder.call((builder) => {
569
723
  const triggerShape = createTrigger({
570
724
  spaceId: space.id,
@@ -585,7 +739,12 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
585
739
  builder
586
740
  .createEdge({ source: queueId.id, target: append.id, input: 'id' })
587
741
  .createEdge({ source: template.id, target: append.id, input: 'items' })
588
- .createEdge({ source: trigger.id, target: template.id, output: triggerOutputName, input: 'type' })
742
+ .createEdge({
743
+ source: trigger.id,
744
+ target: template.id,
745
+ output: triggerOutputName,
746
+ input: 'type',
747
+ })
589
748
  .createEdge({
590
749
  source: random.id,
591
750
  target: template.id,
@@ -595,13 +754,16 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
595
754
  functionTrigger = triggerShape.functionTrigger!.target!;
596
755
  const triggerSpec = functionTrigger.spec;
597
756
  invariant(triggerSpec && triggerSpec.kind === triggerKind, 'No trigger spec.');
598
- initSpec(triggerSpec as any);
757
+ Obj.change(functionTrigger, (ft) => {
758
+ initSpec(ft.spec as any);
759
+ });
599
760
  });
600
761
 
601
762
  const computeModel = createComputeGraph(canvasModel);
602
763
 
603
764
  const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
604
765
  invariant(templateComputeNode, 'Template compute node was not created.');
766
+ // NOTE: These are plain object mutations during model construction, not ECHO object mutations.
605
767
  templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
606
768
  templateComputeNode.inputSchema = Type.toJsonSchema(Schema.Struct({ type: Schema.String, changeId: Schema.String }));
607
769
  attachTrigger(functionTrigger, computeModel);
@@ -611,7 +773,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
611
773
 
612
774
  const addToSpace = (name: string, space: Space, canvas: CanvasGraphModel, compute: ComputeGraphModel) => {
613
775
  return space.db.add(
614
- Obj.make(CanvasBoardType, {
776
+ Obj.make(CanvasBoard.CanvasBoard, {
615
777
  name,
616
778
  computeGraph: Ref.make(compute.root),
617
779
  layout: canvas.graph,
@@ -639,17 +801,27 @@ const setupQueue = (
639
801
  return { queue, queueId };
640
802
  };
641
803
 
642
- const attachTrigger = (functionTrigger: FunctionTrigger | undefined, computeModel: ComputeGraphModel) => {
804
+ const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
643
805
  invariant(functionTrigger);
644
- functionTrigger.function = Ref.make(computeModel.root);
645
806
  const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
646
- functionTrigger.inputNodeId = inputNode.id;
807
+ Obj.change(functionTrigger, (t) => {
808
+ t.function = Ref.make(computeModel.root);
809
+ t.inputNodeId = inputNode.id;
810
+ });
647
811
  };
648
812
 
649
- type RawPositionInput = { centerX: number; centerY: number; width: number; height: number };
813
+ type RawPositionInput = {
814
+ centerX: number;
815
+ centerY: number;
816
+ width: number;
817
+ height: number;
818
+ };
650
819
 
651
820
  const rawPosition = (args: RawPositionInput) => {
652
- return { center: { x: args.centerX, y: args.centerY }, size: { width: args.width, height: args.height } };
821
+ return {
822
+ center: { x: args.centerX, y: args.centerY },
823
+ size: { width: args.width, height: args.height },
824
+ };
653
825
  };
654
826
 
655
827
  const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
@@ -657,7 +829,10 @@ const position = (rect: { x: number; y: number; width?: number; height?: number
657
829
  const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
658
830
  const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
659
831
  if (width && height) {
660
- return { center: { x, y }, size: width && height ? { width, height } : undefined };
832
+ return {
833
+ center: { x, y },
834
+ size: width && height ? { width, height } : undefined,
835
+ };
661
836
  } else {
662
837
  return { center: { x, y } };
663
838
  }
@@ -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