@elisym/mcp 0.19.0 → 0.20.1

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/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { LIMITS, SESSION_ID_REGEX, DEFAULT_KIND_OFFSET, SolanaPaymentStrategy, makeCensor, DEFAULT_REDACT_PATHS, validateAgentName, exportKeyPairBytes, RELAYS, toDTag, JobWaitTimeoutError, attachmentsOf, decodeJobPayload, utf8ByteLength, formatAssetAmount, estimateNetworkBaseline, formatSol as formatSol$1, USDC_SOLANA_DEVNET, estimateSolFeeLamports, formatFeeBreakdown, resolveAssetFromPaymentRequest as resolveAssetFromPaymentRequest$1, parseAssetAmount, ElisymIdentity, ElisymClient, encodeJobPayload, NATIVE_SOL, resolveKnownAsset, getProtocolProgramId, getProtocolConfig, assetKey, KIND_JOB_REQUEST_BASE, KIND_JOB_RESULT_BASE, assetByKey, formatNetworkBaseline, KNOWN_ASSETS } from '@elisym/sdk';
2
+ import { LIMITS, SESSION_ID_REGEX, DEFAULT_KIND_OFFSET, SolanaPaymentStrategy, makeCensor, DEFAULT_REDACT_PATHS, validateAgentName, exportKeyPairBytes, RELAYS, toDTag, JobWaitTimeoutError, attachmentsOf, decodeJobPayload, utf8ByteLength, formatAssetAmount, estimateNetworkBaseline, formatSol as formatSol$1, verifyAgentIdentities, USDC_SOLANA_DEVNET, estimateSolFeeLamports, formatFeeBreakdown, resolveAssetFromPaymentRequest as resolveAssetFromPaymentRequest$1, parseAssetAmount, ElisymIdentity, ElisymClient, encodeJobPayload, NATIVE_SOL, resolveKnownAsset, getProtocolProgramId, getProtocolConfig, assetKey, KIND_JOB_REQUEST_BASE, KIND_JOB_RESULT_BASE, assetByKey, formatNetworkBaseline, KNOWN_ASSETS } from '@elisym/sdk';
3
3
  import { listAgents, createAgentDir, writeYamlInitial, writeExampleSkillTemplate, writeSecrets, resolveAgent, loadAgent, globalConfigPath, writeYaml, writeFileAtomic as writeFileAtomic$1, ensureGitignoreHasMessagesEntry, ensureGitignoreHasJobSessionsEntry } from '@elisym/sdk/agent-store';
4
4
  import { createIrohTransport, loadGlobalConfig, writeGlobalConfig } from '@elisym/sdk/node';
5
5
  import { getBase58Encoder, getBase58Decoder, generateKeyPairSigner, createSolanaRpc, address, getSignatureFromTransaction, createSolanaRpcSubscriptions, sendAndConfirmTransactionFactory, pipe, createTransactionMessage, setTransactionMessageFeePayerSigner, setTransactionMessageLifetimeUsingBlockhash, appendTransactionMessageInstructions, signTransactionMessageWithSigners, createKeyPairSignerFromBytes, isAddress } from '@solana/kit';
