@haven_ai/connect 0.1.22-alpha.0 → 0.1.23-alpha.1

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,7 +1,26 @@
1
+ export { CliIo, runCli } from './cli.cjs';
2
+
1
3
  interface ConnectApiClient {
2
4
  resolveSetup(input: ResolveSetupInput): Promise<ResolvedSetup>;
3
5
  registerSetup(input: RegisterSetupInput): Promise<RegisterSetupResponse>;
4
6
  updateInstallStatus(setupId: string, apiKey: string, input: UpdateInstallStatusInput): Promise<void>;
7
+ /**
8
+ * #1377 D: the narrow status read the connector polls after registering,
9
+ * authenticated with the agent API key it just minted (works while the
10
+ * agent is still `setup_pending` — the endpoint exists for exactly that
11
+ * window). Returns status plus the approved budget once approval lands;
12
+ * never any secret material.
13
+ */
14
+ getConnectorStatus(setupId: string, apiKey: string): Promise<ConnectorStatusResponse>;
15
+ }
16
+ interface ConnectorStatusResponse {
17
+ status: string;
18
+ approved_budget: {
19
+ token_symbol: string;
20
+ token_address: string;
21
+ amount: string;
22
+ reset_period_min: number;
23
+ } | null;
5
24
  }
6
25
  interface ResolveSetupInput {
7
26
  setupToken: string;
@@ -133,6 +152,8 @@ interface RuntimeProfile {
133
152
  label: string;
134
153
  restartMode: RestartMode;
135
154
  canWriteRuntimeConfig: boolean;
155
+ /** Precise, runtime-owned instruction for loading a freshly written MCP entry. */
156
+ activationInstruction: string;
136
157
  }
137
158
  declare function runtimeProfile(runtime: string | undefined, env?: NodeJS.ProcessEnv): RuntimeProfile;
138
159
  declare function normalizeRuntime(runtime: string | undefined, env?: NodeJS.ProcessEnv): RuntimeId;
@@ -264,7 +285,7 @@ declare function runtimeInstallCapabilities(runtime: string | undefined, env?: N
264
285
  restartRequired: boolean;
265
286
  };
266
287
 
267
- declare const CONNECTOR_VERSION = "0.1.22-alpha.0";
288
+ declare const CONNECTOR_VERSION = "0.1.23-alpha.1";
268
289
  interface ConnectOptions {
269
290
  setupToken: string;
270
291
  apiBaseUrl: string;
@@ -275,6 +296,50 @@ interface ConnectOptions {
275
296
  ackSigner?: boolean;
276
297
  ackLocalTools?: boolean;
277
298
  localMcp?: boolean;
299
+ /**
300
+ * #1377 D: keep the process alive after registering and poll for the
301
+ * user's budget approval (default). Set false for structured/automation
302
+ * runs (--json) where prompt output emission matters more than narration.
303
+ */
304
+ waitForApproval?: boolean;
305
+ /** Test/injection overrides for the approval poll cadence and clock. */
306
+ approvalWait?: ApprovalWaitOptions;
307
+ }
308
+ /** The stable machine-readable result emitted by `haven-connect --json`. */
309
+ declare const CONNECT_OUTCOME_SCHEMA_VERSION: 1;
310
+ type ConnectOutcomeStatus = 'complete' | 'action_required' | 'failed';
311
+ interface ConnectOutcome {
312
+ schema_version: typeof CONNECT_OUTCOME_SCHEMA_VERSION;
313
+ outcome: ConnectOutcomeStatus;
314
+ runtime: string;
315
+ topology: string;
316
+ configuration: {
317
+ hosted_mcp: boolean;
318
+ local_signer: boolean;
319
+ local_mcp: boolean;
320
+ };
321
+ probe: {
322
+ result: string;
323
+ };
324
+ activation: {
325
+ restart_required: boolean;
326
+ instruction: string;
327
+ };
328
+ next_action: string;
329
+ approval: {
330
+ required: boolean;
331
+ expires_at: string | null;
332
+ };
333
+ verification: {
334
+ tools: readonly ['haven_get_agent', 'haven_get_allowances'];
335
+ instruction: string;
336
+ };
337
+ delegate_address?: string;
338
+ setup_challenge_expires_at?: string;
339
+ error?: {
340
+ code: string;
341
+ next_action: string;
342
+ };
278
343
  }
279
344
  interface ConnectDeps {
280
345
  api?: ConnectApiClient;
@@ -284,6 +349,8 @@ interface ConnectDeps {
284
349
  writeCredentials?: typeof writeCredentialFiles;
285
350
  installRuntime?: typeof installRuntime;
286
351
  log?: (message: string) => void;
352
+ /** JSON CLI mode must not expose owner-only credential file locations. */
353
+ redactPaths?: boolean;
287
354
  /** Overridable so the Node-floor refusal is testable without spawning a Node. */
288
355
  nodeVersion?: string;
289
356
  }
@@ -292,12 +359,40 @@ interface ConnectResult {
292
359
  agentId: string;
293
360
  delegateAddress: string;
294
361
  credentialPaths: StoredCredentialPaths;
362
+ /** Additive, secret-free completion contract shared by library callers and --json. */
363
+ outcome: ConnectOutcome;
295
364
  }
296
365
  declare function runConnect(options: ConnectOptions, deps?: ConnectDeps): Promise<ConnectResult>;
366
+ declare function completionOutcome(input: {
367
+ runtimeInstall: RuntimeInstallResult;
368
+ delegateAddress: string;
369
+ setupChallengeExpiresAt?: string;
370
+ approvalRequired: boolean;
371
+ }): ConnectOutcome;
372
+ /**
373
+ * A deliberately terse failure record: error messages can contain server or
374
+ * filesystem detail, while this public contract must remain safe to serialize.
375
+ */
376
+ declare function failedConnectOutcome(runtimeHint: string | undefined, error: unknown): ConnectOutcome;
377
+ /**
378
+ * #1377 D: after registering, the connector no longer goes dead while the
379
+ * user approves in Haven — it polls the narrow connector-status endpoint
380
+ * (agent-API-key auth, works during `setup_pending`) and narrates progress in
381
+ * the flow's voice, ending in a concrete celebration naming the granted
382
+ * authority. Bounds (stated per the issue): poll every 5 s, give up after
383
+ * 3 minutes — the connector ALWAYS terminates on its own; a timeout is a
384
+ * clean exit with guidance, never a hang. Injectable clock/cadence for tests.
385
+ */
386
+ interface ApprovalWaitOptions {
387
+ intervalMs?: number;
388
+ timeoutMs?: number;
389
+ sleep?: (ms: number) => Promise<void>;
390
+ }
297
391
 
298
392
  interface ParsedCli {
299
393
  options: ConnectOptions;
300
394
  help: boolean;
395
+ json: boolean;
301
396
  }
302
397
  declare function parseArgs(argv: string[], env?: NodeJS.ProcessEnv): ParsedCli;
303
398
  declare function helpText(): string;
@@ -307,12 +402,12 @@ declare function shortAddress(address: string): string;
307
402
 
308
403
  declare const MCP_RUNTIME_MANIFEST: {
309
404
  readonly mcpPackage: "@haven_ai/mcp";
310
- readonly mcpVersion: "0.1.22-alpha.0";
405
+ readonly mcpVersion: "0.1.23-alpha.1";
311
406
  readonly sdkPackage: "@haven_ai/sdk";
312
- readonly sdkVersion: "0.1.22-alpha.0";
407
+ readonly sdkVersion: "0.1.23-alpha.1";
313
408
  readonly signerPackage: "@haven_ai/signer";
314
- readonly signerVersion: "0.1.22-alpha.0";
315
- readonly minimumNodeVersion: "24.0.0";
409
+ readonly signerVersion: "0.1.23-alpha.1";
410
+ readonly minimumNodeVersion: "22.0.0";
316
411
  readonly supportedClients: readonly ["codex-cli", "codex-desktop", "claude-code"];
317
412
  readonly requiredTools: readonly string[];
318
413
  };
@@ -320,4 +415,4 @@ declare function mcpPackageSpec(): string;
320
415
  declare function sdkPackageSpec(): string;
321
416
  declare function signerPackageSpec(): string;
322
417
 
323
- export { CONNECTOR_VERSION, type ConnectApiClient, type ConnectDeps, type ConnectOptions, type ConnectResult, type LocalDelegateKey, MCP_RUNTIME_MANIFEST, type PrepareSignerRuntimeInput, type PreparedSignerRuntime, type RegisterSetupInput, type RegisterSetupResponse, type ResolveSetupInput, type ResolvedSetup, type RuntimeId, type RuntimeInstallInput, type RuntimeInstallResult, type RuntimeProfile, type StoredCredentialPaths, type UpdateInstallStatusInput, type WriteCredentialInput, createConnectApiClient, defaultAgentDirectory, delegateKeyFromPrivateKey, generateDelegateKey, helpText, installRuntime, mcpPackageSpec, normalizeRuntime, parseArgs, prepareSignerRuntime, redactSecrets, runConnect, runtimeInstallCapabilities, runtimeProfile, sdkPackageSpec, shortAddress, signerPackageSpec, writeCredentialFiles };
418
+ export { CONNECTOR_VERSION, CONNECT_OUTCOME_SCHEMA_VERSION, type ConnectApiClient, type ConnectDeps, type ConnectOptions, type ConnectOutcome, type ConnectOutcomeStatus, type ConnectResult, type LocalDelegateKey, MCP_RUNTIME_MANIFEST, type ParsedCli, type PrepareSignerRuntimeInput, type PreparedSignerRuntime, type RegisterSetupInput, type RegisterSetupResponse, type ResolveSetupInput, type ResolvedSetup, type RuntimeId, type RuntimeInstallInput, type RuntimeInstallResult, type RuntimeProfile, type StoredCredentialPaths, type UpdateInstallStatusInput, type WriteCredentialInput, completionOutcome, createConnectApiClient, defaultAgentDirectory, delegateKeyFromPrivateKey, failedConnectOutcome, generateDelegateKey, helpText, installRuntime, mcpPackageSpec, normalizeRuntime, parseArgs, prepareSignerRuntime, redactSecrets, runConnect, runtimeInstallCapabilities, runtimeProfile, sdkPackageSpec, shortAddress, signerPackageSpec, writeCredentialFiles };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,26 @@
1
+ export { CliIo, runCli } from './cli.js';
2
+
1
3
  interface ConnectApiClient {
2
4
  resolveSetup(input: ResolveSetupInput): Promise<ResolvedSetup>;
3
5
  registerSetup(input: RegisterSetupInput): Promise<RegisterSetupResponse>;
4
6
  updateInstallStatus(setupId: string, apiKey: string, input: UpdateInstallStatusInput): Promise<void>;
7
+ /**
8
+ * #1377 D: the narrow status read the connector polls after registering,
9
+ * authenticated with the agent API key it just minted (works while the
10
+ * agent is still `setup_pending` — the endpoint exists for exactly that
11
+ * window). Returns status plus the approved budget once approval lands;
12
+ * never any secret material.
13
+ */
14
+ getConnectorStatus(setupId: string, apiKey: string): Promise<ConnectorStatusResponse>;
15
+ }
16
+ interface ConnectorStatusResponse {
17
+ status: string;
18
+ approved_budget: {
19
+ token_symbol: string;
20
+ token_address: string;
21
+ amount: string;
22
+ reset_period_min: number;
23
+ } | null;
5
24
  }
6
25
  interface ResolveSetupInput {
7
26
  setupToken: string;
@@ -133,6 +152,8 @@ interface RuntimeProfile {
133
152
  label: string;
134
153
  restartMode: RestartMode;
135
154
  canWriteRuntimeConfig: boolean;
155
+ /** Precise, runtime-owned instruction for loading a freshly written MCP entry. */
156
+ activationInstruction: string;
136
157
  }
137
158
  declare function runtimeProfile(runtime: string | undefined, env?: NodeJS.ProcessEnv): RuntimeProfile;
138
159
  declare function normalizeRuntime(runtime: string | undefined, env?: NodeJS.ProcessEnv): RuntimeId;
@@ -264,7 +285,7 @@ declare function runtimeInstallCapabilities(runtime: string | undefined, env?: N
264
285
  restartRequired: boolean;
265
286
  };
266
287
 
267
- declare const CONNECTOR_VERSION = "0.1.22-alpha.0";
288
+ declare const CONNECTOR_VERSION = "0.1.23-alpha.1";
268
289
  interface ConnectOptions {
269
290
  setupToken: string;
270
291
  apiBaseUrl: string;
@@ -275,6 +296,50 @@ interface ConnectOptions {
275
296
  ackSigner?: boolean;
276
297
  ackLocalTools?: boolean;
277
298
  localMcp?: boolean;
299
+ /**
300
+ * #1377 D: keep the process alive after registering and poll for the
301
+ * user's budget approval (default). Set false for structured/automation
302
+ * runs (--json) where prompt output emission matters more than narration.
303
+ */
304
+ waitForApproval?: boolean;
305
+ /** Test/injection overrides for the approval poll cadence and clock. */
306
+ approvalWait?: ApprovalWaitOptions;
307
+ }
308
+ /** The stable machine-readable result emitted by `haven-connect --json`. */
309
+ declare const CONNECT_OUTCOME_SCHEMA_VERSION: 1;
310
+ type ConnectOutcomeStatus = 'complete' | 'action_required' | 'failed';
311
+ interface ConnectOutcome {
312
+ schema_version: typeof CONNECT_OUTCOME_SCHEMA_VERSION;
313
+ outcome: ConnectOutcomeStatus;
314
+ runtime: string;
315
+ topology: string;
316
+ configuration: {
317
+ hosted_mcp: boolean;
318
+ local_signer: boolean;
319
+ local_mcp: boolean;
320
+ };
321
+ probe: {
322
+ result: string;
323
+ };
324
+ activation: {
325
+ restart_required: boolean;
326
+ instruction: string;
327
+ };
328
+ next_action: string;
329
+ approval: {
330
+ required: boolean;
331
+ expires_at: string | null;
332
+ };
333
+ verification: {
334
+ tools: readonly ['haven_get_agent', 'haven_get_allowances'];
335
+ instruction: string;
336
+ };
337
+ delegate_address?: string;
338
+ setup_challenge_expires_at?: string;
339
+ error?: {
340
+ code: string;
341
+ next_action: string;
342
+ };
278
343
  }
279
344
  interface ConnectDeps {
280
345
  api?: ConnectApiClient;
@@ -284,6 +349,8 @@ interface ConnectDeps {
284
349
  writeCredentials?: typeof writeCredentialFiles;
285
350
  installRuntime?: typeof installRuntime;
286
351
  log?: (message: string) => void;
352
+ /** JSON CLI mode must not expose owner-only credential file locations. */
353
+ redactPaths?: boolean;
287
354
  /** Overridable so the Node-floor refusal is testable without spawning a Node. */
288
355
  nodeVersion?: string;
289
356
  }
@@ -292,12 +359,40 @@ interface ConnectResult {
292
359
  agentId: string;
293
360
  delegateAddress: string;
294
361
  credentialPaths: StoredCredentialPaths;
362
+ /** Additive, secret-free completion contract shared by library callers and --json. */
363
+ outcome: ConnectOutcome;
295
364
  }
296
365
  declare function runConnect(options: ConnectOptions, deps?: ConnectDeps): Promise<ConnectResult>;
366
+ declare function completionOutcome(input: {
367
+ runtimeInstall: RuntimeInstallResult;
368
+ delegateAddress: string;
369
+ setupChallengeExpiresAt?: string;
370
+ approvalRequired: boolean;
371
+ }): ConnectOutcome;
372
+ /**
373
+ * A deliberately terse failure record: error messages can contain server or
374
+ * filesystem detail, while this public contract must remain safe to serialize.
375
+ */
376
+ declare function failedConnectOutcome(runtimeHint: string | undefined, error: unknown): ConnectOutcome;
377
+ /**
378
+ * #1377 D: after registering, the connector no longer goes dead while the
379
+ * user approves in Haven — it polls the narrow connector-status endpoint
380
+ * (agent-API-key auth, works during `setup_pending`) and narrates progress in
381
+ * the flow's voice, ending in a concrete celebration naming the granted
382
+ * authority. Bounds (stated per the issue): poll every 5 s, give up after
383
+ * 3 minutes — the connector ALWAYS terminates on its own; a timeout is a
384
+ * clean exit with guidance, never a hang. Injectable clock/cadence for tests.
385
+ */
386
+ interface ApprovalWaitOptions {
387
+ intervalMs?: number;
388
+ timeoutMs?: number;
389
+ sleep?: (ms: number) => Promise<void>;
390
+ }
297
391
 
298
392
  interface ParsedCli {
299
393
  options: ConnectOptions;
300
394
  help: boolean;
395
+ json: boolean;
301
396
  }
302
397
  declare function parseArgs(argv: string[], env?: NodeJS.ProcessEnv): ParsedCli;
303
398
  declare function helpText(): string;
@@ -307,12 +402,12 @@ declare function shortAddress(address: string): string;
307
402
 
308
403
  declare const MCP_RUNTIME_MANIFEST: {
309
404
  readonly mcpPackage: "@haven_ai/mcp";
310
- readonly mcpVersion: "0.1.22-alpha.0";
405
+ readonly mcpVersion: "0.1.23-alpha.1";
311
406
  readonly sdkPackage: "@haven_ai/sdk";
312
- readonly sdkVersion: "0.1.22-alpha.0";
407
+ readonly sdkVersion: "0.1.23-alpha.1";
313
408
  readonly signerPackage: "@haven_ai/signer";
314
- readonly signerVersion: "0.1.22-alpha.0";
315
- readonly minimumNodeVersion: "24.0.0";
409
+ readonly signerVersion: "0.1.23-alpha.1";
410
+ readonly minimumNodeVersion: "22.0.0";
316
411
  readonly supportedClients: readonly ["codex-cli", "codex-desktop", "claude-code"];
317
412
  readonly requiredTools: readonly string[];
318
413
  };
@@ -320,4 +415,4 @@ declare function mcpPackageSpec(): string;
320
415
  declare function sdkPackageSpec(): string;
321
416
  declare function signerPackageSpec(): string;
322
417
 
323
- export { CONNECTOR_VERSION, type ConnectApiClient, type ConnectDeps, type ConnectOptions, type ConnectResult, type LocalDelegateKey, MCP_RUNTIME_MANIFEST, type PrepareSignerRuntimeInput, type PreparedSignerRuntime, type RegisterSetupInput, type RegisterSetupResponse, type ResolveSetupInput, type ResolvedSetup, type RuntimeId, type RuntimeInstallInput, type RuntimeInstallResult, type RuntimeProfile, type StoredCredentialPaths, type UpdateInstallStatusInput, type WriteCredentialInput, createConnectApiClient, defaultAgentDirectory, delegateKeyFromPrivateKey, generateDelegateKey, helpText, installRuntime, mcpPackageSpec, normalizeRuntime, parseArgs, prepareSignerRuntime, redactSecrets, runConnect, runtimeInstallCapabilities, runtimeProfile, sdkPackageSpec, shortAddress, signerPackageSpec, writeCredentialFiles };
418
+ export { CONNECTOR_VERSION, CONNECT_OUTCOME_SCHEMA_VERSION, type ConnectApiClient, type ConnectDeps, type ConnectOptions, type ConnectOutcome, type ConnectOutcomeStatus, type ConnectResult, type LocalDelegateKey, MCP_RUNTIME_MANIFEST, type ParsedCli, type PrepareSignerRuntimeInput, type PreparedSignerRuntime, type RegisterSetupInput, type RegisterSetupResponse, type ResolveSetupInput, type ResolvedSetup, type RuntimeId, type RuntimeInstallInput, type RuntimeInstallResult, type RuntimeProfile, type StoredCredentialPaths, type UpdateInstallStatusInput, type WriteCredentialInput, completionOutcome, createConnectApiClient, defaultAgentDirectory, delegateKeyFromPrivateKey, failedConnectOutcome, generateDelegateKey, helpText, installRuntime, mcpPackageSpec, normalizeRuntime, parseArgs, prepareSignerRuntime, redactSecrets, runConnect, runtimeInstallCapabilities, runtimeProfile, sdkPackageSpec, shortAddress, signerPackageSpec, writeCredentialFiles };