@elizaos/core 1.5.3-beta.3 → 1.5.5-alpha.10

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 (181) hide show
  1. package/dist/actions.d.ts +23 -0
  2. package/dist/actions.d.ts.map +1 -0
  3. package/dist/browser/index.browser.js +172 -179
  4. package/dist/browser/index.browser.js.map +6 -197
  5. package/dist/browser/index.d.ts +2 -2
  6. package/dist/database.d.ts +481 -0
  7. package/dist/database.d.ts.map +1 -0
  8. package/dist/entities.d.ts +49 -0
  9. package/dist/entities.d.ts.map +1 -0
  10. package/{src/index.browser.ts → dist/index.browser.d.ts} +9 -21
  11. package/dist/index.browser.d.ts.map +1 -0
  12. package/dist/index.d.ts +27 -3
  13. package/dist/index.d.ts.map +1 -0
  14. package/{src/index.node.ts → dist/index.node.d.ts} +3 -16
  15. package/dist/index.node.d.ts.map +1 -0
  16. package/dist/logger.d.ts +47 -0
  17. package/dist/logger.d.ts.map +1 -0
  18. package/dist/node/index.d.ts +2 -2
  19. package/dist/node/index.node.js +15514 -439
  20. package/dist/node/index.node.js.map +139 -8
  21. package/dist/prompts.d.ts +8 -0
  22. package/dist/prompts.d.ts.map +1 -0
  23. package/dist/roles.d.ts +30 -0
  24. package/dist/roles.d.ts.map +1 -0
  25. package/dist/runtime.d.ts +328 -0
  26. package/dist/runtime.d.ts.map +1 -0
  27. package/dist/schemas/character.d.ts +228 -0
  28. package/dist/schemas/character.d.ts.map +1 -0
  29. package/dist/search.d.ts +317 -0
  30. package/dist/search.d.ts.map +1 -0
  31. package/dist/sentry/instrument.browser.d.ts +12 -0
  32. package/dist/sentry/instrument.browser.d.ts.map +1 -0
  33. package/dist/sentry/instrument.d.ts +12 -0
  34. package/dist/sentry/instrument.d.ts.map +1 -0
  35. package/dist/sentry/instrument.node.d.ts +11 -0
  36. package/dist/sentry/instrument.node.d.ts.map +1 -0
  37. package/dist/services.d.ts +49 -0
  38. package/dist/services.d.ts.map +1 -0
  39. package/dist/settings.d.ts +87 -0
  40. package/dist/settings.d.ts.map +1 -0
  41. package/{src/types/agent.ts → dist/types/agent.d.ts} +60 -74
  42. package/dist/types/agent.d.ts.map +1 -0
  43. package/dist/types/browser.d.ts +127 -0
  44. package/dist/types/browser.d.ts.map +1 -0
  45. package/dist/types/components.d.ts +135 -0
  46. package/dist/types/components.d.ts.map +1 -0
  47. package/dist/types/database.d.ts +278 -0
  48. package/dist/types/database.d.ts.map +1 -0
  49. package/dist/types/email.d.ts +143 -0
  50. package/dist/types/email.d.ts.map +1 -0
  51. package/dist/types/environment.d.ts +109 -0
  52. package/dist/types/environment.d.ts.map +1 -0
  53. package/dist/types/events.d.ts +207 -0
  54. package/dist/types/events.d.ts.map +1 -0
  55. package/{src/types/index.ts → dist/types/index.d.ts} +1 -0
  56. package/dist/types/index.d.ts.map +1 -0
  57. package/{src/types/knowledge.ts → dist/types/knowledge.d.ts} +18 -23
  58. package/dist/types/knowledge.d.ts.map +1 -0
  59. package/dist/types/lp.d.ts +115 -0
  60. package/dist/types/lp.d.ts.map +1 -0
  61. package/{src/types/memory.ts → dist/types/memory.d.ts} +69 -132
  62. package/dist/types/memory.d.ts.map +1 -0
  63. package/dist/types/message.d.ts +202 -0
  64. package/dist/types/message.d.ts.map +1 -0
  65. package/dist/types/messaging.d.ts +45 -0
  66. package/dist/types/messaging.d.ts.map +1 -0
  67. package/dist/types/model.d.ts +319 -0
  68. package/dist/types/model.d.ts.map +1 -0
  69. package/dist/types/pdf.d.ts +68 -0
  70. package/dist/types/pdf.d.ts.map +1 -0
  71. package/dist/types/plugin.d.ts +64 -0
  72. package/dist/types/plugin.d.ts.map +1 -0
  73. package/dist/types/post.d.ts +242 -0
  74. package/dist/types/post.d.ts.map +1 -0
  75. package/dist/types/primitives.d.ts +72 -0
  76. package/dist/types/primitives.d.ts.map +1 -0
  77. package/dist/types/runtime.d.ts +106 -0
  78. package/dist/types/runtime.d.ts.map +1 -0
  79. package/{src/types/service.ts → dist/types/service.d.ts} +69 -120
  80. package/dist/types/service.d.ts.map +1 -0
  81. package/dist/types/settings.d.ts +30 -0
  82. package/dist/types/settings.d.ts.map +1 -0
  83. package/{src/types/state.ts → dist/types/state.d.ts} +18 -19
  84. package/dist/types/state.d.ts.map +1 -0
  85. package/dist/types/task.d.ts +68 -0
  86. package/dist/types/task.d.ts.map +1 -0
  87. package/dist/types/tee.d.ts +97 -0
  88. package/dist/types/tee.d.ts.map +1 -0
  89. package/dist/types/testing.d.ts +29 -0
  90. package/dist/types/testing.d.ts.map +1 -0
  91. package/dist/types/token.d.ts +73 -0
  92. package/dist/types/token.d.ts.map +1 -0
  93. package/dist/types/transcription.d.ts +108 -0
  94. package/dist/types/transcription.d.ts.map +1 -0
  95. package/dist/types/video.d.ts +93 -0
  96. package/dist/types/video.d.ts.map +1 -0
  97. package/dist/types/wallet.d.ts +49 -0
  98. package/dist/types/wallet.d.ts.map +1 -0
  99. package/dist/types/web-search.d.ts +112 -0
  100. package/dist/types/web-search.d.ts.map +1 -0
  101. package/dist/utils/buffer.d.ts +105 -0
  102. package/dist/utils/buffer.d.ts.map +1 -0
  103. package/dist/utils/environment.d.ts +106 -0
  104. package/dist/utils/environment.d.ts.map +1 -0
  105. package/dist/utils/server-health.d.ts +23 -0
  106. package/dist/utils/server-health.d.ts.map +1 -0
  107. package/dist/utils.d.ts +177 -0
  108. package/dist/utils.d.ts.map +1 -0
  109. package/package.json +5 -5
  110. package/src/__tests__/action-chaining-simple.test.ts +0 -203
  111. package/src/__tests__/actions.test.ts +0 -218
  112. package/src/__tests__/buffer.test.ts +0 -337
  113. package/src/__tests__/character-validation.test.ts +0 -309
  114. package/src/__tests__/database.test.ts +0 -750
  115. package/src/__tests__/entities.test.ts +0 -727
  116. package/src/__tests__/env.test.ts +0 -23
  117. package/src/__tests__/environment.test.ts +0 -285
  118. package/src/__tests__/logger-browser-node.test.ts +0 -716
  119. package/src/__tests__/logger.test.ts +0 -403
  120. package/src/__tests__/messages.test.ts +0 -196
  121. package/src/__tests__/mockCharacter.ts +0 -544
  122. package/src/__tests__/parsing.test.ts +0 -58
  123. package/src/__tests__/prompts.test.ts +0 -159
  124. package/src/__tests__/roles.test.ts +0 -331
  125. package/src/__tests__/runtime-embedding.test.ts +0 -343
  126. package/src/__tests__/runtime.test.ts +0 -978
  127. package/src/__tests__/search.test.ts +0 -15
  128. package/src/__tests__/services-by-type.test.ts +0 -204
  129. package/src/__tests__/services.test.ts +0 -136
  130. package/src/__tests__/settings.test.ts +0 -810
  131. package/src/__tests__/utils.test.ts +0 -1105
  132. package/src/__tests__/uuid.test.ts +0 -94
  133. package/src/actions.ts +0 -122
  134. package/src/database.ts +0 -579
  135. package/src/entities.ts +0 -406
  136. package/src/index.ts +0 -50
  137. package/src/logger.ts +0 -527
  138. package/src/prompts.ts +0 -243
  139. package/src/roles.ts +0 -85
  140. package/src/runtime.ts +0 -2514
  141. package/src/schemas/character.ts +0 -149
  142. package/src/search.ts +0 -1543
  143. package/src/sentry/instrument.browser.ts +0 -65
  144. package/src/sentry/instrument.node.ts +0 -57
  145. package/src/sentry/instrument.ts +0 -82
  146. package/src/services.ts +0 -105
  147. package/src/settings.ts +0 -409
  148. package/src/test_resources/constants.ts +0 -12
  149. package/src/test_resources/testSetup.ts +0 -21
  150. package/src/test_resources/types.ts +0 -22
  151. package/src/types/browser.ts +0 -145
  152. package/src/types/components.ts +0 -184
  153. package/src/types/database.ts +0 -348
  154. package/src/types/email.ts +0 -162
  155. package/src/types/environment.ts +0 -129
  156. package/src/types/events.ts +0 -249
  157. package/src/types/lp.ts +0 -124
  158. package/src/types/message.ts +0 -233
  159. package/src/types/messaging.ts +0 -57
  160. package/src/types/model.ts +0 -359
  161. package/src/types/pdf.ts +0 -77
  162. package/src/types/plugin.ts +0 -78
  163. package/src/types/post.ts +0 -271
  164. package/src/types/primitives.ts +0 -97
  165. package/src/types/runtime.ts +0 -190
  166. package/src/types/settings.ts +0 -30
  167. package/src/types/task.ts +0 -72
  168. package/src/types/tee.ts +0 -107
  169. package/src/types/testing.ts +0 -30
  170. package/src/types/token.ts +0 -96
  171. package/src/types/transcription.ts +0 -133
  172. package/src/types/video.ts +0 -108
  173. package/src/types/wallet.ts +0 -56
  174. package/src/types/web-search.ts +0 -146
  175. package/src/utils/__tests__/buffer.test.ts +0 -80
  176. package/src/utils/__tests__/environment.test.ts +0 -58
  177. package/src/utils/__tests__/stringToUuid.test.ts +0 -88
  178. package/src/utils/buffer.ts +0 -312
  179. package/src/utils/environment.ts +0 -316
  180. package/src/utils/server-health.ts +0 -117
  181. package/src/utils.ts +0 -1076
