@dxos/blueprints 0.8.4-main.5acf9ea → 0.8.4-main.5ea62a8

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.
@@ -4,24 +4,20 @@ var __export = (target, all) => {
4
4
  __defProp(target, name, { get: all[name], enumerable: true });
5
5
  };
6
6
 
7
- // src/artifacts.ts
8
- var defineArtifact = (definition) => definition;
9
-
10
7
  // src/blueprint/index.ts
11
8
  var blueprint_exports = {};
12
9
  __export(blueprint_exports, {
13
10
  Blueprint: () => Blueprint,
14
11
  Registry: () => Registry,
15
- make: () => make
12
+ make: () => make2,
13
+ toolDefinitions: () => toolDefinitions
16
14
  });
17
15
 
18
16
  // src/blueprint/blueprint.ts
19
17
  import { Schema as Schema2 } from "effect";
20
18
  import { ToolId } from "@dxos/ai";
21
- import { Obj, Ref, Type as Type2 } from "@dxos/echo";
19
+ import { Obj, Type as Type2 } from "@dxos/echo";
22
20
  import { LabelAnnotation } from "@dxos/echo-schema";
23
- import { PublicKey } from "@dxos/keys";
24
- import { DataType as DataType2 } from "@dxos/schema";
25
21
 
26
22
  // src/template/index.ts
27
23
  var template_exports = {};
@@ -29,18 +25,18 @@ __export(template_exports, {
29
25
  Input: () => Input,
30
26
  InputKind: () => InputKind,
31
27
  Template: () => Template,
32
- createPrompt: () => createPrompt
28
+ make: () => make,
29
+ process: () => process
33
30
  });
34
31
 
35
32
  // src/template/prompt.ts
36
33
  import handlebars from "handlebars";
37
- import defaultsDeep from "lodash.defaultsdeep";
38
34
  import { invariant } from "@dxos/invariant";
39
35
  var __dxlog_file = "/__w/dxos/dxos/packages/core/blueprints/src/template/prompt.ts";
