@dxos/blueprints 0.8.4-main.72ec0f3 → 0.8.4-main.74a063c4e0

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,340 @@
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 { FunctionInvocationService } from "@dxos/functions";
43
+ import { invariant } from "@dxos/invariant";
44
+ import { log } from "@dxos/log";
45
+ var __dxlog_file = "/__w/dxos/dxos/packages/core/blueprints/src/template/prompt.ts";
46
+ var process = (source, variables = {}) => {
47
+ invariant(typeof source === "string", void 0, {
48
+ F: __dxlog_file,
49
+ L: 21,
50
+ S: void 0,
51
+ A: [
52
+ "typeof source === 'string'",
53
+ ""
54
+ ]
55
+ });
56
+ let section = 0;
57
+ handlebars.registerHelper("section", () => String(++section));
58
+ const template = handlebars.compile(source.trim());
59
+ const output = template(variables);
60
+ return output.trim().replace(/(\n\s*){3,}/g, "\n\n");
61
+ };
62
+ var processTemplate = (template) => Effect.gen(function* () {
63
+ const functionInvoker = yield* FunctionInvocationService;
64
+ const variables = yield* Effect.forEach(template.inputs ?? [], (input) => Effect.gen(function* () {
65
+ if (input.kind === "function") {
66
+ const fn = yield* functionInvoker.resolveFunction(input.function);
67
+ const result = yield* functionInvoker.invokeFunction(fn, {});
68
+ return [
69
+ input.name,
70
+ result
71
+ ];
72
+ } else {
73
+ return yield* Effect.dieMessage(`Unsupported input kind: ${input.kind}`);
74
+ }
75
+ })).pipe(Effect.map(Record.fromEntries));
76
+ log("processTemplate", {
77
+ variables
78
+ }, {
79
+ F: __dxlog_file,
80
+ L: 48,
81
+ S: this,
82
+ C: (f, a) => f(...a)
83
+ });
84
+ return process((yield* Database.load(template.source)).content, variables);
85
+ });
86
+
87
+ // src/template/template.ts
88
+ import * as Schema from "effect/Schema";
89
+ import { Ref } from "@dxos/echo";
90
+ import { Text } from "@dxos/schema";
91
+ var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
92
+ var Input = Schema.Struct({
93
+ name: Schema.String,
94
+ kind: Schema.optional(InputKind),
95
+ default: Schema.optional(Schema.Any),
96
+ /**
97
+ * Function to call if the kind is 'function'.
98
+ */
99
+ function: Schema.optional(Schema.String)
100
+ });
101
+ var Template = Schema.Struct({
102
+ source: Ref.Ref(Text.Text).annotations({
103
+ description: "Handlebars template source"
104
+ }),
105
+ inputs: Schema.optional(Schema.Array(Input))
106
+ });
107
+ var make = ({ id, source, inputs = [] } = {}) => ({
108
+ source: Ref.make(Text.make({
109
+ id,
110
+ content: source
111
+ })),
112
+ inputs
113
+ });
114
+
115
+ // src/blueprint/blueprint.ts
116
+ var McpServer = Schema2.Struct({
117
+ /**
118
+ * URL of the MCP server.
119
+ */
120
+ url: Schema2.String.annotations({
121
+ description: "URL of the MCP server"
122
+ }),
123
+ protocol: Schema2.Union(Schema2.Literal("sse"), Schema2.Literal("http")).annotations({
124
+ description: "Protocol of the MCP server"
125
+ })
126
+ });
127
+ var Blueprint = Schema2.Struct({
128
+ /**
129
+ * Global registry ID.
130
+ * NOTE: The `key` property refers to the original registry entry.
131
+ */
132
+ // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.
133
+ key: Schema2.String.annotations({
134
+ description: "Unique registration key for the blueprint"
135
+ }),
136
+ /**
137
+ * Human-readable name of the blueprint.
138
+ */
139
+ name: Schema2.String.annotations({
140
+ description: "Human-readable name of the blueprint"
141
+ }),
142
+ /**
143
+ * Description of the blueprint's purpose and functionality.
144
+ */
145
+ description: Schema2.optional(Schema2.String).annotations({
146
+ description: "Description of the blueprint's purpose and functionality"
147
+ }),
148
+ /**
149
+ * Instructions that guide the AI assistant's behavior and responses.
150
+ * These are system prompts or guidelines that the AI should follow.
151
+ */
152
+ instructions: Template.annotations({
153
+ description: "Instructions that guide the AI assistant's behavior and responses"
154
+ }),
155
+ /**
156
+ * Array of tools that the AI assistant can use when this blueprint is active.
157
+ */
158
+ tools: Schema2.Array(ToolId).annotations({
159
+ description: "Array of tools that the AI assistant can use when this blueprint is active"
160
+ }),
161
+ /**
162
+ * Whether an agent is allowed to auto-enable this blueprint in a conversation.
163
+ */
164
+ agentCanEnable: Schema2.optional(Schema2.Boolean).annotations({
165
+ description: "Whether an agent is allowed to auto-enable this blueprint in a conversation."
166
+ }),
167
+ /**
168
+ * Array of MCP servers that the AI assistant can use when this blueprint is active.
169
+ */
170
+ mcpServers: Schema2.optional(Schema2.Array(McpServer))
171
+ }).pipe(Type.object({
172
+ // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.
173
+ typename: "org.dxos.type.blueprint",
174
+ version: "0.1.0"
175
+ }), Annotation.LabelAnnotation.set([
176
+ "name"
177
+ ]), Annotation.IconAnnotation.set({
178
+ icon: "ph--blueprint--regular",
179
+ hue: "sky"
180
+ }));
181
+ var make2 = ({ tools = [], instructions = make(), ...props }) => Obj.make(Blueprint, {
182
+ tools,
183
+ instructions,
184
+ ...props
185
+ });
186
+ var toolDefinitions = ({ tools = [], operations = [] }) => [
187
+ ...operations.map((op) => ToolId.make(op.meta.key)),
188
+ ...tools.map((tool) => ToolId.make(tool))
189
+ ];
190
+
191
+ // src/blueprint/registry.ts
192
+ import * as Context from "effect/Context";
193
+ import * as Effect2 from "effect/Effect";
194
+ import { Database as Database2, Filter, Obj as Obj2 } from "@dxos/echo";
195
+ import { BaseError } from "@dxos/errors";
196
+ import { log as log2 } from "@dxos/log";
197
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/core/blueprints/src/blueprint/registry.ts";
198
+ var Registry = class {
199
+ _blueprints = [];
200
+ constructor(blueprints) {
201
+ const seen = /* @__PURE__ */ new Set();
202
+ blueprints.forEach((blueprint) => {
203
+ if (seen.has(blueprint.key)) {
204
+ log2.warn("duplicate blueprint", {
205
+ key: blueprint.key
206
+ }, {
207
+ F: __dxlog_file2,
208
+ L: 24,
209
+ S: this,
210
+ C: (f, a) => f(...a)
211
+ });
212
+ } else {
213
+ seen.add(blueprint.key);
214
+ this._blueprints.push(blueprint);
215
+ }
216
+ });
217
+ this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
218
+ }
219
+ get blueprints() {
220
+ return this._blueprints;
221
+ }
222
+ getByKey(key) {
223
+ return this._blueprints.find((blueprint) => blueprint.key === key);
224
+ }
225
+ query() {
226
+ return this._blueprints;
227
+ }
228
+ updateBlueprints() {
229
+ return Effect2.gen(this, function* () {
230
+ const blueprints = yield* Database2.runQuery(Filter.type(Blueprint));
231
+ for (const blueprint of blueprints) {
232
+ const registryBlueprint = this.getByKey(blueprint.key);
233
+ if (!registryBlueprint) {
234
+ continue;
235
+ }
236
+ const source = Obj2.clone(registryBlueprint, {
237
+ deep: true
238
+ });
239
+ Obj2.change(blueprint, (mutable) => {
240
+ void Obj2.updateFrom(mutable, source);
241
+ });
242
+ }
243
+ }).pipe(Effect2.orDie);
244
+ }
245
+ };
246
+ var RegistryService = class extends Context.Tag("@dxos/blueprints/RegistryService")() {
247
+ };
248
+ var resolve = (key) => Effect2.gen(function* () {
249
+ const registry = yield* RegistryService;
250
+ const blueprint = registry.getByKey(key);
251
+ if (!blueprint) {
252
+ return yield* Effect2.fail(new NotFoundError({
253
+ context: {
254
+ key
255
+ }
256
+ }));
257
+ }
258
+ return blueprint;
259
+ });
260
+ var upsert = (key) => Effect2.gen(function* () {
261
+ const local = yield* Database2.runQuery(Filter.type(Blueprint, {
262
+ key
263
+ }));
264
+ if (local.length > 0) {
265
+ return local[0];
266
+ }
267
+ return yield* Database2.add(Obj2.clone(yield* resolve(key), {
268
+ deep: true
269
+ }));
270
+ });
271
+ var NotFoundError = class extends BaseError.extend("BlueprintNotFound", "Blueprint not found") {
272
+ };
273
+
274
+ // src/prompt/index.ts
275
+ var prompt_exports = {};
276
+ __export(prompt_exports, {
277
+ Prompt: () => Prompt,
278
+ make: () => make3
279
+ });
280
+
281
+ // src/prompt/prompt.ts
282
+ import * as Schema3 from "effect/Schema";
283
+ import { Annotation as Annotation2, JsonSchema, Obj as Obj3, Ref as Ref2, Type as Type2 } from "@dxos/echo";
284
+ var Prompt = Schema3.Struct({
285
+ /**
286
+ * Name of the prompt.
287
+ */
288
+ name: Schema3.optional(Schema3.String),
289
+ /**
290
+ * Description of the prompt's purpose and functionality.
291
+ * Allows AI agents to execute prompts automatically as tools.
292
+ */
293
+ description: Schema3.optional(Schema3.String),
294
+ /**
295
+ * Input schema of the prompt.
296
+ */
297
+ input: JsonSchema.JsonSchema.pipe(Annotation2.FormInputAnnotation.set(false)),
298
+ /**
299
+ * Output schema of the prompt.
300
+ */
301
+ output: JsonSchema.JsonSchema.pipe(Annotation2.FormInputAnnotation.set(false)),
302
+ /**
303
+ * Natural language instructions for the prompt.
304
+ * These should provide concrete course of action for the AI to follow.
305
+ */
306
+ instructions: Template.pipe(Annotation2.FormInputAnnotation.set(false)),
307
+ /**
308
+ * Blueprints that the prompt may utilize.
309
+ */
310
+ blueprints: Schema3.Array(Ref2.Ref(Blueprint)),
311
+ /**
312
+ * Additional context that the prompt may utilize.
313
+ */
314
+ context: Schema3.Array(Schema3.Any).pipe(Annotation2.FormInputAnnotation.set(false))
315
+ }).pipe(Type2.object({
316
+ typename: "org.dxos.type.prompt",
317
+ version: "0.1.0"
318
+ }), Annotation2.LabelAnnotation.set([
319
+ "name"
320
+ ]), Annotation2.IconAnnotation.set({
321
+ icon: "ph--scroll--regular",
322
+ hue: "sky"
323
+ }));
324
+ var make3 = (params) => Obj3.make(Prompt, {
325
+ name: params.name,
326
+ description: params.description,
327
+ input: JsonSchema.toJsonSchema(params.input ?? Schema3.Void),
328
+ output: JsonSchema.toJsonSchema(params.output ?? Schema3.Void),
329
+ instructions: make({
330
+ source: params.instructions
331
+ }),
332
+ blueprints: params.blueprints ?? [],
333
+ context: params.context ?? []
334
+ });
335
+ export {
336
+ blueprint_exports as Blueprint,
337
+ prompt_exports as Prompt,
338
+ template_exports as Template
339
+ };
340
+ //# 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/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 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// 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 { FunctionInvocationService, type FunctionNotFoundError, type TracingService } from '@dxos/functions';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\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, 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 // TODO(dmaretskyi): create FunctionInvoker.invokeByKey function.\n const fn = yield* functionInvoker.resolveFunction(input.function!);\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 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.change(blueprint, (mutable) => {\n void Obj.updateFrom(mutable, 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 './prompt';\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 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(Ref.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: 'org.dxos.type.prompt',\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 Prompt extends Schema.Schema.Type<typeof Prompt> {}\n\nexport const make = (params: {\n name?: string;\n description?: string;\n input?: Schema.Schema.AnyNoContext;\n output?: Schema.Schema.AnyNoContext;\n instructions?: string;\n blueprints?: Ref.Ref<Blueprint>[];\n context?: any[];\n}): Prompt =>\n Obj.make(Prompt, {\n name: params.name,\n description: params.description,\n input: JsonSchema.toJsonSchema(params.input ?? Schema.Void),\n output: JsonSchema.toJsonSchema(params.output ?? Schema.Void),\n instructions: Template.make({ source: params.instructions }),\n blueprints: params.blueprints ?? [],\n context: params.context ?? [],\n });\n"],
5
+ "mappings": ";;;;;;;AAAA;;;;;;;cAAAA;EAAA;;;;;;ACIA,YAAYC,aAAY;AAExB,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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", "Text", "InputKind", "Literal", "Input", "Struct", "name", "String", "kind", "optional", "default", "Any", "function", "Template", "source", "Ref", "Text", "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", "Registry", "_blueprints", "blueprints", "seen", "Set", "forEach", "blueprint", "has", "key", "log", "warn", "add", "push", "sort", "name", "a", "b", "localeCompare", "getByKey", "find", "query", "updateBlueprints", "gen", "Database", "runQuery", "Filter", "type", "Blueprint", "registryBlueprint", "source", "Obj", "clone", "deep", "change", "mutable", "updateFrom", "pipe", "orDie", "RegistryService", "Tag", "resolve", "registry", "fail", "NotFoundError", "context", "upsert", "local", "length", "BaseError", "extend", "make", "Schema", "Annotation", "JsonSchema", "Obj", "Ref", "Type", "Prompt", "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":6910,"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":4444,"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":11107,"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":10466,"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":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":7592,"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":20508},"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":"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","Prompt","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":1634},"src/template/template.ts":{"bytesInOutput":777},"src/blueprint/registry.ts":{"bytesInOutput":2392},"src/index.ts":{"bytesInOutput":0},"src/prompt/index.ts":{"bytesInOutput":100},"src/prompt/prompt.ts":{"bytesInOutput":1732}},"bytes":10396}}}
@@ -1,73 +1,84 @@
1
1
  import * as Schema from 'effect/Schema';
