@openserv-labs/sdk 2.3.0 → 2.4.0
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 +110 -22
- package/dist/agent.d.ts +94 -41
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +141 -35
- package/dist/capability.d.ts +5 -2
- package/dist/capability.d.ts.map +1 -1
- package/dist/capability.js +8 -3
- package/dist/dreamkid/arcs.d.ts +6 -0
- package/dist/dreamkid/arcs.d.ts.map +1 -0
- package/dist/dreamkid/arcs.js +248 -0
- package/dist/dreamkid/elevenlabs.d.ts +3 -0
- package/dist/dreamkid/elevenlabs.d.ts.map +1 -0
- package/dist/dreamkid/elevenlabs.js +7 -0
- package/dist/dreamkid/main.d.ts +2 -0
- package/dist/dreamkid/main.d.ts.map +1 -0
- package/dist/dreamkid/main.js +313 -0
- package/dist/dreamkid/openai.d.ts +4 -0
- package/dist/dreamkid/openai.d.ts.map +1 -0
- package/dist/dreamkid/openai.js +10 -0
- package/dist/dreamkid/prompting.d.ts +16 -0
- package/dist/dreamkid/prompting.d.ts.map +1 -0
- package/dist/dreamkid/prompting.js +86 -0
- package/dist/dreamkid/system-prompt.d.ts +2 -0
- package/dist/dreamkid/system-prompt.d.ts.map +1 -0
- package/dist/dreamkid/system-prompt.js +14 -0
- package/dist/dreamkid/themes.d.ts +15 -0
- package/dist/dreamkid/themes.d.ts.map +1 -0
- package/dist/dreamkid/themes.js +1255 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/run.d.ts +1 -1
- package/dist/run.js +1 -1
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -16,11 +16,45 @@ const http_errors_1 = require("http-errors");
|
|
|
16
16
|
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
17
17
|
const json_schema_to_zod_1 = require("@n8n/json-schema-to-zod");
|
|
18
18
|
const openai_1 = __importDefault(require("openai"));
|
|
19
|
+
const zod_1 = require("zod");
|
|
19
20
|
const capability_1 = require("./capability");
|
|
20
21
|
const mcp_1 = require("./mcp");
|
|
21
22
|
const PLATFORM_URL = process.env.OPENSERV_API_URL || 'https://api.openserv.ai';
|
|
22
23
|
const RUNTIME_URL = process.env.OPENSERV_RUNTIME_URL || 'https://agents.openserv.ai';
|
|
23
24
|
const DEFAULT_PORT = Number.parseInt(process.env.PORT || '') || 7378;
|
|
25
|
+
/** Default input schema for run-less capabilities that omit inputSchema */
|
|
26
|
+
const DEFAULT_INPUT_SCHEMA = zod_1.z.object({ input: zod_1.z.string() });
|
|
27
|
+
/** Runtime validation schema for capability configs */
|
|
28
|
+
const capabilityConfigSchema = zod_1.z
|
|
29
|
+
.object({
|
|
30
|
+
name: zod_1.z.string().min(1),
|
|
31
|
+
description: zod_1.z.string().min(1),
|
|
32
|
+
inputSchema: zod_1.z.any().optional(),
|
|
33
|
+
schema: zod_1.z.any().optional(),
|
|
34
|
+
run: zod_1.z.any().optional(),
|
|
35
|
+
outputSchema: zod_1.z.any().optional()
|
|
36
|
+
})
|
|
37
|
+
.superRefine((data, ctx) => {
|
|
38
|
+
if (data.inputSchema && data.schema) {
|
|
39
|
+
ctx.addIssue({
|
|
40
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
41
|
+
message: 'Cannot provide both "inputSchema" and "schema". Use "inputSchema" ("schema" is deprecated).'
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
if (data.run && data.outputSchema) {
|
|
45
|
+
ctx.addIssue({
|
|
46
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
47
|
+
message: 'Cannot provide both "run" and "outputSchema". "outputSchema" is only for run-less capabilities.'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (!data.inputSchema && !data.schema && data.run) {
|
|
51
|
+
ctx.addIssue({
|
|
52
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
53
|
+
message: 'Runnable capabilities require "inputSchema" (or deprecated "schema"). ' +
|
|
54
|
+
'Only run-less capabilities can omit it.'
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
24
58
|
class Agent {
|
|
25
59
|
options;
|
|
26
60
|
/**
|
|
@@ -55,7 +89,8 @@ class Agent {
|
|
|
55
89
|
systemPrompt;
|
|
56
90
|
/**
|
|
57
91
|
* Array of capabilities (tools) available to the agent.
|
|
58
|
-
* Each capability is an instance of the Capability class with a name, description,
|
|
92
|
+
* Each capability is an instance of the Capability class with a name, description, inputSchema,
|
|
93
|
+
* and optionally a run function and/or outputSchema.
|
|
59
94
|
* @protected
|
|
60
95
|
*/
|
|
61
96
|
tools = [];
|
|
@@ -127,7 +162,7 @@ class Agent {
|
|
|
127
162
|
function: {
|
|
128
163
|
name: tool.name,
|
|
129
164
|
description: tool.description,
|
|
130
|
-
parameters: (0, zod_to_json_schema_1.zodToJsonSchema)(tool.
|
|
165
|
+
parameters: (0, zod_to_json_schema_1.zodToJsonSchema)(tool.inputSchema)
|
|
131
166
|
}
|
|
132
167
|
}));
|
|
133
168
|
}
|
|
@@ -142,7 +177,8 @@ class Agent {
|
|
|
142
177
|
if (!this._openai) {
|
|
143
178
|
const apiKey = this.options.openaiApiKey || process.env.OPENAI_API_KEY;
|
|
144
179
|
if (!apiKey) {
|
|
145
|
-
throw new Error('OpenAI API key is required for process().
|
|
180
|
+
throw new Error('OpenAI API key is required for process(). Provide it via options or OPENAI_API_KEY env var. ' +
|
|
181
|
+
'Alternatively, use generate() for runtime-delegated LLM calls, or run-less capabilities.');
|
|
146
182
|
}
|
|
147
183
|
this._openai = new openai_1.default({ apiKey });
|
|
148
184
|
}
|
|
@@ -180,41 +216,42 @@ class Agent {
|
|
|
180
216
|
}
|
|
181
217
|
/**
|
|
182
218
|
* Adds a single capability (tool) to the agent.
|
|
183
|
-
* Each capability must have a unique name
|
|
219
|
+
* Each capability must have a unique name. Capabilities can be:
|
|
220
|
+
* - **Runnable**: has a `run` function and requires `inputSchema` (or deprecated `schema`)
|
|
221
|
+
* - **Run-less**: no `run` function -- the runtime handles execution via LLM.
|
|
222
|
+
* `inputSchema` is optional (defaults to `{ input: z.string() }`), `outputSchema` is optional.
|
|
184
223
|
*
|
|
185
224
|
* @template S - The Zod schema type for the capability's parameters
|
|
186
|
-
* @param
|
|
187
|
-
* @
|
|
188
|
-
* @param {string} capability.description - Description of what the capability does
|
|
189
|
-
* @param {S} capability.schema - Zod schema defining the capability's parameters
|
|
190
|
-
* @param {Function} capability.run - Function that implements the capability's behavior
|
|
191
|
-
* @param {Object} capability.run.params - Parameters for the run function
|
|
192
|
-
* @param {z.infer<S>} capability.run.params.args - Validated arguments matching the schema
|
|
193
|
-
* @param {ActionSchema} [capability.run.params.action] - Optional action context
|
|
194
|
-
* @param {ChatCompletionMessageParam[]} capability.run.messages - Chat message history
|
|
195
|
-
* @returns {this} The agent instance for method chaining
|
|
225
|
+
* @param capability - The capability configuration
|
|
226
|
+
* @returns The agent instance for method chaining
|
|
196
227
|
* @throws {Error} If a capability with the same name already exists
|
|
228
|
+
* @throws {Error} If both `inputSchema` and `schema` are provided
|
|
229
|
+
* @throws {Error} If both `run` and `outputSchema` are provided
|
|
230
|
+
* @throws {Error} If a runnable capability omits `inputSchema`/`schema`
|
|
197
231
|
*/
|
|
198
|
-
addCapability(
|
|
199
|
-
|
|
232
|
+
addCapability(capability) {
|
|
233
|
+
const result = capabilityConfigSchema.safeParse(capability);
|
|
234
|
+
if (!result.success) {
|
|
235
|
+
throw new Error(result.error.issues[0]?.message ?? 'Invalid capability configuration');
|
|
236
|
+
}
|
|
237
|
+
const { name, description, run, outputSchema } = result.data;
|
|
238
|
+
const resolvedSchema = (result.data.inputSchema ??
|
|
239
|
+
result.data.schema ??
|
|
240
|
+
DEFAULT_INPUT_SCHEMA);
|
|
200
241
|
if (this.tools.some(tool => tool.name === name)) {
|
|
201
242
|
throw new Error(`Tool with name "${name}" already exists`);
|
|
202
243
|
}
|
|
203
|
-
|
|
204
|
-
this.tools.push(new capability_1.Capability(name, description, schema, run));
|
|
244
|
+
this.tools.push(new capability_1.Capability(name, description, resolvedSchema, typeof run === 'function' ? run : undefined, outputSchema));
|
|
205
245
|
return this;
|
|
206
246
|
}
|
|
207
247
|
/**
|
|
208
248
|
* Adds multiple capabilities (tools) to the agent at once.
|
|
209
249
|
* Each capability must have a unique name and not conflict with existing capabilities.
|
|
250
|
+
* Each element can be runnable or run-less independently.
|
|
210
251
|
*
|
|
211
252
|
* @template T - Tuple of Zod schema types for the capabilities' parameters
|
|
212
|
-
* @param
|
|
213
|
-
* @
|
|
214
|
-
* @param {string} capabilities[].description - Description of what each capability does
|
|
215
|
-
* @param {T[number]} capabilities[].schema - Zod schema defining each capability's parameters
|
|
216
|
-
* @param {Function} capabilities[].run - Function that implements each capability's behavior
|
|
217
|
-
* @returns {this} The agent instance for method chaining
|
|
253
|
+
* @param capabilities - Array of capability configurations
|
|
254
|
+
* @returns The agent instance for method chaining
|
|
218
255
|
* @throws {Error} If any capability has a name that already exists
|
|
219
256
|
*/
|
|
220
257
|
addCapabilities(capabilities) {
|
|
@@ -479,6 +516,24 @@ class Agent {
|
|
|
479
516
|
});
|
|
480
517
|
return response.data;
|
|
481
518
|
}
|
|
519
|
+
async generate(params) {
|
|
520
|
+
const response = await this.runtimeClient.post('/generate', {
|
|
521
|
+
prompt: params.prompt,
|
|
522
|
+
...(params.messages ? { messages: params.messages } : {}),
|
|
523
|
+
...(params.outputSchema ? { outputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(params.outputSchema) } : {}),
|
|
524
|
+
action: params.action
|
|
525
|
+
});
|
|
526
|
+
if (params.outputSchema) {
|
|
527
|
+
if (response.data.object === undefined || response.data.object === null) {
|
|
528
|
+
throw new Error('Runtime returned no structured output for generate() with outputSchema');
|
|
529
|
+
}
|
|
530
|
+
return params.outputSchema.parse(response.data.object);
|
|
531
|
+
}
|
|
532
|
+
if (typeof response.data.text !== 'string') {
|
|
533
|
+
throw new Error('Runtime returned no text for generate()');
|
|
534
|
+
}
|
|
535
|
+
return response.data.text;
|
|
536
|
+
}
|
|
482
537
|
/**
|
|
483
538
|
* Processes a conversation with OpenAI, handling tool calls iteratively until completion.
|
|
484
539
|
*
|
|
@@ -491,7 +546,8 @@ class Agent {
|
|
|
491
546
|
try {
|
|
492
547
|
const apiKey = this.options.openaiApiKey || process.env.OPENAI_API_KEY;
|
|
493
548
|
if (!apiKey) {
|
|
494
|
-
throw new Error('OpenAI API key is required for process().
|
|
549
|
+
throw new Error('OpenAI API key is required for process(). Provide it via options or OPENAI_API_KEY env var. ' +
|
|
550
|
+
'Alternatively, use generate() for runtime-delegated LLM calls, or run-less capabilities.');
|
|
495
551
|
}
|
|
496
552
|
const currentMessages = [...messages];
|
|
497
553
|
if (!currentMessages.find(m => m.content === this.systemPrompt)) {
|
|
@@ -530,8 +586,35 @@ class Agent {
|
|
|
530
586
|
if (!tool) {
|
|
531
587
|
throw new Error(`Tool "${name}" not found`);
|
|
532
588
|
}
|
|
533
|
-
|
|
534
|
-
|
|
589
|
+
let result;
|
|
590
|
+
if (tool.run) {
|
|
591
|
+
// Call the tool's run method with the parsed arguments and bind this
|
|
592
|
+
result = await tool.run.bind(this)({ args: parsedArgs }, currentMessages);
|
|
593
|
+
}
|
|
594
|
+
else {
|
|
595
|
+
// Shim: use OpenAI with conversation history + description for run-less capabilities
|
|
596
|
+
const shimCompletion = await this.openai.chat.completions.create({
|
|
597
|
+
model: 'gpt-4o',
|
|
598
|
+
messages: [
|
|
599
|
+
...currentMessages,
|
|
600
|
+
{ role: 'system', content: tool.description },
|
|
601
|
+
{ role: 'user', content: JSON.stringify(parsedArgs) }
|
|
602
|
+
],
|
|
603
|
+
...(tool.outputSchema
|
|
604
|
+
? {
|
|
605
|
+
response_format: {
|
|
606
|
+
type: 'json_schema',
|
|
607
|
+
json_schema: {
|
|
608
|
+
name: tool.name,
|
|
609
|
+
schema: (0, zod_to_json_schema_1.zodToJsonSchema)(tool.outputSchema),
|
|
610
|
+
strict: true
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
: {})
|
|
615
|
+
});
|
|
616
|
+
result = shimCompletion.choices[0]?.message?.content || '';
|
|
617
|
+
}
|
|
535
618
|
return {
|
|
536
619
|
role: 'tool',
|
|
537
620
|
content: JSON.stringify(result),
|
|
@@ -582,9 +665,12 @@ class Agent {
|
|
|
582
665
|
content: action.task.description
|
|
583
666
|
});
|
|
584
667
|
}
|
|
668
|
+
const proxyTools = this.tools.filter(t => t.run);
|
|
669
|
+
const runtimeTools = this.tools.filter(t => !t.run);
|
|
585
670
|
try {
|
|
586
671
|
await this.runtimeClient.post('/execute', {
|
|
587
|
-
tools:
|
|
672
|
+
tools: proxyTools.map(convertProxyToolToJsonSchema),
|
|
673
|
+
runtimeTools: runtimeTools.map(convertRuntimeToolToJsonSchema),
|
|
588
674
|
messages,
|
|
589
675
|
action
|
|
590
676
|
});
|
|
@@ -616,9 +702,12 @@ class Agent {
|
|
|
616
702
|
});
|
|
617
703
|
}
|
|
618
704
|
}
|
|
705
|
+
const proxyTools = this.tools.filter(t => t.run);
|
|
706
|
+
const runtimeTools = this.tools.filter(t => !t.run);
|
|
619
707
|
try {
|
|
620
708
|
await this.runtimeClient.post('/chat', {
|
|
621
|
-
tools:
|
|
709
|
+
tools: proxyTools.map(convertProxyToolToJsonSchema),
|
|
710
|
+
runtimeTools: runtimeTools.map(convertRuntimeToolToJsonSchema),
|
|
622
711
|
messages,
|
|
623
712
|
action
|
|
624
713
|
});
|
|
@@ -633,15 +722,18 @@ class Agent {
|
|
|
633
722
|
/**
|
|
634
723
|
* Handles execution of a specific tool/capability.
|
|
635
724
|
*
|
|
725
|
+
* The runtime calls this for both task execution (do-task) and chat (respond-chat-message),
|
|
726
|
+
* always providing the action context in the request body.
|
|
727
|
+
*
|
|
636
728
|
* @param {Object} req - The request object
|
|
637
729
|
* @param {Object} req.params - Request parameters
|
|
638
730
|
* @param {string} req.params.toolName - Name of the tool to execute
|
|
639
731
|
* @param {Object} req.body - Request body
|
|
640
732
|
* @param {z.infer<z.ZodTypeAny>} [req.body.args] - Arguments for the tool
|
|
641
|
-
* @param {ActionSchema}
|
|
733
|
+
* @param {ActionSchema} req.body.action - Action context (required)
|
|
642
734
|
* @param {ChatCompletionMessageParam[]} [req.body.messages] - Message history
|
|
643
735
|
* @returns {Promise<{result: string}>} The result of the tool execution
|
|
644
|
-
* @throws {BadRequest} If tool name is missing
|
|
736
|
+
* @throws {BadRequest} If tool name is missing, tool is not found, or action is missing
|
|
645
737
|
* @throws {Error} If tool execution fails
|
|
646
738
|
*/
|
|
647
739
|
async handleToolRoute(req) {
|
|
@@ -653,7 +745,13 @@ class Agent {
|
|
|
653
745
|
if (!tool) {
|
|
654
746
|
throw new http_errors_1.BadRequest(`Tool "${req.params.toolName}" not found`);
|
|
655
747
|
}
|
|
656
|
-
|
|
748
|
+
if (!tool.run) {
|
|
749
|
+
throw new http_errors_1.BadRequest(`Tool "${req.params.toolName}" is a run-less capability handled by the runtime, not by this agent.`);
|
|
750
|
+
}
|
|
751
|
+
if (!req.body?.action) {
|
|
752
|
+
throw new http_errors_1.BadRequest('Action context is required for tool execution');
|
|
753
|
+
}
|
|
754
|
+
const args = await tool.inputSchema.parseAsync(req.body?.args);
|
|
657
755
|
const messages = req.body.messages || [];
|
|
658
756
|
const result = await tool.run.call(this, { args, action: req.body.action }, messages);
|
|
659
757
|
return { result };
|
|
@@ -905,7 +1003,7 @@ class Agent {
|
|
|
905
1003
|
this.addCapability({
|
|
906
1004
|
name: capabilityName,
|
|
907
1005
|
description: tool.description || `Tool from MCP server ${serverId}`,
|
|
908
|
-
|
|
1006
|
+
inputSchema: (0, json_schema_to_zod_1.jsonSchemaToZod)(inputSchema),
|
|
909
1007
|
async run({ args }) {
|
|
910
1008
|
const mcpClient = this.mcpClients[serverId];
|
|
911
1009
|
if (!mcpClient) {
|
|
@@ -930,10 +1028,18 @@ class Agent {
|
|
|
930
1028
|
}
|
|
931
1029
|
}
|
|
932
1030
|
exports.Agent = Agent;
|
|
933
|
-
function
|
|
1031
|
+
function convertProxyToolToJsonSchema(tool) {
|
|
1032
|
+
return {
|
|
1033
|
+
name: tool.name,
|
|
1034
|
+
description: tool.description,
|
|
1035
|
+
schema: (0, zod_to_json_schema_1.zodToJsonSchema)(tool.inputSchema)
|
|
1036
|
+
};
|
|
1037
|
+
}
|
|
1038
|
+
function convertRuntimeToolToJsonSchema(tool) {
|
|
934
1039
|
return {
|
|
935
1040
|
name: tool.name,
|
|
936
1041
|
description: tool.description,
|
|
937
|
-
schema: (0, zod_to_json_schema_1.zodToJsonSchema)(tool.
|
|
1042
|
+
schema: (0, zod_to_json_schema_1.zodToJsonSchema)(tool.inputSchema),
|
|
1043
|
+
...(tool.outputSchema ? { outputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(tool.outputSchema) } : {})
|
|
938
1044
|
};
|
|
939
1045
|
}
|
package/dist/capability.d.ts
CHANGED
|
@@ -5,8 +5,11 @@ import type { Agent } from './agent';
|
|
|
5
5
|
export declare class Capability<M extends string, Schema extends z.ZodTypeAny> {
|
|
6
6
|
readonly name: string;
|
|
7
7
|
readonly description: string;
|
|
8
|
+
readonly run?: ((this: Agent<M>, params: CapabilityFuncParams<Schema>, messages: ChatCompletionMessageParam[]) => string | Promise<string>) | undefined;
|
|
9
|
+
readonly outputSchema?: z.ZodTypeAny | undefined;
|
|
10
|
+
readonly inputSchema: Schema;
|
|
11
|
+
/** @deprecated Use `inputSchema` instead */
|
|
8
12
|
readonly schema: Schema;
|
|
9
|
-
|
|
10
|
-
constructor(name: string, description: string, schema: Schema, run: (this: Agent<M>, params: CapabilityFuncParams<Schema>, messages: ChatCompletionMessageParam[]) => string | Promise<string>);
|
|
13
|
+
constructor(name: string, description: string, inputSchema: Schema, run?: ((this: Agent<M>, params: CapabilityFuncParams<Schema>, messages: ChatCompletionMessageParam[]) => string | Promise<string>) | undefined, outputSchema?: z.ZodTypeAny | undefined);
|
|
11
14
|
}
|
|
12
15
|
//# sourceMappingURL=capability.d.ts.map
|
package/dist/capability.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAA;AACnF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,qBAAa,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,SAAS,CAAC,CAAC,UAAU;
|
|
1
|
+
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAA;AACnF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,qBAAa,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,SAAS,CAAC,CAAC,UAAU;aAMjD,IAAI,EAAE,MAAM;aACZ,WAAW,EAAE,MAAM;aAEnB,GAAG,CAAC,GAAE,CACpB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EACd,MAAM,EAAE,oBAAoB,CAAC,MAAM,CAAC,EACpC,QAAQ,EAAE,0BAA0B,EAAE,KACnC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;aACb,YAAY,CAAC,EAAE,CAAC,CAAC,UAAU;IAb7C,SAAgB,WAAW,EAAE,MAAM,CAAA;IACnC,4CAA4C;IAC5C,SAAgB,MAAM,EAAE,MAAM,CAAA;gBAGZ,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnC,WAAW,EAAE,MAAM,EACH,GAAG,CAAC,GAAE,CACpB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EACd,MAAM,EAAE,oBAAoB,CAAC,MAAM,CAAC,EACpC,QAAQ,EAAE,0BAA0B,EAAE,KACnC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,aAAA,EACb,YAAY,CAAC,EAAE,CAAC,CAAC,UAAU,YAAA;CAK9C"}
|
package/dist/capability.js
CHANGED
|
@@ -4,13 +4,18 @@ exports.Capability = void 0;
|
|
|
4
4
|
class Capability {
|
|
5
5
|
name;
|
|
6
6
|
description;
|
|
7
|
-
schema;
|
|
8
7
|
run;
|
|
9
|
-
|
|
8
|
+
outputSchema;
|
|
9
|
+
inputSchema;
|
|
10
|
+
/** @deprecated Use `inputSchema` instead */
|
|
11
|
+
schema;
|
|
12
|
+
constructor(name, description, inputSchema, run, outputSchema) {
|
|
10
13
|
this.name = name;
|
|
11
14
|
this.description = description;
|
|
12
|
-
this.schema = schema;
|
|
13
15
|
this.run = run;
|
|
16
|
+
this.outputSchema = outputSchema;
|
|
17
|
+
this.inputSchema = inputSchema;
|
|
18
|
+
this.schema = inputSchema;
|
|
14
19
|
}
|
|
15
20
|
}
|
|
16
21
|
exports.Capability = Capability;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arcs.d.ts","sourceRoot":"","sources":["../../src/dreamkid/arcs.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;;;;GAoPhB,CAAA"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arcs = void 0;
|
|
4
|
+
exports.arcs = [
|
|
5
|
+
{
|
|
6
|
+
"id": 1,
|
|
7
|
+
"name": "Journey of Courage",
|
|
8
|
+
"arc": [
|
|
9
|
+
"Introduction of the child hero in their ordinary world",
|
|
10
|
+
"Child feels a call to adventure, but initially refuses it",
|
|
11
|
+
"Encounter with a supportive mentor who provides guidance and encouragement",
|
|
12
|
+
"Child accepts the call to adventure, stepping into the unknown",
|
|
13
|
+
"Child faces tests and challenges, making new friends and encountering enemies",
|
|
14
|
+
"Child reaches the inmost cave - the moment of deepest fear and doubt",
|
|
15
|
+
"Child experiences a moment of transformation and healing",
|
|
16
|
+
"Child faces the final challenge, applying what they have learned",
|
|
17
|
+
"Child emerges victorious, with newfound strength and resilience",
|
|
18
|
+
"Child returns to their ordinary world, transformed and ready to help others"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": 2,
|
|
23
|
+
"name": "Journey of Resilience",
|
|
24
|
+
"arc": [
|
|
25
|
+
"Introduce the child hero in their normal world",
|
|
26
|
+
"Unexpected event triggers a sense of fear and uncertainty in the child",
|
|
27
|
+
"Encounter with a wise mentor who shares valuable lessons",
|
|
28
|
+
"The child decides to confront their fear",
|
|
29
|
+
"The child encounters obstacles and finds helpers along the way",
|
|
30
|
+
"The child's resilience is tested at their lowest point",
|
|
31
|
+
"A moment of healing and transformation occurs",
|
|
32
|
+
"With renewed strength, the child overcomes their biggest challenge",
|
|
33
|
+
"Child hero returns to their world, stronger and braver than before"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": 3,
|
|
38
|
+
"name": "Journey of Hope",
|
|
39
|
+
"arc": [
|
|
40
|
+
"Introduction of the child protagonist in their familiar world",
|
|
41
|
+
"Child receives a call to adventure, hesitant at first",
|
|
42
|
+
"Meeting a mentor who provides wisdom and motivation",
|
|
43
|
+
"Child sets off on the adventure with a glimmer of hope",
|
|
44
|
+
"Child encounters trials, setbacks and finds unexpected allies",
|
|
45
|
+
"Child confronts the most challenging part of the journey",
|
|
46
|
+
"Experience of healing, enlightenment, and transformation",
|
|
47
|
+
"Child musters strength and courage to overcome the final challenge",
|
|
48
|
+
"Child returns to their normal world, instilling hope in others"
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"id": 4,
|
|
53
|
+
"name": "Journey of Transformation",
|
|
54
|
+
"arc": [
|
|
55
|
+
"Introduce the child hero in their comfortable world",
|
|
56
|
+
"Child faces a disturbing event that shakes their comfort",
|
|
57
|
+
"Child meets a mentor who provides strength and guidance",
|
|
58
|
+
"Child decides to face their challenges head on",
|
|
59
|
+
"Child experiences various tests, meets allies and enemies",
|
|
60
|
+
"Child faces their deepest fear and uncertainty",
|
|
61
|
+
"Child gains new insights, healing, and starts transforming",
|
|
62
|
+
"Child takes on the final test, using their newfound wisdom",
|
|
63
|
+
"Child emerges as a transformed individual, inspiring others"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"id": 5,
|
|
68
|
+
"name": "Journey of Strength",
|
|
69
|
+
"arc": [
|
|
70
|
+
"Introduction of the child hero in their everyday life",
|
|
71
|
+
"Child experiences a life-changing event that brings fear and doubt",
|
|
72
|
+
"Child meets a mentor who encourages them to be strong",
|
|
73
|
+
"Child decides to take a leap of faith and face their fear",
|
|
74
|
+
"Child goes through various trials and tribulations, meeting allies",
|
|
75
|
+
"Child faces their greatest fear, a moment of extreme doubt",
|
|
76
|
+
"Child experiences healing and realizes their inner strength",
|
|
77
|
+
"Child faces the final test, showcasing their newfound strength",
|
|
78
|
+
"Child comes back to their world as a symbol of strength"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"id": 6,
|
|
83
|
+
"name": "Epic Adventure of Bravery",
|
|
84
|
+
"arc": [
|
|
85
|
+
"Child hero introduced in their ordinary world",
|
|
86
|
+
"Child experiences a startling event that triggers a sense of fear",
|
|
87
|
+
"Child initially refuses to confront the fear",
|
|
88
|
+
"Child encounters a mentor who offers guidance and wisdom",
|
|
89
|
+
"Inspired by the mentor, child decides to face the fear",
|
|
90
|
+
"Child embarks on an adventure, meeting new friends along the way",
|
|
91
|
+
"Child encounters various obstacles that test their courage",
|
|
92
|
+
"Child experiences a crushing setback leading to a moment of doubt",
|
|
93
|
+
"Mentor encourages child and reveals an inspiring truth",
|
|
94
|
+
"Child gains a new understanding and begins a healing journey",
|
|
95
|
+
"Child faces the greatest challenge, applying newfound courage",
|
|
96
|
+
"Child defeats the challenge, realizing their true potential",
|
|
97
|
+
"Child returns home, transformed, and shares the story of their bravery"
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"id": 7,
|
|
102
|
+
"name": "Epic Quest of Endurance",
|
|
103
|
+
"arc": [
|
|
104
|
+
"Introduce the child protagonist in their daily life",
|
|
105
|
+
"An unexpected event occurs that instills fear in the child",
|
|
106
|
+
"Child hesitates to confront their fear",
|
|
107
|
+
"Child meets a wise mentor who shares encouraging words",
|
|
108
|
+
"Motivated by the mentor, child decides to face the fear",
|
|
109
|
+
"Child embarks on an epic quest, making unexpected allies",
|
|
110
|
+
"Child faces a series of trials testing their endurance",
|
|
111
|
+
"Child experiences a huge setback leading to self-doubt",
|
|
112
|
+
"Mentor provides uplifting advice and reveals an empowering truth",
|
|
113
|
+
"Child begins a healing process and gains a renewed perspective",
|
|
114
|
+
"Child confronts the ultimate challenge with newfound endurance",
|
|
115
|
+
"Child overcomes the challenge, discovering their inner strength",
|
|
116
|
+
"Child returns home, now stronger and shares their inspiring journey"
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"id": 8,
|
|
121
|
+
"name": "Epic Journey of Resilience",
|
|
122
|
+
"arc": [
|
|
123
|
+
"Child hero is introduced in their comfortable world",
|
|
124
|
+
"A life-changing event occurs that scares the child",
|
|
125
|
+
"Child initially refuses to face the event",
|
|
126
|
+
"Child encounters a supportive mentor who provides strength",
|
|
127
|
+
"Inspired, child decides to overcome their fear",
|
|
128
|
+
"Child sets off on a journey, meeting new friends",
|
|
129
|
+
"Child faces a series of challenges that test their resilience",
|
|
130
|
+
"Child undergoes a major setback that leads to despair",
|
|
131
|
+
"Mentor gives the child courage and shares a transformative truth",
|
|
132
|
+
"Child gains a new understanding and begins healing",
|
|
133
|
+
"Child confronts the biggest challenge with newfound resilience",
|
|
134
|
+
"Child triumphs over the challenge, realizing their true potential",
|
|
135
|
+
"Child returns to their world, transformed, inspiring others with their resilience"
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"id": 9,
|
|
140
|
+
"name": "Epic Odyssey of Perseverance",
|
|
141
|
+
"arc": [
|
|
142
|
+
"Introduction of the child protagonist in their everyday life",
|
|
143
|
+
"A dramatic event occurs that instills fear and doubt in the child",
|
|
144
|
+
"Child is hesitant to confront their fear",
|
|
145
|
+
"Child meets a mentor who offers wisdom and encouragement",
|
|
146
|
+
"Motivated by the mentor, child decides to face their fear",
|
|
147
|
+
"Child embarks on an odyssey, encountering new allies",
|
|
148
|
+
"Child faces numerous trials that test their perseverance",
|
|
149
|
+
"Child experiences a major setback leading to deep self-doubt",
|
|
150
|
+
"Mentor provides comfort and reveals a life-changing truth",
|
|
151
|
+
"Child gains new insights and begins a transformative healing journey",
|
|
152
|
+
"Child faces the ultimate challenge with newfound perseverance",
|
|
153
|
+
"Child conquers the challenge, discovering their inner power",
|
|
154
|
+
"Child returns to their world, forever changed by their journey",
|
|
155
|
+
"Child shares their story, inspiring others with their perseverance and strength"
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"id": 10,
|
|
160
|
+
"name": "Expedition of Enlightenment",
|
|
161
|
+
"arc": [
|
|
162
|
+
"Introduction of the child protagonist in their familiar world",
|
|
163
|
+
"Unexpected event incites fear and triggers a need for change",
|
|
164
|
+
"Child meets a mentor who provides wisdom and courage",
|
|
165
|
+
"Child reluctantly embarks on an expedition of growth and learning",
|
|
166
|
+
"Child encounters a series of challenges, learning new skills along the way",
|
|
167
|
+
"Setbacks occur, testing the child's resolve and willpower",
|
|
168
|
+
"Through hardship, child gains a deeper understanding of their journey",
|
|
169
|
+
"Child applies newfound knowledge and skills in a series of tests",
|
|
170
|
+
"A transformative healing experience leads to a breakthrough",
|
|
171
|
+
"Child faces the final challenge, using their new knowledge",
|
|
172
|
+
"Child overcomes the challenge, enlightened and transformed",
|
|
173
|
+
"Child returns to their world, inspiring others with their journey"
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"id": 11,
|
|
178
|
+
"name": "Quest for Knowledge",
|
|
179
|
+
"arc": [
|
|
180
|
+
"Child hero introduced in their ordinary world",
|
|
181
|
+
"A life-altering event occurs, sparking fear and the need for change",
|
|
182
|
+
"Child encounters a mentor who offers wisdom and guidance",
|
|
183
|
+
"Child reluctantly decides to undertake a quest for knowledge",
|
|
184
|
+
"Child navigates a series of obstacles, learning important lessons",
|
|
185
|
+
"Child faces a major setback that tests their will and determination",
|
|
186
|
+
"Through the hardship, child gains a greater understanding of their journey",
|
|
187
|
+
"Child leverages new skills and knowledge to overcome challenges",
|
|
188
|
+
"A transformative healing moment provides clarity and growth",
|
|
189
|
+
"Child confronts the final challenge with their newfound wisdom",
|
|
190
|
+
"Child successfully overcomes the challenge, transformed and enlightened",
|
|
191
|
+
"Child returns home, sharing their newfound wisdom with their community"
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"id": 12,
|
|
196
|
+
"name": "Adventure of Discovery",
|
|
197
|
+
"arc": [
|
|
198
|
+
"Introduction of the child protagonist in their everyday life",
|
|
199
|
+
"An unexpected event incites fear and the need for adaptation",
|
|
200
|
+
"Child meets a mentor who provides wisdom and inspires courage",
|
|
201
|
+
"Child embarks on an adventure, eager to learn and grow",
|
|
202
|
+
"Child faces a series of trials, learning from each experience",
|
|
203
|
+
"A major setback tests the child's resolve and determination",
|
|
204
|
+
"Through adversity, child gains a deeper understanding of their journey",
|
|
205
|
+
"Child applies new skills and insights to overcome subsequent challenges",
|
|
206
|
+
"A transformative healing event facilitates growth and understanding",
|
|
207
|
+
"Child confronts the ultimate challenge using their newfound knowledge",
|
|
208
|
+
"Child triumphs over the challenge, emerging wiser and stronger",
|
|
209
|
+
"Child returns to their world, sharing their story of discovery and growth"
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"id": 13,
|
|
214
|
+
"name": "Voyage of Wisdom",
|
|
215
|
+
"arc": [
|
|
216
|
+
"Introduction of the child hero in their familiar world",
|
|
217
|
+
"An unexpected event sparks fear and a need for change",
|
|
218
|
+
"Child meets a mentor who imparts wisdom and encouragement",
|
|
219
|
+
"Child embarks on a voyage to learn and adapt",
|
|
220
|
+
"Child navigates through trials, learning from each encounter",
|
|
221
|
+
"A major setback tests the child's will and determination",
|
|
222
|
+
"Through adversity, the child gains a greater understanding of their journey",
|
|
223
|
+
"Child applies new wisdom and skills to overcome subsequent challenges",
|
|
224
|
+
"A transformative healing moment leads to a significant breakthrough",
|
|
225
|
+
"Child confronts the final challenge using their newfound wisdom",
|
|
226
|
+
"Child triumphs over the challenge, emerging more enlightened and resilient",
|
|
227
|
+
"Child returns to their world, sharing their wisdom and inspiring others"
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"id": 14,
|
|
232
|
+
"name": "Journey of Learning",
|
|
233
|
+
"arc": [
|
|
234
|
+
"Introduction of the child protagonist in their ordinary world",
|
|
235
|
+
"Unexpected event triggers fear and the need for change",
|
|
236
|
+
"Child encounters a mentor who provides wisdom and courage",
|
|
237
|
+
"Child undertakes a journey to learn and grow",
|
|
238
|
+
"Child faces a series of challenges, gaining knowledge from each one",
|
|
239
|
+
"A significant setback tests the child's resolve and determination",
|
|
240
|
+
"Through trials, child gains a deeper understanding of their journey",
|
|
241
|
+
"Child leverages newfound knowledge to overcome subsequent challenges",
|
|
242
|
+
"A transformative healing event leads to personal growth and clarity",
|
|
243
|
+
"Child faces the ultimate challenge using their newfound knowledge",
|
|
244
|
+
"Child overcomes the challenge, enlightened and transformed",
|
|
245
|
+
"Child returns home, sharing their story of learning and growth"
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elevenlabs.d.ts","sourceRoot":"","sources":["../../src/dreamkid/elevenlabs.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,UAAU,KAEd,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const elevenlabs_js_1 = require("@elevenlabs/elevenlabs-js");
|
|
4
|
+
const elevenlabs = new elevenlabs_js_1.ElevenLabsClient({
|
|
5
|
+
apiKey: process.env.ELEVENLABS_API_KEY,
|
|
6
|
+
});
|
|
7
|
+
exports.default = elevenlabs;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/dreamkid/main.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA"}
|