@haven_ai/connect 0.1.29-alpha.0 → 0.1.31-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
@@ -12,6 +12,11 @@ interface ConnectApiClient {
12
12
  * never any secret material.
13
13
  */
14
14
  getConnectorStatus(setupId: string, apiKey: string): Promise<ConnectorStatusResponse>;
15
+ /**
16
+ * #1700: the agent behind an API key. Used by the re-key flow on both sides
17
+ * of the dashboard hand-off — see {@link AgentIdentity}.
18
+ */
19
+ getAgentIdentity(apiKey: string): Promise<AgentIdentity>;
15
20
  }
16
21
  interface ConnectorStatusResponse {
17
22
  status: string;
@@ -33,6 +38,18 @@ interface RegisterSetupInput extends ResolveSetupInput {
33
38
  proofSignature: string;
34
39
  apiKeyHash: string;
35
40
  apiKeyPrefix: string;
41
+ /**
42
+ * #1878: the RESOLVED hosted MCP server name this agent is being wired as —
43
+ * `haven` for the bare pair, `haven-<slug>` for a named one. Sent so the
44
+ * dashboard can tell two agents in one harness apart; it is a display aid
45
+ * and Haven keys nothing off it.
46
+ *
47
+ * Always sent by a connector that supports it, bare pair included. Omitting
48
+ * it for the bare pair would make "absent" ambiguous between *this is the
49
+ * unnamed pair* and *an older connector said nothing*, and only the second
50
+ * of those may render as unknown.
51
+ */
52
+ mcpServerName?: string;
36
53
  connectorContext?: ConnectorContext;
37
54
  installCapabilities?: {
38
55
  canWriteRuntimeConfig?: boolean;
@@ -105,6 +122,25 @@ interface RegisterSetupResponse {
105
122
  hosted_mcp_url: string;
106
123
  next_action: string;
107
124
  }
125
+ /**
126
+ * The agent identity behind an API key (#1700).
127
+ *
128
+ * Read from `GET /machine-payments/agent`, the same agent-authenticated
129
+ * endpoint the SDK's `getAgent()` uses. Re-key needs it twice and for two
130
+ * different questions: BEFORE, to refuse a legacy-rail account the way the
131
+ * backend would rather than let the owner discover it five signed steps later;
132
+ * and AFTER, to prove the API key the owner pasted really belongs to this
133
+ * agent and really names the key this machine just generated.
134
+ */
135
+ interface AgentIdentity {
136
+ id: string;
137
+ name: string;
138
+ status: string;
139
+ safe_address: string | null;
140
+ delegate_address: string | null;
141
+ chain_id: number | null;
142
+ execution_rail: 'legacy' | 'delegation' | string;
143
+ }
108
144
  declare function createConnectApiClient(baseUrl: string, fetchImpl?: typeof fetch): ConnectApiClient;
109
145
 
110
146
  interface LocalDelegateKey {
@@ -167,8 +203,8 @@ interface RuntimeProfile {
167
203
  }
168
204
  declare function runtimeProfile(runtime: string | undefined, env?: NodeJS.ProcessEnv): RuntimeProfile;
169
205
  declare function normalizeRuntime(runtime: string | undefined, env?: NodeJS.ProcessEnv): RuntimeId;
170
- /** The flag values a refusal message should offer. Mirrors RuntimeId. */
171
- declare const RUNTIME_FLAG_VALUES: "claude-code, codex-cli, codex-desktop, cursor, vscode, vscode-insiders, claude-desktop, hermes, other";
206
+ /** The same values as refusal-message prose. */
207
+ declare const RUNTIME_FLAG_VALUES: string;
172
208
  interface RuntimeSelection {
173
209
  runtime: RuntimeId | null;
174
210
  source: 'force' | 'detected' | 'explicit' | 'prompted' | 'none';
@@ -411,7 +447,7 @@ declare function runtimeInstallCapabilities(runtime: string | undefined, env?: N
411
447
  restartRequired: boolean;
412
448
  };
413
449
 
414
- declare const CONNECTOR_VERSION = "0.1.29-alpha.0";
450
+ declare const CONNECTOR_VERSION = "0.1.31-alpha.0";
415
451
  interface ConnectOptions {
416
452
  setupToken: string;
417
453
  apiBaseUrl: string;
@@ -479,9 +515,19 @@ interface ConnectOutcome {
479
515
  };
480
516
  delegate_address?: string;
481
517
  setup_challenge_expires_at?: string;
518
+ /**
519
+ * #2091, additive within schema_version 1: `message` is the redacted human
520
+ * refusal (automation used to get code + next_action and nothing to act
521
+ * on), and `allowed_runtimes` carries the valid `--runtime` retry values on
522
+ * runtime-selection refusals — the list the backend's setup prompt requires
523
+ * a retry to be drawn from, which `--json` previously discarded with the
524
+ * prose.
525
+ */
482
526
  error?: {
483
527
  code: string;
484
528
  next_action: string;
529
+ message?: string;
530
+ allowed_runtimes?: readonly string[];
485
531
  };
486
532
  }
487
533
  interface ConnectDeps {
@@ -519,13 +565,18 @@ declare function completionOutcome(input: {
519
565
  approvalRequired: boolean;
520
566
  }): ConnectOutcome;
521
567
  /**
522
- * A deliberately terse failure record: error messages can contain server or
523
- * filesystem detail, while this public contract must remain safe to serialize.
568
+ * The failure record for the `--json` contract.
524
569
  *
525
570
  * #1719: a `ConnectError` carries its own code and next action, so it is read
526
571
  * rather than guessed. The regex ladder below survives only for the refusals
527
572
  * that are still plain `Error`s — every new failure mode joins the vocabulary
528
573
  * instead of joining that ladder.
574
+ *
575
+ * #2091: the record now carries the redacted message rather than omitting it.
576
+ * The old stance — terse because "messages can contain server or filesystem
577
+ * detail" — left automation with a code and nothing to act on; the field
578
+ * failure was a Codex agent staring at `connect_failed` with, in its own
579
+ * words, "no additional safe error detail". Sanitize, don't silence.
529
580
  */
530
581
  declare function failedConnectOutcome(runtimeHint: string | undefined, error: unknown): ConnectOutcome;
531
582
  /**
@@ -564,6 +615,16 @@ interface ParsedCli {
564
615
  reason?: string;
565
616
  replacedBy?: string;
566
617
  };
618
+ /**
619
+ * #1700: replace an agent's signing key on this machine. Two phases, because
620
+ * the dashboard sits between them — `start` generates the key and prints its
621
+ * address, `finish` writes the key the owner brings back. No setup token: the
622
+ * re-key API is owner-authenticated and this connector never calls it.
623
+ */
624
+ rekey?: {
625
+ phase: 'start' | 'finish';
626
+ newApiKey?: string;
627
+ };
567
628
  }
568
629
  declare function parseArgs(argv: string[], env?: NodeJS.ProcessEnv): ParsedCli;
569
630
  declare function helpText(): string;
@@ -588,10 +649,22 @@ declare function shortAddress(address: string): string;
588
649
  * Codes are additive and never renamed: a consumer pinned to an older
589
650
  * connector must keep recognising the ones it already knows.
590
651
  */
652
+ interface ConnectErrorDetails {
653
+ /**
654
+ * The `--runtime` values a retry may use, when the refusal is about runtime
655
+ * selection (#2091). The values lived only in `message` prose, which the
656
+ * `--json` contract discards entirely — while the backend's setup prompt
657
+ * instructs an agent to retry only with "one of the values that refusal
658
+ * lists". Carrying them structurally is what makes that retry reachable
659
+ * from automation.
660
+ */
661
+ allowedRuntimes?: readonly string[];
662
+ }
591
663
  declare class ConnectError extends Error {
592
664
  readonly code: string;
593
665
  readonly nextAction: string;
594
- constructor(code: string, message: string, nextAction: string);
666
+ readonly details: ConnectErrorDetails;
667
+ constructor(code: string, message: string, nextAction: string, details?: ConnectErrorDetails);
595
668
  }
596
669
  declare function isConnectError(err: unknown): err is ConnectError;
597
670
 
@@ -651,11 +724,11 @@ declare function resolveRuntimeByInstalledClientPrompt(options?: ScanInstalledCl
651
724
 
652
725
  declare const MCP_RUNTIME_MANIFEST: {
653
726
  readonly mcpPackage: "@haven_ai/mcp";
654
- readonly mcpVersion: "0.1.29-alpha.0";
727
+ readonly mcpVersion: "0.1.31-alpha.0";
655
728
  readonly sdkPackage: "@haven_ai/sdk";
656
- readonly sdkVersion: "0.1.29-alpha.0";
729
+ readonly sdkVersion: "0.1.31-alpha.0";
657
730
  readonly signerPackage: "@haven_ai/signer";
658
- readonly signerVersion: "0.1.29-alpha.0";
731
+ readonly signerVersion: "0.1.31-alpha.0";
659
732
  readonly minimumNodeVersion: "22.0.0";
660
733
  readonly supportedClients: readonly ["codex-cli", "codex-desktop", "claude-code"];
661
734
  readonly requiredTools: readonly string[];
package/dist/index.d.ts CHANGED
@@ -12,6 +12,11 @@ interface ConnectApiClient {
12
12
  * never any secret material.
13
13
  */
14
14
  getConnectorStatus(setupId: string, apiKey: string): Promise<ConnectorStatusResponse>;
15
+ /**
16
+ * #1700: the agent behind an API key. Used by the re-key flow on both sides
17
+ * of the dashboard hand-off — see {@link AgentIdentity}.
18
+ */
19
+ getAgentIdentity(apiKey: string): Promise<AgentIdentity>;
15
20
  }
16
21
  interface ConnectorStatusResponse {
17
22
  status: string;
@@ -33,6 +38,18 @@ interface RegisterSetupInput extends ResolveSetupInput {
33
38
  proofSignature: string;
34
39
  apiKeyHash: string;
35
40
  apiKeyPrefix: string;
41
+ /**
42
+ * #1878: the RESOLVED hosted MCP server name this agent is being wired as —
43
+ * `haven` for the bare pair, `haven-<slug>` for a named one. Sent so the
44
+ * dashboard can tell two agents in one harness apart; it is a display aid
45
+ * and Haven keys nothing off it.
46
+ *
47
+ * Always sent by a connector that supports it, bare pair included. Omitting
48
+ * it for the bare pair would make "absent" ambiguous between *this is the
49
+ * unnamed pair* and *an older connector said nothing*, and only the second
50
+ * of those may render as unknown.
51
+ */
52
+ mcpServerName?: string;
36
53
  connectorContext?: ConnectorContext;
37
54
  installCapabilities?: {
38
55
  canWriteRuntimeConfig?: boolean;
@@ -105,6 +122,25 @@ interface RegisterSetupResponse {
105
122
  hosted_mcp_url: string;
106
123
  next_action: string;
107
124
  }
125
+ /**
126
+ * The agent identity behind an API key (#1700).
127
+ *
128
+ * Read from `GET /machine-payments/agent`, the same agent-authenticated
129
+ * endpoint the SDK's `getAgent()` uses. Re-key needs it twice and for two
130
+ * different questions: BEFORE, to refuse a legacy-rail account the way the
131
+ * backend would rather than let the owner discover it five signed steps later;
132
+ * and AFTER, to prove the API key the owner pasted really belongs to this
133
+ * agent and really names the key this machine just generated.
134
+ */
135
+ interface AgentIdentity {
136
+ id: string;
137
+ name: string;
138
+ status: string;
139
+ safe_address: string | null;
140
+ delegate_address: string | null;
141
+ chain_id: number | null;
142
+ execution_rail: 'legacy' | 'delegation' | string;
143
+ }
108
144
  declare function createConnectApiClient(baseUrl: string, fetchImpl?: typeof fetch): ConnectApiClient;
109
145
 
110
146
  interface LocalDelegateKey {
@@ -167,8 +203,8 @@ interface RuntimeProfile {
167
203
  }
168
204
  declare function runtimeProfile(runtime: string | undefined, env?: NodeJS.ProcessEnv): RuntimeProfile;
169
205
  declare function normalizeRuntime(runtime: string | undefined, env?: NodeJS.ProcessEnv): RuntimeId;
170
- /** The flag values a refusal message should offer. Mirrors RuntimeId. */
171
- declare const RUNTIME_FLAG_VALUES: "claude-code, codex-cli, codex-desktop, cursor, vscode, vscode-insiders, claude-desktop, hermes, other";
206
+ /** The same values as refusal-message prose. */
207
+ declare const RUNTIME_FLAG_VALUES: string;
172
208
  interface RuntimeSelection {
173
209
  runtime: RuntimeId | null;
174
210
  source: 'force' | 'detected' | 'explicit' | 'prompted' | 'none';
@@ -411,7 +447,7 @@ declare function runtimeInstallCapabilities(runtime: string | undefined, env?: N
411
447
  restartRequired: boolean;
412
448
  };
413
449
 
414
- declare const CONNECTOR_VERSION = "0.1.29-alpha.0";
450
+ declare const CONNECTOR_VERSION = "0.1.31-alpha.0";
415
451
  interface ConnectOptions {
416
452
  setupToken: string;
417
453
  apiBaseUrl: string;
@@ -479,9 +515,19 @@ interface ConnectOutcome {
479
515
  };
480
516
  delegate_address?: string;
481
517
  setup_challenge_expires_at?: string;
518
+ /**
519
+ * #2091, additive within schema_version 1: `message` is the redacted human
520
+ * refusal (automation used to get code + next_action and nothing to act
521
+ * on), and `allowed_runtimes` carries the valid `--runtime` retry values on
522
+ * runtime-selection refusals — the list the backend's setup prompt requires
523
+ * a retry to be drawn from, which `--json` previously discarded with the
524
+ * prose.
525
+ */
482
526
  error?: {
483
527
  code: string;
484
528
  next_action: string;
529
+ message?: string;
530
+ allowed_runtimes?: readonly string[];
485
531
  };
486
532
  }
487
533
  interface ConnectDeps {
@@ -519,13 +565,18 @@ declare function completionOutcome(input: {
519
565
  approvalRequired: boolean;
520
566
  }): ConnectOutcome;
521
567
  /**
522
- * A deliberately terse failure record: error messages can contain server or
523
- * filesystem detail, while this public contract must remain safe to serialize.
568
+ * The failure record for the `--json` contract.
524
569
  *
525
570
  * #1719: a `ConnectError` carries its own code and next action, so it is read
526
571
  * rather than guessed. The regex ladder below survives only for the refusals
527
572
  * that are still plain `Error`s — every new failure mode joins the vocabulary
528
573
  * instead of joining that ladder.
574
+ *
575
+ * #2091: the record now carries the redacted message rather than omitting it.
576
+ * The old stance — terse because "messages can contain server or filesystem
577
+ * detail" — left automation with a code and nothing to act on; the field
578
+ * failure was a Codex agent staring at `connect_failed` with, in its own
579
+ * words, "no additional safe error detail". Sanitize, don't silence.
529
580
  */
530
581
  declare function failedConnectOutcome(runtimeHint: string | undefined, error: unknown): ConnectOutcome;
531
582
  /**
@@ -564,6 +615,16 @@ interface ParsedCli {
564
615
  reason?: string;
565
616
  replacedBy?: string;
566
617
  };
618
+ /**
619
+ * #1700: replace an agent's signing key on this machine. Two phases, because
620
+ * the dashboard sits between them — `start` generates the key and prints its
621
+ * address, `finish` writes the key the owner brings back. No setup token: the
622
+ * re-key API is owner-authenticated and this connector never calls it.
623
+ */
624
+ rekey?: {
625
+ phase: 'start' | 'finish';
626
+ newApiKey?: string;
627
+ };
567
628
  }
568
629
  declare function parseArgs(argv: string[], env?: NodeJS.ProcessEnv): ParsedCli;
569
630
  declare function helpText(): string;
@@ -588,10 +649,22 @@ declare function shortAddress(address: string): string;
588
649
  * Codes are additive and never renamed: a consumer pinned to an older
589
650
  * connector must keep recognising the ones it already knows.
590
651
  */
652
+ interface ConnectErrorDetails {
653
+ /**
654
+ * The `--runtime` values a retry may use, when the refusal is about runtime
655
+ * selection (#2091). The values lived only in `message` prose, which the
656
+ * `--json` contract discards entirely — while the backend's setup prompt
657
+ * instructs an agent to retry only with "one of the values that refusal
658
+ * lists". Carrying them structurally is what makes that retry reachable
659
+ * from automation.
660
+ */
661
+ allowedRuntimes?: readonly string[];
662
+ }
591
663
  declare class ConnectError extends Error {
592
664
  readonly code: string;
593
665
  readonly nextAction: string;
594
- constructor(code: string, message: string, nextAction: string);
666
+ readonly details: ConnectErrorDetails;
667
+ constructor(code: string, message: string, nextAction: string, details?: ConnectErrorDetails);
595
668
  }
596
669
  declare function isConnectError(err: unknown): err is ConnectError;
597
670
 
@@ -651,11 +724,11 @@ declare function resolveRuntimeByInstalledClientPrompt(options?: ScanInstalledCl
651
724
 
652
725
  declare const MCP_RUNTIME_MANIFEST: {
653
726
  readonly mcpPackage: "@haven_ai/mcp";
654
- readonly mcpVersion: "0.1.29-alpha.0";
727
+ readonly mcpVersion: "0.1.31-alpha.0";
655
728
  readonly sdkPackage: "@haven_ai/sdk";
656
- readonly sdkVersion: "0.1.29-alpha.0";
729
+ readonly sdkVersion: "0.1.31-alpha.0";
657
730
  readonly signerPackage: "@haven_ai/signer";
658
- readonly signerVersion: "0.1.29-alpha.0";
731
+ readonly signerVersion: "0.1.31-alpha.0";
659
732
  readonly minimumNodeVersion: "22.0.0";
660
733
  readonly supportedClients: readonly ["codex-cli", "codex-desktop", "claude-code"];
661
734
  readonly requiredTools: readonly string[];