opc-agent 1.3.2 → 2.0.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.
Files changed (226) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +20 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +14 -0
  3. package/.github/PULL_REQUEST_TEMPLATE.md +13 -0
  4. package/.github/workflows/ci.yml +24 -0
  5. package/CHANGELOG.md +48 -63
  6. package/CONTRIBUTING.md +21 -60
  7. package/README.md +284 -348
  8. package/README.zh-CN.md +415 -415
  9. package/dist/channels/slack.js +93 -10
  10. package/dist/channels/telegram.d.ts +30 -9
  11. package/dist/channels/telegram.js +125 -33
  12. package/dist/channels/web.d.ts +10 -0
  13. package/dist/channels/web.js +33 -2
  14. package/dist/cli.js +667 -65
  15. package/dist/core/agent.d.ts +23 -0
  16. package/dist/core/agent.js +120 -3
  17. package/dist/core/runtime.d.ts +5 -0
  18. package/dist/core/runtime.js +71 -0
  19. package/dist/core/scheduler.d.ts +52 -0
  20. package/dist/core/scheduler.js +168 -0
  21. package/dist/core/subagent.d.ts +28 -0
  22. package/dist/core/subagent.js +65 -0
  23. package/dist/daemon.d.ts +3 -0
  24. package/dist/daemon.js +134 -0
  25. package/dist/deploy/hermes.js +22 -22
  26. package/dist/deploy/openclaw.js +31 -40
  27. package/dist/index.d.ts +10 -10
  28. package/dist/index.js +22 -15
  29. package/dist/providers/index.d.ts +6 -2
  30. package/dist/providers/index.js +22 -9
  31. package/dist/schema/oad.d.ts +180 -6
  32. package/dist/schema/oad.js +12 -1
  33. package/dist/skills/auto-learn.d.ts +28 -0
  34. package/dist/skills/auto-learn.js +257 -0
  35. package/dist/templates/code-reviewer.d.ts +0 -8
  36. package/dist/templates/code-reviewer.js +5 -9
  37. package/dist/templates/customer-service.d.ts +0 -8
  38. package/dist/templates/customer-service.js +2 -6
  39. package/dist/templates/data-analyst.d.ts +0 -8
  40. package/dist/templates/data-analyst.js +5 -9
  41. package/dist/templates/knowledge-base.d.ts +0 -8
  42. package/dist/templates/knowledge-base.js +2 -6
  43. package/dist/templates/sales-assistant.d.ts +0 -8
  44. package/dist/templates/sales-assistant.js +4 -8
  45. package/dist/templates/teacher.d.ts +0 -8
  46. package/dist/templates/teacher.js +6 -10
  47. package/dist/tools/builtin/datetime.d.ts +3 -0
  48. package/dist/tools/builtin/datetime.js +44 -0
  49. package/dist/tools/builtin/file.d.ts +3 -0
  50. package/dist/tools/builtin/file.js +151 -0
  51. package/dist/tools/builtin/index.d.ts +15 -0
  52. package/dist/tools/builtin/index.js +30 -0
  53. package/dist/tools/builtin/shell.d.ts +3 -0
  54. package/dist/tools/builtin/shell.js +43 -0
  55. package/dist/tools/builtin/web.d.ts +3 -0
  56. package/dist/tools/builtin/web.js +37 -0
  57. package/dist/tools/mcp-client.d.ts +24 -0
  58. package/dist/tools/mcp-client.js +119 -0
  59. package/dist/traces/index.d.ts +49 -0
  60. package/dist/traces/index.js +102 -0
  61. package/docs/.vitepress/config.ts +103 -103
  62. package/docs/api/cli.md +48 -48
  63. package/docs/api/oad-schema.md +64 -64
  64. package/docs/api/sdk.md +80 -80
  65. package/docs/guide/concepts.md +51 -51
  66. package/docs/guide/configuration.md +79 -79
  67. package/docs/guide/deployment.md +42 -42
  68. package/docs/guide/getting-started.md +44 -44
  69. package/docs/guide/templates.md +28 -28
  70. package/docs/guide/testing.md +84 -84
  71. package/docs/index.md +27 -27
  72. package/docs/zh/api/cli.md +54 -54
  73. package/docs/zh/api/oad-schema.md +87 -87
  74. package/docs/zh/api/sdk.md +102 -102
  75. package/docs/zh/guide/concepts.md +104 -104
  76. package/docs/zh/guide/configuration.md +135 -135
  77. package/docs/zh/guide/deployment.md +81 -81
  78. package/docs/zh/guide/getting-started.md +82 -82
  79. package/docs/zh/guide/templates.md +84 -84
  80. package/docs/zh/guide/testing.md +88 -88
  81. package/docs/zh/index.md +27 -27
  82. package/examples/README.md +22 -0
  83. package/examples/basic-agent.ts +90 -0
  84. package/examples/brain-integration.ts +71 -0
  85. package/examples/customer-service-demo/README.md +90 -90
  86. package/examples/customer-service-demo/oad.yaml +107 -107
  87. package/examples/multi-channel.ts +74 -0
  88. package/package.json +1 -1
  89. package/src/analytics/index.ts +66 -66
  90. package/src/channels/discord.ts +192 -192
  91. package/src/channels/email.ts +177 -177
  92. package/src/channels/feishu.ts +236 -236
  93. package/src/channels/index.ts +15 -15
  94. package/src/channels/slack.ts +217 -160
  95. package/src/channels/telegram.ts +155 -33
  96. package/src/channels/voice.ts +106 -106
  97. package/src/channels/web.ts +38 -2
  98. package/src/channels/webhook.ts +199 -199
  99. package/src/channels/websocket.ts +87 -87
  100. package/src/channels/wechat.ts +149 -149
  101. package/src/cli.ts +697 -63
  102. package/src/core/a2a.ts +143 -143
  103. package/src/core/agent.ts +146 -3
  104. package/src/core/analytics-engine.ts +186 -186
  105. package/src/core/auth.ts +57 -57
  106. package/src/core/cache.ts +141 -141
  107. package/src/core/compose.ts +77 -77
  108. package/src/core/config.ts +14 -14
  109. package/src/core/errors.ts +148 -148
  110. package/src/core/hitl.ts +138 -138
  111. package/src/core/logger.ts +57 -57
  112. package/src/core/orchestrator.ts +215 -215
  113. package/src/core/performance.ts +187 -187
  114. package/src/core/rate-limiter.ts +128 -128
  115. package/src/core/room.ts +109 -109
  116. package/src/core/runtime.ts +230 -152
  117. package/src/core/sandbox.ts +101 -101
  118. package/src/core/scheduler.ts +187 -0
  119. package/src/core/security.ts +171 -171
  120. package/src/core/subagent.ts +98 -0
  121. package/src/core/types.ts +68 -68
  122. package/src/core/versioning.ts +106 -106
  123. package/src/core/watch.ts +178 -178
  124. package/src/core/workflow.ts +235 -235
  125. package/src/daemon.ts +96 -0
  126. package/src/deploy/hermes.ts +156 -156
  127. package/src/deploy/openclaw.ts +190 -200
  128. package/src/i18n/index.ts +216 -216
  129. package/src/index.ts +14 -10
  130. package/src/memory/deepbrain.ts +108 -108
  131. package/src/memory/index.ts +34 -34
  132. package/src/plugins/index.ts +208 -208
  133. package/src/providers/index.ts +354 -331
  134. package/src/schema/oad.ts +14 -2
  135. package/src/skills/auto-learn.ts +262 -0
  136. package/src/skills/base.ts +16 -16
  137. package/src/skills/document.ts +100 -100
  138. package/src/skills/http.ts +35 -35
  139. package/src/skills/index.ts +27 -27
  140. package/src/skills/scheduler.ts +80 -80
  141. package/src/skills/webhook-trigger.ts +59 -59
  142. package/src/templates/code-reviewer.ts +30 -34
  143. package/src/templates/customer-service.ts +76 -80
  144. package/src/templates/data-analyst.ts +66 -70
  145. package/src/templates/executive-assistant.ts +71 -71
  146. package/src/templates/financial-advisor.ts +60 -60
  147. package/src/templates/knowledge-base.ts +27 -31
  148. package/src/templates/legal-assistant.ts +71 -71
  149. package/src/templates/sales-assistant.ts +75 -79
  150. package/src/templates/teacher.ts +75 -79
  151. package/src/testing/index.ts +181 -181
  152. package/src/tools/builtin/datetime.ts +41 -0
  153. package/src/tools/builtin/file.ts +107 -0
  154. package/src/tools/builtin/index.ts +28 -0
  155. package/src/tools/builtin/shell.ts +43 -0
  156. package/src/tools/builtin/web.ts +35 -0
  157. package/src/tools/calculator.ts +73 -73
  158. package/src/tools/datetime.ts +149 -149
  159. package/src/tools/json-transform.ts +187 -187
  160. package/src/tools/mcp-client.ts +131 -0
  161. package/src/tools/mcp.ts +76 -76
  162. package/src/tools/text-analysis.ts +116 -116
  163. package/src/traces/index.ts +132 -0
  164. package/templates/Dockerfile +15 -15
  165. package/templates/code-reviewer/README.md +27 -27
  166. package/templates/code-reviewer/oad.yaml +41 -41
  167. package/templates/customer-service/README.md +22 -22
  168. package/templates/customer-service/oad.yaml +36 -36
  169. package/templates/docker-compose.yml +21 -21
  170. package/templates/ecommerce-assistant/README.md +45 -45
  171. package/templates/ecommerce-assistant/oad.yaml +47 -47
  172. package/templates/knowledge-base/README.md +28 -28
  173. package/templates/knowledge-base/oad.yaml +38 -38
  174. package/templates/sales-assistant/README.md +26 -26
  175. package/templates/sales-assistant/oad.yaml +43 -43
  176. package/templates/tech-support/README.md +43 -43
  177. package/templates/tech-support/oad.yaml +45 -45
  178. package/test-agent/Dockerfile +9 -0
  179. package/test-agent/README.md +50 -0
  180. package/test-agent/agent.yaml +23 -0
  181. package/test-agent/docker-compose.yml +11 -0
  182. package/test-agent/oad.yaml +31 -0
  183. package/test-agent/package-lock.json +1492 -0
  184. package/test-agent/package.json +18 -0
  185. package/test-agent/src/index.ts +24 -0
  186. package/test-agent/src/skills/echo.ts +15 -0
  187. package/test-agent/tsconfig.json +25 -0
  188. package/tests/a2a.test.ts +66 -66
  189. package/tests/agent.test.ts +72 -72
  190. package/tests/analytics.test.ts +50 -50
  191. package/tests/auto-learn.test.ts +105 -0
  192. package/tests/builtin-tools.test.ts +83 -0
  193. package/tests/channel.test.ts +39 -39
  194. package/tests/cli.test.ts +46 -0
  195. package/tests/e2e.test.ts +134 -134
  196. package/tests/errors.test.ts +83 -83
  197. package/tests/hitl.test.ts +71 -71
  198. package/tests/i18n.test.ts +41 -41
  199. package/tests/mcp.test.ts +54 -54
  200. package/tests/oad.test.ts +68 -68
  201. package/tests/performance.test.ts +115 -115
  202. package/tests/plugin.test.ts +74 -74
  203. package/tests/room.test.ts +106 -106
  204. package/tests/runtime.test.ts +42 -42
  205. package/tests/sandbox.test.ts +46 -46
  206. package/tests/security.test.ts +60 -60
  207. package/tests/subagent.test.ts +130 -0
  208. package/tests/telegram-discord.test.ts +60 -0
  209. package/tests/templates.test.ts +77 -77
  210. package/tests/v070.test.ts +76 -76
  211. package/tests/versioning.test.ts +75 -75
  212. package/tests/voice.test.ts +61 -61
  213. package/tests/webhook.test.ts +29 -29
  214. package/tests/workflow.test.ts +143 -143
  215. package/tsconfig.json +19 -19
  216. package/vitest.config.ts +9 -9
  217. package/dist/core/dashboard.d.ts +0 -35
  218. package/dist/core/dashboard.js +0 -157
  219. package/dist/core/priority.d.ts +0 -52
  220. package/dist/core/priority.js +0 -102
  221. package/src/core/dashboard.ts +0 -219
  222. package/src/core/priority.ts +0 -140
  223. package/src/dtv/data.ts +0 -29
  224. package/src/dtv/trust.ts +0 -43
  225. package/src/dtv/value.ts +0 -47
  226. package/src/marketplace/index.ts +0 -223
