@dxos/assistant 0.8.4-main.f9ba587 → 0.8.4-main.fd6878d

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.
Files changed (145) hide show
  1. package/dist/lib/browser/chunk-6WRGDEMH.mjs +89 -0
  2. package/dist/lib/browser/chunk-6WRGDEMH.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-NZGGCEF3.mjs +341 -0
  4. package/dist/lib/browser/chunk-NZGGCEF3.mjs.map +7 -0
  5. package/dist/lib/browser/extraction/index.mjs +269 -0
  6. package/dist/lib/browser/extraction/index.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +240 -1905
  8. package/dist/lib/browser/index.mjs.map +4 -4
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/named-entity-recognition-O46UTCLR.mjs +13 -0
  11. package/dist/lib/browser/named-entity-recognition-O46UTCLR.mjs.map +7 -0
  12. package/dist/lib/node-esm/chunk-3UU5V4FS.mjs +91 -0
  13. package/dist/lib/node-esm/chunk-3UU5V4FS.mjs.map +7 -0
  14. package/dist/lib/node-esm/chunk-XOOPGSGW.mjs +343 -0
  15. package/dist/lib/node-esm/chunk-XOOPGSGW.mjs.map +7 -0
  16. package/dist/lib/node-esm/extraction/index.mjs +270 -0
  17. package/dist/lib/node-esm/extraction/index.mjs.map +7 -0
  18. package/dist/lib/node-esm/index.mjs +240 -1906
  19. package/dist/lib/node-esm/index.mjs.map +4 -4
  20. package/dist/lib/node-esm/meta.json +1 -1
  21. package/dist/lib/node-esm/named-entity-recognition-W4VMRCH6.mjs +14 -0
  22. package/dist/lib/node-esm/named-entity-recognition-W4VMRCH6.mjs.map +7 -0
  23. package/dist/types/src/conversation/context.d.ts +90 -0
  24. package/dist/types/src/conversation/context.d.ts.map +1 -0
  25. package/dist/types/src/conversation/conversation.d.ts +31 -25
  26. package/dist/types/src/conversation/conversation.d.ts.map +1 -1
  27. package/dist/types/src/conversation/index.d.ts +1 -0
  28. package/dist/types/src/conversation/index.d.ts.map +1 -1
  29. package/dist/types/src/errors.d.ts +39 -0
  30. package/dist/types/src/errors.d.ts.map +1 -0
  31. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +1 -1
  32. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +143 -45
  33. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +1 -1
  34. package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts +1 -1
  35. package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts.map +1 -1
  36. package/dist/types/src/extraction/extraction.d.ts +106 -44
  37. package/dist/types/src/extraction/extraction.d.ts.map +1 -1
  38. package/dist/types/src/functions/index.d.ts +2 -0
  39. package/dist/types/src/functions/index.d.ts.map +1 -0
  40. package/dist/types/src/functions/services.d.ts +7 -0
  41. package/dist/types/src/functions/services.d.ts.map +1 -0
  42. package/dist/types/src/index.d.ts +3 -5
  43. package/dist/types/src/index.d.ts.map +1 -1
  44. package/dist/types/src/session/artifact-diff.d.ts +27 -0
  45. package/dist/types/src/session/artifact-diff.d.ts.map +1 -0
  46. package/dist/types/src/session/format.d.ts +168 -0
  47. package/dist/types/src/session/format.d.ts.map +1 -0
  48. package/dist/types/src/session/format.test.d.ts +2 -0
  49. package/dist/types/src/session/format.test.d.ts.map +1 -0
  50. package/dist/types/src/session/index.d.ts +1 -0
  51. package/dist/types/src/session/index.d.ts.map +1 -1
  52. package/dist/types/src/session/session.d.ts +123 -239
  53. package/dist/types/src/session/session.d.ts.map +1 -1
  54. package/dist/types/src/session/version-pin.d.ts +4 -4
  55. package/dist/types/src/session/version-pin.d.ts.map +1 -1
  56. package/dist/types/src/templates/index.d.ts +2 -0
  57. package/dist/types/src/templates/index.d.ts.map +1 -0
  58. package/dist/types/src/templates/system.d.ts +22 -0
  59. package/dist/types/src/templates/system.d.ts.map +1 -0
  60. package/dist/types/src/types.d.ts +13 -0
  61. package/dist/types/src/types.d.ts.map +1 -1
  62. package/dist/types/tsconfig.tsbuildinfo +1 -1
  63. package/package.json +46 -22
  64. package/src/{context/binder.ts → conversation/context.ts} +51 -19
  65. package/src/conversation/conversation.ts +90 -68
  66. package/src/conversation/index.ts +1 -0
  67. package/src/errors.ts +10 -0
  68. package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +7 -18
  69. package/src/extraction/extraction-llm-function/extraction-llm-function.ts +22 -17
  70. package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +4 -3
  71. package/src/extraction/extraction-ner-function/extraction-ner-function.ts +7 -4
  72. package/src/extraction/extraction-ner-function/named-entity-recognition.test.ts +2 -2
  73. package/src/extraction/extraction-ner-function/named-entity-recognition.ts +1 -1
  74. package/src/extraction/quotes.test.ts +1 -1
  75. package/src/extraction/quotes.ts +1 -1
  76. package/src/functions/index.ts +5 -0
  77. package/src/functions/services.ts +114 -0
  78. package/src/index.ts +3 -5
  79. package/src/session/__snapshots__/session.test.ts.snap +32 -0
  80. package/src/session/artifact-diff.ts +37 -0
  81. package/src/session/format.test.ts +60 -0
  82. package/src/session/format.ts +139 -0
  83. package/src/session/index.ts +1 -0
  84. package/src/session/session.test.ts +87 -57
  85. package/src/session/session.ts +220 -523
  86. package/src/session/version-pin.test.ts +2 -21
  87. package/src/session/version-pin.ts +9 -9
  88. package/src/summarization/summarization.test.ts +82 -106
  89. package/src/templates/format.tpl +55 -0
  90. package/src/templates/index.ts +5 -0
  91. package/src/templates/system.tpl +47 -0
  92. package/src/templates/system.ts +32 -0
  93. package/src/types.ts +45 -1
  94. package/src/typings.d.ts +5 -0
  95. package/dist/types/bin/chat.d.ts +0 -2
  96. package/dist/types/bin/chat.d.ts.map +0 -1
  97. package/dist/types/src/blueprint/blueprint.d.ts +0 -41
  98. package/dist/types/src/blueprint/blueprint.d.ts.map +0 -1
  99. package/dist/types/src/blueprint/index.d.ts +0 -3
  100. package/dist/types/src/blueprint/index.d.ts.map +0 -1
  101. package/dist/types/src/blueprint/registry.d.ts +0 -7
  102. package/dist/types/src/blueprint/registry.d.ts.map +0 -1
  103. package/dist/types/src/context/binder.d.ts +0 -34
  104. package/dist/types/src/context/binder.d.ts.map +0 -1
  105. package/dist/types/src/context/binding.d.ts +0 -38
  106. package/dist/types/src/context/binding.d.ts.map +0 -1
  107. package/dist/types/src/context/index.d.ts +0 -3
  108. package/dist/types/src/context/index.d.ts.map +0 -1
  109. package/dist/types/src/research/exa.d.ts +0 -7
  110. package/dist/types/src/research/exa.d.ts.map +0 -1
  111. package/dist/types/src/research/graph.d.ts +0 -41
  112. package/dist/types/src/research/graph.d.ts.map +0 -1
  113. package/dist/types/src/research/graph.test.d.ts +0 -2
  114. package/dist/types/src/research/graph.test.d.ts.map +0 -1
  115. package/dist/types/src/research/index.d.ts +0 -4
  116. package/dist/types/src/research/index.d.ts.map +0 -1
  117. package/dist/types/src/research/research.d.ts +0 -10
  118. package/dist/types/src/research/research.d.ts.map +0 -1
  119. package/dist/types/src/research/research.test.d.ts +0 -2
  120. package/dist/types/src/research/research.test.d.ts.map +0 -1
  121. package/dist/types/src/testing/exa-search-1748337321991.d.ts +0 -38
  122. package/dist/types/src/testing/exa-search-1748337321991.d.ts.map +0 -1
  123. package/dist/types/src/testing/exa-search-1748337331526.d.ts +0 -37
  124. package/dist/types/src/testing/exa-search-1748337331526.d.ts.map +0 -1
  125. package/dist/types/src/testing/exa-search-1748337344119.d.ts +0 -58
  126. package/dist/types/src/testing/exa-search-1748337344119.d.ts.map +0 -1
  127. package/dist/types/src/testing/index.d.ts +0 -3
  128. package/dist/types/src/testing/index.d.ts.map +0 -1
  129. package/src/blueprint/blueprint.ts +0 -75
  130. package/src/blueprint/index.ts +0 -6
  131. package/src/blueprint/registry.ts +0 -15
  132. package/src/context/binding.ts +0 -31
  133. package/src/context/index.ts +0 -6
  134. package/src/research/exa.ts +0 -100
  135. package/src/research/graph.test.ts +0 -15
  136. package/src/research/graph.ts +0 -337
  137. package/src/research/index.ts +0 -7
  138. package/src/research/instructions-research.tpl +0 -97
  139. package/src/research/research.test.ts +0 -190
  140. package/src/research/research.ts +0 -90
  141. package/src/testing/exa-search-1748337321991.ts +0 -131
  142. package/src/testing/exa-search-1748337331526.ts +0 -144
  143. package/src/testing/exa-search-1748337344119.ts +0 -133
  144. package/src/testing/index.ts +0 -11
  145. package/src/typedefs.d.ts +0 -8
