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

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,21 +4,19 @@ 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
- Registry: () => Registry
11
+ Registry: () => Registry,
12
+ make: () => make2
15
13
  });
16
14
 
17
15
  // src/blueprint/blueprint.ts
18
16
  import { Schema as Schema2 } from "effect";
19
17
  import { ToolId } from "@dxos/ai";
20
- import { Type as Type2 } from "@dxos/echo";
21
- import { LabelAnnotation as LabelAnnotation2 } from "@dxos/echo-schema";
18
+ import { Obj, Type as Type2 } from "@dxos/echo";
19
+ import { LabelAnnotation } from "@dxos/echo-schema";
22
20
 
23
21
  // src/template/index.ts
24
22
  var template_exports = {};
@@ -26,8 +24,8 @@ __export(template_exports, {
26
24
  Input: () => Input,
27
25
  InputKind: () => InputKind,
28
26
  Template: () => Template,
29
- createPrompt: () => createPrompt,
30
- make: () => make
27
+ make: () => make,
28
+ process: () => process
31
29
  });
32
30
 
33
31
  // src/template/prompt.ts
@@ -35,7 +33,7 @@ import handlebars from "handlebars";
35
33
  import defaultsDeep from "lodash.defaultsdeep";
36
34
  import { invariant } from "@dxos/invariant";
37
35
  var __dxlog_file = "/__w/dxos/dxos/packages/core/blueprints/src/template/prompt.ts";
38
- var createPrompt = (source, options = {}) => {
36
+ var process = (source, options = {}) => {
39
37
  invariant(source, void 0, {
40
38
  F: __dxlog_file,
41
39
  L: 14,
@@ -47,16 +45,15 @@ var createPrompt = (source, options = {}) => {
47
45
  });
48
46
  let section = 0;
49
47
  handlebars.registerHelper("section", () => String(++section));
50
- const template = handlebars.compile(source);
48
+ const template = handlebars.compile(source.trim());
51
49
  return template(defaultsDeep({}, options, {
52
50
  suggestions: true
53
- })).trim();
51
+ })).trim().replace(/(\n\s*){3,}/g, "\n\n");
54
52
  };
55
53
 
56
54
  // src/template/template.ts
57
55
  import { Schema } from "effect";
58
- import { Obj, Ref, Type } from "@dxos/echo";
59
- import { LabelAnnotation } from "@dxos/echo-schema";
56
+ import { Ref, Type } from "@dxos/echo";
60
57
  import { DataType } from "@dxos/schema";
61
58
  var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
