@dxos/plugin-debug 0.8.4-main.406dc2a → 0.8.4-main.52d7546f51

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 (117) 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-VMWHGAJZ.mjs → SpaceGenerator-W3LJORYT.mjs} +259 -266
  6. package/dist/lib/browser/SpaceGenerator-W3LJORYT.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-SRV2AIGJ.mjs → chunk-4UFQXPP7.mjs} +11 -1
  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 -41
  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-FMVC5GPV.mjs +758 -0
  19. package/dist/lib/browser/react-surface-FMVC5GPV.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.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 +77 -70
  66. package/src/DebugPlugin.tsx +17 -31
  67. package/src/capabilities/app-graph-builder/app-graph-builder.ts +421 -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 +411 -0
  74. package/src/capabilities/settings/index.ts +7 -0
  75. package/src/capabilities/settings/settings.ts +31 -0
  76. package/src/components/DebugGraph.tsx +4 -3
  77. package/src/components/DebugObjectPanel.tsx +4 -5
  78. package/src/components/DebugSettings.tsx +59 -33
  79. package/src/components/DevtoolsOverviewContainer.tsx +2 -2
  80. package/src/components/SpaceGenerator/ObjectGenerator.tsx +25 -32
  81. package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
  82. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +8 -6
  83. package/src/components/SpaceGenerator/SpaceGenerator.tsx +35 -31
  84. package/src/components/SpaceGenerator/presets.ts +235 -120
  85. package/src/components/Wireframe.tsx +4 -5
  86. package/src/components/index.ts +4 -1
  87. package/src/meta.ts +7 -4
  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-VMWHGAJZ.mjs.map +0 -7
  95. package/dist/lib/browser/app-graph-builder-I4IHBKKN.mjs +0 -588
  96. package/dist/lib/browser/app-graph-builder-I4IHBKKN.mjs.map +0 -7
  97. package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +0 -7
  98. package/dist/lib/browser/chunk-SVCKCXCL.mjs +0 -16
  99. package/dist/lib/browser/chunk-SVCKCXCL.mjs.map +0 -7
  100. package/dist/lib/browser/react-context-QLZE7VSQ.mjs +0 -16
  101. package/dist/lib/browser/react-context-QLZE7VSQ.mjs.map +0 -7
  102. package/dist/lib/browser/react-surface-GFORPA3A.mjs +0 -772
  103. package/dist/lib/browser/react-surface-GFORPA3A.mjs.map +0 -7
  104. package/dist/lib/browser/settings-EBVICEEW.mjs +0 -22
  105. package/dist/lib/browser/settings-EBVICEEW.mjs.map +0 -7
  106. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  107. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  108. package/dist/types/src/capabilities/react-context.d.ts +0 -8
  109. package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
  110. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  111. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  112. package/dist/types/src/capabilities/settings.d.ts +0 -4
  113. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  114. package/src/capabilities/app-graph-builder.ts +0 -431
  115. package/src/capabilities/react-context.tsx +0 -16
  116. package/src/capabilities/react-surface.tsx +0 -399
  117. package/src/capabilities/settings.ts +0 -19
@@ -4,13 +4,13 @@
4
4
 
5
5
  import * as Schema from 'effect/Schema';
6
6
 
7
- import { RESEARCH_BLUEPRINT, agent, entityExtraction } 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, Tag, Type } from '@dxos/echo';
11
- 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';
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';
@@ -29,15 +29,10 @@ import {
29
29
  createText,
30
30
  createTrigger,
31
31
  } from '@dxos/react-ui-canvas-compute';
32
- import {
33
- CanvasBoardType,
34
- CanvasGraphModel,
35
- pointMultiply,
36
- pointsToRect,
37
- rectToPoints,
38
- } from '@dxos/react-ui-canvas-editor';
39
- import { DataType, createView } from '@dxos/schema';
40
- 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';
41
36
 
