@agent-native/core 0.177.0 → 0.177.1-nightly-20260908151642

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.
@@ -555,3 +555,69 @@ export async function cdpScreenshot(
555
555
  const { writeFile } = await import("node:fs/promises");
556
556
  await writeFile(filePath, Buffer.from(data, "base64"));
557
557
  }
558
+
559
+ /** Inner markup of one node, matched by walking tag depth from its open tag —
560
+ * a non-greedy regex would stop at the first `</div>` of a nested child. */
561
+ export function elementInner(html: string, nodeId: string): string {
562
+ const openIndex = html.indexOf(`data-agent-native-node-id="${nodeId}"`);
563
+ if (openIndex < 0) throw new Error(`node ${nodeId} not found`);
564
+ const tagStart = html.lastIndexOf("<", openIndex);
565
+ const tag = /^<([a-zA-Z0-9-]+)/.exec(html.slice(tagStart))?.[1];
566
+ if (!tag) throw new Error(`no tag for ${nodeId}`);
567
+ const contentStart = html.indexOf(">", openIndex) + 1;
568
+ const pattern = new RegExp(`</?${tag}\\b`, "g");
569
+ pattern.lastIndex = contentStart;
570
+ let depth = 1;
571
+ let match: RegExpExecArray | null;
572
+ while ((match = pattern.exec(html))) {
573
+ depth += match[0].startsWith("</") ? -1 : 1;
574
+ if (depth === 0) return html.slice(contentStart, match.index);
575
+ }
576
+ throw new Error(`unbalanced ${tag} for ${nodeId}`);
577
+ }
578
+
579
+ const VOID_TAGS = new Set([
580
+ "area",
581
+ "base",
582
+ "br",
583
+ "col",
584
+ "embed",
585
+ "hr",
586
+ "img",
587
+ "input",
588
+ "link",
589
+ "meta",
590
+ "source",
591
+ "track",
592
+ "wbr",
593
+ ]);
594
+
595
+ /** Node ids of one node's direct children, in DOM order. A subtree-wide scan
596
+ * also collects the generated `<span data-an-text>` ids inside painted or
597
+ * padded text leaves, which are not flow children of this node. */
598
+ export function childNodeIds(html: string, parentId: string): string[] {
599
+ const ids: string[] = [];
600
+ let depth = 0;
601
+ for (const tag of elementInner(html, parentId).matchAll(
602
+ /<(\/?)([a-zA-Z0-9-]+)([^>]*)>/g,
603
+ )) {
604
+ const [, slash, name, attrs] = tag as unknown as [
605
+ string,
606
+ string,
607
+ string,
608
+ string,
609
+ ];
610
+ if (slash === "/") {
611
+ depth -= 1;
612
+ continue;
613
+ }
614
+ if (depth === 0) {
615
+ const id = /data-agent-native-node-id="([^"]+)"/.exec(attrs)?.[1];
616
+ if (id) ids.push(id);
617
+ }
618
+ if (!attrs.trimEnd().endsWith("/") && !VOID_TAGS.has(name.toLowerCase())) {
619
+ depth += 1;
620
+ }
621
+ }
622
+ return ids;
623
+ }
@@ -407,7 +407,7 @@ export function AgentTabsPage({ appName, extraTabs = [], extraTabFactories = [],
407
407
  event.preventDefault();
408
408
  selectSearchResult(results[0]);
409
409
  }
410
- }, placeholder: searchPlaceholder, "aria-label": searchPlaceholder, className: "h-8 w-full rounded-md border border-border bg-background ps-8 pe-7 text-[13px] text-foreground outline-none transition-colors placeholder:text-muted-foreground focus:border-foreground/30 focus:ring-2 focus:ring-accent/40" }), query && (_jsx("button", { type: "button", onClick: () => setQuery(""), "aria-label": "Clear search", className: "absolute end-1.5 top-1/2 flex size-5 -translate-y-1/2 cursor-pointer items-center justify-center rounded text-muted-foreground hover:bg-accent/60 hover:text-foreground", children: _jsx(IconX, { className: "size-3.5" }) }))] })) : null, query.trim() ? (_jsx("div", { role: "listbox", "aria-label": "Agent search results", className: "flex flex-col gap-0.5", children: results.length === 0 ? (_jsx("p", { className: "px-2 py-6 text-center text-xs text-muted-foreground", children: "No matching items" })) : (results.map((entry) => (_jsx("button", { type: "button", role: "option", onClick: () => selectSearchResult(entry), className: "flex cursor-pointer items-start gap-2 rounded-md px-2.5 py-2 text-start text-sm text-foreground hover:bg-accent/60", children: _jsxs("span", { className: "flex min-w-0 flex-col", children: [_jsx("span", { className: "truncate font-medium", children: entry.label }), _jsx("span", { className: "truncate text-[11px] text-muted-foreground", children: entry.description ?? entry.tabId })] }) }, entry.id)))) })) : (_jsx("nav", { "aria-label": "Agent sections", role: "tablist", className: "flex gap-1 overflow-x-auto sm:flex-col sm:overflow-x-visible", children: tabGroups.map((group, groupIndex) => (_jsxs("div", { className: cn("contents sm:block", groupIndex > 0 &&
410
+ }, placeholder: searchPlaceholder, "aria-label": searchPlaceholder, className: "agent-native-search-input h-8 w-full rounded-md border border-border bg-background ps-8 pe-7 text-[13px] text-foreground outline-none transition-colors placeholder:text-muted-foreground focus:border-foreground/30 focus:ring-2 focus:ring-accent/40" }), query && (_jsx("button", { type: "button", onClick: () => setQuery(""), "aria-label": "Clear search", className: "absolute end-1.5 top-1/2 flex size-5 -translate-y-1/2 cursor-pointer items-center justify-center rounded text-muted-foreground hover:bg-accent/60 hover:text-foreground", children: _jsx(IconX, { className: "size-3.5" }) }))] })) : null, query.trim() ? (_jsx("div", { role: "listbox", "aria-label": "Agent search results", className: "flex flex-col gap-0.5", children: results.length === 0 ? (_jsx("p", { className: "px-2 py-6 text-center text-xs text-muted-foreground", children: "No matching items" })) : (results.map((entry) => (_jsx("button", { type: "button", role: "option", onClick: () => selectSearchResult(entry), className: "flex cursor-pointer items-start gap-2 rounded-md px-2.5 py-2 text-start text-sm text-foreground hover:bg-accent/60", children: _jsxs("span", { className: "flex min-w-0 flex-col", children: [_jsx("span", { className: "truncate font-medium", children: entry.label }), _jsx("span", { className: "truncate text-[11px] text-muted-foreground", children: entry.description ?? entry.tabId })] }) }, entry.id)))) })) : (_jsx("nav", { "aria-label": "Agent sections", role: "tablist", className: "flex gap-1 overflow-x-auto sm:flex-col sm:overflow-x-visible", children: tabGroups.map((group, groupIndex) => (_jsxs("div", { className: cn("contents sm:block", groupIndex > 0 &&
411
411
  "sm:mt-2 sm:border-t sm:border-border/60 sm:pt-2"), children: [group.id === "resources" && (_jsx("div", { className: "hidden px-2.5 pb-1 pt-1 text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground/50 sm:block", children: "Agent resources" })), group.id === "agent" && (_jsx("div", { className: "hidden px-2.5 pb-1 pt-1 text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground/50 sm:block", children: "Agent operations" })), _jsx("div", { className: "contents sm:flex sm:flex-col sm:gap-1", children: group.tabs.map((tab) => {
412
412
  const Icon = tab.icon;
413
413
  const selected = tab.id === selectedTab?.id;
@@ -413,7 +413,7 @@ function SettingsTabsPageContent({ general, account, team, whatsNew, extraTabs =
413
413
  event.preventDefault();
414
414
  selectEntry(results[0]);
415
415
  }
416
- }, placeholder: searchPlaceholder, "aria-label": searchPlaceholder, className: "h-8 w-full rounded-md border border-border bg-background ps-8 pe-7 text-[13px] text-foreground outline-none transition-colors placeholder:text-muted-foreground focus:border-foreground/30 focus:ring-2 focus:ring-accent/40" }), query ? (_jsx("button", { type: "button", onClick: () => setQuery(""), "aria-label": "Clear search", className: "absolute end-1.5 top-1/2 flex size-5 -translate-y-1/2 items-center justify-center rounded text-muted-foreground hover:bg-accent/60 hover:text-foreground", children: _jsx(IconX, { className: "size-3.5" }) })) : null] })) : null, searching ? (_jsx("div", { role: "listbox", "aria-label": "Settings search results", className: "flex flex-col gap-0.5", children: results.length === 0 ? (_jsx("p", { className: "px-2 py-6 text-center text-[12px] text-muted-foreground", children: "No matching settings" })) : (results.map((entry) => {
416
+ }, placeholder: searchPlaceholder, "aria-label": searchPlaceholder, className: "agent-native-search-input h-8 w-full rounded-md border border-border bg-background ps-8 pe-7 text-[13px] text-foreground outline-none transition-colors placeholder:text-muted-foreground focus:border-foreground/30 focus:ring-2 focus:ring-accent/40" }), query ? (_jsx("button", { type: "button", onClick: () => setQuery(""), "aria-label": "Clear search", className: "absolute end-1.5 top-1/2 flex size-5 -translate-y-1/2 items-center justify-center rounded text-muted-foreground hover:bg-accent/60 hover:text-foreground", children: _jsx(IconX, { className: "size-3.5" }) })) : null] })) : null, searching ? (_jsx("div", { role: "listbox", "aria-label": "Settings search results", className: "flex flex-col gap-0.5", children: results.length === 0 ? (_jsx("p", { className: "px-2 py-6 text-center text-[12px] text-muted-foreground", children: "No matching settings" })) : (results.map((entry) => {
417
417
  const Icon = entry.icon;
418
418
  const tab = tabs.find((candidate) => candidate.id === entry.tabId);
419
419
  const entryHash = entry.hash?.replace(/^#/, "");
@@ -3,18 +3,18 @@ declare const _default: import("../../action.js").ActionDefinition<{
3
3
  url?: string;
4
4
  filename?: string;
5
5
  }, {
6
- id?: undefined;
7
6
  error: string;
8
7
  configured?: undefined;
9
8
  connectPath?: undefined;
10
9
  url?: undefined;
10
+ id?: undefined;
11
11
  provider?: undefined;
12
12
  } | {
13
- id?: undefined;
14
13
  error: string;
15
14
  configured: boolean;
16
15
  connectPath: string;
17
16
  url?: undefined;
17
+ id?: undefined;
18
18
  provider?: undefined;
19
19
  } | {
20
20
  error?: undefined;
@@ -28,6 +28,6 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
28
28
  } | {
29
29
  count?: undefined;
30
30
  updated?: undefined;
31
- ok: boolean;
32
31
  error?: undefined;
32
+ ok: boolean;
33
33
  }>>;
@@ -41,27 +41,27 @@ 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
- id?: undefined;
59
59
  error: any;
60
- ok?: undefined;
60
+ id?: undefined;
61
61
  } | {
62
+ error?: undefined;
62
63
  summary?: undefined;
63
64
  spans?: undefined;
64
- id?: undefined;
65
- error?: undefined;
66
65
  ok: boolean;
66
+ id?: undefined;
67
67
  }>>;
@@ -34,10 +34,10 @@ export declare function resolveAgentEngineApiKeyWriteTarget(event: H3Event, scop
34
34
  export declare function createAgentEngineApiKeyHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
35
35
  error: any;
36
36
  } | {
37
- error?: undefined;
38
37
  ok: boolean;
39
38
  key: string;
40
39
  baseUrlKey?: string;
41
40
  scope: AgentEngineApiKeyScope;
41
+ error?: undefined;
42
42
  }>>;
43
43
  export {};
@@ -1224,3 +1224,14 @@
1224
1224
  }
1225
1225
  }
1226
1226
  }
1227
+
1228
+ /* Search inputs that render their own clear button must hide the
1229
+ browser's native WebKit cancel icon, or two clear controls stack on
1230
+ top of each other. Scoped to inputs that opt in via this class, since
1231
+ other type="search" inputs rely on the native control as their only
1232
+ clear affordance. Not motion-related, so it must not live inside the
1233
+ surrounding `prefers-reduced-motion: no-preference` block above. */
1234
+ input.agent-native-search-input::-webkit-search-cancel-button {
1235
+ -webkit-appearance: none;
1236
+ appearance: none;
1237
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.177.0",
3
+ "version": "0.177.1-nightly-20260908151642",
4
4
  "description": "The agentic application framework for building autonomous agents with intuitive UIs",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {