@dxos/plugin-debug 0.8.3 → 0.8.4-main.c1de068

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 (45) hide show
  1. package/dist/lib/browser/{DebugApp-WSEJPCKY.mjs → DebugApp-ZDL4CPY5.mjs} +28 -25
  2. package/dist/lib/browser/DebugApp-ZDL4CPY5.mjs.map +7 -0
  3. package/dist/lib/browser/{DevtoolsOverviewContainer-IIIWO77Q.mjs → DevtoolsOverviewContainer-EPD6EWT5.mjs} +2 -2
  4. package/dist/lib/browser/{SpaceGenerator-VB6IB2LL.mjs → SpaceGenerator-AG3XGNMV.mjs} +186 -441
  5. package/dist/lib/browser/SpaceGenerator-AG3XGNMV.mjs.map +7 -0
  6. package/dist/lib/browser/{app-graph-builder-6HHJMKVU.mjs → app-graph-builder-SQXFD2BL.mjs} +4 -4
  7. package/dist/lib/browser/{chunk-47JOZTT2.mjs → chunk-5XPIRNQS.mjs} +2 -2
  8. package/dist/lib/browser/{chunk-KS3YBEL7.mjs → chunk-AJA6RYN3.mjs} +2 -2
  9. package/dist/lib/browser/index.mjs +12 -12
  10. package/dist/lib/browser/index.mjs.map +3 -3
  11. package/dist/lib/browser/meta.json +1 -1
  12. package/dist/lib/browser/{react-context-ZQRD2WG2.mjs → react-context-NVAGLAJD.mjs} +3 -3
  13. package/dist/lib/browser/{react-surface-UI6OK73H.mjs → react-surface-3GD2OWCA.mjs} +18 -18
  14. package/dist/lib/browser/react-surface-3GD2OWCA.mjs.map +7 -0
  15. package/dist/lib/browser/{settings-SXQWSIM4.mjs → settings-LSSWLM5I.mjs} +4 -4
  16. package/dist/types/src/components/DebugApp/DebugApp.d.ts.map +1 -1
  17. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +3 -1
  18. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  19. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +1 -1
  20. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  21. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +1 -1
  22. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
  23. package/dist/types/src/components/SpaceGenerator/presets.d.ts +1 -4
  24. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  25. package/dist/types/src/translations.d.ts +60 -60
  26. package/dist/types/src/translations.d.ts.map +1 -1
  27. package/dist/types/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +56 -58
  29. package/src/DebugPlugin.tsx +1 -1
  30. package/src/capabilities/react-surface.tsx +2 -2
  31. package/src/components/DebugApp/DebugApp.tsx +19 -12
  32. package/src/components/SpaceGenerator/ObjectGenerator.tsx +25 -19
  33. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +1 -1
  34. package/src/components/SpaceGenerator/SpaceGenerator.tsx +9 -66
  35. package/src/components/SpaceGenerator/presets.ts +216 -214
  36. package/src/translations.ts +6 -4
  37. package/dist/lib/browser/DebugApp-WSEJPCKY.mjs.map +0 -7
  38. package/dist/lib/browser/SpaceGenerator-VB6IB2LL.mjs.map +0 -7
  39. package/dist/lib/browser/react-surface-UI6OK73H.mjs.map +0 -7
  40. /package/dist/lib/browser/{DevtoolsOverviewContainer-IIIWO77Q.mjs.map → DevtoolsOverviewContainer-EPD6EWT5.mjs.map} +0 -0
  41. /package/dist/lib/browser/{app-graph-builder-6HHJMKVU.mjs.map → app-graph-builder-SQXFD2BL.mjs.map} +0 -0
  42. /package/dist/lib/browser/{chunk-47JOZTT2.mjs.map → chunk-5XPIRNQS.mjs.map} +0 -0
  43. /package/dist/lib/browser/{chunk-KS3YBEL7.mjs.map → chunk-AJA6RYN3.mjs.map} +0 -0
  44. /package/dist/lib/browser/{react-context-ZQRD2WG2.mjs.map → react-context-NVAGLAJD.mjs.map} +0 -0
  45. /package/dist/lib/browser/{settings-SXQWSIM4.mjs.map → settings-LSSWLM5I.mjs.map} +0 -0
@@ -2,13 +2,13 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema, SchemaAST } from 'effect';
5
+ import { Schema } from 'effect';
6
6
 
7
7
  import { type ComputeGraphModel, NODE_INPUT } from '@dxos/conductor';
8
8
  import { DXN, Key, Obj, Ref, Type } from '@dxos/echo';
9
- import { FunctionTrigger, TriggerKind, EmailTriggerOutput, type TriggerType } from '@dxos/functions';
9
+ import { FunctionTrigger, TriggerKind, type TriggerType } from '@dxos/functions';
10
10
  import { invariant } from '@dxos/invariant';
