@elizaos/plugin-trust 1.2.0 → 1.2.2
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/actions/evaluateTrust.d.ts +3 -0
- package/dist/actions/evaluateTrust.d.ts.map +1 -0
- package/dist/actions/hasTrustEngine.d.ts +3 -0
- package/dist/actions/hasTrustEngine.d.ts.map +1 -0
- package/dist/actions/index.d.ts +6 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/recordTrustInteraction.d.ts +3 -0
- package/dist/actions/recordTrustInteraction.d.ts.map +1 -0
- package/dist/actions/requestElevation.d.ts +3 -0
- package/dist/actions/requestElevation.d.ts.map +1 -0
- package/dist/actions/roles.d.ts +13 -0
- package/dist/actions/roles.d.ts.map +1 -0
- package/dist/actions/settings.d.ts +21 -0
- package/dist/actions/settings.d.ts.map +1 -0
- package/dist/evaluators/index.d.ts +4 -0
- package/dist/evaluators/index.d.ts.map +1 -0
- package/dist/evaluators/reflection.d.ts +3 -0
- package/dist/evaluators/reflection.d.ts.map +1 -0
- package/dist/evaluators/securityEvaluator.d.ts +28 -0
- package/dist/evaluators/securityEvaluator.d.ts.map +1 -0
- package/dist/evaluators/trustChangeEvaluator.d.ts +3 -0
- package/dist/evaluators/trustChangeEvaluator.d.ts.map +1 -0
- package/dist/framework/TrustAwarePlugin.d.ts +60 -0
- package/dist/framework/TrustAwarePlugin.d.ts.map +1 -0
- package/dist/index.d.ts +34 -827
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5202 -4537
- package/dist/index.js.map +35 -1
- package/dist/providers/adminTrust.d.ts +3 -0
- package/dist/providers/adminTrust.d.ts.map +1 -0
- package/dist/providers/index.d.ts +6 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/roles.d.ts +19 -0
- package/dist/providers/roles.d.ts.map +1 -0
- package/dist/providers/securityStatus.d.ts +15 -0
- package/dist/providers/securityStatus.d.ts.map +1 -0
- package/dist/providers/settings.d.ts +7 -0
- package/dist/providers/settings.d.ts.map +1 -0
- package/dist/providers/trustProfile.d.ts +3 -0
- package/dist/providers/trustProfile.d.ts.map +1 -0
- package/dist/schema.d.ts +1170 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/services/ContextualPermissionSystem.d.ts +40 -0
- package/dist/services/ContextualPermissionSystem.d.ts.map +1 -0
- package/dist/services/CredentialProtector.d.ts +62 -0
- package/dist/services/CredentialProtector.d.ts.map +1 -0
- package/dist/services/SecurityModule.d.ts +145 -0
- package/dist/services/SecurityModule.d.ts.map +1 -0
- package/dist/services/SecurityStore.d.ts +53 -0
- package/dist/services/SecurityStore.d.ts.map +1 -0
- package/dist/services/TrustEngine.d.ts +81 -0
- package/dist/services/TrustEngine.d.ts.map +1 -0
- package/dist/services/adminContext.d.ts +3 -0
- package/dist/services/adminContext.d.ts.map +1 -0
- package/dist/services/db.d.ts +12 -0
- package/dist/services/db.d.ts.map +1 -0
- package/dist/services/index.d.ts +5 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/tests.d.ts +3 -0
- package/dist/tests.d.ts.map +1 -0
- package/dist/types/permissions.d.ts +185 -0
- package/dist/types/permissions.d.ts.map +1 -0
- package/dist/types/security.d.ts +114 -0
- package/dist/types/security.d.ts.map +1 -0
- package/dist/types/trust.d.ts +179 -0
- package/dist/types/trust.d.ts.map +1 -0
- package/package.json +40 -16
- package/LICENSE +0 -21
- package/README.md +0 -5
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { UUID } from "@elizaos/core";
|
|
2
|
+
import type { PermissionContext } from "./permissions";
|
|
3
|
+
export interface SecurityContext extends PermissionContext {
|
|
4
|
+
entityId?: UUID;
|
|
5
|
+
requestedAction?: string;
|
|
6
|
+
messageHistory?: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface SecurityCheck {
|
|
9
|
+
detected: boolean;
|
|
10
|
+
confidence: number;
|
|
11
|
+
type: "prompt_injection" | "social_engineering" | "credential_theft" | "anomaly" | "none";
|
|
12
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
13
|
+
action: "block" | "require_verification" | "allow" | "log_only";
|
|
14
|
+
details?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ThreatAssessment extends SecurityCheck {
|
|
17
|
+
recommendation?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SecurityEvent {
|
|
20
|
+
id?: UUID;
|
|
21
|
+
type: SecurityEventType;
|
|
22
|
+
entityId: UUID;
|
|
23
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
24
|
+
context: PermissionContext;
|
|
25
|
+
details: Record<string, unknown>;
|
|
26
|
+
timestamp?: number;
|
|
27
|
+
handled?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare enum SecurityEventType {
|
|
30
|
+
PROMPT_INJECTION_ATTEMPT = "prompt_injection_attempt",
|
|
31
|
+
SOCIAL_ENGINEERING_ATTEMPT = "social_engineering_attempt",
|
|
32
|
+
PRIVILEGE_ESCALATION_ATTEMPT = "privilege_escalation_attempt",
|
|
33
|
+
ANOMALOUS_REQUEST = "anomalous_request",
|
|
34
|
+
TRUST_MANIPULATION = "trust_manipulation",
|
|
35
|
+
IDENTITY_SPOOFING = "identity_spoofing",
|
|
36
|
+
MULTI_ACCOUNT_ABUSE = "multi_account_abuse",
|
|
37
|
+
CREDENTIAL_THEFT_ATTEMPT = "credential_theft_attempt",
|
|
38
|
+
PHISHING_ATTEMPT = "phishing_attempt",
|
|
39
|
+
IMPERSONATION_ATTEMPT = "impersonation_attempt",
|
|
40
|
+
COORDINATED_ATTACK = "coordinated_attack",
|
|
41
|
+
MALICIOUS_LINK_CAMPAIGN = "malicious_link_campaign"
|
|
42
|
+
}
|
|
43
|
+
export interface PatternDetection {
|
|
44
|
+
type: "multi_account" | "phishing" | "impersonation" | "coordination" | "credential_theft";
|
|
45
|
+
confidence: number;
|
|
46
|
+
evidence: string[];
|
|
47
|
+
relatedEntities?: UUID[];
|
|
48
|
+
recommendation: string;
|
|
49
|
+
}
|
|
50
|
+
export interface MultiAccountDetection extends PatternDetection {
|
|
51
|
+
type: "multi_account";
|
|
52
|
+
primaryAccount: UUID;
|
|
53
|
+
linkedAccounts: UUID[];
|
|
54
|
+
linkageEvidence: {
|
|
55
|
+
typingPattern: number;
|
|
56
|
+
timingPattern: number;
|
|
57
|
+
vocabularyPattern: number;
|
|
58
|
+
behaviorPattern: number;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface PhishingDetection extends PatternDetection {
|
|
62
|
+
type: "phishing";
|
|
63
|
+
maliciousLinks?: string[];
|
|
64
|
+
targetedEntities: UUID[];
|
|
65
|
+
campaignId?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface ImpersonationDetection extends PatternDetection {
|
|
68
|
+
type: "impersonation";
|
|
69
|
+
impersonator: string;
|
|
70
|
+
impersonated: string;
|
|
71
|
+
visualSimilarity: number;
|
|
72
|
+
timingCoincidence: number;
|
|
73
|
+
}
|
|
74
|
+
export interface CoordinationDetection extends PatternDetection {
|
|
75
|
+
type: "coordination";
|
|
76
|
+
coordinatedEntities: UUID[];
|
|
77
|
+
timeWindow: number;
|
|
78
|
+
correlationScore: number;
|
|
79
|
+
}
|
|
80
|
+
export interface CredentialTheftDetection extends PatternDetection {
|
|
81
|
+
type: "credential_theft";
|
|
82
|
+
sensitivePatterns: string[];
|
|
83
|
+
attemptedTheft: string[];
|
|
84
|
+
potentialVictims: UUID[];
|
|
85
|
+
}
|
|
86
|
+
export interface BehavioralProfile {
|
|
87
|
+
entityId: UUID;
|
|
88
|
+
typingSpeed: number;
|
|
89
|
+
vocabularyComplexity: number;
|
|
90
|
+
messageLength: {
|
|
91
|
+
mean: number;
|
|
92
|
+
stdDev: number;
|
|
93
|
+
};
|
|
94
|
+
activeHours: number[];
|
|
95
|
+
commonPhrases: string[];
|
|
96
|
+
interactionPatterns: Map<string, number>;
|
|
97
|
+
}
|
|
98
|
+
export interface Message {
|
|
99
|
+
id: UUID;
|
|
100
|
+
entityId: UUID;
|
|
101
|
+
content: string;
|
|
102
|
+
timestamp: number;
|
|
103
|
+
roomId?: UUID;
|
|
104
|
+
replyTo?: UUID;
|
|
105
|
+
}
|
|
106
|
+
export interface Action {
|
|
107
|
+
id: UUID;
|
|
108
|
+
entityId: UUID;
|
|
109
|
+
type: string;
|
|
110
|
+
timestamp: number;
|
|
111
|
+
target?: string;
|
|
112
|
+
result?: "success" | "failure";
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/types/security.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,kBAAkB,GAAG,oBAAoB,GAAG,kBAAkB,GAAG,SAAS,GAAG,MAAM,CAAC;IAC1F,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;IACjD,MAAM,EAAE,OAAO,GAAG,sBAAsB,GAAG,OAAO,GAAG,UAAU,CAAC;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,IAAI,CAAC;IACV,IAAI,EAAE,iBAAiB,CAAC;IACxB,QAAQ,EAAE,IAAI,CAAC;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IACrB,EAAE,EAAE,IAAI,CAAC;IACT,QAAQ,EAAE,IAAI,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAChC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import type { UUID } from "@elizaos/core";
|
|
2
|
+
/**
|
|
3
|
+
* Core trust dimensions based on interpersonal trust theory
|
|
4
|
+
*/
|
|
5
|
+
export interface TrustDimensions {
|
|
6
|
+
/** Consistency in behavior and promise keeping (0-100) */
|
|
7
|
+
reliability: number;
|
|
8
|
+
/** Ability to perform tasks and provide value (0-100) */
|
|
9
|
+
competence: number;
|
|
10
|
+
/** Adherence to ethical principles (0-100) */
|
|
11
|
+
integrity: number;
|
|
12
|
+
/** Good intentions towards others (0-100) */
|
|
13
|
+
benevolence: number;
|
|
14
|
+
/** Open and honest communication (0-100) */
|
|
15
|
+
transparency: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Evidence types that impact trust scores
|
|
19
|
+
*/
|
|
20
|
+
export declare enum TrustEvidenceType {
|
|
21
|
+
PROMISE_KEPT = "PROMISE_KEPT",
|
|
22
|
+
HELPFUL_ACTION = "HELPFUL_ACTION",
|
|
23
|
+
CONSISTENT_BEHAVIOR = "CONSISTENT_BEHAVIOR",
|
|
24
|
+
VERIFIED_IDENTITY = "VERIFIED_IDENTITY",
|
|
25
|
+
COMMUNITY_CONTRIBUTION = "COMMUNITY_CONTRIBUTION",
|
|
26
|
+
SUCCESSFUL_TRANSACTION = "SUCCESSFUL_TRANSACTION",
|
|
27
|
+
PROMISE_BROKEN = "PROMISE_BROKEN",
|
|
28
|
+
HARMFUL_ACTION = "HARMFUL_ACTION",
|
|
29
|
+
INCONSISTENT_BEHAVIOR = "INCONSISTENT_BEHAVIOR",
|
|
30
|
+
SUSPICIOUS_ACTIVITY = "SUSPICIOUS_ACTIVITY",
|
|
31
|
+
FAILED_VERIFICATION = "FAILED_VERIFICATION",
|
|
32
|
+
SPAM_BEHAVIOR = "SPAM_BEHAVIOR",
|
|
33
|
+
SECURITY_VIOLATION = "SECURITY_VIOLATION",
|
|
34
|
+
IDENTITY_CHANGE = "IDENTITY_CHANGE",
|
|
35
|
+
ROLE_CHANGE = "ROLE_CHANGE",
|
|
36
|
+
CONTEXT_SWITCH = "CONTEXT_SWITCH"
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A piece of evidence that affects trust
|
|
40
|
+
*/
|
|
41
|
+
export interface TrustEvidence {
|
|
42
|
+
type: TrustEvidenceType;
|
|
43
|
+
timestamp: number;
|
|
44
|
+
/** Impact on trust score (-100 to +100) */
|
|
45
|
+
impact: number;
|
|
46
|
+
/** Weight/importance of this evidence (0-1) */
|
|
47
|
+
weight: number;
|
|
48
|
+
/** Optional description of the evidence */
|
|
49
|
+
description: string;
|
|
50
|
+
/** Entity who reported/created this evidence */
|
|
51
|
+
reportedBy: UUID;
|
|
52
|
+
/** Whether this evidence has been verified */
|
|
53
|
+
verified: boolean;
|
|
54
|
+
/** Context where this evidence occurred */
|
|
55
|
+
context: TrustContext;
|
|
56
|
+
targetEntityId: UUID;
|
|
57
|
+
evaluatorId: UUID;
|
|
58
|
+
metadata?: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Trust profile for an entity
|
|
62
|
+
*/
|
|
63
|
+
export interface TrustProfile {
|
|
64
|
+
/** Entity this profile belongs to */
|
|
65
|
+
entityId: UUID;
|
|
66
|
+
/** Core trust dimensions */
|
|
67
|
+
dimensions: TrustDimensions;
|
|
68
|
+
/** Overall trust score (0-100) */
|
|
69
|
+
overallTrust: number;
|
|
70
|
+
/** Confidence in the trust score (0-1) */
|
|
71
|
+
confidence: number;
|
|
72
|
+
/** Number of interactions used to calculate trust */
|
|
73
|
+
interactionCount: number;
|
|
74
|
+
/** Evidence supporting this trust profile */
|
|
75
|
+
evidence: TrustEvidence[];
|
|
76
|
+
/** When this profile was last calculated */
|
|
77
|
+
lastCalculated: number;
|
|
78
|
+
/** Method used to calculate trust */
|
|
79
|
+
calculationMethod: string;
|
|
80
|
+
/** Trust trend over time */
|
|
81
|
+
trend: {
|
|
82
|
+
direction: "increasing" | "decreasing" | "stable";
|
|
83
|
+
changeRate: number;
|
|
84
|
+
lastChangeAt: number;
|
|
85
|
+
};
|
|
86
|
+
evaluatorId: UUID;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Context for trust calculations
|
|
90
|
+
*/
|
|
91
|
+
export interface TrustContext {
|
|
92
|
+
/** Who is evaluating trust */
|
|
93
|
+
evaluatorId: UUID;
|
|
94
|
+
/** Specific context for evaluation */
|
|
95
|
+
worldId?: UUID;
|
|
96
|
+
roomId?: UUID;
|
|
97
|
+
platform?: string;
|
|
98
|
+
/** Type of action being considered */
|
|
99
|
+
action?: string;
|
|
100
|
+
/** Time window for evidence consideration */
|
|
101
|
+
timeWindow?: {
|
|
102
|
+
start: number;
|
|
103
|
+
end: number;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Result of a trust-based decision
|
|
108
|
+
*/
|
|
109
|
+
export interface TrustDecision {
|
|
110
|
+
allowed: boolean;
|
|
111
|
+
trustScore: number;
|
|
112
|
+
requiredScore: number;
|
|
113
|
+
/** Which dimensions were evaluated */
|
|
114
|
+
dimensionsChecked: Partial<TrustDimensions>;
|
|
115
|
+
/** Reason for the decision */
|
|
116
|
+
reason: string;
|
|
117
|
+
/** Suggestions for building trust if denied */
|
|
118
|
+
suggestions?: string[];
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Configuration for trust requirements
|
|
122
|
+
*/
|
|
123
|
+
export interface TrustRequirements {
|
|
124
|
+
/** Minimum overall trust score */
|
|
125
|
+
minimumTrust: number;
|
|
126
|
+
/** Required dimension scores */
|
|
127
|
+
dimensions?: {
|
|
128
|
+
reliability?: number;
|
|
129
|
+
competence?: number;
|
|
130
|
+
integrity?: number;
|
|
131
|
+
benevolence?: number;
|
|
132
|
+
transparency?: number;
|
|
133
|
+
};
|
|
134
|
+
/** Required evidence types */
|
|
135
|
+
requiredEvidence?: TrustEvidenceType[];
|
|
136
|
+
/** Minimum interaction count */
|
|
137
|
+
minimumInteractions?: number;
|
|
138
|
+
/** Required confidence level */
|
|
139
|
+
minimumConfidence?: number;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Trust interaction to be recorded
|
|
143
|
+
*/
|
|
144
|
+
export interface TrustInteraction {
|
|
145
|
+
sourceEntityId: UUID;
|
|
146
|
+
targetEntityId: UUID;
|
|
147
|
+
type: TrustEvidenceType;
|
|
148
|
+
timestamp: number;
|
|
149
|
+
impact: number;
|
|
150
|
+
details?: {
|
|
151
|
+
description?: string;
|
|
152
|
+
messageId?: UUID;
|
|
153
|
+
roomId?: UUID;
|
|
154
|
+
[key: string]: unknown;
|
|
155
|
+
};
|
|
156
|
+
context?: TrustContext;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Trust calculation configuration
|
|
160
|
+
*/
|
|
161
|
+
export interface TrustCalculationConfig {
|
|
162
|
+
/** How much recent evidence is weighted vs old */
|
|
163
|
+
recencyBias: number;
|
|
164
|
+
/** How fast evidence decays over time */
|
|
165
|
+
evidenceDecayRate: number;
|
|
166
|
+
/** Minimum evidence required for confidence */
|
|
167
|
+
minimumEvidenceCount: number;
|
|
168
|
+
/** How much to weight verified vs unverified evidence */
|
|
169
|
+
verificationMultiplier: number;
|
|
170
|
+
/** Dimension weights for overall score */
|
|
171
|
+
dimensionWeights: {
|
|
172
|
+
reliability: number;
|
|
173
|
+
competence: number;
|
|
174
|
+
integrity: number;
|
|
175
|
+
benevolence: number;
|
|
176
|
+
transparency: number;
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=trust.d.ts.map
|
|
@@ -0,0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B,yDAAyD;IACzD,sBAAsB,EAAE,MAAM,CAAC;IAE/B,0CAA0C;IAC1C,gBAAgB,EAAE;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH"}
|
package/package.json
CHANGED
|
@@ -1,34 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/plugin-trust",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Trust and permission management plugin for ElizaOS",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
-
"
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
9
18
|
"scripts": {
|
|
10
|
-
"build": "
|
|
11
|
-
"dev": "
|
|
12
|
-
"clean": "rm -rf dist",
|
|
19
|
+
"build": "bun run build.ts",
|
|
20
|
+
"dev": "bun run build.ts --watch",
|
|
13
21
|
"test": "vitest",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"lint": "
|
|
22
|
+
"clean": "rm -rf dist .turbo node_modules",
|
|
23
|
+
"lint": "bunx @biomejs/biome check --write --unsafe .",
|
|
24
|
+
"lint:check": "bunx @biomejs/biome check .",
|
|
25
|
+
"format": "bunx @biomejs/biome format --write .",
|
|
26
|
+
"format:check": "bunx @biomejs/biome format .",
|
|
27
|
+
"typecheck": "tsc --noEmit"
|
|
17
28
|
},
|
|
18
29
|
"dependencies": {
|
|
19
|
-
"@elizaos/core": "
|
|
20
|
-
"@elizaos/plugin-anthropic": "1.0.3",
|
|
30
|
+
"@elizaos/core": "next",
|
|
21
31
|
"dedent": "^1.6.0",
|
|
22
32
|
"drizzle-orm": "^0.44.2"
|
|
23
33
|
},
|
|
24
34
|
"devDependencies": {
|
|
25
35
|
"@types/node": "^24.0.13",
|
|
26
36
|
"tsup": "^8.2.2",
|
|
27
|
-
"typescript": "^5.3.3"
|
|
37
|
+
"typescript": "^5.3.3",
|
|
38
|
+
"@biomejs/biome": "^2.3.11"
|
|
28
39
|
},
|
|
29
|
-
"files": [
|
|
30
|
-
"dist"
|
|
31
|
-
],
|
|
32
40
|
"publishConfig": {
|
|
33
41
|
"access": "public"
|
|
34
42
|
},
|
|
@@ -40,6 +48,22 @@
|
|
|
40
48
|
"security",
|
|
41
49
|
"rbac"
|
|
42
50
|
],
|
|
51
|
+
"license": "MIT",
|
|
43
52
|
"author": "ElizaOS Contributors",
|
|
44
|
-
"
|
|
53
|
+
"agentConfig": {
|
|
54
|
+
"pluginParameters": {
|
|
55
|
+
"OWNER_ENTITY_ID": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "Entity identifier",
|
|
58
|
+
"required": false,
|
|
59
|
+
"sensitive": false
|
|
60
|
+
},
|
|
61
|
+
"WORLD_ID": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"description": "World identifier",
|
|
64
|
+
"required": false,
|
|
65
|
+
"sensitive": false
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
45
69
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Shaw Walters and elizaOS Contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|