@dxos/blueprints 0.8.4-main.3f58842 → 0.8.4-main.5ea62a8
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/dist/lib/browser/index.mjs +64 -40
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +64 -40
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/blueprint/blueprint.d.ts +36 -10
- package/dist/types/src/blueprint/blueprint.d.ts.map +1 -1
- package/dist/types/src/blueprint/registry.d.ts +1 -1
- package/dist/types/src/blueprint/registry.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/template/prompt.d.ts +1 -1
- package/dist/types/src/template/prompt.d.ts.map +1 -1
- package/dist/types/src/template/template.d.ts +6 -17
- package/dist/types/src/template/template.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -10
- package/src/blueprint/blueprint.ts +20 -2
- package/src/blueprint/registry.ts +15 -1
- package/src/index.ts +0 -1
- package/src/template/prompt.test.ts +2 -2
- package/src/template/prompt.ts +4 -4
- package/src/template/template.ts +7 -19
- package/dist/types/src/artifacts.d.ts +0 -40
- package/dist/types/src/artifacts.d.ts.map +0 -1
- package/src/artifacts.ts +0 -60
|
@@ -4,21 +4,20 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// src/artifacts.ts
|
|
8
|
-
var defineArtifact = (definition) => definition;
|
|
9
|
-
|
|
10
7
|
// src/blueprint/index.ts
|
|
11
8
|
var blueprint_exports = {};
|
|
12
9
|
__export(blueprint_exports, {
|
|
13
10
|
Blueprint: () => Blueprint,
|
|
14
|
-
Registry: () => Registry
|
|
11
|
+
Registry: () => Registry,
|
|
12
|
+
make: () => make2,
|
|
13
|
+
toolDefinitions: () => toolDefinitions
|
|
15
14
|
});
|
|
16
15
|
|
|
17
16
|
// src/blueprint/blueprint.ts
|
|
18
17
|
import { Schema as Schema2 } from "effect";
|
|
19
18
|
import { ToolId } from "@dxos/ai";
|
|
20
|
-
import { Type as Type2 } from "@dxos/echo";
|
|
21
|
-
import { LabelAnnotation
|
|
19
|
+
import { Obj, Type as Type2 } from "@dxos/echo";
|
|
20
|
+
import { LabelAnnotation } from "@dxos/echo-schema";
|
|
22
21
|
|
|
23
22
|
// src/template/index.ts
|
|
24
23
|
var template_exports = {};
|
|
@@ -26,19 +25,18 @@ __export(template_exports, {
|
|
|
26
25
|
Input: () => Input,
|
|
27
26
|
InputKind: () => InputKind,
|
|
28
27
|
Template: () => Template,
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
make: () => make,
|
|
29
|
+
process: () => process
|
|
31
30
|
});
|
|
32
31
|
|
|
33
32
|
// src/template/prompt.ts
|
|
34
33
|
import handlebars from "handlebars";
|
|
35
|
-
import defaultsDeep from "lodash.defaultsdeep";
|
|
36
34
|
import { invariant } from "@dxos/invariant";
|
|
37
35
|
var __dxlog_file = "/__w/dxos/dxos/packages/core/blueprints/src/template/prompt.ts";
|
|
38
|
-
var
|
|
36
|
+
var process = (source, variables = {}) => {
|
|
39
37
|
invariant(source, void 0, {
|
|
40
38
|
F: __dxlog_file,
|
|
41
|
-
L:
|
|
39
|
+
L: 13,
|
|
42
40
|
S: void 0,
|
|
43
41
|
A: [
|
|
44
42
|
"source",
|
|
@@ -47,16 +45,14 @@ var createPrompt = (source, options = {}) => {
|
|
|
47
45
|
});
|
|
48
46
|
let section = 0;
|
|
49
47
|
handlebars.registerHelper("section", () => String(++section));
|
|
50
|
-
const template = handlebars.compile(source);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
})).trim();
|
|
48
|
+
const template = handlebars.compile(source.trim());
|
|
49
|
+
const output = template(variables);
|
|
50
|
+
return output.trim().replace(/(\n\s*){3,}/g, "\n\n");
|
|
54
51
|
};
|
|
55
52
|
|
|
56
53
|
// src/template/template.ts
|
|
57
54
|
import { Schema } from "effect";
|
|
58
|
-
import {
|
|
59
|
-
import { LabelAnnotation } from "@dxos/echo-schema";
|
|
55
|
+
import { Ref, Type } from "@dxos/echo";
|
|
60
56
|
import { DataType } from "@dxos/schema";
|
|
61
57
|
var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
|
|
62
58
|
var Input = Schema.mutable(Schema.Struct({
|
|
@@ -65,25 +61,15 @@ var Input = Schema.mutable(Schema.Struct({
|
|
|
65
61
|
default: Schema.optional(Schema.Any)
|
|
66
62
|
}));
|
|
67
63
|
var Template = Schema.Struct({
|
|
68
|
-
name: Schema.optional(Schema.String),
|
|
69
64
|
source: Type.Ref(DataType.Text).annotations({
|
|
70
65
|
description: "Handlebars template source"
|
|
71
66
|
}),
|
|
72
67
|
inputs: Schema.optional(Schema.mutable(Schema.Array(Input)))
|
|
73
|
-
}).pipe(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
]));
|
|
79
|
-
var make = ({ source = "", ...props }) => {
|
|
80
|
-
return Obj.make(Template, {
|
|
81
|
-
source: Ref.make(Obj.make(DataType.Text, {
|
|
82
|
-
content: source
|
|
83
|
-
})),
|
|
84
|
-
...props
|
|
85
|
-
});
|
|
86
|
-
};
|
|
68
|
+
}).pipe(Schema.mutable);
|
|
69
|
+
var make = ({ source, inputs = [], id }) => ({
|
|
70
|
+
source: Ref.make(DataType.makeText(source, id)),
|
|
71
|
+
inputs
|
|
72
|
+
});
|
|
87
73
|
|
|
88
74
|
// src/blueprint/blueprint.ts
|
|
89
75
|
var Blueprint = Schema2.Struct({
|
|
@@ -111,7 +97,7 @@ var Blueprint = Schema2.Struct({
|
|
|
111
97
|
* Instructions that guide the AI assistant's behavior and responses.
|
|
112
98
|
* These are system prompts or guidelines that the AI should follow.
|
|
113
99
|
*/
|
|
114
|
-
instructions:
|
|
100
|
+
instructions: Template.annotations({
|
|
115
101
|
description: "Instructions that guide the AI assistant's behavior and responses"
|
|
116
102
|
}),
|
|
117
103
|
/**
|
|
@@ -127,27 +113,65 @@ var Blueprint = Schema2.Struct({
|
|
|
127
113
|
version: "0.1.0"
|
|
128
114
|
}),
|
|
129
115
|
// TODO(burdon): Move to Type.Obj def?
|
|
130
|
-
|
|
116
|
+
LabelAnnotation.set([
|
|
131
117
|
"name"
|
|
132
118
|
])
|
|
133
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
|
+
];
|
|
134
128
|
|
|
135
129
|
// src/blueprint/registry.ts
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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;
|
|
140
141
|
}
|
|
142
|
+
return obj;
|
|
143
|
+
}
|
|
144
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/core/blueprints/src/blueprint/registry.ts";
|
|
145
|
+
var Registry = class {
|
|
141
146
|
getByKey(key) {
|
|
142
147
|
return this._blueprints.find((blueprint) => blueprint.key === key);
|
|
143
148
|
}
|
|
144
149
|
query() {
|
|
145
150
|
return this._blueprints;
|
|
146
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
|
+
}
|
|
147
172
|
};
|
|
148
173
|
export {
|
|
149
174
|
blueprint_exports as Blueprint,
|
|
150
|
-
template_exports as Template
|
|
151
|
-
defineArtifact
|
|
175
|
+
template_exports as Template
|
|
152
176
|
};
|
|
153
177
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\
|
|
5
|
-
"mappings": ";;;;;;;
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../../src/blueprint/index.ts", "../../../src/blueprint/blueprint.ts", "../../../src/template/index.ts", "../../../src/template/prompt.ts", "../../../src/template/template.ts", "../../../src/blueprint/registry.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './blueprint';\nexport * from './registry';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { ToolId } from '@dxos/ai';\nimport { Obj, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo-schema';\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"],
|
|
5
|
+
"mappings": "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",
|
|
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"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/
|
|
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/index.ts":{"bytes":673,"imports":[{"path":"src/blueprint/index.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"./template"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9348},"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}],"exports":["Blueprint","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}},"bytes":5131}}}
|
|
@@ -5,21 +5,20 @@ var __export = (target, all) => {
|
|
|
5
5
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
// src/artifacts.ts
|
|
9
|
-
var defineArtifact = (definition) => definition;
|
|
10
|
-
|
|
11
8
|
// src/blueprint/index.ts
|
|
12
9
|
var blueprint_exports = {};
|
|
13
10
|
__export(blueprint_exports, {
|
|
14
11
|
Blueprint: () => Blueprint,
|
|
15
|
-
Registry: () => Registry
|
|
12
|
+
Registry: () => Registry,
|
|
13
|
+
make: () => make2,
|
|
14
|
+
toolDefinitions: () => toolDefinitions
|
|
16
15
|
});
|
|
17
16
|
|
|
18
17
|
// src/blueprint/blueprint.ts
|
|
19
18
|
import { Schema as Schema2 } from "effect";
|
|
20
19
|
import { ToolId } from "@dxos/ai";
|
|
21
|
-
import { Type as Type2 } from "@dxos/echo";
|
|
22
|
-
import { LabelAnnotation
|
|
20
|
+
import { Obj, Type as Type2 } from "@dxos/echo";
|
|
21
|
+
import { LabelAnnotation } from "@dxos/echo-schema";
|
|
23
22
|
|
|
24
23
|
// src/template/index.ts
|
|
25
24
|
var template_exports = {};
|
|
@@ -27,19 +26,18 @@ __export(template_exports, {
|
|
|
27
26
|
Input: () => Input,
|
|
28
27
|
InputKind: () => InputKind,
|
|
29
28
|
Template: () => Template,
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
make: () => make,
|
|
30
|
+
process: () => process
|
|
32
31
|
});
|
|
33
32
|
|
|
34
33
|
// src/template/prompt.ts
|
|
35
34
|
import handlebars from "handlebars";
|
|
36
|
-
import defaultsDeep from "lodash.defaultsdeep";
|
|
37
35
|
import { invariant } from "@dxos/invariant";
|
|
38
36
|
var __dxlog_file = "/__w/dxos/dxos/packages/core/blueprints/src/template/prompt.ts";
|
|
39
|
-
var
|
|
37
|
+
var process = (source, variables = {}) => {
|
|
40
38
|
invariant(source, void 0, {
|
|
41
39
|
F: __dxlog_file,
|
|
42
|
-
L:
|
|
40
|
+
L: 13,
|
|
43
41
|
S: void 0,
|
|
44
42
|
A: [
|
|
45
43
|
"source",
|
|
@@ -48,16 +46,14 @@ var createPrompt = (source, options = {}) => {
|
|
|
48
46
|
});
|
|
49
47
|
let section = 0;
|
|
50
48
|
handlebars.registerHelper("section", () => String(++section));
|
|
51
|
-
const template = handlebars.compile(source);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
})).trim();
|
|
49
|
+
const template = handlebars.compile(source.trim());
|
|
50
|
+
const output = template(variables);
|
|
51
|
+
return output.trim().replace(/(\n\s*){3,}/g, "\n\n");
|
|
55
52
|
};
|
|
56
53
|
|
|
57
54
|
// src/template/template.ts
|
|
58
55
|
import { Schema } from "effect";
|
|
59
|
-
import {
|
|
60
|
-
import { LabelAnnotation } from "@dxos/echo-schema";
|
|
56
|
+
import { Ref, Type } from "@dxos/echo";
|
|
61
57
|
import { DataType } from "@dxos/schema";
|
|
62
58
|
var InputKind = Schema.Literal("value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema");
|
|
63
59
|
var Input = Schema.mutable(Schema.Struct({
|
|
@@ -66,25 +62,15 @@ var Input = Schema.mutable(Schema.Struct({
|
|
|
66
62
|
default: Schema.optional(Schema.Any)
|
|
67
63
|
}));
|
|
68
64
|
var Template = Schema.Struct({
|
|
69
|
-
name: Schema.optional(Schema.String),
|
|
70
65
|
source: Type.Ref(DataType.Text).annotations({
|
|
71
66
|
description: "Handlebars template source"
|
|
72
67
|
}),
|
|
73
68
|
inputs: Schema.optional(Schema.mutable(Schema.Array(Input)))
|
|
74
|
-
}).pipe(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
]));
|
|
80
|
-
var make = ({ source = "", ...props }) => {
|
|
81
|
-
return Obj.make(Template, {
|
|
82
|
-
source: Ref.make(Obj.make(DataType.Text, {
|
|
83
|
-
content: source
|
|
84
|
-
})),
|
|
85
|
-
...props
|
|
86
|
-
});
|
|
87
|
-
};
|
|
69
|
+
}).pipe(Schema.mutable);
|
|
70
|
+
var make = ({ source, inputs = [], id }) => ({
|
|
71
|
+
source: Ref.make(DataType.makeText(source, id)),
|
|
72
|
+
inputs
|
|
73
|
+
});
|
|
88
74
|
|
|
89
75
|
// src/blueprint/blueprint.ts
|
|
90
76
|
var Blueprint = Schema2.Struct({
|
|
@@ -112,7 +98,7 @@ var Blueprint = Schema2.Struct({
|
|
|
112
98
|
* Instructions that guide the AI assistant's behavior and responses.
|
|
113
99
|
* These are system prompts or guidelines that the AI should follow.
|
|
114
100
|
*/
|
|
115
|
-
instructions:
|
|
101
|
+
instructions: Template.annotations({
|
|
116
102
|
description: "Instructions that guide the AI assistant's behavior and responses"
|
|
117
103
|
}),
|
|
118
104
|
/**
|
|
@@ -128,27 +114,65 @@ var Blueprint = Schema2.Struct({
|
|
|
128
114
|
version: "0.1.0"
|
|
129
115
|
}),
|
|
130
116
|
// TODO(burdon): Move to Type.Obj def?
|
|
131
|
-
|
|
117
|
+
LabelAnnotation.set([
|
|
132
118
|
"name"
|
|
133
119
|
])
|
|
134
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
|
+
];
|
|
135
129
|
|
|
136
130
|
// src/blueprint/registry.ts
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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;
|
|
141
142
|
}
|
|
143
|
+
return obj;
|
|
144
|
+
}
|
|
145
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/core/blueprints/src/blueprint/registry.ts";
|
|
146
|
+
var Registry = class {
|
|
142
147
|
getByKey(key) {
|
|
143
148
|
return this._blueprints.find((blueprint) => blueprint.key === key);
|
|
144
149
|
}
|
|
145
150
|
query() {
|
|
146
151
|
return this._blueprints;
|
|
147
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
|
+
}
|
|
148
173
|
};
|
|
149
174
|
export {
|
|
150
175
|
blueprint_exports as Blueprint,
|
|
151
|
-
template_exports as Template
|
|
152
|
-
defineArtifact
|
|
176
|
+
template_exports as Template
|
|
153
177
|
};
|
|
154
178
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\
|
|
5
|
-
"mappings": ";;;;;;;;
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../../src/blueprint/index.ts", "../../../src/blueprint/blueprint.ts", "../../../src/template/index.ts", "../../../src/template/prompt.ts", "../../../src/template/template.ts", "../../../src/blueprint/registry.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nexport * from './blueprint';\nexport * from './registry';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { ToolId } from '@dxos/ai';\nimport { Obj, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo-schema';\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"],
|
|
5
|
+
"mappings": "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",
|
|
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"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/
|
|
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/index.ts":{"bytes":673,"imports":[{"path":"src/blueprint/index.ts","kind":"import-statement","original":"./blueprint"},{"path":"src/template/index.ts","kind":"import-statement","original":"./template"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9349},"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}],"exports":["Blueprint","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}},"bytes":5223}}}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
2
|
import { Type } from '@dxos/echo';
|
|
3
|
+
import { type FunctionDefinition } from '@dxos/functions';
|
|
3
4
|
/**
|
|
4
5
|
* Blueprint schema defines the structure for AI assistant blueprints.
|
|
5
6
|
* Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.
|
|
@@ -23,17 +24,16 @@ export declare const Blueprint: Type.obj<Schema.Struct<{
|
|
|
23
24
|
* Instructions that guide the AI assistant's behavior and responses.
|
|
24
25
|
* These are system prompts or guidelines that the AI should follow.
|
|
25
26
|
*/
|
|
26
|
-
instructions: Schema.
|
|
27
|
-
|
|
28
|
-
source: import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
27
|
+
instructions: Schema.mutable<Schema.Struct<{
|
|
28
|
+
source: Schema.SchemaClass<import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
29
29
|
content: string;
|
|
30
|
-
}>;
|
|
31
|
-
inputs
|
|
32
|
-
name:
|
|
33
|
-
kind
|
|
34
|
-
default
|
|
35
|
-
}
|
|
36
|
-
}
|
|
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
37
|
/**
|
|
38
38
|
* Array of tools that the AI assistant can use when this blueprint is active.
|
|
39
39
|
*/
|
|
@@ -44,4 +44,30 @@ export declare const Blueprint: Type.obj<Schema.Struct<{
|
|
|
44
44
|
*/
|
|
45
45
|
export interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {
|
|
46
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">)[];
|
|
47
73
|
//# sourceMappingURL=blueprint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blueprint.d.ts","sourceRoot":"","sources":["../../../../src/blueprint/blueprint.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,
|
|
1
|
+
{"version":3,"file":"blueprint.d.ts","sourceRoot":"","sources":["../../../../src/blueprint/blueprint.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAI1D;;;;GAIG;AACH,eAAO,MAAM,SAAS;IACpB;;;OAGG;;IAMH;;OAEG;;IAKH;;OAEG;;IAKH;;;OAGG;;;;;;;;;;;IAKH;;OAEG;;GAaJ,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC;CAAG;AAE1E;;GAEG;AACH,eAAO,MAAM,IAAI,GAAI,qBAA0B,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,GAAG,cAAc,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;EAC1E,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,uBAG7B;IACD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAClC,wDAAgG,CAAC"}
|