@dxos/blueprints 0.8.4-main.f5c0578 → 0.8.4-main.fcc0d83b33

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.
@@ -0,0 +1,322 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/blueprint/index.ts
8
+ var blueprint_exports = {};
9
+ __export(blueprint_exports, {
10
+ Blueprint: () => Blueprint,
11
+ McpServer: () => McpServer,
12
+ NotFoundError: () => NotFoundError,
13
+ Registry: () => Registry,
14
+ RegistryService: () => RegistryService,
15
+ make: () => make2,
16
+ resolve: () => resolve,
17
+ toolDefinitions: () => toolDefinitions,
18
+ upsert: () => upsert
19
+ });
20
+
21
+ // src/blueprint/blueprint.ts
22
+ import * as Schema2 from "effect/Schema";
23
+ import { ToolId } from "@dxos/ai";
24
+ import { Annotation, Obj, Type } from "@dxos/echo";
25
+
26
+ // src/template/index.ts
27
+ var template_exports = {};
28
+ __export(template_exports, {
29
+ Input: () => Input,
30
+ InputKind: () => InputKind,
31
+ Template: () => Template,
32
+ make: () => make,
33
+ process: () => process,
34
+ processTemplate: () => processTemplate
35
+ });
36
+
37
+ // src/template/prompt.ts
38
+ import * as Effect from "effect/Effect";
39
+ import * as Record from "effect/Record";
40
+ import handlebars from "handlebars";
41
+ import { Database } from "@dxos/echo";
42
+ import { FunctionNotFoundError } from "@dxos/functions";
43
+ import { invariant } from "@dxos/invariant";
44
+ import { log } from "@dxos/log";
45
+ import { Operation, OperationRegistry } from "@dxos/operation";
46
+ var __dxlog_file = "/__w/dxos/dxos/packages/core/blueprints/src/template/prompt.ts";
47
+ var process = (source, variables = {}) => {
48
+ invariant(typeof source === "string", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 15, S: void 0, A: ["typeof source === 'string'", ""] });
49
+ let section = 0;
50
+ handlebars.registerHelper("section", () => String(++section));
51
+ const template = handlebars.compile(source.trim());
52
+ const output = template(variables);
53
+ return output.trim().replace(/(\n\s*){3,}/g, "\n\n");
54
+ };
55
+ var processTemplate = (template) => Effect.gen(function* () {
56
+ const variables = yield* Effect.forEach(template.inputs ?? [], (input) => Effect.gen(function* () {
57
+ if (input.kind === "function") {
58
+ const fn = yield* OperationRegistry.resolve(input.function).pipe(Effect.flatten, Effect.catchTag("NoSuchElementException", () => Effect.fail(new FunctionNotFoundError(input.function))));
59
+ const result = yield* Operation.invoke(fn, {}).pipe(Effect.orDie);
60
+ return [
61
+ input.name,
62
+ result
63
+ ];
64
+ } else {
65
+ return yield* Effect.dieMessage(`Unsupported input kind: ${input.kind}`);
66
+ }
67
+ })).pipe(Effect.map(Record.fromEntries));
68
+ log("processTemplate", {
69
+ variables
70
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 35, S: this });
71
+ return process((yield* Database.load(template.source)).content, variables);
72
+ });
73
+
74
+ // src/template/template.ts
75
+ import * as Schema from "effect/Schema";
76
+ import { Ref } from "@dxos/echo";
77
+ import { Text } from "@dxos/schema";
78
+ var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
79
+ var Input = Schema.Struct({
80
+ name: Schema.String,
81
+ kind: Schema.optional(InputKind),
82
+ default: Schema.optional(Schema.Any),
83
+ /**
84
+ * Function to call if the kind is 'function'.
85
+ */
86
+ function: Schema.optional(Schema.String)
87
+ });
88
+ var Template = Schema.Struct({
89
+ source: Ref.Ref(Text.Text).annotations({
90
+ description: "Handlebars template source"
91
+ }),
92
+ inputs: Schema.optional(Schema.Array(Input))
93
+ });
94
+ var make = ({ id, source, inputs = [] } = {}) => ({
95
+ source: Ref.make(Text.make({
96
+ id,
97
+ content: source
98
+ })),
99
+ inputs
100
+ });
101
+
102
+ // src/blueprint/blueprint.ts
103
+ var McpServer = Schema2.Struct({
104
+ /**
105
+ * URL of the MCP server.
106
+ */
107
+ url: Schema2.String.annotations({
108
+ description: "URL of the MCP server"
109
+ }),
110
+ protocol: Schema2.Union(Schema2.Literal("sse"), Schema2.Literal("http")).annotations({
111
+ description: "Protocol of the MCP server"
112
+ })
113
+ });
114
+ var Blueprint = Schema2.Struct({
115
+ /**
116
+ * Global registry ID.
117
+ * NOTE: The `key` property refers to the original registry entry.
118
+ */
119
+ // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.
120
+ key: Schema2.String.annotations({
121
+ description: "Unique registration key for the blueprint"
122
+ }),
123
+ /**
124
+ * Human-readable name of the blueprint.
125
+ */
126
+ name: Schema2.String.annotations({
127
+ description: "Human-readable name of the blueprint"
128
+ }),
129
+ /**
130
+ * Description of the blueprint's purpose and functionality.
131
+ */
132
+ description: Schema2.optional(Schema2.String).annotations({
133
+ description: "Description of the blueprint's purpose and functionality"
134
+ }),
135
+ /**
136
+ * Instructions that guide the AI assistant's behavior and responses.
137
+ * These are system prompts or guidelines that the AI should follow.
138
+ */
139
+ instructions: Template.annotations({
140
+ description: "Instructions that guide the AI assistant's behavior and responses"
141
+ }),
142
+ /**
143
+ * Array of tools that the AI assistant can use when this blueprint is active.
144
+ */
145
+ tools: Schema2.Array(ToolId).annotations({
146
+ description: "Array of tools that the AI assistant can use when this blueprint is active"
147
+ }),
148
+ /**
149
+ * Whether an agent is allowed to auto-enable this blueprint in a conversation.
150
+ */
151
+ agentCanEnable: Schema2.optional(Schema2.Boolean).annotations({
152
+ description: "Whether an agent is allowed to auto-enable this blueprint in a conversation."
153
+ }),
154
+ /**
155
+ * Array of MCP servers that the AI assistant can use when this blueprint is active.
156
+ */
157
+ mcpServers: Schema2.optional(Schema2.Array(McpServer))
158
+ }).pipe(Type.object({
159
+ // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.
160
+ typename: "org.dxos.type.blueprint",
161
+ version: "0.1.0"
162
+ }), Annotation.LabelAnnotation.set([
163
+ "name"
164
+ ]), Annotation.IconAnnotation.set({
165
+ icon: "ph--blueprint--regular",
166
+ hue: "sky"
167
+ }));
168
+ var make2 = ({ tools = [], instructions = make(), ...props }) => Obj.make(Blueprint, {
169
+ tools,
170
+ instructions,
171
+ ...props
172
+ });
173
+ var toolDefinitions = ({ tools = [], operations = [] }) => [
174
+ ...operations.map((op) => ToolId.make(op.meta.key)),
175
+ ...tools.map((tool) => ToolId.make(tool))
176
+ ];
177
+
178
+ // src/blueprint/registry.ts
179
+ import * as Context from "effect/Context";
180
+ import * as Effect2 from "effect/Effect";
181
+ import { Database as Database2, Filter, Obj as Obj2 } from "@dxos/echo";
182
+ import { BaseError } from "@dxos/errors";
183
+ import { log as log2 } from "@dxos/log";
184
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/core/blueprints/src/blueprint/registry.ts";
185
+ var Registry = class {
186
+ _blueprints = [];
187
+ constructor(blueprints) {
188
+ const seen = /* @__PURE__ */ new Set();
189
+ blueprints.forEach((blueprint) => {
190
+ if (seen.has(blueprint.key)) {
191
+ log2.warn("duplicate blueprint", {
192
+ key: blueprint.key
193
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 18, S: this });
194
+ } else {
195
+ seen.add(blueprint.key);
196
+ this._blueprints.push(blueprint);
197
+ }
198
+ });
199
+ this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
200
+ }
201
+ get blueprints() {
202
+ return this._blueprints;
203
+ }
204
+ getByKey(key) {
205
+ return this._blueprints.find((blueprint) => blueprint.key === key);
206
+ }
207
+ query() {
208
+ return this._blueprints;
209
+ }
210
+ updateBlueprints() {
211
+ return Effect2.gen(this, function* () {
212
+ const blueprints = yield* Database2.runQuery(Filter.type(Blueprint));
213
+ for (const blueprint of blueprints) {
214
+ const registryBlueprint = this.getByKey(blueprint.key);
215
+ if (!registryBlueprint) {
216
+ continue;
217
+ }
218
+ const source = Obj2.clone(registryBlueprint, {
219
+ deep: true
220
+ });
221
+ Obj2.update(blueprint, (blueprint2) => {
222
+ void Obj2.updateFrom(blueprint2, source);
223
+ });
224
+ }
225
+ }).pipe(Effect2.orDie);
226
+ }
227
+ };
228
+ var RegistryService = class extends Context.Tag("@dxos/blueprints/RegistryService")() {
229
+ };
230
+ var resolve = (key) => Effect2.gen(function* () {
231
+ const registry = yield* RegistryService;
232
+ const blueprint = registry.getByKey(key);
233
+ if (!blueprint) {
234
+ return yield* Effect2.fail(new NotFoundError({
235
+ context: {
236
+ key
237
+ }
238
+ }));
239
+ }
240
+ return blueprint;
241
+ });
242
+ var upsert = (key) => Effect2.gen(function* () {
243
+ const local = yield* Database2.runQuery(Filter.type(Blueprint, {
244
+ key
245
+ }));
246
+ if (local.length > 0) {
247
+ return local[0];
248
+ }
249
+ return yield* Database2.add(Obj2.clone(yield* resolve(key), {
250
+ deep: true
251
+ }));
252
+ });
253
+ var NotFoundError = class extends BaseError.extend("BlueprintNotFound", "Blueprint not found") {
254
+ };
255
+
256
+ // src/routine/index.ts
257
+ var routine_exports = {};
258
+ __export(routine_exports, {
259
+ Routine: () => Routine,
260
+ make: () => make3
261
+ });
262
+
263
+ // src/routine/routine.ts
264
+ import * as Schema3 from "effect/Schema";
265
+ import { Annotation as Annotation2, JsonSchema, Obj as Obj3, Ref as Ref2, Type as Type2 } from "@dxos/echo";
266
+ var Routine = Schema3.Struct({
267
+ /**
268
+ * Name of the routine.
269
+ */
270
+ name: Schema3.optional(Schema3.String),
271
+ /**
272
+ * Description of the routine's purpose and functionality.
273
+ * Allows AI agents to execute routines automatically as tools.
274
+ */
275
+ description: Schema3.optional(Schema3.String),
276
+ /**
277
+ * Input schema of the routine.
278
+ */
279
+ input: JsonSchema.JsonSchema.pipe(Annotation2.FormInputAnnotation.set(false)),
280
+ /**
281
+ * Output schema of the routine.
282
+ */
283
+ output: JsonSchema.JsonSchema.pipe(Annotation2.FormInputAnnotation.set(false)),
284
+ /**
285
+ * Natural language instructions for the routine.
286
+ * These should provide concrete course of action for the AI to follow.
287
+ */
288
+ instructions: Template.pipe(Annotation2.FormInputAnnotation.set(false)),
289
+ /**
290
+ * Blueprints that the routine may utilize.
291
+ */
292
+ blueprints: Schema3.Array(Ref2.Ref(Blueprint)),
293
+ /**
294
+ * Additional context that the routine may utilize.
295
+ */
296
+ context: Schema3.Array(Schema3.Any).pipe(Annotation2.FormInputAnnotation.set(false))
297
+ }).pipe(Type2.object({
298
+ typename: "org.dxos.type.routine",
299
+ version: "0.1.0"
300
+ }), Annotation2.LabelAnnotation.set([
301
+ "name"
302
+ ]), Annotation2.IconAnnotation.set({
303
+ icon: "ph--scroll--regular",
304
+ hue: "sky"
305
+ }));
306
+ var make3 = (params) => Obj3.make(Routine, {
307
+ name: params.name,
308
+ description: params.description,
309
+ input: JsonSchema.toJsonSchema(params.input ?? Schema3.Void),
310
+ output: JsonSchema.toJsonSchema(params.output ?? Schema3.Void),
311
+ instructions: make({
312
+ source: params.instructions
313
+ }),
314
+ blueprints: params.blueprints ?? [],
315
+ context: params.context ?? []
316
+ });
317
+ export {
318
+ blueprint_exports as Blueprint,
319
+ routine_exports as Routine,
320
+ template_exports as Template
321
+ };
322
+ //# sourceMappingURL=index.mjs.map
@@ -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/routine/index.ts", "../../../src/routine/routine.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 Operation } from '@dxos/operation';\n\nimport * as Template from '../template';\n\n/**\n * MCP server definition.\n */\nexport const McpServer = Schema.Struct({\n /**\n * URL of the MCP server.\n */\n url: Schema.String.annotations({\n description: 'URL of the MCP server',\n }),\n\n protocol: Schema.Union(Schema.Literal('sse'), Schema.Literal('http')).annotations({\n description: 'Protocol of the MCP server',\n }),\n});\nexport interface McpServer extends Schema.Schema.Type<typeof McpServer> {}\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\n /**\n * Whether an agent is allowed to auto-enable this blueprint in a conversation.\n */\n agentCanEnable: Schema.optional(Schema.Boolean).annotations({\n description: 'Whether an agent is allowed to auto-enable this blueprint in a conversation.',\n }),\n\n /**\n * Array of MCP servers that the AI assistant can use when this blueprint is active.\n */\n mcpServers: Schema.optional(Schema.Array(McpServer)),\n}).pipe(\n Type.object({\n // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.\n typename: 'org.dxos.type.blueprint',\n version: '0.1.0',\n }),\n Annotation.LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({\n icon: 'ph--blueprint--regular',\n hue: 'sky',\n }),\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 operations = [],\n}: {\n tools?: string[];\n operations?: Operation.Definition.Any[];\n}) => [...operations.map((op) => ToolId.make(op.meta.key)), ...tools.map((tool) => ToolId.make(tool))];\n\n/**\n * Factory for the blueprints.\n */\nexport type Definition = {\n key: string;\n make: () => Blueprint;\n};\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 { FunctionNotFoundError } from '@dxos/functions';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\nimport { Operation, OperationRegistry } from '@dxos/operation';\n\nimport type { Template } from '../index';\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, OperationRegistry.Service | Operation.Service> =>\n Effect.gen(function* () {\n const variables = yield* Effect.forEach(template.inputs ?? [], (input) =>\n Effect.gen(function* () {\n if (input.kind === 'function') {\n const fn = yield* OperationRegistry.resolve(input.function!).pipe(\n Effect.flatten,\n Effect.catchTag('NoSuchElementException', () => Effect.fail(new FunctionNotFoundError(input.function!))),\n );\n const result = yield* Operation.invoke(fn, {} as any).pipe(Effect.orDie);\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 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 } from '@dxos/echo';\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: Ref.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 id,\n source,\n inputs = [],\n}: { id?: string; source?: string; inputs?: Input[] } = {}): Template => ({\n source: Ref.make(Text.make({ id, content: source })),\n inputs,\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\n\nimport { Database, Filter, Obj } from '@dxos/echo';\nimport { BaseError } from '@dxos/errors';\nimport { log } from '@dxos/log';\n\nimport { 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 updateBlueprints(): Effect.Effect<void, never, Database.Service> {\n return Effect.gen(this, function* () {\n const blueprints = yield* Database.runQuery(Filter.type(Blueprint));\n for (const blueprint of blueprints) {\n const registryBlueprint = this.getByKey(blueprint.key);\n if (!registryBlueprint) {\n continue;\n }\n const source = Obj.clone(registryBlueprint, { deep: true });\n Obj.update(blueprint, (blueprint) => {\n void Obj.updateFrom(blueprint, source);\n });\n }\n }).pipe(Effect.orDie);\n }\n}\n\nexport class RegistryService extends Context.Tag('@dxos/blueprints/RegistryService')<RegistryService, Registry>() {}\n\n/**\n * Resolves a blueprint from the registry.\n * Does not check the local database for the blueprint.\n */\nexport const resolve = (key: string): Effect.Effect<Blueprint, NotFoundError, RegistryService> =>\n Effect.gen(function* () {\n const registry = yield* RegistryService;\n const blueprint = registry.getByKey(key);\n if (!blueprint) {\n return yield* Effect.fail(new NotFoundError({ context: { key } }));\n }\n return blueprint;\n });\n\n/**\n * Upserts a blueprint into the database.\n * If the blueprint already exists in the database, local blueprint is returned.\n * Otherwise, it will be added.\n */\nexport const upsert = (key: string): Effect.Effect<Blueprint, NotFoundError, RegistryService | Database.Service> =>\n Effect.gen(function* () {\n const local = yield* Database.runQuery(Filter.type(Blueprint, { key }));\n if (local.length > 0) {\n return local[0];\n }\n return yield* Database.add(Obj.clone(yield* resolve(key), { deep: true }));\n });\n\nexport class NotFoundError extends BaseError.extend('BlueprintNotFound', 'Blueprint not found') {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './routine';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, JsonSchema, Obj, 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 Routine = Schema.Struct({\n /**\n * Name of the routine.\n */\n name: Schema.optional(Schema.String),\n\n /**\n * Description of the routine's purpose and functionality.\n * Allows AI agents to execute routines automatically as tools.\n */\n description: Schema.optional(Schema.String),\n\n /**\n * Input schema of the routine.\n */\n input: JsonSchema.JsonSchema.pipe(Annotation.FormInputAnnotation.set(false)),\n\n /**\n * Output schema of the routine.\n */\n output: JsonSchema.JsonSchema.pipe(Annotation.FormInputAnnotation.set(false)),\n\n /**\n * Natural language instructions for the routine.\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 routine may utilize.\n */\n blueprints: Schema.Array(Ref.Ref(Blueprint)),\n\n /**\n * Additional context that the routine may utilize.\n */\n context: Schema.Array(Schema.Any).pipe(Annotation.FormInputAnnotation.set(false)),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.routine',\n version: '0.1.0',\n }),\n Annotation.LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({\n icon: 'ph--scroll--regular',\n hue: 'sky',\n }),\n);\n\nexport interface Routine extends Schema.Schema.Type<typeof Routine> {}\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}): Routine =>\n Obj.make(Routine, {\n name: params.name,\n description: params.description,\n input: JsonSchema.toJsonSchema(params.input ?? Schema.Void),\n output: JsonSchema.toJsonSchema(params.output ?? Schema.Void),\n instructions: Template.make({ source: params.instructions }),\n blueprints: params.blueprints ?? [],\n context: params.context ?? [],\n });\n"],
5
+ "mappings": ";;;;;;;AAAA;;;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,YAAYC,aAAY;AAExB,SAASC,cAAAA,aAAYC,YAAYC,OAAAA,MAAKC,OAAAA,MAAKC,QAAAA,aAAY;AAShD,IAAMC,UAAiBC,eAAO;;;;EAInCC,MAAaC,iBAAgBC,cAAM;;;;;EAMnCC,aAAoBF,iBAAgBC,cAAM;;;;EAK1CE,OAAOC,WAAWA,WAAWC,KAAKC,YAAWC,oBAAoBC,IAAI,KAAA,CAAA;;;;EAKrEC,QAAQL,WAAWA,WAAWC,KAAKC,YAAWC,oBAAoBC,IAAI,KAAA,CAAA;;;;;EAMtEE,cAAuBC,SAASN,KAAKC,YAAWC,oBAAoBC,IAAI,KAAA,CAAA;;;;EAKxEI,YAAmBC,cAAMC,KAAIA,IAAIC,SAAAA,CAAAA;;;;EAKjCC,SAAgBH,cAAaI,WAAG,EAAEZ,KAAKC,YAAWC,oBAAoBC,IAAI,KAAA,CAAA;AAC5E,CAAA,EAAGH,KACDa,MAAKC,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAf,YAAWgB,gBAAgBd,IAAI;EAAC;CAAO,GACvCF,YAAWiB,eAAef,IAAI;EAC5BgB,MAAM;EACNC,KAAK;AACP,CAAA,CAAA;AAKK,IAAMC,QAAO,CAACC,WASnBC,KAAIF,KAAK7B,SAAS;EAChBE,MAAM4B,OAAO5B;EACbG,aAAayB,OAAOzB;EACpBC,OAAOC,WAAWyB,aAAaF,OAAOxB,SAAgB2B,YAAI;EAC1DrB,QAAQL,WAAWyB,aAAaF,OAAOlB,UAAiBqB,YAAI;EAC5DpB,cAAuBgB,KAAK;IAAEK,QAAQJ,OAAOjB;EAAa,CAAA;EAC1DE,YAAYe,OAAOf,cAAc,CAAA;EACjCI,SAASW,OAAOX,WAAW,CAAA;AAC7B,CAAA;",
6
+ "names": ["make", "Schema", "ToolId", "Annotation", "Obj", "Type", "Effect", "Record", "handlebars", "Database", "FunctionNotFoundError", "invariant", "log", "Operation", "OperationRegistry", "section", "registerHelper", "String", "template", "output", "variables", "trim", "processTemplate", "fn", "resolve", "input", "function", "result", "fromEntries", "Schema", "Ref", "Text", "InputKind", "Literal", "Input", "Struct", "name", "String", "kind", "optional", "default", "Any", "function", "Template", "source", "annotations", "description", "inputs", "Array", "make", "id", "content", "McpServer", "Struct", "url", "String", "annotations", "description", "protocol", "Union", "Literal", "Blueprint", "key", "name", "optional", "instructions", "Template", "tools", "Array", "ToolId", "agentCanEnable", "Boolean", "mcpServers", "pipe", "Type", "object", "typename", "version", "Annotation", "LabelAnnotation", "set", "IconAnnotation", "icon", "hue", "make", "props", "Obj", "toolDefinitions", "operations", "map", "op", "meta", "tool", "Context", "Effect", "Database", "Filter", "Obj", "BaseError", "log", "__dxlog_file", "blueprints", "seen", "has", "blueprint", "log", "key", "getByKey", "query", "updateBlueprints", "registryBlueprint", "Obj", "update", "Effect", "registry", "fail", "NotFoundError", "context", "Database", "local", "make", "Schema", "Annotation", "JsonSchema", "Obj", "Ref", "Type", "Routine", "Struct", "name", "optional", "String", "description", "input", "JsonSchema", "pipe", "Annotation", "FormInputAnnotation", "set", "output", "instructions", "Template", "blueprints", "Array", "Ref", "Blueprint", "context", "Any", "Type", "object", "typename", "version", "LabelAnnotation", "IconAnnotation", "icon", "hue", "make", "params", "Obj", "toJsonSchema", "Void", "source"]
7
+ }
@@ -0,0 +1 @@
1
+ {"inputs":{"src/template/prompt.ts":{"bytes":7094,"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},{"path":"@dxos/operation","kind":"import-statement","external":true}],"format":"esm"},"src/template/template.ts":{"bytes":4357,"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":458,"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":11174,"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":10351,"imports":[{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/blueprint/blueprint.ts","kind":"import-statement","original":"./blueprint"}],"format":"esm"},"src/blueprint/index.ts":{"bytes":465,"imports":[{"path":"src/blueprint/blueprint.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/blueprint/registry.ts","kind":"import-statement","original":"./registry"}],"format":"esm"},"src/routine/routine.ts":{"bytes":7544,"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/routine/index.ts":{"bytes":375,"imports":[{"path":"src/routine/routine.ts","kind":"import-statement","original":"./routine"}],"format":"esm"},"src/index.ts":{"bytes":820,"imports":[{"path":"src/blueprint/index.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"./template"},{"path":"src/routine/index.ts","kind":"import-statement","original":"./routine"}],"format":"esm"}},"outputs":{"dist/lib/neutral/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":20102},"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":"@dxos/operation","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":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/errors","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","Routine","Template"],"entryPoint":"src/index.ts","inputs":{"src/blueprint/index.ts":{"bytesInOutput":342},"src/blueprint/blueprint.ts":{"bytesInOutput":2635},"src/template/index.ts":{"bytesInOutput":227},"src/template/prompt.ts":{"bytesInOutput":1731},"src/template/template.ts":{"bytesInOutput":777},"src/blueprint/registry.ts":{"bytesInOutput":2352},"src/index.ts":{"bytesInOutput":0},"src/routine/index.ts":{"bytesInOutput":104},"src/routine/routine.ts":{"bytesInOutput":1743}},"bytes":10473}}}
@@ -1,65 +1,91 @@
1
- import { Schema } from 'effect';
2
- import { Type } from '@dxos/echo';
1
+ import * as Schema from 'effect/Schema';
2
+ import { Obj, Type } from '@dxos/echo';
3
+ import { type Operation } from '@dxos/operation';
4
+ /**
5
+ * MCP server definition.
6
+ */
7
+ export declare const McpServer: Schema.Struct<{
8
+ /**
9
+ * URL of the MCP server.
10
+ */
11
+ url: Schema.SchemaClass<string, string, never>;
12
+ protocol: Schema.Union<[Schema.Literal<["sse"]>, Schema.Literal<["http"]>]>;
13
+ }>;
14
+ export interface McpServer extends Schema.Schema.Type<typeof McpServer> {
15
+ }
3
16
  /**
4
17
  * Blueprint schema defines the structure for AI assistant blueprints.
5
18
  * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.
6
19
  * Blueprints may use tools to create and read artifacts, which are managed by the assistant.
7
20
  */
8
- export declare const Blueprint: Type.obj<Schema.Struct<{
9
- /**
10
- * Global registry ID.
11
- * NOTE: The `key` property refers to the original registry entry.
12
- */
13
- key: Schema.SchemaClass<string, string, never>;
14
- /**
15
- * Human-readable name of the blueprint.
16
- */
17
- name: Schema.SchemaClass<string, string, never>;
18
- /**
19
- * Description of the blueprint's purpose and functionality.
20
- */
21
- description: Schema.optional<typeof Schema.String>;
22
- /**
23
- * Instructions that guide the AI assistant's behavior and responses.
24
- * These are system prompts or guidelines that the AI should follow.
25
- */
26
- instructions: Schema.mutable<Schema.Struct<{
27
- source: Schema.SchemaClass<import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
28
- content: string;
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
- }>>;
36
- /**
37
- * Array of tools that the AI assistant can use when this blueprint is active.
38
- */
39
- tools: Schema.Array$<Schema.brand<typeof Schema.String, "ToolId">>;
40
- }>>;
21
+ export declare const Blueprint: Type.Obj<{
22
+ readonly key: string;
23
+ readonly name: string;
24
+ readonly description?: string | undefined;
25
+ readonly instructions: {
26
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
27
+ readonly name?: string | undefined;
28
+ readonly content: string;
29
+ }>;
30
+ readonly inputs?: readonly {
31
+ readonly name: string;
32
+ readonly kind?: "context" | "function" | "pass-through" | "query" | "resolver" | "retriever" | "schema" | "value" | undefined;
33
+ readonly default?: any;
34
+ readonly function?: string | undefined;
35
+ }[] | undefined;
36
+ };
37
+ readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
38
+ readonly agentCanEnable?: boolean | undefined;
39
+ readonly mcpServers?: readonly {
40
+ readonly url: string;
41
+ readonly protocol: "http" | "sse";
42
+ }[] | undefined;
43
+ }, Schema.Struct.Fields>;
41
44
  /**
42
45
  * TypeScript type for Blueprint.
43
46
  */
44
47
  export interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {
45
48
  }
49
+ type MakeProps = Pick<Blueprint, 'key' | 'name'> & Partial<Blueprint>;
46
50
  /**
47
51
  * Create a new Blueprint.
48
52
  */
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;
53
+ export declare const make: ({ tools, instructions, ...props }: MakeProps) => Obj.OfShape<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
54
+ readonly key: string;
55
+ readonly name: string;
56
+ readonly description?: string | undefined;
57
+ readonly instructions: {
58
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
59
+ readonly name?: string | undefined;
60
+ readonly content: string;
56
61
  }>;
57
- inputs?: {
58
- name: string;
59
- kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
60
- default?: any;
62
+ readonly inputs?: readonly {
63
+ readonly name: string;
64
+ readonly kind?: "context" | "function" | "pass-through" | "query" | "resolver" | "retriever" | "schema" | "value" | undefined;
65
+ readonly default?: any;
66
+ readonly function?: string | undefined;
61
67
  }[] | undefined;
62
68
  };
63
- tools: (string & import("effect/Brand").Brand<"ToolId">)[];
69
+ readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
70
+ readonly agentCanEnable?: boolean | undefined;
71
+ readonly mcpServers?: readonly {
72
+ readonly url: string;
73
+ readonly protocol: "http" | "sse";
74
+ }[] | undefined;
64
75
  }>;