40
- var createPrompt = (source, options = {}) => {
36
+ var process = (source, variables = {}) => {
41
37
  invariant(source, void 0, {
42
38
  F: __dxlog_file,
43
- L: 14,
39
+ L: 13,
44
40
  S: void 0,
45
41
  A: [
46
42
  "source",
@@ -49,15 +45,14 @@ var createPrompt = (source, options = {}) => {
49
45
  });
50
46
  let section = 0;
51
47
  handlebars.registerHelper("section", () => String(++section));
52
- const template = handlebars.compile(source);
53
- return template(defaultsDeep({}, options, {
54
- suggestions: true
55
- })).trim();
48
+ const template = handlebars.compile(source.trim());
49
+ const output = template(variables);
50
+ return output.trim().replace(/(\n\s*){3,}/g, "\n\n");
56
51
  };
57
52
 
58
53
  // src/template/template.ts
59
54
  import { Schema } from "effect";
60
- import { Type } from "@dxos/echo";
55
+ import { Ref, Type } from "@dxos/echo";
61
56
  import { DataType } from "@dxos/schema";
62
57
  var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
63
58
  var Input = Schema.mutable(Schema.Struct({
@@ -71,6 +66,10 @@ var Template = Schema.Struct({
71
66
  }),
72
67
  inputs: Schema.optional(Schema.mutable(Schema.Array(Input)))
73
68
  }).pipe(Schema.mutable);
69
+ var make = ({ source, inputs = [], id }) => ({
70
+ source: Ref.make(DataType.makeText(source, id)),
71
+ inputs
72
+ });
74
73
 
75
74
  // src/blueprint/blueprint.ts
76
75
  var Blueprint = Schema2.Struct({
@@ -118,35 +117,61 @@ var Blueprint = Schema2.Struct({
118
117
  "name"
119
118
  ])
120
119
  );
121
- var make = ({ key = `example.com/blueprint/${PublicKey.random().truncate()}`, name, description, instructions = {
122
- source: ""
123
- }, tools = [] }) => Obj.make(Blueprint, {
124
- key,
125
- name,
126
- description,
127
- instructions: {
128
- source: Ref.make(DataType2.makeText(instructions.source)),
129
- inputs: instructions.inputs
130
- },
131
- tools
120
+ var make2 = ({ tools = [], ...props }) => Obj.make(Blueprint, {
121
+ tools,
122
+ ...props
132
123
  });
124
+ var toolDefinitions = ({ tools = [], functions = [] }) => [
125
+ ...functions.map((fn) => ToolId.make(fn.name)),
126
+ ...tools.map((tool) => ToolId.make(tool))
127
+ ];
133
128
 
134
129
  // src/blueprint/registry.ts
135
- var Registry = class {
136
- constructor(_blueprints) {
137
- this._blueprints = _blueprints;
138
- this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
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;
139
141
  }
142
+ return obj;
143
+ }
144
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/core/blueprints/src/blueprint/registry.ts";
145
+ var Registry = class {
140
146
  getByKey(key) {
141
147
  return this._blueprints.find((blueprint) => blueprint.key === key);
142
148
  }
143
149
  query() {
144
150
  return this._blueprints;
145
151
  }
152
+ constructor(blueprints) {
153
+ _define_property(this, "_blueprints", []);
154
+ const seen = /* @__PURE__ */ new Set();
155
+ blueprints.forEach((blueprint) => {
156
+ if (seen.has(blueprint.key)) {
157
+ log.warn("duplicate blueprint", {
158
+ key: blueprint.key
159
+ }, {
160
+ F: __dxlog_file2,
161
+ L: 19,
162
+ S: this,
163
+ C: (f, a) => f(...a)
164
+ });
165
+ } else {
166
+ seen.add(blueprint.key);
167
+ this._blueprints.push(blueprint);
168
+ }
169
+ });
170
+ this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
171
+ }
146
172
  };
147
173
  export {
148
174
  blueprint_exports as Blueprint,
149
- template_exports as Template,
150
- defineArtifact
175
+ template_exports as Template
151
176
  };
152
177
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/artifacts.ts", "../../../src/blueprint/index.ts", "../../../src/blueprint/blueprint.ts", "../../../src/template/index.ts", "../../../src/template/prompt.ts", "../../../src/template/template.ts", "../../../src/blueprint/registry.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Schema } from 'effect';\n\nimport { type ExecutableTool } from '@dxos/ai';\nimport { type SpaceId } from '@dxos/keys';\n\n/**\n * @deprecated\n */\n// TODO(burdon): Replace with Ref.\nexport type AssociatedArtifact = {\n spaceId: SpaceId;\n typename: string;\n id: string;\n};\n\n/**\n * Static artifact definition.\n * @deprecated\n */\n// TODO(burdon): Convert to effect schema.\nexport type ArtifactDefinition = {\n // TODO(wittjosiah): Is this actually an ObjectId or should it be a uri?\n // TODO(burdon): Plugin id?\n id: string;\n\n /**\n * Name.\n */\n name: string;\n\n /**\n * Description.\n */\n description?: string;\n\n /**\n * Instructions for how to use the artifact.\n */\n // TODO(burdon): Reference template object.\n instructions: string;\n\n /**\n * Schema that describes the shape of data which matches the artifact.\n */\n schema: Schema.Schema.AnyNoContext;\n\n /**\n * Tools that can be used to act on data which matches the artifact.\n */\n tools: ExecutableTool[];\n\n // TODO(wittjosiah): Add `component` field for rendering data which matches the artifact?\n // NOTE(burdon): I think that could just be provided separately by the plugin (since there might be multiple surface types).\n};\n\nexport const defineArtifact = (definition: ArtifactDefinition): ArtifactDefinition => definition;\n", "//\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, Ref, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo-schema';\nimport { PublicKey } from '@dxos/keys';\nimport { DataType } from '@dxos/schema';\n\nimport { Template } from '../template';\n\n/**\n * Blueprint schema defines the structure for AI assistant blueprints.\n * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.\n * Blueprints may use tools to create and read artifacts, which are managed by the assistant.\n */\nexport const Blueprint = Schema.Struct({\n /**\n * Global registry ID.\n * NOTE: The `key` property refers to the original registry entry.\n */\n // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.\n key: Schema.String.annotations({\n description: 'Unique registration key for the blueprint',\n }),\n\n /**\n * Human-readable name of the blueprint.\n */\n name: Schema.String.annotations({\n description: 'Human-readable name of the blueprint',\n }),\n\n /**\n * Description of the blueprint's purpose and functionality.\n */\n description: Schema.optional(Schema.String).annotations({\n description: \"Description of the blueprint's purpose and functionality\",\n }),\n\n /**\n * Instructions that guide the AI assistant's behavior and responses.\n * These are system prompts or guidelines that the AI should follow.\n */\n instructions: Template.annotations({\n description: \"Instructions that guide the AI assistant's behavior and responses\",\n }),\n\n /**\n * Array of tools that the AI assistant can use when this blueprint is active.\n */\n tools: Schema.Array(ToolId).annotations({\n description: 'Array of tools that the AI assistant can use when this blueprint is active',\n }),\n}).pipe(\n Type.Obj({\n // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.\n typename: 'dxos.org/type/Blueprint',\n version: '0.1.0',\n }),\n\n // TODO(burdon): Move to Type.Obj def?\n LabelAnnotation.set(['name']),\n);\n\n/**\n * TypeScript type for Blueprint.\n */\nexport interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {}\n\n/**\n * Create a new Blueprint.\n */\nexport const make = ({\n key = `example.com/blueprint/${PublicKey.random().truncate()}`,\n name,\n description,\n instructions = { source: '' },\n tools = [],\n}: Pick<Blueprint, 'name'> &\n Omit<Partial<Blueprint>, 'name' | 'instructions'> & {\n instructions?: Omit<Partial<Template>, 'source'> & { source: string };\n }) =>\n Obj.make(Blueprint, {\n key,\n name,\n description,\n instructions: {\n source: Ref.make(DataType.makeText(instructions.source)),\n inputs: instructions.inputs,\n },\n tools,\n });\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\nexport * from './template';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport handlebars from 'handlebars';\nimport defaultsDeep from 'lodash.defaultsdeep';\n\nimport { invariant } from '@dxos/invariant';\n\n/**\n * Process Handlebars template.\n */\nexport const createPrompt = <Options extends {}>(source: string, options: Options = {} as Options): string => {\n invariant(source);\n let section = 0;\n handlebars.registerHelper('section', () => String(++section));\n const template = handlebars.compile(source);\n return template(defaultsDeep({}, options, { suggestions: true })).trim();\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Type } from '@dxos/echo';\nimport { DataType } from '@dxos/schema';\n\n/**\n * Template input kind determines how template variables are resolved.\n */\nexport const InputKind = Schema.Literal(\n 'value', // Literal value.\n 'pass-through',\n 'retriever',\n 'function',\n 'query',\n 'resolver',\n 'context',\n 'schema',\n);\n\nexport type InputKind = Schema.Schema.Type<typeof InputKind>;\n\n/**\n * Template input variable.\n * E.g., {{foo}}\n */\nexport const Input = Schema.mutable(\n Schema.Struct({\n name: Schema.String,\n kind: Schema.optional(InputKind),\n default: Schema.optional(Schema.Any),\n }),\n);\n\nexport type Input = Schema.Schema.Type<typeof Input>;\n\n/**\n * Template type.\n */\nexport const Template = Schema.Struct({\n source: Type.Ref(DataType.Text).annotations({ description: 'Handlebars template source' }),\n inputs: Schema.optional(Schema.mutable(Schema.Array(Input))),\n}).pipe(Schema.mutable);\n\nexport interface Template extends Schema.Schema.Type<typeof Template> {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Blueprint } from './blueprint';\n\n/**\n * Blueprint registry.\n */\nexport class Registry {\n constructor(private readonly _blueprints: Blueprint[]) {\n this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));\n }\n\n getByKey(key: string): Blueprint | undefined {\n return this._blueprints.find((blueprint) => blueprint.key === key);\n }\n\n query(): Blueprint[] {\n return this._blueprints;\n }\n}\n"],
5
- "mappings": ";;;;;;;AA2DO,IAAMA,iBAAiB,CAACC,eAAuDA;;;AC3DtF;;;;;;;;ACIA,SAASC,UAAAA,eAAc;AAEvB,SAASC,cAAc;AACvB,SAASC,KAAKC,KAAKC,QAAAA,aAAY;AAC/B,SAASC,uBAAuB;AAChC,SAASC,iBAAiB;AAC1B,SAASC,YAAAA,iBAAgB;;;ACVzB;;;;;;;;;ACIA,OAAOC,gBAAgB;AACvB,OAAOC,kBAAkB;AAEzB,SAASC,iBAAiB;;AAKnB,IAAMC,eAAe,CAAqBC,QAAgBC,UAAmB,CAAC,MAAY;AAC/FH,YAAUE,QAAAA,QAAAA;;;;;;;;;AACV,MAAIE,UAAU;AACdN,aAAWO,eAA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AMC,OAAO,CAAC,EACnBlB,MAAM,yBAAyBmB,UAAUC,OAAM,EAAGC,SAAQ,CAAA,IAC1DjB,MACAD,aACAG,eAAe;EAAEgB,QAAQ;AAAG,GAC5Bd,QAAQ,CAAA,EAAE,MAKVK,IAAIK,KAAKrB,WAAW;EAClBG;EACAI;EACAD;EACAG,cAAc;IACZgB,QAAQC,IAAIL,KAAKM,UAASC,SAASnB,aAAagB,MAAM,CAAA;IACtDI,QAAQpB,aAAaoB;EACvB;EACAlB;AACF,CAAA;;;AItFK,IAAMmB,WAAN,MAAMA;EACX,YAA6BC,aAA0B;SAA1BA,cAAAA;AAC3B,SAAKA,YAAYC,KAAK,CAAC,EAAEC,MAAMC,EAAC,GAAI,EAAED,MAAME,EAAC,MAAOD,EAAEE,cAAcD,CAAAA,CAAAA;EACtE;EAEAE,SAASC,KAAoC;AAC3C,WAAO,KAAKP,YAAYQ,KAAK,CAACC,cAAcA,UAAUF,QAAQA,GAAAA;EAChE;EAEAG,QAAqB;AACnB,WAAO,KAAKV;EACd;AACF;",
6
- "names": ["defineArtifact", "definition", "Schema", "ToolId", "Obj", "Ref", "Type", "LabelAnnotation", "PublicKey", "DataType", "handlebars", "defaultsDeep", "invariant", "createPrompt", "source", "options", "section", "registerHelper", "String", "template", "compile", "suggestions", "trim", "Schema", "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", "Blueprint", "Schema", "Struct", "key", "String", "annotations", "description", "name", "optional", "instructions", "Template", "tools", "Array", "ToolId", "pipe", "Type", "Obj", "typename", "version", "LabelAnnotation", "set", "make", "PublicKey", "random", "truncate", "source", "Ref", "DataType", "makeText", "inputs", "Registry", "_blueprints", "sort", "name", "a", "b", "localeCompare", "getByKey", "key", "find", "blueprint", "query"]
3
+ "sources": ["../../../src/blueprint/index.ts", "../../../src/blueprint/blueprint.ts", "../../../src/template/index.ts", "../../../src/template/prompt.ts", "../../../src/template/template.ts", "../../../src/blueprint/registry.ts"],
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.name)), ...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(source);\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"],
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,YAAUE,QAAAA,QAAAA;;;;;;;;;AACV,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,SAASC,cAAc;AAEvB,SAASC,KAAKC,YAAY;AAE1B,SAASC,gBAAgB;AAKlB,IAAMC,YAAYC,OAAOC,QAC9B,SACA,gB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BAAkB,CAAC,EAC9BZ,QAAQ,CAAA,GACRa,YAAY,CAAA,EAAE,MAIV;KAAIA,UAAUC,IAAI,CAACC,OAAOb,OAAOQ,KAAKK,GAAGnB,IAAI,CAAA;KAAOI,MAAMc,IAAI,CAACE,SAASd,OAAOQ,KAAKM,IAAAA,CAAAA;;;;AInF1F,SAASC,WAAW;;;;;;;;;;;;;;;AAOb,IAAMC,WAAN,MAAMA;EAiBXC,SAASC,KAAoC;AAC3C,WAAO,KAAKC,YAAYC,KAAK,CAACC,cAAcA,UAAUH,QAAQA,GAAAA;EAChE;EAEAI,QAAqB;AACnB,WAAO,KAAKH;EACd;EApBA,YAAYI,YAAyB;AAFrC,qBAAA,MAAiBJ,eAA2B,CAAA,CAAE;AAG5C,UAAMK,OAAO,oBAAIC,IAAAA;AACjBF,eAAWG,QAAQ,CAACL,cAAAA;AAClB,UAAIG,KAAKG,IAAIN,UAAUH,GAAG,GAAG;AAC3BH,YAAIa,KAAK,uBAAuB;UAAEV,KAAKG,UAAUH;QAAI,GAAA;;;;;;MACvD,OAAO;AACLM,aAAKK,IAAIR,UAAUH,GAAG;AACtB,aAAKC,YAAYW,KAAKT,SAAAA;MACxB;IACF,CAAA;AAEA,SAAKF,YAAYY,KAAK,CAAC,EAAEC,MAAMC,EAAC,GAAI,EAAED,MAAME,EAAC,MAAOD,EAAEE,cAAcD,CAAAA,CAAAA;EACtE;AASF;",
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"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/artifacts.ts":{"bytes":2355,"imports":[],"format":"esm"},"src/template/prompt.ts":{"bytes":2338,"imports":[{"path":"handlebars","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/template/template.ts":{"bytes":3654,"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":8476,"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":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"src/template/index.ts","kind":"import-statement","original":"../template"}],"format":"esm"},"src/blueprint/registry.ts":{"bytes":1958,"imports":[],"format":"esm"},"src/blueprint/index.ts":{"bytes":554,"imports":[{"path":"src/blueprint/blueprint.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/blueprint/registry.ts","kind":"import-statement","original":"./registry"}],"format":"esm"},"src/index.ts":{"bytes":762,"imports":[{"path":"src/artifacts.ts","kind":"import-statement","original":"./artifacts"},{"path":"src/blueprint/index.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"./template"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9962},"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":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"exports":["Blueprint","Template","defineArtifact"],"entryPoint":"src/index.ts","inputs":{"src/artifacts.ts":{"bytesInOutput":49},"src/index.ts":{"bytesInOutput":0},"src/blueprint/index.ts":{"bytesInOutput":139},"src/blueprint/blueprint.ts":{"bytesInOutput":2075},"src/template/index.ts":{"bytesInOutput":175},"src/template/prompt.ts":{"bytesInOutput":601},"src/template/template.ts":{"bytesInOutput":598},"src/blueprint/registry.ts":{"bytesInOutput":311}},"bytes":4467}}}
1
+ {"inputs":{"src/template/prompt.ts":{"bytes":2238,"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":8075,"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/index.ts":{"bytes":673,"imports":[{"path":"src/blueprint/index.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"./template"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9348},"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}],"exports":["Blueprint","Template"],"entryPoint":"src/index.ts","inputs":{"src/blueprint/index.ts":{"bytesInOutput":182},"src/blueprint/blueprint.ts":{"bytesInOutput":1892},"src/template/index.ts":{"bytesInOutput":185},"src/template/prompt.ts":{"bytesInOutput":569},"src/template/template.ts":{"bytesInOutput":714},"src/blueprint/registry.ts":{"bytesInOutput":1109},"src/index.ts":{"bytesInOutput":0}},"bytes":5131}}}
@@ -5,24 +5,20 @@ var __export = (target, all) => {
5
5
  __defProp(target, name, { get: all[name], enumerable: true });
6
6
  };
7
7
 
8
- // src/artifacts.ts
9
- var defineArtifact = (definition) => definition;
10
-
11
8
  // src/blueprint/index.ts
12
9
  var blueprint_exports = {};
13
10
  __export(blueprint_exports, {
14
11
  Blueprint: () => Blueprint,
15
12
  Registry: () => Registry,
16
- make: () => make
13
+ make: () => make2,
14
+ toolDefinitions: () => toolDefinitions
17
15
  });
18
16
 
19
17
  // src/blueprint/blueprint.ts
20
18
  import { Schema as Schema2 } from "effect";
21
19
  import { ToolId } from "@dxos/ai";
22
- import { Obj, Ref, Type as Type2 } from "@dxos/echo";
20
+ import { Obj, Type as Type2 } from "@dxos/echo";
23
21
  import { LabelAnnotation } from "@dxos/echo-schema";
24
- import { PublicKey } from "@dxos/keys";
25
- import { DataType as DataType2 } from "@dxos/schema";
26
22
 
27
23
  // src/template/index.ts
28
24
  var template_exports = {};
@@ -30,18 +26,18 @@ __export(template_exports, {
30
26
  Input: () => Input,
31
27
  InputKind: () => InputKind,
32
28
  Template: () => Template,
33
- createPrompt: () => createPrompt
29
+ make: () => make,
30
+ process: () => process
34
31
  });
35
32
 
36
33
  // src/template/prompt.ts
37
34
  import handlebars from "handlebars";
38
- import defaultsDeep from "lodash.defaultsdeep";
39
35
  import { invariant } from "@dxos/invariant";
40
36
  var __dxlog_file = "/__w/dxos/dxos/packages/core/blueprints/src/template/prompt.ts";
41
- var createPrompt = (source, options = {}) => {
37
+ var process = (source, variables = {}) => {
42
38
  invariant(source, void 0, {
43
39
  F: __dxlog_file,
44
- L: 14,
40
+ L: 13,
45
41
  S: void 0,
46
42
  A: [
47
43
  "source",
@@ -50,15 +46,14 @@ var createPrompt = (source, options = {}) => {
50
46
  });
51
47
  let section = 0;
52
48
  handlebars.registerHelper("section", () => String(++section));
53
- const template = handlebars.compile(source);
54
- return template(defaultsDeep({}, options, {
55
- suggestions: true
56
- })).trim();
49
+ const template = handlebars.compile(source.trim());
50
+ const output = template(variables);
51
+ return output.trim().replace(/(\n\s*){3,}/g, "\n\n");
57
52
  };
58
53
 
59
54
  // src/template/template.ts
60
55
  import { Schema } from "effect";
61
- import { Type } from "@dxos/echo";
56
+ import { Ref, Type } from "@dxos/echo";
62
57
  import { DataType } from "@dxos/schema";
63
58
  var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
64
59
  var Input = Schema.mutable(Schema.Struct({
@@ -72,6 +67,10 @@ var Template = Schema.Struct({
72
67
  }),
73
68
  inputs: Schema.optional(Schema.mutable(Schema.Array(Input)))
74
69
  }).pipe(Schema.mutable);
70
+ var make = ({ source, inputs = [], id }) => ({
71
+ source: Ref.make(DataType.makeText(source, id)),
72
+ inputs
73
+ });
75
74
 
76
75
  // src/blueprint/blueprint.ts
77
76
  var Blueprint = Schema2.Struct({
@@ -119,35 +118,61 @@ var Blueprint = Schema2.Struct({
119
118
  "name"
120
119
  ])
121
120
  );
122
- var make = ({ key = `example.com/blueprint/${PublicKey.random().truncate()}`, name, description, instructions = {
123
- source: ""
124
- }, tools = [] }) => Obj.make(Blueprint, {
125
- key,
126
- name,
127
- description,
128
- instructions: {
129
- source: Ref.make(DataType2.makeText(instructions.source)),
130
- inputs: instructions.inputs
131
- },
132
- tools
121
+ var make2 = ({ tools = [], ...props }) => Obj.make(Blueprint, {
122
+ tools,
123
+ ...props
133
124
  });
125
+ var toolDefinitions = ({ tools = [], functions = [] }) => [
126
+ ...functions.map((fn) => ToolId.make(fn.name)),
127
+ ...tools.map((tool) => ToolId.make(tool))
128
+ ];
134
129
 
135
130
  // src/blueprint/registry.ts
136
- var Registry = class {
137
- constructor(_blueprints) {
138
- this._blueprints = _blueprints;
139
- this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
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;
140
142
  }
143
+ return obj;
144
+ }
145
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/core/blueprints/src/blueprint/registry.ts";
146
+ var Registry = class {
141
147
  getByKey(key) {
142
148
  return this._blueprints.find((blueprint) => blueprint.key === key);
143
149
  }
144
150
  query() {
145
151
  return this._blueprints;
146
152
  }
153
+ constructor(blueprints) {
154
+ _define_property(this, "_blueprints", []);
155
+ const seen = /* @__PURE__ */ new Set();
156
+ blueprints.forEach((blueprint) => {
157
+ if (seen.has(blueprint.key)) {
158
+ log.warn("duplicate blueprint", {
159
+ key: blueprint.key
160
+ }, {
161
+ F: __dxlog_file2,
162
+ L: 19,
163
+ S: this,
164
+ C: (f, a) => f(...a)
165
+ });
166
+ } else {
167
+ seen.add(blueprint.key);
168
+ this._blueprints.push(blueprint);
169
+ }
170
+ });
171
+ this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
172
+ }
147
173
  };
148
174
  export {
149
175
  blueprint_exports as Blueprint,
150
- template_exports as Template,
151
- defineArtifact
176
+ template_exports as Template
152
177
  };
153
178
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/artifacts.ts", "../../../src/blueprint/index.ts", "../../../src/blueprint/blueprint.ts", "../../../src/template/index.ts", "../../../src/template/prompt.ts", "../../../src/template/template.ts", "../../../src/blueprint/registry.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Schema } from 'effect';\n\nimport { type ExecutableTool } from '@dxos/ai';\nimport { type SpaceId } from '@dxos/keys';\n\n/**\n * @deprecated\n */\n// TODO(burdon): Replace with Ref.\nexport type AssociatedArtifact = {\n spaceId: SpaceId;\n typename: string;\n id: string;\n};\n\n/**\n * Static artifact definition.\n * @deprecated\n */\n// TODO(burdon): Convert to effect schema.\nexport type ArtifactDefinition = {\n // TODO(wittjosiah): Is this actually an ObjectId or should it be a uri?\n // TODO(burdon): Plugin id?\n id: string;\n\n /**\n * Name.\n */\n name: string;\n\n /**\n * Description.\n */\n description?: string;\n\n /**\n * Instructions for how to use the artifact.\n */\n // TODO(burdon): Reference template object.\n instructions: string;\n\n /**\n * Schema that describes the shape of data which matches the artifact.\n */\n schema: Schema.Schema.AnyNoContext;\n\n /**\n * Tools that can be used to act on data which matches the artifact.\n */\n tools: ExecutableTool[];\n\n // TODO(wittjosiah): Add `component` field for rendering data which matches the artifact?\n // NOTE(burdon): I think that could just be provided separately by the plugin (since there might be multiple surface types).\n};\n\nexport const defineArtifact = (definition: ArtifactDefinition): ArtifactDefinition => definition;\n", "//\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, Ref, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo-schema';\nimport { PublicKey } from '@dxos/keys';\nimport { DataType } from '@dxos/schema';\n\nimport { Template } from '../template';\n\n/**\n * Blueprint schema defines the structure for AI assistant blueprints.\n * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.\n * Blueprints may use tools to create and read artifacts, which are managed by the assistant.\n */\nexport const Blueprint = Schema.Struct({\n /**\n * Global registry ID.\n * NOTE: The `key` property refers to the original registry entry.\n */\n // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.\n key: Schema.String.annotations({\n description: 'Unique registration key for the blueprint',\n }),\n\n /**\n * Human-readable name of the blueprint.\n */\n name: Schema.String.annotations({\n description: 'Human-readable name of the blueprint',\n }),\n\n /**\n * Description of the blueprint's purpose and functionality.\n */\n description: Schema.optional(Schema.String).annotations({\n description: \"Description of the blueprint's purpose and functionality\",\n }),\n\n /**\n * Instructions that guide the AI assistant's behavior and responses.\n * These are system prompts or guidelines that the AI should follow.\n */\n instructions: Template.annotations({\n description: \"Instructions that guide the AI assistant's behavior and responses\",\n }),\n\n /**\n * Array of tools that the AI assistant can use when this blueprint is active.\n */\n tools: Schema.Array(ToolId).annotations({\n description: 'Array of tools that the AI assistant can use when this blueprint is active',\n }),\n}).pipe(\n Type.Obj({\n // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.\n typename: 'dxos.org/type/Blueprint',\n version: '0.1.0',\n }),\n\n // TODO(burdon): Move to Type.Obj def?\n LabelAnnotation.set(['name']),\n);\n\n/**\n * TypeScript type for Blueprint.\n */\nexport interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {}\n\n/**\n * Create a new Blueprint.\n */\nexport const make = ({\n key = `example.com/blueprint/${PublicKey.random().truncate()}`,\n name,\n description,\n instructions = { source: '' },\n tools = [],\n}: Pick<Blueprint, 'name'> &\n Omit<Partial<Blueprint>, 'name' | 'instructions'> & {\n instructions?: Omit<Partial<Template>, 'source'> & { source: string };\n }) =>\n Obj.make(Blueprint, {\n key,\n name,\n description,\n instructions: {\n source: Ref.make(DataType.makeText(instructions.source)),\n inputs: instructions.inputs,\n },\n tools,\n });\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\nexport * from './template';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport handlebars from 'handlebars';\nimport defaultsDeep from 'lodash.defaultsdeep';\n\nimport { invariant } from '@dxos/invariant';\n\n/**\n * Process Handlebars template.\n */\nexport const createPrompt = <Options extends {}>(source: string, options: Options = {} as Options): string => {\n invariant(source);\n let section = 0;\n handlebars.registerHelper('section', () => String(++section));\n const template = handlebars.compile(source);\n return template(defaultsDeep({}, options, { suggestions: true })).trim();\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Type } from '@dxos/echo';\nimport { DataType } from '@dxos/schema';\n\n/**\n * Template input kind determines how template variables are resolved.\n */\nexport const InputKind = Schema.Literal(\n 'value', // Literal value.\n 'pass-through',\n 'retriever',\n 'function',\n 'query',\n 'resolver',\n 'context',\n 'schema',\n);\n\nexport type InputKind = Schema.Schema.Type<typeof InputKind>;\n\n/**\n * Template input variable.\n * E.g., {{foo}}\n */\nexport const Input = Schema.mutable(\n Schema.Struct({\n name: Schema.String,\n kind: Schema.optional(InputKind),\n default: Schema.optional(Schema.Any),\n }),\n);\n\nexport type Input = Schema.Schema.Type<typeof Input>;\n\n/**\n * Template type.\n */\nexport const Template = Schema.Struct({\n source: Type.Ref(DataType.Text).annotations({ description: 'Handlebars template source' }),\n inputs: Schema.optional(Schema.mutable(Schema.Array(Input))),\n}).pipe(Schema.mutable);\n\nexport interface Template extends Schema.Schema.Type<typeof Template> {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Blueprint } from './blueprint';\n\n/**\n * Blueprint registry.\n */\nexport class Registry {\n constructor(private readonly _blueprints: Blueprint[]) {\n this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));\n }\n\n getByKey(key: string): Blueprint | undefined {\n return this._blueprints.find((blueprint) => blueprint.key === key);\n }\n\n query(): Blueprint[] {\n return this._blueprints;\n }\n}\n"],
5
- "mappings": ";;;;;;;;AA2DO,IAAMA,iBAAiB,CAACC,eAAuDA;;;AC3DtF;;;;;;;;ACIA,SAASC,UAAAA,eAAc;AAEvB,SAASC,cAAc;AACvB,SAASC,KAAKC,KAAKC,QAAAA,aAAY;AAC/B,SAASC,uBAAuB;AAChC,SAASC,iBAAiB;AAC1B,SAASC,YAAAA,iBAAgB;;;ACVzB;;;;;;;;;ACIA,OAAOC,gBAAgB;AACvB,OAAOC,kBAAkB;AAEzB,SAASC,iBAAiB;;AAKnB,IAAMC,eAAe,CAAqBC,QAAgBC,UAAmB,CAAC,MAAY;AAC/FH,YAAUE,QAAAA,QAAAA;;;;;;;;;AACV,MAAIE,UAAU;AACdN,aAAWO,eAAe,WAAW,MAAMC,OAAO,EAAEF,OAAAA,CAAAA;AACpD,QAAMG,WAAWT,WAAWU,QAAQN,MAAAA;AACpC,SAAOK,SAASR,aAAa,CAAC,GAAGI,SAAS;IAAEM,aAAa;EAAK,CAAA,CAAA,EAAIC,KAAI;AACxE;;;ACdA,SAASC,cAAc;AAEvB,SAASC,YAAY;AACrB,SAASC,gBAAgB;AAKlB,IAAMC,YAAYC,OAAOC,QAC9B,SACA,gBACA,aACA,YACA,SACA,YACA,WAC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lB;AACF,CAAA;;;AItFK,IAAMmB,WAAN,MAAMA;EACX,YAA6BC,aAA0B;SAA1BA,cAAAA;AAC3B,SAAKA,YAAYC,KAAK,CAAC,EAAEC,MAAMC,EAAC,GAAI,EAAED,MAAME,EAAC,MAAOD,EAAEE,cAAcD,CAAAA,CAAAA;EACtE;EAEAE,SAASC,KAAoC;AAC3C,WAAO,KAAKP,YAAYQ,KAAK,CAACC,cAAcA,UAAUF,QAAQA,GAAAA;EAChE;EAEAG,QAAqB;AACnB,WAAO,KAAKV;EACd;AACF;",
6
- "names": ["defineArtifact", "definition", "Schema", "ToolId", "Obj", "Ref", "Type", "LabelAnnotation", "PublicKey", "DataType", "handlebars", "defaultsDeep", "invariant", "createPrompt", "source", "options", "section", "registerHelper", "String", "template", "compile", "suggestions", "trim", "Schema", "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", "Blueprint", "Schema", "Struct", "key", "String", "annotations", "description", "name", "optional", "instructions", "Template", "tools", "Array", "ToolId", "pipe", "Type", "Obj", "typename", "version", "LabelAnnotation", "set", "make", "PublicKey", "random", "truncate", "source", "Ref", "DataType", "makeText", "inputs", "Registry", "_blueprints", "sort", "name", "a", "b", "localeCompare", "getByKey", "key", "find", "blueprint", "query"]
3
+ "sources": ["../../../src/blueprint/index.ts", "../../../src/blueprint/blueprint.ts", "../../../src/template/index.ts", "../../../src/template/prompt.ts", "../../../src/template/template.ts", "../../../src/blueprint/registry.ts"],
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.name)), ...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(source);\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"],
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,YAAUE,QAAAA,QAAAA;;;;;;;;;AACV,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,SAASC,cAAc;AAEvB,SAASC,KAAKC,YAAY;AAE1B,SAASC,gBAAgB;AAKlB,IAAMC,YAAYC,OAAOC,QAC9B,SACA,gBACA,aACA,YACA,SACA,YACA,WACA,QAAA;AASK,IAAMC,QAAQF,OAAOG,QAC1BH,OAAOI,OAAO;EACZC,MAAML,OAAOM;EACbC,MAAMP,OAAOQ,SAAST,SAAAA;EACtBU,SAAST,OAAOQ,SAASR,OAAOU,GAAG;AACrC,CAAA,CAAA;AAQK,IAAMC,WAAWX,OAAOI,OAAO;EACpCQ,QAAQC,KAAKC,IAAIC,SAASC,IAAI,EAAEC,YAAY;IAAEC,aAAa;EAA6B,CAA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AAYC,KAAK,CAACC,cAAcA,UAAUH,QAAQA,GAAAA;EAChE;EAEAI,QAAqB;AACnB,WAAO,KAAKH;EACd;EApBA,YAAYI,YAAyB;AAFrC,qBAAA,MAAiBJ,eAA2B,CAAA,CAAE;AAG5C,UAAMK,OAAO,oBAAIC,IAAAA;AACjBF,eAAWG,QAAQ,CAACL,cAAAA;AAClB,UAAIG,KAAKG,IAAIN,UAAUH,GAAG,GAAG;AAC3BH,YAAIa,KAAK,uBAAuB;UAAEV,KAAKG,UAAUH;QAAI,GAAA;;;;;;MACvD,OAAO;AACLM,aAAKK,IAAIR,UAAUH,GAAG;AACtB,aAAKC,YAAYW,KAAKT,SAAAA;MACxB;IACF,CAAA;AAEA,SAAKF,YAAYY,KAAK,CAAC,EAAEC,MAAMC,EAAC,GAAI,EAAED,MAAME,EAAC,MAAOD,EAAEE,cAAcD,CAAAA,CAAAA;EACtE;AASF;",
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"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/artifacts.ts":{"bytes":2355,"imports":[],"format":"esm"},"src/template/prompt.ts":{"bytes":2338,"imports":[{"path":"handlebars","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/template/template.ts":{"bytes":3654,"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":8476,"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":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"src/template/index.ts","kind":"import-statement","original":"../template"}],"format":"esm"},"src/blueprint/registry.ts":{"bytes":1958,"imports":[],"format":"esm"},"src/blueprint/index.ts":{"bytes":554,"imports":[{"path":"src/blueprint/blueprint.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/blueprint/registry.ts","kind":"import-statement","original":"./registry"}],"format":"esm"},"src/index.ts":{"bytes":762,"imports":[{"path":"src/artifacts.ts","kind":"import-statement","original":"./artifacts"},{"path":"src/blueprint/index.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"./template"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9963},"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":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"exports":["Blueprint","Template","defineArtifact"],"entryPoint":"src/index.ts","inputs":{"src/artifacts.ts":{"bytesInOutput":49},"src/index.ts":{"bytesInOutput":0},"src/blueprint/index.ts":{"bytesInOutput":139},"src/blueprint/blueprint.ts":{"bytesInOutput":2075},"src/template/index.ts":{"bytesInOutput":175},"src/template/prompt.ts":{"bytesInOutput":601},"src/template/template.ts":{"bytesInOutput":598},"src/blueprint/registry.ts":{"bytesInOutput":311}},"bytes":4559}}}
1
+ {"inputs":{"src/template/prompt.ts":{"bytes":2238,"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":8075,"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/index.ts":{"bytes":673,"imports":[{"path":"src/blueprint/index.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"./template"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9349},"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}],"exports":["Blueprint","Template"],"entryPoint":"src/index.ts","inputs":{"src/blueprint/index.ts":{"bytesInOutput":182},"src/blueprint/blueprint.ts":{"bytesInOutput":1892},"src/template/index.ts":{"bytesInOutput":185},"src/template/prompt.ts":{"bytesInOutput":569},"src/template/template.ts":{"bytesInOutput":714},"src/blueprint/registry.ts":{"bytesInOutput":1109},"src/index.ts":{"bytesInOutput":0}},"bytes":5223}}}
@@ -1,6 +1,6 @@
1
1
  import { Schema } from 'effect';
2
2
  import { Type } from '@dxos/echo';
3
- import { Template } from '../template';
3
+ import { type FunctionDefinition } from '@dxos/functions';
4
4
  /**
5
5
  * Blueprint schema defines the structure for AI assistant blueprints.
6
6
  * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.
@@ -47,11 +47,7 @@ export interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {
47
47
  /**
48
48
  * Create a new Blueprint.
49
49
  */
50
- export declare const make: ({ key, name, description, instructions, tools, }: Pick<Blueprint, "name"> & Omit<Partial<Blueprint>, "name" | "instructions"> & {
51
- instructions?: Omit<Partial<Template>, "source"> & {
52
- source: string;
53
- };
54
- }) => 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-schema").EntityKind.Object> & {
55
51
  key: string;
56
52
  name: string;
57
53
  description?: string | undefined;
@@ -67,4 +63,11 @@ export declare const make: ({ key, name, description, instructions, tools, }: Pi
67
63
  };
68
64
  tools: (string & import("effect/Brand").Brand<"ToolId">)[];
69
65
  }>;
66
+ /**
67
+ * Util to create tool definitions for a blueprint.
68
+ */
69
+ export declare const toolDefinitions: ({ tools, functions, }: {
70
+ tools?: string[];
71
+ functions?: FunctionDefinition[];
72
+ }) => (string & import("effect/Brand").Brand<"ToolId">)[];
70
73
  //# sourceMappingURL=blueprint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"blueprint.d.ts","sourceRoot":"","sources":["../../../../src/blueprint/blueprint.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAY,IAAI,EAAE,MAAM,YAAY,CAAC;AAK5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;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,kDAMlB,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,GACxB,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,GAAG;IAClD,YAAY,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CACvE;;;;;;;;;;;;;;;EAUC,CAAC"}
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,wDAAgG,CAAC"}
@@ -4,7 +4,7 @@ import { type Blueprint } from './blueprint';
4
4
  */
5
5
  export declare class Registry {
6
6
  private readonly _blueprints;
7
- constructor(_blueprints: Blueprint[]);
7
+ constructor(blueprints: Blueprint[]);
8
8
  getByKey(key: string): Blueprint | undefined;
9
9
  query(): Blueprint[];
10
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/blueprint/registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,SAAS,EAAE;IAIrD,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAI5C,KAAK,IAAI,SAAS,EAAE;CAGrB"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/blueprint/registry.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;gBAEnC,UAAU,EAAE,SAAS,EAAE;IAcnC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAI5C,KAAK,IAAI,SAAS,EAAE;CAGrB"}
@@ -1,4 +1,3 @@
1
- export * from './artifacts';
2
1
  export * as Blueprint from './blueprint';
3
2
  export * as Template from './template';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Process Handlebars template.
3
3
  */
4
- export declare const createPrompt: <Options extends {}>(source: string, options?: Options) => string;
4
+ export declare const process: <Options extends {}>(source: string, variables?: Partial<Options>) => string;
5
5
  //# sourceMappingURL=prompt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/template/prompt.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,SAAS,EAAE,EAAE,QAAQ,MAAM,EAAE,UAAS,OAAuB,KAAG,MAMnG,CAAC"}
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/template/prompt.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,SAAS,EAAE,EAAE,QAAQ,MAAM,EAAE,YAAW,OAAO,CAAC,OAAO,CAAM,KAAG,MAO9F,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { Schema } from 'effect';
2
2
  import { Type } from '@dxos/echo';
3
+ import { type ObjectId } from '@dxos/keys';
3
4
  /**
4
5
  * Template input kind determines how template variables are resolved.
5
6
  */
@@ -30,4 +31,9 @@ export declare const Template: Schema.mutable<Schema.Struct<{
30
31
  }>>;
31
32
  export interface Template extends Schema.Schema.Type<typeof Template> {
32
33
  }
34
+ export declare const make: ({ source, inputs, id }: {
35
+ source: string;
36
+ inputs?: Input[];
37
+ id?: ObjectId;
38
+ }) => Template;
33
39
  //# sourceMappingURL=template.d.ts.map
@@ -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,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGlC;;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,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