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

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.
@@ -16,8 +16,7 @@ __export(blueprint_exports, {
16
16
  // src/blueprint/blueprint.ts
17
17
  import * as Schema2 from "effect/Schema";
18
18
  import { ToolId } from "@dxos/ai";
19
- import { Obj, Type as Type2 } from "@dxos/echo";
20
- import { LabelAnnotation } from "@dxos/echo/internal";
19
+ import { Annotation, Obj, Type as Type2 } from "@dxos/echo";
21
20
 
22
21
  // src/template/index.ts
23
22
  var template_exports = {};
@@ -26,17 +25,23 @@ __export(template_exports, {
26
25
  InputKind: () => InputKind,
27
26
  Template: () => Template,
28
27
  make: () => make,
29
- process: () => process
28
+ process: () => process,
29
+ processTemplate: () => processTemplate
30
30
  });
31
31
 
32
32
  // src/template/prompt.ts
33
+ import * as Effect from "effect/Effect";
34
+ import * as Record from "effect/Record";
33
35
  import handlebars from "handlebars";
36
+ import { Database } from "@dxos/echo";
37
+ import { FunctionInvocationService } from "@dxos/functions";
34
38
  import { invariant } from "@dxos/invariant";
39
+ import { log } from "@dxos/log";
35
40
  var __dxlog_file = "/__w/dxos/dxos/packages/core/blueprints/src/template/prompt.ts";
36
41
  var process = (source, variables = {}) => {
37
42
  invariant(typeof source === "string", void 0, {
38
43
  F: __dxlog_file,
39
- L: 13,
44
+ L: 26,
40
45
  S: void 0,
41
46
  A: [
42
47
  "typeof source === 'string'",
@@ -49,25 +54,53 @@ var process = (source, variables = {}) => {
49
54
  const output = template(variables);
50
55
  return output.trim().replace(/(\n\s*){3,}/g, "\n\n");
51
56
  };
57
+ var processTemplate = (template) => Effect.gen(function* () {
58
+ const functionInvoker = yield* FunctionInvocationService;
59
+ const variables = yield* Effect.forEach(template.inputs ?? [], (input) => Effect.gen(function* () {
60
+ if (input.kind === "function") {
61
+ const fn = yield* functionInvoker.resolveFunction(input.function);
62
+ const result = yield* functionInvoker.invokeFunction(fn, {});
63
+ return [
64
+ input.name,
65
+ result
66
+ ];
67
+ } else {
68
+ return yield* Effect.dieMessage(`Unsupported input kind: ${input.kind}`);
69
+ }
70
+ })).pipe(Effect.map(Record.fromEntries));
71
+ log("processTemplate", {
72
+ variables
73
+ }, {
74
+ F: __dxlog_file,
75
+ L: 56,
76
+ S: this,
77
+ C: (f, a) => f(...a)
78
+ });
79
+ return process((yield* Database.Service.load(template.source)).content, variables);
80
+ });
52
81
 
53
82
  // src/template/template.ts
54
83
  import * as Schema from "effect/Schema";
55
84
  import { Ref, Type } from "@dxos/echo";
56
- import { DataType } from "@dxos/schema";
85
+ import { Text } from "@dxos/schema";
57
86
  var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
58
- var Input = Schema.mutable(Schema.Struct({
87
+ var Input = Schema.Struct({
59
88
  name: Schema.String,
60
89
  kind: Schema.optional(InputKind),
61
- default: Schema.optional(Schema.Any)
62
- }));
90
+ default: Schema.optional(Schema.Any),
91
+ /**
92
+ * Function to call if the kind is 'function'.
93
+ */
94
+ function: Schema.optional(Schema.String)
95
+ });
63
96
  var Template = Schema.Struct({
64
- source: Type.Ref(DataType.Text).annotations({
97
+ source: Type.Ref(Text.Text).annotations({
65
98
  description: "Handlebars template source"
66
99
  }),
67
- inputs: Schema.optional(Schema.mutable(Schema.Array(Input)))
68
- }).pipe(Schema.mutable);
69
- var make = ({ source, inputs = [], id }) => ({
70
- source: Ref.make(DataType.makeText(source, id)),
100
+ inputs: Schema.optional(Schema.Array(Input))
101
+ });
102
+ var make = ({ source, inputs = [], id } = {}) => ({
103
+ source: Ref.make(Text.make(source, id)),
71
104
  inputs
72
105
  });
73
106
 
@@ -106,19 +139,16 @@ var Blueprint = Schema2.Struct({
106
139
  tools: Schema2.Array(ToolId).annotations({
107
140
  description: "Array of tools that the AI assistant can use when this blueprint is active"
108
141
  })
109
- }).pipe(
110
- Type2.Obj({
111
- // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.
112
- typename: "dxos.org/type/Blueprint",
113
- version: "0.1.0"
114
- }),
115
- // TODO(burdon): Move to Type.Obj def?
116
- LabelAnnotation.set([
117
- "name"
118
- ])
119
- );
120
- var make2 = ({ tools = [], ...props }) => Obj.make(Blueprint, {
142
+ }).pipe(Type2.object({
143
+ // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.
144
+ typename: "dxos.org/type/Blueprint",
145
+ version: "0.1.0"
146
+ }), Annotation.LabelAnnotation.set([
147
+ "name"
148
+ ]));
149
+ var make2 = ({ tools = [], instructions = make(), ...props }) => Obj.make(Blueprint, {
121
150
  tools,
151
+ instructions,
122
152
  ...props
123
153
  });
124
154
  var toolDefinitions = ({ tools = [], functions = [] }) => [
@@ -127,7 +157,7 @@ var toolDefinitions = ({ tools = [], functions = [] }) => [
127
157
  ];
128
158
 
129
159
  // src/blueprint/registry.ts
130
- import { log } from "@dxos/log";
160
+ import { log as log2 } from "@dxos/log";
131
161
  var __dxlog_file2 = "/__w/dxos/dxos/packages/core/blueprints/src/blueprint/registry.ts";
132
162
  var Registry = class {
133
163
  _blueprints = [];
@@ -135,7 +165,7 @@ var Registry = class {
135
165
  const seen = /* @__PURE__ */ new Set();
136
166
  blueprints.forEach((blueprint) => {
137
167
  if (seen.has(blueprint.key)) {
138
- log.warn("duplicate blueprint", {
168
+ log2.warn("duplicate blueprint", {
139
169
  key: blueprint.key
140
170
  }, {
141
171
  F: __dxlog_file2,
@@ -150,6 +180,9 @@ var Registry = class {
150
180
  });
151
181
  this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
152
182
  }
183
+ get blueprints() {
184
+ return this._blueprints;
185
+ }
153
186
  getByKey(key) {
154
187
  return this._blueprints.find((blueprint) => blueprint.key === key);
155
188
  }
@@ -167,9 +200,8 @@ __export(prompt_exports, {
167
200
 
168
201
  // src/prompt/prompt.ts
169
202
  import * as Schema3 from "effect/Schema";
170
- import { Obj as Obj2, Type as Type3 } from "@dxos/echo";
171
- import { JsonSchemaType, toJsonSchema } from "@dxos/echo/internal";
172
- var Prompt_ = Schema3.Struct({
203
+ import { Annotation as Annotation2, JsonSchema, Obj as Obj2, Type as Type3 } from "@dxos/echo";
204
+ var Prompt = Schema3.Struct({
173
205
  /**
174
206
  * Name of the prompt.
175
207
  */
@@ -182,16 +214,16 @@ var Prompt_ = Schema3.Struct({
182
214
  /**
183
215
  * Input schema of the prompt.
184
216
  */
185
- input: JsonSchemaType,
217
+ input: JsonSchema.JsonSchema.pipe(Annotation2.FormInputAnnotation.set(false)),
186
218
  /**
187
219
  * Output schema of the prompt.
188
220
  */
189
- output: JsonSchemaType,
221
+ output: JsonSchema.JsonSchema.pipe(Annotation2.FormInputAnnotation.set(false)),
190
222
  /**
191
223
  * Natural language instructions for the prompt.
192
224
  * These should provide concrete course of action for the AI to follow.
193
225
  */
194
- instructions: Template,
226
+ instructions: Template.pipe(Annotation2.FormInputAnnotation.set(false)),
195
227
  /**
196
228
  * Blueprints that the prompt may utilize.
197
229
  */
@@ -199,17 +231,16 @@ var Prompt_ = Schema3.Struct({
199
231
  /**
200
232
  * Additional context that the prompt may utilize.
201
233
  */
202
- context: Schema3.Array(Schema3.Any)
203
- }).pipe(Type3.Obj({
234
+ context: Schema3.Array(Schema3.Any).pipe(Annotation2.FormInputAnnotation.set(false))
235
+ }).pipe(Type3.object({
204
236
  typename: "dxos.org/type/Prompt",
205
237
  version: "0.1.0"
206
238
  }));
207
- var Prompt = Prompt_;
208
239
  var make3 = (params) => Obj2.make(Prompt, {
209
240
  name: params.name,
210
241
  description: params.description,
211
- input: toJsonSchema(params.input ?? Schema3.Void),
212
- output: toJsonSchema(params.output ?? Schema3.Void),
242
+ input: JsonSchema.toJsonSchema(params.input ?? Schema3.Void),
243
+ output: JsonSchema.toJsonSchema(params.output ?? Schema3.Void),
213
244
  instructions: make({
214
245
  source: params.instructions
215
246
  }),
@@ -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 * 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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AAA,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"]
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './blueprint';\nexport * from './registry';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { ToolId } from '@dxos/ai';\nimport { Annotation, Obj, Type } from '@dxos/echo';\nimport { type FunctionDefinition } from '@dxos/functions';\n\nimport * as Template from '../template';\n\n/**\n * Blueprint schema defines the structure for AI assistant blueprints.\n * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.\n * Blueprints may use tools to create and read artifacts, which are managed by the assistant.\n */\nexport const Blueprint = Schema.Struct({\n /**\n * Global registry ID.\n * NOTE: The `key` property refers to the original registry entry.\n */\n // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.\n key: Schema.String.annotations({\n description: 'Unique registration key for the blueprint',\n }),\n\n /**\n * Human-readable name of the blueprint.\n */\n name: Schema.String.annotations({\n description: 'Human-readable name of the blueprint',\n }),\n\n /**\n * Description of the blueprint's purpose and functionality.\n */\n description: Schema.optional(Schema.String).annotations({\n description: \"Description of the blueprint's purpose and functionality\",\n }),\n\n /**\n * Instructions that guide the AI assistant's behavior and responses.\n * These are system prompts or guidelines that the AI should follow.\n */\n instructions: Template.Template.annotations({\n description: \"Instructions that guide the AI assistant's behavior and responses\",\n }),\n\n /**\n * Array of tools that the AI assistant can use when this blueprint is active.\n */\n tools: Schema.Array(ToolId).annotations({\n description: 'Array of tools that the AI assistant can use when this blueprint is active',\n }),\n}).pipe(\n Type.object({\n // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.\n typename: 'dxos.org/type/Blueprint',\n version: '0.1.0',\n }),\n Annotation.LabelAnnotation.set(['name']),\n);\n\n/**\n * TypeScript type for Blueprint.\n */\nexport interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {}\n\ntype MakeProps = Pick<Blueprint, 'key' | 'name'> & Partial<Blueprint>;\n\n/**\n * Create a new Blueprint.\n */\nexport const make = ({ tools = [], instructions = Template.make(), ...props }: MakeProps) =>\n Obj.make(Blueprint, {\n tools,\n instructions,\n ...props,\n });\n\n/**\n * Util to create tool definitions for a blueprint.\n */\nexport const toolDefinitions = ({\n tools = [],\n functions = [],\n}: {\n tools?: string[];\n functions?: FunctionDefinition[];\n}) => [...functions.map((fn) => ToolId.make(fn.key)), ...tools.map((tool) => ToolId.make(tool))];\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\nexport * from './template';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Record from 'effect/Record';\nimport handlebars from 'handlebars';\n\nimport { Database } from '@dxos/echo';\nimport type { ObjectNotFoundError } from '@dxos/echo/Err';\nimport {\n type FunctionDefinition,\n FunctionInvocationService,\n type FunctionNotFoundError,\n type TracingService,\n} from '@dxos/functions';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\n\nimport type { Template } from '..';\n\n/**\n * Process Handlebars template.\n */\nexport const process = <Options extends {}>(source: string, variables: Partial<Options> = {}): string => {\n invariant(typeof source === 'string');\n let section = 0;\n handlebars.registerHelper('section', () => String(++section));\n const template = handlebars.compile(source.trim());\n const output = template(variables);\n return output.trim().replace(/(\\n\\s*){3,}/g, '\\n\\n');\n};\n\nexport const processTemplate = (\n template: Template.Template,\n): Effect.Effect<string, ObjectNotFoundError | FunctionNotFoundError, FunctionInvocationService | TracingService> =>\n Effect.gen(function* () {\n const functionInvoker = yield* FunctionInvocationService;\n\n const variables = yield* Effect.forEach(template.inputs ?? [], (input) =>\n Effect.gen(function* () {\n if (input.kind === 'function') {\n const fn = (yield* functionInvoker.resolveFunction(input.function!)) as FunctionDefinition<\n {},\n unknown,\n never\n >;\n const result = yield* functionInvoker.invokeFunction(fn, {});\n return [input.name, result] as const;\n } else {\n return yield* Effect.dieMessage(`Unsupported input kind: ${input.kind}`);\n }\n }),\n ).pipe(Effect.map(Record.fromEntries));\n\n log('processTemplate', { variables });\n\n return process((yield* Database.Service.load(template.source)).content, variables);\n });\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Ref, Type } from '@dxos/echo';\nimport { type ObjectId } from '@dxos/keys';\nimport { Text } from '@dxos/schema';\n\n/**\n * Template input kind determines how template variables are resolved.\n */\nexport const InputKind = Schema.Literal(\n 'value', // Literal value.\n 'pass-through',\n 'retriever',\n 'function',\n 'query',\n 'resolver',\n 'context',\n 'schema',\n);\n\nexport type InputKind = Schema.Schema.Type<typeof InputKind>;\n\n/**\n * Template input variable.\n * E.g., {{foo}}\n */\nexport const Input = Schema.Struct({\n name: Schema.String,\n kind: Schema.optional(InputKind),\n default: Schema.optional(Schema.Any),\n\n /**\n * Function to call if the kind is 'function'.\n */\n function: Schema.optional(Schema.String),\n});\n\nexport type Input = Schema.Schema.Type<typeof Input>;\n\n/**\n * Template type.\n */\nexport const Template = Schema.Struct({\n source: Type.Ref(Text.Text).annotations({ description: 'Handlebars template source' }),\n inputs: Schema.optional(Schema.Array(Input)),\n});\n\nexport interface Template extends Schema.Schema.Type<typeof Template> {}\n\nexport const make = ({\n source,\n inputs = [],\n id,\n}: { source?: string; inputs?: Input[]; id?: ObjectId } = {}): Template => ({\n source: Ref.make(Text.make(source, id)),\n inputs,\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { log } from '@dxos/log';\n\nimport { type Blueprint } from './blueprint';\n\n/**\n * Blueprint registry.\n */\nexport class Registry {\n private readonly _blueprints: Blueprint[] = [];\n\n constructor(blueprints: Blueprint[]) {\n const seen = new Set<string>();\n blueprints.forEach((blueprint) => {\n if (seen.has(blueprint.key)) {\n log.warn('duplicate blueprint', { key: blueprint.key });\n } else {\n seen.add(blueprint.key);\n this._blueprints.push(blueprint);\n }\n });\n\n this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));\n }\n\n get blueprints(): Blueprint[] {\n return this._blueprints;\n }\n\n getByKey(key: string): Blueprint | undefined {\n return this._blueprints.find((blueprint) => blueprint.key === key);\n }\n\n query(): Blueprint[] {\n return this._blueprints;\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, JsonSchema, Obj, type Ref, Type } from '@dxos/echo';\n\nimport { Blueprint } from '../blueprint';\nimport * as Template from '../template';\n\n/**\n * Executable instructions, which may use Blueprints.\n * May reference additional context.\n */\nexport const Prompt = Schema.Struct({\n /**\n * Name of the prompt.\n */\n name: Schema.optional(Schema.String),\n\n /**\n * Description of the prompt's purpose and functionality.\n * Allows AI agents to execute prompts automatically as tools.\n */\n description: Schema.optional(Schema.String),\n\n /**\n * Input schema of the prompt.\n */\n input: JsonSchema.JsonSchema.pipe(Annotation.FormInputAnnotation.set(false)),\n\n /**\n * Output schema of the prompt.\n */\n output: JsonSchema.JsonSchema.pipe(Annotation.FormInputAnnotation.set(false)),\n\n /**\n * Natural language instructions for the prompt.\n * These should provide concrete course of action for the AI to follow.\n */\n instructions: Template.Template.pipe(Annotation.FormInputAnnotation.set(false)),\n\n /**\n * Blueprints that the prompt may utilize.\n */\n blueprints: Schema.Array(Type.Ref(Blueprint)),\n\n /**\n * Additional context that the prompt may utilize.\n */\n context: Schema.Array(Schema.Any).pipe(Annotation.FormInputAnnotation.set(false)),\n}).pipe(\n Type.object({\n typename: 'dxos.org/type/Prompt',\n version: '0.1.0',\n }),\n);\n\nexport interface Prompt extends Schema.Schema.Type<typeof Prompt> {}\n\nexport const make = (params: {\n name?: string;\n description?: string;\n input?: Schema.Schema.AnyNoContext;\n output?: Schema.Schema.AnyNoContext;\n instructions?: string;\n blueprints?: Ref.Ref<Blueprint>[];\n context?: any[];\n}): Prompt =>\n Obj.make(Prompt, {\n name: params.name,\n description: params.description,\n input: JsonSchema.toJsonSchema(params.input ?? Schema.Void),\n output: JsonSchema.toJsonSchema(params.output ?? Schema.Void),\n instructions: Template.make({ source: params.instructions }),\n blueprints: params.blueprints ?? [],\n context: params.context ?? [],\n });\n"],
5
+ "mappings": ";;;;;;;AAAA;;;;cAAAA;EAAA;;;;ACIA,YAAYC,aAAY;AAExB,SAASC,cAAc;AACvB,SAASC,YAAYC,KAAKC,QAAAA,aAAY;;;ACPtC;;;;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;EAKxEI,YAAmBC,cAAMC,MAAKC,IAAIC,SAAAA,CAAAA;;;;EAKlCC,SAAgBJ,cAAaK,WAAG,EAAEb,KAAKC,YAAWC,oBAAoBC,IAAI,KAAA,CAAA;AAC5E,CAAA,EAAGH,KACDS,MAAKK,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,CAAA;AAKK,IAAMC,QAAO,CAACC,WASnBC,KAAIF,KAAKzB,QAAQ;EACfE,MAAMwB,OAAOxB;EACbG,aAAaqB,OAAOrB;EACpBC,OAAOC,WAAWqB,aAAaF,OAAOpB,SAAgBuB,YAAI;EAC1DjB,QAAQL,WAAWqB,aAAaF,OAAOd,UAAiBiB,YAAI;EAC5DhB,cAAuBY,KAAK;IAAEK,QAAQJ,OAAOb;EAAa,CAAA;EAC1DE,YAAYW,OAAOX,cAAc,CAAA;EACjCK,SAASM,OAAON,WAAW,CAAA;AAC7B,CAAA;",
6
+ "names": ["make", "Schema", "ToolId", "Annotation", "Obj", "Type", "Effect", "Record", "handlebars", "Database", "FunctionInvocationService", "invariant", "log", "process", "source", "variables", "section", "registerHelper", "String", "template", "compile", "trim", "output", "replace", "processTemplate", "gen", "functionInvoker", "forEach", "inputs", "input", "kind", "fn", "resolveFunction", "function", "result", "invokeFunction", "name", "dieMessage", "pipe", "map", "fromEntries", "Service", "load", "content", "Schema", "Ref", "Type", "Text", "InputKind", "Literal", "Input", "Struct", "name", "String", "kind", "optional", "default", "Any", "function", "Template", "source", "Type", "Ref", "Text", "annotations", "description", "inputs", "Array", "make", "id", "Blueprint", "Struct", "key", "String", "annotations", "description", "name", "optional", "instructions", "Template", "tools", "Array", "ToolId", "pipe", "Type", "object", "typename", "version", "Annotation", "LabelAnnotation", "set", "make", "props", "Obj", "toolDefinitions", "functions", "map", "fn", "tool", "log", "Registry", "_blueprints", "blueprints", "seen", "Set", "forEach", "blueprint", "has", "key", "warn", "add", "push", "sort", "name", "a", "b", "localeCompare", "getByKey", "find", "query", "make", "Schema", "Annotation", "JsonSchema", "Obj", "Type", "Prompt", "Struct", "name", "optional", "String", "description", "input", "JsonSchema", "pipe", "Annotation", "FormInputAnnotation", "set", "output", "instructions", "Template", "blueprints", "Array", "Type", "Ref", "Blueprint", "context", "Any", "object", "typename", "version", "make", "params", "Obj", "toJsonSchema", "Void", "source"]
7
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":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}}}
1
+ {"inputs":{"src/template/prompt.ts":{"bytes":6924,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/template/template.ts":{"bytes":4450,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"src/template/index.ts":{"bytes":546,"imports":[{"path":"src/template/prompt.ts","kind":"import-statement","original":"./prompt"},{"path":"src/template/template.ts","kind":"import-statement","original":"./template"}],"format":"esm"},"src/blueprint/blueprint.ts":{"bytes":8164,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/template/index.ts","kind":"import-statement","original":"../template"}],"format":"esm"},"src/blueprint/registry.ts":{"bytes":3662,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/blueprint/index.ts":{"bytes":554,"imports":[{"path":"src/blueprint/blueprint.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/blueprint/registry.ts","kind":"import-statement","original":"./registry"}],"format":"esm"},"src/prompt/prompt.ts":{"bytes":7056,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/blueprint/index.ts","kind":"import-statement","original":"../blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"../template"}],"format":"esm"},"src/prompt/index.ts":{"bytes":456,"imports":[{"path":"src/prompt/prompt.ts","kind":"import-statement","original":"./prompt"}],"format":"esm"},"src/index.ts":{"bytes":813,"imports":[{"path":"src/blueprint/index.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"./template"},{"path":"src/prompt/index.ts","kind":"import-statement","original":"./prompt"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15388},"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":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["Blueprint","Prompt","Template"],"entryPoint":"src/index.ts","inputs":{"src/blueprint/index.ts":{"bytesInOutput":182},"src/blueprint/blueprint.ts":{"bytesInOutput":1842},"src/template/index.ts":{"bytesInOutput":227},"src/template/prompt.ts":{"bytesInOutput":1642},"src/template/template.ts":{"bytesInOutput":761},"src/blueprint/registry.ts":{"bytesInOutput":897},"src/index.ts":{"bytesInOutput":0},"src/prompt/index.ts":{"bytesInOutput":100},"src/prompt/prompt.ts":{"bytesInOutput":1592}},"bytes":7800}}}
@@ -17,8 +17,7 @@ __export(blueprint_exports, {
17
17
  // src/blueprint/blueprint.ts
18
18
  import * as Schema2 from "effect/Schema";
19
19
  import { ToolId } from "@dxos/ai";
20
- import { Obj, Type as Type2 } from "@dxos/echo";
21
- import { LabelAnnotation } from "@dxos/echo/internal";
20
+ import { Annotation, Obj, Type as Type2 } from "@dxos/echo";
22
21
 
23
22
  // src/template/index.ts
24
23
  var template_exports = {};
@@ -27,17 +26,23 @@ __export(template_exports, {
27
26
  InputKind: () => InputKind,
28
27
  Template: () => Template,
29
28
  make: () => make,
30
- process: () => process
29
+ process: () => process,
30
+ processTemplate: () => processTemplate
31
31
  });
32
32
 
33
33
  // src/template/prompt.ts
34
+ import * as Effect from "effect/Effect";
35
+ import * as Record from "effect/Record";
34
36
  import handlebars from "handlebars";
37
+ import { Database } from "@dxos/echo";
38
+ import { FunctionInvocationService } from "@dxos/functions";
35
39
  import { invariant } from "@dxos/invariant";
40
+ import { log } from "@dxos/log";
36
41
  var __dxlog_file = "/__w/dxos/dxos/packages/core/blueprints/src/template/prompt.ts";
37
42
  var process = (source, variables = {}) => {
38
43
  invariant(typeof source === "string", void 0, {
39
44
  F: __dxlog_file,
40
- L: 13,
45
+ L: 26,
41
46
  S: void 0,
42
47
  A: [
43
48
  "typeof source === 'string'",
@@ -50,25 +55,53 @@ var process = (source, variables = {}) => {
50
55
  const output = template(variables);
51
56
  return output.trim().replace(/(\n\s*){3,}/g, "\n\n");
52
57
  };
58
+ var processTemplate = (template) => Effect.gen(function* () {
59
+ const functionInvoker = yield* FunctionInvocationService;
60
+ const variables = yield* Effect.forEach(template.inputs ?? [], (input) => Effect.gen(function* () {
61
+ if (input.kind === "function") {
62
+ const fn = yield* functionInvoker.resolveFunction(input.function);
63
+ const result = yield* functionInvoker.invokeFunction(fn, {});
64
+ return [
65
+ input.name,
66
+ result
67
+ ];
68
+ } else {
69
+ return yield* Effect.dieMessage(`Unsupported input kind: ${input.kind}`);
70
+ }
71
+ })).pipe(Effect.map(Record.fromEntries));
72
+ log("processTemplate", {
73
+ variables
74
+ }, {
75
+ F: __dxlog_file,
76
+ L: 56,
77
+ S: this,
78
+ C: (f, a) => f(...a)
79
+ });
80
+ return process((yield* Database.Service.load(template.source)).content, variables);
81
+ });
53
82
 
54
83
  // src/template/template.ts
55
84
  import * as Schema from "effect/Schema";
56
85
  import { Ref, Type } from "@dxos/echo";
57
- import { DataType } from "@dxos/schema";
86
+ import { Text } from "@dxos/schema";
58
87
  var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
59
- var Input = Schema.mutable(Schema.Struct({
88
+ var Input = Schema.Struct({
60
89
  name: Schema.String,
61
90
  kind: Schema.optional(InputKind),
62
- default: Schema.optional(Schema.Any)
63
- }));
91
+ default: Schema.optional(Schema.Any),
92
+ /**
93
+ * Function to call if the kind is 'function'.
94
+ */
95
+ function: Schema.optional(Schema.String)
96
+ });
64
97
  var Template = Schema.Struct({
65
- source: Type.Ref(DataType.Text).annotations({
98
+ source: Type.Ref(Text.Text).annotations({
66
99
  description: "Handlebars template source"
67
100
  }),
68
- inputs: Schema.optional(Schema.mutable(Schema.Array(Input)))
69
- }).pipe(Schema.mutable);
70
- var make = ({ source, inputs = [], id }) => ({
71
- source: Ref.make(DataType.makeText(source, id)),
101
+ inputs: Schema.optional(Schema.Array(Input))
102
+ });
103
+ var make = ({ source, inputs = [], id } = {}) => ({
104
+ source: Ref.make(Text.make(source, id)),
72
105
  inputs
73
106
  });
74
107
 
@@ -107,19 +140,16 @@ var Blueprint = Schema2.Struct({
107
140
  tools: Schema2.Array(ToolId).annotations({
108
141
  description: "Array of tools that the AI assistant can use when this blueprint is active"
109
142
  })
110
- }).pipe(
111
- Type2.Obj({
112
- // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.
113
- typename: "dxos.org/type/Blueprint",
114
- version: "0.1.0"
115
- }),
116
- // TODO(burdon): Move to Type.Obj def?
117
- LabelAnnotation.set([
118
- "name"
119
- ])
120
- );
121
- var make2 = ({ tools = [], ...props }) => Obj.make(Blueprint, {
143
+ }).pipe(Type2.object({
144
+ // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.
145
+ typename: "dxos.org/type/Blueprint",
146
+ version: "0.1.0"
147
+ }), Annotation.LabelAnnotation.set([
148
+ "name"
149
+ ]));
150
+ var make2 = ({ tools = [], instructions = make(), ...props }) => Obj.make(Blueprint, {
122
151
  tools,
152
+ instructions,
123
153
  ...props
124
154
  });
125
155
  var toolDefinitions = ({ tools = [], functions = [] }) => [
@@ -128,7 +158,7 @@ var toolDefinitions = ({ tools = [], functions = [] }) => [
128
158
  ];
129
159
 
130
160
  // src/blueprint/registry.ts
131
- import { log } from "@dxos/log";
161
+ import { log as log2 } from "@dxos/log";
132
162
  var __dxlog_file2 = "/__w/dxos/dxos/packages/core/blueprints/src/blueprint/registry.ts";
133
163
  var Registry = class {
134
164
  _blueprints = [];
@@ -136,7 +166,7 @@ var Registry = class {
136
166
  const seen = /* @__PURE__ */ new Set();
137
167
  blueprints.forEach((blueprint) => {
138
168
  if (seen.has(blueprint.key)) {
139
- log.warn("duplicate blueprint", {
169
+ log2.warn("duplicate blueprint", {
140
170
  key: blueprint.key
141
171
  }, {
142
172
  F: __dxlog_file2,
@@ -151,6 +181,9 @@ var Registry = class {
151
181
  });
152
182
  this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
153
183
  }
184
+ get blueprints() {
185
+ return this._blueprints;
186
+ }
154
187
  getByKey(key) {
155
188
  return this._blueprints.find((blueprint) => blueprint.key === key);
156
189
  }
@@ -168,9 +201,8 @@ __export(prompt_exports, {
168
201
 
169
202
  // src/prompt/prompt.ts
170
203
  import * as Schema3 from "effect/Schema";
171
- import { Obj as Obj2, Type as Type3 } from "@dxos/echo";
172
- import { JsonSchemaType, toJsonSchema } from "@dxos/echo/internal";
173
- var Prompt_ = Schema3.Struct({
204
+ import { Annotation as Annotation2, JsonSchema, Obj as Obj2, Type as Type3 } from "@dxos/echo";
205
+ var Prompt = Schema3.Struct({
174
206
  /**
175
207
  * Name of the prompt.
176
208
  */
@@ -183,16 +215,16 @@ var Prompt_ = Schema3.Struct({
183
215
  /**
184
216
  * Input schema of the prompt.
185
217
  */
186
- input: JsonSchemaType,
218
+ input: JsonSchema.JsonSchema.pipe(Annotation2.FormInputAnnotation.set(false)),
187
219
  /**
188
220
  * Output schema of the prompt.
189
221
  */
190
- output: JsonSchemaType,
222
+ output: JsonSchema.JsonSchema.pipe(Annotation2.FormInputAnnotation.set(false)),
191
223
  /**
192
224
  * Natural language instructions for the prompt.
193
225
  * These should provide concrete course of action for the AI to follow.
194
226
  */
195
- instructions: Template,
227
+ instructions: Template.pipe(Annotation2.FormInputAnnotation.set(false)),
196
228
  /**
197
229
  * Blueprints that the prompt may utilize.
198
230
  */
@@ -200,17 +232,16 @@ var Prompt_ = Schema3.Struct({
200
232
  /**
201
233
  * Additional context that the prompt may utilize.
202
234
  */
203
- context: Schema3.Array(Schema3.Any)
204
- }).pipe(Type3.Obj({
235
+ context: Schema3.Array(Schema3.Any).pipe(Annotation2.FormInputAnnotation.set(false))
236
+ }).pipe(Type3.object({
205
237
  typename: "dxos.org/type/Prompt",
206
238
  version: "0.1.0"
207
239
  }));
208
- var Prompt = Prompt_;
209
240
  var make3 = (params) => Obj2.make(Prompt, {
210
241
  name: params.name,
211
242
  description: params.description,
212
- input: toJsonSchema(params.input ?? Schema3.Void),
213
- output: toJsonSchema(params.output ?? Schema3.Void),
243
+ input: JsonSchema.toJsonSchema(params.input ?? Schema3.Void),
244
+ output: JsonSchema.toJsonSchema(params.output ?? Schema3.Void),
214
245
  instructions: make({
215
246
  source: params.instructions
216
247
  }),
@@ -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 * 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,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,SAASC,IAAI,EAAEC,YAAY;IAAEC,aAAa;EAA6B,CAAA;EACxFC,QAAeX,gBAAgBL,eAAeiB,aAAMlB,KAAAA,CAAAA,CAAAA;AACtD,CAAA,EAAGmB,KAAYlB,cAAO;AAIf,IAAMmB,OAAO,CAAC,EAAEV,QAAQO,SAAS,CAAA,GAAII,GAAE,OAAuE;EACnHX,QAAQE,IAAIQ,KAAKP,SAASS,SAAS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KL,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;;;ACnCA;;;cAAAmB;;;;ACIA,YAAYC,aAAY;AAExB,SAASC,OAAAA,MAAeC,QAAAA,aAAY;AACpC,SAASC,gBAAgBC,oBAAoB;AAW7C,IAAMC,UAAiBC,eAAO;;;;EAI5BC,MAAaC,iBAAgBC,cAAM;;;;;EAMnCC,aAAoBF,iBAAgBC,cAAM;;;;EAK1CE,OAAOC;;;;EAKPC,QAAQD;;;;;EAMRE,cAAuBC;;;;EAKvBC,YAAmBC,cAAMC,MAAKC,IAAIC,SAAAA,CAAAA;;;;EAKlCC,SAAgBJ,cAAaK,WAAG;AAClC,CAAA,EAAGC,KACDL,MAAKM,IAAI;EACPC,UAAU;EACVC,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"]
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './blueprint';\nexport * from './registry';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { ToolId } from '@dxos/ai';\nimport { Annotation, Obj, Type } from '@dxos/echo';\nimport { type FunctionDefinition } from '@dxos/functions';\n\nimport * as Template from '../template';\n\n/**\n * Blueprint schema defines the structure for AI assistant blueprints.\n * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.\n * Blueprints may use tools to create and read artifacts, which are managed by the assistant.\n */\nexport const Blueprint = Schema.Struct({\n /**\n * Global registry ID.\n * NOTE: The `key` property refers to the original registry entry.\n */\n // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.\n key: Schema.String.annotations({\n description: 'Unique registration key for the blueprint',\n }),\n\n /**\n * Human-readable name of the blueprint.\n */\n name: Schema.String.annotations({\n description: 'Human-readable name of the blueprint',\n }),\n\n /**\n * Description of the blueprint's purpose and functionality.\n */\n description: Schema.optional(Schema.String).annotations({\n description: \"Description of the blueprint's purpose and functionality\",\n }),\n\n /**\n * Instructions that guide the AI assistant's behavior and responses.\n * These are system prompts or guidelines that the AI should follow.\n */\n instructions: Template.Template.annotations({\n description: \"Instructions that guide the AI assistant's behavior and responses\",\n }),\n\n /**\n * Array of tools that the AI assistant can use when this blueprint is active.\n */\n tools: Schema.Array(ToolId).annotations({\n description: 'Array of tools that the AI assistant can use when this blueprint is active',\n }),\n}).pipe(\n Type.object({\n // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.\n typename: 'dxos.org/type/Blueprint',\n version: '0.1.0',\n }),\n Annotation.LabelAnnotation.set(['name']),\n);\n\n/**\n * TypeScript type for Blueprint.\n */\nexport interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {}\n\ntype MakeProps = Pick<Blueprint, 'key' | 'name'> & Partial<Blueprint>;\n\n/**\n * Create a new Blueprint.\n */\nexport const make = ({ tools = [], instructions = Template.make(), ...props }: MakeProps) =>\n Obj.make(Blueprint, {\n tools,\n instructions,\n ...props,\n });\n\n/**\n * Util to create tool definitions for a blueprint.\n */\nexport const toolDefinitions = ({\n tools = [],\n functions = [],\n}: {\n tools?: string[];\n functions?: FunctionDefinition[];\n}) => [...functions.map((fn) => ToolId.make(fn.key)), ...tools.map((tool) => ToolId.make(tool))];\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\nexport * from './template';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Record from 'effect/Record';\nimport handlebars from 'handlebars';\n\nimport { Database } from '@dxos/echo';\nimport type { ObjectNotFoundError } from '@dxos/echo/Err';\nimport {\n type FunctionDefinition,\n FunctionInvocationService,\n type FunctionNotFoundError,\n type TracingService,\n} from '@dxos/functions';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\n\nimport type { Template } from '..';\n\n/**\n * Process Handlebars template.\n */\nexport const process = <Options extends {}>(source: string, variables: Partial<Options> = {}): string => {\n invariant(typeof source === 'string');\n let section = 0;\n handlebars.registerHelper('section', () => String(++section));\n const template = handlebars.compile(source.trim());\n const output = template(variables);\n return output.trim().replace(/(\\n\\s*){3,}/g, '\\n\\n');\n};\n\nexport const processTemplate = (\n template: Template.Template,\n): Effect.Effect<string, ObjectNotFoundError | FunctionNotFoundError, FunctionInvocationService | TracingService> =>\n Effect.gen(function* () {\n const functionInvoker = yield* FunctionInvocationService;\n\n const variables = yield* Effect.forEach(template.inputs ?? [], (input) =>\n Effect.gen(function* () {\n if (input.kind === 'function') {\n const fn = (yield* functionInvoker.resolveFunction(input.function!)) as FunctionDefinition<\n {},\n unknown,\n never\n >;\n const result = yield* functionInvoker.invokeFunction(fn, {});\n return [input.name, result] as const;\n } else {\n return yield* Effect.dieMessage(`Unsupported input kind: ${input.kind}`);\n }\n }),\n ).pipe(Effect.map(Record.fromEntries));\n\n log('processTemplate', { variables });\n\n return process((yield* Database.Service.load(template.source)).content, variables);\n });\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Ref, Type } from '@dxos/echo';\nimport { type ObjectId } from '@dxos/keys';\nimport { Text } from '@dxos/schema';\n\n/**\n * Template input kind determines how template variables are resolved.\n */\nexport const InputKind = Schema.Literal(\n 'value', // Literal value.\n 'pass-through',\n 'retriever',\n 'function',\n 'query',\n 'resolver',\n 'context',\n 'schema',\n);\n\nexport type InputKind = Schema.Schema.Type<typeof InputKind>;\n\n/**\n * Template input variable.\n * E.g., {{foo}}\n */\nexport const Input = Schema.Struct({\n name: Schema.String,\n kind: Schema.optional(InputKind),\n default: Schema.optional(Schema.Any),\n\n /**\n * Function to call if the kind is 'function'.\n */\n function: Schema.optional(Schema.String),\n});\n\nexport type Input = Schema.Schema.Type<typeof Input>;\n\n/**\n * Template type.\n */\nexport const Template = Schema.Struct({\n source: Type.Ref(Text.Text).annotations({ description: 'Handlebars template source' }),\n inputs: Schema.optional(Schema.Array(Input)),\n});\n\nexport interface Template extends Schema.Schema.Type<typeof Template> {}\n\nexport const make = ({\n source,\n inputs = [],\n id,\n}: { source?: string; inputs?: Input[]; id?: ObjectId } = {}): Template => ({\n source: Ref.make(Text.make(source, id)),\n inputs,\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { log } from '@dxos/log';\n\nimport { type Blueprint } from './blueprint';\n\n/**\n * Blueprint registry.\n */\nexport class Registry {\n private readonly _blueprints: Blueprint[] = [];\n\n constructor(blueprints: Blueprint[]) {\n const seen = new Set<string>();\n blueprints.forEach((blueprint) => {\n if (seen.has(blueprint.key)) {\n log.warn('duplicate blueprint', { key: blueprint.key });\n } else {\n seen.add(blueprint.key);\n this._blueprints.push(blueprint);\n }\n });\n\n this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));\n }\n\n get blueprints(): Blueprint[] {\n return this._blueprints;\n }\n\n getByKey(key: string): Blueprint | undefined {\n return this._blueprints.find((blueprint) => blueprint.key === key);\n }\n\n query(): Blueprint[] {\n return this._blueprints;\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, JsonSchema, Obj, type Ref, Type } from '@dxos/echo';\n\nimport { Blueprint } from '../blueprint';\nimport * as Template from '../template';\n\n/**\n * Executable instructions, which may use Blueprints.\n * May reference additional context.\n */\nexport const Prompt = Schema.Struct({\n /**\n * Name of the prompt.\n */\n name: Schema.optional(Schema.String),\n\n /**\n * Description of the prompt's purpose and functionality.\n * Allows AI agents to execute prompts automatically as tools.\n */\n description: Schema.optional(Schema.String),\n\n /**\n * Input schema of the prompt.\n */\n input: JsonSchema.JsonSchema.pipe(Annotation.FormInputAnnotation.set(false)),\n\n /**\n * Output schema of the prompt.\n */\n output: JsonSchema.JsonSchema.pipe(Annotation.FormInputAnnotation.set(false)),\n\n /**\n * Natural language instructions for the prompt.\n * These should provide concrete course of action for the AI to follow.\n */\n instructions: Template.Template.pipe(Annotation.FormInputAnnotation.set(false)),\n\n /**\n * Blueprints that the prompt may utilize.\n */\n blueprints: Schema.Array(Type.Ref(Blueprint)),\n\n /**\n * Additional context that the prompt may utilize.\n */\n context: Schema.Array(Schema.Any).pipe(Annotation.FormInputAnnotation.set(false)),\n}).pipe(\n Type.object({\n typename: 'dxos.org/type/Prompt',\n version: '0.1.0',\n }),\n);\n\nexport interface Prompt extends Schema.Schema.Type<typeof Prompt> {}\n\nexport const make = (params: {\n name?: string;\n description?: string;\n input?: Schema.Schema.AnyNoContext;\n output?: Schema.Schema.AnyNoContext;\n instructions?: string;\n blueprints?: Ref.Ref<Blueprint>[];\n context?: any[];\n}): Prompt =>\n Obj.make(Prompt, {\n name: params.name,\n description: params.description,\n input: JsonSchema.toJsonSchema(params.input ?? Schema.Void),\n output: JsonSchema.toJsonSchema(params.output ?? Schema.Void),\n instructions: Template.make({ source: params.instructions }),\n blueprints: params.blueprints ?? [],\n context: params.context ?? [],\n });\n"],
5
+ "mappings": ";;;;;;;;AAAA;;;;cAAAA;EAAA;;;;ACIA,YAAYC,aAAY;AAExB,SAASC,cAAc;AACvB,SAASC,YAAYC,KAAKC,QAAAA,aAAY;;;ACPtC;;;;;;;;;;;ACIA,YAAYC,YAAY;AACxB,YAAYC,YAAY;AACxB,OAAOC,gBAAgB;AAEvB,SAASC,gBAAgB;AAEzB,SAEEC,iCAGK;AACP,SAASC,iBAAiB;AAC1B,SAASC,WAAW;;AAOb,IAAMC,UAAU,CAAqBC,QAAgBC,YAA8B,CAAC,MAAC;AAC1FJ,YAAU,OAAOG,WAAW,UAAA,QAAA;;;;;;;;;AAC5B,MAAIE,UAAU;AACdR,aAAWS,eAAe,WAAW,MAAMC,OAAO,EAAEF,OAAAA,CAAAA;AACpD,QAAMG,WAAWX,WAAWY,QAAQN,OAAOO,KAAI,CAAA;AAC/C,QAAMC,SAASH,SAASJ,SAAAA;AACxB,SAAOO,OAAOD,KAAI,EAAGE,QAAQ,gBAAgB,MAAA;AAC/C;AAEO,IAAMC,kBAAkB,CAC7BL,aAEOM,WAAI,aAAA;AACT,QAA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,CAAA;AAC7B,CAAA;",
6
+ "names": ["make", "Schema", "ToolId", "Annotation", "Obj", "Type", "Effect", "Record", "handlebars", "Database", "FunctionInvocationService", "invariant", "log", "process", "source", "variables", "section", "registerHelper", "String", "template", "compile", "trim", "output", "replace", "processTemplate", "gen", "functionInvoker", "forEach", "inputs", "input", "kind", "fn", "resolveFunction", "function", "result", "invokeFunction", "name", "dieMessage", "pipe", "map", "fromEntries", "Service", "load", "content", "Schema", "Ref", "Type", "Text", "InputKind", "Literal", "Input", "Struct", "name", "String", "kind", "optional", "default", "Any", "function", "Template", "source", "Type", "Ref", "Text", "annotations", "description", "inputs", "Array", "make", "id", "Blueprint", "Struct", "key", "String", "annotations", "description", "name", "optional", "instructions", "Template", "tools", "Array", "ToolId", "pipe", "Type", "object", "typename", "version", "Annotation", "LabelAnnotation", "set", "make", "props", "Obj", "toolDefinitions", "functions", "map", "fn", "tool", "log", "Registry", "_blueprints", "blueprints", "seen", "Set", "forEach", "blueprint", "has", "key", "warn", "add", "push", "sort", "name", "a", "b", "localeCompare", "getByKey", "find", "query", "make", "Schema", "Annotation", "JsonSchema", "Obj", "Type", "Prompt", "Struct", "name", "optional", "String", "description", "input", "JsonSchema", "pipe", "Annotation", "FormInputAnnotation", "set", "output", "instructions", "Template", "blueprints", "Array", "Type", "Ref", "Blueprint", "context", "Any", "object", "typename", "version", "make", "params", "Obj", "toJsonSchema", "Void", "source"]
7
7
  }