@agent-native/core 0.233.0 → 0.234.0-nightly-20261125004429
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/engine/ai-sdk-engine.d.ts +1 -0
- package/dist/agent/engine/ai-sdk-engine.js +36 -1
- package/dist/agent/engine/anthropic-engine.js +12 -1
- package/dist/agent/production-agent.d.ts +7 -0
- package/dist/agent/tool-search.js +34 -4
- package/dist/application-state/handlers.d.ts +3 -3
- package/dist/cli/skills-content/an-skill.d.ts +1 -1
- package/dist/cli/skills-content/an-skill.js +30 -13
- package/dist/client/action-get-batch.d.ts +1 -0
- package/dist/client/action-get-batch.js +5 -1
- package/dist/client/application-state.js +65 -7
- package/dist/client/chat/agentkit-protocol.js +15 -3
- package/dist/client/feature-flags/use-feature-flag.js +3 -0
- package/dist/client/labs/use-lab.js +2 -0
- package/dist/client/session-identity.d.ts +1 -0
- package/dist/client/session-identity.js +7 -0
- package/dist/client/use-action.d.ts +1 -0
- package/dist/client/use-action.js +19 -6
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/framework-package-versions.json +8 -8
- package/dist/identity/rekey.js +55 -2
- package/dist/jobs/background-automation-runner.d.ts +7 -1
- package/dist/jobs/background-automation-runner.js +18 -2
- package/dist/mcp/build-server.d.ts +2 -0
- package/dist/mcp/build-server.js +45 -4
- package/dist/mcp/embed-app.js +52 -1
- package/dist/mcp/skills-extension.d.ts +42 -0
- package/dist/mcp/skills-extension.js +61 -0
- package/dist/org/migrations.d.ts +1 -1
- package/dist/org/workspace-app-access.js +2 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +12 -12
- package/dist/provider-api/actions/provider-api.d.ts +8 -8
- package/dist/resources/handlers.d.ts +2 -2
- package/dist/server/action-discovery.js +7 -37
- package/dist/server/action-files.d.ts +15 -0
- package/dist/server/action-files.js +71 -0
- package/dist/server/agent-chat/mcp-options.d.ts +3 -0
- package/dist/server/agent-chat/mcp-options.js +1 -0
- package/dist/server/agent-chat/plugin-options.d.ts +27 -3
- package/dist/server/agent-chat-plugin.d.ts +4 -5
- package/dist/server/agent-chat-plugin.js +34 -3
- package/dist/server/agent-teams.d.ts +15 -3
- package/dist/server/agent-teams.js +26 -4
- package/dist/server/dev-database-lifecycle.d.ts +11 -0
- package/dist/server/dev-database-lifecycle.js +11 -5
- package/dist/server/first-touch-route.d.ts +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/shared/analytics-panel-capture.d.ts +2 -1
- package/dist/shared/analytics-panel-capture.js +1 -0
- package/dist/shared/reasoning-effort.d.ts +9 -0
- package/dist/shared/reasoning-effort.js +19 -0
- package/dist/templates/chat/.agents/skills/actions/SKILL.md +2 -0
- package/dist/templates/default/.agents/skills/actions/SKILL.md +2 -0
- package/dist/templates/headless/.agents/skills/actions/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/composable-mini-apps/SKILL.md +7 -2
- package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +8 -8
- package/dist/templates/workspace-root/AGENTS.md +3 -0
- package/dist/templates/workspace-root/README.md +7 -2
- package/dist/vite/action-types-plugin.js +13 -42
- package/dist/vite/client.js +28 -17
- package/package.json +3 -3
- package/src/templates/chat/.agents/skills/actions/SKILL.md +2 -0
- package/src/templates/default/.agents/skills/actions/SKILL.md +2 -0
- package/src/templates/headless/.agents/skills/actions/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/composable-mini-apps/SKILL.md +7 -2
- package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +8 -8
- package/src/templates/workspace-root/AGENTS.md +3 -0
- package/src/templates/workspace-root/README.md +7 -2
|
@@ -456,10 +456,17 @@ function utf8ByteLength(value) {
|
|
|
456
456
|
* refused where its GETs would pass, so an embed keeps one request per call.
|
|
457
457
|
*/
|
|
458
458
|
function canBatchActionGet(options) {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
459
|
+
if (options?.batch !== true)
|
|
460
|
+
return false;
|
|
461
|
+
if (options.responseType === "blob") {
|
|
462
|
+
console.debug("[agent-native] Skipping action-GET batching: responseType is blob");
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
if (isEmbedAuthActive()) {
|
|
466
|
+
console.debug("[agent-native] Skipping action-GET batching: embed auth is active");
|
|
467
|
+
return false;
|
|
468
|
+
}
|
|
469
|
+
return true;
|
|
463
470
|
}
|
|
464
471
|
function waitForActionSend(gate, signal) {
|
|
465
472
|
if (!signal)
|
|
@@ -602,6 +609,9 @@ async function performActionFetch(name, method, params, options) {
|
|
|
602
609
|
init,
|
|
603
610
|
headers,
|
|
604
611
|
batchUrl: `${actionPrefix()}/${ACTION_BATCH_ACTION_NAME}`,
|
|
612
|
+
...(options?.batchGroup
|
|
613
|
+
? { batchGroup: options.batchGroup }
|
|
614
|
+
: {}),
|
|
605
615
|
})
|
|
606
616
|
: (() => {
|
|
607
617
|
try {
|
|
@@ -1375,7 +1385,7 @@ function canBatchActionQueryFetch(query) {
|
|
|
1375
1385
|
!query.observers.some((observer) => observer.options.meta?.[UNBATCHED_REFETCHES_META_KEY] === true));
|
|
1376
1386
|
}
|
|
1377
1387
|
export function useActionQuery(actionName, params, options) {
|
|
1378
|
-
const { refetchInterval, interactive = false, foregroundRefetch = false, retry: callerRetry, enabled: callerEnabled, queryKeyScope, resources, batchRefetches, onRequestStart, onServerResult, onServerError, method = "GET", beforeSend, uiOnly, retryUiCapability, ...restOptions } = options ?? {};
|
|
1388
|
+
const { refetchInterval, interactive = false, foregroundRefetch = false, retry: callerRetry, enabled: callerEnabled, queryKeyScope, resources, batchRefetches, batchInitial, onRequestStart, onServerResult, onServerError, method = "GET", beforeSend, uiOnly, retryUiCapability, ...restOptions } = options ?? {};
|
|
1379
1389
|
const queryKey = ["action", actionName, params, ...(queryKeyScope ?? [])];
|
|
1380
1390
|
const queryClient = useQueryClient();
|
|
1381
1391
|
const errorI18n = useContext(I18nContext)?.i18n;
|
|
@@ -1415,6 +1425,7 @@ export function useActionQuery(actionName, params, options) {
|
|
|
1415
1425
|
queryFn: async ({ signal, client }) => {
|
|
1416
1426
|
const key = circuitKey();
|
|
1417
1427
|
const query = client.getQueryCache().find({ queryKey, exact: true });
|
|
1428
|
+
const initialBatch = batchInitial === true && query?.state.data === undefined;
|
|
1418
1429
|
if (!restOptions.refetchIntervalInBackground && isSurfaceHidden())
|
|
1419
1430
|
throw new CancelledError({ revert: true });
|
|
1420
1431
|
const foreground = interactive && !isSurfaceHidden() && claimActionQueryForeground(query);
|
|
@@ -1440,7 +1451,9 @@ export function useActionQuery(actionName, params, options) {
|
|
|
1440
1451
|
visibleOnly: !restOptions.refetchIntervalInBackground,
|
|
1441
1452
|
uiOnly: uiOnly || interactive,
|
|
1442
1453
|
...(retryUiCapability === undefined ? {} : { retryUiCapability }),
|
|
1443
|
-
batch: method === "GET" &&
|
|
1454
|
+
batch: method === "GET" &&
|
|
1455
|
+
(initialBatch || canBatchActionQueryFetch(query)),
|
|
1456
|
+
...(initialBatch ? { batchGroup: "initial" } : {}),
|
|
1444
1457
|
onResponse: (response) => {
|
|
1445
1458
|
lastResponse = response;
|
|
1446
1459
|
onResponse(response);
|
|
@@ -13,9 +13,9 @@ export declare const postCollabPatch: import("h3").EventHandlerWithFetch<import(
|
|
|
13
13
|
ok: boolean;
|
|
14
14
|
}>>;
|
|
15
15
|
export declare const getCollabJson: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
16
|
-
data?: undefined;
|
|
17
16
|
error: string;
|
|
18
17
|
docId?: undefined;
|
|
18
|
+
data?: undefined;
|
|
19
19
|
} | {
|
|
20
20
|
error?: undefined;
|
|
21
21
|
docId: string;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@agent-native/agentkit": "0.
|
|
2
|
+
"@agent-native/agentkit": "0.234.0-nightly-20261125004429",
|
|
3
3
|
"@agent-native/code-agents-ui": "0.1.75",
|
|
4
|
-
"@agent-native/core": "0.
|
|
5
|
-
"@agent-native/core-corpus": "0.
|
|
4
|
+
"@agent-native/core": "0.234.0-nightly-20261125004429",
|
|
5
|
+
"@agent-native/core-corpus": "0.234.0-nightly-20261125004429",
|
|
6
6
|
"@agent-native/creative-context": "0.8.77",
|
|
7
|
-
"@agent-native/design-system": "0.
|
|
8
|
-
"@agent-native/dispatch": "0.43.
|
|
7
|
+
"@agent-native/design-system": "0.234.0-nightly-20261125004429",
|
|
8
|
+
"@agent-native/dispatch": "0.43.2-nightly-20261125004429",
|
|
9
9
|
"@agent-native/embedding": "0.2.0",
|
|
10
10
|
"@agent-native/migrate": "0.0.7",
|
|
11
11
|
"@agent-native/otel": "0.1.44",
|
|
12
12
|
"@agent-native/pinpoint": "0.1.120",
|
|
13
13
|
"@agent-native/recap-cli": "0.5.108",
|
|
14
|
-
"@agent-native/scheduling": "0.4.
|
|
14
|
+
"@agent-native/scheduling": "0.4.2-nightly-20261125004429",
|
|
15
15
|
"@agent-native/shared-app-config": "0.1.2",
|
|
16
|
-
"@agent-native/skills": "0.4.
|
|
17
|
-
"@agent-native/toolkit": "0.
|
|
16
|
+
"@agent-native/skills": "0.4.13-nightly-20261125004429",
|
|
17
|
+
"@agent-native/toolkit": "0.234.0-nightly-20261125004429"
|
|
18
18
|
}
|
package/dist/identity/rekey.js
CHANGED
|
@@ -292,6 +292,49 @@ const appIdentityGlobal = globalThis;
|
|
|
292
292
|
function appIdentityRegistry() {
|
|
293
293
|
return (appIdentityGlobal[APP_IDENTITY_COLUMNS_KEY] ??= new Map());
|
|
294
294
|
}
|
|
295
|
+
const FIRST_PARTY_APP_IDENTITY_COLUMNS = [
|
|
296
|
+
{
|
|
297
|
+
table: "dispatch_identity_links",
|
|
298
|
+
column: "owner_email",
|
|
299
|
+
emailChange: "rekey",
|
|
300
|
+
offboard: "delete",
|
|
301
|
+
reason: "A linked chat identity acts as its owner; transferring it would let the departed member act as the successor.",
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
table: "dispatch_link_tokens",
|
|
305
|
+
column: "owner_email",
|
|
306
|
+
emailChange: "rekey",
|
|
307
|
+
offboard: "delete",
|
|
308
|
+
reason: "An unclaimed link token binds a chat identity to its owner; the successor mints their own.",
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
table: "identity_sso_authorization_code",
|
|
312
|
+
column: "email",
|
|
313
|
+
emailChange: "delete",
|
|
314
|
+
offboard: "delete",
|
|
315
|
+
reason: "Unconsumed single-use code that asserts this address to an app; the member signs in again.",
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
table: "identity_sso_bootstrap",
|
|
319
|
+
column: "email",
|
|
320
|
+
emailChange: "delete",
|
|
321
|
+
offboard: "delete",
|
|
322
|
+
reason: "Unconsumed single-use sign-in bootstrap for this address; the member signs in again.",
|
|
323
|
+
},
|
|
324
|
+
...[
|
|
325
|
+
"dispatch_destinations",
|
|
326
|
+
"dispatch_dreams",
|
|
327
|
+
"dispatch_link_tokens",
|
|
328
|
+
"vault_secrets",
|
|
329
|
+
"workspace_resources",
|
|
330
|
+
].map((table) => ({
|
|
331
|
+
table,
|
|
332
|
+
column: "created_by",
|
|
333
|
+
emailChange: "retain",
|
|
334
|
+
offboard: "retain",
|
|
335
|
+
reason: "Creator attribution; ownership is owner_email.",
|
|
336
|
+
})),
|
|
337
|
+
];
|
|
295
338
|
const samePolicy = (a, b) => JSON.stringify({ ...a, reason: "" }) === JSON.stringify({ ...b, reason: "" });
|
|
296
339
|
/**
|
|
297
340
|
* Declare how an app's own identity-shaped columns behave on email change and
|
|
@@ -304,9 +347,16 @@ export function registerIdentityColumns(columns) {
|
|
|
304
347
|
...IDENTITY_REKEY_COLUMNS.map(({ table, column }) => `${table}.${column}`),
|
|
305
348
|
...IDENTITY_REKEY_IGNORED_COLUMNS,
|
|
306
349
|
]);
|
|
350
|
+
const firstParty = new Map(FIRST_PARTY_APP_IDENTITY_COLUMNS.map((entry) => [
|
|
351
|
+
`${entry.table}.${entry.column}`,
|
|
352
|
+
entry,
|
|
353
|
+
]));
|
|
307
354
|
const registry = appIdentityRegistry();
|
|
308
355
|
for (const entry of columns) {
|
|
309
356
|
const key = `${entry.table}.${entry.column}`;
|
|
357
|
+
const builtIn = firstParty.get(key);
|
|
358
|
+
if (builtIn && samePolicy(builtIn, entry))
|
|
359
|
+
continue;
|
|
310
360
|
const identifiers = [entry.table, entry.column];
|
|
311
361
|
if (entry.orgScope) {
|
|
312
362
|
identifiers.push(entry.orgScope.column);
|
|
@@ -323,7 +373,7 @@ export function registerIdentityColumns(columns) {
|
|
|
323
373
|
entry.offboard === "transfer" ||
|
|
324
374
|
entry.offboard === "revoke"))
|
|
325
375
|
throw new Error(`Identity column ${key} is secret-scoped; it can only be rekeyed or retained on email change and deleted or retained on offboard.`);
|
|
326
|
-
if (core.has(key))
|
|
376
|
+
if (core.has(key) || builtIn)
|
|
327
377
|
throw new Error(`Identity column ${key} is owned by the framework registry and cannot be redeclared by an app.`);
|
|
328
378
|
const existing = registry.get(key);
|
|
329
379
|
if (existing && !samePolicy(existing, entry))
|
|
@@ -357,7 +407,10 @@ function columnsByTable(rows) {
|
|
|
357
407
|
export function resolveIdentityColumns(rows) {
|
|
358
408
|
const entries = [
|
|
359
409
|
...IDENTITY_REKEY_COLUMNS,
|
|
360
|
-
...[
|
|
410
|
+
...[
|
|
411
|
+
...FIRST_PARTY_APP_IDENTITY_COLUMNS,
|
|
412
|
+
...appIdentityRegistry().values(),
|
|
413
|
+
].map(({ reason: _reason, mode, ...entry }) => mode === "secret-scope" ? { ...entry, mode } : entry),
|
|
361
414
|
];
|
|
362
415
|
const registered = new Set(entries.map(({ table, column }) => `${table}.${column}`));
|
|
363
416
|
const tables = columnsByTable(rows);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ActionAutomationContext, type ActionCaller } from "../action.js";
|
|
2
2
|
import type { AgentEngine } from "../agent/engine/types.js";
|
|
3
|
-
import { type ActionEntry } from "../agent/production-agent.js";
|
|
3
|
+
import { type ActionEntry, type AgentActionSurfaceDetails, type AgentActionSurfaceResolution } from "../agent/production-agent.js";
|
|
4
4
|
import { type AutomationExecutionIdentity } from "../automations/service.js";
|
|
5
5
|
import { type Resource } from "../resources/store.js";
|
|
6
6
|
import { type RequestContext } from "../server/request-context.js";
|
|
@@ -32,6 +32,12 @@ export interface BackgroundAutomationDeps {
|
|
|
32
32
|
workspaceAppsEnabled: boolean;
|
|
33
33
|
}) => Promise<string>;
|
|
34
34
|
getInitialToolNames?: (automation?: BackgroundAutomationContext) => string[] | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* The app's `resolveActionSurface`, applied to the tools a saved automation
|
|
37
|
+
* can discover and call. An allowlist withholds every other tool for the whole run,
|
|
38
|
+
* including after lazy `tool-search`.
|
|
39
|
+
*/
|
|
40
|
+
resolveActionSurface?: (details: AgentActionSurfaceDetails) => AgentActionSurfaceResolution | Promise<AgentActionSurfaceResolution>;
|
|
35
41
|
engine?: AgentEngine;
|
|
36
42
|
apiKey?: string;
|
|
37
43
|
model?: string;
|
|
@@ -5,7 +5,7 @@ import { getStoredModelForEngine, isResolvedEngineUsableForRequest, normalizeMod
|
|
|
5
5
|
import { resolveMainChatMaxOutputTokens } from "../agent/engine/output-tokens.js";
|
|
6
6
|
import { overlayCompletedExecutionStepOutcomes } from "../agent/engine/tool-call-journal-seed.js";
|
|
7
7
|
import { currentExecutionFence, StaleExecutionFenceError, } from "../agent/execution-fence.js";
|
|
8
|
-
import { actionsToEngineTools, filterInitialEngineTools, resolveOwnerEngineApiKey, appendAgentLoopContinuation, } from "../agent/production-agent.js";
|
|
8
|
+
import { actionsToEngineTools, filterInitialEngineTools, resolveOwnerEngineApiKey, appendAgentLoopContinuation, filterActionsByAllowedNames, normalizeAgentActionSurfaceResolution, } from "../agent/production-agent.js";
|
|
9
9
|
import { foldReapedRunIntoThread } from "../agent/reaped-run-thread.js";
|
|
10
10
|
import { AgentLoopAbortedError, runAgentLoopDirectWithSoftTimeout, } from "../agent/run-loop-with-resume.js";
|
|
11
11
|
import { abortRun, resolveBackgroundAutomationSoftTimeoutMs, resolveBackgroundRunHardTimeoutMs, startRun, } from "../agent/run-manager.js";
|
|
@@ -843,6 +843,22 @@ export async function checkBackgroundAutomationCredentials(identity, deps, autom
|
|
|
843
843
|
return { ok: false, failure: classifyAutomationFailure(error) };
|
|
844
844
|
}
|
|
845
845
|
}
|
|
846
|
+
async function surfaceAutomationActions(actions, deps, run) {
|
|
847
|
+
if (!deps.resolveActionSurface)
|
|
848
|
+
return actions;
|
|
849
|
+
const surface = normalizeAgentActionSurfaceResolution(await deps.resolveActionSurface({
|
|
850
|
+
event: undefined,
|
|
851
|
+
ownerEmail: run.ownerEmail,
|
|
852
|
+
orgId: run.orgId ?? null,
|
|
853
|
+
mode: "act",
|
|
854
|
+
internalContinuation: false,
|
|
855
|
+
automation: { name: run.automation.name },
|
|
856
|
+
availableActionNames: Object.keys(actions),
|
|
857
|
+
}));
|
|
858
|
+
if (surface.mode === "default")
|
|
859
|
+
return actions;
|
|
860
|
+
return filterActionsByAllowedNames(actions, surface.allowedActionNames);
|
|
861
|
+
}
|
|
846
862
|
async function executeBackgroundAutomation(options, deps, historyId, runIdRef) {
|
|
847
863
|
const { automation, ownerEmail, orgId, prompt, threadTitle, usageLabel } = options;
|
|
848
864
|
return runWithRequestContext({
|
|
@@ -853,7 +869,7 @@ async function executeBackgroundAutomation(options, deps, historyId, runIdRef) {
|
|
|
853
869
|
assertHardDeadline(options.hardDeadlineAt);
|
|
854
870
|
let noOpReason;
|
|
855
871
|
const messages = await automationOutcomeMessagesForUser(ownerEmail);
|
|
856
|
-
const registeredActions = await deps.getActions(automation);
|
|
872
|
+
const registeredActions = await surfaceAutomationActions(await deps.getActions(automation), deps, { automation, ownerEmail, orgId });
|
|
857
873
|
const baseActions = {
|
|
858
874
|
...(automation.meta.mcpManaged
|
|
859
875
|
? Object.fromEntries(Object.entries(registeredActions)
|
|
@@ -61,6 +61,8 @@ export interface MCPConfig {
|
|
|
61
61
|
builtinCrossAppTools?: boolean;
|
|
62
62
|
/** Opt in to an MCP-only, strictly read-only resource lookup. */
|
|
63
63
|
readOnlyResources?: boolean;
|
|
64
|
+
/** Serve the `an` skill through the MCP Skills extension (SEP-2640). */
|
|
65
|
+
servesAnSkill?: boolean;
|
|
64
66
|
/** Server-only candidate source; it must enforce current workspace grants. */
|
|
65
67
|
taskCandidates?: (input: {
|
|
66
68
|
callableActionNames: readonly string[];
|
package/dist/mcp/build-server.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../authorization/check-action.js";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
import { A2A_ORG_MEMBER_DELEGATION_TYPE, organizationPrincipalClaims, verifyA2AOrganizationIdentity, } from "../a2a/organization-identity.js";
|
|
3
4
|
import { isMcpReadOnlyTool } from "../action-call-classification.js";
|
|
4
5
|
import { MCP_APP_EXTENSION_ID, MCP_APP_MIME_TYPE, MCP_APP_RESOURCE_URI_META_KEY, } from "../action.js";
|
|
@@ -29,6 +30,7 @@ import { mcpApprovalPrompt, mcpApprovalRelativeLinkNote, mcpApprovalReviewUrl, }
|
|
|
29
30
|
import { mcpApprovalAppId } from "./approval-store.js";
|
|
30
31
|
import { runWithMcpChatTurnCall } from "./chat-turn-scope.js";
|
|
31
32
|
import { isFrameworkMcpTool } from "./framework-tools.js";
|
|
33
|
+
import { MCP_SKILLS_EXTENSION_ID, getMcpSkill, listMcpSkills, readMcpSkillFile, } from "./skills-extension.js";
|
|
32
34
|
import { admitWithMcpTurnGrantAdmitters, } from "./turn-grant-admitters.js";
|
|
33
35
|
import { recordTurnGrantConnectCredential } from "./turn-grant-identity.js";
|
|
34
36
|
import { actionUserTurn, isAgentTurnGrantContext, MCP_USER_TURN_META_KEY, requiresTurnGrantPageApproval, runWithMcpTurnGrantScope, runWithoutMcpTurnGrantScope, } from "./turn-grant-scope.js";
|
|
@@ -2658,6 +2660,7 @@ export async function createMCPServerForRequest(config, identity, requestMeta) {
|
|
|
2658
2660
|
const pointedScriptCatalog = scriptCatalogOffered && !scriptCatalog
|
|
2659
2661
|
? await scriptCatalogForPointer()
|
|
2660
2662
|
: undefined;
|
|
2663
|
+
const servesSkills = config.servesAnSkill === true && Boolean(effectiveIdentity?.userEmail);
|
|
2661
2664
|
const server = new Server(mcpServerInfo(config, requestMeta), {
|
|
2662
2665
|
instructions: directoryCatalog
|
|
2663
2666
|
? config.directoryProfile?.instructions
|
|
@@ -2667,13 +2670,18 @@ export async function createMCPServerForRequest(config, identity, requestMeta) {
|
|
|
2667
2670
|
isAdvertisable(TOOL_SEARCH_TOOL_NAME)), pointedScriptCatalog),
|
|
2668
2671
|
capabilities: {
|
|
2669
2672
|
tools: {},
|
|
2670
|
-
...(supportsMcpApps
|
|
2673
|
+
...(supportsMcpApps || servesSkills
|
|
2671
2674
|
? {
|
|
2672
2675
|
resources: {},
|
|
2673
2676
|
extensions: {
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
+
...(supportsMcpApps
|
|
2678
|
+
? {
|
|
2679
|
+
[MCP_APP_EXTENSION_ID]: {
|
|
2680
|
+
mimeTypes: [MCP_APP_MIME_TYPE],
|
|
2681
|
+
},
|
|
2682
|
+
}
|
|
2683
|
+
: {}),
|
|
2684
|
+
...(servesSkills ? { [MCP_SKILLS_EXTENSION_ID]: {} } : {}),
|
|
2677
2685
|
},
|
|
2678
2686
|
}
|
|
2679
2687
|
: {}),
|
|
@@ -3596,6 +3604,9 @@ export async function createMCPServerForRequest(config, identity, requestMeta) {
|
|
|
3596
3604
|
const grantedActions = await grantedResourceActions("mcp:resources/read");
|
|
3597
3605
|
return await withCallerContext(async () => {
|
|
3598
3606
|
const uri = request.params?.uri;
|
|
3607
|
+
const skillFile = servesSkills ? readMcpSkillFile(uri) : null;
|
|
3608
|
+
if (skillFile)
|
|
3609
|
+
return skillFile;
|
|
3599
3610
|
let found = null;
|
|
3600
3611
|
const resourceActions = requestMeta.inlineMcpApps &&
|
|
3601
3612
|
mcpAppWidgetsEnabledForIdentity(config, effectiveIdentity)
|
|
@@ -3642,6 +3653,36 @@ export async function createMCPServerForRequest(config, identity, requestMeta) {
|
|
|
3642
3653
|
}
|
|
3643
3654
|
});
|
|
3644
3655
|
}
|
|
3656
|
+
if (servesSkills) {
|
|
3657
|
+
const notFound = (uri) => new ResourceNotFoundError(String(uri ?? ""), `Skill not found: ${uri}`);
|
|
3658
|
+
const skillParams = z.object({
|
|
3659
|
+
uri: z.string().optional(),
|
|
3660
|
+
cursor: z.string().optional(),
|
|
3661
|
+
});
|
|
3662
|
+
server.setRequestHandler("skills/list", { params: skillParams }, async () => {
|
|
3663
|
+
await resolveServiceGrant("mcp:skills/list");
|
|
3664
|
+
return listMcpSkills();
|
|
3665
|
+
});
|
|
3666
|
+
server.setRequestHandler("skills/get", { params: skillParams }, async (params) => {
|
|
3667
|
+
await resolveServiceGrant("mcp:skills/get");
|
|
3668
|
+
const result = getMcpSkill(params.uri);
|
|
3669
|
+
if (!result)
|
|
3670
|
+
throw notFound(params.uri);
|
|
3671
|
+
return result;
|
|
3672
|
+
});
|
|
3673
|
+
if (!supportsMcpApps) {
|
|
3674
|
+
server.setRequestHandler("resources/list", async () => ({
|
|
3675
|
+
resources: [],
|
|
3676
|
+
}));
|
|
3677
|
+
server.setRequestHandler("resources/read", async (request) => {
|
|
3678
|
+
await resolveServiceGrant("mcp:resources/read");
|
|
3679
|
+
const skillFile = readMcpSkillFile(request.params?.uri);
|
|
3680
|
+
if (!skillFile)
|
|
3681
|
+
throw notFound(request.params?.uri);
|
|
3682
|
+
return skillFile;
|
|
3683
|
+
});
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3645
3686
|
return server;
|
|
3646
3687
|
}
|
|
3647
3688
|
export function getAccessTokens() {
|
package/dist/mcp/embed-app.js
CHANGED
|
@@ -1154,6 +1154,51 @@ export function embedApp(options = {}) {
|
|
|
1154
1154
|
base,
|
|
1155
1155
|
...nodes.map((node) => document.importNode(node, true))
|
|
1156
1156
|
);
|
|
1157
|
+
installBaseUrlFallback(baseHref);
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
// Claude's sandbox CSP sets base-uri 'self', so the base element above is
|
|
1161
|
+
// ignored there and URLs React creates after hydration (modulepreload
|
|
1162
|
+
// links, route chunks) would resolve against the sandbox origin and 404.
|
|
1163
|
+
function installBaseUrlFallback(baseHref) {
|
|
1164
|
+
if (document.baseURI === baseHref) return;
|
|
1165
|
+
const absolute = (value) => {
|
|
1166
|
+
if (
|
|
1167
|
+
typeof value !== "string" ||
|
|
1168
|
+
!value ||
|
|
1169
|
+
/^(?:[a-z][a-z0-9+.-]*:|\\/\\/|#)/i.test(value)
|
|
1170
|
+
) {
|
|
1171
|
+
return value;
|
|
1172
|
+
}
|
|
1173
|
+
try {
|
|
1174
|
+
return new URL(value, baseHref).href;
|
|
1175
|
+
} catch (_err) {
|
|
1176
|
+
return value;
|
|
1177
|
+
}
|
|
1178
|
+
};
|
|
1179
|
+
const nativeSetAttribute = Element.prototype.setAttribute;
|
|
1180
|
+
Element.prototype.setAttribute = function(name, value) {
|
|
1181
|
+
const key = String(name).toLowerCase();
|
|
1182
|
+
const resource =
|
|
1183
|
+
(key === "href" && (this instanceof HTMLLinkElement)) ||
|
|
1184
|
+
(key === "src" && (this instanceof HTMLScriptElement || this instanceof HTMLImageElement));
|
|
1185
|
+
return nativeSetAttribute.call(this, name, resource ? absolute(value) : value);
|
|
1186
|
+
};
|
|
1187
|
+
const targets = [
|
|
1188
|
+
[HTMLLinkElement, "href"],
|
|
1189
|
+
[HTMLScriptElement, "src"],
|
|
1190
|
+
[HTMLImageElement, "src"]
|
|
1191
|
+
];
|
|
1192
|
+
for (const [ctor, prop] of targets) {
|
|
1193
|
+
const descriptor = Object.getOwnPropertyDescriptor(ctor.prototype, prop);
|
|
1194
|
+
if (!descriptor || !descriptor.set) continue;
|
|
1195
|
+
Object.defineProperty(ctor.prototype, prop, {
|
|
1196
|
+
...descriptor,
|
|
1197
|
+
set(value) {
|
|
1198
|
+
descriptor.set.call(this, absolute(value));
|
|
1199
|
+
}
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1157
1202
|
}
|
|
1158
1203
|
|
|
1159
1204
|
function isModuleScript(script) {
|
|
@@ -3313,7 +3358,13 @@ export function embedApp(options = {}) {
|
|
|
3313
3358
|
|
|
3314
3359
|
try {
|
|
3315
3360
|
const nativeStartup = startNativeMcpAppsBridge();
|
|
3316
|
-
|
|
3361
|
+
// ChatGPT may leave ui/initialize unanswered; the pane must not wait out
|
|
3362
|
+
// that 5 s timeout before telling the host it is ready.
|
|
3363
|
+
const openAiStartup = waitForOpenAiBridge().then((bridge) => {
|
|
3364
|
+
const synced = syncOpenAiBridge(bridge);
|
|
3365
|
+
if (synced) notifyOuterMcpAppReady();
|
|
3366
|
+
return synced;
|
|
3367
|
+
});
|
|
3317
3368
|
await Promise.all([
|
|
3318
3369
|
openAiStartup,
|
|
3319
3370
|
nativeStartup.catch(async (nativeErr) => {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** MCP Skills extension (SEP-2640): skills are files served as `skill://` resources. */
|
|
2
|
+
export declare const MCP_SKILLS_EXTENSION_ID = "io.modelcontextprotocol/skills";
|
|
3
|
+
interface ServedFile {
|
|
4
|
+
uri: string;
|
|
5
|
+
text: string;
|
|
6
|
+
mimeType: string;
|
|
7
|
+
}
|
|
8
|
+
interface SkillEntry {
|
|
9
|
+
uri: string;
|
|
10
|
+
frontmatter: Record<string, unknown>;
|
|
11
|
+
resources: {
|
|
12
|
+
uri: string;
|
|
13
|
+
digest: string;
|
|
14
|
+
size: number;
|
|
15
|
+
}[];
|
|
16
|
+
}
|
|
17
|
+
export declare function buildSkill(name: string, skillMd: string): {
|
|
18
|
+
entry: SkillEntry;
|
|
19
|
+
files: ServedFile[];
|
|
20
|
+
};
|
|
21
|
+
export declare function listMcpSkills(): {
|
|
22
|
+
resultType: "complete";
|
|
23
|
+
ttlMs: 0;
|
|
24
|
+
cacheScope: "private";
|
|
25
|
+
skills: SkillEntry[];
|
|
26
|
+
};
|
|
27
|
+
/** The entry for a skill's `SKILL.md` uri, or null when this server does not serve it. */
|
|
28
|
+
export declare function getMcpSkill(uri: unknown): {
|
|
29
|
+
resultType: "complete";
|
|
30
|
+
ttlMs: 0;
|
|
31
|
+
cacheScope: "private";
|
|
32
|
+
skill: SkillEntry;
|
|
33
|
+
} | null;
|
|
34
|
+
/** The contents of a served skill file, or null for any other uri. */
|
|
35
|
+
export declare function readMcpSkillFile(uri: unknown): {
|
|
36
|
+
contents: {
|
|
37
|
+
uri: string;
|
|
38
|
+
mimeType: string;
|
|
39
|
+
text: string;
|
|
40
|
+
}[];
|
|
41
|
+
} | null;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { parse as parseYaml } from "yaml";
|
|
3
|
+
import { AN_SKILL_MD } from "../cli/skills-content/an-skill.js";
|
|
4
|
+
/** MCP Skills extension (SEP-2640): skills are files served as `skill://` resources. */
|
|
5
|
+
export const MCP_SKILLS_EXTENSION_ID = "io.modelcontextprotocol/skills";
|
|
6
|
+
export function buildSkill(name, skillMd) {
|
|
7
|
+
const match = /^---\r?\n([\s\S]*?)\r?\n---/.exec(skillMd);
|
|
8
|
+
const yamlText = match?.at(1);
|
|
9
|
+
const frontmatter = yamlText === undefined ? null : parseYaml(yamlText);
|
|
10
|
+
if (!frontmatter ||
|
|
11
|
+
typeof frontmatter !== "object" ||
|
|
12
|
+
frontmatter.name !== name ||
|
|
13
|
+
typeof frontmatter.description !== "string") {
|
|
14
|
+
throw new Error(`Skill ${name} needs frontmatter with its name and description`);
|
|
15
|
+
}
|
|
16
|
+
const skillFile = {
|
|
17
|
+
uri: `skill://${name}/SKILL.md`,
|
|
18
|
+
text: skillMd,
|
|
19
|
+
mimeType: "text/markdown",
|
|
20
|
+
};
|
|
21
|
+
const files = [skillFile];
|
|
22
|
+
const entry = {
|
|
23
|
+
uri: skillFile.uri,
|
|
24
|
+
frontmatter,
|
|
25
|
+
resources: files.map((file) => {
|
|
26
|
+
const bytes = Buffer.from(file.text, "utf8");
|
|
27
|
+
return {
|
|
28
|
+
uri: file.uri,
|
|
29
|
+
digest: `sha256:${createHash("sha256").update(bytes).digest("hex")}`,
|
|
30
|
+
size: bytes.length,
|
|
31
|
+
};
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
return { entry, files };
|
|
35
|
+
}
|
|
36
|
+
let cached;
|
|
37
|
+
function anSkill() {
|
|
38
|
+
return (cached ??= buildSkill("an", AN_SKILL_MD));
|
|
39
|
+
}
|
|
40
|
+
const FRESHNESS = {
|
|
41
|
+
resultType: "complete",
|
|
42
|
+
ttlMs: 0,
|
|
43
|
+
cacheScope: "private",
|
|
44
|
+
};
|
|
45
|
+
export function listMcpSkills() {
|
|
46
|
+
return { ...FRESHNESS, skills: [anSkill().entry] };
|
|
47
|
+
}
|
|
48
|
+
/** The entry for a skill's `SKILL.md` uri, or null when this server does not serve it. */
|
|
49
|
+
export function getMcpSkill(uri) {
|
|
50
|
+
const { entry } = anSkill();
|
|
51
|
+
return uri === entry.uri ? { ...FRESHNESS, skill: entry } : null;
|
|
52
|
+
}
|
|
53
|
+
/** The contents of a served skill file, or null for any other uri. */
|
|
54
|
+
export function readMcpSkillFile(uri) {
|
|
55
|
+
const file = anSkill().files.find((candidate) => candidate.uri === uri);
|
|
56
|
+
return file
|
|
57
|
+
? {
|
|
58
|
+
contents: [{ uri: file.uri, mimeType: file.mimeType, text: file.text }],
|
|
59
|
+
}
|
|
60
|
+
: null;
|
|
61
|
+
}
|
package/dist/org/migrations.d.ts
CHANGED
|
@@ -279,7 +279,7 @@ async function resolveHostedWorkspaceAppAuth(configuredDirectory, context, email
|
|
|
279
279
|
const delegatedMember = requestContext?.a2aIdentityAssurance === "org-member";
|
|
280
280
|
const orgDomain = orgId ? await cachedOrgDomain(orgId) : null;
|
|
281
281
|
const normalizedOrgDomain = orgDomain?.trim() || undefined;
|
|
282
|
-
if (orgId && !normalizedOrgDomain) {
|
|
282
|
+
if (orgId && !normalizedOrgDomain && delegatedMember) {
|
|
283
283
|
return workspaceAppAccessUnavailable("org-domain-missing", { audience });
|
|
284
284
|
}
|
|
285
285
|
stage = "token-signing-failed";
|
|
@@ -332,6 +332,7 @@ async function resolveHostedWorkspaceAppAuth(configuredDirectory, context, email
|
|
|
332
332
|
audience,
|
|
333
333
|
extraClaims: {
|
|
334
334
|
jti: randomUUID(),
|
|
335
|
+
...(orgId && !normalizedOrgDomain ? { org_id: orgId } : {}),
|
|
335
336
|
},
|
|
336
337
|
});
|
|
337
338
|
}
|
|
@@ -75,9 +75,9 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
75
75
|
user: "user";
|
|
76
76
|
}>>;
|
|
77
77
|
}, z.core.$strip>>, {
|
|
78
|
-
provider?: undefined;
|
|
79
78
|
id?: undefined;
|
|
80
79
|
message?: undefined;
|
|
80
|
+
deleted?: undefined;
|
|
81
81
|
providers: {
|
|
82
82
|
id: string;
|
|
83
83
|
label: string;
|
|
@@ -88,46 +88,46 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
88
88
|
updatedAt: number;
|
|
89
89
|
}[];
|
|
90
90
|
count: number;
|
|
91
|
+
provider?: undefined;
|
|
91
92
|
found?: undefined;
|
|
92
|
-
deleted?: undefined;
|
|
93
93
|
registered?: undefined;
|
|
94
94
|
label?: undefined;
|
|
95
95
|
} | {
|
|
96
96
|
id?: undefined;
|
|
97
|
-
count?: undefined;
|
|
98
97
|
message?: undefined;
|
|
98
|
+
deleted?: undefined;
|
|
99
99
|
providers?: undefined;
|
|
100
|
+
count?: undefined;
|
|
100
101
|
found: boolean;
|
|
101
102
|
provider: import("../custom-registry.js").CustomProviderConfig;
|
|
102
|
-
deleted?: undefined;
|
|
103
103
|
registered?: undefined;
|
|
104
104
|
label?: undefined;
|
|
105
105
|
} | {
|
|
106
|
-
provider?: undefined;
|
|
107
|
-
count?: undefined;
|
|
108
106
|
message?: undefined;
|
|
107
|
+
deleted?: undefined;
|
|
109
108
|
providers?: undefined;
|
|
109
|
+
count?: undefined;
|
|
110
|
+
provider?: undefined;
|
|
110
111
|
found: boolean;
|
|
111
112
|
id: string;
|
|
112
|
-
deleted?: undefined;
|
|
113
113
|
registered?: undefined;
|
|
114
114
|
label?: undefined;
|
|
115
115
|
} | {
|
|
116
|
-
provider?: undefined;
|
|
117
|
-
count?: undefined;
|
|
118
116
|
message?: undefined;
|
|
119
117
|
providers?: undefined;
|
|
118
|
+
count?: undefined;
|
|
119
|
+
provider?: undefined;
|
|
120
120
|
found?: undefined;
|
|
121
121
|
deleted: boolean;
|
|
122
122
|
id: string;
|
|
123
123
|
registered?: undefined;
|
|
124
124
|
label?: undefined;
|
|
125
125
|
} | {
|
|
126
|
-
|
|
127
|
-
count?: undefined;
|
|
126
|
+
deleted?: undefined;
|
|
128
127
|
providers?: undefined;
|
|
128
|
+
count?: undefined;
|
|
129
|
+
provider?: undefined;
|
|
129
130
|
found?: undefined;
|
|
130
|
-
deleted?: undefined;
|
|
131
131
|
registered: boolean;
|
|
132
132
|
id: string;
|
|
133
133
|
label: string;
|