11
- import { Filter, type Space } from '@dxos/react-client/echo';
11
+ import { type Space } from '@dxos/react-client/echo';
12
12
  import {
13
13
  type ComputeShape,
14
14
  createAppend,
@@ -31,21 +31,20 @@ import {
31
31
  pointsToRect,
32
32
  rectToPoints,
33
33
  } from '@dxos/react-ui-canvas-editor';
34
- import { TableType } from '@dxos/react-ui-table';
35
34
  import { range } from '@dxos/util';
36
35
 
37
36
  import { type ObjectGenerator } from './ObjectGenerator';
38
37
 
39
38
  export enum PresetName {
40
- EMAIL_TABLE = 'email-table',
39
+ // EMAIL_TABLE = 'email-table',
41
40
  GPT_QUEUE = 'webhook-gpt-queue',
42
41
  CHAT_GPT = 'chat-gpt-text',
43
- EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
42
+ // EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
44
43
  OBJECT_CHANGE_QUEUE = 'objectChange-queue',
45
44
  FOREX_FUNCTION_CALL = 'forex-function-call',
46
45
  TIMER_TICK_QUEUE = 'timerTick-queue',
47
46
  DISCORD_MESSAGES = 'discord-messages',
48
- KANBAN_QUEUE = 'kanban-queue',
47
+ // KANBAN_QUEUE = 'kanban-queue',
49
48
  }
50
49
 
51
50
  export const generator = () => ({
@@ -125,72 +124,73 @@ export const generator = () => ({
125
124
  },
126
125
  ],
127
126
 
128
- [
129
- PresetName.EMAIL_TABLE,
130
- async (space, n, cb) => {
131
- const objects = range(n, () => {
132
- const canvasModel = CanvasGraphModel.create<ComputeShape>();
133
-
134
- const results = space.db.query(Filter.type(TableType)).runSync();
135
- const emailTable = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Email'));
136
- invariant(emailTable, 'Email table not found.');
137
-
138
- const template = canvasModel.createNode(
139
- createTemplate({
140
- valueType: 'object',
141
- ...rawPosition({ centerX: -80, centerY: -64, width: 320, height: 320 }),
142
- }),
143
- );
144
- const templateContent = ['{'];
145
-
146
- let functionTrigger: FunctionTrigger | undefined;
147
- canvasModel.builder.call((builder) => {
148
- const triggerShape = createTrigger({
149
- spaceId: space.id,
150
- triggerKind: TriggerKind.Email,
151
- ...position({ x: -18, y: -2 }),
152
- });
153
- const trigger = canvasModel.createNode(triggerShape);
154
-
155
- const tableId = canvasModel.createNode(
156
- createConstant({
157
- value: DXN.fromLocalObjectId(emailTable.id).toString(),
158
- ...position({ x: -18, y: 5, width: 8, height: 6 }),
159
- }),
160
- );
161
-
162
- const appendToTable = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
163
-
164
- const properties = SchemaAST.getPropertySignatures(EmailTriggerOutput.ast);
165
- for (let i = 0; i < properties.length; i++) {
166
- const propName = properties[i].name.toString();
167
- builder.createEdge({ source: trigger.id, target: template.id, input: propName, output: propName });
168
- templateContent.push(` "${propName}": "{{${propName}}}"` + (i === properties.length - 1 ? '' : ','));
169
- }
170
- templateContent.push('}');
171
-
172
- builder
173
- .createEdge({ source: tableId.id, target: appendToTable.id, input: 'id' })
174
- .createEdge({ source: template.id, target: appendToTable.id, input: 'items' });
175
-
176
- functionTrigger = triggerShape.functionTrigger!.target!;
177
- });
178
-
179
- const computeModel = createComputeGraph(canvasModel);
180
-
181
- const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
182
- invariant(templateComputeNode, 'Template compute node was not created.');
183
- templateComputeNode.value = templateContent.join('\n');
184
- templateComputeNode.inputSchema = Type.toJsonSchema(EmailTriggerOutput);
185
-
186
- attachTrigger(functionTrigger, computeModel);
187
-
188
- return addToSpace(PresetName.EMAIL_TABLE, space, canvasModel, computeModel);
189
- });
190
- cb?.(objects);
191
- return objects;
192
- },
193
- ],
127
+ // TODO(wittjosiah): Remove?
128
+ // [
129
+ // PresetName.EMAIL_TABLE,
130
+ // async (space, n, cb) => {
131
+ // const objects = range(n, () => {
132
+ // const canvasModel = CanvasGraphModel.create<ComputeShape>();
133
+
134
+ // const results = space.db.query(Filter.type(TableType)).runSync();
135
+ // const emailTable = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Email'));
136
+ // invariant(emailTable, 'Email table not found.');
137
+
138
+ // const template = canvasModel.createNode(
139
+ // createTemplate({
140
+ // valueType: 'object',
141
+ // ...rawPosition({ centerX: -80, centerY: -64, width: 320, height: 320 }),
142
+ // }),
143
+ // );
144
+ // const templateContent = ['{'];
145
+
146
+ // let functionTrigger: FunctionTrigger | undefined;
147
+ // canvasModel.builder.call((builder) => {
148
+ // const triggerShape = createTrigger({
149
+ // spaceId: space.id,
150
+ // triggerKind: TriggerKind.Email,
151
+ // ...position({ x: -18, y: -2 }),
152
+ // });
153
+ // const trigger = canvasModel.createNode(triggerShape);
154
+
155
+ // const tableId = canvasModel.createNode(
156
+ // createConstant({
157
+ // value: DXN.fromLocalObjectId(emailTable.id).toString(),
158
+ // ...position({ x: -18, y: 5, width: 8, height: 6 }),
159
+ // }),
160
+ // );
161
+
162
+ // const appendToTable = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
163
+
164
+ // const properties = SchemaAST.getPropertySignatures(EmailTriggerOutput.ast);
165
+ // for (let i = 0; i < properties.length; i++) {
166
+ // const propName = properties[i].name.toString();
167
+ // builder.createEdge({ source: trigger.id, target: template.id, input: propName, output: propName });
168
+ // templateContent.push(` "${propName}": "{{${propName}}}"` + (i === properties.length - 1 ? '' : ','));
169
+ // }
170
+ // templateContent.push('}');
171
+
172
+ // builder
173
+ // .createEdge({ source: tableId.id, target: appendToTable.id, input: 'id' })
174
+ // .createEdge({ source: template.id, target: appendToTable.id, input: 'items' });
175
+
176
+ // functionTrigger = triggerShape.functionTrigger!.target!;
177
+ // });
178
+
179
+ // const computeModel = createComputeGraph(canvasModel);
180
+
181
+ // const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
182
+ // invariant(templateComputeNode, 'Template compute node was not created.');
183
+ // templateComputeNode.value = templateContent.join('\n');
184
+ // templateComputeNode.inputSchema = Type.toJsonSchema(EmailTriggerOutput);
185
+
186
+ // attachTrigger(functionTrigger, computeModel);
187
+
188
+ // return addToSpace(PresetName.EMAIL_TABLE, space, canvasModel, computeModel);
189
+ // });
190
+ // cb?.(objects);
191
+ // return objects;
192
+ // },
193
+ // ],
194
194
 
195
195
  [
196
196
  PresetName.CHAT_GPT,
@@ -222,99 +222,100 @@ export const generator = () => ({
222
222
  },
223
223
  ],
224
224
 
225
- [
226
- PresetName.EMAIL_WITH_SUMMARY,
227
- async (space, n, cb) => {
228
- const objects = range(n, () => {
229
- const canvasModel = CanvasGraphModel.create<ComputeShape>();
230
-
231
- const results = space.db.query(Filter.type(TableType)).runSync();
232
- const emailTable = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Email'));
233
- invariant(emailTable, 'Email table not found.');
234
-
235
- const template = canvasModel.createNode(
236
- createTemplate({
237
- valueType: 'object',
238
- ...rawPosition({ centerX: 192, centerY: -176, width: 320, height: 320 }),
239
- }),
240
- );
241
- const templateContent = ['{'];
242
-
243
- let functionTrigger: FunctionTrigger | undefined;
244
- canvasModel.builder.call((builder) => {
245
- const gpt = canvasModel.createNode(
246
- createGpt(rawPosition({ centerX: -400, centerY: -112, width: 256, height: 202 })),
247
- );
248
- const systemPrompt = canvasModel.createNode(
249
- createConstant({
250
- value: "use one word to describe content category. don't write anything else",
251
- ...rawPosition({ centerX: -800, centerY: -160, width: 192, height: 128 }),
252
- }),
253
- );
254
- const triggerShape = createTrigger({
255
- spaceId: space.id,
256
- triggerKind: TriggerKind.Email,
257
- ...rawPosition({ centerX: -736, centerY: -384, width: 182, height: 192 }),
258
- });
259
- const trigger = canvasModel.createNode(triggerShape);
260
-
261
- const { queueId } = setupQueue(space, canvasModel, {
262
- idPosition: { centerX: -720, centerY: 224, width: 192, height: 256 },
263
- queuePosition: { centerX: -144, centerY: 416, width: 320, height: 448 },
264
- });
265
- const appendToQueue = canvasModel.createNode(
266
- createAppend(rawPosition({ centerX: -80, centerY: 96, width: 122, height: 128 })),
267
- );
268
-
269
- const tableId = canvasModel.createNode(
270
- createConstant({
271
- value: DXN.fromLocalObjectId(emailTable.id).toString(),
272
- ...rawPosition({ centerX: -112, centerY: -544, width: 192, height: 256 }),
273
- }),
274
- );
275
-
276
- const appendToTable = canvasModel.createNode(
277
- createAppend(rawPosition({ centerX: 560, centerY: -416, width: 128, height: 122 })),
278
- );
279
-
280
- templateContent.push(' "category": "{{text}}",');
281
- builder.createEdge({ source: gpt.id, target: template.id, input: 'text', output: 'text' });
282
-
283
- const properties = SchemaAST.getPropertySignatures(EmailTriggerOutput.ast);
284
- for (let i = 0; i < properties.length; i++) {
285
- const propName = properties[i].name.toString();
286
- builder.createEdge({ source: trigger.id, target: template.id, input: propName, output: propName });
287
- templateContent.push(` "${propName}": "{{${propName}}}"` + (i === properties.length - 1 ? '' : ','));
288
- }
289
- templateContent.push('}');
290
-
291
- builder
292
- .createEdge({ source: tableId.id, target: appendToTable.id, input: 'id' })
293
- .createEdge({ source: queueId.id, target: appendToQueue.id, input: 'id' })
294
- .createEdge({ source: gpt.id, target: appendToQueue.id, output: 'messages', input: 'items' })
295
- .createEdge({ source: systemPrompt.id, target: gpt.id, input: 'systemPrompt' })
296
- .createEdge({ source: trigger.id, target: gpt.id, input: 'prompt', output: 'body' })
297
- .createEdge({ source: template.id, target: appendToTable.id, input: 'items' });
298
-
299
- functionTrigger = triggerShape.functionTrigger!.target!;
300
- });
301
-
302
- const computeModel = createComputeGraph(canvasModel);
303
-
304
- const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
305
- invariant(templateComputeNode, 'Template compute node was not created.');
306
- templateComputeNode.value = templateContent.join('\n');
307
- const extendedSchema = Schema.extend(EmailTriggerOutput, Schema.Struct({ text: Schema.String }));
308
- templateComputeNode.inputSchema = Type.toJsonSchema(extendedSchema);
309
-
310
- attachTrigger(functionTrigger, computeModel);
311
-
312
- return addToSpace(PresetName.EMAIL_WITH_SUMMARY, space, canvasModel, computeModel);
313
- });
314
- cb?.(objects);
315
- return objects;
316
- },
317
- ],
225
+ // TODO(wittjosiah): Remove?
226
+ // [
227
+ // PresetName.EMAIL_WITH_SUMMARY,
228
+ // async (space, n, cb) => {
229
+ // const objects = range(n, () => {
230
+ // const canvasModel = CanvasGraphModel.create<ComputeShape>();
231
+
232
+ // const results = space.db.query(Filter.type(TableType)).runSync();
233
+ // const emailTable = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Email'));
234
+ // invariant(emailTable, 'Email table not found.');
235
+
236
+ // const template = canvasModel.createNode(
237
+ // createTemplate({
238
+ // valueType: 'object',
239
+ // ...rawPosition({ centerX: 192, centerY: -176, width: 320, height: 320 }),
240
+ // }),
241
+ // );
242
+ // const templateContent = ['{'];
243
+
244
+ // let functionTrigger: FunctionTrigger | undefined;
245
+ // canvasModel.builder.call((builder) => {
246
+ // const gpt = canvasModel.createNode(
247
+ // createGpt(rawPosition({ centerX: -400, centerY: -112, width: 256, height: 202 })),
248
+ // );
249
+ // const systemPrompt = canvasModel.createNode(
250
+ // createConstant({
251
+ // value: "use one word to describe content category. don't write anything else",
252
+ // ...rawPosition({ centerX: -800, centerY: -160, width: 192, height: 128 }),
253
+ // }),
254
+ // );
255
+ // const triggerShape = createTrigger({
256
+ // spaceId: space.id,
257
+ // triggerKind: TriggerKind.Email,
258
+ // ...rawPosition({ centerX: -736, centerY: -384, width: 182, height: 192 }),
259
+ // });
260
+ // const trigger = canvasModel.createNode(triggerShape);
261
+
262
+ // const { queueId } = setupQueue(space, canvasModel, {
263
+ // idPosition: { centerX: -720, centerY: 224, width: 192, height: 256 },
264
+ // queuePosition: { centerX: -144, centerY: 416, width: 320, height: 448 },
265
+ // });
266
+ // const appendToQueue = canvasModel.createNode(
267
+ // createAppend(rawPosition({ centerX: -80, centerY: 96, width: 122, height: 128 })),
268
+ // );
269
+
270
+ // const tableId = canvasModel.createNode(
271
+ // createConstant({
272
+ // value: DXN.fromLocalObjectId(emailTable.id).toString(),
273
+ // ...rawPosition({ centerX: -112, centerY: -544, width: 192, height: 256 }),
274
+ // }),
275
+ // );
276
+
277
+ // const appendToTable = canvasModel.createNode(
278
+ // createAppend(rawPosition({ centerX: 560, centerY: -416, width: 128, height: 122 })),
279
+ // );
280
+
281
+ // templateContent.push(' "category": "{{text}}",');
282
+ // builder.createEdge({ source: gpt.id, target: template.id, input: 'text', output: 'text' });
283
+
284
+ // const properties = SchemaAST.getPropertySignatures(EmailTriggerOutput.ast);
285
+ // for (let i = 0; i < properties.length; i++) {
286
+ // const propName = properties[i].name.toString();
287
+ // builder.createEdge({ source: trigger.id, target: template.id, input: propName, output: propName });
288
+ // templateContent.push(` "${propName}": "{{${propName}}}"` + (i === properties.length - 1 ? '' : ','));
289
+ // }
290
+ // templateContent.push('}');
291
+
292
+ // builder
293
+ // .createEdge({ source: tableId.id, target: appendToTable.id, input: 'id' })
294
+ // .createEdge({ source: queueId.id, target: appendToQueue.id, input: 'id' })
295
+ // .createEdge({ source: gpt.id, target: appendToQueue.id, output: 'messages', input: 'items' })
296
+ // .createEdge({ source: systemPrompt.id, target: gpt.id, input: 'systemPrompt' })
297
+ // .createEdge({ source: trigger.id, target: gpt.id, input: 'prompt', output: 'body' })
298
+ // .createEdge({ source: template.id, target: appendToTable.id, input: 'items' });
299
+
300
+ // functionTrigger = triggerShape.functionTrigger!.target!;
301
+ // });
302
+
303
+ // const computeModel = createComputeGraph(canvasModel);
304
+
305
+ // const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
306
+ // invariant(templateComputeNode, 'Template compute node was not created.');
307
+ // templateComputeNode.value = templateContent.join('\n');
308
+ // const extendedSchema = Schema.extend(EmailTriggerOutput, Schema.Struct({ text: Schema.String }));
309
+ // templateComputeNode.inputSchema = Type.toJsonSchema(extendedSchema);
310
+
311
+ // attachTrigger(functionTrigger, computeModel);
312
+
313
+ // return addToSpace(PresetName.EMAIL_WITH_SUMMARY, space, canvasModel, computeModel);
314
+ // });
315
+ // cb?.(objects);
316
+ // return objects;
317
+ // },
318
+ // ],
318
319
 
319
320
  [
320
321
  PresetName.FOREX_FUNCTION_CALL,
@@ -395,54 +396,55 @@ export const generator = () => ({
395
396
  },
396
397
  ],
397
398
 
398
- [
399
- PresetName.KANBAN_QUEUE,
400
- async (space, n, cb) => {
401
- const objects = range(n, () => {
402
- const canvasModel = CanvasGraphModel.create<ComputeShape>();
403
-
404
- // TODO(wittjosiah): Integrate directly w/ Kanban.
405
- // const results = space.db.query(Filter.type(KanbanType)).runSync();
406
- // const kanban = results.find((r) => r.object?.cardView?.target?.query?.type?.endsWith('Message'));
407
- // invariant(kanban, 'Kanban not found.');
408
-
409
- const results = space.db.query(Filter.type(TableType)).runSync();
410
- const messages = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Message'));
411
- invariant(messages, 'Table not found.');
412
-
413
- let functionTrigger: FunctionTrigger | undefined;
414
- canvasModel.builder.call((builder) => {
415
- const triggerShape = createTrigger({
416
- spaceId: space.id,
417
- triggerKind: TriggerKind.Queue,
418
- ...position({ x: -10, y: -5 }),
419
- });
420
- const trigger = canvasModel.createNode(triggerShape);
421
-
422
- const tableId = canvasModel.createNode(
423
- createConstant({
424
- value: DXN.fromLocalObjectId(messages.id).toString(),
425
- ...position({ x: -10, y: 5 }),
426
- }),
427
- );
428
- const appendToTable = canvasModel.createNode(createAppend(position({ x: 10, y: 0 })));
429
-
430
- builder
431
- .createEdge({ source: tableId.id, target: appendToTable.id, input: 'id' })
432
- .createEdge({ source: trigger.id, target: appendToTable.id, input: 'items', output: 'item' });
433
-
434
- functionTrigger = triggerShape.functionTrigger!.target!;
435
- });
436
-
437
- const computeModel = createComputeGraph(canvasModel);
438
- attachTrigger(functionTrigger, computeModel);
439
-
440
- return addToSpace(PresetName.KANBAN_QUEUE, space, canvasModel, computeModel);
441
- });
442
- cb?.(objects);
443
- return objects;
444
- },
445
- ],
399
+ // TODO(wittjosiah): Remove?
400
+ // [
401
+ // PresetName.KANBAN_QUEUE,
402
+ // async (space, n, cb) => {
403
+ // const objects = range(n, () => {
404
+ // const canvasModel = CanvasGraphModel.create<ComputeShape>();
405
+
406
+ // // TODO(wittjosiah): Integrate directly w/ Kanban.
407
+ // // const results = space.db.query(Filter.type(KanbanType)).runSync();
408
+ // // const kanban = results.find((r) => r.object?.cardView?.target?.query?.type?.endsWith('Message'));
409
+ // // invariant(kanban, 'Kanban not found.');
410
+
411
+ // const results = space.db.query(Filter.type(TableType)).runSync();
412
+ // const messages = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Message'));
413
+ // invariant(messages, 'Table not found.');
414
+
415
+ // let functionTrigger: FunctionTrigger | undefined;
416
+ // canvasModel.builder.call((builder) => {
417
+ // const triggerShape = createTrigger({
418
+ // spaceId: space.id,
419
+ // triggerKind: TriggerKind.Queue,
420
+ // ...position({ x: -10, y: -5 }),
421
+ // });
422
+ // const trigger = canvasModel.createNode(triggerShape);
423
+
424
+ // const tableId = canvasModel.createNode(
425
+ // createConstant({
426
+ // value: DXN.fromLocalObjectId(messages.id).toString(),
427
+ // ...position({ x: -10, y: 5 }),
428
+ // }),
429
+ // );
430
+ // const appendToTable = canvasModel.createNode(createAppend(position({ x: 10, y: 0 })));
431
+
432
+ // builder
433
+ // .createEdge({ source: tableId.id, target: appendToTable.id, input: 'id' })
434
+ // .createEdge({ source: trigger.id, target: appendToTable.id, input: 'items', output: 'item' });
435
+
436
+ // functionTrigger = triggerShape.functionTrigger!.target!;
437
+ // });
438
+
439
+ // const computeModel = createComputeGraph(canvasModel);
440
+ // attachTrigger(functionTrigger, computeModel);
441
+
442
+ // return addToSpace(PresetName.KANBAN_QUEUE, space, canvasModel, computeModel);
443
+ // });
444
+ // cb?.(objects);
445
+ // return objects;
446
+ // },
447
+ // ],
446
448
  ] as [PresetName, ObjectGenerator<any>][],
447
449
  });
448
450
 
@@ -2,12 +2,14 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { DEBUG_PLUGIN } from './meta';
5
+ import { type Resource } from '@dxos/react-ui';
6
6
 
7
- export default [
7
+ import { meta } from './meta';
8
+
9
+ export const translations = [
8
10
  {
9
11
  'en-US': {
10
- [DEBUG_PLUGIN]: {
12
+ [meta.id]: {
11
13
  'plugin name': 'Debug',
12
14
  'mutation count': 'Number of mutations',
13
15
  'mutation period': 'Mutation period',
@@ -67,4 +69,4 @@ export default [
67
69
  },
68
70
  },
69
71
  },
70
- ];
72
+ ] as const satisfies Resource[];
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/DebugApp/DebugApp.tsx", "../../../src/components/DebugApp/Tree.tsx", "../../../src/components/Container.tsx", "../../../src/components/DebugApp/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Gauge, Graph as GraphIcon, Gear, Toolbox, Warning } from '@phosphor-icons/react';\nimport React, { type FC, useEffect, useState } from 'react';\n\nimport { type Graph } from '@dxos/plugin-graph';\nimport { useClient, useConfig } from '@dxos/react-client';\nimport { Button, ToggleGroup, ToggleGroupItem, Toolbar } from '@dxos/react-ui';\nimport { getSize, mx } from '@dxos/react-ui-theme';\n\nimport { Json, Tree } from './Tree';\nimport { Container } from '../Container';\n\nexport const DebugApp: FC<{ graph: Graph }> = ({ graph }) => {\n const [view, setView] = useState<'config' | 'diagnostics' | 'graph'>('graph');\n const [data, setData] = useState<any>({});\n const client = useClient();\n const config = useConfig();\n const handleRefresh = async () => {\n const data = await client.diagnostics({ truncate: true });\n setData(data);\n };\n useEffect(() => {\n void handleRefresh();\n }, []);\n\n const handleResetClient = async (force = false) => {\n if (!force && !window.confirm('Reset storage?')) {\n return;\n }\n\n // TODO(burdon): Throws exception.\n await client.reset();\n window.location.href = window.location.origin;\n };\n\n const handleOpenDevtools = () => {\n const vaultUrl = config.values?.runtime?.client?.remoteSource;\n if (vaultUrl) {\n window.open(`https://devtools.dev.dxos.org/?target=${vaultUrl}`);\n }\n };\n\n return (\n <Container\n toolbar={\n <Toolbar.Root classNames='p-1'>\n <ToggleGroup type='single' value={view}>\n <ToggleGroupItem value={'graph'} onClick={() => setView('graph')} title={'Plugin graph'}>\n <GraphIcon className={getSize(5)} />\n </ToggleGroupItem>\n <ToggleGroupItem value={'diagnostics'} onClick={() => setView('diagnostics')} title={'Diagnostics'}>\n <Gauge className={getSize(5)} />\n </ToggleGroupItem>\n <ToggleGroupItem value={'config'} onClick={() => setView('config')} title={'Config'}>\n <Gear className={getSize(5)} />\n </ToggleGroupItem>\n </ToggleGroup>\n\n <Toolbar.Separator variant='gap' />\n <Button onClick={(event) => handleResetClient(event.shiftKey)} title='Reset client'>\n <Warning className={mx(getSize(5), 'text-red-700')} />\n </Button>\n <Button onClick={handleOpenDevtools} title='Open Devtools'>\n <Toolbox weight='duotone' className={mx(getSize(5), 'text-700')} />\n </Button>\n </Toolbar.Root>\n }\n >\n {view === 'graph' && <Tree data={graph.toJSON()} />}\n {view === 'config' && <Json data={data.diagnostics?.config} />}\n {view === 'diagnostics' && <Json data={data} />}\n </Container>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC, type HTMLAttributes, useState } from 'react';\n\nimport { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';\nimport { mx } from '@dxos/react-ui-theme';\nimport { arrayToBuffer } from '@dxos/util';\n\n// TODO(burdon): Copied form devtools.\n\nexport const replacer = (key: any, value: any) => {\n if (typeof value === 'object') {\n if (value instanceof Uint8Array) {\n return arrayToBuffer(value).toString('hex');\n }\n\n if (value?.type === 'Buffer') {\n return Buffer.from(value.data).toString('hex');\n }\n\n if (key === 'downloaded') {\n return undefined;\n }\n }\n\n return value;\n};\n\nexport const Json: FC<{ data?: object }> = ({ data }) => {\n return <SyntaxHighlighter language='json'>{JSON.stringify(data, replacer, 2)}</SyntaxHighlighter>;\n};\n\nexport const Tree: FC<{ data?: object }> = ({ data }) => {\n return (\n <div className='p-2'>\n <Node data={data} root />\n </div>\n );\n};\n\nexport const Node: FC<{ data?: any; root?: boolean }> = ({ data, root }) => {\n if (typeof data !== 'object' || data === undefined || data === null) {\n return <Scalar value={data} />;\n }\n\n if (Array.isArray(data)) {\n return (\n <div className='flex flex-col space-y-2'>\n {data.map((value, index) => (\n <KeyValue key={index} label={String(index)} data={value} className='bg-teal-50' />\n ))}\n </div>\n );\n }\n\n return (\n <div className='flex flex-col space-y-2'>\n {Object.entries(data).map(([key, value]) => (\n <KeyValue key={key} label={key} data={value} className='bg-blue-50' />\n ))}\n </div>\n );\n};\n\nexport const KeyValue: FC<{ label: string; data?: any; className?: string }> = ({ label, data, className }) => {\n const [open, setOpen] = useState(true);\n if (data === undefined) {\n return null;\n }\n\n return (\n <div className='flex'>\n <Box\n className={mx('border-blue-200 text-sm select-none cursor-pointer', className)}\n onClick={() => setOpen((open) => !open)}\n >\n {label}\n </Box>\n {open && <Node data={data} />}\n </div>\n );\n};\n\nconst Scalar: FC<{ value: any }> = ({ value }) => {\n return (\n <Box className='bg-green-50 border-green-200 rounded-r text-sm font-thin'>\n {(value === undefined && 'undefined') ||\n (value === null && 'null') ||\n (typeof value === 'string' && value) ||\n JSON.stringify(value)}\n </Box>\n );\n};\n\nconst Box: FC<HTMLAttributes<HTMLDivElement>> = ({ children, className, ...props }) => {\n return (\n <div className={mx('flex px-2 border border-l-0 font-mono truncate', className)} {...props}>\n {children}\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type PropsWithChildren, type ReactNode } from 'react';\n\n// TODO(burdon): Convert to grid.\nexport const Container = ({ toolbar, children }: PropsWithChildren<{ toolbar: ReactNode }>) => {\n return (\n <div role='none' className='flex flex-col grow overflow-hidden divide-y divide-separator'>\n {toolbar}\n <div className='flex flex-col grow overflow-auto'>{children}</div>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { DebugApp } from './DebugApp';\n\nexport default DebugApp;\n"],
5
- "mappings": ";;AAIA,SAASA,OAAOC,SAASC,WAAWC,MAAMC,SAASC,eAAe;AAClE,OAAOC,UAAkBC,WAAWC,YAAAA,iBAAgB;AAGpD,SAASC,WAAWC,iBAAiB;AACrC,SAASC,QAAQC,aAAaC,iBAAiBC,eAAe;AAC9D,SAASC,SAASC,MAAAA,WAAU;;;;ACN5B,OAAOC,SAAuCC,gBAAgB;AAE9D,SAASC,yBAAyB;AAClC,SAASC,UAAU;AACnB,SAASC,qBAAqB;AAIvB,IAAMC,WAAW,CAACC,KAAUC,UAAAA;AACjC,MAAI,OAAOA,UAAU,UAAU;AAC7B,QAAIA,iBAAiBC,YAAY;AAC/B,aAAOC,cAAcF,KAAAA,EAAOG,SAAS,KAAA;IACvC;AAEA,QAAIH,OAAOI,SAAS,UAAU;AAC5B,aAAOC,OAAOC,KAAKN,MAAMO,IAAI,EAAEJ,SAAS,KAAA;IAC1C;AAEA,QAAIJ,QAAQ,cAAc;AACxB,aAAOS;IACT;EACF;AAEA,SAAOR;AACT;AAEO,IAAMS,OAA8B,CAAC,EAAEF,KAAI,MAAE;;;AAClD,WAAO,sBAAA,cAACG,mBAAAA;MAAkBC,UAAS;OAAQC,KAAKC,UAAUN,MAAMT,UAAU,CAAA,CAAA;;;;AAC5E;AAEO,IAAMgB,OAA8B,CAAC,EAAEP,KAAI,MAAE;;;AAClD,WACE,sBAAA,cAACQ,OAAAA;MAAIC,WAAU;OACb,sBAAA,cAACC,MAAAA;MAAKV;MAAYW,MAAAA;;;;;AAGxB;AAEO,IAAMD,OAA2C,CAAC,EAAEV,MAAMW,KAAI,MAAE;;;AACrE,QAAI,OAAOX,SAAS,YAAYA,SAASC,UAAaD,SAAS,MAAM;AACnE,aAAO,sBAAA,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QAAQ,OAAA;QAAUqC,OAAO;SACvE,gBAAAX,OAAA,cAACY,WAAAA;QAAUC,WAAWC,QAAQ,CAAA;WAEhC,gBAAAd,OAAA,cAACS,iBAAAA;QAAgBD,OAAO;QAAeE,SAAS,MAAMpC,QAAQ,aAAA;QAAgBqC,OAAO;SACnF,gBAAAX,OAAA,cAACe,OAAAA;QAAMF,WAAWC,QAAQ,CAAA;WAE5B,gBAAAd,OAAA,cAACS,iBAAAA;QAAgBD,OAAO;QAAUE,SAAS,MAAMpC,QAAQ,QAAA;QAAWqC,OAAO;SACzE,gBAAAX,OAAA,cAACgB,MAAAA;QAAKH,WAAWC,QAAQ,CAAA;YAI7B,gBAAAd,OAAA,cAACG,QAAQc,WAAS;QAACC,SAAQ;UAC3B,gBAAAlB,OAAA,cAACmB,QAAAA;QAAOT,SAAS,CAACU,UAAUlC,kBAAkBkC,MAAMC,QAAQ;QAAGV,OAAM;SACnE,gBAAAX,OAAA,cAACsB,SAAAA;QAAQT,WAAWU,IAAGT,QAAQ,CAAA,GAAI,cAAA;WAErC,gBAAAd,OAAA,cAACmB,QAAAA;QAAOT,SAAShB;QAAoBiB,OAAM;SACzC,gBAAAX,OAAA,cAACwB,SAAAA;QAAQC,QAAO;QAAUZ,WAAWU,IAAGT,QAAQ,CAAA,GAAI,UAAA;;OAKzDzC,SAAS,WAAW,gBAAA2B,OAAA,cAAC0B,MAAAA;MAAKlD,MAAMJ,MAAMuD,OAAM;QAC5CtD,SAAS,YAAY,gBAAA2B,OAAA,cAAC4B,MAAAA;MAAKpD,MAAMA,KAAKO,aAAaH;QACnDP,SAAS,iBAAiB,gBAAA2B,OAAA,cAAC4B,MAAAA;MAAKpD;;;;;AAGvC;;;AGtEA,IAAA,mBAAeqD;",
6
- "names": ["Gauge", "Graph", "GraphIcon", "Gear", "Toolbox", "Warning", "React", "useEffect", "useState", "useClient", "useConfig", "Button", "ToggleGroup", "ToggleGroupItem", "Toolbar", "getSize", "mx", "React", "useState", "SyntaxHighlighter", "mx", "arrayToBuffer", "replacer", "key", "value", "Uint8Array", "arrayToBuffer", "toString", "type", "Buffer", "from", "data", "undefined", "Json", "SyntaxHighlighter", "language", "JSON", "stringify", "Tree", "div", "className", "Node", "root", "Scalar", "Array", "isArray", "map", "index", "KeyValue", "label", "String", "Object", "entries", "open", "setOpen", "useState", "Box", "mx", "onClick", "children", "props", "React", "Container", "toolbar", "children", "React", "div", "role", "className", "DebugApp", "graph", "view", "setView", "useState", "data", "setData", "client", "useClient", "config", "useConfig", "handleRefresh", "diagnostics", "truncate", "useEffect", "handleResetClient", "force", "window", "confirm", "reset", "location", "href", "origin", "handleOpenDevtools", "vaultUrl", "values", "runtime", "remoteSource", "open", "React", "Container", "toolbar", "Toolbar", "Root", "classNames", "ToggleGroup", "type", "value", "ToggleGroupItem", "onClick", "title", "GraphIcon", "className", "getSize", "Gauge", "Gear", "Separator", "variant", "Button", "event", "shiftKey", "Warning", "mx", "Toolbox", "weight", "Tree", "toJSON", "Json", "DebugApp"]
7
- }