@dxos/blueprints 0.8.4-main.1068cf700f

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 (38) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +3 -0
  3. package/dist/lib/neutral/index.mjs +255 -0
  4. package/dist/lib/neutral/index.mjs.map +7 -0
  5. package/dist/lib/neutral/meta.json +1 -0
  6. package/dist/types/src/blueprint/blueprint.d.ts +60 -0
  7. package/dist/types/src/blueprint/blueprint.d.ts.map +1 -0
  8. package/dist/types/src/blueprint/index.d.ts +3 -0
  9. package/dist/types/src/blueprint/index.d.ts.map +1 -0
  10. package/dist/types/src/blueprint/registry.d.ts +12 -0
  11. package/dist/types/src/blueprint/registry.d.ts.map +1 -0
  12. package/dist/types/src/index.d.ts +4 -0
  13. package/dist/types/src/index.d.ts.map +1 -0
  14. package/dist/types/src/prompt/index.d.ts +2 -0
  15. package/dist/types/src/prompt/index.d.ts.map +1 -0
  16. package/dist/types/src/prompt/prompt.d.ts +54 -0
  17. package/dist/types/src/prompt/prompt.d.ts.map +1 -0
  18. package/dist/types/src/template/index.d.ts +3 -0
  19. package/dist/types/src/template/index.d.ts.map +1 -0
  20. package/dist/types/src/template/prompt.d.ts +10 -0
  21. package/dist/types/src/template/prompt.d.ts.map +1 -0
  22. package/dist/types/src/template/prompt.test.d.ts +2 -0
  23. package/dist/types/src/template/prompt.test.d.ts.map +1 -0
  24. package/dist/types/src/template/template.d.ts +46 -0
  25. package/dist/types/src/template/template.d.ts.map +1 -0
  26. package/dist/types/tsconfig.tsbuildinfo +1 -0
  27. package/package.json +45 -0
  28. package/src/blueprint/blueprint.ts +91 -0
  29. package/src/blueprint/index.ts +6 -0
  30. package/src/blueprint/registry.ts +40 -0
  31. package/src/index.ts +7 -0
  32. package/src/prompt/index.ts +5 -0
  33. package/src/prompt/prompt.ts +79 -0
  34. package/src/template/index.ts +6 -0
  35. package/src/template/prompt.test.ts +44 -0
  36. package/src/template/prompt.ts +59 -0
  37. package/src/template/template.ts +61 -0
  38. package/src/vite-env.d.ts +20 -0
