@agent-native/core 0.202.0 → 0.202.1-nightly-20261007011022
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/dist/agent/actions/list-model-providers.d.ts +2 -0
- package/dist/agent/actions/list-model-providers.js +32 -5
- package/dist/agent/actions/manage-provider-models.d.ts +1 -0
- package/dist/agent/engine/builder-engine.d.ts +1 -1
- package/dist/agent/engine/builtin.js +1 -1
- package/dist/agent/engine/index.d.ts +1 -1
- package/dist/agent/engine/index.js +1 -1
- package/dist/agent/engine/registry.d.ts +2 -0
- package/dist/agent/engine/registry.js +63 -47
- package/dist/agent/model-config.d.ts +6 -6
- package/dist/agent/model-config.js +7 -11
- package/dist/agent/model-version.d.ts +3 -0
- package/dist/agent/model-version.js +67 -0
- package/dist/agent/provider-model-selection.d.ts +6 -1
- package/dist/agent/provider-model-selection.js +131 -13
- package/dist/automation/index.d.ts +1 -1
- package/dist/cli/create.d.ts +2 -1
- package/dist/cli/create.js +17 -4
- package/dist/cli/template-sync.js +2 -1
- package/dist/cli/workspacify.d.ts +1 -0
- package/dist/cli/workspacify.js +4 -0
- package/dist/client/app-config.d.ts +1 -0
- package/dist/client/app-config.js +19 -0
- package/dist/client/chat/agentkit-protocol.js +122 -16
- package/dist/client/chat/runtime.js +943 -50
- package/dist/client/chat-model-groups.d.ts +1 -0
- package/dist/client/chat-model-groups.js +1 -0
- package/dist/client/use-chat-models.js +47 -6
- package/dist/deploy/build.js +23 -9
- package/dist/email-catalog/redact-body.js +1 -1
- package/dist/jobs/actions/manage-recurring-job.d.ts +1 -1
- package/dist/jobs/background-automation-runner.d.ts +3 -1
- package/dist/jobs/background-automation-runner.js +15 -8
- package/dist/jobs/scheduler.js +1 -1
- package/dist/mcp/build-server.d.ts +0 -1
- package/dist/mcp/build-server.js +10 -59
- package/dist/observability/routes.d.ts +6 -6
- package/dist/onboarding/app-profile-data.d.ts +10 -0
- package/dist/onboarding/app-profile-data.js +423 -0
- package/dist/onboarding/app-profile.d.ts +1 -7
- package/dist/onboarding/app-profile.js +5 -422
- package/dist/onboarding/index.d.ts +1 -0
- package/dist/onboarding/index.js +1 -0
- package/dist/org/handlers.d.ts +1 -1
- package/dist/org/index.d.ts +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +2 -2
- package/dist/provider-api/actions/provider-api.d.ts +10 -10
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/scripts/agent-engines/manage-agent-engine.js +1 -1
- package/dist/scripts/agent-engines/set-agent-engine.js +1 -1
- package/dist/secrets/routes.d.ts +11 -11
- package/dist/server/action-routes.js +1 -0
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/app-origin-config.d.ts +2 -0
- package/dist/server/app-origin-config.js +4 -0
- package/dist/server/auth.js +43 -1
- package/dist/server/better-auth-instance.js +7 -12
- package/dist/server/email-auth-links.d.ts +11 -0
- package/dist/server/email-auth-links.js +126 -0
- package/dist/server/fusion-app.js +11 -1
- package/dist/shared/agent-chat-context.d.ts +3 -3
- package/dist/shared/agent-chat-context.js +2 -2
- package/dist/shared/auth-copy.d.ts +3 -0
- package/dist/shared/auth-copy.js +33 -0
- package/dist/shared/design-system-agent-context.d.ts +5 -0
- package/dist/shared/design-system-agent-context.js +37 -8
- package/dist/shared/index.d.ts +1 -1
- package/dist/triggers/actions/manage-automation.d.ts +7 -7
- package/dist/triggers/condition-evaluator.d.ts +21 -5
- package/dist/triggers/condition-evaluator.js +113 -59
- package/dist/triggers/dispatcher.js +39 -21
- package/dist/vite/client.js +10 -0
- package/docs/content/durable-resume.mdx +9 -3
- package/package.json +5 -3
|
@@ -168,6 +168,7 @@ export function buildChatModelGroups({ engines, configuredKeys, builderConnected
|
|
|
168
168
|
...(engine.modelDisplayNames
|
|
169
169
|
? { modelDisplayNames: engine.modelDisplayNames }
|
|
170
170
|
: {}),
|
|
171
|
+
...(engine.preserveCustomModels ? { preserveCustomModels: true } : {}),
|
|
171
172
|
configured: engine.configured ??
|
|
172
173
|
(requiredEnvVars.length === 0 ||
|
|
173
174
|
requiredEnvVars.some((key) => configured.has(key))),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
2
|
import { DEFAULT_MODEL } from "../agent/default-model.js";
|
|
3
|
+
import { upgradeModelToLatestSupportedVersion } from "../agent/model-version.js";
|
|
3
4
|
export { DEFAULT_MODEL };
|
|
4
5
|
import { DEFAULT_REASONING_EFFORT, getReasoningEffortOptionsForModel, resolveReasoningEffortSelection, } from "../shared/reasoning-effort.js";
|
|
5
6
|
import { fetchOllamaModels } from "./agent-engine-key.js";
|
|
@@ -274,21 +275,61 @@ export function useChatModels({ storageKey = DEFAULT_STORAGE_KEY, enabled = true
|
|
|
274
275
|
finish();
|
|
275
276
|
return;
|
|
276
277
|
}
|
|
277
|
-
const selectableGroups = unavailableSelectionPolicy === "require-explicit"
|
|
278
|
+
const selectableGroups = unavailableSelectionPolicy === "require-explicit" ||
|
|
279
|
+
!selection.selectedEngine
|
|
278
280
|
? configuredGroups
|
|
279
281
|
: groups;
|
|
280
|
-
const
|
|
282
|
+
const exactSelectedGroups = selectableGroups.filter((group) => (group.models.includes(selection.selectedModel) ||
|
|
283
|
+
(selection.selectedEngine === group.engine &&
|
|
284
|
+
group.preserveCustomModels)) &&
|
|
281
285
|
(!selection.selectedEngine ||
|
|
282
286
|
group.engine === selection.selectedEngine));
|
|
287
|
+
const exactSelectedGroup = selection.selectedEngine
|
|
288
|
+
? exactSelectedGroups[0]
|
|
289
|
+
: new Set(exactSelectedGroups.map((group) => group.engine)).size ===
|
|
290
|
+
1
|
|
291
|
+
? exactSelectedGroups[0]
|
|
292
|
+
: undefined;
|
|
293
|
+
const upgradeCandidates = exactSelectedGroup
|
|
294
|
+
? []
|
|
295
|
+
: selectableGroups.flatMap((group) => {
|
|
296
|
+
if (selection.selectedEngine &&
|
|
297
|
+
group.engine !== selection.selectedEngine) {
|
|
298
|
+
return [];
|
|
299
|
+
}
|
|
300
|
+
const model = group.preserveCustomModels &&
|
|
301
|
+
selection.selectedEngine === group.engine
|
|
302
|
+
? selection.selectedModel
|
|
303
|
+
: upgradeModelToLatestSupportedVersion(selection.selectedModel, group.models);
|
|
304
|
+
return model ? [{ group, model }] : [];
|
|
305
|
+
});
|
|
306
|
+
const upgradeCandidateKeys = new Set(upgradeCandidates.map(({ group, model }) => JSON.stringify([group.engine, model])));
|
|
307
|
+
const upgradedSelection = upgradeCandidateKeys.size === 1 ? upgradeCandidates[0] : undefined;
|
|
308
|
+
const selectedGroup = exactSelectedGroup ?? upgradedSelection?.group;
|
|
283
309
|
if (selectedGroup) {
|
|
310
|
+
const selectedModel = upgradeModelToLatestSupportedVersion(selection.selectedModel, selectedGroup.models) ?? selection.selectedModel;
|
|
311
|
+
const nextSelection = {
|
|
312
|
+
...selection,
|
|
313
|
+
selectedModel,
|
|
314
|
+
selectedEngine: selectedGroup.engine,
|
|
315
|
+
};
|
|
284
316
|
unavailableSelectionRef.current = null;
|
|
285
317
|
setUnavailableSelection(null);
|
|
286
|
-
if (
|
|
318
|
+
if (selectionRef.current.selectedEngine !== selectedGroup.engine) {
|
|
287
319
|
setSelectedEngine(selectedGroup.engine);
|
|
288
320
|
}
|
|
289
|
-
if (selectionRef.current.selectedModel !==
|
|
290
|
-
setSelectedModel(
|
|
291
|
-
setSelectedEffort(selection.selectedEffort);
|
|
321
|
+
if (selectionRef.current.selectedModel !== selectedModel) {
|
|
322
|
+
setSelectedModel(selectedModel);
|
|
323
|
+
setSelectedEffort(resolveReasoningEffortSelection(selectedModel, selection.selectedEffort));
|
|
324
|
+
}
|
|
325
|
+
if (selection.selectedModel !== selectedModel ||
|
|
326
|
+
selection.selectedEngine !== selectedGroup.engine) {
|
|
327
|
+
selectionRef.current = nextSelection;
|
|
328
|
+
writePersisted(storageKey, {
|
|
329
|
+
model: selectedModel,
|
|
330
|
+
engine: selectedGroup.engine,
|
|
331
|
+
effort: resolveReasoningEffortSelection(selectedModel, selection.selectedEffort),
|
|
332
|
+
});
|
|
292
333
|
}
|
|
293
334
|
finish();
|
|
294
335
|
return;
|
package/dist/deploy/build.js
CHANGED
|
@@ -1414,9 +1414,9 @@ function getRealtimeClientConfigScript() {
|
|
|
1414
1414
|
function getAppOriginClientConfigScript() {
|
|
1415
1415
|
// MUST stay consistent with resolvePublicAppOriginConfig in
|
|
1416
1416
|
// server/app-origin-config.ts, and with the alias order declared on
|
|
1417
|
-
// app.url / workspace.* in app-config (worker
|
|
1418
|
-
// can't import them). Impersonal values only —
|
|
1419
|
-
// CDN-cached shell.
|
|
1417
|
+
// app.id / app.workspaceId / app.url / workspace.* in app-config (worker
|
|
1418
|
+
// bundles a string copy; it can't import them). Impersonal values only —
|
|
1419
|
+
// this ships into the CDN-cached shell.
|
|
1420
1420
|
const env = globalThis.process?.env || {};
|
|
1421
1421
|
const appUrl = firstNonEmpty(
|
|
1422
1422
|
env.APP_URL,
|
|
@@ -1479,23 +1479,37 @@ function getAppOriginClientConfigScript() {
|
|
|
1479
1479
|
return;
|
|
1480
1480
|
}
|
|
1481
1481
|
})();
|
|
1482
|
-
const
|
|
1483
|
-
getAgentNativeAppConfig().app,
|
|
1484
|
-
getAgentNativeAppConfig().workspace,
|
|
1485
|
-
);
|
|
1482
|
+
const appConfig = getAgentNativeAppConfig();
|
|
1486
1483
|
const config = {
|
|
1487
|
-
|
|
1484
|
+
...(appConfig.app.id ? { appId: appConfig.app.id } : {}),
|
|
1485
|
+
...(appConfig.app.workspaceId
|
|
1486
|
+
? { workspaceAppId: appConfig.app.workspaceId }
|
|
1487
|
+
: {}),
|
|
1488
|
+
appHomePath: resolveAgentNativeAppHomePath(
|
|
1489
|
+
appConfig.app,
|
|
1490
|
+
appConfig.workspace,
|
|
1491
|
+
),
|
|
1488
1492
|
...(appUrl ? { appUrl } : {}),
|
|
1489
1493
|
...(workspaceGatewayUrl ? { workspaceGatewayUrl } : {}),
|
|
1490
1494
|
...(workspaceOAuthOrigin ? { workspaceOAuthOrigin } : {}),
|
|
1491
1495
|
...(workspaceRuntime ? { workspaceRuntime: true } : {}),
|
|
1492
1496
|
...(workspaceAppMountPaths ? { workspaceAppMountPaths } : {}),
|
|
1493
1497
|
};
|
|
1498
|
+
const toUnicodeEscape = (character) =>
|
|
1499
|
+
String.fromCharCode(92) +
|
|
1500
|
+
"u" +
|
|
1501
|
+
character.charCodeAt(0).toString(16).padStart(4, "0");
|
|
1502
|
+
let serializedConfig = JSON.stringify(config).replace(/[<>&]/g, toUnicodeEscape);
|
|
1503
|
+
for (const character of [String.fromCharCode(0x2028), String.fromCharCode(0x2029)]) {
|
|
1504
|
+
serializedConfig = serializedConfig
|
|
1505
|
+
.split(character)
|
|
1506
|
+
.join(toUnicodeEscape(character));
|
|
1507
|
+
}
|
|
1494
1508
|
if (Object.keys(config).length === 0) return null;
|
|
1495
1509
|
return (
|
|
1496
1510
|
'<script data-agent-native-app-origin-config>' +
|
|
1497
1511
|
'window.__AGENT_NATIVE_CONFIG__=Object.assign({},window.__AGENT_NATIVE_CONFIG__,' +
|
|
1498
|
-
|
|
1512
|
+
serializedConfig +
|
|
1499
1513
|
");</script>"
|
|
1500
1514
|
);
|
|
1501
1515
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const URL_PATTERN = /https?:\/\/[^\s"'<>)]+|(?<=["'\s]|^)\/\/[^\s"'<>)]+/gi;
|
|
2
|
-
const SENSITIVE_URL_PATH_PATTERN = /\/(?:reset-password|password-reset|magic-link|magic_link|verify-email|email-verification|verification|confirm-email|auth\/callback|sso\/callback|unlock-account)(?:[/?]|$)/i;
|
|
2
|
+
const SENSITIVE_URL_PATH_PATTERN = /\/(?:reset-password|password-reset|magic-link|magic_link|email-link|verify-email|email-verification|verification|confirm-email|auth\/callback|sso\/callback|unlock-account)(?:[/?]|$)/i;
|
|
3
3
|
const SENSITIVE_QUERY_PARAM_PATTERN = /(?:\?|#|&(?:amp;)?)(?:token|code|otp|otp_code|otpcode|verification_code|verificationcode|verify_token|verifytoken|reset_token|resettoken|magic|auth|auth_token|authtoken|session|sid|sig|signature|secret|key|nonce|access_token|accesstoken|id_token|idtoken|oobcode)=/i;
|
|
4
4
|
const JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}\b/g;
|
|
5
5
|
const OTP_KEYWORD_PATTERN = /\b(?:otp|one[- ]time\s+(?:password|code|pin)|verification\s+code|security\s+code|access\s+code|passcode|pin\s+code|login\s+code)\b/i;
|
|
@@ -11,9 +11,9 @@ declare const _default: import("../../action.js").ActionDefinition<{
|
|
|
11
11
|
enabled?: undefined;
|
|
12
12
|
nextRun?: undefined;
|
|
13
13
|
} | {
|
|
14
|
+
deleted?: undefined;
|
|
14
15
|
name: string;
|
|
15
16
|
enabled: boolean;
|
|
16
17
|
nextRun: string;
|
|
17
|
-
deleted?: undefined;
|
|
18
18
|
}>;
|
|
19
19
|
export default _default;
|
|
@@ -111,8 +111,10 @@ export declare function runBackgroundAutomation(options: BackgroundAutomationRun
|
|
|
111
111
|
export declare function checkBackgroundAutomationCredentials(identity: {
|
|
112
112
|
ownerEmail: string;
|
|
113
113
|
orgId?: string;
|
|
114
|
-
}, deps: BackgroundAutomationDeps): Promise<{
|
|
114
|
+
}, deps: BackgroundAutomationDeps, automationModel?: string): Promise<{
|
|
115
115
|
ok: true;
|
|
116
|
+
engine: AgentEngine;
|
|
117
|
+
model: string;
|
|
116
118
|
} | {
|
|
117
119
|
ok: false;
|
|
118
120
|
failure: AutomationFailure;
|
|
@@ -481,15 +481,26 @@ async function resolveUsableBackgroundEngine(identity, deps, assertDeadline) {
|
|
|
481
481
|
await assertLlmCredentialsUsable({ engine, apiKey, ownerEmail, orgId });
|
|
482
482
|
return engine;
|
|
483
483
|
}
|
|
484
|
+
async function resolveBackgroundAutomationModel(engine, automationModel, deps) {
|
|
485
|
+
const modelCandidate = automationModel ??
|
|
486
|
+
deps.model ??
|
|
487
|
+
(await getStoredModelForEngine(engine, { appId: deps.appId })) ??
|
|
488
|
+
engine.defaultModel;
|
|
489
|
+
return normalizeModelForEngine(engine, modelCandidate);
|
|
490
|
+
}
|
|
484
491
|
/**
|
|
485
492
|
* Whether the automation's run identity has a usable LLM credential right now,
|
|
486
493
|
* without starting a run. The scheduler asks this to resume an automation it
|
|
487
494
|
* paused for `missing_credentials` as soon as the credential exists.
|
|
488
495
|
*/
|
|
489
|
-
export async function checkBackgroundAutomationCredentials(identity, deps) {
|
|
496
|
+
export async function checkBackgroundAutomationCredentials(identity, deps, automationModel) {
|
|
490
497
|
try {
|
|
491
|
-
await runWithRequestContext({ userEmail: identity.ownerEmail, orgId: identity.orgId },
|
|
492
|
-
|
|
498
|
+
const { engine, model } = await runWithRequestContext({ userEmail: identity.ownerEmail, orgId: identity.orgId }, async () => {
|
|
499
|
+
const engine = await resolveUsableBackgroundEngine(identity, deps, () => undefined);
|
|
500
|
+
const model = await resolveBackgroundAutomationModel(engine, automationModel, deps);
|
|
501
|
+
return { engine, model };
|
|
502
|
+
});
|
|
503
|
+
return { ok: true, engine, model };
|
|
493
504
|
}
|
|
494
505
|
catch (error) {
|
|
495
506
|
return { ok: false, failure: classifyAutomationFailure(error) };
|
|
@@ -522,11 +533,7 @@ async function executeBackgroundAutomation(options, deps, historyId, runIdRef) {
|
|
|
522
533
|
await assertDeliveryTargetSupported(automation);
|
|
523
534
|
const engine = await resolveUsableBackgroundEngine({ ownerEmail, orgId }, deps, () => assertHardDeadline(options.hardDeadlineAt));
|
|
524
535
|
assertHardDeadline(options.hardDeadlineAt);
|
|
525
|
-
const
|
|
526
|
-
deps.model ??
|
|
527
|
-
(await getStoredModelForEngine(engine, { appId: deps.appId })) ??
|
|
528
|
-
engine.defaultModel;
|
|
529
|
-
const model = normalizeModelForEngine(engine, modelCandidate);
|
|
536
|
+
const model = await resolveBackgroundAutomationModel(engine, automation.meta.model, deps);
|
|
530
537
|
assertHardDeadline(options.hardDeadlineAt);
|
|
531
538
|
const systemPrompt = await deps.getSystemPrompt(ownerEmail);
|
|
532
539
|
assertHardDeadline(options.hardDeadlineAt);
|
package/dist/jobs/scheduler.js
CHANGED
|
@@ -470,7 +470,7 @@ async function resumeRecoveredPauses(paused, deps, now) {
|
|
|
470
470
|
(await checkBackgroundAutomationCredentials({
|
|
471
471
|
ownerEmail: identity.identity.userEmail,
|
|
472
472
|
orgId: identity.identity.orgId,
|
|
473
|
-
}, deps)).ok;
|
|
473
|
+
}, deps, meta.model)).ok;
|
|
474
474
|
if (!recovered) {
|
|
475
475
|
await updateResource(resource, { ...meta, lastCheck: now.toISOString() }, body);
|
|
476
476
|
continue;
|
|
@@ -50,7 +50,6 @@ export interface MCPConfig {
|
|
|
50
50
|
instructions?: string;
|
|
51
51
|
widgets?: boolean;
|
|
52
52
|
widgetDomain?: string;
|
|
53
|
-
widgetDiagnostic?: "tiny-html" | "no-frame-domains";
|
|
54
53
|
keyToolNames?: readonly string[];
|
|
55
54
|
toolDescriptions?: Record<string, string>;
|
|
56
55
|
toolParameterDescriptions?: Record<string, Record<string, string>>;
|
package/dist/mcp/build-server.js
CHANGED
|
@@ -881,7 +881,7 @@ function openAiWidgetCsp(cspConfig, requestMeta) {
|
|
|
881
881
|
csp.frame_domains = frameDomains;
|
|
882
882
|
return Object.keys(csp).length > 0 ? csp : undefined;
|
|
883
883
|
}
|
|
884
|
-
function mcpAppUiMeta(resource, resolvedCsp, requestMeta, description, widgetDomain, directoryMode = false
|
|
884
|
+
function mcpAppUiMeta(resource, resolvedCsp, requestMeta, description, widgetDomain, directoryMode = false) {
|
|
885
885
|
const base = resource._meta && typeof resource._meta === "object"
|
|
886
886
|
? { ...resource._meta }
|
|
887
887
|
: {};
|
|
@@ -890,32 +890,23 @@ function mcpAppUiMeta(resource, resolvedCsp, requestMeta, description, widgetDom
|
|
|
890
890
|
: {};
|
|
891
891
|
const ui = { ...existingUi };
|
|
892
892
|
delete ui.domain;
|
|
893
|
-
const omitFrameDomains = directoryMode && widgetDiagnostic === "no-frame-domains";
|
|
894
893
|
if (directoryMode &&
|
|
895
894
|
ui.csp &&
|
|
896
895
|
typeof ui.csp === "object" &&
|
|
897
896
|
!Array.isArray(ui.csp)) {
|
|
898
897
|
const csp = { ...ui.csp };
|
|
899
898
|
delete csp.baseUriDomains;
|
|
900
|
-
if (omitFrameDomains)
|
|
901
|
-
delete csp.frameDomains;
|
|
902
899
|
ui.csp = csp;
|
|
903
900
|
}
|
|
904
901
|
if (resolvedCsp) {
|
|
905
902
|
const csp = { ...resolvedCsp };
|
|
906
903
|
if (directoryMode)
|
|
907
904
|
delete csp.baseUriDomains;
|
|
908
|
-
if (omitFrameDomains)
|
|
909
|
-
delete csp.frameDomains;
|
|
910
905
|
ui.csp = {
|
|
911
906
|
...csp,
|
|
912
907
|
connectDomains: expandRequestOriginSources(resolvedCsp.connectDomains, requestMeta),
|
|
913
908
|
resourceDomains: expandRequestOriginSources(resolvedCsp.resourceDomains, requestMeta),
|
|
914
|
-
|
|
915
|
-
? {
|
|
916
|
-
frameDomains: expandRequestOriginSources(resolvedCsp.frameDomains, requestMeta),
|
|
917
|
-
}
|
|
918
|
-
: {}),
|
|
909
|
+
frameDomains: expandRequestOriginSources(resolvedCsp.frameDomains, requestMeta),
|
|
919
910
|
...(!directoryMode
|
|
920
911
|
? {
|
|
921
912
|
baseUriDomains: expandRequestOriginSources(resolvedCsp.baseUriDomains, requestMeta),
|
|
@@ -927,21 +918,15 @@ function mcpAppUiMeta(resource, resolvedCsp, requestMeta, description, widgetDom
|
|
|
927
918
|
ui.permissions = resource.permissions;
|
|
928
919
|
const hostSpecificDomain = hostSpecificDomainString(resource.domain) ??
|
|
929
920
|
hostSpecificDomainString(existingUi.domain);
|
|
930
|
-
if (
|
|
931
|
-
delete ui.domain;
|
|
932
|
-
delete base["openai/widgetDomain"];
|
|
933
|
-
}
|
|
934
|
-
else if (widgetDomain)
|
|
921
|
+
if (widgetDomain)
|
|
935
922
|
ui.domain = widgetDomain;
|
|
936
923
|
else if (hostSpecificDomain)
|
|
937
924
|
ui.domain = hostSpecificDomain;
|
|
938
|
-
const openAiWidgetDomain =
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
originString(existingUi.domain) ??
|
|
944
|
-
originString(requestMeta?.origin));
|
|
925
|
+
const openAiWidgetDomain = originString(widgetDomain) ??
|
|
926
|
+
originString(resource.domain) ??
|
|
927
|
+
originString(ui.domain) ??
|
|
928
|
+
originString(existingUi.domain) ??
|
|
929
|
+
originString(requestMeta?.origin);
|
|
945
930
|
if (typeof resource.prefersBorder === "boolean") {
|
|
946
931
|
ui.prefersBorder = resource.prefersBorder;
|
|
947
932
|
}
|
|
@@ -957,8 +942,6 @@ function mcpAppUiMeta(resource, resolvedCsp, requestMeta, description, widgetDom
|
|
|
957
942
|
const openAiCsp = openAiWidgetCsp(resolvedCsp, requestMeta);
|
|
958
943
|
if (directoryMode) {
|
|
959
944
|
const directoryCsp = { ...(openAiCsp ?? {}) };
|
|
960
|
-
if (omitFrameDomains)
|
|
961
|
-
delete directoryCsp.frame_domains;
|
|
962
945
|
const redirectDomain = originString(widgetDomain);
|
|
963
946
|
if (redirectDomain)
|
|
964
947
|
directoryCsp.redirect_domains = [redirectDomain];
|
|
@@ -977,8 +960,7 @@ function mcpAppUiMeta(resource, resolvedCsp, requestMeta, description, widgetDom
|
|
|
977
960
|
else if (openAiCsp && base["openai/widgetCSP"] == null) {
|
|
978
961
|
base["openai/widgetCSP"] = openAiCsp;
|
|
979
962
|
}
|
|
980
|
-
if (
|
|
981
|
-
openAiWidgetDomain &&
|
|
963
|
+
if (openAiWidgetDomain &&
|
|
982
964
|
(widgetDomain || base["openai/widgetDomain"] == null)) {
|
|
983
965
|
base["openai/widgetDomain"] = openAiWidgetDomain;
|
|
984
966
|
}
|
|
@@ -1005,9 +987,7 @@ async function resolveMcpAppResource(config, actionName, entry, requestMeta) {
|
|
|
1005
987
|
requestOrigin: requestMeta?.origin,
|
|
1006
988
|
catalogMode: config.catalogMode,
|
|
1007
989
|
});
|
|
1008
|
-
const resourceMeta = mcpAppUiMeta(resource, resolvedCsp, requestMeta, description, config.catalogMode === "directory" ? config.widgetDomain : undefined, config.catalogMode === "directory"
|
|
1009
|
-
? config.directoryProfile?.widgetDiagnostic
|
|
1010
|
-
: undefined);
|
|
990
|
+
const resourceMeta = mcpAppUiMeta(resource, resolvedCsp, requestMeta, description, config.catalogMode === "directory" ? config.widgetDomain : undefined, config.catalogMode === "directory");
|
|
1011
991
|
return {
|
|
1012
992
|
uri: resolvedUri.uri,
|
|
1013
993
|
...(resolvedUri.legacyUris ? { legacyUris: resolvedUri.legacyUris } : {}),
|
|
@@ -1065,36 +1045,7 @@ async function getMcpAppResources(config, actions, requestMeta) {
|
|
|
1065
1045
|
return true;
|
|
1066
1046
|
});
|
|
1067
1047
|
}
|
|
1068
|
-
const DIRECTORY_TINY_WIDGET_HTML = [
|
|
1069
|
-
"<!doctype html>",
|
|
1070
|
-
'<html lang="en">',
|
|
1071
|
-
"<head>",
|
|
1072
|
-
' <meta charset="utf-8">',
|
|
1073
|
-
' <meta name="viewport" content="width=device-width, initial-scale=1">',
|
|
1074
|
-
" <title>Widget resource size diagnostic</title>",
|
|
1075
|
-
" <style>",
|
|
1076
|
-
" :root { color-scheme: light dark; font-family: system-ui, sans-serif; }",
|
|
1077
|
-
" body { margin: 0; min-height: 100vh; display: grid; place-items: center; background: Canvas; color: CanvasText; }",
|
|
1078
|
-
" main { width: min(42rem, calc(100% - 3rem)); padding: 2rem; border: 1px solid color-mix(in srgb, CanvasText 20%, Canvas); border-radius: 1rem; }",
|
|
1079
|
-
" h1 { margin: 0 0 1rem; font-size: 1.4rem; }",
|
|
1080
|
-
" p { line-height: 1.6; }",
|
|
1081
|
-
" </style>",
|
|
1082
|
-
"</head>",
|
|
1083
|
-
"<body>",
|
|
1084
|
-
' <main role="status">',
|
|
1085
|
-
" <h1>Widget resource size diagnostic</h1>",
|
|
1086
|
-
" <p>This temporary resource replaces the full Agent-Native Slides widget shell while the ChatGPT plugin scan is being diagnosed.</p>",
|
|
1087
|
-
" <p>The Slides app and its MCP tools remain available. This page measures whether the review scan completes when the linked HTML resource is small.</p>",
|
|
1088
|
-
" <p>After the scan experiment, remove this diagnostic lane and restore the production widget resource.</p>",
|
|
1089
|
-
" </main>",
|
|
1090
|
-
"</body>",
|
|
1091
|
-
"</html>",
|
|
1092
|
-
].join("\n");
|
|
1093
1048
|
function renderMcpAppHtml(resource, actionName, config, requestMeta) {
|
|
1094
|
-
if (config.catalogMode === "directory" &&
|
|
1095
|
-
config.directoryProfile?.widgetDiagnostic === "tiny-html") {
|
|
1096
|
-
return DIRECTORY_TINY_WIDGET_HTML;
|
|
1097
|
-
}
|
|
1098
1049
|
if (typeof resource.html === "function") {
|
|
1099
1050
|
return resource.html({
|
|
1100
1051
|
actionName,
|
|
@@ -27,38 +27,38 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
27
27
|
thumbsUpRate: number;
|
|
28
28
|
avgEvalScore: number;
|
|
29
29
|
} | {
|
|
30
|
-
ok?: undefined;
|
|
31
30
|
error: string;
|
|
32
31
|
message: string;
|
|
33
32
|
summary?: undefined;
|
|
34
33
|
spans?: undefined;
|
|
35
34
|
id?: undefined;
|
|
36
|
-
} | {
|
|
37
|
-
error?: undefined;
|
|
38
35
|
ok?: undefined;
|
|
36
|
+
} | {
|
|
39
37
|
message?: undefined;
|
|
40
38
|
summary: import("./types.js").TraceSummary;
|
|
41
39
|
spans: import("./types.js").TraceSpan[];
|
|
42
40
|
id?: undefined;
|
|
43
|
-
} | {
|
|
44
41
|
error?: undefined;
|
|
45
42
|
ok?: undefined;
|
|
43
|
+
} | {
|
|
46
44
|
message?: undefined;
|
|
47
45
|
summary?: undefined;
|
|
48
46
|
spans?: undefined;
|
|
49
47
|
id: string;
|
|
50
|
-
|
|
48
|
+
error?: undefined;
|
|
51
49
|
ok?: undefined;
|
|
50
|
+
} | {
|
|
52
51
|
message?: undefined;
|
|
53
52
|
summary?: undefined;
|
|
54
53
|
spans?: undefined;
|
|
55
54
|
id?: undefined;
|
|
56
55
|
error: any;
|
|
56
|
+
ok?: undefined;
|
|
57
57
|
} | {
|
|
58
|
-
error?: undefined;
|
|
59
58
|
message?: undefined;
|
|
60
59
|
summary?: undefined;
|
|
61
60
|
spans?: undefined;
|
|
62
61
|
id?: undefined;
|
|
62
|
+
error?: undefined;
|
|
63
63
|
ok: boolean;
|
|
64
64
|
}>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { OnboardingAppProfile } from "./types.js";
|
|
2
|
+
export declare function normalizeOnboardingAppId(value: string | undefined): string;
|
|
3
|
+
/**
|
|
4
|
+
* The app's setup profile: the shared workspace services first (see
|
|
5
|
+
* `WORKSPACE_SERVICES`), each tagged with its `service` id, then the app's
|
|
6
|
+
* own capabilities. A profile that declares a
|
|
7
|
+
* service's capability tailors its copy and can raise it to required or
|
|
8
|
+
* recommended, never lower it.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getOnboardingAppProfileForId(appId?: string): OnboardingAppProfile;
|