@agent-native/core 0.92.2 → 0.92.4
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 +2 -2
- package/corpus/core/CHANGELOG.md +32 -0
- package/corpus/core/docs/content/locales/ar-SA/server.mdx +35 -0
- package/corpus/core/docs/content/locales/de-DE/server.mdx +35 -0
- package/corpus/core/docs/content/locales/es-ES/server.mdx +35 -0
- package/corpus/core/docs/content/locales/fr-FR/server.mdx +35 -0
- package/corpus/core/docs/content/locales/hi-IN/server.mdx +35 -0
- package/corpus/core/docs/content/locales/ja-JP/server.mdx +35 -0
- package/corpus/core/docs/content/locales/ko-KR/server.mdx +35 -0
- package/corpus/core/docs/content/locales/pt-BR/server.mdx +35 -0
- package/corpus/core/docs/content/locales/zh-CN/server.mdx +35 -0
- package/corpus/core/docs/content/locales/zh-TW/server.mdx +35 -0
- package/corpus/core/docs/content/server.mdx +35 -0
- package/corpus/core/package.json +2 -2
- package/corpus/core/src/agent/engine/ai-sdk-engine.ts +14 -4
- package/corpus/core/src/agent/engine/anthropic-engine.ts +15 -3
- package/corpus/core/src/agent/engine/builder-engine.ts +30 -4
- package/corpus/core/src/agent/engine/registry.ts +63 -2
- package/corpus/core/src/agent/model-config.ts +0 -2
- package/corpus/core/src/agent/production-agent.ts +12 -1
- package/corpus/core/src/agent/run-manager.ts +57 -36
- package/corpus/core/src/agent/run-store.ts +81 -2
- package/corpus/core/src/agent/thread-data-builder.ts +33 -2
- package/corpus/core/src/client/AssistantChat.tsx +314 -96
- package/corpus/core/src/client/agent-chat-adapter.ts +17 -1
- package/corpus/core/src/client/chat/repo-helpers.ts +45 -0
- package/corpus/core/src/client/chat/tool-call-display.tsx +36 -27
- package/corpus/core/src/client/chat-model-groups.ts +1 -5
- package/corpus/core/src/client/composer/TiptapComposer.tsx +0 -2
- package/corpus/core/src/client/embed-auth.ts +20 -0
- package/corpus/core/src/client/settings/SettingsSection.tsx +66 -5
- package/corpus/core/src/client/sse-event-processor.ts +49 -17
- package/corpus/core/src/client/use-db-sync.ts +31 -9
- package/corpus/core/src/collab/agent-presence.ts +6 -1
- package/corpus/core/src/collab/awareness-store.ts +185 -0
- package/corpus/core/src/collab/awareness.ts +58 -2
- package/corpus/core/src/scripts/agent-engines/manage-agent-engine.ts +7 -8
- package/corpus/core/src/scripts/agent-engines/set-agent-engine.ts +7 -18
- package/corpus/core/src/server/core-routes-plugin.ts +21 -2
- package/corpus/core/src/server/embed-session.ts +20 -4
- package/corpus/core/src/styles/agent-native.css +51 -0
- package/corpus/core/src/tracking/providers.ts +33 -2
- package/corpus/templates/analytics/app/pages/adhoc/explorer-dashboard/index.tsx +8 -1
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +9 -1
- package/corpus/templates/analytics/app/pages/monitoring/uptime/MonitorDetail.tsx +41 -11
- package/corpus/templates/analytics/app/pages/monitoring/uptime/types.ts +44 -0
- package/corpus/templates/analytics/changelog/2026-07-09-dashboard-action-menus-now-close-cleanly-before-opening-hist.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-09-dashboard-email-reports-still-send-when-the-screenshot-captu.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-09-uptime-alerts-now-suppress-recovery-noise-during-flapping-an.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-09-uptime-check-history-now-shows-timing-diagnostics-so-slow-or.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-09-uptime-recovery-alerts-now-send-when-the-original-outage-not.md +6 -0
- package/corpus/templates/analytics/docs/uptime-monitoring.md +29 -16
- package/corpus/templates/analytics/netlify.toml +3 -0
- package/corpus/templates/analytics/scripts/emit-netlify-dashboard-report-cron.ts +126 -0
- package/corpus/templates/analytics/server/db/schema-monitoring.ts +5 -0
- package/corpus/templates/analytics/server/jobs/uptime-monitors.ts +5 -1
- package/corpus/templates/analytics/server/lib/uptime-monitors.ts +305 -31
- package/corpus/templates/analytics/server/plugins/db.ts +15 -0
- package/corpus/templates/analytics/server/plugins/uptime-monitor-jobs.ts +1 -1
- package/corpus/templates/analytics/server/routes/api/uptime-monitors/run.post.ts +57 -0
- package/corpus/templates/clips/actions/list-meetings.ts +12 -0
- package/corpus/templates/clips/changelog/2026-07-09-meeting-reminders-now-ignore-obvious-solo-personal-calendar-.md +6 -0
- package/corpus/templates/clips/desktop/src-tauri/src/meetings_watcher.rs +1 -0
- package/corpus/templates/clips/server/lib/calendar-event-classification.ts +79 -0
- package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.js +13 -4
- package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
- package/dist/agent/engine/anthropic-engine.d.ts.map +1 -1
- package/dist/agent/engine/anthropic-engine.js +14 -3
- package/dist/agent/engine/anthropic-engine.js.map +1 -1
- package/dist/agent/engine/builder-engine.d.ts +1 -1
- package/dist/agent/engine/builder-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.js +26 -4
- package/dist/agent/engine/builder-engine.js.map +1 -1
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +47 -2
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/agent/model-config.d.ts +2 -2
- package/dist/agent/model-config.d.ts.map +1 -1
- package/dist/agent/model-config.js +0 -2
- package/dist/agent/model-config.js.map +1 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +12 -1
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +52 -33
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/run-store.d.ts +24 -0
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +64 -2
- package/dist/agent/run-store.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +28 -2
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +6 -0
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +243 -36
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +15 -1
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/chat/repo-helpers.d.ts.map +1 -1
- package/dist/client/chat/repo-helpers.js +43 -0
- package/dist/client/chat/repo-helpers.js.map +1 -1
- package/dist/client/chat/tool-call-display.d.ts.map +1 -1
- package/dist/client/chat/tool-call-display.js +4 -4
- package/dist/client/chat/tool-call-display.js.map +1 -1
- package/dist/client/chat-model-groups.d.ts.map +1 -1
- package/dist/client/chat-model-groups.js +1 -3
- package/dist/client/chat-model-groups.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +0 -2
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/embed-auth.d.ts.map +1 -1
- package/dist/client/embed-auth.js +14 -0
- package/dist/client/embed-auth.js.map +1 -1
- package/dist/client/settings/SettingsSection.d.ts.map +1 -1
- package/dist/client/settings/SettingsSection.js +32 -3
- package/dist/client/settings/SettingsSection.js.map +1 -1
- package/dist/client/sse-event-processor.d.ts.map +1 -1
- package/dist/client/sse-event-processor.js +44 -17
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/client/use-db-sync.d.ts.map +1 -1
- package/dist/client/use-db-sync.js +29 -9
- package/dist/client/use-db-sync.js.map +1 -1
- package/dist/collab/agent-presence.d.ts.map +1 -1
- package/dist/collab/agent-presence.js +5 -2
- package/dist/collab/agent-presence.js.map +1 -1
- package/dist/collab/awareness-store.d.ts +1 -1
- package/dist/collab/awareness-store.d.ts.map +1 -1
- package/dist/collab/awareness-store.js +0 -0
- package/dist/collab/awareness-store.js.map +1 -1
- package/dist/collab/awareness.d.ts +4 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/awareness.js +46 -2
- package/dist/collab/awareness.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/notifications/routes.d.ts +2 -2
- package/dist/observability/routes.d.ts +3 -3
- package/dist/progress/routes.d.ts +1 -1
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/scripts/agent-engines/manage-agent-engine.d.ts.map +1 -1
- package/dist/scripts/agent-engines/manage-agent-engine.js +6 -6
- package/dist/scripts/agent-engines/manage-agent-engine.js.map +1 -1
- package/dist/scripts/agent-engines/set-agent-engine.d.ts.map +1 -1
- package/dist/scripts/agent-engines/set-agent-engine.js +5 -13
- package/dist/scripts/agent-engines/set-agent-engine.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/core-routes-plugin.d.ts +5 -0
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +10 -3
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/embed-session.d.ts.map +1 -1
- package/dist/server/embed-session.js +17 -4
- package/dist/server/embed-session.js.map +1 -1
- package/dist/styles/agent-native.css +51 -0
- package/dist/tracking/providers.d.ts.map +1 -1
- package/dist/tracking/providers.js +23 -5
- package/dist/tracking/providers.js.map +1 -1
- package/docs/content/locales/ar-SA/server.mdx +35 -0
- package/docs/content/locales/de-DE/server.mdx +35 -0
- package/docs/content/locales/es-ES/server.mdx +35 -0
- package/docs/content/locales/fr-FR/server.mdx +35 -0
- package/docs/content/locales/hi-IN/server.mdx +35 -0
- package/docs/content/locales/ja-JP/server.mdx +35 -0
- package/docs/content/locales/ko-KR/server.mdx +35 -0
- package/docs/content/locales/pt-BR/server.mdx +35 -0
- package/docs/content/locales/zh-CN/server.mdx +35 -0
- package/docs/content/locales/zh-TW/server.mdx +35 -0
- package/docs/content/server.mdx +35 -0
- package/package.json +2 -2
|
@@ -129,6 +129,41 @@ Si tanto el UI como el agente necesitan hacer algo, defina una acción en lugar
|
|
|
129
129
|
|
|
130
130
|
Utilice rutas `/api/*` personalizadas solo cuando necesite un protocolo en forma de ruta o un comportamiento binario/de transmisión. Ver [Actions](/docs/actions).
|
|
131
131
|
|
|
132
|
+
### Aplicaciones solo API {#api-only-apps}
|
|
133
|
+
|
|
134
|
+
No necesita un servidor Express solo porque la aplicación sea solo API. Una aplicación Agent Native ya incluye un servidor Nitro/H3, y `defineAction()` es la superficie API predeterminada. Defina las operaciones en `actions/`; el marco monta cada action en `/_agent-native/actions/<name>` con validación de esquema y contexto de solicitud.
|
|
135
|
+
|
|
136
|
+
Use la opción `http` de la action para dar forma al acceso HTTP directo: las actions son `POST` de forma predeterminada, `http: { method: "GET" | "PUT" | "DELETE" }` cambia el verbo, y `http: false` deja una action fuera de HTTP. Use `server/routes/api/*` solo para necesidades con forma de ruta o protocolo: cargas de archivos, streaming/SSE, webhooks, devoluciones de llamada OAuth, páginas públicas o una forma REST externa que no pueda representarse limpiamente como una action. No cree rutas `/api/*` que principalmente envuelvan o reexporten actions.
|
|
137
|
+
|
|
138
|
+
Para un endpoint de estado de solo lectura, manténgalo como una action:
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
// actions/get-status.ts
|
|
142
|
+
import { defineAction } from "@agent-native/core/action";
|
|
143
|
+
import { z } from "zod";
|
|
144
|
+
|
|
145
|
+
export default defineAction({
|
|
146
|
+
description: "Return API service status",
|
|
147
|
+
schema: z.object({
|
|
148
|
+
service: z.string().optional(),
|
|
149
|
+
}),
|
|
150
|
+
http: { method: "GET" },
|
|
151
|
+
run: async ({ service }) => ({
|
|
152
|
+
ok: true,
|
|
153
|
+
service: service ?? "api",
|
|
154
|
+
checkedAt: new Date().toISOString(),
|
|
155
|
+
}),
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Llámela directamente por HTTP:
|
|
160
|
+
|
|
161
|
+
```http
|
|
162
|
+
GET /_agent-native/actions/get-status?service=billing
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Para `POST` y otras actions de escritura, envíe un cuerpo JSON al mismo path de la action.
|
|
166
|
+
|
|
132
167
|
## Completación de texto de una sola vez {#complete-text}
|
|
133
168
|
|
|
134
169
|
La mayor parte del trabajo de IA debe realizarse a través del chat del agente para que los usuarios puedan verlo, dirigirlo y auditarlo
|
|
@@ -129,6 +129,41 @@ Si le UI et l'agent doivent tous deux faire quelque chose, définissez une actio
|
|
|
129
129
|
|
|
130
130
|
Utilisez des routes `/api/*` personnalisées uniquement lorsque vous avez besoin d'un protocole en forme de route ou d'un comportement binaire/streaming. Voir [Actions](/docs/actions).
|
|
131
131
|
|
|
132
|
+
### Applications API uniquement {#api-only-apps}
|
|
133
|
+
|
|
134
|
+
Vous n'avez pas besoin d'un serveur Express simplement parce que l'application expose uniquement une API. Une application Agent Native inclut déjà un serveur Nitro/H3, et `defineAction()` est la surface API par défaut. Définissez les opérations dans `actions/` ; le framework monte chaque action sur `/_agent-native/actions/<name>` avec validation de schéma et contexte de requête.
|
|
135
|
+
|
|
136
|
+
Utilisez l'option `http` de l'action pour façonner l'accès HTTP direct : les actions sont en `POST` par défaut, `http: { method: "GET" | "PUT" | "DELETE" }` change le verbe, et `http: false` désactive l'endpoint HTTP d'une action. Utilisez `server/routes/api/*` uniquement pour les besoins en forme de route ou de protocole : téléversements de fichiers, streaming/SSE, webhooks, rappels OAuth, pages publiques, ou une forme REST externe qui ne peut pas être représentée proprement par une action. Ne créez pas de routes `/api/*` qui se contentent surtout d'envelopper ou de réexporter des actions.
|
|
137
|
+
|
|
138
|
+
Pour un endpoint de statut en lecture seule, gardez-le comme une action :
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
// actions/get-status.ts
|
|
142
|
+
import { defineAction } from "@agent-native/core/action";
|
|
143
|
+
import { z } from "zod";
|
|
144
|
+
|
|
145
|
+
export default defineAction({
|
|
146
|
+
description: "Return API service status",
|
|
147
|
+
schema: z.object({
|
|
148
|
+
service: z.string().optional(),
|
|
149
|
+
}),
|
|
150
|
+
http: { method: "GET" },
|
|
151
|
+
run: async ({ service }) => ({
|
|
152
|
+
ok: true,
|
|
153
|
+
service: service ?? "api",
|
|
154
|
+
checkedAt: new Date().toISOString(),
|
|
155
|
+
}),
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Appelez-la directement via HTTP :
|
|
160
|
+
|
|
161
|
+
```http
|
|
162
|
+
GET /_agent-native/actions/get-status?service=billing
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Pour `POST` et les autres actions d'écriture, envoyez un corps JSON au même chemin d'action.
|
|
166
|
+
|
|
132
167
|
## Achèvement du texte en une seule fois {#complete-text}
|
|
133
168
|
|
|
134
169
|
La plupart des travaux d'IA doivent passer par le chat de l'agent afin que les utilisateurs puissent voir, piloter et auditer
|
|
@@ -125,6 +125,41 @@ export default defineEventHandler(() => ({
|
|
|
125
125
|
|
|
126
126
|
कस्टम `/api/*` रूट का उपयोग केवल तभी करें जब आपको रूट-आकार वाले प्रोटोकॉल या बाइनरी/स्ट्रीमिंग व्यवहार की आवश्यकता हो। [Actions](/docs/actions) देखें.
|
|
127
127
|
|
|
128
|
+
### केवल API ऐप्स {#api-only-apps}
|
|
129
|
+
|
|
130
|
+
सिर्फ इसलिए कि ऐप केवल API है, आपको Express सर्वर की आवश्यकता नहीं है। Agent Native ऐप में पहले से Nitro/H3 सर्वर शामिल होता है, और `defineAction()` डिफ़ॉल्ट API सतह है। संचालन को `actions/` में परिभाषित करें; फ़्रेमवर्क हर action को schema validation और request context के साथ `/_agent-native/actions/<name>` पर माउंट करता है।
|
|
131
|
+
|
|
132
|
+
सीधे HTTP access का आकार देने के लिए action के `http` विकल्प का उपयोग करें: actions डिफ़ॉल्ट रूप से `POST` होते हैं, `http: { method: "GET" | "PUT" | "DELETE" }` verb बदलता है, और `http: false` action को HTTP से हटा देता है। `server/routes/api/*` का उपयोग केवल route-shaped या protocol चिंताओं के लिए करें: file uploads, streaming/SSE, webhooks, OAuth callbacks, public pages, या ऐसा external REST shape जिसे action के रूप में साफ़ तरीके से व्यक्त नहीं किया जा सकता। ऐसे `/api/*` routes न बनाएं जो अधिकतर actions को wrap या re-export करते हों।
|
|
133
|
+
|
|
134
|
+
रीड-ओनली status endpoint के लिए, इसे action ही रखें:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
// actions/get-status.ts
|
|
138
|
+
import { defineAction } from "@agent-native/core/action";
|
|
139
|
+
import { z } from "zod";
|
|
140
|
+
|
|
141
|
+
export default defineAction({
|
|
142
|
+
description: "Return API service status",
|
|
143
|
+
schema: z.object({
|
|
144
|
+
service: z.string().optional(),
|
|
145
|
+
}),
|
|
146
|
+
http: { method: "GET" },
|
|
147
|
+
run: async ({ service }) => ({
|
|
148
|
+
ok: true,
|
|
149
|
+
service: service ?? "api",
|
|
150
|
+
checkedAt: new Date().toISOString(),
|
|
151
|
+
}),
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
इसे सीधे HTTP पर कॉल करें:
|
|
156
|
+
|
|
157
|
+
```http
|
|
158
|
+
GET /_agent-native/actions/get-status?service=billing
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
`POST` और अन्य write actions के लिए, उसी action path पर JSON body भेजें.
|
|
162
|
+
|
|
128
163
|
## एक-शॉट पाठ समापन {#complete-text}
|
|
129
164
|
|
|
130
165
|
अधिकांश AI कार्य एजेंट चैट के माध्यम से होना चाहिए ताकि उपयोगकर्ता देख सकें, संचालन कर सकें और ऑडिट कर सकें
|
|
@@ -129,6 +129,41 @@ UI とエージェントの両方が何かを行う必要がある場合は、
|
|
|
129
129
|
|
|
130
130
|
カスタム `/api/*` ルートは、ルート形式のプロトコルまたはバイナリ/ストリーミング動作が必要な場合にのみ使用してください。 [Actions](/docs/actions) を参照してください。
|
|
131
131
|
|
|
132
|
+
### API 専用アプリ {#api-only-apps}
|
|
133
|
+
|
|
134
|
+
アプリが API 専用だからといって、Express サーバーは必要ありません。Agent Native アプリには Nitro/H3 サーバーがすでに含まれており、`defineAction()` がデフォルトの API サーフェスです。操作は `actions/` に定義します。フレームワークは、各 action をスキーマ検証とリクエスト コンテキスト付きで `/_agent-native/actions/<name>` にマウントします。
|
|
135
|
+
|
|
136
|
+
直接 HTTP アクセスの形は action の `http` オプションで調整します。actions はデフォルトで `POST`、`http: { method: "GET" | "PUT" | "DELETE" }` でメソッドを変更し、`http: false` で action を HTTP から外します。`server/routes/api/*` は、ファイル アップロード、ストリーミング/SSE、webhooks、OAuth コールバック、パブリック ページ、または action としてきれいに表せない外部向け REST 形状など、ルート形式またはプロトコル上の関心事にだけ使用してください。主に actions をラップまたは再エクスポートする `/api/*` ルートは作成しないでください。
|
|
137
|
+
|
|
138
|
+
読み取り専用の status endpoint は action として保持します:
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
// actions/get-status.ts
|
|
142
|
+
import { defineAction } from "@agent-native/core/action";
|
|
143
|
+
import { z } from "zod";
|
|
144
|
+
|
|
145
|
+
export default defineAction({
|
|
146
|
+
description: "Return API service status",
|
|
147
|
+
schema: z.object({
|
|
148
|
+
service: z.string().optional(),
|
|
149
|
+
}),
|
|
150
|
+
http: { method: "GET" },
|
|
151
|
+
run: async ({ service }) => ({
|
|
152
|
+
ok: true,
|
|
153
|
+
service: service ?? "api",
|
|
154
|
+
checkedAt: new Date().toISOString(),
|
|
155
|
+
}),
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
HTTP で直接呼び出します:
|
|
160
|
+
|
|
161
|
+
```http
|
|
162
|
+
GET /_agent-native/actions/get-status?service=billing
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
`POST` とその他の書き込み actions では、同じ action path に JSON body を送信します。
|
|
166
|
+
|
|
132
167
|
## ワンショットテキスト補完 {#complete-text}
|
|
133
168
|
|
|
134
169
|
ユーザーが確認、操作、監査できるように、ほとんどの AI 作業はエージェント チャットを経由する必要があります
|
|
@@ -127,6 +127,41 @@ UI와 에이전트가 모두 작업을 수행해야 하는 경우 사용자 지
|
|
|
127
127
|
|
|
128
128
|
경로 형태의 프로토콜이나 바이너리/스트리밍 동작이 필요한 경우에만 사용자 지정 `/api/*` 경로를 사용하세요. [Actions](/docs/actions)를 참조하세요.
|
|
129
129
|
|
|
130
|
+
### API 전용 앱 {#api-only-apps}
|
|
131
|
+
|
|
132
|
+
앱이 API 전용이라고 해서 Express 서버가 필요한 것은 아닙니다. Agent Native 앱에는 이미 Nitro/H3 서버가 포함되어 있으며, `defineAction()`이 기본 API 표면입니다. 작업은 `actions/`에 정의하세요. 프레임워크는 각 action을 schema validation 및 request context와 함께 `/_agent-native/actions/<name>`에 마운트합니다.
|
|
133
|
+
|
|
134
|
+
직접 HTTP access의 형태는 action의 `http` 옵션으로 조정합니다. actions는 기본적으로 `POST`이고, `http: { method: "GET" | "PUT" | "DELETE" }`는 verb를 변경하며, `http: false`는 action을 HTTP에서 제외합니다. `server/routes/api/*`는 file uploads, streaming/SSE, webhooks, OAuth callbacks, public pages 또는 action으로 깔끔하게 표현할 수 없는 external REST shape처럼 route-shaped 또는 protocol 관련 요구에만 사용하세요. 주로 actions를 감싸거나 다시 내보내는 `/api/*` 경로는 만들지 마세요.
|
|
135
|
+
|
|
136
|
+
읽기 전용 상태 endpoint는 action으로 유지하세요:
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
// actions/get-status.ts
|
|
140
|
+
import { defineAction } from "@agent-native/core/action";
|
|
141
|
+
import { z } from "zod";
|
|
142
|
+
|
|
143
|
+
export default defineAction({
|
|
144
|
+
description: "Return API service status",
|
|
145
|
+
schema: z.object({
|
|
146
|
+
service: z.string().optional(),
|
|
147
|
+
}),
|
|
148
|
+
http: { method: "GET" },
|
|
149
|
+
run: async ({ service }) => ({
|
|
150
|
+
ok: true,
|
|
151
|
+
service: service ?? "api",
|
|
152
|
+
checkedAt: new Date().toISOString(),
|
|
153
|
+
}),
|
|
154
|
+
});
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
HTTP로 직접 호출합니다:
|
|
158
|
+
|
|
159
|
+
```http
|
|
160
|
+
GET /_agent-native/actions/get-status?service=billing
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
`POST` 및 기타 쓰기 actions는 같은 action path로 JSON body를 보냅니다.
|
|
164
|
+
|
|
130
165
|
## 원샷 텍스트 완성 {#complete-text}
|
|
131
166
|
|
|
132
167
|
대부분의 AI 작업은 사용자가 보고, 조종하고, 감사할 수 있도록 에이전트 채팅을 거쳐야 합니다.
|
|
@@ -129,6 +129,41 @@ Se o UI e o agente precisarem fazer algo, defina uma ação em vez de uma rota A
|
|
|
129
129
|
|
|
130
130
|
Use rotas `/api/*` personalizadas somente quando precisar de um protocolo em formato de rota ou comportamento binário/streaming. Consulte [Actions](/docs/actions).
|
|
131
131
|
|
|
132
|
+
### Aplicativos somente API {#api-only-apps}
|
|
133
|
+
|
|
134
|
+
Você não precisa de um servidor Express só porque o aplicativo é somente API. Um aplicativo Agent Native já vem com um servidor Nitro/H3, e `defineAction()` é a superfície API padrão. Defina operações em `actions/`; a estrutura monta cada action em `/_agent-native/actions/<name>` com validação de schema e contexto de solicitação.
|
|
135
|
+
|
|
136
|
+
Use a opção `http` da action para moldar o acesso HTTP direto: actions são `POST` por padrão, `http: { method: "GET" | "PUT" | "DELETE" }` altera o verbo, e `http: false` remove uma action do HTTP. Use `server/routes/api/*` apenas para necessidades com formato de rota ou protocolo: uploads de arquivos, streaming/SSE, webhooks, callbacks OAuth, páginas públicas ou uma forma REST externa que não possa ser representada claramente como uma action. Não crie rotas `/api/*` que principalmente encapsulem ou reexportem actions.
|
|
137
|
+
|
|
138
|
+
Para um endpoint de status somente leitura, mantenha-o como uma action:
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
// actions/get-status.ts
|
|
142
|
+
import { defineAction } from "@agent-native/core/action";
|
|
143
|
+
import { z } from "zod";
|
|
144
|
+
|
|
145
|
+
export default defineAction({
|
|
146
|
+
description: "Return API service status",
|
|
147
|
+
schema: z.object({
|
|
148
|
+
service: z.string().optional(),
|
|
149
|
+
}),
|
|
150
|
+
http: { method: "GET" },
|
|
151
|
+
run: async ({ service }) => ({
|
|
152
|
+
ok: true,
|
|
153
|
+
service: service ?? "api",
|
|
154
|
+
checkedAt: new Date().toISOString(),
|
|
155
|
+
}),
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Chame diretamente via HTTP:
|
|
160
|
+
|
|
161
|
+
```http
|
|
162
|
+
GET /_agent-native/actions/get-status?service=billing
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Para `POST` e outras actions de escrita, envie um corpo JSON para o mesmo caminho da action.
|
|
166
|
+
|
|
132
167
|
## Completamento de texto único {#complete-text}
|
|
133
168
|
|
|
134
169
|
A maior parte do trabalho de IA deve passar pelo chat do agente para que os usuários possam ver, orientar e auditar
|
|
@@ -125,6 +125,41 @@ export default defineEventHandler(() => ({
|
|
|
125
125
|
|
|
126
126
|
仅当您需要路由型协议或二进制/流行为时才使用自定义 `/api/*` 路由。参见[Actions](/docs/actions)。
|
|
127
127
|
|
|
128
|
+
### 仅 API 应用 {#api-only-apps}
|
|
129
|
+
|
|
130
|
+
应用仅提供 API 并不意味着需要 Express 服务器。Agent Native 应用已经自带 Nitro/H3 服务器,`defineAction()` 是默认的 API 表面。将操作定义在 `actions/` 中;框架会把每个 action 挂载到 `/_agent-native/actions/<name>`,并带有 schema 验证和请求上下文。
|
|
131
|
+
|
|
132
|
+
使用 action 的 `http` 选项来调整直接 HTTP 访问方式:actions 默认是 `POST`,`http: { method: "GET" | "PUT" | "DELETE" }` 会更改动词,`http: false` 会关闭该 action 的 HTTP 端点。只有在处理路由形状或协议问题时才使用 `server/routes/api/*`:文件上传、流式传输/SSE、webhooks、OAuth 回调、公共页面,或无法干净表示为 action 的外部 REST 形状。不要创建主要只是包装或重新导出 actions 的 `/api/*` 路由。
|
|
133
|
+
|
|
134
|
+
对于只读状态 endpoint,请保持为 action:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
// actions/get-status.ts
|
|
138
|
+
import { defineAction } from "@agent-native/core/action";
|
|
139
|
+
import { z } from "zod";
|
|
140
|
+
|
|
141
|
+
export default defineAction({
|
|
142
|
+
description: "Return API service status",
|
|
143
|
+
schema: z.object({
|
|
144
|
+
service: z.string().optional(),
|
|
145
|
+
}),
|
|
146
|
+
http: { method: "GET" },
|
|
147
|
+
run: async ({ service }) => ({
|
|
148
|
+
ok: true,
|
|
149
|
+
service: service ?? "api",
|
|
150
|
+
checkedAt: new Date().toISOString(),
|
|
151
|
+
}),
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
直接通过 HTTP 调用:
|
|
156
|
+
|
|
157
|
+
```http
|
|
158
|
+
GET /_agent-native/actions/get-status?service=billing
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
对于 `POST` 和其他写入 actions,请将 JSON body 发送到相同的 action path。
|
|
162
|
+
|
|
128
163
|
## 一次性文本完成 {#complete-text}
|
|
129
164
|
|
|
130
165
|
大多数人工智能工作应通过代理聊天进行,以便用户可以查看、引导和审核
|
|
@@ -125,6 +125,41 @@ export default defineEventHandler(() => ({
|
|
|
125
125
|
|
|
126
126
|
僅當您需要路由型協議或二進制/流行為時才使用自訂 `/api/*` 路由。參見[Actions](/docs/actions)。
|
|
127
127
|
|
|
128
|
+
### 僅 API 應用程式 {#api-only-apps}
|
|
129
|
+
|
|
130
|
+
應用程式僅提供 API 並不表示需要 Express 伺服器。Agent Native 應用程式已經內建 Nitro/H3 伺服器,`defineAction()` 是預設的 API 表面。將操作定義在 `actions/` 中;框架會將每個 action 掛載到 `/_agent-native/actions/<name>`,並包含 schema 驗證和請求脈絡。
|
|
131
|
+
|
|
132
|
+
使用 action 的 `http` 選項來調整直接 HTTP 存取方式:actions 預設是 `POST`,`http: { method: "GET" | "PUT" | "DELETE" }` 會變更動詞,`http: false` 會關閉該 action 的 HTTP 端點。只有在處理路由形狀或協議問題時才使用 `server/routes/api/*`:檔案上傳、串流/SSE、webhooks、OAuth 回呼、公開頁面,或無法乾淨表示為 action 的外部 REST 形狀。不要建立主要只是包裝或重新匯出 actions 的 `/api/*` 路由。
|
|
133
|
+
|
|
134
|
+
對於唯讀狀態 endpoint,請保持為 action:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
// actions/get-status.ts
|
|
138
|
+
import { defineAction } from "@agent-native/core/action";
|
|
139
|
+
import { z } from "zod";
|
|
140
|
+
|
|
141
|
+
export default defineAction({
|
|
142
|
+
description: "Return API service status",
|
|
143
|
+
schema: z.object({
|
|
144
|
+
service: z.string().optional(),
|
|
145
|
+
}),
|
|
146
|
+
http: { method: "GET" },
|
|
147
|
+
run: async ({ service }) => ({
|
|
148
|
+
ok: true,
|
|
149
|
+
service: service ?? "api",
|
|
150
|
+
checkedAt: new Date().toISOString(),
|
|
151
|
+
}),
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
直接透過 HTTP 呼叫:
|
|
156
|
+
|
|
157
|
+
```http
|
|
158
|
+
GET /_agent-native/actions/get-status?service=billing
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
對於 `POST` 和其他寫入 actions,請將 JSON body 傳送到相同的 action path。
|
|
162
|
+
|
|
128
163
|
## 一次性文字完成 {#complete-text}
|
|
129
164
|
|
|
130
165
|
大多數人工智慧工作應透過代理聊天進行,以便使用者可以檢視、引導和審核
|
package/docs/content/server.mdx
CHANGED
|
@@ -129,6 +129,41 @@ If the UI and agent both need to do something, define an action instead of a cus
|
|
|
129
129
|
|
|
130
130
|
Use custom `/api/*` routes only when you need a route-shaped protocol or binary/streaming behavior. See [Actions](/docs/actions).
|
|
131
131
|
|
|
132
|
+
### API-Only Apps {#api-only-apps}
|
|
133
|
+
|
|
134
|
+
You do not need an Express server just because the app is API-only. An agent-native app already ships with a Nitro/H3 server, and `defineAction()` is the default API surface. Define operations in `actions/`; the framework mounts each action at `/_agent-native/actions/<name>` with schema validation and request context.
|
|
135
|
+
|
|
136
|
+
Use the action `http` option to shape direct HTTP access: actions are `POST` by default, `http: { method: "GET" | "PUT" | "DELETE" }` changes the verb, and `http: false` keeps an action off HTTP. Reach for `server/routes/api/*` only for route-shaped or protocol concerns: file uploads, streaming/SSE, webhooks, OAuth callbacks, public pages, or an external REST shape that cannot be represented cleanly as an action. Do not create `/api/*` routes that mostly wrap or re-export actions.
|
|
137
|
+
|
|
138
|
+
For a read-only status endpoint, keep it as an action:
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
// actions/get-status.ts
|
|
142
|
+
import { defineAction } from "@agent-native/core/action";
|
|
143
|
+
import { z } from "zod";
|
|
144
|
+
|
|
145
|
+
export default defineAction({
|
|
146
|
+
description: "Return API service status",
|
|
147
|
+
schema: z.object({
|
|
148
|
+
service: z.string().optional(),
|
|
149
|
+
}),
|
|
150
|
+
http: { method: "GET" },
|
|
151
|
+
run: async ({ service }) => ({
|
|
152
|
+
ok: true,
|
|
153
|
+
service: service ?? "api",
|
|
154
|
+
checkedAt: new Date().toISOString(),
|
|
155
|
+
}),
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Call it directly over HTTP:
|
|
160
|
+
|
|
161
|
+
```http
|
|
162
|
+
GET /_agent-native/actions/get-status?service=billing
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
For `POST` and other write actions, send a JSON body to the same action path.
|
|
166
|
+
|
|
132
167
|
## One-Shot Text Completion {#complete-text}
|
|
133
168
|
|
|
134
169
|
Most AI work should go through the agent chat so users can see, steer, and audit
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.92.
|
|
3
|
+
"version": "0.92.4",
|
|
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": {
|
|
@@ -315,7 +315,7 @@
|
|
|
315
315
|
"y-protocols": "^1.0.7",
|
|
316
316
|
"yjs": "^13.6.31",
|
|
317
317
|
"zod": "^4.3.6",
|
|
318
|
-
"@agent-native/toolkit": "0.4.4"
|
|
318
|
+
"@agent-native/toolkit": "^0.4.4"
|
|
319
319
|
},
|
|
320
320
|
"devDependencies": {
|
|
321
321
|
"@ai-sdk/anthropic": "^3.0.71",
|