@dxos/assistant 0.8.4-main.b97322e → 0.8.4-main.dedc0f3
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-5GJYG2ML.mjs +396 -0
- package/dist/lib/browser/chunk-5GJYG2ML.mjs.map +7 -0
- package/dist/lib/browser/chunk-UB26N5UF.mjs +89 -0
- package/dist/lib/browser/chunk-UB26N5UF.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 +295 -1657
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/named-entity-recognition-QPYHML66.mjs +13 -0
- package/dist/lib/browser/named-entity-recognition-QPYHML66.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BCFXTNSK.mjs +91 -0
- package/dist/lib/node-esm/chunk-BCFXTNSK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-FLFCEB4P.mjs +398 -0
- package/dist/lib/node-esm/chunk-FLFCEB4P.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 +294 -1657
- 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-2HDF46YX.mjs +14 -0
- package/dist/lib/node-esm/named-entity-recognition-2HDF46YX.mjs.map +7 -0
- package/dist/types/src/conversation/context.d.ts +96 -0
- 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 +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 +65 -30
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction.d.ts +246 -216
- 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 -28
- 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 +79 -0
- package/src/errors.ts +5 -0
- package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +8 -7
- package/src/extraction/extraction-llm-function/extraction-llm-function.ts +10 -10
- package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +9 -9
- package/src/extraction/extraction-ner-function/extraction-ner-function.ts +12 -7
- package/src/extraction/extraction-ner-function/named-entity-recognition.ts +2 -0
- package/src/extraction/quotes.test.ts +1 -1
- package/src/extraction/quotes.ts +1 -1
- package/src/functions/services.ts +57 -77
- 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 +113 -248
- package/src/session/toolkit.ts +42 -0
- package/src/session/version-pin.ts +4 -4
- package/src/summarization/summarization.test.ts +11 -22
- package/src/templates/format.tpl +60 -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 +0 -56
- 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
package/src/templates/index.ts
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{{! System Prompt }}
|
|
2
|
+
|
|
3
|
+
You are a helpful assistant called Kai.
|
|
4
|
+
Your name is Kai and you are powered by different language models.
|
|
5
|
+
You were created by DXOS and operate in Composer and on the DXOS EDGE network.
|
|
6
|
+
In your initial greeting state your name and make some suggestions based on the current context objects.
|
|
7
|
+
|
|
8
|
+
You are an advanced AI assistant capable of creating and managing artifacts from provided data and tools.
|
|
9
|
+
Your task is to process user commands and questions and decide how best to respond.
|
|
10
|
+
In general be concise and direct.
|
|
11
|
+
|
|
12
|
+
Follow these instructions carefully.
|
|
13
|
+
|
|
14
|
+
## Include the following steps
|
|
15
|
+
|
|
16
|
+
- Analyze the structure and type of the content in the user's message.
|
|
17
|
+
- Determine if you complete the task using the available blueprint definitions?
|
|
18
|
+
- If you can't complete the task using the available blueprint definitions, query the list of available blueprint definitions using the appropriate tool.
|
|
19
|
+
- Identify which blueprint definitions are relevant to the user's request.
|
|
20
|
+
- Evaluate the potential benefits of creating an artifact vs. normal processing for each identified element.
|
|
21
|
+
- Make a final decision on whether to create an artifact and explain your reasoning.
|
|
22
|
+
- Are the required blueprint definitions already available?
|
|
23
|
+
- If not, select which blueprint definition(s) will be the most relevant and require them using the require_artifact_definitions tool.
|
|
24
|
+
- The require'd artifact tools will be available for use after require.
|
|
25
|
+
- If creating an artifact, outline how you will structure it within the response.
|
|
26
|
+
- Decide if the artifact needs to be shown to the user.
|
|
27
|
+
- Call the show tool to show the artifact to the user.
|
|
28
|
+
- Your reasoning must include: whether to use artifacts or not, to create one or query, whether to show the artifact to the user, and how to structure the response.
|
|
29
|
+
|
|
30
|
+
## Blueprints
|
|
31
|
+
|
|
32
|
+
- Determine if the interaction involves an artifact. Prefer artifacts for tables, lists, spreadsheets, kanbans, games, images, and other structured data.
|
|
33
|
+
- Determine if the user is explicitly talking about creating a new artifact, or wants to use an existing artifact.
|
|
34
|
+
- If it is ambiguous, query for existing artifacts first and then decide.
|
|
35
|
+
- If you decide to create an artifact, call the associated tool to create the artifact.
|
|
36
|
+
- Artifacts are stored in the database. Tools are used to create and query artifacts.
|
|
37
|
+
- If you are unsure about creating an artifact ask the user for clarification.
|
|
38
|
+
- Artifacts are mutable objects that can change over the course of the conversation.
|
|
39
|
+
- Always re-query the artifact using the tool (like query or inspect) to get the latest state of the artifact before answering the user.
|
|
40
|
+
- You must never generate the id of the artifact; only recall the ids that are already in the history.
|
|
41
|
+
- Artifacts are created by requiring the specific artifact using the require_artifact tool and creating it by calling the associated tool.
|
|
42
|
+
- You can add suggested actions at the end of your response.
|
|
43
|
+
- Suggested actions should be very concise and start with a verb and be phrased as a command to an agent -- not a question to the user.
|
|
44
|
+
- Suggested actions must be in the form of a user instruction that you can follow.
|
|
45
|
+
- Suggested actions could include actions that create artifacts.
|
|
46
|
+
- After creating an artifact use a tool to add it to the chat context.
|
|
47
|
+
|
|
48
|
+
## Context
|
|
49
|
+
|
|
50
|
+
Today is {{DATETIME}}.
|
|
@@ -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.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,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;CAClC,CAAC,CAAC;AAEH,qBAAa,QAAQ;IACnB,UAAU,2CAA6E;IACvF,OAAO,oCAAsE;CAC9E"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'effect';
|
|
2
|
-
import { Type } from '@dxos/echo';
|
|
3
|
-
/**
|
|
4
|
-
* Thread message that binds or unbinds contextual objects to a conversation.
|
|
5
|
-
*/
|
|
6
|
-
export declare const ContextBinding: Type.obj<Schema.Struct<{
|
|
7
|
-
blueprints: Schema.Struct<{
|
|
8
|
-
added: Schema.Array$<Type.ref<Type.obj<Schema.Struct<{
|
|
9
|
-
key: Schema.SchemaClass<string, string, never>;
|
|
10
|
-
name: Schema.SchemaClass<string, string, never>;
|
|
11
|
-
description: Schema.optional<typeof Schema.String>;
|
|
12
|
-
instructions: Schema.SchemaClass<import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
13
|
-
name?: string | undefined;
|
|
14
|
-
source: import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
15
|
-
content: string;
|
|
16
|
-
}>;
|
|
17
|
-
inputs?: {
|
|
18
|
-
name: string;
|
|
19
|
-
kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
|
|
20
|
-
default?: any;
|
|
21
|
-
}[] | undefined;
|
|
22
|
-
}>, import("@dxos/echo-protocol").EncodedReference, never>;
|
|
23
|
-
tools: Schema.Array$<Schema.brand<typeof Schema.String, "ToolId">>;
|
|
24
|
-
}>>>>;
|
|
25
|
-
removed: Schema.Array$<Type.ref<Type.obj<Schema.Struct<{
|
|
26
|
-
key: Schema.SchemaClass<string, string, never>;
|
|
27
|
-
name: Schema.SchemaClass<string, string, never>;
|
|
28
|
-
description: Schema.optional<typeof Schema.String>;
|
|
29
|
-
instructions: Schema.SchemaClass<import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
30
|
-
name?: string | undefined;
|
|
31
|
-
source: import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
32
|
-
content: string;
|
|
33
|
-
}>;
|
|
34
|
-
inputs?: {
|
|
35
|
-
name: string;
|
|
36
|
-
kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
|
|
37
|
-
default?: any;
|
|
38
|
-
}[] | undefined;
|
|
39
|
-
}>, import("@dxos/echo-protocol").EncodedReference, never>;
|
|
40
|
-
tools: Schema.Array$<Schema.brand<typeof Schema.String, "ToolId">>;
|
|
41
|
-
}>>>>;
|
|
42
|
-
}>;
|
|
43
|
-
objects: Schema.Struct<{
|
|
44
|
-
added: Schema.Array$<Type.ref<Schema.Schema<Type.Expando, {
|
|
45
|
-
[x: string]: any;
|
|
46
|
-
id: string;
|
|
47
|
-
}, never>>>;
|
|
48
|
-
removed: Schema.Array$<Type.ref<Schema.Schema<Type.Expando, {
|
|
49
|
-
[x: string]: any;
|
|
50
|
-
id: string;
|
|
51
|
-
}, never>>>;
|
|
52
|
-
}>;
|
|
53
|
-
}>>;
|
|
54
|
-
export interface ContextBinding extends Schema.Schema.Type<typeof ContextBinding> {
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=binding.d.ts.map
|
|
@@ -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;;;;;;;oBAmB6O,CAAC;;;;sBAA4L,CAAC;;wBAA8C,CAAC;2BAAoI,CAAC;;;;;;;;;;oBAAlX,CAAC;;;;sBAA4L,CAAC;;wBAA8C,CAAC;2BAAoI,CAAC;;;;;;;;;;;;;;;;GAHznB,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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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"}
|