@agent-native/core 0.157.10 → 0.157.12
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/templates/analytics/server/lib/first-party-analytics-purge.ts +64 -76
- package/corpus/templates/slides/actions/export-pptx.ts +127 -1
- package/corpus/templates/slides/server/routes/api/exports/google-slides.post.ts +12 -4
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/db/client.js +1 -0
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/integrations/plugin.js +9 -6
- 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/secrets/routes.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { getDbExec } from "@agent-native/core/db";
|
|
2
|
-
import { and, eq, gte, isNull, ne, or } from "drizzle-orm";
|
|
3
|
-
|
|
4
|
-
import { getDb, schema } from "../db/index.js";
|
|
5
2
|
|
|
6
3
|
export interface FirstPartyAnalyticsPurgeScope {
|
|
7
4
|
userEmail: string;
|
|
@@ -19,34 +16,6 @@ export interface FirstPartyAnalyticsPurgeWindow {
|
|
|
19
16
|
startEventDate: string;
|
|
20
17
|
}
|
|
21
18
|
|
|
22
|
-
function scopePredicate(
|
|
23
|
-
table: {
|
|
24
|
-
orgId: any;
|
|
25
|
-
ownerEmail: any;
|
|
26
|
-
},
|
|
27
|
-
scope: FirstPartyAnalyticsPurgeScope,
|
|
28
|
-
includeLegacyOwnerRows: boolean,
|
|
29
|
-
) {
|
|
30
|
-
if (!includeLegacyOwnerRows) return eq(table.orgId, scope.orgId);
|
|
31
|
-
return or(
|
|
32
|
-
eq(table.orgId, scope.orgId),
|
|
33
|
-
and(isNull(table.orgId), eq(table.ownerEmail, scope.userEmail)),
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function windowPredicate(
|
|
38
|
-
table: {
|
|
39
|
-
eventDate: any;
|
|
40
|
-
receivedAt?: any;
|
|
41
|
-
},
|
|
42
|
-
predicate: any,
|
|
43
|
-
window: FirstPartyAnalyticsPurgeWindow,
|
|
44
|
-
) {
|
|
45
|
-
return table.receivedAt
|
|
46
|
-
? and(predicate, gte(table.receivedAt, window.startReceivedAt))
|
|
47
|
-
: and(predicate, gte(table.eventDate, window.startEventDate));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
19
|
type CountTable =
|
|
51
20
|
| "analytics_events"
|
|
52
21
|
| "analytics_event_daily_rollups"
|
|
@@ -54,6 +23,40 @@ type CountTable =
|
|
|
54
23
|
|
|
55
24
|
type CountTimeColumn = "received_at" | "event_date";
|
|
56
25
|
|
|
26
|
+
const PURGE_BATCH_SIZE = 10_000;
|
|
27
|
+
const PURGE_BATCH_TIMEOUT_MS = 60_000;
|
|
28
|
+
const PURGE_COUNT_TIMEOUT_MS = 60_000;
|
|
29
|
+
|
|
30
|
+
function purgeWhereSql(
|
|
31
|
+
table: CountTable,
|
|
32
|
+
scope: FirstPartyAnalyticsPurgeScope,
|
|
33
|
+
includeLegacyOwnerRows: boolean,
|
|
34
|
+
window: FirstPartyAnalyticsPurgeWindow,
|
|
35
|
+
): { sql: string; args: unknown[]; timeColumn: CountTimeColumn } {
|
|
36
|
+
const scopeSql = includeLegacyOwnerRows
|
|
37
|
+
? "(org_id = ? OR (org_id IS NULL AND owner_email = ?))"
|
|
38
|
+
: "org_id = ?";
|
|
39
|
+
const args: unknown[] = includeLegacyOwnerRows
|
|
40
|
+
? [scope.orgId, scope.userEmail]
|
|
41
|
+
: [scope.orgId];
|
|
42
|
+
const timeColumn =
|
|
43
|
+
table === "analytics_events" ? "received_at" : "event_date";
|
|
44
|
+
args.push(
|
|
45
|
+
timeColumn === "received_at"
|
|
46
|
+
? window.startReceivedAt
|
|
47
|
+
: window.startEventDate,
|
|
48
|
+
);
|
|
49
|
+
const eventFilter =
|
|
50
|
+
table === "analytics_events"
|
|
51
|
+
? " AND event_name IS DISTINCT FROM 'http.response'"
|
|
52
|
+
: "";
|
|
53
|
+
return {
|
|
54
|
+
sql: `${scopeSql}${eventFilter} AND ${timeColumn} >= ?`,
|
|
55
|
+
args,
|
|
56
|
+
timeColumn,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
57
60
|
async function countScopedRows(
|
|
58
61
|
table: CountTable,
|
|
59
62
|
timeColumn: CountTimeColumn,
|
|
@@ -84,7 +87,7 @@ async function countScopedRows(
|
|
|
84
87
|
${eventFilter}
|
|
85
88
|
AND ${timeColumn} >= ?`,
|
|
86
89
|
args,
|
|
87
|
-
timeoutMs:
|
|
90
|
+
timeoutMs: PURGE_COUNT_TIMEOUT_MS,
|
|
88
91
|
maxAttempts: 1,
|
|
89
92
|
});
|
|
90
93
|
const rawCount = (rows[0] as { row_count?: unknown } | undefined)?.row_count;
|
|
@@ -136,49 +139,34 @@ export async function purgeFirstPartyAnalyticsPostgresRows(
|
|
|
136
139
|
includeLegacyOwnerRows,
|
|
137
140
|
window,
|
|
138
141
|
);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
);
|
|
169
|
-
await tx
|
|
170
|
-
.delete(schema.analyticsUserDays)
|
|
171
|
-
.where(
|
|
172
|
-
windowPredicate(
|
|
173
|
-
schema.analyticsUserDays,
|
|
174
|
-
scopePredicate(
|
|
175
|
-
schema.analyticsUserDays,
|
|
176
|
-
scope,
|
|
177
|
-
includeLegacyOwnerRows,
|
|
178
|
-
),
|
|
179
|
-
window,
|
|
180
|
-
),
|
|
181
|
-
);
|
|
182
|
-
});
|
|
142
|
+
|
|
143
|
+
for (const table of [
|
|
144
|
+
"analytics_events",
|
|
145
|
+
"analytics_event_daily_rollups",
|
|
146
|
+
"analytics_user_days",
|
|
147
|
+
] as const) {
|
|
148
|
+
const {
|
|
149
|
+
sql: whereSql,
|
|
150
|
+
args,
|
|
151
|
+
timeColumn,
|
|
152
|
+
} = purgeWhereSql(table, scope, includeLegacyOwnerRows, window);
|
|
153
|
+
while (true) {
|
|
154
|
+
const result = await getDbExec().execute({
|
|
155
|
+
sql: `WITH candidates AS (
|
|
156
|
+
SELECT id
|
|
157
|
+
FROM ${table}
|
|
158
|
+
WHERE ${whereSql}
|
|
159
|
+
ORDER BY ${timeColumn}, id
|
|
160
|
+
LIMIT ?
|
|
161
|
+
)
|
|
162
|
+
DELETE FROM ${table}
|
|
163
|
+
WHERE id IN (SELECT id FROM candidates)`,
|
|
164
|
+
args: [...args, PURGE_BATCH_SIZE],
|
|
165
|
+
timeoutMs: PURGE_BATCH_TIMEOUT_MS,
|
|
166
|
+
maxAttempts: 1,
|
|
167
|
+
});
|
|
168
|
+
if (Number(result.rowsAffected ?? 0) < PURGE_BATCH_SIZE) break;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
183
171
|
return counts;
|
|
184
172
|
}
|
|
@@ -194,6 +194,29 @@ interface ParsedCssBorder {
|
|
|
194
194
|
color: string;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
+
/**
|
|
198
|
+
* PowerPoint's `a:spcPct val="100000"` is 100% of the font's *natural* line
|
|
199
|
+
* height, which CSS renders as `line-height: 1.2`, so the importer multiplies a
|
|
200
|
+
* declared percentage by that ratio. Writing the CSS value back out as `lnSpc`
|
|
201
|
+
* unchanged applied that correction a second time, and every imported paragraph
|
|
202
|
+
* came back 20% looser than the source. Neither copy of the constant is
|
|
203
|
+
* exported — `SINGLE_LINE_SPACING_RATIO` in packages/core/src/ingestion/pptx.ts
|
|
204
|
+
* and `DEFAULT_LINE_SPACING` in server/handlers/import/html-converter.ts — so
|
|
205
|
+
* all three have to move together.
|
|
206
|
+
*/
|
|
207
|
+
const SINGLE_LINE_SPACING_RATIO = 1.2;
|
|
208
|
+
|
|
209
|
+
/** A CSS line-height ratio as the single-spacing multiple `lnSpc` measures. */
|
|
210
|
+
function cssLineHeightToSpacingMultiple(
|
|
211
|
+
lineHeight: number | undefined,
|
|
212
|
+
): number | undefined {
|
|
213
|
+
return lineHeight !== undefined &&
|
|
214
|
+
Number.isFinite(lineHeight) &&
|
|
215
|
+
lineHeight > 0
|
|
216
|
+
? lineHeight / SINGLE_LINE_SPACING_RATIO
|
|
217
|
+
: undefined;
|
|
218
|
+
}
|
|
219
|
+
|
|
197
220
|
/** Parse a CSS `border` shorthand. `none`/`hidden` borders yield `undefined`. */
|
|
198
221
|
function parseCssBorder(
|
|
199
222
|
border: string | null | undefined,
|
|
@@ -320,6 +343,8 @@ interface ShapeElement {
|
|
|
320
343
|
lineTransparency?: number; // 0-100, percent transparent
|
|
321
344
|
lineWidth?: number; // in pt
|
|
322
345
|
lineDashType?: NonNullable<PptxGenJS.ShapeLineProps["dashType"]>;
|
|
346
|
+
lineHeadType?: NonNullable<PptxGenJS.ShapeLineProps["beginArrowType"]>;
|
|
347
|
+
lineTailType?: NonNullable<PptxGenJS.ShapeLineProps["endArrowType"]>;
|
|
323
348
|
/** A PowerPoint preset geometry name, or `custGeom` when `points` carry a traced outline. */
|
|
324
349
|
shapeType?: string;
|
|
325
350
|
rectRadius?: number; // inches; roundRect corner radius
|
|
@@ -591,6 +616,8 @@ export function parseSlideHtml(
|
|
|
591
616
|
w: contentW,
|
|
592
617
|
h: elHeight + 0.2,
|
|
593
618
|
letterSpacing: letterSpacing ? parseFloat(letterSpacing) : undefined,
|
|
619
|
+
// Editor-authored HTML already uses the multiple pptxgenjs expects;
|
|
620
|
+
// the importer-only correction belongs in parseImportedSlideHtml.
|
|
594
621
|
lineSpacingMultiple: lineH,
|
|
595
622
|
});
|
|
596
623
|
|
|
@@ -748,6 +775,7 @@ function parseImportedSlideHtml(html: string, dims: SlideDims): ParsedSlide {
|
|
|
748
775
|
const border = parseCssBorder(getStyle(style, "border"));
|
|
749
776
|
const parsedLine = border ? colorToHex(border.color) : undefined;
|
|
750
777
|
const outline = importedFreeformStroke(innerHtml, dims);
|
|
778
|
+
const line = importedLineStroke(style, innerHtml, dims);
|
|
751
779
|
shapes.push({
|
|
752
780
|
...geometry,
|
|
753
781
|
...(parsedFill
|
|
@@ -770,6 +798,9 @@ function parseImportedSlideHtml(html: string, dims: SlideDims): ParsedSlide {
|
|
|
770
798
|
}
|
|
771
799
|
: {}),
|
|
772
800
|
...importedShapeGeometry(attrs, style, outline?.path, geometry, dims),
|
|
801
|
+
// A single-edge border is the importer's own verdict that this box is a
|
|
802
|
+
// line rather than an outline, so it settles the geometry too.
|
|
803
|
+
...line,
|
|
773
804
|
...(rotate != null ? { rotate } : {}),
|
|
774
805
|
order: match.index,
|
|
775
806
|
});
|
|
@@ -818,7 +849,9 @@ function parseImportedSlideHtml(html: string, dims: SlideDims): ParsedSlide {
|
|
|
818
849
|
bold: runs.length > 0 && runs.every((run) => run.options.bold === true),
|
|
819
850
|
align:
|
|
820
851
|
alignValue === "center" || alignValue === "right" ? alignValue : "left",
|
|
821
|
-
lineSpacingMultiple:
|
|
852
|
+
lineSpacingMultiple: cssLineHeightToSpacingMultiple(
|
|
853
|
+
lineHeight ? Number(lineHeight) : undefined,
|
|
854
|
+
),
|
|
822
855
|
x: geometry.x,
|
|
823
856
|
y: geometry.y,
|
|
824
857
|
w: geometry.w,
|
|
@@ -998,6 +1031,93 @@ function importedFreeformStroke(
|
|
|
998
1031
|
};
|
|
999
1032
|
}
|
|
1000
1033
|
|
|
1034
|
+
/** The line axis each single-edge border the importer writes draws along. */
|
|
1035
|
+
const SINGLE_EDGE_BORDER_AXES = {
|
|
1036
|
+
"border-top": "x",
|
|
1037
|
+
"border-left": "y",
|
|
1038
|
+
} as const;
|
|
1039
|
+
|
|
1040
|
+
/**
|
|
1041
|
+
* The stroke of a `<p:cxnSp>` or a degenerate `<p:sp>` — a box with one
|
|
1042
|
+
* dimension of zero. The importer draws those with a single `border-left` or
|
|
1043
|
+
* `border-top` rather than the `border` shorthand (`strokeDecoration` in
|
|
1044
|
+
* server/handlers/import/html-converter.ts), which `parseCssBorder` above
|
|
1045
|
+
* cannot see, so every connector used to export as a `rect` of `cx="0"` with
|
|
1046
|
+
* `<a:noFill/>` and an empty `<a:ln/>`: no width, no color, no ends, nothing
|
|
1047
|
+
* drawn. Reading the edge the importer actually wrote gives back the real line.
|
|
1048
|
+
*/
|
|
1049
|
+
function importedLineStroke(
|
|
1050
|
+
style: string,
|
|
1051
|
+
innerHtml: string,
|
|
1052
|
+
dims: SlideDims,
|
|
1053
|
+
):
|
|
1054
|
+
| (Pick<
|
|
1055
|
+
ShapeElement,
|
|
1056
|
+
| "shapeType"
|
|
1057
|
+
| "lineColor"
|
|
1058
|
+
| "lineTransparency"
|
|
1059
|
+
| "lineWidth"
|
|
1060
|
+
| "lineDashType"
|
|
1061
|
+
| "lineHeadType"
|
|
1062
|
+
| "lineTailType"
|
|
1063
|
+
> &
|
|
1064
|
+
Partial<Pick<ShapeElement, "w" | "h">>)
|
|
1065
|
+
| undefined {
|
|
1066
|
+
for (const [property, axis] of Object.entries(SINGLE_EDGE_BORDER_AXES)) {
|
|
1067
|
+
const border = parseCssBorder(getStyle(style, property));
|
|
1068
|
+
if (!border) continue;
|
|
1069
|
+
const color = colorToHex(border.color);
|
|
1070
|
+
return {
|
|
1071
|
+
shapeType: "line",
|
|
1072
|
+
// A single-edge border is a line in the element's local coordinate
|
|
1073
|
+
// system. Keep its perpendicular dimension collapsed after the box
|
|
1074
|
+
// geometry has been parsed, or a thin rule becomes a diagonal line.
|
|
1075
|
+
...(axis === "x" ? { h: 0 } : { w: 0 }),
|
|
1076
|
+
lineColor: color.hex,
|
|
1077
|
+
lineTransparency: color.transparency,
|
|
1078
|
+
// The same 0.5pt floor the outline paths use, for the same reason:
|
|
1079
|
+
// `pxToPt` rounds, and a hairline that rounds to 0pt draws nothing.
|
|
1080
|
+
lineWidth: Math.max(0.5, pxToPt(border.widthPx, dims)),
|
|
1081
|
+
...(border.dashType ? { lineDashType: border.dashType } : {}),
|
|
1082
|
+
...importedLineEndTypes(innerHtml, axis),
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
return undefined;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
/**
|
|
1089
|
+
* The `<a:headEnd>`/`<a:tailEnd>` the importer redraws as absolutely
|
|
1090
|
+
* positioned `<circle>` overlays (`lineEndCaps` in html-converter.ts). It only
|
|
1091
|
+
* ever reproduces `oval`, and it centers the overlay on the line, so a circle
|
|
1092
|
+
* before the viewBox midpoint caps the head and one after it caps the tail —
|
|
1093
|
+
* still true for a flipped source, because the importer swapped the two before
|
|
1094
|
+
* drawing them.
|
|
1095
|
+
*/
|
|
1096
|
+
function importedLineEndTypes(
|
|
1097
|
+
innerHtml: string,
|
|
1098
|
+
axis: "x" | "y",
|
|
1099
|
+
): Pick<ShapeElement, "lineHeadType" | "lineTailType"> {
|
|
1100
|
+
const svg = innerHtml.match(/<svg\b([^>]*)>([\s\S]*?)<\/svg>/i);
|
|
1101
|
+
const viewBox = getAttribute(svg?.[1] ?? "", "viewBox")
|
|
1102
|
+
?.trim()
|
|
1103
|
+
.split(/[\s,]+/)
|
|
1104
|
+
.map(Number);
|
|
1105
|
+
if (!svg || viewBox?.length !== 4 || !viewBox.every(Number.isFinite)) {
|
|
1106
|
+
return {};
|
|
1107
|
+
}
|
|
1108
|
+
const middle = (axis === "x" ? viewBox[2] : viewBox[3]) / 2;
|
|
1109
|
+
const ends: Pick<ShapeElement, "lineHeadType" | "lineTailType"> = {};
|
|
1110
|
+
for (const circle of svg[2].matchAll(/<circle\b([^>]*)>/gi)) {
|
|
1111
|
+
const alongAttribute = getAttribute(circle[1], axis === "x" ? "cx" : "cy");
|
|
1112
|
+
if (alongAttribute == null) continue;
|
|
1113
|
+
const along = Number(alongAttribute);
|
|
1114
|
+
if (!Number.isFinite(along)) continue;
|
|
1115
|
+
if (along < middle) ends.lineHeadType = "oval";
|
|
1116
|
+
else ends.lineTailType = "oval";
|
|
1117
|
+
}
|
|
1118
|
+
return ends;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1001
1121
|
type CustomGeometryPoint = NonNullable<ShapeElement["points"]>[number];
|
|
1002
1122
|
|
|
1003
1123
|
/** Numbers each SVG path command consumes. The importer emits only these. */
|
|
@@ -2021,6 +2141,12 @@ export default defineAction({
|
|
|
2021
2141
|
...(shape.lineDashType
|
|
2022
2142
|
? { dashType: shape.lineDashType }
|
|
2023
2143
|
: {}),
|
|
2144
|
+
...(shape.lineHeadType
|
|
2145
|
+
? { beginArrowType: shape.lineHeadType }
|
|
2146
|
+
: {}),
|
|
2147
|
+
...(shape.lineTailType
|
|
2148
|
+
? { endArrowType: shape.lineTailType }
|
|
2149
|
+
: {}),
|
|
2024
2150
|
...(shape.lineTransparency != null
|
|
2025
2151
|
? { transparency: shape.lineTransparency }
|
|
2026
2152
|
: {}),
|
|
@@ -14,10 +14,18 @@ const UPLOAD_URL =
|
|
|
14
14
|
"https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart&fields=id,webViewLink";
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Uploads a
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
17
|
+
* Uploads a PPTX into the user's Drive, letting Drive convert it to a native
|
|
18
|
+
* Google Slides deck. The caller decides which exporter produced those bytes,
|
|
19
|
+
* and which one is higher fidelity depends on the deck:
|
|
20
|
+
*
|
|
21
|
+
* - Source-imported decks go through the server `export-pptx`, which writes the
|
|
22
|
+
* source's own geometry as real vector shapes. The browser exporter cannot —
|
|
23
|
+
* `dom-to-pptx` has no custom-geometry support at all and rasterizes every
|
|
24
|
+
* vector shape to a bitmap, so Google receives silhouettes instead of curves.
|
|
25
|
+
* - Editor-authored decks go through the browser exporter, the only place
|
|
26
|
+
* geometry positioned in the DOM is measurable.
|
|
27
|
+
*
|
|
28
|
+
* See "Export Behavior" in `templates/slides/AGENTS.md` for the routing rule.
|
|
21
29
|
*/
|
|
22
30
|
export default defineEventHandler(async (event) => {
|
|
23
31
|
const session = await getSession(event).catch(() => null);
|
|
@@ -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/db/client.js
CHANGED
|
@@ -763,6 +763,7 @@ export async function withDbTimeout(op, run, ms = dbOpTimeoutMs(), onTimeout) {
|
|
|
763
763
|
*/
|
|
764
764
|
export function isServerlessRuntime() {
|
|
765
765
|
return (!!process.env.NETLIFY ||
|
|
766
|
+
!!process.env.NETLIFY_FUNCTION_NAME ||
|
|
766
767
|
!!process.env.VERCEL ||
|
|
767
768
|
!!process.env.AWS_LAMBDA_FUNCTION_NAME ||
|
|
768
769
|
!!process.env.LAMBDA_TASK_ROOT ||
|
|
@@ -17,11 +17,11 @@ declare const _default: import("../../action.js").ActionDefinition<{
|
|
|
17
17
|
id?: undefined;
|
|
18
18
|
provider?: undefined;
|
|
19
19
|
} | {
|
|
20
|
-
error?: undefined;
|
|
21
20
|
configured?: undefined;
|
|
22
21
|
connectPath?: undefined;
|
|
23
22
|
url: string;
|
|
24
23
|
id: string;
|
|
25
24
|
provider: string;
|
|
25
|
+
error?: undefined;
|
|
26
26
|
}>;
|
|
27
27
|
export default _default;
|
|
@@ -708,12 +708,15 @@ export function createIntegrationsPlugin(options) {
|
|
|
708
708
|
// sees the request. Keep the device secret in a dedicated TLS-only
|
|
709
709
|
// header as a transport fallback; the value is still hashed and looked
|
|
710
710
|
// up by authenticateRemoteDeviceToken, never persisted raw.
|
|
711
|
-
const
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
711
|
+
const candidates = [
|
|
712
|
+
getRequestHeader(event, "x-agent-native-device-token")?.trim() || null,
|
|
713
|
+
extractBearerToken(getRequestHeader(event, "authorization")),
|
|
714
|
+
].filter((token, index, all) => Boolean(token) && all.indexOf(token) === index);
|
|
715
|
+
for (const token of candidates) {
|
|
716
|
+
const device = await authenticateRemoteDeviceToken(token);
|
|
717
|
+
if (device)
|
|
718
|
+
return device;
|
|
719
|
+
}
|
|
717
720
|
setResponseStatus(event, 401);
|
|
718
721
|
return null;
|
|
719
722
|
}
|
|
@@ -137,13 +137,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
137
137
|
inputSchema: {
|
|
138
138
|
type: string;
|
|
139
139
|
properties: {
|
|
140
|
+
count?: undefined;
|
|
140
141
|
query?: undefined;
|
|
141
142
|
minutes?: undefined;
|
|
142
143
|
limit?: undefined;
|
|
143
144
|
clientHint?: undefined;
|
|
144
145
|
timestamp?: undefined;
|
|
145
146
|
chapterId?: undefined;
|
|
146
|
-
count?: undefined;
|
|
147
147
|
startAt?: undefined;
|
|
148
148
|
endAt?: undefined;
|
|
149
149
|
reason?: undefined;
|
|
@@ -159,6 +159,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
159
159
|
inputSchema: {
|
|
160
160
|
type: string;
|
|
161
161
|
properties: {
|
|
162
|
+
count?: undefined;
|
|
162
163
|
query: {
|
|
163
164
|
type: string;
|
|
164
165
|
description: string;
|
|
@@ -174,7 +175,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
174
175
|
clientHint?: undefined;
|
|
175
176
|
timestamp?: undefined;
|
|
176
177
|
chapterId?: undefined;
|
|
177
|
-
count?: undefined;
|
|
178
178
|
startAt?: undefined;
|
|
179
179
|
endAt?: undefined;
|
|
180
180
|
reason?: undefined;
|
|
@@ -190,6 +190,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
190
190
|
inputSchema: {
|
|
191
191
|
type: string;
|
|
192
192
|
properties: {
|
|
193
|
+
count?: undefined;
|
|
193
194
|
minutes: {
|
|
194
195
|
type: string;
|
|
195
196
|
description: string;
|
|
@@ -199,7 +200,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
199
200
|
clientHint?: undefined;
|
|
200
201
|
timestamp?: undefined;
|
|
201
202
|
chapterId?: undefined;
|
|
202
|
-
count?: undefined;
|
|
203
203
|
startAt?: undefined;
|
|
204
204
|
endAt?: undefined;
|
|
205
205
|
reason?: undefined;
|
|
@@ -216,6 +216,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
216
216
|
type: string;
|
|
217
217
|
required: string[];
|
|
218
218
|
properties: {
|
|
219
|
+
count?: undefined;
|
|
219
220
|
query: {
|
|
220
221
|
type: string;
|
|
221
222
|
description: string;
|
|
@@ -234,7 +235,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
234
235
|
};
|
|
235
236
|
timestamp?: undefined;
|
|
236
237
|
chapterId?: undefined;
|
|
237
|
-
count?: undefined;
|
|
238
238
|
startAt?: undefined;
|
|
239
239
|
endAt?: undefined;
|
|
240
240
|
reason?: undefined;
|
|
@@ -250,6 +250,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
250
250
|
type: string;
|
|
251
251
|
required: string[];
|
|
252
252
|
properties: {
|
|
253
|
+
count?: undefined;
|
|
253
254
|
query?: undefined;
|
|
254
255
|
minutes?: undefined;
|
|
255
256
|
limit?: undefined;
|
|
@@ -263,7 +264,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
|
|
|
263
264
|
description: string;
|
|
264
265
|
};
|
|
265
266
|
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;
|
|
317
318
|
query?: undefined;
|
|
318
319
|
minutes?: undefined;
|
|
319
320
|
limit?: undefined;
|
|
320
321
|
clientHint?: undefined;
|
|
321
322
|
timestamp?: undefined;
|
|
322
323
|
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;
|
|
352
353
|
query?: undefined;
|
|
353
354
|
minutes?: undefined;
|
|
354
355
|
limit?: undefined;
|
|
355
356
|
clientHint?: undefined;
|
|
356
357
|
timestamp?: undefined;
|
|
357
358
|
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;
|
|
19
20
|
updated: number;
|
|
20
21
|
error?: undefined;
|
|
21
22
|
ok?: undefined;
|
|
22
|
-
count?: undefined;
|
|
23
23
|
} | {
|
|
24
|
+
count?: undefined;
|
|
24
25
|
updated?: undefined;
|
|
25
26
|
error: string;
|
|
26
27
|
ok?: undefined;
|
|
27
|
-
count?: undefined;
|
|
28
28
|
} | {
|
|
29
|
+
count?: undefined;
|
|
29
30
|
updated?: undefined;
|
|
30
31
|
error?: undefined;
|
|
31
32
|
ok: boolean;
|
|
32
|
-
count?: undefined;
|
|
33
33
|
}>>;
|
|
@@ -42,22 +42,22 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
42
42
|
avgEvalScore: number;
|
|
43
43
|
} | {
|
|
44
44
|
error?: undefined;
|
|
45
|
-
ok?: undefined;
|
|
46
45
|
summary: import("./types.js").TraceSummary;
|
|
47
46
|
spans: import("./types.js").TraceSpan[];
|
|
48
47
|
id?: undefined;
|
|
48
|
+
ok?: undefined;
|
|
49
49
|
} | {
|
|
50
50
|
error?: undefined;
|
|
51
|
-
ok?: undefined;
|
|
52
51
|
summary?: undefined;
|
|
53
52
|
spans?: undefined;
|
|
54
53
|
id: string;
|
|
55
|
-
} | {
|
|
56
54
|
ok?: undefined;
|
|
55
|
+
} | {
|
|
57
56
|
summary?: undefined;
|
|
58
57
|
spans?: undefined;
|
|
59
58
|
id?: undefined;
|
|
60
59
|
error: any;
|
|
60
|
+
ok?: undefined;
|
|
61
61
|
} | {
|
|
62
62
|
error?: undefined;
|
|
63
63
|
summary?: undefined;
|
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
|
-
ok?: undefined;
|
|
38
37
|
status?: undefined;
|
|
38
|
+
ok?: undefined;
|
|
39
39
|
} | {
|
|
40
40
|
error?: undefined;
|
|
41
41
|
ok: boolean;
|
|
42
42
|
status: string;
|
|
43
43
|
} | {
|
|
44
|
-
ok?: undefined;
|
|
45
44
|
error: string;
|
|
46
45
|
removed?: undefined;
|
|
46
|
+
ok?: undefined;
|
|
47
47
|
} | {
|
|
48
48
|
error?: undefined;
|
|
49
49
|
ok: boolean;
|
|
@@ -54,9 +54,9 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
|
|
|
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;
|
|
58
57
|
error: string;
|
|
59
58
|
note?: undefined;
|
|
59
|
+
ok?: undefined;
|
|
60
60
|
} | {
|
|
61
61
|
error?: undefined;
|
|
62
62
|
ok: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.157.
|
|
3
|
+
"version": "0.157.12",
|
|
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": {
|