42
37
  import { type ObjectGenerator } from './ObjectGenerator';
43
38
 
@@ -49,47 +44,66 @@ export enum PresetName {
49
44
  CHAT_GPT = 'chat-gpt-text',
50
45
  // EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
51
46
  OBJECT_CHANGE_QUEUE = 'objectChange-queue',
52
- FOREX_FUNCTION_CALL = 'forex-function-call',
53
47
  TIMER_TICK_QUEUE = 'timerTick-queue',
48
+ FOREX_FUNCTION_CALL = 'forex-function-call',
54
49
  DISCORD_MESSAGES = 'discord-messages',
55
50
  // KANBAN_QUEUE = 'kanban-queue',
56
51
  }
57
52
 
58
53
  export const generator = () => ({
59
- schemas: [CanvasBoardType, FunctionTrigger],
54
+ schemas: [CanvasBoard.CanvasBoard, Trigger.Trigger] as any[],
60
55
  types: Object.values(PresetName).map((name) => ({ typename: name })),
61
56
  items: [
62
57
  [
63
58
  PresetName.DXOS_TEAM,
64
59
  async (space, n, cb) => {
65
60
  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
-
61
+ const org = space.db.add(
62
+ Obj.make(Organization.Organization, {
63
+ name: 'DXOS',
64
+ website: 'https://dxos.org',
65
+ }),
66
+ );
71
67
  const doc = space.db.add(
72
- Markdown.makeDocument({
68
+ Markdown.make({
73
69
  name: 'DXOS Research',
74
70
  content: 'DXOS builds Composer, an open-source AI-powered malleable application.',
75
71
  }),
76
72
  );
77
- Obj.getMeta(doc).tags = [tagDxn];
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
+
78
80
  // space.db.add(
79
- // Relation.make(ResearchOn, {
81
+ // Relation.make(HasSubject, {
80
82
  // [Relation.Source]: doc,
81
83
  // [Relation.Target]: org,
82
84
  // completedAt: new Date().toISOString(),
83
85
  // }),
84
86
  // );
85
87
 
88
+ space.db.add(Obj.make(Person.Person, { fullName: 'Rich', organization: Ref.make(org) }, { tags: [tagDxn] }));
89
+ space.db.add(
90
+ Obj.make(Person.Person, {
91
+ fullName: 'Josiah',
92
+ organization: Ref.make(org),
93
+ }),
94
+ );
95
+ space.db.add(
96
+ Obj.make(Person.Person, {
97
+ fullName: 'Dima',
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: 'Mykola',
104
+ organization: Ref.make(org),
105
+ }),
88
106
  );
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
107
 
94
108
  return doc;
95
109
  });
@@ -105,36 +119,38 @@ export const generator = () => ({
105
119
  const tagDxn = Obj.getDXN(tag).toString();
106
120
 
107
121
  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));
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));
110
124
  const notesQuery = Query.select(Filter.type(Markdown.Document)).select(Filter.tag(tagDxn));
111
125
 
112
- const emailSyncTrigger = Obj.make(FunctionTrigger, {
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 = Obj.make(FunctionTrigger, {
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)),
133
- input: {
134
- source: '{{event.item}}',
135
- },
136
- });
137
- space.db.add(contactExtractionTrigger);
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(gmail.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(EntityExtraction.extract)),
149
+ input: {
150
+ source: '{{event.item}}',
151
+ },
152
+ }),
153
+ );
138
154
 
139
155
  const researchPrompt = space.db.add(
140
156
  Prompt.make({
@@ -147,64 +163,84 @@ export const generator = () => ({
147
163
 
148
164
  // TODO(dmaretskyi): This mocks research (returns pre-baked result), the actual research might take compute minutes.
149
165
  // Remove the mock prompt to do the actual research.
150
- instructions:
151
- 'Research the organization provided as input. Create a research note for it at the end. NOTE: Do mocked reseach (set mockSearch to true).',
152
- blueprints: [Ref.make(RESEARCH_BLUEPRINT)],
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)],
153
172
  }),
154
173
  );