@@ -1,30 +0,0 @@
1
- /**
2
- * Interface representing settings with string key-value pairs.
3
- */
4
- export interface RuntimeSettings {
5
- [key: string]: string | undefined;
6
- }
7
-
8
- export interface Setting {
9
- name: string;
10
- description: string; // Used in chat context when discussing the setting
11
- usageDescription: string; // Used during settings to guide users
12
- value: string | boolean | null;
13
- required: boolean;
14
- public?: boolean; // If true, shown in public channels
15
- secret?: boolean; // If true, value is masked and only shown during settings
16
- validation?: (value: any) => boolean;
17
- dependsOn?: string[];
18
- onSetAction?: (value: any) => string;
19
- visibleIf?: (settings: { [key: string]: Setting }) => boolean;
20
- }
21
-
22
- export interface WorldSettings {
23
- [key: string]: Setting;
24
- }
25
-
26
- export interface OnboardingConfig {
27
- settings: {
28
- [key: string]: Omit<Setting, 'value'>;
29
- };
30
- }
package/src/types/task.ts DELETED
@@ -1,72 +0,0 @@
1
- import type { Memory } from './memory';
2
- import type { UUID } from './primitives';
3
- import type { IAgentRuntime } from './runtime';
4
- import type { State } from './state';
5
-
6
- /**
7
- * Defines the contract for a Task Worker, which is responsible for executing a specific type of task.
8
- * Task workers are registered with the `AgentRuntime` and are invoked when a `Task` of their designated `name` needs processing.
9
- * This pattern allows for modular and extensible background task processing.
10
- */
11
- export interface TaskWorker {
12
- /** The unique name of the task type this worker handles. This name links `Task` instances to this worker. */
13
- name: string;
14
- /**
15
- * The core execution logic for the task. This function is called by the runtime when a task needs to be processed.
16
- * It receives the `AgentRuntime`, task-specific `options`, and the `Task` object itself.
17
- */
18
- execute: (
19
- runtime: IAgentRuntime,
20
- options: { [key: string]: unknown },
21
- task: Task
22
- ) => Promise<void>;
23
- /**
24
- * Optional validation function that can be used to determine if a task is valid or should be executed,
25
- * often based on the current message and state. This might be used by an action or evaluator
26
- * before creating or queueing a task.
27
- */
28
- validate?: (runtime: IAgentRuntime, message: Memory, state: State) => Promise<boolean>;
29
- }
30
-
31
- /**
32
- * Defines metadata associated with a `Task`.
33
- * This can include scheduling information like `updateInterval` or UI-related details
34
- * for presenting task options to a user.
35
- * The `[key: string]: unknown;` allows for additional, unspecified metadata fields.
36
- */
37
- export type TaskMetadata = {
38
- /** Optional. If the task is recurring, this specifies the interval in milliseconds between updates or executions. */
39
- updateInterval?: number;
40
- /** Optional. Describes options or parameters that can be configured for this task, often for UI presentation. */
41
- options?: {
42
- name: string;
43
- description: string;
44
- }[];
45
- /** Allows for other dynamic metadata properties related to the task. */
46
- [key: string]: unknown;
47
- };
48
-
49
- /**
50
- * Represents a task to be performed, often in the background or at a later time.
51
- * Tasks are managed by the `AgentRuntime` and processed by registered `TaskWorker`s.
52
- * They can be associated with a room, world, and tagged for categorization and retrieval.
53
- * The `IDatabaseAdapter` handles persistence of task data.
54
- */
55
- export interface Task {
56
- /** Optional. A Universally Unique Identifier for the task. Generated if not provided. */
57
- id?: UUID;
58
- /** The name of the task, which should correspond to a registered `TaskWorker.name`. */
59
- name: string;
60
- /** Optional. Timestamp of the last update to this task. */
61
- updatedAt?: number;
62
- /** Optional. Metadata associated with the task, conforming to `TaskMetadata`. */
63
- metadata?: TaskMetadata;
64
- /** A human-readable description of what the task does or its purpose. */
65
- description: string;
66
- /** Optional. The UUID of the room this task is associated with. */
67
- roomId?: UUID;
68
- /** Optional. The UUID of the world this task is associated with. */
69
- worldId?: UUID;
70
- entityId?: UUID;
71
- tags: string[];
72
- }
package/src/types/tee.ts DELETED
@@ -1,107 +0,0 @@
1
- import type { Metadata } from './primitives';
2
-
3
- // Represents an agent in the TeeAgent table, containing details about the agent.
4
- /**
5
- * Represents an agent's registration details within a Trusted Execution Environment (TEE) context.
6
- * This is typically stored in a database table (e.g., `TeeAgent`) to manage agents operating in a TEE.
7
- * It allows for multiple registrations of the same `agentId` to support scenarios where an agent might restart,
8
- * generating a new keypair and attestation each time.
9
- */
10
- export interface TeeAgent {
11
- /** Primary key for the TEE agent registration record (e.g., a UUID or auto-incrementing ID). */
12
- id: string; // Primary key
13
- // Allow duplicate agentId.
14
- // This is to support the case where the same agentId is registered multiple times.
15
- // Each time the agent restarts, we will generate a new keypair and attestation.
16
- /** The core identifier of the agent, which can be duplicated across multiple TEE registrations. */
17
- agentId: string;
18
- /** The human-readable name of the agent. */
19
- agentName: string;
20
- /** Timestamp (e.g., Unix epoch in milliseconds) when this TEE registration was created. */
21
- createdAt: number;
22
- /** The public key associated with this specific TEE agent instance/session. */
23
- publicKey: string;
24
- /** The attestation document proving the authenticity and integrity of the TEE instance. */
25
- attestation: string;
26
- }
27
-
28
- /**
29
- * Defines the operational modes for a Trusted Execution Environment (TEE).
30
- * This enum is used to configure how TEE functionalities are engaged, allowing for
31
- * different setups for local development, Docker-based development, and production.
32
- */
33
- export enum TEEMode {
34
- /** TEE functionality is completely disabled. */
35
- OFF = 'OFF',
36
- /** For local development, potentially using a TEE simulator. */
37
- LOCAL = 'LOCAL', // For local development with simulator
38
- /** For Docker-based development environments, possibly with a TEE simulator. */
39
- DOCKER = 'DOCKER', // For docker development with simulator
40
- /** For production deployments, using actual TEE hardware without a simulator. */
41
- PRODUCTION = 'PRODUCTION', // For production without simulator
42
- }
43
-
44
- /**
45
- * Represents a quote obtained during remote attestation for a Trusted Execution Environment (TEE).
46
- * This quote is a piece of evidence provided by the TEE, cryptographically signed, which can be
47
- * verified by a relying party to ensure the TEE's integrity and authenticity.
48
- */
49
- export interface RemoteAttestationQuote {
50
- /** The attestation quote data, typically a base64 encoded string or similar format. */
51
- quote: string;
52
- /** Timestamp (e.g., Unix epoch in milliseconds) when the quote was generated or received. */
53
- timestamp: number;
54
- }
55
-
56
- /**
57
- * Data structure used in the attestation process for deriving a key within a Trusted Execution Environment (TEE).
58
- * This information helps establish a secure channel or verify the identity of the agent instance
59
- * requesting key derivation.
60
- */
61
- export interface DeriveKeyAttestationData {
62
- /** The unique identifier of the agent for which the key derivation is being attested. */
63
- agentId: string;
64
- /** The public key of the agent instance involved in the key derivation process. */
65
- publicKey: string;
66
- /** Optional subject or context information related to the key derivation. */
67
- subject?: string;
68
- }
69
-
70
- /**
71
- * Represents a message that has been attested by a Trusted Execution Environment (TEE).
72
- * This structure binds a message to an agent's identity and a timestamp, all within the
73
- * context of a remote attestation process, ensuring the message originated from a trusted TEE instance.
74
- */
75
- export interface RemoteAttestationMessage {
76
- /** The unique identifier of the agent sending the attested message. */
77
- agentId: string;
78
- /** Timestamp (e.g., Unix epoch in milliseconds) when the message was attested or sent. */
79
- timestamp: number;
80
- /** The actual message content, including details about the entity, room, and the content itself. */
81
- message: {
82
- entityId: string;
83
- roomId: string;
84
- content: string;
85
- };
86
- }
87
-
88
- /**
89
- * Enumerates different types or vendors of Trusted Execution Environments (TEEs).
90
- * This allows the system to adapt to specific TEE technologies, like Intel TDX on DSTACK.
91
- */
92
- export enum TeeType {
93
- /** Represents Intel Trusted Domain Extensions (TDX) running on DSTACK infrastructure. */
94
- TDX_DSTACK = 'tdx_dstack',
95
- }
96
-
97
- /**
98
- * Configuration for a TEE (Trusted Execution Environment) plugin.
99
- * This allows specifying the TEE vendor and any vendor-specific configurations.
100
- * It's used to initialize and configure TEE-related functionalities within the agent system.
101
- */
102
- export interface TeePluginConfig {
103
- /** Optional. The name or identifier of the TEE vendor (e.g., 'tdx_dstack' from `TeeType`). */
104
- vendor?: string;
105
- /** Optional. Vendor-specific configuration options, conforming to `TeeVendorConfig`. */
106
- vendorConfig?: Metadata;
107
- }
@@ -1,30 +0,0 @@
1
- import type { IAgentRuntime } from './runtime';
2
-
3
- /**
4
- * Represents a test case for evaluating agent or plugin functionality.
5
- * Each test case has a name and a function that contains the test logic.
6
- * The test function receives the `IAgentRuntime` instance, allowing it to interact with the agent's capabilities.
7
- * Test cases are typically grouped into `TestSuite`s.
8
- */
9
- export interface TestCase {
10
- /** A descriptive name for the test case, e.g., "should respond to greetings". */
11
- name: string;
12
- /**
13
- * The function that executes the test logic. It can be synchronous or asynchronous.
14
- * It receives the `IAgentRuntime` to interact with the agent and its services.
15
- * The function should typically contain assertions to verify expected outcomes.
16
- */
17
- fn: (runtime: IAgentRuntime) => Promise<void> | void;
18
- }
19
-
20
- /**
21
- * Represents a suite of related test cases for an agent or plugin.
22
- * This helps in organizing tests and running them collectively.
23
- * A `ProjectAgent` can define one or more `TestSuite`s.
24
- */
25
- export interface TestSuite {
26
- /** A descriptive name for the test suite, e.g., "Core Functionality Tests". */
27
- name: string;
28
- /** An array of `TestCase` objects that belong to this suite. */
29
- tests: TestCase[];
30
- }
@@ -1,96 +0,0 @@
1
- import { Service, ServiceType } from './service';
2
-
3
- /**
4
- * A standardized representation of a token holding.
5
- */
6
- export interface TokenBalance {
7
- address: string; // Token mint address, or a native identifier like 'SOL' or 'ETH'
8
- balance: string; // Raw balance as a string to handle large numbers with precision
9
- decimals: number;
10
- uiAmount?: number; // User-friendly balance, adjusted for decimals
11
- name?: string;
12
- symbol?: string;
13
- logoURI?: string;
14
- }
15
-
16
- /**
17
- * Generic representation of token data that can be provided by various services.
18
- */
19
- export interface TokenData {
20
- id: string; // Unique identifier (e.g., contract address or a composite ID)
21
- symbol: string;
22
- name: string;
23
- address: string; // Contract address
24
- chain: string; // e.g., 'solana', 'ethereum', 'base'
25
- sourceProvider: string; // e.g., 'birdeye', 'coinmarketcap'
26
-
27
- price?: number;
28
- priceChange24hPercent?: number;
29
- priceChange24hUSD?: number; // Absolute change
30
-
31
- volume24hUSD?: number;
32
- marketCapUSD?: number;
33
-
34
- liquidity?: number;
35
- holders?: number;
36
-
37
- logoURI?: string;
38
- decimals?: number;
39
-
40
- // Timestamps
41
- lastUpdatedAt?: Date; // When this specific data point was last updated from the source
42
-
43
- // Optional raw data from the provider
44
- raw?: any;
45
- }
46
-
47
- /**
48
- * Interface for a generic service that provides token data.
49
- */
50
- export abstract class ITokenDataService extends Service {
51
- static override readonly serviceType = ServiceType.TOKEN_DATA;
52
- public readonly capabilityDescription =
53
- 'Provides standardized access to token market data.' as string;
54
-
55
- /**
56
- * Fetches detailed information for a single token.
57
- * @param address The token's contract address.
58
- * @param chain The blockchain the token resides on.
59
- * @returns A Promise resolving to TokenData or null if not found.
60
- */
61
- abstract getTokenDetails(address: string, chain: string): Promise<TokenData | null>;
62
-
63
- /**
64
- * Fetches a list of trending tokens.
65
- * @param chain Optional: Filter by a specific blockchain.
66
- * @param limit Optional: Number of tokens to return. Defaults to a service-specific value.
67
- * @param timePeriod Optional: Time period for trending data (e.g., '24h', '7d'). Defaults to service-specific.
68
- * @returns A Promise resolving to an array of TokenData.
69
- */
70
- abstract getTrendingTokens(
71
- chain?: string,
72
- limit?: number,
73
- timePeriod?: string
74
- ): Promise<TokenData[]>;
75
-
76
- /**
77
- * Searches for tokens based on a query string.
78
- * @param query The search query (e.g., symbol, name, address).
79
- * @param chain Optional: Filter by a specific blockchain.
80
- * @param limit Optional: Number of results to return.
81
- * @returns A Promise resolving to an array of TokenData.
82
- */
83
- abstract searchTokens(query: string, chain?: string, limit?: number): Promise<TokenData[]>;
84
-
85
- /**
86
- * Fetches data for multiple tokens by their addresses on a specific chain.
87
- * @param addresses Array of token contract addresses.
88
- * @param chain The blockchain the tokens reside on.
89
- * @returns A Promise resolving to an array of TokenData. May not include all requested if some are not found.
90
- */
91
- abstract getTokensByAddresses(addresses: string[], chain: string): Promise<TokenData[]>;
92
-
93
- // Future potential methods:
94
- // getHistoricalPriceData(address: string, chain: string, timeFrame: string): Promise<any[]>;
95
- // getTokenMarketChart(address: string, chain: string, days: number): Promise<any[]>;
96
- }
@@ -1,133 +0,0 @@
1
- import { Service, ServiceType } from './service';
2
-
3
- export interface TranscriptionOptions {
4
- language?: string;
5
- model?: string;
6
- temperature?: number;
7
- prompt?: string;
8
- response_format?: 'json' | 'text' | 'srt' | 'vtt' | 'verbose_json';
9
- timestamp_granularities?: ('word' | 'segment')[];
10
- word_timestamps?: boolean;
11
- segment_timestamps?: boolean;
12
- }
13
-
14
- export interface TranscriptionResult {
15
- text: string;
16
- language?: string;
17
- duration?: number;
18
- segments?: TranscriptionSegment[];
19
- words?: TranscriptionWord[];
20
- confidence?: number;
21
- }
22
-
23
- export interface TranscriptionSegment {
24
- id: number;
25
- text: string;
26
- start: number;
27
- end: number;
28
- confidence?: number;
29
- tokens?: number[];
30
- temperature?: number;
31
- avg_logprob?: number;
32
- compression_ratio?: number;
33
- no_speech_prob?: number;
34
- }
35
-
36
- export interface TranscriptionWord {
37
- word: string;
38
- start: number;
39
- end: number;
40
- confidence?: number;
41
- }
42
-
43
- export interface SpeechToTextOptions {
44
- language?: string;
45
- model?: string;
46
- continuous?: boolean;
47
- interimResults?: boolean;
48
- maxAlternatives?: number;
49
- }
50
-
51
- export interface TextToSpeechOptions {
52
- voice?: string;
53
- model?: string;
54
- speed?: number;
55
- format?: 'mp3' | 'wav' | 'flac' | 'aac';
56
- response_format?: 'mp3' | 'opus' | 'aac' | 'flac';
57
- }
58
-
59
- /**
60
- * Interface for audio transcription and speech services
61
- */
62
- export abstract class ITranscriptionService extends Service {
63
- static override readonly serviceType = ServiceType.TRANSCRIPTION;
64
-
65
- public readonly capabilityDescription = 'Audio transcription and speech processing capabilities';
66
-
67
- /**
68
- * Transcribe audio file to text
69
- * @param audioPath - Path to audio file or audio buffer
70
- * @param options - Transcription options
71
- * @returns Promise resolving to transcription result
72
- */
73
- abstract transcribeAudio(
74
- audioPath: string | Buffer,
75
- options?: TranscriptionOptions
76
- ): Promise<TranscriptionResult>;
77
-
78
- /**
79
- * Transcribe video file to text (extracts audio first)
80
- * @param videoPath - Path to video file or video buffer
81
- * @param options - Transcription options
82
- * @returns Promise resolving to transcription result
83
- */
84
- abstract transcribeVideo(
85
- videoPath: string | Buffer,
86
- options?: TranscriptionOptions
87
- ): Promise<TranscriptionResult>;
88
-
89
- /**
90
- * Real-time speech to text from audio stream
91
- * @param audioStream - Audio stream or buffer
92
- * @param options - Speech to text options
93
- * @returns Promise resolving to transcription result
94
- */
95
- abstract speechToText(
96
- audioStream: NodeJS.ReadableStream | Buffer,
97
- options?: SpeechToTextOptions
98
- ): Promise<TranscriptionResult>;
99
-
100
- /**
101
- * Convert text to speech
102
- * @param text - Text to convert to speech
103
- * @param options - Text to speech options
104
- * @returns Promise resolving to audio buffer
105
- */
106
- abstract textToSpeech(text: string, options?: TextToSpeechOptions): Promise<Buffer>;
107
-
108
- /**
109
- * Get supported languages for transcription
110
- * @returns Promise resolving to array of supported language codes
111
- */
112
- abstract getSupportedLanguages(): Promise<string[]>;
113
-
114
- /**
115
- * Get available voices for text to speech
116
- * @returns Promise resolving to array of available voices
117
- */
118
- abstract getAvailableVoices(): Promise<
119
- Array<{
120
- id: string;
121
- name: string;
122
- language: string;
123
- gender?: 'male' | 'female' | 'neutral';
124
- }>
125
- >;
126
-
127
- /**
128
- * Detect language of audio file
129
- * @param audioPath - Path to audio file or audio buffer
130
- * @returns Promise resolving to detected language code
131
- */
132
- abstract detectLanguage(audioPath: string | Buffer): Promise<string>;
133
- }
@@ -1,108 +0,0 @@
1
- import { Service, ServiceType } from './service';
2
-
3
- export interface VideoInfo {
4
- title?: string;
5
- duration?: number;
6
- url: string;
7
- thumbnail?: string;
8
- description?: string;
9
- uploader?: string;
10
- viewCount?: number;
11
- uploadDate?: Date;
12
- formats?: VideoFormat[];
13
- }
14
-
15
- export interface VideoFormat {
16
- formatId: string;
17
- url: string;
18
- extension: string;
19
- quality: string;
20
- fileSize?: number;
21
- videoCodec?: string;
22
- audioCodec?: string;
23
- resolution?: string;
24
- fps?: number;
25
- bitrate?: number;
26
- }
27
-
28
- export interface VideoDownloadOptions {
29
- format?: string;
30
- quality?: 'best' | 'worst' | 'bestvideo' | 'bestaudio' | string;
31
- outputPath?: string;
32
- audioOnly?: boolean;
33
- videoOnly?: boolean;
34
- subtitles?: boolean;
35
- embedSubs?: boolean;
36
- writeInfoJson?: boolean;
37
- }
38
-
39
- export interface VideoProcessingOptions {
40
- startTime?: number;
41
- endTime?: number;
42
- outputFormat?: string;
43
- resolution?: string;
44
- bitrate?: string;
45
- framerate?: number;
46
- audioCodec?: string;
47
- videoCodec?: string;
48
- }
49
-
50
- /**
51
- * Interface for video processing and download services
52
- */
53
- export abstract class IVideoService extends Service {
54
- static override readonly serviceType = ServiceType.VIDEO;
55
-
56
- public readonly capabilityDescription = 'Video download, processing, and conversion capabilities';
57
-
58
- /**
59
- * Get video information without downloading
60
- * @param url - Video URL
61
- * @returns Promise resolving to video information
62
- */
63
- abstract getVideoInfo(url: string): Promise<VideoInfo>;
64
-
65
- /**
66
- * Download a video from URL
67
- * @param url - Video URL
68
- * @param options - Download options
69
- * @returns Promise resolving to downloaded file path
70
- */
71
- abstract downloadVideo(url: string, options?: VideoDownloadOptions): Promise<string>;
72
-
73
- /**
74
- * Extract audio from video
75
- * @param videoPath - Path to video file or video URL
76
- * @param outputPath - Optional output path for audio file
77
- * @returns Promise resolving to audio file path
78
- */
79
- abstract extractAudio(videoPath: string, outputPath?: string): Promise<string>;
80
-
81
- /**
82
- * Generate thumbnail from video
83
- * @param videoPath - Path to video file or video URL
84
- * @param timestamp - Timestamp in seconds to capture thumbnail
85
- * @returns Promise resolving to thumbnail image path
86
- */
87
- abstract getThumbnail(videoPath: string, timestamp?: number): Promise<string>;
88
-
89
- /**
90
- * Convert video to different format
91
- * @param videoPath - Path to input video file
92
- * @param outputPath - Path for output video file
93
- * @param options - Processing options
94
- * @returns Promise resolving to converted video path
95
- */
96
- abstract convertVideo(
97
- videoPath: string,
98
- outputPath: string,
99
- options?: VideoProcessingOptions
100
- ): Promise<string>;
101
-
102
- /**
103
- * Get available formats for a video URL
104
- * @param url - Video URL
105
- * @returns Promise resolving to available formats
106
- */
107
- abstract getAvailableFormats(url: string): Promise<VideoFormat[]>;
108
- }
@@ -1,56 +0,0 @@
1
- import { Service, ServiceType } from './service';
2
- import type { TokenBalance } from './token';
3
-
4
- /**
5
- * Represents a single asset holding within a wallet, including its value.
6
- * This extends a generic TokenBalance with wallet-specific valuation.
7
- */
8
- export interface WalletAsset extends TokenBalance {
9
- priceUsd?: number;
10
- valueUsd?: number;
11
- }
12
-
13
- /**
14
- * Represents the entire portfolio of assets in a wallet.
15
- */
16
- export interface WalletPortfolio {
17
- totalValueUsd: number;
18
- assets: WalletAsset[];
19
- }
20
-
21
- /**
22
- * Abstract interface for a Wallet Service.
23
- * Plugins that provide wallet functionality (e.g., for Solana, EVM) should implement this service.
24
- * It provides a standardized way for other plugins to query the state of a wallet.
25
- */
26
- export abstract class IWalletService extends Service {
27
- static override readonly serviceType = ServiceType.WALLET;
28
-
29
- public readonly capabilityDescription =
30
- 'Provides standardized access to wallet balances and portfolios.';
31
-
32
- /**
33
- * Retrieves the entire portfolio of assets held by the wallet.
34
- * @param owner - Optional: The specific wallet address/owner to query if the service manages multiple.
35
- * @returns A promise that resolves to the wallet's portfolio.
36
- */
37
- abstract getPortfolio(owner?: string): Promise<WalletPortfolio>;
38
-
39
- /**
40
- * Retrieves the balance of a specific asset in the wallet.
41
- * @param assetAddress - The mint address or native identifier of the asset.
42
- * @param owner - Optional: The specific wallet address/owner to query.
43
- * @returns A promise that resolves to the user-friendly (decimal-adjusted) balance of the asset held.
44
- */
45
- abstract getBalance(assetAddress: string, owner?: string): Promise<number>;
46
-
47
- /**
48
- * Transfers SOL from a specified keypair to a given public key.
49
- * This is a low-level function primarily for Solana-based wallet services.
50
- * @param from - The Keypair of the sender.
51
- * @param to - The PublicKey of the recipient.
52
- * @param lamports - The amount in lamports to transfer.
53
- * @returns A promise that resolves with the transaction signature.
54
- */
55
- abstract transferSol(from: any, to: any, lamports: number): Promise<string>;
56
- }