@haven_ai/signer 0.3.0-alpha.0 → 0.4.0-alpha.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 +8 -3
- package/dist/cli.cjs +108 -10
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +154 -56
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +109 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +225 -3
- package/dist/index.d.ts +225 -3
- package/dist/index.js +155 -57
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { X402ExpectedAuth, X402PaymentRequired, X402PaymentOption, SweepAuthorization, SweepExpectedAuth } from '@haven_ai/sdk';
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
3
|
import { z } from 'zod/v3';
|
|
4
|
+
import { z as z$1 } from 'zod';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* The edge signer core.
|
|
@@ -391,7 +392,201 @@ interface HavenIdentity {
|
|
|
391
392
|
* they never call the Haven API and never emit the key.
|
|
392
393
|
*/
|
|
393
394
|
type SignerToolName = 'haven_sign' | 'haven_x402_sign_header' | 'haven_sign_x402' | 'haven_sign_sweep_delegate';
|
|
394
|
-
declare const toolSchemas:
|
|
395
|
+
declare const toolSchemas: {
|
|
396
|
+
readonly haven_sign_sweep_delegate: {
|
|
397
|
+
readonly authorization: z.ZodObject<{
|
|
398
|
+
from: z.ZodString;
|
|
399
|
+
to: z.ZodString;
|
|
400
|
+
value: z.ZodString;
|
|
401
|
+
validAfter: z.ZodString;
|
|
402
|
+
validBefore: z.ZodString;
|
|
403
|
+
nonce: z.ZodString;
|
|
404
|
+
token: z.ZodString;
|
|
405
|
+
chainId: z.ZodNumber;
|
|
406
|
+
}, "strip", z.ZodTypeAny, {
|
|
407
|
+
chainId: number;
|
|
408
|
+
to: string;
|
|
409
|
+
from: string;
|
|
410
|
+
nonce: string;
|
|
411
|
+
value: string;
|
|
412
|
+
token: string;
|
|
413
|
+
validAfter: string;
|
|
414
|
+
validBefore: string;
|
|
415
|
+
}, {
|
|
416
|
+
chainId: number;
|
|
417
|
+
to: string;
|
|
418
|
+
from: string;
|
|
419
|
+
nonce: string;
|
|
420
|
+
value: string;
|
|
421
|
+
token: string;
|
|
422
|
+
validAfter: string;
|
|
423
|
+
validBefore: string;
|
|
424
|
+
}>;
|
|
425
|
+
readonly expected_auth: z.ZodObject<{
|
|
426
|
+
version: z.ZodNumber;
|
|
427
|
+
message: z.ZodString;
|
|
428
|
+
signature: z.ZodString;
|
|
429
|
+
signer: z.ZodString;
|
|
430
|
+
}, "strip", z.ZodTypeAny, {
|
|
431
|
+
message: string;
|
|
432
|
+
version: number;
|
|
433
|
+
signature: string;
|
|
434
|
+
signer: string;
|
|
435
|
+
}, {
|
|
436
|
+
message: string;
|
|
437
|
+
version: number;
|
|
438
|
+
signature: string;
|
|
439
|
+
signer: string;
|
|
440
|
+
}>;
|
|
441
|
+
};
|
|
442
|
+
readonly haven_sign: {
|
|
443
|
+
readonly payment_id: z.ZodOptional<z.ZodString>;
|
|
444
|
+
readonly payload_hash: z.ZodOptional<z.ZodString>;
|
|
445
|
+
readonly x402_expected: z.ZodOptional<z.ZodObject<{
|
|
446
|
+
payment_id: z.ZodString;
|
|
447
|
+
payload_hash: z.ZodString;
|
|
448
|
+
resource_url: z.ZodString;
|
|
449
|
+
merchant_to: z.ZodString;
|
|
450
|
+
amount: z.ZodString;
|
|
451
|
+
asset: z.ZodString;
|
|
452
|
+
network: z.ZodString;
|
|
453
|
+
expires_at: z.ZodString;
|
|
454
|
+
typed_data_hash: z.ZodOptional<z.ZodString>;
|
|
455
|
+
payer_delegate: z.ZodOptional<z.ZodString>;
|
|
456
|
+
payer_agent_id: z.ZodOptional<z.ZodString>;
|
|
457
|
+
auth: z.ZodObject<{
|
|
458
|
+
version: z.ZodNumber;
|
|
459
|
+
message: z.ZodString;
|
|
460
|
+
signature: z.ZodString;
|
|
461
|
+
signer: z.ZodString;
|
|
462
|
+
}, "strip", z.ZodTypeAny, {
|
|
463
|
+
message: string;
|
|
464
|
+
version: number;
|
|
465
|
+
signature: string;
|
|
466
|
+
signer: string;
|
|
467
|
+
}, {
|
|
468
|
+
message: string;
|
|
469
|
+
version: number;
|
|
470
|
+
signature: string;
|
|
471
|
+
signer: string;
|
|
472
|
+
}>;
|
|
473
|
+
}, "strip", z.ZodTypeAny, {
|
|
474
|
+
network: string;
|
|
475
|
+
payment_id: string;
|
|
476
|
+
payload_hash: string;
|
|
477
|
+
resource_url: string;
|
|
478
|
+
merchant_to: string;
|
|
479
|
+
amount: string;
|
|
480
|
+
asset: string;
|
|
481
|
+
expires_at: string;
|
|
482
|
+
auth: {
|
|
483
|
+
message: string;
|
|
484
|
+
version: number;
|
|
485
|
+
signature: string;
|
|
486
|
+
signer: string;
|
|
487
|
+
};
|
|
488
|
+
typed_data_hash?: string | undefined;
|
|
489
|
+
payer_delegate?: string | undefined;
|
|
490
|
+
payer_agent_id?: string | undefined;
|
|
491
|
+
}, {
|
|
492
|
+
network: string;
|
|
493
|
+
payment_id: string;
|
|
494
|
+
payload_hash: string;
|
|
495
|
+
resource_url: string;
|
|
496
|
+
merchant_to: string;
|
|
497
|
+
amount: string;
|
|
498
|
+
asset: string;
|
|
499
|
+
expires_at: string;
|
|
500
|
+
auth: {
|
|
501
|
+
message: string;
|
|
502
|
+
version: number;
|
|
503
|
+
signature: string;
|
|
504
|
+
signer: string;
|
|
505
|
+
};
|
|
506
|
+
typed_data_hash?: string | undefined;
|
|
507
|
+
payer_delegate?: string | undefined;
|
|
508
|
+
payer_agent_id?: string | undefined;
|
|
509
|
+
}>>;
|
|
510
|
+
readonly typed_data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
511
|
+
readonly typed_data_b64: z.ZodOptional<z.ZodString>;
|
|
512
|
+
};
|
|
513
|
+
readonly haven_x402_sign_header: {
|
|
514
|
+
readonly payment_required: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
515
|
+
readonly x402_binding: z.ZodString;
|
|
516
|
+
};
|
|
517
|
+
readonly haven_sign_x402: {
|
|
518
|
+
readonly payment_id: z.ZodOptional<z.ZodString>;
|
|
519
|
+
readonly payload_hash: z.ZodOptional<z.ZodString>;
|
|
520
|
+
readonly x402_expected: z.ZodOptional<z.ZodObject<{
|
|
521
|
+
payment_id: z.ZodString;
|
|
522
|
+
payload_hash: z.ZodString;
|
|
523
|
+
resource_url: z.ZodString;
|
|
524
|
+
merchant_to: z.ZodString;
|
|
525
|
+
amount: z.ZodString;
|
|
526
|
+
asset: z.ZodString;
|
|
527
|
+
network: z.ZodString;
|
|
528
|
+
expires_at: z.ZodString;
|
|
529
|
+
typed_data_hash: z.ZodOptional<z.ZodString>;
|
|
530
|
+
payer_delegate: z.ZodOptional<z.ZodString>;
|
|
531
|
+
payer_agent_id: z.ZodOptional<z.ZodString>;
|
|
532
|
+
auth: z.ZodObject<{
|
|
533
|
+
version: z.ZodNumber;
|
|
534
|
+
message: z.ZodString;
|
|
535
|
+
signature: z.ZodString;
|
|
536
|
+
signer: z.ZodString;
|
|
537
|
+
}, "strip", z.ZodTypeAny, {
|
|
538
|
+
message: string;
|
|
539
|
+
version: number;
|
|
540
|
+
signature: string;
|
|
541
|
+
signer: string;
|
|
542
|
+
}, {
|
|
543
|
+
message: string;
|
|
544
|
+
version: number;
|
|
545
|
+
signature: string;
|
|
546
|
+
signer: string;
|
|
547
|
+
}>;
|
|
548
|
+
}, "strip", z.ZodTypeAny, {
|
|
549
|
+
network: string;
|
|
550
|
+
payment_id: string;
|
|
551
|
+
payload_hash: string;
|
|
552
|
+
resource_url: string;
|
|
553
|
+
merchant_to: string;
|
|
554
|
+
amount: string;
|
|
555
|
+
asset: string;
|
|
556
|
+
expires_at: string;
|
|
557
|
+
auth: {
|
|
558
|
+
message: string;
|
|
559
|
+
version: number;
|
|
560
|
+
signature: string;
|
|
561
|
+
signer: string;
|
|
562
|
+
};
|
|
563
|
+
typed_data_hash?: string | undefined;
|
|
564
|
+
payer_delegate?: string | undefined;
|
|
565
|
+
payer_agent_id?: string | undefined;
|
|
566
|
+
}, {
|
|
567
|
+
network: string;
|
|
568
|
+
payment_id: string;
|
|
569
|
+
payload_hash: string;
|
|
570
|
+
resource_url: string;
|
|
571
|
+
merchant_to: string;
|
|
572
|
+
amount: string;
|
|
573
|
+
asset: string;
|
|
574
|
+
expires_at: string;
|
|
575
|
+
auth: {
|
|
576
|
+
message: string;
|
|
577
|
+
version: number;
|
|
578
|
+
signature: string;
|
|
579
|
+
signer: string;
|
|
580
|
+
};
|
|
581
|
+
typed_data_hash?: string | undefined;
|
|
582
|
+
payer_delegate?: string | undefined;
|
|
583
|
+
payer_agent_id?: string | undefined;
|
|
584
|
+
}>>;
|
|
585
|
+
readonly payment_required: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
586
|
+
readonly typed_data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
587
|
+
readonly typed_data_b64: z.ZodOptional<z.ZodString>;
|
|
588
|
+
};
|
|
589
|
+
};
|
|
395
590
|
declare const toolDescriptions: Record<SignerToolName, string>;
|
|
396
591
|
interface ToolSuccess<T> {
|
|
397
592
|
success: true;
|
|
@@ -406,6 +601,13 @@ interface ToolFailure {
|
|
|
406
601
|
next_action?: string;
|
|
407
602
|
retry_with_new_quote?: boolean;
|
|
408
603
|
suggested_tool?: string;
|
|
604
|
+
/** #3101 (epic #3105, decision 7): the typed next-step family, additive; `next_tool` never null. */
|
|
605
|
+
next_tool?: string;
|
|
606
|
+
next_tool_server?: string;
|
|
607
|
+
next_tool_name?: string;
|
|
608
|
+
next_tool_server_role?: 'hosted' | 'signer';
|
|
609
|
+
next_arguments?: Record<string, unknown>;
|
|
610
|
+
next_tool_omitted_reason?: string;
|
|
409
611
|
/**
|
|
410
612
|
* #1309: present on `UNSUPPORTED_EXPECTED_CONTEXT_VERSION` /
|
|
411
613
|
* `UNSUPPORTED_SWEEP_BINDING_VERSION` refusals — the exact version set this
|
|
@@ -474,7 +676,7 @@ declare function renderSignerConsentBlock(input: SignerConsentInput, hash: strin
|
|
|
474
676
|
declare function ensureSignerConsent(input: SignerConsentInput, options?: SignerConsentOptions): Promise<SignerConsentDecision>;
|
|
475
677
|
|
|
476
678
|
declare const SIGNER_NAME = "@haven_ai/signer";
|
|
477
|
-
declare const SIGNER_VERSION = "0.
|
|
679
|
+
declare const SIGNER_VERSION = "0.4.0-alpha.0";
|
|
478
680
|
interface SignerOptions {
|
|
479
681
|
/** Path to a Haven credential JSON file (delegate_key is read from it). */
|
|
480
682
|
credentialsPath?: string;
|
|
@@ -539,4 +741,24 @@ declare function assertSupportedNodeVersion(nodeVersion?: string): void;
|
|
|
539
741
|
declare function runSignerStdioServer(options?: SignerOptions): Promise<void>;
|
|
540
742
|
declare function runSignerConsentGate(signer: EdgeSigner, credentials: SignerCredentials | undefined, options: SignerOptions): Promise<SignerConsentDecision>;
|
|
541
743
|
|
|
542
|
-
|
|
744
|
+
/**
|
|
745
|
+
* #3103 (epic #3105, slice 4/5): the signer's typed next step.
|
|
746
|
+
*
|
|
747
|
+
* The signer decides a `next_action` on its refusals and, until this module,
|
|
748
|
+
* never said which tool to call. It cannot know the client's server names
|
|
749
|
+
* (#2550), so the handoff is expressed through the role fields the SDK
|
|
750
|
+
* builder renders — `next_tool_server_role: hosted`, `next_tool_name` — from
|
|
751
|
+
* a bare tool name. The signer must not import the hosted server (it is an
|
|
752
|
+
* npm package installed on user machines; the hosted server is a Docker
|
|
753
|
+
* deployment), so the hosted tools it hands off to are DECLARED here as the
|
|
754
|
+
* argument shape the signer actually emits, and `next-step-signer-parity`
|
|
755
|
+
* in the hosted server's own suite pins them to the hosted schemas at test
|
|
756
|
+
* time — the mirror of how the hosted server declares the signer's shapes.
|
|
757
|
+
*/
|
|
758
|
+
declare const SIGNER_HOSTED_HANDOFF_SHAPES: {
|
|
759
|
+
readonly haven_get_payment_status: {
|
|
760
|
+
readonly payment_id: z$1.ZodString;
|
|
761
|
+
};
|
|
762
|
+
};
|
|
763
|
+
|
|
764
|
+
export { type EdgeSigner, type ResolvedSignerRuntime, SIGNER_ACK_ENV, SIGNER_CAPABILITY_KEY, SIGNER_HOSTED_HANDOFF_SHAPES, SIGNER_NAME, SIGNER_VERSION, SUPPORTED_SWEEP_BINDING_VERSIONS, SUPPORTED_X402_EXPECTED_VERSIONS, type SignerCompatibility, type SignerConsentDecision, type SignerConsentInput, type SignerConsentOptions, type SignerCredentials, type SignerOptions, type SignerToolName, type SigningAuditContext, type SigningAuditEntry, type ToolFailure, type ToolPayload, type ToolSuccess, type X402ExpectedPayment, type X402FundingSignatureResult, type X402HeaderResult, appendSigningAuditEntry, assertSupportedBindingVersion, assertSupportedNodeVersion, assertX402MatchesExpected, buildSignerMcpServer, computeSignerConsentHash, createEdgeSigner, createSigningAuditEntry, createToolHandlers, defaultSigningAuditPath, ensureSignerConsent, hashPayloadForAudit, loadSignerCredentials, readAccountAddressEnv, readAccountAddressField, renderSignerConsentBlock, resolveEdgeSigner, resolveSignerRuntime, runSignerConsentGate, runSignerStdioServer, signerCapabilityAdvertisement, signerCompatibility, signerInstructions, toolDescriptions, toolSchemas, warnIfCredentialFilePermissive };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { X402ExpectedAuth, X402PaymentRequired, X402PaymentOption, SweepAuthorization, SweepExpectedAuth } from '@haven_ai/sdk';
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
3
|
import { z } from 'zod/v3';
|
|
4
|
+
import { z as z$1 } from 'zod';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* The edge signer core.
|
|
@@ -391,7 +392,201 @@ interface HavenIdentity {
|
|
|
391
392
|
* they never call the Haven API and never emit the key.
|
|
392
393
|
*/
|
|
393
394
|
type SignerToolName = 'haven_sign' | 'haven_x402_sign_header' | 'haven_sign_x402' | 'haven_sign_sweep_delegate';
|
|
394
|
-
declare const toolSchemas:
|
|
395
|
+
declare const toolSchemas: {
|
|
396
|
+
readonly haven_sign_sweep_delegate: {
|
|
397
|
+
readonly authorization: z.ZodObject<{
|
|
398
|
+
from: z.ZodString;
|
|
399
|
+
to: z.ZodString;
|
|
400
|
+
value: z.ZodString;
|
|
401
|
+
validAfter: z.ZodString;
|
|
402
|
+
validBefore: z.ZodString;
|
|
403
|
+
nonce: z.ZodString;
|
|
404
|
+
token: z.ZodString;
|
|
405
|
+
chainId: z.ZodNumber;
|
|
406
|
+
}, "strip", z.ZodTypeAny, {
|
|
407
|
+
chainId: number;
|
|
408
|
+
to: string;
|
|
409
|
+
from: string;
|
|
410
|
+
nonce: string;
|
|
411
|
+
value: string;
|
|
412
|
+
token: string;
|
|
413
|
+
validAfter: string;
|
|
414
|
+
validBefore: string;
|
|
415
|
+
}, {
|
|
416
|
+
chainId: number;
|
|
417
|
+
to: string;
|
|
418
|
+
from: string;
|
|
419
|
+
nonce: string;
|
|
420
|
+
value: string;
|
|
421
|
+
token: string;
|
|
422
|
+
validAfter: string;
|
|
423
|
+
validBefore: string;
|
|
424
|
+
}>;
|
|
425
|
+
readonly expected_auth: z.ZodObject<{
|
|
426
|
+
version: z.ZodNumber;
|
|
427
|
+
message: z.ZodString;
|
|
428
|
+
signature: z.ZodString;
|
|
429
|
+
signer: z.ZodString;
|
|
430
|
+
}, "strip", z.ZodTypeAny, {
|
|
431
|
+
message: string;
|
|
432
|
+
version: number;
|
|
433
|
+
signature: string;
|
|
434
|
+
signer: string;
|
|
435
|
+
}, {
|
|
436
|
+
message: string;
|
|
437
|
+
version: number;
|
|
438
|
+
signature: string;
|
|
439
|
+
signer: string;
|
|
440
|
+
}>;
|
|
441
|
+
};
|
|
442
|
+
readonly haven_sign: {
|
|
443
|
+
readonly payment_id: z.ZodOptional<z.ZodString>;
|
|
444
|
+
readonly payload_hash: z.ZodOptional<z.ZodString>;
|
|
445
|
+
readonly x402_expected: z.ZodOptional<z.ZodObject<{
|
|
446
|
+
payment_id: z.ZodString;
|
|
447
|
+
payload_hash: z.ZodString;
|
|
448
|
+
resource_url: z.ZodString;
|
|
449
|
+
merchant_to: z.ZodString;
|
|
450
|
+
amount: z.ZodString;
|
|
451
|
+
asset: z.ZodString;
|
|
452
|
+
network: z.ZodString;
|
|
453
|
+
expires_at: z.ZodString;
|
|
454
|
+
typed_data_hash: z.ZodOptional<z.ZodString>;
|
|
455
|
+
payer_delegate: z.ZodOptional<z.ZodString>;
|
|
456
|
+
payer_agent_id: z.ZodOptional<z.ZodString>;
|
|
457
|
+
auth: z.ZodObject<{
|
|
458
|
+
version: z.ZodNumber;
|
|
459
|
+
message: z.ZodString;
|
|
460
|
+
signature: z.ZodString;
|
|
461
|
+
signer: z.ZodString;
|
|
462
|
+
}, "strip", z.ZodTypeAny, {
|
|
463
|
+
message: string;
|
|
464
|
+
version: number;
|
|
465
|
+
signature: string;
|
|
466
|
+
signer: string;
|
|
467
|
+
}, {
|
|
468
|
+
message: string;
|
|
469
|
+
version: number;
|
|
470
|
+
signature: string;
|
|
471
|
+
signer: string;
|
|
472
|
+
}>;
|
|
473
|
+
}, "strip", z.ZodTypeAny, {
|
|
474
|
+
network: string;
|
|
475
|
+
payment_id: string;
|
|
476
|
+
payload_hash: string;
|
|
477
|
+
resource_url: string;
|
|
478
|
+
merchant_to: string;
|
|
479
|
+
amount: string;
|
|
480
|
+
asset: string;
|
|
481
|
+
expires_at: string;
|
|
482
|
+
auth: {
|
|
483
|
+
message: string;
|
|
484
|
+
version: number;
|
|
485
|
+
signature: string;
|
|
486
|
+
signer: string;
|
|
487
|
+
};
|
|
488
|
+
typed_data_hash?: string | undefined;
|
|
489
|
+
payer_delegate?: string | undefined;
|
|
490
|
+
payer_agent_id?: string | undefined;
|
|
491
|
+
}, {
|
|
492
|
+
network: string;
|
|
493
|
+
payment_id: string;
|
|
494
|
+
payload_hash: string;
|
|
495
|
+
resource_url: string;
|
|
496
|
+
merchant_to: string;
|
|
497
|
+
amount: string;
|
|
498
|
+
asset: string;
|
|
499
|
+
expires_at: string;
|
|
500
|
+
auth: {
|
|
501
|
+
message: string;
|
|
502
|
+
version: number;
|
|
503
|
+
signature: string;
|
|
504
|
+
signer: string;
|
|
505
|
+
};
|
|
506
|
+
typed_data_hash?: string | undefined;
|
|
507
|
+
payer_delegate?: string | undefined;
|
|
508
|
+
payer_agent_id?: string | undefined;
|
|
509
|
+
}>>;
|
|
510
|
+
readonly typed_data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
511
|
+
readonly typed_data_b64: z.ZodOptional<z.ZodString>;
|
|
512
|
+
};
|
|
513
|
+
readonly haven_x402_sign_header: {
|
|
514
|
+
readonly payment_required: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
515
|
+
readonly x402_binding: z.ZodString;
|
|
516
|
+
};
|
|
517
|
+
readonly haven_sign_x402: {
|
|
518
|
+
readonly payment_id: z.ZodOptional<z.ZodString>;
|
|
519
|
+
readonly payload_hash: z.ZodOptional<z.ZodString>;
|
|
520
|
+
readonly x402_expected: z.ZodOptional<z.ZodObject<{
|
|
521
|
+
payment_id: z.ZodString;
|
|
522
|
+
payload_hash: z.ZodString;
|
|
523
|
+
resource_url: z.ZodString;
|
|
524
|
+
merchant_to: z.ZodString;
|
|
525
|
+
amount: z.ZodString;
|
|
526
|
+
asset: z.ZodString;
|
|
527
|
+
network: z.ZodString;
|
|
528
|
+
expires_at: z.ZodString;
|
|
529
|
+
typed_data_hash: z.ZodOptional<z.ZodString>;
|
|
530
|
+
payer_delegate: z.ZodOptional<z.ZodString>;
|
|
531
|
+
payer_agent_id: z.ZodOptional<z.ZodString>;
|
|
532
|
+
auth: z.ZodObject<{
|
|
533
|
+
version: z.ZodNumber;
|
|
534
|
+
message: z.ZodString;
|
|
535
|
+
signature: z.ZodString;
|
|
536
|
+
signer: z.ZodString;
|
|
537
|
+
}, "strip", z.ZodTypeAny, {
|
|
538
|
+
message: string;
|
|
539
|
+
version: number;
|
|
540
|
+
signature: string;
|
|
541
|
+
signer: string;
|
|
542
|
+
}, {
|
|
543
|
+
message: string;
|
|
544
|
+
version: number;
|
|
545
|
+
signature: string;
|
|
546
|
+
signer: string;
|
|
547
|
+
}>;
|
|
548
|
+
}, "strip", z.ZodTypeAny, {
|
|
549
|
+
network: string;
|
|
550
|
+
payment_id: string;
|
|
551
|
+
payload_hash: string;
|
|
552
|
+
resource_url: string;
|
|
553
|
+
merchant_to: string;
|
|
554
|
+
amount: string;
|
|
555
|
+
asset: string;
|
|
556
|
+
expires_at: string;
|
|
557
|
+
auth: {
|
|
558
|
+
message: string;
|
|
559
|
+
version: number;
|
|
560
|
+
signature: string;
|
|
561
|
+
signer: string;
|
|
562
|
+
};
|
|
563
|
+
typed_data_hash?: string | undefined;
|
|
564
|
+
payer_delegate?: string | undefined;
|
|
565
|
+
payer_agent_id?: string | undefined;
|
|
566
|
+
}, {
|
|
567
|
+
network: string;
|
|
568
|
+
payment_id: string;
|
|
569
|
+
payload_hash: string;
|
|
570
|
+
resource_url: string;
|
|
571
|
+
merchant_to: string;
|
|
572
|
+
amount: string;
|
|
573
|
+
asset: string;
|
|
574
|
+
expires_at: string;
|
|
575
|
+
auth: {
|
|
576
|
+
message: string;
|
|
577
|
+
version: number;
|
|
578
|
+
signature: string;
|
|
579
|
+
signer: string;
|
|
580
|
+
};
|
|
581
|
+
typed_data_hash?: string | undefined;
|
|
582
|
+
payer_delegate?: string | undefined;
|
|
583
|
+
payer_agent_id?: string | undefined;
|
|
584
|
+
}>>;
|
|
585
|
+
readonly payment_required: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
586
|
+
readonly typed_data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
587
|
+
readonly typed_data_b64: z.ZodOptional<z.ZodString>;
|
|
588
|
+
};
|
|
589
|
+
};
|
|
395
590
|
declare const toolDescriptions: Record<SignerToolName, string>;
|
|
396
591
|
interface ToolSuccess<T> {
|
|
397
592
|
success: true;
|
|
@@ -406,6 +601,13 @@ interface ToolFailure {
|
|
|
406
601
|
next_action?: string;
|
|
407
602
|
retry_with_new_quote?: boolean;
|
|
408
603
|
suggested_tool?: string;
|
|
604
|
+
/** #3101 (epic #3105, decision 7): the typed next-step family, additive; `next_tool` never null. */
|
|
605
|
+
next_tool?: string;
|
|
606
|
+
next_tool_server?: string;
|
|
607
|
+
next_tool_name?: string;
|
|
608
|
+
next_tool_server_role?: 'hosted' | 'signer';
|
|
609
|
+
next_arguments?: Record<string, unknown>;
|
|
610
|
+
next_tool_omitted_reason?: string;
|
|
409
611
|
/**
|
|
410
612
|
* #1309: present on `UNSUPPORTED_EXPECTED_CONTEXT_VERSION` /
|
|
411
613
|
* `UNSUPPORTED_SWEEP_BINDING_VERSION` refusals — the exact version set this
|
|
@@ -474,7 +676,7 @@ declare function renderSignerConsentBlock(input: SignerConsentInput, hash: strin
|
|
|
474
676
|
declare function ensureSignerConsent(input: SignerConsentInput, options?: SignerConsentOptions): Promise<SignerConsentDecision>;
|
|
475
677
|
|
|
476
678
|
declare const SIGNER_NAME = "@haven_ai/signer";
|
|
477
|
-
declare const SIGNER_VERSION = "0.
|
|
679
|
+
declare const SIGNER_VERSION = "0.4.0-alpha.0";
|
|
478
680
|
interface SignerOptions {
|
|
479
681
|
/** Path to a Haven credential JSON file (delegate_key is read from it). */
|
|
480
682
|
credentialsPath?: string;
|
|
@@ -539,4 +741,24 @@ declare function assertSupportedNodeVersion(nodeVersion?: string): void;
|
|
|
539
741
|
declare function runSignerStdioServer(options?: SignerOptions): Promise<void>;
|
|
540
742
|
declare function runSignerConsentGate(signer: EdgeSigner, credentials: SignerCredentials | undefined, options: SignerOptions): Promise<SignerConsentDecision>;
|
|
541
743
|
|
|
542
|
-
|
|
744
|
+
/**
|
|
745
|
+
* #3103 (epic #3105, slice 4/5): the signer's typed next step.
|
|
746
|
+
*
|
|
747
|
+
* The signer decides a `next_action` on its refusals and, until this module,
|
|
748
|
+
* never said which tool to call. It cannot know the client's server names
|
|
749
|
+
* (#2550), so the handoff is expressed through the role fields the SDK
|
|
750
|
+
* builder renders — `next_tool_server_role: hosted`, `next_tool_name` — from
|
|
751
|
+
* a bare tool name. The signer must not import the hosted server (it is an
|
|
752
|
+
* npm package installed on user machines; the hosted server is a Docker
|
|
753
|
+
* deployment), so the hosted tools it hands off to are DECLARED here as the
|
|
754
|
+
* argument shape the signer actually emits, and `next-step-signer-parity`
|
|
755
|
+
* in the hosted server's own suite pins them to the hosted schemas at test
|
|
756
|
+
* time — the mirror of how the hosted server declares the signer's shapes.
|
|
757
|
+
*/
|
|
758
|
+
declare const SIGNER_HOSTED_HANDOFF_SHAPES: {
|
|
759
|
+
readonly haven_get_payment_status: {
|
|
760
|
+
readonly payment_id: z$1.ZodString;
|
|
761
|
+
};
|
|
762
|
+
};
|
|
763
|
+
|
|
764
|
+
export { type EdgeSigner, type ResolvedSignerRuntime, SIGNER_ACK_ENV, SIGNER_CAPABILITY_KEY, SIGNER_HOSTED_HANDOFF_SHAPES, SIGNER_NAME, SIGNER_VERSION, SUPPORTED_SWEEP_BINDING_VERSIONS, SUPPORTED_X402_EXPECTED_VERSIONS, type SignerCompatibility, type SignerConsentDecision, type SignerConsentInput, type SignerConsentOptions, type SignerCredentials, type SignerOptions, type SignerToolName, type SigningAuditContext, type SigningAuditEntry, type ToolFailure, type ToolPayload, type ToolSuccess, type X402ExpectedPayment, type X402FundingSignatureResult, type X402HeaderResult, appendSigningAuditEntry, assertSupportedBindingVersion, assertSupportedNodeVersion, assertX402MatchesExpected, buildSignerMcpServer, computeSignerConsentHash, createEdgeSigner, createSigningAuditEntry, createToolHandlers, defaultSigningAuditPath, ensureSignerConsent, hashPayloadForAudit, loadSignerCredentials, readAccountAddressEnv, readAccountAddressField, renderSignerConsentBlock, resolveEdgeSigner, resolveSignerRuntime, runSignerConsentGate, runSignerStdioServer, signerCapabilityAdvertisement, signerCompatibility, signerInstructions, toolDescriptions, toolSchemas, warnIfCredentialFilePermissive };
|