openclaw-overlay-plugin 0.7.22
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 +406 -0
- package/SKILL.md +78 -0
- package/clawdbot.plugin.json +106 -0
- package/dist/cli-main.d.ts +7 -0
- package/dist/cli-main.js +192 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +14 -0
- package/dist/core/config.d.ts +11 -0
- package/dist/core/config.js +13 -0
- package/dist/core/index.d.ts +25 -0
- package/dist/core/index.js +26 -0
- package/dist/core/payment.d.ts +16 -0
- package/dist/core/payment.js +94 -0
- package/dist/core/types.d.ts +94 -0
- package/dist/core/types.js +4 -0
- package/dist/core/verify.d.ts +28 -0
- package/dist/core/verify.js +104 -0
- package/dist/core/wallet.d.ts +99 -0
- package/dist/core/wallet.js +219 -0
- package/dist/scripts/baemail/commands.d.ts +64 -0
- package/dist/scripts/baemail/commands.js +258 -0
- package/dist/scripts/baemail/handler.d.ts +36 -0
- package/dist/scripts/baemail/handler.js +284 -0
- package/dist/scripts/baemail/index.d.ts +5 -0
- package/dist/scripts/baemail/index.js +5 -0
- package/dist/scripts/config.d.ts +48 -0
- package/dist/scripts/config.js +68 -0
- package/dist/scripts/index.d.ts +7 -0
- package/dist/scripts/index.js +7 -0
- package/dist/scripts/messaging/connect.d.ts +8 -0
- package/dist/scripts/messaging/connect.js +114 -0
- package/dist/scripts/messaging/handlers.d.ts +21 -0
- package/dist/scripts/messaging/handlers.js +334 -0
- package/dist/scripts/messaging/inbox.d.ts +11 -0
- package/dist/scripts/messaging/inbox.js +51 -0
- package/dist/scripts/messaging/index.d.ts +8 -0
- package/dist/scripts/messaging/index.js +8 -0
- package/dist/scripts/messaging/poll.d.ts +7 -0
- package/dist/scripts/messaging/poll.js +52 -0
- package/dist/scripts/messaging/send.d.ts +7 -0
- package/dist/scripts/messaging/send.js +43 -0
- package/dist/scripts/output.d.ts +12 -0
- package/dist/scripts/output.js +19 -0
- package/dist/scripts/overlay/discover.d.ts +7 -0
- package/dist/scripts/overlay/discover.js +72 -0
- package/dist/scripts/overlay/index.d.ts +7 -0
- package/dist/scripts/overlay/index.js +7 -0
- package/dist/scripts/overlay/registration.d.ts +19 -0
- package/dist/scripts/overlay/registration.js +176 -0
- package/dist/scripts/overlay/services.d.ts +29 -0
- package/dist/scripts/overlay/services.js +167 -0
- package/dist/scripts/overlay/transaction.d.ts +42 -0
- package/dist/scripts/overlay/transaction.js +103 -0
- package/dist/scripts/payment/build.d.ts +24 -0
- package/dist/scripts/payment/build.js +54 -0
- package/dist/scripts/payment/commands.d.ts +15 -0
- package/dist/scripts/payment/commands.js +73 -0
- package/dist/scripts/payment/index.d.ts +6 -0
- package/dist/scripts/payment/index.js +6 -0
- package/dist/scripts/payment/types.d.ts +56 -0
- package/dist/scripts/payment/types.js +4 -0
- package/dist/scripts/services/index.d.ts +6 -0
- package/dist/scripts/services/index.js +6 -0
- package/dist/scripts/services/queue.d.ts +11 -0
- package/dist/scripts/services/queue.js +28 -0
- package/dist/scripts/services/request.d.ts +7 -0
- package/dist/scripts/services/request.js +82 -0
- package/dist/scripts/services/respond.d.ts +11 -0
- package/dist/scripts/services/respond.js +132 -0
- package/dist/scripts/types.d.ts +107 -0
- package/dist/scripts/types.js +4 -0
- package/dist/scripts/utils/index.d.ts +6 -0
- package/dist/scripts/utils/index.js +6 -0
- package/dist/scripts/utils/merkle.d.ts +12 -0
- package/dist/scripts/utils/merkle.js +47 -0
- package/dist/scripts/utils/storage.d.ts +66 -0
- package/dist/scripts/utils/storage.js +211 -0
- package/dist/scripts/utils/woc.d.ts +26 -0
- package/dist/scripts/utils/woc.js +91 -0
- package/dist/scripts/wallet/balance.d.ts +22 -0
- package/dist/scripts/wallet/balance.js +240 -0
- package/dist/scripts/wallet/identity.d.ts +70 -0
- package/dist/scripts/wallet/identity.js +151 -0
- package/dist/scripts/wallet/index.d.ts +6 -0
- package/dist/scripts/wallet/index.js +6 -0
- package/dist/scripts/wallet/setup.d.ts +15 -0
- package/dist/scripts/wallet/setup.js +105 -0
- package/dist/scripts/x-verification/commands.d.ts +27 -0
- package/dist/scripts/x-verification/commands.js +222 -0
- package/dist/scripts/x-verification/index.d.ts +4 -0
- package/dist/scripts/x-verification/index.js +4 -0
- package/dist/services/built-in/api-proxy/index.d.ts +6 -0
- package/dist/services/built-in/api-proxy/index.js +23 -0
- package/dist/services/built-in/code-develop/index.d.ts +6 -0
- package/dist/services/built-in/code-develop/index.js +23 -0
- package/dist/services/built-in/code-review/index.d.ts +10 -0
- package/dist/services/built-in/code-review/index.js +51 -0
- package/dist/services/built-in/image-analysis/index.d.ts +6 -0
- package/dist/services/built-in/image-analysis/index.js +33 -0
- package/dist/services/built-in/memory-store/index.d.ts +6 -0
- package/dist/services/built-in/memory-store/index.js +22 -0
- package/dist/services/built-in/roulette/index.d.ts +6 -0
- package/dist/services/built-in/roulette/index.js +27 -0
- package/dist/services/built-in/summarize/index.d.ts +6 -0
- package/dist/services/built-in/summarize/index.js +21 -0
- package/dist/services/built-in/tell-joke/handler.d.ts +7 -0
- package/dist/services/built-in/tell-joke/handler.js +122 -0
- package/dist/services/built-in/tell-joke/index.d.ts +9 -0
- package/dist/services/built-in/tell-joke/index.js +31 -0
- package/dist/services/built-in/translate/index.d.ts +6 -0
- package/dist/services/built-in/translate/index.js +21 -0
- package/dist/services/built-in/web-research/index.d.ts +9 -0
- package/dist/services/built-in/web-research/index.js +51 -0
- package/dist/services/index.d.ts +13 -0
- package/dist/services/index.js +14 -0
- package/dist/services/loader.d.ts +77 -0
- package/dist/services/loader.js +292 -0
- package/dist/services/manager.d.ts +86 -0
- package/dist/services/manager.js +255 -0
- package/dist/services/registry.d.ts +98 -0
- package/dist/services/registry.js +204 -0
- package/dist/services/types.d.ts +230 -0
- package/dist/services/types.js +30 -0
- package/dist/test/cli.test.d.ts +7 -0
- package/dist/test/cli.test.js +329 -0
- package/dist/test/comprehensive-overlay.test.d.ts +13 -0
- package/dist/test/comprehensive-overlay.test.js +593 -0
- package/dist/test/key-derivation.test.d.ts +12 -0
- package/dist/test/key-derivation.test.js +86 -0
- package/dist/test/overlay-submit.test.d.ts +10 -0
- package/dist/test/overlay-submit.test.js +460 -0
- package/dist/test/request-response-flow.test.d.ts +5 -0
- package/dist/test/request-response-flow.test.js +209 -0
- package/dist/test/service-system.test.d.ts +5 -0
- package/dist/test/service-system.test.js +190 -0
- package/dist/test/utils/server-logic.d.ts +98 -0
- package/dist/test/utils/server-logic.js +286 -0
- package/dist/test/wallet.test.d.ts +7 -0
- package/dist/test/wallet.test.js +146 -0
- package/index.ts +1965 -0
- package/openclaw.plugin.json +106 -0
- package/package.json +73 -0
- package/src/cli-main.ts +230 -0
- package/src/cli.ts +16 -0
- package/src/core/README.md +246 -0
- package/src/core/config.ts +21 -0
- package/src/core/index.ts +42 -0
- package/src/core/payment.ts +111 -0
- package/src/core/types.ts +102 -0
- package/src/core/verify.ts +119 -0
- package/src/core/wallet.ts +282 -0
- package/src/scripts/baemail/commands.ts +326 -0
- package/src/scripts/baemail/handler.ts +338 -0
- package/src/scripts/baemail/index.ts +6 -0
- package/src/scripts/config.ts +81 -0
- package/src/scripts/index.ts +8 -0
- package/src/scripts/messaging/connect.ts +121 -0
- package/src/scripts/messaging/handlers.ts +394 -0
- package/src/scripts/messaging/inbox.ts +64 -0
- package/src/scripts/messaging/index.ts +9 -0
- package/src/scripts/messaging/poll.ts +59 -0
- package/src/scripts/messaging/send.ts +54 -0
- package/src/scripts/output.ts +21 -0
- package/src/scripts/overlay/discover.ts +81 -0
- package/src/scripts/overlay/index.ts +8 -0
- package/src/scripts/overlay/registration.ts +199 -0
- package/src/scripts/overlay/services.ts +199 -0
- package/src/scripts/overlay/transaction.ts +124 -0
- package/src/scripts/payment/build.ts +65 -0
- package/src/scripts/payment/commands.ts +92 -0
- package/src/scripts/payment/index.ts +7 -0
- package/src/scripts/payment/types.ts +62 -0
- package/src/scripts/services/index.ts +7 -0
- package/src/scripts/services/queue.ts +35 -0
- package/src/scripts/services/request.ts +98 -0
- package/src/scripts/services/respond.ts +149 -0
- package/src/scripts/types.ts +121 -0
- package/src/scripts/utils/index.ts +7 -0
- package/src/scripts/utils/merkle.ts +57 -0
- package/src/scripts/utils/storage.ts +231 -0
- package/src/scripts/utils/woc.ts +106 -0
- package/src/scripts/wallet/balance.ts +277 -0
- package/src/scripts/wallet/identity.ts +203 -0
- package/src/scripts/wallet/index.ts +7 -0
- package/src/scripts/wallet/setup.ts +121 -0
- package/src/scripts/x-verification/commands.ts +256 -0
- package/src/scripts/x-verification/index.ts +5 -0
- package/src/services/built-in/api-proxy/index.ts +26 -0
- package/src/services/built-in/api-proxy/prompt.md +26 -0
- package/src/services/built-in/code-develop/index.ts +26 -0
- package/src/services/built-in/code-develop/prompt.md +35 -0
- package/src/services/built-in/code-review/index.ts +54 -0
- package/src/services/built-in/code-review/prompt.md +105 -0
- package/src/services/built-in/image-analysis/index.ts +36 -0
- package/src/services/built-in/image-analysis/prompt.md +42 -0
- package/src/services/built-in/memory-store/index.ts +25 -0
- package/src/services/built-in/memory-store/prompt.md +45 -0
- package/src/services/built-in/roulette/index.ts +30 -0
- package/src/services/built-in/roulette/prompt.md +35 -0
- package/src/services/built-in/summarize/index.ts +24 -0
- package/src/services/built-in/summarize/prompt.md +27 -0
- package/src/services/built-in/tell-joke/handler.ts +134 -0
- package/src/services/built-in/tell-joke/index.ts +34 -0
- package/src/services/built-in/tell-joke/prompt.md +59 -0
- package/src/services/built-in/translate/index.ts +24 -0
- package/src/services/built-in/translate/prompt.md +23 -0
- package/src/services/built-in/web-research/index.ts +54 -0
- package/src/services/built-in/web-research/prompt.md +110 -0
- package/src/services/index.ts +16 -0
- package/src/services/loader.ts +344 -0
- package/src/services/manager.ts +304 -0
- package/src/services/registry.ts +246 -0
- package/src/services/types.ts +259 -0
- package/src/test/cli.test.ts +352 -0
- package/src/test/comprehensive-overlay.test.ts +729 -0
- package/src/test/key-derivation.test.ts +102 -0
- package/src/test/overlay-submit.test.ts +570 -0
- package/src/test/request-response-flow.test.ts +252 -0
- package/src/test/service-system.test.ts +241 -0
- package/src/test/utils/server-logic.ts +368 -0
- package/src/test/wallet.test.ts +166 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image Analysis service definition.
|
|
3
|
+
*/
|
|
4
|
+
import { ServiceCategory } from '../../types.js';
|
|
5
|
+
const imageAnalysisService = {
|
|
6
|
+
id: 'image-analysis',
|
|
7
|
+
name: 'Image Analysis',
|
|
8
|
+
description: 'Analyze and describe images. Identify objects, text, scenes, and more.',
|
|
9
|
+
defaultPrice: 30,
|
|
10
|
+
category: ServiceCategory.AI,
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
imageUrl: { type: 'string', description: 'URL of the image to analyze' },
|
|
15
|
+
imageData: { type: 'string', description: 'Base64 encoded image data' },
|
|
16
|
+
analysisType: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
enum: ['general', 'objects', 'text', 'faces', 'scenes'],
|
|
19
|
+
description: 'Type of analysis to perform'
|
|
20
|
+
},
|
|
21
|
+
detailLevel: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
enum: ['brief', 'detailed', 'comprehensive'],
|
|
24
|
+
description: 'Level of detail in analysis'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
oneOf: [
|
|
28
|
+
{ required: ['imageUrl'] },
|
|
29
|
+
{ required: ['imageData'] }
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export default imageAnalysisService;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory Store service definition.
|
|
3
|
+
*/
|
|
4
|
+
import { ServiceCategory } from '../../types.js';
|
|
5
|
+
const memoryStoreService = {
|
|
6
|
+
id: 'memory-store',
|
|
7
|
+
name: 'Memory Store',
|
|
8
|
+
description: 'Persistent key-value storage for agents. Operations: set, get, delete, list.',
|
|
9
|
+
defaultPrice: 10,
|
|
10
|
+
category: ServiceCategory.UTILITY,
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
operation: { type: 'string', enum: ['set', 'get', 'delete', 'list'], description: 'Storage operation' },
|
|
15
|
+
key: { type: 'string', description: 'Storage key (required for set, get, delete)' },
|
|
16
|
+
value: { description: 'Value to store (required for set operation)' },
|
|
17
|
+
namespace: { type: 'string', description: 'Optional namespace for keys' }
|
|
18
|
+
},
|
|
19
|
+
required: ['operation']
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export default memoryStoreService;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Roulette service definition.
|
|
3
|
+
*/
|
|
4
|
+
import { ServiceCategory } from '../../types.js';
|
|
5
|
+
const rouletteService = {
|
|
6
|
+
id: 'roulette',
|
|
7
|
+
name: 'Roulette',
|
|
8
|
+
description: 'European roulette (single zero). Bet on: number 0-36, red/black, odd/even, high/low.',
|
|
9
|
+
defaultPrice: 10,
|
|
10
|
+
category: ServiceCategory.ENTERTAINMENT,
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
bet: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Bet type: specific number (0-36), red, black, odd, even, high (19-36), low (1-18), or dozen (1st, 2nd, 3rd)'
|
|
17
|
+
},
|
|
18
|
+
amount: {
|
|
19
|
+
type: 'number',
|
|
20
|
+
description: 'Bet amount (optional, for display purposes)',
|
|
21
|
+
minimum: 1
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
required: ['bet']
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export default rouletteService;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Summarize service definition.
|
|
3
|
+
*/
|
|
4
|
+
import { ServiceCategory } from '../../types.js';
|
|
5
|
+
const summarizeService = {
|
|
6
|
+
id: 'summarize',
|
|
7
|
+
name: 'Summarize',
|
|
8
|
+
description: 'Summarize long text, articles, or documents into concise bullet points.',
|
|
9
|
+
defaultPrice: 20,
|
|
10
|
+
category: ServiceCategory.AI,
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
text: { type: 'string', description: 'Text to summarize' },
|
|
15
|
+
maxLength: { type: 'number', description: 'Maximum length of summary' },
|
|
16
|
+
format: { type: 'string', enum: ['bullets', 'paragraph'], description: 'Output format' }
|
|
17
|
+
},
|
|
18
|
+
required: ['text']
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export default summarizeService;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tell Joke service handler.
|
|
3
|
+
*
|
|
4
|
+
* Provides a simple legacy handler for joke telling when not in agent mode.
|
|
5
|
+
*/
|
|
6
|
+
// Simple joke database
|
|
7
|
+
const jokes = {
|
|
8
|
+
dad: [
|
|
9
|
+
"Why don't scientists trust atoms? Because they make up everything!",
|
|
10
|
+
"I told my wife she was drawing her eyebrows too high. She seemed surprised.",
|
|
11
|
+
"Why don't eggs tell jokes? They'd crack each other up!",
|
|
12
|
+
"I invented a new word: Plagiarism!",
|
|
13
|
+
"What do you call a fake noodle? An impasta!"
|
|
14
|
+
],
|
|
15
|
+
pun: [
|
|
16
|
+
"I wondered why the baseball was getting bigger. Then it hit me.",
|
|
17
|
+
"A bicycle can't stand on its own because it's two-tired.",
|
|
18
|
+
"What do you call a bear with no teeth? A gummy bear!",
|
|
19
|
+
"I used to be a banker, but I lost interest.",
|
|
20
|
+
"The math teacher called in sick with algebra."
|
|
21
|
+
],
|
|
22
|
+
tech: [
|
|
23
|
+
"Why do programmers prefer dark mode? Because light attracts bugs!",
|
|
24
|
+
"How many programmers does it take to change a light bulb? None, that's a hardware problem.",
|
|
25
|
+
"Why did the developer go broke? Because he used up all his cache!",
|
|
26
|
+
"There are only 10 types of people in the world: those who understand binary and those who don't.",
|
|
27
|
+
"A SQL query goes into a bar, walks up to two tables and asks... 'Can I join you?'"
|
|
28
|
+
],
|
|
29
|
+
general: [
|
|
30
|
+
"What do you get when you cross a snowman and a vampire? Frostbite!",
|
|
31
|
+
"Why did the scarecrow win an award? He was outstanding in his field!",
|
|
32
|
+
"What's orange and sounds like a parrot? A carrot!",
|
|
33
|
+
"Why don't some couples go to the gym? Because some relationships don't work out!",
|
|
34
|
+
"What did the ocean say to the beach? Nothing, it just waved!"
|
|
35
|
+
]
|
|
36
|
+
};
|
|
37
|
+
export const tellJokeHandler = {
|
|
38
|
+
/**
|
|
39
|
+
* Validate joke request input.
|
|
40
|
+
*/
|
|
41
|
+
validate(input) {
|
|
42
|
+
// Allow empty input for random jokes
|
|
43
|
+
if (!input) {
|
|
44
|
+
return { valid: true, sanitized: {} };
|
|
45
|
+
}
|
|
46
|
+
if (typeof input !== 'object') {
|
|
47
|
+
return { valid: false, error: 'Input must be an object or empty for random joke' };
|
|
48
|
+
}
|
|
49
|
+
const sanitized = {};
|
|
50
|
+
// Validate topic if provided
|
|
51
|
+
if (input.topic !== undefined) {
|
|
52
|
+
if (typeof input.topic !== 'string') {
|
|
53
|
+
return { valid: false, error: 'Topic must be a string' };
|
|
54
|
+
}
|
|
55
|
+
sanitized.topic = input.topic.toLowerCase().trim();
|
|
56
|
+
}
|
|
57
|
+
// Validate style if provided
|
|
58
|
+
if (input.style !== undefined) {
|
|
59
|
+
const validStyles = ['dad', 'pun', 'tech', 'general'];
|
|
60
|
+
if (typeof input.style !== 'string' || !validStyles.includes(input.style)) {
|
|
61
|
+
return {
|
|
62
|
+
valid: false,
|
|
63
|
+
error: `Style must be one of: ${validStyles.join(', ')}`
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
sanitized.style = input.style;
|
|
67
|
+
}
|
|
68
|
+
return { valid: true, sanitized };
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* Process the joke request.
|
|
72
|
+
*/
|
|
73
|
+
async process(input, context) {
|
|
74
|
+
try {
|
|
75
|
+
const startTime = Date.now();
|
|
76
|
+
// Determine joke style
|
|
77
|
+
let style = input.style || 'general';
|
|
78
|
+
// If topic is provided but no style, try to match topic to style
|
|
79
|
+
if (input.topic && !input.style) {
|
|
80
|
+
const topic = input.topic.toLowerCase();
|
|
81
|
+
if (topic.includes('dad') || topic.includes('father')) {
|
|
82
|
+
style = 'dad';
|
|
83
|
+
}
|
|
84
|
+
else if (topic.includes('pun') || topic.includes('wordplay')) {
|
|
85
|
+
style = 'pun';
|
|
86
|
+
}
|
|
87
|
+
else if (topic.includes('programming') || topic.includes('tech') || topic.includes('computer')) {
|
|
88
|
+
style = 'tech';
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Get joke from the selected category
|
|
92
|
+
const jokeCategory = jokes[style] || jokes.general;
|
|
93
|
+
const joke = jokeCategory[Math.floor(Math.random() * jokeCategory.length)];
|
|
94
|
+
const processingTime = Date.now() - startTime;
|
|
95
|
+
return {
|
|
96
|
+
success: true,
|
|
97
|
+
data: {
|
|
98
|
+
joke,
|
|
99
|
+
style,
|
|
100
|
+
topic: input.topic || 'random',
|
|
101
|
+
timestamp: new Date().toISOString()
|
|
102
|
+
},
|
|
103
|
+
metadata: {
|
|
104
|
+
processingTime,
|
|
105
|
+
version: '1.0',
|
|
106
|
+
jokeCount: jokeCategory.length,
|
|
107
|
+
source: 'built-in-handler'
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
return {
|
|
113
|
+
success: false,
|
|
114
|
+
error: error instanceof Error ? error.message : String(error),
|
|
115
|
+
metadata: {
|
|
116
|
+
serviceId: 'tell-joke',
|
|
117
|
+
errorType: 'processing_error'
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tell Joke service definition.
|
|
3
|
+
*
|
|
4
|
+
* A simple service that tells random jokes. This demonstrates
|
|
5
|
+
* a basic service that works in both handler and agent modes.
|
|
6
|
+
*/
|
|
7
|
+
import { ServiceDefinition } from '../../types.js';
|
|
8
|
+
declare const tellJokeService: ServiceDefinition;
|
|
9
|
+
export default tellJokeService;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tell Joke service definition.
|
|
3
|
+
*
|
|
4
|
+
* A simple service that tells random jokes. This demonstrates
|
|
5
|
+
* a basic service that works in both handler and agent modes.
|
|
6
|
+
*/
|
|
7
|
+
import { ServiceCategory } from '../../types.js';
|
|
8
|
+
import { tellJokeHandler } from './handler.js';
|
|
9
|
+
const tellJokeService = {
|
|
10
|
+
id: 'tell-joke',
|
|
11
|
+
name: 'Random Joke',
|
|
12
|
+
description: 'Get a random joke. Guaranteed to be at least mildly amusing.',
|
|
13
|
+
defaultPrice: 5,
|
|
14
|
+
category: ServiceCategory.ENTERTAINMENT,
|
|
15
|
+
inputSchema: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
topic: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'Optional topic for the joke (e.g., "programming", "cats")'
|
|
21
|
+
},
|
|
22
|
+
style: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
enum: ['dad', 'pun', 'tech', 'general'],
|
|
25
|
+
description: 'Style of joke to tell'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
handler: tellJokeHandler
|
|
30
|
+
};
|
|
31
|
+
export default tellJokeService;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translation service definition.
|
|
3
|
+
*/
|
|
4
|
+
import { ServiceCategory } from '../../types.js';
|
|
5
|
+
const translateService = {
|
|
6
|
+
id: 'translate',
|
|
7
|
+
name: 'Translation',
|
|
8
|
+
description: 'Translate text between 30+ languages. Accurate, context-aware translations.',
|
|
9
|
+
defaultPrice: 20,
|
|
10
|
+
category: ServiceCategory.UTILITY,
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
text: { type: 'string', description: 'Text to translate' },
|
|
15
|
+
to: { type: 'string', description: 'Target language (e.g., "es", "french", "Japanese")' },
|
|
16
|
+
from: { type: 'string', description: 'Source language (auto-detected if not provided)' }
|
|
17
|
+
},
|
|
18
|
+
required: ['text', 'to']
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export default translateService;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Research service definition.
|
|
3
|
+
*
|
|
4
|
+
* Research any topic using current web sources and return a synthesized
|
|
5
|
+
* summary with cited sources. Agent-mode service leveraging web search.
|
|
6
|
+
*/
|
|
7
|
+
import { ServiceDefinition } from '../../types.js';
|
|
8
|
+
declare const webResearchService: ServiceDefinition;
|
|
9
|
+
export default webResearchService;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Research service definition.
|
|
3
|
+
*
|
|
4
|
+
* Research any topic using current web sources and return a synthesized
|
|
5
|
+
* summary with cited sources. Agent-mode service leveraging web search.
|
|
6
|
+
*/
|
|
7
|
+
import { ServiceCategory } from '../../types.js';
|
|
8
|
+
const webResearchService = {
|
|
9
|
+
id: 'web-research',
|
|
10
|
+
name: 'Web Research',
|
|
11
|
+
description: 'Research any topic using current web sources. Returns a synthesized summary with cited sources.',
|
|
12
|
+
defaultPrice: 50,
|
|
13
|
+
category: ServiceCategory.RESEARCH,
|
|
14
|
+
inputSchema: {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
query: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'Research query or topic'
|
|
20
|
+
},
|
|
21
|
+
depth: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
enum: ['quick', 'standard', 'comprehensive'],
|
|
24
|
+
description: 'Research depth (default: standard)'
|
|
25
|
+
},
|
|
26
|
+
sources: {
|
|
27
|
+
type: 'number',
|
|
28
|
+
minimum: 3,
|
|
29
|
+
maximum: 20,
|
|
30
|
+
description: 'Number of sources to research (default: 5)'
|
|
31
|
+
},
|
|
32
|
+
focusAreas: {
|
|
33
|
+
type: 'array',
|
|
34
|
+
items: { type: 'string' },
|
|
35
|
+
description: 'Specific aspects to focus on'
|
|
36
|
+
},
|
|
37
|
+
excludeDomains: {
|
|
38
|
+
type: 'array',
|
|
39
|
+
items: { type: 'string' },
|
|
40
|
+
description: 'Domains to exclude from research'
|
|
41
|
+
},
|
|
42
|
+
timeframe: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
enum: ['day', 'week', 'month', 'year', 'all'],
|
|
45
|
+
description: 'How recent the information should be'
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
required: ['query']
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export default webResearchService;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service system main exports.
|
|
3
|
+
*
|
|
4
|
+
* This is the main entry point for the service system, providing
|
|
5
|
+
* a clean interface for the rest of the application.
|
|
6
|
+
*/
|
|
7
|
+
export * from './types.js';
|
|
8
|
+
export * from './registry.js';
|
|
9
|
+
export * from './loader.js';
|
|
10
|
+
export * from './manager.js';
|
|
11
|
+
export { serviceRegistry } from './registry.js';
|
|
12
|
+
export { serviceLoader } from './loader.js';
|
|
13
|
+
export { serviceManager, initializeServiceSystem, getServiceManager } from './manager.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service system main exports.
|
|
3
|
+
*
|
|
4
|
+
* This is the main entry point for the service system, providing
|
|
5
|
+
* a clean interface for the rest of the application.
|
|
6
|
+
*/
|
|
7
|
+
export * from './types.js';
|
|
8
|
+
export * from './registry.js';
|
|
9
|
+
export * from './loader.js';
|
|
10
|
+
export * from './manager.js';
|
|
11
|
+
// Re-export the main instances for easy access
|
|
12
|
+
export { serviceRegistry } from './registry.js';
|
|
13
|
+
export { serviceLoader } from './loader.js';
|
|
14
|
+
export { serviceManager, initializeServiceSystem, getServiceManager } from './manager.js';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service loader implementation.
|
|
3
|
+
*
|
|
4
|
+
* This dynamically loads services from directories, supporting both
|
|
5
|
+
* built-in services and custom user services.
|
|
6
|
+
*/
|
|
7
|
+
import { ServiceDefinition, ServiceLoader } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Default service loader implementation.
|
|
10
|
+
*/
|
|
11
|
+
export declare class DefaultServiceLoader implements ServiceLoader {
|
|
12
|
+
private builtInDir;
|
|
13
|
+
private customDir;
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Load services from a directory.
|
|
17
|
+
*/
|
|
18
|
+
loadFromDirectory(directory: string): Promise<ServiceDefinition[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Load all built-in services.
|
|
21
|
+
*/
|
|
22
|
+
loadBuiltInServices(): Promise<ServiceDefinition[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Load custom user services.
|
|
25
|
+
*/
|
|
26
|
+
loadCustomServices(): Promise<ServiceDefinition[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Load all services (built-in + custom).
|
|
29
|
+
*/
|
|
30
|
+
loadAllServices(): Promise<ServiceDefinition[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Load a service definition from a directory.
|
|
33
|
+
*/
|
|
34
|
+
private loadServiceFromDirectory;
|
|
35
|
+
/**
|
|
36
|
+
* Create a new custom service directory.
|
|
37
|
+
*/
|
|
38
|
+
createCustomServiceDirectory(serviceId: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Create a basic service template.
|
|
41
|
+
*/
|
|
42
|
+
createServiceTemplate(serviceId: string, options: {
|
|
43
|
+
name: string;
|
|
44
|
+
description: string;
|
|
45
|
+
defaultPrice: number;
|
|
46
|
+
category?: string;
|
|
47
|
+
hasHandler?: boolean;
|
|
48
|
+
}): void;
|
|
49
|
+
/**
|
|
50
|
+
* Generate service definition template.
|
|
51
|
+
*/
|
|
52
|
+
private generateServiceTemplate;
|
|
53
|
+
/**
|
|
54
|
+
* Generate prompt template.
|
|
55
|
+
*/
|
|
56
|
+
private generatePromptTemplate;
|
|
57
|
+
/**
|
|
58
|
+
* Generate handler template.
|
|
59
|
+
*/
|
|
60
|
+
private generateHandlerTemplate;
|
|
61
|
+
/**
|
|
62
|
+
* Get the built-in services directory.
|
|
63
|
+
*/
|
|
64
|
+
getBuiltInDirectory(): string;
|
|
65
|
+
/**
|
|
66
|
+
* Get the custom services directory.
|
|
67
|
+
*/
|
|
68
|
+
getCustomDirectory(): string;
|
|
69
|
+
/**
|
|
70
|
+
* Check if a service directory exists.
|
|
71
|
+
*/
|
|
72
|
+
serviceExists(serviceId: string, inCustom?: boolean): boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Global service loader instance.
|
|
76
|
+
*/
|
|
77
|
+
export declare const serviceLoader: DefaultServiceLoader;
|