76
+ /**
77
+ * Util to create tool definitions for a blueprint.
78
+ */
79
+ export declare const toolDefinitions: ({ tools, operations, }: {
80
+ tools?: string[];
81
+ operations?: Operation.Definition.Any[];
82
+ }) => (string & import("effect/Brand").Brand<"ToolId">)[];
83
+ /**
84
+ * Factory for the blueprints.
85
+ */
86
+ export type Definition = {
87
+ key: string;
88
+ make: () => Blueprint;
89
+ };
90
+ export {};
65
91
  //# 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,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"}
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,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD;;GAEG;AACH,eAAO,MAAM,SAAS;IACpB;;OAEG;;;EAQH,CAAC;AACH,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC;CAAG;AAE1E;;;;GAIG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;wBA6DrB,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,sCAA8D,SAAS;;;;;;;;;;;;;;;;;;;;;;EAKpF,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,eAAe,2BAGzB;IACD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;CACzC,wDAAqG,CAAC;AAEvG;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,SAAS,CAAC;CACvB,CAAC"}
@@ -1,11 +1,61 @@
1
- import { type Blueprint } from './blueprint';
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ import { Database } from '@dxos/echo';
4
+ import { BaseError } from '@dxos/errors';
5
+ import { Blueprint } from './blueprint';
2
6
  /**
3
7
  * Blueprint registry.
4
8
  */
