@agent-native/core 0.32.18 → 0.34.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.
@@ -0,0 +1,237 @@
1
+ import { type CredentialContext } from "../credentials/index.js";
2
+ import type { WorkspaceConnectionTemplateUse } from "../connections/catalog.js";
3
+ export declare const PROVIDER_API_IDS: readonly ["amplitude", "apollo", "bigquery", "commonroom", "dataforseo", "ga4", "gcloud", "github", "gmail", "gong", "google_calendar", "google_drive", "granola", "grafana", "hubspot", "jira", "mixpanel", "notion", "posthog", "prometheus", "pylon", "sentry", "slack", "stripe", "twitter"];
4
+ export type ProviderApiId = (typeof PROVIDER_API_IDS)[number];
5
+ export type ProviderApiMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD";
6
+ export interface ProviderApiRequestArgs {
7
+ provider: ProviderApiId | string;
8
+ method?: ProviderApiMethod;
9
+ path: string;
10
+ query?: unknown;
11
+ headers?: Record<string, unknown>;
12
+ body?: unknown;
13
+ auth?: "default" | "none";
14
+ timeoutMs?: number;
15
+ maxBytes?: number;
16
+ connectionId?: string | null;
17
+ accountId?: string | null;
18
+ }
19
+ export type ProviderApiAuthKind = {
20
+ type: "none";
21
+ } | {
22
+ type: "bearer";
23
+ keys: readonly string[];
24
+ workspaceProvider?: string;
25
+ } | {
26
+ type: "basic";
27
+ usernameKey: string;
28
+ passwordKey: string;
29
+ workspaceProvider?: string;
30
+ } | {
31
+ type: "basic-raw";
32
+ key: string;
33
+ workspaceProvider?: string;
34
+ } | {
35
+ type: "api-key-header";
36
+ key: string;
37
+ header: string;
38
+ workspaceProvider?: string;
39
+ } | {
40
+ type: "google-service-account";
41
+ scopes: readonly string[];
42
+ } | {
43
+ type: "oauth-bearer";
44
+ oauthProvider: string;
45
+ tokenLabel: string;
46
+ } | {
47
+ type: "prometheus";
48
+ };
49
+ export interface ProviderApiConfig {
50
+ id: ProviderApiId;
51
+ label: string;
52
+ defaultBaseUrl: string;
53
+ baseUrlCredentialKey?: string;
54
+ auth: ProviderApiAuthKind;
55
+ credentialKeys: readonly string[];
56
+ docsUrls: readonly string[];
57
+ specUrls?: readonly string[];
58
+ allowedHostSuffixes?: readonly string[];
59
+ defaultHeaders?: Record<string, string>;
60
+ placeholders?: readonly ProviderApiPlaceholder[];
61
+ examples?: readonly ProviderApiExample[];
62
+ notes?: readonly string[];
63
+ templateUses?: readonly WorkspaceConnectionTemplateUse[];
64
+ }
65
+ export interface ProviderApiPlaceholder {
66
+ name: string;
67
+ credentialKey: string;
68
+ label: string;
69
+ }
70
+ export interface ProviderApiExample {
71
+ label: string;
72
+ method: ProviderApiMethod;
73
+ path: string;
74
+ body?: unknown;
75
+ }
76
+ export interface ProviderApiResolvedCredential {
77
+ key: string;
78
+ value: string;
79
+ source: string;
80
+ provider: string;
81
+ connectionId?: string;
82
+ connectionLabel?: string;
83
+ accountId?: string;
84
+ accountLabel?: string | null;
85
+ scope?: string;
86
+ }
87
+ export interface ProviderApiCredentialLookupOptions {
88
+ appId: string;
89
+ provider: string;
90
+ key: string;
91
+ ctx: CredentialContext;
92
+ workspaceProvider?: string;
93
+ connectionId?: string | null;
94
+ localCredentialSource: string;
95
+ }
96
+ export type ProviderApiCredentialResolver = (options: ProviderApiCredentialLookupOptions) => Promise<ProviderApiResolvedCredential | null>;
97
+ export interface ProviderApiRuntimeOptions {
98
+ appId: string;
99
+ providerIds?: readonly (ProviderApiId | string)[];
100
+ localCredentialSource?: string;
101
+ getCredentialContext?: () => CredentialContext | null;
102
+ resolveCredential?: ProviderApiCredentialResolver;
103
+ }
104
+ interface ProviderApiRuntime {
105
+ providerIds: readonly ProviderApiId[];
106
+ listCatalog(provider?: ProviderApiId | string): ReturnType<typeof listProviderApiCatalog>;
107
+ fetchDocs(options: {
108
+ provider: ProviderApiId | string;
109
+ url?: string;
110
+ maxBytes?: number;
111
+ }): Promise<unknown>;
112
+ executeRequest(args: ProviderApiRequestArgs): Promise<unknown>;
113
+ }
114
+ export declare function getProviderApiConfig(provider: ProviderApiId | string): ProviderApiConfig;
115
+ export declare function isProviderApiId(provider: string): provider is ProviderApiId;
116
+ export declare function listProviderApiIdsForTemplateUse(templateUse: WorkspaceConnectionTemplateUse): ProviderApiId[];
117
+ export declare function listProviderApiCatalog(provider?: ProviderApiId | string, options?: {
118
+ providerIds?: readonly (ProviderApiId | string)[];
119
+ }): {
120
+ id: "amplitude" | "bigquery" | "sentry" | "posthog" | "mixpanel" | "github" | "slack" | "twitter" | "notion" | "gmail" | "google_drive" | "hubspot" | "granola" | "apollo" | "commonroom" | "dataforseo" | "ga4" | "gcloud" | "gong" | "google_calendar" | "grafana" | "jira" | "prometheus" | "pylon" | "stripe";
121
+ label: string;
122
+ defaultBaseUrl: string;
123
+ baseUrlCredentialKey: string;
124
+ auth: string;
125
+ credentialKeys: readonly string[];
126
+ docsUrls: readonly string[];
127
+ specUrls: readonly string[];
128
+ allowedHostSuffixes: readonly string[];
129
+ placeholders: readonly ProviderApiPlaceholder[];
130
+ defaultHeaders: Record<string, string>;
131
+ examples: readonly ProviderApiExample[];
132
+ notes: readonly string[];
133
+ templateUses: readonly WorkspaceConnectionTemplateUse[];
134
+ }[];
135
+ export declare function createProviderApiRuntime(options: ProviderApiRuntimeOptions): ProviderApiRuntime;
136
+ export declare function fetchProviderApiDocs(options: {
137
+ provider: ProviderApiId | string;
138
+ url?: string;
139
+ maxBytes?: number;
140
+ }, runtime?: ProviderApiRuntimeOptions): Promise<{
141
+ provider: "amplitude" | "bigquery" | "sentry" | "posthog" | "mixpanel" | "github" | "slack" | "twitter" | "notion" | "gmail" | "google_drive" | "hubspot" | "granola" | "apollo" | "commonroom" | "dataforseo" | "ga4" | "gcloud" | "gong" | "google_calendar" | "grafana" | "jira" | "prometheus" | "pylon" | "stripe";
142
+ catalog: {
143
+ id: "amplitude" | "bigquery" | "sentry" | "posthog" | "mixpanel" | "github" | "slack" | "twitter" | "notion" | "gmail" | "google_drive" | "hubspot" | "granola" | "apollo" | "commonroom" | "dataforseo" | "ga4" | "gcloud" | "gong" | "google_calendar" | "grafana" | "jira" | "prometheus" | "pylon" | "stripe";
144
+ label: string;
145
+ defaultBaseUrl: string;
146
+ baseUrlCredentialKey: string;
147
+ auth: string;
148
+ credentialKeys: readonly string[];
149
+ docsUrls: readonly string[];
150
+ specUrls: readonly string[];
151
+ allowedHostSuffixes: readonly string[];
152
+ placeholders: readonly ProviderApiPlaceholder[];
153
+ defaultHeaders: Record<string, string>;
154
+ examples: readonly ProviderApiExample[];
155
+ notes: readonly string[];
156
+ templateUses: readonly WorkspaceConnectionTemplateUse[];
157
+ };
158
+ request?: undefined;
159
+ response?: undefined;
160
+ } | {
161
+ provider: "amplitude" | "bigquery" | "sentry" | "posthog" | "mixpanel" | "github" | "slack" | "twitter" | "notion" | "gmail" | "google_drive" | "hubspot" | "granola" | "apollo" | "commonroom" | "dataforseo" | "ga4" | "gcloud" | "gong" | "google_calendar" | "grafana" | "jira" | "prometheus" | "pylon" | "stripe";
162
+ catalog: {
163
+ id: "amplitude" | "bigquery" | "sentry" | "posthog" | "mixpanel" | "github" | "slack" | "twitter" | "notion" | "gmail" | "google_drive" | "hubspot" | "granola" | "apollo" | "commonroom" | "dataforseo" | "ga4" | "gcloud" | "gong" | "google_calendar" | "grafana" | "jira" | "prometheus" | "pylon" | "stripe";
164
+ label: string;
165
+ defaultBaseUrl: string;
166
+ baseUrlCredentialKey: string;
167
+ auth: string;
168
+ credentialKeys: readonly string[];
169
+ docsUrls: readonly string[];
170
+ specUrls: readonly string[];
171
+ allowedHostSuffixes: readonly string[];
172
+ placeholders: readonly ProviderApiPlaceholder[];
173
+ defaultHeaders: Record<string, string>;
174
+ examples: readonly ProviderApiExample[];
175
+ notes: readonly string[];
176
+ templateUses: readonly WorkspaceConnectionTemplateUse[];
177
+ };
178
+ request: {
179
+ url: string;
180
+ };
181
+ response: {
182
+ status: number;
183
+ statusText: string;
184
+ ok: boolean;
185
+ elapsedMs: number;
186
+ headers: Record<string, string>;
187
+ contentType: string;
188
+ size: number;
189
+ truncated: boolean;
190
+ text: string;
191
+ json: unknown;
192
+ };
193
+ }>;
194
+ export declare function executeProviderApiRequest(args: ProviderApiRequestArgs, runtime: ProviderApiRuntimeOptions): Promise<{
195
+ provider: {
196
+ id: "amplitude" | "bigquery" | "sentry" | "posthog" | "mixpanel" | "github" | "slack" | "twitter" | "notion" | "gmail" | "google_drive" | "hubspot" | "granola" | "apollo" | "commonroom" | "dataforseo" | "ga4" | "gcloud" | "gong" | "google_calendar" | "grafana" | "jira" | "prometheus" | "pylon" | "stripe";
197
+ label: string;
198
+ docsUrls: readonly string[];
199
+ specUrls: readonly string[];
200
+ };
201
+ request: {
202
+ connectionId?: string;
203
+ accountId?: string;
204
+ method: ProviderApiMethod;
205
+ url: string;
206
+ path: string;
207
+ auth: string;
208
+ credentialSources: {
209
+ fingerprint: string;
210
+ source: string;
211
+ key: string;
212
+ scope?: string;
213
+ accountId?: string;
214
+ provider: string;
215
+ accountLabel?: string | null;
216
+ connectionId?: string;
217
+ connectionLabel?: string;
218
+ }[];
219
+ headerNames: string[];
220
+ };
221
+ response: {
222
+ status: number;
223
+ statusText: string;
224
+ ok: boolean;
225
+ elapsedMs: number;
226
+ headers: Record<string, string>;
227
+ contentType: string;
228
+ size: number;
229
+ truncated: boolean;
230
+ text: string;
231
+ json: unknown;
232
+ };
233
+ guidance: string;
234
+ }>;
235
+ export declare function defaultProviderApiCredentialResolver(options: ProviderApiCredentialLookupOptions): Promise<ProviderApiResolvedCredential | null>;
236
+ export {};
237
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/provider-api/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAWjC,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAEhF,eAAO,MAAM,gBAAgB,kSA0BnB,CAAC;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