@agent-native/core 0.161.0 → 0.161.2

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.
Files changed (44) hide show
  1. package/corpus/templates/analytics/actions/compose-dashboard.ts +5 -2
  2. package/corpus/templates/analytics/actions/export-dashboard-panel-to-google-sheet.ts +11 -5
  3. package/corpus/templates/analytics/actions/migrate-first-party-analytics-to-bigquery.ts +89 -2
  4. package/corpus/templates/analytics/actions/update-dashboard.ts +14 -2
  5. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/PanelEditorDialog.tsx +6 -0
  6. package/corpus/templates/analytics/server/lib/dashboard-panel-query.ts +89 -41
  7. package/corpus/templates/analytics/server/lib/dashboard-panel-source-resolver.ts +8 -3
  8. package/corpus/templates/analytics/server/lib/error-capture.ts +6 -0
  9. package/corpus/templates/analytics/server/lib/first-party-analytics-backend.ts +187 -44
  10. package/corpus/templates/analytics/server/lib/first-party-analytics.ts +44 -16
  11. package/dist/agent/engine/builder-engine.js +13 -5
  12. package/dist/agent/engine/error-detail.d.ts +17 -0
  13. package/dist/agent/engine/error-detail.js +27 -0
  14. package/dist/agent/engine/types.d.ts +10 -0
  15. package/dist/agent/engine/types.js +3 -0
  16. package/dist/agent/production-agent.js +7 -1
  17. package/dist/agent/run-manager.js +8 -0
  18. package/dist/agent/thread-data-builder.js +5 -0
  19. package/dist/client/error-format.js +15 -0
  20. package/dist/client/sse-event-processor.js +4 -0
  21. package/dist/file-upload/actions/upload-image.d.ts +1 -1
  22. package/dist/localization/core-messages/ar-SA.js +1 -0
  23. package/dist/localization/core-messages/de-DE.js +1 -0
  24. package/dist/localization/core-messages/en-US.d.ts +1 -0
  25. package/dist/localization/core-messages/en-US.js +1 -0
  26. package/dist/localization/core-messages/es-ES.js +1 -0
  27. package/dist/localization/core-messages/fr-FR.js +1 -0
  28. package/dist/localization/core-messages/hi-IN.js +1 -0
  29. package/dist/localization/core-messages/ja-JP.js +1 -0
  30. package/dist/localization/core-messages/ko-KR.js +1 -0
  31. package/dist/localization/core-messages/pt-BR.js +1 -0
  32. package/dist/localization/core-messages/zh-CN.js +1 -0
  33. package/dist/localization/core-messages/zh-TW.js +1 -0
  34. package/dist/localization/core-messages.d.ts +1 -0
  35. package/dist/observability/routes.d.ts +3 -3
  36. package/dist/provider-api/actions/custom-provider-registration.d.ts +2 -2
  37. package/dist/resources/handlers.d.ts +1 -1
  38. package/dist/secrets/routes.d.ts +9 -9
  39. package/dist/server/realtime-token.d.ts +1 -1
  40. package/dist/server/release-migrations.js +4 -0
  41. package/dist/server/transcribe-voice.d.ts +1 -1
  42. package/dist/workspace-connections/migrations.d.ts +18 -0
  43. package/dist/workspace-connections/migrations.js +153 -0
  44. package/package.json +3 -3
@@ -1,4 +1,5 @@
1
1
  import { GATEWAY_UNAVAILABLE_VISITOR_MESSAGE } from "../agent/engine/credential-errors.js";