5
9
  export declare class Registry {
6
10
  private readonly _blueprints;
7
11
  constructor(blueprints: Blueprint[]);
12
+ get blueprints(): Blueprint[];
8
13
  getByKey(key: string): Blueprint | undefined;
9
14
  query(): Blueprint[];
15
+ updateBlueprints(): Effect.Effect<void, never, Database.Service>;
10
16
  }
17
+ declare const RegistryService_base: Context.TagClass<RegistryService, "@dxos/blueprints/RegistryService", Registry>;
18
+ export declare class RegistryService extends RegistryService_base {
19
+ }
20
+ /**
21
+ * Resolves a blueprint from the registry.
22
+ * Does not check the local database for the blueprint.
23
+ */
24
+ export declare const resolve: (key: string) => Effect.Effect<Blueprint, NotFoundError, RegistryService>;
25
+ /**
26
+ * Upserts a blueprint into the database.
27
+ * If the blueprint already exists in the database, local blueprint is returned.
28
+ * Otherwise, it will be added.
29
+ */
30
+ export declare const upsert: (key: string) => Effect.Effect<Blueprint, NotFoundError, RegistryService | Database.Service>;
31
+ declare const NotFoundError_base: {
32
+ new (options?: import("@dxos/errors").BaseErrorOptions): {
33
+ cause?: unknown;
34
+ stack?: string;
35
+ name: "BlueprintNotFound";
36
+ context: Record<string, unknown>;
37
+ readonly message: string;
38
+ readonly _tag: "BlueprintNotFound";
39
+ };
40
+ isError(error: unknown): error is Error;
41
+ name: "BlueprintNotFound";
42
+ is(error: unknown): error is BaseError;
43
+ wrap(options?: Omit<import("@dxos/errors").BaseErrorOptions, 'cause'> & {
44
+ ifTypeDiffers?: boolean;
45
+ }): (error: unknown) => {
46
+ cause?: unknown;
47
+ stack?: string;
48
+ name: "BlueprintNotFound";
49
+ context: Record<string, unknown>;
50
+ readonly message: string;
51
+ readonly _tag: "BlueprintNotFound";
52
+ };
53
+ extend<Name extends string = string>(name: Name, message?: string): any;
54
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
55
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
56
+ stackTraceLimit: number;
57
+ };
58
+ export declare class NotFoundError extends NotFoundError_base {
59
+ }
60
+ export {};
11
61
  //# sourceMappingURL=registry.d.ts.map
@@ -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":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAe,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;IAE/C,YAAY,UAAU,EAAE,SAAS,EAAE,EAYlC;IAED,IAAI,UAAU,IAAI,SAAS,EAAE,CAE5B;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAE3C;IAED,KAAK,IAAI,SAAS,EAAE,CAEnB;IAED,gBAAgB,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CAc/D;CACF;;AAED,qBAAa,eAAgB,SAAQ,oBAA4E;CAAG;AAEpH;;;GAGG;AACH,eAAO,MAAM,OAAO,QAAS,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,aAAa,EAAE,eAAe,CAQzF,CAAC;AAEL;;;;GAIG;AACH,eAAO,MAAM,MAAM,QAAS,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,aAAa,EAAE,eAAe,GAAG,QAAQ,CAAC,OAAO,CAO3G,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEL,qBAAa,aAAc,SAAQ,kBAA4D;CAAG"}
@@ -1,3 +1,5 @@
1
1
  export * as Blueprint from './blueprint';
2
+ export type { Definition } from './blueprint/blueprint';
2
3
  export * as Template from './template';
4
+ export * as Routine from './routine';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './routine';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/routine/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}