@dxos/plugin-debug 0.8.4-main.2e9d522 → 0.8.4-main.3c1ae3b

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 (94) hide show
  1. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +20 -0
  2. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +7 -0
  3. package/dist/lib/browser/{DevtoolsOverviewContainer-EPD6EWT5.mjs → DevtoolsOverviewContainer-JXVZVPHN.mjs} +2 -2
  4. package/dist/lib/browser/{DevtoolsOverviewContainer-EPD6EWT5.mjs.map → DevtoolsOverviewContainer-JXVZVPHN.mjs.map} +1 -1
  5. package/dist/lib/browser/{SpaceGenerator-AG3XGNMV.mjs → SpaceGenerator-GYCIEMMO.mjs} +274 -99
  6. package/dist/lib/browser/SpaceGenerator-GYCIEMMO.mjs.map +7 -0
  7. package/dist/lib/browser/{app-graph-builder-SQXFD2BL.mjs → app-graph-builder-CRH2HJKT.mjs} +77 -86
  8. package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-AJA6RYN3.mjs → chunk-SRV2AIGJ.mjs} +2 -2
  10. package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-WZFZ4ESO.mjs +20 -0
  12. package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +13 -13
  14. package/dist/lib/browser/index.mjs.map +3 -3
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/{react-context-NVAGLAJD.mjs → react-context-P2YDWEWI.mjs} +6 -6
  17. package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +7 -0
  18. package/dist/lib/browser/{react-surface-3GD2OWCA.mjs → react-surface-RFG63TTF.mjs} +104 -98
  19. package/dist/lib/browser/react-surface-RFG63TTF.mjs.map +7 -0
  20. package/dist/lib/browser/{settings-LSSWLM5I.mjs → settings-SQXR3OAH.mjs} +5 -5
  21. package/dist/lib/browser/{settings-LSSWLM5I.mjs.map → settings-SQXR3OAH.mjs.map} +1 -1
  22. package/dist/types/src/DebugPlugin.d.ts +1 -1
  23. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  24. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
  25. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  26. package/dist/types/src/capabilities/index.d.ts +5 -5
  27. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  28. package/dist/types/src/capabilities/react-context.d.ts +2 -2
  29. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  30. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  31. package/dist/types/src/capabilities/settings.d.ts +1 -1
  32. package/dist/types/src/components/DebugGraph.d.ts +8 -0
  33. package/dist/types/src/components/DebugGraph.d.ts.map +1 -0
  34. package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
  35. package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
  36. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +4 -4
  37. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  38. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +1 -1
  39. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  40. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +13 -4
  41. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
  42. package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
  43. package/dist/types/src/components/SpaceGenerator/presets.d.ts +51 -4
  44. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  45. package/dist/types/src/components/Wireframe.d.ts +2 -2
  46. package/dist/types/src/components/Wireframe.d.ts.map +1 -1
  47. package/dist/types/src/components/index.d.ts +2 -1
  48. package/dist/types/src/components/index.d.ts.map +1 -1
  49. package/dist/types/src/meta.d.ts +0 -1
  50. package/dist/types/src/meta.d.ts.map +1 -1
  51. package/dist/types/src/translations.d.ts +3 -1
  52. package/dist/types/src/translations.d.ts.map +1 -1
  53. package/dist/types/src/types.d.ts +1 -1
  54. package/dist/types/src/types.d.ts.map +1 -1
  55. package/dist/types/tsconfig.tsbuildinfo +1 -1
  56. package/package.json +68 -64
  57. package/src/DebugPlugin.tsx +6 -7
  58. package/src/capabilities/app-graph-builder.ts +68 -94
  59. package/src/capabilities/react-context.tsx +2 -2
  60. package/src/capabilities/react-surface.tsx +77 -56
  61. package/src/components/DebugGraph.tsx +14 -0
  62. package/src/components/DebugObjectPanel.tsx +2 -4
  63. package/src/components/DebugSettings.tsx +102 -73
  64. package/src/components/DebugStatus.tsx +2 -2
  65. package/src/components/DevtoolsOverviewContainer.tsx +1 -1
  66. package/src/components/SpaceGenerator/ObjectGenerator.tsx +29 -36
  67. package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
  68. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +11 -11
  69. package/src/components/SpaceGenerator/SpaceGenerator.tsx +20 -16
  70. package/src/components/SpaceGenerator/draw-util.ts +5 -5
  71. package/src/components/SpaceGenerator/presets.ts +200 -21
  72. package/src/components/Wireframe.tsx +5 -5
  73. package/src/components/index.ts +1 -1
  74. package/src/meta.ts +6 -5
  75. package/src/translations.ts +3 -1
  76. package/src/types.ts +1 -1
  77. package/dist/lib/browser/DebugApp-ZDL4CPY5.mjs +0 -228
  78. package/dist/lib/browser/DebugApp-ZDL4CPY5.mjs.map +0 -7
  79. package/dist/lib/browser/SpaceGenerator-AG3XGNMV.mjs.map +0 -7
  80. package/dist/lib/browser/app-graph-builder-SQXFD2BL.mjs.map +0 -7
  81. package/dist/lib/browser/chunk-5XPIRNQS.mjs +0 -18
  82. package/dist/lib/browser/chunk-5XPIRNQS.mjs.map +0 -7
  83. package/dist/lib/browser/chunk-AJA6RYN3.mjs.map +0 -7
  84. package/dist/lib/browser/react-context-NVAGLAJD.mjs.map +0 -7
  85. package/dist/lib/browser/react-surface-3GD2OWCA.mjs.map +0 -7
  86. package/dist/types/src/components/DebugApp/DebugApp.d.ts +0 -6
  87. package/dist/types/src/components/DebugApp/DebugApp.d.ts.map +0 -1
  88. package/dist/types/src/components/DebugApp/Tree.d.ts +0 -18
  89. package/dist/types/src/components/DebugApp/Tree.d.ts.map +0 -1
  90. package/dist/types/src/components/DebugApp/index.d.ts +0 -3
  91. package/dist/types/src/components/DebugApp/index.d.ts.map +0 -1
  92. package/src/components/DebugApp/DebugApp.tsx +0 -84
  93. package/src/components/DebugApp/Tree.tsx +0 -103
  94. package/src/components/DebugApp/index.ts +0 -7
