@teneo-protocol/sdk 2.0.0 ā 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +11 -2
- package/.github/CODEOWNERS +2 -0
- package/.github/ISSUE_TEMPLATE/01-bug.yml +85 -0
- package/.github/ISSUE_TEMPLATE/config.yml +8 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +22 -0
- package/.github/workflows/claude-code-review.yml +8 -3
- package/.github/workflows/claude-reviewer.yml +6 -4
- package/.github/workflows/publish-npm.yml +1 -0
- package/.github/workflows/push-to-main.yml +1 -1
- package/.github/workflows/top-issue.yml +102 -0
- package/CHANGELOG.md +69 -0
- package/CONCEPTS.md +747 -0
- package/README.md +178 -8
- package/dist/constants.js +8 -8
- package/dist/constants.js.map +1 -1
- package/dist/core/websocket-client.d.ts +15 -3
- package/dist/core/websocket-client.d.ts.map +1 -1
- package/dist/core/websocket-client.js +52 -13
- package/dist/core/websocket-client.js.map +1 -1
- package/dist/formatters/response-formatter.js +4 -0
- package/dist/formatters/response-formatter.js.map +1 -1
- package/dist/handlers/message-handler-registry.js +2 -1
- package/dist/handlers/message-handler-registry.js.map +1 -1
- package/dist/handlers/message-handlers/agent-details-response-handler.d.ts +1666 -0
- package/dist/handlers/message-handlers/agent-details-response-handler.d.ts.map +1 -0
- package/dist/handlers/message-handlers/agent-details-response-handler.js +38 -0
- package/dist/handlers/message-handlers/agent-details-response-handler.js.map +1 -0
- package/dist/handlers/message-handlers/agent-room-operation-response-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/agent-room-operation-response-handler.js +2 -5
- package/dist/handlers/message-handlers/agent-room-operation-response-handler.js.map +1 -1
- package/dist/handlers/message-handlers/agent-selected-handler.js +2 -5
- package/dist/handlers/message-handlers/agent-selected-handler.js.map +1 -1
- package/dist/handlers/message-handlers/agent-status-update-handler.d.ts +783 -0
- package/dist/handlers/message-handlers/agent-status-update-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/agent-status-update-handler.js +2 -5
- package/dist/handlers/message-handlers/agent-status-update-handler.js.map +1 -1
- package/dist/handlers/message-handlers/agents-list-handler.js +2 -5
- package/dist/handlers/message-handlers/agents-list-handler.js.map +1 -1
- package/dist/handlers/message-handlers/all-agents-response-handler.d.ts +439 -0
- package/dist/handlers/message-handlers/all-agents-response-handler.d.ts.map +1 -0
- package/dist/handlers/message-handlers/all-agents-response-handler.js +36 -0
- package/dist/handlers/message-handlers/all-agents-response-handler.js.map +1 -0
- package/dist/handlers/message-handlers/auth-error-handler.js +2 -5
- package/dist/handlers/message-handlers/auth-error-handler.js.map +1 -1
- package/dist/handlers/message-handlers/auth-message-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/auth-message-handler.js +6 -5
- package/dist/handlers/message-handlers/auth-message-handler.js.map +1 -1
- package/dist/handlers/message-handlers/auth-required-handler.js +2 -5
- package/dist/handlers/message-handlers/auth-required-handler.js.map +1 -1
- package/dist/handlers/message-handlers/auth-success-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/auth-success-handler.js +6 -5
- package/dist/handlers/message-handlers/auth-success-handler.js.map +1 -1
- package/dist/handlers/message-handlers/base-handler.d.ts +4 -4
- package/dist/handlers/message-handlers/base-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/base-handler.js +3 -1
- package/dist/handlers/message-handlers/base-handler.js.map +1 -1
- package/dist/handlers/message-handlers/challenge-handler.js +3 -2
- package/dist/handlers/message-handlers/challenge-handler.js.map +1 -1
- package/dist/handlers/message-handlers/error-message-handler.js +2 -5
- package/dist/handlers/message-handlers/error-message-handler.js.map +1 -1
- package/dist/handlers/message-handlers/index.d.ts +6 -0
- package/dist/handlers/message-handlers/index.d.ts.map +1 -1
- package/dist/handlers/message-handlers/index.js +33 -1
- package/dist/handlers/message-handlers/index.js.map +1 -1
- package/dist/handlers/message-handlers/list-available-agents-handler.d.ts +783 -0
- package/dist/handlers/message-handlers/list-available-agents-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/list-available-agents-handler.js +2 -5
- package/dist/handlers/message-handlers/list-available-agents-handler.js.map +1 -1
- package/dist/handlers/message-handlers/list-room-agents-handler.d.ts +783 -0
- package/dist/handlers/message-handlers/list-room-agents-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/list-room-agents-handler.js +2 -5
- package/dist/handlers/message-handlers/list-room-agents-handler.js.map +1 -1
- package/dist/handlers/message-handlers/list-rooms-response-handler.d.ts +2 -199
- package/dist/handlers/message-handlers/list-rooms-response-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/list-rooms-response-handler.js +4 -6
- package/dist/handlers/message-handlers/list-rooms-response-handler.js.map +1 -1
- package/dist/handlers/message-handlers/ping-pong-handler.js +4 -10
- package/dist/handlers/message-handlers/ping-pong-handler.js.map +1 -1
- package/dist/handlers/message-handlers/rate-limit-notification-handler.d.ts +94 -0
- package/dist/handlers/message-handlers/rate-limit-notification-handler.d.ts.map +1 -0
- package/dist/handlers/message-handlers/rate-limit-notification-handler.js +35 -0
- package/dist/handlers/message-handlers/rate-limit-notification-handler.js.map +1 -0
- package/dist/handlers/message-handlers/regular-message-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/regular-message-handler.js +4 -6
- package/dist/handlers/message-handlers/regular-message-handler.js.map +1 -1
- package/dist/handlers/message-handlers/room-operation-response-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/room-operation-response-handler.js +2 -5
- package/dist/handlers/message-handlers/room-operation-response-handler.js.map +1 -1
- package/dist/handlers/message-handlers/subscribe-response-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/subscribe-response-handler.js +4 -6
- package/dist/handlers/message-handlers/subscribe-response-handler.js.map +1 -1
- package/dist/handlers/message-handlers/task-quote-handler.d.ts +14 -0
- package/dist/handlers/message-handlers/task-quote-handler.d.ts.map +1 -0
- package/dist/handlers/message-handlers/task-quote-handler.js +29 -0
- package/dist/handlers/message-handlers/task-quote-handler.js.map +1 -0
- package/dist/handlers/message-handlers/task-response-handler.js +2 -5
- package/dist/handlers/message-handlers/task-response-handler.js.map +1 -1
- package/dist/handlers/message-handlers/types.d.ts +21 -9
- package/dist/handlers/message-handlers/types.d.ts.map +1 -1
- package/dist/handlers/message-handlers/unsubscribe-response-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/unsubscribe-response-handler.js +4 -6
- package/dist/handlers/message-handlers/unsubscribe-response-handler.js.map +1 -1
- package/dist/handlers/message-handlers/user-authenticated-handler.d.ts +40 -0
- package/dist/handlers/message-handlers/user-authenticated-handler.d.ts.map +1 -0
- package/dist/handlers/message-handlers/user-authenticated-handler.js +28 -0
- package/dist/handlers/message-handlers/user-authenticated-handler.js.map +1 -0
- package/dist/handlers/message-handlers/user-count-handler.d.ts +49 -0
- package/dist/handlers/message-handlers/user-count-handler.d.ts.map +1 -0
- package/dist/handlers/message-handlers/user-count-handler.js +31 -0
- package/dist/handlers/message-handlers/user-count-handler.js.map +1 -0
- package/dist/handlers/webhook-handler.d.ts +1 -1
- package/dist/handlers/webhook-handler.d.ts.map +1 -1
- package/dist/handlers/webhook-handler.js +14 -5
- package/dist/handlers/webhook-handler.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/dist/managers/admin-manager.d.ts +116 -0
- package/dist/managers/admin-manager.d.ts.map +1 -0
- package/dist/managers/admin-manager.js +169 -0
- package/dist/managers/admin-manager.js.map +1 -0
- package/dist/managers/agent-registry.d.ts +52 -1
- package/dist/managers/agent-registry.d.ts.map +1 -1
- package/dist/managers/agent-registry.js +145 -6
- package/dist/managers/agent-registry.js.map +1 -1
- package/dist/managers/agent-room-manager.d.ts +1 -7
- package/dist/managers/agent-room-manager.d.ts.map +1 -1
- package/dist/managers/agent-room-manager.js +83 -36
- package/dist/managers/agent-room-manager.js.map +1 -1
- package/dist/managers/connection-manager.js +2 -0
- package/dist/managers/connection-manager.js.map +1 -1
- package/dist/managers/index.d.ts +2 -1
- package/dist/managers/index.d.ts.map +1 -1
- package/dist/managers/index.js +3 -1
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/message-router.d.ts +56 -5
- package/dist/managers/message-router.d.ts.map +1 -1
- package/dist/managers/message-router.js +155 -8
- package/dist/managers/message-router.js.map +1 -1
- package/dist/managers/room-management-manager.d.ts.map +1 -1
- package/dist/managers/room-management-manager.js +9 -7
- package/dist/managers/room-management-manager.js.map +1 -1
- package/dist/managers/room-manager.d.ts +7 -5
- package/dist/managers/room-manager.d.ts.map +1 -1
- package/dist/managers/room-manager.js +14 -10
- package/dist/managers/room-manager.js.map +1 -1
- package/dist/payments/index.d.ts +5 -0
- package/dist/payments/index.d.ts.map +1 -0
- package/dist/payments/index.js +21 -0
- package/dist/payments/index.js.map +1 -0
- package/dist/payments/payment-client.d.ts +74 -0
- package/dist/payments/payment-client.d.ts.map +1 -0
- package/dist/payments/payment-client.js +207 -0
- package/dist/payments/payment-client.js.map +1 -0
- package/dist/teneo-sdk.d.ts +135 -21
- package/dist/teneo-sdk.d.ts.map +1 -1
- package/dist/teneo-sdk.js +268 -26
- package/dist/teneo-sdk.js.map +1 -1
- package/dist/types/categories.d.ts +22 -0
- package/dist/types/categories.d.ts.map +1 -0
- package/dist/types/categories.js +40 -0
- package/dist/types/categories.js.map +1 -0
- package/dist/types/config.d.ts +79 -8
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +62 -5
- package/dist/types/config.js.map +1 -1
- package/dist/types/error-codes.d.ts +8 -0
- package/dist/types/error-codes.d.ts.map +1 -1
- package/dist/types/error-codes.js +9 -0
- package/dist/types/error-codes.js.map +1 -1
- package/dist/types/events.d.ts +44 -0
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/events.js +19 -1
- package/dist/types/events.js.map +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +33 -3
- package/dist/types/index.js.map +1 -1
- package/dist/types/messages.d.ts +11219 -423
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/messages.js +249 -7
- package/dist/types/messages.js.map +1 -1
- package/dist/utils/bounded-queue.d.ts.map +1 -1
- package/dist/utils/bounded-queue.js +5 -2
- package/dist/utils/bounded-queue.js.map +1 -1
- package/dist/utils/circuit-breaker.js +11 -4
- package/dist/utils/circuit-breaker.js.map +1 -1
- package/dist/utils/deduplication-cache.js +3 -1
- package/dist/utils/deduplication-cache.js.map +1 -1
- package/dist/utils/event-waiter.d.ts +3 -3
- package/dist/utils/event-waiter.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/pricing-resolver.d.ts +26 -0
- package/dist/utils/pricing-resolver.d.ts.map +1 -0
- package/dist/utils/pricing-resolver.js +85 -0
- package/dist/utils/pricing-resolver.js.map +1 -0
- package/dist/utils/rate-limiter.d.ts.map +1 -1
- package/dist/utils/rate-limiter.js +6 -0
- package/dist/utils/rate-limiter.js.map +1 -1
- package/dist/utils/retry-policy.js +1 -0
- package/dist/utils/retry-policy.js.map +1 -1
- package/dist/utils/secure-private-key.js +3 -1
- package/dist/utils/secure-private-key.js.map +1 -1
- package/dist/utils/signature-verifier.d.ts.map +1 -1
- package/dist/utils/signature-verifier.js +3 -1
- package/dist/utils/signature-verifier.js.map +1 -1
- package/examples/.env.example +1 -1
- package/examples/agent-room-management-example.ts +10 -9
- package/examples/basic-usage.ts +3 -4
- package/examples/claude-agent-x-follower/.env.example +1 -1
- package/examples/claude-agent-x-follower/QUICKSTART.md +2 -2
- package/examples/claude-agent-x-follower/README.md +2 -2
- package/examples/claude-agent-x-follower/index.ts +120 -96
- package/examples/n8n-teneo/.env.example +1 -1
- package/examples/n8n-teneo/README.md +1 -1
- package/examples/n8n-teneo/index.ts +54 -44
- package/examples/nestjs-dashboard/.env.example +11 -0
- package/examples/nestjs-dashboard/README.md +297 -0
- package/examples/nestjs-dashboard/nest-cli.json +10 -0
- package/examples/nestjs-dashboard/package.json +44 -0
- package/examples/nestjs-dashboard/pnpm-lock.yaml +3079 -0
- package/examples/nestjs-dashboard/src/app.controller.ts +24 -0
- package/examples/nestjs-dashboard/src/app.module.ts +15 -0
- package/examples/nestjs-dashboard/src/main.ts +32 -0
- package/examples/nestjs-dashboard/src/public/dashboard.html +1144 -0
- package/examples/nestjs-dashboard/src/teneo/agents.controller.ts +54 -0
- package/examples/nestjs-dashboard/src/teneo/events.controller.ts +65 -0
- package/examples/nestjs-dashboard/src/teneo/messages.controller.ts +47 -0
- package/examples/nestjs-dashboard/src/teneo/rooms.controller.ts +258 -0
- package/examples/nestjs-dashboard/src/teneo/teneo.module.ts +13 -0
- package/examples/nestjs-dashboard/src/teneo/teneo.service.ts +484 -0
- package/examples/nestjs-dashboard/tsconfig.json +22 -0
- package/examples/openai-teneo/.env.example +1 -1
- package/examples/openai-teneo/README.md +2 -2
- package/examples/openai-teneo/index.ts +82 -71
- package/examples/production-dashboard/.env.example +1 -1
- package/examples/production-dashboard/README.md +1 -1
- package/examples/production-dashboard/server.ts +2 -2
- package/examples/room-management-example.ts +5 -8
- package/examples/usage/.env.example +1 -1
- package/examples/usage/01-connect.ts +3 -4
- package/examples/usage/02-list-agents.ts +2 -3
- package/examples/usage/03-pick-agent.ts +2 -3
- package/examples/usage/04-find-by-capability.ts +2 -3
- package/examples/usage/05-webhook-example.ts +2 -3
- package/examples/usage/06-simple-api-server.ts +2 -3
- package/examples/usage/07-event-listener.ts +2 -3
- package/examples/webhook-integration.ts +1 -1
- package/examples/x-influencer-battle-server.ts +2 -2
- package/package.json +4 -1
- package/src/core/websocket-client.test.ts +8 -3
- package/src/core/websocket-client.ts +36 -6
- package/src/formatters/response-formatter.test.ts +2 -0
- package/src/formatters/response-formatter.ts +3 -3
- package/src/handlers/message-handlers/agent-details-response-handler.ts +42 -0
- package/src/handlers/message-handlers/agent-room-operation-response-handler.ts +2 -8
- package/src/handlers/message-handlers/agent-status-update-handler.ts +3 -9
- package/src/handlers/message-handlers/all-agents-response-handler.ts +39 -0
- package/src/handlers/message-handlers/auth-message-handler.ts +5 -0
- package/src/handlers/message-handlers/auth-success-handler.ts +6 -1
- package/src/handlers/message-handlers/base-handler.ts +20 -7
- package/src/handlers/message-handlers/index.ts +34 -0
- package/src/handlers/message-handlers/list-room-agents-handler.ts +2 -5
- package/src/handlers/message-handlers/list-rooms-response-handler.ts +4 -2
- package/src/handlers/message-handlers/rate-limit-notification-handler.ts +45 -0
- package/src/handlers/message-handlers/regular-message-handler.ts +3 -2
- package/src/handlers/message-handlers/room-operation-response-handler.ts +3 -6
- package/src/handlers/message-handlers/subscribe-response-handler.ts +12 -2
- package/src/handlers/message-handlers/task-quote-handler.ts +31 -0
- package/src/handlers/message-handlers/types.ts +37 -9
- package/src/handlers/message-handlers/unsubscribe-response-handler.ts +12 -2
- package/src/handlers/message-handlers/user-authenticated-handler.ts +31 -0
- package/src/handlers/message-handlers/user-count-handler.ts +34 -0
- package/src/handlers/webhook-handler.test.ts +3 -2
- package/src/handlers/webhook-handler.ts +13 -7
- package/src/index.ts +21 -0
- package/src/managers/admin-manager.ts +249 -0
- package/src/managers/agent-registry.test.ts +2 -1
- package/src/managers/agent-registry.ts +170 -2
- package/src/managers/agent-room-manager.ts +98 -42
- package/src/managers/index.ts +13 -1
- package/src/managers/message-router.ts +215 -17
- package/src/managers/room-management-manager.ts +4 -7
- package/src/managers/room-manager.ts +11 -15
- package/src/payments/index.ts +22 -0
- package/src/payments/payment-client.ts +240 -0
- package/src/teneo-sdk.ts +302 -27
- package/src/types/categories.ts +45 -0
- package/src/types/config.ts +70 -2
- package/src/types/error-codes.ts +10 -0
- package/src/types/events.test.ts +1 -0
- package/src/types/events.ts +43 -0
- package/src/types/index.ts +56 -0
- package/src/types/messages.test.ts +2 -1
- package/src/types/messages.ts +307 -5
- package/src/utils/bounded-queue.test.ts +1 -1
- package/src/utils/bounded-queue.ts +2 -1
- package/src/utils/circuit-breaker.test.ts +1 -1
- package/src/utils/deduplication-cache.test.ts +1 -1
- package/src/utils/event-waiter.test.ts +1 -1
- package/src/utils/event-waiter.ts +3 -3
- package/src/utils/index.ts +7 -0
- package/src/utils/logger.ts +8 -8
- package/src/utils/pricing-resolver.ts +128 -0
- package/src/utils/rate-limiter.test.ts +1 -1
- package/src/utils/rate-limiter.ts +1 -0
- package/src/utils/signature-verifier.test.ts +2 -2
- package/src/utils/signature-verifier.ts +3 -2
- package/tests/.env.example +7 -0
- package/tests/direct-agent-test.ts +151 -0
- package/tests/integration/real-server.test.ts +2 -0
- package/tests/integration/room-management.test.ts +10 -8
- package/tests/integration/websocket.test.ts +4 -1
- package/tests/payment-flow-test.ts +147 -0
- package/tests/unit/handlers/agent-room-operation-response-handler.test.ts +17 -29
- package/tests/unit/handlers/agent-status-update-handler.test.ts +2 -6
- package/tests/unit/handlers/auth-success-handler-rooms.test.ts +1 -3
- package/tests/unit/handlers/list-available-agents-handler.test.ts +4 -12
- package/tests/unit/handlers/list-room-agents-handler.test.ts +2 -6
- package/tests/unit/handlers/room-operation-response-handler.test.ts +9 -36
- package/tests/unit/managers/agent-room-manager.test.ts +9 -16
- package/tests/unit/managers/room-management-manager.test.ts +21 -39
- package/tsconfig.json +2 -2
- package/vitest.config.ts +1 -0
|
@@ -7,31 +7,36 @@
|
|
|
7
7
|
* 3. Return structured results to Claude
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
import { query, tool, createSdkMcpServer } from
|
|
12
|
-
import { z } from
|
|
13
|
-
import { SDKConfigBuilder, TeneoSDK } from
|
|
10
|
+
import "dotenv/config";
|
|
11
|
+
import { query, tool, createSdkMcpServer } from "@anthropic-ai/claude-agent-sdk";
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
import { SDKConfigBuilder, TeneoSDK } from "../../dist/index.js";
|
|
14
14
|
|
|
15
15
|
// Load environment variables
|
|
16
|
-
const WS_URL = process.env.WS_URL ||
|
|
17
|
-
const PRIVATE_KEY = process.env.PRIVATE_KEY ||
|
|
18
|
-
const WALLET_ADDRESS = process.env.WALLET_ADDRESS ||
|
|
19
|
-
const DEFAULT_ROOM = process.env.DEFAULT_ROOM ||
|
|
20
|
-
const LOG_LEVEL = (process.env.LOG_LEVEL ||
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
16
|
+
const WS_URL = process.env.WS_URL || "";
|
|
17
|
+
const PRIVATE_KEY = process.env.PRIVATE_KEY || "";
|
|
18
|
+
const WALLET_ADDRESS = process.env.WALLET_ADDRESS || "";
|
|
19
|
+
const DEFAULT_ROOM = process.env.DEFAULT_ROOM || "general";
|
|
20
|
+
const LOG_LEVEL = (process.env.LOG_LEVEL || "info") as
|
|
21
|
+
| "debug"
|
|
22
|
+
| "info"
|
|
23
|
+
| "warn"
|
|
24
|
+
| "error"
|
|
25
|
+
| "silent";
|
|
26
|
+
const ENABLE_SIG_VERIFICATION = process.env.ENABLE_SIGNATURE_VERIFICATION === "true";
|
|
27
|
+
const TRUSTED_ADDRESSES = process.env.TRUSTED_ADDRESSES?.split(",").filter(Boolean) || [];
|
|
28
|
+
const ENABLE_CACHE = process.env.ENABLE_CACHE !== "false";
|
|
29
|
+
const CACHE_TIMEOUT = parseInt(process.env.CACHE_TIMEOUT || "300000");
|
|
30
|
+
const MAX_CACHE_SIZE = parseInt(process.env.MAX_CACHE_SIZE || "100");
|
|
31
|
+
const ENABLE_RECONNECTION = process.env.ENABLE_RECONNECTION !== "false";
|
|
32
|
+
const RECONNECT_DELAY = parseInt(process.env.RECONNECT_DELAY || "5000");
|
|
33
|
+
const MAX_RECONNECT_ATTEMPTS = parseInt(process.env.MAX_RECONNECT_ATTEMPTS || "10");
|
|
29
34
|
|
|
30
35
|
// Validate required environment variables
|
|
31
36
|
if (!WS_URL || !PRIVATE_KEY) {
|
|
32
|
-
console.error(
|
|
33
|
-
console.error(
|
|
34
|
-
console.error(
|
|
37
|
+
console.error("Missing required environment variables");
|
|
38
|
+
console.error("Required: WS_URL, PRIVATE_KEY");
|
|
39
|
+
console.error("Note: ANTHROPIC_API_KEY is optional if Claude CLI is authenticated");
|
|
35
40
|
process.exit(1);
|
|
36
41
|
}
|
|
37
42
|
|
|
@@ -45,13 +50,13 @@ const config = new SDKConfigBuilder()
|
|
|
45
50
|
delay: RECONNECT_DELAY,
|
|
46
51
|
maxAttempts: MAX_RECONNECT_ATTEMPTS
|
|
47
52
|
})
|
|
48
|
-
.withResponseFormat({ format:
|
|
53
|
+
.withResponseFormat({ format: "both", includeMetadata: true })
|
|
49
54
|
.withLogging(LOG_LEVEL)
|
|
50
55
|
.withCache(ENABLE_CACHE, CACHE_TIMEOUT, MAX_CACHE_SIZE)
|
|
51
56
|
.withSignatureVerification({
|
|
52
57
|
enabled: ENABLE_SIG_VERIFICATION,
|
|
53
58
|
trustedAddresses: TRUSTED_ADDRESSES,
|
|
54
|
-
requireFor: [
|
|
59
|
+
requireFor: ["task_response", "agent_selected"],
|
|
55
60
|
strictMode: false
|
|
56
61
|
})
|
|
57
62
|
.build();
|
|
@@ -61,18 +66,18 @@ const teneoSDK = new TeneoSDK(config);
|
|
|
61
66
|
// Define the tool for Claude Agent
|
|
62
67
|
// Note: Pass Zod shape directly (ZodRawShape), not z.object()
|
|
63
68
|
const getXTimelineTool = tool(
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
"get_x_timeline",
|
|
70
|
+
"Fetch X/Twitter timeline for a given username using Teneo X-Agent. Returns recent tweets and engagement data.",
|
|
66
71
|
{
|
|
67
|
-
username: z.string().describe(
|
|
68
|
-
count: z.number().min(1).max(100).default(20).describe(
|
|
72
|
+
username: z.string().describe("X/Twitter username (without @)"),
|
|
73
|
+
count: z.number().min(1).max(100).default(20).describe("Number of tweets to fetch")
|
|
69
74
|
},
|
|
70
75
|
async (args) => {
|
|
71
76
|
const { username, count } = args;
|
|
72
77
|
|
|
73
|
-
console.log(
|
|
74
|
-
console.log(
|
|
75
|
-
console.log(
|
|
78
|
+
console.log("\n" + "=".repeat(60));
|
|
79
|
+
console.log("š§ TOOL INVOKED: get_x_timeline");
|
|
80
|
+
console.log("=".repeat(60));
|
|
76
81
|
console.log(`š„ Input: username="${username}", count=${count}`);
|
|
77
82
|
console.log(`\nš Fetching timeline for @${username} (${count} tweets)...\n`);
|
|
78
83
|
|
|
@@ -82,22 +87,30 @@ const getXTimelineTool = tool(
|
|
|
82
87
|
console.log(`š Found ${agents.length} available agents`);
|
|
83
88
|
|
|
84
89
|
// Find X Platform Agent by name or ID
|
|
85
|
-
const xAgent = agents.find(
|
|
86
|
-
a
|
|
87
|
-
|
|
90
|
+
const xAgent = agents.find(
|
|
91
|
+
(a) =>
|
|
92
|
+
a.name?.toLowerCase().includes("x platform agent") ||
|
|
93
|
+
a.id?.toLowerCase().includes("x-agent-enterprise-v2")
|
|
88
94
|
);
|
|
89
95
|
|
|
90
96
|
if (!xAgent) {
|
|
91
|
-
console.error(
|
|
92
|
-
console.log(
|
|
97
|
+
console.error("ā X Platform Agent not found in available agents");
|
|
98
|
+
console.log(
|
|
99
|
+
"Available agents:",
|
|
100
|
+
agents.map((a) => ({ id: a.id, name: a.name }))
|
|
101
|
+
);
|
|
93
102
|
return {
|
|
94
|
-
content: [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
content: [
|
|
104
|
+
{
|
|
105
|
+
type: "text" as const,
|
|
106
|
+
text: JSON.stringify({
|
|
107
|
+
success: false,
|
|
108
|
+
error:
|
|
109
|
+
"X Platform Agent not found. Available agents: " +
|
|
110
|
+
agents.map((a) => a.name || a.id).join(", ")
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
]
|
|
101
114
|
};
|
|
102
115
|
}
|
|
103
116
|
|
|
@@ -107,23 +120,28 @@ const getXTimelineTool = tool(
|
|
|
107
120
|
// We pre-selected the X Platform Agent, so we use sendDirectCommand()
|
|
108
121
|
// instead of sendMessage() to send directly to this specific agent
|
|
109
122
|
const waitForResponse = true;
|
|
110
|
-
const response = await teneoSDK.sendDirectCommand(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
123
|
+
const response = await teneoSDK.sendDirectCommand(
|
|
124
|
+
{
|
|
125
|
+
agent: xAgent.id,
|
|
126
|
+
command: `timeline @${username} ${count}`,
|
|
127
|
+
room: DEFAULT_ROOM
|
|
128
|
+
},
|
|
129
|
+
waitForResponse
|
|
130
|
+
);
|
|
115
131
|
|
|
116
|
-
console.log(
|
|
132
|
+
console.log("šØ Received response from Teneo:", response ? "Yes" : "No");
|
|
117
133
|
|
|
118
134
|
if (!response?.humanized) {
|
|
119
135
|
return {
|
|
120
|
-
content: [
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
136
|
+
content: [
|
|
137
|
+
{
|
|
138
|
+
type: "text" as const,
|
|
139
|
+
text: JSON.stringify({
|
|
140
|
+
success: false,
|
|
141
|
+
error: "No response from X-Agent"
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
]
|
|
127
145
|
};
|
|
128
146
|
}
|
|
129
147
|
|
|
@@ -131,28 +149,35 @@ const getXTimelineTool = tool(
|
|
|
131
149
|
|
|
132
150
|
// Return the timeline data in Claude's expected format
|
|
133
151
|
return {
|
|
134
|
-
content: [
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
152
|
+
content: [
|
|
153
|
+
{
|
|
154
|
+
type: "text" as const,
|
|
155
|
+
text: JSON.stringify(
|
|
156
|
+
{
|
|
157
|
+
success: true,
|
|
158
|
+
username: username,
|
|
159
|
+
count: count,
|
|
160
|
+
timeline: response.humanized,
|
|
161
|
+
raw_data: response.raw
|
|
162
|
+
},
|
|
163
|
+
null,
|
|
164
|
+
2
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
]
|
|
144
168
|
};
|
|
145
|
-
|
|
146
169
|
} catch (error) {
|
|
147
|
-
console.error(
|
|
170
|
+
console.error("Error fetching timeline:", error);
|
|
148
171
|
return {
|
|
149
|
-
content: [
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
172
|
+
content: [
|
|
173
|
+
{
|
|
174
|
+
type: "text" as const,
|
|
175
|
+
text: JSON.stringify({
|
|
176
|
+
success: false,
|
|
177
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
]
|
|
156
181
|
};
|
|
157
182
|
}
|
|
158
183
|
}
|
|
@@ -160,26 +185,26 @@ const getXTimelineTool = tool(
|
|
|
160
185
|
|
|
161
186
|
// Create MCP server with the tool
|
|
162
187
|
const teneoMcpServer = createSdkMcpServer({
|
|
163
|
-
name:
|
|
164
|
-
version:
|
|
188
|
+
name: "TeneoXAgent",
|
|
189
|
+
version: "1.0.0",
|
|
165
190
|
tools: [getXTimelineTool]
|
|
166
191
|
});
|
|
167
192
|
|
|
168
193
|
// Main function
|
|
169
194
|
async function main() {
|
|
170
|
-
console.log(
|
|
195
|
+
console.log("š¤ Claude Agent + Teneo SDK - X Timeline Follower\n");
|
|
171
196
|
|
|
172
197
|
// Connect to Teneo
|
|
173
|
-
console.log(
|
|
198
|
+
console.log("š” Connecting to Teneo Protocol...");
|
|
174
199
|
await teneoSDK.connect();
|
|
175
|
-
console.log(
|
|
200
|
+
console.log("ā
Connected to Teneo\n");
|
|
176
201
|
|
|
177
202
|
// Get prompt from command line or use default
|
|
178
|
-
const userPrompt =
|
|
179
|
-
|
|
203
|
+
const userPrompt =
|
|
204
|
+
process.argv[2] || "Use the get_x_timeline tool to get the timeline for elonmusk for 5 tweets";
|
|
180
205
|
|
|
181
206
|
console.log(`š¬ Prompt: "${userPrompt}"\n`);
|
|
182
|
-
console.log(
|
|
207
|
+
console.log("š§ Claude is processing...\n");
|
|
183
208
|
|
|
184
209
|
try {
|
|
185
210
|
// Query Claude with the custom tool
|
|
@@ -187,32 +212,32 @@ async function main() {
|
|
|
187
212
|
const result = query({
|
|
188
213
|
prompt: userPrompt,
|
|
189
214
|
options: {
|
|
190
|
-
model:
|
|
191
|
-
pathToClaudeCodeExecutable: process.env.HOME +
|
|
192
|
-
permissionMode:
|
|
215
|
+
model: "claude-3-5-haiku-20241022",
|
|
216
|
+
pathToClaudeCodeExecutable: process.env.HOME + "/.claude/local/claude",
|
|
217
|
+
permissionMode: "bypassPermissions", // Allow tool use without asking
|
|
193
218
|
mcpServers: {
|
|
194
219
|
teneo: teneoMcpServer
|
|
195
220
|
}
|
|
196
221
|
}
|
|
197
222
|
});
|
|
198
223
|
|
|
199
|
-
console.log(
|
|
200
|
-
console.log(
|
|
201
|
-
console.log(
|
|
224
|
+
console.log("\n" + "=".repeat(60));
|
|
225
|
+
console.log("š CLAUDE RESPONSE:");
|
|
226
|
+
console.log("=".repeat(60));
|
|
202
227
|
|
|
203
228
|
// Stream the response
|
|
204
229
|
for await (const message of result) {
|
|
205
|
-
if (message.type ===
|
|
230
|
+
if (message.type === "result") {
|
|
206
231
|
// Show the final result in a readable format
|
|
207
|
-
console.log(
|
|
232
|
+
console.log("\nš Final Result:");
|
|
208
233
|
|
|
209
234
|
// Check if it's an error result
|
|
210
235
|
if (message.is_error) {
|
|
211
|
-
console.log(
|
|
236
|
+
console.log("ā Error occurred during execution");
|
|
212
237
|
console.log(message);
|
|
213
238
|
} else {
|
|
214
239
|
// Success result - TypeScript narrows the type here
|
|
215
|
-
console.log((message as any).result ||
|
|
240
|
+
console.log((message as any).result || "No result returned");
|
|
216
241
|
}
|
|
217
242
|
|
|
218
243
|
console.log(`\nā±ļø Duration: ${message.duration_ms}ms`);
|
|
@@ -224,15 +249,14 @@ async function main() {
|
|
|
224
249
|
}
|
|
225
250
|
}
|
|
226
251
|
|
|
227
|
-
console.log(
|
|
228
|
-
|
|
252
|
+
console.log("=".repeat(60) + "\n");
|
|
229
253
|
} catch (error) {
|
|
230
|
-
console.error(
|
|
254
|
+
console.error("\nā Claude query error:", error);
|
|
231
255
|
} finally {
|
|
232
256
|
// Cleanup
|
|
233
257
|
teneoSDK.disconnect();
|
|
234
258
|
teneoSDK.destroy();
|
|
235
|
-
console.log(
|
|
259
|
+
console.log("ā
Done!\n");
|
|
236
260
|
|
|
237
261
|
// Force exit to prevent hanging
|
|
238
262
|
setTimeout(() => process.exit(0), 500);
|
|
@@ -241,7 +265,7 @@ async function main() {
|
|
|
241
265
|
|
|
242
266
|
// Run with error handling
|
|
243
267
|
main().catch((error) => {
|
|
244
|
-
console.error(
|
|
268
|
+
console.error("\nā Error:", error);
|
|
245
269
|
teneoSDK.disconnect();
|
|
246
270
|
teneoSDK.destroy();
|
|
247
271
|
process.exit(1);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Copy this file to .env and fill in your values
|
|
3
3
|
|
|
4
4
|
# ============================================================================
|
|
5
|
-
# REQUIRED: Teneo
|
|
5
|
+
# REQUIRED: Teneo Protocol Connection
|
|
6
6
|
# ============================================================================
|
|
7
7
|
|
|
8
8
|
# WebSocket URL for Teneo AI Network
|
|
@@ -44,7 +44,7 @@ Query Teneo agents (like X-Agent for Twitter/X data) from visual n8n workflows f
|
|
|
44
44
|
ā WebSocket
|
|
45
45
|
ā
|
|
46
46
|
āāāāāāāāāāāā¼āāāāāāāāāāāāāāāā
|
|
47
|
-
ā Teneo
|
|
47
|
+
ā Teneo Protocol ā
|
|
48
48
|
ā (X-Agent, etc.) ā
|
|
49
49
|
āāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
50
50
|
```
|
|
@@ -14,28 +14,33 @@
|
|
|
14
14
|
* - Event-based response handling for reliable message delivery
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import
|
|
18
|
-
import express from
|
|
19
|
-
import { SDKConfigBuilder, TeneoSDK } from
|
|
17
|
+
import "dotenv/config";
|
|
18
|
+
import express from "express";
|
|
19
|
+
import { SDKConfigBuilder, TeneoSDK } from "../../dist/index.js";
|
|
20
20
|
|
|
21
21
|
// Load environment variables
|
|
22
|
-
const WS_URL = process.env.WS_URL ||
|
|
23
|
-
const PRIVATE_KEY = process.env.PRIVATE_KEY ||
|
|
24
|
-
const WALLET_ADDRESS = process.env.WALLET_ADDRESS ||
|
|
25
|
-
const DEFAULT_ROOM = process.env.DEFAULT_ROOM ||
|
|
26
|
-
const LOG_LEVEL = (process.env.LOG_LEVEL ||
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
22
|
+
const WS_URL = process.env.WS_URL || "";
|
|
23
|
+
const PRIVATE_KEY = process.env.PRIVATE_KEY || "";
|
|
24
|
+
const WALLET_ADDRESS = process.env.WALLET_ADDRESS || "";
|
|
25
|
+
const DEFAULT_ROOM = process.env.DEFAULT_ROOM || "general";
|
|
26
|
+
const LOG_LEVEL = (process.env.LOG_LEVEL || "info") as
|
|
27
|
+
| "debug"
|
|
28
|
+
| "info"
|
|
29
|
+
| "warn"
|
|
30
|
+
| "error"
|
|
31
|
+
| "silent";
|
|
32
|
+
const ENABLE_SIG_VERIFICATION = process.env.ENABLE_SIGNATURE_VERIFICATION === "true";
|
|
33
|
+
const TRUSTED_ADDRESSES = process.env.TRUSTED_ADDRESSES?.split(",").filter(Boolean) || [];
|
|
34
|
+
const ENABLE_CACHE = process.env.ENABLE_CACHE !== "false";
|
|
35
|
+
const CACHE_TIMEOUT = parseInt(process.env.CACHE_TIMEOUT || "300000");
|
|
36
|
+
const MAX_CACHE_SIZE = parseInt(process.env.MAX_CACHE_SIZE || "100");
|
|
37
|
+
const ENABLE_RECONNECTION = process.env.ENABLE_RECONNECTION !== "false";
|
|
38
|
+
const RECONNECT_DELAY = parseInt(process.env.RECONNECT_DELAY || "5000");
|
|
39
|
+
const MAX_RECONNECT_ATTEMPTS = parseInt(process.env.MAX_RECONNECT_ATTEMPTS || "10");
|
|
35
40
|
|
|
36
41
|
// Validate required environment variables
|
|
37
42
|
if (!WS_URL || !PRIVATE_KEY) {
|
|
38
|
-
console.error(
|
|
43
|
+
console.error("Missing required environment variables: WS_URL, PRIVATE_KEY");
|
|
39
44
|
process.exit(1);
|
|
40
45
|
}
|
|
41
46
|
|
|
@@ -45,20 +50,20 @@ app.use(express.json());
|
|
|
45
50
|
// Initialize Teneo SDK using SDKConfigBuilder pattern
|
|
46
51
|
const config = new SDKConfigBuilder()
|
|
47
52
|
.withWebSocketUrl(WS_URL)
|
|
48
|
-
.withAuthentication(PRIVATE_KEY, WALLET_ADDRESS)
|
|
53
|
+
.withAuthentication(PRIVATE_KEY, WALLET_ADDRESS) // Wallet auto-derived if not provided
|
|
49
54
|
.withRoom(DEFAULT_ROOM)
|
|
50
55
|
.withReconnection({
|
|
51
56
|
enabled: ENABLE_RECONNECTION,
|
|
52
57
|
delay: RECONNECT_DELAY,
|
|
53
58
|
maxAttempts: MAX_RECONNECT_ATTEMPTS
|
|
54
59
|
})
|
|
55
|
-
.withResponseFormat({ format:
|
|
60
|
+
.withResponseFormat({ format: "both", includeMetadata: true })
|
|
56
61
|
.withLogging(LOG_LEVEL)
|
|
57
62
|
.withCache(ENABLE_CACHE, CACHE_TIMEOUT, MAX_CACHE_SIZE)
|
|
58
63
|
.withSignatureVerification({
|
|
59
64
|
enabled: ENABLE_SIG_VERIFICATION,
|
|
60
65
|
trustedAddresses: TRUSTED_ADDRESSES,
|
|
61
|
-
requireFor: [
|
|
66
|
+
requireFor: ["task_response", "agent_selected"],
|
|
62
67
|
strictMode: false
|
|
63
68
|
})
|
|
64
69
|
.build();
|
|
@@ -66,35 +71,35 @@ const config = new SDKConfigBuilder()
|
|
|
66
71
|
const teneoSDK = new TeneoSDK(config);
|
|
67
72
|
|
|
68
73
|
// Connect to Teneo
|
|
69
|
-
console.log(
|
|
74
|
+
console.log("š” Connecting to Teneo Protocol...");
|
|
70
75
|
await teneoSDK.connect();
|
|
71
|
-
console.log(
|
|
76
|
+
console.log("ā
Connected to Teneo\n");
|
|
72
77
|
|
|
73
78
|
// Health endpoint
|
|
74
|
-
app.get(
|
|
79
|
+
app.get("/health", (req, res) => {
|
|
75
80
|
const health = teneoSDK.getHealth();
|
|
76
81
|
res.json({
|
|
77
|
-
status:
|
|
82
|
+
status: "ok",
|
|
78
83
|
teneo: {
|
|
79
|
-
connected: health.connection.status ===
|
|
84
|
+
connected: health.connection.status === "connected",
|
|
80
85
|
authenticated: health.connection.authenticated
|
|
81
86
|
}
|
|
82
87
|
});
|
|
83
88
|
});
|
|
84
89
|
|
|
85
90
|
// Query endpoint - send message to Teneo coordinator or specific agent
|
|
86
|
-
app.post(
|
|
91
|
+
app.post("/query", async (req, res) => {
|
|
87
92
|
try {
|
|
88
93
|
const { message, agent, timeout = 30000 } = req.body;
|
|
89
94
|
|
|
90
95
|
if (!message) {
|
|
91
96
|
return res.status(400).json({
|
|
92
97
|
success: false,
|
|
93
|
-
error:
|
|
98
|
+
error: "Message is required"
|
|
94
99
|
});
|
|
95
100
|
}
|
|
96
101
|
|
|
97
|
-
console.log(`\nš Query: ${message}${agent ? ` (to agent: ${agent})` :
|
|
102
|
+
console.log(`\nš Query: ${message}${agent ? ` (to agent: ${agent})` : " (via coordinator)"}`);
|
|
98
103
|
|
|
99
104
|
let response: any;
|
|
100
105
|
|
|
@@ -103,14 +108,17 @@ app.post('/query', async (req, res) => {
|
|
|
103
108
|
if (agent) {
|
|
104
109
|
// Direct command to specific agent
|
|
105
110
|
console.log(`šÆ Sending direct command to agent: ${agent}`);
|
|
106
|
-
response = await teneoSDK.sendDirectCommand(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
response = await teneoSDK.sendDirectCommand(
|
|
112
|
+
{
|
|
113
|
+
agent,
|
|
114
|
+
command: message,
|
|
115
|
+
room: DEFAULT_ROOM
|
|
116
|
+
},
|
|
117
|
+
true
|
|
118
|
+
); // waitForResponse = true
|
|
111
119
|
} else {
|
|
112
120
|
// Send via coordinator (coordinator will select best agent)
|
|
113
|
-
console.log(
|
|
121
|
+
console.log("š” Sending message via coordinator");
|
|
114
122
|
response = await teneoSDK.sendMessage(message, {
|
|
115
123
|
waitForResponse: true,
|
|
116
124
|
timeout
|
|
@@ -118,14 +126,14 @@ app.post('/query', async (req, res) => {
|
|
|
118
126
|
}
|
|
119
127
|
|
|
120
128
|
if (!response || !response.humanized) {
|
|
121
|
-
console.log(
|
|
129
|
+
console.log("ā ļø No response data received");
|
|
122
130
|
return res.json({
|
|
123
131
|
success: false,
|
|
124
|
-
error:
|
|
132
|
+
error: "No response from agent"
|
|
125
133
|
});
|
|
126
134
|
}
|
|
127
135
|
|
|
128
|
-
console.log(
|
|
136
|
+
console.log("šØ Response received from agent");
|
|
129
137
|
console.log(`ā
Response successfully processed\n`);
|
|
130
138
|
|
|
131
139
|
res.json({
|
|
@@ -137,20 +145,20 @@ app.post('/query', async (req, res) => {
|
|
|
137
145
|
}
|
|
138
146
|
});
|
|
139
147
|
} catch (error) {
|
|
140
|
-
console.error(
|
|
148
|
+
console.error("ā Query error:", error);
|
|
141
149
|
res.status(500).json({
|
|
142
150
|
success: false,
|
|
143
|
-
error: error instanceof Error ? error.message :
|
|
151
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
144
152
|
});
|
|
145
153
|
}
|
|
146
154
|
});
|
|
147
155
|
|
|
148
156
|
// List agents endpoint
|
|
149
|
-
app.get(
|
|
157
|
+
app.get("/agents", (_req, res) => {
|
|
150
158
|
const agents = teneoSDK.getAgents();
|
|
151
159
|
res.json({
|
|
152
160
|
success: true,
|
|
153
|
-
agents: agents.map(a => ({
|
|
161
|
+
agents: agents.map((a) => ({
|
|
154
162
|
id: a.id,
|
|
155
163
|
name: a.name,
|
|
156
164
|
description: a.description,
|
|
@@ -164,13 +172,15 @@ app.listen(PORT, () => {
|
|
|
164
172
|
console.log(`š Teneo Service running on http://localhost:${PORT}`);
|
|
165
173
|
console.log(` Health: GET http://localhost:${PORT}/health`);
|
|
166
174
|
console.log(` Query: POST http://localhost:${PORT}/query`);
|
|
167
|
-
console.log(
|
|
175
|
+
console.log(
|
|
176
|
+
` Body: { "message": "your query", "agent": "optional-agent-id", "timeout": 30000 }`
|
|
177
|
+
);
|
|
168
178
|
console.log(` Agents: GET http://localhost:${PORT}/agents\n`);
|
|
169
179
|
});
|
|
170
180
|
|
|
171
181
|
// Graceful shutdown
|
|
172
|
-
process.on(
|
|
173
|
-
console.log(
|
|
182
|
+
process.on("SIGINT", () => {
|
|
183
|
+
console.log("\nš Shutting down...");
|
|
174
184
|
teneoSDK.disconnect();
|
|
175
185
|
teneoSDK.destroy();
|
|
176
186
|
process.exit(0);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Teneo SDK Configuration
|
|
2
|
+
WS_URL=wss://your-teneo-server.com/ws
|
|
3
|
+
PRIVATE_KEY=your_ethereum_private_key_here_without_0x_prefix
|
|
4
|
+
WALLET_ADDRESS=your_ethereum_wallet_address_here_with_0x_prefix(optional)
|
|
5
|
+
|
|
6
|
+
# Signature Verification (optional)
|
|
7
|
+
ENABLE_SIGNATURE_VERIFICATION=false
|
|
8
|
+
TRUSTED_ADDRESSES=0x1234...,0x5678...
|
|
9
|
+
|
|
10
|
+
# Server Configuration
|
|
11
|
+
PORT=3000
|