2
+ import { BUILDER_GATEWAY_INTERNAL_ERROR_CODE } from "../agent/engine/error-detail.js";
2
3
  /**
3
4
  * Append a Builder CTA markdown link to gateway errors that users can fix
4
5
  * outside the app. Used by both
@@ -21,6 +22,13 @@ const OPEN_BUILDER_SPACE_SETTINGS_LABEL = "Open Builder space settings";
21
22
  const START_NEW_CHAT_LABEL = "Start new chat";
22
23
  const UPGRADE_AT_BUILDER_LABEL = "Upgrade at builder.io";
23
24
  const BUILDER_AUTHENTICATION_ERROR = "Builder rejected the connected credentials. Reconnect Builder.io (free tier available) in Settings, then retry.";
25
+ /**
26
+ * The gateway's unhandled-500 envelope is an internal correlation id and an
27
+ * apology: nothing the reader can act on, and nothing that says whether the
28
+ * failure was theirs. Say where it broke and keep the raw sentence in
29
+ * `details`, which is the only place the error id is useful.
30
+ */
31
+ const GATEWAY_INTERNAL_ERROR_MESSAGE = "The model gateway hit an internal error before the agent could answer. Retry in a moment, and quote the error id below if it keeps happening.";
24
32
  function isSafeUpgradeUrl(url) {
25
33
  try {
26
34
  const parsed = new URL(url);
@@ -104,6 +112,10 @@ const KNOWN_CHAT_ERROR_KEYS = new Map([
104
112
  "The model gateway returned no error details and the chat couldn't recover. Wait a moment and retry, or start a new chat if it keeps happening.",
105
113
  "agentChat.errorMessages.gatewayNoDetails",
106
114
  ],
115
+ [
116
+ GATEWAY_INTERNAL_ERROR_MESSAGE,
117
+ "agentChat.errorMessages.gatewayInternalError",
118
+ ],
107
119
  [
108
120
  "The agent connection timed out before it could finish. You can continue from the partial work or retry.",
109
121
  "agentChat.errorMessages.inactivityTimeout",
@@ -233,6 +245,9 @@ export function normalizeChatError(errorMessage, errorCode) {
233
245
  details: text,
234
246
  };
235
247
  }
248
+ if (code === BUILDER_GATEWAY_INTERNAL_ERROR_CODE) {
249
+ return { message: GATEWAY_INTERNAL_ERROR_MESSAGE, details: text };
250
+ }
236
251
  if (code === "builder_auth_error") {
237
252
  return {
238
253
  message: BUILDER_AUTHENTICATION_ERROR,
@@ -1,4 +1,5 @@
1
1
  import { LLM_MISSING_CREDENTIALS_ERROR_CODE, LLM_MISSING_CREDENTIALS_MESSAGE, } from "../agent/engine/credential-errors.js";
2
+ import { BUILDER_GATEWAY_INTERNAL_ERROR_CODE } from "../agent/engine/error-detail.js";
2
3
  import { emitChatFirstOpenApp } from "./chat-first.js";
3
4
  import { formatChatErrorText, normalizeChatError } from "./error-format.js";
4
5
  import { humanizeToolLabelText, humanizeToolName, isToolCallActive, runningToolLabel, } from "./tool-display.js";
@@ -529,6 +530,9 @@ function isAutoRecoverableError(ev, errMsg) {
529
530
  code === "http_408" ||
530
531
  code === "http_429" ||
531
532
  code === "http_500" ||
533
+ // The gateway's unhandled-500 envelope delivered in-stream instead of as a
534
+ // status. Recoverable for the same reason `http_500` is.
535
+ code === BUILDER_GATEWAY_INTERNAL_ERROR_CODE ||
532
536
  code === "http_502" ||
533
537
  code === "http_503" ||
534
538
  code === "http_504" ||
@@ -17,11 +17,11 @@ declare const _default: import("../../action.js").ActionDefinition<{
17
17
  id?: undefined;
18
18
  provider?: undefined;
19
19
  } | {
20
+ error?: undefined;
20
21
  configured?: undefined;
21
22
  connectPath?: undefined;
22
23
  url: string;
23
24
  id: string;
24
25
  provider: string;
25
- error?: undefined;
26
26
  }>;
27
27
  export default _default;
@@ -260,6 +260,7 @@ const messages = {
260
260
  "errorMessages.builderAuthentication": "رفض Builder بيانات الاعتماد المتصلة. أعد الاتصال بـ Builder.io من الإعدادات، ثم أعد المحاولة.",
261
261
  "errorMessages.builderModelUnauthorized": "رفض المزوّد الذي يشغّل هذا النموذج الطلب. اختر نموذجًا آخر، ثم أعد المحاولة.",
262
262
  "errorMessages.errorPrefix": "خطأ: {{message}}",
263
+ "errorMessages.gatewayInternalError": "حدث خطأ داخلي في بوابة النموذج قبل أن يتمكن الوكيل من الإجابة. أعد المحاولة بعد قليل، وإذا تكرر الأمر فأرفق معرّف الخطأ الظاهر أدناه.",
263
264
  "errorMessages.gatewayNoDetails": "لم تُرجع بوابة النموذج أي تفاصيل عن الخطأ وتعذّر على المحادثة الاسترداد. انتظر قليلًا ثم أعد المحاولة، أو ابدأ محادثة جديدة إذا استمرت المشكلة.",
264
265
  "errorMessages.inactivityTimeout": "انتهت مهلة اتصال الوكيل قبل أن يتمكن من الإكمال. يمكنك المتابعة من العمل الجزئي أو إعادة المحاولة.",
265
266
  "errorMessages.invalidToolSchema": "كان مخطط إحدى الأدوات غير صالح، لذلك رفض النموذج الطلب قبل بدئه. يمكن تخطي الأداة غير الصالحة وإعادة محاولة الطلب.",
@@ -389,6 +389,7 @@ const messages = {
389
389
  "errorMessages.builderAuthentication": "Builder hat die verbundenen Anmeldedaten abgelehnt. Verbinde Builder.io in den Einstellungen erneut und versuche es dann noch einmal.",
390
390
  "errorMessages.builderModelUnauthorized": "Der Anbieter hinter diesem Modell hat die Anfrage abgelehnt. Wähle ein anderes Modell und versuche es erneut.",
391
391
  "errorMessages.errorPrefix": "Fehler: {{message}}",
392
+ "errorMessages.gatewayInternalError": "Das Modell-Gateway hat einen internen Fehler ausgelöst, bevor der Agent antworten konnte. Versuchen Sie es in einem Moment erneut und geben Sie die untenstehende Fehler-ID an, wenn es weiterhin auftritt.",
392
393
  "errorMessages.gatewayNoDetails": "Das Modell-Gateway hat keine Fehlerdetails zurückgegeben und der Chat konnte nicht fortgesetzt werden. Warte einen Moment und versuche es erneut. Falls das Problem bestehen bleibt, starte einen neuen Chat.",
393
394
  "errorMessages.inactivityTimeout": "Die Verbindung zum Agenten wurde wegen Zeitüberschreitung beendet, bevor er fertig war. Du kannst mit dem Teilergebnis fortfahren oder es erneut versuchen.",
394
395
  "errorMessages.invalidToolSchema": "Ein Tool-Schema war ungültig. Deshalb hat das Modell die Anfrage abgelehnt, bevor sie gestartet wurde. Das ungültige Tool kann übersprungen und die Anfrage erneut gesendet werden.",
@@ -252,6 +252,7 @@ declare const messages: {
252
252
  readonly "errorMessages.builderAuthentication": "Builder rejected the connected credentials. Reconnect Builder.io in Settings, then retry.";
253
253
  readonly "errorMessages.builderModelUnauthorized": "The provider behind this model rejected the request. Pick a different model, then retry.";
254
254
  readonly "errorMessages.errorPrefix": "Error: {{message}}";
255
+ readonly "errorMessages.gatewayInternalError": "The model gateway hit an internal error before the agent could answer. Retry in a moment, and quote the error id below if it keeps happening.";
255
256
  readonly "errorMessages.gatewayNoDetails": "The model gateway returned no error details and the chat couldn't recover. Wait a moment and retry, or start a new chat if it keeps happening.";
256
257
  readonly "errorMessages.inactivityTimeout": "The agent connection timed out before it could finish. You can continue from the partial work or retry.";
257
258
  readonly "errorMessages.invalidToolSchema": "A tool schema was invalid, so the model rejected the request before it started. The invalid tool can be skipped and the request retried.";
@@ -252,6 +252,7 @@ const messages = {
252
252
  "errorMessages.builderAuthentication": "Builder rejected the connected credentials. Reconnect Builder.io in Settings, then retry.",
253
253
  "errorMessages.builderModelUnauthorized": "The provider behind this model rejected the request. Pick a different model, then retry.",
254
254
  "errorMessages.errorPrefix": "Error: {{message}}",
255
+ "errorMessages.gatewayInternalError": "The model gateway hit an internal error before the agent could answer. Retry in a moment, and quote the error id below if it keeps happening.",
255
256
  "errorMessages.gatewayNoDetails": "The model gateway returned no error details and the chat couldn't recover. Wait a moment and retry, or start a new chat if it keeps happening.",
256
257
  "errorMessages.inactivityTimeout": "The agent connection timed out before it could finish. You can continue from the partial work or retry.",
257
258
  "errorMessages.invalidToolSchema": "A tool schema was invalid, so the model rejected the request before it started. The invalid tool can be skipped and the request retried.",
@@ -396,6 +396,7 @@ const messages = {
396
396
  "errorMessages.builderAuthentication": "Builder rechazó las credenciales conectadas. Vuelve a conectar Builder.io en Ajustes e inténtalo de nuevo.",
397
397
  "errorMessages.builderModelUnauthorized": "El proveedor de este modelo rechazó la solicitud. Elige otro modelo y vuelve a intentarlo.",
398
398
  "errorMessages.errorPrefix": "Error: {{message}}",
399
+ "errorMessages.gatewayInternalError": "La pasarela del modelo tuvo un error interno antes de que el agente pudiera responder. Vuelve a intentarlo en un momento e indica el id de error de abajo si sigue ocurriendo.",
399
400
  "errorMessages.gatewayNoDetails": "La pasarela del modelo no devolvió detalles del error y el chat no pudo recuperarse. Espera un momento y vuelve a intentarlo. Si el problema continúa, inicia un chat nuevo.",
400
401
  "errorMessages.inactivityTimeout": "La conexión del agente expiró antes de que pudiera finalizar. Puedes continuar desde el trabajo parcial o volver a intentarlo.",
401
402
  "errorMessages.invalidToolSchema": "El esquema de una herramienta no era válido, así que el modelo rechazó la solicitud antes de iniciarla. Puedes omitir la herramienta no válida y volver a intentarlo.",
@@ -396,6 +396,7 @@ const messages = {
396
396
  "errorMessages.builderAuthentication": "Builder a rejeté les identifiants connectés. Reconnectez Builder.io dans les paramètres, puis réessayez.",
397
397
  "errorMessages.builderModelUnauthorized": "Le fournisseur de ce modèle a rejeté la demande. Choisissez un autre modèle, puis réessayez.",
398
398
  "errorMessages.errorPrefix": "Erreur : {{message}}",
399
+ "errorMessages.gatewayInternalError": "La passerelle du modèle a rencontré une erreur interne avant que l'agent puisse répondre. Réessayez dans un instant et indiquez l'identifiant d'erreur ci-dessous si cela persiste.",
399
400
  "errorMessages.gatewayNoDetails": "La passerelle du modèle n’a fourni aucun détail sur l’erreur et la discussion n’a pas pu reprendre. Patientez un instant et réessayez. Si le problème persiste, démarrez une nouvelle discussion.",
400
401
  "errorMessages.inactivityTimeout": "La connexion à l’agent a expiré avant la fin. Vous pouvez poursuivre à partir du travail partiel ou réessayer.",
401
402
  "errorMessages.invalidToolSchema": "Le schéma d’un outil n’était pas valide. Le modèle a donc rejeté la demande avant son démarrage. Vous pouvez ignorer cet outil et réessayer.",
@@ -252,6 +252,7 @@ const messages = {
252
252
  "errorMessages.builderAuthentication": "Builder ने कनेक्ट किए गए क्रेडेंशियल अस्वीकार कर दिए। सेटिंग्स में Builder.io को दोबारा कनेक्ट करें, फिर से प्रयास करें।",
253
253
  "errorMessages.builderModelUnauthorized": "इस मॉडल के पीछे मौजूद प्रदाता ने अनुरोध अस्वीकार कर दिया। कोई दूसरा मॉडल चुनें, फिर से प्रयास करें।",
254
254
  "errorMessages.errorPrefix": "त्रुटि: {{message}}",
255
+ "errorMessages.gatewayInternalError": "एजेंट के उत्तर देने से पहले मॉडल गेटवे में एक आंतरिक त्रुटि आई। कुछ देर में फिर कोशिश करें, और बार-बार होने पर नीचे दिया गया error id बताएं।",
255
256
  "errorMessages.gatewayNoDetails": "मॉडल गेटवे ने त्रुटि का कोई विवरण नहीं दिया और चैट रिकवर नहीं हो सकी। कुछ देर रुककर फिर से प्रयास करें या समस्या बनी रहने पर नई चैट शुरू करें।",
256
257
  "errorMessages.inactivityTimeout": "एजेंट का कनेक्शन काम पूरा होने से पहले समय सीमा पर पहुँच गया। आप आंशिक काम से जारी रख सकते हैं या फिर से प्रयास कर सकते हैं।",
257
258
  "errorMessages.invalidToolSchema": "एक टूल स्कीमा अमान्य था, इसलिए मॉडल ने अनुरोध शुरू होने से पहले ही अस्वीकार कर दिया। अमान्य टूल को छोड़कर अनुरोध दोबारा किया जा सकता है।",
@@ -250,6 +250,7 @@ const messages = {
250
250
  "errorMessages.builderAuthentication": "Builder が接続済みの認証情報を拒否しました。設定で Builder.io に再接続してから再試行してください。",
251
251
  "errorMessages.builderModelUnauthorized": "このモデルのプロバイダーがリクエストを拒否しました。別のモデルを選択して再試行してください。",
252
252
  "errorMessages.errorPrefix": "エラー:{{message}}",
253
+ "errorMessages.gatewayInternalError": "エージェントが応答する前にモデルゲートウェイで内部エラーが発生しました。少し待ってから再試行し、繰り返す場合は下のエラー ID を伝えてください。",
253
254
  "errorMessages.gatewayNoDetails": "モデルゲートウェイからエラーの詳細が返されず、チャットを復旧できませんでした。少し待ってから再試行し、繰り返し発生する場合は新しいチャットを開始してください。",
254
255
  "errorMessages.inactivityTimeout": "エージェントとの接続が完了前にタイムアウトしました。途中までの作業から続行するか、再試行できます。",
255
256
  "errorMessages.invalidToolSchema": "ツールのスキーマが無効だったため、モデルは開始前にリクエストを拒否しました。無効なツールをスキップして再試行できます。",
@@ -250,6 +250,7 @@ const messages = {
250
250
  "errorMessages.builderAuthentication": "Builder가 연결된 자격 증명을 거부했습니다. 설정에서 Builder.io를 다시 연결한 후 다시 시도하세요.",
251
251
  "errorMessages.builderModelUnauthorized": "이 모델의 제공업체가 요청을 거부했습니다. 다른 모델을 선택한 후 다시 시도하세요.",
252
252
  "errorMessages.errorPrefix": "오류: {{message}}",
253
+ "errorMessages.gatewayInternalError": "에이전트가 답변하기 전에 모델 게이트웨이에서 내부 오류가 발생했습니다. 잠시 후 다시 시도하고, 계속 발생하면 아래 오류 ID를 알려 주세요.",
253
254
  "errorMessages.gatewayNoDetails": "모델 게이트웨이가 오류 세부 정보를 반환하지 않아 채팅을 복구할 수 없습니다. 잠시 후 다시 시도하고, 문제가 계속되면 새 채팅을 시작하세요.",
254
255
  "errorMessages.inactivityTimeout": "에이전트 연결이 완료 전에 시간 초과되었습니다. 부분적으로 완료된 작업에서 계속하거나 다시 시도할 수 있습니다.",
255
256
  "errorMessages.invalidToolSchema": "도구 스키마가 올바르지 않아 모델이 요청 시작 전에 거부했습니다. 올바르지 않은 도구를 건너뛰고 요청을 다시 시도할 수 있습니다.",
@@ -396,6 +396,7 @@ const messages = {
396
396
  "errorMessages.builderAuthentication": "O Builder rejeitou as credenciais conectadas. Reconecte Builder.io em Configurações e tente novamente.",
397
397
  "errorMessages.builderModelUnauthorized": "O provedor por trás deste modelo rejeitou a solicitação. Escolha um modelo diferente e tente novamente.",
398
398
  "errorMessages.errorPrefix": "Erro: {{message}}",
399
+ "errorMessages.gatewayInternalError": "O gateway do modelo teve um erro interno antes de o agente poder responder. Tente novamente em instantes e informe o id de erro abaixo se continuar acontecendo.",
399
400
  "errorMessages.gatewayNoDetails": "O gateway do modelo não retornou detalhes do erro, e o chat não pôde ser recuperado. Aguarde um momento e tente novamente. Se o problema persistir, inicie um novo chat.",
400
401
  "errorMessages.inactivityTimeout": "A conexão com o agente expirou antes da conclusão. Você pode continuar a partir do trabalho parcial ou tentar novamente.",
401
402
  "errorMessages.invalidToolSchema": "O esquema de uma ferramenta era inválido, então o modelo rejeitou a solicitação antes de iniciá-la. Você pode ignorar a ferramenta inválida e tentar novamente.",
@@ -250,6 +250,7 @@ const messages = {
250
250
  "errorMessages.builderAuthentication": "Builder 拒绝了已连接的凭据。请在设置中重新连接 Builder.io,然后重试。",
251
251
  "errorMessages.builderModelUnauthorized": "此模型背后的提供商拒绝了请求。请选择其他模型后重试。",
252
252
  "errorMessages.errorPrefix": "错误:{{message}}",
253
+ "errorMessages.gatewayInternalError": "模型网关在智能体作答前发生内部错误。请稍后重试;如果持续出现,请提供下方的错误 ID。",
253
254
  "errorMessages.gatewayNoDetails": "模型网关未返回错误详情,聊天无法恢复。请稍等片刻后重试;如果问题持续出现,请开始新聊天。",
254
255
  "errorMessages.inactivityTimeout": "智能体连接在完成前超时。您可以从已完成的部分继续,也可以重试。",
255
256
  "errorMessages.invalidToolSchema": "工具架构无效,因此模型在请求开始前拒绝了该请求。可以跳过无效工具并重试请求。",
@@ -250,6 +250,7 @@ const messages = {
250
250
  "errorMessages.builderAuthentication": "Builder 拒絕了已連線的憑證。請在設定中重新連線至 Builder.io,然後重試。",
251
251
  "errorMessages.builderModelUnauthorized": "這個模型背後的供應商拒絕了要求。請選擇其他模型後重試。",
252
252
  "errorMessages.errorPrefix": "錯誤:{{message}}",
253
+ "errorMessages.gatewayInternalError": "模型閘道在代理回答前發生內部錯誤。請稍後重試;若持續發生,請提供下方的錯誤 ID。",
253
254
  "errorMessages.gatewayNoDetails": "模型閘道未傳回錯誤詳細資訊,聊天無法復原。請稍候再試;如果問題持續發生,請開始新聊天。",
254
255
  "errorMessages.inactivityTimeout": "代理連線在完成前逾時。您可以從已完成的部分繼續,也可以重試。",
255
256
  "errorMessages.invalidToolSchema": "工具結構描述無效,因此模型在要求開始前便拒絕了要求。您可以略過無效工具並重試要求。",
@@ -254,6 +254,7 @@ export declare const englishAgentChatMessages: {
254
254
  readonly "errorMessages.builderAuthentication": "Builder rejected the connected credentials. Reconnect Builder.io in Settings, then retry.";
255
255
  readonly "errorMessages.builderModelUnauthorized": "The provider behind this model rejected the request. Pick a different model, then retry.";
256
256
  readonly "errorMessages.errorPrefix": "Error: {{message}}";
257
+ readonly "errorMessages.gatewayInternalError": "The model gateway hit an internal error before the agent could answer. Retry in a moment, and quote the error id below if it keeps happening.";
257
258
  readonly "errorMessages.gatewayNoDetails": "The model gateway returned no error details and the chat couldn't recover. Wait a moment and retry, or start a new chat if it keeps happening.";
258
259
  readonly "errorMessages.inactivityTimeout": "The agent connection timed out before it could finish. You can continue from the partial work or retry.";
259
260
  readonly "errorMessages.invalidToolSchema": "A tool schema was invalid, so the model rejected the request before it started. The invalid tool can be skipped and the request retried.";
@@ -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;
@@ -75,8 +75,8 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
75
75
  user: "user";
76
76
  }>>;
77
77
  }, z.core.$strip>>, {
78
- id?: undefined;
79
78
  message?: undefined;
79
+ id?: undefined;
80
80
  deleted?: undefined;
81
81
  providers: {
82
82
  id: string;
@@ -93,9 +93,9 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
93
93
  registered?: undefined;
94
94
  label?: undefined;
95
95
  } | {
96
- id?: undefined;
97
96
  message?: undefined;
98
97
  count?: undefined;
98
+ id?: undefined;
99
99
  deleted?: undefined;
100
100
  providers?: undefined;
101
101
  found: boolean;
@@ -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
- ok?: undefined;
52
51
  error: string;
52
+ ok?: undefined;
53
53
  } | {
54
54
  error?: undefined;
55
55
  ok: boolean;
@@ -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
- ok?: undefined;
38
37
  status?: undefined;
38
+ ok?: undefined;
39
39
  } | {
40
- error?: undefined;
41
40
  ok: boolean;
42
41
  status: string;
42
+ error?: undefined;
43
43
  } | {
44
- ok?: undefined;
45
44
  error: string;
46
45
  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;
58
57
  error: string;
59
58
  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
  }>>;
@@ -26,8 +26,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
26
26
  expiresAt?: undefined;
27
27
  ttlSeconds?: undefined;
28
28
  } | {
29
- error?: undefined;
30
29
  token: string;
31
30
  expiresAt: string;
32
31
  ttlSeconds: number;
32
+ error?: undefined;
33
33
  }>>;
@@ -11,6 +11,7 @@ import { runAutomationSchedulerHealthMigrations } from "../jobs/scheduler-health
11
11
  import { OAUTH_TOKEN_MIGRATIONS, OAUTH_TOKEN_MIGRATIONS_TABLE, } from "../oauth-tokens/migrations.js";
12
12
  import { ORG_MIGRATIONS } from "../org/migrations.js";
13
13
  import { USAGE_ALERT_MIGRATIONS, USAGE_ALERT_MIGRATIONS_TABLE, } from "../usage/migrations.js";
14
+ import { WORKSPACE_CONNECTIONS_MIGRATIONS, WORKSPACE_CONNECTIONS_MIGRATIONS_TABLE, } from "../workspace-connections/migrations.js";
14
15
  import { runBetterAuthMigrations } from "./better-auth-migrations.js";
15
16
  import { IDENTITY_SSO_MIGRATIONS } from "./identity-sso-migrations.js";
16
17
  /**
@@ -53,6 +54,9 @@ export async function runFrameworkReleaseMigrations(nitroApp) {
53
54
  await runMigrations(OBSERVATIONAL_MEMORY_MIGRATIONS, {
54
55
  table: "_observational_memory_migrations",
55
56
  })(nitroApp);
57
+ await runMigrations(WORKSPACE_CONNECTIONS_MIGRATIONS, {
58
+ table: WORKSPACE_CONNECTIONS_MIGRATIONS_TABLE,
59
+ })(nitroApp);
56
60
  await runAutomationRunMigrations(nitroApp);
57
61
  await runAutomationSchedulerHealthMigrations(nitroApp);
58
62
  }
@@ -20,6 +20,6 @@ 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
  }>>;
@@ -0,0 +1,18 @@
1
+ import type { MigrationEntry } from "../db/migrations.js";
2
+ export declare const WORKSPACE_CONNECTIONS_MIGRATIONS_TABLE = "_workspace_connections_migrations";
3
+ /**
4
+ * Deploy-time schema for workspace connections, grants, and user groups.
5
+ *
6
+ * These three tables were shipped with only their runtime `ensureTable`
7
+ * helpers in `store.ts` / `groups.ts`. That is enough locally and on a
8
+ * long-lived server, but `schemaEnsureDisabled()` makes every probe report
9
+ * "present" on a production serverless runtime, so the ensure path issues no
10
+ * DDL there at all. A table with no entry here therefore never gets created in
11
+ * production, and the first read fails with `relation ... does not exist` —
12
+ * which is exactly what `workspace_user_groups` did from the day after it
13
+ * shipped. Runtime ensure covers dev; this list is the production contract.
14
+ *
15
+ * `created_at` / `updated_at` must be BIGINT on Postgres: they store epoch
16
+ * milliseconds, which overflow int4.
17
+ */
18
+ export declare const WORKSPACE_CONNECTIONS_MIGRATIONS: MigrationEntry[];
@@ -0,0 +1,153 @@
1
+ export const WORKSPACE_CONNECTIONS_MIGRATIONS_TABLE = "_workspace_connections_migrations";
2
+ /**
3
+ * Deploy-time schema for workspace connections, grants, and user groups.
4
+ *
5
+ * These three tables were shipped with only their runtime `ensureTable`
6
+ * helpers in `store.ts` / `groups.ts`. That is enough locally and on a
7
+ * long-lived server, but `schemaEnsureDisabled()` makes every probe report
8
+ * "present" on a production serverless runtime, so the ensure path issues no
9
+ * DDL there at all. A table with no entry here therefore never gets created in
10
+ * production, and the first read fails with `relation ... does not exist` —
11
+ * which is exactly what `workspace_user_groups` did from the day after it
12
+ * shipped. Runtime ensure covers dev; this list is the production contract.
13
+ *
14
+ * `created_at` / `updated_at` must be BIGINT on Postgres: they store epoch
15
+ * milliseconds, which overflow int4.
16
+ */
17
+ export const WORKSPACE_CONNECTIONS_MIGRATIONS = [
18
+ {
19
+ version: 1,
20
+ sql: {
21
+ postgres: `CREATE TABLE IF NOT EXISTS workspace_connections (
22
+ id TEXT PRIMARY KEY,
23
+ provider TEXT NOT NULL DEFAULT '',
24
+ label TEXT NOT NULL DEFAULT '',
25
+ account_id TEXT,
26
+ account_label TEXT,
27
+ status TEXT NOT NULL DEFAULT 'connected',
28
+ scopes_json TEXT NOT NULL DEFAULT '[]',
29
+ config_json TEXT NOT NULL DEFAULT '{}',
30
+ allowed_apps_json TEXT NOT NULL DEFAULT '[]',
31
+ allowed_users_json TEXT NOT NULL DEFAULT '[]',
32
+ allowed_user_groups_json TEXT NOT NULL DEFAULT '[]',
33
+ credential_refs_json TEXT NOT NULL DEFAULT '[]',
34
+ owner_email TEXT NOT NULL DEFAULT '',
35
+ org_id TEXT,
36
+ created_at BIGINT NOT NULL DEFAULT 0,
37
+ updated_at BIGINT NOT NULL DEFAULT 0,
38
+ last_used_at BIGINT,
39
+ last_checked_at BIGINT,
40
+ last_error TEXT
41
+ )`,
42
+ sqlite: `CREATE TABLE IF NOT EXISTS workspace_connections (
43
+ id TEXT PRIMARY KEY,
44
+ provider TEXT NOT NULL DEFAULT '',
45
+ label TEXT NOT NULL DEFAULT '',
46
+ account_id TEXT,
47
+ account_label TEXT,
48
+ status TEXT NOT NULL DEFAULT 'connected',
49
+ scopes_json TEXT NOT NULL DEFAULT '[]',
50
+ config_json TEXT NOT NULL DEFAULT '{}',
51
+ allowed_apps_json TEXT NOT NULL DEFAULT '[]',
52
+ allowed_users_json TEXT NOT NULL DEFAULT '[]',
53
+ allowed_user_groups_json TEXT NOT NULL DEFAULT '[]',
54
+ credential_refs_json TEXT NOT NULL DEFAULT '[]',
55
+ owner_email TEXT NOT NULL DEFAULT '',
56
+ org_id TEXT,
57
+ created_at INTEGER NOT NULL DEFAULT 0,
58
+ updated_at INTEGER NOT NULL DEFAULT 0,
59
+ last_used_at INTEGER,
60
+ last_checked_at INTEGER,
61
+ last_error TEXT
62
+ )`,
63
+ },
64
+ },
65
+ {
66
+ version: 2,
67
+ sql: `CREATE INDEX IF NOT EXISTS idx_workspace_connections_scope_provider
68
+ ON workspace_connections (org_id, owner_email, provider)`,
69
+ },
70
+ {
71
+ version: 3,
72
+ sql: `CREATE INDEX IF NOT EXISTS idx_workspace_connections_updated_at
73
+ ON workspace_connections (updated_at)`,
74
+ },
75
+ {
76
+ version: 4,
77
+ sql: {
78
+ postgres: `CREATE TABLE IF NOT EXISTS workspace_connection_grants (
79
+ id TEXT PRIMARY KEY,
80
+ connection_id TEXT NOT NULL DEFAULT '',
81
+ provider TEXT NOT NULL DEFAULT '',
82
+ app_id TEXT NOT NULL DEFAULT '',
83
+ scopes_json TEXT NOT NULL DEFAULT '[]',
84
+ config_json TEXT NOT NULL DEFAULT '{}',
85
+ credential_refs_json TEXT NOT NULL DEFAULT '[]',
86
+ granted_by_email TEXT NOT NULL DEFAULT '',
87
+ owner_email TEXT NOT NULL DEFAULT '',
88
+ org_id TEXT,
89
+ created_at BIGINT NOT NULL DEFAULT 0,
90
+ updated_at BIGINT NOT NULL DEFAULT 0,
91
+ last_used_at BIGINT
92
+ )`,
93
+ sqlite: `CREATE TABLE IF NOT EXISTS workspace_connection_grants (
94
+ id TEXT PRIMARY KEY,
95
+ connection_id TEXT NOT NULL DEFAULT '',
96
+ provider TEXT NOT NULL DEFAULT '',
97
+ app_id TEXT NOT NULL DEFAULT '',
98
+ scopes_json TEXT NOT NULL DEFAULT '[]',
99
+ config_json TEXT NOT NULL DEFAULT '{}',
100
+ credential_refs_json TEXT NOT NULL DEFAULT '[]',
101
+ granted_by_email TEXT NOT NULL DEFAULT '',
102
+ owner_email TEXT NOT NULL DEFAULT '',
103
+ org_id TEXT,
104
+ created_at INTEGER NOT NULL DEFAULT 0,
105
+ updated_at INTEGER NOT NULL DEFAULT 0,
106
+ last_used_at INTEGER
107
+ )`,
108
+ },
109
+ },
110
+ {
111
+ version: 5,
112
+ sql: `CREATE UNIQUE INDEX IF NOT EXISTS idx_workspace_connection_grants_connection_app
113
+ ON workspace_connection_grants (connection_id, app_id)`,
114
+ },
115
+ {
116
+ version: 6,
117
+ sql: `CREATE INDEX IF NOT EXISTS idx_workspace_connection_grants_scope_app
118
+ ON workspace_connection_grants (org_id, owner_email, app_id)`,
119
+ },
120
+ {
121
+ version: 7,
122
+ sql: `CREATE INDEX IF NOT EXISTS idx_workspace_connection_grants_updated_at
123
+ ON workspace_connection_grants (updated_at)`,
124
+ },
125
+ {
126
+ version: 8,
127
+ sql: {
128
+ postgres: `CREATE TABLE IF NOT EXISTS workspace_user_groups (
129
+ id TEXT PRIMARY KEY,
130
+ org_id TEXT NOT NULL DEFAULT '',
131
+ name TEXT NOT NULL DEFAULT '',
132
+ member_emails_json TEXT NOT NULL DEFAULT '[]',
133
+ created_by_email TEXT NOT NULL DEFAULT '',
134
+ created_at BIGINT NOT NULL DEFAULT 0,
135
+ updated_at BIGINT NOT NULL DEFAULT 0
136
+ )`,
137
+ sqlite: `CREATE TABLE IF NOT EXISTS workspace_user_groups (
138
+ id TEXT PRIMARY KEY,
139
+ org_id TEXT NOT NULL DEFAULT '',
140
+ name TEXT NOT NULL DEFAULT '',
141
+ member_emails_json TEXT NOT NULL DEFAULT '[]',
142
+ created_by_email TEXT NOT NULL DEFAULT '',
143
+ created_at INTEGER NOT NULL DEFAULT 0,
144
+ updated_at INTEGER NOT NULL DEFAULT 0
145
+ )`,
146
+ },
147
+ },
148
+ {
149
+ version: 9,
150
+ sql: `CREATE INDEX IF NOT EXISTS idx_workspace_user_groups_org_updated
151
+ ON workspace_user_groups (org_id, updated_at)`,
152
+ },
153
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.161.0",
3
+ "version": "0.161.2",
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": {
@@ -427,8 +427,8 @@
427
427
  "y-protocols": "^1.0.7",
428
428
  "yjs": "^13.6.31",
429
429
  "zod": "^4.3.6",
430
- "@agent-native/recap-cli": "0.5.4",
431
- "@agent-native/toolkit": "^0.16.4"
430
+ "@agent-native/toolkit": "^0.16.4",
431
+ "@agent-native/recap-cli": "0.5.4"
432
432
  },
433
433
  "devDependencies": {
434
434
  "@ai-sdk/anthropic": "^3.0.71",