@dxos/plugin-debug 0.8.2-main.f11618f → 0.8.2-staging.42af850

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 (67) hide show
  1. package/dist/lib/browser/DebugApp-WSEJPCKY.mjs +225 -0
  2. package/dist/lib/browser/{DebugApp-7PFYN52J.mjs.map → DebugApp-WSEJPCKY.mjs.map} +1 -1
  3. package/dist/lib/browser/DevtoolsOverviewContainer-IIIWO77Q.mjs +25 -0
  4. package/dist/lib/browser/{DevtoolsOverviewContainer-HYNZTH2Z.mjs.map → DevtoolsOverviewContainer-IIIWO77Q.mjs.map} +1 -1
  5. package/dist/lib/browser/{SpaceGenerator-HR7R3RTE.mjs → SpaceGenerator-RHQLPN44.mjs} +246 -234
  6. package/dist/lib/browser/SpaceGenerator-RHQLPN44.mjs.map +7 -0
  7. package/dist/lib/browser/{app-graph-builder-RTKWOHHT.mjs → app-graph-builder-PIPBIN6P.mjs} +88 -83
  8. package/dist/lib/browser/app-graph-builder-PIPBIN6P.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-RORUXVAC.mjs → chunk-47JOZTT2.mjs} +1 -4
  10. package/dist/lib/browser/{chunk-RORUXVAC.mjs.map → chunk-47JOZTT2.mjs.map} +3 -3
  11. package/dist/lib/browser/chunk-KS3YBEL7.mjs +68 -0
  12. package/dist/lib/browser/chunk-KS3YBEL7.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +6 -5
  14. package/dist/lib/browser/index.mjs.map +2 -2
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/{react-context-ZRLN5KUI.mjs → react-context-ZQRD2WG2.mjs} +2 -2
  17. package/dist/lib/browser/{react-surface-NEMNEAAI.mjs → react-surface-PHUWS5WD.mjs} +313 -266
  18. package/dist/lib/browser/react-surface-PHUWS5WD.mjs.map +7 -0
  19. package/dist/lib/browser/{settings-BIRIGKTH.mjs → settings-N4Q6YB7L.mjs} +3 -3
  20. package/dist/types/src/capabilities/app-graph-builder.d.ts +2 -179
  21. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  22. package/dist/types/src/capabilities/index.d.ts +2 -178
  23. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  24. package/dist/types/src/capabilities/react-surface.d.ts +2 -2
  25. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  26. package/dist/types/src/components/Container.d.ts.map +1 -1
  27. package/dist/types/src/components/DebugApp/Tree.d.ts.map +1 -1
  28. package/dist/types/src/components/DebugObjectPanel.d.ts +2 -2
  29. package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
  30. package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
  31. package/dist/types/src/components/DebugStatus.d.ts.map +1 -1
  32. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  33. package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +1 -1
  34. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  35. package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
  36. package/dist/types/src/components/SpaceGenerator/presets.d.ts +1 -1
  37. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  38. package/dist/types/src/components/Wireframe.d.ts +2 -2
  39. package/dist/types/src/components/Wireframe.d.ts.map +1 -1
  40. package/dist/types/src/meta.d.ts.map +1 -1
  41. package/dist/types/src/translations.d.ts +1 -0
  42. package/dist/types/src/translations.d.ts.map +1 -1
  43. package/dist/types/src/types.d.ts +5 -4
  44. package/dist/types/src/types.d.ts.map +1 -1
  45. package/dist/types/tsconfig.tsbuildinfo +1 -1
  46. package/package.json +60 -55
  47. package/src/capabilities/app-graph-builder.ts +415 -379
  48. package/src/capabilities/react-surface.tsx +23 -12
  49. package/src/components/DebugObjectPanel.tsx +2 -2
  50. package/src/components/DebugStatus.tsx +2 -5
  51. package/src/components/SpaceGenerator/ObjectGenerator.tsx +3 -4
  52. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +1 -1
  53. package/src/components/SpaceGenerator/SpaceGenerator.tsx +5 -5
  54. package/src/components/SpaceGenerator/presets.ts +18 -16
  55. package/src/components/Wireframe.tsx +2 -2
  56. package/src/meta.ts +0 -1
  57. package/src/translations.ts +1 -0
  58. package/src/types.ts +6 -5
  59. package/dist/lib/browser/DebugApp-7PFYN52J.mjs +0 -182
  60. package/dist/lib/browser/DevtoolsOverviewContainer-HYNZTH2Z.mjs +0 -19
  61. package/dist/lib/browser/SpaceGenerator-HR7R3RTE.mjs.map +0 -7
  62. package/dist/lib/browser/app-graph-builder-RTKWOHHT.mjs.map +0 -7
  63. package/dist/lib/browser/chunk-TCEHALD4.mjs +0 -73
  64. package/dist/lib/browser/chunk-TCEHALD4.mjs.map +0 -7
  65. package/dist/lib/browser/react-surface-NEMNEAAI.mjs.map +0 -7
  66. /package/dist/lib/browser/{react-context-ZRLN5KUI.mjs.map → react-context-ZQRD2WG2.mjs.map} +0 -0
  67. /package/dist/lib/browser/{settings-BIRIGKTH.mjs.map → settings-N4Q6YB7L.mjs.map} +0 -0
