@agent-native/core 0.123.2 → 0.124.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.
@@ -1,5 +1,17 @@
1
1
  # @agent-native/core
2
2
 
3
+ ## 0.124.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e9dd025: `agent-native dev --inspect` (and `--inspect-brk`, optionally `=<port>`) now
8
+ attaches the Node inspector to **only** the Nitro API-server process, on a
9
+ single known port (default 9229). It selects Nitro's `node-process` dev runner
10
+ so the server is a real, attachable process, and injects `NODE_OPTIONS` through
11
+ a Vite preload that runs before Vite's own startup — so Vite, pnpm, and the CLI
12
+ are never inspected and there is exactly one debugger target. Set
13
+ `NITRO_DEV_RUNNER` yourself to override the runner.
14
+
3
15
  ## 0.123.2
4
16
 
5
17
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.123.2",
3
+ "version": "0.124.0",
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": {
@@ -1,6 +1,8 @@
1
+ import { getOrgContext } from "@agent-native/core/org";
1
2
  import {
2
3
  FeatureNotConfiguredError,
3
4
  getSession,
5
+ runWithRequestContext,
4
6
  startBuilderDesignSystemIndex,
5
7
  } from "@agent-native/core/server";
6
8
  import {
@@ -89,28 +91,43 @@ export const indexDesignSystemWithBuilder = defineEventHandler(
89
91
  .replace(/[-_]+/g, " ")
90
92
  .trim() || "Imported brand";
91
93
 
94
+ // `session.orgId` is set at sign-in and not refreshed when the user
95
+ // switches orgs; `getOrgContext` resolves the live active-org setting.
96
+ let orgId: string | undefined;
92
97
  try {
93
- const result = await startBuilderDesignSystemIndex({
94
- projectName: suggestedTitle,
95
- files: [
96
- {
97
- name: filename,
98
- data: part.data,
99
- mimeType: "application/octet-stream",
100
- },
101
- ],
102
- });
103
- const proxy = await upsertBuilderProxyDesignSystem({
104
- result,
105
- ownerEmail: session.email,
106
- orgId: session.orgId ?? null,
107
- projectName: suggestedTitle,
108
- });
109
- return {
110
- ...result,
111
- ...proxy,
112
- uploadedFileCount: 1,
113
- };
98
+ orgId = (await getOrgContext(event)).orgId ?? undefined;
99
+ } catch {
100
+ // Org tables can be unavailable during first boot; fall back below.
101
+ }
102
+ orgId ??= session.orgId ?? undefined;
103
+
104
+ try {
105
+ return await runWithRequestContext(
106
+ { userEmail: session.email, orgId },
107
+ async () => {
108
+ const result = await startBuilderDesignSystemIndex({
109
+ projectName: suggestedTitle,
110
+ files: [
111
+ {
112
+ name: filename,
113
+ data: part.data,
114
+ mimeType: "application/octet-stream",
115
+ },
116
+ ],
117
+ });
118
+ const proxy = await upsertBuilderProxyDesignSystem({
119
+ result,
120
+ ownerEmail: session.email,
121
+ orgId: orgId ?? null,
122
+ projectName: suggestedTitle,
123
+ });
124
+ return {
125
+ ...result,
126
+ ...proxy,
127
+ uploadedFileCount: 1,
128
+ };
129
+ },
130
+ );
114
131
  } catch (err) {
115
132
  if (err instanceof FeatureNotConfiguredError) {
116
133
  setResponseStatus(event, 412);
@@ -11,6 +11,7 @@ import {
11
11
  } from "h3";
12
12
 
13
13
  import { upsertBuilderProxyDesignSystem } from "../lib/builder-design-system-proxy.js";
14
+ import { withSlidesRequestContext } from "./request-auth-context.js";
14
15
 
15
16
  const MAX_FIG_BYTES = 200 * 1024 * 1024;
16
17
  const MULTIPART_OVERHEAD_BYTES = 1024 * 1024;
@@ -72,27 +73,29 @@ export const indexDesignSystemWithBuilder = defineEventHandler(
72
73
  .trim() || "Imported brand";
73
74
 
74
75
  try {
75
- const result = await startBuilderDesignSystemIndex({
76
- projectName: suggestedTitle,
77
- files: [
78
- {
79
- name: part.filename || "brand.fig",
80
- data: part.data,
81
- mimeType: "application/octet-stream",
82
- },
83
- ],
84
- });
85
- const proxy = await upsertBuilderProxyDesignSystem({
86
- result,
87
- ownerEmail: session.email,
88
- orgId: session.orgId ?? null,
89
- projectName: suggestedTitle,
76
+ return await withSlidesRequestContext(event, async ({ orgId }) => {
77
+ const result = await startBuilderDesignSystemIndex({
78
+ projectName: suggestedTitle,
79
+ files: [
80
+ {
81
+ name: part.filename || "brand.fig",
82
+ data: part.data,
83
+ mimeType: "application/octet-stream",
84
+ },
85
+ ],
86
+ });
87
+ const proxy = await upsertBuilderProxyDesignSystem({
88
+ result,
89
+ ownerEmail: session.email,
90
+ orgId: orgId ?? null,
91
+ projectName: suggestedTitle,
92
+ });
93
+ return {
94
+ ...result,
95
+ ...proxy,
96
+ uploadedFileCount: 1,
97
+ };
90
98
  });
91
- return {
92
- ...result,
93
- ...proxy,
94
- uploadedFileCount: 1,
95
- };
96
99
  } catch (err) {
97
100
  if (err instanceof FeatureNotConfiguredError) {
98
101
  setResponseStatus(event, 412);
@@ -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,10 +77,10 @@ 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
  }>>;
86
86
  //# sourceMappingURL=awareness.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"awareness.d.ts","sourceRoot":"","sources":["../../src/collab/awareness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgB3C,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC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EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAOD,wBAAgB,mBAAmB,IAAI,YAAY,CAElD;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,cAAc,GAAG,SAAS,GAChC,IAAI,CAON;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,EAClD,KAAK,CAAC,EAAE,cAAc,GACrB,IAAI,CAgBN;AAoBD,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,MAAmB,GAC7B,IAAI,CAON;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAE1E;AAiBD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAO1E;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,IAAI,CAOnE;AAkCD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;;;;;kBAwDa,MAAM;eAAS,MAAM;;;GAoB1D,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;kBAYM,MAAM;kBAAY,MAAM;;;GAMvD,CAAC"}
@@ -26,8 +26,8 @@ export declare const getCollabState: import("h3").EventHandlerWithFetch<import("
26
26
  * Body: { update: string (base64), requestSource?: string }
27
27
  */
28
28
  export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
29
- error: string;
30
29
  ok?: undefined;
30
+ error: string;
31
31
  } | {
32
32
  error?: undefined;
33
33
  ok: boolean;
@@ -41,9 +41,9 @@ export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import
41
41
  * Body: { text: string, fieldName?: string, requestSource?: string }
42
42
  */
43
43
  export declare const postCollabText: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
44
- text?: undefined;
45
44
  ok?: undefined;
46
45
  error: string;
46
+ text?: undefined;
47
47
  } | {
48
48
  error?: undefined;
49
49
  ok: boolean;
@@ -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,16 +41,16 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
41
41
  thumbsUpRate: number;
42
42
  avgEvalScore: number;
43
43
  } | {
44
- error?: undefined;
45
44
  summary: import("./types.js").TraceSummary;
46
45
  spans: import("./types.js").TraceSpan[];
47
46
  id?: undefined;
47
+ error?: undefined;
48
48
  ok?: undefined;
49
49
  } | {
50
- error?: undefined;
51
50
  summary?: undefined;
52
51
  spans?: undefined;
53
52
  id: string;
53
+ error?: undefined;
54
54
  ok?: undefined;
55
55
  } | {
56
56
  summary?: undefined;
@@ -59,10 +59,10 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
59
59
  error: any;
60
60
  ok?: undefined;
61
61
  } | {
62
- error?: undefined;
63
62
  summary?: undefined;
64
63
  spans?: undefined;
65
64
  id?: undefined;
65
+ error?: undefined;
66
66
  ok: boolean;
67
67
  }>>;
68
68
  //# sourceMappingURL=routes.d.ts.map
@@ -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;
@@ -20,7 +20,7 @@ export declare function createTranscribeVoiceHandler(): import("h3").EventHandle
20
20
  error: string;
21
21
  text?: undefined;
22
22
  } | {
23
- error?: undefined;
24
23
  text: string;
24
+ error?: undefined;
25
25
  }>>;
26
26
  //# sourceMappingURL=transcribe-voice.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.123.2",
3
+ "version": "0.124.0",
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": {