@agent-native/core 0.116.0 → 0.117.0
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/core/CHANGELOG.md +15 -0
- package/corpus/core/package.json +4 -1
- package/corpus/core/src/client/analytics.ts +7 -0
- package/corpus/core/src/client/use-db-sync.ts +354 -15
- package/corpus/core/src/collab/client.ts +26 -2
- package/corpus/core/src/db/ddl-guard.ts +49 -10
- package/corpus/core/src/deploy/build.ts +25 -2
- package/corpus/core/src/realtime-protocol.ts +92 -0
- package/corpus/core/src/server/core-routes-plugin.ts +7 -0
- package/corpus/core/src/server/poll-events.ts +29 -8
- package/corpus/core/src/server/poll.ts +1123 -865
- package/corpus/core/src/server/realtime-token.ts +106 -0
- package/corpus/core/src/server/sentry-config.ts +40 -0
- package/corpus/core/src/server/short-lived-token.ts +156 -0
- package/corpus/core/src/server/sse.ts +15 -0
- package/corpus/core/src/server/ssr-handler.ts +9 -3
- package/corpus/templates/clips/app/components/sharing/share-ui.tsx +12 -0
- package/corpus/templates/clips/app/i18n/en-US.ts +1 -0
- package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +566 -299
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +14 -0
- package/corpus/templates/content/app/i18n-data.ts +90 -0
- package/dist/client/analytics.d.ts +10 -0
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/use-db-sync.d.ts +1 -1
- package/dist/client/use-db-sync.d.ts.map +1 -1
- package/dist/client/use-db-sync.js +315 -15
- package/dist/client/use-db-sync.js.map +1 -1
- package/dist/collab/client.d.ts.map +1 -1
- package/dist/collab/client.js +26 -2
- package/dist/collab/client.js.map +1 -1
- package/dist/db/ddl-guard.d.ts +7 -2
- package/dist/db/ddl-guard.d.ts.map +1 -1
- package/dist/db/ddl-guard.js +21 -9
- package/dist/db/ddl-guard.js.map +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +25 -2
- package/dist/deploy/build.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +5 -5
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +4 -4
- package/dist/provider-api/actions/provider-api.d.ts +6 -6
- package/dist/realtime-protocol.d.ts +40 -0
- package/dist/realtime-protocol.d.ts.map +1 -0
- package/dist/realtime-protocol.js +69 -0
- package/dist/realtime-protocol.js.map +1 -0
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/secrets/routes.d.ts +3 -3
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +3 -0
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/poll-events.d.ts +7 -1
- package/dist/server/poll-events.d.ts.map +1 -1
- package/dist/server/poll-events.js +24 -7
- package/dist/server/poll-events.js.map +1 -1
- package/dist/server/poll.d.ts +223 -42
- package/dist/server/poll.d.ts.map +1 -1
- package/dist/server/poll.js +849 -737
- package/dist/server/poll.js.map +1 -1
- package/dist/server/realtime-token.d.ts +34 -0
- package/dist/server/realtime-token.d.ts.map +1 -0
- package/dist/server/realtime-token.js +85 -0
- package/dist/server/realtime-token.js.map +1 -0
- package/dist/server/sentry-config.d.ts +12 -0
- package/dist/server/sentry-config.d.ts.map +1 -1
- package/dist/server/sentry-config.js +34 -0
- package/dist/server/sentry-config.js.map +1 -1
- package/dist/server/short-lived-token.d.ts +46 -0
- package/dist/server/short-lived-token.d.ts.map +1 -1
- package/dist/server/short-lived-token.js +104 -0
- package/dist/server/short-lived-token.js.map +1 -1
- package/dist/server/sse.d.ts +1 -1
- package/dist/server/sse.d.ts.map +1 -1
- package/dist/server/sse.js +4 -0
- package/dist/server/sse.js.map +1 -1
- package/dist/server/ssr-handler.d.ts.map +1 -1
- package/dist/server/ssr-handler.js +5 -3
- package/dist/server/ssr-handler.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/package.json +4 -1
- package/src/client/analytics.ts +7 -0
- package/src/client/use-db-sync.ts +354 -15
- package/src/collab/client.ts +26 -2
- package/src/db/ddl-guard.ts +49 -10
- package/src/deploy/build.ts +25 -2
- package/src/realtime-protocol.ts +92 -0
- package/src/server/core-routes-plugin.ts +7 -0
- package/src/server/poll-events.ts +29 -8
- package/src/server/poll.ts +1123 -865
- package/src/server/realtime-token.ts +106 -0
- package/src/server/sentry-config.ts +40 -0
- package/src/server/short-lived-token.ts +156 -0
- package/src/server/sse.ts +15 -0
- package/src/server/ssr-handler.ts +9 -3
|
@@ -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
|
|
@@ -41,28 +41,28 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
41
41
|
thumbsUpRate: number;
|
|
42
42
|
avgEvalScore: number;
|
|
43
43
|
} | {
|
|
44
|
+
error?: undefined;
|
|
45
|
+
ok?: undefined;
|
|
44
46
|
summary: import("./types.js").TraceSummary;
|
|
45
47
|
spans: import("./types.js").TraceSpan[];
|
|
46
48
|
id?: undefined;
|
|
49
|
+
} | {
|
|
47
50
|
error?: undefined;
|
|
48
51
|
ok?: undefined;
|
|
49
|
-
} | {
|
|
50
52
|
summary?: undefined;
|
|
51
53
|
spans?: undefined;
|
|
52
54
|
id: string;
|
|
53
|
-
error?: undefined;
|
|
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
|
+
error?: undefined;
|
|
62
63
|
summary?: undefined;
|
|
63
64
|
spans?: undefined;
|
|
64
65
|
id?: undefined;
|
|
65
|
-
error?: undefined;
|
|
66
66
|
ok: boolean;
|
|
67
67
|
}>>;
|
|
68
68
|
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -75,7 +75,6 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
75
75
|
user: "user";
|
|
76
76
|
}>>;
|
|
77
77
|
}, z.core.$strip>>, {
|
|
78
|
-
message?: undefined;
|
|
79
78
|
id?: undefined;
|
|
80
79
|
found?: undefined;
|
|
81
80
|
deleted?: undefined;
|
|
@@ -92,8 +91,8 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
92
91
|
provider?: undefined;
|
|
93
92
|
registered?: undefined;
|
|
94
93
|
label?: undefined;
|
|
95
|
-
} | {
|
|
96
94
|
message?: undefined;
|
|
95
|
+
} | {
|
|
97
96
|
id?: undefined;
|
|
98
97
|
deleted?: undefined;
|
|
99
98
|
providers?: undefined;
|
|
@@ -102,8 +101,8 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
102
101
|
provider: import("../custom-registry.js").CustomProviderConfig;
|
|
103
102
|
registered?: undefined;
|
|
104
103
|
label?: undefined;
|
|
105
|
-
} | {
|
|
106
104
|
message?: undefined;
|
|
105
|
+
} | {
|
|
107
106
|
deleted?: undefined;
|
|
108
107
|
providers?: undefined;
|
|
109
108
|
count?: undefined;
|
|
@@ -112,8 +111,8 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
112
111
|
id: string;
|
|
113
112
|
registered?: undefined;
|
|
114
113
|
label?: undefined;
|
|
115
|
-
} | {
|
|
116
114
|
message?: undefined;
|
|
115
|
+
} | {
|
|
117
116
|
found?: undefined;
|
|
118
117
|
providers?: undefined;
|
|
119
118
|
count?: undefined;
|
|
@@ -122,6 +121,7 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
122
121
|
id: string;
|
|
123
122
|
registered?: undefined;
|
|
124
123
|
label?: undefined;
|
|
124
|
+
message?: undefined;
|
|
125
125
|
} | {
|
|
126
126
|
found?: undefined;
|
|
127
127
|
deleted?: undefined;
|
|
@@ -309,9 +309,9 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
309
309
|
notes?: string | undefined;
|
|
310
310
|
scope?: "org" | "user" | undefined;
|
|
311
311
|
}, {
|
|
312
|
+
deleted?: undefined;
|
|
312
313
|
id?: undefined;
|
|
313
314
|
provider?: undefined;
|
|
314
|
-
deleted?: undefined;
|
|
315
315
|
found?: undefined;
|
|
316
316
|
providers: {
|
|
317
317
|
id: string;
|
|
@@ -327,9 +327,9 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
327
327
|
label?: undefined;
|
|
328
328
|
message?: undefined;
|
|
329
329
|
} | {
|
|
330
|
-
id?: undefined;
|
|
331
330
|
deleted?: undefined;
|
|
332
331
|
count?: undefined;
|
|
332
|
+
id?: undefined;
|
|
333
333
|
providers?: undefined;
|
|
334
334
|
found: boolean;
|
|
335
335
|
provider: import("../custom-registry.js").CustomProviderConfig;
|
|
@@ -337,9 +337,9 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
337
337
|
label?: undefined;
|
|
338
338
|
message?: undefined;
|
|
339
339
|
} | {
|
|
340
|
-
provider?: undefined;
|
|
341
340
|
deleted?: undefined;
|
|
342
341
|
count?: undefined;
|
|
342
|
+
provider?: undefined;
|
|
343
343
|
providers?: undefined;
|
|
344
344
|
found: boolean;
|
|
345
345
|
id: string;
|
|
@@ -347,9 +347,9 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
347
347
|
label?: undefined;
|
|
348
348
|
message?: undefined;
|
|
349
349
|
} | {
|
|
350
|
+
count?: undefined;
|
|
350
351
|
provider?: undefined;
|
|
351
352
|
found?: undefined;
|
|
352
|
-
count?: undefined;
|
|
353
353
|
providers?: undefined;
|
|
354
354
|
deleted: boolean;
|
|
355
355
|
id: string;
|
|
@@ -357,10 +357,10 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
357
357
|
label?: undefined;
|
|
358
358
|
message?: undefined;
|
|
359
359
|
} | {
|
|
360
|
-
provider?: undefined;
|
|
361
360
|
deleted?: undefined;
|
|
362
|
-
found?: undefined;
|
|
363
361
|
count?: undefined;
|
|
362
|
+
provider?: undefined;
|
|
363
|
+
found?: undefined;
|
|
364
364
|
providers?: undefined;
|
|
365
365
|
registered: boolean;
|
|
366
366
|
id: string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Realtime SSE wire protocol — shared by the server SSE handlers (framework
|
|
3
|
+
* in-process path + the hosted Realtime Gateway) and the client transport.
|
|
4
|
+
*
|
|
5
|
+
* Pure constants, types, and parsers only — NO h3/node/browser deps — so both
|
|
6
|
+
* the Node server and the browser client import it.
|
|
7
|
+
*
|
|
8
|
+
* Frame taxonomy:
|
|
9
|
+
* - CHANGE / batch frames ride the default (unnamed) SSE `message` event and
|
|
10
|
+
* are parsed by the client's existing `normalizeEventPayload`. Unchanged.
|
|
11
|
+
* - CONTROL frames (handshake, token rotation) ride NAMED SSE events, so
|
|
12
|
+
* `EventSource.addEventListener(name)` routes them separately and an older
|
|
13
|
+
* client that only reads `onmessage` silently ignores them (backward safe).
|
|
14
|
+
*/
|
|
15
|
+
export declare const REALTIME_PROTOCOL_VERSION = 1;
|
|
16
|
+
/** Named SSE event carrying the one-time handshake ({@link RealtimeHandshake}). */
|
|
17
|
+
export declare const REALTIME_SSE_HANDSHAKE_EVENT = "handshake";
|
|
18
|
+
/** Named SSE event carrying a rotated subscribe token ({@link RealtimeTokenFrame}). */
|
|
19
|
+
export declare const REALTIME_SSE_TOKEN_EVENT = "token";
|
|
20
|
+
/**
|
|
21
|
+
* Capability advertised by the hosted gateway: awareness/presence is NOT
|
|
22
|
+
* forwarded (it lives only on the in-process emitter, never in `sync_events`),
|
|
23
|
+
* so the collab client must keep its own presence cadence. The framework's
|
|
24
|
+
* in-process SSE path forwards awareness and therefore sends no handshake — the
|
|
25
|
+
* client treats an absent handshake as "all capabilities present."
|
|
26
|
+
*/
|
|
27
|
+
export declare const REALTIME_CAP_NO_AWARENESS = "no-awareness";
|
|
28
|
+
export interface RealtimeHandshake {
|
|
29
|
+
protocol: number;
|
|
30
|
+
capabilities: string[];
|
|
31
|
+
}
|
|
32
|
+
export interface RealtimeTokenFrame {
|
|
33
|
+
token: string;
|
|
34
|
+
/** ISO expiry, informational; the client re-mints/rotates before this. */
|
|
35
|
+
expiresAt?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function buildHandshakeFrame(capabilities?: readonly string[]): RealtimeHandshake;
|
|
38
|
+
export declare function parseHandshakeFrame(data: string): RealtimeHandshake | null;
|
|
39
|
+
export declare function parseTokenFrame(data: string): RealtimeTokenFrame | null;
|
|
40
|
+
//# sourceMappingURL=realtime-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-protocol.d.ts","sourceRoot":"","sources":["../src/realtime-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,mFAAmF;AACnF,eAAO,MAAM,4BAA4B,cAAc,CAAC;AACxD,uFAAuF;AACvF,eAAO,MAAM,wBAAwB,UAAU,CAAC;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,iBAAiB,CAAC;AAExD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,mBAAmB,CACjC,YAAY,GAAE,SAAS,MAAM,EAAO,GACnC,iBAAiB,CAKnB;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAoB1E;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAkBvE"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Realtime SSE wire protocol — shared by the server SSE handlers (framework
|
|
3
|
+
* in-process path + the hosted Realtime Gateway) and the client transport.
|
|
4
|
+
*
|
|
5
|
+
* Pure constants, types, and parsers only — NO h3/node/browser deps — so both
|
|
6
|
+
* the Node server and the browser client import it.
|
|
7
|
+
*
|
|
8
|
+
* Frame taxonomy:
|
|
9
|
+
* - CHANGE / batch frames ride the default (unnamed) SSE `message` event and
|
|
10
|
+
* are parsed by the client's existing `normalizeEventPayload`. Unchanged.
|
|
11
|
+
* - CONTROL frames (handshake, token rotation) ride NAMED SSE events, so
|
|
12
|
+
* `EventSource.addEventListener(name)` routes them separately and an older
|
|
13
|
+
* client that only reads `onmessage` silently ignores them (backward safe).
|
|
14
|
+
*/
|
|
15
|
+
export const REALTIME_PROTOCOL_VERSION = 1;
|
|
16
|
+
/** Named SSE event carrying the one-time handshake ({@link RealtimeHandshake}). */
|
|
17
|
+
export const REALTIME_SSE_HANDSHAKE_EVENT = "handshake";
|
|
18
|
+
/** Named SSE event carrying a rotated subscribe token ({@link RealtimeTokenFrame}). */
|
|
19
|
+
export const REALTIME_SSE_TOKEN_EVENT = "token";
|
|
20
|
+
/**
|
|
21
|
+
* Capability advertised by the hosted gateway: awareness/presence is NOT
|
|
22
|
+
* forwarded (it lives only on the in-process emitter, never in `sync_events`),
|
|
23
|
+
* so the collab client must keep its own presence cadence. The framework's
|
|
24
|
+
* in-process SSE path forwards awareness and therefore sends no handshake — the
|
|
25
|
+
* client treats an absent handshake as "all capabilities present."
|
|
26
|
+
*/
|
|
27
|
+
export const REALTIME_CAP_NO_AWARENESS = "no-awareness";
|
|
28
|
+
export function buildHandshakeFrame(capabilities = []) {
|
|
29
|
+
return {
|
|
30
|
+
protocol: REALTIME_PROTOCOL_VERSION,
|
|
31
|
+
capabilities: [...capabilities],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export function parseHandshakeFrame(data) {
|
|
35
|
+
try {
|
|
36
|
+
const parsed = JSON.parse(data);
|
|
37
|
+
if (parsed &&
|
|
38
|
+
typeof parsed === "object" &&
|
|
39
|
+
typeof parsed.protocol === "number" &&
|
|
40
|
+
Array.isArray(parsed.capabilities)) {
|
|
41
|
+
return {
|
|
42
|
+
protocol: parsed.protocol,
|
|
43
|
+
capabilities: parsed.capabilities.filter((c) => typeof c === "string"),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
// fall through
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
export function parseTokenFrame(data) {
|
|
53
|
+
try {
|
|
54
|
+
const parsed = JSON.parse(data);
|
|
55
|
+
if (parsed &&
|
|
56
|
+
typeof parsed === "object" &&
|
|
57
|
+
typeof parsed.token === "string") {
|
|
58
|
+
return {
|
|
59
|
+
token: parsed.token,
|
|
60
|
+
expiresAt: typeof parsed.expiresAt === "string" ? parsed.expiresAt : undefined,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// fall through
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=realtime-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-protocol.js","sourceRoot":"","sources":["../src/realtime-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C,mFAAmF;AACnF,MAAM,CAAC,MAAM,4BAA4B,GAAG,WAAW,CAAC;AACxD,uFAAuF;AACvF,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,cAAc,CAAC;AAaxD,MAAM,UAAU,mBAAmB,CACjC,YAAY,GAAsB,EAAE;IAEpC,OAAO;QACL,QAAQ,EAAE,yBAAyB;QACnC,YAAY,EAAE,CAAC,GAAG,YAAY,CAAC;KAChC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChC,IACE,MAAM;YACN,OAAO,MAAM,KAAK,QAAQ;YAC1B,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ;YACnC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,EAClC,CAAC;YACD,OAAO;gBACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,CACtC,CAAC,CAAU,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CACnD;aACF,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,eAAe;IACjB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChC,IACE,MAAM;YACN,OAAO,MAAM,KAAK,QAAQ;YAC1B,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,EAChC,CAAC;YACD,OAAO;gBACL,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,SAAS,EACP,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;aACtE,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,eAAe;IACjB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/**\n * Realtime SSE wire protocol — shared by the server SSE handlers (framework\n * in-process path + the hosted Realtime Gateway) and the client transport.\n *\n * Pure constants, types, and parsers only — NO h3/node/browser deps — so both\n * the Node server and the browser client import it.\n *\n * Frame taxonomy:\n * - CHANGE / batch frames ride the default (unnamed) SSE `message` event and\n * are parsed by the client's existing `normalizeEventPayload`. Unchanged.\n * - CONTROL frames (handshake, token rotation) ride NAMED SSE events, so\n * `EventSource.addEventListener(name)` routes them separately and an older\n * client that only reads `onmessage` silently ignores them (backward safe).\n */\n\nexport const REALTIME_PROTOCOL_VERSION = 1;\n\n/** Named SSE event carrying the one-time handshake ({@link RealtimeHandshake}). */\nexport const REALTIME_SSE_HANDSHAKE_EVENT = \"handshake\";\n/** Named SSE event carrying a rotated subscribe token ({@link RealtimeTokenFrame}). */\nexport const REALTIME_SSE_TOKEN_EVENT = \"token\";\n\n/**\n * Capability advertised by the hosted gateway: awareness/presence is NOT\n * forwarded (it lives only on the in-process emitter, never in `sync_events`),\n * so the collab client must keep its own presence cadence. The framework's\n * in-process SSE path forwards awareness and therefore sends no handshake — the\n * client treats an absent handshake as \"all capabilities present.\"\n */\nexport const REALTIME_CAP_NO_AWARENESS = \"no-awareness\";\n\nexport interface RealtimeHandshake {\n protocol: number;\n capabilities: string[];\n}\n\nexport interface RealtimeTokenFrame {\n token: string;\n /** ISO expiry, informational; the client re-mints/rotates before this. */\n expiresAt?: string;\n}\n\nexport function buildHandshakeFrame(\n capabilities: readonly string[] = [],\n): RealtimeHandshake {\n return {\n protocol: REALTIME_PROTOCOL_VERSION,\n capabilities: [...capabilities],\n };\n}\n\nexport function parseHandshakeFrame(data: string): RealtimeHandshake | null {\n try {\n const parsed = JSON.parse(data);\n if (\n parsed &&\n typeof parsed === \"object\" &&\n typeof parsed.protocol === \"number\" &&\n Array.isArray(parsed.capabilities)\n ) {\n return {\n protocol: parsed.protocol,\n capabilities: parsed.capabilities.filter(\n (c: unknown): c is string => typeof c === \"string\",\n ),\n };\n }\n } catch {\n // fall through\n }\n return null;\n}\n\nexport function parseTokenFrame(data: string): RealtimeTokenFrame | null {\n try {\n const parsed = JSON.parse(data);\n if (\n parsed &&\n typeof parsed === \"object\" &&\n typeof parsed.token === \"string\"\n ) {\n return {\n token: parsed.token,\n expiresAt:\n typeof parsed.expiresAt === \"string\" ? parsed.expiresAt : undefined,\n };\n }\n } catch {\n // fall through\n }\n return null;\n}\n"]}
|
|
@@ -49,8 +49,8 @@ export declare function handleUpdateResource(event: any): Promise<import("./stor
|
|
|
49
49
|
}>;
|
|
50
50
|
/** DELETE /_agent-native/resources/:id — delete a resource */
|
|
51
51
|
export declare function handleDeleteResource(event: any): Promise<{
|
|
52
|
-
error: string;
|
|
53
52
|
ok?: undefined;
|
|
53
|
+
error: string;
|
|
54
54
|
} | {
|
|
55
55
|
error?: undefined;
|
|
56
56
|
ok: boolean;
|
package/dist/secrets/routes.d.ts
CHANGED
|
@@ -34,16 +34,16 @@ 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
40
|
ok: boolean;
|
|
41
41
|
status: string;
|
|
42
42
|
error?: undefined;
|
|
43
43
|
} | {
|
|
44
|
+
ok?: undefined;
|
|
44
45
|
error: string;
|
|
45
46
|
removed?: undefined;
|
|
46
|
-
ok?: undefined;
|
|
47
47
|
} | {
|
|
48
48
|
ok: boolean;
|
|
49
49
|
removed: boolean;
|
|
@@ -54,9 +54,9 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
|
|
|
54
54
|
* current stored value without changing anything. Useful for the "Test" button.
|
|
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
61
|
ok: boolean;
|
|
62
62
|
note?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-routes-plugin.d.ts","sourceRoot":"","sources":["../../src/server/core-routes-plugin.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAqClC,OAAO,EAIL,KAAK,0BAA0B,EAChC,MAAM,8BAA8B,CAAC;AAkDtC,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EA+BL,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,EAE7B,MAAM,sBAAsB,CAAC;AAM9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"core-routes-plugin.d.ts","sourceRoot":"","sources":["../../src/server/core-routes-plugin.ts"],"names":[],"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ACnC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAChD,mBAAmB,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAC7C;AAED,KAAK,sBAAsB,GAAG,CAC5B,GAAG,EAAE,MAAM,KACR,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;AAE7C,wBAAsB,+BAA+B,CACnD,WAAW,GAAE,sBAAmC,GAC/C,OAAO,CAAC,2BAA2B,CAAC,CAgBtC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,GAAE,uBAA4B,GACpC,cAAc,CAk7FhB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,EAAE,cAAyC,CAAC"}
|
|
@@ -49,6 +49,7 @@ import { handleIdentitySso } from "./identity-sso.js";
|
|
|
49
49
|
import { createOpenRouteHandler } from "./open-route.js";
|
|
50
50
|
import { createPollEventsHandler } from "./poll-events.js";
|
|
51
51
|
import { createPollHandler } from "./poll.js";
|
|
52
|
+
import { createRealtimeTokenHandler } from "./realtime-token.js";
|
|
52
53
|
import { runWithRequestContext } from "./request-context.js";
|
|
53
54
|
import { findUnsupportedScopedKeyNames, saveKeyValuesToScopedSecrets, ScopedKeyStorageError, } from "./scoped-key-storage.js";
|
|
54
55
|
import { createTranscribeVoiceHandler } from "./transcribe-voice.js";
|
|
@@ -901,6 +902,8 @@ export function createCoreRoutesPlugin(options = {}) {
|
|
|
901
902
|
}));
|
|
902
903
|
// Polling
|
|
903
904
|
getH3App(nitroApp).use(`${P}/poll`, createPollHandler());
|
|
905
|
+
// Realtime subscribe-token mint (hosted gateway path)
|
|
906
|
+
getH3App(nitroApp).use(`${P}/realtime-token`, createRealtimeTokenHandler());
|
|
904
907
|
// SSE
|
|
905
908
|
if (!options.disableSSE) {
|
|
906
909
|
for (const route of resolveFrameworkSseRoutes(options.sseRoute)) {
|