@dxos/blueprints 0.8.4-main.1da679c
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.
- package/LICENSE +8 -0
- package/README.md +3 -0
- package/dist/lib/browser/index.mjs +235 -0
- package/dist/lib/browser/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/lib/node-esm/index.mjs +236 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/types/src/blueprint/blueprint.d.ts +73 -0
- package/dist/types/src/blueprint/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprint/index.d.ts +3 -0
- package/dist/types/src/blueprint/index.d.ts.map +1 -0
- package/dist/types/src/blueprint/registry.d.ts +11 -0
- package/dist/types/src/blueprint/registry.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +4 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/prompt/index.d.ts +2 -0
- package/dist/types/src/prompt/index.d.ts.map +1 -0
- package/dist/types/src/prompt/prompt.d.ts +72 -0
- package/dist/types/src/prompt/prompt.d.ts.map +1 -0
- package/dist/types/src/template/index.d.ts +3 -0
- package/dist/types/src/template/index.d.ts.map +1 -0
- package/dist/types/src/template/prompt.d.ts +5 -0
- package/dist/types/src/template/prompt.d.ts.map +1 -0
- package/dist/types/src/template/prompt.test.d.ts +2 -0
- package/dist/types/src/template/prompt.test.d.ts.map +1 -0
- package/dist/types/src/template/template.d.ts +39 -0
- package/dist/types/src/template/template.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +46 -0
- package/src/blueprint/blueprint.ts +88 -0
- package/src/blueprint/index.ts +6 -0
- package/src/blueprint/registry.ts +36 -0
- package/src/index.ts +7 -0
- package/src/prompt/index.ts +5 -0
- package/src/prompt/prompt.ts +82 -0
- package/src/template/index.ts +6 -0
- package/src/template/prompt.test.ts +44 -0
- package/src/template/prompt.ts +19 -0
- package/src/template/template.ts +54 -0
- package/src/vite-env.d.ts +20 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
Copyright (c) 2022 DXOS
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
5
|
+
|
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
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
|
+
Registry: () => Registry,
|
|
12
|
+
make: () => make2,
|
|
13
|
+
toolDefinitions: () => toolDefinitions
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// src/blueprint/blueprint.ts
|
|
17
|
+
import { Schema as Schema2 } from "effect";
|
|
18
|
+
import { ToolId } from "@dxos/ai";
|
|
19
|
+
import { Obj, Type as Type2 } from "@dxos/echo";
|
|
20
|
+
import { LabelAnnotation } from "@dxos/echo-schema";
|
|
21
|
+
|
|
22
|
+
// src/template/index.ts
|
|
23
|
+
var template_exports = {};
|
|
24
|
+
__export(template_exports, {
|
|
25
|
+
Input: () => Input,
|
|
26
|
+
InputKind: () => InputKind,
|
|
27
|
+
Template: () => Template,
|
|
28
|
+
make: () => make,
|
|
29
|
+
process: () => process
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// src/template/prompt.ts
|
|
33
|
+
import handlebars from "handlebars";
|
|
34
|
+
import { invariant } from "@dxos/invariant";
|
|
35
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/core/blueprints/src/template/prompt.ts";
|
|
36
|
+
var process = (source, variables = {}) => {
|
|
37
|
+
invariant(source, void 0, {
|
|
38
|
+
F: __dxlog_file,
|
|
39
|
+
L: 13,
|
|
40
|
+
S: void 0,
|
|
41
|
+
A: [
|
|
42
|
+
"source",
|
|
43
|
+
""
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
let section = 0;
|
|
47
|
+
handlebars.registerHelper("section", () => String(++section));
|
|
48
|
+
const template = handlebars.compile(source.trim());
|
|
49
|
+
const output = template(variables);
|
|
50
|
+
return output.trim().replace(/(\n\s*){3,}/g, "\n\n");
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// src/template/template.ts
|
|
54
|
+
import { Schema } from "effect";
|
|
55
|
+
import { Ref, Type } from "@dxos/echo";
|
|
56
|
+
import { DataType } from "@dxos/schema";
|
|
57
|
+
var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
|
|
58
|
+
var Input = Schema.mutable(Schema.Struct({
|
|
59
|
+
name: Schema.String,
|
|
60
|
+
kind: Schema.optional(InputKind),
|
|
61
|
+
default: Schema.optional(Schema.Any)
|
|
62
|
+
}));
|
|
63
|
+
var Template = Schema.Struct({
|
|
64
|
+
source: Type.Ref(DataType.Text).annotations({
|
|
65
|
+
description: "Handlebars template source"
|
|
66
|
+
}),
|
|
67
|
+
inputs: Schema.optional(Schema.mutable(Schema.Array(Input)))
|
|
68
|
+
}).pipe(Schema.mutable);
|
|
69
|
+
var make = ({ source, inputs = [], id }) => ({
|
|
70
|
+
source: Ref.make(DataType.makeText(source, id)),
|
|
71
|
+
inputs
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// src/blueprint/blueprint.ts
|
|
75
|
+
var Blueprint = Schema2.Struct({
|
|
76
|
+
/**
|
|
77
|
+
* Global registry ID.
|
|
78
|
+
* NOTE: The `key` property refers to the original registry entry.
|
|
79
|
+
*/
|
|
80
|
+
// TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.
|
|
81
|
+
key: Schema2.String.annotations({
|
|
82
|
+
description: "Unique registration key for the blueprint"
|
|
83
|
+
}),
|
|
84
|
+
/**
|
|
85
|
+
* Human-readable name of the blueprint.
|
|
86
|
+
*/
|
|
87
|
+
name: Schema2.String.annotations({
|
|
88
|
+
description: "Human-readable name of the blueprint"
|
|
89
|
+
}),
|
|
90
|
+
/**
|
|
91
|
+
* Description of the blueprint's purpose and functionality.
|
|
92
|
+
*/
|
|
93
|
+
description: Schema2.optional(Schema2.String).annotations({
|
|
94
|
+
description: "Description of the blueprint's purpose and functionality"
|
|
95
|
+
}),
|
|
96
|
+
/**
|
|
97
|
+
* Instructions that guide the AI assistant's behavior and responses.
|
|
98
|
+
* These are system prompts or guidelines that the AI should follow.
|
|
99
|
+
*/
|
|
100
|
+
instructions: Template.annotations({
|
|
101
|
+
description: "Instructions that guide the AI assistant's behavior and responses"
|
|
102
|
+
}),
|
|
103
|
+
/**
|
|
104
|
+
* Array of tools that the AI assistant can use when this blueprint is active.
|
|
105
|
+
*/
|
|
106
|
+
tools: Schema2.Array(ToolId).annotations({
|
|
107
|
+
description: "Array of tools that the AI assistant can use when this blueprint is active"
|
|
108
|
+
})
|
|
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
|
+
);
|
|
120
|
+
var make2 = ({ tools = [], ...props }) => Obj.make(Blueprint, {
|
|
121
|
+
tools,
|
|
122
|
+
...props
|
|
123
|
+
});
|
|
124
|
+
var toolDefinitions = ({ tools = [], functions = [] }) => [
|
|
125
|
+
...functions.map((fn) => ToolId.make(fn.name)),
|
|
126
|
+
...tools.map((tool) => ToolId.make(tool))
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
// src/blueprint/registry.ts
|
|
130
|
+
import { log } from "@dxos/log";
|
|
131
|
+
function _define_property(obj, key, value) {
|
|
132
|
+
if (key in obj) {
|
|
133
|
+
Object.defineProperty(obj, key, {
|
|
134
|
+
value,
|
|
135
|
+
enumerable: true,
|
|
136
|
+
configurable: true,
|
|
137
|
+
writable: true
|
|
138
|
+
});
|
|
139
|
+
} else {
|
|
140
|
+
obj[key] = value;
|
|
141
|
+
}
|
|
142
|
+
return obj;
|
|
143
|
+
}
|
|
144
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/core/blueprints/src/blueprint/registry.ts";
|
|
145
|
+
var Registry = class {
|
|
146
|
+
getByKey(key) {
|
|
147
|
+
return this._blueprints.find((blueprint) => blueprint.key === key);
|
|
148
|
+
}
|
|
149
|
+
query() {
|
|
150
|
+
return this._blueprints;
|
|
151
|
+
}
|
|
152
|
+
constructor(blueprints) {
|
|
153
|
+
_define_property(this, "_blueprints", []);
|
|
154
|
+
const seen = /* @__PURE__ */ new Set();
|
|
155
|
+
blueprints.forEach((blueprint) => {
|
|
156
|
+
if (seen.has(blueprint.key)) {
|
|
157
|
+
log.warn("duplicate blueprint", {
|
|
158
|
+
key: blueprint.key
|
|
159
|
+
}, {
|
|
160
|
+
F: __dxlog_file2,
|
|
161
|
+
L: 19,
|
|
162
|
+
S: this,
|
|
163
|
+
C: (f, a) => f(...a)
|
|
164
|
+
});
|
|
165
|
+
} else {
|
|
166
|
+
seen.add(blueprint.key);
|
|
167
|
+
this._blueprints.push(blueprint);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// src/prompt/index.ts
|
|
175
|
+
var prompt_exports = {};
|
|
176
|
+
__export(prompt_exports, {
|
|
177
|
+
Prompt: () => Prompt,
|
|
178
|
+
make: () => make3
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// src/prompt/prompt.ts
|
|
182
|
+
import { Schema as Schema3 } from "effect";
|
|
183
|
+
import { Obj as Obj2, Type as Type3 } from "@dxos/echo";
|
|
184
|
+
import { JsonSchemaType, toJsonSchema } from "@dxos/echo-schema";
|
|
185
|
+
var Prompt_ = Schema3.Struct({
|
|
186
|
+
/**
|
|
187
|
+
* Name of the prompt.
|
|
188
|
+
*/
|
|
189
|
+
name: Schema3.String,
|
|
190
|
+
/**
|
|
191
|
+
* Description of the prompt's purpose and functionality.
|
|
192
|
+
* Allows AI agents to execute prompts automatically as tools.
|
|
193
|
+
*/
|
|
194
|
+
description: Schema3.optional(Schema3.String),
|
|
195
|
+
/**
|
|
196
|
+
* Input schema of the prompt.
|
|
197
|
+
*/
|
|
198
|
+
input: JsonSchemaType,
|
|
199
|
+
/**
|
|
200
|
+
* Output schema of the prompt.
|
|
201
|
+
*/
|
|
202
|
+
output: JsonSchemaType,
|
|
203
|
+
/**
|
|
204
|
+
* Natural language instructions for the prompt.
|
|
205
|
+
* These should provide concrete course of action for the AI to follow.
|
|
206
|
+
*/
|
|
207
|
+
instructions: Schema3.String,
|
|
208
|
+
/**
|
|
209
|
+
* Blueprints that the prompt may utilize.
|
|
210
|
+
*/
|
|
211
|
+
blueprints: Schema3.Array(Type3.Ref(Blueprint)),
|
|
212
|
+
/**
|
|
213
|
+
* Additional context that the prompt may utilize.
|
|
214
|
+
*/
|
|
215
|
+
context: Schema3.Array(Schema3.Any)
|
|
216
|
+
}).pipe(Type3.Obj({
|
|
217
|
+
typename: "dxos.org/type/Prompt",
|
|
218
|
+
version: "0.1.0"
|
|
219
|
+
}));
|
|
220
|
+
var Prompt = Prompt_;
|
|
221
|
+
var make3 = (opts) => Obj2.make(Prompt, {
|
|
222
|
+
name: opts.name,
|
|
223
|
+
description: opts.description,
|
|
224
|
+
input: toJsonSchema(opts.input),
|
|
225
|
+
output: toJsonSchema(opts.output),
|
|
226
|
+
instructions: opts.instructions,
|
|
227
|
+
blueprints: opts.blueprints ?? [],
|
|
228
|
+
context: opts.context ?? []
|
|
229
|
+
});
|
|
230
|
+
export {
|
|
231
|
+
blueprint_exports as Blueprint,
|
|
232
|
+
prompt_exports as Prompt,
|
|
233
|
+
template_exports as Template
|
|
234
|
+
};
|
|
235
|
+
//# 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 { Schema } from 'effect';\n\nimport { ToolId } from '@dxos/ai';\nimport { Obj, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo-schema';\nimport { type FunctionDefinition } from '@dxos/functions';\n\nimport { Template } from '../template';\n\n/**\n * Blueprint schema defines the structure for AI assistant blueprints.\n * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.\n * Blueprints may use tools to create and read artifacts, which are managed by the assistant.\n */\nexport const Blueprint = Schema.Struct({\n /**\n * Global registry ID.\n * NOTE: The `key` property refers to the original registry entry.\n */\n // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.\n key: Schema.String.annotations({\n description: 'Unique registration key for the blueprint',\n }),\n\n /**\n * Human-readable name of the blueprint.\n */\n name: Schema.String.annotations({\n description: 'Human-readable name of the blueprint',\n }),\n\n /**\n * Description of the blueprint's purpose and functionality.\n */\n description: Schema.optional(Schema.String).annotations({\n description: \"Description of the blueprint's purpose and functionality\",\n }),\n\n /**\n * Instructions that guide the AI assistant's behavior and responses.\n * These are system prompts or guidelines that the AI should follow.\n */\n instructions: Template.annotations({\n description: \"Instructions that guide the AI assistant's behavior and responses\",\n }),\n\n /**\n * Array of tools that the AI assistant can use when this blueprint is active.\n */\n tools: Schema.Array(ToolId).annotations({\n description: 'Array of tools that the AI assistant can use when this blueprint is active',\n }),\n}).pipe(\n Type.Obj({\n // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.\n typename: 'dxos.org/type/Blueprint',\n version: '0.1.0',\n }),\n\n // TODO(burdon): Move to Type.Obj def?\n LabelAnnotation.set(['name']),\n);\n\n/**\n * TypeScript type for Blueprint.\n */\nexport interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {}\n\n/**\n * Create a new Blueprint.\n */\nexport const make = ({ tools = [], ...props }: Pick<Blueprint, 'key' | 'name' | 'instructions'> & Partial<Blueprint>) =>\n Obj.make(Blueprint, { tools, ...props });\n\n/**\n * Util to create tool definitions for a blueprint.\n */\nexport const toolDefinitions = ({\n tools = [],\n functions = [],\n}: {\n tools?: string[];\n functions?: FunctionDefinition[];\n}) => [...functions.map((fn) => ToolId.make(fn.name)), ...tools.map((tool) => ToolId.make(tool))];\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\nexport * from './template';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport handlebars from 'handlebars';\n\nimport { invariant } from '@dxos/invariant';\n\n/**\n * Process Handlebars template.\n */\nexport const process = <Options extends {}>(source: string, variables: Partial<Options> = {}): string => {\n invariant(source);\n let section = 0;\n handlebars.registerHelper('section', () => String(++section));\n const template = handlebars.compile(source.trim());\n const output = template(variables);\n return output.trim().replace(/(\\n\\s*){3,}/g, '\\n\\n');\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Ref, Type } from '@dxos/echo';\nimport { type ObjectId } from '@dxos/keys';\nimport { DataType } from '@dxos/schema';\n\n/**\n * Template input kind determines how template variables are resolved.\n */\nexport const InputKind = Schema.Literal(\n 'value', // Literal value.\n 'pass-through',\n 'retriever',\n 'function',\n 'query',\n 'resolver',\n 'context',\n 'schema',\n);\n\nexport type InputKind = Schema.Schema.Type<typeof InputKind>;\n\n/**\n * Template input variable.\n * E.g., {{foo}}\n */\nexport const Input = Schema.mutable(\n Schema.Struct({\n name: Schema.String,\n kind: Schema.optional(InputKind),\n default: Schema.optional(Schema.Any),\n }),\n);\n\nexport type Input = Schema.Schema.Type<typeof Input>;\n\n/**\n * Template type.\n */\nexport const Template = Schema.Struct({\n source: Type.Ref(DataType.Text).annotations({ description: 'Handlebars template source' }),\n inputs: Schema.optional(Schema.mutable(Schema.Array(Input))),\n}).pipe(Schema.mutable);\n\nexport interface Template extends Schema.Schema.Type<typeof Template> {}\n\nexport const make = ({ source, inputs = [], id }: { source: string; inputs?: Input[]; id?: ObjectId }): Template => ({\n source: Ref.make(DataType.makeText(source, id)),\n inputs,\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { log } from '@dxos/log';\n\nimport { type Blueprint } from './blueprint';\n\n/**\n * Blueprint registry.\n */\nexport class Registry {\n private readonly _blueprints: Blueprint[] = [];\n\n constructor(blueprints: Blueprint[]) {\n const seen = new Set<string>();\n blueprints.forEach((blueprint) => {\n if (seen.has(blueprint.key)) {\n log.warn('duplicate blueprint', { key: blueprint.key });\n } else {\n seen.add(blueprint.key);\n this._blueprints.push(blueprint);\n }\n });\n\n this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));\n }\n\n getByKey(key: string): Blueprint | undefined {\n return this._blueprints.find((blueprint) => blueprint.key === key);\n }\n\n query(): Blueprint[] {\n return this._blueprints;\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Obj, type Ref, Type } from '@dxos/echo';\nimport { JsonSchemaType, toJsonSchema } from '@dxos/echo-schema';\n\nimport { Blueprint } from '../blueprint';\n\n/**\n * Executable instructions.\n * Declare input and output schema.\n * May utilize blueprints.\n * May reference additional context.\n */\nconst Prompt_ = Schema.Struct({\n /**\n * Name of the prompt.\n */\n name: 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: JsonSchemaType,\n\n /**\n * Output schema of the prompt.\n */\n output: JsonSchemaType,\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: Schema.String,\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),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Prompt',\n version: '0.1.0',\n }),\n);\nexport interface Prompt extends Schema.Schema.Type<typeof Prompt_> {}\nexport interface Prompt_Encoded extends Schema.Schema.Encoded<typeof Prompt_> {}\nexport const Prompt: Schema.Schema<Prompt, Prompt_Encoded> = Prompt_;\n\nexport const make = (opts: {\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: opts.name,\n description: opts.description,\n input: toJsonSchema(opts.input),\n output: toJsonSchema(opts.output),\n instructions: opts.instructions,\n blueprints: opts.blueprints ?? [],\n context: opts.context ?? [],\n });\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAAA;;;;cAAAA;EAAA;;;;ACIA,SAASC,UAAAA,eAAc;AAEvB,SAASC,cAAc;AACvB,SAASC,KAAKC,QAAAA,aAAY;AAC1B,SAASC,uBAAuB;;;ACRhC;;;;;;;;;;ACIA,OAAOC,gBAAgB;AAEvB,SAASC,iBAAiB;;AAKnB,IAAMC,UAAU,CAAqBC,QAAgBC,YAA8B,CAAC,MAAC;AAC1FH,YAAUE,QAAAA,QAAAA;;;;;;;;;AACV,MAAIE,UAAU;AACdL,aAAWM,eAAe,WAAW,MAAMC,OAAO,EAAEF,OAAAA,CAAAA;AACpD,QAAMG,WAAWR,WAAWS,QAAQN,OAAOO,KAAI,CAAA;AAC/C,QAAMC,SAASH,SAASJ,SAAAA;AACxB,SAAOO,OAAOD,KAAI,EAAGE,QAAQ,gBAAgB,MAAA;AAC/C;;;ACdA,SAASC,cAAc;AAEvB,SAASC,KAAKC,YAAY;AAE1B,SAASC,gBAAgB;AAKlB,IAAMC,YAAYC,OAAOC,QAC9B,SACA,gBACA,aACA,YACA,SACA,YACA,WACA,QAAA;AASK,IAAMC,QAAQF,OAAOG,QAC1BH,OAAOI,OAAO;EACZC,MAAML,OAAOM;EACbC,MAAMP,OAAOQ,SAAST,SAAAA;EACtBU,SAAST,OAAOQ,SAASR,OAAOU,GAAG;AACrC,CAAA,CAAA;AAQK,IAAMC,WAAWX,OAAOI,OAAO;EACpCQ,QAAQC,KAAKC,IAAIC,SAASC,IAAI,EAAEC,YAAY;IAAEC,aAAa;EAA6B,CAAA;EACxFC,QAAQnB,OAAOQ,SAASR,OAAOG,QAAQH,OAAOoB,MAAMlB,KAAAA,CAAAA,CAAAA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AKR,WAAW,CAAA;AAC3B,CAAA;",
|
|
6
|
+
"names": ["make", "Schema", "ToolId", "Obj", "Type", "LabelAnnotation", "handlebars", "invariant", "process", "source", "variables", "section", "registerHelper", "String", "template", "compile", "trim", "output", "replace", "Schema", "Ref", "Type", "DataType", "InputKind", "Schema", "Literal", "Input", "mutable", "Struct", "name", "String", "kind", "optional", "default", "Any", "Template", "source", "Type", "Ref", "DataType", "Text", "annotations", "description", "inputs", "Array", "pipe", "make", "id", "makeText", "Blueprint", "Schema", "Struct", "key", "String", "annotations", "description", "name", "optional", "instructions", "Template", "tools", "Array", "ToolId", "pipe", "Type", "Obj", "typename", "version", "LabelAnnotation", "set", "make", "props", "toolDefinitions", "functions", "map", "fn", "tool", "log", "Registry", "getByKey", "key", "_blueprints", "find", "blueprint", "query", "blueprints", "seen", "Set", "forEach", "has", "warn", "add", "push", "sort", "name", "a", "b", "localeCompare", "make", "Schema", "Obj", "Type", "JsonSchemaType", "toJsonSchema", "Prompt_", "Schema", "Struct", "name", "String", "description", "optional", "input", "JsonSchemaType", "output", "instructions", "blueprints", "Array", "Type", "Ref", "Blueprint", "context", "Any", "pipe", "Obj", "typename", "version", "Prompt", "make", "opts", "toJsonSchema"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/template/prompt.ts":{"bytes":2238,"imports":[{"path":"handlebars","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/template/template.ts":{"bytes":4373,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"src/template/index.ts":{"bytes":546,"imports":[{"path":"src/template/prompt.ts","kind":"import-statement","original":"./prompt"},{"path":"src/template/template.ts","kind":"import-statement","original":"./template"}],"format":"esm"},"src/blueprint/blueprint.ts":{"bytes":8075,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"src/template/index.ts","kind":"import-statement","original":"../template"}],"format":"esm"},"src/blueprint/registry.ts":{"bytes":3784,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/blueprint/index.ts":{"bytes":554,"imports":[{"path":"src/blueprint/blueprint.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/blueprint/registry.ts","kind":"import-statement","original":"./registry"}],"format":"esm"},"src/prompt/prompt.ts":{"bytes":6070,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"src/blueprint/index.ts","kind":"import-statement","original":"../blueprint"}],"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/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":12564},"dist/lib/browser/index.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","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":1892},"src/template/index.ts":{"bytesInOutput":185},"src/template/prompt.ts":{"bytesInOutput":569},"src/template/template.ts":{"bytesInOutput":714},"src/blueprint/registry.ts":{"bytesInOutput":1109},"src/index.ts":{"bytesInOutput":0},"src/prompt/index.ts":{"bytesInOutput":100},"src/prompt/prompt.ts":{"bytesInOutput":1325}},"bytes":6633}}}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// src/blueprint/index.ts
|
|
9
|
+
var blueprint_exports = {};
|
|
10
|
+
__export(blueprint_exports, {
|
|
11
|
+
Blueprint: () => Blueprint,
|
|
12
|
+
Registry: () => Registry,
|
|
13
|
+
make: () => make2,
|
|
14
|
+
toolDefinitions: () => toolDefinitions
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// src/blueprint/blueprint.ts
|
|
18
|
+
import { Schema as Schema2 } from "effect";
|
|
19
|
+
import { ToolId } from "@dxos/ai";
|
|
20
|
+
import { Obj, Type as Type2 } from "@dxos/echo";
|
|
21
|
+
import { LabelAnnotation } from "@dxos/echo-schema";
|
|
22
|
+
|
|
23
|
+
// src/template/index.ts
|
|
24
|
+
var template_exports = {};
|
|
25
|
+
__export(template_exports, {
|
|
26
|
+
Input: () => Input,
|
|
27
|
+
InputKind: () => InputKind,
|
|
28
|
+
Template: () => Template,
|
|
29
|
+
make: () => make,
|
|
30
|
+
process: () => process
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// src/template/prompt.ts
|
|
34
|
+
import handlebars from "handlebars";
|
|
35
|
+
import { invariant } from "@dxos/invariant";
|
|
36
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/core/blueprints/src/template/prompt.ts";
|
|
37
|
+
var process = (source, variables = {}) => {
|
|
38
|
+
invariant(source, void 0, {
|
|
39
|
+
F: __dxlog_file,
|
|
40
|
+
L: 13,
|
|
41
|
+
S: void 0,
|
|
42
|
+
A: [
|
|
43
|
+
"source",
|
|
44
|
+
""
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
let section = 0;
|
|
48
|
+
handlebars.registerHelper("section", () => String(++section));
|
|
49
|
+
const template = handlebars.compile(source.trim());
|
|
50
|
+
const output = template(variables);
|
|
51
|
+
return output.trim().replace(/(\n\s*){3,}/g, "\n\n");
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/template/template.ts
|
|
55
|
+
import { Schema } from "effect";
|
|
56
|
+
import { Ref, Type } from "@dxos/echo";
|
|
57
|
+
import { DataType } from "@dxos/schema";
|
|
58
|
+
var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
|
|
59
|
+
var Input = Schema.mutable(Schema.Struct({
|
|
60
|
+
name: Schema.String,
|
|
61
|
+
kind: Schema.optional(InputKind),
|
|
62
|
+
default: Schema.optional(Schema.Any)
|
|
63
|
+
}));
|
|
64
|
+
var Template = Schema.Struct({
|
|
65
|
+
source: Type.Ref(DataType.Text).annotations({
|
|
66
|
+
description: "Handlebars template source"
|
|
67
|
+
}),
|
|
68
|
+
inputs: Schema.optional(Schema.mutable(Schema.Array(Input)))
|
|
69
|
+
}).pipe(Schema.mutable);
|
|
70
|
+
var make = ({ source, inputs = [], id }) => ({
|
|
71
|
+
source: Ref.make(DataType.makeText(source, id)),
|
|
72
|
+
inputs
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// src/blueprint/blueprint.ts
|
|
76
|
+
var Blueprint = Schema2.Struct({
|
|
77
|
+
/**
|
|
78
|
+
* Global registry ID.
|
|
79
|
+
* NOTE: The `key` property refers to the original registry entry.
|
|
80
|
+
*/
|
|
81
|
+
// TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.
|
|
82
|
+
key: Schema2.String.annotations({
|
|
83
|
+
description: "Unique registration key for the blueprint"
|
|
84
|
+
}),
|
|
85
|
+
/**
|
|
86
|
+
* Human-readable name of the blueprint.
|
|
87
|
+
*/
|
|
88
|
+
name: Schema2.String.annotations({
|
|
89
|
+
description: "Human-readable name of the blueprint"
|
|
90
|
+
}),
|
|
91
|
+
/**
|
|
92
|
+
* Description of the blueprint's purpose and functionality.
|
|
93
|
+
*/
|
|
94
|
+
description: Schema2.optional(Schema2.String).annotations({
|
|
95
|
+
description: "Description of the blueprint's purpose and functionality"
|
|
96
|
+
}),
|
|
97
|
+
/**
|
|
98
|
+
* Instructions that guide the AI assistant's behavior and responses.
|
|
99
|
+
* These are system prompts or guidelines that the AI should follow.
|
|
100
|
+
*/
|
|
101
|
+
instructions: Template.annotations({
|
|
102
|
+
description: "Instructions that guide the AI assistant's behavior and responses"
|
|
103
|
+
}),
|
|
104
|
+
/**
|
|
105
|
+
* Array of tools that the AI assistant can use when this blueprint is active.
|
|
106
|
+
*/
|
|
107
|
+
tools: Schema2.Array(ToolId).annotations({
|
|
108
|
+
description: "Array of tools that the AI assistant can use when this blueprint is active"
|
|
109
|
+
})
|
|
110
|
+
}).pipe(
|
|
111
|
+
Type2.Obj({
|
|
112
|
+
// TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.
|
|
113
|
+
typename: "dxos.org/type/Blueprint",
|
|
114
|
+
version: "0.1.0"
|
|
115
|
+
}),
|
|
116
|
+
// TODO(burdon): Move to Type.Obj def?
|
|
117
|
+
LabelAnnotation.set([
|
|
118
|
+
"name"
|
|
119
|
+
])
|
|
120
|
+
);
|
|
121
|
+
var make2 = ({ tools = [], ...props }) => Obj.make(Blueprint, {
|
|
122
|
+
tools,
|
|
123
|
+
...props
|
|
124
|
+
});
|
|
125
|
+
var toolDefinitions = ({ tools = [], functions = [] }) => [
|
|
126
|
+
...functions.map((fn) => ToolId.make(fn.name)),
|
|
127
|
+
...tools.map((tool) => ToolId.make(tool))
|
|
128
|
+
];
|
|
129
|
+
|
|
130
|
+
// src/blueprint/registry.ts
|
|
131
|
+
import { log } from "@dxos/log";
|
|
132
|
+
function _define_property(obj, key, value) {
|
|
133
|
+
if (key in obj) {
|
|
134
|
+
Object.defineProperty(obj, key, {
|
|
135
|
+
value,
|
|
136
|
+
enumerable: true,
|
|
137
|
+
configurable: true,
|
|
138
|
+
writable: true
|
|
139
|
+
});
|
|
140
|
+
} else {
|
|
141
|
+
obj[key] = value;
|
|
142
|
+
}
|
|
143
|
+
return obj;
|
|
144
|
+
}
|
|
145
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/core/blueprints/src/blueprint/registry.ts";
|
|
146
|
+
var Registry = class {
|
|
147
|
+
getByKey(key) {
|
|
148
|
+
return this._blueprints.find((blueprint) => blueprint.key === key);
|
|
149
|
+
}
|
|
150
|
+
query() {
|
|
151
|
+
return this._blueprints;
|
|
152
|
+
}
|
|
153
|
+
constructor(blueprints) {
|
|
154
|
+
_define_property(this, "_blueprints", []);
|
|
155
|
+
const seen = /* @__PURE__ */ new Set();
|
|
156
|
+
blueprints.forEach((blueprint) => {
|
|
157
|
+
if (seen.has(blueprint.key)) {
|
|
158
|
+
log.warn("duplicate blueprint", {
|
|
159
|
+
key: blueprint.key
|
|
160
|
+
}, {
|
|
161
|
+
F: __dxlog_file2,
|
|
162
|
+
L: 19,
|
|
163
|
+
S: this,
|
|
164
|
+
C: (f, a) => f(...a)
|
|
165
|
+
});
|
|
166
|
+
} else {
|
|
167
|
+
seen.add(blueprint.key);
|
|
168
|
+
this._blueprints.push(blueprint);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
// src/prompt/index.ts
|
|
176
|
+
var prompt_exports = {};
|
|
177
|
+
__export(prompt_exports, {
|
|
178
|
+
Prompt: () => Prompt,
|
|
179
|
+
make: () => make3
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// src/prompt/prompt.ts
|
|
183
|
+
import { Schema as Schema3 } from "effect";
|
|
184
|
+
import { Obj as Obj2, Type as Type3 } from "@dxos/echo";
|
|
185
|
+
import { JsonSchemaType, toJsonSchema } from "@dxos/echo-schema";
|
|
186
|
+
var Prompt_ = Schema3.Struct({
|
|
187
|
+
/**
|
|
188
|
+
* Name of the prompt.
|
|
189
|
+
*/
|
|
190
|
+
name: Schema3.String,
|
|
191
|
+
/**
|
|
192
|
+
* Description of the prompt's purpose and functionality.
|
|
193
|
+
* Allows AI agents to execute prompts automatically as tools.
|
|
194
|
+
*/
|
|
195
|
+
description: Schema3.optional(Schema3.String),
|
|
196
|
+
/**
|
|
197
|
+
* Input schema of the prompt.
|
|
198
|
+
*/
|
|
199
|
+
input: JsonSchemaType,
|
|
200
|
+
/**
|
|
201
|
+
* Output schema of the prompt.
|
|
202
|
+
*/
|
|
203
|
+
output: JsonSchemaType,
|
|
204
|
+
/**
|
|
205
|
+
* Natural language instructions for the prompt.
|
|
206
|
+
* These should provide concrete course of action for the AI to follow.
|
|
207
|
+
*/
|
|
208
|
+
instructions: Schema3.String,
|
|
209
|
+
/**
|
|
210
|
+
* Blueprints that the prompt may utilize.
|
|
211
|
+
*/
|
|
212
|
+
blueprints: Schema3.Array(Type3.Ref(Blueprint)),
|
|
213
|
+
/**
|
|
214
|
+
* Additional context that the prompt may utilize.
|
|
215
|
+
*/
|
|
216
|
+
context: Schema3.Array(Schema3.Any)
|
|
217
|
+
}).pipe(Type3.Obj({
|
|
218
|
+
typename: "dxos.org/type/Prompt",
|
|
219
|
+
version: "0.1.0"
|
|
220
|
+
}));
|
|
221
|
+
var Prompt = Prompt_;
|
|
222
|
+
var make3 = (opts) => Obj2.make(Prompt, {
|
|
223
|
+
name: opts.name,
|
|
224
|
+
description: opts.description,
|
|
225
|
+
input: toJsonSchema(opts.input),
|
|
226
|
+
output: toJsonSchema(opts.output),
|
|
227
|
+
instructions: opts.instructions,
|
|
228
|
+
blueprints: opts.blueprints ?? [],
|
|
229
|
+
context: opts.context ?? []
|
|
230
|
+
});
|
|
231
|
+
export {
|
|
232
|
+
blueprint_exports as Blueprint,
|
|
233
|
+
prompt_exports as Prompt,
|
|
234
|
+
template_exports as Template
|
|
235
|
+
};
|
|
236
|
+
//# 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 { Schema } from 'effect';\n\nimport { ToolId } from '@dxos/ai';\nimport { Obj, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo-schema';\nimport { type FunctionDefinition } from '@dxos/functions';\n\nimport { Template } from '../template';\n\n/**\n * Blueprint schema defines the structure for AI assistant blueprints.\n * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.\n * Blueprints may use tools to create and read artifacts, which are managed by the assistant.\n */\nexport const Blueprint = Schema.Struct({\n /**\n * Global registry ID.\n * NOTE: The `key` property refers to the original registry entry.\n */\n // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.\n key: Schema.String.annotations({\n description: 'Unique registration key for the blueprint',\n }),\n\n /**\n * Human-readable name of the blueprint.\n */\n name: Schema.String.annotations({\n description: 'Human-readable name of the blueprint',\n }),\n\n /**\n * Description of the blueprint's purpose and functionality.\n */\n description: Schema.optional(Schema.String).annotations({\n description: \"Description of the blueprint's purpose and functionality\",\n }),\n\n /**\n * Instructions that guide the AI assistant's behavior and responses.\n * These are system prompts or guidelines that the AI should follow.\n */\n instructions: Template.annotations({\n description: \"Instructions that guide the AI assistant's behavior and responses\",\n }),\n\n /**\n * Array of tools that the AI assistant can use when this blueprint is active.\n */\n tools: Schema.Array(ToolId).annotations({\n description: 'Array of tools that the AI assistant can use when this blueprint is active',\n }),\n}).pipe(\n Type.Obj({\n // TODO(burdon): Is this a DXN? Need to create a Format type for these IDs.\n typename: 'dxos.org/type/Blueprint',\n version: '0.1.0',\n }),\n\n // TODO(burdon): Move to Type.Obj def?\n LabelAnnotation.set(['name']),\n);\n\n/**\n * TypeScript type for Blueprint.\n */\nexport interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {}\n\n/**\n * Create a new Blueprint.\n */\nexport const make = ({ tools = [], ...props }: Pick<Blueprint, 'key' | 'name' | 'instructions'> & Partial<Blueprint>) =>\n Obj.make(Blueprint, { tools, ...props });\n\n/**\n * Util to create tool definitions for a blueprint.\n */\nexport const toolDefinitions = ({\n tools = [],\n functions = [],\n}: {\n tools?: string[];\n functions?: FunctionDefinition[];\n}) => [...functions.map((fn) => ToolId.make(fn.name)), ...tools.map((tool) => ToolId.make(tool))];\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\nexport * from './template';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport handlebars from 'handlebars';\n\nimport { invariant } from '@dxos/invariant';\n\n/**\n * Process Handlebars template.\n */\nexport const process = <Options extends {}>(source: string, variables: Partial<Options> = {}): string => {\n invariant(source);\n let section = 0;\n handlebars.registerHelper('section', () => String(++section));\n const template = handlebars.compile(source.trim());\n const output = template(variables);\n return output.trim().replace(/(\\n\\s*){3,}/g, '\\n\\n');\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Ref, Type } from '@dxos/echo';\nimport { type ObjectId } from '@dxos/keys';\nimport { DataType } from '@dxos/schema';\n\n/**\n * Template input kind determines how template variables are resolved.\n */\nexport const InputKind = Schema.Literal(\n 'value', // Literal value.\n 'pass-through',\n 'retriever',\n 'function',\n 'query',\n 'resolver',\n 'context',\n 'schema',\n);\n\nexport type InputKind = Schema.Schema.Type<typeof InputKind>;\n\n/**\n * Template input variable.\n * E.g., {{foo}}\n */\nexport const Input = Schema.mutable(\n Schema.Struct({\n name: Schema.String,\n kind: Schema.optional(InputKind),\n default: Schema.optional(Schema.Any),\n }),\n);\n\nexport type Input = Schema.Schema.Type<typeof Input>;\n\n/**\n * Template type.\n */\nexport const Template = Schema.Struct({\n source: Type.Ref(DataType.Text).annotations({ description: 'Handlebars template source' }),\n inputs: Schema.optional(Schema.mutable(Schema.Array(Input))),\n}).pipe(Schema.mutable);\n\nexport interface Template extends Schema.Schema.Type<typeof Template> {}\n\nexport const make = ({ source, inputs = [], id }: { source: string; inputs?: Input[]; id?: ObjectId }): Template => ({\n source: Ref.make(DataType.makeText(source, id)),\n inputs,\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { log } from '@dxos/log';\n\nimport { type Blueprint } from './blueprint';\n\n/**\n * Blueprint registry.\n */\nexport class Registry {\n private readonly _blueprints: Blueprint[] = [];\n\n constructor(blueprints: Blueprint[]) {\n const seen = new Set<string>();\n blueprints.forEach((blueprint) => {\n if (seen.has(blueprint.key)) {\n log.warn('duplicate blueprint', { key: blueprint.key });\n } else {\n seen.add(blueprint.key);\n this._blueprints.push(blueprint);\n }\n });\n\n this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));\n }\n\n getByKey(key: string): Blueprint | undefined {\n return this._blueprints.find((blueprint) => blueprint.key === key);\n }\n\n query(): Blueprint[] {\n return this._blueprints;\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './prompt';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Obj, type Ref, Type } from '@dxos/echo';\nimport { JsonSchemaType, toJsonSchema } from '@dxos/echo-schema';\n\nimport { Blueprint } from '../blueprint';\n\n/**\n * Executable instructions.\n * Declare input and output schema.\n * May utilize blueprints.\n * May reference additional context.\n */\nconst Prompt_ = Schema.Struct({\n /**\n * Name of the prompt.\n */\n name: 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: JsonSchemaType,\n\n /**\n * Output schema of the prompt.\n */\n output: JsonSchemaType,\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: Schema.String,\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),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Prompt',\n version: '0.1.0',\n }),\n);\nexport interface Prompt extends Schema.Schema.Type<typeof Prompt_> {}\nexport interface Prompt_Encoded extends Schema.Schema.Encoded<typeof Prompt_> {}\nexport const Prompt: Schema.Schema<Prompt, Prompt_Encoded> = Prompt_;\n\nexport const make = (opts: {\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: opts.name,\n description: opts.description,\n input: toJsonSchema(opts.input),\n output: toJsonSchema(opts.output),\n instructions: opts.instructions,\n blueprints: opts.blueprints ?? [],\n context: opts.context ?? [],\n });\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAAA;;;;cAAAA;EAAA;;;;ACIA,SAASC,UAAAA,eAAc;AAEvB,SAASC,cAAc;AACvB,SAASC,KAAKC,QAAAA,aAAY;AAC1B,SAASC,uBAAuB;;;ACRhC;;;;;;;;;;ACIA,OAAOC,gBAAgB;AAEvB,SAASC,iBAAiB;;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,EAAC,GAAI,EAAED,MAAME,EAAC,MAAOD,EAAEE,cAAcD,CAAAA,CAAAA;EACtE;AASF;;;ACnCA;;;cAAAE;;;;ACIA,SAASC,UAAAA,eAAc;AAEvB,SAASC,OAAAA,MAAeC,QAAAA,aAAY;AACpC,SAASC,gBAAgBC,oBAAoB;AAU7C,IAAMC,UAAUC,QAAOC,OAAO;;;;EAI5BC,MAAMF,QAAOG;;;;;EAMbC,aAAaJ,QAAOK,SAASL,QAAOG,MAAM;;;;EAK1CG,OAAOC;;;;EAKPC,QAAQD;;;;;EAMRE,cAAcT,QAAOG;;;;EAKrBO,YAAYV,QAAOW,MAAMC,MAAKC,IAAIC,SAAAA,CAAAA;;;;EAKlCC,SAASf,QAAOW,MAAMX,QAAOgB,GAAG;AAClC,CAAA,EAAGC,KACDL,MAAKM,IAAI;EACPC,UAAU;EACVC,SAAS;AACX,CAAA,CAAA;AAIK,IAAMC,SAAgDtB;AAEtD,IAAMuB,QAAO,CAACC,SASnBL,KAAII,KAAKD,QAAQ;EACfnB,MAAMqB,KAAKrB;EACXE,aAAamB,KAAKnB;EAClBE,OAAOkB,aAAaD,KAAKjB,KAAK;EAC9BE,QAAQgB,aAAaD,KAAKf,MAAM;EAChCC,cAAcc,KAAKd;EACnBC,YAAYa,KAAKb,cAAc,CAAA;EAC/BK,SAASQ,KAAKR,WAAW,CAAA;AAC3B,CAAA;",
|
|
6
|
+
"names": ["make", "Schema", "ToolId", "Obj", "Type", "LabelAnnotation", "handlebars", "invariant", "process", "source", "variables", "section", "registerHelper", "String", "template", "compile", "trim", "output", "replace", "Schema", "Ref", "Type", "DataType", "InputKind", "Schema", "Literal", "Input", "mutable", "Struct", "name", "String", "kind", "optional", "default", "Any", "Template", "source", "Type", "Ref", "DataType", "Text", "annotations", "description", "inputs", "Array", "pipe", "make", "id", "makeText", "Blueprint", "Schema", "Struct", "key", "String", "annotations", "description", "name", "optional", "instructions", "Template", "tools", "Array", "ToolId", "pipe", "Type", "Obj", "typename", "version", "LabelAnnotation", "set", "make", "props", "toolDefinitions", "functions", "map", "fn", "tool", "log", "Registry", "getByKey", "key", "_blueprints", "find", "blueprint", "query", "blueprints", "seen", "Set", "forEach", "has", "warn", "add", "push", "sort", "name", "a", "b", "localeCompare", "make", "Schema", "Obj", "Type", "JsonSchemaType", "toJsonSchema", "Prompt_", "Schema", "Struct", "name", "String", "description", "optional", "input", "JsonSchemaType", "output", "instructions", "blueprints", "Array", "Type", "Ref", "Blueprint", "context", "Any", "pipe", "Obj", "typename", "version", "Prompt", "make", "opts", "toJsonSchema"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/template/prompt.ts":{"bytes":2238,"imports":[{"path":"handlebars","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/template/template.ts":{"bytes":4373,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"src/template/index.ts":{"bytes":546,"imports":[{"path":"src/template/prompt.ts","kind":"import-statement","original":"./prompt"},{"path":"src/template/template.ts","kind":"import-statement","original":"./template"}],"format":"esm"},"src/blueprint/blueprint.ts":{"bytes":8075,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"src/template/index.ts","kind":"import-statement","original":"../template"}],"format":"esm"},"src/blueprint/registry.ts":{"bytes":3784,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/blueprint/index.ts":{"bytes":554,"imports":[{"path":"src/blueprint/blueprint.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/blueprint/registry.ts","kind":"import-statement","original":"./registry"}],"format":"esm"},"src/prompt/prompt.ts":{"bytes":6070,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"src/blueprint/index.ts","kind":"import-statement","original":"../blueprint"}],"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/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":12565},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"handlebars","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","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":1892},"src/template/index.ts":{"bytesInOutput":185},"src/template/prompt.ts":{"bytesInOutput":569},"src/template/template.ts":{"bytesInOutput":714},"src/blueprint/registry.ts":{"bytesInOutput":1109},"src/index.ts":{"bytesInOutput":0},"src/prompt/index.ts":{"bytesInOutput":100},"src/prompt/prompt.ts":{"bytesInOutput":1325}},"bytes":6725}}}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import { Type } from '@dxos/echo';
|
|
3
|
+
import { type FunctionDefinition } from '@dxos/functions';
|
|
4
|
+
/**
|
|
5
|
+
* Blueprint schema defines the structure for AI assistant blueprints.
|
|
6
|
+
* Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.
|
|
7
|
+
* Blueprints may use tools to create and read artifacts, which are managed by the assistant.
|
|
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-schema").Ref<Type.OfKind<import("@dxos/echo-schema").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
|
+
}>>;
|
|
42
|
+
/**
|
|
43
|
+
* TypeScript type for Blueprint.
|
|
44
|
+
*/
|
|
45
|
+
export interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create a new Blueprint.
|
|
49
|
+
*/
|
|
50
|
+
export declare const make: ({ tools, ...props }: Pick<Blueprint, "key" | "name" | "instructions"> & Partial<Blueprint>) => import("@dxos/live-object").Live<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
51
|
+
key: string;
|
|
52
|
+
name: string;
|
|
53
|
+
description?: string | undefined;
|
|
54
|
+
instructions: {
|
|
55
|
+
source: import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
56
|
+
content: string;
|
|
57
|
+
}>;
|
|
58
|
+
inputs?: {
|
|
59
|
+
name: string;
|
|
60
|
+
kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
|
|
61
|
+
default?: any;
|
|
62
|
+
}[] | undefined;
|
|
63
|
+
};
|
|
64
|
+
tools: (string & import("effect/Brand").Brand<"ToolId">)[];
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Util to create tool definitions for a blueprint.
|
|
68
|
+
*/
|
|
69
|
+
export declare const toolDefinitions: ({ tools, functions, }: {
|
|
70
|
+
tools?: string[];
|
|
71
|
+
functions?: FunctionDefinition[];
|
|
72
|
+
}) => (string & import("effect/Brand").Brand<"ToolId">)[];
|
|
73
|
+
//# sourceMappingURL=blueprint.d.ts.map
|