@dxos/blueprints 0.8.4-main.e8ec1fe → 0.8.4-main.ef1bc66f44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,8 +16,7 @@ __export(blueprint_exports, {
16
16
  // src/blueprint/blueprint.ts
17
17
  import * as Schema2 from "effect/Schema";
18
18
  import { ToolId } from "@dxos/ai";
19
- import { Obj, Type as Type2 } from "@dxos/echo";
20
- import { LabelAnnotation } from "@dxos/echo/internal";
19
+ import { Annotation, Obj, Type as Type2 } from "@dxos/echo";
21
20
 
22
21
  // src/template/index.ts
23
22
  var template_exports = {};
@@ -26,17 +25,23 @@ __export(template_exports, {
26
25
  InputKind: () => InputKind,
27
26
  Template: () => Template,
28
27
  make: () => make,
29
- process: () => process
28
+ process: () => process,
29
+ processTemplate: () => processTemplate
30
30
  });
31
31
 
32
32
  // src/template/prompt.ts
33
+ import * as Effect from "effect/Effect";
34
+ import * as Record from "effect/Record";
33
35
  import handlebars from "handlebars";
36
+ import { Database } from "@dxos/echo";
37
+ import { FunctionInvocationService } from "@dxos/functions";
34
38
  import { invariant } from "@dxos/invariant";
39
+ import { log } from "@dxos/log";
35
40
  var __dxlog_file = "/__w/dxos/dxos/packages/core/blueprints/src/template/prompt.ts";
36
41
  var process = (source, variables = {}) => {
37
42
  invariant(typeof source === "string", void 0, {
38
43
  F: __dxlog_file,
39
- L: 13,
44
+ L: 26,
40
45
  S: void 0,
41
46
  A: [
42
47
  "typeof source === 'string'",
@@ -49,23 +54,51 @@ var process = (source, variables = {}) => {
49
54
  const output = template(variables);
50
55
  return output.trim().replace(/(\n\s*){3,}/g, "\n\n");
51
56
  };
57
+ var processTemplate = (template) => Effect.gen(function* () {
58
+ const functionInvoker = yield* FunctionInvocationService;
59
+ const variables = yield* Effect.forEach(template.inputs ?? [], (input) => Effect.gen(function* () {
60
+ if (input.kind === "function") {
61
+ const fn = yield* functionInvoker.resolveFunction(input.function);
62
+ const result = yield* functionInvoker.invokeFunction(fn, {});
63
+ return [
64
+ input.name,
65
+ result
66
+ ];
67
+ } else {
68
+ return yield* Effect.dieMessage(`Unsupported input kind: ${input.kind}`);
69
+ }
70
+ })).pipe(Effect.map(Record.fromEntries));
71
+ log("processTemplate", {
72
+ variables
73
+ }, {
74
+ F: __dxlog_file,
75
+ L: 56,
76
+ S: this,
77
+ C: (f, a) => f(...a)
78
+ });
79
+ return process((yield* Database.load(template.source)).content, variables);
80
+ });
52
81
 
53
82
  // src/template/template.ts
54
83
  import * as Schema from "effect/Schema";
55
84
  import { Ref, Type } from "@dxos/echo";
56
85
  import { Text } from "@dxos/schema";
57
86
  var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
58
- var Input = Schema.mutable(Schema.Struct({
87
+ var Input = Schema.Struct({
59
88
  name: Schema.String,
60
89
  kind: Schema.optional(InputKind),
61
- default: Schema.optional(Schema.Any)
62
- }));
90
+ default: Schema.optional(Schema.Any),
91
+ /**
92
+ * Function to call if the kind is 'function'.
93
+ */
94
+ function: Schema.optional(Schema.String)
95
+ });
63
96
  var Template = Schema.Struct({
64
97
  source: Type.Ref(Text.Text).annotations({
65
98
  description: "Handlebars template source"
66
99
  }),
67
- inputs: Schema.optional(Schema.mutable(Schema.Array(Input)))
68
- }).pipe(Schema.mutable);
100
+ inputs: Schema.optional(Schema.Array(Input))
101
+ });
69
102
  var make = ({ source, inputs = [], id } = {}) => ({
70
103
  source: Ref.make(Text.make(source, id)),
71
104
  inputs
@@ -106,17 +139,13 @@ var Blueprint = Schema2.Struct({
106
139
  tools: Schema2.Array(ToolId).annotations({
107
140
  description: "Array of tools that the AI assistant can use when this blueprint is active"
108
141
  })
109
- }).pipe(
110
- Type2.Obj({
111
- // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.
112
- typename: "dxos.org/type/Blueprint",
113
- version: "0.1.0"
114
- }),
115
- // TODO(burdon): Move to Type.Obj def?
116
- LabelAnnotation.set([
117
- "name"
118
- ])
119
- );
142
+ }).pipe(Type2.object({
143
+ // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.
144
+ typename: "dxos.org/type/Blueprint",
145
+ version: "0.1.0"
146
+ }), Annotation.LabelAnnotation.set([
147
+ "name"
148
+ ]));
120
149
  var make2 = ({ tools = [], instructions = make(), ...props }) => Obj.make(Blueprint, {
121
150
  tools,
122
151
  instructions,
@@ -128,7 +157,7 @@ var toolDefinitions = ({ tools = [], functions = [] }) => [
128
157
  ];
129
158
 
130
159
  // src/blueprint/registry.ts
131
- import { log } from "@dxos/log";
160
+ import { log as log2 } from "@dxos/log";
132
161
  var __dxlog_file2 = "/__w/dxos/dxos/packages/core/blueprints/src/blueprint/registry.ts";
133
162
  var Registry = class {
134
163
  _blueprints = [];
@@ -136,7 +165,7 @@ var Registry = class {
136
165
  const seen = /* @__PURE__ */ new Set();
137
166
  blueprints.forEach((blueprint) => {
138
167
  if (seen.has(blueprint.key)) {
139
- log.warn("duplicate blueprint", {
168
+ log2.warn("duplicate blueprint", {
140
169
  key: blueprint.key
141
170
  }, {
142
171
  F: __dxlog_file2,
@@ -151,6 +180,9 @@ var Registry = class {
151
180
  });
152
181
  this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
153
182
  }
183
+ get blueprints() {
184
+ return this._blueprints;
185
+ }
154
186
  getByKey(key) {
155
187
  return this._blueprints.find((blueprint) => blueprint.key === key);
156
188
  }
@@ -168,9 +200,8 @@ __export(prompt_exports, {
168
200
 
169
201
  // src/prompt/prompt.ts
170
202
  import * as Schema3 from "effect/Schema";
171
- import { Obj as Obj2, Type as Type3 } from "@dxos/echo";
172
- import { FormAnnotation, JsonSchemaType, toJsonSchema } from "@dxos/echo/internal";
173
- var Prompt_ = Schema3.Struct({
203
+ import { Annotation as Annotation2, JsonSchema, Obj as Obj2, Type as Type3 } from "@dxos/echo";
204
+ var Prompt = Schema3.Struct({
174
205
  /**
175
206
  * Name of the prompt.
176
207
  */
@@ -183,16 +214,16 @@ var Prompt_ = Schema3.Struct({
183
214
  /**
184
215
  * Input schema of the prompt.
185
216
  */
186
- input: JsonSchemaType.pipe(FormAnnotation.set(false)),
217
+ input: JsonSchema.JsonSchema.pipe(Annotation2.FormInputAnnotation.set(false)),
187
218
  /**
188
219
  * Output schema of the prompt.
189
220
  */
190
- output: JsonSchemaType.pipe(FormAnnotation.set(false)),
221
+ output: JsonSchema.JsonSchema.pipe(Annotation2.FormInputAnnotation.set(false)),
191
222
  /**
192
223
  * Natural language instructions for the prompt.
193
224
  * These should provide concrete course of action for the AI to follow.
194
225
  */
195
- instructions: Template.pipe(FormAnnotation.set(false)),
226
+ instructions: Template.pipe(Annotation2.FormInputAnnotation.set(false)),
196
227
  /**
197
228
  * Blueprints that the prompt may utilize.
198
229
  */
@@ -200,17 +231,16 @@ var Prompt_ = Schema3.Struct({
200
231
  /**
201
232
  * Additional context that the prompt may utilize.
202
233
  */
203
- context: Schema3.Array(Schema3.Any).pipe(FormAnnotation.set(false))
204
- }).pipe(Type3.Obj({
234
+ context: Schema3.Array(Schema3.Any).pipe(Annotation2.FormInputAnnotation.set(false))
235
+ }).pipe(Type3.object({
205
236
  typename: "dxos.org/type/Prompt",
206
237
  version: "0.1.0"
207
238
  }));
208
- var Prompt = Prompt_;
209
239
  var make3 = (params) => Obj2.make(Prompt, {
210
240
  name: params.name,
211
241
  description: params.description,
212
- input: toJsonSchema(params.input ?? Schema3.Void),
213
- output: toJsonSchema(params.output ?? Schema3.Void),
242
+ input: JsonSchema.toJsonSchema(params.input ?? Schema3.Void),
243
+ output: JsonSchema.toJsonSchema(params.output ?? Schema3.Void),
214
244
  instructions: make({
215
245
  source: params.instructions
216
246
  }),
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/blueprint/index.ts", "../../../src/blueprint/blueprint.ts", "../../../src/template/index.ts", "../../../src/template/prompt.ts", "../../../src/template/template.ts", "../../../src/blueprint/registry.ts", "../../../src/prompt/index.ts", "../../../src/prompt/prompt.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './blueprint';\nexport * from './registry';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { ToolId } from '@dxos/ai';\nimport { Annotation, Obj, Type } from '@dxos/echo';\nimport { type FunctionDefinition } from '@dxos/functions';\n\nimport * as Template from '../template';\n\n/**\n * Blueprint schema defines the structure for AI assistant blueprints.\n * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.\n * Blueprints may use tools to create and read artifacts, which are managed by the assistant.\n */\nexport const Blueprint = Schema.Struct({\n /**\n * Global registry ID.\n * NOTE: The `key` property refers to the original registry entry.\n */\n // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.\n key: Schema.String.annotations({\n description: 'Unique registration key for the blueprint',\n }),\n\n /**\n * Human-readable name of the blueprint.\n */\n name: Schema.String.annotations({\n description: 'Human-readable name of the blueprint',\n }),\n\n /**\n * Description of the blueprint's purpose and functionality.\n */\n description: Schema.optional(Schema.String).annotations({\n description: \"Description of the blueprint's purpose and functionality\",\n }),\n\n /**\n * Instructions that guide the AI assistant's behavior and responses.\n * These are system prompts or guidelines that the AI should follow.\n */\n instructions: Template.Template.annotations({\n description: \"Instructions that guide the AI assistant's behavior and responses\",\n }),\n\n /**\n * Array of tools that the AI assistant can use when this blueprint is active.\n */\n tools: Schema.Array(ToolId).annotations({\n description: 'Array of tools that the AI assistant can use when this blueprint is active',\n }),\n}).pipe(\n Type.object({\n // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.\n typename: 'dxos.org/type/Blueprint',\n version: '0.1.0',\n }),\n Annotation.LabelAnnotation.set(['name']),\n);\n\n/**\n * TypeScript type for Blueprint.\n */\nexport interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {}\n\ntype MakeProps = Pick<Blueprint, 'key' | 'name'> & Partial<Blueprint>;\n\n/**\n * Create a new Blueprint.\n */\nexport const make = ({ tools = [], instructions = Template.make(), ...props }: MakeProps) =>\n Obj.make(Blueprint, {\n tools,\n instructions,\n ...props,\n });\n\n/**\n * Util to create tool definitions for a blueprint.\n */\nexport const toolDefinitions = ({\n tools = [],\n functions = [],\n}: {\n tools?: string[];\n functions?: FunctionDefinition[];\n}) => [...functions.map((fn) => ToolId.make(fn.key)), ...tools.map((tool) => ToolId.make(tool))];\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\nexport * from './template';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Record from 'effect/Record';\nimport handlebars from 'handlebars';\n\nimport { Database } from '@dxos/echo';\nimport type { ObjectNotFoundError } from '@dxos/echo/Err';\nimport {\n type FunctionDefinition,\n FunctionInvocationService,\n type FunctionNotFoundError,\n type TracingService,\n} from '@dxos/functions';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\n\nimport type { Template } from '..';\n\n/**\n * Process Handlebars template.\n */\nexport const process = <Options extends {}>(source: string, variables: Partial<Options> = {}): string => {\n invariant(typeof source === 'string');\n let section = 0;\n handlebars.registerHelper('section', () => String(++section));\n const template = handlebars.compile(source.trim());\n const output = template(variables);\n return output.trim().replace(/(\\n\\s*){3,}/g, '\\n\\n');\n};\n\nexport const processTemplate = (\n template: Template.Template,\n): Effect.Effect<string, ObjectNotFoundError | FunctionNotFoundError, FunctionInvocationService | TracingService> =>\n Effect.gen(function* () {\n const functionInvoker = yield* FunctionInvocationService;\n\n const variables = yield* Effect.forEach(template.inputs ?? [], (input) =>\n Effect.gen(function* () {\n if (input.kind === 'function') {\n const fn = (yield* functionInvoker.resolveFunction(input.function!)) as FunctionDefinition<\n {},\n unknown,\n never\n >;\n const result = yield* functionInvoker.invokeFunction(fn, {});\n return [input.name, result] as const;\n } else {\n return yield* Effect.dieMessage(`Unsupported input kind: ${input.kind}`);\n }\n }),\n ).pipe(Effect.map(Record.fromEntries));\n\n log('processTemplate', { variables });\n\n return process((yield* Database.load(template.source)).content, variables);\n });\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Ref, Type } from '@dxos/echo';\nimport { type ObjectId } from '@dxos/keys';\nimport { Text } from '@dxos/schema';\n\n/**\n * Template input kind determines how template variables are resolved.\n */\nexport const InputKind = Schema.Literal(\n 'value', // Literal value.\n 'pass-through',\n 'retriever',\n 'function',\n 'query',\n 'resolver',\n 'context',\n 'schema',\n);\n\nexport type InputKind = Schema.Schema.Type<typeof InputKind>;\n\n/**\n * Template input variable.\n * E.g., {{foo}}\n */\nexport const Input = Schema.Struct({\n name: Schema.String,\n kind: Schema.optional(InputKind),\n default: Schema.optional(Schema.Any),\n\n /**\n * Function to call if the kind is 'function'.\n */\n function: Schema.optional(Schema.String),\n});\n\nexport type Input = Schema.Schema.Type<typeof Input>;\n\n/**\n * Template type.\n */\nexport const Template = Schema.Struct({\n source: Type.Ref(Text.Text).annotations({ description: 'Handlebars template source' }),\n inputs: Schema.optional(Schema.Array(Input)),\n});\n\nexport interface Template extends Schema.Schema.Type<typeof Template> {}\n\nexport const make = ({\n source,\n inputs = [],\n id,\n}: { source?: string; inputs?: Input[]; id?: ObjectId } = {}): Template => ({\n source: Ref.make(Text.make(source, id)),\n inputs,\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { log } from '@dxos/log';\n\nimport { type Blueprint } from './blueprint';\n\n/**\n * Blueprint registry.\n */\nexport class Registry {\n private readonly _blueprints: Blueprint[] = [];\n\n constructor(blueprints: Blueprint[]) {\n const seen = new Set<string>();\n blueprints.forEach((blueprint) => {\n if (seen.has(blueprint.key)) {\n log.warn('duplicate blueprint', { key: blueprint.key });\n } else {\n seen.add(blueprint.key);\n this._blueprints.push(blueprint);\n }\n });\n\n this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));\n }\n\n get blueprints(): Blueprint[] {\n return this._blueprints;\n }\n\n getByKey(key: string): Blueprint | undefined {\n return this._blueprints.find((blueprint) => blueprint.key === key);\n }\n\n query(): Blueprint[] {\n return this._blueprints;\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, JsonSchema, Obj, type Ref, Type } from '@dxos/echo';\n\nimport { Blueprint } from '../blueprint';\nimport * as Template from '../template';\n\n/**\n * Executable instructions, which may use Blueprints.\n * May reference additional context.\n */\nexport const Prompt = Schema.Struct({\n /**\n * Name of the prompt.\n */\n name: Schema.optional(Schema.String),\n\n /**\n * Description of the prompt's purpose and functionality.\n * Allows AI agents to execute prompts automatically as tools.\n */\n description: Schema.optional(Schema.String),\n\n /**\n * Input schema of the prompt.\n */\n input: JsonSchema.JsonSchema.pipe(Annotation.FormInputAnnotation.set(false)),\n\n /**\n * Output schema of the prompt.\n */\n output: JsonSchema.JsonSchema.pipe(Annotation.FormInputAnnotation.set(false)),\n\n /**\n * Natural language instructions for the prompt.\n * These should provide concrete course of action for the AI to follow.\n */\n instructions: Template.Template.pipe(Annotation.FormInputAnnotation.set(false)),\n\n /**\n * Blueprints that the prompt may utilize.\n */\n blueprints: Schema.Array(Type.Ref(Blueprint)),\n\n /**\n * Additional context that the prompt may utilize.\n */\n context: Schema.Array(Schema.Any).pipe(Annotation.FormInputAnnotation.set(false)),\n}).pipe(\n Type.object({\n typename: 'dxos.org/type/Prompt',\n version: '0.1.0',\n }),\n);\n\nexport interface Prompt extends Schema.Schema.Type<typeof Prompt> {}\n\nexport const make = (params: {\n name?: string;\n description?: string;\n input?: Schema.Schema.AnyNoContext;\n output?: Schema.Schema.AnyNoContext;\n instructions?: string;\n blueprints?: Ref.Ref<Blueprint>[];\n context?: any[];\n}): Prompt =>\n Obj.make(Prompt, {\n name: params.name,\n description: params.description,\n input: JsonSchema.toJsonSchema(params.input ?? Schema.Void),\n output: JsonSchema.toJsonSchema(params.output ?? Schema.Void),\n instructions: Template.make({ source: params.instructions }),\n blueprints: params.blueprints ?? [],\n context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;;;;EAKrEC,QAAQL,WAAWA,WAAWC,KAAKC,YAAWC,oBAAoBC,IAAI,KAAA,CAAA;;;;;EAMtEE,cAAuBC,SAASN,KAAKC,YAAWC,oBAAoBC,IAAI,KAAA,CAAA;;;;EAKxEI,YAAmBC,cAAMC,MAAKC,IAAIC,SAAAA,CAAAA;;;;EAKlCC,SAAgBJ,cAAaK,WAAG,EAAEb,KAAKC,YAAWC,oBAAoBC,IAAI,KAAA,CAAA;AAC5E,CAAA,EAAGH,KACDS,MAAKK,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,CAAA;AAKK,IAAMC,QAAO,CAACC,WASnBC,KAAIF,KAAKzB,QAAQ;EACfE,MAAMwB,OAAOxB;EACbG,aAAaqB,OAAOrB;EACpBC,OAAOC,WAAWqB,aAAaF,OAAOpB,SAAgBuB,YAAI;EAC1DjB,QAAQL,WAAWqB,aAAaF,OAAOd,UAAiBiB,YAAI;EAC5DhB,cAAuBY,KAAK;IAAEK,QAAQJ,OAAOb;EAAa,CAAA;EAC1DE,YAAYW,OAAOX,cAAc,CAAA;EACjCK,SAASM,OAAON,WAAW,CAAA;AAC7B,CAAA;",
6
+ "names": ["make", "Schema", "ToolId", "Annotation", "Obj", "Type", "Effect", "Record", "handlebars", "Database", "FunctionInvocationService", "invariant", "log", "process", "source", "variables", "section", "registerHelper", "String", "template", "compile", "trim", "output", "replace", "processTemplate", "gen", "functionInvoker", "forEach", "inputs", "input", "kind", "fn", "resolveFunction", "function", "result", "invokeFunction", "name", "dieMessage", "pipe", "map", "fromEntries", "load", "content", "Schema", "Ref", "Type", "Text", "InputKind", "Literal", "Input", "Struct", "name", "String", "kind", "optional", "default", "Any", "function", "Template", "source", "Type", "Ref", "Text", "annotations", "description", "inputs", "Array", "make", "id", "Blueprint", "Struct", "key", "String", "annotations", "description", "name", "optional", "instructions", "Template", "tools", "Array", "ToolId", "pipe", "Type", "object", "typename", "version", "Annotation", "LabelAnnotation", "set", "make", "props", "Obj", "toolDefinitions", "functions", "map", "fn", "tool", "log", "Registry", "_blueprints", "blueprints", "seen", "Set", "forEach", "blueprint", "has", "key", "warn", "add", "push", "sort", "name", "a", "b", "localeCompare", "getByKey", "find", "query", "make", "Schema", "Annotation", "JsonSchema", "Obj", "Type", "Prompt", "Struct", "name", "optional", "String", "description", "input", "JsonSchema", "pipe", "Annotation", "FormInputAnnotation", "set", "output", "instructions", "Template", "blueprints", "Array", "Type", "Ref", "Blueprint", "context", "Any", "object", "typename", "version", "make", "params", "Obj", "toJsonSchema", "Void", "source"]
7
+ }
@@ -0,0 +1 @@
1
+ {"inputs":{"src/template/prompt.ts":{"bytes":6876,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/template/template.ts":{"bytes":4450,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"src/template/index.ts":{"bytes":546,"imports":[{"path":"src/template/prompt.ts","kind":"import-statement","original":"./prompt"},{"path":"src/template/template.ts","kind":"import-statement","original":"./template"}],"format":"esm"},"src/blueprint/blueprint.ts":{"bytes":8164,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/template/index.ts","kind":"import-statement","original":"../template"}],"format":"esm"},"src/blueprint/registry.ts":{"bytes":3662,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/blueprint/index.ts":{"bytes":554,"imports":[{"path":"src/blueprint/blueprint.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/blueprint/registry.ts","kind":"import-statement","original":"./registry"}],"format":"esm"},"src/prompt/prompt.ts":{"bytes":7056,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/blueprint/index.ts","kind":"import-statement","original":"../blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"../template"}],"format":"esm"},"src/prompt/index.ts":{"bytes":456,"imports":[{"path":"src/prompt/prompt.ts","kind":"import-statement","original":"./prompt"}],"format":"esm"},"src/index.ts":{"bytes":813,"imports":[{"path":"src/blueprint/index.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"./template"},{"path":"src/prompt/index.ts","kind":"import-statement","original":"./prompt"}],"format":"esm"}},"outputs":{"dist/lib/neutral/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15363},"dist/lib/neutral/index.mjs":{"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["Blueprint","Prompt","Template"],"entryPoint":"src/index.ts","inputs":{"src/blueprint/index.ts":{"bytesInOutput":182},"src/blueprint/blueprint.ts":{"bytesInOutput":1842},"src/template/index.ts":{"bytesInOutput":227},"src/template/prompt.ts":{"bytesInOutput":1634},"src/template/template.ts":{"bytesInOutput":761},"src/blueprint/registry.ts":{"bytesInOutput":897},"src/index.ts":{"bytesInOutput":0},"src/prompt/index.ts":{"bytesInOutput":100},"src/prompt/prompt.ts":{"bytesInOutput":1592}},"bytes":7792}}}
@@ -1,67 +1,53 @@
1
1
  import * as Schema from 'effect/Schema';
2
- import { Type } from '@dxos/echo';
2
+ import { Obj, Type } from '@dxos/echo';
3
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.
7
7
  * Blueprints may use tools to create and read artifacts, which are managed by the assistant.
8
8
  */
9
- export declare const Blueprint: Type.obj<Schema.Struct<{
10
- /**
11
- * Global registry ID.
12
- * NOTE: The `key` property refers to the original registry entry.
13
- */
14
- key: Schema.SchemaClass<string, string, never>;
15
- /**
16
- * Human-readable name of the blueprint.
17
- */
18
- name: Schema.SchemaClass<string, string, never>;
19
- /**
20
- * Description of the blueprint's purpose and functionality.
21
- */
22
- description: Schema.optional<typeof Schema.String>;
23
- /**
24
- * Instructions that guide the AI assistant's behavior and responses.
25
- * These are system prompts or guidelines that the AI should follow.
26
- */
27
- instructions: Schema.mutable<Schema.Struct<{
28
- source: Schema.SchemaClass<import("@dxos/echo/internal").Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
29
- content: string;
30
- }>, import("@dxos/echo-protocol").EncodedReference, never>;
31
- inputs: Schema.optional<Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
32
- name: typeof Schema.String;
33
- kind: Schema.optional<Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>>;
34
- default: Schema.optional<typeof Schema.Any>;
35
- }>>>>>;
36
- }>>;
37
- /**
38
- * Array of tools that the AI assistant can use when this blueprint is active.
39
- */
40
- tools: Schema.Array$<Schema.brand<typeof Schema.String, "ToolId">>;
41
- }>>;
9
+ export declare const Blueprint: Type.Obj<{
10
+ readonly description?: string | undefined;
11
+ readonly name: string;
12
+ readonly key: string;
13
+ readonly instructions: {
14
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
15
+ readonly content: string;
16
+ }>;
17
+ readonly inputs?: readonly {
18
+ readonly function?: string | undefined;
19
+ readonly name: string;
20
+ readonly kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
21
+ readonly default?: any;
22
+ }[] | undefined;
23
+ };
24
+ readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
25
+ }, Schema.Struct.Fields>;
42
26
  /**
43
27
  * TypeScript type for Blueprint.
44
28
  */
45
29
  export interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {
46
30
  }
31
+ type MakeProps = Pick<Blueprint, 'key' | 'name'> & Partial<Blueprint>;
47
32
  /**
48
33
  * Create a new Blueprint.
49
34
  */
50
- export declare const make: ({ tools, instructions, ...props }: Pick<Blueprint, "key" | "name"> & Partial<Blueprint>) => import("@dxos/live-object").Live<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
51
- key: string;
52
- name: string;
53
- description?: string | undefined;
54
- instructions: {
55
- source: import("@dxos/echo/internal").Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
56
- content: string;
35
+ export declare const make: ({ tools, instructions, ...props }: MakeProps) => Obj.Obj<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
36
+ readonly description?: string | undefined;
37
+ readonly name: string;
38
+ readonly key: string;
39
+ readonly instructions: {
40
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
41
+ readonly content: string;
57
42
  }>;
58
- inputs?: {
59
- name: string;
60
- kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
61
- default?: any;
43
+ readonly inputs?: readonly {
44
+ readonly function?: string | undefined;
45
+ readonly name: string;
46
+ readonly kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
47
+ readonly default?: any;
62
48
  }[] | undefined;
63
49
  };
64
- tools: (string & import("effect/Brand").Brand<"ToolId">)[];
50
+ readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
65
51
  }>;
66
52
  /**
67
53
  * Util to create tool definitions for a blueprint.
@@ -70,4 +56,5 @@ export declare const toolDefinitions: ({ tools, functions, }: {
70
56
  tools?: string[];
71
57
  functions?: FunctionDefinition[];
72
58
  }) => (string & import("effect/Brand").Brand<"ToolId">)[];
59
+ export {};
73
60
  //# sourceMappingURL=blueprint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"blueprint.d.ts","sourceRoot":"","sources":["../../../../src/blueprint/blueprint.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAI1D;;;;GAIG;AACH,eAAO,MAAM,SAAS;IACpB;;;OAGG;;IAMH;;OAEG;;IAKH;;OAEG;;IAKH;;;OAGG;;;;;;;;;;;IAKH;;OAEG;;GAaJ,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC;CAAG;AAE1E;;GAEG;AACH,eAAO,MAAM,IAAI,GAAI,mCAIlB,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;EAA2D,CAAC;AAEnH;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,uBAG7B;IACD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAClC,wDAA+F,CAAC"}
1
+ {"version":3,"file":"blueprint.d.ts","sourceRoot":"","sources":["../../../../src/blueprint/blueprint.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAc,GAAG,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAI1D;;;;GAIG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;wBA6CrB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC;CAAG;AAE1E,KAAK,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,IAAI,GAAI,mCAA0D,SAAS;;;;;;;;;;;;;;;;EAKpF,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,uBAG7B;IACD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAClC,wDAA+F,CAAC"}
@@ -5,6 +5,7 @@ import { type Blueprint } from './blueprint';
5
5
  export declare class Registry {
6
6
  private readonly _blueprints;
7
7
  constructor(blueprints: Blueprint[]);
8
+ get blueprints(): Blueprint[];
8
9
  getByKey(key: string): Blueprint | undefined;
9
10
  query(): Blueprint[];
10
11
  }
@@ -1 +1 @@
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
+ {"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,IAAI,UAAU,IAAI,SAAS,EAAE,CAE5B;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAI5C,KAAK,IAAI,SAAS,EAAE;CAGrB"}
@@ -2,72 +2,46 @@ import * as Schema from 'effect/Schema';
2
2
  import { type Ref, Type } from '@dxos/echo';
3
3
  import { Blueprint } from '../blueprint';
4
4
  /**
5
- * Executable instructions.
6
- * Declare input and output schema.
7
- * May utilize blueprints.
5
+ * Executable instructions, which may use Blueprints.
8
6
  * May reference additional context.
9
7
  */
10
- declare const Prompt_: Type.obj<Schema.Struct<{
11
- /**
12
- * Name of the prompt.
13
- */
14
- name: Schema.optional<typeof Schema.String>;
15
- /**
16
- * Description of the prompt's purpose and functionality.
17
- * Allows AI agents to execute prompts automatically as tools.
18
- */
19
- description: Schema.optional<typeof Schema.String>;
20
- /**
21
- * Input schema of the prompt.
22
- */
23
- input: Schema.Schema<Type.JsonSchema, Type.JsonSchema, never>;
24
- /**
25
- * Output schema of the prompt.
26
- */
27
- output: Schema.Schema<Type.JsonSchema, Type.JsonSchema, never>;
28
- /**
29
- * Natural language instructions for the prompt.
30
- * These should provide concrete course of action for the AI to follow.
31
- */
32
- instructions: Schema.mutable<Schema.Struct<{
33
- source: Schema.SchemaClass<import("@dxos/echo/internal").Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
34
- content: string;
35
- }>, import("@dxos/echo-protocol").EncodedReference, never>;
36
- inputs: Schema.optional<Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
37
- name: typeof Schema.String;
38
- kind: Schema.optional<Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>>;
39
- default: Schema.optional<typeof Schema.Any>;
40
- }>>>>>;
41
- }>>;
42
- /**
43
- * Blueprints that the prompt may utilize.
44
- */
45
- blueprints: Schema.Array$<Type.ref<Type.obj<Schema.Struct<{
46
- key: Schema.SchemaClass<string, string, never>;
47
- name: Schema.SchemaClass<string, string, never>;
48
- description: Schema.optional<typeof Schema.String>;
49
- instructions: Schema.mutable<Schema.Struct<{
50
- source: Schema.SchemaClass<import("@dxos/echo/internal").Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
51
- content: string;
52
- }>, import("@dxos/echo-protocol").EncodedReference, never>;
53
- inputs: Schema.optional<Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
54
- name: typeof Schema.String;
55
- kind: Schema.optional<Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>>;
56
- default: Schema.optional<typeof Schema.Any>;
57
- }>>>>>;
58
- }>>;
59
- tools: Schema.Array$<Schema.brand<typeof Schema.String, "ToolId">>;
60
- }>>>>;
61
- /**
62
- * Additional context that the prompt may utilize.
63
- */
64
- context: Schema.Array$<typeof Schema.Any>;
65
- }>>;
66
- export interface Prompt extends Schema.Schema.Type<typeof Prompt_> {
8
+ export declare const Prompt: Type.Obj<{
9
+ readonly description?: string | undefined;
10
+ readonly name?: string | undefined;
11
+ readonly context: readonly any[];
12
+ readonly instructions: {
13
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
14
+ readonly content: string;
15
+ }>;
16
+ readonly inputs?: readonly {
17
+ readonly function?: string | undefined;
18
+ readonly name: string;
19
+ readonly kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
20
+ readonly default?: any;
21
+ }[] | undefined;
22
+ };
23
+ readonly input: import("@dxos/echo/internal").JsonSchemaType;
24
+ readonly output: import("@dxos/echo/internal").JsonSchemaType;
25
+ readonly blueprints: readonly import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
26
+ readonly description?: string | undefined;
27
+ readonly name: string;
28
+ readonly key: string;
29
+ readonly instructions: {
30
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
31
+ readonly content: string;
32
+ }>;
33
+ readonly inputs?: readonly {
34
+ readonly function?: string | undefined;
35
+ readonly name: string;
36
+ readonly kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
37
+ readonly default?: any;
38
+ }[] | undefined;
39
+ };
40
+ readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
41
+ }>[];
42
+ }, Schema.Struct.Fields>;
43
+ export interface Prompt extends Schema.Schema.Type<typeof Prompt> {
67
44
  }
68
- export interface Prompt_Encoded extends Schema.Schema.Encoded<typeof Prompt_> {
69
- }
70
- export declare const Prompt: Schema.Schema<Prompt, Prompt_Encoded>;
71
45
  export declare const make: (params: {
72
46
  name?: string;
73
47
  description?: string;
@@ -77,5 +51,4 @@ export declare const make: (params: {
77
51
  blueprints?: Ref.Ref<Blueprint>[];
78
52
  context?: any[];
79
53
  }) => Prompt;
80
- export {};
81
54
  //# sourceMappingURL=prompt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/prompt/prompt.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAO,KAAK,GAAG,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC;;;;;GAKG;AAC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AC,OAAO,MAAM,CAAC;CAAG;AAEpE,eAAO,MAAM,IAAI,GAAI,QAAQ;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;IAClC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;CACjB,KAAG,MASA,CAAC"}
@@ -1,5 +1,10 @@
1
+ import * as Effect from 'effect/Effect';
2
+ import type { ObjectNotFoundError } from '@dxos/echo/Err';
3
+ import { FunctionInvocationService, type FunctionNotFoundError, type TracingService } from '@dxos/functions';
4
+ import type { Template } from '..';
1
5
  /**
2
6
  * Process Handlebars template.
3
7
  */
4
8
  export declare const process: <Options extends {}>(source: string, variables?: Partial<Options>) => string;
9
+ export declare const processTemplate: (template: Template.Template) => Effect.Effect<string, ObjectNotFoundError | FunctionNotFoundError, FunctionInvocationService | TracingService>;
5
10
  //# sourceMappingURL=prompt.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/template/prompt.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAEL,yBAAyB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,SAAS,EAAE,EAAE,QAAQ,MAAM,EAAE,YAAW,OAAO,CAAC,OAAO,CAAM,KAAG,MAO9F,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,UAAU,QAAQ,CAAC,QAAQ,KAC1B,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,qBAAqB,EAAE,yBAAyB,GAAG,cAAc,CAuB5G,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import * as Schema from 'effect/Schema';
2
- import { Type } from '@dxos/echo';
3
2
  import { type ObjectId } from '@dxos/keys';
4
3
  /**
5
4
  * Template input kind determines how template variables are resolved.
@@ -10,25 +9,33 @@ export type InputKind = Schema.Schema.Type<typeof InputKind>;
10
9
  * Template input variable.
11
10
  * E.g., {{foo}}
12
11
  */
13
- export declare const Input: Schema.mutable<Schema.Struct<{
12
+ export declare const Input: Schema.Struct<{
14
13
  name: typeof Schema.String;
15
14
  kind: Schema.optional<Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>>;
16
15
  default: Schema.optional<typeof Schema.Any>;
17
- }>>;
16
+ /**
17
+ * Function to call if the kind is 'function'.
18
+ */
19
+ function: Schema.optional<typeof Schema.String>;
20
+ }>;
18
21
  export type Input = Schema.Schema.Type<typeof Input>;
19
22
  /**
20
23
  * Template type.
21
24
  */
22
- export declare const Template: Schema.mutable<Schema.Struct<{
23
- source: Schema.SchemaClass<import("@dxos/echo/internal").Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
24
- content: string;
25
+ export declare const Template: Schema.Struct<{
26
+ source: Schema.SchemaClass<import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
27
+ readonly content: string;
25
28
  }>, import("@dxos/echo-protocol").EncodedReference, never>;
26
- inputs: Schema.optional<Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
29
+ inputs: Schema.optional<Schema.Array$<Schema.Struct<{
27
30
  name: typeof Schema.String;
28
31
  kind: Schema.optional<Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>>;
29
32
  default: Schema.optional<typeof Schema.Any>;
30
- }>>>>>;
31
- }>>;
33
+ /**
34
+ * Function to call if the kind is 'function'.
35
+ */
36
+ function: Schema.optional<typeof Schema.String>;
37
+ }>>>;
38
+ }>;
32
39
  export interface Template extends Schema.Schema.Type<typeof Template> {
33
40
  }
34
41
  export declare const make: ({ source, inputs, id, }?: {
@@ -1 +1 @@
1
- {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/template/template.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C;;GAEG;AACH,eAAO,MAAM,SAAS,8GASrB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;GAMjB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;GAGE,CAAC;AAExB,MAAM,WAAW,QAAS,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC;CAAG;AAExE,eAAO,MAAM,IAAI,GAAI,0BAIlB;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAA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