@agent-native/core 0.137.7 → 0.137.8
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/corpus/README.md +1 -1
- package/corpus/templates/clips/app/components/recorder/pre-record-panel.tsx +65 -18
- package/corpus/templates/clips/app/i18n/en-US.ts +4 -0
- package/corpus/templates/clips/desktop/package.json +1 -0
- package/corpus/templates/clips/desktop/src/app.tsx +70 -6
- package/corpus/templates/clips/desktop/src/components/AlertDialog.tsx +131 -0
- package/corpus/templates/clips/desktop/src/styles.css +129 -0
- package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +2 -0
- package/corpus/templates/design/actions/generate-design.ts +3 -2
- package/corpus/templates/design/actions/update-design.ts +35 -14
- package/corpus/templates/design/app/components/design/DesignImportPanel.tsx +7 -2
- package/corpus/templates/design/app/components/design/FigmaHydrationDialog.tsx +11 -2
- package/corpus/templates/design/app/components/editor/PromptDialog.tsx +8 -1
- package/corpus/templates/design/app/i18n-data.ts +53 -22
- package/corpus/templates/design/app/lib/design-file-upload.ts +2 -3
- package/corpus/templates/design/app/lib/upload-limits.ts +4 -0
- package/corpus/templates/design/changelog/2026-08-05-chat-attachments-now-warn-before-upload-when-they-exceed-the.md +6 -0
- package/corpus/templates/design/changelog/2026-08-05-figma-fig-uploads-now-show-a-clear-4-mb-limit-up-front-inste.md +6 -0
- package/corpus/templates/design/server/handlers/import-design-file.ts +9 -5
- package/corpus/templates/design/server/handlers/uploads.ts +13 -9
- package/corpus/templates/design/server/lib/fig-file-limits.ts +2 -1
- package/corpus/templates/design/server/lib/figma-image-hydration.ts +1 -1
- package/corpus/templates/design/server/lib/request-body-limits.ts +11 -0
- package/corpus/templates/design/shared/canvas-frames.ts +81 -0
- package/dist/client/require-session.js +13 -4
- package/dist/client/use-session.d.ts +11 -0
- package/dist/client/use-session.js +34 -6
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/progress/routes.d.ts +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import type { AuthSession } from "../server/auth.js";
|
|
2
2
|
export type { AuthSession };
|
|
3
|
+
/**
|
|
4
|
+
* `"unavailable"` is the session endpoint being unreadable — a 5xx, a network
|
|
5
|
+
* failure, or a timeout. It is NOT the visitor being signed out, and a caller
|
|
6
|
+
* that collapses the two either strands the user on a spinner forever or
|
|
7
|
+
* bounces a signed-in user to the sign-in page over a transient blip.
|
|
8
|
+
*/
|
|
9
|
+
export type SessionStatus = "loading" | "authenticated" | "unauthenticated" | "unavailable";
|
|
3
10
|
interface UseSessionResult {
|
|
4
11
|
session: AuthSession | null;
|
|
5
12
|
isLoading: boolean;
|
|
13
|
+
status: SessionStatus;
|
|
14
|
+
error: Error | null;
|
|
15
|
+
/** Restart the resolve loop, e.g. from a "Try again" control. */
|
|
16
|
+
retry: () => void;
|
|
6
17
|
}
|
|
7
18
|
/**
|
|
8
19
|
* Client-side hook to get the current auth session.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
2
|
import { setSentryUser, trackSessionStatus } from "./analytics.js";
|
|
3
3
|
import { fetchAuthSessionStatus } from "./client-status-requests.js";
|
|
4
4
|
const SESSION_CACHE_TTL_MS = 30_000;
|
|
5
5
|
const SESSION_RETRY_DELAY_MS = 1_000;
|
|
6
|
+
const SESSION_MAX_ATTEMPTS = 4;
|
|
6
7
|
let cachedSession;
|
|
7
8
|
let cachedSessionAt = 0;
|
|
8
9
|
let sessionRequest;
|
|
@@ -65,22 +66,41 @@ function fetchSharedSession() {
|
|
|
65
66
|
export function useSession() {
|
|
66
67
|
const cached = hasFreshSessionCache() ? (cachedSession ?? null) : null;
|
|
67
68
|
const [session, setSession] = useState(cached);
|
|
68
|
-
const [
|
|
69
|
+
const [status, setStatus] = useState(() => {
|
|
70
|
+
if (!hasFreshSessionCache())
|
|
71
|
+
return "loading";
|
|
72
|
+
return cached ? "authenticated" : "unauthenticated";
|
|
73
|
+
});
|
|
74
|
+
const [error, setError] = useState(null);
|
|
75
|
+
const [retryToken, setRetryToken] = useState(0);
|
|
76
|
+
const retry = useCallback(() => {
|
|
77
|
+
setError(null);
|
|
78
|
+
setStatus("loading");
|
|
79
|
+
setRetryToken((token) => token + 1);
|
|
80
|
+
}, []);
|
|
69
81
|
useEffect(() => {
|
|
70
82
|
let cancelled = false;
|
|
71
83
|
let retryTimer;
|
|
84
|
+
let attempts = 0;
|
|
72
85
|
const resolveSession = async () => {
|
|
73
86
|
const resolved = await fetchSharedSession();
|
|
74
87
|
if (cancelled)
|
|
75
88
|
return;
|
|
76
89
|
if (resolved === undefined) {
|
|
90
|
+
attempts += 1;
|
|
91
|
+
if (attempts >= SESSION_MAX_ATTEMPTS) {
|
|
92
|
+
setError(new Error(`Could not read the session after ${attempts} attempts.`));
|
|
93
|
+
setStatus("unavailable");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
77
96
|
retryTimer = setTimeout(() => {
|
|
78
97
|
void resolveSession();
|
|
79
|
-
}, SESSION_RETRY_DELAY_MS);
|
|
98
|
+
}, SESSION_RETRY_DELAY_MS * attempts);
|
|
80
99
|
return;
|
|
81
100
|
}
|
|
82
101
|
setSession(resolved);
|
|
83
|
-
|
|
102
|
+
setError(null);
|
|
103
|
+
setStatus(resolved ? "authenticated" : "unauthenticated");
|
|
84
104
|
};
|
|
85
105
|
void resolveSession();
|
|
86
106
|
return () => {
|
|
@@ -88,7 +108,15 @@ export function useSession() {
|
|
|
88
108
|
if (retryTimer)
|
|
89
109
|
clearTimeout(retryTimer);
|
|
90
110
|
};
|
|
91
|
-
}, []);
|
|
92
|
-
|
|
111
|
+
}, [retryToken]);
|
|
112
|
+
// Callers that only read `isLoading`/`session` (most of the codebase, not
|
|
113
|
+
// yet migrated to `status`) must not see "unavailable" as "signed out" —
|
|
114
|
+
// that bounces an authenticated user through sign-in-only UI over a
|
|
115
|
+
// transient blip. Keeping `isLoading` true here reproduces this hook's
|
|
116
|
+
// pre-existing behavior for those callers (an indefinite "still resolving"
|
|
117
|
+
// instead of a wrong answer); only `status`-aware callers get the distinct
|
|
118
|
+
// "unavailable" treatment with a retry affordance.
|
|
119
|
+
const isLoading = status === "loading" || status === "unavailable";
|
|
120
|
+
return { session, isLoading, status, error, retry };
|
|
93
121
|
}
|
|
94
122
|
//# sourceMappingURL=use-session.js.map
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* Body: { json: any, fieldName?: string, type?: "map"|"array", requestSource?: string }
|
|
14
14
|
*/
|
|
15
15
|
export declare const postCollabJson: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
16
|
-
ok?: undefined;
|
|
17
16
|
error: string;
|
|
17
|
+
ok?: undefined;
|
|
18
18
|
} | {
|
|
19
19
|
error?: undefined;
|
|
20
20
|
ok: boolean;
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
export declare function createNotificationsHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<"" | import("./types.js").Notification[] | {
|
|
14
14
|
count: number;
|
|
15
15
|
updated?: undefined;
|
|
16
|
-
error?: undefined;
|
|
17
16
|
ok?: undefined;
|
|
17
|
+
error?: undefined;
|
|
18
18
|
} | {
|
|
19
19
|
count?: undefined;
|
|
20
20
|
updated: number;
|
|
21
|
-
error?: undefined;
|
|
22
21
|
ok?: undefined;
|
|
22
|
+
error?: undefined;
|
|
23
23
|
} | {
|
|
24
24
|
count?: undefined;
|
|
25
25
|
updated?: undefined;
|
|
@@ -28,7 +28,7 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
|
|
|
28
28
|
} | {
|
|
29
29
|
count?: undefined;
|
|
30
30
|
updated?: undefined;
|
|
31
|
-
error?: undefined;
|
|
32
31
|
ok: boolean;
|
|
32
|
+
error?: undefined;
|
|
33
33
|
}>>;
|
|
34
34
|
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -27,11 +27,11 @@ export declare function resolveAgentEngineApiKeyWriteTarget(event: H3Event, scop
|
|
|
27
27
|
export declare function createAgentEngineApiKeyHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
28
28
|
error: any;
|
|
29
29
|
} | {
|
|
30
|
-
error?: undefined;
|
|
31
30
|
ok: boolean;
|
|
32
31
|
key: string;
|
|
33
32
|
baseUrlKey?: string;
|
|
34
33
|
scope: AgentEngineApiKeyScope;
|
|
34
|
+
error?: undefined;
|
|
35
35
|
}>>;
|
|
36
36
|
export {};
|
|
37
37
|
//# sourceMappingURL=agent-engine-api-key-route.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.137.
|
|
3
|
+
"version": "0.137.8",
|
|
4
4
|
"description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|