@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/dist/lib/browser/index.mjs +25 -25
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +25 -25
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/blueprints/discord/discord-blueprint.d.ts +4 -3
- package/dist/types/src/blueprints/discord/discord-blueprint.d.ts.map +1 -1
- package/dist/types/src/blueprints/linear/linear-blueprint.d.ts +4 -3
- package/dist/types/src/blueprints/linear/linear-blueprint.d.ts.map +1 -1
- package/dist/types/src/crud/graph.d.ts.map +1 -1
- package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts +12 -13
- package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts.map +1 -1
- package/dist/types/src/functions/entity-extraction/index.d.ts +12 -13
- package/dist/types/src/functions/entity-extraction/index.d.ts.map +1 -1
- package/dist/types/src/functions/research/research-graph.d.ts +2 -2
- package/dist/types/src/functions/research/research-graph.d.ts.map +1 -1
- package/dist/types/src/functions/research/types.d.ts +1 -1
- package/dist/types/src/functions/research/types.d.ts.map +1 -1
- package/dist/types/src/plugins.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -23
- package/src/crud/graph.ts +11 -17
- package/src/functions/research/research-graph.ts +2 -0
- package/src/functions/research/types.ts +1 -1
- package/src/plugins.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/assistant-toolkit",
|
|
3
|
-
"version": "0.8.4-main.
|
|
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/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/assistant": "0.8.4-main.
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/echo-protocol": "0.8.4-main.
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/functions-runtime": "0.8.4-main.
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/plugin-markdown": "0.8.4-main.
|
|
50
|
-
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
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,
|
|
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
|
-
|
|
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 !==
|
|
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 ===
|
|
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: ${
|
|
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
|
|
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,
|
|
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 (
|
|
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 =
|
|
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 =
|
|
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:
|
|
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:
|
|
13
|
+
coordinates: Format.GeoPoint,
|
|
14
14
|
}).pipe(
|
|
15
15
|
Type.Obj({
|
|
16
16
|
typename: 'example.com/type/Map',
|