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.
Files changed (221) hide show
  1. package/README.md +406 -0
  2. package/SKILL.md +78 -0
  3. package/clawdbot.plugin.json +106 -0
  4. package/dist/cli-main.d.ts +7 -0
  5. package/dist/cli-main.js +192 -0
  6. package/dist/cli.d.ts +8 -0
  7. package/dist/cli.js +14 -0
  8. package/dist/core/config.d.ts +11 -0
  9. package/dist/core/config.js +13 -0
  10. package/dist/core/index.d.ts +25 -0
  11. package/dist/core/index.js +26 -0
  12. package/dist/core/payment.d.ts +16 -0
  13. package/dist/core/payment.js +94 -0
  14. package/dist/core/types.d.ts +94 -0
  15. package/dist/core/types.js +4 -0
  16. package/dist/core/verify.d.ts +28 -0
  17. package/dist/core/verify.js +104 -0
  18. package/dist/core/wallet.d.ts +99 -0
  19. package/dist/core/wallet.js +219 -0
  20. package/dist/scripts/baemail/commands.d.ts +64 -0
  21. package/dist/scripts/baemail/commands.js +258 -0
  22. package/dist/scripts/baemail/handler.d.ts +36 -0
  23. package/dist/scripts/baemail/handler.js +284 -0
  24. package/dist/scripts/baemail/index.d.ts +5 -0
  25. package/dist/scripts/baemail/index.js +5 -0
  26. package/dist/scripts/config.d.ts +48 -0
  27. package/dist/scripts/config.js +68 -0
  28. package/dist/scripts/index.d.ts +7 -0
  29. package/dist/scripts/index.js +7 -0
  30. package/dist/scripts/messaging/connect.d.ts +8 -0
  31. package/dist/scripts/messaging/connect.js +114 -0
  32. package/dist/scripts/messaging/handlers.d.ts +21 -0
  33. package/dist/scripts/messaging/handlers.js +334 -0
  34. package/dist/scripts/messaging/inbox.d.ts +11 -0
  35. package/dist/scripts/messaging/inbox.js +51 -0
  36. package/dist/scripts/messaging/index.d.ts +8 -0
  37. package/dist/scripts/messaging/index.js +8 -0
  38. package/dist/scripts/messaging/poll.d.ts +7 -0
  39. package/dist/scripts/messaging/poll.js +52 -0
  40. package/dist/scripts/messaging/send.d.ts +7 -0
  41. package/dist/scripts/messaging/send.js +43 -0
  42. package/dist/scripts/output.d.ts +12 -0
  43. package/dist/scripts/output.js +19 -0
  44. package/dist/scripts/overlay/discover.d.ts +7 -0
  45. package/dist/scripts/overlay/discover.js +72 -0
  46. package/dist/scripts/overlay/index.d.ts +7 -0
  47. package/dist/scripts/overlay/index.js +7 -0
  48. package/dist/scripts/overlay/registration.d.ts +19 -0
  49. package/dist/scripts/overlay/registration.js +176 -0
  50. package/dist/scripts/overlay/services.d.ts +29 -0
  51. package/dist/scripts/overlay/services.js +167 -0
  52. package/dist/scripts/overlay/transaction.d.ts +42 -0
  53. package/dist/scripts/overlay/transaction.js +103 -0
  54. package/dist/scripts/payment/build.d.ts +24 -0
  55. package/dist/scripts/payment/build.js +54 -0
  56. package/dist/scripts/payment/commands.d.ts +15 -0
  57. package/dist/scripts/payment/commands.js +73 -0
  58. package/dist/scripts/payment/index.d.ts +6 -0
  59. package/dist/scripts/payment/index.js +6 -0
  60. package/dist/scripts/payment/types.d.ts +56 -0
  61. package/dist/scripts/payment/types.js +4 -0
  62. package/dist/scripts/services/index.d.ts +6 -0
  63. package/dist/scripts/services/index.js +6 -0
  64. package/dist/scripts/services/queue.d.ts +11 -0
  65. package/dist/scripts/services/queue.js +28 -0
  66. package/dist/scripts/services/request.d.ts +7 -0
  67. package/dist/scripts/services/request.js +82 -0
  68. package/dist/scripts/services/respond.d.ts +11 -0
  69. package/dist/scripts/services/respond.js +132 -0
  70. package/dist/scripts/types.d.ts +107 -0
  71. package/dist/scripts/types.js +4 -0
  72. package/dist/scripts/utils/index.d.ts +6 -0
  73. package/dist/scripts/utils/index.js +6 -0
  74. package/dist/scripts/utils/merkle.d.ts +12 -0
  75. package/dist/scripts/utils/merkle.js +47 -0
  76. package/dist/scripts/utils/storage.d.ts +66 -0
  77. package/dist/scripts/utils/storage.js +211 -0
  78. package/dist/scripts/utils/woc.d.ts +26 -0
  79. package/dist/scripts/utils/woc.js +91 -0
  80. package/dist/scripts/wallet/balance.d.ts +22 -0
  81. package/dist/scripts/wallet/balance.js +240 -0
  82. package/dist/scripts/wallet/identity.d.ts +70 -0
  83. package/dist/scripts/wallet/identity.js +151 -0
  84. package/dist/scripts/wallet/index.d.ts +6 -0
  85. package/dist/scripts/wallet/index.js +6 -0
  86. package/dist/scripts/wallet/setup.d.ts +15 -0
  87. package/dist/scripts/wallet/setup.js +105 -0
  88. package/dist/scripts/x-verification/commands.d.ts +27 -0
  89. package/dist/scripts/x-verification/commands.js +222 -0
  90. package/dist/scripts/x-verification/index.d.ts +4 -0
  91. package/dist/scripts/x-verification/index.js +4 -0
  92. package/dist/services/built-in/api-proxy/index.d.ts +6 -0
  93. package/dist/services/built-in/api-proxy/index.js +23 -0
  94. package/dist/services/built-in/code-develop/index.d.ts +6 -0
  95. package/dist/services/built-in/code-develop/index.js +23 -0
  96. package/dist/services/built-in/code-review/index.d.ts +10 -0
  97. package/dist/services/built-in/code-review/index.js +51 -0
  98. package/dist/services/built-in/image-analysis/index.d.ts +6 -0
  99. package/dist/services/built-in/image-analysis/index.js +33 -0
  100. package/dist/services/built-in/memory-store/index.d.ts +6 -0
  101. package/dist/services/built-in/memory-store/index.js +22 -0
  102. package/dist/services/built-in/roulette/index.d.ts +6 -0
  103. package/dist/services/built-in/roulette/index.js +27 -0
  104. package/dist/services/built-in/summarize/index.d.ts +6 -0
  105. package/dist/services/built-in/summarize/index.js +21 -0
  106. package/dist/services/built-in/tell-joke/handler.d.ts +7 -0
  107. package/dist/services/built-in/tell-joke/handler.js +122 -0
  108. package/dist/services/built-in/tell-joke/index.d.ts +9 -0
  109. package/dist/services/built-in/tell-joke/index.js +31 -0
  110. package/dist/services/built-in/translate/index.d.ts +6 -0
  111. package/dist/services/built-in/translate/index.js +21 -0
  112. package/dist/services/built-in/web-research/index.d.ts +9 -0
  113. package/dist/services/built-in/web-research/index.js +51 -0
  114. package/dist/services/index.d.ts +13 -0
  115. package/dist/services/index.js +14 -0
  116. package/dist/services/loader.d.ts +77 -0
  117. package/dist/services/loader.js +292 -0
  118. package/dist/services/manager.d.ts +86 -0
  119. package/dist/services/manager.js +255 -0
  120. package/dist/services/registry.d.ts +98 -0
  121. package/dist/services/registry.js +204 -0
  122. package/dist/services/types.d.ts +230 -0
  123. package/dist/services/types.js +30 -0
  124. package/dist/test/cli.test.d.ts +7 -0
  125. package/dist/test/cli.test.js +329 -0
  126. package/dist/test/comprehensive-overlay.test.d.ts +13 -0
  127. package/dist/test/comprehensive-overlay.test.js +593 -0
  128. package/dist/test/key-derivation.test.d.ts +12 -0
  129. package/dist/test/key-derivation.test.js +86 -0
  130. package/dist/test/overlay-submit.test.d.ts +10 -0
  131. package/dist/test/overlay-submit.test.js +460 -0
  132. package/dist/test/request-response-flow.test.d.ts +5 -0
  133. package/dist/test/request-response-flow.test.js +209 -0
  134. package/dist/test/service-system.test.d.ts +5 -0
  135. package/dist/test/service-system.test.js +190 -0
  136. package/dist/test/utils/server-logic.d.ts +98 -0
  137. package/dist/test/utils/server-logic.js +286 -0
  138. package/dist/test/wallet.test.d.ts +7 -0
  139. package/dist/test/wallet.test.js +146 -0
  140. package/index.ts +1965 -0
  141. package/openclaw.plugin.json +106 -0
  142. package/package.json +73 -0
  143. package/src/cli-main.ts +230 -0
  144. package/src/cli.ts +16 -0
  145. package/src/core/README.md +246 -0
  146. package/src/core/config.ts +21 -0
  147. package/src/core/index.ts +42 -0
  148. package/src/core/payment.ts +111 -0
  149. package/src/core/types.ts +102 -0
  150. package/src/core/verify.ts +119 -0
  151. package/src/core/wallet.ts +282 -0
  152. package/src/scripts/baemail/commands.ts +326 -0
  153. package/src/scripts/baemail/handler.ts +338 -0
  154. package/src/scripts/baemail/index.ts +6 -0
  155. package/src/scripts/config.ts +81 -0
  156. package/src/scripts/index.ts +8 -0
  157. package/src/scripts/messaging/connect.ts +121 -0
  158. package/src/scripts/messaging/handlers.ts +394 -0
  159. package/src/scripts/messaging/inbox.ts +64 -0
  160. package/src/scripts/messaging/index.ts +9 -0
  161. package/src/scripts/messaging/poll.ts +59 -0
  162. package/src/scripts/messaging/send.ts +54 -0
  163. package/src/scripts/output.ts +21 -0
  164. package/src/scripts/overlay/discover.ts +81 -0
  165. package/src/scripts/overlay/index.ts +8 -0
  166. package/src/scripts/overlay/registration.ts +199 -0
  167. package/src/scripts/overlay/services.ts +199 -0
  168. package/src/scripts/overlay/transaction.ts +124 -0
  169. package/src/scripts/payment/build.ts +65 -0
  170. package/src/scripts/payment/commands.ts +92 -0
  171. package/src/scripts/payment/index.ts +7 -0
  172. package/src/scripts/payment/types.ts +62 -0
  173. package/src/scripts/services/index.ts +7 -0
  174. package/src/scripts/services/queue.ts +35 -0
  175. package/src/scripts/services/request.ts +98 -0
  176. package/src/scripts/services/respond.ts +149 -0
  177. package/src/scripts/types.ts +121 -0
  178. package/src/scripts/utils/index.ts +7 -0
  179. package/src/scripts/utils/merkle.ts +57 -0
  180. package/src/scripts/utils/storage.ts +231 -0
  181. package/src/scripts/utils/woc.ts +106 -0
  182. package/src/scripts/wallet/balance.ts +277 -0
  183. package/src/scripts/wallet/identity.ts +203 -0
  184. package/src/scripts/wallet/index.ts +7 -0
  185. package/src/scripts/wallet/setup.ts +121 -0
  186. package/src/scripts/x-verification/commands.ts +256 -0
  187. package/src/scripts/x-verification/index.ts +5 -0
  188. package/src/services/built-in/api-proxy/index.ts +26 -0
  189. package/src/services/built-in/api-proxy/prompt.md +26 -0
  190. package/src/services/built-in/code-develop/index.ts +26 -0
  191. package/src/services/built-in/code-develop/prompt.md +35 -0
  192. package/src/services/built-in/code-review/index.ts +54 -0
  193. package/src/services/built-in/code-review/prompt.md +105 -0
  194. package/src/services/built-in/image-analysis/index.ts +36 -0
  195. package/src/services/built-in/image-analysis/prompt.md +42 -0
  196. package/src/services/built-in/memory-store/index.ts +25 -0
  197. package/src/services/built-in/memory-store/prompt.md +45 -0
  198. package/src/services/built-in/roulette/index.ts +30 -0
  199. package/src/services/built-in/roulette/prompt.md +35 -0
  200. package/src/services/built-in/summarize/index.ts +24 -0
  201. package/src/services/built-in/summarize/prompt.md +27 -0
  202. package/src/services/built-in/tell-joke/handler.ts +134 -0
  203. package/src/services/built-in/tell-joke/index.ts +34 -0
  204. package/src/services/built-in/tell-joke/prompt.md +59 -0
  205. package/src/services/built-in/translate/index.ts +24 -0
  206. package/src/services/built-in/translate/prompt.md +23 -0
  207. package/src/services/built-in/web-research/index.ts +54 -0
  208. package/src/services/built-in/web-research/prompt.md +110 -0
  209. package/src/services/index.ts +16 -0
  210. package/src/services/loader.ts +344 -0
  211. package/src/services/manager.ts +304 -0
  212. package/src/services/registry.ts +246 -0
  213. package/src/services/types.ts +259 -0
  214. package/src/test/cli.test.ts +352 -0
  215. package/src/test/comprehensive-overlay.test.ts +729 -0
  216. package/src/test/key-derivation.test.ts +102 -0
  217. package/src/test/overlay-submit.test.ts +570 -0
  218. package/src/test/request-response-flow.test.ts +252 -0
  219. package/src/test/service-system.test.ts +241 -0
  220. package/src/test/utils/server-logic.ts +368 -0
  221. package/src/test/wallet.test.ts +166 -0
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Roulette service definition.
3
+ */
4
+
5
+ import { ServiceDefinition, ServiceCategory } from '../../types.js';
6
+
7
+ const rouletteService: ServiceDefinition = {
8
+ id: 'roulette',
9
+ name: 'Roulette',
10
+ description: 'European roulette (single zero). Bet on: number 0-36, red/black, odd/even, high/low.',
11
+ defaultPrice: 10,
12
+ category: ServiceCategory.ENTERTAINMENT,
13
+ inputSchema: {
14
+ type: 'object',
15
+ properties: {
16
+ bet: {
17
+ type: 'string',
18
+ description: 'Bet type: specific number (0-36), red, black, odd, even, high (19-36), low (1-18), or dozen (1st, 2nd, 3rd)'
19
+ },
20
+ amount: {
21
+ type: 'number',
22
+ description: 'Bet amount (optional, for display purposes)',
23
+ minimum: 1
24
+ }
25
+ },
26
+ required: ['bet']
27
+ }
28
+ };
29
+
30
+ export default rouletteService;
@@ -0,0 +1,35 @@
1
+ # Roulette Service
2
+
3
+ You are processing a request for the "roulette" service. You simulate a European roulette game with a single zero wheel.
4
+
5
+ ## Input
6
+ ```json
7
+ {{input}}
8
+ ```
9
+
10
+ ## Instructions
11
+ 1. Parse the bet type from the input
12
+ 2. Generate a random number from 0-36 (European roulette)
13
+ 3. Determine win/loss based on the bet type and winning number
14
+ 4. Calculate payout according to roulette odds
15
+ 5. Provide engaging commentary about the spin
16
+
17
+ ## Bet Types and Payouts
18
+ - **Single number (0-36)**: 35:1 payout
19
+ - **Red/Black**: 1:1 payout (Red: 1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36)
20
+ - **Odd/Even**: 1:1 payout (0 is neither odd nor even)
21
+ - **High (19-36)/Low (1-18)**: 1:1 payout
22
+ - **Dozens (1-12, 13-24, 25-36)**: 2:1 payout
23
+
24
+ ## Response Format
25
+ ```json
26
+ {
27
+ "success": true,
28
+ "winningNumber": 23,
29
+ "winningColor": "red",
30
+ "betPlaced": "red",
31
+ "result": "win",
32
+ "payout": "1:1",
33
+ "commentary": "The ball lands on 23 red! Your bet on red wins!"
34
+ }
35
+ ```
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Summarize service definition.
3
+ */
4
+
5
+ import { ServiceDefinition, ServiceCategory } from '../../types.js';
6
+
7
+ const summarizeService: ServiceDefinition = {
8
+ id: 'summarize',
9
+ name: 'Summarize',
10
+ description: 'Summarize long text, articles, or documents into concise bullet points.',
11
+ defaultPrice: 20,
12
+ category: ServiceCategory.AI,
13
+ inputSchema: {
14
+ type: 'object',
15
+ properties: {
16
+ text: { type: 'string', description: 'Text to summarize' },
17
+ maxLength: { type: 'number', description: 'Maximum length of summary' },
18
+ format: { type: 'string', enum: ['bullets', 'paragraph'], description: 'Output format' }
19
+ },
20
+ required: ['text']
21
+ }
22
+ };
23
+
24
+ export default summarizeService;
@@ -0,0 +1,27 @@
1
+ # Summarize Service
2
+
3
+ You are processing a request for the "summarize" service. You help users create concise summaries of long text content.
4
+
5
+ ## Input
6
+ ```json
7
+ {{input}}
8
+ ```
9
+
10
+ ## Instructions
11
+ 1. Read and understand the provided text thoroughly
12
+ 2. Extract the key points and main ideas
13
+ 3. Create a clear, concise summary in the requested format
14
+ 4. Preserve important details while removing redundancy
15
+
16
+ ## Response Format
17
+ ```json
18
+ {
19
+ "success": true,
20
+ "summary": "Your concise summary here",
21
+ "keyPoints": ["point 1", "point 2", "point 3"],
22
+ "wordCount": {
23
+ "original": 1500,
24
+ "summary": 250
25
+ }
26
+ }
27
+ ```
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Tell Joke service handler.
3
+ *
4
+ * Provides a simple legacy handler for joke telling when not in agent mode.
5
+ */
6
+
7
+ import { ServiceHandler, ValidationResult, ServiceContext, ServiceResult } from '../../types.js';
8
+
9
+ // Simple joke database
10
+ const jokes = {
11
+ dad: [
12
+ "Why don't scientists trust atoms? Because they make up everything!",
13
+ "I told my wife she was drawing her eyebrows too high. She seemed surprised.",
14
+ "Why don't eggs tell jokes? They'd crack each other up!",
15
+ "I invented a new word: Plagiarism!",
16
+ "What do you call a fake noodle? An impasta!"
17
+ ],
18
+ pun: [
19
+ "I wondered why the baseball was getting bigger. Then it hit me.",
20
+ "A bicycle can't stand on its own because it's two-tired.",
21
+ "What do you call a bear with no teeth? A gummy bear!",
22
+ "I used to be a banker, but I lost interest.",
23
+ "The math teacher called in sick with algebra."
24
+ ],
25
+ tech: [
26
+ "Why do programmers prefer dark mode? Because light attracts bugs!",
27
+ "How many programmers does it take to change a light bulb? None, that's a hardware problem.",
28
+ "Why did the developer go broke? Because he used up all his cache!",
29
+ "There are only 10 types of people in the world: those who understand binary and those who don't.",
30
+ "A SQL query goes into a bar, walks up to two tables and asks... 'Can I join you?'"
31
+ ],
32
+ general: [
33
+ "What do you get when you cross a snowman and a vampire? Frostbite!",
34
+ "Why did the scarecrow win an award? He was outstanding in his field!",
35
+ "What's orange and sounds like a parrot? A carrot!",
36
+ "Why don't some couples go to the gym? Because some relationships don't work out!",
37
+ "What did the ocean say to the beach? Nothing, it just waved!"
38
+ ]
39
+ };
40
+
41
+ export const tellJokeHandler: ServiceHandler = {
42
+ /**
43
+ * Validate joke request input.
44
+ */
45
+ validate(input: any): ValidationResult {
46
+ // Allow empty input for random jokes
47
+ if (!input) {
48
+ return { valid: true, sanitized: {} };
49
+ }
50
+
51
+ if (typeof input !== 'object') {
52
+ return { valid: false, error: 'Input must be an object or empty for random joke' };
53
+ }
54
+
55
+ const sanitized: any = {};
56
+
57
+ // Validate topic if provided
58
+ if (input.topic !== undefined) {
59
+ if (typeof input.topic !== 'string') {
60
+ return { valid: false, error: 'Topic must be a string' };
61
+ }
62
+ sanitized.topic = input.topic.toLowerCase().trim();
63
+ }
64
+
65
+ // Validate style if provided
66
+ if (input.style !== undefined) {
67
+ const validStyles = ['dad', 'pun', 'tech', 'general'];
68
+ if (typeof input.style !== 'string' || !validStyles.includes(input.style)) {
69
+ return {
70
+ valid: false,
71
+ error: `Style must be one of: ${validStyles.join(', ')}`
72
+ };
73
+ }
74
+ sanitized.style = input.style;
75
+ }
76
+
77
+ return { valid: true, sanitized };
78
+ },
79
+
80
+ /**
81
+ * Process the joke request.
82
+ */
83
+ async process(input: any, context: ServiceContext): Promise<ServiceResult> {
84
+ try {
85
+ const startTime = Date.now();
86
+
87
+ // Determine joke style
88
+ let style = input.style || 'general';
89
+
90
+ // If topic is provided but no style, try to match topic to style
91
+ if (input.topic && !input.style) {
92
+ const topic = input.topic.toLowerCase();
93
+ if (topic.includes('dad') || topic.includes('father')) {
94
+ style = 'dad';
95
+ } else if (topic.includes('pun') || topic.includes('wordplay')) {
96
+ style = 'pun';
97
+ } else if (topic.includes('programming') || topic.includes('tech') || topic.includes('computer')) {
98
+ style = 'tech';
99
+ }
100
+ }
101
+
102
+ // Get joke from the selected category
103
+ const jokeCategory = jokes[style as keyof typeof jokes] || jokes.general;
104
+ const joke = jokeCategory[Math.floor(Math.random() * jokeCategory.length)];
105
+
106
+ const processingTime = Date.now() - startTime;
107
+
108
+ return {
109
+ success: true,
110
+ data: {
111
+ joke,
112
+ style,
113
+ topic: input.topic || 'random',
114
+ timestamp: new Date().toISOString()
115
+ },
116
+ metadata: {
117
+ processingTime,
118
+ version: '1.0',
119
+ jokeCount: jokeCategory.length,
120
+ source: 'built-in-handler'
121
+ }
122
+ };
123
+ } catch (error) {
124
+ return {
125
+ success: false,
126
+ error: error instanceof Error ? error.message : String(error),
127
+ metadata: {
128
+ serviceId: 'tell-joke',
129
+ errorType: 'processing_error'
130
+ }
131
+ };
132
+ }
133
+ }
134
+ };
@@ -0,0 +1,34 @@
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
+
8
+ import { ServiceDefinition, ServiceCategory } from '../../types.js';
9
+ import { tellJokeHandler } from './handler.js';
10
+
11
+ const tellJokeService: ServiceDefinition = {
12
+ id: 'tell-joke',
13
+ name: 'Random Joke',
14
+ description: 'Get a random joke. Guaranteed to be at least mildly amusing.',
15
+ defaultPrice: 5,
16
+ category: ServiceCategory.ENTERTAINMENT,
17
+ inputSchema: {
18
+ type: 'object',
19
+ properties: {
20
+ topic: {
21
+ type: 'string',
22
+ description: 'Optional topic for the joke (e.g., "programming", "cats")'
23
+ },
24
+ style: {
25
+ type: 'string',
26
+ enum: ['dad', 'pun', 'tech', 'general'],
27
+ description: 'Style of joke to tell'
28
+ }
29
+ }
30
+ },
31
+ handler: tellJokeHandler
32
+ };
33
+
34
+ export default tellJokeService;
@@ -0,0 +1,59 @@
1
+ # Tell Joke Service
2
+
3
+ You are processing a request for the "tell-joke" service. Your job is to tell a funny, appropriate joke.
4
+
5
+ ## Service Description
6
+ Get a random joke. Guaranteed to be at least mildly amusing.
7
+
8
+ ## Input
9
+ The user has provided the following input:
10
+ ```json
11
+ {{input}}
12
+ ```
13
+
14
+ ## Instructions
15
+ Tell a joke based on the user's preferences. Consider:
16
+ - **Topic**: If the user specified a topic, try to make a joke related to that topic
17
+ - **Style**: If the user specified a style (dad, pun, tech, general), match that style
18
+ - Keep jokes clean and appropriate
19
+ - Make them actually funny!
20
+
21
+ ## Response Format
22
+ Provide your response in this format:
23
+ ```json
24
+ {
25
+ "joke": "Your joke here",
26
+ "style": "style of joke (dad, pun, tech, general)",
27
+ "topic": "topic if applicable",
28
+ "explanation": "Optional: why this joke is funny or context"
29
+ }
30
+ ```
31
+
32
+ ## Examples
33
+
34
+ For input `{"topic": "programming"}`:
35
+ ```json
36
+ {
37
+ "joke": "Why do programmers prefer dark mode? Because light attracts bugs!",
38
+ "style": "tech",
39
+ "topic": "programming"
40
+ }
41
+ ```
42
+
43
+ For input `{"style": "dad"}`:
44
+ ```json
45
+ {
46
+ "joke": "Why don't scientists trust atoms? Because they make up everything!",
47
+ "style": "dad",
48
+ "topic": "science"
49
+ }
50
+ ```
51
+
52
+ For empty input `{}`:
53
+ ```json
54
+ {
55
+ "joke": "What do you get when you cross a snowman and a vampire? Frostbite!",
56
+ "style": "general",
57
+ "topic": "random"
58
+ }
59
+ ```
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Translation service definition.
3
+ */
4
+
5
+ import { ServiceDefinition, ServiceCategory } from '../../types.js';
6
+
7
+ const translateService: ServiceDefinition = {
8
+ id: 'translate',
9
+ name: 'Translation',
10
+ description: 'Translate text between 30+ languages. Accurate, context-aware translations.',
11
+ defaultPrice: 20,
12
+ category: ServiceCategory.UTILITY,
13
+ inputSchema: {
14
+ type: 'object',
15
+ properties: {
16
+ text: { type: 'string', description: 'Text to translate' },
17
+ to: { type: 'string', description: 'Target language (e.g., "es", "french", "Japanese")' },
18
+ from: { type: 'string', description: 'Source language (auto-detected if not provided)' }
19
+ },
20
+ required: ['text', 'to']
21
+ }
22
+ };
23
+
24
+ export default translateService;
@@ -0,0 +1,23 @@
1
+ # Translation Service
2
+
3
+ You are processing a request for the "translate" service. You are an expert translator fluent in dozens of languages.
4
+
5
+ ## Input
6
+ ```json
7
+ {{input}}
8
+ ```
9
+
10
+ ## Instructions
11
+ Translate the provided text accurately while preserving meaning, tone, and context.
12
+
13
+ ## Response Format
14
+ ```json
15
+ {
16
+ "originalText": "text that was translated",
17
+ "translatedText": "the translation",
18
+ "fromLanguage": "detected or provided source language",
19
+ "toLanguage": "target language",
20
+ "confidence": "high|medium|low",
21
+ "notes": "any translation notes or context"
22
+ }
23
+ ```
@@ -0,0 +1,54 @@
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
+
8
+ import { ServiceDefinition, ServiceCategory } from '../../types.js';
9
+
10
+ const webResearchService: ServiceDefinition = {
11
+ id: 'web-research',
12
+ name: 'Web Research',
13
+ description: 'Research any topic using current web sources. Returns a synthesized summary with cited sources.',
14
+ defaultPrice: 50,
15
+ category: ServiceCategory.RESEARCH,
16
+ inputSchema: {
17
+ type: 'object',
18
+ properties: {
19
+ query: {
20
+ type: 'string',
21
+ description: 'Research query or topic'
22
+ },
23
+ depth: {
24
+ type: 'string',
25
+ enum: ['quick', 'standard', 'comprehensive'],
26
+ description: 'Research depth (default: standard)'
27
+ },
28
+ sources: {
29
+ type: 'number',
30
+ minimum: 3,
31
+ maximum: 20,
32
+ description: 'Number of sources to research (default: 5)'
33
+ },
34
+ focusAreas: {
35
+ type: 'array',
36
+ items: { type: 'string' },
37
+ description: 'Specific aspects to focus on'
38
+ },
39
+ excludeDomains: {
40
+ type: 'array',
41
+ items: { type: 'string' },
42
+ description: 'Domains to exclude from research'
43
+ },
44
+ timeframe: {
45
+ type: 'string',
46
+ enum: ['day', 'week', 'month', 'year', 'all'],
47
+ description: 'How recent the information should be'
48
+ }
49
+ },
50
+ required: ['query']
51
+ }
52
+ };
53
+
54
+ export default webResearchService;
@@ -0,0 +1,110 @@
1
+ # Web Research Service
2
+
3
+ You are processing a request for the "web-research" service. You are an expert researcher who excels at finding, analyzing, and synthesizing information from web sources.
4
+
5
+ ## Service Description
6
+ Research any topic using current web sources and return a synthesized summary with cited sources.
7
+
8
+ ## Input
9
+ The user has provided the following input:
10
+ ```json
11
+ {{input}}
12
+ ```
13
+
14
+ ## Instructions
15
+
16
+ 1. **Use web search tools** to find current, relevant information about the query
17
+ 2. **Prioritize credible sources**: academic papers, reputable news sources, official documentation, established organizations
18
+ 3. **Cross-reference information** from multiple sources to verify accuracy
19
+ 4. **Focus on recent information** if timeframe is specified
20
+ 5. **Synthesize findings** into a coherent, well-structured response
21
+ 6. **Cite all sources** with URLs and publication dates when available
22
+
23
+ ### Research Depth Levels
24
+ - **Quick**: 3-5 sources, brief overview (500-800 words)
25
+ - **Standard**: 5-8 sources, balanced analysis (800-1500 words)
26
+ - **Comprehensive**: 8+ sources, detailed analysis (1500+ words)
27
+
28
+ ### Source Quality Guidelines
29
+ - Prioritize: .edu, .gov, established news outlets, research institutions
30
+ - Use cautiously: Wikipedia (for general info, but verify with primary sources)
31
+ - Avoid: Obviously biased sources, unverified claims, outdated information
32
+
33
+ ## Response Format
34
+ ```json
35
+ {
36
+ "summary": {
37
+ "query": "user's research query",
38
+ "keyFindings": ["3-5 main findings"],
39
+ "confidence": "high|medium|low - based on source quality",
40
+ "lastUpdated": "when the most recent info was published"
41
+ },
42
+ "research": {
43
+ "introduction": "Brief overview of the topic",
44
+ "mainContent": "Detailed research findings organized by themes/aspects",
45
+ "keyInsights": ["Important insights or conclusions"],
46
+ "controversies": ["Areas of disagreement or debate if any"],
47
+ "futureImplications": ["What this means going forward"]
48
+ },
49
+ "sources": [
50
+ {
51
+ "title": "Source title",
52
+ "url": "https://...",
53
+ "domain": "example.com",
54
+ "publishDate": "2024-01-01",
55
+ "credibility": "high|medium|low",
56
+ "relevance": "high|medium|low",
57
+ "summary": "What this source contributed"
58
+ }
59
+ ],
60
+ "methodology": {
61
+ "sourcesSearched": 15,
62
+ "sourcesUsed": 8,
63
+ "searchTerms": ["terms used in research"],
64
+ "timeframe": "time period covered"
65
+ },
66
+ "limitations": [
67
+ "Any limitations or caveats about the research"
68
+ ]
69
+ }
70
+ ```
71
+
72
+ ## Example Response Structure
73
+ For query "latest developments in quantum computing 2024":
74
+
75
+ ```json
76
+ {
77
+ "summary": {
78
+ "query": "latest developments in quantum computing 2024",
79
+ "keyFindings": [
80
+ "IBM achieved 1000+ qubit processor",
81
+ "Google claims quantum advantage in error correction",
82
+ "Commercial applications emerging in finance"
83
+ ],
84
+ "confidence": "high",
85
+ "lastUpdated": "2024-01-15"
86
+ },
87
+ "research": {
88
+ "introduction": "2024 has been a breakthrough year for quantum computing...",
89
+ "mainContent": "Detailed analysis of developments...",
90
+ "keyInsights": ["Error correction is becoming practical", "Commercial viability improving"]
91
+ },
92
+ "sources": [
93
+ {
94
+ "title": "IBM Unveils 1000-Qubit Quantum Processor",
95
+ "url": "https://research.ibm.com/...",
96
+ "domain": "ibm.com",
97
+ "publishDate": "2024-01-10",
98
+ "credibility": "high",
99
+ "relevance": "high",
100
+ "summary": "Primary source for IBM's quantum achievements"
101
+ }
102
+ ]
103
+ }
104
+ ```
105
+
106
+ Remember to:
107
+ - Use actual web search to get current information
108
+ - Verify facts across multiple sources
109
+ - Clearly indicate when information is speculative or disputed
110
+ - Include publication dates for time-sensitive topics
@@ -0,0 +1,16 @@
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
+
8
+ export * from './types.js';
9
+ export * from './registry.js';
10
+ export * from './loader.js';
11
+ export * from './manager.js';
12
+
13
+ // Re-export the main instances for easy access
14
+ export { serviceRegistry } from './registry.js';
15
+ export { serviceLoader } from './loader.js';
16
+ export { serviceManager, initializeServiceSystem, getServiceManager } from './manager.js';