@elizaos/plugin-trust 1.2.1 → 2.0.0-alpha.4

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 (63) hide show
  1. package/dist/actions/evaluateTrust.d.ts +3 -0
  2. package/dist/actions/evaluateTrust.d.ts.map +1 -0
  3. package/dist/actions/index.d.ts +6 -0
  4. package/dist/actions/index.d.ts.map +1 -0
  5. package/dist/actions/recordTrustInteraction.d.ts +3 -0
  6. package/dist/actions/recordTrustInteraction.d.ts.map +1 -0
  7. package/dist/actions/requestElevation.d.ts +3 -0
  8. package/dist/actions/requestElevation.d.ts.map +1 -0
  9. package/dist/actions/roles.d.ts +13 -0
  10. package/dist/actions/roles.d.ts.map +1 -0
  11. package/dist/actions/settings.d.ts +21 -0
  12. package/dist/actions/settings.d.ts.map +1 -0
  13. package/dist/evaluators/index.d.ts +3 -0
  14. package/dist/evaluators/index.d.ts.map +1 -0
  15. package/dist/evaluators/reflection.d.ts +3 -0
  16. package/dist/evaluators/reflection.d.ts.map +1 -0
  17. package/dist/evaluators/trustChangeEvaluator.d.ts +3 -0
  18. package/dist/evaluators/trustChangeEvaluator.d.ts.map +1 -0
  19. package/dist/framework/TrustAwarePlugin.d.ts +60 -0
  20. package/dist/framework/TrustAwarePlugin.d.ts.map +1 -0
  21. package/dist/index.d.ts +42 -809
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +18128 -4475
  24. package/dist/index.js.map +103 -1
  25. package/dist/providers/index.d.ts +5 -0
  26. package/dist/providers/index.d.ts.map +1 -0
  27. package/dist/providers/roles.d.ts +19 -0
  28. package/dist/providers/roles.d.ts.map +1 -0
  29. package/dist/providers/securityStatus.d.ts +3 -0
  30. package/dist/providers/securityStatus.d.ts.map +1 -0
  31. package/dist/providers/settings.d.ts +7 -0
  32. package/dist/providers/settings.d.ts.map +1 -0
  33. package/dist/providers/trustProfile.d.ts +3 -0
  34. package/dist/providers/trustProfile.d.ts.map +1 -0
  35. package/dist/schema.d.ts +1169 -0
  36. package/dist/schema.d.ts.map +1 -0
  37. package/dist/services/ContextualPermissionSystem.d.ts +40 -0
  38. package/dist/services/ContextualPermissionSystem.d.ts.map +1 -0
  39. package/dist/services/CredentialProtector.d.ts +53 -0
  40. package/dist/services/CredentialProtector.d.ts.map +1 -0
  41. package/dist/services/LLMEvaluator.d.ts +44 -0
  42. package/dist/services/LLMEvaluator.d.ts.map +1 -0
  43. package/dist/services/SecurityModule.d.ts +137 -0
  44. package/dist/services/SecurityModule.d.ts.map +1 -0
  45. package/dist/services/SecurityStore.d.ts +48 -0
  46. package/dist/services/SecurityStore.d.ts.map +1 -0
  47. package/dist/services/TrustEngine.d.ts +81 -0
  48. package/dist/services/TrustEngine.d.ts.map +1 -0
  49. package/dist/services/db.d.ts +12 -0
  50. package/dist/services/db.d.ts.map +1 -0
  51. package/dist/services/index.d.ts +6 -0
  52. package/dist/services/index.d.ts.map +1 -0
  53. package/dist/tests.d.ts +3 -0
  54. package/dist/tests.d.ts.map +1 -0
  55. package/dist/types/permissions.d.ts +185 -0
  56. package/dist/types/permissions.d.ts.map +1 -0
  57. package/dist/types/security.d.ts +114 -0
  58. package/dist/types/security.d.ts.map +1 -0
  59. package/dist/types/trust.d.ts +179 -0
  60. package/dist/types/trust.d.ts.map +1 -0
  61. package/package.json +26 -17
  62. package/LICENSE +0 -21
  63. package/README.md +0 -244