@@ -2,12 +2,17 @@
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 { Agent, EntityExtraction, ResearchBlueprint } from '@dxos/assistant-toolkit';
8
+ import { Prompt } from '@dxos/blueprints';
7
9
  import { type ComputeGraphModel, NODE_INPUT } from '@dxos/conductor';
8
- import { DXN, Key, Obj, Ref, Type } from '@dxos/echo';
9
- import { FunctionTrigger, TriggerKind, type TriggerType } from '@dxos/functions';
10
+ import { DXN, Filter, Key, Obj, Query, Ref, Tag, Type } from '@dxos/echo';
11
+ import { Trigger, serializeFunction } from '@dxos/functions';
10
12
  import { invariant } from '@dxos/invariant';
13
+ import { gmail } from '@dxos/plugin-inbox';
14
+ import { Mailbox } from '@dxos/plugin-inbox/types';
15
+ import { Markdown } from '@dxos/plugin-markdown/types';
11
16
  import { type Space } from '@dxos/react-client/echo';
12
17
  import {
13
18
  type ComputeShape,
@@ -18,8 +23,8 @@ import {
18
23
  createFunction,
19
24
  createGpt,
20
25
  createQueue,
21
- createSurface,
22
26
  createRandom,
27
+ createSurface,
23
28
  createTemplate,
24
29
  createText,
25
30
  createTrigger,
@@ -31,38 +36,209 @@ import {
31
36
  pointsToRect,
32
37
  rectToPoints,
33
38
  } from '@dxos/react-ui-canvas-editor';
34
- 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';
35
42
 
36
43
  import { type ObjectGenerator } from './ObjectGenerator';
37
44
 
38
45
  export enum PresetName {
46
+ DXOS_TEAM = 'dxos-team',
47
+ ORG_RESEARCH_PROJECT = 'org-research-project',
39
48
  // EMAIL_TABLE = 'email-table',
40
49
  GPT_QUEUE = 'webhook-gpt-queue',
41
50
  CHAT_GPT = 'chat-gpt-text',
42
51
  // EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
43
52
  OBJECT_CHANGE_QUEUE = 'objectChange-queue',
44
- FOREX_FUNCTION_CALL = 'forex-function-call',
45
53
  TIMER_TICK_QUEUE = 'timerTick-queue',
54
+ FOREX_FUNCTION_CALL = 'forex-function-call',
46
55
  DISCORD_MESSAGES = 'discord-messages',
47
56
  // KANBAN_QUEUE = 'kanban-queue',
48
57
  }
49
58
 
50
59
  export const generator = () => ({
51
- schemas: [CanvasBoardType, FunctionTrigger],
60
+ schemas: [CanvasBoardType, Trigger.Trigger],
52
61
  types: Object.values(PresetName).map((name) => ({ typename: name })),
53
62
  items: [
63
+ [
64
+ PresetName.DXOS_TEAM,
65
+ async (space, n, cb) => {
66
+ const objects = range(n, () => {
67
+ const org = space.db.add(Obj.make(Organization.Organization, { name: 'DXOS', website: 'https://dxos.org' }));
68
+ const doc = space.db.add(
69
+ Markdown.make({
70
+ name: 'DXOS Research',
71
+ content: 'DXOS builds Composer, an open-source AI-powered malleable application.',
72
+ }),
73
+ );
74
+
75
+ const tag = space.db.add(Tag.make({ label: 'Investor' }));
76
+ const tagDxn = Obj.getDXN(tag).toString();
77
+ Obj.getMeta(doc).tags = [tagDxn];
78
+
79
+ // space.db.add(
80
+ // Relation.make(HasSubject, {
81
+ // [Relation.Source]: doc,
82
+ // [Relation.Target]: org,
83
+ // completedAt: new Date().toISOString(),
84
+ // }),
85
+ // );
86
+
87
+ space.db.add(Obj.make(Person.Person, { fullName: 'Rich', organization: Ref.make(org) }, { tags: [tagDxn] }));
88
+ space.db.add(Obj.make(Person.Person, { fullName: 'Josiah', organization: Ref.make(org) }));
89
+ space.db.add(Obj.make(Person.Person, { fullName: 'Dima', organization: Ref.make(org) }));
90
+ space.db.add(Obj.make(Person.Person, { fullName: 'Mykola', organization: Ref.make(org) }));
91
+
92
+ return doc;
93
+ });
94
+ cb?.(objects);
95
+ return objects;
96
+ },
97
+ ],
98
+ [
99
+ PresetName.ORG_RESEARCH_PROJECT,
100
+ async (space, n, cb) => {
101
+ const mailbox = await space.db.query(Filter.type(Mailbox.Mailbox)).first();
102
+ const tag = await space.db.query(Filter.type(Tag.Tag, { label: 'Investor' })).first();
103
+ const tagDxn = Obj.getDXN(tag).toString();
104
+
105
+ const objects = range(n, () => {
106
+ const contactsQuery = Query.select(Filter.type(Person.Person)).select(Filter.tag(tagDxn));
107
+ const organizationsQuery = Query.select(Filter.type(Organization.Organization)).select(Filter.tag(tagDxn));
108
+ const notesQuery = Query.select(Filter.type(Markdown.Document)).select(Filter.tag(tagDxn));
109
+
110
+ space.db.add(
111
+ Trigger.make({
112
+ enabled: true,
113
+ spec: {
114
+ kind: 'timer',
115
+ cron: '* * * * *', // Every minute.
116
+ },
117
+ function: Ref.make(serializeFunction(gmail.sync)),
118
+ input: {
119
+ mailboxId: Obj.getDXN(mailbox).toString(),
120
+ },
121
+ }),
122
+ );
123
+
124
+ space.db.add(
125
+ Trigger.make({
126
+ enabled: true,
127
+ // TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
128
+ spec: {
129
+ kind: 'queue',
130
+ queue: mailbox.queue.dxn.toString(),
131
+ },
132
+ function: Ref.make(serializeFunction(EntityExtraction.extract)),
133
+ input: {
134
+ source: '{{event.item}}',
135
+ },
136
+ }),
137
+ );
138
+
139
+ const researchPrompt = space.db.add(
140
+ Prompt.make({
141
+ name: 'Research',
142
+ description: 'Research organization',
143
+ input: Schema.Struct({
144
+ org: Schema.Any,
145
+ }),
146
+ output: Schema.Any,
147
+
148
+ // TODO(dmaretskyi): This mocks research (returns pre-baked result), the actual research might take compute minutes.
149
+ // Remove the mock prompt to do the actual research.
150
+ instructions: trim`
151
+ Research the organization provided as input.
152
+ Create a research note for it at the end.
153
+ NOTE: Do mocked reseach (set mockSearch to true).
154
+ `,
155
+ blueprints: [Ref.make(ResearchBlueprint)],
156
+ }),
157
+ );
158
+
159
+ space.db.add(
160
+ Trigger.make({
161
+ enabled: true,
162
+ spec: {
163
+ kind: 'subscription',
164
+ query: {
165
+ ast: organizationsQuery.ast,
166
+ },
167
+ },
168
+ function: Ref.make(serializeFunction(Agent.prompt)),
169
+ input: {
170
+ prompt: Ref.make(researchPrompt),
171
+ input: '{{event.subject}}',
172
+ },
173
+ }),
174
+ );
175
+
176
+ const mailboxView = View.make({
177
+ query: Query.select(
178
+ Filter.type(Message.Message, { properties: { labels: Filter.contains('investor') } }),
179
+ ).options({
180
+ queues: [mailbox.queue.dxn.toString()],
181
+ }),
182
+ jsonSchema: Type.toJsonSchema(Message.Message),
183
+ });
184
+ const contactsView = View.make({
185
+ query: contactsQuery,
186
+ jsonSchema: Type.toJsonSchema(Person.Person),
187
+ });
188
+ const organizationsView = View.make({
189
+ query: organizationsQuery,
190
+ jsonSchema: Type.toJsonSchema(Organization.Organization),
191
+ });
192
+ const notesView = View.make({
193
+ query: notesQuery,
194
+ jsonSchema: Type.toJsonSchema(Markdown.Document),
195
+ });
196
+
197
+ return space.db.add(
198
+ Project.make({
199
+ name: 'Investor Research',
200
+ columns: [
201
+ {
202
+ name: 'Mailbox',
203
+ view: Ref.make(mailboxView),
204
+ order: [],
205
+ },
206
+ {
207
+ name: 'Contacts',
208
+ view: Ref.make(contactsView),
209
+ order: [],
210
+ },
211
+ {
212
+ name: 'Organizations',
213
+ view: Ref.make(organizationsView),
214
+ order: [],
215
+ },
216
+ {
217
+ name: 'Notes',
218
+ view: Ref.make(notesView),
219
+ order: [],
220
+ },
221
+ ],
222
+ }),
223
+ );
224
+ });
225
+
226
+ cb?.(objects.flat());
227
+ return objects.flat();
228
+ },
229
+ ],
54
230
  [
55
231
  PresetName.GPT_QUEUE,
56
232
  async (space, n, cb) => {
57
233
  const objects = range(n, () => {
58
234
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
59
235
 
60
- let functionTrigger: FunctionTrigger | undefined;
236
+ let functionTrigger: Trigger.Trigger | undefined;
61
237
  canvasModel.builder.call((builder) => {
62
238
  const gpt = canvasModel.createNode(createGpt(position({ x: 0, y: -14 })));
63
239
  const triggerShape = createTrigger({
64
240
  spaceId: space.id,
65
- triggerKind: TriggerKind.Webhook,
241
+ triggerKind: 'webhook',
66
242
  ...position({ x: -18, y: -2 }),
67
243
  });
68
244
  const trigger = canvasModel.createNode(triggerShape);
@@ -96,8 +272,11 @@ export const generator = () => ({
96
272
  const objects = range(n, () => {
97
273
  const { canvasModel, computeModel } = createQueueSinkPreset(
98
274
  space,
99
- TriggerKind.Subscription,
100
- (triggerSpec) => (triggerSpec.filter = { type: 'dxn:type:dxos.org/type/Chess' }),
275
+ 'subscription',
276
+ (triggerSpec) =>
277
+ (triggerSpec.query = {
278
+ ast: Query.select(Filter.typename('dxos.org/type/Chess')).ast,
279
+ }),
101
280
  'type',
102
281
  );
103
282
  return addToSpace(PresetName.OBJECT_CHANGE_QUEUE, space, canvasModel, computeModel);
@@ -113,7 +292,7 @@ export const generator = () => ({
113
292
  const objects = range(n, () => {
114
293
  const { canvasModel, computeModel } = createQueueSinkPreset(
115
294
  space,
116
- TriggerKind.Timer,
295
+ 'timer',
117
296
  (triggerSpec) => (triggerSpec.cron = '*/5 * * * * *'),
118
297
  'result',
119
298
  );
@@ -147,7 +326,7 @@ export const generator = () => ({
147
326
  // canvasModel.builder.call((builder) => {
148
327
  // const triggerShape = createTrigger({
149
328
  // spaceId: space.id,
150
- // triggerKind: TriggerKind.Email,
329
+ // triggerKind: 'email',
151
330
  // ...position({ x: -18, y: -2 }),
152
331
  // });
153
332
  // const trigger = canvasModel.createNode(triggerShape);
@@ -254,7 +433,7 @@ export const generator = () => ({
254
433
  // );
255
434
  // const triggerShape = createTrigger({
256
435
  // spaceId: space.id,
257
- // triggerKind: TriggerKind.Email,
436
+ // triggerKind: 'email',
258
437
  // ...rawPosition({ centerX: -736, centerY: -384, width: 182, height: 192 }),
259
438
  // });
260
439
  // const trigger = canvasModel.createNode(triggerShape);
@@ -354,11 +533,11 @@ export const generator = () => ({
354
533
  const objects = range(n, () => {
355
534
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
356
535
 
357
- let functionTrigger: FunctionTrigger | undefined;
536
+ let functionTrigger: Trigger.Trigger | undefined;
358
537
  canvasModel.builder.call((builder) => {
359
538
  const triggerShape = createTrigger({
360
539
  spaceId: space.id,
361
- triggerKind: TriggerKind.Timer,
540
+ triggerKind: 'timer',
362
541
  ...position({ x: -10, y: -5 }),
363
542
  });
364
543
  const trigger = canvasModel.createNode(triggerShape);
@@ -416,7 +595,7 @@ export const generator = () => ({
416
595
  // canvasModel.builder.call((builder) => {
417
596
  // const triggerShape = createTrigger({
418
597
  // spaceId: space.id,
419
- // triggerKind: TriggerKind.Queue,
598
+ // triggerKind: 'queue',
420
599
  // ...position({ x: -10, y: -5 }),
421
600
  // });
422
601
  // const trigger = canvasModel.createNode(triggerShape);
@@ -448,10 +627,10 @@ export const generator = () => ({
448
627
  ] as [PresetName, ObjectGenerator<any>][],
449
628
  });
450
629
 
451
- const createQueueSinkPreset = <SpecType extends TriggerKind>(
630
+ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
452
631
  space: Space,
453
632
  triggerKind: SpecType,
454
- initSpec: (spec: Extract<TriggerType, { kind: SpecType }>) => void,
633
+ initSpec: (spec: Extract<Trigger.Spec, { kind: SpecType }>) => void,
455
634
  triggerOutputName: string,
456
635
  ) => {
457
636
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
@@ -463,7 +642,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
463
642
  }),
464
643
  );
465
644
 
466
- let functionTrigger: FunctionTrigger | undefined;
645
+ let functionTrigger: Trigger.Trigger | undefined;
467
646
  canvasModel.builder.call((builder) => {
468
647
  const triggerShape = createTrigger({
469
648
  spaceId: space.id,
@@ -538,7 +717,7 @@ const setupQueue = (
538
717
  return { queue, queueId };
539
718
  };
540
719
 
541
- const attachTrigger = (functionTrigger: FunctionTrigger | undefined, computeModel: ComputeGraphModel) => {
720
+ const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
542
721
  invariant(functionTrigger);
543
722
  functionTrigger.function = Ref.make(computeModel.root);
544
723
  const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
@@ -5,8 +5,7 @@
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';
@@ -14,14 +13,15 @@ import { mx } from '@dxos/react-ui-theme';
14
13
 
15
14
  // TODO(burdon): Create generic container with wireframe mode.
16
15
  export type WireframeProps = ThemedClassName<{
17
- label?: string;
18
16
  object: Obj.Any;
17
+ label?: string;
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();
24
+
25
25
  return (
26
26
  <div ref={ref} className={mx('relative grow min-bs-96', classNames)} {...attentionAttrs}>
27
27
  <div className='absolute inset-2 flex flex-col gap-2 overflow-hidden font-mono'>
@@ -30,7 +30,7 @@ export const Wireframe = ({ classNames, label, object }: WireframeProps) => {
30
30
  <div>{`[${width}x${height}]`}</div>
31
31
  </div>
32
32
  {object && (
33
- <SyntaxHighlighter language='json' classNames='flex w-full text-xs opacity-75 rounded'>
33
+ <SyntaxHighlighter language='json' classNames='text-xs opacity-75 rounded'>
34
34
  {JSON.stringify(object, undefined, 2)}
35
35
  </SyntaxHighlighter>
36
36
  )}
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { lazy } from 'react';
6
6
 
7
- export const DebugApp = lazy(() => import('./DebugApp'));
7
+ export const DebugGraph = lazy(() => import('./DebugGraph'));
8
8
  export const DevtoolsOverviewContainer = lazy(() => import('./DevtoolsOverviewContainer'));
9
9
  export const SpaceGenerator = lazy(() => import('./SpaceGenerator'));
10
10
 
package/src/meta.ts CHANGED
@@ -3,14 +3,15 @@
3
3
  //
4
4
 
5
5
  import { type PluginMeta } from '@dxos/app-framework';
6
-
7
- export const DEBUG_PLUGIN = 'dxos.org/plugin/debug';
6
+ import { trim } from '@dxos/util';
8
7
 
9
8
  export const meta: PluginMeta = {
10
- id: DEBUG_PLUGIN,
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'],
@@ -11,12 +11,14 @@ export const translations = [
11
11
  'en-US': {
12
12
  [meta.id]: {
13
13
  'plugin name': 'Debug',
14
+ 'settings title': 'Debug settings',
14
15
  'mutation count': 'Number of mutations',
15
16
  'mutation period': 'Mutation period',
16
17
  'open devtools label': 'Open DevTools',
17
18
  'devtools label': 'DevTools',
18
- 'devtools overview label': 'DevTools Stats',
19
+ 'devtools overview label': 'Stats',
19
20
  'debug label': 'Debug',
21
+ 'debug app graph label': 'App Graph',
20
22
  'settings show debug panel': 'Show Debug panel.',
21
23
  'settings show devtools panel': 'Show DevTools panel.',
22
24
  'settings wireframe': 'Show wireframes.',
package/src/types.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import { type Context, createContext } from 'react';
7
7
 
8
8
  import type { TimerCallback, TimerOptions } from '@dxos/async';
@@ -1,228 +0,0 @@
1
- // src/components/DebugApp/DebugApp.tsx
2
- import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
3
- import React3, { useEffect, useState as useState2 } from "react";
4
- import { useClient, useConfig } from "@dxos/react-client";
5
- import { ToggleGroup, ToggleGroupItem, Toolbar, Icon, IconButton } from "@dxos/react-ui";
6
-
7
- // src/components/DebugApp/Tree.tsx
8
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
9
- import React, { useState } from "react";
10
- import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
11
- import { mx } from "@dxos/react-ui-theme";
12
- import { arrayToBuffer } from "@dxos/util";
13
- var replacer = (key, value) => {
14
- if (typeof value === "object") {
15
- if (value instanceof Uint8Array) {
16
- return arrayToBuffer(value).toString("hex");
17
- }
18
- if (value?.type === "Buffer") {
19
- return Buffer.from(value.data).toString("hex");
20
- }
21
- if (key === "downloaded") {
22
- return void 0;
23
- }
24
- }
25
- return value;
26
- };
27
- var Json = ({ data }) => {
28
- var _effect = _useSignals();
29
- try {
30
- return /* @__PURE__ */ React.createElement(SyntaxHighlighter, {
31
- language: "json"
32
- }, JSON.stringify(data, replacer, 2));
33
- } finally {
34
- _effect.f();
35
- }
36
- };
37
- var Tree = ({ data }) => {
38
- var _effect = _useSignals();
39
- try {
40
- return /* @__PURE__ */ React.createElement("div", {
41
- className: "p-2"
42
- }, /* @__PURE__ */ React.createElement(Node, {
43
- data,
44
- root: true
45
- }));
46
- } finally {
47
- _effect.f();
48
- }
49
- };
50
- var Node = ({ data, root }) => {
51
- var _effect = _useSignals();
52
- try {
53
- if (typeof data !== "object" || data === void 0 || data === null) {
54
- return /* @__PURE__ */ React.createElement(Scalar, {
55
- value: data
56
- });
57
- }
58
- if (Array.isArray(data)) {
59
- return /* @__PURE__ */ React.createElement("div", {
60
- className: "flex flex-col space-y-2"
61
- }, data.map((value, index) => /* @__PURE__ */ React.createElement(KeyValue, {
62
- key: index,
63
- label: String(index),
64
- data: value,
65
- className: "bg-teal-50"
66
- })));
67
- }
68
- return /* @__PURE__ */ React.createElement("div", {
69
- className: "flex flex-col space-y-2"
70
- }, Object.entries(data).map(([key, value]) => /* @__PURE__ */ React.createElement(KeyValue, {
71
- key,
72
- label: key,
73
- data: value,
74
- className: "bg-blue-50"
75
- })));
76
- } finally {
77
- _effect.f();
78
- }
79
- };
80
- var KeyValue = ({ label, data, className }) => {
81
- var _effect = _useSignals();
82
- try {
83
- const [open, setOpen] = useState(true);
84
- if (data === void 0) {
85
- return null;
86
- }
87
- return /* @__PURE__ */ React.createElement("div", {
88
- className: "flex"
89
- }, /* @__PURE__ */ React.createElement(Box, {
90
- className: mx("border-blue-200 text-sm select-none cursor-pointer", className),
91
- onClick: () => setOpen((open2) => !open2)
92
- }, label), open && /* @__PURE__ */ React.createElement(Node, {
93
- data
94
- }));
95
- } finally {
96
- _effect.f();
97
- }
98
- };
99
- var Scalar = ({ value }) => {
100
- var _effect = _useSignals();
101
- try {
102
- return /* @__PURE__ */ React.createElement(Box, {
103
- className: "bg-green-50 border-green-200 rounded-r text-sm font-thin"
104
- }, value === void 0 && "undefined" || value === null && "null" || typeof value === "string" && value || JSON.stringify(value));
105
- } finally {
106
- _effect.f();
107
- }
108
- };
109
- var Box = ({ children, className, ...props }) => {
110
- var _effect = _useSignals();
111
- try {
112
- return /* @__PURE__ */ React.createElement("div", {
113
- className: mx("flex px-2 border border-l-0 font-mono truncate", className),
114
- ...props
115
- }, children);
116
- } finally {
117
- _effect.f();
118
- }
119
- };
120
-
121
- // src/components/Container.tsx
122
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
123
- import React2 from "react";
124
- var Container = ({ toolbar, children }) => {
125
- var _effect = _useSignals2();
126
- try {
127
- return /* @__PURE__ */ React2.createElement("div", {
128
- role: "none",
129
- className: "flex flex-col grow overflow-hidden divide-y divide-separator"
130
- }, toolbar, /* @__PURE__ */ React2.createElement("div", {
131
- className: "flex flex-col grow overflow-auto"
132
- }, children));
133
- } finally {
134
- _effect.f();
135
- }
136
- };
137
-
138
- // src/components/DebugApp/DebugApp.tsx
139
- var DebugApp = ({ graph }) => {
140
- var _effect = _useSignals3();
141
- try {
142
- const [view, setView] = useState2("graph");
143
- const [data, setData] = useState2({});
144
- const client = useClient();
145
- const config = useConfig();
146
- const handleRefresh = async () => {
147
- const data2 = await client.diagnostics({
148
- truncate: true
149
- });
150
- setData(data2);
151
- };
152
- useEffect(() => {
153
- void handleRefresh();
154
- }, []);
155
- const handleResetClient = async (force = false) => {
156
- if (!force && !window.confirm("Reset storage?")) {
157
- return;
158
- }
159
- await client.reset();
160
- window.location.href = window.location.origin;
161
- };
162
- const handleOpenDevtools = () => {
163
- const vaultUrl = config.values?.runtime?.client?.remoteSource;
164
- if (vaultUrl) {
165
- window.open(`https://devtools.dev.dxos.org/?target=${vaultUrl}`);
166
- }
167
- };
168
- return /* @__PURE__ */ React3.createElement(Container, {
169
- toolbar: /* @__PURE__ */ React3.createElement(Toolbar.Root, {
170
- classNames: "p-1"
171
- }, /* @__PURE__ */ React3.createElement(ToggleGroup, {
172
- type: "single",
173
- value: view
174
- }, /* @__PURE__ */ React3.createElement(ToggleGroupItem, {
175
- value: "graph",
176
- onClick: () => setView("graph"),
177
- title: "Plugin graph"
178
- }, /* @__PURE__ */ React3.createElement(Icon, {
179
- icon: "ph--graph--regular",
180
- size: 5
181
- })), /* @__PURE__ */ React3.createElement(ToggleGroupItem, {
182
- value: "diagnostics",
183
- onClick: () => setView("diagnostics"),
184
- title: "Diagnostics"
185
- }, /* @__PURE__ */ React3.createElement(Icon, {
186
- icon: "ph--gauge--regular",
187
- size: 5
188
- })), /* @__PURE__ */ React3.createElement(ToggleGroupItem, {
189
- value: "config",
190
- onClick: () => setView("config"),
191
- title: "Config"
192
- }, /* @__PURE__ */ React3.createElement(Icon, {
193
- icon: "ph--gear--regular",
194
- size: 5
195
- }))), /* @__PURE__ */ React3.createElement(Toolbar.Separator, {
196
- variant: "gap"
197
- }), /* @__PURE__ */ React3.createElement(IconButton, {
198
- icon: "ph--warning--regular",
199
- iconOnly: true,
200
- size: 5,
201
- classNames: "text-red-700",
202
- onClick: (event) => handleResetClient(event.shiftKey),
203
- label: "Reset client"
204
- }), /* @__PURE__ */ React3.createElement(IconButton, {
205
- icon: "ph--toolbox--duotone",
206
- iconOnly: true,
207
- size: 5,
208
- onClick: handleOpenDevtools,
209
- label: "Open Devtools"
210
- }))
211
- }, view === "graph" && /* @__PURE__ */ React3.createElement(Tree, {
212
- data: graph.toJSON()
213
- }), view === "config" && /* @__PURE__ */ React3.createElement(Json, {
214
- data: data.diagnostics?.config
215
- }), view === "diagnostics" && /* @__PURE__ */ React3.createElement(Json, {
216
- data
217
- }));
218
- } finally {
219
- _effect.f();
220
- }
221
- };
222
-
223
- // src/components/DebugApp/index.ts
224
- var DebugApp_default = DebugApp;
225
- export {
226
- DebugApp_default as default
227
- };
228
- //# sourceMappingURL=DebugApp-ZDL4CPY5.mjs.map