@haven_ai/signer 0.2.1-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/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.
@@ -282,18 +283,8 @@ declare function signerInstructions(): string;
282
283
  interface SignerCredentials {
283
284
  delegateKey: string;
284
285
  agentId?: string;
285
- /**
286
- * The Haven account (smart account) the agent spends from — #2908, the
287
- * account-vocabulary name. Same value as `safeAddress`.
288
- */
286
+ /** The Haven account (smart account) the agent spends from. */
289
287
  accountAddress?: string;
290
- /**
291
- * @deprecated #2908 — same value as {@link SignerCredentials.accountAddress}.
292
- * Removed from this shape in the release after the one carrying #2908
293
- * (#2914). The credential-FILE keys it was read from are a different
294
- * matter — see `readAccountAddressField`.
295
- */
296
- safeAddress?: string;
297
288
  chainId?: number;
298
289
  network?: string;
299
290
  x402BindingSigner?: string;
@@ -305,11 +296,11 @@ interface RawCredentialFile {
305
296
  delegateKey?: unknown;
306
297
  agent_id?: unknown;
307
298
  agentId?: unknown;
308
- /** #2908: what `@haven_ai/connect` writes from this release on. */
299
+ /** What `@haven_ai/connect` writes. */
309
300
  account_address?: unknown;
310
- /** Pre-#2908 spelling — read PERMANENTLY, see `readAccountAddressField`. */
301
+ /** Pre-#2908 spelling — read PERMANENTLY (a credential file never rewrites itself), see `readAccountAddressField`. */
311
302
  safe_address?: unknown;
312
- /** Pre-#2908 spelling — read PERMANENTLY, see `readAccountAddressField`. */
303
+ /** Pre-#2908 spelling — read PERMANENTLY (a credential file never rewrites itself), see `readAccountAddressField`. */
313
304
  safeAddress?: unknown;
314
305
  chain_id?: unknown;
315
306
  chainId?: unknown;
@@ -346,11 +337,11 @@ declare function loadSignerCredentials(path?: string | undefined): Promise<Signe
346
337
  */
347
338
  declare function readAccountAddressField(raw: Pick<RawCredentialFile, 'account_address' | 'safe_address' | 'safeAddress'>): string | undefined;
348
339
  /**
349
- * The account address off the process environment, new name first:
350
- * `HAVEN_ACCOUNT_ADDRESS` (the survivor, decided on #2906) then the two
351
- * names the dashboard handoff emitted before #2908 — `HAVEN_WALLET_ADDRESS`
352
- * and `HAVEN_SAFE_ADDRESS`. Unlike the file fallbacks these two ARE
353
- * window-scoped: they are dropped at #2914, one release after this one.
340
+ * The account address off the process environment: `HAVEN_ACCOUNT_ADDRESS`
341
+ * (the survivor, decided on #2906). The two names the dashboard handoff
342
+ * emitted before #2908 — `HAVEN_WALLET_ADDRESS` and `HAVEN_SAFE_ADDRESS` —
343
+ * were window-scoped (unlike the credential-FILE fallbacks) and are retired
344
+ * as of #2914.
354
345
  */
355
346
  declare function readAccountAddressEnv(env: NodeJS.ProcessEnv): string | undefined;
356
347
  /**
@@ -368,12 +359,20 @@ interface SigningAuditEntry {
368
359
  tool: SignerToolName;
369
360
  payload_hash: string;
370
361
  delegate_address: string;
362
+ /**
363
+ * Serialized key kept as `safe_address` deliberately (#2914 review): this
364
+ * is a persisted JSONL field, and an audit log written by an earlier
365
+ * release never rewrites itself — renaming the key here would fork the
366
+ * format mid-file. `SigningAuditContext.accountAddress` (the in-memory
367
+ * field this is built from) carries the account-vocabulary name; only the
368
+ * on-disk spelling stays put.
369
+ */
371
370
  safe_address?: string;
372
371
  chain_id?: number;
373
372
  }
374
373
  interface SigningAuditContext {
375
374
  delegateAddress: string;
376
- safeAddress?: string;
375
+ accountAddress?: string;
377
376
  chainId?: number;
378
377
  auditPath?: string;
379
378
  }
@@ -393,7 +392,201 @@ interface HavenIdentity {
393
392
  * they never call the Haven API and never emit the key.
394
393
  */
395
394
  type SignerToolName = 'haven_sign' | 'haven_x402_sign_header' | 'haven_sign_x402' | 'haven_sign_sweep_delegate';
396
- declare const toolSchemas: Record<SignerToolName, z.ZodRawShape>;
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
+ };
397
590
  declare const toolDescriptions: Record<SignerToolName, string>;
398
591
  interface ToolSuccess<T> {
399
592
  success: true;
@@ -408,6 +601,13 @@ interface ToolFailure {
408
601
  next_action?: string;
409
602
  retry_with_new_quote?: boolean;
410
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;
411
611
  /**
412
612
  * #1309: present on `UNSUPPORTED_EXPECTED_CONTEXT_VERSION` /
413
613
  * `UNSUPPORTED_SWEEP_BINDING_VERSION` refusals — the exact version set this
@@ -451,7 +651,7 @@ declare function createToolHandlers(signer: EdgeSigner, options?: ToolHandlerOpt
451
651
 
452
652
  interface SignerConsentInput {
453
653
  delegateAddress: string;
454
- safeAddress?: string;
654
+ accountAddress?: string;
455
655
  agentId?: string;
456
656
  chainId?: number;
457
657
  network?: string;
@@ -476,7 +676,7 @@ declare function renderSignerConsentBlock(input: SignerConsentInput, hash: strin
476
676
  declare function ensureSignerConsent(input: SignerConsentInput, options?: SignerConsentOptions): Promise<SignerConsentDecision>;
477
677
 
478
678
  declare const SIGNER_NAME = "@haven_ai/signer";
479
- declare const SIGNER_VERSION = "0.2.1-alpha.0";
679
+ declare const SIGNER_VERSION = "0.4.0-alpha.0";
480
680
  interface SignerOptions {
481
681
  /** Path to a Haven credential JSON file (delegate_key is read from it). */
482
682
  credentialsPath?: string;
@@ -541,4 +741,24 @@ declare function assertSupportedNodeVersion(nodeVersion?: string): void;
541
741
  declare function runSignerStdioServer(options?: SignerOptions): Promise<void>;
542
742
  declare function runSignerConsentGate(signer: EdgeSigner, credentials: SignerCredentials | undefined, options: SignerOptions): Promise<SignerConsentDecision>;
543
743
 
544
- export { type EdgeSigner, type ResolvedSignerRuntime, SIGNER_ACK_ENV, SIGNER_CAPABILITY_KEY, 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 };
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.
@@ -282,18 +283,8 @@ declare function signerInstructions(): string;
282
283
  interface SignerCredentials {
283
284
  delegateKey: string;
284
285
  agentId?: string;
285
- /**
286
- * The Haven account (smart account) the agent spends from — #2908, the
287
- * account-vocabulary name. Same value as `safeAddress`.
288
- */
286
+ /** The Haven account (smart account) the agent spends from. */
289
287
  accountAddress?: string;
290
- /**
291
- * @deprecated #2908 — same value as {@link SignerCredentials.accountAddress}.
292
- * Removed from this shape in the release after the one carrying #2908
293
- * (#2914). The credential-FILE keys it was read from are a different
294
- * matter — see `readAccountAddressField`.
295
- */
296
- safeAddress?: string;
297
288
  chainId?: number;
298
289
  network?: string;
299
290
  x402BindingSigner?: string;
@@ -305,11 +296,11 @@ interface RawCredentialFile {
305
296
  delegateKey?: unknown;
306
297
  agent_id?: unknown;
307
298
  agentId?: unknown;
308
- /** #2908: what `@haven_ai/connect` writes from this release on. */
299
+ /** What `@haven_ai/connect` writes. */
309
300
  account_address?: unknown;
310
- /** Pre-#2908 spelling — read PERMANENTLY, see `readAccountAddressField`. */
301
+ /** Pre-#2908 spelling — read PERMANENTLY (a credential file never rewrites itself), see `readAccountAddressField`. */
311
302
  safe_address?: unknown;
312
- /** Pre-#2908 spelling — read PERMANENTLY, see `readAccountAddressField`. */
303
+ /** Pre-#2908 spelling — read PERMANENTLY (a credential file never rewrites itself), see `readAccountAddressField`. */
313
304
  safeAddress?: unknown;
314
305
  chain_id?: unknown;
315
306
  chainId?: unknown;
@@ -346,11 +337,11 @@ declare function loadSignerCredentials(path?: string | undefined): Promise<Signe
346
337
  */
347
338
  declare function readAccountAddressField(raw: Pick<RawCredentialFile, 'account_address' | 'safe_address' | 'safeAddress'>): string | undefined;
348
339
  /**
349
- * The account address off the process environment, new name first:
350
- * `HAVEN_ACCOUNT_ADDRESS` (the survivor, decided on #2906) then the two
351
- * names the dashboard handoff emitted before #2908 — `HAVEN_WALLET_ADDRESS`
352
- * and `HAVEN_SAFE_ADDRESS`. Unlike the file fallbacks these two ARE
353
- * window-scoped: they are dropped at #2914, one release after this one.
340
+ * The account address off the process environment: `HAVEN_ACCOUNT_ADDRESS`
341
+ * (the survivor, decided on #2906). The two names the dashboard handoff
342
+ * emitted before #2908 — `HAVEN_WALLET_ADDRESS` and `HAVEN_SAFE_ADDRESS` —
343
+ * were window-scoped (unlike the credential-FILE fallbacks) and are retired
344
+ * as of #2914.
354
345
  */
355
346
  declare function readAccountAddressEnv(env: NodeJS.ProcessEnv): string | undefined;
356
347
  /**
@@ -368,12 +359,20 @@ interface SigningAuditEntry {
368
359
  tool: SignerToolName;
369
360
  payload_hash: string;
370
361
  delegate_address: string;
362
+ /**
363
+ * Serialized key kept as `safe_address` deliberately (#2914 review): this
364
+ * is a persisted JSONL field, and an audit log written by an earlier
365
+ * release never rewrites itself — renaming the key here would fork the
366
+ * format mid-file. `SigningAuditContext.accountAddress` (the in-memory
367
+ * field this is built from) carries the account-vocabulary name; only the
368
+ * on-disk spelling stays put.
369
+ */
371
370
  safe_address?: string;
372
371
  chain_id?: number;
373
372
  }
374
373
  interface SigningAuditContext {
375
374
  delegateAddress: string;
376
- safeAddress?: string;
375
+ accountAddress?: string;
377
376
  chainId?: number;
378
377
  auditPath?: string;
379
378
  }
@@ -393,7 +392,201 @@ interface HavenIdentity {
393
392
  * they never call the Haven API and never emit the key.
394
393
  */
395
394
  type SignerToolName = 'haven_sign' | 'haven_x402_sign_header' | 'haven_sign_x402' | 'haven_sign_sweep_delegate';
396
- declare const toolSchemas: Record<SignerToolName, z.ZodRawShape>;
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
+ };
397
590
  declare const toolDescriptions: Record<SignerToolName, string>;
398
591
  interface ToolSuccess<T> {
399
592
  success: true;
@@ -408,6 +601,13 @@ interface ToolFailure {
408
601
  next_action?: string;
409
602
  retry_with_new_quote?: boolean;
410
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;
411
611
  /**
412
612
  * #1309: present on `UNSUPPORTED_EXPECTED_CONTEXT_VERSION` /
413
613
  * `UNSUPPORTED_SWEEP_BINDING_VERSION` refusals — the exact version set this
@@ -451,7 +651,7 @@ declare function createToolHandlers(signer: EdgeSigner, options?: ToolHandlerOpt
451
651
 
452
652
  interface SignerConsentInput {
453
653
  delegateAddress: string;
454
- safeAddress?: string;
654
+ accountAddress?: string;
455
655
  agentId?: string;
456
656
  chainId?: number;
457
657
  network?: string;
@@ -476,7 +676,7 @@ declare function renderSignerConsentBlock(input: SignerConsentInput, hash: strin
476
676
  declare function ensureSignerConsent(input: SignerConsentInput, options?: SignerConsentOptions): Promise<SignerConsentDecision>;
477
677
 
478
678
  declare const SIGNER_NAME = "@haven_ai/signer";
479
- declare const SIGNER_VERSION = "0.2.1-alpha.0";
679
+ declare const SIGNER_VERSION = "0.4.0-alpha.0";
480
680
  interface SignerOptions {
481
681
  /** Path to a Haven credential JSON file (delegate_key is read from it). */
482
682
  credentialsPath?: string;
@@ -541,4 +741,24 @@ declare function assertSupportedNodeVersion(nodeVersion?: string): void;
541
741
  declare function runSignerStdioServer(options?: SignerOptions): Promise<void>;
542
742
  declare function runSignerConsentGate(signer: EdgeSigner, credentials: SignerCredentials | undefined, options: SignerOptions): Promise<SignerConsentDecision>;
543
743
 
544
- export { type EdgeSigner, type ResolvedSignerRuntime, SIGNER_ACK_ENV, SIGNER_CAPABILITY_KEY, 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 };
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 };