@agent-native/core 0.49.23 → 0.49.25
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/cli/recap.d.ts.map +1 -1
- package/dist/cli/recap.js +21 -0
- package/dist/cli/recap.js.map +1 -1
- package/dist/client/agent-chat.d.ts.map +1 -1
- package/dist/client/agent-chat.js +26 -7
- package/dist/client/agent-chat.js.map +1 -1
- package/dist/client/builder-frame.d.ts +2 -0
- package/dist/client/builder-frame.d.ts.map +1 -1
- package/dist/client/builder-frame.js +2 -0
- package/dist/client/builder-frame.js.map +1 -1
- package/dist/client/mcp-app-host.d.ts +3 -0
- package/dist/client/mcp-app-host.d.ts.map +1 -1
- package/dist/client/mcp-app-host.js +13 -0
- package/dist/client/mcp-app-host.js.map +1 -1
- package/dist/provider-api/index.d.ts +6 -0
- package/dist/provider-api/index.d.ts.map +1 -1
- package/dist/provider-api/index.js +27 -10
- package/dist/provider-api/index.js.map +1 -1
- package/dist/templates/default/.agents/skills/actions/SKILL.md +22 -6
- package/dist/templates/default/.agents/skills/adding-a-feature/SKILL.md +7 -1
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +22 -6
- package/dist/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +7 -1
- package/package.json +1 -1
- package/src/templates/default/.agents/skills/actions/SKILL.md +22 -6
- package/src/templates/default/.agents/skills/adding-a-feature/SKILL.md +7 -1
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +22 -6
- package/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +7 -1
|
@@ -137,6 +137,12 @@ export interface ProviderApiRuntimeOptions {
|
|
|
137
137
|
localCredentialSource?: string;
|
|
138
138
|
getCredentialContext?: () => CredentialContext | null;
|
|
139
139
|
resolveCredential?: ProviderApiCredentialResolver;
|
|
140
|
+
/**
|
|
141
|
+
* Template-specific OAuth token provider overrides for built-in provider API
|
|
142
|
+
* configs. Use when an app stores a provider's OAuth grant under a narrower
|
|
143
|
+
* local provider id, e.g. Google Drive scoped to a "google-docs" connection.
|
|
144
|
+
*/
|
|
145
|
+
oauthProviderOverrides?: Record<string, string>;
|
|
140
146
|
/**
|
|
141
147
|
* Optional loader for custom providers registered at runtime. When provided,
|
|
142
148
|
* custom providers are merged with the static built-in registry for catalog,
|
|
@@ -1 +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;
|
|
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;AAYjC,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,gBAAgB,kSA0BnB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,MAAM,MAAM,iBAAiB,GACzB,KAAK,GACL,MAAM,GACN,KAAK,GACL,OAAO,GACP,QAAQ,GACR,MAAM,CAAC;AAEX,kDAAkD;AAClD,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;O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sBAEL,MAAM,EAAE;;;;;;;;;;;;;;;;;;;GA7e/B;AAED,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,sBAAsB,EAC5B,OAAO,EAAE,yBAAyB,oBAiLnC;AAsaD,wBAAsB,oCAAoC,CACxD,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,6BAA6B,GAAG,IAAI,CAAC,CAkC/C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { resolveCredential, } from "../credentials/index.js";
|
|
3
3
|
import { createSsrfSafeDispatcher, isBlockedExtensionUrlWithDns, } from "../extensions/url-safety.js";
|
|
4
|
-
import { listOAuthAccountsByOwner, saveOAuthTokens, } from "../oauth-tokens/index.js";
|
|
4
|
+
import { deleteOAuthTokens, listOAuthAccountsByOwner, saveOAuthTokens, } from "../oauth-tokens/index.js";
|
|
5
5
|
import { getCredentialContext } from "../server/request-context.js";
|
|
6
6
|
import { resolveWorkspaceConnectionCredentialForApp } from "../workspace-connections/credentials.js";
|
|
7
7
|
export { upsertCustomProvider, deleteCustomProvider, listCustomProviders, getCustomProvider, validateCustomBaseUrl, } from "./custom-registry.js";
|
|
@@ -32,6 +32,11 @@ export const PROVIDER_API_IDS = [
|
|
|
32
32
|
"stripe",
|
|
33
33
|
"twitter",
|
|
34
34
|
];
|
|
35
|
+
const PERMANENT_GOOGLE_OAUTH_REFRESH_ERRORS = new Set([
|
|
36
|
+
"invalid_grant",
|
|
37
|
+
"unauthorized_client",
|
|
38
|
+
"invalid_client",
|
|
39
|
+
]);
|
|
35
40
|
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
36
41
|
const MAX_TIMEOUT_MS = 120_000;
|
|
37
42
|
const DEFAULT_MAX_BYTES = 1024 * 1024;
|
|
@@ -94,7 +99,7 @@ const PROVIDER_CONFIGS = {
|
|
|
94
99
|
},
|
|
95
100
|
credentialKeys: ["APOLLO_API_KEY"],
|
|
96
101
|
docsUrls: ["https://docs.apollo.io/reference/api-reference"],
|
|
97
|
-
templateUses: ["analytics"],
|
|
102
|
+
templateUses: ["analytics", "calendar"],
|
|
98
103
|
examples: [
|
|
99
104
|
{
|
|
100
105
|
label: "Search people",
|
|
@@ -270,7 +275,7 @@ const PROVIDER_CONFIGS = {
|
|
|
270
275
|
Accept: "application/vnd.github+json",
|
|
271
276
|
"X-GitHub-Api-Version": "2022-11-28",
|
|
272
277
|
},
|
|
273
|
-
templateUses: ["analytics", "brain", "dispatch"],
|
|
278
|
+
templateUses: ["analytics", "brain", "design", "dispatch"],
|
|
274
279
|
examples: [
|
|
275
280
|
{ label: "Authenticated user", method: "GET", path: "/user" },
|
|
276
281
|
{ label: "Search issues", method: "GET", path: "/search/issues" },
|
|
@@ -319,7 +324,7 @@ const PROVIDER_CONFIGS = {
|
|
|
319
324
|
},
|
|
320
325
|
credentialKeys: ["GONG_ACCESS_KEY", "GONG_ACCESS_SECRET", "GONG_API_BASE"],
|
|
321
326
|
docsUrls: ["https://gong.app.gong.io/settings/api/documentation"],
|
|
322
|
-
templateUses: ["analytics"],
|
|
327
|
+
templateUses: ["analytics", "calendar"],
|
|
323
328
|
examples: [
|
|
324
329
|
{ label: "List calls", method: "GET", path: "/calls" },
|
|
325
330
|
{
|
|
@@ -343,7 +348,7 @@ const PROVIDER_CONFIGS = {
|
|
|
343
348
|
docsUrls: ["https://developers.google.com/calendar/api/v3/reference"],
|
|
344
349
|
specUrls: ["https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest"],
|
|
345
350
|
allowedHostSuffixes: ["googleapis.com"],
|
|
346
|
-
templateUses: ["brain", "calendar", "dispatch"],
|
|
351
|
+
templateUses: ["brain", "calendar", "dispatch", "mail"],
|
|
347
352
|
examples: [
|
|
348
353
|
{
|
|
349
354
|
label: "List calendars",
|
|
@@ -426,7 +431,7 @@ const PROVIDER_CONFIGS = {
|
|
|
426
431
|
},
|
|
427
432
|
credentialKeys: ["HUBSPOT_PRIVATE_APP_TOKEN", "HUBSPOT_ACCESS_TOKEN"],
|
|
428
433
|
docsUrls: ["https://developers.hubspot.com/docs/api/overview"],
|
|
429
|
-
templateUses: ["analytics", "brain", "mail", "dispatch"],
|
|
434
|
+
templateUses: ["analytics", "brain", "calendar", "mail", "dispatch"],
|
|
430
435
|
examples: [
|
|
431
436
|
{
|
|
432
437
|
label: "Search deals with any HubSpot CRM filter",
|
|
@@ -585,7 +590,7 @@ const PROVIDER_CONFIGS = {
|
|
|
585
590
|
},
|
|
586
591
|
credentialKeys: ["PYLON_API_KEY"],
|
|
587
592
|
docsUrls: ["https://docs.usepylon.com/pylon-docs/developer/api-reference"],
|
|
588
|
-
templateUses: ["analytics"],
|
|
593
|
+
templateUses: ["analytics", "calendar"],
|
|
589
594
|
examples: [{ label: "List issues", method: "GET", path: "/issues" }],
|
|
590
595
|
},
|
|
591
596
|
sentry: {
|
|
@@ -1394,7 +1399,7 @@ function buildProviderUrl(options) {
|
|
|
1394
1399
|
const rawPath = options.rawPath.trim();
|
|
1395
1400
|
const url = /^https?:\/\//i.test(rawPath)
|
|
1396
1401
|
? new URL(rawPath)
|
|
1397
|
-
: new URL(
|
|
1402
|
+
: new URL(joinProviderUrlPath(base, rawPath), base.origin);
|
|
1398
1403
|
if (!isAllowedProviderUrl(url, base, options.config)) {
|
|
1399
1404
|
throw new Error(`${options.config.label} API requests must stay on the configured provider host or registered provider host suffix.`);
|
|
1400
1405
|
}
|
|
@@ -1403,6 +1408,13 @@ function buildProviderUrl(options) {
|
|
|
1403
1408
|
}
|
|
1404
1409
|
return url;
|
|
1405
1410
|
}
|
|
1411
|
+
function joinProviderUrlPath(base, rawPath) {
|
|
1412
|
+
const basePath = base.pathname.replace(/\/+$/, "");
|
|
1413
|
+
const providerPath = rawPath.replace(/^\/+/, "");
|
|
1414
|
+
if (!providerPath)
|
|
1415
|
+
return basePath || "/";
|
|
1416
|
+
return `${basePath}/${providerPath}`;
|
|
1417
|
+
}
|
|
1406
1418
|
function isAllowedProviderUrl(url, base, config) {
|
|
1407
1419
|
if (url.protocol !== "https:" && url.protocol !== "http:")
|
|
1408
1420
|
return false;
|
|
@@ -1533,8 +1545,9 @@ async function resolveAuth(config, runtime, ctx, args) {
|
|
|
1533
1545
|
};
|
|
1534
1546
|
}
|
|
1535
1547
|
if (auth.type === "oauth-bearer") {
|
|
1548
|
+
const oauthProvider = runtime.oauthProviderOverrides?.[config.id] ?? auth.oauthProvider;
|
|
1536
1549
|
const credential = await resolveOAuthBearerToken({
|
|
1537
|
-
auth,
|
|
1550
|
+
auth: { ...auth, oauthProvider },
|
|
1538
1551
|
ctx,
|
|
1539
1552
|
accountId: args.accountId,
|
|
1540
1553
|
});
|
|
@@ -1733,7 +1746,8 @@ async function getValidOAuthAccessToken(options) {
|
|
|
1733
1746
|
const refreshToken = options.tokens.refresh_token ?? options.tokens.refreshToken;
|
|
1734
1747
|
if (!refreshToken)
|
|
1735
1748
|
return accessToken;
|
|
1736
|
-
if (options.oauthProvider === "google"
|
|
1749
|
+
if (options.oauthProvider === "google" ||
|
|
1750
|
+
options.oauthProvider === "google-docs") {
|
|
1737
1751
|
return refreshGoogleOAuthToken(options, refreshToken);
|
|
1738
1752
|
}
|
|
1739
1753
|
throw new Error(`${options.oauthProvider} OAuth token is expired and automatic refresh is not configured for provider-api.`);
|
|
@@ -1756,6 +1770,9 @@ async function refreshGoogleOAuthToken(options, refreshToken) {
|
|
|
1756
1770
|
});
|
|
1757
1771
|
const data = (await res.json());
|
|
1758
1772
|
if (!res.ok || !data.access_token) {
|
|
1773
|
+
if (data.error && PERMANENT_GOOGLE_OAUTH_REFRESH_ERRORS.has(data.error)) {
|
|
1774
|
+
await deleteOAuthTokens(options.oauthProvider, options.accountId);
|
|
1775
|
+
}
|
|
1759
1776
|
const detail = data.error_description ?? data.error ?? res.statusText;
|
|
1760
1777
|
throw new Error(`Google OAuth refresh failed: ${detail}`);
|
|
1761
1778
|
}
|