@dxos/blueprints 0.8.4-main.fd6878d → 0.8.4-main.fffef41

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.
@@ -9,14 +9,15 @@ var blueprint_exports = {};
9
9
  __export(blueprint_exports, {
10
10
  Blueprint: () => Blueprint,
11
11
  Registry: () => Registry,
12
- make: () => make2
12
+ make: () => make2,
13
+ toolDefinitions: () => toolDefinitions
13
14
  });
14
15
 
15
16
  // src/blueprint/blueprint.ts
16
- import { Schema as Schema2 } from "effect";
17
+ import * as Schema2 from "effect/Schema";
17
18
  import { ToolId } from "@dxos/ai";
18
19
  import { Obj, Type as Type2 } from "@dxos/echo";
19
- import { LabelAnnotation } from "@dxos/echo-schema";
20
+ import { LabelAnnotation } from "@dxos/echo/internal";
20
21
 
21
22
  // src/template/index.ts
22
23
  var template_exports = {};
@@ -30,31 +31,29 @@ __export(template_exports, {
30
31
 
31
32
  // src/template/prompt.ts
32
33
  import handlebars from "handlebars";
33
- import defaultsDeep from "lodash.defaultsdeep";
34
34
  import { invariant } from "@dxos/invariant";
35
35
  var __dxlog_file = "/__w/dxos/dxos/packages/core/blueprints/src/template/prompt.ts";
36
- var process = (source, options = {}) => {
37
- invariant(source, void 0, {
36
+ var process = (source, variables = {}) => {
37
+ invariant(typeof source === "string", void 0, {
38
38
  F: __dxlog_file,
39
- L: 14,
39
+ L: 13,
40
40
  S: void 0,
41
41
  A: [
42
- "source",
42
+ "typeof source === 'string'",
43
43
  ""
44
44
  ]
45
45
  });
46
46
  let section = 0;
47
47
  handlebars.registerHelper("section", () => String(++section));
48
48
  const template = handlebars.compile(source.trim());
49
- return template(defaultsDeep({}, options, {
50
- suggestions: true
51
- })).trim().replace(/(\n\s*){3,}/g, "\n\n");
49
+ const output = template(variables);
50
+ return output.trim().replace(/(\n\s*){3,}/g, "\n\n");
52
51
  };
53
52
 
54
53
  // src/template/template.ts
55
- import { Schema } from "effect";
54
+ import * as Schema from "effect/Schema";
56
55
  import { Ref, Type } from "@dxos/echo";
57
- import { DataType } from "@dxos/schema";
56
+ import { Text } from "@dxos/schema";
58
57
  var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
59
58
  var Input = Schema.mutable(Schema.Struct({
60
59
  name: Schema.String,
@@ -62,13 +61,13 @@ var Input = Schema.mutable(Schema.Struct({
62
61
  default: Schema.optional(Schema.Any)
63
62
  }));
64
63
  var Template = Schema.Struct({
65
- source: Type.Ref(DataType.Text).annotations({
64
+ source: Type.Ref(Text.Text).annotations({
66
65
  description: "Handlebars template source"
67
66
  }),
68
67
  inputs: Schema.optional(Schema.mutable(Schema.Array(Input)))
69
68
  }).pipe(Schema.mutable);
70
- var make = ({ source, inputs = [] }) => ({
71
- source: Ref.make(DataType.makeText(source)),
69
+ var make = ({ source, inputs = [], id } = {}) => ({
70
+ source: Ref.make(Text.make(source, id)),
72
71
  inputs
73
72
  });
74
73
 
@@ -118,10 +117,15 @@ var Blueprint = Schema2.Struct({
118
117
  "name"
119
118
  ])
120
119
  );
121
- var make2 = ({ tools = [], ...props }) => Obj.make(Blueprint, {
120
+ var make2 = ({ tools = [], instructions = make(), ...props }) => Obj.make(Blueprint, {
122
121
  tools,
122
+ instructions,
123
123
  ...props
124
124
  });
125
+ var toolDefinitions = ({ tools = [], functions = [] }) => [
126
+ ...functions.map((fn) => ToolId.make(fn.key)),
127
+ ...tools.map((tool) => ToolId.make(tool))
128
+ ];
125
129
 
126
130
  // src/blueprint/registry.ts
127
131
  import { log } from "@dxos/log";
@@ -154,8 +158,68 @@ var Registry = class {
154
158
  return this._blueprints;
155
159
  }
156
160
  };
161
+
162
+ // src/prompt/index.ts
163
+ var prompt_exports = {};
164
+ __export(prompt_exports, {
165
+ Prompt: () => Prompt,
166
+ make: () => make3
167
+ });
168
+
169
+ // src/prompt/prompt.ts
170
+ import * as Schema3 from "effect/Schema";
171
+ import { Obj as Obj2, Type as Type3 } from "@dxos/echo";
172
+ import { FormAnnotation, JsonSchemaType, toJsonSchema } from "@dxos/echo/internal";
173
+ var Prompt_ = Schema3.Struct({
174
+ /**
175
+ * Name of the prompt.
176
+ */
177
+ name: Schema3.optional(Schema3.String),
178
+ /**
179
+ * Description of the prompt's purpose and functionality.
180
+ * Allows AI agents to execute prompts automatically as tools.
181
+ */
182
+ description: Schema3.optional(Schema3.String),
183
+ /**
184
+ * Input schema of the prompt.
185
+ */
186
+ input: JsonSchemaType.pipe(FormAnnotation.set(false)),
187
+ /**
188
+ * Output schema of the prompt.
189
+ */
190
+ output: JsonSchemaType.pipe(FormAnnotation.set(false)),
191
+ /**
192
+ * Natural language instructions for the prompt.
193
+ * These should provide concrete course of action for the AI to follow.
194
+ */
195
+ instructions: Template.pipe(FormAnnotation.set(false)),
196
+ /**
197
+ * Blueprints that the prompt may utilize.
198
+ */
199
+ blueprints: Schema3.Array(Type3.Ref(Blueprint)),
200
+ /**
201
+ * Additional context that the prompt may utilize.
202
+ */
203
+ context: Schema3.Array(Schema3.Any).pipe(FormAnnotation.set(false))
204
+ }).pipe(Type3.Obj({
205
+ typename: "dxos.org/type/Prompt",
206
+ version: "0.1.0"
207
+ }));
208
+ var Prompt = Prompt_;
209
+ var make3 = (params) => Obj2.make(Prompt, {
210
+ name: params.name,
211
+ description: params.description,
212
+ input: toJsonSchema(params.input ?? Schema3.Void),
213
+ output: toJsonSchema(params.output ?? Schema3.Void),
214
+ instructions: make({
215
+ source: params.instructions
216
+ }),
217
+ blueprints: params.blueprints ?? [],
218
+ context: params.context ?? []
219
+ });
157
220
  export {
158
221
  blueprint_exports as Blueprint,
222
+ prompt_exports as Prompt,
159
223
  template_exports as Template
160
224
  };
161
225
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
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"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './blueprint';\nexport * from './registry';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { ToolId } from '@dxos/ai';\nimport { Obj, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo-schema';\n\nimport { 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.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.Obj({\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\n // TODO(burdon): Move to Type.Obj def?\n LabelAnnotation.set(['name']),\n);\n\n/**\n * TypeScript type for Blueprint.\n */\nexport interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {}\n\n/**\n * Create a new Blueprint.\n */\nexport const make = ({ tools = [], ...props }: Pick<Blueprint, 'key' | 'name' | 'instructions'> & Partial<Blueprint>) =>\n Obj.make(Blueprint, { tools, ...props });\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\nexport * from './template';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport handlebars from 'handlebars';\nimport defaultsDeep from 'lodash.defaultsdeep';\n\nimport { invariant } from '@dxos/invariant';\n\n/**\n * Process Handlebars template.\n */\nexport const process = <Options extends {}>(source: string, options: Options = {} as Options): string => {\n invariant(source);\n let section = 0;\n handlebars.registerHelper('section', () => String(++section));\n const template = handlebars.compile(source.trim());\n return template(defaultsDeep({}, options, { suggestions: true }))\n .trim()\n .replace(/(\\n\\s*){3,}/g, '\\n\\n');\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Ref, Type } from '@dxos/echo';\nimport { DataType } 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.mutable(\n Schema.Struct({\n name: Schema.String,\n kind: Schema.optional(InputKind),\n default: Schema.optional(Schema.Any),\n }),\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(DataType.Text).annotations({ description: 'Handlebars template source' }),\n inputs: Schema.optional(Schema.mutable(Schema.Array(Input))),\n}).pipe(Schema.mutable);\n\nexport interface Template extends Schema.Schema.Type<typeof Template> {}\n\nexport const make = ({ source, inputs = [] }: { source: string; inputs?: Input[] }): Template => ({\n source: Ref.make(DataType.makeText(source)),\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 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"],
5
- "mappings": ";;;;;;;AAAA;;;;cAAAA;;;;ACIA,SAASC,UAAAA,eAAc;AAEvB,SAASC,cAAc;AACvB,SAASC,KAAKC,QAAAA,aAAY;AAC1B,SAASC,uBAAuB;;;ACRhC;;;;;;;;;;ACIA,OAAOC,gBAAgB;AACvB,OAAOC,kBAAkB;AAEzB,SAASC,iBAAiB;;AAKnB,IAAMC,UAAU,CAAqBC,QAAgBC,UAAmB,CAAC,MAAY;AAC1FH,YAAUE,QAAAA,QAAAA;;;;;;;;;AACV,MAAIE,UAAU;AACdN,aAAWO,eAAe,WAAW,MAAMC,OAAO,EAAEF,OAAAA,CAAAA;AACpD,QAAMG,WAAWT,WAAWU,QAAQN,OAAOO,KAAI,CAAA;AAC/C,SAAOF,SAASR,aAAa,CAAC,GAAGI,SAAS;IAAEO,aAAa;EAAK,CAAA,CAAA,EAC3DD,KAAI,EACJE,QAAQ,gBAAgB,MAAA;AAC7B;;;AChBA,SAASC,cAAc;AAEvB,SAASC,KAAKC,YAAY;AAC1B,SAASC,gBAAgB;AAKlB,IAAMC,YAAYC,OAAOC,QAC9B,SACA,gBACA,aACA,YACA,SACA,YACA,WACA,QAAA;AASK,IAAMC,QAAQF,OAAOG,QAC1BH,OAAOI,OAAO;EACZC,MAAML,OAAOM;EACbC,MAAMP,OAAOQ,SAAST,SAAAA;EACtBU,SAAST,OAAOQ,SAASR,OAAOU,GAAG;AACrC,CAAA,CAAA;AAQK,IAAMC,WAAWX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KF,UAAUE;QAAI,GAAA;;;;;;MACvD,OAAO;AACLL,aAAKO,IAAIJ,UAAUE,GAAG;AACtB,aAAKP,YAAYU,KAAKL,SAAAA;MACxB;IACF,CAAA;AAEA,SAAKL,YAAYW,KAAK,CAAC,EAAEC,MAAMC,EAAC,GAAI,EAAED,MAAME,EAAC,MAAOD,EAAEE,cAAcD,CAAAA,CAAAA;EACtE;EAEAE,SAAST,KAAoC;AAC3C,WAAO,KAAKP,YAAYiB,KAAK,CAACZ,cAAcA,UAAUE,QAAQA,GAAAA;EAChE;EAEAW,QAAqB;AACnB,WAAO,KAAKlB;EACd;AACF;",
6
- "names": ["make", "Schema", "ToolId", "Obj", "Type", "LabelAnnotation", "handlebars", "defaultsDeep", "invariant", "process", "source", "options", "section", "registerHelper", "String", "template", "compile", "trim", "suggestions", "replace", "Schema", "Ref", "Type", "DataType", "InputKind", "Schema", "Literal", "Input", "mutable", "Struct", "name", "String", "kind", "optional", "default", "Any", "Template", "source", "Type", "Ref", "DataType", "Text", "annotations", "description", "inputs", "Array", "pipe", "make", "makeText", "Blueprint", "Schema", "Struct", "key", "String", "annotations", "description", "name", "optional", "instructions", "Template", "tools", "Array", "ToolId", "pipe", "Type", "Obj", "typename", "version", "LabelAnnotation", "set", "make", "props", "log", "Registry", "_blueprints", "blueprints", "seen", "Set", "forEach", "blueprint", "has", "key", "warn", "add", "push", "sort", "name", "a", "b", "localeCompare", "getByKey", "find", "query"]
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 { Obj, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo/internal';\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.Obj({\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\n // TODO(burdon): Move to Type.Obj def?\n LabelAnnotation.set(['name']),\n);\n\n/**\n * TypeScript type for Blueprint.\n */\nexport interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {}\n\n/**\n * Create a new Blueprint.\n */\nexport const make = ({\n tools = [],\n instructions = Template.make(),\n ...props\n}: Pick<Blueprint, 'key' | 'name'> & Partial<Blueprint>) => Obj.make(Blueprint, { tools, instructions, ...props });\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 handlebars from 'handlebars';\n\nimport { invariant } from '@dxos/invariant';\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", "//\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.mutable(\n Schema.Struct({\n name: Schema.String,\n kind: Schema.optional(InputKind),\n default: Schema.optional(Schema.Any),\n }),\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.mutable(Schema.Array(Input))),\n}).pipe(Schema.mutable);\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 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 { Obj, type Ref, Type } from '@dxos/echo';\nimport { FormAnnotation, JsonSchemaType, toJsonSchema } from '@dxos/echo/internal';\n\nimport { Blueprint } from '../blueprint';\nimport * as Template from '../template';\n\n/**\n * Executable instructions.\n * Declare input and output schema.\n * May utilize blueprints.\n * May reference additional context.\n */\nconst 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: JsonSchemaType.pipe(FormAnnotation.set(false)),\n\n /**\n * Output schema of the prompt.\n */\n output: JsonSchemaType.pipe(FormAnnotation.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(FormAnnotation.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(FormAnnotation.set(false)),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Prompt',\n version: '0.1.0',\n }),\n);\n\nexport interface Prompt extends Schema.Schema.Type<typeof Prompt_> {}\nexport interface Prompt_Encoded extends Schema.Schema.Encoded<typeof Prompt_> {}\nexport const Prompt: Schema.Schema<Prompt, Prompt_Encoded> = 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: toJsonSchema(params.input ?? Schema.Void),\n output: 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,KAAKC,QAAAA,aAAY;AAC1B,SAASC,uBAAuB;;;ACRhC;;;;;;;;;;ACIA,OAAOC,gBAAgB;AAEvB,SAASC,iBAAiB;;AAKnB,IAAMC,UAAU,CAAqBC,QAAgBC,YAA8B,CAAC,MAAC;AAC1FH,YAAU,OAAOE,WAAW,UAAA,QAAA;;;;;;;;;AAC5B,MAAIE,UAAU;AACdL,aAAWM,eAAe,WAAW,MAAMC,OAAO,EAAEF,OAAAA,CAAAA;AACpD,QAAMG,WAAWR,WAAWS,QAAQN,OAAOO,KAAI,CAAA;AAC/C,QAAMC,SAASH,SAASJ,SAAAA;AACxB,SAAOO,OAAOD,KAAI,EAAGE,QAAQ,gBAAgB,MAAA;AAC/C;;;ACdA,YAAYC,YAAY;AAExB,SAASC,KAAKC,YAAY;AAE1B,SAASC,YAAY;AAKd,IAAMC,YAAmBC,eAC9B,SACA,gBACA,aACA,YACA,SACA,YACA,WACA,QAAA;AASK,IAAMC,QAAeC,eACnBC,cAAO;EACZC,MAAaC;EACbC,MAAaC,gBAASR,SAAAA;EACtBS,SAAgBD,gB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EACVC,SAAS;AACX,CAAA,CAAA;AAKK,IAAMC,SAAgDxB;AAEtD,IAAMyB,QAAO,CAACC,WASnBL,KAAII,KAAKD,QAAQ;EACftB,MAAMwB,OAAOxB;EACbG,aAAaqB,OAAOrB;EACpBC,OAAOqB,aAAaD,OAAOpB,SAAgBsB,YAAI;EAC/CjB,QAAQgB,aAAaD,OAAOf,UAAiBiB,YAAI;EACjDhB,cAAuBa,KAAK;IAAEI,QAAQH,OAAOd;EAAa,CAAA;EAC1DE,YAAYY,OAAOZ,cAAc,CAAA;EACjCK,SAASO,OAAOP,WAAW,CAAA;AAC7B,CAAA;",
6
+ "names": ["make", "Schema", "ToolId", "Obj", "Type", "LabelAnnotation", "handlebars", "invariant", "process", "source", "variables", "section", "registerHelper", "String", "template", "compile", "trim", "output", "replace", "Schema", "Ref", "Type", "Text", "InputKind", "Literal", "Input", "mutable", "Struct", "name", "String", "kind", "optional", "default", "Any", "Template", "source", "Type", "Ref", "Text", "annotations", "description", "inputs", "Array", "pipe", "make", "id", "Blueprint", "Struct", "key", "String", "annotations", "description", "name", "optional", "instructions", "Template", "tools", "Array", "ToolId", "pipe", "Type", "Obj", "typename", "version", "LabelAnnotation", "set", "make", "props", "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", "Obj", "Type", "FormAnnotation", "JsonSchemaType", "toJsonSchema", "Prompt_", "Struct", "name", "optional", "String", "description", "input", "JsonSchemaType", "pipe", "FormAnnotation", "set", "output", "instructions", "Template", "blueprints", "Array", "Type", "Ref", "Blueprint", "context", "Any", "Obj", "typename", "version", "Prompt", "make", "params", "toJsonSchema", "Void", "source"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/template/prompt.ts":{"bytes":2492,"imports":[{"path":"handlebars","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/template/template.ts":{"bytes":4245,"imports":[{"path":"effect","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":7015,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"src/template/index.ts","kind":"import-statement","original":"../template"}],"format":"esm"},"src/blueprint/registry.ts":{"bytes":3436,"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/index.ts":{"bytes":673,"imports":[{"path":"src/blueprint/index.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"./template"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8774},"dist/lib/browser/index.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"effect","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}],"exports":["Blueprint","Template"],"entryPoint":"src/index.ts","inputs":{"src/blueprint/index.ts":{"bytesInOutput":140},"src/blueprint/blueprint.ts":{"bytesInOutput":1735},"src/template/index.ts":{"bytesInOutput":185},"src/template/prompt.ts":{"bytesInOutput":635},"src/template/template.ts":{"bytesInOutput":706},"src/blueprint/registry.ts":{"bytesInOutput":834},"src/index.ts":{"bytesInOutput":0}},"bytes":4715}}}
1
+ {"inputs":{"src/template/prompt.ts":{"bytes":2322,"imports":[{"path":"handlebars","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/template/template.ts":{"bytes":4366,"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":8272,"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":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"src/template/index.ts","kind":"import-statement","original":"../template"}],"format":"esm"},"src/blueprint/registry.ts":{"bytes":3436,"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":7187,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","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/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13028},"dist/lib/browser/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":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"@dxos/invariant","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},{"path":"@dxos/echo/internal","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":1930},"src/template/index.ts":{"bytesInOutput":185},"src/template/prompt.ts":{"bytesInOutput":609},"src/template/template.ts":{"bytesInOutput":711},"src/blueprint/registry.ts":{"bytesInOutput":834},"src/index.ts":{"bytesInOutput":0},"src/prompt/index.ts":{"bytesInOutput":100},"src/prompt/prompt.ts":{"bytesInOutput":1553}},"bytes":6661}}}
@@ -10,14 +10,15 @@ var blueprint_exports = {};
10
10
  __export(blueprint_exports, {
11
11
  Blueprint: () => Blueprint,
12
12
  Registry: () => Registry,
13
- make: () => make2
13
+ make: () => make2,
14
+ toolDefinitions: () => toolDefinitions
14
15
  });
15
16
 
16
17
  // src/blueprint/blueprint.ts
17
- import { Schema as Schema2 } from "effect";
18
+ import * as Schema2 from "effect/Schema";
18
19
  import { ToolId } from "@dxos/ai";
19
20
  import { Obj, Type as Type2 } from "@dxos/echo";
20
- import { LabelAnnotation } from "@dxos/echo-schema";
21
+ import { LabelAnnotation } from "@dxos/echo/internal";
21
22
 
22
23
  // src/template/index.ts
23
24
  var template_exports = {};
@@ -31,31 +32,29 @@ __export(template_exports, {
31
32
 
32
33
  // src/template/prompt.ts
33
34
  import handlebars from "handlebars";
34
- import defaultsDeep from "lodash.defaultsdeep";
35
35
  import { invariant } from "@dxos/invariant";
36
36
  var __dxlog_file = "/__w/dxos/dxos/packages/core/blueprints/src/template/prompt.ts";
37
- var process = (source, options = {}) => {
38
- invariant(source, void 0, {
37
+ var process = (source, variables = {}) => {
38
+ invariant(typeof source === "string", void 0, {
39
39
  F: __dxlog_file,
40
- L: 14,
40
+ L: 13,
41
41
  S: void 0,
42
42
  A: [
43
- "source",
43
+ "typeof source === 'string'",
44
44
  ""
45
45
  ]
46
46
  });
47
47
  let section = 0;
48
48
  handlebars.registerHelper("section", () => String(++section));
49
49
  const template = handlebars.compile(source.trim());
50
- return template(defaultsDeep({}, options, {
51
- suggestions: true
52
- })).trim().replace(/(\n\s*){3,}/g, "\n\n");
50
+ const output = template(variables);
51
+ return output.trim().replace(/(\n\s*){3,}/g, "\n\n");
53
52
  };
54
53
 
55
54
  // src/template/template.ts
56
- import { Schema } from "effect";
55
+ import * as Schema from "effect/Schema";
57
56
  import { Ref, Type } from "@dxos/echo";
58
- import { DataType } from "@dxos/schema";
57
+ import { Text } from "@dxos/schema";
59
58
  var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
60
59
  var Input = Schema.mutable(Schema.Struct({
61
60
  name: Schema.String,
@@ -63,13 +62,13 @@ var Input = Schema.mutable(Schema.Struct({
63
62
  default: Schema.optional(Schema.Any)
64
63
  }));
65
64
  var Template = Schema.Struct({
66
- source: Type.Ref(DataType.Text).annotations({
65
+ source: Type.Ref(Text.Text).annotations({
67
66
  description: "Handlebars template source"
68
67
  }),
69
68
  inputs: Schema.optional(Schema.mutable(Schema.Array(Input)))
70
69
  }).pipe(Schema.mutable);
71
- var make = ({ source, inputs = [] }) => ({
72
- source: Ref.make(DataType.makeText(source)),
70
+ var make = ({ source, inputs = [], id } = {}) => ({
71
+ source: Ref.make(Text.make(source, id)),
73
72
  inputs
74
73
  });
75
74
 
@@ -119,10 +118,15 @@ var Blueprint = Schema2.Struct({
119
118
  "name"
120
119
  ])
121
120
  );
122
- var make2 = ({ tools = [], ...props }) => Obj.make(Blueprint, {
121
+ var make2 = ({ tools = [], instructions = make(), ...props }) => Obj.make(Blueprint, {
123
122
  tools,
123
+ instructions,
124
124
  ...props
125
125
  });
126
+ var toolDefinitions = ({ tools = [], functions = [] }) => [
127
+ ...functions.map((fn) => ToolId.make(fn.key)),
128
+ ...tools.map((tool) => ToolId.make(tool))
129
+ ];
126
130
 
127
131
  // src/blueprint/registry.ts
128
132
  import { log } from "@dxos/log";
@@ -155,8 +159,68 @@ var Registry = class {
155
159
  return this._blueprints;
156
160
  }
157
161
  };
162
+
163
+ // src/prompt/index.ts
164
+ var prompt_exports = {};
165
+ __export(prompt_exports, {
166
+ Prompt: () => Prompt,
167
+ make: () => make3
168
+ });
169
+
170
+ // src/prompt/prompt.ts
171
+ import * as Schema3 from "effect/Schema";
172
+ import { Obj as Obj2, Type as Type3 } from "@dxos/echo";
173
+ import { FormAnnotation, JsonSchemaType, toJsonSchema } from "@dxos/echo/internal";
174
+ var Prompt_ = Schema3.Struct({
175
+ /**
176
+ * Name of the prompt.
177
+ */
178
+ name: Schema3.optional(Schema3.String),
179
+ /**
180
+ * Description of the prompt's purpose and functionality.
181
+ * Allows AI agents to execute prompts automatically as tools.
182
+ */
183
+ description: Schema3.optional(Schema3.String),
184
+ /**
185
+ * Input schema of the prompt.
186
+ */
187
+ input: JsonSchemaType.pipe(FormAnnotation.set(false)),
188
+ /**
189
+ * Output schema of the prompt.
190
+ */
191
+ output: JsonSchemaType.pipe(FormAnnotation.set(false)),
192
+ /**
193
+ * Natural language instructions for the prompt.
194
+ * These should provide concrete course of action for the AI to follow.
195
+ */
196
+ instructions: Template.pipe(FormAnnotation.set(false)),
197
+ /**
198
+ * Blueprints that the prompt may utilize.
199
+ */
200
+ blueprints: Schema3.Array(Type3.Ref(Blueprint)),
201
+ /**
202
+ * Additional context that the prompt may utilize.
203
+ */
204
+ context: Schema3.Array(Schema3.Any).pipe(FormAnnotation.set(false))
205
+ }).pipe(Type3.Obj({
206
+ typename: "dxos.org/type/Prompt",
207
+ version: "0.1.0"
208
+ }));
209
+ var Prompt = Prompt_;
210
+ var make3 = (params) => Obj2.make(Prompt, {
211
+ name: params.name,
212
+ description: params.description,
213
+ input: toJsonSchema(params.input ?? Schema3.Void),
214
+ output: toJsonSchema(params.output ?? Schema3.Void),
215
+ instructions: make({
216
+ source: params.instructions
217
+ }),
218
+ blueprints: params.blueprints ?? [],
219
+ context: params.context ?? []
220
+ });
158
221
  export {
159
222
  blueprint_exports as Blueprint,
223
+ prompt_exports as Prompt,
160
224
  template_exports as Template
161
225
  };
162
226
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
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"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './blueprint';\nexport * from './registry';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { ToolId } from '@dxos/ai';\nimport { Obj, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo-schema';\n\nimport { 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.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.Obj({\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\n // TODO(burdon): Move to Type.Obj def?\n LabelAnnotation.set(['name']),\n);\n\n/**\n * TypeScript type for Blueprint.\n */\nexport interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {}\n\n/**\n * Create a new Blueprint.\n */\nexport const make = ({ tools = [], ...props }: Pick<Blueprint, 'key' | 'name' | 'instructions'> & Partial<Blueprint>) =>\n Obj.make(Blueprint, { tools, ...props });\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\nexport * from './template';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport handlebars from 'handlebars';\nimport defaultsDeep from 'lodash.defaultsdeep';\n\nimport { invariant } from '@dxos/invariant';\n\n/**\n * Process Handlebars template.\n */\nexport const process = <Options extends {}>(source: string, options: Options = {} as Options): string => {\n invariant(source);\n let section = 0;\n handlebars.registerHelper('section', () => String(++section));\n const template = handlebars.compile(source.trim());\n return template(defaultsDeep({}, options, { suggestions: true }))\n .trim()\n .replace(/(\\n\\s*){3,}/g, '\\n\\n');\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Ref, Type } from '@dxos/echo';\nimport { DataType } 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.mutable(\n Schema.Struct({\n name: Schema.String,\n kind: Schema.optional(InputKind),\n default: Schema.optional(Schema.Any),\n }),\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(DataType.Text).annotations({ description: 'Handlebars template source' }),\n inputs: Schema.optional(Schema.mutable(Schema.Array(Input))),\n}).pipe(Schema.mutable);\n\nexport interface Template extends Schema.Schema.Type<typeof Template> {}\n\nexport const make = ({ source, inputs = [] }: { source: string; inputs?: Input[] }): Template => ({\n source: Ref.make(DataType.makeText(source)),\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 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"],
5
- "mappings": ";;;;;;;;AAAA;;;;cAAAA;;;;ACIA,SAASC,UAAAA,eAAc;AAEvB,SAASC,cAAc;AACvB,SAASC,KAAKC,QAAAA,aAAY;AAC1B,SAASC,uBAAuB;;;ACRhC;;;;;;;;;;ACIA,OAAOC,gBAAgB;AACvB,OAAOC,kBAAkB;AAEzB,SAASC,iBAAiB;;AAKnB,IAAMC,UAAU,CAAqBC,QAAgBC,UAAmB,CAAC,MAAY;AAC1FH,YAAUE,QAAAA,QAAAA;;;;;;;;;AACV,MAAIE,UAAU;AACdN,aAAWO,eAAe,WAAW,MAAMC,OAAO,EAAEF,OAAAA,CAAAA;AACpD,QAAMG,WAAWT,WAAWU,QAAQN,OAAOO,KAAI,CAAA;AAC/C,SAAOF,SAASR,aAAa,CAAC,GAAGI,SAAS;IAAEO,aAAa;EAAK,CAAA,CAAA,EAC3DD,KAAI,EACJE,QAAQ,gBAAgB,MAAA;AAC7B;;;AChBA,SAASC,cAAc;AAEvB,SAASC,KAAKC,YAAY;AAC1B,SAASC,gBAAgB;AAKlB,IAAMC,YAAYC,OAAOC,QAC9B,SACA,gBACA,aACA,YACA,SACA,YACA,WACA,QAAA;AASK,IAAMC,QAAQF,OAAOG,QAC1BH,OAAOI,OAAO;EACZC,MAAML,OAAOM;EACbC,MAAMP,OAAOQ,SAAST,SAAAA;EACtBU,SAAST,OAAOQ,SAASR,OAAOU,GAAG;AACrC,CAAA,CAAA;AAQK,IAAMC,WAAWX,OAAOI,OAAO;EACpCQ,QAAQC,KAAKC,IAAIC,SAASC,IAAI,EAAEC,YAAY;IAAEC,aAAa;EAA6B,CAAA;EACxFC,QAAQnB,OAAOQ,SAASR,OAAOG,QAAQH,OAAOoB,MAAMlB,KAAAA,CAAAA,CAAAA;AACtD,CAAA,EAAGmB,KAAKrB,OAAOG,OAAO;AAIf,IAAMmB,OAAO,CAAC,EA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AE,SAAST,KAAoC;AAC3C,WAAO,KAAKP,YAAYiB,KAAK,CAACZ,cAAcA,UAAUE,QAAQA,GAAAA;EAChE;EAEAW,QAAqB;AACnB,WAAO,KAAKlB;EACd;AACF;",
6
- "names": ["make", "Schema", "ToolId", "Obj", "Type", "LabelAnnotation", "handlebars", "defaultsDeep", "invariant", "process", "source", "options", "section", "registerHelper", "String", "template", "compile", "trim", "suggestions", "replace", "Schema", "Ref", "Type", "DataType", "InputKind", "Schema", "Literal", "Input", "mutable", "Struct", "name", "String", "kind", "optional", "default", "Any", "Template", "source", "Type", "Ref", "DataType", "Text", "annotations", "description", "inputs", "Array", "pipe", "make", "makeText", "Blueprint", "Schema", "Struct", "key", "String", "annotations", "description", "name", "optional", "instructions", "Template", "tools", "Array", "ToolId", "pipe", "Type", "Obj", "typename", "version", "LabelAnnotation", "set", "make", "props", "log", "Registry", "_blueprints", "blueprints", "seen", "Set", "forEach", "blueprint", "has", "key", "warn", "add", "push", "sort", "name", "a", "b", "localeCompare", "getByKey", "find", "query"]
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 { Obj, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo/internal';\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.Obj({\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\n // TODO(burdon): Move to Type.Obj def?\n LabelAnnotation.set(['name']),\n);\n\n/**\n * TypeScript type for Blueprint.\n */\nexport interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {}\n\n/**\n * Create a new Blueprint.\n */\nexport const make = ({\n tools = [],\n instructions = Template.make(),\n ...props\n}: Pick<Blueprint, 'key' | 'name'> & Partial<Blueprint>) => Obj.make(Blueprint, { tools, instructions, ...props });\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 handlebars from 'handlebars';\n\nimport { invariant } from '@dxos/invariant';\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", "//\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.mutable(\n Schema.Struct({\n name: Schema.String,\n kind: Schema.optional(InputKind),\n default: Schema.optional(Schema.Any),\n }),\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.mutable(Schema.Array(Input))),\n}).pipe(Schema.mutable);\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 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 { Obj, type Ref, Type } from '@dxos/echo';\nimport { FormAnnotation, JsonSchemaType, toJsonSchema } from '@dxos/echo/internal';\n\nimport { Blueprint } from '../blueprint';\nimport * as Template from '../template';\n\n/**\n * Executable instructions.\n * Declare input and output schema.\n * May utilize blueprints.\n * May reference additional context.\n */\nconst 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: JsonSchemaType.pipe(FormAnnotation.set(false)),\n\n /**\n * Output schema of the prompt.\n */\n output: JsonSchemaType.pipe(FormAnnotation.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(FormAnnotation.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(FormAnnotation.set(false)),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Prompt',\n version: '0.1.0',\n }),\n);\n\nexport interface Prompt extends Schema.Schema.Type<typeof Prompt_> {}\nexport interface Prompt_Encoded extends Schema.Schema.Encoded<typeof Prompt_> {}\nexport const Prompt: Schema.Schema<Prompt, Prompt_Encoded> = 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: toJsonSchema(params.input ?? Schema.Void),\n output: 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,KAAKC,QAAAA,aAAY;AAC1B,SAASC,uBAAuB;;;ACRhC;;;;;;;;;;ACIA,OAAOC,gBAAgB;AAEvB,SAASC,iBAAiB;;AAKnB,IAAMC,UAAU,CAAqBC,QAAgBC,YAA8B,CAAC,MAAC;AAC1FH,YAAU,OAAOE,WAAW,UAAA,QAAA;;;;;;;;;AAC5B,MAAIE,UAAU;AACdL,aAAWM,eAAe,WAAW,MAAMC,OAAO,EAAEF,OAAAA,CAAAA;AACpD,QAAMG,WAAWR,WAAWS,QAAQN,OAAOO,KAAI,CAAA;AAC/C,QAAMC,SAASH,SAASJ,SAAAA;AACxB,SAAOO,OAAOD,KAAI,EAAGE,QAAQ,gBAAgB,MAAA;AAC/C;;;ACdA,YAAYC,YAAY;AAExB,SAASC,KAAKC,YAAY;AAE1B,SAASC,YAAY;AAKd,IAAMC,YAAmBC,eAC9B,SACA,gBACA,aACA,YACA,SACA,YACA,WACA,QAAA;AASK,IAAMC,QAAeC,eACnBC,cAAO;EACZC,MAAaC;EACbC,MAAaC,gBAASR,SAAAA;EACtBS,SAAgBD,gBAAgBE,UAAG;AACrC,CAAA,CAAA;AAQK,IAAMC,WAAkBP,cAAO;EACpCQ,QAAQC,KAAKC,IAAIC,KAAKA,IAAI,EAAEC,YAAY;IAAEC,aAAa;EAA6B,CAAA;EACpFC,QAAeV,gBAAgBL,eAAegB,aAAMjB,KAAAA,CAAAA,CAAAA;AACtD,CAAA,EAAGkB,KAAYjB,cAAO;AAIf,IAAM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ACjDhB,cAAuBa,KAAK;IAAEI,QAAQH,OAAOd;EAAa,CAAA;EAC1DE,YAAYY,OAAOZ,cAAc,CAAA;EACjCK,SAASO,OAAOP,WAAW,CAAA;AAC7B,CAAA;",
6
+ "names": ["make", "Schema", "ToolId", "Obj", "Type", "LabelAnnotation", "handlebars", "invariant", "process", "source", "variables", "section", "registerHelper", "String", "template", "compile", "trim", "output", "replace", "Schema", "Ref", "Type", "Text", "InputKind", "Literal", "Input", "mutable", "Struct", "name", "String", "kind", "optional", "default", "Any", "Template", "source", "Type", "Ref", "Text", "annotations", "description", "inputs", "Array", "pipe", "make", "id", "Blueprint", "Struct", "key", "String", "annotations", "description", "name", "optional", "instructions", "Template", "tools", "Array", "ToolId", "pipe", "Type", "Obj", "typename", "version", "LabelAnnotation", "set", "make", "props", "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", "Obj", "Type", "FormAnnotation", "JsonSchemaType", "toJsonSchema", "Prompt_", "Struct", "name", "optional", "String", "description", "input", "JsonSchemaType", "pipe", "FormAnnotation", "set", "output", "instructions", "Template", "blueprints", "Array", "Type", "Ref", "Blueprint", "context", "Any", "Obj", "typename", "version", "Prompt", "make", "params", "toJsonSchema", "Void", "source"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/template/prompt.ts":{"bytes":2492,"imports":[{"path":"handlebars","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/template/template.ts":{"bytes":4245,"imports":[{"path":"effect","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":7015,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"src/template/index.ts","kind":"import-statement","original":"../template"}],"format":"esm"},"src/blueprint/registry.ts":{"bytes":3436,"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/index.ts":{"bytes":673,"imports":[{"path":"src/blueprint/index.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"./template"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8775},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"effect","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}],"exports":["Blueprint","Template"],"entryPoint":"src/index.ts","inputs":{"src/blueprint/index.ts":{"bytesInOutput":140},"src/blueprint/blueprint.ts":{"bytesInOutput":1735},"src/template/index.ts":{"bytesInOutput":185},"src/template/prompt.ts":{"bytesInOutput":635},"src/template/template.ts":{"bytesInOutput":706},"src/blueprint/registry.ts":{"bytesInOutput":834},"src/index.ts":{"bytesInOutput":0}},"bytes":4807}}}
1
+ {"inputs":{"src/template/prompt.ts":{"bytes":2322,"imports":[{"path":"handlebars","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/template/template.ts":{"bytes":4366,"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":8272,"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":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"src/template/index.ts","kind":"import-statement","original":"../template"}],"format":"esm"},"src/blueprint/registry.ts":{"bytes":3436,"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":7187,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","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/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13029},"dist/lib/node-esm/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":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"@dxos/invariant","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},{"path":"@dxos/echo/internal","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":1930},"src/template/index.ts":{"bytesInOutput":185},"src/template/prompt.ts":{"bytesInOutput":609},"src/template/template.ts":{"bytesInOutput":711},"src/blueprint/registry.ts":{"bytesInOutput":834},"src/index.ts":{"bytesInOutput":0},"src/prompt/index.ts":{"bytesInOutput":100},"src/prompt/prompt.ts":{"bytesInOutput":1553}},"bytes":6753}}}
@@ -1,5 +1,6 @@
1
- import { Schema } from 'effect';
1
+ import * as Schema from 'effect/Schema';
2
2
  import { Type } from '@dxos/echo';
3
+ import { type FunctionDefinition } from '@dxos/functions';
3
4
  /**
4
5
  * Blueprint schema defines the structure for AI assistant blueprints.
5
6
  * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.
@@ -24,7 +25,7 @@ export declare const Blueprint: Type.obj<Schema.Struct<{
24
25
  * These are system prompts or guidelines that the AI should follow.
25
26
  */
26
27
  instructions: Schema.mutable<Schema.Struct<{
27
- source: Schema.SchemaClass<import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
28
+ source: Schema.SchemaClass<import("@dxos/echo/internal").Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
28
29
  content: string;
29
30
  }>, import("@dxos/echo-protocol").EncodedReference, never>;
30
31
  inputs: Schema.optional<Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
@@ -46,12 +47,12 @@ export interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {
46
47
  /**
47
48
  * Create a new Blueprint.
48
49
  */
49
- export declare const make: ({ tools, ...props }: Pick<Blueprint, "key" | "name" | "instructions"> & Partial<Blueprint>) => import("@dxos/live-object").Live<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
50
+ export declare const make: ({ tools, instructions, ...props }: Pick<Blueprint, "key" | "name"> & Partial<Blueprint>) => import("@dxos/live-object").Live<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
50
51
  key: string;
51
52
  name: string;
52
53
  description?: string | undefined;
53
54
  instructions: {
54
- source: import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
55
+ source: import("@dxos/echo/internal").Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
55
56
  content: string;
56
57
  }>;
57
58
  inputs?: {
@@ -62,4 +63,11 @@ export declare const make: ({ tools, ...props }: Pick<Blueprint, "key" | "name"
62
63
  };
63
64
  tools: (string & import("effect/Brand").Brand<"ToolId">)[];
64
65
  }>;
66
+ /**
67
+ * Util to create tool definitions for a blueprint.
68
+ */
69
+ export declare const toolDefinitions: ({ tools, functions, }: {
70
+ tools?: string[];
71
+ functions?: FunctionDefinition[];
72
+ }) => (string & import("effect/Brand").Brand<"ToolId">)[];
65
73
  //# sourceMappingURL=blueprint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"blueprint.d.ts","sourceRoot":"","sources":["../../../../src/blueprint/blueprint.ts"],"names":[],"mappings":"AAIA,OAAO,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ACjB,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAClC,wDAA+F,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * as Blueprint from './blueprint';
2
2
  export * as Template from './template';
3
+ export * as Prompt from './prompt';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
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"}