@teneo-protocol/sdk 1.0.1 → 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 +9 -6
- package/.github/workflows/push-to-main.yml +1 -1
- package/.github/workflows/top-issue.yml +102 -0
- package/CHANGELOG.md +334 -0
- package/CONCEPTS.md +747 -0
- package/README.md +577 -54
- package/dist/constants.js +8 -8
- package/dist/constants.js.map +1 -1
- package/dist/core/websocket-client.d.ts +25 -1
- package/dist/core/websocket-client.d.ts.map +1 -1
- package/dist/core/websocket-client.js +74 -15
- 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 +76 -0
- package/dist/handlers/message-handlers/agent-room-operation-response-handler.d.ts.map +1 -0
- package/dist/handlers/message-handlers/agent-room-operation-response-handler.js +67 -0
- package/dist/handlers/message-handlers/agent-room-operation-response-handler.js.map +1 -0
- package/dist/handlers/message-handlers/agent-selected-handler.d.ts +92 -38
- package/dist/handlers/message-handlers/agent-selected-handler.d.ts.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 +1687 -0
- package/dist/handlers/message-handlers/agent-status-update-handler.d.ts.map +1 -0
- package/dist/handlers/message-handlers/agent-status-update-handler.js +48 -0
- package/dist/handlers/message-handlers/agent-status-update-handler.js.map +1 -0
- 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.d.ts +45 -31
- package/dist/handlers/message-handlers/auth-error-handler.d.ts.map +1 -1
- 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 +6 -0
- package/dist/handlers/message-handlers/auth-message-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/auth-message-handler.js +71 -10
- package/dist/handlers/message-handlers/auth-message-handler.js.map +1 -1
- package/dist/handlers/message-handlers/auth-required-handler.d.ts +49 -31
- package/dist/handlers/message-handlers/auth-required-handler.d.ts.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 +6 -0
- package/dist/handlers/message-handlers/auth-success-handler.d.ts.map +1 -1
- package/dist/handlers/message-handlers/auth-success-handler.js +52 -9
- 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.d.ts +45 -31
- package/dist/handlers/message-handlers/challenge-handler.d.ts.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.d.ts +49 -31
- package/dist/handlers/message-handlers/error-message-handler.d.ts.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 +11 -0
- package/dist/handlers/message-handlers/index.d.ts.map +1 -1
- package/dist/handlers/message-handlers/index.js +55 -1
- package/dist/handlers/message-handlers/index.js.map +1 -1
- package/dist/handlers/message-handlers/list-available-agents-handler.d.ts +1660 -0
- package/dist/handlers/message-handlers/list-available-agents-handler.d.ts.map +1 -0
- package/dist/handlers/message-handlers/list-available-agents-handler.js +35 -0
- package/dist/handlers/message-handlers/list-available-agents-handler.js.map +1 -0
- package/dist/handlers/message-handlers/list-room-agents-handler.d.ts +1669 -0
- package/dist/handlers/message-handlers/list-room-agents-handler.d.ts.map +1 -0
- package/dist/handlers/message-handlers/list-room-agents-handler.js +48 -0
- package/dist/handlers/message-handlers/list-room-agents-handler.js.map +1 -0
- package/dist/handlers/message-handlers/list-rooms-response-handler.d.ts +2 -110
- 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.d.ts +62 -58
- package/dist/handlers/message-handlers/ping-pong-handler.d.ts.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 +31 -29
- 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 +328 -0
- package/dist/handlers/message-handlers/room-operation-response-handler.d.ts.map +1 -0
- package/dist/handlers/message-handlers/room-operation-response-handler.js +89 -0
- package/dist/handlers/message-handlers/room-operation-response-handler.js.map +1 -0
- package/dist/handlers/message-handlers/subscribe-response-handler.d.ts +53 -31
- 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 -7
- package/dist/handlers/message-handlers/types.d.ts.map +1 -1
- package/dist/handlers/message-handlers/unsubscribe-response-handler.d.ts +53 -31
- 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 +216 -0
- package/dist/managers/agent-room-manager.d.ts.map +1 -0
- package/dist/managers/agent-room-manager.js +555 -0
- package/dist/managers/agent-room-manager.js.map +1 -0
- package/dist/managers/connection-manager.js +2 -0
- package/dist/managers/connection-manager.js.map +1 -1
- package/dist/managers/index.d.ts +4 -1
- package/dist/managers/index.d.ts.map +1 -1
- package/dist/managers/index.js +7 -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 +213 -0
- package/dist/managers/room-management-manager.d.ts.map +1 -0
- package/dist/managers/room-management-manager.js +442 -0
- package/dist/managers/room-management-manager.js.map +1 -0
- package/dist/managers/room-manager.d.ts +11 -9
- 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 +467 -33
- package/dist/teneo-sdk.d.ts.map +1 -1
- package/dist/teneo-sdk.js +735 -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 +134 -54
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +70 -9
- package/dist/types/config.js.map +1 -1
- package/dist/types/error-codes.d.ts +10 -0
- package/dist/types/error-codes.d.ts.map +1 -1
- package/dist/types/error-codes.js +12 -0
- package/dist/types/error-codes.js.map +1 -1
- package/dist/types/events.d.ts +176 -68
- 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 +57 -2
- package/dist/types/index.js.map +1 -1
- package/dist/types/messages.d.ts +22225 -2592
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/messages.js +537 -28
- 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 +2 -2
- package/examples/agent-room-management-example.ts +335 -0
- package/examples/basic-usage.ts +3 -4
- package/examples/claude-agent-x-follower/.env.example +3 -3
- package/examples/claude-agent-x-follower/QUICKSTART.md +3 -3
- package/examples/claude-agent-x-follower/README.md +3 -3
- package/examples/claude-agent-x-follower/index.ts +120 -96
- package/examples/n8n-teneo/.env.example +3 -3
- package/examples/n8n-teneo/README.md +2 -2
- 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 +3 -3
- package/examples/openai-teneo/README.md +3 -3
- package/examples/openai-teneo/index.ts +82 -71
- package/examples/production-dashboard/.env.example +3 -3
- package/examples/production-dashboard/README.md +90 -13
- package/examples/production-dashboard/public/dashboard.html +1173 -601
- package/examples/production-dashboard/server.ts +349 -7
- package/examples/room-management-example.ts +282 -0
- package/examples/usage/.env.example +2 -2
- 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/usage/README.md +1 -1
- package/examples/webhook-integration.ts +1 -1
- package/examples/x-influencer-battle-server.ts +2 -2
- package/package.json +12 -1
- package/src/core/websocket-client.test.ts +8 -3
- package/src/core/websocket-client.ts +58 -4
- 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 +77 -0
- package/src/handlers/message-handlers/agent-status-update-handler.ts +52 -0
- package/src/handlers/message-handlers/all-agents-response-handler.ts +39 -0
- package/src/handlers/message-handlers/auth-message-handler.ts +78 -5
- package/src/handlers/message-handlers/auth-success-handler.ts +63 -6
- package/src/handlers/message-handlers/base-handler.ts +20 -7
- package/src/handlers/message-handlers/index.ts +53 -0
- package/src/handlers/message-handlers/list-available-agents-handler.ts +41 -0
- package/src/handlers/message-handlers/list-room-agents-handler.ts +58 -0
- 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 +102 -0
- 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 +41 -7
- 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 +665 -0
- package/src/managers/index.ts +15 -1
- package/src/managers/message-router.ts +215 -17
- package/src/managers/room-management-manager.ts +520 -0
- package/src/managers/room-manager.ts +15 -20
- package/src/payments/index.ts +22 -0
- package/src/payments/payment-client.ts +240 -0
- package/src/teneo-sdk.ts +806 -30
- package/src/types/categories.ts +45 -0
- package/src/types/config.ts +80 -7
- package/src/types/error-codes.ts +14 -0
- package/src/types/events.test.ts +1 -0
- package/src/types/events.ts +67 -0
- package/src/types/index.ts +111 -0
- package/src/types/messages.test.ts +2 -1
- package/src/types/messages.ts +677 -42
- 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 +516 -0
- package/tests/integration/websocket.test.ts +5 -2
- package/tests/payment-flow-test.ts +147 -0
- package/tests/unit/handlers/agent-room-operation-response-handler.test.ts +382 -0
- package/tests/unit/handlers/agent-status-update-handler.test.ts +403 -0
- package/tests/unit/handlers/auth-success-handler-rooms.test.ts +697 -0
- package/tests/unit/handlers/list-available-agents-handler.test.ts +248 -0
- package/tests/unit/handlers/list-room-agents-handler.test.ts +290 -0
- package/tests/unit/handlers/room-operation-response-handler.test.ts +500 -0
- package/tests/unit/managers/agent-room-manager.test.ts +527 -0
- package/tests/unit/managers/room-management-manager.test.ts +420 -0
- package/tsconfig.json +2 -2
- package/vitest.config.ts +1 -0
package/dist/teneo-sdk.d.ts
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { EventEmitter } from "eventemitter3";
|
|
7
7
|
import { z } from "zod";
|
|
8
|
-
import { PartialSDKConfig, SDKConfigBuilder, Agent,
|
|
8
|
+
import { PartialSDKConfig, SDKConfigBuilder, Agent, RoomInfo, AgentRoomInfo, type HealthStatus } from "./types";
|
|
9
9
|
import { SDKEvents } from "./types/events";
|
|
10
10
|
import { FormattedResponse, ResponseFormatOptions } from "./formatters/response-formatter";
|
|
11
|
-
import { SendMessageOptions, AgentCommand } from "./managers";
|
|
12
|
-
export type { SendMessageOptions, AgentCommand };
|
|
11
|
+
import { SendMessageOptions, AgentCommand, QuoteResult, AdminManager, ListAllAgentsOptions, AllAgentsResult } from "./managers";
|
|
12
|
+
export type { SendMessageOptions, AgentCommand, QuoteResult, ListAllAgentsOptions, AllAgentsResult };
|
|
13
13
|
export declare const SendMessageOptionsSchema: z.ZodObject<{
|
|
14
14
|
room: z.ZodOptional<z.ZodString>;
|
|
15
15
|
from: z.ZodOptional<z.ZodString>;
|
|
@@ -46,13 +46,17 @@ export declare class TeneoSDK extends EventEmitter<SDKEvents> {
|
|
|
46
46
|
private config;
|
|
47
47
|
private readonly logger;
|
|
48
48
|
private isDestroyed;
|
|
49
|
+
private secureKey?;
|
|
49
50
|
private readonly wsClient;
|
|
50
51
|
private readonly webhookHandler;
|
|
51
52
|
private readonly responseFormatter;
|
|
52
53
|
private readonly connection;
|
|
53
54
|
private readonly rooms;
|
|
55
|
+
private readonly roomManagement;
|
|
56
|
+
private readonly agentRoom;
|
|
54
57
|
private readonly agents;
|
|
55
58
|
private readonly messages;
|
|
59
|
+
private readonly _admin;
|
|
56
60
|
/**
|
|
57
61
|
* Creates a new instance of the Teneo Protocol SDK.
|
|
58
62
|
* Initializes all core components, managers, and validates the provided configuration.
|
|
@@ -103,7 +107,7 @@ export declare class TeneoSDK extends EventEmitter<SDKEvents> {
|
|
|
103
107
|
*/
|
|
104
108
|
constructor(config: PartialSDKConfig);
|
|
105
109
|
/**
|
|
106
|
-
* Establishes a connection to the Teneo
|
|
110
|
+
* Establishes a connection to the Teneo Protocol via WebSocket.
|
|
107
111
|
* Handles authentication automatically and joins any configured auto-join rooms.
|
|
108
112
|
* Emits 'connection:open', 'auth:success', and 'ready' events on successful connection.
|
|
109
113
|
*
|
|
@@ -116,19 +120,19 @@ export declare class TeneoSDK extends EventEmitter<SDKEvents> {
|
|
|
116
120
|
* ```typescript
|
|
117
121
|
* const sdk = new TeneoSDK({ wsUrl: 'wss://example.com', privateKey: '0x...' });
|
|
118
122
|
* await sdk.connect();
|
|
119
|
-
* console.log('Connected to Teneo
|
|
123
|
+
* console.log('Connected to Teneo Protocol');
|
|
120
124
|
* ```
|
|
121
125
|
*/
|
|
122
126
|
connect(): Promise<void>;
|
|
123
127
|
/**
|
|
124
|
-
* Disconnects from the Teneo
|
|
128
|
+
* Disconnects from the Teneo Protocol and cleans up all active connections.
|
|
125
129
|
* Clears all timers, pending messages, and stops automatic reconnection attempts.
|
|
126
130
|
* Emits 'disconnect' event after disconnection is complete.
|
|
127
131
|
*
|
|
128
132
|
* @example
|
|
129
133
|
* ```typescript
|
|
130
134
|
* sdk.disconnect();
|
|
131
|
-
* console.log('Disconnected from Teneo
|
|
135
|
+
* console.log('Disconnected from Teneo Protocol');
|
|
132
136
|
* ```
|
|
133
137
|
*/
|
|
134
138
|
disconnect(): void;
|
|
@@ -188,36 +192,59 @@ export declare class TeneoSDK extends EventEmitter<SDKEvents> {
|
|
|
188
192
|
*/
|
|
189
193
|
sendDirectCommand(command: AgentCommand, waitForResponse?: boolean): Promise<FormattedResponse | void>;
|
|
190
194
|
/**
|
|
191
|
-
*
|
|
192
|
-
*
|
|
195
|
+
* Requests a quote for a task from the coordinator.
|
|
196
|
+
* The quote includes agent selection, pricing, and expiration.
|
|
197
|
+
* Does NOT auto-approve - use confirmQuote() to execute.
|
|
198
|
+
*/
|
|
199
|
+
requestQuote(content: string, room: string): Promise<QuoteResult>;
|
|
200
|
+
/**
|
|
201
|
+
* Confirms a pending quote and executes the task with payment.
|
|
202
|
+
* Attaches x402 payment header if payment client is configured.
|
|
203
|
+
*/
|
|
204
|
+
confirmQuote(taskId: string, options?: {
|
|
205
|
+
waitForResponse?: boolean;
|
|
206
|
+
timeout?: number;
|
|
207
|
+
}): Promise<FormattedResponse | void>;
|
|
208
|
+
/**
|
|
209
|
+
* Gets a pending quote by task ID.
|
|
210
|
+
*/
|
|
211
|
+
getPendingQuote(taskId: string): QuoteResult | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* Subscribes to a public room in the Teneo Protocol.
|
|
214
|
+
* This is only needed for public rooms - private rooms are automatically subscribed.
|
|
193
215
|
* Emits 'room:subscribed' event when successfully subscribed.
|
|
194
216
|
*
|
|
195
|
-
* @param roomId - The ID of the room to subscribe to
|
|
217
|
+
* @param roomId - The ID of the public room to subscribe to
|
|
196
218
|
* @returns Promise that resolves when the room has been subscribed
|
|
197
219
|
* @throws {SDKError} If not connected to the network (ErrorCode.NOT_CONNECTED)
|
|
198
220
|
* @throws {ValidationError} If roomId is empty or invalid
|
|
199
221
|
*
|
|
200
222
|
* @example
|
|
201
223
|
* ```typescript
|
|
202
|
-
*
|
|
203
|
-
*
|
|
224
|
+
* // Subscribe to a public room
|
|
225
|
+
* await sdk.subscribeToRoom('public-announcements');
|
|
226
|
+
* console.log('Subscribed to public room');
|
|
227
|
+
*
|
|
228
|
+
* // Note: Private rooms don't need subscription - you're always subscribed
|
|
204
229
|
* ```
|
|
205
230
|
*/
|
|
206
231
|
subscribeToRoom(roomId: string): Promise<void>;
|
|
207
232
|
/**
|
|
208
|
-
* Unsubscribes from a
|
|
209
|
-
* You will no longer receive messages from
|
|
233
|
+
* Unsubscribes from a public room in the Teneo Protocol.
|
|
234
|
+
* You will no longer receive messages from this public room.
|
|
210
235
|
* Emits 'room:unsubscribed' event when successfully unsubscribed.
|
|
211
236
|
*
|
|
212
|
-
*
|
|
237
|
+
* Note: This only applies to public rooms. Private rooms cannot be unsubscribed from.
|
|
238
|
+
*
|
|
239
|
+
* @param roomId - The ID of the public room to unsubscribe from
|
|
213
240
|
* @returns Promise that resolves when the room has been unsubscribed
|
|
214
241
|
* @throws {SDKError} If not connected to the network (ErrorCode.NOT_CONNECTED)
|
|
215
242
|
* @throws {ValidationError} If roomId is empty or invalid
|
|
216
243
|
*
|
|
217
244
|
* @example
|
|
218
245
|
* ```typescript
|
|
219
|
-
* await sdk.unsubscribeFromRoom('
|
|
220
|
-
* console.log('Unsubscribed from
|
|
246
|
+
* await sdk.unsubscribeFromRoom('public-announcements');
|
|
247
|
+
* console.log('Unsubscribed from public room');
|
|
221
248
|
* ```
|
|
222
249
|
*/
|
|
223
250
|
unsubscribeFromRoom(roomId: string): Promise<void>;
|
|
@@ -254,7 +281,7 @@ export declare class TeneoSDK extends EventEmitter<SDKEvents> {
|
|
|
254
281
|
*/
|
|
255
282
|
getSubscribedRooms(): string[];
|
|
256
283
|
/**
|
|
257
|
-
* Gets a list of all available agents in the Teneo
|
|
284
|
+
* Gets a list of all available agents in the Teneo Protocol.
|
|
258
285
|
* The list is automatically updated when new agents join or leave.
|
|
259
286
|
* Returns a read-only array to prevent external modification.
|
|
260
287
|
*
|
|
@@ -349,7 +376,71 @@ export declare class TeneoSDK extends EventEmitter<SDKEvents> {
|
|
|
349
376
|
*/
|
|
350
377
|
findAgentsByStatus(status: string): ReadonlyArray<Agent>;
|
|
351
378
|
/**
|
|
352
|
-
*
|
|
379
|
+
* Fetches detailed information about a specific agent from the server.
|
|
380
|
+
* Makes a request to the server for full agent details including capabilities,
|
|
381
|
+
* commands, pricing, and more.
|
|
382
|
+
*
|
|
383
|
+
* @param agentId - The unique identifier of the agent
|
|
384
|
+
* @returns Promise that resolves with full agent details
|
|
385
|
+
* @throws {SDKError} If not connected or request times out
|
|
386
|
+
* @throws {ValidationError} If agentId is invalid
|
|
387
|
+
*
|
|
388
|
+
* @example
|
|
389
|
+
* ```typescript
|
|
390
|
+
* const details = await sdk.getAgentDetails('weather-agent-001');
|
|
391
|
+
* console.log(`Agent: ${details.agent_name}`);
|
|
392
|
+
* console.log(`Capabilities: ${details.capabilities?.length}`);
|
|
393
|
+
* console.log(`Status: ${details.status}`);
|
|
394
|
+
* ```
|
|
395
|
+
*/
|
|
396
|
+
getAgentDetails(agentId: string): Promise<AgentRoomInfo>;
|
|
397
|
+
/**
|
|
398
|
+
* Gets the admin manager for admin-only features.
|
|
399
|
+
* Returns undefined if the current user is not an admin.
|
|
400
|
+
* Use this to access admin APIs like listing all agents, user counts, etc.
|
|
401
|
+
*
|
|
402
|
+
* @returns The AdminManager instance if user is admin, undefined otherwise
|
|
403
|
+
*
|
|
404
|
+
* @example
|
|
405
|
+
* ```typescript
|
|
406
|
+
* if (sdk.admin?.isAdmin) {
|
|
407
|
+
* // List all agents in the network
|
|
408
|
+
* const result = await sdk.admin.listAllAgents({ limit: 20 });
|
|
409
|
+
* console.log(`Found ${result.total} agents`);
|
|
410
|
+
*
|
|
411
|
+
* result.agents.forEach(agent => {
|
|
412
|
+
* console.log(`${agent.agent_name}: verified=${agent.is_verified}, banned=${agent.is_banned}`);
|
|
413
|
+
* });
|
|
414
|
+
*
|
|
415
|
+
* // Get user count
|
|
416
|
+
* const userCount = sdk.admin.getLastUserCount();
|
|
417
|
+
* console.log(`Online users: ${userCount?.count}`);
|
|
418
|
+
*
|
|
419
|
+
* // Listen for user count updates
|
|
420
|
+
* sdk.admin.on('user_count', (data) => {
|
|
421
|
+
* console.log(`User count updated: ${data.count}`);
|
|
422
|
+
* });
|
|
423
|
+
* }
|
|
424
|
+
* ```
|
|
425
|
+
*/
|
|
426
|
+
get admin(): AdminManager | undefined;
|
|
427
|
+
/**
|
|
428
|
+
* Lists all agents in the network (admin only, convenience method).
|
|
429
|
+
* Returns paginated list of agents with full admin information.
|
|
430
|
+
*
|
|
431
|
+
* @param options - Pagination and filter options
|
|
432
|
+
* @returns Promise that resolves with agents list
|
|
433
|
+
* @throws {SDKError} If not connected or not an admin
|
|
434
|
+
*
|
|
435
|
+
* @example
|
|
436
|
+
* ```typescript
|
|
437
|
+
* const result = await sdk.listAllAgents({ limit: 50, filter: 'weather' });
|
|
438
|
+
* console.log(`Found ${result.total} agents matching 'weather'`);
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
441
|
+
listAllAgents(options?: ListAllAgentsOptions): Promise<AllAgentsResult>;
|
|
442
|
+
/**
|
|
443
|
+
* Gets a list of all available rooms in the Teneo Protocol.
|
|
353
444
|
* Includes rooms you have access to based on your authentication.
|
|
354
445
|
* Returns a read-only array to prevent external modification.
|
|
355
446
|
*
|
|
@@ -364,7 +455,7 @@ export declare class TeneoSDK extends EventEmitter<SDKEvents> {
|
|
|
364
455
|
* });
|
|
365
456
|
* ```
|
|
366
457
|
*/
|
|
367
|
-
getRooms(): ReadonlyArray<
|
|
458
|
+
getRooms(): ReadonlyArray<RoomInfo>;
|
|
368
459
|
/**
|
|
369
460
|
* Gets a specific room by its unique ID.
|
|
370
461
|
* Returns undefined if no room with the specified ID exists or if you don't have access.
|
|
@@ -383,7 +474,343 @@ export declare class TeneoSDK extends EventEmitter<SDKEvents> {
|
|
|
383
474
|
* }
|
|
384
475
|
* ```
|
|
385
476
|
*/
|
|
386
|
-
getRoom(roomId: string):
|
|
477
|
+
getRoom(roomId: string): RoomInfo | undefined;
|
|
478
|
+
/**
|
|
479
|
+
* Creates a new private or public room.
|
|
480
|
+
* Checks room limit before creating (for private rooms).
|
|
481
|
+
* Emits 'room:created' event on success, 'room:create_error' on failure.
|
|
482
|
+
*
|
|
483
|
+
* @param options - Room creation options
|
|
484
|
+
* @param options.name - Room name (1-100 characters)
|
|
485
|
+
* @param options.description - Optional room description (max 500 characters)
|
|
486
|
+
* @param options.isPublic - Whether room is public (default: false)
|
|
487
|
+
* @returns Promise that resolves with created room info
|
|
488
|
+
* @throws {SDKError} If not connected, over limit, or validation fails
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* ```typescript
|
|
492
|
+
* const room = await sdk.createRoom({
|
|
493
|
+
* name: 'My Project Room',
|
|
494
|
+
* description: 'Collaboration space for my project',
|
|
495
|
+
* isPublic: false
|
|
496
|
+
* });
|
|
497
|
+
* console.log(`Created room: ${room.id}`);
|
|
498
|
+
* ```
|
|
499
|
+
*/
|
|
500
|
+
createRoom(options: {
|
|
501
|
+
name: string;
|
|
502
|
+
description?: string;
|
|
503
|
+
isPublic?: boolean;
|
|
504
|
+
}): Promise<RoomInfo>;
|
|
505
|
+
/**
|
|
506
|
+
* Updates an existing room's name and/or description.
|
|
507
|
+
* User must own the room to update it.
|
|
508
|
+
* Emits 'room:updated' event on success, 'room:update_error' on failure.
|
|
509
|
+
*
|
|
510
|
+
* @param roomId - ID of room to update
|
|
511
|
+
* @param updates - Fields to update
|
|
512
|
+
* @param updates.name - New room name (1-100 characters)
|
|
513
|
+
* @param updates.description - New room description (max 500 characters)
|
|
514
|
+
* @returns Promise that resolves with updated room info
|
|
515
|
+
* @throws {SDKError} If not connected, not owner, or validation fails
|
|
516
|
+
*
|
|
517
|
+
* @example
|
|
518
|
+
* ```typescript
|
|
519
|
+
* const room = await sdk.updateRoom('room-123', {
|
|
520
|
+
* name: 'Updated Room Name',
|
|
521
|
+
* description: 'New description'
|
|
522
|
+
* });
|
|
523
|
+
* ```
|
|
524
|
+
*/
|
|
525
|
+
updateRoom(roomId: string, updates: {
|
|
526
|
+
name?: string;
|
|
527
|
+
description?: string;
|
|
528
|
+
}): Promise<RoomInfo>;
|
|
529
|
+
/**
|
|
530
|
+
* Deletes a room permanently.
|
|
531
|
+
* User must own the room to delete it.
|
|
532
|
+
* Emits 'room:deleted' event on success, 'room:delete_error' on failure.
|
|
533
|
+
*
|
|
534
|
+
* @param roomId - ID of room to delete
|
|
535
|
+
* @returns Promise that resolves when room is deleted
|
|
536
|
+
* @throws {SDKError} If not connected or not owner
|
|
537
|
+
*
|
|
538
|
+
* @example
|
|
539
|
+
* ```typescript
|
|
540
|
+
* await sdk.deleteRoom('room-123');
|
|
541
|
+
* console.log('Room deleted successfully');
|
|
542
|
+
* ```
|
|
543
|
+
*/
|
|
544
|
+
deleteRoom(roomId: string): Promise<void>;
|
|
545
|
+
/**
|
|
546
|
+
* Gets all rooms owned by the current user.
|
|
547
|
+
* Synchronous method that returns cached data from authentication.
|
|
548
|
+
*
|
|
549
|
+
* @returns Array of owned room info
|
|
550
|
+
*
|
|
551
|
+
* @example
|
|
552
|
+
* ```typescript
|
|
553
|
+
* const myRooms = sdk.getOwnedRooms();
|
|
554
|
+
* console.log(`I own ${myRooms.length} rooms`);
|
|
555
|
+
* myRooms.forEach(room => {
|
|
556
|
+
* console.log(`- ${room.name} (${room.id})`);
|
|
557
|
+
* });
|
|
558
|
+
* ```
|
|
559
|
+
*/
|
|
560
|
+
getOwnedRooms(): ReadonlyArray<Readonly<RoomInfo>>;
|
|
561
|
+
/**
|
|
562
|
+
* Gets all rooms the user is a member of (but doesn't own).
|
|
563
|
+
* Synchronous method that returns cached data from authentication.
|
|
564
|
+
*
|
|
565
|
+
* @returns Array of shared room info
|
|
566
|
+
*
|
|
567
|
+
* @example
|
|
568
|
+
* ```typescript
|
|
569
|
+
* const sharedRooms = sdk.getSharedRooms();
|
|
570
|
+
* console.log(`I'm a member of ${sharedRooms.length} shared rooms`);
|
|
571
|
+
* ```
|
|
572
|
+
*/
|
|
573
|
+
getSharedRooms(): ReadonlyArray<Readonly<RoomInfo>>;
|
|
574
|
+
/**
|
|
575
|
+
* Gets all rooms the user has access to (both owned and shared).
|
|
576
|
+
* Convenience method that combines getOwnedRooms() and getSharedRooms().
|
|
577
|
+
* Synchronous method that returns cached data from authentication.
|
|
578
|
+
*
|
|
579
|
+
* @returns Array of all room info (owned + shared)
|
|
580
|
+
*
|
|
581
|
+
* @example
|
|
582
|
+
* ```typescript
|
|
583
|
+
* const allRooms = sdk.getAllRooms();
|
|
584
|
+
* console.log(`I have access to ${allRooms.length} total rooms`);
|
|
585
|
+
*
|
|
586
|
+
* // You can filter by ownership if needed
|
|
587
|
+
* const myRooms = allRooms.filter(r => r.is_owner);
|
|
588
|
+
* const sharedWithMe = allRooms.filter(r => !r.is_owner);
|
|
589
|
+
* ```
|
|
590
|
+
*/
|
|
591
|
+
getAllRooms(): ReadonlyArray<Readonly<RoomInfo>>;
|
|
592
|
+
/**
|
|
593
|
+
* Gets the maximum number of private rooms the user can create.
|
|
594
|
+
* Based on user's subscription/plan.
|
|
595
|
+
*
|
|
596
|
+
* @returns Maximum private room limit
|
|
597
|
+
*
|
|
598
|
+
* @example
|
|
599
|
+
* ```typescript
|
|
600
|
+
* const limit = sdk.getRoomLimit();
|
|
601
|
+
* const current = sdk.getOwnedRoomCount();
|
|
602
|
+
* console.log(`Using ${current}/${limit} room slots`);
|
|
603
|
+
* ```
|
|
604
|
+
*/
|
|
605
|
+
getRoomLimit(): number;
|
|
606
|
+
/**
|
|
607
|
+
* Gets the current count of owned private rooms.
|
|
608
|
+
*
|
|
609
|
+
* @returns Number of rooms user owns
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* ```typescript
|
|
613
|
+
* const count = sdk.getOwnedRoomCount();
|
|
614
|
+
* if (sdk.canCreateRoom()) {
|
|
615
|
+
* console.log(`Can create ${sdk.getRoomLimit() - count} more rooms`);
|
|
616
|
+
* }
|
|
617
|
+
* ```
|
|
618
|
+
*/
|
|
619
|
+
getOwnedRoomCount(): number;
|
|
620
|
+
/**
|
|
621
|
+
* Checks if user can create another private room.
|
|
622
|
+
* Compares current owned room count against limit.
|
|
623
|
+
*
|
|
624
|
+
* @returns True if under limit, false otherwise
|
|
625
|
+
*
|
|
626
|
+
* @example
|
|
627
|
+
* ```typescript
|
|
628
|
+
* if (sdk.canCreateRoom()) {
|
|
629
|
+
* await sdk.createRoom({ name: 'New Room' });
|
|
630
|
+
* } else {
|
|
631
|
+
* console.log('Room limit reached! Upgrade your plan.');
|
|
632
|
+
* }
|
|
633
|
+
* ```
|
|
634
|
+
*/
|
|
635
|
+
canCreateRoom(): boolean;
|
|
636
|
+
/**
|
|
637
|
+
* Adds an agent to a room. Only room owners can add agents.
|
|
638
|
+
* Emits 'agent_room:agent_added' on success, 'agent_room:add_error' on failure.
|
|
639
|
+
*
|
|
640
|
+
* @param roomId - ID of the room to add the agent to
|
|
641
|
+
* @param agentId - ID of the agent to add
|
|
642
|
+
* @returns Promise that resolves when agent is added
|
|
643
|
+
* @throws {SDKError} If not connected, not owner, or agent already in room
|
|
644
|
+
*
|
|
645
|
+
* @example
|
|
646
|
+
* ```typescript
|
|
647
|
+
* await sdk.addAgentToRoom('room-123', 'weather-agent');
|
|
648
|
+
* console.log('Agent added to room');
|
|
649
|
+
* ```
|
|
650
|
+
*/
|
|
651
|
+
addAgentToRoom(roomId: string, agentId: string): Promise<void>;
|
|
652
|
+
/**
|
|
653
|
+
* Removes an agent from a room. Only room owners can remove agents.
|
|
654
|
+
* Emits 'agent_room:agent_removed' on success, 'agent_room:remove_error' on failure.
|
|
655
|
+
*
|
|
656
|
+
* @param roomId - ID of the room to remove the agent from
|
|
657
|
+
* @param agentId - ID of the agent to remove
|
|
658
|
+
* @returns Promise that resolves when agent is removed
|
|
659
|
+
* @throws {SDKError} If not connected, not owner, or agent not in room
|
|
660
|
+
*
|
|
661
|
+
* @example
|
|
662
|
+
* ```typescript
|
|
663
|
+
* await sdk.removeAgentFromRoom('room-123', 'weather-agent');
|
|
664
|
+
* console.log('Agent removed from room');
|
|
665
|
+
* ```
|
|
666
|
+
*/
|
|
667
|
+
removeAgentFromRoom(roomId: string, agentId: string): Promise<void>;
|
|
668
|
+
/**
|
|
669
|
+
* Lists all agents in a room.
|
|
670
|
+
* Results are cached for 5 minutes for performance.
|
|
671
|
+
* Emits 'agent_room:agents_listed' when list is received.
|
|
672
|
+
*
|
|
673
|
+
* @param roomId - ID of the room to list agents for
|
|
674
|
+
* @param useCache - Whether to use cached data if available (default: true)
|
|
675
|
+
* @returns Promise that resolves to array of agents in the room
|
|
676
|
+
* @throws {SDKError} If not connected
|
|
677
|
+
*
|
|
678
|
+
* @example
|
|
679
|
+
* ```typescript
|
|
680
|
+
* const agents = await sdk.listRoomAgents('room-123');
|
|
681
|
+
* console.log(`Room has ${agents.length} agents`);
|
|
682
|
+
* agents.forEach(agent => {
|
|
683
|
+
* console.log(`- ${agent.agent_name} (${agent.status})`);
|
|
684
|
+
* });
|
|
685
|
+
* ```
|
|
686
|
+
*/
|
|
687
|
+
listRoomAgents(roomId: string, useCache?: boolean): Promise<any[]>;
|
|
688
|
+
/**
|
|
689
|
+
* Lists all agents available to be added to a room.
|
|
690
|
+
* Shows agents not currently in the room.
|
|
691
|
+
* Results are cached for 5 minutes for performance.
|
|
692
|
+
* Emits 'agent_room:available_agents_listed' when list is received.
|
|
693
|
+
*
|
|
694
|
+
* @param roomId - ID of the room to check available agents for
|
|
695
|
+
* @param useCache - Whether to use cached data if available (default: true)
|
|
696
|
+
* @returns Promise that resolves to array of available agents
|
|
697
|
+
* @throws {SDKError} If not connected
|
|
698
|
+
*
|
|
699
|
+
* @example
|
|
700
|
+
* ```typescript
|
|
701
|
+
* const available = await sdk.listAvailableAgents('room-123');
|
|
702
|
+
* console.log(`${available.length} agents available to add`);
|
|
703
|
+
* ```
|
|
704
|
+
*/
|
|
705
|
+
listAvailableAgents(roomId: string, useCache?: boolean): Promise<any[]>;
|
|
706
|
+
/**
|
|
707
|
+
* Gets agents in a room from cache (synchronous).
|
|
708
|
+
* Returns undefined if not cached. Use listRoomAgents() to fetch.
|
|
709
|
+
*
|
|
710
|
+
* @param roomId - ID of the room
|
|
711
|
+
* @returns Array of agents if cached, undefined otherwise
|
|
712
|
+
*
|
|
713
|
+
* @example
|
|
714
|
+
* ```typescript
|
|
715
|
+
* const agents = sdk.getRoomAgents('room-123');
|
|
716
|
+
* if (agents) {
|
|
717
|
+
* console.log(`${agents.length} agents (cached)`);
|
|
718
|
+
* } else {
|
|
719
|
+
* await sdk.listRoomAgents('room-123'); // Fetch from server
|
|
720
|
+
* }
|
|
721
|
+
* ```
|
|
722
|
+
*/
|
|
723
|
+
getRoomAgents(roomId: string): any[] | undefined;
|
|
724
|
+
/**
|
|
725
|
+
* Gets available agents for a room from cache (synchronous).
|
|
726
|
+
* Returns undefined if not cached. Use listAvailableAgents() to fetch.
|
|
727
|
+
*
|
|
728
|
+
* @param roomId - ID of the room
|
|
729
|
+
* @returns Array of available agents if cached, undefined otherwise
|
|
730
|
+
*
|
|
731
|
+
* @example
|
|
732
|
+
* ```typescript
|
|
733
|
+
* const available = sdk.getAvailableAgents('room-123');
|
|
734
|
+
* if (available) {
|
|
735
|
+
* console.log(`${available.length} agents available (cached)`);
|
|
736
|
+
* }
|
|
737
|
+
* ```
|
|
738
|
+
*/
|
|
739
|
+
getAvailableAgents(roomId: string): any[] | undefined;
|
|
740
|
+
/**
|
|
741
|
+
* Checks if an agent is in a room (synchronous, from cache).
|
|
742
|
+
* Returns undefined if room data not cached.
|
|
743
|
+
*
|
|
744
|
+
* @param roomId - ID of the room
|
|
745
|
+
* @param agentId - ID of the agent
|
|
746
|
+
* @returns True if agent is in room, false if not, undefined if not cached
|
|
747
|
+
*
|
|
748
|
+
* @example
|
|
749
|
+
* ```typescript
|
|
750
|
+
* const inRoom = sdk.isAgentInRoom('room-123', 'weather-agent');
|
|
751
|
+
* if (inRoom === true) {
|
|
752
|
+
* console.log('Agent is in room');
|
|
753
|
+
* } else if (inRoom === false) {
|
|
754
|
+
* console.log('Agent is not in room');
|
|
755
|
+
* } else {
|
|
756
|
+
* console.log('Room data not cached');
|
|
757
|
+
* }
|
|
758
|
+
* ```
|
|
759
|
+
*/
|
|
760
|
+
isAgentInRoom(roomId: string, agentId: string): boolean | undefined;
|
|
761
|
+
/**
|
|
762
|
+
* Gets the count of agents in a room (synchronous, from cache).
|
|
763
|
+
* Returns undefined if room data not cached.
|
|
764
|
+
*
|
|
765
|
+
* @param roomId - ID of the room
|
|
766
|
+
* @returns Number of agents in room, or undefined if not cached
|
|
767
|
+
*
|
|
768
|
+
* @example
|
|
769
|
+
* ```typescript
|
|
770
|
+
* const count = sdk.getRoomAgentCount('room-123');
|
|
771
|
+
* if (count !== undefined) {
|
|
772
|
+
* console.log(`Room has ${count} agents`);
|
|
773
|
+
* }
|
|
774
|
+
* ```
|
|
775
|
+
*/
|
|
776
|
+
getRoomAgentCount(roomId: string): number | undefined;
|
|
777
|
+
/**
|
|
778
|
+
* Invalidates the agent-room cache for a specific room.
|
|
779
|
+
* Forces the next listRoomAgents() or listAvailableAgents() call to fetch fresh data.
|
|
780
|
+
* Useful after bulk operations or when you know the cache is stale.
|
|
781
|
+
*
|
|
782
|
+
* @param roomId - ID of the room to invalidate cache for
|
|
783
|
+
*
|
|
784
|
+
* @example
|
|
785
|
+
* ```typescript
|
|
786
|
+
* // After adding/removing agents
|
|
787
|
+
* await sdk.addAgentToRoom('room-123', 'agent-456');
|
|
788
|
+
* sdk.invalidateAgentRoomCache('room-123');
|
|
789
|
+
* const freshAgents = await sdk.listRoomAgents('room-123');
|
|
790
|
+
* ```
|
|
791
|
+
*/
|
|
792
|
+
invalidateAgentRoomCache(roomId: string): void;
|
|
793
|
+
/**
|
|
794
|
+
* Updates user preferences on the server.
|
|
795
|
+
* Server-side enforcement of max price per request - prevents quotes/payments exceeding the limit.
|
|
796
|
+
*
|
|
797
|
+
* @param preferences - User preferences to update
|
|
798
|
+
* @param preferences.maxPricePerRequest - Max price per request in USDC (e.g., 0.01 = $0.01), or null to remove limit
|
|
799
|
+
* @returns Promise that resolves when preferences are updated
|
|
800
|
+
* @throws {SDKError} If update fails or times out
|
|
801
|
+
*
|
|
802
|
+
* @example
|
|
803
|
+
* ```typescript
|
|
804
|
+
* // Set a spending limit of $0.05 per request
|
|
805
|
+
* await sdk.setUserPreferences({ maxPricePerRequest: 0.05 });
|
|
806
|
+
*
|
|
807
|
+
* // Remove the spending limit
|
|
808
|
+
* await sdk.setUserPreferences({ maxPricePerRequest: null });
|
|
809
|
+
* ```
|
|
810
|
+
*/
|
|
811
|
+
setUserPreferences(preferences: {
|
|
812
|
+
maxPricePerRequest?: number | null;
|
|
813
|
+
}): Promise<void>;
|
|
387
814
|
/**
|
|
388
815
|
* Configures webhook URL and headers for receiving real-time event notifications.
|
|
389
816
|
* Webhooks allow you to receive events at your server endpoint via HTTP POST requests.
|
|
@@ -470,25 +897,28 @@ export declare class TeneoSDK extends EventEmitter<SDKEvents> {
|
|
|
470
897
|
isWhitelisted?: boolean | undefined;
|
|
471
898
|
isAdmin?: boolean | undefined;
|
|
472
899
|
nftVerified?: boolean | undefined;
|
|
473
|
-
roomObjects?: {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
created_by:
|
|
479
|
-
created_at:
|
|
480
|
-
updated_at:
|
|
481
|
-
|
|
482
|
-
}[] | undefined;
|
|
900
|
+
roomObjects?: z.objectOutputType<{
|
|
901
|
+
id: z.ZodString;
|
|
902
|
+
name: z.ZodOptional<z.ZodString>;
|
|
903
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
904
|
+
is_public: z.ZodOptional<z.ZodBoolean>;
|
|
905
|
+
created_by: z.ZodOptional<z.ZodString>;
|
|
906
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
907
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
908
|
+
is_owner: z.ZodOptional<z.ZodBoolean>;
|
|
909
|
+
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
483
910
|
privateRoomId?: string | undefined;
|
|
484
911
|
challengeTimestamp?: number | undefined;
|
|
912
|
+
privateRoomIds?: string[] | undefined;
|
|
913
|
+
sharedRoomIds?: string[] | undefined;
|
|
914
|
+
maxPrivateRooms?: number | undefined;
|
|
485
915
|
};
|
|
486
916
|
/**
|
|
487
917
|
* Quick check for whether the WebSocket connection is currently active.
|
|
488
918
|
* This is a convenience getter that returns only the connection status.
|
|
489
919
|
* For detailed state information, use getConnectionState().
|
|
490
920
|
*
|
|
491
|
-
* @returns True if connected to the Teneo
|
|
921
|
+
* @returns True if connected to the Teneo Protocol, false otherwise
|
|
492
922
|
*
|
|
493
923
|
* @example
|
|
494
924
|
* ```typescript
|
|
@@ -506,7 +936,7 @@ export declare class TeneoSDK extends EventEmitter<SDKEvents> {
|
|
|
506
936
|
* This is a convenience getter that returns only the authentication status.
|
|
507
937
|
* For detailed auth information, use getAuthState().
|
|
508
938
|
*
|
|
509
|
-
* @returns True if authenticated with the Teneo
|
|
939
|
+
* @returns True if authenticated with the Teneo Protocol, false otherwise
|
|
510
940
|
*
|
|
511
941
|
* @example
|
|
512
942
|
* ```typescript
|
|
@@ -706,6 +1136,10 @@ export declare class TeneoSDK extends EventEmitter<SDKEvents> {
|
|
|
706
1136
|
* Create default logger using pino
|
|
707
1137
|
*/
|
|
708
1138
|
private createDefaultLogger;
|
|
1139
|
+
/**
|
|
1140
|
+
* Derive wallet address from private key
|
|
1141
|
+
*/
|
|
1142
|
+
private deriveWalletAddress;
|
|
709
1143
|
/**
|
|
710
1144
|
* Creates a new SDK configuration builder for fluent configuration.
|
|
711
1145
|
* The builder pattern provides a more intuitive way to configure the SDK
|
package/dist/teneo-sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teneo-sdk.d.ts","sourceRoot":"","sources":["../src/teneo-sdk.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"teneo-sdk.d.ts","sourceRoot":"","sources":["../src/teneo-sdk.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAEL,gBAAgB,EAEhB,gBAAgB,EAChB,KAAK,EACL,QAAQ,EAKR,aAAa,EACb,KAAK,YAAY,EAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAY,MAAM,gBAAgB,CAAC;AAIrD,OAAO,EAEL,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAOL,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,eAAe,EAChB,MAAM,YAAY,CAAC;AAMpB,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,eAAe,EAChB,CAAC;AAGF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;EAMnC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAI7B,CAAC;AAEH,qBAAa,QAAS,SAAQ,YAAY,CAAC,SAAS,CAAC;IACnD,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAA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