@elizaos/plugin-nostr 2.0.0-beta.1 → 2.0.3-beta.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.
Files changed (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +72 -164
  3. package/auto-enable.ts +1 -1
  4. package/package.json +22 -6
  5. package/dist/src/accounts.d.ts +0 -15
  6. package/dist/src/accounts.d.ts.map +0 -1
  7. package/dist/src/accounts.js +0 -139
  8. package/dist/src/accounts.js.map +0 -1
  9. package/dist/src/actions/index.d.ts +0 -7
  10. package/dist/src/actions/index.d.ts.map +0 -1
  11. package/dist/src/actions/index.js +0 -7
  12. package/dist/src/actions/index.js.map +0 -1
  13. package/dist/src/actions/publishProfile.d.ts +0 -6
  14. package/dist/src/actions/publishProfile.d.ts.map +0 -1
  15. package/dist/src/actions/publishProfile.js +0 -157
  16. package/dist/src/actions/publishProfile.js.map +0 -1
  17. package/dist/src/connector-account-provider.d.ts +0 -20
  18. package/dist/src/connector-account-provider.d.ts.map +0 -1
  19. package/dist/src/connector-account-provider.js +0 -78
  20. package/dist/src/connector-account-provider.js.map +0 -1
  21. package/dist/src/index.d.ts +0 -19
  22. package/dist/src/index.d.ts.map +0 -1
  23. package/dist/src/index.js +0 -66
  24. package/dist/src/index.js.map +0 -1
  25. package/dist/src/providers/identityContext.d.ts +0 -6
  26. package/dist/src/providers/identityContext.d.ts.map +0 -1
  27. package/dist/src/providers/identityContext.js +0 -69
  28. package/dist/src/providers/identityContext.js.map +0 -1
  29. package/dist/src/providers/index.d.ts +0 -5
  30. package/dist/src/providers/index.d.ts.map +0 -1
  31. package/dist/src/providers/index.js +0 -5
  32. package/dist/src/providers/index.js.map +0 -1
  33. package/dist/src/providers/senderContext.d.ts +0 -6
  34. package/dist/src/providers/senderContext.d.ts.map +0 -1
  35. package/dist/src/providers/senderContext.js +0 -64
  36. package/dist/src/providers/senderContext.js.map +0 -1
  37. package/dist/src/service.d.ts +0 -116
  38. package/dist/src/service.d.ts.map +0 -1
  39. package/dist/src/service.js +0 -915
  40. package/dist/src/service.js.map +0 -1
  41. package/dist/src/toon.d.ts +0 -2
  42. package/dist/src/toon.d.ts.map +0 -1
  43. package/dist/src/toon.js +0 -18
  44. package/dist/src/toon.js.map +0 -1
  45. package/dist/src/types.d.ts +0 -125
  46. package/dist/src/types.d.ts.map +0 -1
  47. package/dist/src/types.js +0 -192
  48. package/dist/src/types.js.map +0 -1
@@ -1,157 +0,0 @@
1
- /**
2
- * Publish profile action for Nostr plugin.
3
- */
4
- import { composePromptFromState, ModelType, parseJSONObjectFromText, } from "@elizaos/core";
5
- import { normalizeNostrAccountId, readNostrAccountId } from "../accounts.js";
6
- import { NOSTR_SERVICE_NAME } from "../types.js";
7
- const PUBLISH_PROFILE_TEMPLATE = `# Task: Extract Nostr profile data
8
- Based on the conversation, determine what profile information to update.
9
-
10
- Recent conversation:
11
- {{recentMessages}}
12
-
13
- Respond with JSON only, no prose or fences, listing only the fields to update:
14
-
15
- {
16
- "name": "optional display name",
17
- "about": "optional bio",
18
- "picture": "optional profile picture URL",
19
- "banner": "optional banner URL",
20
- "nip05": "optional user@domain.com",
21
- "lud16": "optional lightning address",
22
- "website": "optional website URL"
23
- }`;
24
- const MAX_NOSTR_PROFILE_FIELD_CHARS = 500;
25
- const MAX_NOSTR_PROFILE_RELAYS = 10;
26
- const NOSTR_PROFILE_ACTION_TIMEOUT_MS = 30_000;
27
- function truncateProfileField(value) {
28
- return typeof value === "string" && value.trim()
29
- ? value.trim().slice(0, MAX_NOSTR_PROFILE_FIELD_CHARS)
30
- : undefined;
31
- }
32
- export const publishProfile = {
33
- name: "NOSTR_PUBLISH_PROFILE",
34
- similes: ["UPDATE_NOSTR_PROFILE", "SET_NOSTR_PROFILE", "NOSTR_PROFILE"],
35
- description: "Publish or update the bot's Nostr profile (kind:0 metadata)",
36
- descriptionCompressed: "publish update bot Nostr profile (kind: 0 metadata)",
37
- contexts: ["social_posting", "connectors"],
38
- contextGate: { anyOf: ["social_posting", "connectors"] },
39
- roleGate: { minRole: "USER" },
40
- parameters: [
41
- {
42
- name: "name",
43
- description: "Display name for the Nostr profile.",
44
- required: false,
45
- schema: { type: "string" },
46
- },
47
- {
48
- name: "about",
49
- description: "Profile bio/about text.",
50
- required: false,
51
- schema: { type: "string" },
52
- },
53
- {
54
- name: "picture",
55
- description: "Profile picture URL.",
56
- required: false,
57
- schema: { type: "string" },
58
- },
59
- ],
60
- validate: async (_runtime, message, _state) => {
61
- return message.content.source === "nostr";
62
- },
63
- handler: async (runtime, message, state, _options, callback) => {
64
- const nostrService = runtime.getService(NOSTR_SERVICE_NAME);
65
- if (!nostrService?.isConnected()) {
66
- if (callback) {
67
- callback({ text: "Nostr service is not available.", source: "nostr" });
68
- }
69
- return { success: false, error: "Nostr service not available" };
70
- }
71
- const requestedAccountId = normalizeNostrAccountId(readNostrAccountId(_options, message.content) ?? nostrService.getAccountId(runtime));
72
- // Get or compose state
73
- const currentState = state ?? (await runtime.composeState(message));
74
- // Compose prompt
75
- const prompt = await composePromptFromState({
76
- template: PUBLISH_PROFILE_TEMPLATE,
77
- state: currentState,
78
- });
79
- // Extract parameters using LLM
80
- let profileInfo = null;
81
- for (let attempt = 0; attempt < 3; attempt++) {
82
- const response = await runtime.useModel(ModelType.TEXT_SMALL, {
83
- prompt,
84
- });
85
- const actionParams = parseJSONObjectFromText(String(response));
86
- if (actionParams) {
87
- profileInfo = {
88
- name: truncateProfileField(actionParams.name),
89
- displayName: truncateProfileField(actionParams.displayName),
90
- about: truncateProfileField(actionParams.about),
91
- picture: truncateProfileField(actionParams.picture),
92
- banner: truncateProfileField(actionParams.banner),
93
- nip05: truncateProfileField(actionParams.nip05),
94
- lud16: truncateProfileField(actionParams.lud16),
95
- website: truncateProfileField(actionParams.website),
96
- };
97
- break;
98
- }
99
- }
100
- if (!profileInfo) {
101
- if (callback) {
102
- callback({
103
- text: "I couldn't understand the profile information. Please try again.",
104
- source: "nostr",
105
- });
106
- }
107
- return { success: false, error: "Could not extract profile parameters" };
108
- }
109
- // Publish profile
110
- const timeoutMs = NOSTR_PROFILE_ACTION_TIMEOUT_MS;
111
- const result = await nostrService.publishProfile({
112
- ...profileInfo,
113
- accountId: requestedAccountId,
114
- });
115
- if (!result.success) {
116
- if (callback) {
117
- callback({
118
- text: `Failed to publish profile: ${result.error}`,
119
- source: "nostr",
120
- });
121
- }
122
- return { success: false, error: result.error };
123
- }
124
- if (callback) {
125
- callback({
126
- text: "Profile published successfully.",
127
- source: message.content.source,
128
- });
129
- }
130
- return {
131
- success: true,
132
- data: {
133
- eventId: result.eventId,
134
- relays: result.relays?.slice(0, MAX_NOSTR_PROFILE_RELAYS),
135
- profile: profileInfo,
136
- timeoutMs,
137
- accountId: requestedAccountId,
138
- },
139
- };
140
- },
141
- examples: [
142
- [
143
- {
144
- name: "{{user1}}",
145
- content: { text: "Update your profile name to 'Bot Assistant'" },
146
- },
147
- {
148
- name: "{{agent}}",
149
- content: {
150
- text: "I'll update my Nostr profile.",
151
- actions: ["NOSTR_PUBLISH_PROFILE"],
152
- },
153
- },
154
- ],
155
- ],
156
- };
157
- //# sourceMappingURL=publishProfile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"publishProfile.js","sourceRoot":"","sources":["../../../src/actions/publishProfile.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGL,sBAAsB,EAGtB,SAAS,EACT,uBAAuB,GAExB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE7E,OAAO,EAAE,kBAAkB,EAAqB,MAAM,aAAa,CAAC;AAEpE,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;EAgB/B,CAAC;AAEH,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAC1C,MAAM,wBAAwB,GAAG,EAAE,CAAC;AACpC,MAAM,+BAA+B,GAAG,MAAM,CAAC;AAE/C,SAAS,oBAAoB,C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OAAO,CAAC,MAAgB;aACzC,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI;YACb,IAAI,EAAE;gBACJ,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,wBAAwB,CAAC;gBACzD,OAAO,EAAE,WAAW;gBACpB,SAAS;gBACT,SAAS,EAAE,kBAAkB;aAC9B;SACF,CAAC;IACJ,CAAC;IAED,QAAQ,EAAE;QACR;YACE;gBACE,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,EAAE,IAAI,EAAE,6CAA6C,EAAE;aACjE;YACD;gBACE,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE;oBACP,IAAI,EAAE,+BAA+B;oBACrC,OAAO,EAAE,CAAC,uBAAuB,CAAC;iBACnC;aACF;SACF;KACF;CACF,CAAC"}
@@ -1,20 +0,0 @@
1
- /**
2
- * Nostr ConnectorAccountManager provider.
3
- *
4
- * Adapts the multi-account scaffolding in `accounts.ts` to the
5
- * `ConnectorAccountProvider` contract from
6
- * `@elizaos/core/connectors/account-manager`.
7
- *
8
- * Source of truth for accounts is character settings (`character.settings.nostr`)
9
- * + NOSTR_ACCOUNTS JSON env var + single-account env vars (NOSTR_PRIVATE_KEY,
10
- * NOSTR_RELAYS, NOSTR_DM_POLICY).
11
- *
12
- * AccountKey is the nostr pubkey (hex). Role is `OWNER` since the private key
13
- * is the user's identity. Public key is derived at service start time, so
14
- * `externalId` may be empty until the service has resolved it; the manager
15
- * tolerates this.
16
- */
17
- import type { ConnectorAccountProvider, IAgentRuntime } from "@elizaos/core";
18
- export declare const NOSTR_PROVIDER_ID = "nostr";
19
- export declare function createNostrConnectorAccountProvider(runtime: IAgentRuntime): ConnectorAccountProvider;
20
- //# sourceMappingURL=connector-account-provider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connector-account-provider.d.ts","sourceRoot":"","sources":["../../src/connector-account-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAIV,wBAAwB,EACxB,aAAa,EACd,MAAM,eAAe,CAAC;AASvB,eAAO,MAAM,iBAAiB,UAAU,CAAC;AA+BzC,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,aAAa,GACrB,wBAAwB,CAiC1B"}
@@ -1,78 +0,0 @@
1
- /**
2
- * Nostr ConnectorAccountManager provider.
3
- *
4
- * Adapts the multi-account scaffolding in `accounts.ts` to the
5
- * `ConnectorAccountProvider` contract from
6
- * `@elizaos/core/connectors/account-manager`.
7
- *
8
- * Source of truth for accounts is character settings (`character.settings.nostr`)
9
- * + NOSTR_ACCOUNTS JSON env var + single-account env vars (NOSTR_PRIVATE_KEY,
10
- * NOSTR_RELAYS, NOSTR_DM_POLICY).
11
- *
12
- * AccountKey is the nostr pubkey (hex). Role is `OWNER` since the private key
13
- * is the user's identity. Public key is derived at service start time, so
14
- * `externalId` may be empty until the service has resolved it; the manager
15
- * tolerates this.
16
- */
17
- import { DEFAULT_NOSTR_ACCOUNT_ID, listNostrAccountIds, normalizeNostrAccountId, resolveNostrAccountSettings, } from "./accounts.js";
18
- export const NOSTR_PROVIDER_ID = "nostr";
19
- function accessGateForAccount(settings) {
20
- if (settings.dmPolicy === "pairing")
21
- return "pairing";
22
- if (settings.dmPolicy === "disabled")
23
- return "disabled";
24
- return "open";
25
- }
26
- function toConnectorAccount(settings) {
27
- const now = Date.now();
28
- const configured = Boolean(settings.privateKey);
29
- return {
30
- id: normalizeNostrAccountId(settings.accountId),
31
- provider: NOSTR_PROVIDER_ID,
32
- label: settings.profile?.name ?? (settings.publicKey || settings.accountId),
33
- role: "OWNER",
34
- purpose: ["messaging"],
35
- accessGate: accessGateForAccount(settings),
36
- status: settings.enabled !== false && configured ? "connected" : "disabled",
37
- externalId: settings.publicKey || undefined,
38
- displayHandle: settings.profile?.name ?? (settings.publicKey || undefined),
39
- createdAt: now,
40
- updatedAt: now,
41
- metadata: {
42
- relays: settings.relays ?? [],
43
- dmPolicy: settings.dmPolicy ?? "pairing",
44
- hasProfile: Boolean(settings.profile),
45
- },
46
- };
47
- }
48
- export function createNostrConnectorAccountProvider(runtime) {
49
- return {
50
- provider: NOSTR_PROVIDER_ID,
51
- label: "Nostr",
52
- listAccounts: async (_manager) => {
53
- const ids = listNostrAccountIds(runtime);
54
- if (ids.length === 0) {
55
- return [toConnectorAccount(resolveNostrAccountSettings(runtime, DEFAULT_NOSTR_ACCOUNT_ID))];
56
- }
57
- return ids.map((id) => toConnectorAccount(resolveNostrAccountSettings(runtime, id)));
58
- },
59
- createAccount: async (input, _manager) => {
60
- return {
61
- ...input,
62
- provider: NOSTR_PROVIDER_ID,
63
- role: input.role ?? "OWNER",
64
- purpose: input.purpose ?? ["messaging"],
65
- accessGate: input.accessGate ?? "open",
66
- status: input.status ?? "pending",
67
- };
68
- },
69
- patchAccount: async (_accountId, patch, _manager) => {
70
- return { ...patch, provider: NOSTR_PROVIDER_ID };
71
- },
72
- deleteAccount: async (_accountId, _manager) => {
73
- // No-op at provider layer — runtime credentials live in character
74
- // settings; deletion of those is out of band.
75
- },
76
- };
77
- }
78
- //# sourceMappingURL=connector-account-provider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connector-account-provider.js","sourceRoot":"","sources":["../../src/connector-account-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AASH,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,eAAe,CAAC;AAGvB,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAEzC,SAAS,oBAAoB,CAAC,QAAuB;IACnD,IAAI,QAAQ,CAAC,QAAQ,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACtD,IAAI,QAAQ,CAAC,QAAQ,KAAK,UAAU;QAAE,OAAO,UAAU,CAAC;IACxD,OAAO,MAAM,CAAC;A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,KAAK,CAAC,EAAE,CAAC;gBACrB,OAAO,CAAC,kBAAkB,CAAC,2BAA2B,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC;YAC9F,CAAC;YACD,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,kBAAkB,CAAC,2BAA2B,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QACvF,CAAC;QACD,aAAa,EAAE,KAAK,EAAE,KAA4B,EAAE,QAAiC,EAAE,EAAE;YACvF,OAAO;gBACL,GAAG,KAAK;gBACR,QAAQ,EAAE,iBAAiB;gBAC3B,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,OAAO;gBAC3B,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC;gBACvC,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,MAAM;gBACtC,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,SAAS;aAClC,CAAC;QACJ,CAAC;QACD,YAAY,EAAE,KAAK,EACjB,UAAkB,EAClB,KAA4B,EAC5B,QAAiC,EACjC,EAAE;YACF,OAAO,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;QACnD,CAAC;QACD,aAAa,EAAE,KAAK,EAAE,UAAkB,EAAE,QAAiC,EAAE,EAAE;YAC7E,kEAAkE;YAClE,8CAA8C;QAChD,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Nostr Plugin for ElizaOS
3
- *
4
- * Provides Nostr decentralized messaging integration for ElizaOS agents,
5
- * supporting encrypted DMs via NIP-04 and profile management.
6
- */
7
- import type { Plugin } from "@elizaos/core";
8
- import { identityContextProvider } from "./providers/index.js";
9
- import { NostrService } from "./service.js";
10
- export * from "./accounts.js";
11
- export * from "./types.js";
12
- export { identityContextProvider, NostrService };
13
- export { publishProfile } from "./actions/index.js";
14
- /**
15
- * Nostr plugin definition
16
- */
17
- declare const nostrPlugin: Plugin;
18
- export default nostrPlugin;
19
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAiB,MAAM,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,cAAc,eAAe,CAAC;AAE9B,cAAc,YAAY,CAAC;AAI3B,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;GAEG;AACH,QAAA,MAAM,WAAW,EAAE,MAwDlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
package/dist/src/index.js DELETED
@@ -1,66 +0,0 @@
1
- /**
2
- * Nostr Plugin for ElizaOS
3
- *
4
- * Provides Nostr decentralized messaging integration for ElizaOS agents,
5
- * supporting encrypted DMs via NIP-04 and profile management.
6
- */
7
- import { getConnectorAccountManager, logger } from "@elizaos/core";
8
- import { createNostrConnectorAccountProvider } from "./connector-account-provider.js";
9
- import { identityContextProvider } from "./providers/index.js";
10
- import { NostrService } from "./service.js";
11
- import { DEFAULT_NOSTR_RELAYS } from "./types.js";
12
- export * from "./accounts.js";
13
- // Export types
14
- export * from "./types.js";
15
- // Export service / providers / actions
16
- // Nostr DMs route through MESSAGE. Public notes route through POST. Profile
17
- // publishing is connector-owned identity metadata, not a planner action.
18
- export { identityContextProvider, NostrService };
19
- export { publishProfile } from "./actions/index.js";
20
- /**
21
- * Nostr plugin definition
22
- */
23
- const nostrPlugin = {
24
- name: "nostr",
25
- description: "Nostr decentralized messaging plugin for ElizaOS agents",
26
- services: [NostrService],
27
- actions: [],
28
- providers: [identityContextProvider],
29
- tests: [],
30
- // Self-declared auto-enable: activate when the "nostr" connector is
31
- // configured under config.connectors. The hardcoded CONNECTOR_PLUGINS map
32
- // in plugin-auto-enable-engine.ts still serves as a fallback.
33
- autoEnable: {
34
- connectorKeys: ["nostr"],
35
- },
36
- /**
37
- * Plugin initialization hook
38
- */
39
- init: async (config, runtime) => {
40
- logger.info("Initializing Nostr plugin...");
41
- try {
42
- const manager = getConnectorAccountManager(runtime);
43
- manager.registerProvider(createNostrConnectorAccountProvider(runtime));
44
- }
45
- catch (err) {
46
- logger.warn({
47
- src: "plugin:nostr",
48
- err: err instanceof Error ? err.message : String(err),
49
- }, "Failed to register Nostr provider with ConnectorAccountManager");
50
- }
51
- // Log configuration status
52
- const hasPrivateKey = Boolean(config.NOSTR_PRIVATE_KEY || process.env.NOSTR_PRIVATE_KEY);
53
- const relaysRaw = config.NOSTR_RELAYS || process.env.NOSTR_RELAYS || "";
54
- const relays = relaysRaw ? relaysRaw.split(",").length : DEFAULT_NOSTR_RELAYS.length;
55
- logger.info(`Nostr plugin configuration:`);
56
- logger.info(` - Private key configured: ${hasPrivateKey ? "Yes" : "No"}`);
57
- logger.info(` - Relays: ${relays} relay(s)`);
58
- logger.info(` - DM policy: ${config.NOSTR_DM_POLICY || process.env.NOSTR_DM_POLICY || "pairing"}`);
59
- if (!hasPrivateKey) {
60
- logger.warn("Nostr private key not configured. Set NOSTR_PRIVATE_KEY (hex or nsec format).");
61
- }
62
- logger.info("Nostr plugin initialized");
63
- },
64
- };
65
- export default nostrPlugin;
66
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,mCAAmC,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE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iBAAiB,CAAC,CAAC;QACzF,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC;QACxE,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC;QAErF,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAC3C,MAAM,CAAC,IAAI,CAAC,+BAA+B,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAC3E,MAAM,CAAC,IAAI,CAAC,eAAe,MAAM,WAAW,CAAC,CAAC;QAC9C,MAAM,CAAC,IAAI,CACT,kBAAkB,MAAM,CAAC,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,SAAS,EAAE,CACvF,CAAC;QAEF,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,MAAM,CAAC,IAAI,CAAC,+EAA+E,CAAC,CAAC;QAC/F,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IAC1C,CAAC;CACF,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Identity context provider for Nostr plugin.
3
- */
4
- import type { Provider } from "@elizaos/core";
5
- export declare const identityContextProvider: Provider;
6
- //# sourceMappingURL=identityContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"identityContext.d.ts","sourceRoot":"","sources":["../../../src/providers/identityContext.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAyB,QAAQ,EAAyB,MAAM,eAAe,CAAC;AAM5F,eAAO,MAAM,uBAAuB,EAAE,QAmErC,CAAC"}
@@ -1,69 +0,0 @@
1
- /**
2
- * Identity context provider for Nostr plugin.
3
- */
4
- import { NOSTR_SERVICE_NAME } from "../types.js";
5
- const MAX_RELAYS_IN_STATE = 12;
6
- export const identityContextProvider = {
7
- name: "nostrIdentityContext",
8
- description: "Provides information about the bot's Nostr identity",
9
- descriptionCompressed: "provide information bot Nostr identity",
10
- dynamic: true,
11
- contextGate: { anyOf: ["social", "connectors"] },
12
- cacheStable: false,
13
- cacheScope: "turn",
14
- contexts: ["social", "connectors"],
15
- get: async (runtime, message, state) => {
16
- // Only provide context for Nostr messages
17
- if (message.content.source !== "nostr") {
18
- return {
19
- data: {},
20
- values: {},
21
- text: "",
22
- };
23
- }
24
- const nostrService = runtime.getService(NOSTR_SERVICE_NAME);
25
- if (!nostrService?.isConnected()) {
26
- return {
27
- data: { connected: false },
28
- values: { connected: false },
29
- text: "",
30
- };
31
- }
32
- const agentName = state?.agentName || "The agent";
33
- try {
34
- const publicKey = nostrService.getPublicKey();
35
- const npub = nostrService.getNpub();
36
- const relays = nostrService.getRelays();
37
- const shownRelays = relays.slice(0, MAX_RELAYS_IN_STATE);
38
- const truncated = relays.length > shownRelays.length;
39
- const responseText = `${agentName} is connected to Nostr with pubkey ${npub}. ` +
40
- `Connected to ${relays.length} relay(s): ${shownRelays.join(", ")}${truncated ? " ..." : ""}. ` +
41
- `Nostr is a decentralized social protocol using cryptographic keys for identity.`;
42
- return {
43
- data: {
44
- publicKey,
45
- npub,
46
- relays: shownRelays,
47
- relayCount: relays.length,
48
- shownRelayCount: shownRelays.length,
49
- truncated,
50
- connected: true,
51
- },
52
- values: {
53
- publicKey,
54
- npub,
55
- relayCount: relays.length,
56
- },
57
- text: responseText,
58
- };
59
- }
60
- catch (error) {
61
- return {
62
- data: { connected: false, error: error instanceof Error ? error.message : String(error) },
63
- values: { connected: false },
64
- text: "",
65
- };
66
- }
67
- },
68
- };
69
- //# sourceMappingURL=identityContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"identityContext.js","sourceRoot":"","sources":["../../../src/providers/identityContext.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OA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AAC,CAAC,EAAE,mBAAmB,CAAC,CAAC;YACzD,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;YAErD,MAAM,YAAY,GAChB,GAAG,SAAS,sCAAsC,IAAI,IAAI;gBAC1D,gBAAgB,MAAM,CAAC,MAAM,cAAc,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI;gBAC/F,iFAAiF,CAAC;YAEpF,OAAO;gBACL,IAAI,EAAE;oBACJ,SAAS;oBACT,IAAI;oBACJ,MAAM,EAAE,WAAW;oBACnB,UAAU,EAAE,MAAM,CAAC,MAAM;oBACzB,eAAe,EAAE,WAAW,CAAC,MAAM;oBACnC,SAAS;oBACT,SAAS,EAAE,IAAI;iBAChB;gBACD,MAAM,EAAE;oBACN,SAAS;oBACT,IAAI;oBACJ,UAAU,EAAE,MAAM,CAAC,MAAM;iBAC1B;gBACD,IAAI,EAAE,YAAY;aACnB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,IAAI,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;gBACzF,MAAM,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;gBAC5B,IAAI,EAAE,EAAE;aACT,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Export all Nostr providers.
3
- */
4
- export { identityContextProvider } from "./identityContext.js";
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Export all Nostr providers.
3
- */
4
- export { identityContextProvider } from "./identityContext.js";
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/providers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Sender context provider for Nostr plugin.
3
- */
4
- import type { Provider } from "@elizaos/core";
5
- export declare const senderContextProvider: Provider;
6
- //# sourceMappingURL=senderContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"senderContext.d.ts","sourceRoot":"","sources":["../../../src/providers/senderContext.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAyB,QAAQ,EAAyB,MAAM,eAAe,CAAC;AAI5F,eAAO,MAAM,qBAAqB,EAAE,QAmEnC,CAAC"}
@@ -1,64 +0,0 @@
1
- /**
2
- * Sender context provider for Nostr plugin.
3
- */
4
- import { getPubkeyDisplayName, NOSTR_SERVICE_NAME, pubkeyToNpub } from "../types.js";
5
- export const senderContextProvider = {
6
- name: "nostrSenderContext",
7
- description: "Provides information about the Nostr user in the current conversation",
8
- descriptionCompressed: "provide information Nostr user current conversation",
9
- dynamic: true,
10
- get: async (runtime, message, state) => {
11
- // Only provide context for Nostr messages
12
- if (message.content.source !== "nostr") {
13
- return {
14
- data: {},
15
- values: {},
16
- text: "",
17
- };
18
- }
19
- const nostrService = runtime.getService(NOSTR_SERVICE_NAME);
20
- if (!nostrService?.isConnected()) {
21
- return {
22
- data: { connected: false },
23
- values: { connected: false },
24
- text: "",
25
- };
26
- }
27
- const agentName = state?.agentName || "The agent";
28
- // Get sender pubkey from state if available
29
- const senderPubkey = state?.data?.senderPubkey;
30
- if (!senderPubkey) {
31
- return {
32
- data: { connected: true },
33
- values: { connected: true },
34
- text: "",
35
- };
36
- }
37
- let senderNpub = "";
38
- try {
39
- senderNpub = pubkeyToNpub(senderPubkey);
40
- }
41
- catch {
42
- // Use hex if npub conversion fails
43
- }
44
- const displayName = getPubkeyDisplayName(senderPubkey);
45
- const responseText = `${agentName} is talking to ${displayName} on Nostr. ` +
46
- `Their pubkey is ${senderNpub || senderPubkey}. ` +
47
- `This is an encrypted direct message conversation using NIP-04.`;
48
- return {
49
- data: {
50
- senderPubkey,
51
- senderNpub,
52
- displayName,
53
- isEncrypted: true,
54
- },
55
- values: {
56
- senderPubkey,
57
- senderNpub,
58
- displayName,
59
- },
60
- text: responseText,
61
- };
62
- },
63
- };
64
- //# sourceMappingURL=senderContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"senderContext.js","sourceRoot":"","sources":["../../../src/providers/senderContext.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAErF,MAAM,CAAC,MAAM,qBAAqB,GAAa;IAC7C,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,uEAAuE;IACpF,qBAAqB,EAAE,qDAAqD;IAC5E,OAAO,EAAE,IAAI;IACb,GAAG,EAAE,KAAK,EAAE,OAAsB,EAAE,OAAe,EAAE,KAAY,EAA2B,EAAE;QAC5F,0CAA0C;QAC1C,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;YACvC,OAAO;gBACL,IAAI,EAAE,EAAE;gBACR,MAAM,EAAE,EAAE;gBACV,IAAI,EAAE,EAAE;aACT,CAAC;QACJ,CAAC;QAED,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAe,kBAAkB,CAAC,CAAC;QAE1E,IAAI,CAAC,YAAY,EAAE,WAAW,EAAE,EAAE,CAAC;YACjC,OAAO;gBACL,IAAI,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;gBAC1B,MAAM,EAAE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