@@ -4045,6 +4045,8 @@ async function removeContact(agentDir, pubkey) {
4045
4045
  // src/tools/discovery.ts
4046
4046
  var SEARCH_PING_TIMEOUT_MS = 3e3;
4047
4047
  var MAX_SEARCH_CANDIDATES = 100;
4048
+ var MAX_IDENTITY_HANDLE_DISPLAY_LEN = 254;
4049
+ var MAX_IDENTITY_PROOF_URL_DISPLAY_LEN = 300;
4048
4050
  var STOP_WORDS = /* @__PURE__ */ new Set([
4049
4051
  "a",
4050
4052
  "an",
@@ -4185,12 +4187,15 @@ var SearchAgentsSchema = z.object({
4185
4187
  "If true, restrict results to providers saved in the active agent's .contacts.json. Each returned item gains a `last_worked_at` field."
4186
4188
  )
4187
4189
  });
4190
+ var VerifyAgentIdentitiesSchema = z.object({
4191
+ agent_npub: z.string().min(1).describe("Agent npub (bech32 nostr identifier, starts with `npub1...`).")
4192
+ });
4188
4193
  var ListCapabilitiesSchema = z.object({});
4189
4194
  var GetIdentitySchema = z.object({});
4190
4195
  var discoveryTools = [
4191
4196
  defineTool({
4192
4197
  name: "search_agents",
4193
- description: "Search AI agents currently online on elisym. `capabilities` is a hard OR-filter of substring tokens from the user's request (never invent synonyms). `query` is optional re-ranking; omit if not needed. Offline agents are excluded by default - pass include_offline=true only when debugging. Results that match a saved contact are sorted to the top and annotated with `is_contact`, `last_worked_at`, `last_capability`, and `contact_note` - surface this to the user (e.g. \"already in your contacts, last used <date>\") so they can prefer providers they've worked with before.",
4198
+ description: "Search AI agents currently online on elisym. `capabilities` is a hard OR-filter of substring tokens from the user's request (never invent synonyms). `query` is optional re-ranking; omit if not needed. Offline agents are excluded by default - pass include_offline=true only when debugging. Results that match a saved contact are sorted to the top and annotated with `is_contact`, `last_worked_at`, `last_capability`, and `contact_note` - surface this to the user (e.g. \"already in your contacts, last used <date>\") so they can prefer providers they've worked with before. `claimed_identities` entries (github/x/website) are unverified self-claims until checked with `verify_agent_identities` - anyone can publish a claim for any handle; do not relay claims as established identity.",
4194
4199
  schema: SearchAgentsSchema,
4195
4200
  async handler(ctx, input) {
4196
4201
  ctx.toolRateLimiter.check();
@@ -4354,6 +4359,14 @@ var discoveryTools = [
4354
4359
  };
4355
4360
  }),
4356
4361
  supported_kinds: a.supportedKinds,
4362
+ // External identity claims (kind 10011 / kind-0 nip05). Claims only,
4363
+ // zero proof fetches here - anyone can publish a claim for any handle,
4364
+ // so status comes exclusively from verify_agent_identities.
4365
+ claimed_identities: a.identities !== void 0 && a.identities.length > 0 ? a.identities.map((identity) => ({
4366
+ platform: identity.platform,
4367
+ handle: sanitizeField(identity.handle, MAX_IDENTITY_HANDLE_DISPLAY_LEN),
4368
+ proof_url: sanitizeField(identity.proofUrl, MAX_IDENTITY_PROOF_URL_DISPLAY_LEN)
4369
+ })) : void 0,
4357
4370
  // Nostr-verified reputation (last 30 days): `verified_*` counts only
4358
4371
  // ratings whose author also signed the job request, so a third party
4359
4372
  // cannot inflate them. On-chain payment verification is NOT applied
@@ -4381,6 +4394,36 @@ var discoveryTools = [
4381
4394
  return textResult(text);
4382
4395
  }
4383
4396
  }),
4397
+ defineTool({
4398
+ name: "verify_agent_identities",
4399
+ description: 'Verify an agent\'s external identity claims (GitHub, X, website) by fetching their published proofs. Returns one entry per claim with `status`: `verified` (proof fetched and it matches this agent), `broken` (proof fetched and definitively wrong - a positive "do not trust" signal), or `unverifiable` (could not check: outage, rate limit, timeout - neutral, never treat as negative). Call before hiring when trust matters; do not call while browsing search results. Pass an agent npub.',
4400
+ schema: VerifyAgentIdentitiesSchema,
4401
+ async handler(ctx, input) {
4402
+ ctx.toolRateLimiter.check();
4403
+ let pubkey;
4404
+ try {
4405
+ pubkey = decodeNpub(input.agent_npub);
4406
+ } catch (err) {
4407
+ return errorResult(`Invalid agent_npub: ${err.message}`);
4408
+ }
4409
+ const agent = ctx.active();
4410
+ const { identities } = await agent.client.discovery.fetchExternalIdentityClaims(pubkey);
4411
+ if (identities.length === 0) {
4412
+ return textResult(
4413
+ "No identity claims published for this agent (no kind 10011 identity tags and no kind-0 nip05)."
4414
+ );
4415
+ }
4416
+ const results = await verifyAgentIdentities(pubkey, identities);
4417
+ const reported = results.map((result) => ({
4418
+ platform: result.identity.platform,
4419
+ handle: sanitizeField(result.identity.handle, MAX_IDENTITY_HANDLE_DISPLAY_LEN),
4420
+ proof_url: sanitizeField(result.identity.proofUrl, MAX_IDENTITY_PROOF_URL_DISPLAY_LEN),
4421
+ status: result.status
4422
+ }));
4423
+ const { text } = sanitizeUntrusted(JSON.stringify(reported, null, 2), "structured");
4424
+ return textResult(text);
4425
+ }
4426
+ }),
4384
4427
  defineTool({
4385
4428
  name: "list_capabilities",
4386
4429
  description: "List all unique capability tags currently published on the elisym network.",