@keyban/cli 0.6.0 → 0.7.0
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/README.md +17 -7
- package/SKILL.md +23 -56
- package/dist/index.mjs +405 -217
- package/dist/index.mjs.map +4 -4
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -16297,118 +16297,6 @@ var require_application_lookup_service = __commonJS({
|
|
|
16297
16297
|
}
|
|
16298
16298
|
});
|
|
16299
16299
|
|
|
16300
|
-
// node_modules/.pnpm/@keyban+mcp-openapi@file+..+..+sdk+libs+keyban-mcp-openapi_@modelcontextprotocol+sdk@1._4d810e0200ac4c68cff07162d9118ec3/node_modules/@keyban/mcp-openapi/dist/skills.js
|
|
16301
|
-
var require_skills = __commonJS({
|
|
16302
|
-
"node_modules/.pnpm/@keyban+mcp-openapi@file+..+..+sdk+libs+keyban-mcp-openapi_@modelcontextprotocol+sdk@1._4d810e0200ac4c68cff07162d9118ec3/node_modules/@keyban/mcp-openapi/dist/skills.js"(exports) {
|
|
16303
|
-
"use strict";
|
|
16304
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16305
|
-
exports.skillUrl = exports.SKILL_NAMES = void 0;
|
|
16306
|
-
exports.SKILL_NAMES = ["keyban-admin", "keyban-agent-wallet"];
|
|
16307
|
-
var PUBLISHED_SKILLS_URL = "https://docs.keyban.io/.well-known/agent-skills";
|
|
16308
|
-
var skillUrl = (name) => `${PUBLISHED_SKILLS_URL}/${name}/SKILL.md`;
|
|
16309
|
-
exports.skillUrl = skillUrl;
|
|
16310
|
-
}
|
|
16311
|
-
});
|
|
16312
|
-
|
|
16313
|
-
// node_modules/.pnpm/@keyban+mcp-openapi@file+..+..+sdk+libs+keyban-mcp-openapi_@modelcontextprotocol+sdk@1._4d810e0200ac4c68cff07162d9118ec3/node_modules/@keyban/mcp-openapi/dist/registrar/instructions-service.js
|
|
16314
|
-
var require_instructions_service = __commonJS({
|
|
16315
|
-
"node_modules/.pnpm/@keyban+mcp-openapi@file+..+..+sdk+libs+keyban-mcp-openapi_@modelcontextprotocol+sdk@1._4d810e0200ac4c68cff07162d9118ec3/node_modules/@keyban/mcp-openapi/dist/registrar/instructions-service.js"(exports) {
|
|
16316
|
-
"use strict";
|
|
16317
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16318
|
-
exports.InstructionsService = void 0;
|
|
16319
|
-
var logger_1 = require_logger();
|
|
16320
|
-
var skills_1 = require_skills();
|
|
16321
|
-
var zod_compat_1 = require_zod_compat();
|
|
16322
|
-
var schema_utils_1 = require_schema_utils();
|
|
16323
|
-
var validation_utils_1 = require_validation_utils();
|
|
16324
|
-
var DEFAULT_SKILL = "keyban-admin";
|
|
16325
|
-
var SKILL_PARAMETER_DESCRIPTION = "Which guide to read. keyban-admin (default): this server, and the way from a fresh Keyban account to an installed agent wallet MCP. keyban-agent-wallet: operating the wallet through the agent wallet MCP, for a client that has not installed it yet.";
|
|
16326
|
-
var getInstructionsInputShape = {
|
|
16327
|
-
skill: zod_compat_1.z.enum(skills_1.SKILL_NAMES).optional().describe(SKILL_PARAMETER_DESCRIPTION)
|
|
16328
|
-
};
|
|
16329
|
-
var getInstructionsInputParser = zod_compat_1.z.object(getInstructionsInputShape);
|
|
16330
|
-
var getInstructionsInputJsonSchema = {
|
|
16331
|
-
$schema: schema_utils_1.DEFAULT_JSON_SCHEMA_URL,
|
|
16332
|
-
type: "object",
|
|
16333
|
-
additionalProperties: false,
|
|
16334
|
-
required: [],
|
|
16335
|
-
properties: {
|
|
16336
|
-
skill: {
|
|
16337
|
-
type: "string",
|
|
16338
|
-
enum: [...skills_1.SKILL_NAMES],
|
|
16339
|
-
description: SKILL_PARAMETER_DESCRIPTION
|
|
16340
|
-
}
|
|
16341
|
-
}
|
|
16342
|
-
};
|
|
16343
|
-
var InstructionsService = class _InstructionsService {
|
|
16344
|
-
constructor(toolRegistry, readSkill) {
|
|
16345
|
-
this.toolRegistry = toolRegistry;
|
|
16346
|
-
this.readSkill = readSkill;
|
|
16347
|
-
this.logger = (0, logger_1.createLogger)(_InstructionsService.name);
|
|
16348
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
16349
|
-
}
|
|
16350
|
-
registerTool() {
|
|
16351
|
-
this.toolRegistry.registerCustomTool({
|
|
16352
|
-
name: "get_instructions",
|
|
16353
|
-
config: {
|
|
16354
|
-
title: "Read the Keyban guide",
|
|
16355
|
-
description: 'Return the guide to follow with this server (the keyban-admin skill): what it does, how to work with it, and the steps from a fresh Keyban account to an installed agent wallet MCP. Call it first in a new conversation, or whenever the next step is unclear. Pass skill "keyban-agent-wallet" for the agent wallet guide instead.',
|
|
16356
|
-
annotations: {
|
|
16357
|
-
title: "Read the Keyban guide",
|
|
16358
|
-
readOnlyHint: true,
|
|
16359
|
-
idempotentHint: true,
|
|
16360
|
-
openWorldHint: false
|
|
16361
|
-
},
|
|
16362
|
-
_meta: { mcpType: "Tool" },
|
|
16363
|
-
inputSchema: getInstructionsInputShape
|
|
16364
|
-
},
|
|
16365
|
-
handler: (args) => this.execute(args),
|
|
16366
|
-
inputSchemaForDocs: getInstructionsInputJsonSchema
|
|
16367
|
-
});
|
|
16368
|
-
}
|
|
16369
|
-
async execute(args) {
|
|
16370
|
-
const parsed = getInstructionsInputParser.safeParse(args);
|
|
16371
|
-
if (!parsed.success) {
|
|
16372
|
-
return {
|
|
16373
|
-
content: [
|
|
16374
|
-
{
|
|
16375
|
-
type: "text",
|
|
16376
|
-
text: `Invalid input: ${(0, validation_utils_1.formatZodIssues)(parsed.error)}. Known skills: ${skills_1.SKILL_NAMES.join(", ")}.`
|
|
16377
|
-
}
|
|
16378
|
-
],
|
|
16379
|
-
isError: true
|
|
16380
|
-
};
|
|
16381
|
-
}
|
|
16382
|
-
const name = parsed.data.skill ?? DEFAULT_SKILL;
|
|
16383
|
-
try {
|
|
16384
|
-
return { content: [{ type: "text", text: await this.read(name) }] };
|
|
16385
|
-
} catch (error2) {
|
|
16386
|
-
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
16387
|
-
this.logger.error(`Skill ${name} could not be read: ${message}`);
|
|
16388
|
-
return {
|
|
16389
|
-
content: [
|
|
16390
|
-
{
|
|
16391
|
-
type: "text",
|
|
16392
|
-
text: `The ${name} guide could not be read on this server. Read it at ${(0, skills_1.skillUrl)(name)}`
|
|
16393
|
-
}
|
|
16394
|
-
],
|
|
16395
|
-
isError: true
|
|
16396
|
-
};
|
|
16397
|
-
}
|
|
16398
|
-
}
|
|
16399
|
-
async read(name) {
|
|
16400
|
-
const cached2 = this.cache.get(name);
|
|
16401
|
-
if (cached2 !== void 0)
|
|
16402
|
-
return cached2;
|
|
16403
|
-
const text5 = await this.readSkill(name);
|
|
16404
|
-
this.cache.set(name, text5);
|
|
16405
|
-
return text5;
|
|
16406
|
-
}
|
|
16407
|
-
};
|
|
16408
|
-
exports.InstructionsService = InstructionsService;
|
|
16409
|
-
}
|
|
16410
|
-
});
|
|
16411
|
-
|
|
16412
16300
|
// node_modules/.pnpm/@keyban+mcp-openapi@file+..+..+sdk+libs+keyban-mcp-openapi_@modelcontextprotocol+sdk@1._4d810e0200ac4c68cff07162d9118ec3/node_modules/@keyban/mcp-openapi/dist/registrar/prompt-registry.js
|
|
16413
16301
|
var require_prompt_registry = __commonJS({
|
|
16414
16302
|
"node_modules/.pnpm/@keyban+mcp-openapi@file+..+..+sdk+libs+keyban-mcp-openapi_@modelcontextprotocol+sdk@1._4d810e0200ac4c68cff07162d9118ec3/node_modules/@keyban/mcp-openapi/dist/registrar/prompt-registry.js"(exports) {
|
|
@@ -33488,7 +33376,6 @@ var require_mcp_registrar = __commonJS({
|
|
|
33488
33376
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33489
33377
|
exports.McpOperationRegistrar = void 0;
|
|
33490
33378
|
var application_lookup_service_1 = require_application_lookup_service();
|
|
33491
|
-
var instructions_service_1 = require_instructions_service();
|
|
33492
33379
|
var prompt_registry_1 = require_prompt_registry();
|
|
33493
33380
|
var resource_registry_1 = require_resource_registry();
|
|
33494
33381
|
var server_introspection_1 = require_server_introspection();
|
|
@@ -33503,7 +33390,6 @@ var require_mcp_registrar = __commonJS({
|
|
|
33503
33390
|
this.applicationLookup = new application_lookup_service_1.ApplicationLookupService(httpClient, this.toolRegistry);
|
|
33504
33391
|
this.introspectionInstaller = new server_introspection_1.ServerIntrospectionInstaller(server, this.toolRegistry, this.resourceRegistry, this.applicationLookup);
|
|
33505
33392
|
this.promptRegistry = new prompt_registry_1.PromptRegistry(server);
|
|
33506
|
-
this.instructions = options.readSkill ? new instructions_service_1.InstructionsService(this.toolRegistry, options.readSkill) : void 0;
|
|
33507
33393
|
}
|
|
33508
33394
|
register(operations) {
|
|
33509
33395
|
let registeredTools = 0;
|
|
@@ -33527,10 +33413,6 @@ var require_mcp_registrar = __commonJS({
|
|
|
33527
33413
|
}
|
|
33528
33414
|
this.applicationLookup.registerLookupTool();
|
|
33529
33415
|
registeredTools += 1;
|
|
33530
|
-
if (this.instructions) {
|
|
33531
|
-
this.instructions.registerTool();
|
|
33532
|
-
registeredTools += 1;
|
|
33533
|
-
}
|
|
33534
33416
|
this.introspectionInstaller.install();
|
|
33535
33417
|
return {
|
|
33536
33418
|
tools: registeredTools,
|
|
@@ -33600,7 +33482,6 @@ var require_dist2 = __commonJS({
|
|
|
33600
33482
|
Object.defineProperty(exports, "ToolRegistry", { enumerable: true, get: function() {
|
|
33601
33483
|
return tool_registry_1.ToolRegistry;
|
|
33602
33484
|
} });
|
|
33603
|
-
__exportStar(require_skills(), exports);
|
|
33604
33485
|
__exportStar(require_types3(), exports);
|
|
33605
33486
|
}
|
|
33606
33487
|
});
|
|
@@ -106811,11 +106692,11 @@ var require_frost = __commonJS({
|
|
|
106811
106692
|
"node_modules/.pnpm/@keyban+agent-wallet-protocol@file+..+..+sdk+libs+keyban-agent-wallet-protocol_viem@2.57.4_typescript@5.9.3_zod@3.25.76_/node_modules/@keyban/agent-wallet-protocol/dist/crypto/frost.js"(exports) {
|
|
106812
106693
|
"use strict";
|
|
106813
106694
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
106814
|
-
exports.normalizeFrostSig =
|
|
106695
|
+
exports.normalizeFrostSig = normalizeFrostSig4;
|
|
106815
106696
|
exports.encodeMultiSignerSignature = encodeMultiSignerSignature3;
|
|
106816
106697
|
var viem_1 = require_cjs2();
|
|
106817
106698
|
var secp256k1_1 = require_secp256k13();
|
|
106818
|
-
function
|
|
106699
|
+
function normalizeFrostSig4(raw) {
|
|
106819
106700
|
return raw.startsWith("0x") ? raw : `0x${raw}`;
|
|
106820
106701
|
}
|
|
106821
106702
|
function encodeMultiSignerSignature3(rawSig, publicKeyHex, frostVerifierAddress) {
|
|
@@ -130099,7 +129980,7 @@ var require_wire_schemas = __commonJS({
|
|
|
130099
129980
|
"node_modules/.pnpm/@keyban+agent-wallet-protocol@file+..+..+sdk+libs+keyban-agent-wallet-protocol_viem@2.57.4_typescript@5.9.3_zod@3.25.76_/node_modules/@keyban/agent-wallet-protocol/dist/wire-schemas.js"(exports) {
|
|
130100
129981
|
"use strict";
|
|
130101
129982
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
130102
|
-
exports.policyDecisionSchema = exports.policyInputSchema = exports.x402AuthorizationSchema = exports.x402RequestSchema = exports.relayPreimageSchema = void 0;
|
|
129983
|
+
exports.policyDecisionSchema = exports.policyInputSchema = exports.signContentSchema = exports.x402AuthorizationSchema = exports.x402RequestSchema = exports.relayPreimageSchema = void 0;
|
|
130103
129984
|
var zod_1 = require_zod2();
|
|
130104
129985
|
var decimalString = zod_1.z.string().regex(/^\d+$/);
|
|
130105
129986
|
var hashString2 = zod_1.z.string().regex(/^0x[a-fA-F0-9]{64}$/);
|
|
@@ -130192,10 +130073,13 @@ var require_wire_schemas = __commonJS({
|
|
|
130192
130073
|
extra: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional()
|
|
130193
130074
|
})
|
|
130194
130075
|
});
|
|
130076
|
+
exports.signContentSchema = zod_1.z.union([
|
|
130077
|
+
zod_1.z.string(),
|
|
130078
|
+
exports.relayPreimageSchema,
|
|
130079
|
+
exports.x402RequestSchema
|
|
130080
|
+
]);
|
|
130195
130081
|
exports.policyInputSchema = zod_1.z.object({
|
|
130196
|
-
|
|
130197
|
-
relay: exports.relayPreimageSchema.optional(),
|
|
130198
|
-
x402: exports.x402RequestSchema.optional(),
|
|
130082
|
+
content: exports.signContentSchema,
|
|
130199
130083
|
clientHash: hashString2.optional(),
|
|
130200
130084
|
// What the agent can handle beyond the base protocol. `sponsored-x402`
|
|
130201
130085
|
// (legacy, still required for the Keyban welcome offer): it accepts an
|
|
@@ -130616,8 +130500,8 @@ var require_dist3 = __commonJS({
|
|
|
130616
130500
|
"node_modules/.pnpm/@keyban+agent-wallet-protocol@file+..+..+sdk+libs+keyban-agent-wallet-protocol_viem@2.57.4_typescript@5.9.3_zod@3.25.76_/node_modules/@keyban/agent-wallet-protocol/dist/index.js"(exports) {
|
|
130617
130501
|
"use strict";
|
|
130618
130502
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
130619
|
-
exports.
|
|
130620
|
-
exports.renewalCooldownSlot = exports.renewableAt = exports.recoveryFormOf = exports.noMarginReopensAt = exports.noMarginPeersNeeded = exports.lastRenewalAtOf = exports.isSameKind = exports.computeRotationDigest = exports.applySignerRotation = exports.SIGNER_ROTATED_TOPIC = exports.SCHNORR_MULTISIG_STORAGE_BASE = exports.ROTATION_TYPEHASHES = exports.RENEWAL_COOLDOWN_SECONDS = exports.NO_MARGIN_RECOVERY_INTERVAL_SECONDS = exports.hashSignerChanges = exports.computeManageSignersDigest = exports.buildManagementChanges = exports.applySignerChanges = exports.ManagementReplayError = exports.MANAGE_SIGNERS_TYPEHASH = exports.verifyTreasuryAttestation = void 0;
|
|
130503
|
+
exports.hashRing = exports.computeTreasuryAttestationDigest = exports.computeInitHash = exports.TREASURY_ATTESTATION_TYPEHASH = exports.addressWords = exports.networkToChainId = exports.evmChainIdForNetwork = exports.x402RequestSchema = exports.x402AuthorizationSchema = exports.signContentSchema = exports.relayPreimageSchema = exports.policyInputSchema = exports.policyDecisionSchema = exports.normalizeFrostSig = exports.encodeMultiSignerSignature = exports.decompressPoint = exports.selectExactUsdcAccept = exports.extractPayTos = exports.decodeX402 = exports.x402ToCanonical = exports.relayToCanonical = exports.extractRelayPayment = exports.computeRelayHash = exports.computeLotRelayHash = exports.computeBatchRelayHash = exports.recomputeErc7739Hash = exports.buildEip3009TypedData = exports.EIP3009_PRIMARY_TYPES = exports.EIP3009_FIELDS = exports.webAuthnSignerFromPrivateKey = exports.webAuthnChallenge = exports.verifyWebAuthnAssertion = exports.toLowS = exports.signWebAuthnAssertion = exports.encodeWebAuthnSigner = exports.encodeWebAuthnSignature = exports.encodeAuthenticatorAssertion = exports.decodeWebAuthnSignature = exports.decodeP256PublicKey = exports.base64UrlToBytes = exports.P256_N = exports.encodeMultiSignerEnvelope = exports.verifyEnrollmentCommitment = exports.sasMatches = exports.sasContext = exports.managementSasScope = exports.deriveSas = exports.commitEnrollment = exports.isCanonicalUsdc = exports.getUsdcChainEntry = void 0;
|
|
130504
|
+
exports.renewalCooldownSlot = exports.renewableAt = exports.recoveryFormOf = exports.noMarginReopensAt = exports.noMarginPeersNeeded = exports.lastRenewalAtOf = exports.isSameKind = exports.computeRotationDigest = exports.applySignerRotation = exports.SIGNER_ROTATED_TOPIC = exports.SCHNORR_MULTISIG_STORAGE_BASE = exports.ROTATION_TYPEHASHES = exports.RENEWAL_COOLDOWN_SECONDS = exports.NO_MARGIN_RECOVERY_INTERVAL_SECONDS = exports.hashSignerChanges = exports.computeManageSignersDigest = exports.buildManagementChanges = exports.applySignerChanges = exports.ManagementReplayError = exports.MANAGE_SIGNERS_TYPEHASH = exports.verifyTreasuryAttestation = exports.hashSignerSet = void 0;
|
|
130621
130505
|
var usdc_registry_1 = require_usdc_registry();
|
|
130622
130506
|
Object.defineProperty(exports, "getUsdcChainEntry", { enumerable: true, get: function() {
|
|
130623
130507
|
return usdc_registry_1.getUsdcChainEntry;
|
|
@@ -130749,6 +130633,9 @@ var require_dist3 = __commonJS({
|
|
|
130749
130633
|
Object.defineProperty(exports, "relayPreimageSchema", { enumerable: true, get: function() {
|
|
130750
130634
|
return wire_schemas_1.relayPreimageSchema;
|
|
130751
130635
|
} });
|
|
130636
|
+
Object.defineProperty(exports, "signContentSchema", { enumerable: true, get: function() {
|
|
130637
|
+
return wire_schemas_1.signContentSchema;
|
|
130638
|
+
} });
|
|
130752
130639
|
Object.defineProperty(exports, "x402AuthorizationSchema", { enumerable: true, get: function() {
|
|
130753
130640
|
return wire_schemas_1.x402AuthorizationSchema;
|
|
130754
130641
|
} });
|
|
@@ -147942,6 +147829,58 @@ var schnorrAccountAbi = [
|
|
|
147942
147829
|
],
|
|
147943
147830
|
"stateMutability": "view"
|
|
147944
147831
|
},
|
|
147832
|
+
{
|
|
147833
|
+
"type": "function",
|
|
147834
|
+
"name": "TYPEHASH_ADD",
|
|
147835
|
+
"inputs": [],
|
|
147836
|
+
"outputs": [
|
|
147837
|
+
{
|
|
147838
|
+
"name": "",
|
|
147839
|
+
"type": "bytes32",
|
|
147840
|
+
"internalType": "bytes32"
|
|
147841
|
+
}
|
|
147842
|
+
],
|
|
147843
|
+
"stateMutability": "view"
|
|
147844
|
+
},
|
|
147845
|
+
{
|
|
147846
|
+
"type": "function",
|
|
147847
|
+
"name": "TYPEHASH_POP",
|
|
147848
|
+
"inputs": [],
|
|
147849
|
+
"outputs": [
|
|
147850
|
+
{
|
|
147851
|
+
"name": "",
|
|
147852
|
+
"type": "bytes32",
|
|
147853
|
+
"internalType": "bytes32"
|
|
147854
|
+
}
|
|
147855
|
+
],
|
|
147856
|
+
"stateMutability": "view"
|
|
147857
|
+
},
|
|
147858
|
+
{
|
|
147859
|
+
"type": "function",
|
|
147860
|
+
"name": "TYPEHASH_REMOVE",
|
|
147861
|
+
"inputs": [],
|
|
147862
|
+
"outputs": [
|
|
147863
|
+
{
|
|
147864
|
+
"name": "",
|
|
147865
|
+
"type": "bytes32",
|
|
147866
|
+
"internalType": "bytes32"
|
|
147867
|
+
}
|
|
147868
|
+
],
|
|
147869
|
+
"stateMutability": "view"
|
|
147870
|
+
},
|
|
147871
|
+
{
|
|
147872
|
+
"type": "function",
|
|
147873
|
+
"name": "TYPEHASH_RENEW",
|
|
147874
|
+
"inputs": [],
|
|
147875
|
+
"outputs": [
|
|
147876
|
+
{
|
|
147877
|
+
"name": "",
|
|
147878
|
+
"type": "bytes32",
|
|
147879
|
+
"internalType": "bytes32"
|
|
147880
|
+
}
|
|
147881
|
+
],
|
|
147882
|
+
"stateMutability": "view"
|
|
147883
|
+
},
|
|
147945
147884
|
{
|
|
147946
147885
|
"type": "function",
|
|
147947
147886
|
"name": "UPGRADE_INTERFACE_VERSION",
|
|
@@ -147970,12 +147909,27 @@ var schnorrAccountAbi = [
|
|
|
147970
147909
|
},
|
|
147971
147910
|
{
|
|
147972
147911
|
"type": "function",
|
|
147973
|
-
"name": "
|
|
147912
|
+
"name": "addSigner",
|
|
147974
147913
|
"inputs": [
|
|
147975
147914
|
{
|
|
147976
|
-
"name": "
|
|
147977
|
-
"type": "bytes
|
|
147978
|
-
"internalType": "bytes
|
|
147915
|
+
"name": "approver",
|
|
147916
|
+
"type": "bytes",
|
|
147917
|
+
"internalType": "bytes"
|
|
147918
|
+
},
|
|
147919
|
+
{
|
|
147920
|
+
"name": "newSigner",
|
|
147921
|
+
"type": "bytes",
|
|
147922
|
+
"internalType": "bytes"
|
|
147923
|
+
},
|
|
147924
|
+
{
|
|
147925
|
+
"name": "pop",
|
|
147926
|
+
"type": "bytes",
|
|
147927
|
+
"internalType": "bytes"
|
|
147928
|
+
},
|
|
147929
|
+
{
|
|
147930
|
+
"name": "signature",
|
|
147931
|
+
"type": "bytes",
|
|
147932
|
+
"internalType": "bytes"
|
|
147979
147933
|
}
|
|
147980
147934
|
],
|
|
147981
147935
|
"outputs": [],
|
|
@@ -148037,6 +147991,32 @@ var schnorrAccountAbi = [
|
|
|
148037
147991
|
],
|
|
148038
147992
|
"stateMutability": "view"
|
|
148039
147993
|
},
|
|
147994
|
+
{
|
|
147995
|
+
"type": "function",
|
|
147996
|
+
"name": "enrollmentOpen",
|
|
147997
|
+
"inputs": [],
|
|
147998
|
+
"outputs": [
|
|
147999
|
+
{
|
|
148000
|
+
"name": "",
|
|
148001
|
+
"type": "bool",
|
|
148002
|
+
"internalType": "bool"
|
|
148003
|
+
}
|
|
148004
|
+
],
|
|
148005
|
+
"stateMutability": "view"
|
|
148006
|
+
},
|
|
148007
|
+
{
|
|
148008
|
+
"type": "function",
|
|
148009
|
+
"name": "enrollmentState",
|
|
148010
|
+
"inputs": [],
|
|
148011
|
+
"outputs": [
|
|
148012
|
+
{
|
|
148013
|
+
"name": "",
|
|
148014
|
+
"type": "uint8",
|
|
148015
|
+
"internalType": "enum SchnorrAccount.EnrollmentState"
|
|
148016
|
+
}
|
|
148017
|
+
],
|
|
148018
|
+
"stateMutability": "view"
|
|
148019
|
+
},
|
|
148040
148020
|
{
|
|
148041
148021
|
"type": "function",
|
|
148042
148022
|
"name": "entryPoint",
|
|
@@ -148262,6 +148242,19 @@ var schnorrAccountAbi = [
|
|
|
148262
148242
|
],
|
|
148263
148243
|
"stateMutability": "view"
|
|
148264
148244
|
},
|
|
148245
|
+
{
|
|
148246
|
+
"type": "function",
|
|
148247
|
+
"name": "mgmtNonce",
|
|
148248
|
+
"inputs": [],
|
|
148249
|
+
"outputs": [
|
|
148250
|
+
{
|
|
148251
|
+
"name": "",
|
|
148252
|
+
"type": "uint256",
|
|
148253
|
+
"internalType": "uint256"
|
|
148254
|
+
}
|
|
148255
|
+
],
|
|
148256
|
+
"stateMutability": "view"
|
|
148257
|
+
},
|
|
148265
148258
|
{
|
|
148266
148259
|
"type": "function",
|
|
148267
148260
|
"name": "onERC1155BatchReceived",
|
|
@@ -148433,12 +148426,50 @@ var schnorrAccountAbi = [
|
|
|
148433
148426
|
},
|
|
148434
148427
|
{
|
|
148435
148428
|
"type": "function",
|
|
148436
|
-
"name": "
|
|
148429
|
+
"name": "removeSigner",
|
|
148437
148430
|
"inputs": [
|
|
148438
148431
|
{
|
|
148439
|
-
"name": "
|
|
148440
|
-
"type": "bytes
|
|
148441
|
-
"internalType": "bytes
|
|
148432
|
+
"name": "approver",
|
|
148433
|
+
"type": "bytes",
|
|
148434
|
+
"internalType": "bytes"
|
|
148435
|
+
},
|
|
148436
|
+
{
|
|
148437
|
+
"name": "target",
|
|
148438
|
+
"type": "bytes",
|
|
148439
|
+
"internalType": "bytes"
|
|
148440
|
+
},
|
|
148441
|
+
{
|
|
148442
|
+
"name": "signature",
|
|
148443
|
+
"type": "bytes",
|
|
148444
|
+
"internalType": "bytes"
|
|
148445
|
+
}
|
|
148446
|
+
],
|
|
148447
|
+
"outputs": [],
|
|
148448
|
+
"stateMutability": "nonpayable"
|
|
148449
|
+
},
|
|
148450
|
+
{
|
|
148451
|
+
"type": "function",
|
|
148452
|
+
"name": "renewSigner",
|
|
148453
|
+
"inputs": [
|
|
148454
|
+
{
|
|
148455
|
+
"name": "oldSigner",
|
|
148456
|
+
"type": "bytes",
|
|
148457
|
+
"internalType": "bytes"
|
|
148458
|
+
},
|
|
148459
|
+
{
|
|
148460
|
+
"name": "newSigner",
|
|
148461
|
+
"type": "bytes",
|
|
148462
|
+
"internalType": "bytes"
|
|
148463
|
+
},
|
|
148464
|
+
{
|
|
148465
|
+
"name": "pop",
|
|
148466
|
+
"type": "bytes",
|
|
148467
|
+
"internalType": "bytes"
|
|
148468
|
+
},
|
|
148469
|
+
{
|
|
148470
|
+
"name": "signature",
|
|
148471
|
+
"type": "bytes",
|
|
148472
|
+
"internalType": "bytes"
|
|
148442
148473
|
}
|
|
148443
148474
|
],
|
|
148444
148475
|
"outputs": [],
|
|
@@ -148457,6 +148488,35 @@ var schnorrAccountAbi = [
|
|
|
148457
148488
|
"outputs": [],
|
|
148458
148489
|
"stateMutability": "nonpayable"
|
|
148459
148490
|
},
|
|
148491
|
+
{
|
|
148492
|
+
"type": "function",
|
|
148493
|
+
"name": "rotationDigest",
|
|
148494
|
+
"inputs": [
|
|
148495
|
+
{
|
|
148496
|
+
"name": "typehash",
|
|
148497
|
+
"type": "bytes32",
|
|
148498
|
+
"internalType": "bytes32"
|
|
148499
|
+
},
|
|
148500
|
+
{
|
|
148501
|
+
"name": "a",
|
|
148502
|
+
"type": "bytes",
|
|
148503
|
+
"internalType": "bytes"
|
|
148504
|
+
},
|
|
148505
|
+
{
|
|
148506
|
+
"name": "b",
|
|
148507
|
+
"type": "bytes",
|
|
148508
|
+
"internalType": "bytes"
|
|
148509
|
+
}
|
|
148510
|
+
],
|
|
148511
|
+
"outputs": [
|
|
148512
|
+
{
|
|
148513
|
+
"name": "",
|
|
148514
|
+
"type": "bytes32",
|
|
148515
|
+
"internalType": "bytes32"
|
|
148516
|
+
}
|
|
148517
|
+
],
|
|
148518
|
+
"stateMutability": "view"
|
|
148519
|
+
},
|
|
148460
148520
|
{
|
|
148461
148521
|
"type": "function",
|
|
148462
148522
|
"name": "setAuthority",
|
|
@@ -148472,14 +148532,8 @@ var schnorrAccountAbi = [
|
|
|
148472
148532
|
},
|
|
148473
148533
|
{
|
|
148474
148534
|
"type": "function",
|
|
148475
|
-
"name": "
|
|
148476
|
-
"inputs": [
|
|
148477
|
-
{
|
|
148478
|
-
"name": "newThreshold",
|
|
148479
|
-
"type": "uint64",
|
|
148480
|
-
"internalType": "uint64"
|
|
148481
|
-
}
|
|
148482
|
-
],
|
|
148535
|
+
"name": "settleEnrollment",
|
|
148536
|
+
"inputs": [],
|
|
148483
148537
|
"outputs": [],
|
|
148484
148538
|
"stateMutability": "nonpayable"
|
|
148485
148539
|
},
|
|
@@ -148705,6 +148759,19 @@ var schnorrAccountAbi = [
|
|
|
148705
148759
|
],
|
|
148706
148760
|
"anonymous": false
|
|
148707
148761
|
},
|
|
148762
|
+
{
|
|
148763
|
+
"type": "event",
|
|
148764
|
+
"name": "EnrollmentChanged",
|
|
148765
|
+
"inputs": [
|
|
148766
|
+
{
|
|
148767
|
+
"name": "state",
|
|
148768
|
+
"type": "uint8",
|
|
148769
|
+
"indexed": false,
|
|
148770
|
+
"internalType": "enum SchnorrAccount.EnrollmentState"
|
|
148771
|
+
}
|
|
148772
|
+
],
|
|
148773
|
+
"anonymous": false
|
|
148774
|
+
},
|
|
148708
148775
|
{
|
|
148709
148776
|
"type": "event",
|
|
148710
148777
|
"name": "Initialized",
|
|
@@ -148744,6 +148811,56 @@ var schnorrAccountAbi = [
|
|
|
148744
148811
|
],
|
|
148745
148812
|
"anonymous": false
|
|
148746
148813
|
},
|
|
148814
|
+
{
|
|
148815
|
+
"type": "event",
|
|
148816
|
+
"name": "SignerAdmitted",
|
|
148817
|
+
"inputs": [
|
|
148818
|
+
{
|
|
148819
|
+
"name": "approver",
|
|
148820
|
+
"type": "bytes32",
|
|
148821
|
+
"indexed": true,
|
|
148822
|
+
"internalType": "bytes32"
|
|
148823
|
+
},
|
|
148824
|
+
{
|
|
148825
|
+
"name": "newSigner",
|
|
148826
|
+
"type": "bytes32",
|
|
148827
|
+
"indexed": true,
|
|
148828
|
+
"internalType": "bytes32"
|
|
148829
|
+
},
|
|
148830
|
+
{
|
|
148831
|
+
"name": "nonce",
|
|
148832
|
+
"type": "uint256",
|
|
148833
|
+
"indexed": true,
|
|
148834
|
+
"internalType": "uint256"
|
|
148835
|
+
}
|
|
148836
|
+
],
|
|
148837
|
+
"anonymous": false
|
|
148838
|
+
},
|
|
148839
|
+
{
|
|
148840
|
+
"type": "event",
|
|
148841
|
+
"name": "SignerDismissed",
|
|
148842
|
+
"inputs": [
|
|
148843
|
+
{
|
|
148844
|
+
"name": "approver",
|
|
148845
|
+
"type": "bytes32",
|
|
148846
|
+
"indexed": true,
|
|
148847
|
+
"internalType": "bytes32"
|
|
148848
|
+
},
|
|
148849
|
+
{
|
|
148850
|
+
"name": "signer",
|
|
148851
|
+
"type": "bytes32",
|
|
148852
|
+
"indexed": true,
|
|
148853
|
+
"internalType": "bytes32"
|
|
148854
|
+
},
|
|
148855
|
+
{
|
|
148856
|
+
"name": "nonce",
|
|
148857
|
+
"type": "uint256",
|
|
148858
|
+
"indexed": true,
|
|
148859
|
+
"internalType": "uint256"
|
|
148860
|
+
}
|
|
148861
|
+
],
|
|
148862
|
+
"anonymous": false
|
|
148863
|
+
},
|
|
148747
148864
|
{
|
|
148748
148865
|
"type": "event",
|
|
148749
148866
|
"name": "SignerRegistered",
|
|
@@ -148763,6 +148880,37 @@ var schnorrAccountAbi = [
|
|
|
148763
148880
|
],
|
|
148764
148881
|
"anonymous": false
|
|
148765
148882
|
},
|
|
148883
|
+
{
|
|
148884
|
+
"type": "event",
|
|
148885
|
+
"name": "SignerRotated",
|
|
148886
|
+
"inputs": [
|
|
148887
|
+
{
|
|
148888
|
+
"name": "oldSigner",
|
|
148889
|
+
"type": "bytes32",
|
|
148890
|
+
"indexed": true,
|
|
148891
|
+
"internalType": "bytes32"
|
|
148892
|
+
},
|
|
148893
|
+
{
|
|
148894
|
+
"name": "newSigner",
|
|
148895
|
+
"type": "bytes32",
|
|
148896
|
+
"indexed": true,
|
|
148897
|
+
"internalType": "bytes32"
|
|
148898
|
+
},
|
|
148899
|
+
{
|
|
148900
|
+
"name": "nonce",
|
|
148901
|
+
"type": "uint256",
|
|
148902
|
+
"indexed": true,
|
|
148903
|
+
"internalType": "uint256"
|
|
148904
|
+
},
|
|
148905
|
+
{
|
|
148906
|
+
"name": "typehash",
|
|
148907
|
+
"type": "bytes32",
|
|
148908
|
+
"indexed": false,
|
|
148909
|
+
"internalType": "bytes32"
|
|
148910
|
+
}
|
|
148911
|
+
],
|
|
148912
|
+
"anonymous": false
|
|
148913
|
+
},
|
|
148766
148914
|
{
|
|
148767
148915
|
"type": "event",
|
|
148768
148916
|
"name": "Upgraded",
|
|
@@ -148905,11 +149053,26 @@ var schnorrAccountAbi = [
|
|
|
148905
149053
|
}
|
|
148906
149054
|
]
|
|
148907
149055
|
},
|
|
149056
|
+
{
|
|
149057
|
+
"type": "error",
|
|
149058
|
+
"name": "EnrollmentClosed",
|
|
149059
|
+
"inputs": []
|
|
149060
|
+
},
|
|
149061
|
+
{
|
|
149062
|
+
"type": "error",
|
|
149063
|
+
"name": "EnrollmentNotClosed",
|
|
149064
|
+
"inputs": []
|
|
149065
|
+
},
|
|
148908
149066
|
{
|
|
148909
149067
|
"type": "error",
|
|
148910
149068
|
"name": "FailedCall",
|
|
148911
149069
|
"inputs": []
|
|
148912
149070
|
},
|
|
149071
|
+
{
|
|
149072
|
+
"type": "error",
|
|
149073
|
+
"name": "InvalidBootstrapSigners",
|
|
149074
|
+
"inputs": []
|
|
149075
|
+
},
|
|
148913
149076
|
{
|
|
148914
149077
|
"type": "error",
|
|
148915
149078
|
"name": "InvalidCommitmentSigner",
|
|
@@ -148920,6 +149083,16 @@ var schnorrAccountAbi = [
|
|
|
148920
149083
|
"name": "InvalidInitialization",
|
|
148921
149084
|
"inputs": []
|
|
148922
149085
|
},
|
|
149086
|
+
{
|
|
149087
|
+
"type": "error",
|
|
149088
|
+
"name": "InvalidProofOfPossession",
|
|
149089
|
+
"inputs": []
|
|
149090
|
+
},
|
|
149091
|
+
{
|
|
149092
|
+
"type": "error",
|
|
149093
|
+
"name": "InvalidSignerApproval",
|
|
149094
|
+
"inputs": []
|
|
149095
|
+
},
|
|
148923
149096
|
{
|
|
148924
149097
|
"type": "error",
|
|
148925
149098
|
"name": "MultiSignerERC7913AlreadyExists",
|
|
@@ -148989,6 +149162,11 @@ var schnorrAccountAbi = [
|
|
|
148989
149162
|
"name": "ReentrancyGuardReentrantCall",
|
|
148990
149163
|
"inputs": []
|
|
148991
149164
|
},
|
|
149165
|
+
{
|
|
149166
|
+
"type": "error",
|
|
149167
|
+
"name": "SignerKindMismatch",
|
|
149168
|
+
"inputs": []
|
|
149169
|
+
},
|
|
148992
149170
|
{
|
|
148993
149171
|
"type": "error",
|
|
148994
149172
|
"name": "UUPSUnauthorizedCallContext",
|
|
@@ -149102,7 +149280,11 @@ async function initialize(session, progress) {
|
|
|
149102
149280
|
inviteKey: session.inviteKey
|
|
149103
149281
|
});
|
|
149104
149282
|
const txHash = await postRegisterAndPoll(session, frostSignerBytes, signature);
|
|
149105
|
-
|
|
149283
|
+
if (txHash) {
|
|
149284
|
+
logger.info(`Registered FROST signer on chain (tx ${txHash}).`);
|
|
149285
|
+
} else {
|
|
149286
|
+
logger.info("FROST signer already registered on chain by another job (skipped).");
|
|
149287
|
+
}
|
|
149106
149288
|
}
|
|
149107
149289
|
reportInitSucceeded(alreadyRegistered);
|
|
149108
149290
|
}
|
|
@@ -149152,8 +149334,7 @@ async function postRegisterAndPoll(session, frostBytes, signature) {
|
|
|
149152
149334
|
}
|
|
149153
149335
|
const body = await pollRes.json();
|
|
149154
149336
|
if (body.state === "confirmed") {
|
|
149155
|
-
|
|
149156
|
-
return body.txHash;
|
|
149337
|
+
return body.txHash ?? "";
|
|
149157
149338
|
}
|
|
149158
149339
|
if (body.state === "failed") {
|
|
149159
149340
|
throw new Error(`register-signer failed: ${body.error ?? "unknown error"}`);
|
|
@@ -149355,6 +149536,31 @@ function createApiStatusTool(session) {
|
|
|
149355
149536
|
|
|
149356
149537
|
// src/tools/sign-message.ts
|
|
149357
149538
|
init_zod();
|
|
149539
|
+
|
|
149540
|
+
// src/lib/sign-content.ts
|
|
149541
|
+
var import_agent_wallet_protocol2 = __toESM(require_dist3(), 1);
|
|
149542
|
+
var SignHeld = class extends Error {
|
|
149543
|
+
constructor(intentId, reasons) {
|
|
149544
|
+
super(`policy/require_human intentId=${intentId} reasons=${reasons.join("; ")}`);
|
|
149545
|
+
this.intentId = intentId;
|
|
149546
|
+
this.reasons = reasons;
|
|
149547
|
+
this.name = "SignHeld";
|
|
149548
|
+
}
|
|
149549
|
+
};
|
|
149550
|
+
async function signContent(signer, dkgBlob, content, hash3) {
|
|
149551
|
+
const decision = await signer.evaluateIntent({ ...content, clientHash: hash3 });
|
|
149552
|
+
if (decision.decision === "deny") {
|
|
149553
|
+
throw new Error(decision.reasons.join("; ") || "policy/deny");
|
|
149554
|
+
}
|
|
149555
|
+
if (decision.decision === "require_human") {
|
|
149556
|
+
if (!decision.intentId) throw new Error("The backend held it without an intent id.");
|
|
149557
|
+
throw new SignHeld(decision.intentId, decision.reasons);
|
|
149558
|
+
}
|
|
149559
|
+
const signature = (0, import_agent_wallet_protocol2.normalizeFrostSig)(await signer.sign(dkgBlob, hash3));
|
|
149560
|
+
return { signature, decision };
|
|
149561
|
+
}
|
|
149562
|
+
|
|
149563
|
+
// src/tools/sign-message.ts
|
|
149358
149564
|
var signMessageSchema = external_exports.object({
|
|
149359
149565
|
message: external_exports.string().describe("the message to sign")
|
|
149360
149566
|
});
|
|
@@ -149363,7 +149569,7 @@ function createSignMessageTool(session) {
|
|
|
149363
149569
|
name: "sign_message",
|
|
149364
149570
|
title: "Sign a message",
|
|
149365
149571
|
// Not read-only: it uses the wallet key. Not destructive in the spec's
|
|
149366
|
-
// sense either — it
|
|
149572
|
+
// sense either — it moves no funds. That is a hint about display, not a
|
|
149367
149573
|
// safety claim: the signature is a bearer artefact that can authorize
|
|
149368
149574
|
// something elsewhere later. What guards that is the policy engine, never
|
|
149369
149575
|
// these annotations.
|
|
@@ -149373,25 +149579,23 @@ function createSignMessageTool(session) {
|
|
|
149373
149579
|
idempotentHint: true,
|
|
149374
149580
|
openWorldHint: false
|
|
149375
149581
|
},
|
|
149376
|
-
description: "Sign
|
|
149582
|
+
description: "Sign a text with the account key (EIP-191 personal sign for EVM). A signed text never runs on chain: it signs free, as often as asked, unless the wallet is paused. Not a way to pay: use `x402_pay` or `transfer_usdc`.",
|
|
149377
149583
|
inputSchema: signMessageSchema,
|
|
149378
149584
|
handler: async (input) => {
|
|
149379
|
-
await ensureAccount(session);
|
|
149380
|
-
const
|
|
149381
|
-
|
|
149382
|
-
|
|
149383
|
-
|
|
149585
|
+
const { signer, account } = await ensureAccount(session);
|
|
149586
|
+
const { signature } = await signContent(
|
|
149587
|
+
signer,
|
|
149588
|
+
account.dkgBlob,
|
|
149589
|
+
{ content: input.message },
|
|
149590
|
+
hashMessage(input.message, "hex")
|
|
149384
149591
|
);
|
|
149385
|
-
if (!signature.startsWith("0x")) {
|
|
149386
|
-
signature = `0x${signature}`;
|
|
149387
|
-
}
|
|
149388
149592
|
return `Signature: ${signature}`;
|
|
149389
149593
|
}
|
|
149390
149594
|
};
|
|
149391
149595
|
}
|
|
149392
149596
|
|
|
149393
149597
|
// src/tools/transfer-usdc.ts
|
|
149394
|
-
var
|
|
149598
|
+
var import_agent_wallet_protocol6 = __toESM(require_dist3(), 1);
|
|
149395
149599
|
init_zod();
|
|
149396
149600
|
|
|
149397
149601
|
// src/lib/approval-link.ts
|
|
@@ -149425,7 +149629,7 @@ function missionPageLink(baseURL, appId, missionId) {
|
|
|
149425
149629
|
}
|
|
149426
149630
|
|
|
149427
149631
|
// src/lib/balance.ts
|
|
149428
|
-
var
|
|
149632
|
+
var import_agent_wallet_protocol3 = __toESM(require_dist3(), 1);
|
|
149429
149633
|
var DEFAULT_CURRENCY = "EUR";
|
|
149430
149634
|
async function fetchPreferredCurrency(session) {
|
|
149431
149635
|
try {
|
|
@@ -149492,7 +149696,7 @@ async function getAccountBalance(session) {
|
|
|
149492
149696
|
}
|
|
149493
149697
|
const address = session.account.address;
|
|
149494
149698
|
const publicClient = session.account.publicClient;
|
|
149495
|
-
const usdcEntry = (0,
|
|
149699
|
+
const usdcEntry = (0, import_agent_wallet_protocol3.getUsdcChainEntry)(chain.id);
|
|
149496
149700
|
if (!usdcEntry) {
|
|
149497
149701
|
const raw = await publicClient.getBalance({ address });
|
|
149498
149702
|
const nativeStr = `${formatUnits(raw, chain.nativeCurrency.decimals)} ${chain.nativeCurrency.symbol}`;
|
|
@@ -149800,15 +150004,7 @@ function forgetRunPayments(session, runId) {
|
|
|
149800
150004
|
}
|
|
149801
150005
|
|
|
149802
150006
|
// src/lib/relay.ts
|
|
149803
|
-
var
|
|
149804
|
-
var RelayHeld = class extends Error {
|
|
149805
|
-
constructor(intentId, reasons) {
|
|
149806
|
-
super(`policy/require_human intentId=${intentId} reasons=${reasons.join("; ")}`);
|
|
149807
|
-
this.intentId = intentId;
|
|
149808
|
-
this.reasons = reasons;
|
|
149809
|
-
this.name = "RelayHeld";
|
|
149810
|
-
}
|
|
149811
|
-
};
|
|
150007
|
+
var import_agent_wallet_protocol4 = __toESM(require_dist3(), 1);
|
|
149812
150008
|
async function executeRelayedWithIntent(publicClient, signer, dkgBlob, accountAddress, dest, value, publicKeyHex, frostVerifierAddress, data = "0x", missionRunId) {
|
|
149813
150009
|
const chainId = await publicClient.getChainId();
|
|
149814
150010
|
const code = await publicClient.getCode({ address: accountAddress });
|
|
@@ -149822,7 +150018,7 @@ async function executeRelayedWithIntent(publicClient, signer, dkgBlob, accountAd
|
|
|
149822
150018
|
abi: schnorrAccountAbi,
|
|
149823
150019
|
functionName: "relayNonce"
|
|
149824
150020
|
});
|
|
149825
|
-
const relayHash = (0,
|
|
150021
|
+
const relayHash = (0, import_agent_wallet_protocol4.computeRelayHash)({
|
|
149826
150022
|
chainId,
|
|
149827
150023
|
account: accountAddress,
|
|
149828
150024
|
nonce,
|
|
@@ -149830,32 +150026,25 @@ async function executeRelayedWithIntent(publicClient, signer, dkgBlob, accountAd
|
|
|
149830
150026
|
value,
|
|
149831
150027
|
data
|
|
149832
150028
|
});
|
|
149833
|
-
const policyDecision = await
|
|
149834
|
-
|
|
149835
|
-
|
|
149836
|
-
|
|
149837
|
-
|
|
149838
|
-
|
|
149839
|
-
|
|
149840
|
-
|
|
149841
|
-
|
|
150029
|
+
const { signature: rawSignature, decision: policyDecision } = await signContent(
|
|
150030
|
+
signer,
|
|
150031
|
+
dkgBlob,
|
|
150032
|
+
{
|
|
150033
|
+
content: {
|
|
150034
|
+
chainId,
|
|
150035
|
+
account: accountAddress,
|
|
150036
|
+
nonce: nonce.toString(),
|
|
150037
|
+
dest,
|
|
150038
|
+
value: value.toString(),
|
|
150039
|
+
data
|
|
150040
|
+
},
|
|
150041
|
+
...missionRunId ? { missionRunId } : {}
|
|
149842
150042
|
},
|
|
149843
|
-
|
|
149844
|
-
...missionRunId ? { missionRunId } : {}
|
|
149845
|
-
});
|
|
149846
|
-
if (policyDecision.decision === "deny") {
|
|
149847
|
-
throw new Error(policyDecision.reasons.join("; "));
|
|
149848
|
-
}
|
|
149849
|
-
if (policyDecision.decision === "require_human") {
|
|
149850
|
-
if (!policyDecision.intentId) throw new Error("The backend held the transfer without an intent id.");
|
|
149851
|
-
throw new RelayHeld(policyDecision.intentId, policyDecision.reasons);
|
|
149852
|
-
}
|
|
149853
|
-
const rawSignature = (0, import_agent_wallet_protocol3.normalizeFrostSig)(
|
|
149854
|
-
await signer.sign(dkgBlob, relayHash)
|
|
150043
|
+
relayHash
|
|
149855
150044
|
);
|
|
149856
|
-
const multiSignerSig = (0,
|
|
150045
|
+
const multiSignerSig = (0, import_agent_wallet_protocol4.encodeMultiSignerSignature)(
|
|
149857
150046
|
rawSignature,
|
|
149858
|
-
(0,
|
|
150047
|
+
(0, import_agent_wallet_protocol4.normalizeFrostSig)(publicKeyHex),
|
|
149859
150048
|
frostVerifierAddress
|
|
149860
150049
|
);
|
|
149861
150050
|
const txHash = await signer.relay(
|
|
@@ -149885,7 +150074,7 @@ var UI_PAGES = {
|
|
|
149885
150074
|
};
|
|
149886
150075
|
|
|
149887
150076
|
// src/lib/x402-diagnostics.ts
|
|
149888
|
-
var
|
|
150077
|
+
var import_agent_wallet_protocol5 = __toESM(require_dist3(), 1);
|
|
149889
150078
|
var SETTLE_REASON_HINTS = {
|
|
149890
150079
|
invalid_exact_evm_transaction_failed: "The facilitator could not complete the on-chain settlement transaction (USDC transferWithAuthorization). If it reverted, common causes: (1) the payer is a smart-contract wallet (e.g. a SchnorrAccount) and its ERC-1271/ERC-7739 signature was rejected during on-chain verification; (2) USDC balance < amount at execution time; (3) the authorization nonce was already used; (4) the authorization expired (validBefore in the past). Note: the facilitator pays gas, so the payer holding 0 native ETH is NOT the cause.",
|
|
149891
150080
|
insufficient_funds: "The payer account does not hold enough of the payment asset to cover the amount.",
|
|
@@ -149941,7 +150130,7 @@ async function describeAccountState(publicClient, payer2, chainId, requiredAmoun
|
|
|
149941
150130
|
} catch (err) {
|
|
149942
150131
|
logger.warn(`diagnostics: failed to read native balance: ${String(err)}`);
|
|
149943
150132
|
}
|
|
149944
|
-
const usdcEntry = (0,
|
|
150133
|
+
const usdcEntry = (0, import_agent_wallet_protocol5.getUsdcChainEntry)(chainId);
|
|
149945
150134
|
if (usdcEntry) {
|
|
149946
150135
|
try {
|
|
149947
150136
|
const usdc = await publicClient.readContract({
|
|
@@ -150047,7 +150236,7 @@ function sender(session) {
|
|
|
150047
150236
|
`USDC transfer is not supported for network "${session.network}". Supported: ${Object.keys(CHAIN_MAP).join(", ")}`
|
|
150048
150237
|
);
|
|
150049
150238
|
}
|
|
150050
|
-
const usdc = (0,
|
|
150239
|
+
const usdc = (0, import_agent_wallet_protocol6.getUsdcChainEntry)(chain.id);
|
|
150051
150240
|
if (!usdc) {
|
|
150052
150241
|
throw new Error(
|
|
150053
150242
|
`No canonical USDC contract registered for network "${session.network}" (chainId ${chain.id}).`
|
|
@@ -150074,10 +150263,10 @@ function sender(session) {
|
|
|
150074
150263
|
let sent;
|
|
150075
150264
|
try {
|
|
150076
150265
|
sent = await send().catch(async (err) => {
|
|
150077
|
-
if (!(err instanceof
|
|
150266
|
+
if (!(err instanceof SignHeld)) throw err;
|
|
150078
150267
|
await holdPayment(session, transferHold(err.intentId, input, amount2));
|
|
150079
150268
|
return send().catch(async (again) => {
|
|
150080
|
-
if (!(again instanceof
|
|
150269
|
+
if (!(again instanceof SignHeld)) throw again;
|
|
150081
150270
|
throw await heldAnswer(session, transferHold(again.intentId, input, amount2));
|
|
150082
150271
|
});
|
|
150083
150272
|
});
|
|
@@ -150540,7 +150729,7 @@ async function withFundingFallback(pay, input, funding) {
|
|
|
150540
150729
|
}
|
|
150541
150730
|
|
|
150542
150731
|
// src/lib/x402-signer.ts
|
|
150543
|
-
var
|
|
150732
|
+
var import_agent_wallet_protocol7 = __toESM(require_dist3(), 1);
|
|
150544
150733
|
|
|
150545
150734
|
// node_modules/.pnpm/viem@2.57.4_typescript@5.9.3_zod@3.25.76/node_modules/viem/_esm/experimental/erc7739/utils/wrapTypedDataSignature.js
|
|
150546
150735
|
init_isHex();
|
|
@@ -150582,7 +150771,7 @@ function wrapTypedDataSignature(parameters) {
|
|
|
150582
150771
|
|
|
150583
150772
|
// src/lib/x402-signer.ts
|
|
150584
150773
|
function isSupportedPrimaryType(value) {
|
|
150585
|
-
return
|
|
150774
|
+
return import_agent_wallet_protocol7.EIP3009_PRIMARY_TYPES.includes(value);
|
|
150586
150775
|
}
|
|
150587
150776
|
async function signX402Authorization(session, auth2) {
|
|
150588
150777
|
const { account, frostVerifierAddress } = session;
|
|
@@ -150592,7 +150781,7 @@ async function signX402Authorization(session, auth2) {
|
|
|
150592
150781
|
);
|
|
150593
150782
|
}
|
|
150594
150783
|
const chainId = Number(auth2.chainId);
|
|
150595
|
-
const registryEntry = (0,
|
|
150784
|
+
const registryEntry = (0, import_agent_wallet_protocol7.getUsdcChainEntry)(chainId);
|
|
150596
150785
|
if (!registryEntry) {
|
|
150597
150786
|
throw new Error(
|
|
150598
150787
|
`Unsupported chain for x402 USDC payment: chainId=${chainId}.`
|
|
@@ -150608,8 +150797,8 @@ async function signX402Authorization(session, auth2) {
|
|
|
150608
150797
|
validBefore: BigInt(auth2.authorization.validBefore),
|
|
150609
150798
|
nonce: auth2.authorization.nonce
|
|
150610
150799
|
};
|
|
150611
|
-
const typedData = (0,
|
|
150612
|
-
const hash3 = (0,
|
|
150800
|
+
const typedData = (0, import_agent_wallet_protocol7.buildEip3009TypedData)(payment, registryEntry);
|
|
150801
|
+
const hash3 = (0, import_agent_wallet_protocol7.recomputeErc7739Hash)({
|
|
150613
150802
|
accountAddress: account.address,
|
|
150614
150803
|
typedData
|
|
150615
150804
|
});
|
|
@@ -150619,12 +150808,12 @@ async function signX402Authorization(session, auth2) {
|
|
|
150619
150808
|
);
|
|
150620
150809
|
}
|
|
150621
150810
|
logger.info("Signing x402 EIP-3009 envelope (TSS Schnorr)...");
|
|
150622
|
-
const rawSig = (0,
|
|
150811
|
+
const rawSig = (0, import_agent_wallet_protocol7.normalizeFrostSig)(
|
|
150623
150812
|
await session.signer.sign(account.dkgBlob, hash3)
|
|
150624
150813
|
);
|
|
150625
|
-
const multiSig = (0,
|
|
150814
|
+
const multiSig = (0, import_agent_wallet_protocol7.encodeMultiSignerSignature)(
|
|
150626
150815
|
rawSig,
|
|
150627
|
-
(0,
|
|
150816
|
+
(0, import_agent_wallet_protocol7.normalizeFrostSig)(account.publicKey),
|
|
150628
150817
|
frostVerifierAddress
|
|
150629
150818
|
);
|
|
150630
150819
|
return wrapTypedDataSignature({
|
|
@@ -150896,10 +151085,9 @@ function payer(session) {
|
|
|
150896
151085
|
} else {
|
|
150897
151086
|
const maxValue = input.maxAmount ? parseUnits(input.maxAmount, USDC_DECIMALS3).toString() : void 0;
|
|
150898
151087
|
decision = await ctx.evaluateIntent({
|
|
150899
|
-
channel: "x402",
|
|
150900
151088
|
...sponsor && !prepaid ? { capabilities: ["sponsored-x402"] } : {},
|
|
150901
151089
|
...input.missionRunId ? { missionRunId: input.missionRunId } : {},
|
|
150902
|
-
|
|
151090
|
+
content: {
|
|
150903
151091
|
url: input.url,
|
|
150904
151092
|
...ctx.accountAddress ? { accountAddress: ctx.accountAddress } : {},
|
|
150905
151093
|
...maxValue ? { maxValue } : {},
|
|
@@ -151696,7 +151884,7 @@ var ExactEvmScheme = class {
|
|
|
151696
151884
|
};
|
|
151697
151885
|
|
|
151698
151886
|
// src/tools/x402-info.ts
|
|
151699
|
-
var
|
|
151887
|
+
var import_agent_wallet_protocol9 = __toESM(require_dist3(), 1);
|
|
151700
151888
|
|
|
151701
151889
|
// src/lib/bazaar-input.ts
|
|
151702
151890
|
var MAX_FIELDS = 30;
|
|
@@ -151750,7 +151938,7 @@ function formatBazaarInput(extensions) {
|
|
|
151750
151938
|
}
|
|
151751
151939
|
|
|
151752
151940
|
// src/lib/x402-payability.ts
|
|
151753
|
-
var
|
|
151941
|
+
var import_agent_wallet_protocol8 = __toESM(require_dist3(), 1);
|
|
151754
151942
|
var CANNOT_SETTLE = "which this wallet cannot settle yet (it supports exact)";
|
|
151755
151943
|
function offeredSchemes(accepts) {
|
|
151756
151944
|
return [...new Set(accepts.map((a) => a.scheme))].join(", ");
|
|
@@ -151769,7 +151957,7 @@ function explain(reason, accepts) {
|
|
|
151769
151957
|
}
|
|
151770
151958
|
}
|
|
151771
151959
|
function payabilityWarning(decoded, chainId) {
|
|
151772
|
-
const selected = (0,
|
|
151960
|
+
const selected = (0, import_agent_wallet_protocol8.selectExactUsdcAccept)(decoded, chainId);
|
|
151773
151961
|
if (selected.ok) return null;
|
|
151774
151962
|
return `\u26A0 Not payable by this wallet: ${explain(selected.reason, decoded.accepts)} \u2014 do not call x402_pay; pick another provider.`;
|
|
151775
151963
|
}
|
|
@@ -151790,7 +151978,7 @@ var evmScheme = new ExactEvmScheme();
|
|
|
151790
151978
|
var CANONICAL_USDC_DECIMALS = 6;
|
|
151791
151979
|
function canonicalUsdcDecimals(network, asset) {
|
|
151792
151980
|
try {
|
|
151793
|
-
const entry = (0,
|
|
151981
|
+
const entry = (0, import_agent_wallet_protocol9.getUsdcChainEntry)((0, import_agent_wallet_protocol9.networkToChainId)(network));
|
|
151794
151982
|
if (!entry) return void 0;
|
|
151795
151983
|
return entry.address.toLowerCase() === asset.toLowerCase() ? CANONICAL_USDC_DECIMALS : void 0;
|
|
151796
151984
|
} catch {
|
|
@@ -151867,7 +152055,7 @@ The route may only serve another method \u2014 its x402 paywall is never reached
|
|
|
151867
152055
|
${body2}` : ""}`;
|
|
151868
152056
|
}
|
|
151869
152057
|
const body = await response.text().catch(() => "");
|
|
151870
|
-
const result = (0,
|
|
152058
|
+
const result = (0, import_agent_wallet_protocol9.decodeX402)(response.headers.get("payment-required"), body);
|
|
151871
152059
|
if (!result.ok) {
|
|
151872
152060
|
return result.reason === "malformed" ? `402 received with malformed x402 payment metadata (URL: ${response.url})` : `402 received but no x402 headers \u2014 standard payment wall (URL: ${response.url})`;
|
|
151873
152061
|
}
|
|
@@ -152152,10 +152340,10 @@ function createAwaitPaymentApprovalTool(session) {
|
|
|
152152
152340
|
init_zod();
|
|
152153
152341
|
|
|
152154
152342
|
// src/lib/x402-service-lines.ts
|
|
152155
|
-
var
|
|
152343
|
+
var import_agent_wallet_protocol10 = __toESM(require_dist3(), 1);
|
|
152156
152344
|
function priceOption(option) {
|
|
152157
152345
|
const evm = /^eip155:(\d+)$/.exec(option.network);
|
|
152158
|
-
const usdc = evm ? (0,
|
|
152346
|
+
const usdc = evm ? (0, import_agent_wallet_protocol10.getUsdcChainEntry)(Number(evm[1])) : null;
|
|
152159
152347
|
if (usdc && option.asset?.toLowerCase() === usdc.address.toLowerCase()) {
|
|
152160
152348
|
return `${formatUsdc(option.amount)} (${option.network})`;
|
|
152161
152349
|
}
|
|
@@ -152339,7 +152527,7 @@ init_zod();
|
|
|
152339
152527
|
var import_amount2 = __toESM(require_amount(), 1);
|
|
152340
152528
|
|
|
152341
152529
|
// src/lib/expense-rows.ts
|
|
152342
|
-
var
|
|
152530
|
+
var import_agent_wallet_protocol11 = __toESM(require_dist3(), 1);
|
|
152343
152531
|
var isSponsorGrant = (row) => row.kind === "sponsor-grant";
|
|
152344
152532
|
function prepaidAmount2(row) {
|
|
152345
152533
|
if (row.amountEur == null) return void 0;
|
|
@@ -152348,7 +152536,7 @@ function prepaidAmount2(row) {
|
|
|
152348
152536
|
return `${eur} (${formatUsdc(row.value)})`;
|
|
152349
152537
|
}
|
|
152350
152538
|
function isUsdcRow({ tokenAddress, decimals, agent }) {
|
|
152351
|
-
return (0,
|
|
152539
|
+
return (0, import_agent_wallet_protocol11.isCanonicalUsdc)({
|
|
152352
152540
|
chainId: agent?.network ? CHAIN_MAP[agent.network]?.id : null,
|
|
152353
152541
|
tokenAddress,
|
|
152354
152542
|
decimals
|
|
@@ -156549,7 +156737,7 @@ function setupCommand() {
|
|
|
156549
156737
|
}
|
|
156550
156738
|
|
|
156551
156739
|
// src/index.ts
|
|
156552
|
-
var VERSION5 = true ? "0.
|
|
156740
|
+
var VERSION5 = true ? "0.7.0" : "0.0.0";
|
|
156553
156741
|
if (process.argv[2] !== "mcp" && !process.env.MCP_LOG_LEVEL) logger.setMinLevel("error");
|
|
156554
156742
|
function typedArgv(argv) {
|
|
156555
156743
|
if (argv[2] !== "__complete") return argv;
|