@agent-native/core 0.0.0-beta-20260820224008 → 0.0.0-beta-20260820231735
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/templates/brain/actions/list-sources.ts +17 -7
- package/corpus/templates/brain/app/components/brain/Surface.tsx +4 -2
- package/corpus/templates/brain/app/lib/brain.ts +13 -3
- package/corpus/templates/brain/server/lib/brain-health.ts +5 -8
- package/corpus/templates/brain/server/lib/brain.ts +1 -0
- package/corpus/templates/brain/server/lib/capture-sanitization.ts +5 -0
- package/corpus/templates/brain/server/routes/api/brain/queue/run.post.ts +3 -2
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/routes.d.ts +1 -1
- package/dist/config.d.ts +3 -1
- package/dist/config.js +14 -9
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +3 -3
- package/dist/resources/handlers.d.ts +2 -2
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/vite/agent-native-config-loader.js +1 -1
- package/dist/vite/client.js +6 -8
- package/docs/content/agent-native-config.mdx +55 -31
- package/docs/content/environment-variables.mdx +51 -14
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ import { z } from "zod";
|
|
|
6
6
|
import { getDb, schema } from "../server/db/index.js";
|
|
7
7
|
import { nextBrainSourceSyncAt } from "../server/jobs/sync-sources.js";
|
|
8
8
|
import { listAccessibleAudienceIds } from "../server/lib/audiences.js";
|
|
9
|
+
import { sourceHealthState } from "../server/lib/brain-health.js";
|
|
9
10
|
import { parseJson, serializeSource } from "../server/lib/brain.js";
|
|
10
11
|
import { sourceProviderSchema } from "./_schemas.js";
|
|
11
12
|
|
|
@@ -71,14 +72,23 @@ export default defineAction({
|
|
|
71
72
|
.from(schema.brainSources)
|
|
72
73
|
.where(and(...clauses))
|
|
73
74
|
.orderBy(desc(schema.brainSources.updatedAt));
|
|
75
|
+
const nowMs = Date.now();
|
|
74
76
|
const sources = await Promise.all(
|
|
75
|
-
rows.map(async (row) =>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
rows.map(async (row) => {
|
|
78
|
+
const latest = await latestRun(row.id);
|
|
79
|
+
const nextSyncAt = nextBrainSourceSyncAt(row);
|
|
80
|
+
return {
|
|
81
|
+
...serializeSource(row),
|
|
82
|
+
recordCount: await sourceRecordCount(row.id),
|
|
83
|
+
latestRun: latest,
|
|
84
|
+
nextSyncAt,
|
|
85
|
+
health: sourceHealthState(row, latest, nextSyncAt, nowMs),
|
|
86
|
+
};
|
|
87
|
+
}),
|
|
81
88
|
);
|
|
82
|
-
return {
|
|
89
|
+
return {
|
|
90
|
+
count: rows.length,
|
|
91
|
+
sources,
|
|
92
|
+
};
|
|
83
93
|
},
|
|
84
94
|
});
|
|
@@ -117,7 +117,8 @@ export function StatusBadge({ status }: { status: string }) {
|
|
|
117
117
|
? IconCircleCheck
|
|
118
118
|
: normalized.includes("review") ||
|
|
119
119
|
normalized.includes("degraded") ||
|
|
120
|
-
normalized.includes("stale")
|
|
120
|
+
normalized.includes("stale") ||
|
|
121
|
+
normalized.includes("needs")
|
|
121
122
|
? IconClock
|
|
122
123
|
: normalized.includes("error")
|
|
123
124
|
? IconAlertTriangle
|
|
@@ -132,7 +133,8 @@ export function StatusBadge({ status }: { status: string }) {
|
|
|
132
133
|
"border-border bg-secondary text-secondary-foreground",
|
|
133
134
|
(normalized.includes("review") ||
|
|
134
135
|
normalized.includes("degraded") ||
|
|
135
|
-
normalized.includes("stale")
|
|
136
|
+
normalized.includes("stale") ||
|
|
137
|
+
normalized.includes("needs")) &&
|
|
136
138
|
"border-amber-500/35 bg-amber-500/10 text-amber-700 dark:text-amber-300",
|
|
137
139
|
normalized.includes("error") &&
|
|
138
140
|
"border-destructive/35 bg-destructive/10 text-destructive",
|
|
@@ -20,7 +20,14 @@ export type BrainView =
|
|
|
20
20
|
| "settings";
|
|
21
21
|
|
|
22
22
|
export type KnowledgeStatus = "approved" | "needs_review" | "draft" | "stale";
|
|
23
|
-
export type SourceHealth =
|
|
23
|
+
export type SourceHealth =
|
|
24
|
+
| "healthy"
|
|
25
|
+
| "needs_setup"
|
|
26
|
+
| "needs_sync"
|
|
27
|
+
| "stale"
|
|
28
|
+
| "degraded"
|
|
29
|
+
| "paused"
|
|
30
|
+
| "error";
|
|
24
31
|
export type ReviewPriority = "high" | "medium" | "low";
|
|
25
32
|
|
|
26
33
|
export interface Citation {
|
|
@@ -1144,8 +1151,11 @@ export function sourceDescription(source: BrainSource) {
|
|
|
1144
1151
|
export function sourceHealth(source: BrainSource): SourceHealth {
|
|
1145
1152
|
if (source.health) return source.health;
|
|
1146
1153
|
if (sourceRetryAfter(source)) return "degraded";
|
|
1147
|
-
if (source.status === "active")
|
|
1148
|
-
|
|
1154
|
+
if (source.status === "active") {
|
|
1155
|
+
if (source.lastError) return "degraded";
|
|
1156
|
+
if (sourceAutoSync(source) && !source.lastSyncedAt) return "needs_sync";
|
|
1157
|
+
return "healthy";
|
|
1158
|
+
}
|
|
1149
1159
|
if (source.status === "error") return "error";
|
|
1150
1160
|
if (source.status === "paused" || source.status === "archived")
|
|
1151
1161
|
return "paused";
|
|
@@ -189,9 +189,9 @@ function latestIso(values: Array<string | null | undefined>) {
|
|
|
189
189
|
return latest;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
function sourceHealthState(
|
|
192
|
+
export function sourceHealthState(
|
|
193
193
|
source: SourceRow,
|
|
194
|
-
latestRun: SyncRunRow | null,
|
|
194
|
+
latestRun: Pick<SyncRunRow, "status"> | null,
|
|
195
195
|
nextSyncAt: string | null,
|
|
196
196
|
nowMs: number,
|
|
197
197
|
): BrainSourceHealthState {
|
|
@@ -530,12 +530,9 @@ export async function readBrainHealth() {
|
|
|
530
530
|
};
|
|
531
531
|
});
|
|
532
532
|
|
|
533
|
-
const sourceHealthCounts = countStatuses<
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
...sourceSummaries.map((source) => ({ status: source.health })),
|
|
537
|
-
...sourceRows.map((source) => ({ status: source.status })),
|
|
538
|
-
]);
|
|
533
|
+
const sourceHealthCounts = countStatuses<BrainSourceHealthState>(
|
|
534
|
+
sourceSummaries.map((source) => ({ status: source.health })),
|
|
535
|
+
);
|
|
539
536
|
const captureCounts = countStatuses(captureRows);
|
|
540
537
|
const captureDispositionCounts = countStatuses(
|
|
541
538
|
captureRows.map((capture) => ({
|
|
@@ -755,6 +755,7 @@ export async function createCapture(values: {
|
|
|
755
755
|
title: source.title,
|
|
756
756
|
provider: source.provider as BrainSourceProvider,
|
|
757
757
|
ownerEmail: source.ownerEmail,
|
|
758
|
+
orgId: source.orgId,
|
|
758
759
|
},
|
|
759
760
|
sourceConfig: parseJson<Record<string, unknown>>(source.configJson, {}),
|
|
760
761
|
settings,
|
|
@@ -71,6 +71,7 @@ export interface CaptureSanitizationInput {
|
|
|
71
71
|
title: string;
|
|
72
72
|
provider: BrainSourceProvider;
|
|
73
73
|
ownerEmail: string;
|
|
74
|
+
orgId?: string | null;
|
|
74
75
|
};
|
|
75
76
|
sourceConfig?: Record<string, unknown>;
|
|
76
77
|
settings: BrainSettings;
|
|
@@ -440,6 +441,10 @@ async function classifyWithApprovedModel(
|
|
|
440
441
|
apiKeyEnvVar: userApiKey.apiKeyEnvVar,
|
|
441
442
|
appId: "brain",
|
|
442
443
|
engineOption: engineName,
|
|
444
|
+
credentialIdentity: {
|
|
445
|
+
userEmail: input.source.ownerEmail,
|
|
446
|
+
orgId: input.source.orgId ?? undefined,
|
|
447
|
+
},
|
|
443
448
|
});
|
|
444
449
|
|
|
445
450
|
const maxChars = Math.min(
|
|
@@ -10,7 +10,8 @@ declare global {
|
|
|
10
10
|
var __AGENT_NATIVE_BRAIN_SCHEDULED_RUNTIME__: boolean | undefined;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export const BRAIN_QUEUE_SWEEP_LIMIT =
|
|
13
|
+
export const BRAIN_QUEUE_SWEEP_LIMIT = 25;
|
|
14
|
+
export const BRAIN_MAX_DISTILLATIONS_PER_SWEEP = 2;
|
|
14
15
|
|
|
15
16
|
function productionLike() {
|
|
16
17
|
return (
|
|
@@ -53,7 +54,7 @@ export default defineEventHandler(async (event) => {
|
|
|
53
54
|
processBrainIngestQueueOnce({
|
|
54
55
|
limit: BRAIN_QUEUE_SWEEP_LIMIT,
|
|
55
56
|
runDistillation: true,
|
|
56
|
-
maxDistillations:
|
|
57
|
+
maxDistillations: BRAIN_MAX_DISTILLATIONS_PER_SWEEP,
|
|
57
58
|
}),
|
|
58
59
|
expireSensitivityQuarantines(),
|
|
59
60
|
]);
|
|
@@ -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;
|
|
65
66
|
states: {
|
|
66
67
|
clientId: number;
|
|
67
68
|
state: string;
|
|
68
69
|
}[];
|
|
69
|
-
error?: undefined;
|
|
70
70
|
}>>;
|
|
71
71
|
/**
|
|
72
72
|
* GET /_agent-native/collab/:docId/users
|
|
@@ -77,9 +77,9 @@ export declare const getActiveUsers: import("h3").EventHandlerWithFetch<import("
|
|
|
77
77
|
error: string;
|
|
78
78
|
users?: undefined;
|
|
79
79
|
} | {
|
|
80
|
+
error?: undefined;
|
|
80
81
|
users: {
|
|
81
82
|
clientId: number;
|
|
82
83
|
lastSeen: number;
|
|
83
84
|
}[];
|
|
84
|
-
error?: undefined;
|
|
85
85
|
}>>;
|
package/dist/collab/routes.d.ts
CHANGED
|
@@ -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;
|
package/dist/config.d.ts
CHANGED
|
@@ -113,7 +113,9 @@ export declare function agentNativeConfigEnvName(path: readonly string[]): strin
|
|
|
113
113
|
*/
|
|
114
114
|
export declare function readAgentNativeConfigEnv(env: Record<string, string | undefined>): AgentNativeConfig;
|
|
115
115
|
export declare function normalizeAgentNativeConfig(input: unknown, source?: string): AgentNativeConfig;
|
|
116
|
-
export declare function mergeAgentNativeConfigs(base: AgentNativeConfig, override: AgentNativeConfig
|
|
116
|
+
export declare function mergeAgentNativeConfigs(base: AgentNativeConfig, override: AgentNativeConfig, options?: {
|
|
117
|
+
arrayStrategy?: "merge" | "replace";
|
|
118
|
+
}): AgentNativeConfig;
|
|
117
119
|
export declare function resolveAgentNativeConfig(input: AgentNativeConfigInput | undefined, context: AgentNativeConfigContext): AgentNativeConfig;
|
|
118
120
|
export declare function resolveFirstRunOnboardingMode(setting: AgentNativeFirstRunOnboardingSetting, context: AgentNativeConfigContext): AgentNativeFirstRunOnboardingMode;
|
|
119
121
|
export declare function isAgentNativeDeploymentEnvironment(value: unknown): value is AgentNativeDeploymentEnvironment;
|
package/dist/config.js
CHANGED
|
@@ -315,7 +315,8 @@ export function normalizeAgentNativeConfig(input, source = "agent-native config"
|
|
|
315
315
|
}
|
|
316
316
|
return normalized;
|
|
317
317
|
}
|
|
318
|
-
export function mergeAgentNativeConfigs(base, override) {
|
|
318
|
+
export function mergeAgentNativeConfigs(base, override, options = {}) {
|
|
319
|
+
const arrayStrategy = options.arrayStrategy ?? "merge";
|
|
319
320
|
return {
|
|
320
321
|
...(base.version === undefined && override.version === undefined
|
|
321
322
|
? {}
|
|
@@ -348,7 +349,7 @@ export function mergeAgentNativeConfigs(base, override) {
|
|
|
348
349
|
? {
|
|
349
350
|
...base.runtime?.environment,
|
|
350
351
|
...override.runtime?.environment,
|
|
351
|
-
required: mergeStringLists(base.runtime?.environment?.required, override.runtime?.environment?.required),
|
|
352
|
+
required: mergeStringLists(base.runtime?.environment?.required, override.runtime?.environment?.required, arrayStrategy),
|
|
352
353
|
}
|
|
353
354
|
: undefined,
|
|
354
355
|
}
|
|
@@ -390,7 +391,7 @@ export function mergeAgentNativeConfigs(base, override) {
|
|
|
390
391
|
...override.changelog,
|
|
391
392
|
}
|
|
392
393
|
: undefined,
|
|
393
|
-
harness: mergeHarnessSettings(base.harness, override.harness),
|
|
394
|
+
harness: mergeHarnessSettings(base.harness, override.harness, arrayStrategy),
|
|
394
395
|
};
|
|
395
396
|
}
|
|
396
397
|
export function resolveAgentNativeConfig(input, context) {
|
|
@@ -551,7 +552,7 @@ function normalizeHarnessConfig(value, source) {
|
|
|
551
552
|
: { runtimes: [...new Set(runtimes)] }),
|
|
552
553
|
};
|
|
553
554
|
}
|
|
554
|
-
function mergeHarnessSettings(base, override) {
|
|
555
|
+
function mergeHarnessSettings(base, override, arrayStrategy = "merge") {
|
|
555
556
|
if (override === undefined)
|
|
556
557
|
return base;
|
|
557
558
|
if (typeof override === "boolean")
|
|
@@ -563,10 +564,12 @@ function mergeHarnessSettings(base, override) {
|
|
|
563
564
|
}
|
|
564
565
|
return {
|
|
565
566
|
runtimes: [
|
|
566
|
-
...
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
567
|
+
...(arrayStrategy === "replace"
|
|
568
|
+
? (override.runtimes ?? base.runtimes ?? [])
|
|
569
|
+
: new Set([
|
|
570
|
+
...(base.runtimes ?? []),
|
|
571
|
+
...(override.runtimes ?? []),
|
|
572
|
+
])),
|
|
570
573
|
],
|
|
571
574
|
};
|
|
572
575
|
}
|
|
@@ -592,9 +595,11 @@ function normalizeRequiredEnvKeys(value, source) {
|
|
|
592
595
|
}
|
|
593
596
|
return [...new Set(keys)];
|
|
594
597
|
}
|
|
595
|
-
function mergeStringLists(base, override) {
|
|
598
|
+
function mergeStringLists(base, override, arrayStrategy = "merge") {
|
|
596
599
|
if (base === undefined && override === undefined)
|
|
597
600
|
return undefined;
|
|
601
|
+
if (arrayStrategy === "replace")
|
|
602
|
+
return override ?? base;
|
|
598
603
|
return [...new Set([...(base ?? []), ...(override ?? [])])];
|
|
599
604
|
}
|
|
600
605
|
function isFirstRunMode(value) {
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
* DELETE /_agent-native/notifications/:id — delete
|
|
12
12
|
*/
|
|
13
13
|
export declare function createNotificationsHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<"" | import("./types.js").Notification[] | {
|
|
14
|
+
error?: undefined;
|
|
14
15
|
count: number;
|
|
15
16
|
updated?: undefined;
|
|
16
|
-
error?: undefined;
|
|
17
17
|
ok?: undefined;
|
|
18
18
|
} | {
|
|
19
|
+
error?: undefined;
|
|
19
20
|
count?: undefined;
|
|
20
21
|
updated: number;
|
|
21
|
-
error?: undefined;
|
|
22
22
|
ok?: undefined;
|
|
23
23
|
} | {
|
|
24
24
|
count?: undefined;
|
|
@@ -26,8 +26,8 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
|
|
|
26
26
|
error: string;
|
|
27
27
|
ok?: undefined;
|
|
28
28
|
} | {
|
|
29
|
+
error?: undefined;
|
|
29
30
|
count?: undefined;
|
|
30
31
|
updated?: undefined;
|
|
31
|
-
error?: undefined;
|
|
32
32
|
ok: boolean;
|
|
33
33
|
}>>;
|
|
@@ -41,16 +41,16 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
41
41
|
thumbsUpRate: number;
|
|
42
42
|
avgEvalScore: number;
|
|
43
43
|
} | {
|
|
44
|
+
error?: undefined;
|
|
44
45
|
summary: import("./types.js").TraceSummary;
|
|
45
46
|
spans: import("./types.js").TraceSpan[];
|
|
46
47
|
id?: undefined;
|
|
47
|
-
error?: undefined;
|
|
48
48
|
ok?: undefined;
|
|
49
49
|
} | {
|
|
50
|
+
error?: undefined;
|
|
50
51
|
summary?: undefined;
|
|
51
52
|
spans?: undefined;
|
|
52
53
|
id: string;
|
|
53
|
-
error?: undefined;
|
|
54
54
|
ok?: undefined;
|
|
55
55
|
} | {
|
|
56
56
|
summary?: undefined;
|
|
@@ -59,9 +59,9 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
59
59
|
error: any;
|
|
60
60
|
ok?: undefined;
|
|
61
61
|
} | {
|
|
62
|
+
error?: undefined;
|
|
62
63
|
summary?: undefined;
|
|
63
64
|
spans?: undefined;
|
|
64
65
|
id?: undefined;
|
|
65
|
-
error?: undefined;
|
|
66
66
|
ok: boolean;
|
|
67
67
|
}>>;
|
|
@@ -51,8 +51,8 @@ export declare function handleDeleteResource(event: any): Promise<{
|
|
|
51
51
|
error: string;
|
|
52
52
|
ok?: undefined;
|
|
53
53
|
} | {
|
|
54
|
-
ok: boolean;
|
|
55
54
|
error?: undefined;
|
|
55
|
+
ok: boolean;
|
|
56
56
|
}>;
|
|
57
57
|
/** POST /_agent-native/resources/upload — upload a file as a resource */
|
|
58
58
|
export declare function handleUploadResource(event: any): Promise<import("./store.js").Resource | {
|
|
@@ -73,10 +73,10 @@ export declare function handleUploadResource(event: any): Promise<import("./stor
|
|
|
73
73
|
runId: string | null;
|
|
74
74
|
expiresAt: number | null;
|
|
75
75
|
metadata: string | null;
|
|
76
|
+
error?: undefined;
|
|
76
77
|
url: string;
|
|
77
78
|
provider: string;
|
|
78
79
|
storageSetupRequired?: undefined;
|
|
79
|
-
error?: undefined;
|
|
80
80
|
} | {
|
|
81
81
|
error: string;
|
|
82
82
|
storageSetupRequired: boolean;
|
|
@@ -26,8 +26,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
|
|
|
26
26
|
expiresAt?: undefined;
|
|
27
27
|
ttlSeconds?: undefined;
|
|
28
28
|
} | {
|
|
29
|
+
error?: undefined;
|
|
29
30
|
token: string;
|
|
30
31
|
expiresAt: string;
|
|
31
32
|
ttlSeconds: number;
|
|
32
|
-
error?: undefined;
|
|
33
33
|
}>>;
|
|
@@ -81,7 +81,7 @@ export async function loadResolvedAgentNativeConfig(cwd, context, options = {})
|
|
|
81
81
|
: await loadAgentNativeConfigFile(cwd));
|
|
82
82
|
return resolveAgentNativeConfig(mergeAgentNativeConfigs(mergeAgentNativeConfigs(mergeAgentNativeConfigs(workspaceConfig
|
|
83
83
|
? resolveAgentNativeConfig(workspaceConfig, context)
|
|
84
|
-
: {}, readAgentNativeJsonConfig(cwd)), readAgentNativeConfigEnv(options.environment ?? process.env)
|
|
84
|
+
: {}, readAgentNativeJsonConfig(cwd)), projectConfig ? resolveAgentNativeConfig(projectConfig, context) : {}), readAgentNativeConfigEnv(options.environment ?? process.env), { arrayStrategy: "replace" }), context);
|
|
85
85
|
}
|
|
86
86
|
function findConfigPath(cwd) {
|
|
87
87
|
return AGENT_NATIVE_CONFIG_FILE_CANDIDATES.map((filename) => path.join(cwd, filename)).find((candidate) => fs.existsSync(candidate));
|
package/dist/vite/client.js
CHANGED
|
@@ -2806,7 +2806,7 @@ function reportRuntimeConfigDiagnostics(appConfig, context, mode, env = process.
|
|
|
2806
2806
|
}
|
|
2807
2807
|
console.warn(message);
|
|
2808
2808
|
}
|
|
2809
|
-
function createAgentNativeConfig(options = {}, command, userConfig = {}, mode = process.env.NODE_ENV === "production" ? "production" : "development", projectConfig) {
|
|
2809
|
+
function createAgentNativeConfig(options = {}, command, userConfig = {}, mode = process.env.NODE_ENV === "production" ? "production" : "development", projectConfig, workspaceConfig) {
|
|
2810
2810
|
const cwd = process.cwd();
|
|
2811
2811
|
const configContext = createAgentNativeConfigContext(command, mode);
|
|
2812
2812
|
const projectConfigInput = projectConfig ?? options.agentNativeConfig;
|
|
@@ -2822,9 +2822,11 @@ function createAgentNativeConfig(options = {}, command, userConfig = {}, mode =
|
|
|
2822
2822
|
...loadEnv(mode, cwd, ""),
|
|
2823
2823
|
...process.env,
|
|
2824
2824
|
};
|
|
2825
|
-
const appConfig = resolveAgentNativeConfig(mergeAgentNativeConfigs(mergeAgentNativeConfigs(
|
|
2825
|
+
const appConfig = resolveAgentNativeConfig(mergeAgentNativeConfigs(mergeAgentNativeConfigs(mergeAgentNativeConfigs(workspaceConfig
|
|
2826
|
+
? resolveAgentNativeConfig(workspaceConfig, configContext)
|
|
2827
|
+
: {}, readAgentNativeJsonConfig(cwd)), projectConfigInput
|
|
2826
2828
|
? resolveAgentNativeConfig(projectConfigInput, configContext)
|
|
2827
|
-
: {}), configContext);
|
|
2829
|
+
: {}), readAgentNativeConfigEnv(runtimeEnv), { arrayStrategy: "replace" }), configContext);
|
|
2828
2830
|
const inferredDeploymentEnvironment = appConfig.deployment?.environment ??
|
|
2829
2831
|
inferAgentNativeDeploymentEnvironment(process.env, mode);
|
|
2830
2832
|
const resolvedAppConfig = appConfig.deployment?.environment === undefined &&
|
|
@@ -3139,14 +3141,10 @@ function createAgentNativeConfigPlugin(options) {
|
|
|
3139
3141
|
name: "agent-native-config",
|
|
3140
3142
|
enforce: "pre",
|
|
3141
3143
|
async config(config, env) {
|
|
3142
|
-
const context = createAgentNativeConfigContext(env.command, env.mode);
|
|
3143
3144
|
const workspaceConfig = await loadWorkspaceAgentNativeConfigFile(process.cwd());
|
|
3144
3145
|
const projectConfig = options.agentNativeConfig ??
|
|
3145
3146
|
(await loadAgentNativeConfigFile(process.cwd()));
|
|
3146
|
-
|
|
3147
|
-
? resolveAgentNativeConfig(workspaceConfig, context)
|
|
3148
|
-
: {}, projectConfig ? resolveAgentNativeConfig(projectConfig, context) : {});
|
|
3149
|
-
return createAgentNativeConfig(options, env.command, config, env.mode, resolvedConfig);
|
|
3147
|
+
return createAgentNativeConfig(options, env.command, config, env.mode, projectConfig, workspaceConfig);
|
|
3150
3148
|
},
|
|
3151
3149
|
};
|
|
3152
3150
|
}
|
|
@@ -16,13 +16,19 @@ The resolved configuration is serialized into the browser bundle. Treat every
|
|
|
16
16
|
value in these files as public. Put credentials and deployment-specific values
|
|
17
17
|
in the environment or the scoped secret store instead.
|
|
18
18
|
|
|
19
|
-
This file is the home for public, app-owned configuration - the values
|
|
20
|
-
describe how an app should behave or what capabilities it exposes.
|
|
21
|
-
|
|
22
|
-
deployment-specific value, the framework
|
|
23
|
-
`AGENT_NATIVE_CONFIG*` environment alias
|
|
24
|
-
secrets, provider credentials, database URLs, host-specific
|
|
25
|
-
server-only values that are not part of this public config.
|
|
19
|
+
This file is the primary home for public, app-owned configuration - the values
|
|
20
|
+
that describe how an app should behave or what capabilities it exposes. Put
|
|
21
|
+
the committed default here first. When the same public setting needs a
|
|
22
|
+
deployment-specific value, the framework accepts a deterministic
|
|
23
|
+
`AGENT_NATIVE_CONFIG*` environment alias as the final override. Environment
|
|
24
|
+
variables still own secrets, provider credentials, database URLs, host-specific
|
|
25
|
+
values, and other server-only values that are not part of this public config.
|
|
26
|
+
|
|
27
|
+
The server-only `defineAppConfig()` schema is a deliberate boundary, not a
|
|
28
|
+
second spelling of this file. It configures behavior that must stay out of the
|
|
29
|
+
browser bundle, such as credential scoping, webhook trust, and workspace
|
|
30
|
+
runtime wiring. Its declared environment aliases are documented separately in
|
|
31
|
+
the maintainer environment inventory.
|
|
26
32
|
|
|
27
33
|
## File location and loading
|
|
28
34
|
|
|
@@ -109,13 +115,23 @@ Every supported public config path has an environment alias under the
|
|
|
109
115
|
`AGENT_NATIVE_CONFIG` namespace. Convert each lower-camel-case path segment to
|
|
110
116
|
upper snake case and join segments with underscores:
|
|
111
117
|
|
|
112
|
-
| Config path
|
|
113
|
-
|
|
|
114
|
-
| the whole config
|
|
115
|
-
| `
|
|
116
|
-
| `runtime
|
|
117
|
-
| `runtime.auth
|
|
118
|
-
| `
|
|
118
|
+
| Config path | Environment alias |
|
|
119
|
+
| ------------------------------ | -------------------------------------------------- |
|
|
120
|
+
| the whole config | `AGENT_NATIVE_CONFIG` |
|
|
121
|
+
| `onboarding.firstRun` | `AGENT_NATIVE_CONFIG_ONBOARDING_FIRST_RUN` |
|
|
122
|
+
| `runtime` | `AGENT_NATIVE_CONFIG_RUNTIME` |
|
|
123
|
+
| `runtime.auth` | `AGENT_NATIVE_CONFIG_RUNTIME_AUTH` |
|
|
124
|
+
| `runtime.auth.enabled` | `AGENT_NATIVE_CONFIG_RUNTIME_AUTH_ENABLED` |
|
|
125
|
+
| `runtime.database.required` | `AGENT_NATIVE_CONFIG_RUNTIME_DATABASE_REQUIRED` |
|
|
126
|
+
| `runtime.environment.required` | `AGENT_NATIVE_CONFIG_RUNTIME_ENVIRONMENT_REQUIRED` |
|
|
127
|
+
| `deployment.environment` | `AGENT_NATIVE_CONFIG_DEPLOYMENT_ENVIRONMENT` |
|
|
128
|
+
| `diagnostics.failOnBuild` | `AGENT_NATIVE_CONFIG_DIAGNOSTICS_FAIL_ON_BUILD` |
|
|
129
|
+
| `instructions.runtime` | `AGENT_NATIVE_CONFIG_INSTRUCTIONS_RUNTIME` |
|
|
130
|
+
| `instructions.development` | `AGENT_NATIVE_CONFIG_INSTRUCTIONS_DEVELOPMENT` |
|
|
131
|
+
| `translations.locales` | `AGENT_NATIVE_CONFIG_TRANSLATIONS_LOCALES` |
|
|
132
|
+
| `changelog.enabled` | `AGENT_NATIVE_CONFIG_CHANGELOG_ENABLED` |
|
|
133
|
+
| `harness` | `AGENT_NATIVE_CONFIG_HARNESS` |
|
|
134
|
+
| `harness.runtimes` | `AGENT_NATIVE_CONFIG_HARNESS_RUNTIMES` |
|
|
119
135
|
|
|
120
136
|
The whole config, an object section, or a deeply nested object can be supplied
|
|
121
137
|
as one JSON string. Arrays also use JSON strings. More-specific aliases are
|
|
@@ -148,12 +164,16 @@ scoped secret and connection stores.
|
|
|
148
164
|
## Configuration vs environment variables
|
|
149
165
|
|
|
150
166
|
Use the config file or JSON manifest for stable, non-secret application
|
|
151
|
-
defaults. Use
|
|
152
|
-
|
|
167
|
+
defaults. Use the canonical config alias when a public value needs a deployment
|
|
168
|
+
override. Use a separate environment variable or the scoped secret store only
|
|
169
|
+
when the value belongs to a deployment, the server, or a user or organization
|
|
170
|
+
connection:
|
|
153
171
|
|
|
154
172
|
| Put it in | Examples | Notes |
|
|
155
173
|
| --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
156
|
-
| `agent-native.config.ts` or the shared section of `agent-native.json` | onboarding mode, required runtime contracts, release lane, shipped locales, changelog, hosted harness capabilities | Committed app policy. It is resolved during the Vite config phase and can use `command`, `mode`, `isDev`, and `isBuild`.
|
|
174
|
+
| `agent-native.config.ts` or the shared section of `agent-native.json` | onboarding mode, required runtime contracts, release lane, shipped locales, changelog, hosted harness capabilities | Committed public app policy. It is resolved during the Vite config phase and can use `command`, `mode`, `isDev`, and `isBuild`. |
|
|
175
|
+
| `AGENT_NATIVE_CONFIG_<PATH>` | A deployment-specific public override of one config path | Final override for the typed/JSON public config. Its value is bundled for the browser, so it is never a secret. |
|
|
176
|
+
| Server-only `defineAppConfig()` | credential scoping, webhook trust, agent runtime controls, workspace wiring | Not serialized into the browser. Its declared aliases are the deliberate exception for server behavior. |
|
|
157
177
|
| Deployment environment variables | `DATABASE_URL`, `BETTER_AUTH_SECRET`, `APP_URL`, `NITRO_PRESET`, provider keys, host-specific toggles | Set by the deployment platform or local `.env`. Keep secret values out of source control. See [Environment Variables](/docs/environment-variables). |
|
|
158
178
|
| `runtime.environment.required` | `"PUBLIC_API_ORIGIN"`, `"STRIPE_PUBLISHABLE_KEY"` | A declaration of names the production readiness check must find. It does not set, expose, or replace the values. |
|
|
159
179
|
|
|
@@ -282,26 +302,28 @@ the same setting as the separate `doctor.failOnBuild` option documented in the
|
|
|
282
302
|
|
|
283
303
|
## Precedence and merge behavior
|
|
284
304
|
|
|
285
|
-
For a Vite app, the effective
|
|
305
|
+
For a Vite app, the effective public configuration follows this order:
|
|
286
306
|
|
|
287
307
|
1. Framework defaults. First-run onboarding defaults to `off`; auth and a
|
|
288
308
|
persistent database default to required in production diagnostics.
|
|
289
|
-
2.
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
fallback for deployment inference only; it does not override explicit JSON,
|
|
293
|
-
typed, or canonical config-alias values.
|
|
309
|
+
2. A workspace-level typed config, when the app is inside a configured
|
|
310
|
+
workspace.
|
|
311
|
+
3. `agent-native.json` at the app root.
|
|
294
312
|
4. The automatically loaded typed file, if present. The loader checks these
|
|
295
313
|
candidates in order: `agent-native.config.ts`, `agent-native.ts`,
|
|
296
314
|
`agent-native.mts`, `agent-native.config.mts`.
|
|
297
315
|
5. An explicit `agentNativeConfig` passed to `agentNative()` or the legacy
|
|
298
316
|
`defineConfig()` wrapper. Supplying this option skips automatic typed-file
|
|
299
317
|
loading, while the explicit value still overlays `agent-native.json`.
|
|
300
|
-
6.
|
|
318
|
+
6. `AGENT_NATIVE_CONFIG` and its path aliases from the deployment environment.
|
|
319
|
+
These are the final public-config overrides. The legacy
|
|
320
|
+
`AGENT_NATIVE_DEPLOYMENT_ENVIRONMENT` variable remains a fallback for
|
|
321
|
+
deployment inference only; it does not override an explicit config value.
|
|
322
|
+
7. For onboarding only, the legacy public Vite variables
|
|
301
323
|
`VITE_AGENT_NATIVE_FIRST_RUN_ONBOARDING` and
|
|
302
324
|
`VITE_AGENT_NATIVE_FIRST_RUN_ONBOARDING_SKIP_INTEGRATIONS` can override the
|
|
303
|
-
resolved onboarding mode. Use the config file
|
|
304
|
-
for new work.
|
|
325
|
+
resolved onboarding mode for backwards compatibility. Use the config file
|
|
326
|
+
or its canonical path alias for new work.
|
|
305
327
|
|
|
306
328
|
Use only one of the four typed filenames. If more than one exists, the first
|
|
307
329
|
candidate in the loader's order wins, with `agent-native.config.ts` preferred
|
|
@@ -319,9 +341,10 @@ The JSON and typed sources are merged by supported nested section:
|
|
|
319
341
|
supplies it, it replaces the lower-precedence string or mode map as a whole.
|
|
320
342
|
|
|
321
343
|
For example, JSON can provide `runtime.auth.enabled` and
|
|
322
|
-
`
|
|
323
|
-
`
|
|
324
|
-
|
|
344
|
+
`runtime.environment.required: ["NOTION_API_KEY"]`, while
|
|
345
|
+
`agent-native.config.ts` adds `runtime.database.required` and
|
|
346
|
+
`runtime.environment.required: ["GOOGLE_CLIENT_ID"]`. The result keeps the
|
|
347
|
+
auth setting, adds the database setting, and checks both environment names.
|
|
325
348
|
|
|
326
349
|
## What is safe to commit
|
|
327
350
|
|
|
@@ -342,8 +365,9 @@ Do not commit these values to either config format:
|
|
|
342
365
|
vary by environment.
|
|
343
366
|
|
|
344
367
|
Even a value that is not a secret should stay in deployment configuration when
|
|
345
|
-
it
|
|
346
|
-
public
|
|
368
|
+
it is a platform fact, a routing detail, or server-only behavior that changes
|
|
369
|
+
between targets. For public app behavior, use the typed config plus its
|
|
370
|
+
canonical deployment alias rather than inventing another standalone variable.
|
|
347
371
|
|
|
348
372
|
## `agent-native.json` compatibility
|
|
349
373
|
|
|
@@ -12,20 +12,57 @@ deployment system in this repository. Template-only values stay in the
|
|
|
12
12
|
maintainer inventory; the setup tables below focus on the shared configuration
|
|
13
13
|
most apps need.
|
|
14
14
|
|
|
15
|
-
For a normal app, start with [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
vary by deployment, use its deterministic
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
For a normal app, start with the [Agent-Native app configuration guide](/docs/agent-native-config),
|
|
16
|
+
then use [Deployment: Environment Variables](/docs/deployment-environment-variables)
|
|
17
|
+
and [Authentication](/docs/authentication) for the deliberate environment-only
|
|
18
|
+
parts. Keep user-, organization-, and workspace-scoped credentials in the
|
|
19
|
+
database-backed secret or connection store; use environment variables for
|
|
20
|
+
deploy-level configuration.
|
|
21
|
+
|
|
22
|
+
For committed, non-secret app defaults, use `agent-native.config.ts` first. If a
|
|
23
|
+
public config value must vary by deployment, use its deterministic
|
|
24
|
+
`AGENT_NATIVE_CONFIG_<PATH>` alias. That alias is the final override of the
|
|
25
|
+
typed/JSON config and also becomes part of the public browser bundle. Do not
|
|
26
|
+
create another standalone Vite-prefixed or Agent-Native-prefixed variable for
|
|
27
|
+
a public setting already represented by the config guide.
|
|
28
|
+
|
|
29
|
+
## Start with Agent-Native app configuration
|
|
30
|
+
|
|
31
|
+
The typed config is the primary documentation and default source for public
|
|
32
|
+
app behavior. Its deployment aliases are the standard environment override:
|
|
33
|
+
|
|
34
|
+
| Config path | Deployment override alias |
|
|
35
|
+
| ------------------------------ | -------------------------------------------------- |
|
|
36
|
+
| `onboarding.firstRun` | `AGENT_NATIVE_CONFIG_ONBOARDING_FIRST_RUN` |
|
|
37
|
+
| `runtime.auth.enabled` | `AGENT_NATIVE_CONFIG_RUNTIME_AUTH_ENABLED` |
|
|
38
|
+
| `runtime.database.required` | `AGENT_NATIVE_CONFIG_RUNTIME_DATABASE_REQUIRED` |
|
|
39
|
+
| `runtime.environment.required` | `AGENT_NATIVE_CONFIG_RUNTIME_ENVIRONMENT_REQUIRED` |
|
|
40
|
+
| `deployment.environment` | `AGENT_NATIVE_CONFIG_DEPLOYMENT_ENVIRONMENT` |
|
|
41
|
+
| `diagnostics.failOnBuild` | `AGENT_NATIVE_CONFIG_DIAGNOSTICS_FAIL_ON_BUILD` |
|
|
42
|
+
| `instructions.runtime` | `AGENT_NATIVE_CONFIG_INSTRUCTIONS_RUNTIME` |
|
|
43
|
+
| `instructions.development` | `AGENT_NATIVE_CONFIG_INSTRUCTIONS_DEVELOPMENT` |
|
|
44
|
+
| `translations.locales` | `AGENT_NATIVE_CONFIG_TRANSLATIONS_LOCALES` |
|
|
45
|
+
| `changelog.enabled` | `AGENT_NATIVE_CONFIG_CHANGELOG_ENABLED` |
|
|
46
|
+
| `harness` | `AGENT_NATIVE_CONFIG_HARNESS` |
|
|
47
|
+
| `harness.runtimes` | `AGENT_NATIVE_CONFIG_HARNESS_RUNTIMES` |
|
|
48
|
+
|
|
49
|
+
Use [Agent-Native app configuration](/docs/agent-native-config) for the full
|
|
50
|
+
schema, mode-aware examples, JSON fragments, and precedence rules. The
|
|
51
|
+
resolved public config is bundled into the browser, so it must contain only
|
|
52
|
+
non-secret app policy.
|
|
53
|
+
|
|
54
|
+
Some non-secret environment variables remain deliberate exceptions because
|
|
55
|
+
they configure server-only behavior, platform facts, routing, or deployment
|
|
56
|
+
secrets. Server-only product controls use the framework's `defineAppConfig()`
|
|
57
|
+
schema and its declared aliases; they are not public `agent-native.config.ts`
|
|
58
|
+
fields. The maintainer inventory's generated **Declared app configuration**
|
|
59
|
+
section is the exhaustive list of those server fields and aliases.
|
|
60
|
+
|
|
61
|
+
## Server, environment-only, and deployment variables
|
|
62
|
+
|
|
63
|
+
The table below covers values that belong to the running deployment, a
|
|
64
|
+
server-only config surface, or an environment-only compatibility surface. For
|
|
65
|
+
public app behavior, use the config paths above instead.
|
|
29
66
|
|
|
30
67
|
| Variable | What it controls | Supported values or format |
|
|
31
68
|
| ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.0.0-beta-
|
|
3
|
+
"version": "0.0.0-beta-20260820231735",
|
|
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": {
|