@@ -13,7 +13,8 @@ import {
13
13
  createSurface,
14
14
  LayoutAction,
15
15
  useCapability,
16
- type PluginsContext,
16
+ useIntentDispatcher,
17
+ type PluginContext,
17
18
  } from '@dxos/app-framework';
18
19
  import {
19
20
  AutomergePanel,
@@ -24,7 +25,7 @@ import {
24
25
  EdgeDashboardPanel,
25
26
  FeedsPanel,
26
27
  IdentityPanel,
27
- InvocationTracePanel,
28
+ InvocationTraceContainer,
28
29
  KeyringPanel,
29
30
  LoggingPanel,
30
31
  MembersPanel,
@@ -32,6 +33,7 @@ import {
32
33
  NetworkPanel,
33
34
  ObjectsPanel,
34
35
  QueuesPanel,
36
+ SchemaPanel,
35
37
  SignalPanel,
36
38
  SpaceInfoPanel,
37
39
  SpaceListPanel,
@@ -51,7 +53,7 @@ import {
51
53
  SpaceState,
52
54
  isSpace,
53
55
  isEchoObject,
54
- type ReactiveEchoObject,
56
+ type AnyLiveObject,
55
57
  type Live,
56
58
  type Space,
57
59
  parseId,
@@ -90,7 +92,7 @@ const useCurrentSpace = () => {
90
92
  return space;
91
93
  };
92
94
 
93
- export default (context: PluginsContext) =>
95
+ export default (context: PluginContext) =>
94
96
  contributes(Capabilities.ReactSurface, [
95
97
  createSurface({
96
98
  id: `${DEBUG_PLUGIN}/plugin-settings`,
@@ -117,7 +119,7 @@ export default (context: PluginsContext) =>
117
119
  return;
118
120
  }
119
121
 
120
- const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
122
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
121
123
  objects.forEach((object) => {
122
124
  void dispatch(createIntent(SpaceAction.AddObject, { target: collection, object }));
123
125
  });
@@ -138,9 +140,9 @@ export default (context: PluginsContext) =>
138
140
  id: `${DEBUG_PLUGIN}/wireframe`,
139
141
  role: ['article', 'section'],
140
142
  position: 'hoist',
141
- filter: (data): data is { subject: ReactiveEchoObject<any> } => {
143
+ filter: (data): data is { subject: AnyLiveObject<any> } => {
142
144
  const settings = context
143
- .requestCapability(Capabilities.SettingsStore)
145
+ .getCapability(Capabilities.SettingsStore)
144
146
  .getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
145
147
  return isEchoObject(data.subject) && !!settings.wireframe;
146
148
  },
@@ -151,7 +153,7 @@ export default (context: PluginsContext) =>
151
153
  createSurface({
152
154
  id: `${DEBUG_PLUGIN}/object-debug`,
153
155
  role: 'article',
154
- filter: (data): data is { companionTo: ReactiveEchoObject<any> } =>
156
+ filter: (data): data is { companionTo: AnyLiveObject<any> } =>
155
157
  data.subject === 'debug' && isEchoObject(data.companionTo),
156
158
  component: ({ data }) => <DebugObjectPanel object={data.companionTo} />,
157
159
  }),
@@ -232,7 +234,7 @@ export default (context: PluginsContext) =>
232
234
  role: 'article',
233
235
  filter: (data): data is any => data.subject === Devtools.Echo.Spaces,
234
236
  component: () => {
235
- const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
237
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
236
238
  const handleSelect = useCallback(
237
239
  () => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Space] })),
238
240
  [dispatch],
@@ -246,7 +248,7 @@ export default (context: PluginsContext) =>
246
248
  filter: (data): data is any => data.subject === Devtools.Echo.Space,
247
249
  component: () => {
248
250
  const space = useCurrentSpace();
249
- const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
251
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
250
252
  const handleSelect = useCallback(
251
253
  () => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Feeds] })),
252
254
  [dispatch],
@@ -272,6 +274,15 @@ export default (context: PluginsContext) =>
272
274
  return <ObjectsPanel space={space} />;
273
275
  },
274
276
  }),
277
+ createSurface({
278
+ id: `${DEBUG_PLUGIN}/echo/schema`,
279
+ role: 'article',
280
+ filter: (data): data is any => data.subject === Devtools.Echo.Schema,
281
+ component: () => {
282
+ const space = useCurrentSpace();
283
+ return <SchemaPanel space={space} />;
284
+ },
285
+ }),
275
286
  createSurface({
276
287
  id: `${DEBUG_PLUGIN}/echo/automerge`,
277
288
  role: 'article',
@@ -351,7 +362,7 @@ export default (context: PluginsContext) =>
351
362
  filter: (data): data is any => data.subject === Devtools.Edge.Traces,
352
363
  component: () => {
353
364
  const space = useCurrentSpace();
354
- return <InvocationTracePanel space={space} />;
365
+ return <InvocationTraceContainer space={space} />;
355
366
  },
356
367
  }),
357
368
  createSurface({
@@ -359,7 +370,7 @@ export default (context: PluginsContext) =>
359
370
  role: 'article',
360
371
  filter: (data): data is any => data.subject === Devtools.Edge.Testing,
361
372
  component: () => {
362
- const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
373
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
363
374
  const onSpaceCreate = useCallback(
364
375
  async (space: Space) => {
365
376
  await space.waitUntilReady();
@@ -4,12 +4,12 @@
4
4
 
5
5
  import React from 'react';
6
6
 
7
- import { type ReactiveEchoObject } from '@dxos/client/echo';
7
+ import { type AnyLiveObject } from '@dxos/client/echo';
8
8
  import { Clipboard, Input } from '@dxos/react-ui';
9
9
  import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
10
10
 
11
11
  export type DebugObjectPanelProps = {
12
- object: ReactiveEchoObject<any>;
12
+ object: AnyLiveObject<any>;
13
13
  };
14
14
 
15
15
  // TODO(burdon): Get schema and traverse references.
@@ -4,9 +4,8 @@
4
4
 
5
5
  import React, { useEffect, useRef, useState } from 'react';
6
6
 
7
- import { useAppGraph, useLayout } from '@dxos/app-framework';
8
7
  import { TimeoutError } from '@dxos/async';
9
- import { getActiveSpace } from '@dxos/plugin-space';
8
+ import { useActiveSpace } from '@dxos/plugin-space';
10
9
  import { StatusBar } from '@dxos/plugin-status-bar';
11
10
  import { ConnectionState } from '@dxos/protocols/proto/dxos/client/services';
12
11
  import { useNetworkStatus } from '@dxos/react-client/mesh';
@@ -134,9 +133,7 @@ const SwarmIndicator = () => {
134
133
  // TODO(burdon): Merge with SaveStatus.
135
134
  const SavingIndicator = () => {
136
135
  const [state, _setState] = useState(0);
137
- const layout = useLayout();
138
- const { graph } = useAppGraph();
139
- const _space = graph ? getActiveSpace(graph, layout.active[0]) : undefined;
136
+ const _space = useActiveSpace();
140
137
  // TODO(dmaretskyi): Fix this when we have save status for automerge.
141
138
  // useEffect(() => {
142
139
  // if (!space) {
@@ -14,7 +14,7 @@ import { CanvasType, DiagramType } from '@dxos/plugin-sketch/types';
14
14
  import { faker } from '@dxos/random';
15
15
  import { Filter, type Space } from '@dxos/react-client/echo';
16
16
  import { TableType } from '@dxos/react-ui-table';
17
- import { createView, TextType } from '@dxos/schema';
17
+ import { createView, DataType } from '@dxos/schema';
18
18
  import { createAsyncGenerator, type ValueGenerator } from '@dxos/schema/testing';
19
19
  import { range } from '@dxos/util';
20
20
 
@@ -42,8 +42,7 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
42
42
  return space.db.add(
43
43
  live(DocumentType, {
44
44
  name: faker.commerce.productName(),
45
- content: makeRef(live(TextType, { content: faker.lorem.sentences(5) })),
46
- threads: [],
45
+ content: makeRef(live(DataType.Text, { content: faker.lorem.sentences(5) })),
47
46
  }),
48
47
  );
49
48
  });
@@ -150,7 +149,7 @@ export const createGenerator = <T extends BaseObject>(type: TypedObject<T>): Obj
150
149
  const objects = await generate.createObjects(n);
151
150
 
152
151
  // Find or create table and view.
153
- const { objects: tables } = await space.db.query(Filter.schema(TableType)).run();
152
+ const { objects: tables } = await space.db.query(Filter.type(TableType)).run();
154
153
  const table = tables.find((table) => table.view?.target?.query?.typename === type.typename);
155
154
  if (!table) {
156
155
  const name = type.typename.split('/').pop() ?? type.typename;
@@ -26,7 +26,7 @@ const meta: Meta = {
26
26
  title: 'plugins/plugin-debug/SpaceGenerator',
27
27
  component: SpaceGenerator,
28
28
  render: render(DefaultStory),
29
- decorators: [withClientProvider({ createSpace: true }), withLayout({ tooltips: true }), withTheme],
29
+ decorators: [withClientProvider({ createSpace: true }), withLayout(), withTheme],
30
30
  parameters: {
31
31
  layout: 'fullscreen',
32
32
  },
@@ -6,7 +6,7 @@ import React, { useCallback, useMemo, useState } from 'react';
6
6
 
7
7
  import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
8
8
  import { ComputeGraph } from '@dxos/conductor';
9
- import { toEffectSchema } from '@dxos/echo-schema';
9
+ import { Filter, toEffectSchema } from '@dxos/echo-schema';
10
10
  import { live, type Live } from '@dxos/live-object';
11
11
  import { log } from '@dxos/log';
12
12
  import { DocumentType } from '@dxos/plugin-markdown/types';
@@ -18,10 +18,10 @@ import { getTypename, type Space } from '@dxos/react-client/echo';
18
18
  import { IconButton, Input, Toolbar, useAsyncEffect } from '@dxos/react-ui';
19
19
  import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
20
20
  import { initializeTable, TableType } from '@dxos/react-ui-table';
21
- import { Testing } from '@dxos/schema/testing';
21
+ import { DataType } from '@dxos/schema';
22
22
  import { jsonKeyReplacer, sortKeys } from '@dxos/util';
23
23
 
24
- import { type ObjectGenerator, createGenerator, staticGenerators } from './ObjectGenerator';
24
+ import { createGenerator, staticGenerators, type ObjectGenerator } from './ObjectGenerator';
25
25
  import { SchemaTable } from './SchemaTable';
26
26
  import { presets } from './presets';
27
27
 
@@ -34,7 +34,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
34
34
  const { dispatchPromise: dispatch } = useIntentDispatcher();
35
35
  const client = useClient();
36
36
  const staticTypes = [DocumentType, DiagramType, SheetType, ComputeGraph]; // TODO(burdon): Make extensible.
37
- const mutableTypes = [Testing.Organization, Testing.Project, Testing.Contact, Testing.Message];
37
+ const mutableTypes = [DataType.Organization, DataType.Project, DataType.Person, DataType.Message];
38
38
  const [count, setCount] = useState(1);
39
39
  const [info, setInfo] = useState<any>({});
40
40
 
@@ -55,7 +55,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
55
55
  const staticSchema = space.db.graph.schemaRegistry.schemas;
56
56
 
57
57
  // Create object map.
58
- const { objects } = await space.db.query().run();
58
+ const { objects } = await space.db.query(Filter.everything()).run();
59
59
  const objectMap = sortKeys(
60
60
  objects.reduce<Record<string, number>>((map, obj) => {
61
61
  const type = getTypename(obj);
@@ -2,9 +2,12 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { type ComputeGraphModel, EmailTriggerOutput, NODE_INPUT } from '@dxos/conductor';
6
- import { AST, ObjectId, S, toJsonSchema } from '@dxos/echo-schema';
7
- import { FunctionTrigger, TriggerKind, type TriggerType } from '@dxos/functions/types';
5
+ import { Schema, SchemaAST } from 'effect';
6
+
7
+ import { type ComputeGraphModel, NODE_INPUT } from '@dxos/conductor';
8
+ import { Ref } from '@dxos/echo';
9
+ import { ObjectId, toJsonSchema } from '@dxos/echo-schema';
10
+ import { FunctionTrigger, TriggerKind, EmailTriggerOutput, type TriggerType } from '@dxos/functions';
8
11
  import { invariant } from '@dxos/invariant';
9
12
  import { DXN } from '@dxos/keys';
10
13
  import { live, makeRef } from '@dxos/live-object';
@@ -131,7 +134,7 @@ export const presets = {
131
134
  const objects = range(n, () => {
132
135
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
133
136
 
134
- const results = space.db.query(Filter.schema(TableType)).runSync();
137
+ const results = space.db.query(Filter.type(TableType)).runSync();
135
138
  const emailTable = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Email'));
136
139
  invariant(emailTable, 'Email table not found.');
137
140
 
@@ -161,7 +164,7 @@ export const presets = {
161
164
 
162
165
  const appendToTable = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
163
166
 
164
- const properties = AST.getPropertySignatures(EmailTriggerOutput.ast);
167
+ const properties = SchemaAST.getPropertySignatures(EmailTriggerOutput.ast);
165
168
  for (let i = 0; i < properties.length; i++) {
166
169
  const propName = properties[i].name.toString();
167
170
  builder.createEdge({ source: trigger.id, target: template.id, input: propName, output: propName });
@@ -228,7 +231,7 @@ export const presets = {
228
231
  const objects = range(n, () => {
229
232
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
230
233
 
231
- const results = space.db.query(Filter.schema(TableType)).runSync();
234
+ const results = space.db.query(Filter.type(TableType)).runSync();
232
235
  const emailTable = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Email'));
233
236
  invariant(emailTable, 'Email table not found.');
234
237
 
@@ -280,7 +283,7 @@ export const presets = {
280
283
  templateContent.push(' "category": "{{text}}",');
281
284
  builder.createEdge({ source: gpt.id, target: template.id, input: 'text', output: 'text' });
282
285
 
283
- const properties = AST.getPropertySignatures(EmailTriggerOutput.ast);
286
+ const properties = SchemaAST.getPropertySignatures(EmailTriggerOutput.ast);
284
287
  for (let i = 0; i < properties.length; i++) {
285
288
  const propName = properties[i].name.toString();
286
289
  builder.createEdge({ source: trigger.id, target: template.id, input: propName, output: propName });
@@ -304,7 +307,7 @@ export const presets = {
304
307
  const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
305
308
  invariant(templateComputeNode, 'Template compute node was not created.');
306
309
  templateComputeNode.value = templateContent.join('\n');
307
- const extendedSchema = S.extend(EmailTriggerOutput, S.Struct({ text: S.String }));
310
+ const extendedSchema = Schema.extend(EmailTriggerOutput, Schema.Struct({ text: Schema.String }));
308
311
  templateComputeNode.inputSchema = toJsonSchema(extendedSchema);
309
312
 
310
313
  attachTrigger(functionTrigger, computeModel);
@@ -402,11 +405,11 @@ export const presets = {
402
405
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
403
406
 
404
407
  // TODO(wittjosiah): Integrate directly w/ Kanban.
405
- // const results = space.db.query(Filter.schema(KanbanType)).runSync();
408
+ // const results = space.db.query(Filter.type(KanbanType)).runSync();
406
409
  // const kanban = results.find((r) => r.object?.cardView?.target?.query?.type?.endsWith('Message'));
407
410
  // invariant(kanban, 'Kanban not found.');
408
411
 
409
- const results = space.db.query(Filter.schema(TableType)).runSync();
412
+ const results = space.db.query(Filter.type(TableType)).runSync();
410
413
  const messages = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Message'));
411
414
  invariant(messages, 'Table not found.');
412
415
 
@@ -449,7 +452,7 @@ export const presets = {
449
452
  const createQueueSinkPreset = <SpecType extends TriggerKind>(
450
453
  space: Space,
451
454
  triggerKind: SpecType,
452
- initSpec: (spec: Extract<TriggerType, { type: SpecType }>) => void,
455
+ initSpec: (spec: Extract<TriggerType, { kind: SpecType }>) => void,
453
456
  triggerOutputName: string,
454
457
  ) => {
455
458
  const canvasModel = CanvasGraphModel.create<ComputeShape>();
@@ -491,7 +494,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
491
494
 
492
495
  functionTrigger = triggerShape.functionTrigger!.target!;
493
496
  const triggerSpec = functionTrigger.spec;
494
- invariant(triggerSpec && triggerSpec.type === triggerKind, 'No trigger spec.');
497
+ invariant(triggerSpec && triggerSpec.kind === triggerKind, 'No trigger spec.');
495
498
  initSpec(triggerSpec as any);
496
499
  });
497
500
 
@@ -500,7 +503,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
500
503
  const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
501
504
  invariant(templateComputeNode, 'Template compute node was not created.');
502
505
  templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
503
- templateComputeNode.inputSchema = toJsonSchema(S.Struct({ type: S.String, changeId: S.String }));
506
+ templateComputeNode.inputSchema = toJsonSchema(Schema.Struct({ type: Schema.String, changeId: Schema.String }));
504
507
 
505
508
  attachTrigger(functionTrigger, computeModel);
506
509
 
@@ -539,10 +542,9 @@ const setupQueue = (
539
542
 
540
543
  const attachTrigger = (functionTrigger: FunctionTrigger | undefined, computeModel: ComputeGraphModel) => {
541
544
  invariant(functionTrigger);
542
- functionTrigger.function = DXN.fromLocalObjectId(computeModel.root.id).toString();
543
- functionTrigger.meta ??= {};
545
+ functionTrigger.function = Ref.make(computeModel.root);
544
546
  const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
545
- functionTrigger.meta.computeNodeId = inputNode.id;
547
+ functionTrigger.inputNodeId = inputNode.id;
546
548
  };
547
549
 
548
550
  type RawPositionInput = { centerX: number; centerY: number; width: number; height: number };
@@ -5,7 +5,7 @@
5
5
  import React from 'react';
6
6
  import { useResizeDetector } from 'react-resize-detector';
7
7
 
8
- import { fullyQualifiedId, type ReactiveEchoObject } from '@dxos/react-client/echo';
8
+ import { fullyQualifiedId, type AnyLiveObject } from '@dxos/react-client/echo';
9
9
  import { type ThemedClassName } from '@dxos/react-ui';
10
10
  import { useAttendableAttributes } from '@dxos/react-ui-attention';
11
11
  import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
@@ -14,7 +14,7 @@ import { mx } from '@dxos/react-ui-theme';
14
14
  // TODO(burdon): Create generic container with wireframe mode.
15
15
  export type WireframeProps = ThemedClassName<{
16
16
  label?: string;
17
- object: ReactiveEchoObject<any>;
17
+ object: AnyLiveObject<any>;
18
18
  }>;
19
19
 
20
20
  // TODO(burdon): Make focusable and attendable with input.
package/src/meta.ts CHANGED
@@ -13,6 +13,5 @@ export const meta: PluginMeta = {
13
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.',
14
14
  icon: 'ph--bug--regular',
15
15
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-debug',
16
- tags: ['experimental'],
17
16
  screenshots: ['https://dxos.network/plugin-details-debug-dark.png'],
18
17
  };
@@ -48,6 +48,7 @@ export default [
48
48
  'space label': 'Space',
49
49
  'feeds label': 'Feeds',
50
50
  'objects label': 'Objects',
51
+ 'schema label': 'Schema',
51
52
  'automerge label': 'Automerge',
52
53
  'queues label': 'Queues',
53
54
  'members label': 'Members',
package/src/types.ts CHANGED
@@ -2,10 +2,10 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
+ import { Schema } from 'effect';
5
6
  import { type Context, createContext } from 'react';
6
7
 
7
8
  import type { TimerCallback, TimerOptions } from '@dxos/async';
8
- import { S } from '@dxos/echo-schema';
9
9
 
10
10
  export type DebugContextType = {
11
11
  running: boolean;
@@ -19,13 +19,13 @@ export const DebugContext: Context<DebugContextType> = createContext<DebugContex
19
19
  stop: () => {},
20
20
  });
21
21
 
22
- export const DebugSettingsSchema = S.mutable(
23
- S.Struct({
24
- wireframe: S.optional(S.Boolean),
22
+ export const DebugSettingsSchema = Schema.mutable(
23
+ Schema.Struct({
24
+ wireframe: Schema.optional(Schema.Boolean),
25
25
  }),
26
26
  );
27
27
 
28
- export interface DebugSettingsProps extends S.Schema.Type<typeof DebugSettingsSchema> {}
28
+ export interface DebugSettingsProps extends Schema.Schema.Type<typeof DebugSettingsSchema> {}
29
29
 
30
30
  export namespace Devtools {
31
31
  // TODO(wittjosiah): Cannot use slashes in ids until we have a router which decouples ids from url paths.
@@ -54,6 +54,7 @@ export namespace Devtools {
54
54
  export const Space = `${Devtools.Echo.id}.space`;
55
55
  export const Feeds = `${Devtools.Echo.id}.feeds`;
56
56
  export const Objects = `${Devtools.Echo.id}.objects`;
57
+ export const Schema = `${Devtools.Echo.id}.schema`;
57
58
  export const Automerge = `${Devtools.Echo.id}.automerge`;
58
59
  export const Queues = `${Devtools.Echo.id}.queues`;
59
60
  export const Members = `${Devtools.Echo.id}.members`;
@@ -1,182 +0,0 @@
1
- // packages/plugins/plugin-debug/src/components/DebugApp/DebugApp.tsx
2
- import { Gauge, Graph as GraphIcon, Gear, Toolbox, Warning } from "@phosphor-icons/react";
3
- import React3, { useEffect, useState as useState2 } from "react";
4
- import { useClient, useConfig } from "@dxos/react-client";
5
- import { Button, ToggleGroup, ToggleGroupItem, Toolbar } from "@dxos/react-ui";
6
- import { getSize, mx as mx2 } from "@dxos/react-ui-theme";
7
-
8
- // packages/plugins/plugin-debug/src/components/DebugApp/Tree.tsx
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
- return /* @__PURE__ */ React.createElement(SyntaxHighlighter, {
29
- language: "json"
30
- }, JSON.stringify(data, replacer, 2));
31
- };
32
- var Tree = ({ data }) => {
33
- return /* @__PURE__ */ React.createElement("div", {
34
- className: "p-2"
35
- }, /* @__PURE__ */ React.createElement(Node, {
36
- data,
37
- root: true
38
- }));
39
- };
40
- var Node = ({ data, root }) => {
41
- if (typeof data !== "object" || data === void 0 || data === null) {
42
- return /* @__PURE__ */ React.createElement(Scalar, {
43
- value: data
44
- });
45
- }
46
- if (Array.isArray(data)) {
47
- return /* @__PURE__ */ React.createElement("div", {
48
- className: "flex flex-col space-y-2"
49
- }, data.map((value, index) => /* @__PURE__ */ React.createElement(KeyValue, {
50
- key: index,
51
- label: String(index),
52
- data: value,
53
- className: "bg-teal-50"
54
- })));
55
- }
56
- return /* @__PURE__ */ React.createElement("div", {
57
- className: "flex flex-col space-y-2"
58
- }, Object.entries(data).map(([key, value]) => /* @__PURE__ */ React.createElement(KeyValue, {
59
- key,
60
- label: key,
61
- data: value,
62
- className: "bg-blue-50"
63
- })));
64
- };
65
- var KeyValue = ({ label, data, className }) => {
66
- const [open, setOpen] = useState(true);
67
- if (data === void 0) {
68
- return null;
69
- }
70
- return /* @__PURE__ */ React.createElement("div", {
71
- className: "flex"
72
- }, /* @__PURE__ */ React.createElement(Box, {
73
- className: mx("border-blue-200 text-sm select-none cursor-pointer", className),
74
- onClick: () => setOpen((open2) => !open2)
75
- }, label), open && /* @__PURE__ */ React.createElement(Node, {
76
- data
77
- }));
78
- };
79
- var Scalar = ({ value }) => {
80
- return /* @__PURE__ */ React.createElement(Box, {
81
- className: "bg-green-50 border-green-200 rounded-r text-sm font-thin"
82
- }, value === void 0 && "undefined" || value === null && "null" || typeof value === "string" && value || JSON.stringify(value));
83
- };
84
- var Box = ({ children, className, ...props }) => {
85
- return /* @__PURE__ */ React.createElement("div", {
86
- className: mx("flex px-2 border border-l-0 font-mono truncate", className),
87
- ...props
88
- }, children);
89
- };
90
-
91
- // packages/plugins/plugin-debug/src/components/Container.tsx
92
- import React2 from "react";
93
- var Container = ({ toolbar, children }) => {
94
- return /* @__PURE__ */ React2.createElement("div", {
95
- role: "none",
96
- className: "flex flex-col grow overflow-hidden divide-y divide-separator"
97
- }, toolbar, /* @__PURE__ */ React2.createElement("div", {
98
- className: "flex flex-col grow overflow-auto"
99
- }, children));
100
- };
101
-
102
- // packages/plugins/plugin-debug/src/components/DebugApp/DebugApp.tsx
103
- var DebugApp = ({ graph }) => {
104
- const [view, setView] = useState2("graph");
105
- const [data, setData] = useState2({});
106
- const client = useClient();
107
- const config = useConfig();
108
- const handleRefresh = async () => {
109
- const data2 = await client.diagnostics({
110
- truncate: true
111
- });
112
- setData(data2);
113
- };
114
- useEffect(() => {
115
- void handleRefresh();
116
- }, []);
117
- const handleResetClient = async (force = false) => {
118
- if (!force && !window.confirm("Reset storage?")) {
119
- return;
120
- }
121
- await client.reset();
122
- window.location.href = window.location.origin;
123
- };
124
- const handleOpenDevtools = () => {
125
- const vaultUrl = config.values?.runtime?.client?.remoteSource;
126
- if (vaultUrl) {
127
- window.open(`https://devtools.dev.dxos.org/?target=${vaultUrl}`);
128
- }
129
- };
130
- return /* @__PURE__ */ React3.createElement(Container, {
131
- toolbar: /* @__PURE__ */ React3.createElement(Toolbar.Root, {
132
- classNames: "p-1"
133
- }, /* @__PURE__ */ React3.createElement(ToggleGroup, {
134
- type: "single",
135
- value: view
136
- }, /* @__PURE__ */ React3.createElement(ToggleGroupItem, {
137
- value: "graph",
138
- onClick: () => setView("graph"),
139
- title: "Plugin graph"
140
- }, /* @__PURE__ */ React3.createElement(GraphIcon, {
141
- className: getSize(5)
142
- })), /* @__PURE__ */ React3.createElement(ToggleGroupItem, {
143
- value: "diagnostics",
144
- onClick: () => setView("diagnostics"),
145
- title: "Diagnostics"
146
- }, /* @__PURE__ */ React3.createElement(Gauge, {
147
- className: getSize(5)
148
- })), /* @__PURE__ */ React3.createElement(ToggleGroupItem, {
149
- value: "config",
150
- onClick: () => setView("config"),
151
- title: "Config"
152
- }, /* @__PURE__ */ React3.createElement(Gear, {
153
- className: getSize(5)
154
- }))), /* @__PURE__ */ React3.createElement(Toolbar.Separator, {
155
- variant: "gap"
156
- }), /* @__PURE__ */ React3.createElement(Button, {
157
- onClick: (event) => handleResetClient(event.shiftKey),
158
- title: "Reset client"
159
- }, /* @__PURE__ */ React3.createElement(Warning, {
160
- className: mx2(getSize(5), "text-red-700")
161
- })), /* @__PURE__ */ React3.createElement(Button, {
162
- onClick: handleOpenDevtools,
163
- title: "Open Devtools"
164
- }, /* @__PURE__ */ React3.createElement(Toolbox, {
165
- weight: "duotone",
166
- className: mx2(getSize(5), "text-700")
167
- })))
168
- }, view === "graph" && /* @__PURE__ */ React3.createElement(Tree, {
169
- data: graph.toJSON()
170
- }), view === "config" && /* @__PURE__ */ React3.createElement(Json, {
171
- data: data.diagnostics?.config
172
- }), view === "diagnostics" && /* @__PURE__ */ React3.createElement(Json, {
173
- data
174
- }));
175
- };
176
-
177
- // packages/plugins/plugin-debug/src/components/DebugApp/index.ts
178
- var DebugApp_default = DebugApp;
179
- export {
180
- DebugApp_default as default
181
- };
182
- //# sourceMappingURL=DebugApp-7PFYN52J.mjs.map
@@ -1,19 +0,0 @@
1
- // packages/plugins/plugin-debug/src/components/DevtoolsOverviewContainer.tsx
2
- import React from "react";
3
- import { Surface } from "@dxos/app-framework";
4
- import { StatsPanel, useStats } from "@dxos/devtools";
5
- var DevtoolsOverviewContainer = () => {
6
- const [stats, refreshStats] = useStats();
7
- return /* @__PURE__ */ React.createElement(StatsPanel, {
8
- stats,
9
- onRefresh: refreshStats
10
- }, /* @__PURE__ */ React.createElement(Surface, {
11
- role: "devtools-overview"
12
- }));
13
- };
14
- var DevtoolsOverviewContainer_default = DevtoolsOverviewContainer;
15
- export {
16
- DevtoolsOverviewContainer,
17
- DevtoolsOverviewContainer_default as default
18
- };
19
- //# sourceMappingURL=DevtoolsOverviewContainer-HYNZTH2Z.mjs.map