62
59
  var Input = Schema.mutable(Schema.Struct({
@@ -65,25 +62,15 @@ var Input = Schema.mutable(Schema.Struct({
65
62
  default: Schema.optional(Schema.Any)
66
63
  }));
67
64
  var Template = Schema.Struct({
68
- name: Schema.optional(Schema.String),
69
65
  source: Type.Ref(DataType.Text).annotations({
70
66
  description: "Handlebars template source"
71
67
  }),
72
68
  inputs: Schema.optional(Schema.mutable(Schema.Array(Input)))
73
- }).pipe(Type.Obj({
74
- typename: "dxos.org/type/Template",
75
- version: "0.1.0"
76
- }), LabelAnnotation.set([
77
- "name"
78
- ]));
79
- var make = ({ source = "", ...props }) => {
80
- return Obj.make(Template, {
81
- source: Ref.make(Obj.make(DataType.Text, {
82
- content: source
83
- })),
84
- ...props
85
- });
86
- };
69
+ }).pipe(Schema.mutable);
70
+ var make = ({ source, inputs = [] }) => ({
71
+ source: Ref.make(DataType.makeText(source)),
72
+ inputs
73
+ });
87
74
 
88
75
  // src/blueprint/blueprint.ts
89
76
  var Blueprint = Schema2.Struct({
@@ -111,7 +98,7 @@ var Blueprint = Schema2.Struct({
111
98
  * Instructions that guide the AI assistant's behavior and responses.
112
99
  * These are system prompts or guidelines that the AI should follow.
113
100
  */
114
- instructions: Type2.Ref(Template).annotations({
101
+ instructions: Template.annotations({
115
102
  description: "Instructions that guide the AI assistant's behavior and responses"
116
103
  }),
117
104
  /**
@@ -127,15 +114,37 @@ var Blueprint = Schema2.Struct({
127
114
  version: "0.1.0"
128
115
  }),
129
116
  // TODO(burdon): Move to Type.Obj def?
130
- LabelAnnotation2.set([
117
+ LabelAnnotation.set([
131
118
  "name"
132
119
  ])
133
120
  );
121
+ var make2 = ({ tools = [], ...props }) => Obj.make(Blueprint, {
122
+ tools,
123
+ ...props
124
+ });
134
125
 
135
126
  // src/blueprint/registry.ts
127
+ import { log } from "@dxos/log";
128
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/core/blueprints/src/blueprint/registry.ts";
136
129
  var Registry = class {
137
- constructor(_blueprints) {
138
- this._blueprints = _blueprints;
130
+ _blueprints = [];
131
+ constructor(blueprints) {
132
+ const seen = /* @__PURE__ */ new Set();
133
+ blueprints.forEach((blueprint) => {
134
+ if (seen.has(blueprint.key)) {
135
+ log.warn("duplicate blueprint", {
136
+ key: blueprint.key
137
+ }, {
138
+ F: __dxlog_file2,
139
+ L: 19,
140
+ S: this,
141
+ C: (f, a) => f(...a)
142
+ });
143
+ } else {
144
+ seen.add(blueprint.key);
145
+ this._blueprints.push(blueprint);
146
+ }
147
+ });
139
148
  this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
140
149
  }
141
150
  getByKey(key) {
@@ -147,7 +156,6 @@ var Registry = class {
147
156
  };
148
157
  export {
149
158
  blueprint_exports as Blueprint,
150
- template_exports as Template,
151
- defineArtifact
159
+ template_exports as Template
152
160
  };
153
161
  //# 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 { Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo-schema';\n\nimport { Template } from '../template';\n\n/**\n * Blueprint schema defines the structure for AI assistant blueprints.\n * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.\n * Blueprints may use tools to create and read artifacts, which are managed by the assistant.\n */\nexport const Blueprint = Schema.Struct({\n /**\n * Global registry ID.\n * NOTE: The `key` property refers to the original registry entry.\n */\n // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.\n key: Schema.String.annotations({\n description: 'Unique registration key for the blueprint',\n }),\n\n /**\n * Human-readable name of the blueprint.\n */\n name: Schema.String.annotations({\n description: 'Human-readable name of the blueprint',\n }),\n\n /**\n * Description of the blueprint's purpose and functionality.\n */\n description: Schema.optional(Schema.String).annotations({\n description: \"Description of the blueprint's purpose and functionality\",\n }),\n\n /**\n * Instructions that guide the AI assistant's behavior and responses.\n * These are system prompts or guidelines that the AI should follow.\n */\n instructions: Type.Ref(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// 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 { Obj, Ref, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo-schema';\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 name: Schema.optional(Schema.String),\n source: Type.Ref(DataType.Text).annotations({ description: 'Handlebars template source' }),\n inputs: Schema.optional(Schema.mutable(Schema.Array(Input))),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Template',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n);\n\nexport interface Template extends Schema.Schema.Type<typeof Template> {}\n\n/**\n * Creates a template.\n */\nexport const make = ({ source = '', ...props }: Partial<Omit<Template, 'source'> & { source: string }>) => {\n return Obj.make(Template, {\n source: Ref.make(Obj.make(DataType.Text, { content: source })),\n ...props,\n });\n};\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,QAAAA,aAAY;AACrB,SAASC,mBAAAA,wBAAuB;;;ACRhC;;;;;;;;;;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,S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,MAAKC,IAAIC,QAAAA,EAAUP,YAAY;IAC3CC,aAAa;EACf,CAAA;;;;EAKAO,OAAOZ,QAAOa,MAAMC,MAAAA,EAAQV,YAAY;IACtCC,aAAa;EACf,CAAA;AACF,CAAA,EAAGU;EACDN,MAAKO,IAAI;;IAEPC,UAAU;IACVC,SAAS;EACX,CAAA;;EAGAC,iBAAgBC,IAAI;IAAC;GAAO;AAAA;;;AItDvB,IAAMC,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", "Type", "LabelAnnotation", "handlebars", "defaultsDeep", "invariant", "createPrompt", "source", "options", "section", "registerHelper", "String", "template", "compile", "suggestions", "trim", "Schema", "Obj", "Ref", "Type", "LabelAnnotation", "DataType", "InputKind", "Schema", "Literal", "Input", "mutable", "Struct", "name", "String", "kind", "optional", "default", "Any", "Template", "source", "Type", "Ref", "DataType", "Text", "annotations", "description", "inputs", "Array", "pipe", "Obj", "typename", "version", "LabelAnnotation", "set", "make", "props", "content", "Blueprint", "Schema", "Struct", "key", "String", "annotations", "description", "name", "optional", "instructions", "Type", "Ref", "Template", "tools", "Array", "ToolId", "pipe", "Obj", "typename", "version", "LabelAnnotation", "set", "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';\n\nimport { Template } from '../template';\n\n/**\n * Blueprint schema defines the structure for AI assistant blueprints.\n * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.\n * Blueprints may use tools to create and read artifacts, which are managed by the assistant.\n */\nexport const Blueprint = Schema.Struct({\n /**\n * Global registry ID.\n * NOTE: The `key` property refers to the original registry entry.\n */\n // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.\n key: Schema.String.annotations({\n description: 'Unique registration key for the blueprint',\n }),\n\n /**\n * Human-readable name of the blueprint.\n */\n name: Schema.String.annotations({\n description: 'Human-readable name of the blueprint',\n }),\n\n /**\n * Description of the blueprint's purpose and functionality.\n */\n description: Schema.optional(Schema.String).annotations({\n description: \"Description of the blueprint's purpose and functionality\",\n }),\n\n /**\n * Instructions that guide the AI assistant's behavior and responses.\n * These are system prompts or guidelines that the AI should follow.\n */\n instructions: Template.annotations({\n description: \"Instructions that guide the AI assistant's behavior and responses\",\n }),\n\n /**\n * Array of tools that the AI assistant can use when this blueprint is active.\n */\n tools: Schema.Array(ToolId).annotations({\n description: 'Array of tools that the AI assistant can use when this blueprint is active',\n }),\n}).pipe(\n Type.Obj({\n // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.\n typename: 'dxos.org/type/Blueprint',\n version: '0.1.0',\n }),\n\n // TODO(burdon): Move to Type.Obj def?\n LabelAnnotation.set(['name']),\n);\n\n/**\n * TypeScript type for Blueprint.\n */\nexport interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {}\n\n/**\n * Create a new Blueprint.\n */\nexport const make = ({ tools = [], ...props }: Pick<Blueprint, 'key' | 'name' | 'instructions'> & Partial<Blueprint>) =>\n Obj.make(Blueprint, { tools, ...props });\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\nexport * from './template';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport handlebars from 'handlebars';\nimport defaultsDeep from 'lodash.defaultsdeep';\n\nimport { invariant } from '@dxos/invariant';\n\n/**\n * Process Handlebars template.\n */\nexport const process = <Options extends {}>(source: string, options: Options = {} as Options): string => {\n invariant(source);\n let section = 0;\n handlebars.registerHelper('section', () => String(++section));\n const template = handlebars.compile(source.trim());\n return template(defaultsDeep({}, options, { suggestions: true }))\n .trim()\n .replace(/(\\n\\s*){3,}/g, '\\n\\n');\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Ref, Type } from '@dxos/echo';\nimport { DataType } from '@dxos/schema';\n\n/**\n * Template input kind determines how template variables are resolved.\n */\nexport const InputKind = Schema.Literal(\n 'value', // Literal value.\n 'pass-through',\n 'retriever',\n 'function',\n 'query',\n 'resolver',\n 'context',\n 'schema',\n);\n\nexport type InputKind = Schema.Schema.Type<typeof InputKind>;\n\n/**\n * Template input variable.\n * E.g., {{foo}}\n */\nexport const Input = Schema.mutable(\n Schema.Struct({\n name: Schema.String,\n kind: Schema.optional(InputKind),\n default: Schema.optional(Schema.Any),\n }),\n);\n\nexport type Input = Schema.Schema.Type<typeof Input>;\n\n/**\n * Template type.\n */\nexport const Template = Schema.Struct({\n source: Type.Ref(DataType.Text).annotations({ description: 'Handlebars template source' }),\n inputs: Schema.optional(Schema.mutable(Schema.Array(Input))),\n}).pipe(Schema.mutable);\n\nexport interface Template extends Schema.Schema.Type<typeof Template> {}\n\nexport const make = ({ source, inputs = [] }: { source: string; inputs?: Input[] }): Template => ({\n source: Ref.make(DataType.makeText(source)),\n inputs,\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { log } from '@dxos/log';\n\nimport { type Blueprint } from './blueprint';\n\n/**\n * Blueprint registry.\n */\nexport class Registry {\n private readonly _blueprints: Blueprint[] = [];\n\n constructor(blueprints: Blueprint[]) {\n const seen = new Set<string>();\n blueprints.forEach((blueprint) => {\n if (seen.has(blueprint.key)) {\n log.warn('duplicate blueprint', { key: blueprint.key });\n } else {\n seen.add(blueprint.key);\n this._blueprints.push(blueprint);\n }\n });\n\n this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));\n }\n\n getByKey(key: string): Blueprint | undefined {\n return this._blueprints.find((blueprint) => blueprint.key === key);\n }\n\n query(): Blueprint[] {\n return this._blueprints;\n }\n}\n"],
5
+ "mappings": ";;;;;;;AAAA;;;;cAAAA;;;;ACIA,SAASC,UAAAA,eAAc;AAEvB,SAASC,cAAc;AACvB,SAASC,KAAKC,QAAAA,aAAY;AAC1B,SAASC,uBAAuB;;;ACRhC;;;;;;;;;;ACIA,OAAOC,gBAAgB;AACvB,OAAOC,kBAAkB;AAEzB,SAASC,iBAAiB;;AAKnB,IAAMC,UAAU,CAAqBC,QAAgBC,UAAmB,CAAC,MAAY;AAC1FH,YAAUE,QAAAA,QAAAA;;;;;;;;;AACV,MAAIE,UAAU;AACdN,aAAWO,eAAe,WAAW,MAAMC,OAAO,EAAEF,OAAAA,CAAAA;AACpD,QAAMG,WAAWT,WAAWU,QAAQN,OAAOO,KAAI,CAAA;AAC/C,SAAOF,SAASR,aAAa,CAAC,GAAGI,SAAS;IAAEO,aAAa;EAAK,CAAA,CAAA,EAC3DD,KAAI,EACJE,QAAQ,gBAAgB,MAAA;AAC7B;;;AChBA,SAASC,cAAc;AAEvB,SAASC,KAAKC,YAAY;AAC1B,SAASC,gBAAgB;AAKlB,IAAMC,YAAYC,OAAOC,QAC9B,SACA,gBACA,aACA,YACA,SACA,YACA,WACA,QAAA;AASK,IAAMC,QAAQF,OAAOG,QAC1BH,OAAOI,OAAO;EACZC,MAAML,OAAOM;EACbC,MAAMP,OAAOQ,SAAST,SAAAA;EACtBU,SAAST,OAAOQ,SAASR,OAAOU,GAAG;AACrC,CAAA,CAAA;AAQK,IAAMC,WAAWX,O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,UAAUE;QAAI,GAAA;;;;;;MACvD,OAAO;AACLL,aAAKO,IAAIJ,UAAUE,GAAG;AACtB,aAAKP,YAAYU,KAAKL,SAAAA;MACxB;IACF,CAAA;AAEA,SAAKL,YAAYW,KAAK,CAAC,EAAEC,MAAMC,EAAC,GAAI,EAAED,MAAME,EAAC,MAAOD,EAAEE,cAAcD,CAAAA,CAAAA;EACtE;EAEAE,SAAST,KAAoC;AAC3C,WAAO,KAAKP,YAAYiB,KAAK,CAACZ,cAAcA,UAAUE,QAAQA,GAAAA;EAChE;EAEAW,QAAqB;AACnB,WAAO,KAAKlB;EACd;AACF;",
6
+ "names": ["make", "Schema", "ToolId", "Obj", "Type", "LabelAnnotation", "handlebars", "defaultsDeep", "invariant", "process", "source", "options", "section", "registerHelper", "String", "template", "compile", "trim", "suggestions", "replace", "Schema", "Ref", "Type", "DataType", "InputKind", "Schema", "Literal", "Input", "mutable", "Struct", "name", "String", "kind", "optional", "default", "Any", "Template", "source", "Type", "Ref", "DataType", "Text", "annotations", "description", "inputs", "Array", "pipe", "make", "makeText", "Blueprint", "Schema", "Struct", "key", "String", "annotations", "description", "name", "optional", "instructions", "Template", "tools", "Array", "ToolId", "pipe", "Type", "Obj", "typename", "version", "LabelAnnotation", "set", "make", "props", "log", "Registry", "_blueprints", "blueprints", "seen", "Set", "forEach", "blueprint", "has", "key", "warn", "add", "push", "sort", "name", "a", "b", "localeCompare", "getByKey", "find", "query"]
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":5350,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@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":6427,"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":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":9767},"dist/lib/browser/index.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","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":119},"src/blueprint/blueprint.ts":{"bytesInOutput":1674},"src/template/index.ts":{"bytesInOutput":195},"src/template/prompt.ts":{"bytesInOutput":601},"src/template/template.ts":{"bytesInOutput":966},"src/blueprint/registry.ts":{"bytesInOutput":311}},"bytes":4434}}}
1
+ {"inputs":{"src/template/prompt.ts":{"bytes":2492,"imports":[{"path":"handlebars","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/template/template.ts":{"bytes":4245,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"src/template/index.ts":{"bytes":546,"imports":[{"path":"src/template/prompt.ts","kind":"import-statement","original":"./prompt"},{"path":"src/template/template.ts","kind":"import-statement","original":"./template"}],"format":"esm"},"src/blueprint/blueprint.ts":{"bytes":7015,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"src/template/index.ts","kind":"import-statement","original":"../template"}],"format":"esm"},"src/blueprint/registry.ts":{"bytes":3436,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/blueprint/index.ts":{"bytes":554,"imports":[{"path":"src/blueprint/blueprint.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/blueprint/registry.ts","kind":"import-statement","original":"./registry"}],"format":"esm"},"src/index.ts":{"bytes":673,"imports":[{"path":"src/blueprint/index.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"./template"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8774},"dist/lib/browser/index.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Blueprint","Template"],"entryPoint":"src/index.ts","inputs":{"src/blueprint/index.ts":{"bytesInOutput":140},"src/blueprint/blueprint.ts":{"bytesInOutput":1735},"src/template/index.ts":{"bytesInOutput":185},"src/template/prompt.ts":{"bytesInOutput":635},"src/template/template.ts":{"bytesInOutput":706},"src/blueprint/registry.ts":{"bytesInOutput":834},"src/index.ts":{"bytesInOutput":0}},"bytes":4715}}}
@@ -5,21 +5,19 @@ 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
- Registry: () => Registry
12
+ Registry: () => Registry,
13
+ make: () => make2
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 { Type as Type2 } from "@dxos/echo";
22
- import { LabelAnnotation as LabelAnnotation2 } from "@dxos/echo-schema";
19
+ import { Obj, Type as Type2 } from "@dxos/echo";
20
+ import { LabelAnnotation } from "@dxos/echo-schema";
23
21
 
24
22
  // src/template/index.ts
25
23
  var template_exports = {};
@@ -27,8 +25,8 @@ __export(template_exports, {
27
25
  Input: () => Input,
28
26
  InputKind: () => InputKind,
29
27
  Template: () => Template,
30
- createPrompt: () => createPrompt,
31
- make: () => make
28
+ make: () => make,
29
+ process: () => process
32
30
  });
33
31
 
34
32
  // src/template/prompt.ts
@@ -36,7 +34,7 @@ import handlebars from "handlebars";
36
34
  import defaultsDeep from "lodash.defaultsdeep";
37
35
  import { invariant } from "@dxos/invariant";
38
36
  var __dxlog_file = "/__w/dxos/dxos/packages/core/blueprints/src/template/prompt.ts";
39
- var createPrompt = (source, options = {}) => {
37
+ var process = (source, options = {}) => {
40
38
  invariant(source, void 0, {
41
39
  F: __dxlog_file,
42
40
  L: 14,
@@ -48,16 +46,15 @@ var createPrompt = (source, options = {}) => {
48
46
  });
49
47
  let section = 0;
50
48
  handlebars.registerHelper("section", () => String(++section));
51
- const template = handlebars.compile(source);
49
+ const template = handlebars.compile(source.trim());
52
50
  return template(defaultsDeep({}, options, {
53
51
  suggestions: true
54
- })).trim();
52
+ })).trim().replace(/(\n\s*){3,}/g, "\n\n");
55
53
  };
56
54
 
57
55
  // src/template/template.ts
58
56
  import { Schema } from "effect";
59
- import { Obj, Ref, Type } from "@dxos/echo";
60
- import { LabelAnnotation } from "@dxos/echo-schema";
57
+ import { Ref, Type } from "@dxos/echo";
61
58
  import { DataType } from "@dxos/schema";
62
59
  var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
63
60
  var Input = Schema.mutable(Schema.Struct({
@@ -66,25 +63,15 @@ var Input = Schema.mutable(Schema.Struct({
66
63
  default: Schema.optional(Schema.Any)
67
64
  }));
68
65
  var Template = Schema.Struct({
69
- name: Schema.optional(Schema.String),
70
66
  source: Type.Ref(DataType.Text).annotations({
71
67
  description: "Handlebars template source"
72
68
  }),
73
69
  inputs: Schema.optional(Schema.mutable(Schema.Array(Input)))
74
- }).pipe(Type.Obj({
75
- typename: "dxos.org/type/Template",
76
- version: "0.1.0"
77
- }), LabelAnnotation.set([
78
- "name"
79
- ]));
80
- var make = ({ source = "", ...props }) => {
81
- return Obj.make(Template, {
82
- source: Ref.make(Obj.make(DataType.Text, {
83
- content: source
84
- })),
85
- ...props
86
- });
87
- };
70
+ }).pipe(Schema.mutable);
71
+ var make = ({ source, inputs = [] }) => ({
72
+ source: Ref.make(DataType.makeText(source)),
73
+ inputs
74
+ });
88
75
 
89
76
  // src/blueprint/blueprint.ts
90
77
  var Blueprint = Schema2.Struct({
@@ -112,7 +99,7 @@ var Blueprint = Schema2.Struct({
112
99
  * Instructions that guide the AI assistant's behavior and responses.
113
100
  * These are system prompts or guidelines that the AI should follow.
114
101
  */
115
- instructions: Type2.Ref(Template).annotations({
102
+ instructions: Template.annotations({
116
103
  description: "Instructions that guide the AI assistant's behavior and responses"
117
104
  }),
118
105
  /**
@@ -128,15 +115,37 @@ var Blueprint = Schema2.Struct({
128
115
  version: "0.1.0"
129
116
  }),
130
117
  // TODO(burdon): Move to Type.Obj def?
131
- LabelAnnotation2.set([
118
+ LabelAnnotation.set([
132
119
  "name"
133
120
  ])
134
121
  );
122
+ var make2 = ({ tools = [], ...props }) => Obj.make(Blueprint, {
123
+ tools,
124
+ ...props
125
+ });
135
126
 
136
127
  // src/blueprint/registry.ts
128
+ import { log } from "@dxos/log";
129
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/core/blueprints/src/blueprint/registry.ts";
137
130
  var Registry = class {
138
- constructor(_blueprints) {
139
- this._blueprints = _blueprints;
131
+ _blueprints = [];
132
+ constructor(blueprints) {
133
+ const seen = /* @__PURE__ */ new Set();
134
+ blueprints.forEach((blueprint) => {
135
+ if (seen.has(blueprint.key)) {
136
+ log.warn("duplicate blueprint", {
137
+ key: blueprint.key
138
+ }, {
139
+ F: __dxlog_file2,
140
+ L: 19,
141
+ S: this,
142
+ C: (f, a) => f(...a)
143
+ });
144
+ } else {
145
+ seen.add(blueprint.key);
146
+ this._blueprints.push(blueprint);
147
+ }
148
+ });
140
149
  this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
141
150
  }
142
151
  getByKey(key) {
@@ -148,7 +157,6 @@ var Registry = class {
148
157
  };
149
158
  export {
150
159
  blueprint_exports as Blueprint,
151
- template_exports as Template,
152
- defineArtifact
160
+ template_exports as Template
153
161
  };
154
162
  //# 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 { Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo-schema';\n\nimport { Template } from '../template';\n\n/**\n * Blueprint schema defines the structure for AI assistant blueprints.\n * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.\n * Blueprints may use tools to create and read artifacts, which are managed by the assistant.\n */\nexport const Blueprint = Schema.Struct({\n /**\n * Global registry ID.\n * NOTE: The `key` property refers to the original registry entry.\n */\n // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.\n key: Schema.String.annotations({\n description: 'Unique registration key for the blueprint',\n }),\n\n /**\n * Human-readable name of the blueprint.\n */\n name: Schema.String.annotations({\n description: 'Human-readable name of the blueprint',\n }),\n\n /**\n * Description of the blueprint's purpose and functionality.\n */\n description: Schema.optional(Schema.String).annotations({\n description: \"Description of the blueprint's purpose and functionality\",\n }),\n\n /**\n * Instructions that guide the AI assistant's behavior and responses.\n * These are system prompts or guidelines that the AI should follow.\n */\n instructions: Type.Ref(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// 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 { Obj, Ref, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo-schema';\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 name: Schema.optional(Schema.String),\n source: Type.Ref(DataType.Text).annotations({ description: 'Handlebars template source' }),\n inputs: Schema.optional(Schema.mutable(Schema.Array(Input))),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Template',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n);\n\nexport interface Template extends Schema.Schema.Type<typeof Template> {}\n\n/**\n * Creates a template.\n */\nexport const make = ({ source = '', ...props }: Partial<Omit<Template, 'source'> & { source: string }>) => {\n return Obj.make(Template, {\n source: Ref.make(Obj.make(DataType.Text, { content: source })),\n ...props,\n });\n};\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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,MAAAA,MAA+D;AACpG,SAAON,IAAIK,KAAKhB,UAAU;IACxBC,QAAQE,IAAIa,KAAKL,IAAIK,KAAKZ,SAASC,MAAM;MAAEa,SAASjB;IAAO,CAAA,CAAA;IAC3D,GAAGgB;EACL,CAAA;AACF;;;AHhDO,IAAME,YAAYC,QAAOC,OAAO;;;;;;EAMrCC,KAAKF,QAAOG,OAAOC,YAAY;IAC7BC,aAAa;EACf,CAAA;;;;EAKAC,MAAMN,QAAOG,OAAOC,YAAY;IAC9BC,aAAa;EACf,CAAA;;;;EAKAA,aAAaL,QAAOO,SAASP,QAAOG,MAAM,EAAEC,YAAY;IACtDC,aAAa;EACf,CAAA;;;;;EAMAG,cAAcC,MAAKC,IAAIC,QAAAA,EAAUP,YAAY;IAC3CC,aAAa;EACf,CAAA;;;;EAKAO,OAAOZ,QAAOa,MAAMC,MAAAA,EAAQV,YAAY;IACtCC,aAAa;EACf,CAAA;AACF,CAAA,EAAGU;EACDN,MAAKO,IAAI;;IAEPC,UAAU;IACVC,SAAS;EACX,CAAA;;EAGAC,iBAAgBC,IAAI;IAAC;GAAO;AAAA;;;AItDvB,IAAMC,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", "Type", "LabelAnnotation", "handlebars", "defaultsDeep", "invariant", "createPrompt", "source", "options", "section", "registerHelper", "String", "template", "compile", "suggestions", "trim", "Schema", "Obj", "Ref", "Type", "LabelAnnotation", "DataType", "InputKind", "Schema", "Literal", "Input", "mutable", "Struct", "name", "String", "kind", "optional", "default", "Any", "Template", "source", "Type", "Ref", "DataType", "Text", "annotations", "description", "inputs", "Array", "pipe", "Obj", "typename", "version", "LabelAnnotation", "set", "make", "props", "content", "Blueprint", "Schema", "Struct", "key", "String", "annotations", "description", "name", "optional", "instructions", "Type", "Ref", "Template", "tools", "Array", "ToolId", "pipe", "Obj", "typename", "version", "LabelAnnotation", "set", "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';\n\nimport { Template } from '../template';\n\n/**\n * Blueprint schema defines the structure for AI assistant blueprints.\n * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.\n * Blueprints may use tools to create and read artifacts, which are managed by the assistant.\n */\nexport const Blueprint = Schema.Struct({\n /**\n * Global registry ID.\n * NOTE: The `key` property refers to the original registry entry.\n */\n // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.\n key: Schema.String.annotations({\n description: 'Unique registration key for the blueprint',\n }),\n\n /**\n * Human-readable name of the blueprint.\n */\n name: Schema.String.annotations({\n description: 'Human-readable name of the blueprint',\n }),\n\n /**\n * Description of the blueprint's purpose and functionality.\n */\n description: Schema.optional(Schema.String).annotations({\n description: \"Description of the blueprint's purpose and functionality\",\n }),\n\n /**\n * Instructions that guide the AI assistant's behavior and responses.\n * These are system prompts or guidelines that the AI should follow.\n */\n instructions: Template.annotations({\n description: \"Instructions that guide the AI assistant's behavior and responses\",\n }),\n\n /**\n * Array of tools that the AI assistant can use when this blueprint is active.\n */\n tools: Schema.Array(ToolId).annotations({\n description: 'Array of tools that the AI assistant can use when this blueprint is active',\n }),\n}).pipe(\n Type.Obj({\n // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.\n typename: 'dxos.org/type/Blueprint',\n version: '0.1.0',\n }),\n\n // TODO(burdon): Move to Type.Obj def?\n LabelAnnotation.set(['name']),\n);\n\n/**\n * TypeScript type for Blueprint.\n */\nexport interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {}\n\n/**\n * Create a new Blueprint.\n */\nexport const make = ({ tools = [], ...props }: Pick<Blueprint, 'key' | 'name' | 'instructions'> & Partial<Blueprint>) =>\n Obj.make(Blueprint, { tools, ...props });\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\nexport * from './template';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport handlebars from 'handlebars';\nimport defaultsDeep from 'lodash.defaultsdeep';\n\nimport { invariant } from '@dxos/invariant';\n\n/**\n * Process Handlebars template.\n */\nexport const process = <Options extends {}>(source: string, options: Options = {} as Options): string => {\n invariant(source);\n let section = 0;\n handlebars.registerHelper('section', () => String(++section));\n const template = handlebars.compile(source.trim());\n return template(defaultsDeep({}, options, { suggestions: true }))\n .trim()\n .replace(/(\\n\\s*){3,}/g, '\\n\\n');\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Ref, Type } from '@dxos/echo';\nimport { DataType } from '@dxos/schema';\n\n/**\n * Template input kind determines how template variables are resolved.\n */\nexport const InputKind = Schema.Literal(\n 'value', // Literal value.\n 'pass-through',\n 'retriever',\n 'function',\n 'query',\n 'resolver',\n 'context',\n 'schema',\n);\n\nexport type InputKind = Schema.Schema.Type<typeof InputKind>;\n\n/**\n * Template input variable.\n * E.g., {{foo}}\n */\nexport const Input = Schema.mutable(\n Schema.Struct({\n name: Schema.String,\n kind: Schema.optional(InputKind),\n default: Schema.optional(Schema.Any),\n }),\n);\n\nexport type Input = Schema.Schema.Type<typeof Input>;\n\n/**\n * Template type.\n */\nexport const Template = Schema.Struct({\n source: Type.Ref(DataType.Text).annotations({ description: 'Handlebars template source' }),\n inputs: Schema.optional(Schema.mutable(Schema.Array(Input))),\n}).pipe(Schema.mutable);\n\nexport interface Template extends Schema.Schema.Type<typeof Template> {}\n\nexport const make = ({ source, inputs = [] }: { source: string; inputs?: Input[] }): Template => ({\n source: Ref.make(DataType.makeText(source)),\n inputs,\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { log } from '@dxos/log';\n\nimport { type Blueprint } from './blueprint';\n\n/**\n * Blueprint registry.\n */\nexport class Registry {\n private readonly _blueprints: Blueprint[] = [];\n\n constructor(blueprints: Blueprint[]) {\n const seen = new Set<string>();\n blueprints.forEach((blueprint) => {\n if (seen.has(blueprint.key)) {\n log.warn('duplicate blueprint', { key: blueprint.key });\n } else {\n seen.add(blueprint.key);\n this._blueprints.push(blueprint);\n }\n });\n\n this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));\n }\n\n getByKey(key: string): Blueprint | undefined {\n return this._blueprints.find((blueprint) => blueprint.key === key);\n }\n\n query(): Blueprint[] {\n return this._blueprints;\n }\n}\n"],
5
+ "mappings": ";;;;;;;;AAAA;;;;cAAAA;;;;ACIA,SAASC,UAAAA,eAAc;AAEvB,SAASC,cAAc;AACvB,SAASC,KAAKC,QAAAA,aAAY;AAC1B,SAASC,uBAAuB;;;ACRhC;;;;;;;;;;ACIA,OAAOC,gBAAgB;AACvB,OAAOC,kBAAkB;AAEzB,SAASC,iBAAiB;;AAKnB,IAAMC,UAAU,CAAqBC,QAAgBC,UAAmB,CAAC,MAAY;AAC1FH,YAAUE,QAAAA,QAAAA;;;;;;;;;AACV,MAAIE,UAAU;AACdN,aAAWO,eAAe,WAAW,MAAMC,OAAO,EAAEF,OAAAA,CAAAA;AACpD,QAAMG,WAAWT,WAAWU,QAAQN,OAAOO,KAAI,CAAA;AAC/C,SAAOF,SA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C,SAAS;EACX,CAAA;;EAGAC,gBAAgBC,IAAI;IAAC;GAAO;AAAA;AAWvB,IAAMC,QAAO,CAAC,EAAEV,QAAQ,CAAA,GAAI,GAAGW,MAAAA,MACpCN,IAAIK,KAAKrB,WAAW;EAAEW;EAAO,GAAGW;AAAM,CAAA;;;AIvExC,SAASC,WAAW;;AAOb,IAAMC,WAAN,MAAMA;EACMC,cAA2B,CAAA;EAE5C,YAAYC,YAAyB;AACnC,UAAMC,OAAO,oBAAIC,IAAAA;AACjBF,eAAWG,QAAQ,CAACC,cAAAA;AAClB,UAAIH,KAAKI,IAAID,UAAUE,GAAG,GAAG;AAC3BT,YAAIU,KAAK,uBAAuB;UAAED,KAAKF,UAAUE;QAAI,GAAA;;;;;;MACvD,OAAO;AACLL,aAAKO,IAAIJ,UAAUE,GAAG;AACtB,aAAKP,YAAYU,KAAKL,SAAAA;MACxB;IACF,CAAA;AAEA,SAAKL,YAAYW,KAAK,CAAC,EAAEC,MAAMC,EAAC,GAAI,EAAED,MAAME,EAAC,MAAOD,EAAEE,cAAcD,CAAAA,CAAAA;EACtE;EAEAE,SAAST,KAAoC;AAC3C,WAAO,KAAKP,YAAYiB,KAAK,CAACZ,cAAcA,UAAUE,QAAQA,GAAAA;EAChE;EAEAW,QAAqB;AACnB,WAAO,KAAKlB;EACd;AACF;",
6
+ "names": ["make", "Schema", "ToolId", "Obj", "Type", "LabelAnnotation", "handlebars", "defaultsDeep", "invariant", "process", "source", "options", "section", "registerHelper", "String", "template", "compile", "trim", "suggestions", "replace", "Schema", "Ref", "Type", "DataType", "InputKind", "Schema", "Literal", "Input", "mutable", "Struct", "name", "String", "kind", "optional", "default", "Any", "Template", "source", "Type", "Ref", "DataType", "Text", "annotations", "description", "inputs", "Array", "pipe", "make", "makeText", "Blueprint", "Schema", "Struct", "key", "String", "annotations", "description", "name", "optional", "instructions", "Template", "tools", "Array", "ToolId", "pipe", "Type", "Obj", "typename", "version", "LabelAnnotation", "set", "make", "props", "log", "Registry", "_blueprints", "blueprints", "seen", "Set", "forEach", "blueprint", "has", "key", "warn", "add", "push", "sort", "name", "a", "b", "localeCompare", "getByKey", "find", "query"]
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":5350,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@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":6427,"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":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":9768},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","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":119},"src/blueprint/blueprint.ts":{"bytesInOutput":1674},"src/template/index.ts":{"bytesInOutput":195},"src/template/prompt.ts":{"bytesInOutput":601},"src/template/template.ts":{"bytesInOutput":966},"src/blueprint/registry.ts":{"bytesInOutput":311}},"bytes":4526}}}
1
+ {"inputs":{"src/template/prompt.ts":{"bytes":2492,"imports":[{"path":"handlebars","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/template/template.ts":{"bytes":4245,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"src/template/index.ts":{"bytes":546,"imports":[{"path":"src/template/prompt.ts","kind":"import-statement","original":"./prompt"},{"path":"src/template/template.ts","kind":"import-statement","original":"./template"}],"format":"esm"},"src/blueprint/blueprint.ts":{"bytes":7015,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"src/template/index.ts","kind":"import-statement","original":"../template"}],"format":"esm"},"src/blueprint/registry.ts":{"bytes":3436,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/blueprint/index.ts":{"bytes":554,"imports":[{"path":"src/blueprint/blueprint.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/blueprint/registry.ts","kind":"import-statement","original":"./registry"}],"format":"esm"},"src/index.ts":{"bytes":673,"imports":[{"path":"src/blueprint/index.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"./template"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8775},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Blueprint","Template"],"entryPoint":"src/index.ts","inputs":{"src/blueprint/index.ts":{"bytesInOutput":140},"src/blueprint/blueprint.ts":{"bytesInOutput":1735},"src/template/index.ts":{"bytesInOutput":185},"src/template/prompt.ts":{"bytesInOutput":635},"src/template/template.ts":{"bytesInOutput":706},"src/blueprint/registry.ts":{"bytesInOutput":834},"src/index.ts":{"bytesInOutput":0}},"bytes":4807}}}
@@ -23,17 +23,16 @@ export declare const Blueprint: Type.obj<Schema.Struct<{
23
23
  * Instructions that guide the AI assistant's behavior and responses.
24
24
  * These are system prompts or guidelines that the AI should follow.
25
25
  */
26
- instructions: Schema.SchemaClass<import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
27
- name?: string | undefined;
28
- source: import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
26
+ instructions: Schema.mutable<Schema.Struct<{
27
+ source: Schema.SchemaClass<import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
29
28
  content: string;
30
- }>;
31
- inputs?: {
32
- name: string;
33
- kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
34
- default?: any;
35
- }[] | undefined;
36
- }>, import("@dxos/echo-protocol").EncodedReference, never>;
29
+ }>, import("@dxos/echo-protocol").EncodedReference, never>;
30
+ inputs: Schema.optional<Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
31
+ name: typeof Schema.String;
32
+ kind: Schema.optional<Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>>;
33
+ default: Schema.optional<typeof Schema.Any>;
34
+ }>>>>>;
35
+ }>>;
37
36
  /**
38
37
  * Array of tools that the AI assistant can use when this blueprint is active.
39
38
  */
@@ -44,4 +43,23 @@ export declare const Blueprint: Type.obj<Schema.Struct<{
44
43
  */
45
44
  export interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {
46
45
  }
46
+ /**
47
+ * Create a new Blueprint.
48
+ */
49
+ export declare const make: ({ tools, ...props }: Pick<Blueprint, "key" | "name" | "instructions"> & Partial<Blueprint>) => import("@dxos/live-object").Live<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
50
+ key: string;
51
+ name: string;
52
+ description?: string | undefined;
53
+ instructions: {
54
+ source: import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
55
+ content: string;
56
+ }>;
57
+ inputs?: {
58
+ name: string;
59
+ kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
60
+ default?: any;
61
+ }[] | undefined;
62
+ };
63
+ tools: (string & import("effect/Brand").Brand<"ToolId">)[];
64
+ }>;
47
65
  //# 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,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKlC;;;;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"}
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;AAKvC;;;;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"}
@@ -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, options?: 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":"AASA;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,SAAS,EAAE,EAAE,QAAQ,MAAM,EAAE,UAAS,OAAuB,KAAG,MAQ9F,CAAC"}