@agent-native/core 0.137.4 → 0.137.5
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/changelog/2026-08-04-signing-out-now-takes-effect-immediately-after-verifying-a-n.md +6 -0
- package/corpus/templates/clips/desktop/src/app.tsx +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/secrets/routes.d.ts +6 -6
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/auth.js +35 -13
- package/dist/server/better-auth-instance.d.ts +1 -0
- package/package.json +1 -1
package/corpus/README.md
CHANGED
|
@@ -1206,7 +1206,7 @@ export function App() {
|
|
|
1206
1206
|
try {
|
|
1207
1207
|
const res = await fetch(
|
|
1208
1208
|
`${serverUrl.replace(/\/+$/, "")}/_agent-native/auth/session`,
|
|
1209
|
-
{ credentials: "include" },
|
|
1209
|
+
{ credentials: "include", cache: "no-store" },
|
|
1210
1210
|
);
|
|
1211
1211
|
if (!res.ok) {
|
|
1212
1212
|
if (res.status === 401 || res.status === 403) {
|
|
@@ -62,11 +62,11 @@ export declare const postAwareness: import("h3").EventHandlerWithFetch<import("h
|
|
|
62
62
|
error: string;
|
|
63
63
|
states?: undefined;
|
|
64
64
|
} | {
|
|
65
|
+
error?: undefined;
|
|
65
66
|
states: {
|
|
66
67
|
clientId: number;
|
|
67
68
|
state: string;
|
|
68
69
|
}[];
|
|
69
|
-
error?: undefined;
|
|
70
70
|
}>>;
|
|
71
71
|
/**
|
|
72
72
|
* GET /_agent-native/collab/:docId/users
|
|
@@ -77,10 +77,10 @@ export declare const getActiveUsers: import("h3").EventHandlerWithFetch<import("
|
|
|
77
77
|
error: string;
|
|
78
78
|
users?: undefined;
|
|
79
79
|
} | {
|
|
80
|
+
error?: undefined;
|
|
80
81
|
users: {
|
|
81
82
|
clientId: number;
|
|
82
83
|
lastSeen: number;
|
|
83
84
|
}[];
|
|
84
|
-
error?: undefined;
|
|
85
85
|
}>>;
|
|
86
86
|
//# sourceMappingURL=awareness.d.ts.map
|
package/dist/collab/routes.d.ts
CHANGED
|
@@ -26,8 +26,8 @@ export declare const getCollabState: import("h3").EventHandlerWithFetch<import("
|
|
|
26
26
|
* Body: { update: string (base64), requestSource?: string }
|
|
27
27
|
*/
|
|
28
28
|
export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
29
|
-
ok?: undefined;
|
|
30
29
|
error: string;
|
|
30
|
+
ok?: undefined;
|
|
31
31
|
} | {
|
|
32
32
|
error?: undefined;
|
|
33
33
|
ok: boolean;
|
|
@@ -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;
|
package/dist/secrets/routes.d.ts
CHANGED
|
@@ -37,17 +37,17 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
|
|
|
37
37
|
status?: undefined;
|
|
38
38
|
ok?: undefined;
|
|
39
39
|
} | {
|
|
40
|
+
error?: undefined;
|
|
40
41
|
ok: boolean;
|
|
41
42
|
status: string;
|
|
42
|
-
error?: undefined;
|
|
43
43
|
} | {
|
|
44
44
|
error: string;
|
|
45
45
|
removed?: undefined;
|
|
46
46
|
ok?: undefined;
|
|
47
47
|
} | {
|
|
48
|
+
error?: undefined;
|
|
48
49
|
ok: boolean;
|
|
49
50
|
removed: boolean;
|
|
50
|
-
error?: undefined;
|
|
51
51
|
}>>;
|
|
52
52
|
/**
|
|
53
53
|
* POST /_agent-native/secrets/:key/test — validate an optional candidate value
|
|
@@ -58,13 +58,13 @@ export declare function createTestSecretHandler(): import("h3").EventHandlerWith
|
|
|
58
58
|
note?: undefined;
|
|
59
59
|
ok?: undefined;
|
|
60
60
|
} | {
|
|
61
|
+
error?: undefined;
|
|
61
62
|
ok: boolean;
|
|
62
63
|
note?: undefined;
|
|
63
|
-
error?: undefined;
|
|
64
64
|
} | {
|
|
65
|
+
error?: undefined;
|
|
65
66
|
ok: boolean;
|
|
66
67
|
note: string;
|
|
67
|
-
error?: undefined;
|
|
68
68
|
} | {
|
|
69
69
|
note?: undefined;
|
|
70
70
|
ok: boolean;
|
|
@@ -95,12 +95,12 @@ export interface AdHocSecretPayload {
|
|
|
95
95
|
export declare function createAdHocSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<AdHocSecretPayload[] | {
|
|
96
96
|
error: string;
|
|
97
97
|
} | {
|
|
98
|
+
error?: undefined;
|
|
98
99
|
ok: boolean;
|
|
99
100
|
key: string;
|
|
100
|
-
error?: undefined;
|
|
101
101
|
} | {
|
|
102
|
+
error?: undefined;
|
|
102
103
|
ok: boolean;
|
|
103
104
|
removed: boolean;
|
|
104
|
-
error?: undefined;
|
|
105
105
|
}>>;
|
|
106
106
|
//# 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/dist/server/auth.js
CHANGED
|
@@ -389,18 +389,18 @@ async function readDesktopSsoSafely(event) {
|
|
|
389
389
|
* user. Returns undefined if no session cookie was minted (the common
|
|
390
390
|
* case — Better Auth's reset doesn't auto-sign-in by default).
|
|
391
391
|
*/
|
|
392
|
+
function getSetCookieHeaders(headers) {
|
|
393
|
+
const responseHeaders = headers;
|
|
394
|
+
return typeof responseHeaders.getSetCookie === "function"
|
|
395
|
+
? responseHeaders.getSetCookie()
|
|
396
|
+
: (responseHeaders.get("set-cookie") ?? "")
|
|
397
|
+
.split(/,(?=[^;]+=)/)
|
|
398
|
+
.map((value) => value.trim())
|
|
399
|
+
.filter(Boolean);
|
|
400
|
+
}
|
|
392
401
|
function extractSessionTokenFromSetCookies(response) {
|
|
393
402
|
try {
|
|
394
|
-
|
|
395
|
-
// when available (Node 20+ / undici), else fall back to comma split.
|
|
396
|
-
const headers = response.headers;
|
|
397
|
-
const setCookies = typeof headers.getSetCookie === "function"
|
|
398
|
-
? headers.getSetCookie()
|
|
399
|
-
: (headers.get("set-cookie") ?? "")
|
|
400
|
-
.split(/,(?=[^;]+=)/)
|
|
401
|
-
.map((s) => s.trim())
|
|
402
|
-
.filter(Boolean);
|
|
403
|
-
for (const sc of setCookies) {
|
|
403
|
+
for (const sc of getSetCookieHeaders(response.headers)) {
|
|
404
404
|
// Better Auth's session cookie name is configurable but defaults to
|
|
405
405
|
// `<prefix>.session_token`. Match either the Better Auth default or
|
|
406
406
|
// our COOKIE_NAME (`an_session`) on the same line.
|
|
@@ -414,6 +414,16 @@ function extractSessionTokenFromSetCookies(response) {
|
|
|
414
414
|
}
|
|
415
415
|
return undefined;
|
|
416
416
|
}
|
|
417
|
+
function forwardBetterAuthSetCookies(event, result) {
|
|
418
|
+
if (!result || typeof result !== "object")
|
|
419
|
+
return;
|
|
420
|
+
const headers = result.headers;
|
|
421
|
+
if (!headers || typeof headers.get !== "function")
|
|
422
|
+
return;
|
|
423
|
+
for (const cookie of getSetCookieHeaders(headers)) {
|
|
424
|
+
event.res?.headers?.append("set-cookie", cookie);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
417
427
|
// ---------------------------------------------------------------------------
|
|
418
428
|
// ACCESS_TOKEN resolution
|
|
419
429
|
// ---------------------------------------------------------------------------
|
|
@@ -2762,7 +2772,11 @@ async function mountBetterAuthRoutes(app, options) {
|
|
|
2762
2772
|
clearFrameworkSessionCookies(event);
|
|
2763
2773
|
optOutOfAuthDisabledSession(event);
|
|
2764
2774
|
try {
|
|
2765
|
-
await auth.api.signOut({
|
|
2775
|
+
const result = await auth.api.signOut({
|
|
2776
|
+
headers: event.headers,
|
|
2777
|
+
returnHeaders: true,
|
|
2778
|
+
});
|
|
2779
|
+
forwardBetterAuthSetCookies(event, result);
|
|
2766
2780
|
}
|
|
2767
2781
|
catch {
|
|
2768
2782
|
// Ignore if no Better Auth session
|
|
@@ -2826,7 +2840,11 @@ async function mountBetterAuthRoutes(app, options) {
|
|
|
2826
2840
|
clearFrameworkSessionCookies(event);
|
|
2827
2841
|
optOutOfAuthDisabledSession(event);
|
|
2828
2842
|
try {
|
|
2829
|
-
await auth.api.signOut({
|
|
2843
|
+
const result = await auth.api.signOut({
|
|
2844
|
+
headers: event.headers,
|
|
2845
|
+
returnHeaders: true,
|
|
2846
|
+
});
|
|
2847
|
+
forwardBetterAuthSetCookies(event, result);
|
|
2830
2848
|
}
|
|
2831
2849
|
catch {
|
|
2832
2850
|
// Ignore — sessions are already gone in DB.
|
|
@@ -2981,7 +2999,11 @@ function mountAuthFallbackRoutes(app) {
|
|
|
2981
2999
|
optOutOfAuthDisabledSession(event);
|
|
2982
3000
|
try {
|
|
2983
3001
|
const auth = await getBetterAuth();
|
|
2984
|
-
await auth.api.signOut({
|
|
3002
|
+
const result = await auth.api.signOut({
|
|
3003
|
+
headers: event.headers,
|
|
3004
|
+
returnHeaders: true,
|
|
3005
|
+
});
|
|
3006
|
+
forwardBetterAuthSetCookies(event, result);
|
|
2985
3007
|
}
|
|
2986
3008
|
catch {
|
|
2987
3009
|
// Ignore if Better Auth is still unavailable
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.137.
|
|
3
|
+
"version": "0.137.5",
|
|
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": {
|