@dxos/assistant-toolkit 0.8.4-main.2c6827d → 0.8.4-main.66e292d

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/assistant-toolkit",
3
- "version": "0.8.4-main.2c6827d",
3
+ "version": "0.8.4-main.66e292d",
4
4
  "description": "Assistant toolkit, definitions, and utilities.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -30,28 +30,28 @@
30
30
  "@effect/platform": "^0.92.1",
31
31
  "dfx": "^0.126.0",
32
32
  "exa-js": "^1.5.12",
33
- "@dxos/app-framework": "0.8.4-main.2c6827d",
34
- "@dxos/ai": "0.8.4-main.2c6827d",
35
- "@dxos/assistant": "0.8.4-main.2c6827d",
36
- "@dxos/blueprints": "0.8.4-main.2c6827d",
37
- "@dxos/conductor": "0.8.4-main.2c6827d",
38
- "@dxos/echo": "0.8.4-main.2c6827d",
39
- "@dxos/context": "0.8.4-main.2c6827d",
40
- "@dxos/echo-protocol": "0.8.4-main.2c6827d",
41
- "@dxos/edge-client": "0.8.4-main.2c6827d",
42
- "@dxos/echo-db": "0.8.4-main.2c6827d",
43
- "@dxos/effect": "0.8.4-main.2c6827d",
44
- "@dxos/invariant": "0.8.4-main.2c6827d",
45
- "@dxos/errors": "0.8.4-main.2c6827d",
46
- "@dxos/functions": "0.8.4-main.2c6827d",
47
- "@dxos/functions-runtime": "0.8.4-main.2c6827d",
48
- "@dxos/keys": "0.8.4-main.2c6827d",
49
- "@dxos/plugin-markdown": "0.8.4-main.2c6827d",
50
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.2c6827d",
51
- "@dxos/log": "0.8.4-main.2c6827d",
52
- "@dxos/schema": "0.8.4-main.2c6827d",
53
- "@dxos/types": "0.8.4-main.2c6827d",
54
- "@dxos/util": "0.8.4-main.2c6827d"
33
+ "@dxos/ai": "0.8.4-main.66e292d",
34
+ "@dxos/app-framework": "0.8.4-main.66e292d",
35
+ "@dxos/assistant": "0.8.4-main.66e292d",
36
+ "@dxos/conductor": "0.8.4-main.66e292d",
37
+ "@dxos/blueprints": "0.8.4-main.66e292d",
38
+ "@dxos/context": "0.8.4-main.66e292d",
39
+ "@dxos/echo": "0.8.4-main.66e292d",
40
+ "@dxos/echo-protocol": "0.8.4-main.66e292d",
41
+ "@dxos/echo-db": "0.8.4-main.66e292d",
42
+ "@dxos/edge-client": "0.8.4-main.66e292d",
43
+ "@dxos/errors": "0.8.4-main.66e292d",
44
+ "@dxos/effect": "0.8.4-main.66e292d",
45
+ "@dxos/functions": "0.8.4-main.66e292d",
46
+ "@dxos/invariant": "0.8.4-main.66e292d",
47
+ "@dxos/functions-runtime": "0.8.4-main.66e292d",
48
+ "@dxos/log": "0.8.4-main.66e292d",
49
+ "@dxos/plugin-markdown": "0.8.4-main.66e292d",
50
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.66e292d",
51
+ "@dxos/keys": "0.8.4-main.66e292d",
52
+ "@dxos/types": "0.8.4-main.66e292d",
53
+ "@dxos/util": "0.8.4-main.66e292d",
54
+ "@dxos/schema": "0.8.4-main.66e292d"
55
55
  },
