@agent-native/core 0.229.0 → 0.230.0-nightly-20261117004313
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/action.d.ts +23 -0
- package/dist/action.js +21 -0
- package/dist/agent/production-agent.d.ts +1 -0
- package/dist/agent/production-agent.js +28 -21
- package/dist/agent/types.d.ts +2 -0
- package/dist/app-config/deploy-cache.d.ts +2 -0
- package/dist/app-config/deploy-cache.js +8 -0
- package/dist/app-config/observability.d.ts +1 -0
- package/dist/app-config/observability.js +10 -0
- package/dist/app-config/schema.d.ts +3 -0
- package/dist/app-config/store.js +1 -0
- package/dist/cli/skills-content/design-remix-skill.d.ts +1 -1
- package/dist/cli/skills-content/design-remix-skill.js +193 -32
- package/dist/client/action-query-foreground.d.ts +4 -2
- package/dist/client/action-query-foreground.js +53 -6
- package/dist/client/hooks/index.d.ts +1 -0
- package/dist/client/hooks/index.js +1 -0
- package/dist/client/onboarding/first-run-status.js +4 -0
- package/dist/client/org/hooks.d.ts +12 -1
- package/dist/client/org/hooks.js +24 -2
- package/dist/client/sharing/useShareButtonController.d.ts +8 -1
- package/dist/client/sharing/useShareButtonController.js +20 -13
- package/dist/client/theme.d.ts +9 -1
- package/dist/client/theme.js +15 -2
- package/dist/client/ui/index.d.ts +1 -1
- package/dist/client/ui/index.js +1 -1
- package/dist/client/use-action.d.ts +8 -0
- package/dist/client/use-action.js +20 -3
- package/dist/collab/routes.d.ts +1 -1
- package/dist/db/create-get-db.d.ts +2 -1
- package/dist/db/create-get-db.js +99 -14
- package/dist/deploy/build-cache.js +10 -0
- package/dist/deploy/build.js +44 -5
- package/dist/deploy/workspace-deploy.js +46 -1
- package/dist/extensions/url-safety.d.ts +2 -0
- package/dist/extensions/url-safety.js +1 -0
- package/dist/framework-package-versions.json +7 -7
- package/dist/identity/offboard.d.ts +2 -0
- package/dist/identity/offboard.js +32 -0
- package/dist/org/auto-join-domain.js +11 -3
- package/dist/org/handlers.d.ts +16 -1
- package/dist/org/handlers.js +162 -42
- package/dist/org/index.d.ts +2 -1
- package/dist/org/index.js +1 -0
- package/dist/org/plugin.d.ts +2 -0
- package/dist/org/plugin.js +17 -1
- package/dist/org/types.d.ts +6 -0
- package/dist/provider-api/actions/custom-provider-registration.d.ts +16 -16
- package/dist/provider-api/actions/provider-api.d.ts +10 -10
- package/dist/resources/store.d.ts +5 -0
- package/dist/resources/store.js +54 -0
- package/dist/server/auth.js +3 -1
- package/dist/server/builder-browser.js +10 -1
- package/dist/server/document-build-id.d.ts +18 -0
- package/dist/server/document-build-id.js +43 -0
- package/dist/server/entry-server.js +3 -5
- package/dist/server/first-touch-route.d.ts +1 -1
- package/dist/server/onboarding-html.js +4 -3
- package/dist/server/workspace-provider-oauth.js +26 -6
- package/dist/sharing/actions/set-resource-visibility.js +36 -4
- package/dist/sharing/grant.js +10 -2
- package/dist/sharing/registry.d.ts +2 -0
- package/dist/templates/default/app/root.tsx +8 -2
- package/dist/triggers/dispatcher.d.ts +7 -0
- package/dist/triggers/dispatcher.js +13 -0
- package/dist/triggers/index.d.ts +1 -1
- package/dist/triggers/index.js +1 -1
- package/dist/user-profile/actions/update-user-profile.js +1 -1
- package/dist/vite/client.d.ts +2 -1
- package/dist/vite/client.js +5 -2
- package/dist/vitest-config.js +6 -0
- package/package.json +4 -4
- package/src/templates/default/app/root.tsx +8 -2
package/dist/org/plugin.js
CHANGED
|
@@ -4,7 +4,7 @@ import { awaitBootstrap, getH3App, FRAMEWORK_PREFIX, markDefaultPluginProvided,
|
|
|
4
4
|
import { listAppRolesHandler, setAppRoleHandler, getAppPermissionsHandler, setAppPermissionsHandler, resetAppPermissionHandler, } from "./app-roles-handlers.js";
|
|
5
5
|
import { listSSOProvidersHandler, createSSOProviderHandler, verifySSOProviderHandler, deleteSSOProviderHandler, getSCIMHandler, createSCIMHandler, deleteSCIMHandler, } from "./enterprise-auth-handlers.js";
|
|
6
6
|
import { CROSS_APP_ORG_FEDERATION_FLAG } from "./feature-flags.js";
|
|
7
|
-
import { getMyOrgHandler, createOrgHandler, updateOrgHandler, deleteOrgHandler, switchOrgHandler, listMembersHandler, removeMemberHandler, retryPendingFederatedRemovalHandler, changeMemberRoleHandler, listInvitationsHandler, createInvitationHandler, acceptInvitationHandler, cancelInvitationHandler, joinByDomainHandler, setDomainHandler, setWorkspaceUrlHandler, setRequiredAuthProviderHandler, setA2AMemberDelegationHandler, revealA2ASecretHandler, setA2ASecretHandler, syncA2ASecretHandler, receiveA2ASecretHandler, setWorkspaceAppDefaultVisibilityHandler, setOrgVisualIdentityHandler, } from "./handlers.js";
|
|
7
|
+
import { getMyOrgHandler, createOrgHandler, updateOrgHandler, deleteOrgHandler, switchOrgHandler, listMembersHandler, listDeactivatedMembersHandler, removeMemberHandler, leaveOrgHandler, retryPendingFederatedRemovalHandler, changeMemberRoleHandler, listInvitationsHandler, createInvitationHandler, acceptInvitationHandler, cancelInvitationHandler, joinByDomainHandler, setDomainHandler, setWorkspaceUrlHandler, setRequiredAuthProviderHandler, setA2AMemberDelegationHandler, revealA2ASecretHandler, setA2ASecretHandler, syncA2ASecretHandler, receiveA2ASecretHandler, setWorkspaceAppDefaultVisibilityHandler, setOrgVisualIdentityHandler, } from "./handlers.js";
|
|
8
8
|
import { schedulePreviewDevOrgMembership } from "./preview-dev-membership.js";
|
|
9
9
|
import { readWorkspacePrivateIconHandler, uploadWorkspacePrivateIconHandler, } from "./private-icon-handlers.js";
|
|
10
10
|
import { orgStore } from "./schema-store.js";
|
|
@@ -42,7 +42,9 @@ async function workspaceIconUploadResponse(event) {
|
|
|
42
42
|
* PATCH /_agent-native/org — rename organization (owner/admin)
|
|
43
43
|
* DELETE /_agent-native/org — delete organization (owner only)
|
|
44
44
|
* PUT /_agent-native/org/switch — switch active org
|
|
45
|
+
* POST /_agent-native/org/leave — leave the active org (not its owner)
|
|
45
46
|
* GET /_agent-native/org/members — list members of active org
|
|
47
|
+
* GET /_agent-native/org/members/deactivated — members removed with `deactivate`
|
|
46
48
|
* DELETE /_agent-native/org/members/:email — remove member (owner/admin only)
|
|
47
49
|
* POST /_agent-native/org/federation-removal/retry — retry the caller's pending self-cleanup
|
|
48
50
|
* GET /_agent-native/org/app-roles?appId=X — app role vocabulary + assignments
|
|
@@ -188,6 +190,13 @@ export function createOrgPlugin() {
|
|
|
188
190
|
}
|
|
189
191
|
return listMembersHandler(event);
|
|
190
192
|
}
|
|
193
|
+
if (tail === "/deactivated" || tail === "/deactivated/") {
|
|
194
|
+
if (method !== "GET") {
|
|
195
|
+
setResponseStatus(event, 405);
|
|
196
|
+
return { error: "Method not allowed" };
|
|
197
|
+
}
|
|
198
|
+
return listDeactivatedMembersHandler(event);
|
|
199
|
+
}
|
|
191
200
|
if (/^\/[^/]+\/role\/?$/.test(tail)) {
|
|
192
201
|
if (method !== "PUT") {
|
|
193
202
|
setResponseStatus(event, 405);
|
|
@@ -324,6 +333,13 @@ export function createOrgPlugin() {
|
|
|
324
333
|
}
|
|
325
334
|
return setRequiredAuthProviderHandler(event);
|
|
326
335
|
}));
|
|
336
|
+
app.use(`${ORG_PREFIX}/leave`, defineEventHandler(async (event) => {
|
|
337
|
+
if (getMethod(event) !== "POST") {
|
|
338
|
+
setResponseStatus(event, 405);
|
|
339
|
+
return { error: "Method not allowed" };
|
|
340
|
+
}
|
|
341
|
+
return leaveOrgHandler(event);
|
|
342
|
+
}));
|
|
327
343
|
app.use(`${ORG_PREFIX}/switch`, defineEventHandler(async (event) => {
|
|
328
344
|
if (getMethod(event) !== "PUT") {
|
|
329
345
|
setResponseStatus(event, 405);
|
package/dist/org/types.d.ts
CHANGED
|
@@ -83,6 +83,12 @@ export interface OrgMember {
|
|
|
83
83
|
name?: string | null;
|
|
84
84
|
image?: string | null;
|
|
85
85
|
}
|
|
86
|
+
/** A member removed with `deactivate`; they hold no membership. */
|
|
87
|
+
export interface OrgDeactivatedMember {
|
|
88
|
+
email: string;
|
|
89
|
+
role: "admin" | "member";
|
|
90
|
+
deactivatedAt: number;
|
|
91
|
+
}
|
|
86
92
|
export interface OrgPendingInvitation {
|
|
87
93
|
id: string;
|
|
88
94
|
email: string;
|
|
@@ -75,10 +75,7 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
75
75
|
user: "user";
|
|
76
76
|
}>>;
|
|
77
77
|
}, z.core.$strip>>, {
|
|
78
|
-
provider?: undefined;
|
|
79
78
|
id?: undefined;
|
|
80
|
-
message?: undefined;
|
|
81
|
-
deleted?: undefined;
|
|
82
79
|
providers: {
|
|
83
80
|
id: string;
|
|
84
81
|
label: string;
|
|
@@ -89,45 +86,48 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
89
86
|
updatedAt: number;
|
|
90
87
|
}[];
|
|
91
88
|
count: number;
|
|
89
|
+
provider?: undefined;
|
|
92
90
|
found?: undefined;
|
|
91
|
+
deleted?: undefined;
|
|
93
92
|
registered?: undefined;
|
|
94
93
|
label?: undefined;
|
|
94
|
+
message?: undefined;
|
|
95
95
|
} | {
|
|
96
96
|
id?: undefined;
|
|
97
|
-
message?: undefined;
|
|
98
|
-
count?: undefined;
|
|
99
|
-
deleted?: undefined;
|
|
100
97
|
providers?: undefined;
|
|
98
|
+
count?: undefined;
|
|
101
99
|
found: boolean;
|
|
102
100
|
provider: import("../custom-registry.js").CustomProviderConfig;
|
|
101
|
+
deleted?: undefined;
|
|
103
102
|
registered?: undefined;
|
|
104
103
|
label?: undefined;
|
|
105
|
-
} | {
|
|
106
|
-
provider?: undefined;
|
|
107
104
|
message?: undefined;
|
|
108
|
-
|
|
109
|
-
deleted?: undefined;
|
|
105
|
+
} | {
|
|
110
106
|
providers?: undefined;
|
|
107
|
+
count?: undefined;
|
|
108
|
+
provider?: undefined;
|
|
111
109
|
found: boolean;
|
|
112
110
|
id: string;
|
|
111
|
+
deleted?: undefined;
|
|
113
112
|
registered?: undefined;
|
|
114
113
|
label?: undefined;
|
|
115
|
-
} | {
|
|
116
|
-
provider?: undefined;
|
|
117
114
|
message?: undefined;
|
|
118
|
-
|
|
115
|
+
} | {
|
|
119
116
|
providers?: undefined;
|
|
117
|
+
count?: undefined;
|
|
118
|
+
provider?: undefined;
|
|
120
119
|
found?: undefined;
|
|
121
120
|
deleted: boolean;
|
|
122
121
|
id: string;
|
|
123
122
|
registered?: undefined;
|
|
124
123
|
label?: undefined;
|
|
124
|
+
message?: undefined;
|
|
125
125
|
} | {
|
|
126
|
-
provider?: undefined;
|
|
127
|
-
count?: undefined;
|
|
128
|
-
deleted?: undefined;
|
|
129
126
|
providers?: undefined;
|
|
127
|
+
count?: undefined;
|
|
128
|
+
provider?: undefined;
|
|
130
129
|
found?: undefined;
|
|
130
|
+
deleted?: undefined;
|
|
131
131
|
registered: boolean;
|
|
132
132
|
id: string;
|
|
133
133
|
label: string;
|
|
@@ -320,9 +320,8 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
320
320
|
notes?: string | undefined;
|
|
321
321
|
scope?: "org" | "user" | undefined;
|
|
322
322
|
}, {
|
|
323
|
-
deleted?: undefined;
|
|
324
323
|
id?: undefined;
|
|
325
|
-
|
|
324
|
+
deleted?: undefined;
|
|
326
325
|
message?: undefined;
|
|
327
326
|
providers: {
|
|
328
327
|
id: string;
|
|
@@ -334,34 +333,35 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
334
333
|
updatedAt: number;
|
|
335
334
|
}[];
|
|
336
335
|
count: number;
|
|
336
|
+
provider?: undefined;
|
|
337
337
|
found?: undefined;
|
|
338
338
|
registered?: undefined;
|
|
339
339
|
label?: undefined;
|
|
340
340
|
} | {
|
|
341
|
-
deleted?: undefined;
|
|
342
341
|
id?: undefined;
|
|
342
|
+
deleted?: undefined;
|
|
343
343
|
message?: undefined;
|
|
344
|
-
count?: undefined;
|
|
345
344
|
providers?: undefined;
|
|
345
|
+
count?: undefined;
|
|
346
346
|
found: boolean;
|
|
347
347
|
provider: import("../custom-registry.js").CustomProviderConfig;
|
|
348
348
|
registered?: undefined;
|
|
349
349
|
label?: undefined;
|
|
350
350
|
} | {
|
|
351
351
|
deleted?: undefined;
|
|
352
|
-
provider?: undefined;
|
|
353
352
|
message?: undefined;
|
|
354
|
-
count?: undefined;
|
|
355
353
|
providers?: undefined;
|
|
354
|
+
count?: undefined;
|
|
355
|
+
provider?: undefined;
|
|
356
356
|
found: boolean;
|
|
357
357
|
id: string;
|
|
358
358
|
registered?: undefined;
|
|
359
359
|
label?: undefined;
|
|
360
360
|
} | {
|
|
361
|
-
provider?: undefined;
|
|
362
361
|
message?: undefined;
|
|
363
|
-
count?: undefined;
|
|
364
362
|
providers?: undefined;
|
|
363
|
+
count?: undefined;
|
|
364
|
+
provider?: undefined;
|
|
365
365
|
found?: undefined;
|
|
366
366
|
deleted: boolean;
|
|
367
367
|
id: string;
|
|
@@ -369,9 +369,9 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
369
369
|
label?: undefined;
|
|
370
370
|
} | {
|
|
371
371
|
deleted?: undefined;
|
|
372
|
-
provider?: undefined;
|
|
373
|
-
count?: undefined;
|
|
374
372
|
providers?: undefined;
|
|
373
|
+
count?: undefined;
|
|
374
|
+
provider?: undefined;
|
|
375
375
|
found?: undefined;
|
|
376
376
|
registered: boolean;
|
|
377
377
|
id: string;
|
|
@@ -267,6 +267,11 @@ export declare function resourceListAllOwnersWithFingerprint(pathPrefix: string)
|
|
|
267
267
|
fingerprint: string;
|
|
268
268
|
}>;
|
|
269
269
|
export declare function resourceMove(id: string, newPath: string): Promise<boolean>;
|
|
270
|
+
/**
|
|
271
|
+
* Move a database-backed resource while its identity, version, content, and
|
|
272
|
+
* metadata still match.
|
|
273
|
+
*/
|
|
274
|
+
export declare function resourceMoveIfCurrent(current: Resource, newPath: string): Promise<Resource | null>;
|
|
270
275
|
/**
|
|
271
276
|
* Which of `paths` already hold something a resource stored for `owner`
|
|
272
277
|
* would land on if it moved there. For a local workspace file
|
package/dist/resources/store.js
CHANGED
|
@@ -2664,6 +2664,60 @@ export async function resourceMove(id, newPath) {
|
|
|
2664
2664
|
}
|
|
2665
2665
|
return moved;
|
|
2666
2666
|
}
|
|
2667
|
+
/**
|
|
2668
|
+
* Move a database-backed resource while its identity, version, content, and
|
|
2669
|
+
* metadata still match.
|
|
2670
|
+
*/
|
|
2671
|
+
export async function resourceMoveIfCurrent(current, newPath) {
|
|
2672
|
+
if (isWorkspaceResourceOwner(current.owner)) {
|
|
2673
|
+
throw new Error("Workspace resources cannot be moved with resourceMoveIfCurrent");
|
|
2674
|
+
}
|
|
2675
|
+
if (!newPath ||
|
|
2676
|
+
newPath.startsWith("/") ||
|
|
2677
|
+
newPath.includes("\\") ||
|
|
2678
|
+
newPath.split("/").some((part) => !part || part === "." || part === "..") ||
|
|
2679
|
+
/[\x00-\x1f\x7f]/.test(newPath)) {
|
|
2680
|
+
throw new Error("Invalid resource path");
|
|
2681
|
+
}
|
|
2682
|
+
if (newPath === current.path)
|
|
2683
|
+
return null;
|
|
2684
|
+
await ensureTable();
|
|
2685
|
+
const updatedAt = Math.max(Date.now(), current.updatedAt + 1);
|
|
2686
|
+
let result;
|
|
2687
|
+
try {
|
|
2688
|
+
result = await getDbExec().execute({
|
|
2689
|
+
sql: `UPDATE resources SET path = ?, updated_at = ? WHERE id = ? AND owner = ? AND path = ? AND updated_at = ? AND content = ? AND metadata IS NOT DISTINCT FROM ? AND NOT EXISTS (SELECT 1 FROM resources AS destination WHERE destination.owner = resources.owner AND destination.path = ?) RETURNING *`,
|
|
2690
|
+
args: [
|
|
2691
|
+
newPath,
|
|
2692
|
+
updatedAt,
|
|
2693
|
+
current.id,
|
|
2694
|
+
current.owner,
|
|
2695
|
+
current.path,
|
|
2696
|
+
current.updatedAt,
|
|
2697
|
+
current.content,
|
|
2698
|
+
current.metadata,
|
|
2699
|
+
newPath,
|
|
2700
|
+
],
|
|
2701
|
+
});
|
|
2702
|
+
}
|
|
2703
|
+
catch (error) {
|
|
2704
|
+
// A concurrent insert can win the destination's unique (owner, path) key
|
|
2705
|
+
// after the statement snapshot; PostgreSQL then rejects this whole update.
|
|
2706
|
+
if (typeof error === "object" &&
|
|
2707
|
+
error !== null &&
|
|
2708
|
+
"code" in error &&
|
|
2709
|
+
error.code === "23505") {
|
|
2710
|
+
return null;
|
|
2711
|
+
}
|
|
2712
|
+
throw error;
|
|
2713
|
+
}
|
|
2714
|
+
const row = result.rows[0];
|
|
2715
|
+
if (!row)
|
|
2716
|
+
return null;
|
|
2717
|
+
const moved = rowToResource(row);
|
|
2718
|
+
emitResourceChange(moved.id, moved.path, moved.owner);
|
|
2719
|
+
return moved;
|
|
2720
|
+
}
|
|
2667
2721
|
/**
|
|
2668
2722
|
* Which of `paths` already hold something a resource stored for `owner`
|
|
2669
2723
|
* would land on if it moved there. For a local workspace file
|
package/dist/server/auth.js
CHANGED
|
@@ -18,6 +18,7 @@ import { bindBuilderSignupAttempt, startBuilderSignupForVerifiedSession, builder
|
|
|
18
18
|
import { createConsentHandler, createConsentRegionHandler, requestAllowsConsentCategory, } from "./consent-route.js";
|
|
19
19
|
import { readDevActionDiscoveryFile } from "./dev-action-discovery.js";
|
|
20
20
|
import { devLoopbackAuthHint } from "./dev-origin-hint.js";
|
|
21
|
+
import { documentBuildIdMetaTag } from "./document-build-id.js";
|
|
21
22
|
import { EMAIL_AUTH_LINK_LANDING_PATH, emailAuthLinkFields, emailAuthLinkLandingPage, emailAuthVerificationPath, emailAuthVerificationUrl, } from "./email-auth-links.js";
|
|
22
23
|
import { isEmbedCapabilityScope, declaresWorkspaceAppChatCredential, revokeEmbedSessionsForOwners, requestHasEmbedAuthMarker, resolveEmbedSessionCookieOwners, resolveEmbedSessionFromRequest, verifyEmbedSessionToken, } from "./embed-session.js";
|
|
23
24
|
import { getEmbeddedHostOrgScope, preserveEmbeddedHostOrgScope, } from "./embedded-org-scope.js";
|
|
@@ -2924,7 +2925,7 @@ function desktopMagicLinkLandingPage(actionUrl, fields) {
|
|
|
2924
2925
|
const hiddenInputs = Object.entries(fields)
|
|
2925
2926
|
.map(([name, value]) => `<input type="hidden" name="${escapeHtmlAttr(name)}" value="${escapeHtmlAttr(value)}">`)
|
|
2926
2927
|
.join("");
|
|
2927
|
-
const html = `<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"
|
|
2928
|
+
const html = `<!DOCTYPE html><html lang="en"><head><meta charset="utf-8">${documentBuildIdMetaTag()}<meta name="viewport" content="width=device-width,initial-scale=1"><title>Continue sign-in</title></head><body><main><h1>Continue signing in</h1><p>Click continue to finish signing in to the Agent-Native desktop app.</p><form method="post" action="${safeActionUrl}" autocomplete="off">${hiddenInputs}<button type="submit">Continue</button></form></main></body></html>`;
|
|
2928
2929
|
return new Response(html, {
|
|
2929
2930
|
status: 200,
|
|
2930
2931
|
headers: {
|
|
@@ -4291,6 +4292,7 @@ function getCustomAuthRequiredHtml() {
|
|
|
4291
4292
|
<html lang="en">
|
|
4292
4293
|
<head>
|
|
4293
4294
|
<meta charset="UTF-8">
|
|
4295
|
+
${documentBuildIdMetaTag()}
|
|
4294
4296
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
4295
4297
|
<title>Authentication required</title>
|
|
4296
4298
|
<style>
|
|
@@ -1326,7 +1326,16 @@ export function resolveBuilderCallbackReturnUrl(options) {
|
|
|
1326
1326
|
const BUILDER_CALLBACK_THEME_SCRIPT = `<script>
|
|
1327
1327
|
(function () {
|
|
1328
1328
|
try {
|
|
1329
|
-
var stored =
|
|
1329
|
+
var stored = null;
|
|
1330
|
+
if (window.localStorage) {
|
|
1331
|
+
for (var i = 0; i < window.localStorage.length; i++) {
|
|
1332
|
+
var key = window.localStorage.key(i);
|
|
1333
|
+
if (key === "theme" || (key && key.slice(-6) === ":theme")) {
|
|
1334
|
+
var value = window.localStorage.getItem(key);
|
|
1335
|
+
if (value === "light" || value === "dark") { stored = value; if (key === "theme") break; }
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1330
1339
|
var resolved;
|
|
1331
1340
|
if (stored === "light" || stored === "dark") {
|
|
1332
1341
|
resolved = stored;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The build id this server was built with. The bundler define is the normal
|
|
3
|
+
* source; the app config covers an unbundled server, where the define is absent.
|
|
4
|
+
*/
|
|
5
|
+
export declare function documentBuildId(): string;
|
|
6
|
+
/**
|
|
7
|
+
* The release a served document names. Under the per-app deploy cache the build
|
|
8
|
+
* id is a `content-<hash>` artifact id that no reader can tie to a commit, so
|
|
9
|
+
* the baked workspace commit wins and the build id is only the fallback.
|
|
10
|
+
*/
|
|
11
|
+
export declare function documentReleaseId(): string;
|
|
12
|
+
/**
|
|
13
|
+
* `<meta name="agent-native-build-sha">` for every document the framework
|
|
14
|
+
* serves, both the React Router documents and the hand-built auth pages, so a
|
|
15
|
+
* capture of any of them can be attributed to a release. Empty when the release
|
|
16
|
+
* is unknown: the marker is never written as an empty or "undefined" value.
|
|
17
|
+
*/
|
|
18
|
+
export declare function documentBuildIdMetaTag(): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getAppConfig } from "../app-config/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* The build id this server was built with. The bundler define is the normal
|
|
4
|
+
* source; the app config covers an unbundled server, where the define is absent.
|
|
5
|
+
*/
|
|
6
|
+
export function documentBuildId() {
|
|
7
|
+
const raw = typeof __AGENT_NATIVE_BUILD_ID__ === "string"
|
|
8
|
+
? __AGENT_NATIVE_BUILD_ID__
|
|
9
|
+
: getAppConfig().observability.buildId;
|
|
10
|
+
return (raw ?? "").trim();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The release a served document names. Under the per-app deploy cache the build
|
|
14
|
+
* id is a `content-<hash>` artifact id that no reader can tie to a commit, so
|
|
15
|
+
* the baked workspace commit wins and the build id is only the fallback.
|
|
16
|
+
*/
|
|
17
|
+
export function documentReleaseId() {
|
|
18
|
+
const baked = typeof __AGENT_NATIVE_COMMIT_SHA__ === "string"
|
|
19
|
+
? __AGENT_NATIVE_COMMIT_SHA__.trim()
|
|
20
|
+
: "";
|
|
21
|
+
return (baked ||
|
|
22
|
+
(getAppConfig().observability.buildSha ?? "").trim() ||
|
|
23
|
+
documentBuildId());
|
|
24
|
+
}
|
|
25
|
+
function escapeAttribute(value) {
|
|
26
|
+
return value
|
|
27
|
+
.replace(/&/g, "&")
|
|
28
|
+
.replace(/"/g, """)
|
|
29
|
+
.replace(/</g, "<")
|
|
30
|
+
.replace(/>/g, ">");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* `<meta name="agent-native-build-sha">` for every document the framework
|
|
34
|
+
* serves, both the React Router documents and the hand-built auth pages, so a
|
|
35
|
+
* capture of any of them can be attributed to a release. Empty when the release
|
|
36
|
+
* is unknown: the marker is never written as an empty or "undefined" value.
|
|
37
|
+
*/
|
|
38
|
+
export function documentBuildIdMetaTag() {
|
|
39
|
+
const value = documentReleaseId();
|
|
40
|
+
if (!value)
|
|
41
|
+
return "";
|
|
42
|
+
return `<meta name="agent-native-build-sha" content="${escapeAttribute(value)}"/>`;
|
|
43
|
+
}
|
|
@@ -2,10 +2,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import ReactDOMServer from "react-dom/server.browser";
|
|
3
3
|
const { renderToReadableStream } = ReactDOMServer;
|
|
4
4
|
import { isbot } from "isbot";
|
|
5
|
-
import { getAppConfig } from "../app-config/index.js";
|
|
6
5
|
import { ROUTE_CHUNK_RECOVERY_BOOTSTRAP_SCRIPT } from "../shared/route-chunk-recovery-bootstrap.js";
|
|
7
6
|
import { getSsrSessionBootstrapScriptTag, SsrSessionBootstrapContext, } from "../shared/ssr-session-bootstrap-slot.js";
|
|
8
7
|
import { wrapWithAnalytics } from "./analytics.js";
|
|
8
|
+
import { documentBuildId, documentBuildIdMetaTag, } from "./document-build-id.js";
|
|
9
9
|
export const streamTimeout = 5_000;
|
|
10
10
|
const HEAD_OPEN_PATTERN = /<head\b[^>]*>/i;
|
|
11
11
|
/**
|
|
@@ -15,10 +15,7 @@ const HEAD_OPEN_PATTERN = /<head\b[^>]*>/i;
|
|
|
15
15
|
* stamp must never be written as the string "undefined".
|
|
16
16
|
*/
|
|
17
17
|
function buildIdStampScriptTag() {
|
|
18
|
-
const
|
|
19
|
-
? __AGENT_NATIVE_BUILD_ID__
|
|
20
|
-
: getAppConfig().observability.buildId;
|
|
21
|
-
const value = (raw ?? "").trim();
|
|
18
|
+
const value = documentBuildId();
|
|
22
19
|
return value
|
|
23
20
|
? `<script data-agent-native-build-id>globalThis.__AGENT_NATIVE_BUILD_ID__=${JSON.stringify(value)};</script>`
|
|
24
21
|
: "";
|
|
@@ -103,6 +100,7 @@ export function createDocumentRequestHandler(ServerRouter) {
|
|
|
103
100
|
responseHeaders.set("Content-Type", "text/html; charset=utf-8");
|
|
104
101
|
const headScripts = CHUNK_RECOVERY_BOOTSTRAP_TAG +
|
|
105
102
|
buildIdStampScriptTag() +
|
|
103
|
+
documentBuildIdMetaTag() +
|
|
106
104
|
(sessionPath ? getSsrSessionBootstrapScriptTag(sessionPath) : "");
|
|
107
105
|
return new Response(wrapWithAnalytics(installEarlyHeadScripts(body, headScripts)), {
|
|
108
106
|
headers: responseHeaders,
|
|
@@ -17,9 +17,9 @@ export type FirstTouchSyncResult = {
|
|
|
17
17
|
* browser's `an_ft` and `an_lt` again, so Safari keeps them their 30 days.
|
|
18
18
|
*/
|
|
19
19
|
export declare function createFirstTouchHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
20
|
-
stored?: undefined;
|
|
21
20
|
error: string;
|
|
22
21
|
reason?: undefined;
|
|
22
|
+
stored?: undefined;
|
|
23
23
|
firstTouch?: undefined;
|
|
24
24
|
} | {
|
|
25
25
|
error?: undefined;
|
|
@@ -10,6 +10,7 @@ import { AGENT_NATIVE_SOCIAL_IMAGE_ALT, AGENT_NATIVE_SOCIAL_IMAGE_HEIGHT, AGENT_
|
|
|
10
10
|
import { getAppBasePathFromViteEnv, normalizeAppBasePath, } from "./app-base-path.js";
|
|
11
11
|
import { AUTH_MARKETING_LOCALE_COPY, } from "./auth-marketing-locales.js";
|
|
12
12
|
import { resolveBuiltInAuthMarketing, resolveBuiltInAuthMarketingByName, resolveBuiltInAuthMarketingPresentation, resolveBuiltInAuthMarketingSlug, resolveBuiltInAuthMarketingSlugFromName, } from "./auth-marketing.js";
|
|
13
|
+
import { documentBuildIdMetaTag } from "./document-build-id.js";
|
|
13
14
|
import { resolveGoogleAuthMode, } from "./google-auth-mode.js";
|
|
14
15
|
import { hasGoogleSignInCredentials } from "./google-oauth-credentials.js";
|
|
15
16
|
import { isCanonicalIdentitySsoClientRequest, isCanonicalIdentitySsoClientConfigured, isIdentitySsoAvailableForRequest, isNetlifyDeployPermalinkIdentitySsoClientRequest, } from "./identity-sso-store.js";
|
|
@@ -2263,7 +2264,7 @@ export function getOnboardingHtml(opts = {}) {
|
|
|
2263
2264
|
: hasMarketing
|
|
2264
2265
|
? "has-marketing"
|
|
2265
2266
|
: "";
|
|
2266
|
-
return `<!DOCTYPE html><html lang="${DEFAULT_LOCALE}" dir="ltr"><head><meta charset="UTF-8"
|
|
2267
|
+
return `<!DOCTYPE html><html lang="${DEFAULT_LOCALE}" dir="ltr"><head><meta charset="UTF-8"/>${documentBuildIdMetaTag()}<script data-agent-native-locale-init="">${localeInitScript}</script><script data-agent-native-embedded-init="">${embeddedAuthInitScript}</script><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>${fontLinks}<title>${escapeHtml(title)}</title><link rel="icon" type="image/svg+xml" href="${escapeHtml(withAppBasePath("/favicon.svg", appBasePath))}"/><link rel="apple-touch-icon" href="${escapeHtml(withAppBasePath("/icon-180.svg", appBasePath))}"/>${marketingMeta}<style>${authDocumentStyles + authPageLayoutStyles}</style>${opts.authHeadHtml ?? ""}<script type="module" src="${escapeHtml(authClientScriptPath)}"></script></head><body${bodyClass ? ` class="${bodyClass}"` : ""}><div id="agent-native-auth-root" class="auth-root"${authPageMarkup === undefined ? ' data-agent-native-auth-fallback="true"' : ""}>${pageMarkup}</div><script type="application/json" id="agent-native-auth-data">${authPageData}</script></body></html>`;
|
|
2267
2268
|
}
|
|
2268
2269
|
const RESET_PASSWORD_STYLES = `
|
|
2269
2270
|
/* guard:allow-raw-color - standalone reset page has no app theme token layer */
|
|
@@ -2299,7 +2300,7 @@ export function getResetPasswordHtml(requestPath, renderResetPasswordPage) {
|
|
|
2299
2300
|
const pageMarkup = renderResetPasswordPage?.(resetPageProps);
|
|
2300
2301
|
const resetMarkup = pageMarkup ??
|
|
2301
2302
|
'<main class="card"><h1>Reset password</h1><p class="subtitle">Reset your password</p></main>';
|
|
2302
|
-
return `<!DOCTYPE html><html lang="en" dir="ltr"><head><meta charset="UTF-8"
|
|
2303
|
+
return `<!DOCTYPE html><html lang="en" dir="ltr"><head><meta charset="UTF-8"/>${documentBuildIdMetaTag()}<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/><title>Reset password</title><link rel="icon" type="image/svg+xml" href="${escapeHtml(withAppBasePath("/favicon.svg", appBasePath))}"/><link rel="apple-touch-icon" href="${escapeHtml(withAppBasePath("/icon-180.svg", appBasePath))}"/><style>${RESET_PASSWORD_STYLES}</style><script type="module" src="${escapeHtml(authClientAssetPath(appBasePath))}"></script></head><body><div id="agent-native-auth-root"${pageMarkup === undefined ? ' data-agent-native-auth-fallback="true"' : ""}>${resetMarkup}</div><script type="application/json" id="agent-native-auth-data">${serializeAuthPageData(resetPageProps)}</script></body></html>`;
|
|
2303
2304
|
}
|
|
2304
2305
|
// Read only by the server-rendered setup page, so it stays out of the auth
|
|
2305
2306
|
// copy every sign-in page ships to the browser.
|
|
@@ -2444,5 +2445,5 @@ export function getDeploySettingsRequiredHtml({ keys, locale, dir, requestPath,
|
|
|
2444
2445
|
.map((key) => `<code>${escapeHtml(key)}</code>`)
|
|
2445
2446
|
.join(", ");
|
|
2446
2447
|
const arrowIcon = '<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 7l-10 10"/><path d="M8 7l9 0l0 9"/></svg>';
|
|
2447
|
-
return `<!DOCTYPE html><html lang="${escapeHtml(locale)}" dir="${dir}"><head><meta charset="UTF-8"
|
|
2448
|
+
return `<!DOCTYPE html><html lang="${escapeHtml(locale)}" dir="${dir}"><head><meta charset="UTF-8"/>${documentBuildIdMetaTag()}<meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="robots" content="noindex, nofollow"/><title>${escapeHtml(copy.title)}</title><link rel="icon" type="image/svg+xml" href="${escapeHtml(withAppBasePath("/favicon.svg", appBasePath))}"/><style>${DEPLOY_SETTINGS_STYLES}</style></head><body><main class="card" data-testid="deploy-settings-required"><h1>${escapeHtml(copy.title)}</h1><p class="message">${escapeHtml(before)}${keyList}${escapeHtml(after)}</p><a class="docs-link" href="${escapeHtml(DEPLOY_SETTINGS_DOCS_URL)}" target="_blank" rel="noreferrer">${escapeHtml(copy.docsLink)}${arrowIcon}</a></main></body></html>`;
|
|
2448
2449
|
}
|
|
@@ -33,6 +33,27 @@ const SUPPORTED_PROVIDERS = new Set([
|
|
|
33
33
|
"notion",
|
|
34
34
|
"sigma",
|
|
35
35
|
]);
|
|
36
|
+
// Whether one upstream account (a portal, an org, a site) is linked by each
|
|
37
|
+
// user separately, so each owner gets its own token row. A provider that
|
|
38
|
+
// starts owner-scoping after connections were saved must keep those
|
|
39
|
+
// connections on their bare-id rows, which only their owner can rewrite.
|
|
40
|
+
const OWNER_SCOPED_ACCOUNTS = {
|
|
41
|
+
figma: false,
|
|
42
|
+
gmail: false,
|
|
43
|
+
google_calendar: false,
|
|
44
|
+
google_docs: false,
|
|
45
|
+
google_drive: false,
|
|
46
|
+
bigquery: false,
|
|
47
|
+
google_sheets: false,
|
|
48
|
+
google_slides: false,
|
|
49
|
+
github: false,
|
|
50
|
+
hubspot: true,
|
|
51
|
+
salesforce: true,
|
|
52
|
+
jira: true,
|
|
53
|
+
sentry: false,
|
|
54
|
+
notion: false,
|
|
55
|
+
sigma: true,
|
|
56
|
+
};
|
|
36
57
|
const FLOW_TTL_SECONDS = 10 * 60;
|
|
37
58
|
const PROVIDER_REQUEST_TIMEOUT_MS = 10_000;
|
|
38
59
|
const PROVIDER_RESPONSE_MAX_BYTES = 256 * 1024;
|
|
@@ -292,7 +313,10 @@ export async function handleWorkspaceProviderOAuthStart(event, providerId) {
|
|
|
292
313
|
redirectUri,
|
|
293
314
|
state,
|
|
294
315
|
challenge,
|
|
295
|
-
|
|
316
|
+
// Only a reconnect names its account. Hinting the signed-in user's own
|
|
317
|
+
// email on a plain connect pins Google to that account, so a second
|
|
318
|
+
// account can never be chosen.
|
|
319
|
+
loginHint: targetAccountEmail,
|
|
296
320
|
includeGrantedScopes: sharesGoogleTokenRow(provider),
|
|
297
321
|
...(requestedScopes || optionalScopes
|
|
298
322
|
? {
|
|
@@ -1032,12 +1056,8 @@ export function canConnectWorkspaceProviderOAuth(orgId, role) {
|
|
|
1032
1056
|
return Boolean(orgId) && (role === "owner" || role === "admin");
|
|
1033
1057
|
}
|
|
1034
1058
|
export function scopedOAuthAccountId(provider, owner, accountId) {
|
|
1035
|
-
if (provider
|
|
1036
|
-
provider !== "salesforce" &&
|
|
1037
|
-
provider !== "jira" &&
|
|
1038
|
-
provider !== "sigma") {
|
|
1059
|
+
if (!OWNER_SCOPED_ACCOUNTS[provider])
|
|
1039
1060
|
return accountId;
|
|
1040
|
-
}
|
|
1041
1061
|
const ownerKey = crypto
|
|
1042
1062
|
.createHash("sha256")
|
|
1043
1063
|
.update(`${provider}:${owner.trim().toLowerCase()}`)
|
|
@@ -107,6 +107,14 @@ export default defineAction({
|
|
|
107
107
|
}
|
|
108
108
|
return false;
|
|
109
109
|
},
|
|
110
|
+
approvalLabel: (args) => {
|
|
111
|
+
const name = requireShareableResource(args.resourceType).displayName.toLowerCase();
|
|
112
|
+
const count = requestedIds(args).length;
|
|
113
|
+
const what = count === 1 ? `this ${name}` : `${count} ${pluralResourceName(name)}`;
|
|
114
|
+
return args.role && args.role !== "viewer"
|
|
115
|
+
? `Make ${what} public, so anyone with the link can comment?`
|
|
116
|
+
: `Make ${what} public?`;
|
|
117
|
+
},
|
|
110
118
|
mcpAnnotations: {
|
|
111
119
|
readOnlyHint: false,
|
|
112
120
|
destructiveHint: true,
|
|
@@ -239,7 +247,14 @@ export default defineAction({
|
|
|
239
247
|
...change.update,
|
|
240
248
|
visibility: args.visibility,
|
|
241
249
|
};
|
|
242
|
-
await reg.assertSharingChange?.({
|
|
250
|
+
await reg.assertSharingChange?.({
|
|
251
|
+
resource,
|
|
252
|
+
change: {
|
|
253
|
+
kind: "grant",
|
|
254
|
+
principalType: grant.principalType,
|
|
255
|
+
principalId: grant.principalId,
|
|
256
|
+
},
|
|
257
|
+
});
|
|
243
258
|
const id = generalAccessShareId(grant.principalType, change.resourceId);
|
|
244
259
|
await db
|
|
245
260
|
.insert(reg.sharesTable)
|
|
@@ -268,7 +283,14 @@ export default defineAction({
|
|
|
268
283
|
.where(and(grantRows(change, grant), ne(reg.sharesTable.id, id)));
|
|
269
284
|
// The checks before the write miss a change that commits in between; a
|
|
270
285
|
// refusal or a newer visibility here is undone by the rollback.
|
|
271
|
-
await reg.assertSharingChange?.({
|
|
286
|
+
await reg.assertSharingChange?.({
|
|
287
|
+
resource,
|
|
288
|
+
change: {
|
|
289
|
+
kind: "grant",
|
|
290
|
+
principalType: grant.principalType,
|
|
291
|
+
principalId: grant.principalId,
|
|
292
|
+
},
|
|
293
|
+
});
|
|
272
294
|
const [current] = await db
|
|
273
295
|
.select({ visibility: reg.resourceTable.visibility })
|
|
274
296
|
.from(reg.resourceTable)
|
|
@@ -511,7 +533,13 @@ export default defineAction({
|
|
|
511
533
|
};
|
|
512
534
|
},
|
|
513
535
|
});
|
|
514
|
-
|
|
536
|
+
function pluralResourceName(name) {
|
|
537
|
+
return name.endsWith("y") ? `${name.slice(0, -1)}ies` : `${name}s`;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* One card for the whole call: the first resource's title, then how many more.
|
|
541
|
+
* The detail repeats the count, because a long title can cut off its end.
|
|
542
|
+
*/
|
|
515
543
|
function sharingChangeFor(reg, firstChanged, changedCount, detail) {
|
|
516
544
|
const first = resourceSharingChange(reg, firstChanged.access.resource, "updated", detail).change;
|
|
517
545
|
if (changedCount === 1)
|
|
@@ -521,7 +549,11 @@ function sharingChangeFor(reg, firstChanged, changedCount, detail) {
|
|
|
521
549
|
const title = first.title.length <= room
|
|
522
550
|
? first.title
|
|
523
551
|
: `${first.title.slice(0, room - 1).trimEnd()}…`;
|
|
524
|
-
return {
|
|
552
|
+
return {
|
|
553
|
+
...first,
|
|
554
|
+
title: `${title}${suffix}`,
|
|
555
|
+
detail: `${detail} · ${changedCount} changed`,
|
|
556
|
+
};
|
|
525
557
|
}
|
|
526
558
|
function batchRefusal(total, failures) {
|
|
527
559
|
const reasons = failures
|
package/dist/sharing/grant.js
CHANGED
|
@@ -123,7 +123,11 @@ export async function grantResourceAccess(input) {
|
|
|
123
123
|
// registration cannot be bypassed by a second entry point.
|
|
124
124
|
await reg.assertSharingChange?.({
|
|
125
125
|
resource: access.resource,
|
|
126
|
-
change: {
|
|
126
|
+
change: {
|
|
127
|
+
kind: "grant",
|
|
128
|
+
principalType: input.principalType,
|
|
129
|
+
principalId,
|
|
130
|
+
},
|
|
127
131
|
});
|
|
128
132
|
const extensionTargetsBefore = await getExtensionShareChangeTargets(input.resourceType, input.resourceId);
|
|
129
133
|
if (reg.requireOrgMemberForUserShares) {
|
|
@@ -220,7 +224,11 @@ export async function grantResourceAccess(input) {
|
|
|
220
224
|
try {
|
|
221
225
|
await reg.assertSharingChange?.({
|
|
222
226
|
resource: access.resource,
|
|
223
|
-
change: {
|
|
227
|
+
change: {
|
|
228
|
+
kind: "grant",
|
|
229
|
+
principalType: input.principalType,
|
|
230
|
+
principalId,
|
|
231
|
+
},
|
|
224
232
|
});
|
|
225
233
|
}
|
|
226
234
|
catch (error) {
|