@dxos/assistant 0.8.4-main.5acf9ea → 0.8.4-main.5ea62a8
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/chunk-6WRGDEMH.mjs +89 -0
- package/dist/lib/browser/chunk-6WRGDEMH.mjs.map +7 -0
- package/dist/lib/browser/chunk-N4O3C3T5.mjs +396 -0
- package/dist/lib/browser/chunk-N4O3C3T5.mjs.map +7 -0
- package/dist/lib/browser/extraction/index.mjs +268 -0
- package/dist/lib/browser/extraction/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +284 -1609
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/named-entity-recognition-O46UTCLR.mjs +13 -0
- package/dist/lib/browser/named-entity-recognition-O46UTCLR.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3UU5V4FS.mjs +91 -0
- package/dist/lib/node-esm/chunk-3UU5V4FS.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QVJ7EAM2.mjs +398 -0
- package/dist/lib/node-esm/chunk-QVJ7EAM2.mjs.map +7 -0
- package/dist/lib/node-esm/extraction/index.mjs +269 -0
- package/dist/lib/node-esm/extraction/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +283 -1609
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/named-entity-recognition-W4VMRCH6.mjs +14 -0
- package/dist/lib/node-esm/named-entity-recognition-W4VMRCH6.mjs.map +7 -0
- package/dist/types/src/{context/binding.d.ts → conversation/context.d.ts} +45 -3
- package/dist/types/src/conversation/context.d.ts.map +1 -0
- package/dist/types/src/conversation/conversation.d.ts +25 -21
- package/dist/types/src/conversation/conversation.d.ts.map +1 -1
- package/dist/types/src/conversation/index.d.ts +1 -0
- package/dist/types/src/conversation/index.d.ts.map +1 -1
- package/dist/types/src/diff.d.ts +15 -0
- package/dist/types/src/diff.d.ts.map +1 -0
- package/dist/types/src/diff.test.d.ts +2 -0
- package/dist/types/src/diff.test.d.ts.map +1 -0
- package/dist/types/src/errors.d.ts +41 -4
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +59 -27
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction.d.ts +244 -214
- package/dist/types/src/extraction/extraction.d.ts.map +1 -1
- package/dist/types/src/functions/services.d.ts +4 -3
- package/dist/types/src/functions/services.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/session/artifact-diff.d.ts +27 -0
- package/dist/types/src/session/artifact-diff.d.ts.map +1 -0
- package/dist/types/src/session/error-handling.d.ts +4 -0
- package/dist/types/src/session/error-handling.d.ts.map +1 -0
- package/dist/types/src/session/format.d.ts +182 -0
- package/dist/types/src/session/format.d.ts.map +1 -0
- package/dist/types/src/session/format.test.d.ts +2 -0
- package/dist/types/src/session/format.test.d.ts.map +1 -0
- package/dist/types/src/session/index.d.ts +3 -0
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/observer.d.ts +22 -0
- package/dist/types/src/session/observer.d.ts.map +1 -0
- package/dist/types/src/session/session.d.ts +23 -236
- package/dist/types/src/session/session.d.ts.map +1 -1
- package/dist/types/src/session/toolkit.d.ts +14 -0
- package/dist/types/src/session/toolkit.d.ts.map +1 -0
- package/dist/types/src/session/version-pin.d.ts +2 -2
- package/dist/types/src/session/version-pin.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +1 -1
- package/dist/types/src/templates/system.d.ts +18 -0
- package/dist/types/src/templates/system.d.ts.map +1 -0
- package/dist/types/src/types.d.ts +3 -0
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +45 -29
- package/src/conversation/context.ts +154 -0
- package/src/conversation/conversation.ts +80 -53
- package/src/conversation/index.ts +1 -0
- package/src/diff.test.ts +43 -0
- package/src/diff.ts +77 -0
- package/src/errors.ts +5 -0
- package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +1 -0
- package/src/extraction/extraction-llm-function/extraction-llm-function.ts +7 -7
- package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +4 -3
- package/src/extraction/extraction-ner-function/extraction-ner-function.ts +2 -2
- package/src/extraction/quotes.test.ts +1 -1
- package/src/extraction/quotes.ts +1 -1
- package/src/functions/services.ts +37 -17
- package/src/index.ts +2 -3
- package/src/session/artifact-diff.ts +41 -0
- package/src/session/error-handling.ts +36 -0
- package/src/session/format.test.ts +60 -0
- package/src/session/format.ts +139 -0
- package/src/session/index.ts +3 -0
- package/src/session/observer.ts +58 -0
- package/src/session/session.test.ts +36 -38
- package/src/session/session.ts +114 -249
- package/src/session/toolkit.ts +42 -0
- package/src/session/version-pin.ts +4 -4
- package/src/summarization/summarization.test.ts +5 -7
- package/src/templates/format.tpl +59 -0
- package/src/templates/index.ts +1 -1
- package/src/templates/system.tpl +50 -0
- package/src/templates/system.ts +41 -0
- package/src/types.ts +10 -5
- package/src/typings.d.ts +5 -0
- package/dist/types/bin/chat.d.ts +0 -2
- package/dist/types/bin/chat.d.ts.map +0 -1
- package/dist/types/src/context/binder.d.ts +0 -34
- package/dist/types/src/context/binder.d.ts.map +0 -1
- package/dist/types/src/context/binding.d.ts.map +0 -1
- package/dist/types/src/context/index.d.ts +0 -3
- package/dist/types/src/context/index.d.ts.map +0 -1
- package/dist/types/src/research/exa.d.ts +0 -12
- package/dist/types/src/research/exa.d.ts.map +0 -1
- package/dist/types/src/research/graph.d.ts +0 -51
- package/dist/types/src/research/graph.d.ts.map +0 -1
- package/dist/types/src/research/graph.test.d.ts +0 -2
- package/dist/types/src/research/graph.test.d.ts.map +0 -1
- package/dist/types/src/research/index.d.ts +0 -4
- package/dist/types/src/research/index.d.ts.map +0 -1
- package/dist/types/src/research/research.d.ts +0 -10
- package/dist/types/src/research/research.d.ts.map +0 -1
- package/dist/types/src/research/research.test.d.ts +0 -2
- package/dist/types/src/research/research.test.d.ts.map +0 -1
- package/dist/types/src/templates/prompt.d.ts +0 -30
- package/dist/types/src/templates/prompt.d.ts.map +0 -1
- package/dist/types/src/testing/exa-search-1748337321991.d.ts +0 -38
- package/dist/types/src/testing/exa-search-1748337321991.d.ts.map +0 -1
- package/dist/types/src/testing/exa-search-1748337331526.d.ts +0 -37
- package/dist/types/src/testing/exa-search-1748337331526.d.ts.map +0 -1
- package/dist/types/src/testing/exa-search-1748337344119.d.ts +0 -58
- package/dist/types/src/testing/exa-search-1748337344119.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts +0 -3
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/src/context/binder.ts +0 -103
- package/src/context/binding.ts +0 -32
- package/src/context/index.ts +0 -6
- package/src/research/exa.ts +0 -97
- package/src/research/graph.test.ts +0 -64
- package/src/research/graph.ts +0 -369
- package/src/research/index.ts +0 -7
- package/src/research/instructions-research.tpl +0 -98
- package/src/research/research.test.ts +0 -190
- package/src/research/research.ts +0 -87
- package/src/templates/assistant.tpl +0 -111
- package/src/templates/prompt.ts +0 -45
- package/src/testing/exa-search-1748337321991.ts +0 -131
- package/src/testing/exa-search-1748337331526.ts +0 -144
- package/src/testing/exa-search-1748337344119.ts +0 -133
- package/src/testing/index.ts +0 -11
- package/src/typedefs.d.ts +0 -8
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import defaultsDeep from 'lodash.defaultsdeep';
|
|
6
|
+
|
|
7
|
+
import { type ModelCapabilities } from '@dxos/ai';
|
|
8
|
+
import { Template } from '@dxos/blueprints';
|
|
9
|
+
|
|
10
|
+
import FORMAT from './format.tpl?raw';
|
|
11
|
+
import SYSTEM from './system.tpl?raw';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* System template variables.
|
|
15
|
+
*/
|
|
16
|
+
export type SystemPromptOptions = ModelCapabilities & {
|
|
17
|
+
DATETIME: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Base system prompt.
|
|
22
|
+
* NOTE: This contains protocol instructions that can not be dynamically edited.
|
|
23
|
+
*/
|
|
24
|
+
export const createSystemPrompt = (options: Partial<SystemPromptOptions> = {}) =>
|
|
25
|
+
Template.process<SystemPromptOptions>(
|
|
26
|
+
FORMAT,
|
|
27
|
+
defaultsDeep(options, {
|
|
28
|
+
DATETIME: new Date().toISOString(),
|
|
29
|
+
}),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const templates = {
|
|
33
|
+
/** Editable system prompt.*/
|
|
34
|
+
system: Template.make({
|
|
35
|
+
/**
|
|
36
|
+
* NOTE: We are forbidden from accessing randomness at model level in cloudflare, so we have to have pre-generated ids.
|
|
37
|
+
*/
|
|
38
|
+
id: '01K2J2FZWH39F55CS7B26GP1Q3',
|
|
39
|
+
source: SYSTEM,
|
|
40
|
+
}),
|
|
41
|
+
};
|
package/src/types.ts
CHANGED
|
@@ -6,21 +6,26 @@ import { Schema } from 'effect';
|
|
|
6
6
|
|
|
7
7
|
import { type ObjectId } from '@dxos/echo-schema';
|
|
8
8
|
import { DXN, LOCAL_SPACE_TAG, type SpaceId } from '@dxos/keys';
|
|
9
|
+
import { trim } from '@dxos/util';
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated
|
|
13
|
+
*/
|
|
10
14
|
export const createArtifactElement = (id: ObjectId) => `<artifact id=${id} />`;
|
|
11
15
|
|
|
12
16
|
/**
|
|
13
17
|
* A model-friendly way to reference an object.
|
|
14
18
|
* Supports vairous formats that will be normalized to a DXN.
|
|
15
19
|
*/
|
|
20
|
+
// TODO(burdon): Rename ObjectReference?
|
|
16
21
|
export const ArtifactId: Schema.Schema<string> & {
|
|
17
22
|
toDXN: (reference: ArtifactId, owningSpaceId?: SpaceId) => DXN;
|
|
18
23
|
} = class extends Schema.String.annotations({
|
|
19
|
-
description: `
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
description: trim`
|
|
25
|
+
The ID of the referenced object. Formats accepted:
|
|
26
|
+
- DXN (dxn:echo:@:XXXXX). DXNs can be prepended with an @ symbol for compatibility with in-text references.
|
|
27
|
+
- space ID, object ID tuple (spaceID:objectID)
|
|
28
|
+
- Only object ID that is assumed to be in the current space (XXXXX)
|
|
24
29
|
`,
|
|
25
30
|
examples: ['dxn:echo:@:XXXXX', '@dxn:echo:@:XXXXX', 'spaceID:objectID', 'XXXXX'],
|
|
26
31
|
}) {
|
package/src/typings.d.ts
CHANGED
package/dist/types/bin/chat.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../bin/chat.ts"],"names":[],"mappings":""}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { type ReadonlySignal } from '@preact/signals-core';
|
|
2
|
-
import { type Blueprint } from '@dxos/blueprints';
|
|
3
|
-
import { type Type, type Ref } from '@dxos/echo';
|
|
4
|
-
import { type Queue } from '@dxos/echo-db';
|
|
5
|
-
import { ComplexSet } from '@dxos/util';
|
|
6
|
-
/**
|
|
7
|
-
* Manages bindings of blueprints and objects to a conversation.
|
|
8
|
-
*/
|
|
9
|
-
export declare class ContextBinder {
|
|
10
|
-
private readonly _queue;
|
|
11
|
-
constructor(_queue: Queue);
|
|
12
|
-
/**
|
|
13
|
-
* Reactive query of all bindings.
|
|
14
|
-
*/
|
|
15
|
-
readonly bindings: ReadonlySignal<Bindings>;
|
|
16
|
-
readonly blueprints: ReadonlySignal<Ref.Ref<Blueprint.Blueprint>[]>;
|
|
17
|
-
readonly objects: ReadonlySignal<Ref.Ref<Type.Expando>[]>;
|
|
18
|
-
/**
|
|
19
|
-
* Asynchronous query of all bindings.
|
|
20
|
-
*/
|
|
21
|
-
query(): Promise<Bindings>;
|
|
22
|
-
bind(props: BindingProps): Promise<void>;
|
|
23
|
-
unbind(props: BindingProps): Promise<void>;
|
|
24
|
-
private _reduce;
|
|
25
|
-
}
|
|
26
|
-
export type BindingProps = Partial<{
|
|
27
|
-
blueprints: Ref.Ref<Blueprint.Blueprint>[];
|
|
28
|
-
objects: Ref.Ref<Type.Expando>[];
|
|
29
|
-
}>;
|
|
30
|
-
export declare class Bindings {
|
|
31
|
-
blueprints: ComplexSet<Ref.Ref<Blueprint.Blueprint>>;
|
|
32
|
-
objects: ComplexSet<Ref.Ref<Type.Expando>>;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=binder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"binder.d.ts","sourceRoot":"","sources":["../../../../src/context/binder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGrE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAO,KAAK,IAAI,EAAE,KAAK,GAAG,EAAiB,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAIxC;;GAEG;AACH,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,KAAK;IAE1C;;OAEG;IAEH,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAqD;IAGhG,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,CAEhE;IACH,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAoD;IAE7G;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,QAAQ,CAAC;IAM1B,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBxC,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBhD,OAAO,CAAC,OAAO;CAahB;AAED,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC;IACjC,UAAU,EAAE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC;IAC3C,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;CAClC,CAAC,CAAC;AAEH,qBAAa,QAAQ;IACnB,UAAU,2CAA6E;IACvF,OAAO,oCAAsE;CAC9E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../../../../src/context/binding.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC;;GAEG;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgB1B,CAAC;AAEF,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,cAAc,CAAC;CAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/context/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AiTool, AiToolkit } from '@effect/ai';
|
|
2
|
-
import { Schema } from 'effect';
|
|
3
|
-
import { CredentialsService } from '@dxos/functions';
|
|
4
|
-
declare const ExaToolkit_base: AiToolkit.AiToolkit<AiTool.AiTool<"exa_search", Schema.Struct<{
|
|
5
|
-
query: Schema.SchemaClass<string, string, never>;
|
|
6
|
-
}>, typeof Schema.Unknown, typeof Schema.Never, CredentialsService>>;
|
|
7
|
-
export declare class ExaToolkit extends ExaToolkit_base {
|
|
8
|
-
}
|
|
9
|
-
export declare const LiveExaHandler: import("effect/Layer").Layer<AiTool.Handler<"exa_search">, never, never>;
|
|
10
|
-
export declare const MockExaHandler: import("effect/Layer").Layer<AiTool.Handler<"exa_search">, never, never>;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=exa.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exa.d.ts","sourceRoot":"","sources":["../../../../src/research/exa.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;;;;AAKrD,qBAAa,UAAW,SAAQ,eAS/B;CAAG;AAEJ,eAAO,MAAM,cAAc,0EAmBzB,CAAC;AAEH,eAAO,MAAM,cAAc,0EA2BzB,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { AiTool, AiToolkit } from '@effect/ai';
|
|
2
|
-
import { Schema } from 'effect';
|
|
3
|
-
import { type EchoDatabase, type Queue } from '@dxos/echo-db';
|
|
4
|
-
import { type BaseObject } from '@dxos/echo-schema';
|
|
5
|
-
import { DatabaseService } from '@dxos/functions';
|
|
6
|
-
export declare const Subgraph: Schema.Struct<{
|
|
7
|
-
/** Objects and relations. */
|
|
8
|
-
objects: Schema.Array$<typeof Schema.Any>;
|
|
9
|
-
}>;
|
|
10
|
-
export interface Subgraph extends Schema.Schema.Type<typeof Subgraph> {
|
|
11
|
-
}
|
|
12
|
-
export type RelatedSchema = {
|
|
13
|
-
schema: Schema.Schema.AnyNoContext;
|
|
14
|
-
kind: 'reference' | 'relation';
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Find all schemas that are related to the given schema.
|
|
18
|
-
*
|
|
19
|
-
* @param db
|
|
20
|
-
* @param schema
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
23
|
-
export declare const findRelatedSchema: (db: EchoDatabase, anchor: Schema.Schema.AnyNoContext) => Promise<RelatedSchema[]>;
|
|
24
|
-
declare const LocalSearchToolkit_base: AiToolkit.AiToolkit<AiTool.AiTool<"search_local_search", Schema.Struct<{
|
|
25
|
-
query: Schema.SchemaClass<string, string, never>;
|
|
26
|
-
}>, typeof Schema.Unknown, typeof Schema.Never, DatabaseService>>;
|
|
27
|
-
/**
|
|
28
|
-
* Perform vector search in the local database.
|
|
29
|
-
*/
|
|
30
|
-
export declare class LocalSearchToolkit extends LocalSearchToolkit_base {
|
|
31
|
-
}
|
|
32
|
-
export declare const LocalSearchHandler: import("effect/Layer").Layer<AiTool.Handler<"search_local_search">, never, never>;
|
|
33
|
-
/**
|
|
34
|
-
* Forms typed objects that can be written to the graph database.
|
|
35
|
-
*/
|
|
36
|
-
export declare const makeGraphWriterToolkit: ({ schema }: {
|
|
37
|
-
schema: Schema.Schema.AnyNoContext[];
|
|
38
|
-
}) => AiToolkit.AiToolkit<AiTool.AiTool<"graph_writer", Schema.Struct<Readonly<{
|
|
39
|
-
[k: string]: Schema.optional<Schema.Array$<Schema.Schema.AnyNoContext>>;
|
|
40
|
-
}>>, typeof Schema.Unknown, typeof Schema.Never, DatabaseService>>;
|
|
41
|
-
export declare const makeGraphWriterHandler: (toolkit: ReturnType<typeof makeGraphWriterToolkit>) => import("effect/Layer").Layer<AiTool.Handler<"graph_writer">, never, never>;
|
|
42
|
-
/**
|
|
43
|
-
* Create a schema for structured data extraction.
|
|
44
|
-
*/
|
|
45
|
-
export declare const createExtractionSchema: (types: Schema.Schema.AnyNoContext[]) => Schema.Struct<{
|
|
46
|
-
[k: string]: Schema.optional<Schema.Array$<Schema.Schema.AnyNoContext>>;
|
|
47
|
-
}>;
|
|
48
|
-
export declare const getSanitizedSchemaName: (schema: Schema.Schema.AnyNoContext) => string;
|
|
49
|
-
export declare const sanitizeObjects: (types: Schema.Schema.AnyNoContext[], data: Record<string, readonly unknown[]>, db: EchoDatabase, queue?: Queue) => Promise<BaseObject[]>;
|
|
50
|
-
export {};
|
|
51
|
-
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../../src/research/graph.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAqC,MAAM,EAAa,MAAM,QAAQ,CAAC;AAI9E,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EAcL,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAuB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAMvE,eAAO,MAAM,QAAQ;IACnB,6BAA6B;;EAE7B,CAAC;AACH,MAAM,WAAW,QAAS,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC;CAAG;AAExE,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;IACnC,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC;CAChC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC5B,IAAI,YAAY,EAChB,QAAQ,MAAM,CAAC,MAAM,CAAC,YAAY,KACjC,OAAO,CAAC,aAAa,EAAE,CAsBzB,CAAC;;;;AAmBF;;GAEG;AAEH,qBAAa,kBAAmB,SAAQ,uBAWvC;CAAG;AAEJ,eAAO,MAAM,kBAAkB,mFAkB7B,CAAC;AAUH;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,YAAY;IAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,CAAA;CAAE;;kEAW1F,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,SAAS,UAAU,CAAC,OAAO,sBAAsB,CAAC,+EAexF,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE;;EAWzE,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM,CAAC,MAAM,CAAC,YAAY,WAIxE,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EACnC,MAAM,MAAM,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC,EACxC,IAAI,YAAY,EAChB,QAAQ,KAAK,KACZ,OAAO,CAAC,UAAU,EAAE,CAyHtB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph.test.d.ts","sourceRoot":"","sources":["../../../../src/research/graph.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/research/index.ts"],"names":[],"mappings":"AAIA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Exec external service and return the results as a Subgraph.
|
|
3
|
-
*/
|
|
4
|
-
export declare const researchFn: import("@dxos/functions").FunctionDefinition<{
|
|
5
|
-
readonly query: string;
|
|
6
|
-
readonly mockSearch?: boolean | undefined;
|
|
7
|
-
}, {
|
|
8
|
-
readonly result: unknown;
|
|
9
|
-
}>;
|
|
10
|
-
//# sourceMappingURL=research.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"research.d.ts","sourceRoot":"","sources":["../../../../src/research/research.ts"],"names":[],"mappings":"AAqBA;;GAEG;AAEH,eAAO,MAAM,UAAU;;;;;EA6DrB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"research.test.d.ts","sourceRoot":"","sources":["../../../../src/research/research.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { type AssociatedArtifact } from '@dxos/blueprints';
|
|
2
|
-
/**
|
|
3
|
-
* Type for assistant prompt variables.
|
|
4
|
-
*/
|
|
5
|
-
export type AssistantPromptOptions = {
|
|
6
|
-
/**
|
|
7
|
-
* Instructions for each artifact.
|
|
8
|
-
*/
|
|
9
|
-
artifacts?: string[];
|
|
10
|
-
/**
|
|
11
|
-
* Associated artifact to include in the prompt.
|
|
12
|
-
* @deprecated
|
|
13
|
-
*/
|
|
14
|
-
artifact?: AssociatedArtifact;
|
|
15
|
-
/**
|
|
16
|
-
* Whether to include suggestions in the prompt.
|
|
17
|
-
*/
|
|
18
|
-
suggestions?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Additional instructions to include in the prompt.
|
|
21
|
-
*/
|
|
22
|
-
instructions?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Emit chain-of-thought inside <cot> tag.
|
|
25
|
-
* Should be `false` for models with built-in reasoning: Claude, deepseek, o1.
|
|
26
|
-
*/
|
|
27
|
-
cot?: boolean;
|
|
28
|
-
};
|
|
29
|
-
export declare const createSystemPrompt: (options: AssistantPromptOptions) => string;
|
|
30
|
-
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/templates/prompt.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,kBAAkB,EAAY,MAAM,kBAAkB,CAAC;AAIrE;;GAEG;AAEH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IAEH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAErB;;;OAGG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAE9B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,SAAS,sBAAsB,WAEjE,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
requestId: string;
|
|
3
|
-
autopromptString: string;
|
|
4
|
-
autoDate: string;
|
|
5
|
-
resolvedSearchType: string;
|
|
6
|
-
results: ({
|
|
7
|
-
id: string;
|
|
8
|
-
title: string;
|
|
9
|
-
url: string;
|
|
10
|
-
publishedDate: string;
|
|
11
|
-
author: string;
|
|
12
|
-
score: number;
|
|
13
|
-
text: string;
|
|
14
|
-
image?: undefined;
|
|
15
|
-
favicon?: undefined;
|
|
16
|
-
} | {
|
|
17
|
-
id: string;
|
|
18
|
-
title: string;
|
|
19
|
-
url: string;
|
|
20
|
-
publishedDate: string;
|
|
21
|
-
author: string;
|
|
22
|
-
score: number;
|
|
23
|
-
text: string;
|
|
24
|
-
image: string;
|
|
25
|
-
favicon: string;
|
|
26
|
-
})[];
|
|
27
|
-
costDollars: {
|
|
28
|
-
total: number;
|
|
29
|
-
search: {
|
|
30
|
-
neural: number;
|
|
31
|
-
};
|
|
32
|
-
contents: {
|
|
33
|
-
text: number;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
export default _default;
|
|
38
|
-
//# sourceMappingURL=exa-search-1748337321991.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exa-search-1748337321991.d.ts","sourceRoot":"","sources":["../../../../src/testing/exa-search-1748337321991.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,wBA8HE"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
requestId: string;
|
|
3
|
-
autopromptString: string;
|
|
4
|
-
resolvedSearchType: string;
|
|
5
|
-
results: ({
|
|
6
|
-
id: string;
|
|
7
|
-
title: string;
|
|
8
|
-
url: string;
|
|
9
|
-
publishedDate: string;
|
|
10
|
-
author: string;
|
|
11
|
-
score: number;
|
|
12
|
-
text: string;
|
|
13
|
-
image: string;
|
|
14
|
-
favicon: string;
|
|
15
|
-
} | {
|
|
16
|
-
id: string;
|
|
17
|
-
title: string;
|
|
18
|
-
url: string;
|
|
19
|
-
publishedDate: string;
|
|
20
|
-
author: string;
|
|
21
|
-
text: string;
|
|
22
|
-
image: string;
|
|
23
|
-
favicon: string;
|
|
24
|
-
score?: undefined;
|
|
25
|
-
})[];
|
|
26
|
-
costDollars: {
|
|
27
|
-
total: number;
|
|
28
|
-
search: {
|
|
29
|
-
neural: number;
|
|
30
|
-
};
|
|
31
|
-
contents: {
|
|
32
|
-
text: number;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
export default _default;
|
|
37
|
-
//# sourceMappingURL=exa-search-1748337331526.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exa-search-1748337331526.d.ts","sourceRoot":"","sources":["../../../../src/testing/exa-search-1748337331526.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,wBA2IE"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
requestId: string;
|
|
3
|
-
autopromptString: string;
|
|
4
|
-
autoDate: string;
|
|
5
|
-
resolvedSearchType: string;
|
|
6
|
-
results: ({
|
|
7
|
-
id: string;
|
|
8
|
-
title: string;
|
|
9
|
-
url: string;
|
|
10
|
-
publishedDate: string;
|
|
11
|
-
author: string;
|
|
12
|
-
score: number;
|
|
13
|
-
text: string;
|
|
14
|
-
favicon: string;
|
|
15
|
-
image?: undefined;
|
|
16
|
-
} | {
|
|
17
|
-
id: string;
|
|
18
|
-
title: string;
|
|
19
|
-
url: string;
|
|
20
|
-
publishedDate: string;
|
|
21
|
-
author: string;
|
|
22
|
-
score: number;
|
|
23
|
-
text: string;
|
|
24
|
-
favicon?: undefined;
|
|
25
|
-
image?: undefined;
|
|
26
|
-
} | {
|
|
27
|
-
id: string;
|
|
28
|
-
title: string;
|
|
29
|
-
url: string;
|
|
30
|
-
publishedDate: string;
|
|
31
|
-
author: string;
|
|
32
|
-
score: number;
|
|
33
|
-
text: string;
|
|
34
|
-
image: string;
|
|
35
|
-
favicon: string;
|
|
36
|
-
} | {
|
|
37
|
-
id: string;
|
|
38
|
-
title: string;
|
|
39
|
-
url: string;
|
|
40
|
-
author: string;
|
|
41
|
-
text: string;
|
|
42
|
-
image: string;
|
|
43
|
-
favicon: string;
|
|
44
|
-
publishedDate?: undefined;
|
|
45
|
-
score?: undefined;
|
|
46
|
-
})[];
|
|
47
|
-
costDollars: {
|
|
48
|
-
total: number;
|
|
49
|
-
search: {
|
|
50
|
-
neural: number;
|
|
51
|
-
};
|
|
52
|
-
contents: {
|
|
53
|
-
text: number;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
export default _default;
|
|
58
|
-
//# sourceMappingURL=exa-search-1748337344119.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exa-search-1748337344119.d.ts","sourceRoot":"","sources":["../../../../src/testing/exa-search-1748337344119.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,wBAgIE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAM7C,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,GAAG,CAAC,EAAgC,CAAC"}
|
package/src/context/binder.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { computed, type ReadonlySignal } from '@preact/signals-core';
|
|
6
|
-
import { Array, pipe } from 'effect';
|
|
7
|
-
|
|
8
|
-
import { type Blueprint } from '@dxos/blueprints';
|
|
9
|
-
import { Obj, type Type, type Ref, type Relation } from '@dxos/echo';
|
|
10
|
-
import { type Queue } from '@dxos/echo-db';
|
|
11
|
-
import { ComplexSet } from '@dxos/util';
|
|
12
|
-
|
|
13
|
-
import { ContextBinding } from './binding';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Manages bindings of blueprints and objects to a conversation.
|
|
17
|
-
*/
|
|
18
|
-
export class ContextBinder {
|
|
19
|
-
constructor(private readonly _queue: Queue) {}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Reactive query of all bindings.
|
|
23
|
-
*/
|
|
24
|
-
// TODO(burdon): Cache value?
|
|
25
|
-
readonly bindings: ReadonlySignal<Bindings> = computed(() => this._reduce(this._queue.objects));
|
|
26
|
-
|
|
27
|
-
// TODO(burdon): load refs?
|
|
28
|
-
readonly blueprints: ReadonlySignal<Ref.Ref<Blueprint.Blueprint>[]> = computed(() => [
|
|
29
|
-
...this.bindings.value.blueprints,
|
|
30
|
-
]);
|
|
31
|
-
readonly objects: ReadonlySignal<Ref.Ref<Type.Expando>[]> = computed(() => [...this.bindings.value.objects]);
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Asynchronous query of all bindings.
|
|
35
|
-
*/
|
|
36
|
-
async query(): Promise<Bindings> {
|
|
37
|
-
const queueItems = await this._queue.queryObjects();
|
|
38
|
-
return this._reduce(queueItems);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// TODO(burdon): Pass in Blueprint obj (from registry?) and create reference.
|
|
42
|
-
async bind(props: BindingProps): Promise<void> {
|
|
43
|
-
if (!props.blueprints?.length && !props.objects?.length) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
await this._queue.append([
|
|
48
|
-
Obj.make(ContextBinding, {
|
|
49
|
-
blueprints: {
|
|
50
|
-
added: props.blueprints ?? [],
|
|
51
|
-
removed: [],
|
|
52
|
-
},
|
|
53
|
-
objects: {
|
|
54
|
-
added: props.objects ?? [],
|
|
55
|
-
removed: [],
|
|
56
|
-
},
|
|
57
|
-
}),
|
|
58
|
-
]);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async unbind(props: BindingProps): Promise<void> {
|
|
62
|
-
if (!props.blueprints?.length && !props.objects?.length) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
await this._queue.append([
|
|
67
|
-
Obj.make(ContextBinding, {
|
|
68
|
-
blueprints: {
|
|
69
|
-
added: [],
|
|
70
|
-
removed: props.blueprints ?? [],
|
|
71
|
-
},
|
|
72
|
-
objects: {
|
|
73
|
-
added: [],
|
|
74
|
-
removed: props.objects ?? [],
|
|
75
|
-
},
|
|
76
|
-
}),
|
|
77
|
-
]);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
private _reduce(items: (Obj.Any | Relation.Any)[]): Bindings {
|
|
81
|
-
return pipe(
|
|
82
|
-
items,
|
|
83
|
-
Array.filter(Obj.instanceOf(ContextBinding)),
|
|
84
|
-
Array.reduce(new Bindings(), (context, item) => {
|
|
85
|
-
item.blueprints.removed.forEach((item) => context.blueprints.delete(item));
|
|
86
|
-
item.blueprints.added.forEach((item) => context.blueprints.add(item));
|
|
87
|
-
item.objects.removed.forEach((item) => context.objects.delete(item));
|
|
88
|
-
item.objects.added.forEach((item) => context.objects.add(item));
|
|
89
|
-
return context;
|
|
90
|
-
}),
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export type BindingProps = Partial<{
|
|
96
|
-
blueprints: Ref.Ref<Blueprint.Blueprint>[];
|
|
97
|
-
objects: Ref.Ref<Type.Expando>[];
|
|
98
|
-
}>;
|
|
99
|
-
|
|
100
|
-
export class Bindings {
|
|
101
|
-
blueprints = new ComplexSet<Ref.Ref<Blueprint.Blueprint>>((ref) => ref.dxn.toString());
|
|
102
|
-
objects = new ComplexSet<Ref.Ref<Type.Expando>>((ref) => ref.dxn.toString());
|
|
103
|
-
}
|
package/src/context/binding.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
|
-
|
|
7
|
-
import { Blueprint } from '@dxos/blueprints';
|
|
8
|
-
import { Type } from '@dxos/echo';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Thread message that binds or unbinds contextual objects to a conversation.
|
|
12
|
-
*/
|
|
13
|
-
// TODO(burdon): Make ContentBlock.
|
|
14
|
-
export const ContextBinding = Schema.Struct({
|
|
15
|
-
blueprints: Schema.Struct({
|
|
16
|
-
added: Schema.Array(Type.Ref(Blueprint.Blueprint)),
|
|
17
|
-
removed: Schema.Array(Type.Ref(Blueprint.Blueprint)),
|
|
18
|
-
}),
|
|
19
|
-
|
|
20
|
-
// TODO(burdon): Type.Expando => Type.Obj (or Obj.Any?)
|
|
21
|
-
objects: Schema.Struct({
|
|
22
|
-
added: Schema.Array(Type.Ref(Type.Expando)),
|
|
23
|
-
removed: Schema.Array(Type.Ref(Type.Expando)),
|
|
24
|
-
}),
|
|
25
|
-
}).pipe(
|
|
26
|
-
Type.Obj({
|
|
27
|
-
typename: 'dxos.org/type/ContextBinding',
|
|
28
|
-
version: '0.1.0',
|
|
29
|
-
}),
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
export interface ContextBinding extends Schema.Schema.Type<typeof ContextBinding> {}
|