2
- import { Type } from '@dxos/echo';
3
- import { type FunctionDefinition } from '@dxos/functions';
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
+ }
4
16
  /**
5
17
  * Blueprint schema defines the structure for AI assistant blueprints.
6
18
  * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.
7
19
  * Blueprints may use tools to create and read artifacts, which are managed by the assistant.
8
20
  */
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
- }>>;
21
+ export declare const Blueprint: Type.Obj<{
22
+ readonly name: string;
23
+ readonly description?: string | undefined;
24
+ readonly key: string;
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 function?: string | undefined;
32
+ readonly name: string;
33
+ readonly kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
34
+ readonly default?: any;
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: "sse" | "http";
42
+ }[] | undefined;
43
+ }, Schema.Struct.Fields>;
42
44
  /**
43
45
  * TypeScript type for Blueprint.
44
46
  */
45
47
  export interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {
46
48
  }
49
+ type MakeProps = Pick<Blueprint, 'key' | 'name'> & Partial<Blueprint>;
47
50
  /**
48
51
  * Create a new Blueprint.
49
52
  */
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;
53
+ export declare const make: ({ tools, instructions, ...props }: MakeProps) => Obj.OfShape<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
54
+ readonly name: string;
55
+ readonly description?: string | undefined;
56
+ readonly key: string;
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;
57
61
  }>;