155
174
 
156
- const researchTrigger = Obj.make(FunctionTrigger, {
157
- enabled: true,
158
- spec: {
159
- kind: 'subscription',
160
- query: {
161
- ast: organizationsQuery.ast,
175
+ space.db.add(
176
+ Trigger.make({
177
+ enabled: true,
178
+ spec: {
179
+ kind: 'subscription',
180
+ query: {
181
+ ast: organizationsQuery.ast,
182
+ },
162
183
  },
163
- },
164
- function: Ref.make(serializeFunction(agent)),
165
- input: {
166
- prompt: Ref.make(researchPrompt),
167
- input: '{{event.subject}}',
168
- },
169
- });
170
- space.db.add(researchTrigger);
184
+ function: Ref.make(serializeFunction(Agent.prompt)),
185
+ input: {
186
+ prompt: Ref.make(researchPrompt),
187
+ input: '{{event.subject}}',
188
+ },
189
+ }),
190
+ );
171
191
 
172
- const mailboxView = createView({
173
- name: 'Mailbox',
192
+ const mailboxView = View.make({
174
193
  query: Query.select(
175
- Filter.type(DataType.Message, { properties: { labels: Filter.contains('investor') } }),
194
+ Filter.type(Message.Message, {
195
+ properties: { labels: Filter.contains('investor') },
196
+ }),
176
197
  ).options({
177
198
  queues: [mailbox.queue.dxn.toString()],
178
199
  }),
179
- jsonSchema: Type.toJsonSchema(DataType.Message),
180
- presentation: Obj.make(DataType.Collection, { objects: [] }),
200
+ jsonSchema: Type.toJsonSchema(Message.Message),
181
201
  });
182
- const contactsView = createView({
183
- name: 'Contacts',
202
+ const contactsView = View.make({
184
203
  query: contactsQuery,
185
- jsonSchema: Type.toJsonSchema(DataType.Person),
186
- presentation: Obj.make(DataType.Collection, { objects: [] }),
204
+ jsonSchema: Type.toJsonSchema(Person.Person),
187
205
  });
188
- const organizationsView = createView({
189
- name: 'Organizations',
206
+ const organizationsView = View.make({
190
207
  query: organizationsQuery,
191
- jsonSchema: Type.toJsonSchema(DataType.Organization),
192
- presentation: Obj.make(DataType.Collection, { objects: [] }),
208
+ jsonSchema: Type.toJsonSchema(Organization.Organization),
193
209
  });
194
- const notesView = createView({
195
- name: 'Notes',
210
+ const notesView = View.make({
196
211
  query: notesQuery,
197
212
  jsonSchema: Type.toJsonSchema(Markdown.Document),
198
- presentation: Obj.make(DataType.Collection, { objects: [] }),
199
213
  });
200
214
 
201
215
  return space.db.add(
202
- DataType.makeProject({
216
+ Pipeline.make({
203
217
  name: 'Investor Research',
204
- 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
+ ],
205
240
  }),
206
241
  );
207
242
  });
243
+
208
244
  cb?.(objects.flat());
209
245
  return objects.flat();
210
246
  },
@@ -215,7 +251,7 @@ export const generator = () => ({
215
251
  const objects = range(n, () => {
216
252
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
217
253
 
218
- let functionTrigger: FunctionTrigger | undefined;
254
+ let functionTrigger: Trigger.Trigger | undefined;
219
255
  canvasModel.builder.call((builder) => {
220
256
  const gpt = canvasModel.createNode(createGpt(position({ x: 0, y: -14 })));
221
257
  const triggerShape = createTrigger({
@@ -229,10 +265,24 @@ export const generator = () => ({
229
265
  const append = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
230
266
 
231
267
  builder
232
- .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
+ })
233
274
  .createEdge({ source: gpt.id, target: text.id, output: 'text' })
234
- .createEdge({ source: queueId.id, target: append.id, input: 'id' })
235
- .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
+ });
236
286
 
237
287
  functionTrigger = triggerShape.functionTrigger!.target!;
238
288
  });
@@ -257,7 +307,7 @@ export const generator = () => ({
257
307
  'subscription',
258
308
  (triggerSpec) =>
259
309
  (triggerSpec.query = {
260
- ast: Query.select(Filter.typename('dxos.org/type/Chess')).ast,
310
+ ast: Query.select(Filter.typename('dxos.org/type/Chess')).ast as Obj.Mutable<QueryAST.Query>,
261
311
  }),
262
312
  'type',
263
313
  );
@@ -370,8 +420,17 @@ export const generator = () => ({
370
420
  builder
371
421
  .createEdge({ source: chat.id, target: gpt.id, input: 'prompt' })
372
422
  .createEdge({ source: gpt.id, target: text.id, output: 'text' })
373
- .createEdge({ source: queueId.id, target: append.id, input: 'id' })
374
- .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
+ });
375
434
  });
376
435
 
377
436
  const computeModel = createComputeGraph(canvasModel);
@@ -495,9 +554,21 @@ export const generator = () => ({
495
554
  const view = canvasModel.createNode(createSurface(position({ x: 12, y: 0 })));
496
555
 
497
556
  builder
498
- .createEdge({ source: sourceCurrency.id, target: converter.id, input: 'from' })
499
- .createEdge({ source: targetCurrency.id, target: converter.id, input: 'to' })
500
- .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
+ });
501
572
  });
502
573
 
503
574
  const computeModel = createComputeGraph(canvasModel);
@@ -515,7 +586,7 @@ export const generator = () => ({
515
586
  const objects = range(n, () => {
516
587
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
517
588
 
518
- let functionTrigger: FunctionTrigger | undefined;
589
+ let functionTrigger: Trigger.Trigger | undefined;
519
590
  canvasModel.builder.call((builder) => {
520
591
  const triggerShape = createTrigger({
521
592
  spaceId: space.id,
@@ -525,7 +596,10 @@ export const generator = () => ({
525
596
  const trigger = canvasModel.createNode(triggerShape);
526
597
  // DXOS dev-null channel.
527
598
  const channelId = canvasModel.createNode(
528
- createConstant({ value: '1088569858767212554', ...position({ x: -10, y: 0 }) }),
599
+ createConstant({
600
+ value: '1088569858767212554',
601
+ ...position({ x: -10, y: 0 }),
602
+ }),
529
603
  );
530
604
  const queueId = canvasModel.createNode(
531
605
  createConstant({
@@ -538,11 +612,31 @@ export const generator = () => ({
538
612
  const queue = canvasModel.createNode(createQueue(position({ x: 0, y: 12 })));
539
613
 
540
614
  builder
541
- .createEdge({ source: trigger.id, target: converter.id, input: 'tick' })
542
- .createEdge({ source: channelId.id, target: converter.id, input: 'channelId' })
543
- .createEdge({ source: queueId.id, target: converter.id, input: 'queueId' })
544
- .createEdge({ source: converter.id, target: view.id, output: 'newMessages' })
545
- .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
+ });
546
640
 
547
641
  functionTrigger = triggerShape.functionTrigger!.target!;
548
642
  });
@@ -609,10 +703,10 @@ export const generator = () => ({
609
703
  ] as [PresetName, ObjectGenerator<any>][],
610
704
  });
611
705
 
612
- const createQueueSinkPreset = <SpecType extends TriggerKind>(
706
+ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
613
707
  space: Space,
614
708
  triggerKind: SpecType,
615
- initSpec: (spec: Extract<TriggerType, { kind: SpecType }>) => void,
709
+ initSpec: (spec: Obj.Mutable<Extract<Trigger.Spec, { kind: SpecType }>>) => void,
616
710
  triggerOutputName: string,
617
711
  ) => {
618
712
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
@@ -624,7 +718,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
624
718
  }),
625
719
  );
626
720
 
627
- let functionTrigger: FunctionTrigger | undefined;
721
+ let functionTrigger: Trigger.Trigger | undefined;
628
722
  canvasModel.builder.call((builder) => {
629
723
  const triggerShape = createTrigger({
630
724
  spaceId: space.id,
@@ -645,7 +739,12 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
645
739
  builder
646
740
  .createEdge({ source: queueId.id, target: append.id, input: 'id' })
647
741
  .createEdge({ source: template.id, target: append.id, input: 'items' })
648
- .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
+ })
649
748
  .createEdge({
650
749
  source: random.id,
651
750
  target: template.id,
@@ -655,13 +754,16 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
655
754
  functionTrigger = triggerShape.functionTrigger!.target!;
656
755
  const triggerSpec = functionTrigger.spec;
657
756
  invariant(triggerSpec && triggerSpec.kind === triggerKind, 'No trigger spec.');
658
- initSpec(triggerSpec as any);
757
+ Obj.change(functionTrigger, (ft) => {
758
+ initSpec(ft.spec as any);
759
+ });
659
760
  });
660
761
 
661
762
  const computeModel = createComputeGraph(canvasModel);
662
763
 
663
764
  const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
664
765
  invariant(templateComputeNode, 'Template compute node was not created.');
766
+ // NOTE: These are plain object mutations during model construction, not ECHO object mutations.
665
767
  templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
666
768
  templateComputeNode.inputSchema = Type.toJsonSchema(Schema.Struct({ type: Schema.String, changeId: Schema.String }));
667
769
  attachTrigger(functionTrigger, computeModel);
@@ -671,7 +773,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
671
773
 
672
774
  const addToSpace = (name: string, space: Space, canvas: CanvasGraphModel, compute: ComputeGraphModel) => {
673
775
  return space.db.add(
674
- Obj.make(CanvasBoardType, {
776
+ Obj.make(CanvasBoard.CanvasBoard, {
675
777
  name,
676
778
  computeGraph: Ref.make(compute.root),
677
779
  layout: canvas.graph,
@@ -699,17 +801,27 @@ const setupQueue = (
699
801
  return { queue, queueId };
700
802
  };
701
803
 
702
- const attachTrigger = (functionTrigger: FunctionTrigger | undefined, computeModel: ComputeGraphModel) => {
804
+ const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
703
805
  invariant(functionTrigger);
704
- functionTrigger.function = Ref.make(computeModel.root);
705
806
  const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
706
- functionTrigger.inputNodeId = inputNode.id;
807
+ Obj.change(functionTrigger, (t) => {
808
+ t.function = Ref.make(computeModel.root);
809
+ t.inputNodeId = inputNode.id;
810
+ });
707
811
  };
708
812
 
709
- 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
+ };
710
819
 
711
820
  const rawPosition = (args: RawPositionInput) => {
712
- 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
+ };
713
825
  };
714
826
 
715
827
  const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
@@ -717,7 +829,10 @@ const position = (rect: { x: number; y: number; width?: number; height?: number
717
829
  const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
718
830
  const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
719
831
  if (width && height) {
720
- return { center: { x, y }, size: width && height ? { width, height } : undefined };
832
+ return {
833
+ center: { x, y },
834
+ size: width && height ? { width, height } : undefined,
835
+ };
721
836
  } else {
722
837
  return { center: { x, y } };
723
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,13 +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 meta: PluginMeta = {
8
+ export const meta: Plugin.Meta = {
8
9
  id: 'dxos.org/plugin/debug',
9
10
  name: 'Debug',
10
- description:
11
- '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
+ `,
12
15
  icon: 'ph--bug--regular',
13
16
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-debug',
14
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 { 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';