@agent-native/core 0.157.12 → 0.157.13
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/collab/awareness.d.ts +2 -2
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/db/runtime-diagnostics.js +12 -0
- package/dist/deploy/workspace-deploy.js +21 -0
- package/dist/integrations/remote-device-migrations.d.ts +9 -0
- package/dist/integrations/remote-device-migrations.js +59 -0
- package/dist/mcp/screen-memory-stdio.d.ts +7 -7
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +3 -3
- package/dist/progress/routes.d.ts +1 -1
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/action-routes.js +8 -1
- package/dist/server/auth.d.ts +9 -0
- package/dist/server/auth.js +26 -2
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/release-migrations.js +4 -0
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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;
|
|
66
65
|
states: {
|
|
67
66
|
clientId: number;
|
|
68
67
|
state: string;
|
|
69
68
|
}[];
|
|
69
|
+
error?: undefined;
|
|
70
70
|
}>>;
|
|
71
71
|
/**
|
|
72
72
|
* GET /_agent-native/collab/:docId/users
|
|
@@ -77,9 +77,9 @@ export declare const getActiveUsers: import("h3").EventHandlerWithFetch<import("
|
|
|
77
77
|
error: string;
|
|
78
78
|
users?: undefined;
|
|
79
79
|
} | {
|
|
80
|
-
error?: undefined;
|
|
81
80
|
users: {
|
|
82
81
|
clientId: number;
|
|
83
82
|
lastSeen: number;
|
|
84
83
|
}[];
|
|
84
|
+
error?: undefined;
|
|
85
85
|
}>>;
|
|
@@ -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
|
-
error: string;
|
|
17
16
|
ok?: undefined;
|
|
17
|
+
error: string;
|
|
18
18
|
} | {
|
|
19
19
|
error?: undefined;
|
|
20
20
|
ok: boolean;
|
|
@@ -54,6 +54,18 @@ export const DEFAULT_REQUIRED_SCHEMA = [
|
|
|
54
54
|
table: "application_state",
|
|
55
55
|
columns: ["session_id", "key", "value", "updated_at"],
|
|
56
56
|
},
|
|
57
|
+
{
|
|
58
|
+
table: "integration_remote_devices",
|
|
59
|
+
columns: [
|
|
60
|
+
"id",
|
|
61
|
+
"owner_email",
|
|
62
|
+
"label",
|
|
63
|
+
"device_token_hash",
|
|
64
|
+
"status",
|
|
65
|
+
"created_at",
|
|
66
|
+
"updated_at",
|
|
67
|
+
],
|
|
68
|
+
},
|
|
57
69
|
];
|
|
58
70
|
function envValue(key) {
|
|
59
71
|
const value = process.env[key]?.trim();
|
|
@@ -52,6 +52,18 @@ const WORKSPACE_APPS_ENV_KEY = "AGENT_NATIVE_WORKSPACE_APPS_JSON";
|
|
|
52
52
|
const WORKSPACE_APPS_MANIFEST_DIR = ".agent-native";
|
|
53
53
|
const WORKSPACE_APPS_MANIFEST_FILE = "workspace-apps.json";
|
|
54
54
|
const VERCEL_OUTPUT_DIR = ".vercel/output";
|
|
55
|
+
const WORKSPACE_DIRECTORY_ENV_SNIPPET = `
|
|
56
|
+
const directoryOrigin =
|
|
57
|
+
processRef.env.AGENT_NATIVE_ORG_DIRECTORY_URL ||
|
|
58
|
+
processRef.env.WORKSPACE_GATEWAY_URL ||
|
|
59
|
+
processRef.env.APP_URL ||
|
|
60
|
+
processRef.env.URL ||
|
|
61
|
+
processRef.env.DEPLOY_URL ||
|
|
62
|
+
processRef.env.BETTER_AUTH_URL;
|
|
63
|
+
if (directoryOrigin) {
|
|
64
|
+
processRef.env.AGENT_NATIVE_ORG_DIRECTORY_URL = directoryOrigin;
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
55
67
|
export async function runWorkspaceDeploy(opts = {}) {
|
|
56
68
|
const workspaceRoot = opts.workspaceRoot ?? findWorkspaceRoot(process.cwd()) ?? process.cwd();
|
|
57
69
|
const appsDir = path.join(workspaceRoot, "apps");
|
|
@@ -149,6 +161,11 @@ function buildOneApp(workspaceRoot, app, preset, execFile, workspaceApps) {
|
|
|
149
161
|
VITE_AGENT_NATIVE_WORKSPACE_APP_PUBLIC_PATHS: JSON.stringify(workspaceAppRouteAccess.publicPaths),
|
|
150
162
|
VITE_AGENT_NATIVE_WORKSPACE_APP_PROTECTED_PATHS: JSON.stringify(workspaceAppRouteAccess.protectedPaths),
|
|
151
163
|
VITE_AGENT_NATIVE_WORKSPACE_APPS_JSON: JSON.stringify(workspaceApps),
|
|
164
|
+
...(workspaceGatewayUrl
|
|
165
|
+
? {
|
|
166
|
+
AGENT_NATIVE_ORG_DIRECTORY_URL: process.env.AGENT_NATIVE_ORG_DIRECTORY_URL || workspaceGatewayUrl,
|
|
167
|
+
}
|
|
168
|
+
: {}),
|
|
152
169
|
...(workspaceGatewayUrl
|
|
153
170
|
? {
|
|
154
171
|
WORKSPACE_GATEWAY_URL: process.env.WORKSPACE_GATEWAY_URL || workspaceGatewayUrl,
|
|
@@ -670,6 +687,7 @@ function processorPathFromBody(body) {
|
|
|
670
687
|
function setBasePathEnv() {
|
|
671
688
|
const processRef = globalThis.process ??= { env: {} };
|
|
672
689
|
processRef.env ??= {};
|
|
690
|
+
${WORKSPACE_DIRECTORY_ENV_SNIPPET}
|
|
673
691
|
Object.assign(processRef.env, {
|
|
674
692
|
AGENT_NATIVE_WORKSPACE: "1",
|
|
675
693
|
AGENT_NATIVE_WORKSPACE_APP_ID: ${JSON.stringify(app)},
|
|
@@ -755,6 +773,7 @@ globalThis.${INTEGRATION_RECOVERY_RUNTIME_MARKER} = true;
|
|
|
755
773
|
function setBasePathEnv() {
|
|
756
774
|
const processRef = globalThis.process ??= { env: {} };
|
|
757
775
|
processRef.env ??= {};
|
|
776
|
+
${WORKSPACE_DIRECTORY_ENV_SNIPPET}
|
|
758
777
|
Object.assign(processRef.env, {
|
|
759
778
|
AGENT_NATIVE_WORKSPACE: "1",
|
|
760
779
|
AGENT_NATIVE_WORKSPACE_APP_ID: ${JSON.stringify(app)},
|
|
@@ -855,6 +874,7 @@ function normalizeBasePathArgs(args) {
|
|
|
855
874
|
function setBasePathEnv() {
|
|
856
875
|
const processRef = globalThis.process ??= { env: {} };
|
|
857
876
|
processRef.env ??= {};
|
|
877
|
+
${WORKSPACE_DIRECTORY_ENV_SNIPPET}
|
|
858
878
|
Object.assign(processRef.env, {
|
|
859
879
|
AGENT_NATIVE_WORKSPACE: "1",
|
|
860
880
|
AGENT_NATIVE_WORKSPACE_APP_ID: ${JSON.stringify(app)},
|
|
@@ -914,6 +934,7 @@ function patchVercelFunctionEntry(functionDir, app, workspaceApps) {
|
|
|
914
934
|
function setBasePathEnv() {
|
|
915
935
|
const processRef = globalThis.process ??= { env: {} };
|
|
916
936
|
processRef.env ??= {};
|
|
937
|
+
${WORKSPACE_DIRECTORY_ENV_SNIPPET}
|
|
917
938
|
Object.assign(processRef.env, {
|
|
918
939
|
AGENT_NATIVE_WORKSPACE: "1",
|
|
919
940
|
AGENT_NATIVE_WORKSPACE_APP_ID: ${JSON.stringify(app)},
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MigrationEntry } from "../db/migrations.js";
|
|
2
|
+
/**
|
|
3
|
+
* Remote-device state is read on request paths, so its table must exist before
|
|
4
|
+
* production serverless functions serve requests. The store keeps its local
|
|
5
|
+
* development convergence path for older databases; release migrations own
|
|
6
|
+
* production schema.
|
|
7
|
+
*/
|
|
8
|
+
export declare const REMOTE_DEVICE_MIGRATIONS: MigrationEntry[];
|
|
9
|
+
export declare const REMOTE_DEVICE_MIGRATIONS_TABLE = "_remote_device_migrations";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remote-device state is read on request paths, so its table must exist before
|
|
3
|
+
* production serverless functions serve requests. The store keeps its local
|
|
4
|
+
* development convergence path for older databases; release migrations own
|
|
5
|
+
* production schema.
|
|
6
|
+
*/
|
|
7
|
+
export const REMOTE_DEVICE_MIGRATIONS = [
|
|
8
|
+
{
|
|
9
|
+
version: 1,
|
|
10
|
+
name: "remote-device-table-and-indexes",
|
|
11
|
+
sql: {
|
|
12
|
+
postgres: `
|
|
13
|
+
CREATE TABLE IF NOT EXISTS integration_remote_devices (
|
|
14
|
+
id TEXT PRIMARY KEY,
|
|
15
|
+
owner_email TEXT NOT NULL,
|
|
16
|
+
org_id TEXT,
|
|
17
|
+
label TEXT NOT NULL,
|
|
18
|
+
platform TEXT,
|
|
19
|
+
app_version TEXT,
|
|
20
|
+
host_name TEXT,
|
|
21
|
+
metadata_json TEXT,
|
|
22
|
+
device_token_hash TEXT NOT NULL,
|
|
23
|
+
last_seen_at BIGINT,
|
|
24
|
+
status TEXT NOT NULL,
|
|
25
|
+
revoked_at BIGINT,
|
|
26
|
+
created_at BIGINT NOT NULL,
|
|
27
|
+
updated_at BIGINT NOT NULL
|
|
28
|
+
);
|
|
29
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_remote_devices_token_hash
|
|
30
|
+
ON integration_remote_devices (device_token_hash);
|
|
31
|
+
CREATE INDEX IF NOT EXISTS idx_remote_devices_owner
|
|
32
|
+
ON integration_remote_devices (owner_email, org_id);
|
|
33
|
+
`,
|
|
34
|
+
sqlite: `
|
|
35
|
+
CREATE TABLE IF NOT EXISTS integration_remote_devices (
|
|
36
|
+
id TEXT PRIMARY KEY,
|
|
37
|
+
owner_email TEXT NOT NULL,
|
|
38
|
+
org_id TEXT,
|
|
39
|
+
label TEXT NOT NULL,
|
|
40
|
+
platform TEXT,
|
|
41
|
+
app_version TEXT,
|
|
42
|
+
host_name TEXT,
|
|
43
|
+
metadata_json TEXT,
|
|
44
|
+
device_token_hash TEXT NOT NULL,
|
|
45
|
+
last_seen_at INTEGER,
|
|
46
|
+
status TEXT NOT NULL,
|
|
47
|
+
revoked_at INTEGER,
|
|
48
|
+
created_at INTEGER NOT NULL,
|
|
49
|
+
updated_at INTEGER NOT NULL
|
|
50
|
+
);
|
|
51
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_remote_devices_token_hash
|
|
52
|
+
ON integration_remote_devices (device_token_hash);
|
|
53
|
+
CREATE INDEX IF NOT EXISTS idx_remote_devices_owner
|
|
54
|
+
ON integration_remote_devices (owner_email, org_id);
|
|
55
|
+
`,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
export const REMOTE_DEVICE_MIGRATIONS_TABLE = "_remote_device_migrations";
|
|
@@ -137,13 +137,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
137
137
|
inputSchema: {
|
|
138
138
|
type: string;
|
|
139
139
|
properties: {
|
|
140
|
-
count?: undefined;
|
|
141
140
|
query?: undefined;
|
|
142
141
|
minutes?: undefined;
|
|
143
142
|
limit?: undefined;
|
|
144
143
|
clientHint?: undefined;
|
|
145
144
|
timestamp?: undefined;
|
|
146
145
|
chapterId?: undefined;
|
|
146
|
+
count?: undefined;
|
|
147
147
|
startAt?: undefined;
|
|
148
148
|
endAt?: undefined;
|
|
149
149
|
reason?: undefined;
|
|
@@ -159,7 +159,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
159
159
|
inputSchema: {
|
|
160
160
|
type: string;
|
|
161
161
|
properties: {
|
|
162
|
-
count?: undefined;
|
|
163
162
|
query: {
|
|
164
163
|
type: string;
|
|
165
164
|
description: string;
|
|
@@ -175,6 +174,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
175
174
|
clientHint?: undefined;
|
|
176
175
|
timestamp?: undefined;
|
|
177
176
|
chapterId?: undefined;
|
|
177
|
+
count?: undefined;
|
|
178
178
|
startAt?: undefined;
|
|
179
179
|
endAt?: undefined;
|
|
180
180
|
reason?: undefined;
|
|
@@ -190,7 +190,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
190
190
|
inputSchema: {
|
|
191
191
|
type: string;
|
|
192
192
|
properties: {
|
|
193
|
-
count?: undefined;
|
|
194
193
|
minutes: {
|
|
195
194
|
type: string;
|
|
196
195
|
description: string;
|
|
@@ -200,6 +199,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
200
199
|
clientHint?: undefined;
|
|
201
200
|
timestamp?: undefined;
|
|
202
201
|
chapterId?: undefined;
|
|
202
|
+
count?: undefined;
|
|
203
203
|
startAt?: undefined;
|
|
204
204
|
endAt?: undefined;
|
|
205
205
|
reason?: undefined;
|
|
@@ -216,7 +216,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
216
216
|
type: string;
|
|
217
217
|
required: string[];
|
|
218
218
|
properties: {
|
|
219
|
-
count?: undefined;
|
|
220
219
|
query: {
|
|
221
220
|
type: string;
|
|
222
221
|
description: string;
|
|
@@ -235,6 +234,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
235
234
|
};
|
|
236
235
|
timestamp?: undefined;
|
|
237
236
|
chapterId?: undefined;
|
|
237
|
+
count?: undefined;
|
|
238
238
|
startAt?: undefined;
|
|
239
239
|
endAt?: undefined;
|
|
240
240
|
reason?: undefined;
|
|
@@ -250,7 +250,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
250
250
|
type: string;
|
|
251
251
|
required: string[];
|
|
252
252
|
properties: {
|
|
253
|
-
count?: undefined;
|
|
254
253
|
query?: undefined;
|
|
255
254
|
minutes?: undefined;
|
|
256
255
|
limit?: undefined;
|
|
@@ -264,6 +263,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
264
263
|
description: string;
|
|
265
264
|
};
|
|
266
265
|
chapterId?: undefined;
|
|
266
|
+
count?: undefined;
|
|
267
267
|
startAt?: undefined;
|
|
268
268
|
endAt?: undefined;
|
|
269
269
|
includeMicrophone?: undefined;
|
|
@@ -314,13 +314,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
314
314
|
type: string;
|
|
315
315
|
required: string[];
|
|
316
316
|
properties: {
|
|
317
|
-
count?: undefined;
|
|
318
317
|
query?: undefined;
|
|
319
318
|
minutes?: undefined;
|
|
320
319
|
limit?: undefined;
|
|
321
320
|
clientHint?: undefined;
|
|
322
321
|
timestamp?: undefined;
|
|
323
322
|
chapterId?: undefined;
|
|
323
|
+
count?: undefined;
|
|
324
324
|
startAt: {
|
|
325
325
|
type: string;
|
|
326
326
|
description: string;
|
|
@@ -349,13 +349,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
349
349
|
type: string;
|
|
350
350
|
required: string[];
|
|
351
351
|
properties: {
|
|
352
|
-
count?: undefined;
|
|
353
352
|
query?: undefined;
|
|
354
353
|
minutes?: undefined;
|
|
355
354
|
limit?: undefined;
|
|
356
355
|
clientHint?: undefined;
|
|
357
356
|
timestamp?: undefined;
|
|
358
357
|
chapterId?: undefined;
|
|
358
|
+
count?: undefined;
|
|
359
359
|
startAt?: undefined;
|
|
360
360
|
endAt?: undefined;
|
|
361
361
|
reason?: undefined;
|
|
@@ -16,18 +16,18 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
|
|
|
16
16
|
error?: undefined;
|
|
17
17
|
ok?: undefined;
|
|
18
18
|
} | {
|
|
19
|
-
count?: undefined;
|
|
20
19
|
updated: number;
|
|
21
20
|
error?: undefined;
|
|
22
21
|
ok?: undefined;
|
|
23
|
-
} | {
|
|
24
22
|
count?: undefined;
|
|
23
|
+
} | {
|
|
25
24
|
updated?: undefined;
|
|
26
25
|
error: string;
|
|
27
26
|
ok?: undefined;
|
|
28
|
-
} | {
|
|
29
27
|
count?: undefined;
|
|
28
|
+
} | {
|
|
30
29
|
updated?: undefined;
|
|
31
30
|
error?: undefined;
|
|
32
31
|
ok: boolean;
|
|
32
|
+
count?: undefined;
|
|
33
33
|
}>>;
|
|
@@ -41,23 +41,23 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
41
41
|
thumbsUpRate: number;
|
|
42
42
|
avgEvalScore: number;
|
|
43
43
|
} | {
|
|
44
|
+
ok?: undefined;
|
|
44
45
|
error?: undefined;
|
|
45
46
|
summary: import("./types.js").TraceSummary;
|
|
46
47
|
spans: import("./types.js").TraceSpan[];
|
|
47
48
|
id?: undefined;
|
|
48
|
-
ok?: undefined;
|
|
49
49
|
} | {
|
|
50
|
+
ok?: undefined;
|
|
50
51
|
error?: undefined;
|
|
51
52
|
summary?: undefined;
|
|
52
53
|
spans?: undefined;
|
|
53
54
|
id: string;
|
|
54
|
-
ok?: undefined;
|
|
55
55
|
} | {
|
|
56
|
+
ok?: undefined;
|
|
56
57
|
summary?: undefined;
|
|
57
58
|
spans?: undefined;
|
|
58
59
|
id?: undefined;
|
|
59
60
|
error: any;
|
|
60
|
-
ok?: undefined;
|
|
61
61
|
} | {
|
|
62
62
|
error?: undefined;
|
|
63
63
|
summary?: undefined;
|
|
@@ -48,8 +48,8 @@ export declare function handleUpdateResource(event: any): Promise<import("./stor
|
|
|
48
48
|
}>;
|
|
49
49
|
/** DELETE /_agent-native/resources/:id — delete a resource */
|
|
50
50
|
export declare function handleDeleteResource(event: any): Promise<{
|
|
51
|
-
error: string;
|
|
52
51
|
ok?: undefined;
|
|
52
|
+
error: string;
|
|
53
53
|
} | {
|
|
54
54
|
error?: undefined;
|
|
55
55
|
ok: boolean;
|
package/dist/secrets/routes.d.ts
CHANGED
|
@@ -34,37 +34,37 @@ export declare function createListSecretsHandler(): import("h3").EventHandlerWit
|
|
|
34
34
|
/** POST /_agent-native/secrets/:key — write a secret. */
|
|
35
35
|
export declare function createWriteSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
36
36
|
error: string;
|
|
37
|
-
status?: undefined;
|
|
38
37
|
ok?: undefined;
|
|
38
|
+
status?: undefined;
|
|
39
39
|
} | {
|
|
40
|
-
error?: undefined;
|
|
41
40
|
ok: boolean;
|
|
42
41
|
status: string;
|
|
42
|
+
error?: undefined;
|
|
43
43
|
} | {
|
|
44
|
+
ok?: undefined;
|
|
44
45
|
error: string;
|
|
45
46
|
removed?: undefined;
|
|
46
|
-
ok?: undefined;
|
|
47
47
|
} | {
|
|
48
|
-
error?: undefined;
|
|
49
48
|
ok: boolean;
|
|
50
49
|
removed: boolean;
|
|
50
|
+
error?: undefined;
|
|
51
51
|
}>>;
|
|
52
52
|
/**
|
|
53
53
|
* POST /_agent-native/secrets/:key/test — validate an optional candidate value
|
|
54
54
|
* or the current stored value without changing anything.
|
|
55
55
|
*/
|
|
56
56
|
export declare function createTestSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
57
|
+
ok?: undefined;
|
|
57
58
|
error: string;
|
|
58
59
|
note?: undefined;
|
|
59
|
-
ok?: undefined;
|
|
60
60
|
} | {
|
|
61
|
-
error?: undefined;
|
|
62
61
|
ok: boolean;
|
|
63
62
|
note?: undefined;
|
|
64
|
-
} | {
|
|
65
63
|
error?: undefined;
|
|
64
|
+
} | {
|
|
66
65
|
ok: boolean;
|
|
67
66
|
note: string;
|
|
67
|
+
error?: undefined;
|
|
68
68
|
} | {
|
|
69
69
|
note?: undefined;
|
|
70
70
|
ok: boolean;
|
|
@@ -95,11 +95,11 @@ 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;
|
|
99
98
|
ok: boolean;
|
|
100
99
|
key: string;
|
|
101
|
-
} | {
|
|
102
100
|
error?: undefined;
|
|
101
|
+
} | {
|
|
103
102
|
ok: boolean;
|
|
104
103
|
removed: boolean;
|
|
104
|
+
error?: undefined;
|
|
105
105
|
}>>;
|
|
@@ -33,7 +33,7 @@ function currentBuildId() {
|
|
|
33
33
|
* Actions are exposed as POST by default. Use `http: { method: "GET" }` in
|
|
34
34
|
* defineAction to expose as GET. Use `http: false` to mark as agent-only.
|
|
35
35
|
*/
|
|
36
|
-
import { isLoopbackRequest } from "./auth.js";
|
|
36
|
+
import { isLoopbackRequest, registerAuthPublicPaths } from "./auth.js";
|
|
37
37
|
import { getH3App } from "./framework-request-handler.js";
|
|
38
38
|
import { runWithRequestContext } from "./request-context.js";
|
|
39
39
|
const ROUTE_PREFIX = "/_agent-native/actions";
|
|
@@ -245,6 +245,13 @@ export function mountActionRoutes(nitroApp, actions, options) {
|
|
|
245
245
|
const method = entry.http?.method ?? "POST";
|
|
246
246
|
const path = entry.http?.path ?? name;
|
|
247
247
|
const routePath = `${ROUTE_PREFIX}/${path}`;
|
|
248
|
+
// These two actions authenticate with a scoped A2A bearer rather than a
|
|
249
|
+
// browser session. Let that verifier see the request before the cookie
|
|
250
|
+
// auth guard rejects it; the action route still fails closed on invalid
|
|
251
|
+
// or missing credentials.
|
|
252
|
+
if (name === "list-feature-flags" || name === "set-feature-flag") {
|
|
253
|
+
registerAuthPublicPaths([routePath]);
|
|
254
|
+
}
|
|
248
255
|
getH3App(nitroApp).use(routePath, defineEventHandler(async (event) => {
|
|
249
256
|
const reqMethod = getMethod(event);
|
|
250
257
|
const effectiveMethod = reqMethod === "HEAD" && method === "GET" ? "GET" : reqMethod;
|
package/dist/server/auth.d.ts
CHANGED
|
@@ -221,6 +221,15 @@ export declare function removeSession(token: string): Promise<void>;
|
|
|
221
221
|
* TTL and the only-cache-successes rule.
|
|
222
222
|
*/
|
|
223
223
|
export declare function getSessionEmail(token: string): Promise<string | null>;
|
|
224
|
+
/**
|
|
225
|
+
* Allow framework routes with their own non-cookie authentication to reach
|
|
226
|
+
* the handler. The handler remains responsible for verifying the credential.
|
|
227
|
+
*
|
|
228
|
+
* This is registered separately from template auth options because framework
|
|
229
|
+
* routes can be mounted after the auth plugin and must also work in custom
|
|
230
|
+
* workspace deployments that do not own a template auth file.
|
|
231
|
+
*/
|
|
232
|
+
export declare function registerAuthPublicPaths(paths: readonly string[]): void;
|
|
224
233
|
export interface DesktopExchangeErrorPayload {
|
|
225
234
|
message: string;
|
|
226
235
|
code?: string;
|
package/dist/server/auth.js
CHANGED
|
@@ -960,7 +960,31 @@ export async function getSessionEmail(token) {
|
|
|
960
960
|
// ---------------------------------------------------------------------------
|
|
961
961
|
let customGetSession = null;
|
|
962
962
|
let _authGuardConfig = null;
|
|
963
|
+
const _registeredAuthPublicPaths = new Set();
|
|
963
964
|
const _genericGoogleOAuthRoutesEnabled = new WeakMap();
|
|
965
|
+
/**
|
|
966
|
+
* Allow framework routes with their own non-cookie authentication to reach
|
|
967
|
+
* the handler. The handler remains responsible for verifying the credential.
|
|
968
|
+
*
|
|
969
|
+
* This is registered separately from template auth options because framework
|
|
970
|
+
* routes can be mounted after the auth plugin and must also work in custom
|
|
971
|
+
* workspace deployments that do not own a template auth file.
|
|
972
|
+
*/
|
|
973
|
+
export function registerAuthPublicPaths(paths) {
|
|
974
|
+
for (const path of paths) {
|
|
975
|
+
const normalized = typeof path === "string" ? path.trim() : "";
|
|
976
|
+
if (!normalized.startsWith("/"))
|
|
977
|
+
continue;
|
|
978
|
+
_registeredAuthPublicPaths.add(normalized);
|
|
979
|
+
if (_authGuardConfig &&
|
|
980
|
+
!_authGuardConfig.publicPaths.includes(normalized)) {
|
|
981
|
+
_authGuardConfig.publicPaths.push(normalized);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
function resolveAuthPublicPaths(paths) {
|
|
986
|
+
return [...new Set([...(paths ?? []), ..._registeredAuthPublicPaths])];
|
|
987
|
+
}
|
|
964
988
|
function getRequestHost(event) {
|
|
965
989
|
return (getHeader(event, "x-forwarded-host") ??
|
|
966
990
|
getHeader(event, "host") ??
|
|
@@ -2578,7 +2602,7 @@ function getCustomAuthRequiredHtml() {
|
|
|
2578
2602
|
// mountBetterAuthRoutes — Better Auth powered auth with backward-compat routes
|
|
2579
2603
|
// ---------------------------------------------------------------------------
|
|
2580
2604
|
async function mountBetterAuthRoutes(app, options) {
|
|
2581
|
-
const publicPaths =
|
|
2605
|
+
const publicPaths = resolveAuthPublicPaths(options.publicPaths);
|
|
2582
2606
|
const workspaceAppAudience = resolveWorkspaceAppAudience(options);
|
|
2583
2607
|
const workspaceAppRouteAccess = resolveWorkspaceAppRouteAccess(options);
|
|
2584
2608
|
// The A2A agent card is part of an open protocol — other agents must be
|
|
@@ -3811,7 +3835,7 @@ export async function autoMountAuth(app, options = {}) {
|
|
|
3811
3835
|
// Reset globals
|
|
3812
3836
|
customGetSession = null;
|
|
3813
3837
|
sessionMaxAge = options.maxAge ?? DEFAULT_MAX_AGE;
|
|
3814
|
-
const publicPaths = options.publicPaths
|
|
3838
|
+
const publicPaths = resolveAuthPublicPaths(options.publicPaths);
|
|
3815
3839
|
const workspaceAppAudience = resolveWorkspaceAppAudience(options);
|
|
3816
3840
|
const workspaceAppRouteAccess = resolveWorkspaceAppRouteAccess(options);
|
|
3817
3841
|
mountAuthCorsMiddleware(app);
|
package/dist/server/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { createOpenRouteHandler, type OpenRouteOptions } from "./open-route.js";
|
|
|
7
7
|
export { createEmbedStartRouteHandler, buildEmbedStartPath, type EmbedStartRouteOptions, } from "./embed-route.js";
|
|
8
8
|
export { createEmbedSessionTicket, consumeEmbedSessionTicket, normalizeEmbedTargetPath, requestHasEmbedAuthMarker, resolveEmbedSessionFromRequest, setEmbedSessionCookie, signEmbedSessionToken, verifyEmbedSessionToken, type ConsumedEmbedSessionTicket, type ConsumeEmbedSessionTicketOptions, type EmbedSessionTicket, type EmbedSessionTicketInput, type EmbedSessionTokenClaims, type ResolvedEmbedSession, type VerifyEmbedSessionTokenResult, } from "./embed-session.js";
|
|
9
9
|
export { createSSEHandler, type SSEHandlerOptions } from "./sse.js";
|
|
10
|
-
export { mountAuthMiddleware, autoMountAuth, getSession, COOKIE_NAME, addSession, removeSession, getSessionEmail, getFrameworkSessionCookieValues, setFrameworkSessionCookie, clearFrameworkSessionCookies, runAuthGuard, setDesktopExchange, setDesktopExchangeError, safeReturnPath, type DesktopExchangeErrorPayload, type AuthSession, type AuthOptions, } from "./auth.js";
|
|
10
|
+
export { mountAuthMiddleware, autoMountAuth, registerAuthPublicPaths, getSession, COOKIE_NAME, addSession, removeSession, getSessionEmail, getFrameworkSessionCookieValues, setFrameworkSessionCookie, clearFrameworkSessionCookies, runAuthGuard, setDesktopExchange, setDesktopExchangeError, safeReturnPath, type DesktopExchangeErrorPayload, type AuthSession, type AuthOptions, } from "./auth.js";
|
|
11
11
|
export { handleIdentitySso, getIdentityHubUrl, isIdentitySsoEnabled, isIdentitySsoBypassPath, identitySsoLoginButtonHtml, IDENTITY_SSO_PROVIDER_ID, IDENTITY_SSO_SCOPE, IDENTITY_SSO_DESKTOP_COMPLETE_PATH, } from "./identity-sso.js";
|
|
12
12
|
export { requireEnvKey, type MissingKeyResponse } from "./missing-key.js";
|
|
13
13
|
export { assertCurrentRequestUserIsOrgAdmin, currentRequestUserIsOrgAdmin, } from "./org-admin.js";
|
package/dist/server/index.js
CHANGED
|
@@ -7,7 +7,7 @@ export { createOpenRouteHandler } from "./open-route.js";
|
|
|
7
7
|
export { createEmbedStartRouteHandler, buildEmbedStartPath, } from "./embed-route.js";
|
|
8
8
|
export { createEmbedSessionTicket, consumeEmbedSessionTicket, normalizeEmbedTargetPath, requestHasEmbedAuthMarker, resolveEmbedSessionFromRequest, setEmbedSessionCookie, signEmbedSessionToken, verifyEmbedSessionToken, } from "./embed-session.js";
|
|
9
9
|
export { createSSEHandler } from "./sse.js";
|
|
10
|
-
export { mountAuthMiddleware, autoMountAuth, getSession, COOKIE_NAME, addSession, removeSession, getSessionEmail, getFrameworkSessionCookieValues, setFrameworkSessionCookie, clearFrameworkSessionCookies, runAuthGuard, setDesktopExchange, setDesktopExchangeError, safeReturnPath, } from "./auth.js";
|
|
10
|
+
export { mountAuthMiddleware, autoMountAuth, registerAuthPublicPaths, getSession, COOKIE_NAME, addSession, removeSession, getSessionEmail, getFrameworkSessionCookieValues, setFrameworkSessionCookie, clearFrameworkSessionCookies, runAuthGuard, setDesktopExchange, setDesktopExchangeError, safeReturnPath, } from "./auth.js";
|
|
11
11
|
export { handleIdentitySso, getIdentityHubUrl, isIdentitySsoEnabled, isIdentitySsoBypassPath, identitySsoLoginButtonHtml, IDENTITY_SSO_PROVIDER_ID, IDENTITY_SSO_SCOPE, IDENTITY_SSO_DESKTOP_COMPLETE_PATH, } from "./identity-sso.js";
|
|
12
12
|
export { requireEnvKey } from "./missing-key.js";
|
|
13
13
|
export { assertCurrentRequestUserIsOrgAdmin, currentRequestUserIsOrgAdmin, } from "./org-admin.js";
|
|
@@ -26,8 +26,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
|
|
|
26
26
|
expiresAt?: undefined;
|
|
27
27
|
ttlSeconds?: undefined;
|
|
28
28
|
} | {
|
|
29
|
+
error?: undefined;
|
|
29
30
|
token: string;
|
|
30
31
|
expiresAt: string;
|
|
31
32
|
ttlSeconds: number;
|
|
32
|
-
error?: undefined;
|
|
33
33
|
}>>;
|
|
@@ -5,6 +5,7 @@ import { AGENT_RUN_MIGRATIONS, AGENT_RUN_MIGRATIONS_TABLE, } from "../agent/run-
|
|
|
5
5
|
import { AGENT_TOOL_APPROVAL_MIGRATIONS, AGENT_TOOL_APPROVAL_MIGRATIONS_TABLE, } from "../agent/tool-approval-migrations.js";
|
|
6
6
|
import { CHAT_THREAD_SCHEMA_MIGRATIONS, CHAT_THREAD_SCHEMA_MIGRATIONS_TABLE, } from "../chat-threads/schema-migrations.js";
|
|
7
7
|
import { runMigrations } from "../db/migrations.js";
|
|
8
|
+
import { REMOTE_DEVICE_MIGRATIONS, REMOTE_DEVICE_MIGRATIONS_TABLE, } from "../integrations/remote-device-migrations.js";
|
|
8
9
|
import { runAutomationRunMigrations } from "../jobs/run-history.js";
|
|
9
10
|
import { runAutomationSchedulerHealthMigrations } from "../jobs/scheduler-health.js";
|
|
10
11
|
import { OAUTH_TOKEN_MIGRATIONS, OAUTH_TOKEN_MIGRATIONS_TABLE, } from "../oauth-tokens/migrations.js";
|
|
@@ -40,6 +41,9 @@ export async function runFrameworkReleaseMigrations(nitroApp) {
|
|
|
40
41
|
table: USAGE_ALERT_MIGRATIONS_TABLE,
|
|
41
42
|
})(nitroApp);
|
|
42
43
|
await runMigrations(ORG_MIGRATIONS, { table: "_org_migrations" })(nitroApp);
|
|
44
|
+
await runMigrations(REMOTE_DEVICE_MIGRATIONS, {
|
|
45
|
+
table: REMOTE_DEVICE_MIGRATIONS_TABLE,
|
|
46
|
+
})(nitroApp);
|
|
43
47
|
await runMigrations(IDENTITY_SSO_MIGRATIONS, {
|
|
44
48
|
table: "_identity_sso_migrations",
|
|
45
49
|
})(nitroApp);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.157.
|
|
3
|
+
"version": "0.157.13",
|
|
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": {
|