@nangohq/types 0.71.12 → 0.71.14

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.
@@ -0,0 +1,10 @@
1
+ /** First observed website source. No user identity or full URLs. */
2
+ export interface SignupAcquisition {
3
+ acquisition_utm_source?: string | undefined;
4
+ acquisition_utm_medium?: string | undefined;
5
+ acquisition_utm_campaign?: string | undefined;
6
+ acquisition_utm_content?: string | undefined;
7
+ acquisition_utm_term?: string | undefined;
8
+ acquisition_referring_domain?: string | undefined;
9
+ acquisition_landing_path?: string | undefined;
10
+ }
@@ -3,6 +3,7 @@ import type { ApiEndpoint, ApiError } from '../api.js';
3
3
  import type { AuditPolicy } from '../audit-trail/event.js';
4
4
  import type { MFACredential } from '../mfa/credential.js';
5
5
  import type { ApiUser } from '../user/api.js';
6
+ import type { SignupAcquisition } from './acquisition.js';
6
7
  export interface AccountApiKey {
7
8
  id: number;
8
9
  uuid: string;
@@ -57,8 +58,9 @@ export type PostSignup = ApiEndpoint<{
57
58
  password: string;
58
59
  token?: string | undefined;
59
60
  foundUs?: string | undefined;
61
+ acquisition?: SignupAcquisition | undefined;
60
62
  };
61
- Error: ApiError<'email_already_verified'> | ApiError<'error_creating_user'> | ApiError<'user_already_exists'> | ApiError<'error_creating_account'> | ApiError<'not_found'> | ApiError<'email_not_verified'>;
63
+ Error: ApiError<'email_already_verified'> | ApiError<'error_creating_user'> | ApiError<'user_already_exists'> | ApiError<'error_creating_account'> | ApiError<'not_found'> | ApiError<'email_not_verified'> | ApiError<'disposable_email'>;
62
64
  Success: {
63
65
  data: {
64
66
  uuid: string;
@@ -206,6 +208,7 @@ export type PostManagedSignup = ApiEndpoint<{
206
208
  Path: '/api/v1/account/managed/signup';
207
209
  Body: {
208
210
  provider: 'GoogleOAuth';
211
+ acquisition?: SignupAcquisition | undefined;
209
212
  token?: string | undefined;
210
213
  returnTo?: string | undefined;
211
214
  };
@@ -0,0 +1,8 @@
1
+ /** Optional ad matching context on the existing new-account event. Never a group property. */
2
+ export interface SignupAdvertising {
3
+ advertising_consent_method: 'explicit' | 'implied';
4
+ advertising_consent_timestamp: string;
5
+ advertising_oppref_click_timestamp?: string;
6
+ advertising_fbc?: string;
7
+ advertising_oppref?: string;
8
+ }
@@ -28,7 +28,7 @@ export type PostPublicTriggerAction = ApiEndpoint<{
28
28
  Path: '/action/trigger';
29
29
  Body: {
30
30
  action_name: string;
31
- input: unknown;
31
+ input?: unknown;
32
32
  };
33
33
  Headers: {
34
34
  'provider-config-key': string;
@@ -38,15 +38,15 @@ export type PostPublicTriggerAction = ApiEndpoint<{
38
38
  };
39
39
  Success: any;
40
40
  }>;
41
- export type PostInternalTriggerFunction = ApiEndpoint<{
41
+ export type PostInternalInvokeFunction = ApiEndpoint<{
42
42
  Audit: {
43
43
  kind: 'no-audit';
44
- reason: 'non-auditable';
44
+ reason: 'data-plane operation';
45
45
  };
46
46
  Method: 'POST';
47
- Path: '/api/v1/trigger/function';
47
+ Path: '/api/v1/functions/invoke';
48
48
  Body: {
49
- type: 'action' | 'sync';
49
+ type: 'action' | 'sync' | 'tool';
50
50
  function_name: string;
51
51
  provider_config_key: string;
52
52
  connection_id: string;
@@ -3,7 +3,7 @@ import type { AuditPolicy } from '../audit-trail/event.js';
3
3
  import type { Tags } from '../db.js';
4
4
  import type { AgentSessionUnknownPinnedConnectionsPayload } from './connections.js';
5
5
  import type { AgentSessionCreateConnectionConfig, AgentSessionEndedReason } from './session.js';
6
- import type { AgentSessionToolsNotInToolsetPayload, AgentSessionUnknownIntegrationsPayload, AgentSessionUnknownToolsPayload, AgentSessionUnsupportedFunctionTypesPayload } from './toolset.js';
6
+ import type { AgentSessionMcpServerStatus, AgentSessionToolsNotInToolsetPayload, AgentSessionUnknownIntegrationsPayload, AgentSessionUnknownToolsPayload, AgentSessionUnsupportedFunctionTypesPayload } from './toolset.js';
7
7
  export interface AgentSessionToolListInput {
8
8
  tools: string[];
9
9
  }
@@ -51,6 +51,7 @@ export interface AgentSessionToolsetSummary {
51
51
  connected: boolean;
52
52
  tools_pinned: number;
53
53
  tools_searchable: number;
54
+ mcp_server?: AgentSessionMcpServerStatus;
54
55
  }
55
56
  export interface AgentSessionMetaToolsSummary {
56
57
  nango_tool_search: boolean;
@@ -89,6 +90,14 @@ export type AgentSessionCreationErrorCode = 'ambiguous_connections' | 'unknown_p
89
90
  */
90
91
  export type AgentSessionCreationErrorPayload = AgentSessionAmbiguousConnectionsReply | AgentSessionUnknownPinnedConnectionsPayload | AgentSessionPinnedConnectionNotMatchedReply | AgentSessionUnknownIntegrationsPayload | AgentSessionUnknownToolsPayload | AgentSessionUnsupportedFunctionTypesPayload | AgentSessionToolsNotInToolsetPayload | AgentSessionUnknownMetaToolsPayload;
91
92
  export type PostAgentSessionsCreationError = ApiError<AgentSessionCreationErrorCode, undefined, AgentSessionCreationErrorPayload>;
93
+ export interface ApiCreatedAgentSession {
94
+ session_id: string;
95
+ session_token: string;
96
+ mcp_url: string;
97
+ expires_at: string;
98
+ toolset: Record<string, AgentSessionToolsetSummary>;
99
+ meta_tools: AgentSessionMetaToolsSummary;
100
+ }
92
101
  export type PostAgentSessions = ApiEndpoint<{
93
102
  Audit: AuditPolicy<'agent_session', 'created', 'environment'>;
94
103
  Method: 'POST';
@@ -96,14 +105,7 @@ export type PostAgentSessions = ApiEndpoint<{
96
105
  Body: PostAgentSessionsBody;
97
106
  Error: PostAgentSessionsCreationError;
98
107
  Success: {
99
- data: {
100
- session_id: string;
101
- session_token: string;
102
- mcp_url: string;
103
- expires_at: string;
104
- toolset: Record<string, AgentSessionToolsetSummary>;
105
- meta_tools: AgentSessionMetaToolsSummary;
106
- };
108
+ data: ApiCreatedAgentSession;
107
109
  };
108
110
  }>;
109
111
  export interface ApiTerminatedAgentSession {
@@ -1,14 +1,42 @@
1
1
  import type { ApiEndpoint, ApiError } from '../api.js';
2
+ import type { PostAgentSessionsBody } from './api.js';
2
3
  export interface AgentPlaygroundUsage {
3
4
  inputTokens: number;
4
5
  outputTokens: number;
5
6
  }
7
+ export interface AgentPlaygroundIntegrationSetup {
8
+ provider: string;
9
+ integrationId?: string;
10
+ outcome: 'created' | 'existing' | 'missing_credentials' | 'not_created';
11
+ }
12
+ export type AgentPlaygroundSessionChange = 'integrations_changed' | 'connections_changed';
13
+ export interface AgentPlaygroundSessionCreated {
14
+ request: PostAgentSessionsBody;
15
+ reason?: AgentPlaygroundSessionChange | 'expired';
16
+ }
6
17
  export interface AgentPlaygroundMessageMetadata {
7
18
  sessionId?: string;
8
19
  hidden?: boolean;
20
+ connectedIntegrations?: string[];
21
+ starterProvider?: string;
22
+ integrationSetup?: AgentPlaygroundIntegrationSetup;
23
+ sessionCreated?: AgentPlaygroundSessionCreated;
9
24
  usage?: AgentPlaygroundUsage;
25
+ replyOutcome?: AgentPlaygroundReplyOutcome;
26
+ }
27
+ export type AgentPlaygroundReplyOutcome = {
28
+ kind: 'stopped';
29
+ } | {
30
+ kind: 'failed';
31
+ error: string;
32
+ };
33
+ export type AgentPlaygroundErrorCode = 'feature_disabled' | 'session_creation_failed' | 'model_error' | 'model_unavailable' | 'too_many_request';
34
+ export interface AgentPlaygroundModelUnavailableError {
35
+ error: {
36
+ code: 'model_unavailable';
37
+ retryable: boolean;
38
+ };
10
39
  }
11
- export type AgentPlaygroundErrorCode = 'feature_disabled' | 'session_creation_failed' | 'model_error';
12
40
  export type PostAgentPlaygroundChat = ApiEndpoint<{
13
41
  Audit: {
14
42
  kind: 'no-audit';
@@ -21,6 +49,7 @@ export type PostAgentPlaygroundChat = ApiEndpoint<{
21
49
  };
22
50
  Body: {
23
51
  sessionId?: string | undefined;
52
+ chatId?: string | undefined;
24
53
  messages: unknown[];
25
54
  timeZone?: string | undefined;
26
55
  };
@@ -15,6 +15,16 @@ export interface AgentSessionMetaTools {
15
15
  readonly nangoProxy: boolean;
16
16
  readonly nangoCreateConnection: AgentSessionCreateConnectionConfig;
17
17
  }
18
+ /** Nango's own tools, as opposed to the integration tools an account deploys. */
19
+ export type AgentSessionMetaTool = 'nango_execute' | 'nango_proxy' | 'nango_tool_search' | 'nango_create_connection';
20
+ /** One ranked tool, as the search returned it. Confidence runs from 0, nothing matched, to 1. */
21
+ export interface AgentSessionToolSearchHit {
22
+ tool_name: string;
23
+ /** The name the agent was given for it, which collisions make impossible to derive afterwards. */
24
+ tool_slug: string;
25
+ integration_id: string;
26
+ confidence: number;
27
+ }
18
28
  export type AgentSessionEndedReason = 'terminated' | 'expired';
19
29
  export interface AgentSession {
20
30
  readonly id: string;
@@ -8,14 +8,23 @@ export interface AgentSessionIntegrationPolicy {
8
8
  }
9
9
  export type AgentSessionToolsetPolicy = '*' | Readonly<Record<string, AgentSessionIntegrationPolicy>>;
10
10
  export type AgentSessionPinnedTools = Readonly<Record<string, readonly string[]>>;
11
+ /** A tool the integration's MCP server listed when the session was created, as opposed to a deployed action. */
12
+ export interface AgentSessionMcpToolDefinition {
13
+ readonly inputSchema: Record<string, unknown>;
14
+ readonly annotations?: Record<string, unknown>;
15
+ }
11
16
  export interface AgentSessionCompiledTool {
12
17
  readonly name: string;
13
18
  readonly description: string;
19
+ readonly mcp?: AgentSessionMcpToolDefinition;
14
20
  }
21
+ /** `unavailable` means the MCP server could not be listed, so the session carries none of its tools. */
22
+ export type AgentSessionMcpServerStatus = 'available' | 'unavailable';
15
23
  export interface AgentSessionCompiledIntegration {
16
24
  readonly provider: string;
17
25
  readonly pinned: AgentSessionCompiledTool[];
18
26
  readonly searchable: AgentSessionCompiledTool[];
27
+ readonly mcpServer?: AgentSessionMcpServerStatus;
19
28
  }
20
29
  export type AgentSessionCompiledToolset = Record<string, AgentSessionCompiledIntegration>;
21
30
  export interface AgentSessionToolNames {