@agent-native/core 0.84.57 → 0.84.58
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/core/CHANGELOG.md +8 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/action.ts +11 -0
- package/corpus/core/src/agent/production-agent.ts +24 -46
- package/corpus/core/src/client/AssistantChat.tsx +69 -12
- package/corpus/core/src/client/MultiTabAssistantChat.tsx +1 -1
- package/corpus/core/src/client/conversation/use-near-bottom-autoscroll.ts +45 -2
- package/corpus/core/src/coding-tools/run-code.ts +1 -0
- package/corpus/core/src/integrations/webhook-handler.ts +10 -9
- package/corpus/core/src/server/action-discovery.ts +3 -0
- package/corpus/core/src/server/credential-provider.ts +11 -6
- package/corpus/templates/analytics/server/lib/agent-chat-plan-mode.ts +29 -0
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +9 -1
- package/corpus/templates/design/actions/list-design-extensions.ts +2 -2
- package/corpus/templates/design/app/components/design/CodeWorkbenchHost.tsx +11 -89
- package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +314 -181
- package/corpus/templates/design/app/components/design/DesignImportPanel.tsx +92 -134
- package/corpus/templates/design/app/components/design/EditPanel.tsx +93 -19
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +18 -26
- package/corpus/templates/design/app/components/design/TokensPanel.tsx +220 -192
- package/corpus/templates/design/app/components/design/code-workbench-theme.ts +150 -0
- package/corpus/templates/design/app/i18n/zh-TW.ts +5 -7
- package/corpus/templates/design/app/i18n-data.ts +61 -77
- package/corpus/templates/design/app/lib/design-import.ts +4 -1
- package/corpus/templates/design/app/pages/DesignEditor.tsx +97 -48
- package/corpus/templates/design/changelog/2026-07-02-design-inspector-and-canvas-controls-stay-consistent-when-se.md +6 -0
- package/corpus/templates/design/changelog/2026-07-02-fixed-a-crash-when-opening-the-code-editor.md +6 -0
- package/corpus/templates/design/changelog/2026-07-02-fixed-motion-drawer-open-transition.md +6 -0
- package/corpus/templates/design/changelog/2026-07-02-improved-design-assets-panel.md +6 -0
- package/dist/action.d.ts +8 -0
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +3 -0
- package/dist/action.js.map +1 -1
- package/dist/agent/production-agent.d.ts +10 -11
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +21 -44
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +1 -0
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +61 -11
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +1 -1
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/conversation/use-near-bottom-autoscroll.d.ts.map +1 -1
- package/dist/client/conversation/use-near-bottom-autoscroll.js +43 -2
- package/dist/client/conversation/use-near-bottom-autoscroll.js.map +1 -1
- package/dist/coding-tools/run-code.d.ts.map +1 -1
- package/dist/coding-tools/run-code.js +1 -0
- package/dist/coding-tools/run-code.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +2 -2
- package/dist/integrations/webhook-handler.d.ts +1 -0
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +9 -9
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +5 -5
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +3 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/credential-provider.d.ts +4 -0
- package/dist/server/credential-provider.d.ts.map +1 -1
- package/dist/server/credential-provider.js +13 -7
- package/dist/server/credential-provider.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ import { isMcpActionResult } from "../mcp-client/app-result.js";
|
|
|
11
11
|
import { isMcpToolAllowedForRequest } from "../mcp-client/visibility.js";
|
|
12
12
|
import { completeRun as completeProgressRun, startRun as startProgressRun, updateRunProgress, } from "../progress/registry.js";
|
|
13
13
|
import { getFrontmatterValue, parseFrontmatter, } from "../resources/metadata.js";
|
|
14
|
-
import {
|
|
14
|
+
import { canUseDeployCredentialFallbackForRequest, readDeployCredentialEnv, } from "../server/credential-provider.js";
|
|
15
15
|
import { readBody } from "../server/h3-helpers.js";
|
|
16
16
|
import { getRequestRunContext, ensureRequestRunContext, getRequestContext, getRequestOrgId, getRequestUserEmail, runWithRequestContext, } from "../server/request-context.js";
|
|
17
17
|
import { fireInternalDispatch } from "../server/self-dispatch.js";
|
|
@@ -279,31 +279,16 @@ export async function getOwnerApiKey(provider, ownerEmail) {
|
|
|
279
279
|
export function engineToProvider(engineName) {
|
|
280
280
|
return engineName.startsWith("ai-sdk:") ? engineName.slice(7) : engineName;
|
|
281
281
|
}
|
|
282
|
-
/**
|
|
283
|
-
* Returns true when this process should block generic deploy-level provider
|
|
284
|
-
* credentials for signed-in chat requests.
|
|
285
|
-
*
|
|
286
|
-
* Self-hosted single-tenant deployments keep the env-var fallback so the
|
|
287
|
-
* original BYO-server UX continues to work without a per-user key.
|
|
288
|
-
*/
|
|
289
|
-
function shouldBlockDeployCredentialFallback() {
|
|
290
|
-
return !isDeployCredentialFallbackAllowed();
|
|
291
|
-
}
|
|
292
282
|
/**
|
|
293
283
|
* Resolve the active engine's provider and look up the user's API key for it.
|
|
294
284
|
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
* prompt logging tied to the deployment owner) — exactly the prior-incident
|
|
300
|
-
* pattern we hit on 2026-04-29.
|
|
301
|
-
*
|
|
302
|
-
* Single-tenant (local-dev, self-hosted SQLite) keeps the env fallback.
|
|
285
|
+
* If the owner has no scoped key, fall back to provider keys supplied by the
|
|
286
|
+
* hosting environment only when the current request can safely use deploy-level
|
|
287
|
+
* credentials. This is a read from process-level config, not a request-scoped
|
|
288
|
+
* write to `process.env`.
|
|
303
289
|
*
|
|
304
|
-
* Callers
|
|
305
|
-
*
|
|
306
|
-
* another deployment-key fallback after this must keep the same gate.
|
|
290
|
+
* Callers that layer another deployment-key fallback after this should keep the
|
|
291
|
+
* same precedence: scoped key first, host-provided env key second.
|
|
307
292
|
*/
|
|
308
293
|
export async function getOwnerActiveApiKey(ownerEmail) {
|
|
309
294
|
try {
|
|
@@ -314,14 +299,8 @@ export async function getOwnerActiveApiKey(ownerEmail) {
|
|
|
314
299
|
const userKey = await getOwnerApiKey(provider, ownerEmail);
|
|
315
300
|
if (userKey)
|
|
316
301
|
return userKey;
|
|
317
|
-
if (
|
|
318
|
-
// Shared hosted default: refuse the env fallback. A null user
|
|
319
|
-
// (unauthenticated / background context with no owner) gets undefined
|
|
320
|
-
// here too — there's no user to bill, and the call site must surface a
|
|
321
|
-
// "configure a key" error to the requester rather than silently using
|
|
322
|
-
// the deploy key.
|
|
302
|
+
if (!canUseDeployCredentialFallbackForRequest())
|
|
323
303
|
return undefined;
|
|
324
|
-
}
|
|
325
304
|
const envVar = PROVIDER_TO_ENV[provider];
|
|
326
305
|
return envVar ? readDeployCredentialEnv(envVar) : undefined;
|
|
327
306
|
}
|
|
@@ -417,6 +396,8 @@ function planModeBlockedMessage(toolName, reason) {
|
|
|
417
396
|
". Switch to Act mode after the user approves the plan, then retry the action.");
|
|
418
397
|
}
|
|
419
398
|
export function isPlanModeToolCallAllowed(name, input, entry) {
|
|
399
|
+
if (entry.allowInPlanMode === false)
|
|
400
|
+
return false;
|
|
420
401
|
if (PLAN_MODE_BLOCKED_READONLY_TOOLS.has(name))
|
|
421
402
|
return false;
|
|
422
403
|
if (name === "web-request") {
|
|
@@ -498,6 +479,8 @@ export function createPlanModeActionRegistry(actions) {
|
|
|
498
479
|
for (const [name, entry] of Object.entries(actions)) {
|
|
499
480
|
if (name === TOOL_SEARCH_ACTION_NAME)
|
|
500
481
|
continue;
|
|
482
|
+
if (entry.allowInPlanMode === false)
|
|
483
|
+
continue;
|
|
501
484
|
if (PLAN_MODE_BLOCKED_READONLY_TOOLS.has(name))
|
|
502
485
|
continue;
|
|
503
486
|
const allowedActions = PLAN_MODE_ALLOWED_ACTIONS[name];
|
|
@@ -3625,15 +3608,13 @@ export function createProductionAgentHandler(options) {
|
|
|
3625
3608
|
// for that provider instead of the global active engine's provider.
|
|
3626
3609
|
// DIAGNOSTIC-ONLY: bracket per-owner API-key resolution (settings/app_secrets reads).
|
|
3627
3610
|
workerStep("apikey_start");
|
|
3611
|
+
const allowDeployCredentialFallback = canUseDeployCredentialFallbackForRequest();
|
|
3628
3612
|
let userApiKey;
|
|
3629
3613
|
if (requestEngine) {
|
|
3630
3614
|
const provider = engineToProvider(requestEngine);
|
|
3631
3615
|
userApiKey = await getOwnerApiKey(provider, ownerEmail);
|
|
3632
|
-
if (!userApiKey &&
|
|
3633
|
-
//
|
|
3634
|
-
// hosted deploys never silently substitute the deploy-level key for
|
|
3635
|
-
// an authenticated user (see getOwnerActiveApiKey for the full
|
|
3636
|
-
// rationale).
|
|
3616
|
+
if (!userApiKey && allowDeployCredentialFallback) {
|
|
3617
|
+
// Read-only env fallback for the requested provider.
|
|
3637
3618
|
const envVar = PROVIDER_TO_ENV[provider];
|
|
3638
3619
|
userApiKey = envVar ? readDeployCredentialEnv(envVar) : undefined;
|
|
3639
3620
|
}
|
|
@@ -3644,16 +3625,12 @@ export function createProductionAgentHandler(options) {
|
|
|
3644
3625
|
// DIAGNOSTIC-ONLY: API-key resolution finished.
|
|
3645
3626
|
workerStep("apikey_done");
|
|
3646
3627
|
// `options.apiKey` is the value the template constructed the plugin with
|
|
3647
|
-
// (
|
|
3648
|
-
//
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
const effectiveApiKey =
|
|
3653
|
-
? userApiKey
|
|
3654
|
-
: (userApiKey ??
|
|
3655
|
-
options.apiKey ??
|
|
3656
|
-
readDeployCredentialEnv("ANTHROPIC_API_KEY"));
|
|
3628
|
+
// (often wired from a deployment env var). Honor it as host-provided
|
|
3629
|
+
// read-only configuration after scoped keys when deploy fallback is safe.
|
|
3630
|
+
const hostApiKey = allowDeployCredentialFallback
|
|
3631
|
+
? (options.apiKey ?? readDeployCredentialEnv("ANTHROPIC_API_KEY"))
|
|
3632
|
+
: undefined;
|
|
3633
|
+
const effectiveApiKey = userApiKey ?? hostApiKey;
|
|
3657
3634
|
// Resolve engine — per-request engine override takes priority
|
|
3658
3635
|
// DIAGNOSTIC-ONLY: bracket engine resolution (Builder credential / app-default
|
|
3659
3636
|
// settings reads inside resolveEngine).
|