@@ -0,0 +1,3 @@
1
+ import { type Action } from "@elizaos/core";
2
+ export declare const evaluateTrustAction: Action;
3
+ //# sourceMappingURL=evaluateTrust.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluateTrust.d.ts","sourceRoot":"","sources":["../../src/actions/evaluateTrust.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EAOZ,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,mBAAmB,EAAE,MAsMjC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from "./evaluateTrust";
2
+ export * from "./recordTrustInteraction";
3
+ export * from "./requestElevation";
4
+ export * from "./roles";
5
+ export * from "./settings";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Action } from "@elizaos/core";
2
+ export declare const recordTrustInteractionAction: Action;
3
+ //# sourceMappingURL=recordTrustInteraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordTrustInteraction.d.ts","sourceRoot":"","sources":["../../src/actions/recordTrustInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EAMZ,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,4BAA4B,EAAE,MAmK1C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Action } from "@elizaos/core";
2
+ export declare const requestElevationAction: Action;
3
+ //# sourceMappingURL=requestElevation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestElevation.d.ts","sourceRoot":"","sources":["../../src/actions/requestElevation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EAKZ,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,sBAAsB,EAAE,MA6KpC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { type Action } from "@elizaos/core";
2
+ /**
3
+ * Represents an action to update the role of a user within a server.
4
+ * @typedef {Object} Action
5
+ * @property {string} name - The name of the action.
6
+ * @property {string[]} similes - The similar actions that can be performed.
7
+ * @property {string} description - A description of the action and its purpose.
8
+ * @property {Function} validate - A function to validate the action before execution.
9
+ * @property {Function} handler - A function to handle the execution of the action.
10
+ * @property {ActionExample[][]} examples - Examples demonstrating how the action can be used.
11
+ */
12
+ export declare const updateRoleAction: Action;
13
+ //# sourceMappingURL=roles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../src/actions/roles.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EAcZ,MAAM,eAAe,CAAC;AAqFvB;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAwQ9B,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { type Action, type IAgentRuntime, type WorldSettings } from "@elizaos/core";
2
+ /**
3
+ * Gets settings state from world metadata
4
+ */
5
+ /**
6
+ * Retrieves the settings for a specific world from the database.
7
+ * @param {IAgentRuntime} runtime - The Agent Runtime instance.
8
+ * @param {string} serverId - The ID of the server.
9
+ * @returns {Promise<WorldSettings | null>} The settings of the world, or null if not found.
10
+ */
11
+ export declare function getWorldSettings(runtime: IAgentRuntime, serverId: string): Promise<WorldSettings | null>;
12
+ /**
13
+ * Updates settings state in world metadata
14
+ */
15
+ export declare function updateWorldSettings(runtime: IAgentRuntime, serverId: string, worldSettings: WorldSettings): Promise<boolean>;
16
+ /**
17
+ * Enhanced settings action with improved state management and logging
18
+ * Updated to use world metadata instead of cache
19
+ */
20
+ export declare const updateSettingsAction: Action;
21
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/actions/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EAUX,KAAK,aAAa,EAOlB,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAsNvB;;GAEG;AACH;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAc/B;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,OAAO,CAAC,CA0BlB;AAuZD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,MA6WlC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./reflection";
2
+ export * from "./trustChangeEvaluator";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/evaluators/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Evaluator } from "@elizaos/core";
2
+ export declare const reflectionEvaluator: Evaluator;
3
+ //# sourceMappingURL=reflection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflection.d.ts","sourceRoot":"","sources":["../../src/evaluators/reflection.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EAUf,MAAM,eAAe,CAAC;AAuTvB,eAAO,MAAM,mBAAmB,EAAE,SAyMjC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Evaluator } from "@elizaos/core";
2
+ export declare const trustChangeEvaluator: Evaluator;
3
+ //# sourceMappingURL=trustChangeEvaluator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trustChangeEvaluator.d.ts","sourceRoot":"","sources":["../../src/evaluators/trustChangeEvaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAKf,MAAM,eAAe,CAAC;AAQvB,eAAO,MAAM,oBAAoB,EAAE,SA8TlC,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { type Action, type Evaluator, type IAgentRuntime, type Memory, type Plugin, type Provider, Service, type UUID } from "@elizaos/core";
2
+ import type { ContextualPermissionSystem } from "../services/ContextualPermissionSystem";
3
+ import type { SecurityModule } from "../services/SecurityModule";
4
+ import type { TrustEngine } from "../services/TrustEngine";
5
+ import { type ActionPermission } from "../types/permissions";
6
+ /**
7
+ * Base class for trust-aware plugins
8
+ * Provides automatic trust checking and permission management
9
+ */
10
+ export declare abstract class TrustAwarePlugin implements Plugin {
11
+ protected trustEngine: TrustEngine | null;
12
+ protected permissionSystem: ContextualPermissionSystem | null;
13
+ protected securityModule: SecurityModule | null;
14
+ /**
15
+ * Define required trust levels for actions
16
+ * Override in subclasses
17
+ */
18
+ protected abstract trustRequirements: Record<string, number>;
19
+ /**
20
+ * Define required permissions for actions
21
+ * Override in subclasses
22
+ */
23
+ protected abstract permissions: Record<string, ActionPermission>;
24
+ /**
25
+ * Initialize trust-aware services
26
+ */
27
+ init(_config: Record<string, string>, runtime: IAgentRuntime): Promise<void>;
28
+ /**
29
+ * Wrap an action with trust and permission checking
30
+ */
31
+ protected wrapAction(action: Action): Action;
32
+ /**
33
+ * Check if user has permission to execute action
34
+ */
35
+ protected checkPermission(runtime: IAgentRuntime, message: Memory, permission: ActionPermission): Promise<boolean>;
36
+ /**
37
+ * Get trust level for a user
38
+ */
39
+ protected getTrustLevel(runtime: IAgentRuntime, userId: UUID): Promise<number>;
40
+ /**
41
+ * Check if user is trusted (>= 80 trust score)
42
+ */
43
+ protected isTrusted(runtime: IAgentRuntime, userId: UUID): Promise<boolean>;
44
+ /**
45
+ * Check if user is admin
46
+ */
47
+ protected isAdmin(_userId: UUID): boolean;
48
+ /**
49
+ * Check if user is system/agent
50
+ */
51
+ protected isSystem(_userId: UUID): boolean;
52
+ abstract name: string;
53
+ abstract description: string;
54
+ abstract actions?: Action[];
55
+ abstract providers?: Provider[];
56
+ abstract evaluators?: Evaluator[];
57
+ abstract services?: (typeof Service)[];
58
+ }
59
+ export declare const exampleTrustAwarePlugin: Plugin;
60
+ //# sourceMappingURL=TrustAwarePlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TrustAwarePlugin.d.ts","sourceRoot":"","sources":["../../src/framework/TrustAwarePlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KA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