@@ -1,34 +0,0 @@
1
- import { type ReadonlySignal } from '@preact/signals-core';
2
- import { type Type, type Ref } from '@dxos/echo';
3
- import { type Queue } from '@dxos/echo-db';
4
- import { ComplexSet } from '@dxos/util';
5
- import { type Blueprint } from '../blueprint';
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>[]>;
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>[];
28
- objects: Ref.Ref<Type.Expando>[];
29
- }>;
30
- export declare class Bindings {
31
- blueprints: ComplexSet<Ref.Ref<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,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;AAGxC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;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,EAAE,CAAC,CAAuD;IAChH,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,EAAE,CAAC;IACjC,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;CAClC,CAAC,CAAC;AAEH,qBAAa,QAAQ;IACnB,UAAU,iCAAmE;IAC7E,OAAO,oCAAsE;CAC9E"}
@@ -1,38 +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<string, string, never>;
13
- tools: Schema.Array$<Schema.SchemaClass<string, string, never>>;
14
- artifacts: Schema.Array$<typeof Schema.String>;
15
- }>>>>;
16
- removed: Schema.Array$<Type.ref<Type.obj<Schema.Struct<{
17
- key: Schema.SchemaClass<string, string, never>;
18
- name: Schema.SchemaClass<string, string, never>;
19
- description: Schema.optional<typeof Schema.String>;
20
- instructions: Schema.SchemaClass<string, string, never>;
21
- tools: Schema.Array$<Schema.SchemaClass<string, string, never>>;
22
- artifacts: Schema.Array$<typeof Schema.String>;
23
- }>>>>;
24
- }>;
25
- objects: Schema.Struct<{
26
- added: Schema.Array$<Type.ref<Schema.Schema<Type.Expando, {
27
- [x: string]: any;
28
- id: string;
29
- }, never>>>;
30
- removed: Schema.Array$<Type.ref<Schema.Schema<Type.Expando, {
31
- [x: string]: any;
32
- id: string;
33
- }, never>>>;
34
- }>;
35
- }>>;
36
- export interface ContextBinding extends Schema.Schema.Type<typeof ContextBinding> {
37
- }
38
- //# 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;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGlC;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgB1B,CAAC;AAEF,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,cAAc,CAAC;CAAG"}
@@ -1,3 +0,0 @@
1
- export * from './binder';
2
- export * from './binding';
3
- //# sourceMappingURL=index.d.ts.map
@@ -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,7 +0,0 @@
1
- type CreateExaToolOptions = {
2
- apiKey: string;
3
- };
4
- export declare const createExaTool: ({ apiKey }: CreateExaToolOptions) => import("@dxos/ai").ExecutableTool;
5
- export declare const createMockExaTool: () => import("@dxos/ai").ExecutableTool;
6
- export {};
7
- //# sourceMappingURL=exa.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exa.d.ts","sourceRoot":"","sources":["../../../../src/research/exa.ts"],"names":[],"mappings":"AAYA,KAAK,oBAAoB,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,YAAY,oBAAoB,sCAuB7D,CAAC;AAEF,eAAO,MAAM,iBAAiB,yCAkC7B,CAAC"}
@@ -1,41 +0,0 @@
1
- import { Schema } from 'effect';
2
- import type { Obj } from '@dxos/echo';
3
- import { type EchoDatabase, type Queue } from '@dxos/echo-db';
4
- import { type BaseObject } from '@dxos/echo-schema';
5
- export declare const Subgraph: Schema.Struct<{
6
- /** Objects and relations. */
7
- objects: Schema.Array$<typeof Schema.Any>;
8
- }>;
9
- export interface Subgraph extends Schema.Schema.Type<typeof Subgraph> {
10
- }
11
- export type RelatedSchema = {
12
- schema: Schema.Schema.AnyNoContext;
13
- kind: 'reference' | 'relation';
14
- };
15
- /**
16
- * Find all schemas that are related to the given schema.
17
- *
18
- * @param db
19
- * @param schema
20
- * @returns
21
- */
22
- export declare const findRelatedSchema: (db: EchoDatabase, anchor: Schema.Schema.AnyNoContext) => Promise<RelatedSchema[]>;
23
- /**
24
- * Perform vector search in the local database.
25
- */
26
- export declare const createLocalSearchTool: (db: EchoDatabase, queue?: Queue) => import("@dxos/ai").ExecutableTool;
27
- /**
28
- * Create a schema for structured data extraction.
29
- */
30
- export declare const createExtractionSchema: (types: Schema.Schema.AnyNoContext[]) => Schema.Struct<{
31
- [k: string]: Schema.optional<Schema.Array$<Schema.Schema.AnyNoContext>>;
32
- }>;
33
- export declare const getSanitizedSchemaName: (schema: Schema.Schema.AnyNoContext) => string;
34
- export declare const sanitizeObjects: (types: Schema.Schema.AnyNoContext[], data: Record<string, readonly unknown[]>, db: EchoDatabase, queue?: Queue) => Promise<BaseObject[]>;
35
- export declare const createGraphWriterTool: ({ db, queue, schema, onDone, }: {
36
- db: EchoDatabase;
37
- queue?: Queue;
38
- schema: Schema.Schema.AnyNoContext[];
39
- onDone?: (data: Obj.Any[]) => Promise<any>;
40
- }) => import("@dxos/ai").ExecutableTool;
41
- //# 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,EAA+B,MAAM,QAAQ,CAAC;AAG7D,OAAO,KAAK,EAAE,GAAG,EAAY,MAAM,YAAY,CAAC;AAEhD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EAUL,KAAK,UAAU,EAKhB,MAAM,mBAAmB,CAAC;AAO3B,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;AACH,eAAO,MAAM,qBAAqB,GAAI,IAAI,YAAY,EAAE,QAAQ,KAAK,sCAyBpE,CAAC;AAEF;;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;AA2CF,eAAO,MAAM,qBAAqB,GAAI,gCAKnC;IACD,EAAE,EAAE,YAAY,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;IACrC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CAC5C,sCAUA,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=graph.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graph.test.d.ts","sourceRoot":"","sources":["../../../../src/research/graph.test.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- export * from './exa';
2
- export * from './research';
3
- export * from './graph';
4
- //# sourceMappingURL=index.d.ts.map
@@ -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
- result: any;
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":"AAkBA;;GAEG;AAEH,eAAO,MAAM,UAAU;;;;YAuDC,GAAG;EAYzB,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=research.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"research.test.d.ts","sourceRoot":"","sources":["../../../../src/research/research.test.ts"],"names":[],"mappings":""}
@@ -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,3 +0,0 @@
1
- import type { SearchResponse } from 'exa-js';
2
- export declare const SEARCH_RESULTS: SearchResponse<any>[];
3
- //# sourceMappingURL=index.d.ts.map
@@ -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"}
@@ -1,75 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { Schema } from 'effect';
6
-
7
- import { ToolId } from '@dxos/ai';
8
- import { Type } from '@dxos/echo';
9
- import { LabelAnnotation } from '@dxos/echo-schema';
10
-
11
- /**
12
- * Blueprint schema defines the structure for AI assistant blueprints.
13
- * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.
14
- */
15
- export const Blueprint = Schema.Struct({
16
- /**
17
- * Global registry ID.
18
- * NOTE: Once a blueprint has been cloned from the registry, its stored definition may converge,
19
- * but the `key` property refers to the original registry entry.
20
- */
21
- // TODO(burdon): Create Format type.
22
- key: Schema.String.annotations({
23
- description: 'Unique registration key for the blueprint',
24
- }),
25
-
26
- /**
27
- * Human-readable name of the blueprint.
28
- */
29
- name: Schema.String.annotations({
30
- description: 'Human-readable name of the blueprint',
31
- }),
32
-
33
- /**
34
- * Description of the blueprint's purpose and functionality.
35
- */
36
- description: Schema.optional(Schema.String).annotations({
37
- description: "Description of the blueprint's purpose and functionality",
38
- }),
39
-
40
- /**
41
- * Instructions that guide the AI assistant's behavior and responses.
42
- * These are system prompts or guidelines that the AI should follow.
43
- */
44
- instructions: Schema.String.annotations({
45
- description: "Instructions that guide the AI assistant's behavior and responses",
46
- }),
47
-
48
- /**
49
- * Array of tools that the AI assistant can use when this blueprint is active.
50
- */
51
- tools: Schema.Array(ToolId).annotations({
52
- description: 'Array of tools that the AI assistant can use when this blueprint is active',
53
- }),
54
-
55
- /**
56
- * Array of artifacts that the AI assistant can create or modify.
57
- */
58
- artifacts: Schema.Array(Schema.String).annotations({
59
- description: 'Ids of artifact definitions that should be pulled into the blueprint',
60
- }),
61
- }).pipe(
62
- Type.Obj({
63
- // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.
64
- typename: 'dxos.org/type/Blueprint',
65
- version: '0.1.0',
66
- }),
67
-
68
- // TODO(burdon): Move to main API.
69
- LabelAnnotation.set(['name']),
70
- );
71
-
72
- /**
73
- * TypeScript type for Blueprint.
74
- */
75
- export interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {}
@@ -1,6 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- export * from './blueprint';
6
- export * from './registry';
@@ -1,15 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { type Blueprint } from './blueprint';
6
-
7
- export class BlueprintRegistry {
8
- constructor(private readonly _blueprints: Blueprint[]) {
9
- this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
10
- }
11
-
12
- query(): Blueprint[] {
13
- return this._blueprints;
14
- }
15
- }
@@ -1,31 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { Schema } from 'effect';
6
-
7
- import { Type } from '@dxos/echo';
8
-
9
- import { Blueprint } from '../blueprint';
10
- /**
11
- * Thread message that binds or unbinds contextual objects to a conversation.
12
- */
13
- export const ContextBinding = Schema.Struct({
14
- blueprints: Schema.Struct({
15
- added: Schema.Array(Type.Ref(Blueprint)),
16
- removed: Schema.Array(Type.Ref(Blueprint)),
17
- }),
18
-
19
- // TODO(burdon): Type.Expando => Type.Obj (or Obj.Any?)
20
- objects: Schema.Struct({
21
- added: Schema.Array(Type.Ref(Type.Expando)),
22
- removed: Schema.Array(Type.Ref(Type.Expando)),
23
- }),
24
- }).pipe(
25
- Type.Obj({
26
- typename: 'dxos.org/type/ContextBinding',
27
- version: '0.1.0',
28
- }),
29
- );
30
-
31
- export interface ContextBinding extends Schema.Schema.Type<typeof ContextBinding> {}
@@ -1,6 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- export * from './binder';
6
- export * from './binding';
@@ -1,100 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { Schema } from 'effect';
6
- import Exa from 'exa-js';
7
-
8
- import { createTool, ToolResult } from '@dxos/ai';
9
- import { log } from '@dxos/log';
10
-
11
- import { SEARCH_RESULTS } from '../testing';
12
-
13
- type CreateExaToolOptions = {
14
- apiKey: string;
15
- };
16
-
17
- export const createExaTool = ({ apiKey }: CreateExaToolOptions) => {
18
- const exa = new Exa(apiKey);
19
-
20
- return createTool('search', {
21
- name: 'web_search',
22
- description: 'Search the web for information',
23
- schema: Schema.Struct({
24
- query: Schema.String.annotations({ description: 'The query to search for' }),
25
- }),
26
- execute: async ({ query }) => {
27
- const context = await exa.searchAndContents(query, {
28
- type: 'auto',
29
- text: {
30
- maxCharacters: 3_000,
31
- },
32
- livecrawl: 'always',
33
- });
34
-
35
- log.info('exa search', { query, costDollars: context.costDollars });
36
-
37
- return ToolResult.Success(context);
38
- },
39
- });
40
- };
41
-
42
- export const createMockExaTool = () => {
43
- return createTool('search', {
44
- name: 'web_search',
45
- description: 'Search the web for information',
46
- schema: Schema.Struct({
47
- query: Schema.String.annotations({ description: 'The query to search for' }),
48
- }),
49
- execute: async ({ query }) => {
50
- // Find result with closest matching autoprompt using weighted Levenshtein distance
51
- const result = SEARCH_RESULTS.reduce(
52
- (closest, current) => {
53
- if (!current.autopromptString) {
54
- return closest;
55
- }
56
- if (!closest) {
57
- return current;
58
- }
59
-
60
- // Calculate Levenshtein distance
61
- const dist1 = levenshteinDistance(query, current.autopromptString);
62
- const dist2 = levenshteinDistance(query, closest.autopromptString || '');
63
-
64
- // Weight by length of the longer string to normalize
65
- const weight1 = dist1 / Math.max(query.length, current.autopromptString.length);
66
- const weight2 = dist2 / Math.max(query.length, closest.autopromptString?.length || 0);
67
-
68
- return weight1 < weight2 ? current : closest;
69
- },
70
- null as (typeof SEARCH_RESULTS)[0] | null,
71
- );
72
-
73
- return ToolResult.Success(result);
74
- },
75
- });
76
- };
77
-
78
- const levenshteinDistance = (str1: string, str2: string): number => {
79
- const m = str1.length;
80
- const n = str2.length;
81
- const dp: number[][] = Array(m + 1)
82
- .fill(null)
83
- .map(() => Array(n + 1).fill(0));
84
-
85
- for (let i = 0; i <= m; i++) {
86
- dp[i][0] = i;
87
- }
88
- for (let j = 0; j <= n; j++) {
89
- dp[0][j] = j;
90
- }
91
-
92
- for (let i = 1; i <= m; i++) {
93
- for (let j = 1; j <= n; j++) {
94
- dp[i][j] =
95
- str1[i - 1] === str2[j - 1] ? dp[i - 1][j - 1] : Math.min(dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1]) + 1;
96
- }
97
- }
98
-
99
- return dp[m][n];
100
- };
@@ -1,15 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { describe } from 'vitest';
6
-
7
- // import { type EchoTestBuilder } from '@dxos/echo-db/testing';
8
-
9
- describe('graph', () => {
10
- // let builder: EchoTestBuilder;
11
- // test('findRelatedSchema', async () => {
12
- // const db = await createEchoDatabase();
13
- // const relatedSchemas = await findRelatedSchema(db, Schema.Struct({}));
14
- // });
15
- });