@elizaos/core 1.0.8 → 1.0.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.
- package/dist/{chunk-6EXKM3O4.js → chunk-27AU6HW7.js} +761 -564
- package/dist/{index-C7vN6HiA.d.ts → index-KbaTHD-K.d.ts} +32 -4
- package/dist/index.d.ts +421 -173
- package/dist/index.js +11 -1
- package/dist/specs/v1/actionExample.d.ts +1 -1
- package/dist/specs/v1/index.d.ts +1 -1
- package/dist/specs/v1/index.js +1 -1
- package/dist/specs/v1/messages.js +1 -1
- package/dist/specs/v1/posts.js +1 -1
- package/dist/specs/v1/provider.d.ts +1 -1
- package/dist/specs/v1/runtime.js +1 -1
- package/dist/specs/v1/state.d.ts +1 -1
- package/dist/specs/v1/templates.d.ts +1 -1
- package/dist/specs/v1/uuid.js +1 -1
- package/dist/specs/v2/index.d.ts +2 -2
- package/dist/specs/v2/index.js +1 -1
- package/dist/{types-szUq9-0V.d.ts → types-CpAVqV6l.d.ts} +7 -1
- package/package.json +5 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { M as Metadata, S as Service,
|
|
2
|
-
export { b9 as ActionEventPayload, al as ActionExample, ak as AgentStatus, aQ as AudioProcessingParams, Z as BaseMetadata, aI as BaseModelParams, af as CacheKeyPrefix, b6 as ChannelClearedPayload, ah as ChunkRow,
|
|
1
|
+
import { M as Metadata, S as Service, T as TemplateType, a as State, b as Memory, E as Entity, I as IAgentRuntime, U as UUID, C as ContentType, c as Character, A as Action, d as IDatabaseAdapter, e as Component, L as Log, f as MemoryMetadata, W as World, R as Room, P as Participant, g as Relationship, h as Agent, i as Task, j as Role, k as Evaluator, l as Provider, m as Plugin, n as ServiceTypeName, o as ModelHandler, p as Route, q as RuntimeSettings, H as HandlerCallback, r as ChannelType, s as ModelTypeName, t as ModelResultMap, u as ModelParamsMap, v as TaskWorker, w as SendHandlerFunction, x as TargetInfo, y as Content, z as Setting, B as WorldSettings, O as OnboardingConfig, D as v2 } from './index-KbaTHD-K.js';
|
|
2
|
+
export { b9 as ActionEventPayload, al as ActionExample, ak as AgentStatus, aQ as AudioProcessingParams, Z as BaseMetadata, aI as BaseModelParams, af as CacheKeyPrefix, b6 as ChannelClearedPayload, ah as ChunkRow, bi as ControlMessage, a2 as CustomMetadata, a_ as DbConnection, a1 as DescriptionMetadata, aH as DetokenizeTextParams, ag as DirectoryItem, _ as DocumentMetadata, aU as EmbeddingSearchResult, Q as EnhancedState, b4 as EntityPayload, ao as EvaluationExample, ba as EvaluatorEventPayload, be as EventHandler, b2 as EventPayload, bd as EventPayloadMap, b0 as EventType, $ as FragmentMetadata, aG as GenerateTextParams, am as Handler, aN as ImageDescriptionParams, aM as ImageGenerationParams, b7 as InvokePayload, av as IsValidServiceType, aS as JSONSchema, ad as KnowledgeItem, ae as KnowledgeScope, G as Media, aV as MemoryRetrievalOptions, Y as MemoryScope, aW as MemorySearchOptions, X as MemoryType, V as MemoryTypeAlias, aj as MessageExample, a3 as MessageMemory, a0 as MessageMetadata, b5 as MessagePayload, bc as MessageReceivedHandlerParams, bb as ModelEventPayload, aF as ModelType, aX as MultiRoomMemoryOptions, aT as ObjectGenerationParams, b1 as PlatformPrefix, aq as PluginEvents, as as Project, ar as ProjectAgent, ap as ProviderResult, ai as RoomMetadata, b8 as RunEventPayload, bh as SOCKET_MESSAGE_TYPE, bl as ServiceBuilder, ax as ServiceClassMap, bn as ServiceDefinition, aD as ServiceError, ay as ServiceInstance, az as ServiceRegistry, aA as ServiceType, at as ServiceTypeRegistry, au as ServiceTypeValue, N as StateArray, K as StateObject, J as StateValue, bg as TaskMetadata, bj as TestCase, bk as TestSuite, aK as TextEmbeddingParams, aJ as TextGenerationParams, aP as TextToSpeechParams, aL as TokenizeTextParams, aO as TranscriptionParams, bf as TypedEventHandler, aB as TypedService, aw as TypedServiceClass, aY as UnifiedMemoryOptions, aZ as UnifiedSearchOptions, a$ as VECTOR_DIMS, an as Validator, aR as VideoProcessingParams, b3 as WorldPayload, F as asUUID, a4 as createMessageMemory, bm as createService, aE as createServiceError, bo as defineService, ac as getMemoryText, aC as getTypedService, a9 as isCustomMetadata, a8 as isDescriptionMetadata, aa as isDocumentMemory, a5 as isDocumentMetadata, ab as isFragmentMemory, a6 as isFragmentMetadata, a7 as isMessageMetadata } from './index-KbaTHD-K.js';
|
|
3
|
+
import { z } from 'zod';
|
|
3
4
|
import * as pino from 'pino';
|
|
4
5
|
import * as browser from '@sentry/browser';
|
|
5
6
|
export { browser as Sentry };
|
|
6
7
|
export { i as v1 } from './index-BHW44X0A.js';
|
|
7
|
-
import './types-
|
|
8
|
+
import './types-CpAVqV6l.js';
|
|
8
9
|
import './specs/v1/messages.js';
|
|
9
10
|
import './specs/v1/types.js';
|
|
10
11
|
import 'stream';
|
|
@@ -343,6 +344,401 @@ declare abstract class ILpService extends Service {
|
|
|
343
344
|
abstract getMarketDataForPools(poolIds: string[]): Promise<Record<string, Partial<PoolInfo>>>;
|
|
344
345
|
}
|
|
345
346
|
|
|
347
|
+
/**
|
|
348
|
+
* Composes a context string by replacing placeholders in a template with corresponding values from the state.
|
|
349
|
+
*
|
|
350
|
+
* This function takes a template string with placeholders in the format `{{placeholder}}` and a state object.
|
|
351
|
+
* It replaces each placeholder with the value from the state object that matches the placeholder's name.
|
|
352
|
+
* If a matching key is not found in the state object for a given placeholder, the placeholder is replaced with an empty string.
|
|
353
|
+
*
|
|
354
|
+
* @param {Object} params - The parameters for composing the context.
|
|
355
|
+
* @param {State} params.state - The state object containing values to replace the placeholders in the template.
|
|
356
|
+
* @param {TemplateType} params.template - The template string or function containing placeholders to be replaced with state values.
|
|
357
|
+
* @returns {string} The composed context string with placeholders replaced by corresponding state values.
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* // Given a state object and a template
|
|
361
|
+
* const state = { userName: "Alice", userAge: 30 };
|
|
362
|
+
* const template = "Hello, {{userName}}! You are {{userAge}} years old";
|
|
363
|
+
*
|
|
364
|
+
* // Composing the context with simple string replacement will result in:
|
|
365
|
+
* // "Hello, Alice! You are 30 years old."
|
|
366
|
+
* const contextSimple = composePromptFromState({ state, template });
|
|
367
|
+
*
|
|
368
|
+
* // Using composePromptFromState with a template function for dynamic template
|
|
369
|
+
* const template = ({ state }) => {
|
|
370
|
+
* const tone = Math.random() > 0.5 ? "kind" : "rude";
|
|
371
|
+
* return `Hello, {{userName}}! You are {{userAge}} years old. Be ${tone}`;
|
|
372
|
+
* };
|
|
373
|
+
* const contextSimple = composePromptFromState({ state, template });
|
|
374
|
+
*/
|
|
375
|
+
/**
|
|
376
|
+
* Function to compose a prompt using a provided template and state.
|
|
377
|
+
* It compiles the template (upgrading double braces to triple braces for non-HTML escaping)
|
|
378
|
+
* and then populates it with values from the state. Additionally, it processes the
|
|
379
|
+
* resulting string with `composeRandomUser` to replace placeholders like `{{nameX}}`.
|
|
380
|
+
*
|
|
381
|
+
* @param {Object} options - Object containing state and template information.
|
|
382
|
+
* @param {State} options.state - The state object containing values to fill the template.
|
|
383
|
+
* @param {TemplateType} options.template - The template string or function to be used for composing the prompt.
|
|
384
|
+
* @returns {string} The composed prompt output, with state values and random user names populated.
|
|
385
|
+
*/
|
|
386
|
+
declare const composePrompt: ({ state, template, }: {
|
|
387
|
+
state: {
|
|
388
|
+
[key: string]: string;
|
|
389
|
+
};
|
|
390
|
+
template: TemplateType;
|
|
391
|
+
}) => string;
|
|
392
|
+
/**
|
|
393
|
+
* Function to compose a prompt using a provided template and state.
|
|
394
|
+
*
|
|
395
|
+
* @param {Object} options - Object containing state and template information.
|
|
396
|
+
* @param {State} options.state - The state object containing values to fill the template.
|
|
397
|
+
* @param {TemplateType} options.template - The template to be used for composing the prompt.
|
|
398
|
+
* @returns {string} The composed prompt output.
|
|
399
|
+
*/
|
|
400
|
+
declare const composePromptFromState: ({ state, template, }: {
|
|
401
|
+
state: State;
|
|
402
|
+
template: TemplateType;
|
|
403
|
+
}) => string;
|
|
404
|
+
/**
|
|
405
|
+
* Adds a header to a body of text.
|
|
406
|
+
*
|
|
407
|
+
* This function takes a header string and a body string and returns a new string with the header prepended to the body.
|
|
408
|
+
* If the body string is empty, the header is returned as is.
|
|
409
|
+
*
|
|
410
|
+
* @param {string} header - The header to add to the body.
|
|
411
|
+
* @param {string} body - The body to which to add the header.
|
|
412
|
+
* @returns {string} The body with the header prepended.
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* // Given a header and a body
|
|
416
|
+
* const header = "Header";
|
|
417
|
+
* const body = "Body";
|
|
418
|
+
*
|
|
419
|
+
* // Adding the header to the body will result in:
|
|
420
|
+
* // "Header\nBody"
|
|
421
|
+
* const text = addHeader(header, body);
|
|
422
|
+
*/
|
|
423
|
+
declare const addHeader: (header: string, body: string) => string;
|
|
424
|
+
declare const formatPosts: ({ messages, entities, conversationHeader, }: {
|
|
425
|
+
messages: Memory[];
|
|
426
|
+
entities: Entity[];
|
|
427
|
+
conversationHeader?: boolean;
|
|
428
|
+
}) => string;
|
|
429
|
+
/**
|
|
430
|
+
* Format messages into a string
|
|
431
|
+
* @param {Object} params - The formatting parameters
|
|
432
|
+
* @param {Memory[]} params.messages - List of messages to format
|
|
433
|
+
* @param {Entity[]} params.entities - List of entities for name resolution
|
|
434
|
+
* @returns {string} Formatted message string with timestamps and user information
|
|
435
|
+
*/
|
|
436
|
+
declare const formatMessages: ({ messages, entities, }: {
|
|
437
|
+
messages: Memory[];
|
|
438
|
+
entities: Entity[];
|
|
439
|
+
}) => string;
|
|
440
|
+
declare const formatTimestamp: (messageDate: number) => string;
|
|
441
|
+
/**
|
|
442
|
+
* Parses key-value pairs from a simple XML structure within a given text.
|
|
443
|
+
* It looks for an XML block (e.g., <response>...</response>) and extracts
|
|
444
|
+
* text content from direct child elements (e.g., <key>value</key>).
|
|
445
|
+
*
|
|
446
|
+
* Note: This uses regex and is suitable for simple, predictable XML structures.
|
|
447
|
+
* For complex XML, a proper parsing library is recommended.
|
|
448
|
+
*
|
|
449
|
+
* @param text - The input text containing the XML structure.
|
|
450
|
+
* @returns An object with key-value pairs extracted from the XML, or null if parsing fails.
|
|
451
|
+
*/
|
|
452
|
+
declare function parseKeyValueXml(text: string): Record<string, any> | null;
|
|
453
|
+
/**
|
|
454
|
+
* Parses a JSON object from a given text. The function looks for a JSON block wrapped in triple backticks
|
|
455
|
+
* with `json` language identifier, and if not found, it searches for an object pattern within the text.
|
|
456
|
+
* It then attempts to parse the JSON string into a JavaScript object. If parsing is successful and the result
|
|
457
|
+
* is an object (but not an array), it returns the object; otherwise, it tries to parse an array if the result
|
|
458
|
+
* is an array, or returns null if parsing is unsuccessful or the result is neither an object nor an array.
|
|
459
|
+
*
|
|
460
|
+
* @param text - The input text from which to extract and parse the JSON object.
|
|
461
|
+
* @returns An object parsed from the JSON string if successful; otherwise, null or the result of parsing an array.
|
|
462
|
+
*/
|
|
463
|
+
declare function parseJSONObjectFromText(text: string): Record<string, any> | null;
|
|
464
|
+
/**
|
|
465
|
+
* Normalizes a JSON-like string by correcting formatting issues:
|
|
466
|
+
* - Removes extra spaces after '{' and before '}'.
|
|
467
|
+
* - Wraps unquoted values in double quotes.
|
|
468
|
+
* - Converts single-quoted values to double-quoted.
|
|
469
|
+
* - Ensures consistency in key-value formatting.
|
|
470
|
+
* - Normalizes mixed adjacent quote pairs.
|
|
471
|
+
*
|
|
472
|
+
* This is useful for cleaning up improperly formatted JSON strings
|
|
473
|
+
* before parsing them into valid JSON.
|
|
474
|
+
*
|
|
475
|
+
* @param str - The JSON-like string to normalize.
|
|
476
|
+
* @returns A properly formatted JSON string.
|
|
477
|
+
*/
|
|
478
|
+
declare const normalizeJsonString: (str: string) => string;
|
|
479
|
+
/**
|
|
480
|
+
* Truncate text to fit within the character limit, ensuring it ends at a complete sentence.
|
|
481
|
+
*/
|
|
482
|
+
declare function truncateToCompleteSentence(text: string, maxLength: number): string;
|
|
483
|
+
declare function splitChunks(content: string, chunkSize?: number, bleed?: number): Promise<string[]>;
|
|
484
|
+
/**
|
|
485
|
+
* Trims the provided text prompt to a specified token limit using a tokenizer model and type.
|
|
486
|
+
*/
|
|
487
|
+
declare function trimTokens(prompt: string, maxTokens: number, runtime: IAgentRuntime): Promise<string>;
|
|
488
|
+
declare function safeReplacer(): (key: string, value: any) => any;
|
|
489
|
+
/**
|
|
490
|
+
* Parses a string to determine its boolean equivalent.
|
|
491
|
+
*
|
|
492
|
+
* Recognized affirmative values: "YES", "Y", "TRUE", "T", "1", "ON", "ENABLE"
|
|
493
|
+
* Recognized negative values: "NO", "N", "FALSE", "F", "0", "OFF", "DISABLE"
|
|
494
|
+
*
|
|
495
|
+
* @param {string | undefined | null} value - The input text to parse
|
|
496
|
+
* @returns {boolean} - Returns `true` for affirmative inputs, `false` for negative or unrecognized inputs
|
|
497
|
+
*/
|
|
498
|
+
declare function parseBooleanFromText(value: string | undefined | null): boolean;
|
|
499
|
+
/**
|
|
500
|
+
* Validates a UUID value.
|
|
501
|
+
*
|
|
502
|
+
* @param {unknown} value - The value to validate.
|
|
503
|
+
* @returns {UUID | null} Returns the validated UUID value or null if validation fails.
|
|
504
|
+
*/
|
|
505
|
+
declare function validateUuid(value: unknown): UUID | null;
|
|
506
|
+
/**
|
|
507
|
+
* Converts a string or number to a UUID.
|
|
508
|
+
*
|
|
509
|
+
* @param {string | number} target - The string or number to convert to a UUID.
|
|
510
|
+
* @returns {UUID} The UUID generated from the input target.
|
|
511
|
+
* @throws {TypeError} Throws an error if the input target is not a string.
|
|
512
|
+
*/
|
|
513
|
+
declare function stringToUuid(target: string | number): UUID;
|
|
514
|
+
declare const getContentTypeFromMimeType: (mimeType: string) => ContentType | undefined;
|
|
515
|
+
|
|
516
|
+
declare const characterSchema: z.ZodObject<{
|
|
517
|
+
id: z.ZodOptional<z.ZodString>;
|
|
518
|
+
name: z.ZodString;
|
|
519
|
+
username: z.ZodOptional<z.ZodString>;
|
|
520
|
+
system: z.ZodOptional<z.ZodString>;
|
|
521
|
+
templates: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>]>>>;
|
|
522
|
+
bio: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
523
|
+
messageExamples: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
|
|
524
|
+
name: z.ZodString;
|
|
525
|
+
content: z.ZodObject<{
|
|
526
|
+
text: z.ZodOptional<z.ZodString>;
|
|
527
|
+
thought: z.ZodOptional<z.ZodString>;
|
|
528
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
529
|
+
providers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
530
|
+
source: z.ZodOptional<z.ZodString>;
|
|
531
|
+
target: z.ZodOptional<z.ZodString>;
|
|
532
|
+
url: z.ZodOptional<z.ZodString>;
|
|
533
|
+
inReplyTo: z.ZodOptional<z.ZodString>;
|
|
534
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
535
|
+
channelType: z.ZodOptional<z.ZodString>;
|
|
536
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
537
|
+
text: z.ZodOptional<z.ZodString>;
|
|
538
|
+
thought: z.ZodOptional<z.ZodString>;
|
|
539
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
540
|
+
providers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
541
|
+
source: z.ZodOptional<z.ZodString>;
|
|
542
|
+
target: z.ZodOptional<z.ZodString>;
|
|
543
|
+
url: z.ZodOptional<z.ZodString>;
|
|
544
|
+
inReplyTo: z.ZodOptional<z.ZodString>;
|
|
545
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
546
|
+
channelType: z.ZodOptional<z.ZodString>;
|
|
547
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
548
|
+
text: z.ZodOptional<z.ZodString>;
|
|
549
|
+
thought: z.ZodOptional<z.ZodString>;
|
|
550
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
551
|
+
providers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
552
|
+
source: z.ZodOptional<z.ZodString>;
|
|
553
|
+
target: z.ZodOptional<z.ZodString>;
|
|
554
|
+
url: z.ZodOptional<z.ZodString>;
|
|
555
|
+
inReplyTo: z.ZodOptional<z.ZodString>;
|
|
556
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
557
|
+
channelType: z.ZodOptional<z.ZodString>;
|
|
558
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
559
|
+
}, "strip", z.ZodTypeAny, {
|
|
560
|
+
name?: string;
|
|
561
|
+
content?: {
|
|
562
|
+
thought?: string;
|
|
563
|
+
text?: string;
|
|
564
|
+
actions?: string[];
|
|
565
|
+
providers?: string[];
|
|
566
|
+
source?: string;
|
|
567
|
+
target?: string;
|
|
568
|
+
url?: string;
|
|
569
|
+
inReplyTo?: string;
|
|
570
|
+
attachments?: any[];
|
|
571
|
+
channelType?: string;
|
|
572
|
+
} & {
|
|
573
|
+
[k: string]: unknown;
|
|
574
|
+
};
|
|
575
|
+
}, {
|
|
576
|
+
name?: string;
|
|
577
|
+
content?: {
|
|
578
|
+
thought?: string;
|
|
579
|
+
text?: string;
|
|
580
|
+
actions?: string[];
|
|
581
|
+
providers?: string[];
|
|
582
|
+
source?: string;
|
|
583
|
+
target?: string;
|
|
584
|
+
url?: string;
|
|
585
|
+
inReplyTo?: string;
|
|
586
|
+
attachments?: any[];
|
|
587
|
+
channelType?: string;
|
|
588
|
+
} & {
|
|
589
|
+
[k: string]: unknown;
|
|
590
|
+
};
|
|
591
|
+
}>, "many">, "many">>;
|
|
592
|
+
postExamples: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
593
|
+
topics: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
594
|
+
adjectives: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
595
|
+
knowledge: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
596
|
+
path: z.ZodString;
|
|
597
|
+
shared: z.ZodOptional<z.ZodBoolean>;
|
|
598
|
+
}, "strip", z.ZodTypeAny, {
|
|
599
|
+
shared?: boolean;
|
|
600
|
+
path?: string;
|
|
601
|
+
}, {
|
|
602
|
+
shared?: boolean;
|
|
603
|
+
path?: string;
|
|
604
|
+
}>, z.ZodObject<{
|
|
605
|
+
directory: z.ZodString;
|
|
606
|
+
shared: z.ZodOptional<z.ZodBoolean>;
|
|
607
|
+
}, "strip", z.ZodTypeAny, {
|
|
608
|
+
shared?: boolean;
|
|
609
|
+
directory?: string;
|
|
610
|
+
}, {
|
|
611
|
+
shared?: boolean;
|
|
612
|
+
directory?: string;
|
|
613
|
+
}>]>, "many">>;
|
|
614
|
+
plugins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
615
|
+
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodAny]>>>;
|
|
616
|
+
secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodNumber]>>>;
|
|
617
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
618
|
+
all: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
619
|
+
chat: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
620
|
+
post: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
621
|
+
}, "strip", z.ZodTypeAny, {
|
|
622
|
+
all?: string[];
|
|
623
|
+
chat?: string[];
|
|
624
|
+
post?: string[];
|
|
625
|
+
}, {
|
|
626
|
+
all?: string[];
|
|
627
|
+
chat?: string[];
|
|
628
|
+
post?: string[];
|
|
629
|
+
}>>;
|
|
630
|
+
}, "strict", z.ZodTypeAny, {
|
|
631
|
+
knowledge?: (string | {
|
|
632
|
+
shared?: boolean;
|
|
633
|
+
directory?: string;
|
|
634
|
+
} | {
|
|
635
|
+
shared?: boolean;
|
|
636
|
+
path?: string;
|
|
637
|
+
})[];
|
|
638
|
+
username?: string;
|
|
639
|
+
name?: string;
|
|
640
|
+
id?: string;
|
|
641
|
+
system?: string;
|
|
642
|
+
templates?: Record<string, string | ((...args: unknown[]) => unknown)>;
|
|
643
|
+
bio?: string | string[];
|
|
644
|
+
messageExamples?: {
|
|
645
|
+
name?: string;
|
|
646
|
+
content?: {
|
|
647
|
+
thought?: string;
|
|
648
|
+
text?: string;
|
|
649
|
+
actions?: string[];
|
|
650
|
+
providers?: string[];
|
|
651
|
+
source?: string;
|
|
652
|
+
target?: string;
|
|
653
|
+
url?: string;
|
|
654
|
+
inReplyTo?: string;
|
|
655
|
+
attachments?: any[];
|
|
656
|
+
channelType?: string;
|
|
657
|
+
} & {
|
|
658
|
+
[k: string]: unknown;
|
|
659
|
+
};
|
|
660
|
+
}[][];
|
|
661
|
+
postExamples?: string[];
|
|
662
|
+
topics?: string[];
|
|
663
|
+
adjectives?: string[];
|
|
664
|
+
plugins?: string[];
|
|
665
|
+
settings?: Record<string, any>;
|
|
666
|
+
secrets?: Record<string, string | number | boolean>;
|
|
667
|
+
style?: {
|
|
668
|
+
all?: string[];
|
|
669
|
+
chat?: string[];
|
|
670
|
+
post?: string[];
|
|
671
|
+
};
|
|
672
|
+
}, {
|
|
673
|
+
knowledge?: (string | {
|
|
674
|
+
shared?: boolean;
|
|
675
|
+
directory?: string;
|
|
676
|
+
} | {
|
|
677
|
+
shared?: boolean;
|
|
678
|
+
path?: string;
|
|
679
|
+
})[];
|
|
680
|
+
username?: string;
|
|
681
|
+
name?: string;
|
|
682
|
+
id?: string;
|
|
683
|
+
system?: string;
|
|
684
|
+
templates?: Record<string, string | ((...args: unknown[]) => unknown)>;
|
|
685
|
+
bio?: string | string[];
|
|
686
|
+
messageExamples?: {
|
|
687
|
+
name?: string;
|
|
688
|
+
content?: {
|
|
689
|
+
thought?: string;
|
|
690
|
+
text?: string;
|
|
691
|
+
actions?: string[];
|
|
692
|
+
providers?: string[];
|
|
693
|
+
source?: string;
|
|
694
|
+
target?: string;
|
|
695
|
+
url?: string;
|
|
696
|
+
inReplyTo?: string;
|
|
697
|
+
attachments?: any[];
|
|
698
|
+
channelType?: string;
|
|
699
|
+
} & {
|
|
700
|
+
[k: string]: unknown;
|
|
701
|
+
};
|
|
702
|
+
}[][];
|
|
703
|
+
postExamples?: string[];
|
|
704
|
+
topics?: string[];
|
|
705
|
+
adjectives?: string[];
|
|
706
|
+
plugins?: string[];
|
|
707
|
+
settings?: Record<string, any>;
|
|
708
|
+
secrets?: Record<string, string | number | boolean>;
|
|
709
|
+
style?: {
|
|
710
|
+
all?: string[];
|
|
711
|
+
chat?: string[];
|
|
712
|
+
post?: string[];
|
|
713
|
+
};
|
|
714
|
+
}>;
|
|
715
|
+
interface CharacterValidationResult {
|
|
716
|
+
success: boolean;
|
|
717
|
+
data?: Character;
|
|
718
|
+
error?: {
|
|
719
|
+
message: string;
|
|
720
|
+
issues?: z.ZodIssue[];
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Safely validates character data using Zod schema
|
|
725
|
+
* @param data - Raw character data to validate
|
|
726
|
+
* @returns Validation result with success flag and either data or error
|
|
727
|
+
*/
|
|
728
|
+
declare function validateCharacter(data: unknown): CharacterValidationResult;
|
|
729
|
+
/**
|
|
730
|
+
* Safely parses JSON string and validates as character
|
|
731
|
+
* @param jsonString - JSON string to parse and validate
|
|
732
|
+
* @returns Validation result with success flag and either data or error
|
|
733
|
+
*/
|
|
734
|
+
declare function parseAndValidateCharacter(jsonString: string): CharacterValidationResult;
|
|
735
|
+
/**
|
|
736
|
+
* Type guard to check if data is a valid Character
|
|
737
|
+
* @param data - Data to check
|
|
738
|
+
* @returns True if data is a valid Character
|
|
739
|
+
*/
|
|
740
|
+
declare function isValidCharacter(data: unknown): data is Character;
|
|
741
|
+
|
|
346
742
|
/**
|
|
347
743
|
* Composes a set of example conversations based on provided actions and a specified count.
|
|
348
744
|
* It randomly selects examples from the provided actions and formats them with generated names.
|
|
@@ -900,7 +1296,7 @@ declare let logger: pino.Logger<string, boolean>;
|
|
|
900
1296
|
declare const elizaLogger: pino.Logger<string, boolean>;
|
|
901
1297
|
|
|
902
1298
|
declare const shouldRespondTemplate = "<task>Decide on behalf of {{agentName}} whether they should respond to the message, ignore it or stop the conversation.</task>\n\n<providers>\n{{providers}}\n</providers>\n\n<instructions>Decide if {{agentName}} should respond to or interact with the conversation.\nIf the message is directed at or relevant to {{agentName}}, respond with RESPOND action.\nIf a user asks {{agentName}} to be quiet, respond with STOP action.\nIf {{agentName}} should ignore the message, respond with IGNORE action.</instructions>\n\n<output>\nDo NOT include any thinking, reasoning, or <think> sections in your response. \nGo directly to the XML response format without any preamble or explanation.\n\nRespond using XML format like this:\n<response>\n <name>{{agentName}}</name>\n <reasoning>Your reasoning here</reasoning>\n <action>RESPOND | IGNORE | STOP</action>\n</response>\n\nIMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.\n</output>";
|
|
903
|
-
declare const messageHandlerTemplate = "<task>Generate dialog and actions for the character {{agentName}}.</task>\n\n<providers>\n{{providers}}\n</providers>\n\nThese are the available valid actions:\n<actionNames>\n{{actionNames}}\n</actionNames>\n\n<instructions>\
|
|
1299
|
+
declare const messageHandlerTemplate = "<task>Generate dialog and actions for the character {{agentName}}.</task>\n\n<providers>\n{{providers}}\n</providers>\n\nThese are the available valid actions:\n<actionNames>\n{{actionNames}}\n</actionNames>\n\n<instructions>\nWrite a thought and plan for {{agentName}} and decide what actions to take. Also include the providers that {{agentName}} will use to have the right context for responding and acting, if any.\n\nIMPORTANT ACTION ORDERING RULES:\n- Actions are executed in the ORDER you list them - the order MATTERS!\n- REPLY should come FIRST to acknowledge the user's request before executing other actions\n- Common patterns:\n - For requests requiring tool use: REPLY,CALL_MCP_TOOL (acknowledge first, then gather info)\n - For task execution: REPLY,SEND_MESSAGE or REPLY,EVM_SWAP_TOKENS (acknowledge first, then do the task)\n - For multi-step operations: REPLY,ACTION1,ACTION2 (acknowledge first, then complete all steps)\n- REPLY is used to acknowledge and inform the user about what you're going to do\n- Follow-up actions execute the actual tasks after acknowledgment\n- Use IGNORE only when you should not respond at all\n\nIMPORTANT PROVIDER SELECTION RULES:\n- If the message mentions images, photos, pictures, attachments, or visual content, OR if you see \"(Attachments:\" in the conversation, you MUST include \"ATTACHMENTS\" in your providers list\n- If the message asks about or references specific people, include \"ENTITIES\" in your providers list \n- If the message asks about relationships or connections between people, include \"RELATIONSHIPS\" in your providers list\n- If the message asks about facts or specific information, include \"FACTS\" in your providers list\n- If the message asks about the environment or world context, include \"WORLD\" in your providers list\n- If you need external knowledge, information, or context beyond the current conversation to provide a helpful response, include \"KNOWLEDGE\" in your providers list\n\nFirst, think about what you want to do next and plan your actions. Then, write the next message and include the actions you plan to take.\n</instructions>\n\n<keys>\n\"thought\" should be a short description of what the agent is thinking about and planning.\n\"actions\" should be a comma-separated list of the actions {{agentName}} plans to take based on the thought, IN THE ORDER THEY SHOULD BE EXECUTED (if none, use IGNORE, if simply responding with text, use REPLY)\n\"providers\" should be a comma-separated list of the providers that {{agentName}} will use to have the right context for responding and acting (NEVER use \"IGNORE\" as a provider - use specific provider names like ATTACHMENTS, ENTITIES, FACTS, KNOWLEDGE, etc.)\n\"text\" should be the text of the next message for {{agentName}} which they will send to the conversation.\n</keys>\n\n<output>\nDo NOT include any thinking, reasoning, or <think> sections in your response. \nGo directly to the XML response format without any preamble or explanation.\n\nRespond using XML format like this:\n<response>\n <thought>Your thought here</thought>\n <actions>ACTION1,ACTION2</actions>\n <providers>PROVIDER1,PROVIDER2</providers>\n <text>Your response text here</text>\n</response>\n\nIMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.\n</output>";
|
|
904
1300
|
declare const postCreationTemplate = "# Task: Create a post in the voice and style and perspective of {{agentName}} @{{twitterUserName}}.\n\nExample task outputs:\n1. A post about the importance of AI in our lives\n<response>\n <thought>I am thinking about writing a post about the importance of AI in our lives</thought>\n <post>AI is changing the world and it is important to understand how it works</post>\n <imagePrompt>A futuristic cityscape with flying cars and people using AI to do things</imagePrompt>\n</response>\n\n2. A post about dogs\n<response>\n <thought>I am thinking about writing a post about dogs</thought>\n <post>Dogs are man's best friend and they are loyal and loving</post>\n <imagePrompt>A dog playing with a ball in a park</imagePrompt>\n</response>\n\n3. A post about finding a new job\n<response>\n <thought>Getting a job is hard, I bet there's a good tweet in that</thought>\n <post>Just keep going!</post>\n <imagePrompt>A person looking at a computer screen with a job search website</imagePrompt>\n</response>\n\n{{providers}}\n\nWrite a post that is {{adjective}} about {{topic}} (without mentioning {{topic}} directly), from the perspective of {{agentName}}. Do not add commentary or acknowledge this request, just write the post.\nYour response should be 1, 2, or 3 sentences (choose the length at random).\nYour response should not contain any questions. Brief, concise statements only. The total character count MUST be less than 280. No emojis. Use \\n\\n (double spaces) between statements if there are multiple statements in your response.\n\nYour output should be formatted in XML like this:\n<response>\n <thought>Your thought here</thought>\n <post>Your post text here</post>\n <imagePrompt>Optional image prompt here</imagePrompt>\n</response>\n\nThe \"post\" field should be the post you want to send. Do not including any thinking or internal reflection in the \"post\" field.\nThe \"imagePrompt\" field is optional and should be a prompt for an image that is relevant to the post. It should be a single sentence that captures the essence of the post. ONLY USE THIS FIELD if it makes sense that the post would benefit from an image.\nThe \"thought\" field should be a short description of what the agent is thinking about before responding, inlcuding a brief justification for the response. Includate an explanation how the post is relevant to the topic but unique and different than other posts.\n\nDo NOT include any thinking, reasoning, or <think> sections in your response. \nGo directly to the XML response format without any preamble or explanation.\n\nIMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.";
|
|
905
1301
|
declare const booleanFooter = "Respond with only a YES or a NO.";
|
|
906
1302
|
declare const imageDescriptionTemplate = "<task>Analyze the provided image and generate a comprehensive description with multiple levels of detail.</task>\n\n<instructions>\nCarefully examine the image and provide:\n1. A concise, descriptive title that captures the main subject or scene\n2. A brief summary description (1-2 sentences) highlighting the key elements\n3. An extensive, detailed description that covers all visible elements, composition, lighting, colors, mood, and any other relevant details\n\nBe objective and descriptive. Focus on what you can actually see in the image rather than making assumptions about context or meaning.\n</instructions>\n\n<output>\nDo NOT include any thinking, reasoning, or <think> sections in your response. \nGo directly to the XML response format without any preamble or explanation.\n\nRespond using XML format like this:\n<response>\n <title>A concise, descriptive title for the image</title>\n <description>A brief 1-2 sentence summary of the key elements in the image</description>\n <text>An extensive, detailed description covering all visible elements, composition, lighting, colors, mood, setting, objects, people, activities, and any other relevant details you can observe in the image</text>\n</response>\n\nIMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.\n</output>";
|
|
@@ -974,6 +1370,8 @@ declare class AgentRuntime implements IAgentRuntime {
|
|
|
974
1370
|
logger: any;
|
|
975
1371
|
private settings;
|
|
976
1372
|
private servicesInitQueue;
|
|
1373
|
+
private currentRunId?;
|
|
1374
|
+
private currentActionContext?;
|
|
977
1375
|
constructor(opts: {
|
|
978
1376
|
conversationLength?: number;
|
|
979
1377
|
agentId?: UUID;
|
|
@@ -987,6 +1385,22 @@ declare class AgentRuntime implements IAgentRuntime {
|
|
|
987
1385
|
};
|
|
988
1386
|
allAvailablePlugins?: Plugin[];
|
|
989
1387
|
});
|
|
1388
|
+
/**
|
|
1389
|
+
* Create a new run ID for tracking a sequence of model calls
|
|
1390
|
+
*/
|
|
1391
|
+
createRunId(): UUID;
|
|
1392
|
+
/**
|
|
1393
|
+
* Start a new run for tracking prompts
|
|
1394
|
+
*/
|
|
1395
|
+
startRun(): UUID;
|
|
1396
|
+
/**
|
|
1397
|
+
* End the current run
|
|
1398
|
+
*/
|
|
1399
|
+
endRun(): void;
|
|
1400
|
+
/**
|
|
1401
|
+
* Get the current run ID (creates one if it doesn't exist)
|
|
1402
|
+
*/
|
|
1403
|
+
getCurrentRunId(): UUID;
|
|
990
1404
|
registerPlugin(plugin: Plugin): Promise<void>;
|
|
991
1405
|
private resolvePluginDependencies;
|
|
992
1406
|
getAllServices(): Map<ServiceTypeName, Service>;
|
|
@@ -1090,6 +1504,7 @@ declare class AgentRuntime implements IAgentRuntime {
|
|
|
1090
1504
|
start?: number;
|
|
1091
1505
|
end?: number;
|
|
1092
1506
|
}): Promise<Memory[]>;
|
|
1507
|
+
getAllMemories(): Promise<Memory[]>;
|
|
1093
1508
|
getMemoryById(id: UUID): Promise<Memory | null>;
|
|
1094
1509
|
getMemoriesByIds(ids: UUID[], tableName?: string): Promise<Memory[]>;
|
|
1095
1510
|
getMemoriesByRoomIds(params: {
|
|
@@ -1135,6 +1550,7 @@ declare class AgentRuntime implements IAgentRuntime {
|
|
|
1135
1550
|
}): Promise<boolean>;
|
|
1136
1551
|
deleteMemory(memoryId: UUID): Promise<void>;
|
|
1137
1552
|
deleteManyMemories(memoryIds: UUID[]): Promise<void>;
|
|
1553
|
+
clearAllAgentMemories(): Promise<void>;
|
|
1138
1554
|
deleteAllMemories(roomId: UUID, tableName: string): Promise<void>;
|
|
1139
1555
|
countMemories(roomId: UUID, unique?: boolean, tableName?: string): Promise<number>;
|
|
1140
1556
|
getLogs(params: {
|
|
@@ -1302,174 +1718,6 @@ declare function encryptObjectValues(obj: Record<string, any>, salt: string): Re
|
|
|
1302
1718
|
*/
|
|
1303
1719
|
declare function decryptObjectValues(obj: Record<string, any>, salt: string): Record<string, any>;
|
|
1304
1720
|
|
|
1305
|
-
/**
|
|
1306
|
-
* Composes a context string by replacing placeholders in a template with corresponding values from the state.
|
|
1307
|
-
*
|
|
1308
|
-
* This function takes a template string with placeholders in the format `{{placeholder}}` and a state object.
|
|
1309
|
-
* It replaces each placeholder with the value from the state object that matches the placeholder's name.
|
|
1310
|
-
* If a matching key is not found in the state object for a given placeholder, the placeholder is replaced with an empty string.
|
|
1311
|
-
*
|
|
1312
|
-
* @param {Object} params - The parameters for composing the context.
|
|
1313
|
-
* @param {State} params.state - The state object containing values to replace the placeholders in the template.
|
|
1314
|
-
* @param {TemplateType} params.template - The template string or function containing placeholders to be replaced with state values.
|
|
1315
|
-
* @returns {string} The composed context string with placeholders replaced by corresponding state values.
|
|
1316
|
-
*
|
|
1317
|
-
* @example
|
|
1318
|
-
* // Given a state object and a template
|
|
1319
|
-
* const state = { userName: "Alice", userAge: 30 };
|
|
1320
|
-
* const template = "Hello, {{userName}}! You are {{userAge}} years old";
|
|
1321
|
-
*
|
|
1322
|
-
* // Composing the context with simple string replacement will result in:
|
|
1323
|
-
* // "Hello, Alice! You are 30 years old."
|
|
1324
|
-
* const contextSimple = composePromptFromState({ state, template });
|
|
1325
|
-
*
|
|
1326
|
-
* // Using composePromptFromState with a template function for dynamic template
|
|
1327
|
-
* const template = ({ state }) => {
|
|
1328
|
-
* const tone = Math.random() > 0.5 ? "kind" : "rude";
|
|
1329
|
-
* return `Hello, {{userName}}! You are {{userAge}} years old. Be ${tone}`;
|
|
1330
|
-
* };
|
|
1331
|
-
* const contextSimple = composePromptFromState({ state, template });
|
|
1332
|
-
*/
|
|
1333
|
-
/**
|
|
1334
|
-
* Function to compose a prompt using a provided template and state.
|
|
1335
|
-
* It compiles the template (upgrading double braces to triple braces for non-HTML escaping)
|
|
1336
|
-
* and then populates it with values from the state. Additionally, it processes the
|
|
1337
|
-
* resulting string with `composeRandomUser` to replace placeholders like `{{nameX}}`.
|
|
1338
|
-
*
|
|
1339
|
-
* @param {Object} options - Object containing state and template information.
|
|
1340
|
-
* @param {State} options.state - The state object containing values to fill the template.
|
|
1341
|
-
* @param {TemplateType} options.template - The template string or function to be used for composing the prompt.
|
|
1342
|
-
* @returns {string} The composed prompt output, with state values and random user names populated.
|
|
1343
|
-
*/
|
|
1344
|
-
declare const composePrompt: ({ state, template, }: {
|
|
1345
|
-
state: {
|
|
1346
|
-
[key: string]: string;
|
|
1347
|
-
};
|
|
1348
|
-
template: TemplateType;
|
|
1349
|
-
}) => string;
|
|
1350
|
-
/**
|
|
1351
|
-
* Function to compose a prompt using a provided template and state.
|
|
1352
|
-
*
|
|
1353
|
-
* @param {Object} options - Object containing state and template information.
|
|
1354
|
-
* @param {State} options.state - The state object containing values to fill the template.
|
|
1355
|
-
* @param {TemplateType} options.template - The template to be used for composing the prompt.
|
|
1356
|
-
* @returns {string} The composed prompt output.
|
|
1357
|
-
*/
|
|
1358
|
-
declare const composePromptFromState: ({ state, template, }: {
|
|
1359
|
-
state: State;
|
|
1360
|
-
template: TemplateType;
|
|
1361
|
-
}) => string;
|
|
1362
|
-
/**
|
|
1363
|
-
* Adds a header to a body of text.
|
|
1364
|
-
*
|
|
1365
|
-
* This function takes a header string and a body string and returns a new string with the header prepended to the body.
|
|
1366
|
-
* If the body string is empty, the header is returned as is.
|
|
1367
|
-
*
|
|
1368
|
-
* @param {string} header - The header to add to the body.
|
|
1369
|
-
* @param {string} body - The body to which to add the header.
|
|
1370
|
-
* @returns {string} The body with the header prepended.
|
|
1371
|
-
*
|
|
1372
|
-
* @example
|
|
1373
|
-
* // Given a header and a body
|
|
1374
|
-
* const header = "Header";
|
|
1375
|
-
* const body = "Body";
|
|
1376
|
-
*
|
|
1377
|
-
* // Adding the header to the body will result in:
|
|
1378
|
-
* // "Header\nBody"
|
|
1379
|
-
* const text = addHeader(header, body);
|
|
1380
|
-
*/
|
|
1381
|
-
declare const addHeader: (header: string, body: string) => string;
|
|
1382
|
-
declare const formatPosts: ({ messages, entities, conversationHeader, }: {
|
|
1383
|
-
messages: Memory[];
|
|
1384
|
-
entities: Entity[];
|
|
1385
|
-
conversationHeader?: boolean;
|
|
1386
|
-
}) => string;
|
|
1387
|
-
/**
|
|
1388
|
-
* Format messages into a string
|
|
1389
|
-
* @param {Object} params - The formatting parameters
|
|
1390
|
-
* @param {Memory[]} params.messages - List of messages to format
|
|
1391
|
-
* @param {Entity[]} params.entities - List of entities for name resolution
|
|
1392
|
-
* @returns {string} Formatted message string with timestamps and user information
|
|
1393
|
-
*/
|
|
1394
|
-
declare const formatMessages: ({ messages, entities, }: {
|
|
1395
|
-
messages: Memory[];
|
|
1396
|
-
entities: Entity[];
|
|
1397
|
-
}) => string;
|
|
1398
|
-
declare const formatTimestamp: (messageDate: number) => string;
|
|
1399
|
-
/**
|
|
1400
|
-
* Parses key-value pairs from a simple XML structure within a given text.
|
|
1401
|
-
* It looks for an XML block (e.g., <response>...</response>) and extracts
|
|
1402
|
-
* text content from direct child elements (e.g., <key>value</key>).
|
|
1403
|
-
*
|
|
1404
|
-
* Note: This uses regex and is suitable for simple, predictable XML structures.
|
|
1405
|
-
* For complex XML, a proper parsing library is recommended.
|
|
1406
|
-
*
|
|
1407
|
-
* @param text - The input text containing the XML structure.
|
|
1408
|
-
* @returns An object with key-value pairs extracted from the XML, or null if parsing fails.
|
|
1409
|
-
*/
|
|
1410
|
-
declare function parseKeyValueXml(text: string): Record<string, any> | null;
|
|
1411
|
-
/**
|
|
1412
|
-
* Parses a JSON object from a given text. The function looks for a JSON block wrapped in triple backticks
|
|
1413
|
-
* with `json` language identifier, and if not found, it searches for an object pattern within the text.
|
|
1414
|
-
* It then attempts to parse the JSON string into a JavaScript object. If parsing is successful and the result
|
|
1415
|
-
* is an object (but not an array), it returns the object; otherwise, it tries to parse an array if the result
|
|
1416
|
-
* is an array, or returns null if parsing is unsuccessful or the result is neither an object nor an array.
|
|
1417
|
-
*
|
|
1418
|
-
* @param text - The input text from which to extract and parse the JSON object.
|
|
1419
|
-
* @returns An object parsed from the JSON string if successful; otherwise, null or the result of parsing an array.
|
|
1420
|
-
*/
|
|
1421
|
-
declare function parseJSONObjectFromText(text: string): Record<string, any> | null;
|
|
1422
|
-
/**
|
|
1423
|
-
* Normalizes a JSON-like string by correcting formatting issues:
|
|
1424
|
-
* - Removes extra spaces after '{' and before '}'.
|
|
1425
|
-
* - Wraps unquoted values in double quotes.
|
|
1426
|
-
* - Converts single-quoted values to double-quoted.
|
|
1427
|
-
* - Ensures consistency in key-value formatting.
|
|
1428
|
-
* - Normalizes mixed adjacent quote pairs.
|
|
1429
|
-
*
|
|
1430
|
-
* This is useful for cleaning up improperly formatted JSON strings
|
|
1431
|
-
* before parsing them into valid JSON.
|
|
1432
|
-
*
|
|
1433
|
-
* @param str - The JSON-like string to normalize.
|
|
1434
|
-
* @returns A properly formatted JSON string.
|
|
1435
|
-
*/
|
|
1436
|
-
declare const normalizeJsonString: (str: string) => string;
|
|
1437
|
-
/**
|
|
1438
|
-
* Truncate text to fit within the character limit, ensuring it ends at a complete sentence.
|
|
1439
|
-
*/
|
|
1440
|
-
declare function truncateToCompleteSentence(text: string, maxLength: number): string;
|
|
1441
|
-
declare function splitChunks(content: string, chunkSize?: number, bleed?: number): Promise<string[]>;
|
|
1442
|
-
/**
|
|
1443
|
-
* Trims the provided text prompt to a specified token limit using a tokenizer model and type.
|
|
1444
|
-
*/
|
|
1445
|
-
declare function trimTokens(prompt: string, maxTokens: number, runtime: IAgentRuntime): Promise<string>;
|
|
1446
|
-
declare function safeReplacer(): (key: string, value: any) => any;
|
|
1447
|
-
/**
|
|
1448
|
-
* Parses a string to determine its boolean equivalent.
|
|
1449
|
-
*
|
|
1450
|
-
* Recognized affirmative values: "YES", "Y", "TRUE", "T", "1", "ON", "ENABLE"
|
|
1451
|
-
* Recognized negative values: "NO", "N", "FALSE", "F", "0", "OFF", "DISABLE"
|
|
1452
|
-
*
|
|
1453
|
-
* @param {string | undefined | null} value - The input text to parse
|
|
1454
|
-
* @returns {boolean} - Returns `true` for affirmative inputs, `false` for negative or unrecognized inputs
|
|
1455
|
-
*/
|
|
1456
|
-
declare function parseBooleanFromText(value: string | undefined | null): boolean;
|
|
1457
|
-
/**
|
|
1458
|
-
* Validates a UUID value.
|
|
1459
|
-
*
|
|
1460
|
-
* @param {unknown} value - The value to validate.
|
|
1461
|
-
* @returns {UUID | null} Returns the validated UUID value or null if validation fails.
|
|
1462
|
-
*/
|
|
1463
|
-
declare function validateUuid(value: unknown): UUID | null;
|
|
1464
|
-
/**
|
|
1465
|
-
* Converts a string or number to a UUID.
|
|
1466
|
-
*
|
|
1467
|
-
* @param {string | number} target - The string or number to convert to a UUID.
|
|
1468
|
-
* @returns {UUID} The UUID generated from the input target.
|
|
1469
|
-
* @throws {TypeError} Throws an error if the input target is not a string.
|
|
1470
|
-
*/
|
|
1471
|
-
declare function stringToUuid(target: string | number): UUID;
|
|
1472
|
-
|
|
1473
1721
|
declare const defaultSpec: typeof v2;
|
|
1474
1722
|
|
|
1475
|
-
export { Action, Agent, AgentRuntime, ChannelType, Character, Component, Content, DatabaseAdapter, type DeriveKeyAttestationData, Entity, Evaluator, HandlerCallback, IAgentRuntime, IDatabaseAdapter, ILpService, ITokenDataService, IWalletService, Log, type LpPositionDetails, Memory, MemoryMetadata, Metadata, ModelHandler, ModelParamsMap, ModelResultMap, ModelTypeName, OnboardingConfig, Participant, Plugin, type PoolInfo, Provider, Relationship, type RemoteAttestationMessage, type RemoteAttestationQuote, Role, Room, Route, RuntimeSettings, Semaphore, SendHandlerFunction, type ServerOwnershipState, Service, ServiceTypeName, Setting, State, TEEMode, TargetInfo, Task, TaskWorker, type TeeAgent, type TeePluginConfig, TeeType, TemplateType, type TokenBalance, type TokenData, type TransactionResult, UUID, type WalletAsset, type WalletPortfolio, World, WorldSettings, addHeader, booleanFooter, composeActionExamples, composePrompt, composePromptFromState, createLogger, createSettingFromConfig, createUniqueUuid, decryptObjectValues, decryptStringValue as decryptSecret, decryptStringValue, decryptedCharacter, defaultSpec, elizaLogger, encryptObjectValues, encryptStringValue, encryptedCharacter, findEntityByName, findWorldsForOwner, formatActionNames, formatActions, formatEntities, formatMessages, formatPosts, formatTimestamp, getEntityDetails, getSalt, getUserServerRole, getWorldSettings, imageDescriptionTemplate, initializeOnboarding, logger, messageHandlerTemplate, normalizeJsonString, parseBooleanFromText, parseJSONObjectFromText, parseKeyValueXml, postCreationTemplate, safeReplacer, saltSettingValue, saltWorldSettings, shouldRespondTemplate, splitChunks, stringToUuid, trimTokens, truncateToCompleteSentence, unsaltSettingValue, unsaltWorldSettings, updateWorldSettings, v2, validateUuid };
|
|
1723
|
+
export { Action, Agent, AgentRuntime, ChannelType, Character, type CharacterValidationResult, Component, Content, ContentType, DatabaseAdapter, type DeriveKeyAttestationData, Entity, Evaluator, HandlerCallback, IAgentRuntime, IDatabaseAdapter, ILpService, ITokenDataService, IWalletService, Log, type LpPositionDetails, Memory, MemoryMetadata, Metadata, ModelHandler, ModelParamsMap, ModelResultMap, ModelTypeName, OnboardingConfig, Participant, Plugin, type PoolInfo, Provider, Relationship, type RemoteAttestationMessage, type RemoteAttestationQuote, Role, Room, Route, RuntimeSettings, Semaphore, SendHandlerFunction, type ServerOwnershipState, Service, ServiceTypeName, Setting, State, TEEMode, TargetInfo, Task, TaskWorker, type TeeAgent, type TeePluginConfig, TeeType, TemplateType, type TokenBalance, type TokenData, type TransactionResult, UUID, type WalletAsset, type WalletPortfolio, World, WorldSettings, addHeader, booleanFooter, characterSchema, composeActionExamples, composePrompt, composePromptFromState, createLogger, createSettingFromConfig, createUniqueUuid, decryptObjectValues, decryptStringValue as decryptSecret, decryptStringValue, decryptedCharacter, defaultSpec, elizaLogger, encryptObjectValues, encryptStringValue, encryptedCharacter, findEntityByName, findWorldsForOwner, formatActionNames, formatActions, formatEntities, formatMessages, formatPosts, formatTimestamp, getContentTypeFromMimeType, getEntityDetails, getSalt, getUserServerRole, getWorldSettings, imageDescriptionTemplate, initializeOnboarding, isValidCharacter, logger, messageHandlerTemplate, normalizeJsonString, parseAndValidateCharacter, parseBooleanFromText, parseJSONObjectFromText, parseKeyValueXml, postCreationTemplate, safeReplacer, saltSettingValue, saltWorldSettings, shouldRespondTemplate, splitChunks, stringToUuid, trimTokens, truncateToCompleteSentence, unsaltSettingValue, unsaltWorldSettings, updateWorldSettings, v2, validateCharacter, validateUuid };
|