@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
|
@@ -392,13 +392,12 @@ import * as Function3 from "effect/Function";
|
|
|
392
392
|
import * as Option3 from "effect/Option";
|
|
393
393
|
import * as Schema5 from "effect/Schema";
|
|
394
394
|
import * as SchemaAST from "effect/SchemaAST";
|
|
395
|
-
import { Obj as Obj3 } from "@dxos/echo";
|
|
396
|
-
import {
|
|
397
|
-
import { EntityKind, ObjectId, ReferenceAnnotationId, RelationSourceDXNId, RelationSourceId, RelationTargetDXNId, RelationTargetId, create, getEntityKind, getSchemaDXN, getSchemaTypename, getTypeAnnotation, getTypeIdentifierAnnotation } from "@dxos/echo/internal";
|
|
395
|
+
import { Entity, Filter, Obj as Obj3, Query, Type as Type2 } from "@dxos/echo";
|
|
396
|
+
import { ReferenceAnnotationId, RelationSourceDXNId, RelationSourceId, RelationTargetDXNId, RelationTargetId, createObject, getTypeAnnotation, getTypeIdentifierAnnotation } from "@dxos/echo/internal";
|
|
398
397
|
import { isEncodedReference } from "@dxos/echo-protocol";
|
|
399
398
|
import { mapAst } from "@dxos/effect";
|
|
400
399
|
import { ContextQueueService, DatabaseService as DatabaseService4 } from "@dxos/functions";
|
|
401
|
-
import { DXN } from "@dxos/keys";
|
|
400
|
+
import { DXN, ObjectId } from "@dxos/keys";
|
|
402
401
|
import { log as log3 } from "@dxos/log";
|
|
403
402
|
import { deepMapValues, isNonNullable, trim } from "@dxos/util";
|
|
404
403
|
var __dxlog_file3 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/crud/graph.ts";
|
|
@@ -411,7 +410,7 @@ var findRelatedSchema = async (db, anchor) => {
|
|
|
411
410
|
...db.graph.schemaRegistry.schemas
|
|
412
411
|
];
|
|
413
412
|
return allSchemas.filter((schema) => {
|
|
414
|
-
if (getTypeAnnotation(schema)?.kind !==
|
|
413
|
+
if (getTypeAnnotation(schema)?.kind !== Entity.Kind.Relation) {
|
|
415
414
|
return false;
|
|
416
415
|
}
|
|
417
416
|
return isSchemaAddressableByDxn(anchor, DXN.parse(getTypeAnnotation(schema).sourceSchema)) || isSchemaAddressableByDxn(anchor, DXN.parse(getTypeAnnotation(schema).targetSchema));
|
|
@@ -426,7 +425,7 @@ var isSchemaAddressableByDxn = (schema, dxn) => {
|
|
|
426
425
|
}
|
|
427
426
|
const t = dxn.asTypeDXN();
|
|
428
427
|
if (t) {
|
|
429
|
-
return t.type ===
|
|
428
|
+
return t.type === Type2.getTypename(schema);
|
|
430
429
|
}
|
|
431
430
|
return false;
|
|
432
431
|
};
|
|
@@ -498,13 +497,13 @@ var createExtractionSchema = (types) => {
|
|
|
498
497
|
...Object.fromEntries(types.map(preprocessSchema).map((schema, index) => [
|
|
499
498
|
`objects_${getSanitizedSchemaName(types[index])}`,
|
|
500
499
|
Schema5.optional(Schema5.Array(schema)).annotations({
|
|
501
|
-
description: `The objects of type: ${
|
|
500
|
+
description: `The objects of type: ${Type2.getDXN(types[index])?.asTypeDXN().type}. ${SchemaAST.getDescriptionAnnotation(types[index].ast).pipe(Option3.getOrElse(() => ""))}`
|
|
502
501
|
})
|
|
503
502
|
]))
|
|
504
503
|
});
|
|
505
504
|
};
|
|
506
505
|
var getSanitizedSchemaName = (schema) => {
|
|
507
|
-
return
|
|
506
|
+
return Type2.getDXN(schema).asTypeDXN().type.replaceAll(/[^a-zA-Z0-9]+/g, "_");
|
|
508
507
|
};
|
|
509
508
|
var sanitizeObjects = async (types, data, db, queue) => {
|
|
510
509
|
const entries = types.map((type) => data[`objects_${getSanitizedSchemaName(type)}`]?.map((object) => ({
|
|
@@ -549,14 +548,14 @@ var sanitizeObjects = async (types, data, db, queue) => {
|
|
|
549
548
|
}
|
|
550
549
|
return recurse(value2);
|
|
551
550
|
});
|
|
552
|
-
if (
|
|
551
|
+
if (Entity.getKind(entry.schema) === "relation") {
|
|
553
552
|
const sourceDxn = resolveId(data2.source);
|
|
554
553
|
if (!sourceDxn) {
|
|
555
554
|
log3.warn("source not found", {
|
|
556
555
|
source: data2.source
|
|
557
556
|
}, {
|
|
558
557
|
F: __dxlog_file3,
|
|
559
|
-
L:
|
|
558
|
+
L: 275,
|
|
560
559
|
S: void 0,
|
|
561
560
|
C: (f, a) => f(...a)
|
|
562
561
|
});
|
|
@@ -567,7 +566,7 @@ var sanitizeObjects = async (types, data, db, queue) => {
|
|
|
567
566
|
target: data2.target
|
|
568
567
|
}, {
|
|
569
568
|
F: __dxlog_file3,
|
|
570
|
-
L:
|
|
569
|
+
L: 279,
|
|
571
570
|
S: void 0,
|
|
572
571
|
C: (f, a) => f(...a)
|
|
573
572
|
});
|
|
@@ -596,7 +595,7 @@ var sanitizeObjects = async (types, data, db, queue) => {
|
|
|
596
595
|
existingIds
|
|
597
596
|
}, {
|
|
598
597
|
F: __dxlog_file3,
|
|
599
|
-
L:
|
|
598
|
+
L: 300,
|
|
600
599
|
S: void 0,
|
|
601
600
|
C: (f, a) => f(...a)
|
|
602
601
|
});
|
|
@@ -627,7 +626,7 @@ var sanitizeObjects = async (types, data, db, queue) => {
|
|
|
627
626
|
}
|
|
628
627
|
}
|
|
629
628
|
if (!skip) {
|
|
630
|
-
const obj =
|
|
629
|
+
const obj = createObject(schema, data2);
|
|
631
630
|
enitties.set(obj.id, obj);
|
|
632
631
|
return [
|
|
633
632
|
obj
|
|
@@ -642,7 +641,7 @@ var SoftRef = Schema5.Struct({
|
|
|
642
641
|
description: "Reference to another object."
|
|
643
642
|
});
|
|
644
643
|
var preprocessSchema = (schema) => {
|
|
645
|
-
const isRelationSchema =
|
|
644
|
+
const isRelationSchema = Entity.getKind(schema) === "relation";
|
|
646
645
|
const go = (ast, visited = /* @__PURE__ */ new Set()) => {
|
|
647
646
|
if (visited.has(ast)) {
|
|
648
647
|
return ast;
|
|
@@ -1362,15 +1361,16 @@ var levenshteinDistance = (str1, str2) => {
|
|
|
1362
1361
|
import * as Effect9 from "effect/Effect";
|
|
1363
1362
|
import * as Layer2 from "effect/Layer";
|
|
1364
1363
|
import * as Schema9 from "effect/Schema";
|
|
1365
|
-
import { Obj as Obj5, Query as Query2, Ref as Ref2, Type as
|
|
1364
|
+
import { Obj as Obj5, Query as Query2, Ref as Ref2, Type as Type3 } from "@dxos/echo";
|
|
1365
|
+
import { SystemTypeAnnotation } from "@dxos/echo/internal";
|
|
1366
1366
|
import { Queue } from "@dxos/echo-db";
|
|
1367
1367
|
import { ContextQueueService as ContextQueueService2, DatabaseService as DatabaseService6, QueueService } from "@dxos/functions";
|
|
1368
1368
|
var ResearchGraph = Schema9.Struct({
|
|
1369
|
-
queue:
|
|
1370
|
-
}).pipe(
|
|
1369
|
+
queue: Type3.Ref(Queue)
|
|
1370
|
+
}).pipe(Type3.Obj({
|
|
1371
1371
|
typename: "dxos.org/type/ResearchGraph",
|
|
1372
1372
|
version: "0.1.0"
|
|
1373
|
-
}));
|
|
1373
|
+
}), SystemTypeAnnotation.set(true));
|
|
1374
1374
|
var queryResearchGraph = Effect9.fn("queryResearchGraph")(function* () {
|
|
1375
1375
|
const { objects } = yield* DatabaseService6.runQuery(Query2.type(ResearchGraph));
|
|
1376
1376
|
return objects.at(0);
|
|
@@ -2430,11 +2430,11 @@ var websearch_default = websearch_blueprint_default;
|
|
|
2430
2430
|
import * as Schema15 from "effect/Schema";
|
|
2431
2431
|
import React from "react";
|
|
2432
2432
|
import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
|
|
2433
|
-
import { Type as
|
|
2433
|
+
import { Format, Type as Type4 } from "@dxos/echo";
|
|
2434
2434
|
import { JsonFilter } from "@dxos/react-ui-syntax-highlighter";
|
|
2435
2435
|
var MapSchema = Schema15.Struct({
|
|
2436
|
-
coordinates:
|
|
2437
|
-
}).pipe(
|
|
2436
|
+
coordinates: Format.GeoPoint
|
|
2437
|
+
}).pipe(Type4.Obj({
|
|
2438
2438
|
typename: "example.com/type/Map",
|
|
2439
2439
|
version: "0.1.0"
|
|
2440
2440
|
}));
|
|
@@ -2523,7 +2523,7 @@ import * as Effect17 from "effect/Effect";
|
|
|
2523
2523
|
import * as Record2 from "effect/Record";
|
|
2524
2524
|
import * as Schema17 from "effect/Schema";
|
|
2525
2525
|
import { ArtifactId as ArtifactId7 } from "@dxos/assistant";
|
|
2526
|
-
import { DXN as DXN2, Obj as Obj16, Relation as Relation2, Tag as Tag2, Type as
|
|
2526
|
+
import { DXN as DXN2, Obj as Obj16, Relation as Relation2, Tag as Tag2, Type as Type5 } from "@dxos/echo";
|
|
2527
2527
|
import { DatabaseService as DatabaseService14 } from "@dxos/functions";
|
|
2528
2528
|
import { trim as trim11 } from "@dxos/util";
|
|
2529
2529
|
var SystemToolkit = Toolkit6.make(
|
|
@@ -2674,10 +2674,10 @@ var layer4 = () => SystemToolkit.toLayer({
|
|
|
2674
2674
|
]
|
|
2675
2675
|
}).run());
|
|
2676
2676
|
return schema.map((schema2) => {
|
|
2677
|
-
const meta =
|
|
2677
|
+
const meta = Type5.getMeta(schema2);
|
|
2678
2678
|
return {
|
|
2679
|
-
typename:
|
|
2680
|
-
jsonSchema:
|
|
2679
|
+
typename: Type5.getTypename(schema2),
|
|
2680
|
+
jsonSchema: Type5.toJsonSchema(schema2),
|
|
2681
2681
|
kind: meta?.sourceSchema ? "relation" : "record"
|
|
2682
2682
|
};
|
|
2683
2683
|
});
|