package/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ MIT License
2
+ Copyright (c) 2022 DXOS
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @dxos/blueprints
2
+
3
+ Low-level definitions for Blueprints, Templates, and related utilities.
@@ -0,0 +1,255 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/blueprint/index.ts
8
+ var blueprint_exports = {};
9
+ __export(blueprint_exports, {
10
+ Blueprint: () => Blueprint,
11
+ Registry: () => Registry,
12
+ make: () => make2,
13
+ toolDefinitions: () => toolDefinitions
14
+ });
15
+
16
+ // src/blueprint/blueprint.ts
17
+ import * as Schema2 from "effect/Schema";
18
+ import { ToolId } from "@dxos/ai";
19
+ import { Annotation, Obj, Type as Type2 } from "@dxos/echo";
20
+
21
+ // src/template/index.ts
22
+ var template_exports = {};
23
+ __export(template_exports, {
24
+ Input: () => Input,
25
+ InputKind: () => InputKind,
26
+ Template: () => Template,
27
+ make: () => make,
28
+ process: () => process,
29
+ processTemplate: () => processTemplate
30
+ });
31
+
32
+ // src/template/prompt.ts
33
+ import * as Effect from "effect/Effect";
34
+ import * as Record from "effect/Record";
35
+ import handlebars from "handlebars";
36
+ import { Database } from "@dxos/echo";
37
+ import { FunctionInvocationService } from "@dxos/functions";
38
+ import { invariant } from "@dxos/invariant";
39
+ import { log } from "@dxos/log";
40
+ var __dxlog_file = "/__w/dxos/dxos/packages/core/blueprints/src/template/prompt.ts";
41
+ var process = (source, variables = {}) => {
42
+ invariant(typeof source === "string", void 0, {
43
+ F: __dxlog_file,
44
+ L: 26,
45
+ S: void 0,
46
+ A: [
47
+ "typeof source === 'string'",
48
+ ""
49
+ ]
50
+ });
51
+ let section = 0;
52
+ handlebars.registerHelper("section", () => String(++section));
53
+ const template = handlebars.compile(source.trim());
54
+ const output = template(variables);
55
+ return output.trim().replace(/(\n\s*){3,}/g, "\n\n");
56
+ };
57
+ var processTemplate = (template) => Effect.gen(function* () {
58
+ const functionInvoker = yield* FunctionInvocationService;
59
+ const variables = yield* Effect.forEach(template.inputs ?? [], (input) => Effect.gen(function* () {
60
+ if (input.kind === "function") {
61
+ const fn = yield* functionInvoker.resolveFunction(input.function);
62
+ const result = yield* functionInvoker.invokeFunction(fn, {});
63
+ return [
64
+ input.name,
65
+ result
66
+ ];
67
+ } else {
68
+ return yield* Effect.dieMessage(`Unsupported input kind: ${input.kind}`);
69
+ }
70
+ })).pipe(Effect.map(Record.fromEntries));
71
+ log("processTemplate", {
72
+ variables
73
+ }, {
74
+ F: __dxlog_file,
75
+ L: 56,
76
+ S: this,
77
+ C: (f, a) => f(...a)
78
+ });
79
+ return process((yield* Database.load(template.source)).content, variables);
80
+ });
81
+
82
+ // src/template/template.ts
83
+ import * as Schema from "effect/Schema";
84
+ import { Ref, Type } from "@dxos/echo";
85
+ import { Text } from "@dxos/schema";
86
+ var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
87
+ var Input = Schema.Struct({
88
+ name: Schema.String,
89
+ kind: Schema.optional(InputKind),
90
+ default: Schema.optional(Schema.Any),
91
+ /**
92
+ * Function to call if the kind is 'function'.
93
+ */
94
+ function: Schema.optional(Schema.String)
95
+ });
96
+ var Template = Schema.Struct({
97
+ source: Type.Ref(Text.Text).annotations({
98
+ description: "Handlebars template source"
99
+ }),
100
+ inputs: Schema.optional(Schema.Array(Input))
101
+ });
102
+ var make = ({ source, inputs = [], id } = {}) => ({
103
+ source: Ref.make(Text.make(source, id)),
104
+ inputs
105
+ });
106
+
107
+ // src/blueprint/blueprint.ts
108
+ var Blueprint = Schema2.Struct({
109
+ /**
110
+ * Global registry ID.
111
+ * NOTE: The `key` property refers to the original registry entry.
112
+ */
113
+ // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.
114
+ key: Schema2.String.annotations({
115
+ description: "Unique registration key for the blueprint"
116
+ }),
117
+ /**
118
+ * Human-readable name of the blueprint.
119
+ */
120
+ name: Schema2.String.annotations({
121
+ description: "Human-readable name of the blueprint"
122
+ }),
123
+ /**
124
+ * Description of the blueprint's purpose and functionality.
125
+ */
126
+ description: Schema2.optional(Schema2.String).annotations({
127
+ description: "Description of the blueprint's purpose and functionality"
128
+ }),
129
+ /**
130
+ * Instructions that guide the AI assistant's behavior and responses.
131
+ * These are system prompts or guidelines that the AI should follow.
132
+ */
133
+ instructions: Template.annotations({
134
+ description: "Instructions that guide the AI assistant's behavior and responses"
135
+ }),
136
+ /**
137
+ * Array of tools that the AI assistant can use when this blueprint is active.
138
+ */
139
+ tools: Schema2.Array(ToolId).annotations({
140
+ description: "Array of tools that the AI assistant can use when this blueprint is active"
141
+ })
142
+ }).pipe(Type2.object({
143
+ // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.
144
+ typename: "dxos.org/type/Blueprint",
145
+ version: "0.1.0"
146
+ }), Annotation.LabelAnnotation.set([
147
+ "name"
148
+ ]));
149
+ var make2 = ({ tools = [], instructions = make(), ...props }) => Obj.make(Blueprint, {
150
+ tools,
151
+ instructions,
152
+ ...props
153
+ });
154
+ var toolDefinitions = ({ tools = [], functions = [] }) => [
155
+ ...functions.map((fn) => ToolId.make(fn.key)),
156
+ ...tools.map((tool) => ToolId.make(tool))
157
+ ];
158
+
159
+ // src/blueprint/registry.ts
160
+ import { log as log2 } from "@dxos/log";
161
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/core/blueprints/src/blueprint/registry.ts";
162
+ var Registry = class {
163
+ _blueprints = [];
164
+ constructor(blueprints) {
165
+ const seen = /* @__PURE__ */ new Set();
166
+ blueprints.forEach((blueprint) => {
167
+ if (seen.has(blueprint.key)) {
168
+ log2.warn("duplicate blueprint", {
169
+ key: blueprint.key
170
+ }, {
171
+ F: __dxlog_file2,
172
+ L: 19,
173
+ S: this,
174
+ C: (f, a) => f(...a)
175
+ });
176
+ } else {
177
+ seen.add(blueprint.key);
178
+ this._blueprints.push(blueprint);
179
+ }
180
+ });
181
+ this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
182
+ }
183
+ get blueprints() {
184
+ return this._blueprints;
185
+ }
186
+ getByKey(key) {
187
+ return this._blueprints.find((blueprint) => blueprint.key === key);
188
+ }
189
+ query() {
190
+ return this._blueprints;
191
+ }
192
+ };
193
+
194
+ // src/prompt/index.ts
195
+ var prompt_exports = {};
196
+ __export(prompt_exports, {
197
+ Prompt: () => Prompt,
198
+ make: () => make3
199
+ });
200
+
201
+ // src/prompt/prompt.ts
202
+ import * as Schema3 from "effect/Schema";
203
+ import { Annotation as Annotation2, JsonSchema, Obj as Obj2, Type as Type3 } from "@dxos/echo";
204
+ var Prompt = Schema3.Struct({
205
+ /**
206
+ * Name of the prompt.
207
+ */
208
+ name: Schema3.optional(Schema3.String),
209
+ /**
210
+ * Description of the prompt's purpose and functionality.
211
+ * Allows AI agents to execute prompts automatically as tools.
212
+ */
213
+ description: Schema3.optional(Schema3.String),
214
+ /**
215
+ * Input schema of the prompt.
216
+ */
217
+ input: JsonSchema.JsonSchema.pipe(Annotation2.FormInputAnnotation.set(false)),
218
+ /**
219
+ * Output schema of the prompt.
220
+ */
221
+ output: JsonSchema.JsonSchema.pipe(Annotation2.FormInputAnnotation.set(false)),
222
+ /**
223
+ * Natural language instructions for the prompt.
224
+ * These should provide concrete course of action for the AI to follow.
225
+ */
226
+ instructions: Template.pipe(Annotation2.FormInputAnnotation.set(false)),
227
+ /**
228
+ * Blueprints that the prompt may utilize.
229
+ */
230
+ blueprints: Schema3.Array(Type3.Ref(Blueprint)),
231
+ /**
232
+ * Additional context that the prompt may utilize.
233
+ */
234
+ context: Schema3.Array(Schema3.Any).pipe(Annotation2.FormInputAnnotation.set(false))
235
+ }).pipe(Type3.object({
236
+ typename: "dxos.org/type/Prompt",
237
+ version: "0.1.0"
238
+ }));
239
+ var make3 = (params) => Obj2.make(Prompt, {
240
+ name: params.name,
241
+ description: params.description,
242
+ input: JsonSchema.toJsonSchema(params.input ?? Schema3.Void),
243
+ output: JsonSchema.toJsonSchema(params.output ?? Schema3.Void),
244
+ instructions: make({
245
+ source: params.instructions
246
+ }),
247
+ blueprints: params.blueprints ?? [],
248
+ context: params.context ?? []
249
+ });
250
+ export {
251
+ blueprint_exports as Blueprint,
252
+ prompt_exports as Prompt,
253
+ template_exports as Template
254
+ };
255
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/blueprint/index.ts", "../../../src/blueprint/blueprint.ts", "../../../src/template/index.ts", "../../../src/template/prompt.ts", "../../../src/template/template.ts", "../../../src/blueprint/registry.ts", "../../../src/prompt/index.ts", "../../../src/prompt/prompt.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './blueprint';\nexport * from './registry';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { ToolId } from '@dxos/ai';\nimport { Annotation, Obj, Type } from '@dxos/echo';\nimport { type FunctionDefinition } from '@dxos/functions';\n\nimport * as Template from '../template';\n\n/**\n * Blueprint schema defines the structure for AI assistant blueprints.\n * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.\n * Blueprints may use tools to create and read artifacts, which are managed by the assistant.\n */\nexport const Blueprint = Schema.Struct({\n /**\n * Global registry ID.\n * NOTE: The `key` property refers to the original registry entry.\n */\n // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.\n key: Schema.String.annotations({\n description: 'Unique registration key for the blueprint',\n }),\n\n /**\n * Human-readable name of the blueprint.\n */\n name: Schema.String.annotations({\n description: 'Human-readable name of the blueprint',\n }),\n\n /**\n * Description of the blueprint's purpose and functionality.\n */\n description: Schema.optional(Schema.String).annotations({\n description: \"Description of the blueprint's purpose and functionality\",\n }),\n\n /**\n * Instructions that guide the AI assistant's behavior and responses.\n * These are system prompts or guidelines that the AI should follow.\n */\n instructions: Template.Template.annotations({\n description: \"Instructions that guide the AI assistant's behavior and responses\",\n }),\n\n /**\n * Array of tools that the AI assistant can use when this blueprint is active.\n */\n tools: Schema.Array(ToolId).annotations({\n description: 'Array of tools that the AI assistant can use when this blueprint is active',\n }),\n}).pipe(\n Type.object({\n // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.\n typename: 'dxos.org/type/Blueprint',\n version: '0.1.0',\n }),\n Annotation.LabelAnnotation.set(['name']),\n);\n\n/**\n * TypeScript type for Blueprint.\n */\nexport interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {}\n\ntype MakeProps = Pick<Blueprint, 'key' | 'name'> & Partial<Blueprint>;\n\n/**\n * Create a new Blueprint.\n */\nexport const make = ({ tools = [], instructions = Template.make(), ...props }: MakeProps) =>\n Obj.make(Blueprint, {\n tools,\n instructions,\n ...props,\n });\n\n/**\n * Util to create tool definitions for a blueprint.\n */\nexport const toolDefinitions = ({\n tools = [],\n functions = [],\n}: {\n tools?: string[];\n functions?: FunctionDefinition[];\n}) => [...functions.map((fn) => ToolId.make(fn.key)), ...tools.map((tool) => ToolId.make(tool))];\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\nexport * from './template';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Record from 'effect/Record';\nimport handlebars from 'handlebars';\n\nimport { Database } from '@dxos/echo';\nimport type { ObjectNotFoundError } from '@dxos/echo/Err';\nimport {\n type FunctionDefinition,\n FunctionInvocationService,\n type FunctionNotFoundError,\n type TracingService,\n} from '@dxos/functions';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\n\nimport type { Template } from '..';\n\n/**\n * Process Handlebars template.\n */\nexport const process = <Options extends {}>(source: string, variables: Partial<Options> = {}): string => {\n invariant(typeof source === 'string');\n let section = 0;\n handlebars.registerHelper('section', () => String(++section));\n const template = handlebars.compile(source.trim());\n const output = template(variables);\n return output.trim().replace(/(\\n\\s*){3,}/g, '\\n\\n');\n};\n\nexport const processTemplate = (\n template: Template.Template,\n): Effect.Effect<string, ObjectNotFoundError | FunctionNotFoundError, FunctionInvocationService | TracingService> =>\n Effect.gen(function* () {\n const functionInvoker = yield* FunctionInvocationService;\n\n const variables = yield* Effect.forEach(template.inputs ?? [], (input) =>\n Effect.gen(function* () {\n if (input.kind === 'function') {\n const fn = (yield* functionInvoker.resolveFunction(input.function!)) as FunctionDefinition<\n {},\n unknown,\n never\n >;\n const result = yield* functionInvoker.invokeFunction(fn, {});\n return [input.name, result] as const;\n } else {\n return yield* Effect.dieMessage(`Unsupported input kind: ${input.kind}`);\n }\n }),\n ).pipe(Effect.map(Record.fromEntries));\n\n log('processTemplate', { variables });\n\n return process((yield* Database.load(template.source)).content, variables);\n });\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Ref, Type } from '@dxos/echo';\nimport { type ObjectId } from '@dxos/keys';\nimport { Text } from '@dxos/schema';\n\n/**\n * Template input kind determines how template variables are resolved.\n */\nexport const InputKind = Schema.Literal(\n 'value', // Literal value.\n 'pass-through',\n 'retriever',\n 'function',\n 'query',\n 'resolver',\n 'context',\n 'schema',\n);\n\nexport type InputKind = Schema.Schema.Type<typeof InputKind>;\n\n/**\n * Template input variable.\n * E.g., {{foo}}\n */\nexport const Input = Schema.Struct({\n name: Schema.String,\n kind: Schema.optional(InputKind),\n default: Schema.optional(Schema.Any),\n\n /**\n * Function to call if the kind is 'function'.\n */\n function: Schema.optional(Schema.String),\n});\n\nexport type Input = Schema.Schema.Type<typeof Input>;\n\n/**\n * Template type.\n */\nexport const Template = Schema.Struct({\n source: Type.Ref(Text.Text).annotations({ description: 'Handlebars template source' }),\n inputs: Schema.optional(Schema.Array(Input)),\n});\n\nexport interface Template extends Schema.Schema.Type<typeof Template> {}\n\nexport const make = ({\n source,\n inputs = [],\n id,\n}: { source?: string; inputs?: Input[]; id?: ObjectId } = {}): Template => ({\n source: Ref.make(Text.make(source, id)),\n inputs,\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { log } from '@dxos/log';\n\nimport { type Blueprint } from './blueprint';\n\n/**\n * Blueprint registry.\n */\nexport class Registry {\n private readonly _blueprints: Blueprint[] = [];\n\n constructor(blueprints: Blueprint[]) {\n const seen = new Set<string>();\n blueprints.forEach((blueprint) => {\n if (seen.has(blueprint.key)) {\n log.warn('duplicate blueprint', { key: blueprint.key });\n } else {\n seen.add(blueprint.key);\n this._blueprints.push(blueprint);\n }\n });\n\n this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));\n }\n\n get blueprints(): Blueprint[] {\n return this._blueprints;\n }\n\n getByKey(key: string): Blueprint | undefined {\n return this._blueprints.find((blueprint) => blueprint.key === key);\n }\n\n query(): Blueprint[] {\n return this._blueprints;\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, JsonSchema, Obj, type Ref, Type } from '@dxos/echo';\n\nimport { Blueprint } from '../blueprint';\nimport * as Template from '../template';\n\n/**\n * Executable instructions, which may use Blueprints.\n * May reference additional context.\n */\nexport const Prompt = Schema.Struct({\n /**\n * Name of the prompt.\n */\n name: Schema.optional(Schema.String),\n\n /**\n * Description of the prompt's purpose and functionality.\n * Allows AI agents to execute prompts automatically as tools.\n */\n description: Schema.optional(Schema.String),\n\n /**\n * Input schema of the prompt.\n */\n input: JsonSchema.JsonSchema.pipe(Annotation.FormInputAnnotation.set(false)),\n\n /**\n * Output schema of the prompt.\n */\n output: JsonSchema.JsonSchema.pipe(Annotation.FormInputAnnotation.set(false)),\n\n /**\n * Natural language instructions for the prompt.\n * These should provide concrete course of action for the AI to follow.\n */\n instructions: Template.Template.pipe(Annotation.FormInputAnnotation.set(false)),\n\n /**\n * Blueprints that the prompt may utilize.\n */\n blueprints: Schema.Array(Type.Ref(Blueprint)),\n\n /**\n * Additional context that the prompt may utilize.\n */\n context: Schema.Array(Schema.Any).pipe(Annotation.FormInputAnnotation.set(false)),\n}).pipe(\n Type.object({\n typename: 'dxos.org/type/Prompt',\n version: '0.1.0',\n }),\n);\n\nexport interface Prompt extends Schema.Schema.Type<typeof Prompt> {}\n\nexport const make = (params: {\n name?: string;\n description?: string;\n input?: Schema.Schema.AnyNoContext;\n output?: Schema.Schema.AnyNoContext;\n instructions?: string;\n blueprints?: Ref.Ref<Blueprint>[];\n context?: any[];\n}): Prompt =>\n Obj.make(Prompt, {\n name: params.name,\n description: params.description,\n input: JsonSchema.toJsonSchema(params.input ?? Schema.Void),\n output: JsonSchema.toJsonSchema(params.output ?? Schema.Void),\n instructions: Template.make({ source: params.instructions }),\n blueprints: params.blueprints ?? [],\n context: params.context ?? [],\n });\n"],
5
+ "mappings": ";;;;;;;AAAA;;;;cAAAA;EAAA;;;;ACIA,YAAYC,aAAY;AAExB,SAASC,cAAc;AACvB,SAASC,YAAYC,KAA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,IAAI,KAAA,CAAA;;;;EAKxEI,YAAmBC,cAAMC,MAAKC,IAAIC,SAAAA,CAAAA;;;;EAKlCC,SAAgBJ,cAAaK,WAAG,EAAEb,KAAKC,YAAWC,oBAAoBC,IAAI,KAAA,CAAA;AAC5E,CAAA,EAAGH,KACDS,MAAKK,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,CAAA;AAKK,IAAMC,QAAO,CAACC,WASnBC,KAAIF,KAAKzB,QAAQ;EACfE,MAAMwB,OAAOxB;EACbG,aAAaqB,OAAOrB;EACpBC,OAAOC,WAAWqB,aAAaF,OAAOpB,SAAgBuB,YAAI;EAC1DjB,QAAQL,WAAWqB,aAAaF,OAAOd,UAAiBiB,YAAI;EAC5DhB,cAAuBY,KAAK;IAAEK,QAAQJ,OAAOb;EAAa,CAAA;EAC1DE,YAAYW,OAAOX,cAAc,CAAA;EACjCK,SAASM,OAAON,WAAW,CAAA;AAC7B,CAAA;",
6
+ "names": ["make", "Schema", "ToolId", "Annotation", "Obj", "Type", "Effect", "Record", "handlebars", "Database", "FunctionInvocationService", "invariant", "log", "process", "source", "variables", "section", "registerHelper", "String", "template", "compile", "trim", "output", "replace", "processTemplate", "gen", "functionInvoker", "forEach", "inputs", "input", "kind", "fn", "resolveFunction", "function", "result", "invokeFunction", "name", "dieMessage", "pipe", "map", "fromEntries", "load", "content", "Schema", "Ref", "Type", "Text", "InputKind", "Literal", "Input", "Struct", "name", "String", "kind", "optional", "default", "Any", "function", "Template", "source", "Type", "Ref", "Text", "annotations", "description", "inputs", "Array", "make", "id", "Blueprint", "Struct", "key", "String", "annotations", "description", "name", "optional", "instructions", "Template", "tools", "Array", "ToolId", "pipe", "Type", "object", "typename", "version", "Annotation", "LabelAnnotation", "set", "make", "props", "Obj", "toolDefinitions", "functions", "map", "fn", "tool", "log", "Registry", "_blueprints", "blueprints", "seen", "Set", "forEach", "blueprint", "has", "key", "warn", "add", "push", "sort", "name", "a", "b", "localeCompare", "getByKey", "find", "query", "make", "Schema", "Annotation", "JsonSchema", "Obj", "Type", "Prompt", "Struct", "name", "optional", "String", "description", "input", "JsonSchema", "pipe", "Annotation", "FormInputAnnotation", "set", "output", "instructions", "Template", "blueprints", "Array", "Type", "Ref", "Blueprint", "context", "Any", "object", "typename", "version", "make", "params", "Obj", "toJsonSchema", "Void", "source"]
7
+ }
@@ -0,0 +1 @@
1
+ {"inputs":{"src/template/prompt.ts":{"bytes":6876,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/template/template.ts":{"bytes":4450,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"src/template/index.ts":{"bytes":546,"imports":[{"path":"src/template/prompt.ts","kind":"import-statement","original":"./prompt"},{"path":"src/template/template.ts","kind":"import-statement","original":"./template"}],"format":"esm"},"src/blueprint/blueprint.ts":{"bytes":8164,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/template/index.ts","kind":"import-statement","original":"../template"}],"format":"esm"},"src/blueprint/registry.ts":{"bytes":3662,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/blueprint/index.ts":{"bytes":554,"imports":[{"path":"src/blueprint/blueprint.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/blueprint/registry.ts","kind":"import-statement","original":"./registry"}],"format":"esm"},"src/prompt/prompt.ts":{"bytes":7056,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/blueprint/index.ts","kind":"import-statement","original":"../blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"../template"}],"format":"esm"},"src/prompt/index.ts":{"bytes":456,"imports":[{"path":"src/prompt/prompt.ts","kind":"import-statement","original":"./prompt"}],"format":"esm"},"src/index.ts":{"bytes":813,"imports":[{"path":"src/blueprint/index.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"./template"},{"path":"src/prompt/index.ts","kind":"import-statement","original":"./prompt"}],"format":"esm"}},"outputs":{"dist/lib/neutral/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15363},"dist/lib/neutral/index.mjs":{"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["Blueprint","Prompt","Template"],"entryPoint":"src/index.ts","inputs":{"src/blueprint/index.ts":{"bytesInOutput":182},"src/blueprint/blueprint.ts":{"bytesInOutput":1842},"src/template/index.ts":{"bytesInOutput":227},"src/template/prompt.ts":{"bytesInOutput":1634},"src/template/template.ts":{"bytesInOutput":761},"src/blueprint/registry.ts":{"bytesInOutput":897},"src/index.ts":{"bytesInOutput":0},"src/prompt/index.ts":{"bytesInOutput":100},"src/prompt/prompt.ts":{"bytesInOutput":1592}},"bytes":7792}}}
@@ -0,0 +1,60 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import { Obj, Type } from '@dxos/echo';
3
+ import { type FunctionDefinition } from '@dxos/functions';
4
+ /**
5
+ * Blueprint schema defines the structure for AI assistant blueprints.
6
+ * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.
7
+ * Blueprints may use tools to create and read artifacts, which are managed by the assistant.
8
+ */
9
+ export declare const Blueprint: Type.Obj<{
10
+ readonly description?: string | undefined;
11
+ readonly name: string;
12
+ readonly key: string;
13
+ readonly instructions: {
14
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
15
+ readonly content: string;
16
+ }>;
17
+ readonly inputs?: readonly {
18
+ readonly function?: string | undefined;
19
+ readonly name: string;
20
+ readonly kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
21
+ readonly default?: any;
22
+ }[] | undefined;
23
+ };
24
+ readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
25
+ }, Schema.Struct.Fields>;
26
+ /**
27
+ * TypeScript type for Blueprint.
28
+ */
29
+ export interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {
30
+ }
31
+ type MakeProps = Pick<Blueprint, 'key' | 'name'> & Partial<Blueprint>;
32
+ /**
33
+ * Create a new Blueprint.
34
+ */
35
+ export declare const make: ({ tools, instructions, ...props }: MakeProps) => Obj.Obj<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
36
+ readonly description?: string | undefined;
37
+ readonly name: string;
38
+ readonly key: string;
39
+ readonly instructions: {
40
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
41
+ readonly content: string;
42
+ }>;
43
+ readonly inputs?: readonly {
44
+ readonly function?: string | undefined;
45
+ readonly name: string;
46
+ readonly kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
47
+ readonly default?: any;
48
+ }[] | undefined;
49
+ };
50
+ readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
51
+ }>;
52
+ /**
53
+ * Util to create tool definitions for a blueprint.
54
+ */
55
+ export declare const toolDefinitions: ({ tools, functions, }: {
56
+ tools?: string[];
57
+ functions?: FunctionDefinition[];
58
+ }) => (string & import("effect/Brand").Brand<"ToolId">)[];
59
+ export {};
60
+ //# sourceMappingURL=blueprint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blueprint.d.ts","sourceRoot":"","sources":["../../../../src/blueprint/blueprint.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAc,GAAG,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAI1D;;;;GAIG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;wBA6CrB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC;CAAG;AAE1E,KAAK,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,IAAI,GAAI,mCAA0D,SAAS;;;;;;;;;;;;;;;;EAKpF,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,uBAG7B;IACD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAClC,wDAA+F,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './blueprint';
2
+ export * from './registry';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blueprint/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { type Blueprint } from './blueprint';
2
+ /**
3
+ * Blueprint registry.
4
+ */
5
+ export declare class Registry {
6
+ private readonly _blueprints;
7
+ constructor(blueprints: Blueprint[]);
8
+ get blueprints(): Blueprint[];
9
+ getByKey(key: string): Blueprint | undefined;
10
+ query(): Blueprint[];
11
+ }
12
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/blueprint/registry.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;gBAEnC,UAAU,EAAE,SAAS,EAAE;IAcnC,IAAI,UAAU,IAAI,SAAS,EAAE,CAE5B;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAI5C,KAAK,IAAI,SAAS,EAAE;CAGrB"}
@@ -0,0 +1,4 @@
1
+ export * as Blueprint from './blueprint';
2
+ export * as Template from './template';
3
+ export * as Prompt from './prompt';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './prompt';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/prompt/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,54 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import { type Ref, Type } from '@dxos/echo';
3
+ import { Blueprint } from '../blueprint';
4
+ /**
5
+ * Executable instructions, which may use Blueprints.
6
+ * May reference additional context.
7
+ */
8
+ export declare const Prompt: Type.Obj<{
9
+ readonly description?: string | undefined;
10
+ readonly name?: string | undefined;
11
+ readonly context: readonly any[];
12
+ readonly instructions: {
13
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
14
+ readonly content: string;
15
+ }>;
16
+ readonly inputs?: readonly {
17
+ readonly function?: string | undefined;
18
+ readonly name: string;
19
+ readonly kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
20
+ readonly default?: any;
21
+ }[] | undefined;
22
+ };
23
+ readonly input: import("@dxos/echo/internal").JsonSchemaType;
24
+ readonly output: import("@dxos/echo/internal").JsonSchemaType;
25
+ readonly blueprints: readonly import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
26
+ readonly description?: string | undefined;
27
+ readonly name: string;
28
+ readonly key: string;
29
+ readonly instructions: {
30
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
31
+ readonly content: string;
32
+ }>;
33
+ readonly inputs?: readonly {
34
+ readonly function?: string | undefined;
35
+ readonly name: string;
36
+ readonly kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
37
+ readonly default?: any;
38
+ }[] | undefined;
39
+ };
40
+ readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
41
+ }>[];
42
+ }, Schema.Struct.Fields>;
43
+ export interface Prompt extends Schema.Schema.Type<typeof Prompt> {
44
+ }
45
+ export declare const make: (params: {
46
+ name?: string;
47
+ description?: string;
48
+ input?: Schema.Schema.AnyNoContext;
49
+ output?: Schema.Schema.AnyNoContext;
50
+ instructions?: string;
51
+ blueprints?: Ref.Ref<Blueprint>[];
52
+ context?: any[];
53
+ }) => Prompt;
54
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/prompt/prompt.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAA+B,KAAK,GAAG,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEzE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC;;;GAGG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0ClB,CAAC;AAEF,MAAM,WAAW,MAAO,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,MAAM,CAAC;CAAG;AAEpE,eAAO,MAAM,IAAI,GAAI,QAAQ;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;IAClC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;CACjB,KAAG,MASA,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './prompt';
2
+ export * from './template';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/template/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
@@ -0,0 +1,10 @@
1
+ import * as Effect from 'effect/Effect';
2
+ import type { ObjectNotFoundError } from '@dxos/echo/Err';
3
+ import { FunctionInvocationService, type FunctionNotFoundError, type TracingService } from '@dxos/functions';
4
+ import type { Template } from '..';
5
+ /**
6
+ * Process Handlebars template.
7
+ */
8
+ export declare const process: <Options extends {}>(source: string, variables?: Partial<Options>) => string;
9
+ export declare const processTemplate: (template: Template.Template) => Effect.Effect<string, ObjectNotFoundError | FunctionNotFoundError, FunctionInvocationService | TracingService>;
10
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/template/prompt.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAEL,yBAAyB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,SAAS,EAAE,EAAE,QAAQ,MAAM,EAAE,YAAW,OAAO,CAAC,OAAO,CAAM,KAAG,MAO9F,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,UAAU,QAAQ,CAAC,QAAQ,KAC1B,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,qBAAqB,EAAE,yBAAyB,GAAG,cAAc,CAuB5G,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=prompt.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.test.d.ts","sourceRoot":"","sources":["../../../../src/template/prompt.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,46 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import { type ObjectId } from '@dxos/keys';
3
+ /**
4
+ * Template input kind determines how template variables are resolved.
5
+ */
6
+ export declare const InputKind: Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>;
7
+ export type InputKind = Schema.Schema.Type<typeof InputKind>;
8
+ /**
9
+ * Template input variable.
10
+ * E.g., {{foo}}
11
+ */
12
+ export declare const Input: Schema.Struct<{
13
+ name: typeof Schema.String;
14
+ kind: Schema.optional<Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>>;
15
+ default: Schema.optional<typeof Schema.Any>;
16
+ /**
17
+ * Function to call if the kind is 'function'.
18
+ */
19
+ function: Schema.optional<typeof Schema.String>;
20
+ }>;
21
+ export type Input = Schema.Schema.Type<typeof Input>;
22
+ /**
23
+ * Template type.
24
+ */
25
+ export declare const Template: Schema.Struct<{
26
+ source: Schema.SchemaClass<import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
27
+ readonly content: string;
28
+ }>, import("@dxos/echo-protocol").EncodedReference, never>;
29
+ inputs: Schema.optional<Schema.Array$<Schema.Struct<{
30
+ name: typeof Schema.String;
31
+ kind: Schema.optional<Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>>;
32
+ default: Schema.optional<typeof Schema.Any>;
33
+ /**
34
+ * Function to call if the kind is 'function'.
35
+ */
36
+ function: Schema.optional<typeof Schema.String>;
37
+ }>>>;
38
+ }>;
39
+ export interface Template extends Schema.Schema.Type<typeof Template> {
40
+ }
41
+ export declare const make: ({ source, inputs, id, }?: {
42
+ source?: string;
43
+ inputs?: Input[];
44
+ id?: ObjectId;
45
+ }) => Template;
46
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/template/template.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C;;GAEG;AACH,eAAO,MAAM,SAAS,8GASrB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;IAKhB;;OAEG;;EAEH,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;QAXnB;;WAEG;;;EAYH,CAAC;AAEH,MAAM,WAAW,QAAS,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC;CAAG;AAExE,eAAO,MAAM,IAAI,GAAI,0BAIlB;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IAAC,EAAE,CAAC,EAAE,QAAQ,CAAA;CAAO,KAAG,QAG7D,CAAC"}