@agent-native/core 0.208.0 → 0.209.0-nightly-20261014070126
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/agent-native.eject.json +1 -0
- package/dist/agent/approval-key.d.ts +2 -0
- package/dist/agent/approval-key.js +12 -0
- package/dist/agent/context-xray/tokenize.js +12 -3
- package/dist/agent/engine/translate-anthropic.js +4 -0
- package/dist/agent/engine/types.d.ts +2 -0
- package/dist/agent/production-agent.d.ts +20 -5
- package/dist/agent/production-agent.js +227 -34
- package/dist/agent/run-manager.js +57 -11
- package/dist/agent/run-store.d.ts +10 -0
- package/dist/agent/run-store.js +49 -4
- package/dist/agent/thread-data-builder.d.ts +2 -0
- package/dist/agent/thread-data-builder.js +288 -14
- package/dist/agent/tool-approval-store.d.ts +3 -1
- package/dist/agent/tool-approval-store.js +26 -12
- package/dist/agent/tool-call-journal.d.ts +1 -1
- package/dist/agent/tool-call-journal.js +5 -3
- package/dist/agent/types.d.ts +7 -0
- package/dist/client/chat/agentkit-agent-native.js +18 -0
- package/dist/client/chat/agentkit-protocol.js +56 -5
- package/dist/client/chat/runtime.d.ts +10 -0
- package/dist/client/chat/runtime.js +257 -26
- package/dist/client/sse-event-processor.d.ts +22 -0
- package/dist/client/sse-event-processor.js +91 -11
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/connections/catalog.d.ts +24 -1
- package/dist/connections/catalog.js +12 -0
- package/dist/data-programs/schema.d.ts +1 -0
- package/dist/data-programs/schema.js +3 -0
- package/dist/data-programs/store.js +2 -1
- package/dist/deploy/build.js +16 -14
- package/dist/eject/workspace-connections.js +1 -0
- package/dist/extensions/fetch-tool.js +114 -23
- package/dist/extensions/schema.d.ts +1 -0
- package/dist/extensions/schema.js +3 -0
- package/dist/extensions/store.js +2 -1
- package/dist/extensions/web-content.d.ts +5 -1
- package/dist/extensions/web-content.js +24 -6
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +11 -11
- package/dist/provider-api/actions/provider-api.d.ts +9 -9
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/provider-api/index.d.ts +2 -0
- package/dist/provider-api/index.js +95 -12
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/server/agent-engine-default-model-route.d.ts +2 -2
- package/dist/server/agent-engine-ollama-models-route.d.ts +1 -1
- package/dist/server/auth.js +1 -0
- package/dist/server/core-routes-plugin.js +1 -0
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +2 -1
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/server/workspace-provider-oauth.d.ts +1 -1
- package/dist/server/workspace-provider-oauth.js +2 -0
- package/dist/shared/context-status.js +1 -1
- package/dist/shared/optional-peer-ssr.d.ts +2 -0
- package/dist/shared/optional-peer-ssr.js +123 -0
- package/dist/shared/tool-inputs.d.ts +2 -0
- package/dist/shared/tool-inputs.js +56 -0
- package/dist/sharing/actions/list-resource-shares.d.ts +1 -1
- package/dist/tracking/index.d.ts +1 -0
- package/dist/tracking/index.js +1 -0
- package/dist/vite/client.js +46 -3
- package/dist/workspace-connections/store.d.ts +3 -1
- package/dist/workspace-connections/store.js +18 -8
- package/dist/workspace-files/constants.d.ts +3 -0
- package/dist/workspace-files/constants.js +3 -0
- package/dist/workspace-files/store.d.ts +2 -3
- package/dist/workspace-files/store.js +2 -3
- package/docs/content/automations.mdx +19 -13
- package/package.json +3 -3
- package/src/eject/workspace-connections.ts +1 -0
|
@@ -195,10 +195,12 @@ const PROVIDER_CONFIGS = {
|
|
|
195
195
|
"https://www.googleapis.com/auth/cloud-platform",
|
|
196
196
|
"https://www.googleapis.com/auth/bigquery",
|
|
197
197
|
],
|
|
198
|
+
oauthProvider: "google",
|
|
199
|
+
workspaceProvider: "bigquery",
|
|
198
200
|
},
|
|
199
201
|
credentialKeys: [
|
|
200
|
-
"GOOGLE_APPLICATION_CREDENTIALS_JSON",
|
|
201
202
|
"BIGQUERY_PROJECT_ID",
|
|
203
|
+
"GOOGLE_APPLICATION_CREDENTIALS_JSON",
|
|
202
204
|
],
|
|
203
205
|
docsUrls: ["https://cloud.google.com/bigquery/docs/reference/rest"],
|
|
204
206
|
specUrls: ["https://bigquery.googleapis.com/$discovery/rest?version=v2"],
|
|
@@ -1564,11 +1566,21 @@ export async function resolveProviderApiOAuthAccessToken(args, runtime) {
|
|
|
1564
1566
|
tokenLabel: auth.tokenLabel,
|
|
1565
1567
|
workspaceProvider: auth.workspaceProvider,
|
|
1566
1568
|
}
|
|
1567
|
-
:
|
|
1569
|
+
: auth.type === "google-service-account" && auth.oauthProvider
|
|
1570
|
+
? {
|
|
1571
|
+
type: "oauth-bearer",
|
|
1572
|
+
oauthProvider: auth.oauthProvider,
|
|
1573
|
+
tokenLabel: "Google OAuth token",
|
|
1574
|
+
workspaceProvider: auth.workspaceProvider,
|
|
1575
|
+
}
|
|
1576
|
+
: null;
|
|
1568
1577
|
if (!oauthAuth) {
|
|
1569
1578
|
throw new Error(`Provider API ${args.provider} does not use a direct OAuth bearer token.`);
|
|
1570
1579
|
}
|
|
1571
1580
|
const ctx = requireRuntimeCredentialContext(runtime, config.credentialKeys[0] ?? config.id);
|
|
1581
|
+
if (args.provider === "bigquery" && ctx.credentialScope === "org") {
|
|
1582
|
+
throw new Error("Personal BigQuery OAuth is unavailable for org-only credential scope.");
|
|
1583
|
+
}
|
|
1572
1584
|
const credential = oauthAuth.workspaceProvider
|
|
1573
1585
|
? await resolveOptionalConnectionBoundOAuthBearerToken({
|
|
1574
1586
|
auth: oauthAuth,
|
|
@@ -2966,6 +2978,45 @@ async function resolveAuth(config, runtime, ctx, args, endpoint) {
|
|
|
2966
2978
|
};
|
|
2967
2979
|
}
|
|
2968
2980
|
if (auth.type === "google-service-account") {
|
|
2981
|
+
if (auth.oauthProvider &&
|
|
2982
|
+
auth.workspaceProvider &&
|
|
2983
|
+
!(auth.workspaceProvider === "bigquery" && ctx.credentialScope === "org")) {
|
|
2984
|
+
let oauthCredential;
|
|
2985
|
+
try {
|
|
2986
|
+
oauthCredential = await resolveOptionalConnectionBoundOAuthBearerToken({
|
|
2987
|
+
auth: {
|
|
2988
|
+
type: "oauth-bearer",
|
|
2989
|
+
oauthProvider: auth.oauthProvider,
|
|
2990
|
+
tokenLabel: "Google OAuth token",
|
|
2991
|
+
workspaceProvider: auth.workspaceProvider,
|
|
2992
|
+
},
|
|
2993
|
+
runtime,
|
|
2994
|
+
ctx,
|
|
2995
|
+
workspaceProvider: auth.workspaceProvider,
|
|
2996
|
+
connectionId: args.connectionId,
|
|
2997
|
+
accountId: args.accountId,
|
|
2998
|
+
});
|
|
2999
|
+
}
|
|
3000
|
+
catch (error) {
|
|
3001
|
+
if (auth.workspaceProvider !== "bigquery" ||
|
|
3002
|
+
!(error instanceof AgentConnectionRequiredError) ||
|
|
3003
|
+
error.provider !== "bigquery" ||
|
|
3004
|
+
error.reason !== "reauthorize") {
|
|
3005
|
+
throw error;
|
|
3006
|
+
}
|
|
3007
|
+
if (args.connectionId?.trim() || args.accountId?.trim()) {
|
|
3008
|
+
throw error;
|
|
3009
|
+
}
|
|
3010
|
+
oauthCredential = null;
|
|
3011
|
+
}
|
|
3012
|
+
if (oauthCredential) {
|
|
3013
|
+
return {
|
|
3014
|
+
headers: { Authorization: `Bearer ${oauthCredential.value}` },
|
|
3015
|
+
credentialSources: [omitCredentialValue(oauthCredential)],
|
|
3016
|
+
secretValues: [oauthCredential.value],
|
|
3017
|
+
};
|
|
3018
|
+
}
|
|
3019
|
+
}
|
|
2969
3020
|
const token = await getGoogleServiceAccountToken(auth.scopes, runtime, ctx);
|
|
2970
3021
|
return {
|
|
2971
3022
|
headers: { Authorization: `Bearer ${token}` },
|
|
@@ -3471,13 +3522,33 @@ async function resolveOAuthBearerToken(options) {
|
|
|
3471
3522
|
throw new Error(`${options.auth.tokenLabel} account ${requestedAccountId} is not available to ${ownerEmail}.`);
|
|
3472
3523
|
}
|
|
3473
3524
|
const tokens = account.tokens;
|
|
3474
|
-
const
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3525
|
+
const preserveSharedGoogleGrant = options.auth.oauthProvider === "google" &&
|
|
3526
|
+
Boolean(options.auth.workspaceProvider);
|
|
3527
|
+
let token;
|
|
3528
|
+
try {
|
|
3529
|
+
token = await getValidOAuthAccessToken({
|
|
3530
|
+
oauthProvider: options.auth.oauthProvider,
|
|
3531
|
+
accountId: account.accountId,
|
|
3532
|
+
ownerEmail,
|
|
3533
|
+
tokens,
|
|
3534
|
+
preserveTokensOnPermanentFailure: preserveSharedGoogleGrant,
|
|
3535
|
+
salesforceLoginUrl: options.salesforceLoginUrl,
|
|
3536
|
+
});
|
|
3537
|
+
}
|
|
3538
|
+
catch (error) {
|
|
3539
|
+
if (preserveSharedGoogleGrant &&
|
|
3540
|
+
options.auth.workspaceProvider &&
|
|
3541
|
+
isPermanentGoogleOAuthRefreshFailure(error)) {
|
|
3542
|
+
return throwWorkspaceConnectionRequired({
|
|
3543
|
+
runtime: options.runtime,
|
|
3544
|
+
provider: options.auth.workspaceProvider,
|
|
3545
|
+
connectionId: options.connectionId,
|
|
3546
|
+
message: `${options.auth.tokenLabel} requires an available workspace connection.`,
|
|
3547
|
+
reason: "reauthorize",
|
|
3548
|
+
});
|
|
3549
|
+
}
|
|
3550
|
+
throw error;
|
|
3551
|
+
}
|
|
3481
3552
|
return {
|
|
3482
3553
|
key: `${options.auth.oauthProvider.toUpperCase()}_OAUTH_TOKEN`,
|
|
3483
3554
|
value: token,
|
|
@@ -3535,24 +3606,37 @@ async function throwWorkspaceConnectionRequired(options) {
|
|
|
3535
3606
|
}
|
|
3536
3607
|
async function resolveOptionalConnectionBoundOAuthBearerToken(options) {
|
|
3537
3608
|
const requestedConnectionId = options.connectionId?.trim();
|
|
3609
|
+
const requestedAccountId = options.accountId?.trim();
|
|
3538
3610
|
let resolved;
|
|
3539
3611
|
try {
|
|
3540
3612
|
resolved = await resolveWorkspaceConnectionForApp({
|
|
3541
3613
|
appId: options.runtime.appId,
|
|
3542
3614
|
provider: options.workspaceProvider,
|
|
3543
3615
|
connectionId: requestedConnectionId,
|
|
3616
|
+
accountId: requestedAccountId,
|
|
3617
|
+
...(options.workspaceProvider === "bigquery"
|
|
3618
|
+
? { connectionOwnerEmail: options.ctx.userEmail }
|
|
3619
|
+
: {}),
|
|
3544
3620
|
requireConnected: true,
|
|
3545
3621
|
});
|
|
3546
3622
|
}
|
|
3547
3623
|
catch (error) {
|
|
3548
3624
|
if (error instanceof Error &&
|
|
3549
3625
|
error.message === "Workspace connections require an authenticated user.") {
|
|
3626
|
+
if (requestedConnectionId || requestedAccountId) {
|
|
3627
|
+
return throwWorkspaceConnectionRequired({
|
|
3628
|
+
runtime: options.runtime,
|
|
3629
|
+
provider: options.workspaceProvider,
|
|
3630
|
+
connectionId: requestedConnectionId,
|
|
3631
|
+
message: "Sign in to use the selected workspace connection.",
|
|
3632
|
+
});
|
|
3633
|
+
}
|
|
3550
3634
|
return null;
|
|
3551
3635
|
}
|
|
3552
3636
|
throw error;
|
|
3553
3637
|
}
|
|
3554
3638
|
if (!resolved.available || !resolved.connection) {
|
|
3555
|
-
if (requestedConnectionId) {
|
|
3639
|
+
if (requestedConnectionId || requestedAccountId) {
|
|
3556
3640
|
return throwWorkspaceConnectionRequired({
|
|
3557
3641
|
runtime: options.runtime,
|
|
3558
3642
|
provider: options.workspaceProvider,
|
|
@@ -3578,9 +3662,8 @@ async function resolveOptionalConnectionBoundOAuthBearerToken(options) {
|
|
|
3578
3662
|
return null;
|
|
3579
3663
|
throw new Error(`${options.auth.tokenLabel} workspace connection ${resolved.connection.id} is missing its OAuth account binding.`);
|
|
3580
3664
|
}
|
|
3581
|
-
const requestedAccountId = options.accountId?.trim();
|
|
3582
3665
|
if (requestedAccountId && requestedAccountId !== connectionAccountId) {
|
|
3583
|
-
throw new Error(`${options.auth.tokenLabel} account
|
|
3666
|
+
throw new Error(`${options.auth.tokenLabel} account binding does not match the requested workspace connection.`);
|
|
3584
3667
|
}
|
|
3585
3668
|
const credential = await resolveOAuthBearerToken({
|
|
3586
3669
|
auth: options.auth,
|
|
@@ -39,8 +39,8 @@ export declare function handleUpdateResource(event: any): Promise<import("./stor
|
|
|
39
39
|
error: string;
|
|
40
40
|
}>;
|
|
41
41
|
export declare function handleDeleteResource(event: any): Promise<{
|
|
42
|
-
error: string;
|
|
43
42
|
ok?: undefined;
|
|
43
|
+
error: string;
|
|
44
44
|
} | {
|
|
45
45
|
error?: undefined;
|
|
46
46
|
ok: boolean;
|
|
@@ -8,17 +8,17 @@ export declare const AGENT_ENGINE_API_KEY_ACTION_NAME = "agent-engine-api-key";
|
|
|
8
8
|
* resolveEngine's credential detection.
|
|
9
9
|
*/
|
|
10
10
|
export declare function createAgentEngineDisconnectHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
11
|
+
ok?: undefined;
|
|
11
12
|
error: string;
|
|
12
13
|
scope?: undefined;
|
|
13
|
-
ok?: undefined;
|
|
14
14
|
} | {
|
|
15
15
|
ok: boolean;
|
|
16
16
|
error: any;
|
|
17
17
|
scope?: undefined;
|
|
18
18
|
} | {
|
|
19
|
+
error?: undefined;
|
|
19
20
|
ok: boolean;
|
|
20
21
|
scope: "org" | "user";
|
|
21
|
-
error?: undefined;
|
|
22
22
|
}>>;
|
|
23
23
|
export interface DefaultModelSelectionRequest {
|
|
24
24
|
engine: string;
|
package/dist/server/auth.js
CHANGED
|
@@ -2395,6 +2395,7 @@ function isWorkspaceGoogleOAuthProvider(provider) {
|
|
|
2395
2395
|
provider === "google_calendar" ||
|
|
2396
2396
|
provider === "google_docs" ||
|
|
2397
2397
|
provider === "google_drive" ||
|
|
2398
|
+
provider === "bigquery" ||
|
|
2398
2399
|
provider === "google_sheets" ||
|
|
2399
2400
|
provider === "google_slides");
|
|
2400
2401
|
}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { readComposerWebsiteSource, type ComposerWebsiteExtraction, } from "./composer-website-source.js";
|
|
2
2
|
export { isAgentKitFigmaSourceAvailable, listAgentKitCapabilities, readAgentKitIntegrationIntent, type AgentKitCapabilityAppId, type AgentKitCapabilityCatalog, type AgentKitIntegrationCapability, } from "../agentkit/capabilities.js";
|
|
3
3
|
export { defineAppConfig, getAppConfig, resolveAppHomePath, resetAppConfigForTests, appConfigSchema, type AppConfig, type AppConfigInput, } from "../app-config/index.js";
|
|
4
|
+
export { platformWaitUntil } from "./background-work.js";
|
|
4
5
|
export { resolveDeployEnvironment } from "./deploy-environment.js";
|
|
5
6
|
export { isTestIdentity, testIdentitySql } from "./test-identity.js";
|
|
6
7
|
export { inferWorkspaceAppRootHomePath, readConfiguredWorkspaceAppHomePath, } from "../workspace-app-config.js";
|
|
@@ -16,7 +17,7 @@ export { createSSEHandler, type SSEHandlerOptions } from "./sse.js";
|
|
|
16
17
|
export { isCredentialMembershipUnavailable } from "./credential-membership-unavailable.js";
|
|
17
18
|
export { mountAuthMiddleware, autoMountAuth, registerAuthPublicPaths, getSession, isSessionResolutionUnavailable, getMcpOAuthBearerSession, logout, COOKIE_NAME, addSession, removeSession, getSessionEmail, getFrameworkSessionCookieValues, setFrameworkSessionCookie, setFirstRunOnboardingCookie, clearFrameworkSessionCookies, runAuthGuard, registerDesktopExchange, prepareDesktopOAuthBrowserBinding, matchesDesktopOAuthBrowserBinding, DESKTOP_OAUTH_BROWSER_BINDING_COOKIE, setDesktopExchange, setDesktopExchangeError, safeReturnPath, type DesktopExchangeErrorPayload, type AuthSession, type AuthOptions, } from "./auth.js";
|
|
18
19
|
export { handleIdentitySso, ensureIdentityUser, getIdentityHubUrl, isIdentitySsoEnabled, isIdentitySsoBypassPath, identitySsoLoginButtonHtml, IDENTITY_SSO_BOOTSTRAP_ACTIVATE_PATH, IDENTITY_SSO_BOOTSTRAP_BINDING_COOKIE, clearIdentitySsoBootstrapBindingCookie, getIdentitySsoBootstrapBindingCookie, setIdentitySsoBootstrapBindingCookie, IDENTITY_SSO_PROVIDER_ID, IDENTITY_SSO_SCOPE, IDENTITY_SSO_DESKTOP_COMPLETE_PATH, } from "./identity-sso.js";
|
|
19
|
-
export { createBetterAuthSessionForEmail, ensureGoogleAuthIdentity, hasGoogleAuthIdentity, setBetterAuthSessionCookie, } from "./better-auth-instance.js";
|
|
20
|
+
export { createBetterAuthSessionForEmail, ensureGoogleAuthIdentity, getBetterAuthUserIdForEmail, hasGoogleAuthIdentity, setBetterAuthSessionCookie, } from "./better-auth-instance.js";
|
|
20
21
|
export { setIdentityGoogleAuthCookie } from "./identity-auth-provider.js";
|
|
21
22
|
export { requireEnvKey, type MissingKeyResponse } from "./missing-key.js";
|
|
22
23
|
export { assertCurrentRequestUserIsOrgAdmin, currentRequestUserIsOrgAdmin, } from "./org-admin.js";
|
package/dist/server/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { readComposerWebsiteSource, } from "./composer-website-source.js";
|
|
2
2
|
export { isAgentKitFigmaSourceAvailable, listAgentKitCapabilities, readAgentKitIntegrationIntent, } from "../agentkit/capabilities.js";
|
|
3
3
|
export { defineAppConfig, getAppConfig, resolveAppHomePath, resetAppConfigForTests, appConfigSchema, } from "../app-config/index.js";
|
|
4
|
+
export { platformWaitUntil } from "./background-work.js";
|
|
4
5
|
export { resolveDeployEnvironment } from "./deploy-environment.js";
|
|
5
6
|
export { isTestIdentity, testIdentitySql } from "./test-identity.js";
|
|
6
7
|
export { inferWorkspaceAppRootHomePath, readConfiguredWorkspaceAppHomePath, } from "../workspace-app-config.js";
|
|
@@ -16,7 +17,7 @@ export { createSSEHandler } from "./sse.js";
|
|
|
16
17
|
export { isCredentialMembershipUnavailable } from "./credential-membership-unavailable.js";
|
|
17
18
|
export { mountAuthMiddleware, autoMountAuth, registerAuthPublicPaths, getSession, isSessionResolutionUnavailable, getMcpOAuthBearerSession, logout, COOKIE_NAME, addSession, removeSession, getSessionEmail, getFrameworkSessionCookieValues, setFrameworkSessionCookie, setFirstRunOnboardingCookie, clearFrameworkSessionCookies, runAuthGuard, registerDesktopExchange, prepareDesktopOAuthBrowserBinding, matchesDesktopOAuthBrowserBinding, DESKTOP_OAUTH_BROWSER_BINDING_COOKIE, setDesktopExchange, setDesktopExchangeError, safeReturnPath, } from "./auth.js";
|
|
18
19
|
export { handleIdentitySso, ensureIdentityUser, getIdentityHubUrl, isIdentitySsoEnabled, isIdentitySsoBypassPath, identitySsoLoginButtonHtml, IDENTITY_SSO_BOOTSTRAP_ACTIVATE_PATH, IDENTITY_SSO_BOOTSTRAP_BINDING_COOKIE, clearIdentitySsoBootstrapBindingCookie, getIdentitySsoBootstrapBindingCookie, setIdentitySsoBootstrapBindingCookie, IDENTITY_SSO_PROVIDER_ID, IDENTITY_SSO_SCOPE, IDENTITY_SSO_DESKTOP_COMPLETE_PATH, } from "./identity-sso.js";
|
|
19
|
-
export { createBetterAuthSessionForEmail, ensureGoogleAuthIdentity, hasGoogleAuthIdentity, setBetterAuthSessionCookie, } from "./better-auth-instance.js";
|
|
20
|
+
export { createBetterAuthSessionForEmail, ensureGoogleAuthIdentity, getBetterAuthUserIdForEmail, hasGoogleAuthIdentity, setBetterAuthSessionCookie, } from "./better-auth-instance.js";
|
|
20
21
|
export { setIdentityGoogleAuthCookie } from "./identity-auth-provider.js";
|
|
21
22
|
export { requireEnvKey } from "./missing-key.js";
|
|
22
23
|
export { assertCurrentRequestUserIsOrgAdmin, currentRequestUserIsOrgAdmin, } from "./org-admin.js";
|
|
@@ -54,8 +54,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
|
|
|
54
54
|
expiresAt?: undefined;
|
|
55
55
|
ttlSeconds?: undefined;
|
|
56
56
|
} | {
|
|
57
|
-
error?: undefined;
|
|
58
57
|
token: string;
|
|
59
58
|
expiresAt: string;
|
|
60
59
|
ttlSeconds: number;
|
|
60
|
+
error?: undefined;
|
|
61
61
|
}>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type H3Event } from "h3";
|
|
2
2
|
import { type WorkspaceConnectionProvider } from "../connections/catalog.js";
|
|
3
3
|
import { type OAuthStatePayload } from "./google-oauth.js";
|
|
4
|
-
export type GenericWorkspaceOAuthProvider = "figma" | "gmail" | "google_calendar" | "google_docs" | "google_drive" | "google_sheets" | "google_slides" | "github" | "hubspot" | "salesforce" | "jira" | "sentry" | "notion";
|
|
4
|
+
export type GenericWorkspaceOAuthProvider = "figma" | "gmail" | "google_calendar" | "google_docs" | "google_drive" | "bigquery" | "google_sheets" | "google_slides" | "github" | "hubspot" | "salesforce" | "jira" | "sentry" | "notion";
|
|
5
5
|
export type WorkspaceProviderOAuthScope = "user" | "organization" | "app";
|
|
6
6
|
export declare function isWorkspaceProviderOAuthScope(value: unknown): value is WorkspaceProviderOAuthScope;
|
|
7
7
|
export declare function isGoogleWorkspaceOAuthProvider(provider: string): boolean;
|
|
@@ -19,6 +19,7 @@ const SUPPORTED_PROVIDERS = new Set([
|
|
|
19
19
|
"google_calendar",
|
|
20
20
|
"google_docs",
|
|
21
21
|
"google_drive",
|
|
22
|
+
"bigquery",
|
|
22
23
|
"google_sheets",
|
|
23
24
|
"google_slides",
|
|
24
25
|
"github",
|
|
@@ -43,6 +44,7 @@ export function isGoogleWorkspaceOAuthProvider(provider) {
|
|
|
43
44
|
provider === "google_calendar" ||
|
|
44
45
|
provider === "google_docs" ||
|
|
45
46
|
provider === "google_drive" ||
|
|
47
|
+
provider === "bigquery" ||
|
|
46
48
|
provider === "google_sheets" ||
|
|
47
49
|
provider === "google_slides");
|
|
48
50
|
}
|
|
@@ -50,5 +50,5 @@ export const SELECTION_CONTEXT_UNAVAILABLE_NOTE = wrapNote("Selected text unavai
|
|
|
50
50
|
/** `partial` when another source did deliver context this turn. */
|
|
51
51
|
export function preloadedContextUnavailableNote(status, options = {}) {
|
|
52
52
|
const reason = status === "timed_out" ? "timed out" : "failed";
|
|
53
|
-
return wrapNote(`${options.partial ? "Some preloaded context" : "Preloaded context"} was unavailable this turn (${reason}); search for
|
|
53
|
+
return wrapNote(`${options.partial ? "Some preloaded context" : "Preloaded context"} was unavailable this turn (${reason}); if the request depends on workspace knowledge, such as prior work, team docs, brand defaults, or people, search for it with the available tools before answering; otherwise continue without it.`);
|
|
54
54
|
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
|
+
export const CORE_BUNDLED_INGESTION_OPTIONAL_PEERS = [
|
|
5
|
+
"fast-xml-parser",
|
|
6
|
+
"jszip",
|
|
7
|
+
"officeparser",
|
|
8
|
+
"pdf-parse",
|
|
9
|
+
"pdfjs-dist",
|
|
10
|
+
];
|
|
11
|
+
function isMissingFileError(error) {
|
|
12
|
+
return (error instanceof Error &&
|
|
13
|
+
"code" in error &&
|
|
14
|
+
typeof error.code === "string" &&
|
|
15
|
+
error.code === "ENOENT");
|
|
16
|
+
}
|
|
17
|
+
function findCorePackageRoot(cwd) {
|
|
18
|
+
const installedManifest = findDependencyManifestPath("@agent-native/core", cwd);
|
|
19
|
+
if (installedManifest) {
|
|
20
|
+
const manifest = JSON.parse(fs.readFileSync(installedManifest, "utf8"));
|
|
21
|
+
if (manifest.name === "@agent-native/core") {
|
|
22
|
+
return fs.realpathSync(path.dirname(installedManifest));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const appPackage = JSON.parse(fs.readFileSync(path.join(cwd, "package.json"), "utf8"));
|
|
27
|
+
const localCore = appPackage.dependencies?.["@agent-native/core"] ??
|
|
28
|
+
appPackage.devDependencies?.["@agent-native/core"];
|
|
29
|
+
if (localCore?.startsWith("file:")) {
|
|
30
|
+
const root = fileURLToPath(new URL(localCore, pathToFileURL(path.join(cwd, "package.json"))));
|
|
31
|
+
const manifestPath = path.join(root, "package.json");
|
|
32
|
+
if (fs.existsSync(manifestPath)) {
|
|
33
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
34
|
+
if (manifest.name === "@agent-native/core") {
|
|
35
|
+
return fs.realpathSync(root);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (!isMissingFileError(error))
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
for (const candidate of [
|
|
45
|
+
path.resolve(cwd, "packages/core"),
|
|
46
|
+
path.resolve(cwd, "../../packages/core"),
|
|
47
|
+
path.resolve(cwd, "../core"),
|
|
48
|
+
]) {
|
|
49
|
+
const manifestPath = path.join(candidate, "package.json");
|
|
50
|
+
if (!fs.existsSync(manifestPath))
|
|
51
|
+
continue;
|
|
52
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
53
|
+
if (manifest.name === "@agent-native/core") {
|
|
54
|
+
return fs.realpathSync(candidate);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
function findDependencyManifestPath(packageName, startDir) {
|
|
60
|
+
const packagePath = packageName.split("/");
|
|
61
|
+
let dir = path.resolve(startDir);
|
|
62
|
+
for (let i = 0; i < 20; i++) {
|
|
63
|
+
const candidate = path.join(dir, "node_modules", ...packagePath, "package.json");
|
|
64
|
+
if (fs.existsSync(candidate))
|
|
65
|
+
return candidate;
|
|
66
|
+
const parent = path.dirname(dir);
|
|
67
|
+
if (parent === dir)
|
|
68
|
+
break;
|
|
69
|
+
dir = parent;
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
function getRuntimeDependencyNames(cwd, coreRoot) {
|
|
74
|
+
const appPackage = JSON.parse(fs.readFileSync(path.join(cwd, "package.json"), "utf8"));
|
|
75
|
+
const pending = [
|
|
76
|
+
...Object.keys(appPackage.dependencies ?? {}),
|
|
77
|
+
...Object.keys(appPackage.optionalDependencies ?? {}),
|
|
78
|
+
...Object.keys(appPackage.peerDependencies ?? {}),
|
|
79
|
+
].map((name) => ({ name, fromDir: cwd }));
|
|
80
|
+
const dependencies = new Set();
|
|
81
|
+
const visited = new Set();
|
|
82
|
+
while (pending.length > 0) {
|
|
83
|
+
const current = pending.pop();
|
|
84
|
+
const manifestPath = findDependencyManifestPath(current.name, current.fromDir);
|
|
85
|
+
if (!manifestPath)
|
|
86
|
+
continue;
|
|
87
|
+
if (findDependencyManifestPath(current.name, coreRoot)) {
|
|
88
|
+
dependencies.add(current.name);
|
|
89
|
+
}
|
|
90
|
+
const realManifestPath = fs.realpathSync(manifestPath);
|
|
91
|
+
if (visited.has(realManifestPath))
|
|
92
|
+
continue;
|
|
93
|
+
visited.add(realManifestPath);
|
|
94
|
+
const manifest = JSON.parse(fs.readFileSync(realManifestPath, "utf8"));
|
|
95
|
+
const packageDir = path.dirname(realManifestPath);
|
|
96
|
+
for (const name of [
|
|
97
|
+
...Object.keys(manifest.dependencies ?? {}),
|
|
98
|
+
...Object.keys(manifest.optionalDependencies ?? {}),
|
|
99
|
+
]) {
|
|
100
|
+
pending.push({ name, fromDir: packageDir });
|
|
101
|
+
}
|
|
102
|
+
// A workspace-linked Core resolves its own dev-installed peers from coreRoot.
|
|
103
|
+
const peerFromDir = manifest.name === "@agent-native/core" ? cwd : packageDir;
|
|
104
|
+
for (const name of Object.keys(manifest.peerDependencies ?? {})) {
|
|
105
|
+
pending.push({ name, fromDir: peerFromDir });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return dependencies;
|
|
109
|
+
}
|
|
110
|
+
export function getMissingCoreOptionalPeers(cwd) {
|
|
111
|
+
const coreRoot = findCorePackageRoot(cwd);
|
|
112
|
+
if (!coreRoot)
|
|
113
|
+
return [];
|
|
114
|
+
const corePackage = JSON.parse(fs.readFileSync(path.join(coreRoot, "package.json"), "utf8"));
|
|
115
|
+
const runtimeDependencies = getRuntimeDependencyNames(cwd, coreRoot);
|
|
116
|
+
const bundledIngestionPeers = new Set(CORE_BUNDLED_INGESTION_OPTIONAL_PEERS);
|
|
117
|
+
return Object.entries(corePackage.peerDependenciesMeta ?? {})
|
|
118
|
+
.filter(([name, peer]) => peer.optional === true &&
|
|
119
|
+
!runtimeDependencies.has(name) &&
|
|
120
|
+
!bundledIngestionPeers.has(name))
|
|
121
|
+
.map(([name]) => name)
|
|
122
|
+
.sort();
|
|
123
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export function toolInputsMatch(callInput, approvalInput) {
|
|
2
|
+
return (callInput !== null &&
|
|
3
|
+
approvalInput !== null &&
|
|
4
|
+
typeof callInput === "object" &&
|
|
5
|
+
typeof approvalInput === "object" &&
|
|
6
|
+
!Array.isArray(callInput) &&
|
|
7
|
+
!Array.isArray(approvalInput) &&
|
|
8
|
+
toolInputValuesMatch(callInput, approvalInput));
|
|
9
|
+
}
|
|
10
|
+
export function toolInputFingerprint(input) {
|
|
11
|
+
let serialized;
|
|
12
|
+
try {
|
|
13
|
+
serialized = JSON.stringify(input, (_key, value) => {
|
|
14
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
15
|
+
return Object.fromEntries(Object.keys(value)
|
|
16
|
+
.sort()
|
|
17
|
+
.map((key) => [key, value[key]]));
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
if (error instanceof TypeError)
|
|
24
|
+
return undefined;
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
if (serialized === undefined)
|
|
28
|
+
return undefined;
|
|
29
|
+
let hash = 0xcbf29ce484222325n;
|
|
30
|
+
for (let index = 0; index < serialized.length; index += 1) {
|
|
31
|
+
hash ^= BigInt(serialized.charCodeAt(index));
|
|
32
|
+
hash = BigInt.asUintN(64, hash * 0x100000001b3n);
|
|
33
|
+
}
|
|
34
|
+
return `fnv1a64:${hash.toString(16).padStart(16, "0")}`;
|
|
35
|
+
}
|
|
36
|
+
function toolInputValuesMatch(left, right) {
|
|
37
|
+
if (Object.is(left, right))
|
|
38
|
+
return true;
|
|
39
|
+
if (Array.isArray(left) || Array.isArray(right)) {
|
|
40
|
+
return (Array.isArray(left) &&
|
|
41
|
+
Array.isArray(right) &&
|
|
42
|
+
left.length === right.length &&
|
|
43
|
+
left.every((value, index) => toolInputValuesMatch(value, right[index])));
|
|
44
|
+
}
|
|
45
|
+
if (left === null ||
|
|
46
|
+
right === null ||
|
|
47
|
+
typeof left !== "object" ||
|
|
48
|
+
typeof right !== "object") {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
const leftKeys = Object.keys(left);
|
|
52
|
+
const rightKeys = Object.keys(right);
|
|
53
|
+
return (leftKeys.length === rightKeys.length &&
|
|
54
|
+
leftKeys.every((key) => Object.hasOwn(right, key) &&
|
|
55
|
+
toolInputValuesMatch(left[key], right[key])));
|
|
56
|
+
}
|
|
@@ -2,7 +2,6 @@ declare const _default: import("../../action.js").ActionDefinition<{
|
|
|
2
2
|
resourceType: string;
|
|
3
3
|
resourceId: string;
|
|
4
4
|
}, {
|
|
5
|
-
role?: undefined;
|
|
6
5
|
ownerEmail: any;
|
|
7
6
|
visibility: any;
|
|
8
7
|
shares: any[];
|
|
@@ -12,6 +11,7 @@ declare const _default: import("../../action.js").ActionDefinition<{
|
|
|
12
11
|
supportsGroupShares?: boolean;
|
|
13
12
|
};
|
|
14
13
|
orgId?: undefined;
|
|
14
|
+
role?: undefined;
|
|
15
15
|
agentReadable?: undefined;
|
|
16
16
|
} | {
|
|
17
17
|
ownerEmail: string;
|
package/dist/tracking/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { track, identify, flushTracking, registerTrackingProvider, unregisterTrackingProvider, listTrackingProviders, type TrackingMeta, type TrackingSource, } from "./registry.js";
|
|
2
2
|
export { registerBuiltinProviders } from "./providers.js";
|
|
3
|
+
export { readAnalyticsAnonymousId } from "../server/attribution.js";
|
|
3
4
|
export { AGENT_NATIVE_ACTION_EVENTS, AGENT_NATIVE_LIFECYCLE_EVENTS, trackActionEvent, trackLifecycleEvent, type AgentNativeActionEventName, type AgentNativeLifecycleEventName, } from "./lifecycle.js";
|
|
4
5
|
export { captureException, type TrackingExceptionContext, type TrackingExceptionLevel, } from "./error-capture.js";
|
|
5
6
|
export { classifyTrackingFailure, type TrackingFailureCategory, } from "./failure-category.js";
|
package/dist/tracking/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { track, identify, flushTracking, registerTrackingProvider, unregisterTrackingProvider, listTrackingProviders, } from "./registry.js";
|
|
2
2
|
export { registerBuiltinProviders } from "./providers.js";
|
|
3
|
+
export { readAnalyticsAnonymousId } from "../server/attribution.js";
|
|
3
4
|
export { AGENT_NATIVE_ACTION_EVENTS, AGENT_NATIVE_LIFECYCLE_EVENTS, trackActionEvent, trackLifecycleEvent, } from "./lifecycle.js";
|
|
4
5
|
export { captureException, } from "./error-capture.js";
|
|
5
6
|
export { classifyTrackingFailure, } from "./failure-category.js";
|
package/dist/vite/client.js
CHANGED
|
@@ -22,6 +22,7 @@ import { EMBED_SESSION_COOKIE, EMBED_TOKEN_QUERY_PARAM, MCP_APP_CHAT_BRIDGE_QUER
|
|
|
22
22
|
import { FRAMEWORK_INTERNAL_ROUTE_PREFIX, matchesPathPrefix, normalizeFrameworkRoutePrefix, } from "../shared/framework-route-prefix.js";
|
|
23
23
|
import { isMcpEmbedCorsOrigin, MCP_EMBED_CORS_ALLOW_HEADERS, MCP_EMBED_STATIC_ASSET_HEADERS, mcpEmbedStaticAssetRouteRules, shouldAllowMcpEmbedCredentials, } from "../shared/mcp-embed-headers.js";
|
|
24
24
|
import { normalizeMcpIntegrationsConfig, } from "../shared/mcp-integration-config.js";
|
|
25
|
+
import { getMissingCoreOptionalPeers } from "../shared/optional-peer-ssr.js";
|
|
25
26
|
import { isMissingPeer } from "../shared/optional-peer.js";
|
|
26
27
|
import { normalizeAgentNativeRouteWarmupConfig, } from "../shared/route-warmup-config.js";
|
|
27
28
|
import { AGENT_NATIVE_TYPEGEN_ENV, formatRuntimeConfigReport, getRuntimeConfigReport, isTruthyRuntimeValue, } from "../shared/runtime-config.js";
|
|
@@ -2229,6 +2230,41 @@ function ssrStubPlugin(packages) {
|
|
|
2229
2230
|
},
|
|
2230
2231
|
};
|
|
2231
2232
|
}
|
|
2233
|
+
function toolkitTablerIconSsrStubPlugin(cwd) {
|
|
2234
|
+
const toolkitRoot = findToolkitPackageRoot(cwd);
|
|
2235
|
+
if (!toolkitRoot)
|
|
2236
|
+
return null;
|
|
2237
|
+
const catalogPaths = new Set([
|
|
2238
|
+
path.join(toolkitRoot, "src/icons/catalog.ts"),
|
|
2239
|
+
path.join(toolkitRoot, "dist/icons/catalog.js"),
|
|
2240
|
+
]
|
|
2241
|
+
.filter((catalogPath) => fs.existsSync(catalogPath))
|
|
2242
|
+
.map((catalogPath) => fs.realpathSync(catalogPath)));
|
|
2243
|
+
const stubId = "\0agent-native-toolkit-tabler-chunk-loaders-ssr";
|
|
2244
|
+
return {
|
|
2245
|
+
name: "agent-native-toolkit-tabler-chunk-loaders-ssr",
|
|
2246
|
+
enforce: "pre",
|
|
2247
|
+
resolveId(id, importer, options) {
|
|
2248
|
+
if (!options?.ssr || id !== "./tabler-chunk-loaders.js" || !importer) {
|
|
2249
|
+
return null;
|
|
2250
|
+
}
|
|
2251
|
+
const importerPath = path.resolve(importer.split("?")[0]);
|
|
2252
|
+
if (!fs.existsSync(importerPath) ||
|
|
2253
|
+
!catalogPaths.has(fs.realpathSync(importerPath))) {
|
|
2254
|
+
return null;
|
|
2255
|
+
}
|
|
2256
|
+
return stubId;
|
|
2257
|
+
},
|
|
2258
|
+
load(id) {
|
|
2259
|
+
if (id !== stubId)
|
|
2260
|
+
return null;
|
|
2261
|
+
return [
|
|
2262
|
+
'const unavailable = () => { throw new Error("Tabler icons are available only in the browser"); };',
|
|
2263
|
+
"export default unavailable;",
|
|
2264
|
+
].join("\n");
|
|
2265
|
+
},
|
|
2266
|
+
};
|
|
2267
|
+
}
|
|
2232
2268
|
function enterpriseAuthAdapterStubPlugin(enabled) {
|
|
2233
2269
|
if (enabled)
|
|
2234
2270
|
return null;
|
|
@@ -3613,6 +3649,7 @@ function createAgentNativePlugins(options, { command, includeReactTransform, use
|
|
|
3613
3649
|
...(options.ssrStubs ?? []),
|
|
3614
3650
|
]),
|
|
3615
3651
|
enterpriseAuthAdapterStubPlugin(enterpriseAuthAdaptersEnabled),
|
|
3652
|
+
toolkitTablerIconSsrStubPlugin(cwd),
|
|
3616
3653
|
clientOptionalPeerStubPlugin(cwd),
|
|
3617
3654
|
...userPlugins,
|
|
3618
3655
|
externalStoreShimPlugin(),
|
|
@@ -3696,8 +3733,12 @@ function reportRuntimeConfigDiagnostics(appConfig, context, mode, env = process.
|
|
|
3696
3733
|
}
|
|
3697
3734
|
console.warn(message);
|
|
3698
3735
|
}
|
|
3699
|
-
function createAgentNativeConfig(options = {}, command, userConfig = {}, mode = process.env.NODE_ENV === "production" ? "production" : "development", projectConfig, workspaceConfig) {
|
|
3736
|
+
function createAgentNativeConfig(options = {}, command, userConfig = {}, mode = process.env.NODE_ENV === "production" ? "production" : "development", projectConfig, workspaceConfig, isSsrBuild = false) {
|
|
3700
3737
|
const cwd = process.cwd();
|
|
3738
|
+
const optionalSsrExternals = isBuildCommand(command)
|
|
3739
|
+
? getMissingCoreOptionalPeers(cwd)
|
|
3740
|
+
: [];
|
|
3741
|
+
const optionalBuildExternals = isSsrBuild ? optionalSsrExternals : [];
|
|
3701
3742
|
const usesAgentKit = hasDep("@agent-native/agentkit", cwd);
|
|
3702
3743
|
const configContext = createAgentNativeConfigContext(command, mode);
|
|
3703
3744
|
const projectConfigInput = projectConfig ?? options.agentNativeConfig;
|
|
@@ -3894,8 +3935,9 @@ function createAgentNativeConfig(options = {}, command, userConfig = {}, mode =
|
|
|
3894
3935
|
build: {
|
|
3895
3936
|
...userBuild,
|
|
3896
3937
|
rolldownOptions: {
|
|
3938
|
+
external: optionalBuildExternals,
|
|
3897
3939
|
experimental: {
|
|
3898
|
-
lazyBarrel:
|
|
3940
|
+
lazyBarrel: _buildRolldownOptions?.experimental?.lazyBarrel ?? true,
|
|
3899
3941
|
},
|
|
3900
3942
|
},
|
|
3901
3943
|
outDir: options.outDir ?? userConfig.build?.outDir ?? "dist/spa",
|
|
@@ -3911,6 +3953,7 @@ function createAgentNativeConfig(options = {}, command, userConfig = {}, mode =
|
|
|
3911
3953
|
...(userConfig.ssr ?? {}),
|
|
3912
3954
|
noExternal: /^(?!(?:react|react-dom|react-router|@tanstack\/react-query)(?:\/|$))(?!node:)/,
|
|
3913
3955
|
external: [
|
|
3956
|
+
...optionalSsrExternals,
|
|
3914
3957
|
"yjs",
|
|
3915
3958
|
"@agent-native/core",
|
|
3916
3959
|
"react",
|
|
@@ -4015,7 +4058,7 @@ function createAgentNativeConfigPlugin(options) {
|
|
|
4015
4058
|
const workspaceConfig = await loadWorkspaceAgentNativeConfigFile(process.cwd());
|
|
4016
4059
|
const projectConfig = options.agentNativeConfig ??
|
|
4017
4060
|
(await loadAgentNativeConfigFile(process.cwd()));
|
|
4018
|
-
return createAgentNativeConfig(options, env.command, config, env.mode, projectConfig, workspaceConfig);
|
|
4061
|
+
return createAgentNativeConfig(options, env.command, config, env.mode, projectConfig, workspaceConfig, env.isSsrBuild === true);
|
|
4019
4062
|
},
|
|
4020
4063
|
};
|
|
4021
4064
|
}
|