@agent-native/core 0.147.0 → 0.148.1
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 +1 -1
- package/corpus/templates/analytics/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/analytics/DEVELOPING.md +50 -3
- package/corpus/templates/analytics/actions/purge-first-party-analytics-postgres.ts +190 -0
- package/corpus/templates/analytics/app/i18n/index.ts +14 -29
- package/corpus/templates/analytics/app/i18n-data.ts +10 -10
- package/corpus/templates/analytics/app/pages/Settings.tsx +5 -21
- package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +1 -3
- package/corpus/templates/analytics/scripts/first-party-analytics-bigquery-backfill.ts +197 -18
- package/corpus/templates/analytics/server/db/schema.ts +23 -0
- package/corpus/templates/analytics/server/handlers/first-party-analytics.ts +3 -1
- package/corpus/templates/analytics/server/jobs/analytics-bigquery-backfill.ts +1 -1
- package/corpus/templates/analytics/server/lib/first-party-analytics-backend.ts +113 -13
- package/corpus/templates/analytics/server/lib/first-party-analytics-purge.ts +140 -0
- package/corpus/templates/analytics/server/lib/first-party-analytics-volume.ts +207 -0
- package/corpus/templates/analytics/server/lib/first-party-analytics.ts +40 -9
- package/corpus/templates/analytics/server/lib/gcloud.ts +148 -20
- package/corpus/templates/analytics/server/plugins/db.ts +42 -0
- package/corpus/templates/assets/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/assets/app/i18n/index.ts +14 -29
- package/corpus/templates/brain/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/brain/app/i18n/index.ts +14 -29
- package/corpus/templates/calendar/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/chat/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/chat/app/i18n/index.ts +14 -29
- package/corpus/templates/clips/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/clips/app/components/player/transcript-panel.tsx +2 -7
- package/corpus/templates/clips/app/components/recorder/storage-setup-card.tsx +18 -13
- package/corpus/templates/clips/app/components/settings/ai-setup-section.tsx +87 -370
- package/corpus/templates/clips/app/components/settings/slack-section.tsx +59 -101
- package/corpus/templates/clips/app/components/settings/video-storage-section.tsx +136 -213
- package/corpus/templates/clips/app/i18n/en-US.ts +11 -8
- package/corpus/templates/clips/desktop/src/app.tsx +1 -1
- package/corpus/templates/content/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/content/app/i18n/index.ts +14 -29
- package/corpus/templates/crm/app/i18n/index.ts +14 -29
- package/corpus/templates/design/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/design/actions/analyze-brand-assets.ts +15 -15
- package/corpus/templates/design/actions/import-code.ts +2 -43
- package/corpus/templates/design/app/i18n/index.ts +14 -29
- package/corpus/templates/dispatch/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/dispatch/app/i18n-data.ts +1 -1
- package/corpus/templates/factory/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/factory/AGENTS.md +40 -49
- package/corpus/templates/factory/actions/babysit-agent-native-pull-request.ts +66 -0
- package/corpus/templates/factory/actions/evaluate-triage-item.ts +37 -0
- package/corpus/templates/factory/actions/get-slack-feedback-context.ts +20 -0
- package/corpus/templates/factory/actions/get-triage-item.ts +25 -4
- package/corpus/templates/factory/actions/govern-agent-native-pull-request.ts +55 -0
- package/corpus/templates/factory/actions/ingest-github-observation.ts +21 -0
- package/corpus/templates/factory/actions/list-factory-audit.ts +118 -0
- package/corpus/templates/factory/actions/list-factory-automations.ts +2 -1
- package/corpus/templates/factory/actions/list-triage-items.ts +24 -2
- package/corpus/templates/factory/actions/poll-github-sources.ts +60 -0
- package/corpus/templates/factory/actions/poll-sentry-errors.ts +39 -0
- package/corpus/templates/factory/actions/poll-slack-channel.ts +45 -1
- package/corpus/templates/factory/actions/run-factory-automation.ts +1 -1
- package/corpus/templates/factory/actions/save-factory-automation.ts +2 -2
- package/corpus/templates/factory/actions/start-builder-for-item.ts +51 -0
- package/corpus/templates/factory/app/components/factory/FactoryAuditView.tsx +685 -0
- package/corpus/templates/factory/app/hooks/use-navigation-state.ts +6 -0
- package/corpus/templates/factory/app/i18n/en-US.ts +25 -0
- package/corpus/templates/factory/app/routes/factory.tsx +95 -42
- package/corpus/templates/factory/server/db/schema.ts +37 -0
- package/corpus/templates/factory/server/lib/require-factory-automation.ts +5 -1
- package/corpus/templates/factory/server/plugins/factory-migrations.ts +29 -0
- package/corpus/templates/factory/server/triage/audit.ts +79 -0
- package/corpus/templates/forms/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/forms/app/i18n/index.ts +14 -29
- package/corpus/templates/macros/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/macros/app/i18n/index.ts +14 -29
- package/corpus/templates/mail/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/mail/app/i18n/index.ts +14 -29
- package/corpus/templates/plan/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/plan/app/components/plan/wireframe/Wireframe.tsx +7 -7
- package/corpus/templates/plan/app/i18n/index.ts +14 -29
- package/corpus/templates/slides/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/slides/actions/analyze-brand-assets.ts +15 -15
- package/corpus/templates/slides/actions/import-code.ts +2 -43
- package/corpus/templates/slides/app/i18n/index.ts +14 -29
- package/corpus/templates/slides/server/routes/api/preview-images.get.ts +4 -1
- package/corpus/templates/tasks/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/tasks/app/components/layout/HeaderActions.tsx +1 -84
- package/corpus/templates/tasks/app/hooks/use-mobile.tsx +1 -21
- package/corpus/templates/tasks/app/i18n/index.ts +14 -29
- package/dist/agent/engine/ai-sdk-engine.js +2 -1
- package/dist/agent/engine/openai-compatible-endpoint.d.ts +2 -0
- package/dist/agent/engine/openai-compatible-endpoint.js +5 -1
- package/dist/agent/engine/provider-endpoint-validation.d.ts +9 -0
- package/dist/agent/engine/provider-endpoint-validation.js +26 -0
- package/dist/agent/engine/provider-env-vars.d.ts +1 -1
- package/dist/agent/engine/provider-env-vars.js +1 -1
- package/dist/agent/engine/registry.d.ts +8 -6
- package/dist/agent/engine/registry.js +37 -24
- package/dist/agent/tool-search.d.ts +1 -0
- package/dist/agent/tool-search.js +17 -1
- package/dist/automations/service.js +4 -10
- package/dist/brand-kit/brand-signals.d.ts +13 -0
- package/dist/brand-kit/brand-signals.js +15 -0
- package/dist/brand-kit/index.d.ts +2 -2
- package/dist/brand-kit/index.js +1 -1
- package/dist/cli/plan-blocks.d.ts +3 -18
- package/dist/cli/plan-blocks.js +2 -95
- package/dist/cli/plan-publish-store.d.ts +2 -61
- package/dist/cli/plan-publish-store.js +2 -127
- package/dist/cli/skills-content/connection.d.ts +1 -1
- package/dist/cli/skills-content/connection.js +1 -52
- package/dist/cli/skills-content/visual-recap-skill.d.ts +1 -1
- package/dist/cli/skills-content/visual-recap-skill.js +1 -553
- package/dist/client/agent-engine-key.d.ts +14 -4
- package/dist/client/agent-engine-key.js +51 -5
- package/dist/client/agent-provider-catalog.d.ts +20 -0
- package/dist/client/agent-provider-catalog.js +100 -0
- package/dist/client/blocks/index.d.ts +1 -0
- package/dist/client/blocks/index.js +1 -0
- package/dist/client/blocks/library/diagram.js +1 -1
- package/dist/client/blocks/library/sanitize-html.js +66 -2
- package/dist/client/blocks/library/wireframe-kit.js +69 -0
- package/dist/client/chat/run-recovery.js +4 -48
- package/dist/client/chat-first/apps-rail.d.ts +1 -1
- package/dist/client/chat-first/apps-rail.js +4 -4
- package/dist/client/chat-first/copy.js +1 -0
- package/dist/client/chat-first/types.d.ts +1 -0
- package/dist/client/chat-first.js +4 -3
- package/dist/client/i18n.d.ts +14 -0
- package/dist/client/i18n.js +18 -0
- package/dist/client/settings/ProviderSetupForm.d.ts +21 -0
- package/dist/client/settings/ProviderSetupForm.js +145 -0
- package/dist/client/settings/SettingsPanel.js +52 -49
- package/dist/client/settings/index.d.ts +2 -0
- package/dist/client/settings/index.js +2 -0
- package/dist/coding-tools/run-code.d.ts +5 -0
- package/dist/coding-tools/run-code.js +196 -36
- package/dist/coding-tools/tool-orchestration.d.ts +10 -0
- package/dist/coding-tools/tool-orchestration.js +107 -0
- package/dist/collab/routes.d.ts +1 -1
- package/dist/jobs/frontmatter.d.ts +9 -0
- package/dist/jobs/frontmatter.js +16 -0
- package/dist/jobs/scheduler.js +8 -8
- package/dist/jobs/tools.d.ts +1 -1
- package/dist/jobs/tools.js +2 -7
- package/dist/localization/default-messages.d.ts +20 -0
- package/dist/localization/default-messages.js +25 -5
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +2 -2
- package/dist/onboarding/app-profile.js +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +8 -8
- package/dist/provider-api/actions/provider-api.d.ts +11 -11
- package/dist/scripts/agent-engines/test-agent-engine.js +34 -10
- package/dist/server/agent-chat/run-code-tools.d.ts +1 -1
- package/dist/server/agent-chat/run-code-tools.js +3 -1
- package/dist/server/agent-chat-plugin.js +6 -6
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/agent-engine-api-key-route.js +43 -12
- package/dist/server/agents-bundle.js +2 -1
- package/dist/server/auth.js +21 -5
- package/dist/server/credential-provider.js +1 -0
- package/dist/server/design-token-utils.d.ts +18 -0
- package/dist/server/design-token-utils.js +31 -0
- package/dist/server/onboarding-html.js +22 -2
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/styles/blocks.css +132 -0
- package/dist/templates/chat/.agents/skills/frontend-design/SKILL.md +115 -68
- package/dist/templates/chat/app/i18n/index.ts +14 -29
- package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +115 -68
- package/dist/templates/default/app/i18n/index.ts +14 -29
- package/dist/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +22 -9
- package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +115 -68
- package/dist/triggers/dispatcher.js +1 -8
- package/docs/content/actions.mdx +4 -1
- package/docs/content/agent-surfaces.mdx +8 -6
- package/docs/content/automations.mdx +1 -1
- package/docs/content/database.mdx +6 -1
- package/docs/content/docs-components.mdx +22 -14
- package/docs/content/drop-in-agent.mdx +1 -1
- package/docs/content/environment-variables.mdx +39 -38
- package/docs/content/getting-started-actions.mdx +5 -4
- package/docs/content/getting-started-pages.mdx +7 -6
- package/docs/content/getting-started.mdx +4 -3
- package/docs/content/notifications.mdx +6 -6
- package/docs/content/progress.mdx +5 -5
- package/docs/content/routing.mdx +3 -1
- package/docs/content/server-database.mdx +13 -4
- package/docs/content/server-overview.mdx +9 -9
- package/docs/content/server-plugins.mdx +10 -4
- package/docs/content/server-routes.mdx +7 -2
- package/docs/content/tracking.mdx +4 -4
- package/docs/content/what-is-agent-native.mdx +4 -4
- package/package.json +4 -4
- package/src/templates/chat/.agents/skills/frontend-design/SKILL.md +115 -68
- package/src/templates/chat/app/i18n/index.ts +14 -29
- package/src/templates/default/.agents/skills/frontend-design/SKILL.md +115 -68
- package/src/templates/default/app/i18n/index.ts +14 -29
- package/src/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +22 -9
- package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +115 -68
- package/corpus/templates/plan/app/components/plan/wireframe/sanitize-html.ts +0 -343
|
@@ -41,14 +41,14 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
41
41
|
thumbsUpRate: number;
|
|
42
42
|
avgEvalScore: number;
|
|
43
43
|
} | {
|
|
44
|
-
error?: undefined;
|
|
45
44
|
ok?: undefined;
|
|
45
|
+
error?: undefined;
|
|
46
46
|
summary: import("./types.js").TraceSummary;
|
|
47
47
|
spans: import("./types.js").TraceSpan[];
|
|
48
48
|
id?: undefined;
|
|
49
49
|
} | {
|
|
50
|
-
error?: undefined;
|
|
51
50
|
ok?: undefined;
|
|
51
|
+
error?: undefined;
|
|
52
52
|
summary?: undefined;
|
|
53
53
|
spans?: undefined;
|
|
54
54
|
id: string;
|
|
@@ -3,7 +3,7 @@ const LLM_CAPABILITY = {
|
|
|
3
3
|
label: "AI model",
|
|
4
4
|
required: true,
|
|
5
5
|
builderIncluded: true,
|
|
6
|
-
keySummary: "One model key: Anthropic, OpenAI, Gemini, Groq, Mistral, or
|
|
6
|
+
keySummary: "One model key or local connection: Anthropic, OpenAI, OpenRouter, Gemini, Groq, Mistral, Cohere, or Ollama",
|
|
7
7
|
why: "The agent uses a language model to understand requests and produce answers.",
|
|
8
8
|
};
|
|
9
9
|
const DESIGN_SYSTEM_INTELLIGENCE_CAPABILITY = {
|
|
@@ -75,8 +75,9 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
75
75
|
user: "user";
|
|
76
76
|
}>>;
|
|
77
77
|
}, z.core.$strip>>, {
|
|
78
|
-
deleted?: undefined;
|
|
79
78
|
id?: undefined;
|
|
79
|
+
provider?: undefined;
|
|
80
|
+
deleted?: undefined;
|
|
80
81
|
providers: {
|
|
81
82
|
id: string;
|
|
82
83
|
label: string;
|
|
@@ -87,15 +88,14 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
87
88
|
updatedAt: number;
|
|
88
89
|
}[];
|
|
89
90
|
count: number;
|
|
90
|
-
provider?: undefined;
|
|
91
91
|
found?: undefined;
|
|
92
92
|
registered?: undefined;
|
|
93
93
|
label?: undefined;
|
|
94
94
|
message?: undefined;
|
|
95
95
|
} | {
|
|
96
|
-
deleted?: undefined;
|
|
97
96
|
count?: undefined;
|
|
98
97
|
id?: undefined;
|
|
98
|
+
deleted?: undefined;
|
|
99
99
|
providers?: undefined;
|
|
100
100
|
found: boolean;
|
|
101
101
|
provider: import("../custom-registry.js").CustomProviderConfig;
|
|
@@ -103,10 +103,10 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
103
103
|
label?: undefined;
|
|
104
104
|
message?: undefined;
|
|
105
105
|
} | {
|
|
106
|
-
deleted?: undefined;
|
|
107
106
|
count?: undefined;
|
|
108
|
-
providers?: undefined;
|
|
109
107
|
provider?: undefined;
|
|
108
|
+
deleted?: undefined;
|
|
109
|
+
providers?: undefined;
|
|
110
110
|
found: boolean;
|
|
111
111
|
id: string;
|
|
112
112
|
registered?: undefined;
|
|
@@ -114,8 +114,8 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
114
114
|
message?: undefined;
|
|
115
115
|
} | {
|
|
116
116
|
count?: undefined;
|
|
117
|
-
providers?: undefined;
|
|
118
117
|
provider?: undefined;
|
|
118
|
+
providers?: undefined;
|
|
119
119
|
found?: undefined;
|
|
120
120
|
deleted: boolean;
|
|
121
121
|
id: string;
|
|
@@ -123,10 +123,10 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
123
123
|
label?: undefined;
|
|
124
124
|
message?: undefined;
|
|
125
125
|
} | {
|
|
126
|
-
deleted?: undefined;
|
|
127
126
|
count?: undefined;
|
|
128
|
-
providers?: undefined;
|
|
129
127
|
provider?: undefined;
|
|
128
|
+
deleted?: undefined;
|
|
129
|
+
providers?: undefined;
|
|
130
130
|
found?: undefined;
|
|
131
131
|
registered: boolean;
|
|
132
132
|
id: string;
|
|
@@ -312,8 +312,6 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
312
312
|
scope?: "org" | "user" | undefined;
|
|
313
313
|
}, {
|
|
314
314
|
id?: undefined;
|
|
315
|
-
message?: undefined;
|
|
316
|
-
provider?: undefined;
|
|
317
315
|
deleted?: undefined;
|
|
318
316
|
providers: {
|
|
319
317
|
id: string;
|
|
@@ -325,44 +323,46 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
325
323
|
updatedAt: number;
|
|
326
324
|
}[];
|
|
327
325
|
count: number;
|
|
326
|
+
provider?: undefined;
|
|
328
327
|
found?: undefined;
|
|
329
328
|
registered?: undefined;
|
|
330
329
|
label?: undefined;
|
|
330
|
+
message?: undefined;
|
|
331
331
|
} | {
|
|
332
332
|
id?: undefined;
|
|
333
|
-
message?: undefined;
|
|
334
|
-
count?: undefined;
|
|
335
333
|
deleted?: undefined;
|
|
334
|
+
count?: undefined;
|
|
336
335
|
providers?: undefined;
|
|
337
336
|
found: boolean;
|
|
338
337
|
provider: import("../custom-registry.js").CustomProviderConfig;
|
|
339
338
|
registered?: undefined;
|
|
340
339
|
label?: undefined;
|
|
341
|
-
} | {
|
|
342
340
|
message?: undefined;
|
|
343
|
-
|
|
344
|
-
provider?: undefined;
|
|
341
|
+
} | {
|
|
345
342
|
deleted?: undefined;
|
|
343
|
+
count?: undefined;
|
|
346
344
|
providers?: undefined;
|
|
345
|
+
provider?: undefined;
|
|
347
346
|
found: boolean;
|
|
348
347
|
id: string;
|
|
349
348
|
registered?: undefined;
|
|
350
349
|
label?: undefined;
|
|
351
|
-
} | {
|
|
352
350
|
message?: undefined;
|
|
351
|
+
} | {
|
|
353
352
|
count?: undefined;
|
|
354
|
-
provider?: undefined;
|
|
355
353
|
providers?: undefined;
|
|
354
|
+
provider?: undefined;
|
|
356
355
|
found?: undefined;
|
|
357
356
|
deleted: boolean;
|
|
358
357
|
id: string;
|
|
359
358
|
registered?: undefined;
|
|
360
359
|
label?: undefined;
|
|
360
|
+
message?: undefined;
|
|
361
361
|
} | {
|
|
362
|
-
count?: undefined;
|
|
363
|
-
provider?: undefined;
|
|
364
362
|
deleted?: undefined;
|
|
363
|
+
count?: undefined;
|
|
365
364
|
providers?: undefined;
|
|
365
|
+
provider?: undefined;
|
|
366
366
|
found?: undefined;
|
|
367
367
|
registered: boolean;
|
|
368
368
|
id: string;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* test-agent-engine — sends a trivial prompt to verify the engine is working.
|
|
3
3
|
*/
|
|
4
4
|
import { getAgentEngineEntry, registerBuiltinEngines, } from "../../agent/engine/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { OLLAMA_BASE_URL_ENV_VAR, OPENAI_BASE_URL_ENV_VAR, } from "../../agent/engine/openai-compatible-endpoint.js";
|
|
6
|
+
import { validateProviderBaseUrl } from "../../agent/engine/provider-endpoint-validation.js";
|
|
6
7
|
import { canUseDeployCredentialFallbackForRequest, readDeployCredentialEnv, resolveSecret, } from "../../server/credential-provider.js";
|
|
7
8
|
export const tool = {
|
|
8
9
|
description: "Test an agent engine by sending a trivial prompt and measuring latency. Useful for verifying API keys and connectivity before switching engines.",
|
|
@@ -31,13 +32,30 @@ async function resolveAgentEngineSecret(key) {
|
|
|
31
32
|
if (value)
|
|
32
33
|
return value;
|
|
33
34
|
}
|
|
34
|
-
catch {
|
|
35
|
-
|
|
35
|
+
catch (error) {
|
|
36
|
+
if (!canUseDeployCredentialFallbackForRequest(key))
|
|
37
|
+
throw error;
|
|
38
|
+
console.warn("[test-agent-engine] Saved provider secret unavailable; using deploy configuration.", { key, error });
|
|
36
39
|
}
|
|
37
40
|
return canUseDeployCredentialFallbackForRequest(key)
|
|
38
41
|
? readDeployCredentialEnv(key)
|
|
39
42
|
: undefined;
|
|
40
43
|
}
|
|
44
|
+
async function resolveAgentEngineEndpoint(key) {
|
|
45
|
+
const value = await resolveSecret(key);
|
|
46
|
+
if (value) {
|
|
47
|
+
return validateProviderBaseUrl(value, {
|
|
48
|
+
allowLocalOllama: key === OLLAMA_BASE_URL_ENV_VAR &&
|
|
49
|
+
process.env.NODE_ENV === "development",
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (!canUseDeployCredentialFallbackForRequest(key))
|
|
53
|
+
return undefined;
|
|
54
|
+
const deployValue = readDeployCredentialEnv(key);
|
|
55
|
+
return deployValue
|
|
56
|
+
? validateProviderBaseUrl(deployValue, { allowPrivate: true })
|
|
57
|
+
: undefined;
|
|
58
|
+
}
|
|
41
59
|
function canUseDeployEnvForEntry(entry) {
|
|
42
60
|
if (entry.requiredEnvVars.length === 0)
|
|
43
61
|
return true;
|
|
@@ -50,13 +68,19 @@ async function createEngineConfig(entry, args) {
|
|
|
50
68
|
: undefined,
|
|
51
69
|
allowEnvFallback: canUseDeployEnvForEntry(entry),
|
|
52
70
|
};
|
|
53
|
-
if (entry.name === "ai-sdk:openai") {
|
|
54
|
-
const
|
|
55
|
-
?
|
|
56
|
-
:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
71
|
+
if (entry.name === "ai-sdk:openai" || entry.name === "ai-sdk:ollama") {
|
|
72
|
+
const endpointKey = entry.name === "ai-sdk:ollama"
|
|
73
|
+
? OLLAMA_BASE_URL_ENV_VAR
|
|
74
|
+
: OPENAI_BASE_URL_ENV_VAR;
|
|
75
|
+
const explicitBaseUrl = args.baseUrl?.trim();
|
|
76
|
+
const baseUrl = explicitBaseUrl
|
|
77
|
+
? await validateProviderBaseUrl(explicitBaseUrl, {
|
|
78
|
+
allowLocalOllama: entry.name === "ai-sdk:ollama" &&
|
|
79
|
+
process.env.NODE_ENV === "development",
|
|
80
|
+
})
|
|
81
|
+
: await resolveAgentEngineEndpoint(endpointKey);
|
|
82
|
+
if (baseUrl)
|
|
83
|
+
config.baseUrl = baseUrl;
|
|
60
84
|
}
|
|
61
85
|
return config;
|
|
62
86
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ActionEntry } from "../../agent/production-agent.js";
|
|
2
2
|
/**
|
|
3
3
|
* Load the sandboxed code-execution tool entries for one action registry:
|
|
4
|
-
* `run-code` plus its `get-code-execution` poll companion. The poll tool is
|
|
4
|
+
* `run-code`, bounded `tool-orchestration`, plus its `get-code-execution` poll companion. The poll tool is
|
|
5
5
|
* registered ALONGSIDE run-code everywhere run-code appears, so the durable
|
|
6
6
|
* background-execution guidance run-code emits ("check it with
|
|
7
7
|
* get-code-execution") always points at a callable tool. Returns an empty
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Load the sandboxed code-execution tool entries for one action registry:
|
|
3
|
-
* `run-code` plus its `get-code-execution` poll companion. The poll tool is
|
|
3
|
+
* `run-code`, bounded `tool-orchestration`, plus its `get-code-execution` poll companion. The poll tool is
|
|
4
4
|
* registered ALONGSIDE run-code everywhere run-code appears, so the durable
|
|
5
5
|
* background-execution guidance run-code emits ("check it with
|
|
6
6
|
* get-code-execution") always points at a callable tool. Returns an empty
|
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
export async function loadRunCodeToolEntries(supplier, runCodeOptions) {
|
|
14
14
|
try {
|
|
15
15
|
const { createRunCodeEntry, createGetCodeExecutionEntry } = await import("../../coding-tools/run-code.js");
|
|
16
|
+
const { createToolOrchestrationEntry } = await import("../../coding-tools/tool-orchestration.js");
|
|
16
17
|
const entries = {
|
|
17
18
|
"run-code": createRunCodeEntry(supplier, runCodeOptions),
|
|
19
|
+
"tool-orchestration": createToolOrchestrationEntry(supplier),
|
|
18
20
|
"get-code-execution": createGetCodeExecutionEntry(),
|
|
19
21
|
};
|
|
20
22
|
// Data programs: stored JS scripts executed through this same run-code
|
|
@@ -876,11 +876,11 @@ export function createAgentChatPlugin(options) {
|
|
|
876
876
|
: rawEnvCodeExec === "off"
|
|
877
877
|
? "off"
|
|
878
878
|
: (options?.codeExecution?.production ?? "off");
|
|
879
|
-
// Forward-declaration for the production
|
|
880
|
-
// Must come before
|
|
879
|
+
// Forward-declaration for the production code-execution bridge supplier.
|
|
880
|
+
// Must come before the code entries are created so their closures can capture it.
|
|
881
881
|
let prodRunCodeToolActions = {};
|
|
882
882
|
let leanRunCodeToolActions = {};
|
|
883
|
-
// Sandboxed run-code tool
|
|
883
|
+
// Sandboxed run-code, bounded tool-orchestration, and get-code-execution:
|
|
884
884
|
// available in "sandboxed" or "trusted" prod modes and always in dev
|
|
885
885
|
// mode. See loadRunCodeToolEntries for the registration contract.
|
|
886
886
|
const runCodeTool = await loadRunCodeToolEntries(
|
|
@@ -914,7 +914,7 @@ export function createAgentChatPlugin(options) {
|
|
|
914
914
|
// Forward-declaration: populated after devActions is assembled below.
|
|
915
915
|
// Must be declared before devRunCodeTool so the closure can close over it.
|
|
916
916
|
let devRunCodeToolActions = {};
|
|
917
|
-
// Always register
|
|
917
|
+
// Always register code execution (+ get-code-execution) in dev mode (when the
|
|
918
918
|
// coding module loads). devActions is not yet defined at this point; we
|
|
919
919
|
// use a late-binding supplier so devRunCodeTool can reference the
|
|
920
920
|
// devActions registry once it is built below (see devHandler block).
|
|
@@ -2551,8 +2551,8 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
2551
2551
|
// System-prompt note appended when production code execution is enabled.
|
|
2552
2552
|
const prodCodeExecPromptNote = !canToggle && resolvedProdCodeExec !== "off"
|
|
2553
2553
|
? resolvedProdCodeExec === "trusted"
|
|
2554
|
-
? "\n\n<code-execution-mode>Full shell access is enabled (trusted mode). You have bash, read, edit, write, and run-code tools available. Use bash for file discovery, running tests and builds, and project CLIs. Use run-code for sandboxed JavaScript data processing: provider/API pagination, joins, classification, aggregation, and large-response reduction. Use `pnpm action <name>` in bash to invoke registered app actions from the shell.</code-execution-mode>"
|
|
2555
|
-
: "\n\n<code-execution-mode>Sandboxed code execution is enabled.
|
|
2554
|
+
? "\n\n<code-execution-mode>Full shell access is enabled (trusted mode). You have bash, read, edit, write, and run-code tools available. Use bash for file discovery, running tests and builds, and project CLIs. Use run-code for sandboxed JavaScript data processing: provider/API pagination, joins, classification, aggregation, and large-response reduction. Use tool-orchestration for short bounded fan-out or reduction over read-only tools. Use `pnpm action <name>` in bash to invoke registered app actions from the shell.</code-execution-mode>"
|
|
2555
|
+
: "\n\n<code-execution-mode>Sandboxed code execution is enabled. Use tool-orchestration for short bounded fan-out, joins, and reduction over read-only tools. Use run-code when you need its broader provider/web helpers, workspace staging, or durable background execution. In either tool, authenticated calls go through the provided host globals and results should be reduced before printing.</code-execution-mode>"
|
|
2556
2556
|
: "";
|
|
2557
2557
|
const prodHandler = createProductionAgentHandler({
|
|
2558
2558
|
actions: leanPrompt ? leanActions : prodActions,
|
|
@@ -27,10 +27,10 @@ export declare function resolveAgentEngineApiKeyWriteTarget(event: H3Event, scop
|
|
|
27
27
|
export declare function createAgentEngineApiKeyHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
28
28
|
error: any;
|
|
29
29
|
} | {
|
|
30
|
+
error?: undefined;
|
|
30
31
|
ok: boolean;
|
|
31
32
|
key: string;
|
|
32
33
|
baseUrlKey?: string;
|
|
33
34
|
scope: AgentEngineApiKeyScope;
|
|
34
|
-
error?: undefined;
|
|
35
35
|
}>>;
|
|
36
36
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineEventHandler, getMethod, setResponseStatus, } from "h3";
|
|
2
2
|
import { normalizeOpenAiBaseUrl } from "../agent/engine/openai-compatible-endpoint.js";
|
|
3
|
-
import {
|
|
3
|
+
import { validateProviderBaseUrl } from "../agent/engine/provider-endpoint-validation.js";
|
|
4
|
+
import { OLLAMA_BASE_URL_ENV_VAR, OPENAI_BASE_URL_ENV_VAR, PROVIDER_ENV_META, } from "../agent/engine/provider-env-vars.js";
|
|
4
5
|
import { getOrgContext } from "../org/context.js";
|
|
5
6
|
import { deleteAppSecret, writeAppSecret } from "../secrets/storage.js";
|
|
6
7
|
import { getSession } from "./auth.js";
|
|
@@ -11,15 +12,23 @@ const PROVIDER_TO_ENV_VAR = new Map(Object.entries(PROVIDER_ENV_META).map(([prov
|
|
|
11
12
|
meta.envVar,
|
|
12
13
|
]));
|
|
13
14
|
const PROVIDER_ENV_VAR_KEYS = new Set(PROVIDER_TO_ENV_VAR.values());
|
|
15
|
+
const BASE_URL_KEYS = new Set([
|
|
16
|
+
OPENAI_BASE_URL_ENV_VAR,
|
|
17
|
+
OLLAMA_BASE_URL_ENV_VAR,
|
|
18
|
+
]);
|
|
19
|
+
const OPENAI_PROVIDER_KEY = PROVIDER_TO_ENV_VAR.get("openai") ?? "";
|
|
14
20
|
export function normalizeAgentEngineApiKeyPayload(body) {
|
|
15
21
|
const payload = body && typeof body === "object" ? body : {};
|
|
16
22
|
const raw = payload;
|
|
23
|
+
const provider = typeof raw.provider === "string" ? raw.provider.trim() : "";
|
|
17
24
|
const key = typeof raw.key === "string"
|
|
18
25
|
? raw.key.trim()
|
|
19
|
-
:
|
|
20
|
-
?
|
|
21
|
-
:
|
|
22
|
-
|
|
26
|
+
: provider === "ollama"
|
|
27
|
+
? OLLAMA_BASE_URL_ENV_VAR
|
|
28
|
+
: provider
|
|
29
|
+
? (PROVIDER_TO_ENV_VAR.get(provider) ?? "")
|
|
30
|
+
: "";
|
|
31
|
+
if (!key || (!PROVIDER_ENV_VAR_KEYS.has(key) && !BASE_URL_KEYS.has(key))) {
|
|
23
32
|
return {
|
|
24
33
|
ok: false,
|
|
25
34
|
statusCode: 400,
|
|
@@ -38,11 +47,11 @@ export function normalizeAgentEngineApiKeyPayload(body) {
|
|
|
38
47
|
: "";
|
|
39
48
|
let baseUrl;
|
|
40
49
|
if (rawBaseUrl.trim()) {
|
|
41
|
-
if (key !==
|
|
50
|
+
if (key !== OPENAI_PROVIDER_KEY && !BASE_URL_KEYS.has(key)) {
|
|
42
51
|
return {
|
|
43
52
|
ok: false,
|
|
44
53
|
statusCode: 400,
|
|
45
|
-
error: "Endpoint URL is only supported for OpenAI.",
|
|
54
|
+
error: "Endpoint URL is only supported for OpenAI or Ollama.",
|
|
46
55
|
};
|
|
47
56
|
}
|
|
48
57
|
try {
|
|
@@ -57,11 +66,11 @@ export function normalizeAgentEngineApiKeyPayload(body) {
|
|
|
57
66
|
}
|
|
58
67
|
}
|
|
59
68
|
const clearBaseUrl = raw.clearBaseUrl === true && baseUrl == null;
|
|
60
|
-
if (clearBaseUrl && key !==
|
|
69
|
+
if (clearBaseUrl && key !== OPENAI_PROVIDER_KEY && !BASE_URL_KEYS.has(key)) {
|
|
61
70
|
return {
|
|
62
71
|
ok: false,
|
|
63
72
|
statusCode: 400,
|
|
64
|
-
error: "Endpoint URL is only supported for OpenAI.",
|
|
73
|
+
error: "Endpoint URL is only supported for OpenAI or Ollama.",
|
|
65
74
|
};
|
|
66
75
|
}
|
|
67
76
|
if (!value && !baseUrl && !clearBaseUrl) {
|
|
@@ -130,6 +139,20 @@ export function createAgentEngineApiKeyHandler() {
|
|
|
130
139
|
setResponseStatus(event, resolved.statusCode);
|
|
131
140
|
return { error: resolved.error };
|
|
132
141
|
}
|
|
142
|
+
if (payload.baseUrl) {
|
|
143
|
+
try {
|
|
144
|
+
await validateProviderBaseUrl(payload.baseUrl, {
|
|
145
|
+
allowLocalOllama: payload.key === OLLAMA_BASE_URL_ENV_VAR &&
|
|
146
|
+
process.env.NODE_ENV === "development",
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
setResponseStatus(event, 400);
|
|
151
|
+
return {
|
|
152
|
+
error: err instanceof Error ? err.message : String(err),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
133
156
|
if (payload.value) {
|
|
134
157
|
await writeAppSecret({
|
|
135
158
|
key: payload.key,
|
|
@@ -144,7 +167,9 @@ export function createAgentEngineApiKeyHandler() {
|
|
|
144
167
|
}
|
|
145
168
|
if (payload.baseUrl) {
|
|
146
169
|
await writeAppSecret({
|
|
147
|
-
key:
|
|
170
|
+
key: payload.key === OLLAMA_BASE_URL_ENV_VAR
|
|
171
|
+
? OLLAMA_BASE_URL_ENV_VAR
|
|
172
|
+
: OPENAI_BASE_URL_ENV_VAR,
|
|
148
173
|
value: payload.baseUrl,
|
|
149
174
|
scope: resolved.target.scope,
|
|
150
175
|
scopeId: resolved.target.scopeId,
|
|
@@ -152,7 +177,9 @@ export function createAgentEngineApiKeyHandler() {
|
|
|
152
177
|
}
|
|
153
178
|
else if (payload.clearBaseUrl) {
|
|
154
179
|
await deleteAppSecret({
|
|
155
|
-
key:
|
|
180
|
+
key: payload.key === OLLAMA_BASE_URL_ENV_VAR
|
|
181
|
+
? OLLAMA_BASE_URL_ENV_VAR
|
|
182
|
+
: OPENAI_BASE_URL_ENV_VAR,
|
|
156
183
|
scope: resolved.target.scope,
|
|
157
184
|
scopeId: resolved.target.scopeId,
|
|
158
185
|
});
|
|
@@ -161,7 +188,11 @@ export function createAgentEngineApiKeyHandler() {
|
|
|
161
188
|
ok: true,
|
|
162
189
|
key: payload.key,
|
|
163
190
|
...(payload.baseUrl || payload.clearBaseUrl
|
|
164
|
-
? {
|
|
191
|
+
? {
|
|
192
|
+
baseUrlKey: payload.key === OLLAMA_BASE_URL_ENV_VAR
|
|
193
|
+
? OLLAMA_BASE_URL_ENV_VAR
|
|
194
|
+
: OPENAI_BASE_URL_ENV_VAR,
|
|
195
|
+
}
|
|
165
196
|
: {}),
|
|
166
197
|
scope: resolved.target.scope,
|
|
167
198
|
};
|
|
@@ -293,8 +293,9 @@ export function readAgentsBundleFromFs(cwd, workspaceSource = null, options = {}
|
|
|
293
293
|
try {
|
|
294
294
|
readNestedSkillsDir(skillsDir, cwd, skills);
|
|
295
295
|
}
|
|
296
|
-
catch {
|
|
296
|
+
catch (error) {
|
|
297
297
|
// Optional host-provided skills must not make the coding session fail.
|
|
298
|
+
console.warn("[agents-bundle] Failed to load optional host-provided skills", { skillsDir, error });
|
|
298
299
|
}
|
|
299
300
|
}
|
|
300
301
|
return {
|
package/dist/server/auth.js
CHANGED
|
@@ -1678,11 +1678,27 @@ async function createAutoDevAccountForSession(auth, db) {
|
|
|
1678
1678
|
function isHostedPreviewRequest(event) {
|
|
1679
1679
|
const host = getRequestHost(event)?.split(",")[0]?.trim().toLowerCase() ?? "";
|
|
1680
1680
|
return (host.endsWith(".agent-native.com") ||
|
|
1681
|
-
host
|
|
1681
|
+
isBuilderPreviewHost(host) ||
|
|
1682
|
+
host.includes("deploy-preview"));
|
|
1683
|
+
}
|
|
1684
|
+
const BUILDER_PREVIEW_LOCAL_DEV_ENV = "AGENT_NATIVE_ALLOW_BUILDER_PREVIEW_LOCAL_DEV";
|
|
1685
|
+
function isBuilderPreviewHost(host) {
|
|
1686
|
+
return (host.endsWith(".builderio.xyz") ||
|
|
1682
1687
|
host.endsWith(".builderio.dev") ||
|
|
1683
1688
|
host.endsWith(".builder.codes") ||
|
|
1684
|
-
host.endsWith(".builder.my")
|
|
1685
|
-
|
|
1689
|
+
host.endsWith(".builder.my"));
|
|
1690
|
+
}
|
|
1691
|
+
function isBuilderPreviewLocalDevEnabled() {
|
|
1692
|
+
const value = process.env[BUILDER_PREVIEW_LOCAL_DEV_ENV]
|
|
1693
|
+
?.trim()
|
|
1694
|
+
.toLowerCase();
|
|
1695
|
+
return value === "1" || value === "true";
|
|
1696
|
+
}
|
|
1697
|
+
function isBuilderPreviewLocalDevRequest(event) {
|
|
1698
|
+
if (!isBuilderPreviewLocalDevEnabled())
|
|
1699
|
+
return false;
|
|
1700
|
+
const host = getRequestHost(event)?.split(",")[0]?.trim().toLowerCase() ?? "";
|
|
1701
|
+
return isBuilderPreviewHost(host);
|
|
1686
1702
|
}
|
|
1687
1703
|
export function isLocalDevAuthAllowed(event) {
|
|
1688
1704
|
const deployPreview = typeof isDeployPreview === "function" && isDeployPreview();
|
|
@@ -1690,8 +1706,8 @@ export function isLocalDevAuthAllowed(event) {
|
|
|
1690
1706
|
!deployPreview &&
|
|
1691
1707
|
!isAuthDisabled() &&
|
|
1692
1708
|
process.env.AGENT_NATIVE_DISABLE_AUTO_DEV_ACCOUNT !== "1" &&
|
|
1693
|
-
!isHostedPreviewRequest(event) &&
|
|
1694
|
-
|
|
1709
|
+
((!isHostedPreviewRequest(event) && isLoopbackRequest(event)) ||
|
|
1710
|
+
isBuilderPreviewLocalDevRequest(event)));
|
|
1695
1711
|
}
|
|
1696
1712
|
async function createOrReuseAutoDevSession(auth, config) {
|
|
1697
1713
|
let session = await createBetterAuthSessionForEmail(AUTO_DEV_ACCOUNT_EMAIL, config);
|
|
@@ -22,6 +22,22 @@ export declare const SECONDARY_PATHS: string[];
|
|
|
22
22
|
export declare const CODE_MAX_FILES = 20;
|
|
23
23
|
/** Maximum total bytes accepted in import-code. */
|
|
24
24
|
export declare const CODE_MAX_TOTAL_BYTES: number;
|
|
25
|
+
export interface CodeAnalysisFile {
|
|
26
|
+
filename: string;
|
|
27
|
+
content: string;
|
|
28
|
+
}
|
|
29
|
+
export interface CodeAnalysisResult {
|
|
30
|
+
source: "code";
|
|
31
|
+
fileCount: number;
|
|
32
|
+
filesAnalyzed: string[];
|
|
33
|
+
colors: Record<string, string>;
|
|
34
|
+
cssCustomProperties: Record<string, string>;
|
|
35
|
+
fonts: CodeAnalysisState["fonts"];
|
|
36
|
+
spacing: CodeAnalysisState["spacing"];
|
|
37
|
+
borderRadius: CodeAnalysisState["borderRadius"];
|
|
38
|
+
stylingFramework: CodeAnalysisState["stylingFramework"];
|
|
39
|
+
rawExtracts: CodeAnalysisState["rawExtracts"];
|
|
40
|
+
}
|
|
25
41
|
/** Regex for hex colors (3-8 digit, including alpha). */
|
|
26
42
|
export declare const HEX_COLOR_RE: RegExp;
|
|
27
43
|
/** Regex for well-known named CSS colors. */
|
|
@@ -140,6 +156,8 @@ export declare function analyzePackageJson(state: CodeAnalysisState, content: st
|
|
|
140
156
|
export declare function analyzeThemeSourceFile(state: CodeAnalysisState, content: string, filename: string): void;
|
|
141
157
|
/** Route a file to the correct analyzer based on filename. */
|
|
142
158
|
export declare function analyzeCodeFile(state: CodeAnalysisState, filename: string, content: string): void;
|
|
159
|
+
/** Analyze the bounded code-file payload accepted by the import-code actions. */
|
|
160
|
+
export declare function analyzeCodeFiles(files: CodeAnalysisFile[]): CodeAnalysisResult;
|
|
143
161
|
/** Deduplicate and trim an array of strings. */
|
|
144
162
|
export declare function unique(arr: string[]): string[];
|
|
145
163
|
/** Extract hex and named colors from plain text. */
|
|
@@ -595,6 +595,37 @@ export function analyzeCodeFile(state, filename, content) {
|
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
597
|
}
|
|
598
|
+
/** Analyze the bounded code-file payload accepted by the import-code actions. */
|
|
599
|
+
export function analyzeCodeFiles(files) {
|
|
600
|
+
const truncated = files.slice(0, CODE_MAX_FILES);
|
|
601
|
+
let totalBytes = 0;
|
|
602
|
+
const accepted = [];
|
|
603
|
+
for (const file of truncated) {
|
|
604
|
+
const size = new TextEncoder().encode(file.content).byteLength;
|
|
605
|
+
if (totalBytes + size > CODE_MAX_TOTAL_BYTES)
|
|
606
|
+
break;
|
|
607
|
+
totalBytes += size;
|
|
608
|
+
accepted.push(file);
|
|
609
|
+
}
|
|
610
|
+
const state = createCodeAnalysisState();
|
|
611
|
+
const filesAnalyzed = [];
|
|
612
|
+
for (const file of accepted) {
|
|
613
|
+
filesAnalyzed.push(file.filename);
|
|
614
|
+
analyzeCodeFile(state, file.filename, file.content);
|
|
615
|
+
}
|
|
616
|
+
return {
|
|
617
|
+
source: "code",
|
|
618
|
+
fileCount: accepted.length,
|
|
619
|
+
filesAnalyzed,
|
|
620
|
+
colors: Object.fromEntries(Object.entries(state.colors).slice(0, 60)),
|
|
621
|
+
cssCustomProperties: Object.fromEntries(Object.entries(state.cssCustomProperties).slice(0, 80)),
|
|
622
|
+
fonts: state.fonts.slice(0, 20),
|
|
623
|
+
spacing: state.spacing,
|
|
624
|
+
borderRadius: state.borderRadius,
|
|
625
|
+
stylingFramework: state.stylingFramework,
|
|
626
|
+
rawExtracts: state.rawExtracts,
|
|
627
|
+
};
|
|
628
|
+
}
|
|
598
629
|
// ---------------------------------------------------------------------------
|
|
599
630
|
// Document analysis helpers (import-document)
|
|
600
631
|
// ---------------------------------------------------------------------------
|
|
@@ -47,6 +47,17 @@ function withAppBasePath(path) {
|
|
|
47
47
|
}
|
|
48
48
|
const AGENT_NATIVE_TERMS_URL = "https://www.agent-native.com/terms";
|
|
49
49
|
const AGENT_NATIVE_PRIVACY_URL = "https://www.agent-native.com/privacy";
|
|
50
|
+
const BUILDER_PREVIEW_LOCAL_DEV_ENV = "AGENT_NATIVE_ALLOW_BUILDER_PREVIEW_LOCAL_DEV";
|
|
51
|
+
function isBuilderPreviewLocalDevEnabled() {
|
|
52
|
+
if (process.env.NODE_ENV !== "development" &&
|
|
53
|
+
process.env.NODE_ENV !== "test") {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
const value = process.env[BUILDER_PREVIEW_LOCAL_DEV_ENV]
|
|
57
|
+
?.trim()
|
|
58
|
+
.toLowerCase();
|
|
59
|
+
return value === "1" || value === "true";
|
|
60
|
+
}
|
|
50
61
|
const EN_AUTH_COPY = {
|
|
51
62
|
languageLabel: "Language",
|
|
52
63
|
systemLanguage: "System",
|
|
@@ -1296,6 +1307,7 @@ export function getOnboardingHtml(opts = {}) {
|
|
|
1296
1307
|
const publicOAuthOrigin = getPublicOAuthOrigin();
|
|
1297
1308
|
const workspaceGatewayReturnOrigin = getWorkspaceGatewayReturnOrigin();
|
|
1298
1309
|
const googleAuthMode = resolveGoogleAuthMode(opts.googleAuthMode);
|
|
1310
|
+
const builderPreviewLocalDevEnabled = isBuilderPreviewLocalDevEnabled();
|
|
1299
1311
|
const localeInitScript = getLocaleInitScript();
|
|
1300
1312
|
const marketing = opts.marketing ??
|
|
1301
1313
|
resolveBuiltInAuthMarketing({
|
|
@@ -2828,6 +2840,7 @@ ${signInJourneyInlineScript()}
|
|
|
2828
2840
|
var __AN_PUBLIC_OAUTH_ORIGIN = ${JSON.stringify(publicOAuthOrigin)};
|
|
2829
2841
|
var __AN_WORKSPACE_GATEWAY_RETURN_ORIGIN = ${JSON.stringify(workspaceGatewayReturnOrigin)};
|
|
2830
2842
|
var __AN_GOOGLE_AUTH_MODE = ${JSON.stringify(googleAuthMode)};
|
|
2843
|
+
var __AN_BUILDER_PREVIEW_LOCAL_DEV_ENABLED = ${JSON.stringify(builderPreviewLocalDevEnabled)};
|
|
2831
2844
|
function __anConfiguredOAuthOrigin() {
|
|
2832
2845
|
if (!__AN_PUBLIC_OAUTH_ORIGIN) return '';
|
|
2833
2846
|
try {
|
|
@@ -2957,8 +2970,15 @@ ${signInJourneyInlineScript()}
|
|
|
2957
2970
|
var hostname = (window.location.hostname || '').toLowerCase();
|
|
2958
2971
|
return hostname === 'localhost' || hostname === '::1' || hostname === '127.0.0.1' || hostname.indexOf('127.') === 0;
|
|
2959
2972
|
}
|
|
2973
|
+
function __anIsBuilderPreviewHost() {
|
|
2974
|
+
var hostname = (window.location.hostname || '').toLowerCase();
|
|
2975
|
+
return hostname.endsWith('.builderio.xyz') || hostname.endsWith('.builderio.dev') || hostname.endsWith('.builder.codes') || hostname.endsWith('.builder.my');
|
|
2976
|
+
}
|
|
2977
|
+
function __anCanUseLocalDevSignin() {
|
|
2978
|
+
return __anIsLoopbackHostname() || (__AN_BUILDER_PREVIEW_LOCAL_DEV_ENABLED && __anIsBuilderPreviewHost());
|
|
2979
|
+
}
|
|
2960
2980
|
function __anShouldStartWithLocalDev() {
|
|
2961
|
-
if (!
|
|
2981
|
+
if (!__anCanUseLocalDevSignin()) return false;
|
|
2962
2982
|
var params = new URLSearchParams(window.location.search);
|
|
2963
2983
|
var explicitTab = params.get('tab');
|
|
2964
2984
|
var verifiedRedirect = typeof __anIsVerifiedRedirectSuccess === 'function' && __anIsVerifiedRedirectSuccess();
|
|
@@ -2981,7 +3001,7 @@ ${signInJourneyInlineScript()}
|
|
|
2981
3001
|
var button = document.getElementById('local-dev-btn');
|
|
2982
3002
|
var fullOptionsButton = document.getElementById('local-dev-full-options');
|
|
2983
3003
|
var message = document.getElementById('local-dev-msg');
|
|
2984
|
-
if (!container || !button || !
|
|
3004
|
+
if (!container || !button || !__anCanUseLocalDevSignin()) return;
|
|
2985
3005
|
container.hidden = false;
|
|
2986
3006
|
var startWithLocalDev = __anShouldStartWithLocalDev();
|
|
2987
3007
|
__anSetFullAuthOptionsVisible(!startWithLocalDev);
|
|
@@ -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
|
}>>;
|