58
- inputs?: {
59
- name: string;
60
- kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
61
- default?: any;
62
+ readonly inputs?: readonly {
63
+ readonly function?: string | undefined;
64
+ readonly name: string;
65
+ readonly kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
66
+ readonly default?: any;
62
67
  }[] | undefined;
63
68
  };
64
- 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: "sse" | "http";
74
+ }[] | undefined;
65
75
  }>;
66
76
  /**
67
77
  * Util to create tool definitions for a blueprint.
68
78
  */
69
- export declare const toolDefinitions: ({ tools, functions, }: {
79
+ export declare const toolDefinitions: ({ tools, operations, }: {
70
80
  tools?: string[];
71
- functions?: FunctionDefinition[];
81
+ operations?: Operation.Definition.Any[];
72
82
  }) => (string & import("effect/Brand").Brand<"ToolId">)[];
83
+ export {};
73
84
  //# 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;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O,MAAM,eAAe,GAAI,wBAG7B;IACD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;CACzC,wDAAqG,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
+ name: "BlueprintNotFound";
34
+ context: Record<string, unknown>;
35
+ readonly message: string;
36
+ readonly _tag: "BlueprintNotFound";
37
+ stack?: string;
38
+ cause?: unknown;
39
+ };
40
+ name: "BlueprintNotFound";
41
+ is(error: unknown): error is BaseError;
42
+ wrap(options?: Omit<import("@dxos/errors").BaseErrorOptions, "cause"> & {
43
+ ifTypeDiffers?: boolean;
44
+ }): (error: unknown) => {
45
+ name: "BlueprintNotFound";
46
+ context: Record<string, unknown>;
47
+ readonly message: string;
48
+ readonly _tag: "BlueprintNotFound";
49
+ stack?: string;
50
+ cause?: unknown;
51
+ };
52
+ extend<Name extends string = string>(name: Name, message?: string): any;
53
+ isError(error: unknown): error is Error;
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;gBAEnC,UAAU,EAAE,SAAS,EAAE;IAcnC,IAAI,UAAU,IAAI,SAAS,EAAE,CAE5B;IAED,QAAQ,CAAC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