@@ -286,6 +286,57 @@ export declare const StreamingSchema: z.ZodObject<{
286
286
  enabled?: boolean | undefined;
287
287
  chunkSize?: number | undefined;
288
288
  }>;
289
+ export declare const MCPServerSchema: z.ZodObject<{
290
+ name: z.ZodString;
291
+ command: z.ZodString;
292
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
293
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
294
+ }, "strip", z.ZodTypeAny, {
295
+ name: string;
296
+ command: string;
297
+ args?: string[] | undefined;
298
+ env?: Record<string, string> | undefined;
299
+ }, {
300
+ name: string;
301
+ command: string;
302
+ args?: string[] | undefined;
303
+ env?: Record<string, string> | undefined;
304
+ }>;
305
+ export declare const ToolsSchema: z.ZodObject<{
306
+ builtin: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
307
+ mcp: z.ZodOptional<z.ZodArray<z.ZodObject<{
308
+ name: z.ZodString;
309
+ command: z.ZodString;
310
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
311
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
312
+ }, "strip", z.ZodTypeAny, {
313
+ name: string;
314
+ command: string;
315
+ args?: string[] | undefined;
316
+ env?: Record<string, string> | undefined;
317
+ }, {
318
+ name: string;
319
+ command: string;
320
+ args?: string[] | undefined;
321
+ env?: Record<string, string> | undefined;
322
+ }>, "many">>;
323
+ }, "strip", z.ZodTypeAny, {
324
+ builtin?: string[] | undefined;
325
+ mcp?: {
326
+ name: string;
327
+ command: string;
328
+ args?: string[] | undefined;
329
+ env?: Record<string, string> | undefined;
330
+ }[] | undefined;
331
+ }, {
332
+ builtin?: string[] | undefined;
333
+ mcp?: {
334
+ name: string;
335
+ command: string;
336
+ args?: string[] | undefined;
337
+ env?: Record<string, string> | undefined;
338
+ }[] | undefined;
339
+ }>;
289
340
  export declare const SpecSchema: z.ZodObject<{
290
341
  provider: z.ZodOptional<z.ZodObject<{
291
342
  default: z.ZodDefault<z.ZodString>;
@@ -358,6 +409,41 @@ export declare const SpecSchema: z.ZodObject<{
358
409
  collection?: string | undefined;
359
410
  } | undefined;
360
411
  }>>;
412
+ tools: z.ZodOptional<z.ZodObject<{
413
+ builtin: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
414
+ mcp: z.ZodOptional<z.ZodArray<z.ZodObject<{
415
+ name: z.ZodString;
416
+ command: z.ZodString;
417
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
418
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
419
+ }, "strip", z.ZodTypeAny, {
420
+ name: string;
421
+ command: string;
422
+ args?: string[] | undefined;
423
+ env?: Record<string, string> | undefined;
424
+ }, {
425
+ name: string;
426
+ command: string;
427
+ args?: string[] | undefined;
428
+ env?: Record<string, string> | undefined;
429
+ }>, "many">>;
430
+ }, "strip", z.ZodTypeAny, {
431
+ builtin?: string[] | undefined;
432
+ mcp?: {
433
+ name: string;
434
+ command: string;
435
+ args?: string[] | undefined;
436
+ env?: Record<string, string> | undefined;
437
+ }[] | undefined;
438
+ }, {
439
+ builtin?: string[] | undefined;
440
+ mcp?: {
441
+ name: string;
442
+ command: string;
443
+ args?: string[] | undefined;
444
+ env?: Record<string, string> | undefined;
445
+ }[] | undefined;
446
+ }>>;
361
447
  dtv: z.ZodOptional<z.ZodObject<{
362
448
  trust: z.ZodOptional<z.ZodObject<{
363
449
  level: z.ZodDefault<z.ZodEnum<["sandbox", "verified", "certified", "listed"]>>;
@@ -515,6 +601,15 @@ export declare const SpecSchema: z.ZodObject<{
515
601
  enabled: boolean;
516
602
  chunkSize?: number | undefined;
517
603
  };
604
+ tools?: {
605
+ builtin?: string[] | undefined;
606
+ mcp?: {
607
+ name: string;
608
+ command: string;
609
+ args?: string[] | undefined;
610
+ env?: Record<string, string> | undefined;
611
+ }[] | undefined;
612
+ } | undefined;
518
613
  auth?: {
519
614
  enabled: boolean;
520
615
  apiKeys: string[];
@@ -577,6 +672,15 @@ export declare const SpecSchema: z.ZodObject<{
577
672
  config?: Record<string, unknown> | undefined;
578
673
  }[] | undefined;
579
674
  }, {
675
+ tools?: {
676
+ builtin?: string[] | undefined;
677
+ mcp?: {
678
+ name: string;
679
+ command: string;
680
+ args?: string[] | undefined;
681
+ env?: Record<string, string> | undefined;
682
+ }[] | undefined;
683
+ } | undefined;
580
684
  model?: string | undefined;
581
685
  auth?: {
582
686
  enabled?: boolean | undefined;
@@ -776,6 +880,41 @@ export declare const OADSchema: z.ZodObject<{
776
880
  collection?: string | undefined;
777
881
  } | undefined;
778
882
  }>>;
883
+ tools: z.ZodOptional<z.ZodObject<{
884
+ builtin: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
885
+ mcp: z.ZodOptional<z.ZodArray<z.ZodObject<{
886
+ name: z.ZodString;
887
+ command: z.ZodString;
888
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
889
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
890
+ }, "strip", z.ZodTypeAny, {
891
+ name: string;
892
+ command: string;
893
+ args?: string[] | undefined;
894
+ env?: Record<string, string> | undefined;
895
+ }, {
896
+ name: string;
897
+ command: string;
898
+ args?: string[] | undefined;
899
+ env?: Record<string, string> | undefined;
900
+ }>, "many">>;
901
+ }, "strip", z.ZodTypeAny, {
902
+ builtin?: string[] | undefined;
903
+ mcp?: {
904
+ name: string;
905
+ command: string;
906
+ args?: string[] | undefined;
907
+ env?: Record<string, string> | undefined;
908
+ }[] | undefined;
909
+ }, {
910
+ builtin?: string[] | undefined;
911
+ mcp?: {
912
+ name: string;
913
+ command: string;
914
+ args?: string[] | undefined;
915
+ env?: Record<string, string> | undefined;
916
+ }[] | undefined;
917
+ }>>;
779
918
  dtv: z.ZodOptional<z.ZodObject<{
780
919
  trust: z.ZodOptional<z.ZodObject<{
781
920
  level: z.ZodDefault<z.ZodEnum<["sandbox", "verified", "certified", "listed"]>>;
@@ -933,6 +1072,15 @@ export declare const OADSchema: z.ZodObject<{
933
1072
  enabled: boolean;
934
1073
  chunkSize?: number | undefined;
935
1074
  };
1075
+ tools?: {
1076
+ builtin?: string[] | undefined;
1077
+ mcp?: {
1078
+ name: string;
1079
+ command: string;
1080
+ args?: string[] | undefined;
1081
+ env?: Record<string, string> | undefined;
1082
+ }[] | undefined;
1083
+ } | undefined;
936
1084
  auth?: {
937
1085
  enabled: boolean;
938
1086
  apiKeys: string[];
@@ -995,6 +1143,15 @@ export declare const OADSchema: z.ZodObject<{
995
1143
  config?: Record<string, unknown> | undefined;
996
1144
  }[] | undefined;
997
1145
  }, {
1146
+ tools?: {
1147
+ builtin?: string[] | undefined;
1148
+ mcp?: {
1149
+ name: string;
1150
+ command: string;
1151
+ args?: string[] | undefined;
1152
+ env?: Record<string, string> | undefined;
1153
+ }[] | undefined;
1154
+ } | undefined;
998
1155
  model?: string | undefined;
999
1156
  auth?: {
1000
1157
  enabled?: boolean | undefined;
@@ -1073,8 +1230,6 @@ export declare const OADSchema: z.ZodObject<{
1073
1230
  }[] | undefined;
1074
1231
  }>;
1075
1232
  }, "strip", z.ZodTypeAny, {
1076
- apiVersion: "opc/v1";
1077
- kind: "Agent";
1078
1233
  metadata: {
1079
1234
  name: string;
1080
1235
  version: string;
@@ -1088,6 +1243,8 @@ export declare const OADSchema: z.ZodObject<{
1088
1243
  tags?: string[] | undefined;
1089
1244
  } | undefined;
1090
1245
  };
1246
+ apiVersion: "opc/v1";
1247
+ kind: "Agent";
1091
1248
  spec: {
1092
1249
  model: string;
1093
1250
  skills: {
@@ -1104,6 +1261,15 @@ export declare const OADSchema: z.ZodObject<{
1104
1261
  enabled: boolean;
1105
1262
  chunkSize?: number | undefined;
1106
1263
  };
1264
+ tools?: {
1265
+ builtin?: string[] | undefined;
1266
+ mcp?: {
1267
+ name: string;
1268
+ command: string;
1269
+ args?: string[] | undefined;
1270
+ env?: Record<string, string> | undefined;
1271
+ }[] | undefined;
1272
+ } | undefined;
1107
1273
  auth?: {
1108
1274
  enabled: boolean;
1109
1275
  apiKeys: string[];
@@ -1167,8 +1333,6 @@ export declare const OADSchema: z.ZodObject<{
1167
1333
  }[] | undefined;
1168
1334
  };
1169
1335
  }, {
1170
- apiVersion: "opc/v1";
1171
- kind: "Agent";
1172
1336
  metadata: {
1173
1337
  name: string;
1174
1338
  description?: string | undefined;
@@ -1182,7 +1346,18 @@ export declare const OADSchema: z.ZodObject<{
1182
1346
  tags?: string[] | undefined;
1183
1347
  } | undefined;
1184
1348
  };
1349
+ apiVersion: "opc/v1";
1350
+ kind: "Agent";
1185
1351
  spec: {
1352
+ tools?: {
1353
+ builtin?: string[] | undefined;
1354
+ mcp?: {
1355
+ name: string;
1356
+ command: string;
1357
+ args?: string[] | undefined;
1358
+ env?: Record<string, string> | undefined;
1359
+ }[] | undefined;
1360
+ } | undefined;
1186
1361
  model?: string | undefined;
1187
1362
  auth?: {
1188
1363
  enabled?: boolean | undefined;
@@ -1266,6 +1441,5 @@ export type SkillRef = z.infer<typeof SkillRefSchema>;
1266
1441
  export type Channel = z.infer<typeof ChannelSchema>;
1267
1442
  export type Metadata = z.infer<typeof MetadataSchema>;
1268
1443
  export type Spec = z.infer<typeof SpecSchema>;
1269
- export type DTVConfig = z.infer<typeof DTVSchema>;
1270
- export type TrustLevelType = z.infer<typeof TrustLevel>;
1444
+ export type TrustLevelType = string;
1271
1445
  //# sourceMappingURL=oad.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OADSchema = exports.SpecSchema = exports.StreamingSchema = exports.RoomSchema = exports.MetadataSchema = exports.MarketplaceSchema = exports.ProviderSchema = exports.DTVSchema = exports.TrustLevel = exports.MemorySchema = exports.LongTermMemorySchema = exports.ChannelSchema = exports.AuthSchema = exports.PluginRefSchema = exports.HITLSchema = exports.WebhookSchema = exports.VoiceSchema = exports.WorkflowSchema = exports.WorkflowStepSchema = exports.SkillRefSchema = void 0;
3
+ exports.OADSchema = exports.SpecSchema = exports.ToolsSchema = exports.MCPServerSchema = exports.StreamingSchema = exports.RoomSchema = exports.MetadataSchema = exports.MarketplaceSchema = exports.ProviderSchema = exports.DTVSchema = exports.TrustLevel = exports.MemorySchema = exports.LongTermMemorySchema = exports.ChannelSchema = exports.AuthSchema = exports.PluginRefSchema = exports.HITLSchema = exports.WebhookSchema = exports.VoiceSchema = exports.WorkflowSchema = exports.WorkflowStepSchema = exports.SkillRefSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  // ─── OAD Schema v1 ───────────────────────────────────────────
6
6
  exports.SkillRefSchema = zod_1.z.object({
@@ -103,6 +103,16 @@ exports.StreamingSchema = zod_1.z.object({
103
103
  enabled: zod_1.z.boolean().default(false),
104
104
  chunkSize: zod_1.z.number().optional(),
105
105
  });
106
+ exports.MCPServerSchema = zod_1.z.object({
107
+ name: zod_1.z.string(),
108
+ command: zod_1.z.string(),
109
+ args: zod_1.z.array(zod_1.z.string()).optional(),
110
+ env: zod_1.z.record(zod_1.z.string()).optional(),
111
+ });
112
+ exports.ToolsSchema = zod_1.z.object({
113
+ builtin: zod_1.z.array(zod_1.z.string()).optional(),
114
+ mcp: zod_1.z.array(exports.MCPServerSchema).optional(),
115
+ });
106
116
  exports.SpecSchema = zod_1.z.object({
107
117
  provider: exports.ProviderSchema.optional(),
108
118
  model: zod_1.z.string().default('deepseek-chat'),
@@ -110,6 +120,7 @@ exports.SpecSchema = zod_1.z.object({
110
120
  skills: zod_1.z.array(exports.SkillRefSchema).default([]),
111
121
  channels: zod_1.z.array(exports.ChannelSchema).default([]),
112
122
  memory: exports.MemorySchema.optional(),
123
+ tools: exports.ToolsSchema.optional(),
113
124
  dtv: exports.DTVSchema.optional(),
114
125
  room: exports.RoomSchema.optional(),
115
126
  streaming: zod_1.z.union([zod_1.z.boolean(), exports.StreamingSchema]).default(false),
@@ -0,0 +1,28 @@
1
+ import type { Message } from '../core/types';
2
+ import type { LLMProvider } from '../providers';
3
+ export interface LearnedSkill {
4
+ name: string;
5
+ description: string;
6
+ trigger: string;
7
+ instructions: string;
8
+ examples: string[];
9
+ createdAt: Date;
10
+ usageCount: number;
11
+ lastUsed?: Date;
12
+ version: number;
13
+ }
14
+ export declare class SkillLearner {
15
+ private skillsDir;
16
+ private skills;
17
+ private loaded;
18
+ constructor(skillsDir: string);
19
+ analyzeForSkillCreation(conversation: Message[], provider: LLMProvider): Promise<LearnedSkill | null>;
20
+ saveSkill(skill: LearnedSkill): Promise<void>;
21
+ loadLearnedSkills(): Promise<LearnedSkill[]>;
22
+ matchSkill(message: string): LearnedSkill | null;
23
+ improveSkill(skill: LearnedSkill, conversation: Message[], provider: LLMProvider): Promise<void>;
24
+ getSkills(): LearnedSkill[];
25
+ }
26
+ export declare function skillToMarkdown(skill: LearnedSkill): string;
27
+ export declare function parseSkillMarkdown(content: string): LearnedSkill | null;
28
+ //# sourceMappingURL=auto-learn.d.ts.map
@@ -0,0 +1,257 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.SkillLearner = void 0;
37
+ exports.skillToMarkdown = skillToMarkdown;
38
+ exports.parseSkillMarkdown = parseSkillMarkdown;
39
+ const fs = __importStar(require("fs"));
40
+ const path = __importStar(require("path"));
41
+ const SKILL_EXTRACTION_PROMPT = `Analyze this conversation and determine if it represents a repeatable task that should be saved as a reusable skill.
42
+
43
+ Criteria for creating a skill:
44
+ 1. The task is specific and well-defined
45
+ 2. It could reasonably happen again
46
+ 3. The solution has clear steps
47
+
48
+ If yes, extract:
49
+ - name: short kebab-case name
50
+ - description: one-line description
51
+ - trigger: regex pattern or keywords that would identify this task
52
+ - instructions: step-by-step instructions to complete the task
53
+ - examples: 2-3 example user inputs that would trigger this skill
54
+
55
+ If this is just casual chat or a one-off question, return null.
56
+
57
+ Respond in JSON format only: { "shouldCreate": boolean, "skill": { "name": string, "description": string, "trigger": string, "instructions": string, "examples": string[] } | null }
58
+
59
+ Conversation:
60
+ `;
61
+ const SKILL_IMPROVEMENT_PROMPT = `This skill was just used. Based on the outcome, suggest improvements:
62
+
63
+ Current skill:
64
+ `;
65
+ const SKILL_IMPROVEMENT_SUFFIX = `
66
+
67
+ Respond in JSON only: { "shouldImprove": boolean, "improvements": { "instructions"?: string, "trigger"?: string, "examples"?: string[] } | null }`;
68
+ class SkillLearner {
69
+ skillsDir;
70
+ skills = [];
71
+ loaded = false;
72
+ constructor(skillsDir) {
73
+ this.skillsDir = skillsDir;
74
+ }
75
+ async analyzeForSkillCreation(conversation, provider) {
76
+ const conversationText = conversation
77
+ .map((m) => `${m.role}: ${m.content}`)
78
+ .join('\n');
79
+ const prompt = SKILL_EXTRACTION_PROMPT + conversationText;
80
+ try {
81
+ const response = await provider.chat([{ id: 'analysis', role: 'user', content: prompt, timestamp: Date.now() }], 'You are a skill extraction assistant. Respond only with valid JSON.');
82
+ const json = extractJson(response);
83
+ if (!json || !json.shouldCreate || !json.skill)
84
+ return null;
85
+ const skill = {
86
+ name: json.skill.name,
87
+ description: json.skill.description,
88
+ trigger: json.skill.trigger,
89
+ instructions: json.skill.instructions,
90
+ examples: json.skill.examples || [],
91
+ createdAt: new Date(),
92
+ usageCount: 0,
93
+ version: 1,
94
+ };
95
+ return skill;
96
+ }
97
+ catch {
98
+ return null;
99
+ }
100
+ }
101
+ async saveSkill(skill) {
102
+ fs.mkdirSync(this.skillsDir, { recursive: true });
103
+ const filePath = path.join(this.skillsDir, `${skill.name}.md`);
104
+ fs.writeFileSync(filePath, skillToMarkdown(skill), 'utf-8');
105
+ // Update cache
106
+ const idx = this.skills.findIndex((s) => s.name === skill.name);
107
+ if (idx >= 0) {
108
+ this.skills[idx] = skill;
109
+ }
110
+ else {
111
+ this.skills.push(skill);
112
+ }
113
+ }
114
+ async loadLearnedSkills() {
115
+ if (!fs.existsSync(this.skillsDir))
116
+ return [];
117
+ const files = fs.readdirSync(this.skillsDir).filter((f) => f.endsWith('.md'));
118
+ this.skills = files
119
+ .map((f) => {
120
+ try {
121
+ const content = fs.readFileSync(path.join(this.skillsDir, f), 'utf-8');
122
+ return parseSkillMarkdown(content);
123
+ }
124
+ catch {
125
+ return null;
126
+ }
127
+ })
128
+ .filter((s) => s !== null);
129
+ this.loaded = true;
130
+ return this.skills;
131
+ }
132
+ matchSkill(message) {
133
+ if (!this.loaded)
134
+ return null;
135
+ for (const skill of this.skills) {
136
+ try {
137
+ const regex = new RegExp(skill.trigger, 'i');
138
+ if (regex.test(message))
139
+ return skill;
140
+ }
141
+ catch {
142
+ // Fallback: keyword matching — split on common separators, strip non-word chars
143
+ const keywords = skill.trigger.split(/[\s,;|]+/).map(k => k.replace(/[^\w-]/g, '').toLowerCase()).filter(k => k.length > 2);
144
+ const lower = message.toLowerCase();
145
+ if (keywords.some((kw) => lower.includes(kw)))
146
+ return skill;
147
+ }
148
+ }
149
+ return null;
150
+ }
151
+ async improveSkill(skill, conversation, provider) {
152
+ const conversationText = conversation
153
+ .map((m) => `${m.role}: ${m.content}`)
154
+ .join('\n');
155
+ const prompt = SKILL_IMPROVEMENT_PROMPT +
156
+ skillToMarkdown(skill) +
157
+ '\n\nConversation where it was used:\n' +
158
+ conversationText +
159
+ SKILL_IMPROVEMENT_SUFFIX;
160
+ try {
161
+ const response = await provider.chat([{ id: 'improve', role: 'user', content: prompt, timestamp: Date.now() }], 'You are a skill improvement assistant. Respond only with valid JSON.');
162
+ const json = extractJson(response);
163
+ if (!json || !json.shouldImprove || !json.improvements)
164
+ return;
165
+ const { improvements } = json;
166
+ if (improvements.instructions)
167
+ skill.instructions = improvements.instructions;
168
+ if (improvements.trigger)
169
+ skill.trigger = improvements.trigger;
170
+ if (improvements.examples)
171
+ skill.examples = [...skill.examples, ...improvements.examples];
172
+ skill.version++;
173
+ await this.saveSkill(skill);
174
+ }
175
+ catch {
176
+ // Silently fail — improvement is best-effort
177
+ }
178
+ }
179
+ getSkills() {
180
+ return [...this.skills];
181
+ }
182
+ }
183
+ exports.SkillLearner = SkillLearner;
184
+ // ─── Helpers ────────────────────────────────────────────────
185
+ function extractJson(text) {
186
+ // Try to extract JSON from response (may be wrapped in markdown code block)
187
+ const match = text.match(/\{[\s\S]*\}/);
188
+ if (!match)
189
+ return null;
190
+ try {
191
+ return JSON.parse(match[0]);
192
+ }
193
+ catch {
194
+ return null;
195
+ }
196
+ }
197
+ function skillToMarkdown(skill) {
198
+ const lines = [
199
+ `# Skill: ${skill.name}`,
200
+ '',
201
+ '## Description',
202
+ skill.description,
203
+ '',
204
+ '## Trigger',
205
+ `Pattern: ${skill.trigger}`,
206
+ '',
207
+ '## Instructions',
208
+ skill.instructions,
209
+ '',
210
+ '## Examples',
211
+ ...skill.examples.map((e) => `- "${e}"`),
212
+ '',
213
+ '## Metadata',
214
+ `- Created: ${skill.createdAt.toISOString()}`,
215
+ `- Version: ${skill.version}`,
216
+ `- Usage Count: ${skill.usageCount}`,
217
+ `- Last Used: ${skill.lastUsed?.toISOString() ?? 'never'}`,
218
+ '',
219
+ ];
220
+ return lines.join('\n');
221
+ }
222
+ function parseSkillMarkdown(content) {
223
+ const nameMatch = content.match(/^# Skill:\s*(.+)$/m);
224
+ if (!nameMatch)
225
+ return null;
226
+ const section = (heading) => {
227
+ const re = new RegExp(`## ${heading}\\s*\\n([\\s\\S]*?)(?=\\n## |$)`);
228
+ const m = content.match(re);
229
+ return m ? m[1].trim() : '';
230
+ };
231
+ const description = section('Description');
232
+ const triggerLine = section('Trigger');
233
+ const trigger = triggerLine.replace(/^Pattern:\s*/i, '').trim();
234
+ const instructions = section('Instructions');
235
+ const examplesRaw = section('Examples');
236
+ const examples = examplesRaw
237
+ .split('\n')
238
+ .map((l) => l.replace(/^-\s*"?|"?\s*$/g, '').trim())
239
+ .filter(Boolean);
240
+ const metadata = section('Metadata');
241
+ const getMeta = (key) => {
242
+ const m = metadata.match(new RegExp(`- ${key}:\\s*(.+)`, 'i'));
243
+ return m ? m[1].trim() : '';
244
+ };
245
+ return {
246
+ name: nameMatch[1].trim(),
247
+ description,
248
+ trigger,
249
+ instructions,
250
+ examples,
251
+ createdAt: new Date(getMeta('Created') || Date.now()),
252
+ version: parseInt(getMeta('Version') || '1', 10),
253
+ usageCount: parseInt(getMeta('Usage Count') || '0', 10),
254
+ lastUsed: getMeta('Last Used') !== 'never' ? new Date(getMeta('Last Used')) : undefined,
255
+ };
256
+ }
257
+ //# sourceMappingURL=auto-learn.js.map
@@ -28,14 +28,6 @@ export declare function createCodeReviewerConfig(): {
28
28
  shortTerm: boolean;
29
29
  longTerm: boolean;
30
30
  };
31
- dtv: {
32
- trust: {
33
- level: "sandbox";
34
- };
35
- value: {
36
- metrics: string[];
37
- };
38
- };
39
31
  };
40
32
  };
41
33
  //# sourceMappingURL=code-reviewer.d.ts.map
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CODE_REVIEWER_SYSTEM_PROMPT = void 0;
4
4
  exports.createCodeReviewerConfig = createCodeReviewerConfig;
5
- exports.CODE_REVIEWER_SYSTEM_PROMPT = `You are an expert code reviewer. When given code:
6
- 1. Check for bugs, security issues, and performance problems
7
- 2. Suggest improvements for readability and maintainability
8
- 3. Follow language-specific best practices
9
- 4. Be constructive and explain your reasoning
5
+ exports.CODE_REVIEWER_SYSTEM_PROMPT = `You are an expert code reviewer. When given code:
6
+ 1. Check for bugs, security issues, and performance problems
7
+ 2. Suggest improvements for readability and maintainability
8
+ 3. Follow language-specific best practices
9
+ 4. Be constructive and explain your reasoning
10
10
  Rate severity: 🔴 Critical | 🟡 Warning | 🔵 Info`;
11
11
  function createCodeReviewerConfig() {
12
12
  return {
@@ -28,10 +28,6 @@ function createCodeReviewerConfig() {
28
28
  ],
29
29
  channels: [{ type: 'web', port: 3000 }],
30
30
  memory: { shortTerm: true, longTerm: false },
31
- dtv: {
32
- trust: { level: 'sandbox' },
33
- value: { metrics: ['reviews_completed', 'issues_found'] },
34
- },
35
31
  },
36
32
  };
37
33
  }
@@ -43,14 +43,6 @@ export declare function createCustomerServiceConfig(): {
43
43
  shortTerm: boolean;
44
44
  longTerm: boolean;
45
45
  };
46
- dtv: {
47
- trust: {
48
- level: "sandbox";
49
- };
50
- value: {
51
- metrics: string[];
52
- };
53
- };
54
46
  };
55
47
  };
56
48
  //# sourceMappingURL=customer-service.d.ts.map
@@ -41,8 +41,8 @@ class HandoffSkill extends base_1.BaseSkill {
41
41
  }
42
42
  }
43
43
  exports.HandoffSkill = HandoffSkill;
44
- exports.CUSTOMER_SERVICE_SYSTEM_PROMPT = `You are a friendly and professional customer service agent.
45
- You help customers with their questions about products, orders, shipping, and returns.
44
+ exports.CUSTOMER_SERVICE_SYSTEM_PROMPT = `You are a friendly and professional customer service agent.
45
+ You help customers with their questions about products, orders, shipping, and returns.
46
46
  Be concise, helpful, and empathetic. If you're unsure, offer to connect them with a human agent.`;
47
47
  function createCustomerServiceConfig() {
48
48
  return {
@@ -65,10 +65,6 @@ function createCustomerServiceConfig() {
65
65
  ],
66
66
  channels: [{ type: 'web', port: 3000 }],
67
67
  memory: { shortTerm: true, longTerm: false },
68
- dtv: {
69
- trust: { level: 'sandbox' },
70
- value: { metrics: ['response_time', 'satisfaction_score'] },
71
- },
72
68
  },
73
69
  };
74
70
  }
@@ -40,14 +40,6 @@ export declare function createDataAnalystConfig(): {
40
40
  shortTerm: boolean;
41
41
  longTerm: boolean;
42
42
  };
43
- dtv: {
44
- trust: {
45
- level: "sandbox";
46
- };
47
- value: {
48
- metrics: string[];
49
- };
50
- };
51
43
  };
52
44
  };
53
45
  //# sourceMappingURL=data-analyst.d.ts.map