@agent-native/core 0.173.1 → 0.173.2-nightly-20260825163448

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 (33) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/clips/desktop/src/app.tsx +77 -7
  3. package/corpus/templates/clips/desktop/src/lib/recorder.ts +91 -25
  4. package/corpus/templates/clips/desktop/src/lib/upload-recovery.ts +20 -2
  5. package/corpus/templates/clips/desktop/src-tauri/Cargo.toml +7 -1
  6. package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +1 -0
  7. package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +372 -70
  8. package/corpus/templates/clips/server/lib/resumable-session.ts +15 -0
  9. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +245 -118
  10. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/reset-chunks.post.ts +21 -11
  11. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/resume.get.ts +132 -25
  12. package/corpus/templates/content/actions/_database-property-input.ts +211 -0
  13. package/corpus/templates/content/actions/_database-row-mutation.ts +151 -26
  14. package/corpus/templates/content/actions/add-database-item.ts +15 -5
  15. package/corpus/templates/content/actions/update-database-item.ts +15 -7
  16. package/corpus/templates/content/actions/upsert-database-item-by-key.ts +15 -5
  17. package/corpus/templates/content/package.json +1 -0
  18. package/corpus/templates/content/parity/README.md +11 -2
  19. package/corpus/templates/content/parity/eval-scenarios.ts +52 -0
  20. package/corpus/templates/content/parity/run-database-create-property-preservation.ts +140 -0
  21. package/corpus/templates/content/parity/scenario-to-eval.ts +390 -0
  22. package/dist/agent/run-store.js +0 -1
  23. package/dist/client/agent-engine-key.js +26 -4
  24. package/dist/client/settings/ProviderSetupForm.js +1 -1
  25. package/dist/collab/struct-routes.d.ts +1 -1
  26. package/dist/eval/agent-runner.js +23 -0
  27. package/dist/eval/types.d.ts +11 -0
  28. package/dist/observability/routes.d.ts +1 -1
  29. package/dist/resources/handlers.d.ts +1 -1
  30. package/dist/server/agent-engine-api-key-route.d.ts +7 -0
  31. package/dist/server/agent-engine-api-key-route.js +38 -0
  32. package/dist/server/realtime-token.d.ts +1 -1
  33. package/package.json +1 -1
@@ -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
- error: string;
52
51
  ok?: undefined;
52
+ error: string;
53
53
  } | {
54
54
  error?: undefined;
55
55
  ok: boolean;
@@ -4,6 +4,13 @@ export interface AgentEngineApiKeyWriteTarget {
4
4
  scope: AgentEngineApiKeyScope;
5
5
  scopeId: string;
6
6
  }
7
+ export declare function validateAgentEngineProviderKey(key: string, value: string): Promise<{
8
+ ok: true;
9
+ } | {
10
+ ok: false;
11
+ statusCode: number;
12
+ error: string;
13
+ }>;
7
14
  export declare function normalizeAgentEngineApiKeyPayload(body: unknown): {
8
15
  ok: true;
9
16
  key: string;
@@ -17,6 +17,39 @@ const BASE_URL_KEYS = new Set([
17
17
  OLLAMA_BASE_URL_ENV_VAR,
18
18
  ]);
19
19
  const OPENAI_PROVIDER_KEY = PROVIDER_TO_ENV_VAR.get("openai") ?? "";
20
+ const OPENROUTER_PROVIDER_KEY = PROVIDER_TO_ENV_VAR.get("openrouter") ?? "";
21
+ const OPENROUTER_KEY_DETAILS_URL = "https://openrouter.ai/api/v1/key";
22
+ export async function validateAgentEngineProviderKey(key, value) {
23
+ if (key !== OPENROUTER_PROVIDER_KEY)
24
+ return { ok: true };
25
+ try {
26
+ const response = await fetch(OPENROUTER_KEY_DETAILS_URL, {
27
+ headers: { Authorization: `Bearer ${value}` },
28
+ signal: AbortSignal.timeout(8_000),
29
+ });
30
+ if (response.ok)
31
+ return { ok: true };
32
+ if (response.status === 401 || response.status === 403) {
33
+ return {
34
+ ok: false,
35
+ statusCode: 400,
36
+ error: "OpenRouter rejected this API key. Get a new key from OpenRouter and try again.",
37
+ };
38
+ }
39
+ return {
40
+ ok: false,
41
+ statusCode: 502,
42
+ error: "OpenRouter could not verify this API key right now. Try again in a moment.",
43
+ };
44
+ }
45
+ catch {
46
+ return {
47
+ ok: false,
48
+ statusCode: 502,
49
+ error: "Could not reach OpenRouter to verify this API key. Check your connection and try again.",
50
+ };
51
+ }
52
+ }
20
53
  export function normalizeAgentEngineApiKeyPayload(body) {
21
54
  const payload = body && typeof body === "object" ? body : {};
22
55
  const raw = payload;
@@ -154,6 +187,11 @@ export function createAgentEngineApiKeyHandler() {
154
187
  }
155
188
  }
156
189
  if (payload.value) {
190
+ const keyValidation = await validateAgentEngineProviderKey(payload.key, payload.value);
191
+ if (!keyValidation.ok) {
192
+ setResponseStatus(event, keyValidation.statusCode);
193
+ return { error: keyValidation.error };
194
+ }
157
195
  await writeAppSecret({
158
196
  key: payload.key,
159
197
  value: payload.value,
@@ -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
  }>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.173.1",
3
+ "version": "0.173.2-nightly-20260825163448",
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": {