@dxos/blueprints 0.8.4-main.a4bbb77 → 0.8.4-main.ae835ea

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.
@@ -14,10 +14,10 @@ __export(blueprint_exports, {
14
14
  });
15
15
 
16
16
  // src/blueprint/blueprint.ts
17
- import { Schema as Schema2 } from "effect";
17
+ import * as Schema2 from "effect/Schema";
18
18
  import { ToolId } from "@dxos/ai";
19
19
  import { Obj, Type as Type2 } from "@dxos/echo";
20
- import { LabelAnnotation } from "@dxos/echo-schema";
20
+ import { LabelAnnotation } from "@dxos/echo/internal";
21
21
 
22
22
  // src/template/index.ts
23
23
  var template_exports = {};
@@ -51,7 +51,7 @@ var process = (source, variables = {}) => {
51
51
  };
52
52
 
53
53
  // src/template/template.ts
54
- import { Schema } from "effect";
54
+ import * as Schema from "effect/Schema";
55
55
  import { Ref, Type } from "@dxos/echo";
56
56
  import { DataType } from "@dxos/schema";
57
57
  var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
@@ -128,29 +128,10 @@ var toolDefinitions = ({ tools = [], functions = [] }) => [
128
128
 
129
129
  // src/blueprint/registry.ts
130
130
  import { log } from "@dxos/log";
131
- function _define_property(obj, key, value) {
132
- if (key in obj) {
133
- Object.defineProperty(obj, key, {
134
- value,
135
- enumerable: true,
136
- configurable: true,
137
- writable: true
138
- });
139
- } else {
140
- obj[key] = value;
141
- }
142
- return obj;
143
- }
144
131
  var __dxlog_file2 = "/__w/dxos/dxos/packages/core/blueprints/src/blueprint/registry.ts";
145
132
  var Registry = class {
146
- getByKey(key) {
147
- return this._blueprints.find((blueprint) => blueprint.key === key);
148
- }
149
- query() {
150
- return this._blueprints;
151
- }
133
+ _blueprints = [];
152
134
  constructor(blueprints) {
153
- _define_property(this, "_blueprints", []);
154
135
  const seen = /* @__PURE__ */ new Set();
155
136
  blueprints.forEach((blueprint) => {
156
137
  if (seen.has(blueprint.key)) {
@@ -169,6 +150,12 @@ var Registry = class {
169
150
  });
170
151
  this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
171
152
  }
153
+ getByKey(key) {
154
+ return this._blueprints.find((blueprint) => blueprint.key === key);
155
+ }
156
+ query() {
157
+ return this._blueprints;
158
+ }
172
159
  };
173
160
 
174
161
  // src/prompt/index.ts
@@ -179,14 +166,14 @@ __export(prompt_exports, {
179
166
  });
180
167
 
181
168
  // src/prompt/prompt.ts
182
- import { Schema as Schema3 } from "effect";
169
+ import * as Schema3 from "effect/Schema";
183
170
  import { Obj as Obj2, Type as Type3 } from "@dxos/echo";
184
- import { JsonSchemaType, toJsonSchema } from "@dxos/echo-schema";
171
+ import { JsonSchemaType, toJsonSchema } from "@dxos/echo/internal";
185
172
  var Prompt_ = Schema3.Struct({
186
173
  /**
187
174
  * Name of the prompt.
188
175
  */
189
- name: Schema3.String,
176
+ name: Schema3.optional(Schema3.String),
190
177
  /**
191
178
  * Description of the prompt's purpose and functionality.
192
179
  * Allows AI agents to execute prompts automatically as tools.
@@ -204,7 +191,7 @@ var Prompt_ = Schema3.Struct({
204
191
  * Natural language instructions for the prompt.
205
192
  * These should provide concrete course of action for the AI to follow.
206
193
  */
207
- instructions: Schema3.String,
194
+ instructions: Template,
208
195
  /**
209
196
  * Blueprints that the prompt may utilize.
210
197
  */
@@ -218,14 +205,16 @@ var Prompt_ = Schema3.Struct({
218
205
  version: "0.1.0"
219
206
  }));
220
207
  var Prompt = Prompt_;
221
- var make3 = (opts) => Obj2.make(Prompt, {
222
- name: opts.name,
223
- description: opts.description,
224
- input: toJsonSchema(opts.input),
225
- output: toJsonSchema(opts.output),
226
- instructions: opts.instructions,
227
- blueprints: opts.blueprints ?? [],
228
- context: opts.context ?? []
208
+ var make3 = (params) => Obj2.make(Prompt, {
209
+ name: params.name,
210
+ description: params.description,
211
+ input: toJsonSchema(params.input ?? Schema3.Void),
212
+ output: toJsonSchema(params.output ?? Schema3.Void),
213
+ instructions: make({
214
+ source: params.instructions
215
+ }),
216
+ blueprints: params.blueprints ?? [],
217
+ context: params.context ?? []
229
218
  });
230
219
  export {
231
220
  blueprint_exports as Blueprint,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 { Schema } from 'effect';\n\nimport { ToolId } from '@dxos/ai';\nimport { Obj, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo-schema';\nimport { type FunctionDefinition } from '@dxos/functions';\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/**\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 { Schema } from 'effect';\n\nimport { Ref, Type } from '@dxos/echo';\nimport { type ObjectId } from '@dxos/keys';\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 = [], id }: { source: string; inputs?: Input[]; id?: ObjectId }): Template => ({\n source: Ref.make(DataType.makeText(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 { Schema } from 'effect';\n\nimport { Obj, type Ref, Type } from '@dxos/echo';\nimport { JsonSchemaType, toJsonSchema } from '@dxos/echo-schema';\n\nimport { Blueprint } from '../blueprint';\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.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,\n\n /**\n * Output schema of the prompt.\n */\n output: JsonSchemaType,\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: Schema.String,\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),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Prompt',\n version: '0.1.0',\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 = (opts: {\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: opts.name,\n description: opts.description,\n input: toJsonSchema(opts.input),\n output: toJsonSchema(opts.output),\n instructions: opts.instructions,\n blueprints: opts.blueprints ?? [],\n context: opts.context ?? [],\n });\n"],
5
- "mappings": ";;;;;;;AAAA;;;;cAAAA;EAAA;;;;ACIA,SAASC,UAAAA,eAAc;AAEvB,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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AOG;;;;;EAMbC,aAAaJ,QAAOK,SAASL,QAAOG,MAAM;;;;EAK1CG,OAAOC;;;;EAKPC,QAAQD;;;;;EAMRE,cAAcT,QAAOG;;;;EAKrBO,YAAYV,QAAOW,MAAMC,MAAKC,IAAIC,SAAAA,CAAAA;;;;EAKlCC,SAASf,QAAOW,MAAMX,QAAOgB,GAAG;AAClC,CAAA,EAAGC,KACDL,MAAKM,IAAI;EACPC,UAAU;EACVC,SAAS;AACX,CAAA,CAAA;AAIK,IAAMC,SAAgDtB;AAEtD,IAAMuB,QAAO,CAACC,SASnBL,KAAII,KAAKD,QAAQ;EACfnB,MAAMqB,KAAKrB;EACXE,aAAamB,KAAKnB;EAClBE,OAAOkB,aAAaD,KAAKjB,KAAK;EAC9BE,QAAQgB,aAAaD,KAAKf,MAAM;EAChCC,cAAcc,KAAKd;EACnBC,YAAYa,KAAKb,cAAc,CAAA;EAC/BK,SAASQ,KAAKR,WAAW,CAAA;AAC3B,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", "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", "id", "makeText", "Blueprint", "Schema", "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", "getByKey", "key", "_blueprints", "find", "blueprint", "query", "blueprints", "seen", "Set", "forEach", "has", "warn", "add", "push", "sort", "name", "a", "b", "localeCompare", "make", "Schema", "Obj", "Type", "JsonSchemaType", "toJsonSchema", "Prompt_", "Schema", "Struct", "name", "String", "description", "optional", "input", "JsonSchemaType", "output", "instructions", "blueprints", "Array", "Type", "Ref", "Blueprint", "context", "Any", "pipe", "Obj", "typename", "version", "Prompt", "make", "opts", "toJsonSchema"]
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 { 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/**\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 { 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 = [], id }: { source: string; inputs?: Input[]; id?: ObjectId }): Template => ({\n source: Ref.make(DataType.makeText(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 { 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,\n\n /**\n * Output schema of the prompt.\n */\n output: JsonSchemaType,\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,\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),\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,gBAAgB;AAKlB,IAAM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,QAAO,CAACC,WASnBL,KAAII,KAAKD,QAAQ;EACfpB,MAAMsB,OAAOtB;EACbG,aAAamB,OAAOnB;EACpBC,OAAOmB,aAAaD,OAAOlB,SAAgBoB,YAAI;EAC/ClB,QAAQiB,aAAaD,OAAOhB,UAAiBkB,YAAI;EACjDjB,cAAuBc,KAAK;IAAEI,QAAQH,OAAOf;EAAa,CAAA;EAC1DE,YAAYa,OAAOb,cAAc,CAAA;EACjCK,SAASQ,OAAOR,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", "DataType", "InputKind", "Literal", "Input", "mutable", "Struct", "name", "String", "kind", "optional", "default", "Any", "Template", "source", "Type", "Ref", "DataType", "Text", "annotations", "description", "inputs", "Array", "pipe", "make", "id", "makeText", "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", "JsonSchemaType", "toJsonSchema", "Prompt_", "Struct", "name", "optional", "String", "description", "input", "JsonSchemaType", "output", "instructions", "Template", "blueprints", "Array", "Type", "Ref", "Blueprint", "context", "Any", "pipe", "Obj", "typename", "version", "Prompt", "make", "params", "toJsonSchema", "Void", "source"]
7
7
  }
@@ -1 +1 @@
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":4373,"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":8074,"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":3784,"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":6070,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"src/blueprint/index.ts","kind":"import-statement","original":"../blueprint"}],"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":12592},"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":"@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},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","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":1891},"src/template/index.ts":{"bytesInOutput":185},"src/template/prompt.ts":{"bytesInOutput":609},"src/template/template.ts":{"bytesInOutput":714},"src/blueprint/registry.ts":{"bytesInOutput":1109},"src/index.ts":{"bytesInOutput":0},"src/prompt/index.ts":{"bytesInOutput":100},"src/prompt/prompt.ts":{"bytesInOutput":1325}},"bytes":6672}}}
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":4385,"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":8092,"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":6623,"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":12644},"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":1891},"src/template/index.ts":{"bytesInOutput":185},"src/template/prompt.ts":{"bytesInOutput":609},"src/template/template.ts":{"bytesInOutput":722},"src/blueprint/registry.ts":{"bytesInOutput":834},"src/index.ts":{"bytesInOutput":0},"src/prompt/index.ts":{"bytesInOutput":100},"src/prompt/prompt.ts":{"bytesInOutput":1409}},"bytes":6489}}}
@@ -15,10 +15,10 @@ __export(blueprint_exports, {
15
15
  });
16
16
 
17
17
  // src/blueprint/blueprint.ts
18
- import { Schema as Schema2 } from "effect";
18
+ import * as Schema2 from "effect/Schema";
19
19
  import { ToolId } from "@dxos/ai";
20
20
  import { Obj, Type as Type2 } from "@dxos/echo";
21
- import { LabelAnnotation } from "@dxos/echo-schema";
21
+ import { LabelAnnotation } from "@dxos/echo/internal";
22
22
 
23
23
  // src/template/index.ts
24
24
  var template_exports = {};
@@ -52,7 +52,7 @@ var process = (source, variables = {}) => {
52
52
  };
53
53
 
54
54
  // src/template/template.ts
55
- import { Schema } from "effect";
55
+ import * as Schema from "effect/Schema";
56
56
  import { Ref, Type } from "@dxos/echo";
57
57
  import { DataType } from "@dxos/schema";
58
58
  var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
@@ -129,29 +129,10 @@ var toolDefinitions = ({ tools = [], functions = [] }) => [
129
129
 
130
130
  // src/blueprint/registry.ts
131
131
  import { log } from "@dxos/log";
132
- function _define_property(obj, key, value) {
133
- if (key in obj) {
134
- Object.defineProperty(obj, key, {
135
- value,
136
- enumerable: true,
137
- configurable: true,
138
- writable: true
139
- });
140
- } else {
141
- obj[key] = value;
142
- }
143
- return obj;
144
- }
145
132
  var __dxlog_file2 = "/__w/dxos/dxos/packages/core/blueprints/src/blueprint/registry.ts";
146
133
  var Registry = class {
147
- getByKey(key) {
148
- return this._blueprints.find((blueprint) => blueprint.key === key);
149
- }
150
- query() {
151
- return this._blueprints;
152
- }
134
+ _blueprints = [];
153
135
  constructor(blueprints) {
154
- _define_property(this, "_blueprints", []);
155
136
  const seen = /* @__PURE__ */ new Set();
156
137
  blueprints.forEach((blueprint) => {
157
138
  if (seen.has(blueprint.key)) {
@@ -170,6 +151,12 @@ var Registry = class {
170
151
  });
171
152
  this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
172
153
  }
154
+ getByKey(key) {
155
+ return this._blueprints.find((blueprint) => blueprint.key === key);
156
+ }
157
+ query() {
158
+ return this._blueprints;
159
+ }
173
160
  };
174
161
 
175
162
  // src/prompt/index.ts
@@ -180,14 +167,14 @@ __export(prompt_exports, {
180
167
  });
181
168
 
182
169
  // src/prompt/prompt.ts
183
- import { Schema as Schema3 } from "effect";
170
+ import * as Schema3 from "effect/Schema";
184
171
  import { Obj as Obj2, Type as Type3 } from "@dxos/echo";
185
- import { JsonSchemaType, toJsonSchema } from "@dxos/echo-schema";
172
+ import { JsonSchemaType, toJsonSchema } from "@dxos/echo/internal";
186
173
  var Prompt_ = Schema3.Struct({
187
174
  /**
188
175
  * Name of the prompt.
189
176
  */
190
- name: Schema3.String,
177
+ name: Schema3.optional(Schema3.String),
191
178
  /**
192
179
  * Description of the prompt's purpose and functionality.
193
180
  * Allows AI agents to execute prompts automatically as tools.
@@ -205,7 +192,7 @@ var Prompt_ = Schema3.Struct({
205
192
  * Natural language instructions for the prompt.
206
193
  * These should provide concrete course of action for the AI to follow.
207
194
  */
208
- instructions: Schema3.String,
195
+ instructions: Template,
209
196
  /**
210
197
  * Blueprints that the prompt may utilize.
211
198
  */
@@ -219,14 +206,16 @@ var Prompt_ = Schema3.Struct({
219
206
  version: "0.1.0"
220
207
  }));
221
208
  var Prompt = Prompt_;
222
- var make3 = (opts) => Obj2.make(Prompt, {
223
- name: opts.name,
224
- description: opts.description,
225
- input: toJsonSchema(opts.input),
226
- output: toJsonSchema(opts.output),
227
- instructions: opts.instructions,
228
- blueprints: opts.blueprints ?? [],
229
- context: opts.context ?? []
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 ?? []
230
219
  });
231
220
  export {
232
221
  blueprint_exports as Blueprint,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 { Schema } from 'effect';\n\nimport { ToolId } from '@dxos/ai';\nimport { Obj, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo-schema';\nimport { type FunctionDefinition } from '@dxos/functions';\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/**\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 { Schema } from 'effect';\n\nimport { Ref, Type } from '@dxos/echo';\nimport { type ObjectId } from '@dxos/keys';\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 = [], id }: { source: string; inputs?: Input[]; id?: ObjectId }): Template => ({\n source: Ref.make(DataType.makeText(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 { Schema } from 'effect';\n\nimport { Obj, type Ref, Type } from '@dxos/echo';\nimport { JsonSchemaType, toJsonSchema } from '@dxos/echo-schema';\n\nimport { Blueprint } from '../blueprint';\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.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,\n\n /**\n * Output schema of the prompt.\n */\n output: JsonSchemaType,\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: Schema.String,\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),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Prompt',\n version: '0.1.0',\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 = (opts: {\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: opts.name,\n description: opts.description,\n input: toJsonSchema(opts.input),\n output: toJsonSchema(opts.output),\n instructions: opts.instructions,\n blueprints: opts.blueprints ?? [],\n context: opts.context ?? [],\n });\n"],
5
- "mappings": ";;;;;;;;AAAA;;;;cAAAA;EAAA;;;;ACIA,SAASC,UAAAA,eAAc;AAEvB,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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AoB;AAU7C,IAAMC,UAAUC,QAAOC,OAAO;;;;EAI5BC,MAAMF,QAAOG;;;;;EAMbC,aAAaJ,QAAOK,SAASL,QAAOG,MAAM;;;;EAK1CG,OAAOC;;;;EAKPC,QAAQD;;;;;EAMRE,cAAcT,QAAOG;;;;EAKrBO,YAAYV,QAAOW,MAAMC,MAAKC,IAAIC,SAAAA,CAAAA;;;;EAKlCC,SAASf,QAAOW,MAAMX,QAAOgB,GAAG;AAClC,CAAA,EAAGC,KACDL,MAAKM,IAAI;EACPC,UAAU;EACVC,SAAS;AACX,CAAA,CAAA;AAIK,IAAMC,SAAgDtB;AAEtD,IAAMuB,QAAO,CAACC,SASnBL,KAAII,KAAKD,QAAQ;EACfnB,MAAMqB,KAAKrB;EACXE,aAAamB,KAAKnB;EAClBE,OAAOkB,aAAaD,KAAKjB,KAAK;EAC9BE,QAAQgB,aAAaD,KAAKf,MAAM;EAChCC,cAAcc,KAAKd;EACnBC,YAAYa,KAAKb,cAAc,CAAA;EAC/BK,SAASQ,KAAKR,WAAW,CAAA;AAC3B,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", "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", "id", "makeText", "Blueprint", "Schema", "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", "getByKey", "key", "_blueprints", "find", "blueprint", "query", "blueprints", "seen", "Set", "forEach", "has", "warn", "add", "push", "sort", "name", "a", "b", "localeCompare", "make", "Schema", "Obj", "Type", "JsonSchemaType", "toJsonSchema", "Prompt_", "Schema", "Struct", "name", "String", "description", "optional", "input", "JsonSchemaType", "output", "instructions", "blueprints", "Array", "Type", "Ref", "Blueprint", "context", "Any", "pipe", "Obj", "typename", "version", "Prompt", "make", "opts", "toJsonSchema"]
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 { 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/**\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 { 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 = [], id }: { source: string; inputs?: Input[]; id?: ObjectId }): Template => ({\n source: Ref.make(DataType.makeText(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 { 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,\n\n /**\n * Output schema of the prompt.\n */\n output: JsonSchemaType,\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,\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),\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,YA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C,SAAS;AACX,CAAA,CAAA;AAKK,IAAMC,SAAgDtB;AAEtD,IAAMuB,QAAO,CAACC,WASnBL,KAAII,KAAKD,QAAQ;EACfpB,MAAMsB,OAAOtB;EACbG,aAAamB,OAAOnB;EACpBC,OAAOmB,aAAaD,OAAOlB,SAAgBoB,YAAI;EAC/ClB,QAAQiB,aAAaD,OAAOhB,UAAiBkB,YAAI;EACjDjB,cAAuBc,KAAK;IAAEI,QAAQH,OAAOf;EAAa,CAAA;EAC1DE,YAAYa,OAAOb,cAAc,CAAA;EACjCK,SAASQ,OAAOR,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", "DataType", "InputKind", "Literal", "Input", "mutable", "Struct", "name", "String", "kind", "optional", "default", "Any", "Template", "source", "Type", "Ref", "DataType", "Text", "annotations", "description", "inputs", "Array", "pipe", "make", "id", "makeText", "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", "JsonSchemaType", "toJsonSchema", "Prompt_", "Struct", "name", "optional", "String", "description", "input", "JsonSchemaType", "output", "instructions", "Template", "blueprints", "Array", "Type", "Ref", "Blueprint", "context", "Any", "pipe", "Obj", "typename", "version", "Prompt", "make", "params", "toJsonSchema", "Void", "source"]
7
7
  }
@@ -1 +1 @@
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":4373,"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":8074,"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":3784,"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":6070,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"src/blueprint/index.ts","kind":"import-statement","original":"../blueprint"}],"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":12593},"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":"@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},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","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":1891},"src/template/index.ts":{"bytesInOutput":185},"src/template/prompt.ts":{"bytesInOutput":609},"src/template/template.ts":{"bytesInOutput":714},"src/blueprint/registry.ts":{"bytesInOutput":1109},"src/index.ts":{"bytesInOutput":0},"src/prompt/index.ts":{"bytesInOutput":100},"src/prompt/prompt.ts":{"bytesInOutput":1325}},"bytes":6764}}}
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":4385,"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":8092,"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":6623,"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":12645},"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":1891},"src/template/index.ts":{"bytesInOutput":185},"src/template/prompt.ts":{"bytesInOutput":609},"src/template/template.ts":{"bytesInOutput":722},"src/blueprint/registry.ts":{"bytesInOutput":834},"src/index.ts":{"bytesInOutput":0},"src/prompt/index.ts":{"bytesInOutput":100},"src/prompt/prompt.ts":{"bytesInOutput":1409}},"bytes":6581}}}
@@ -1,4 +1,4 @@
1
- import { Schema } from 'effect';
1
+ import * as Schema from 'effect/Schema';
2
2
  import { Type } from '@dxos/echo';
3
3
  import { type FunctionDefinition } from '@dxos/functions';
4
4
  /**
@@ -25,7 +25,7 @@ export declare const Blueprint: Type.obj<Schema.Struct<{
25
25
  * These are system prompts or guidelines that the AI should follow.
26
26
  */
27
27
  instructions: Schema.mutable<Schema.Struct<{
28
- 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> & {
29
29
  content: string;
30
30
  }>, import("@dxos/echo-protocol").EncodedReference, never>;
31
31
  inputs: Schema.optional<Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
@@ -47,12 +47,12 @@ export interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {
47
47
  /**
48
48
  * Create a new Blueprint.
49
49
  */
50
- 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, ...props }: Pick<Blueprint, "key" | "name" | "instructions"> & Partial<Blueprint>) => import("@dxos/live-object").Live<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
51
51
  key: string;
52
52
  name: string;
53
53
  description?: string | undefined;
54
54
  instructions: {
55
- 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> & {
56
56
  content: string;
57
57
  }>;
58
58
  inputs?: {
@@ -1 +1 @@
1
- {"version":3,"file":"blueprint.d.ts","sourceRoot":"","sources":["../../../../src/blueprint/blueprint.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAI1D;;;;GAIG;AACH,eAAO,MAAM,SAAS;IACpB;;;OAGG;;IAMH;;OAEG;;IAKH;;OAEG;;IAKH;;;OAGG;;;;;;;;;;;IAKH;;OAEG;;GAaJ,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC;CAAG;AAE1E;;GAEG;AACH,eAAO,MAAM,IAAI,GAAI,qBAA0B,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,GAAG,cAAc,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;EAC1E,CAAC;AAE3C;;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"}
1
+ {"version":3,"file":"blueprint.d.ts","sourceRoot":"","sources":["../../../../src/blueprint/blueprint.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAI1D;;;;GAIG;AACH,eAAO,MAAM,SAAS;IACpB;;;OAGG;;IAMH;;OAEG;;IAKH;;OAEG;;IAKH;;;OAGG;;;;;;;;;;;IAKH;;OAEG;;GAaJ,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC;CAAG;AAE1E;;GAEG;AACH,eAAO,MAAM,IAAI,GAAI,qBAA0B,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,GAAG,cAAc,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;EAC1E,CAAC;AAE3C;;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"}
@@ -1,4 +1,4 @@
1
- import { Schema } from 'effect';
1
+ import * as Schema from 'effect/Schema';
2
2
  import { type Ref, Type } from '@dxos/echo';
3
3
  import { Blueprint } from '../blueprint';
4
4
  /**
@@ -11,7 +11,7 @@ declare const Prompt_: Type.obj<Schema.Struct<{
11
11
  /**
12
12
  * Name of the prompt.
13
13
  */
14
- name: typeof Schema.String;
14
+ name: Schema.optional<typeof Schema.String>;
15
15
  /**
16
16
  * Description of the prompt's purpose and functionality.
17
17
  * Allows AI agents to execute prompts automatically as tools.
@@ -29,7 +29,16 @@ declare const Prompt_: Type.obj<Schema.Struct<{
29
29
  * Natural language instructions for the prompt.
30
30
  * These should provide concrete course of action for the AI to follow.
31
31
  */
32
- instructions: typeof Schema.String;
32
+ instructions: Schema.mutable<Schema.Struct<{
33
+ source: Schema.SchemaClass<import("@dxos/echo/internal").Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
34
+ content: string;
35
+ }>, import("@dxos/echo-protocol").EncodedReference, never>;
36
+ inputs: Schema.optional<Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
37
+ name: typeof Schema.String;
38
+ kind: Schema.optional<Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>>;
39
+ default: Schema.optional<typeof Schema.Any>;
40
+ }>>>>>;
41
+ }>>;
33
42
  /**
34
43
  * Blueprints that the prompt may utilize.
35
44
  */
@@ -38,7 +47,7 @@ declare const Prompt_: Type.obj<Schema.Struct<{
38
47
  name: Schema.SchemaClass<string, string, never>;
39
48
  description: Schema.optional<typeof Schema.String>;
40
49
  instructions: Schema.mutable<Schema.Struct<{
41
- source: Schema.SchemaClass<import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
50
+ source: Schema.SchemaClass<import("@dxos/echo/internal").Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
42
51
  content: string;
43
52
  }>, import("@dxos/echo-protocol").EncodedReference, never>;
44
53
  inputs: Schema.optional<Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
@@ -59,11 +68,11 @@ export interface Prompt extends Schema.Schema.Type<typeof Prompt_> {
59
68
  export interface Prompt_Encoded extends Schema.Schema.Encoded<typeof Prompt_> {
60
69
  }
61
70
  export declare const Prompt: Schema.Schema<Prompt, Prompt_Encoded>;
62
- export declare const make: (opts: {
63
- name: string;
71
+ export declare const make: (params: {
72
+ name?: string;
64
73
  description?: string;
65
- input: Schema.Schema.AnyNoContext;
66
- output: Schema.Schema.AnyNoContext;
74
+ input?: Schema.Schema.AnyNoContext;
75
+ output?: Schema.Schema.AnyNoContext;
67
76
  instructions: string;
68
77
  blueprints?: Ref.Ref<Blueprint>[];
69
78
  context?: any[];
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/prompt/prompt.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAO,KAAK,GAAG,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,EAAE,S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;;;;;;;;IAGH;;OAEG;;GAOJ,CAAC;AAEF,MAAM,WAAW,MAAO,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC;CAAG;AACrE,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,OAAO,CAAC;CAAG;AAChF,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAW,CAAC;AAErE,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,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;IAClC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;CACjB,KAAG,MASA,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Schema } from 'effect';
1
+ import * as Schema from 'effect/Schema';
2
2
  import { Type } from '@dxos/echo';
3
3
  import { type ObjectId } from '@dxos/keys';
4
4
  /**
@@ -20,7 +20,7 @@ export type Input = Schema.Schema.Type<typeof Input>;
20
20
  * Template type.
21
21
  */
22
22
  export declare const Template: Schema.mutable<Schema.Struct<{
23
- source: Schema.SchemaClass<import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
23
+ source: Schema.SchemaClass<import("@dxos/echo/internal").Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
24
24
  content: string;
25
25
  }>, import("@dxos/echo-protocol").EncodedReference, never>;
26
26
  inputs: Schema.optional<Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
@@ -1 +1 @@
1
- {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/template/template.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,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;;;;GAMjB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;GAGE,CAAC;AAExB,MAAM,WAAW,QAAS,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC;CAAG;AAExE,eAAO,MAAM,IAAI,GAAI,wBAA6B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IAAC,EAAE,CAAC,EAAE,QAAQ,CAAA;CAAE,KAAG,QAGtG,CAAC"}
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/template/template.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,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;;;;GA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