56
56
  "devDependencies": {
57
57
  "effect": "3.18.3",
package/src/crud/graph.ts CHANGED
@@ -11,20 +11,14 @@ import * as Option from 'effect/Option';
11
11
  import * as Schema from 'effect/Schema';
12
12
  import * as SchemaAST from 'effect/SchemaAST';
13
13
 
14
- import { Obj, type Relation } from '@dxos/echo';
15
- import { Filter, Query } from '@dxos/echo';
14
+ import { Entity, Filter, Obj, Query, Type } from '@dxos/echo';
16
15
  import {
17
- EntityKind,
18
- ObjectId,
19
16
  ReferenceAnnotationId,
20
17
  RelationSourceDXNId,
21
18
  RelationSourceId,
22
19
  RelationTargetDXNId,
23
20
  RelationTargetId,
24
- create,
25
- getEntityKind,
26
- getSchemaDXN,
27
- getSchemaTypename,
21
+ createObject,
28
22
  getTypeAnnotation,
29
23
  getTypeIdentifierAnnotation,
30
24
  } from '@dxos/echo/internal';
@@ -32,7 +26,7 @@ import { type EchoDatabase, type Queue } from '@dxos/echo-db';
32
26
  import { isEncodedReference } from '@dxos/echo-protocol';
33
27
  import { mapAst } from '@dxos/effect';
34
28
  import { ContextQueueService, DatabaseService } from '@dxos/functions';
35
- import { DXN } from '@dxos/keys';
29
+ import { DXN, ObjectId } from '@dxos/keys';
36
30
  import { log } from '@dxos/log';
37
31
  import { deepMapValues, isNonNullable, trim } from '@dxos/util';
38
32
 
@@ -66,7 +60,7 @@ export const findRelatedSchema = async (
66
60
  // TODO(dmaretskyi): Also do references.
67
61
  return allSchemas
68
62
  .filter((schema) => {
69
- if (getTypeAnnotation(schema)?.kind !== EntityKind.Relation) {
63
+ if (getTypeAnnotation(schema)?.kind !== Entity.Kind.Relation) {
70
64
  return false;
71
65
  }
72
66
 
@@ -94,7 +88,7 @@ const isSchemaAddressableByDxn = (schema: Schema.Schema.AnyNoContext, dxn: DXN):
94
88
 
95
89
  const t = dxn.asTypeDXN();
96
90
  if (t) {
97
- return t.type === getSchemaTypename(schema);
91
+ return t.type === Type.getTypename(schema);
98
92
  }
99
93
 
100
94
  return false;
@@ -199,7 +193,7 @@ export const createExtractionSchema = (types: Schema.Schema.AnyNoContext[]) => {
199
193
  types.map(preprocessSchema).map((schema, index) => [
200
194
  `objects_${getSanitizedSchemaName(types[index])}`,
201
195
  Schema.optional(Schema.Array(schema)).annotations({
202
- description: `The objects of type: ${getSchemaDXN(types[index])?.asTypeDXN()!.type}. ${SchemaAST.getDescriptionAnnotation(types[index].ast).pipe(Option.getOrElse(() => ''))}`,
196
+ description: `The objects of type: ${Type.getDXN(types[index])?.asTypeDXN()!.type}. ${SchemaAST.getDescriptionAnnotation(types[index].ast).pipe(Option.getOrElse(() => ''))}`,
203
197
  }),
204
198
  ]),
205
199
  ),
@@ -207,7 +201,7 @@ export const createExtractionSchema = (types: Schema.Schema.AnyNoContext[]) => {
207
201
  };
208
202
 
209
203
  export const getSanitizedSchemaName = (schema: Schema.Schema.AnyNoContext) => {
210
- return getSchemaDXN(schema)!
204
+ return Type.getDXN(schema)!
211
205
  .asTypeDXN()!
212
206
  .type.replaceAll(/[^a-zA-Z0-9]+/g, '_');
213
207
  };
@@ -230,7 +224,7 @@ export const sanitizeObjects = async (
230
224
 
231
225
  const idMap = new Map<string, string>();
232
226
  const existingIds = new Set<ObjectId>();
233
- const enitties = new Map<ObjectId, Obj.Any | Relation.Any>();
227
+ const enitties = new Map<ObjectId, Entity.Unknown>();
234
228
 
235
229
  const resolveId = (id: string): DXN | undefined => {
236
230
  if (ObjectId.isValid(id)) {
@@ -275,7 +269,7 @@ export const sanitizeObjects = async (
275
269
  return recurse(value);
276
270
  });
277
271
 
278
- if (getEntityKind(entry.schema) === 'relation') {
272
+ if (Entity.getKind(entry.schema) === 'relation') {
279
273
  const sourceDxn = resolveId(data.source);
280
274
  if (!sourceDxn) {
281
275
  log.warn('source not found', { source: data.source });
@@ -332,7 +326,7 @@ export const sanitizeObjects = async (
332
326
  }
333
327
  }
334
328
  if (!skip) {
335
- const obj = create(schema, data);
329
+ const obj = createObject(schema, data);
336
330
  enitties.set(obj.id, obj);
337
331
  return [obj];
338
332
  }
@@ -347,7 +341,7 @@ const SoftRef = Schema.Struct({
347
341
  });
348
342
 
349
343
  const preprocessSchema = (schema: Schema.Schema.AnyNoContext) => {
350
- const isRelationSchema = getEntityKind(schema) === 'relation';
344
+ const isRelationSchema = Entity.getKind(schema) === 'relation';
351
345
 
352
346
  const go = (ast: SchemaAST.AST, visited = new Set<SchemaAST.AST>()): SchemaAST.AST => {
353
347
  if (visited.has(ast)) {
@@ -7,6 +7,7 @@ import * as Layer from 'effect/Layer';
7
7
  import * as Schema from 'effect/Schema';
8
8
 
9
9
  import { Obj, Query, Ref, Type } from '@dxos/echo';
10
+ import { SystemTypeAnnotation } from '@dxos/echo/internal';
10
11
  import { Queue } from '@dxos/echo-db';
11
12
  import { ContextQueueService, DatabaseService, QueueService } from '@dxos/functions';
12
13
 
@@ -20,6 +21,7 @@ export const ResearchGraph = Schema.Struct({
20
21
  typename: 'dxos.org/type/ResearchGraph',
21
22
  version: '0.1.0',
22
23
  }),
24
+ SystemTypeAnnotation.set(true),
23
25
  );
24
26
 
25
27
  export interface ResearchGraph extends Schema.Schema.Type<typeof ResearchGraph> {}
@@ -9,7 +9,7 @@ import { Event, HasConnection, HasRelationship, LegacyOrganization, LegacyPerson
9
9
  /**
10
10
  * Data types for research.
11
11
  */
12
- export const ResearchDataTypes: (Type.Obj.Any | Type.Relation.Any)[] = [
12
+ export const ResearchDataTypes: Type.Entity.Any[] = [
13
13
  // Objects
14
14
  Event.Event,
15
15
  LegacyOrganization,
package/src/plugins.tsx CHANGED
@@ -6,11 +6,11 @@ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { type AnyCapability, Capabilities, contributes, createSurface } from '@dxos/app-framework';
9
- import { type Obj, Type } from '@dxos/echo';
9
+ import { Format, type Obj, Type } from '@dxos/echo';
10
10
  import { JsonFilter } from '@dxos/react-ui-syntax-highlighter';
11
11
 
12
12
  export const MapSchema = Schema.Struct({
13
- coordinates: Type.Format.GeoPoint,
13
+ coordinates: Format.GeoPoint,
14
14
  }).pipe(
15
15
  Type.Obj({
16
16
  typename: 'example.com/type/Map',