@dxos/compute 0.9.0 → 0.9.1-staging.ee54ba693a
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/README.md +4 -4
- package/dist/lib/neutral/AgentService.mjs +12 -0
- package/dist/lib/neutral/StorageService.mjs +3 -3
- package/dist/lib/neutral/{chunk-AFBNVFAY.mjs → chunk-2ZN64ZS7.mjs} +3 -3
- package/dist/lib/neutral/{chunk-JAU4E4EK.mjs → chunk-5VAXF6AH.mjs} +2 -2
- package/dist/lib/neutral/{chunk-QZS4G6PE.mjs → chunk-EVROJER7.mjs} +70 -25
- package/dist/lib/neutral/chunk-EVROJER7.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-XEVFBI6S.mjs → chunk-PF7XP7XP.mjs} +13 -13
- package/dist/lib/neutral/{chunk-XEVFBI6S.mjs.map → chunk-PF7XP7XP.mjs.map} +3 -3
- package/dist/lib/neutral/{chunk-MEPE4HHX.mjs → chunk-SJ37RWHU.mjs} +3 -3
- package/dist/lib/neutral/chunk-VSAZPWSJ.mjs +25 -0
- package/dist/lib/neutral/chunk-VSAZPWSJ.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-2B2KSJT6.mjs → chunk-WEO4FCQY.mjs} +3 -3
- package/dist/lib/neutral/fib-5XIYECL5.mjs +10 -0
- package/dist/lib/neutral/index.mjs +448 -399
- package/dist/lib/neutral/index.mjs.map +4 -4
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/reply-GCBRCUVM.mjs +10 -0
- package/dist/lib/neutral/sleep-XR6CL6W3.mjs +10 -0
- package/dist/lib/neutral/sleep-XR6CL6W3.mjs.map +7 -0
- package/dist/lib/neutral/testing/index.mjs +6 -6
- package/dist/types/src/AgentService.d.ts +71 -0
- package/dist/types/src/AgentService.d.ts.map +1 -0
- package/dist/types/src/Credential.d.ts +2 -0
- package/dist/types/src/Credential.d.ts.map +1 -1
- package/dist/types/src/Instructions.d.ts +33 -0
- package/dist/types/src/Instructions.d.ts.map +1 -0
- package/dist/types/src/McpServer.d.ts +1 -1
- package/dist/types/src/Operation.d.ts +92 -27
- package/dist/types/src/Operation.d.ts.map +1 -1
- package/dist/types/src/Operation.test.d.ts +2 -0
- package/dist/types/src/Operation.test.d.ts.map +1 -0
- package/dist/types/src/Process.d.ts +55 -21
- package/dist/types/src/Process.d.ts.map +1 -1
- package/dist/types/src/Runnable.d.ts +4 -0
- package/dist/types/src/Runnable.d.ts.map +1 -0
- package/dist/types/src/Script.d.ts +9 -11
- package/dist/types/src/Script.d.ts.map +1 -1
- package/dist/types/src/ServiceResolver.d.ts +1 -1
- package/dist/types/src/Skill.d.ts +157 -0
- package/dist/types/src/Skill.d.ts.map +1 -0
- package/dist/types/src/StorageService.d.ts +8 -8
- package/dist/types/src/StorageService.d.ts.map +1 -1
- package/dist/types/src/Template.d.ts +2 -4
- package/dist/types/src/Template.d.ts.map +1 -1
- package/dist/types/src/Trace.d.ts +16 -14
- package/dist/types/src/Trace.d.ts.map +1 -1
- package/dist/types/src/Trigger.d.ts +26 -61
- package/dist/types/src/Trigger.d.ts.map +1 -1
- package/dist/types/src/TriggerEvent.d.ts +3 -11
- package/dist/types/src/TriggerEvent.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +5 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +22 -16
- package/src/AgentService.ts +90 -0
- package/src/Credential.ts +3 -0
- package/src/Instructions.ts +73 -0
- package/src/McpServer.ts +1 -1
- package/src/Operation.test.ts +39 -0
- package/src/Operation.ts +130 -54
- package/src/Process.ts +96 -26
- package/src/Runnable.ts +12 -0
- package/src/Script.ts +14 -14
- package/src/ServiceResolver.ts +1 -1
- package/src/Skill.ts +218 -0
- package/src/StorageService.ts +15 -12
- package/src/Template.ts +2 -1
- package/src/Trace.ts +13 -11
- package/src/Trigger.ts +57 -52
- package/src/index.ts +5 -3
- package/src/umbrella.test.ts +8 -6
- package/dist/lib/neutral/chunk-QZS4G6PE.mjs.map +0 -7
- package/dist/lib/neutral/fib-HBDUGQW7.mjs +0 -10
- package/dist/lib/neutral/reply-RJIAJ6FV.mjs +0 -10
- package/dist/lib/neutral/sleep-3T2CZ7RE.mjs +0 -10
- package/dist/types/src/Blueprint.d.ts +0 -182
- package/dist/types/src/Blueprint.d.ts.map +0 -1
- package/dist/types/src/Routine.d.ts +0 -54
- package/dist/types/src/Routine.d.ts.map +0 -1
- package/src/Blueprint.ts +0 -224
- package/src/Routine.ts +0 -68
- /package/dist/lib/neutral/{fib-HBDUGQW7.mjs.map → AgentService.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-AFBNVFAY.mjs.map → chunk-2ZN64ZS7.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-JAU4E4EK.mjs.map → chunk-5VAXF6AH.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-MEPE4HHX.mjs.map → chunk-SJ37RWHU.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-2B2KSJT6.mjs.map → chunk-WEO4FCQY.mjs.map} +0 -0
- /package/dist/lib/neutral/{reply-RJIAJ6FV.mjs.map → fib-5XIYECL5.mjs.map} +0 -0
- /package/dist/lib/neutral/{sleep-3T2CZ7RE.mjs.map → reply-GCBRCUVM.mjs.map} +0 -0
package/src/Blueprint.ts
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// @import-as-namespace
|
|
6
|
-
|
|
7
|
-
import * as Effect from 'effect/Effect';
|
|
8
|
-
import * as Schema from 'effect/Schema';
|
|
9
|
-
|
|
10
|
-
import { ToolId } from '@dxos/ai';
|
|
11
|
-
import { DXN, Annotation, Database, Filter, Migration, Obj, Registry, Type, URI } from '@dxos/echo';
|
|
12
|
-
import { BaseError } from '@dxos/errors';
|
|
13
|
-
|
|
14
|
-
import * as McpServer from './McpServer';
|
|
15
|
-
import * as Operation from './Operation';
|
|
16
|
-
import * as Template from './Template';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Blueprint schema defines the structure for AI assistant blueprints.
|
|
20
|
-
* Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.
|
|
21
|
-
* Blueprints may use tools to create and read artifacts, which are managed by the assistant.
|
|
22
|
-
*
|
|
23
|
-
* The registry `key` and `version` are stored in the object meta — access them via
|
|
24
|
-
* `Obj.getMeta(blueprint).key` and `Obj.getMeta(blueprint).version`.
|
|
25
|
-
*/
|
|
26
|
-
// TODO(burdon): Rename Skill?
|
|
27
|
-
export const Blueprint = Schema.Struct({
|
|
28
|
-
/**
|
|
29
|
-
* Human-readable name of the blueprint.
|
|
30
|
-
*/
|
|
31
|
-
name: Schema.String.annotations({
|
|
32
|
-
description: 'Human-readable name of the blueprint',
|
|
33
|
-
}),
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Description of the blueprint's purpose and functionality.
|
|
37
|
-
*/
|
|
38
|
-
description: Schema.optional(Schema.String).annotations({
|
|
39
|
-
description: "Description of the blueprint's purpose and functionality",
|
|
40
|
-
}),
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Instructions that guide the AI assistant's behavior and responses.
|
|
44
|
-
* These are system prompts or guidelines that the AI should follow.
|
|
45
|
-
*/
|
|
46
|
-
instructions: Template.Template.annotations({
|
|
47
|
-
description: "Instructions that guide the AI assistant's behavior and responses",
|
|
48
|
-
}),
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Array of tools that the AI assistant can use when this blueprint is active.
|
|
52
|
-
*/
|
|
53
|
-
tools: Schema.Array(ToolId).annotations({
|
|
54
|
-
description: 'Array of tools that the AI assistant can use when this blueprint is active',
|
|
55
|
-
}),
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Whether an agent is allowed to auto-enable this blueprint in a conversation.
|
|
59
|
-
*/
|
|
60
|
-
agentCanEnable: Schema.optional(Schema.Boolean).annotations({
|
|
61
|
-
description: 'Whether an agent is allowed to auto-enable this blueprint in a conversation.',
|
|
62
|
-
}),
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Array of MCP servers that the AI assistant can use when this blueprint is active.
|
|
66
|
-
*/
|
|
67
|
-
mcpServers: Schema.optional(Schema.Array(McpServer.McpServer)),
|
|
68
|
-
}).pipe(
|
|
69
|
-
Annotation.LabelAnnotation.set(['name']),
|
|
70
|
-
Annotation.IconAnnotation.set({ icon: 'ph--blueprint--regular', hue: 'sky' }),
|
|
71
|
-
Type.makeObject(DXN.make('org.dxos.type.blueprint', '0.2.0')),
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* TypeScript type for Blueprint.
|
|
76
|
-
*/
|
|
77
|
-
export type Blueprint = Type.InstanceType<typeof Blueprint>;
|
|
78
|
-
|
|
79
|
-
type MakeProps = { key: string; version?: string; name: string } & Partial<Blueprint>;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Create a new Blueprint.
|
|
83
|
-
* The `key` (and optional `version`) are stored in the object meta.
|
|
84
|
-
*/
|
|
85
|
-
export const make = ({ key, version, tools = [], instructions = Template.make(), ...props }: MakeProps) =>
|
|
86
|
-
Obj.make(Blueprint, {
|
|
87
|
-
[Obj.Meta]: { key, version },
|
|
88
|
-
tools,
|
|
89
|
-
instructions,
|
|
90
|
-
...props,
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Get the registry key for a blueprint.
|
|
95
|
-
*/
|
|
96
|
-
export const getKey = (blueprint: Blueprint): string => {
|
|
97
|
-
const key = Obj.getMeta(blueprint).key;
|
|
98
|
-
if (key === undefined) {
|
|
99
|
-
throw new Error('Blueprint is missing the meta key.');
|
|
100
|
-
}
|
|
101
|
-
return key;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Get the registry version for a blueprint, if any.
|
|
106
|
-
*/
|
|
107
|
-
export const getVersion = (blueprint: Blueprint): string | undefined => Obj.getMeta(blueprint).version;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Util to create tool definitions for a blueprint.
|
|
111
|
-
*/
|
|
112
|
-
export const toolDefinitions = ({
|
|
113
|
-
tools = [],
|
|
114
|
-
operations = [],
|
|
115
|
-
}: {
|
|
116
|
-
tools?: string[];
|
|
117
|
-
operations?: Operation.Definition.Any[];
|
|
118
|
-
}) => [...operations.map((op) => ToolId.make(DXN.getName(op.meta.key))), ...tools.map((tool) => ToolId.make(tool))];
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Factory for the blueprints.
|
|
122
|
-
*/
|
|
123
|
-
export type Definition = {
|
|
124
|
-
key: string;
|
|
125
|
-
make: () => Blueprint;
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Returns the canonical URI used to reference this blueprint in the registry.
|
|
130
|
-
* Valid DXN keys produce `dxn:<key>`; other keys use the raw key as a URI.
|
|
131
|
-
* Use this URI with `Ref.fromURI` to bind a blueprint without cloning it to the DB.
|
|
132
|
-
*
|
|
133
|
-
* TODO(wittjosiah): Should use Obj.getURI instead once it supports options to prefer meta key over EID.
|
|
134
|
-
*/
|
|
135
|
-
export const registryURI = (key: string): URI.URI => (DXN.tryMake(`dxn:${key}`) ?? URI.make(key)) as URI.URI;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Resolves a blueprint from the registry by its meta key.
|
|
139
|
-
* Does not check the local database for the blueprint.
|
|
140
|
-
*/
|
|
141
|
-
export const resolve = (key: string): Effect.Effect<Blueprint, NotFoundError, Registry.Service> =>
|
|
142
|
-
Effect.gen(function* () {
|
|
143
|
-
const results = yield* Registry.runQuery(Filter.and(Filter.type(Blueprint), Filter.key(key)));
|
|
144
|
-
const blueprint = results[0];
|
|
145
|
-
if (!blueprint) {
|
|
146
|
-
return yield* Effect.fail(new NotFoundError({ context: { key } }));
|
|
147
|
-
}
|
|
148
|
-
return blueprint;
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Upserts a blueprint into the database.
|
|
153
|
-
* If the blueprint already exists in the database, the local (possibly forked) copy is returned as-is.
|
|
154
|
-
* Otherwise, a fresh copy is cloned from the registry and added.
|
|
155
|
-
* @deprecated Since we're using a registry we no longer need to store blueprints in the database.
|
|
156
|
-
*/
|
|
157
|
-
// TODO(dmaretskyi): Remove.
|
|
158
|
-
export const upsert = (key: string): Effect.Effect<Blueprint, NotFoundError, Registry.Service | Database.Service> =>
|
|
159
|
-
Effect.gen(function* () {
|
|
160
|
-
const local = yield* Database.query(Filter.and(Filter.type(Blueprint), Filter.key(key))).run;
|
|
161
|
-
if (local.length > 0) {
|
|
162
|
-
return local[0];
|
|
163
|
-
}
|
|
164
|
-
return yield* Database.add(Obj.clone(yield* resolve(key), { deep: true }));
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
export class NotFoundError extends BaseError.extend('BlueprintNotFound', 'Blueprint not found') {}
|
|
168
|
-
|
|
169
|
-
//
|
|
170
|
-
// Legacy schemas and migrations.
|
|
171
|
-
//
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Blueprint schema v0.1.0 — `key` is stored as a data property.
|
|
175
|
-
* @deprecated Use {@link Blueprint} (v0.2.0) instead; the `key` and `version` now live in the object meta.
|
|
176
|
-
*/
|
|
177
|
-
export const Blueprint_v0_1_0 = Schema.Struct({
|
|
178
|
-
/**
|
|
179
|
-
* Global registry ID.
|
|
180
|
-
* NOTE: The `key` property refers to the original registry entry.
|
|
181
|
-
*/
|
|
182
|
-
key: Schema.String.annotations({
|
|
183
|
-
description: 'Unique registration key for the blueprint',
|
|
184
|
-
}),
|
|
185
|
-
|
|
186
|
-
name: Schema.String.annotations({
|
|
187
|
-
description: 'Human-readable name of the blueprint',
|
|
188
|
-
}),
|
|
189
|
-
|
|
190
|
-
description: Schema.optional(Schema.String),
|
|
191
|
-
|
|
192
|
-
instructions: Template.Template,
|
|
193
|
-
|
|
194
|
-
tools: Schema.Array(ToolId),
|
|
195
|
-
|
|
196
|
-
agentCanEnable: Schema.optional(Schema.Boolean),
|
|
197
|
-
|
|
198
|
-
mcpServers: Schema.optional(Schema.Array(McpServer.McpServer)),
|
|
199
|
-
}).pipe(Type.makeObject(DXN.make('org.dxos.type.blueprint', '0.1.0')));
|
|
200
|
-
|
|
201
|
-
export type Blueprint_v0_1_0 = Type.InstanceType<typeof Blueprint_v0_1_0>;
|
|
202
|
-
/**
|
|
203
|
-
* Migration from {@link Blueprint_v0_1_0} (v0.1.0) to {@link Blueprint} (v0.2.0).
|
|
204
|
-
* Moves `key` from the data section into the object meta.
|
|
205
|
-
*/
|
|
206
|
-
const _migration = Migration.define({
|
|
207
|
-
from: Blueprint_v0_1_0,
|
|
208
|
-
to: Blueprint,
|
|
209
|
-
transform: async (from) => ({
|
|
210
|
-
[Obj.Meta]: { key: from.key, version: '0.1.0' },
|
|
211
|
-
name: from.name,
|
|
212
|
-
description: from.description,
|
|
213
|
-
instructions: from.instructions,
|
|
214
|
-
tools: from.tools,
|
|
215
|
-
agentCanEnable: from.agentCanEnable,
|
|
216
|
-
mcpServers: from.mcpServers,
|
|
217
|
-
}),
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Schema migrations exported by this module.
|
|
222
|
-
* Exported as an array for extensibility — append future versions here.
|
|
223
|
-
*/
|
|
224
|
-
export const migrations = [_migration];
|
package/src/Routine.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// @import-as-namespace
|
|
6
|
-
|
|
7
|
-
import * as Schema from 'effect/Schema';
|
|
8
|
-
|
|
9
|
-
import { DXN, Annotation, JsonSchema, Obj, Ref, Type, Format } from '@dxos/echo';
|
|
10
|
-
import { Text } from '@dxos/schema';
|
|
11
|
-
|
|
12
|
-
import * as Blueprint from './Blueprint';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Prompt-based operation.
|
|
16
|
-
* May reference blueprints and additional context.
|
|
17
|
-
*/
|
|
18
|
-
export const Routine = Schema.Struct({
|
|
19
|
-
name: Schema.optional(Schema.String),
|
|
20
|
-
description: Schema.optional(Schema.String),
|
|
21
|
-
input: JsonSchema.JsonSchema.pipe(Annotation.FormInputAnnotation.set(false)).annotations({
|
|
22
|
-
description: 'Input schema',
|
|
23
|
-
}),
|
|
24
|
-
output: JsonSchema.JsonSchema.pipe(Annotation.FormInputAnnotation.set(false)).annotations({
|
|
25
|
-
description: 'Output schema',
|
|
26
|
-
}),
|
|
27
|
-
instructions: Ref.Ref(Text.Text).pipe(
|
|
28
|
-
Format.FormatAnnotation.set(Format.TypeFormat.Markdown),
|
|
29
|
-
Schema.annotations({ title: 'Instructions', description: 'Agent instructions' }),
|
|
30
|
-
),
|
|
31
|
-
blueprints: Schema.Array(Ref.Ref(Blueprint.Blueprint)),
|
|
32
|
-
context: Schema.Array(Schema.Any).pipe(Annotation.FormInputAnnotation.set(false)),
|
|
33
|
-
}).pipe(
|
|
34
|
-
Annotation.LabelAnnotation.set(['name']),
|
|
35
|
-
Annotation.IconAnnotation.set({ icon: 'ph--scroll--regular', hue: 'sky' }),
|
|
36
|
-
Type.makeObject(DXN.make('org.dxos.type.routine', '0.1.0')),
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
export type Routine = Type.InstanceType<typeof Routine>;
|
|
40
|
-
|
|
41
|
-
export type MakeProps = {
|
|
42
|
-
name?: string;
|
|
43
|
-
description?: string;
|
|
44
|
-
input?: Schema.Schema.AnyNoContext;
|
|
45
|
-
output?: Schema.Schema.AnyNoContext;
|
|
46
|
-
instructions?: string;
|
|
47
|
-
blueprints?: Ref.Ref<Blueprint.Blueprint>[];
|
|
48
|
-
context?: any[];
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const make = ({
|
|
52
|
-
name,
|
|
53
|
-
description,
|
|
54
|
-
input,
|
|
55
|
-
output,
|
|
56
|
-
instructions,
|
|
57
|
-
blueprints = [],
|
|
58
|
-
context = [],
|
|
59
|
-
}: MakeProps): Routine =>
|
|
60
|
-
Obj.make(Routine, {
|
|
61
|
-
name,
|
|
62
|
-
description,
|
|
63
|
-
input: JsonSchema.toJsonSchema(input ?? Schema.Void),
|
|
64
|
-
output: JsonSchema.toJsonSchema(output ?? Schema.Void),
|
|
65
|
-
instructions: Ref.make(Text.make({ content: instructions ?? '' })),
|
|
66
|
-
blueprints,
|
|
67
|
-
context,
|
|
68
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|