@haven_ai/signer 0.5.0-alpha.1 → 0.7.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 +12 -6
- package/dist/cli.cjs +481 -22
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +482 -23
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +482 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -4
- package/dist/index.d.ts +39 -4
- package/dist/index.js +483 -24
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -251,6 +251,13 @@ interface SignerCompatibility {
|
|
|
251
251
|
* never a second literal.
|
|
252
252
|
*/
|
|
253
253
|
direct_sign_context_versions: number[];
|
|
254
|
+
/**
|
|
255
|
+
* #3329: `task_sign_context_version`s this signer will fetch and verify
|
|
256
|
+
* from `GET /task-budgets/:id/sign-context` — derived from
|
|
257
|
+
* `SUPPORTED_TASK_SIGN_CONTEXT_VERSIONS`, never a second literal, same
|
|
258
|
+
* discipline as `direct_sign_context_versions`.
|
|
259
|
+
*/
|
|
260
|
+
task_sign_context_versions: number[];
|
|
254
261
|
}
|
|
255
262
|
/** The supported sets this signer enforces, as a plain serialisable object. */
|
|
256
263
|
declare function signerCompatibility(): SignerCompatibility;
|
|
@@ -481,6 +488,26 @@ declare const SIGNER_HOSTED_HANDOFF_SHAPES: {
|
|
|
481
488
|
};
|
|
482
489
|
};
|
|
483
490
|
|
|
491
|
+
/**
|
|
492
|
+
* The signer's wire identity. Declared HERE, in the tools/handlers module —
|
|
493
|
+
* `server.ts` (the MCP wiring) imports them from this module, keeping the
|
|
494
|
+
* import graph one-directional (tools.ts ← server.ts, never the reverse);
|
|
495
|
+
* `server.ts` re-exports them, so the package's public API is unchanged.
|
|
496
|
+
*/
|
|
497
|
+
declare const SIGNER_NAME = "@haven_ai/signer";
|
|
498
|
+
declare const SIGNER_VERSION = "0.7.0-alpha.0";
|
|
499
|
+
/**
|
|
500
|
+
* #3419: the marker the tool layer prefixes the undeclared-argument refusal
|
|
501
|
+
* with. The strict re-parse lives in THIS module (`parseStrictFor`, below) —
|
|
502
|
+
* the same module as the `normalizeError` branch that shapes the refusal — so
|
|
503
|
+
* the marker, the message and the structured fields are one unit and cannot
|
|
504
|
+
* drift. The registration in `server.ts` is passthrough (the issue's "schema
|
|
505
|
+
* that keeps unknown keys"): the SDK layer lets an undeclared key through and
|
|
506
|
+
* the tool layer refuses it here, where the full structured refusal
|
|
507
|
+
* (`UNSUPPORTED_ARGUMENT` with `unknown_arguments`, `signer_version`,
|
|
508
|
+
* `fallback`) is still expressible as JSON on the result.
|
|
509
|
+
*/
|
|
510
|
+
declare const UNSUPPORTED_ARGUMENT_MARKER = "HavenSignerUnsupportedArgument:";
|
|
484
511
|
/**
|
|
485
512
|
* Local signer tool set. These run on the agent's machine, next to the key,
|
|
486
513
|
* and pair with the hosted server's construct/relay tools (#183). They sign;
|
|
@@ -604,6 +631,8 @@ declare const toolSchemas: {
|
|
|
604
631
|
}>>;
|
|
605
632
|
readonly typed_data: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
606
633
|
readonly typed_data_b64: z$1.ZodOptional<z$1.ZodString>;
|
|
634
|
+
readonly task_budget_id: z$1.ZodOptional<z$1.ZodString>;
|
|
635
|
+
readonly sub_budget_id: z$1.ZodOptional<z$1.ZodString>;
|
|
607
636
|
};
|
|
608
637
|
readonly haven_x402_sign_header: {
|
|
609
638
|
readonly payment_required: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
@@ -719,6 +748,14 @@ interface ToolFailure {
|
|
|
719
748
|
* field for every sign-context refusal (`'typed_data_b64'`).
|
|
720
749
|
*/
|
|
721
750
|
fallback?: string;
|
|
751
|
+
/**
|
|
752
|
+
* #3419: present on `UNSUPPORTED_ARGUMENT` — the undeclared top-level
|
|
753
|
+
* argument names the caller sent (the strict schema's `unrecognized_keys`),
|
|
754
|
+
* so an agent can see exactly what this signer does not accept.
|
|
755
|
+
*/
|
|
756
|
+
unknown_arguments?: string[];
|
|
757
|
+
/** #3419: present on `UNSUPPORTED_ARGUMENT` — this signer's own package version. */
|
|
758
|
+
signer_version?: string;
|
|
722
759
|
/**
|
|
723
760
|
* #3001: present on `SIGN_CONTEXT_REFUSED` — the HTTP status the backend
|
|
724
761
|
* answered the sign-context fetch with (404, 410, …) — the x402 fetch, or
|
|
@@ -727,7 +764,7 @@ interface ToolFailure {
|
|
|
727
764
|
http_status?: number;
|
|
728
765
|
/** #3001: the backend's own `error_code` on `SIGN_CONTEXT_REFUSED` (`expired`, `already_executed`, `not_signable`, `sign_context_unavailable`, and since #3303 `client_outdated`). */
|
|
729
766
|
backend_error_code?: string;
|
|
730
|
-
/** #3303: on `client_outdated`, the backend's update hint — `upgrade_command`
|
|
767
|
+
/** #3303: on `client_outdated`, the backend's update hint — `upgrade_command` starts the update (the doctor, then its repair line — #3412). */
|
|
731
768
|
client_update?: HavenClientUpdate;
|
|
732
769
|
}
|
|
733
770
|
type ToolPayload<T = unknown> = ToolSuccess<T> | ToolFailure;
|
|
@@ -775,8 +812,6 @@ declare function computeSignerConsentHash(input: SignerConsentInput): string;
|
|
|
775
812
|
declare function renderSignerConsentBlock(input: SignerConsentInput, hash: string): string;
|
|
776
813
|
declare function ensureSignerConsent(input: SignerConsentInput, options?: SignerConsentOptions): Promise<SignerConsentDecision>;
|
|
777
814
|
|
|
778
|
-
declare const SIGNER_NAME = "@haven_ai/signer";
|
|
779
|
-
declare const SIGNER_VERSION = "0.5.0-alpha.1";
|
|
780
815
|
interface SignerOptions {
|
|
781
816
|
/** Path to a Haven credential JSON file (delegate_key is read from it). */
|
|
782
817
|
credentialsPath?: string;
|
|
@@ -841,4 +876,4 @@ declare function assertSupportedNodeVersion(nodeVersion?: string): void;
|
|
|
841
876
|
declare function runSignerStdioServer(options?: SignerOptions): Promise<void>;
|
|
842
877
|
declare function runSignerConsentGate(signer: EdgeSigner, credentials: SignerCredentials | undefined, options: SignerOptions): Promise<SignerConsentDecision>;
|
|
843
878
|
|
|
844
|
-
export { AUDIT_ROTATE_BYTES, type AppendAuditOptions, type EdgeSigner, OWNER_ONLY_MODE, type PermissionLog, type PermissiveFile, 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 TightenOutcome, 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, permissiveMode, readAccountAddressEnv, readAccountAddressField, renderSignerConsentBlock, resolveEdgeSigner, resolveSignerRuntime, runSignerConsentGate, runSignerStdioServer, signerCapabilityAdvertisement, signerCompatibility, signerInstructions, tightenIfFilePermissive, toolDescriptions, toolSchemas, warnIfCredentialFilePermissive, warnIfFilePermissive };
|
|
879
|
+
export { AUDIT_ROTATE_BYTES, type AppendAuditOptions, type EdgeSigner, OWNER_ONLY_MODE, type PermissionLog, type PermissiveFile, 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 TightenOutcome, type ToolFailure, type ToolPayload, type ToolSuccess, UNSUPPORTED_ARGUMENT_MARKER, type X402ExpectedPayment, type X402FundingSignatureResult, type X402HeaderResult, appendSigningAuditEntry, assertSupportedBindingVersion, assertSupportedNodeVersion, assertX402MatchesExpected, buildSignerMcpServer, computeSignerConsentHash, createEdgeSigner, createSigningAuditEntry, createToolHandlers, defaultSigningAuditPath, ensureSignerConsent, hashPayloadForAudit, loadSignerCredentials, permissiveMode, readAccountAddressEnv, readAccountAddressField, renderSignerConsentBlock, resolveEdgeSigner, resolveSignerRuntime, runSignerConsentGate, runSignerStdioServer, signerCapabilityAdvertisement, signerCompatibility, signerInstructions, tightenIfFilePermissive, toolDescriptions, toolSchemas, warnIfCredentialFilePermissive, warnIfFilePermissive };
|
package/dist/index.d.ts
CHANGED
|
@@ -251,6 +251,13 @@ interface SignerCompatibility {
|
|
|
251
251
|
* never a second literal.
|
|
252
252
|
*/
|
|
253
253
|
direct_sign_context_versions: number[];
|
|
254
|
+
/**
|
|
255
|
+
* #3329: `task_sign_context_version`s this signer will fetch and verify
|
|
256
|
+
* from `GET /task-budgets/:id/sign-context` — derived from
|
|
257
|
+
* `SUPPORTED_TASK_SIGN_CONTEXT_VERSIONS`, never a second literal, same
|
|
258
|
+
* discipline as `direct_sign_context_versions`.
|
|
259
|
+
*/
|
|
260
|
+
task_sign_context_versions: number[];
|
|
254
261
|
}
|
|
255
262
|
/** The supported sets this signer enforces, as a plain serialisable object. */
|
|
256
263
|
declare function signerCompatibility(): SignerCompatibility;
|
|
@@ -481,6 +488,26 @@ declare const SIGNER_HOSTED_HANDOFF_SHAPES: {
|
|
|
481
488
|
};
|
|
482
489
|
};
|
|
483
490
|
|
|
491
|
+
/**
|
|
492
|
+
* The signer's wire identity. Declared HERE, in the tools/handlers module —
|
|
493
|
+
* `server.ts` (the MCP wiring) imports them from this module, keeping the
|
|
494
|
+
* import graph one-directional (tools.ts ← server.ts, never the reverse);
|
|
495
|
+
* `server.ts` re-exports them, so the package's public API is unchanged.
|
|
496
|
+
*/
|
|
497
|
+
declare const SIGNER_NAME = "@haven_ai/signer";
|
|
498
|
+
declare const SIGNER_VERSION = "0.7.0-alpha.0";
|
|
499
|
+
/**
|
|
500
|
+
* #3419: the marker the tool layer prefixes the undeclared-argument refusal
|
|
501
|
+
* with. The strict re-parse lives in THIS module (`parseStrictFor`, below) —
|
|
502
|
+
* the same module as the `normalizeError` branch that shapes the refusal — so
|
|
503
|
+
* the marker, the message and the structured fields are one unit and cannot
|
|
504
|
+
* drift. The registration in `server.ts` is passthrough (the issue's "schema
|
|
505
|
+
* that keeps unknown keys"): the SDK layer lets an undeclared key through and
|
|
506
|
+
* the tool layer refuses it here, where the full structured refusal
|
|
507
|
+
* (`UNSUPPORTED_ARGUMENT` with `unknown_arguments`, `signer_version`,
|
|
508
|
+
* `fallback`) is still expressible as JSON on the result.
|
|
509
|
+
*/
|
|
510
|
+
declare const UNSUPPORTED_ARGUMENT_MARKER = "HavenSignerUnsupportedArgument:";
|
|
484
511
|
/**
|
|
485
512
|
* Local signer tool set. These run on the agent's machine, next to the key,
|
|
486
513
|
* and pair with the hosted server's construct/relay tools (#183). They sign;
|
|
@@ -604,6 +631,8 @@ declare const toolSchemas: {
|
|
|
604
631
|
}>>;
|
|
605
632
|
readonly typed_data: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
606
633
|
readonly typed_data_b64: z$1.ZodOptional<z$1.ZodString>;
|
|
634
|
+
readonly task_budget_id: z$1.ZodOptional<z$1.ZodString>;
|
|
635
|
+
readonly sub_budget_id: z$1.ZodOptional<z$1.ZodString>;
|
|
607
636
|
};
|
|
608
637
|
readonly haven_x402_sign_header: {
|
|
609
638
|
readonly payment_required: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
@@ -719,6 +748,14 @@ interface ToolFailure {
|
|
|
719
748
|
* field for every sign-context refusal (`'typed_data_b64'`).
|
|
720
749
|
*/
|
|
721
750
|
fallback?: string;
|
|
751
|
+
/**
|
|
752
|
+
* #3419: present on `UNSUPPORTED_ARGUMENT` — the undeclared top-level
|
|
753
|
+
* argument names the caller sent (the strict schema's `unrecognized_keys`),
|
|
754
|
+
* so an agent can see exactly what this signer does not accept.
|
|
755
|
+
*/
|
|
756
|
+
unknown_arguments?: string[];
|
|
757
|
+
/** #3419: present on `UNSUPPORTED_ARGUMENT` — this signer's own package version. */
|
|
758
|
+
signer_version?: string;
|
|
722
759
|
/**
|
|
723
760
|
* #3001: present on `SIGN_CONTEXT_REFUSED` — the HTTP status the backend
|
|
724
761
|
* answered the sign-context fetch with (404, 410, …) — the x402 fetch, or
|
|
@@ -727,7 +764,7 @@ interface ToolFailure {
|
|
|
727
764
|
http_status?: number;
|
|
728
765
|
/** #3001: the backend's own `error_code` on `SIGN_CONTEXT_REFUSED` (`expired`, `already_executed`, `not_signable`, `sign_context_unavailable`, and since #3303 `client_outdated`). */
|
|
729
766
|
backend_error_code?: string;
|
|
730
|
-
/** #3303: on `client_outdated`, the backend's update hint — `upgrade_command`
|
|
767
|
+
/** #3303: on `client_outdated`, the backend's update hint — `upgrade_command` starts the update (the doctor, then its repair line — #3412). */
|
|
731
768
|
client_update?: HavenClientUpdate;
|
|
732
769
|
}
|
|
733
770
|
type ToolPayload<T = unknown> = ToolSuccess<T> | ToolFailure;
|
|
@@ -775,8 +812,6 @@ declare function computeSignerConsentHash(input: SignerConsentInput): string;
|
|
|
775
812
|
declare function renderSignerConsentBlock(input: SignerConsentInput, hash: string): string;
|
|
776
813
|
declare function ensureSignerConsent(input: SignerConsentInput, options?: SignerConsentOptions): Promise<SignerConsentDecision>;
|
|
777
814
|
|
|
778
|
-
declare const SIGNER_NAME = "@haven_ai/signer";
|
|
779
|
-
declare const SIGNER_VERSION = "0.5.0-alpha.1";
|
|
780
815
|
interface SignerOptions {
|
|
781
816
|
/** Path to a Haven credential JSON file (delegate_key is read from it). */
|
|
782
817
|
credentialsPath?: string;
|
|
@@ -841,4 +876,4 @@ declare function assertSupportedNodeVersion(nodeVersion?: string): void;
|
|
|
841
876
|
declare function runSignerStdioServer(options?: SignerOptions): Promise<void>;
|
|
842
877
|
declare function runSignerConsentGate(signer: EdgeSigner, credentials: SignerCredentials | undefined, options: SignerOptions): Promise<SignerConsentDecision>;
|
|
843
878
|
|
|
844
|
-
export { AUDIT_ROTATE_BYTES, type AppendAuditOptions, type EdgeSigner, OWNER_ONLY_MODE, type PermissionLog, type PermissiveFile, 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 TightenOutcome, 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, permissiveMode, readAccountAddressEnv, readAccountAddressField, renderSignerConsentBlock, resolveEdgeSigner, resolveSignerRuntime, runSignerConsentGate, runSignerStdioServer, signerCapabilityAdvertisement, signerCompatibility, signerInstructions, tightenIfFilePermissive, toolDescriptions, toolSchemas, warnIfCredentialFilePermissive, warnIfFilePermissive };
|
|
879
|
+
export { AUDIT_ROTATE_BYTES, type AppendAuditOptions, type EdgeSigner, OWNER_ONLY_MODE, type PermissionLog, type PermissiveFile, 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 TightenOutcome, type ToolFailure, type ToolPayload, type ToolSuccess, UNSUPPORTED_ARGUMENT_MARKER, type X402ExpectedPayment, type X402FundingSignatureResult, type X402HeaderResult, appendSigningAuditEntry, assertSupportedBindingVersion, assertSupportedNodeVersion, assertX402MatchesExpected, buildSignerMcpServer, computeSignerConsentHash, createEdgeSigner, createSigningAuditEntry, createToolHandlers, defaultSigningAuditPath, ensureSignerConsent, hashPayloadForAudit, loadSignerCredentials, permissiveMode, readAccountAddressEnv, readAccountAddressField, renderSignerConsentBlock, resolveEdgeSigner, resolveSignerRuntime, runSignerConsentGate, runSignerStdioServer, signerCapabilityAdvertisement, signerCompatibility, signerInstructions, tightenIfFilePermissive, toolDescriptions, toolSchemas, warnIfCredentialFilePermissive, warnIfFilePermissive };
|