veryfront 0.1.1004 → 0.1.1005
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/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-stream.d.ts","sourceRoot":"","sources":["../../../src/src/internal-agents/run-stream.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,YAAY,IAAI,OAAO,EAC5B,KAAK,aAAa,EAEnB,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,KAAK,EACV,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"run-stream.d.ts","sourceRoot":"","sources":["../../../src/src/internal-agents/run-stream.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,YAAY,IAAI,OAAO,EAC5B,KAAK,aAAa,EAEnB,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,KAAK,EACV,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,qBAAqB,CAAC;AAU7B,OAAO,EAAmB,KAAK,IAAI,EAAgB,MAAM,kBAAkB,CAAC;AAU5E,OAAO,EAA0B,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAsCxD,MAAM,WAAW,+BAA+B;IAC9C,cAAc,EAAE,sBAAsB,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC,CAAC;IAC5C,mBAAmB,CAAC,EAAE;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,cAAc,CAAC,EAAE,+BAA+B,CAAC,gBAAgB,CAAC,CAAC;IACnE,8BAA8B,CAAC,EAAE,CAC/B,KAAK,EAAE,+BAA+B,KACnC,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAC7C,aAAa,CAAC,EAAE,CACd,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAClC;QACH,MAAM,EAAE,CACN,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,SAAS,CAAC,EAAE;YACV,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;SAC9C,EACD,aAAa,CAAC,EAAE,MAAM,EACtB,uBAAuB,CAAC,EAAE,MAAM,EAChC,WAAW,CAAC,EAAE,WAAW,KACtB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;KAC1C,CAAC;CACH;AAoCD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,oBAAoB,EAC3B,cAAc,EAAE,sBAAsB,EACtC,2BAA2B,CAAC,EAAE,MAAM,EAAE,EACtC,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC;;cAsFrD;AAyOD,wBAAsB,gCAAgC,CACpD,KAAK,EAAE,oBAAoB,EAC3B,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,+BAA+B,GACpC,OAAO,CAAC,QAAQ,CAAC,CAoVnB"}
|
|
@@ -7,6 +7,7 @@ import { createAgentServiceSandboxTools } from "../sandbox/index.js";
|
|
|
7
7
|
import { tryResolve } from "../extensions/contracts.js";
|
|
8
8
|
import { importFirstPartyExtensionModule } from "../extensions/first-party-import.js";
|
|
9
9
|
import { SandboxShellToolsProviderName, } from "../extensions/sandbox/index.js";
|
|
10
|
+
import { resolveHostedRuntimeAllowedToolNames } from "../agent/hosted/runtime-essential-tools.js";
|
|
10
11
|
import { SKILL_TOOL_IDS } from "../skill/types.js";
|
|
11
12
|
import { isToolVisibleTo, toolRegistry } from "../tool/index.js";
|
|
12
13
|
import { defineSchema, lazySchema } from "../schemas/index.js";
|
|
@@ -209,6 +210,54 @@ function getAllowedRemoteToolNames(forwardedProps) {
|
|
|
209
210
|
}
|
|
210
211
|
return allowedTools.every((toolName) => typeof toolName === "string") ? allowedTools : [];
|
|
211
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Reads the restrictive `runtimeOverrides.toolAllowlist` override.
|
|
215
|
+
*
|
|
216
|
+
* Unlike `runtimeOverrides.allowedTools` — which this path treats as an
|
|
217
|
+
* additive grant list (Studio forwards integration/studio tool names it wants
|
|
218
|
+
* attached on top of the agent's own surface) — `toolAllowlist` is a hard
|
|
219
|
+
* restriction: the model-visible tool set of the run is intersected with it.
|
|
220
|
+
* Scheduled automations declare it via schedule `input.runtimeOverrides` for
|
|
221
|
+
* defense in depth. Returns null when absent (no restriction); a present but
|
|
222
|
+
* malformed value fails closed to an empty allowlist.
|
|
223
|
+
*/
|
|
224
|
+
function getRuntimeToolAllowlist(forwardedProps) {
|
|
225
|
+
const runtimeOverrides = isRecord(forwardedProps?.runtimeOverrides)
|
|
226
|
+
? forwardedProps.runtimeOverrides
|
|
227
|
+
: null;
|
|
228
|
+
if (!runtimeOverrides || !Object.hasOwn(runtimeOverrides, "toolAllowlist")) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
const toolAllowlist = runtimeOverrides.toolAllowlist;
|
|
232
|
+
if (!Array.isArray(toolAllowlist)) {
|
|
233
|
+
return new Set();
|
|
234
|
+
}
|
|
235
|
+
return new Set(toolAllowlist.filter((toolName) => typeof toolName === "string" && toolName.length > 0));
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Intersects the merged run tool set with the restrictive tool allowlist.
|
|
239
|
+
* Skill runtime/delegation tools are preserved for skill-enabled agents,
|
|
240
|
+
* mirroring the hosted chat runtime's allowlist semantics.
|
|
241
|
+
*/
|
|
242
|
+
function applyRuntimeToolAllowlist(mergedTools, toolAllowlist, agent) {
|
|
243
|
+
if (!toolAllowlist || !mergedTools || mergedTools === true) {
|
|
244
|
+
return mergedTools;
|
|
245
|
+
}
|
|
246
|
+
const availableSkillIds = agent.config.skills === true
|
|
247
|
+
? ["*"]
|
|
248
|
+
: Array.isArray(agent.config.skills)
|
|
249
|
+
? agent.config.skills
|
|
250
|
+
: undefined;
|
|
251
|
+
const allowedToolNames = resolveHostedRuntimeAllowedToolNames({
|
|
252
|
+
allowedToolNames: toolAllowlist,
|
|
253
|
+
localToolNames: Object.keys(mergedTools),
|
|
254
|
+
...(availableSkillIds ? { availableSkillIds } : {}),
|
|
255
|
+
});
|
|
256
|
+
if (!allowedToolNames) {
|
|
257
|
+
return mergedTools;
|
|
258
|
+
}
|
|
259
|
+
return Object.fromEntries(Object.entries(mergedTools).filter(([toolName]) => allowedToolNames.has(toolName)));
|
|
260
|
+
}
|
|
212
261
|
function getServerResolvedProjectToolNames(forwardedProps) {
|
|
213
262
|
const runtimeOverrides = isRecord(forwardedProps?.runtimeOverrides)
|
|
214
263
|
? forwardedProps.runtimeOverrides
|
|
@@ -257,9 +306,21 @@ export async function createRuntimeAgentStreamResponse(input, agent, deps) {
|
|
|
257
306
|
});
|
|
258
307
|
const forwardedAllowedRemoteToolNames = getAllowedRemoteToolNames(input.forwardedProps);
|
|
259
308
|
const sourceAllowedRemoteToolNames = getAgentAllowedRemoteToolNames(agent);
|
|
260
|
-
const
|
|
309
|
+
const grantedRemoteToolNames = forwardedAllowedRemoteToolNames === undefined
|
|
261
310
|
? undefined
|
|
262
311
|
: mergeRemoteToolNames(sourceAllowedRemoteToolNames, forwardedAllowedRemoteToolNames);
|
|
312
|
+
// A restrictive toolAllowlist caps remote exposure too: it intersects the
|
|
313
|
+
// tightest existing remote filter (forwarded grants, else the agent source's
|
|
314
|
+
// own __vfAllowedRemoteTools), and with neither present it becomes the
|
|
315
|
+
// remote filter directly. It can only narrow what the agent's sources
|
|
316
|
+
// already expose, never add.
|
|
317
|
+
const runtimeToolAllowlist = getRuntimeToolAllowlist(input.forwardedProps);
|
|
318
|
+
const sourceRemoteFilterBase = Object.hasOwn(agent.config, "__vfAllowedRemoteTools")
|
|
319
|
+
? sourceAllowedRemoteToolNames
|
|
320
|
+
: undefined;
|
|
321
|
+
const allowedRemoteToolNames = runtimeToolAllowlist === null
|
|
322
|
+
? grantedRemoteToolNames
|
|
323
|
+
: (grantedRemoteToolNames ?? sourceRemoteFilterBase ?? [...runtimeToolAllowlist]).filter((toolName) => runtimeToolAllowlist.has(toolName));
|
|
263
324
|
const forwardedIntegrationToolDefs = getForwardedIntegrationToolDefinitions(input.forwardedProps);
|
|
264
325
|
const availableForwardedToolNames = forwardedIntegrationToolDefs?.map((tool) => tool.name);
|
|
265
326
|
const sandboxTools = await buildProjectAgentSandboxTools({ agent, deps });
|
|
@@ -267,7 +328,7 @@ export async function createRuntimeAgentStreamResponse(input, agent, deps) {
|
|
|
267
328
|
...(deps.localTools ?? {}),
|
|
268
329
|
...(sandboxTools.tools ?? {}),
|
|
269
330
|
};
|
|
270
|
-
const mergedTools = buildMergedTools(agent, input, deps.sessionManager, availableForwardedToolNames, Object.keys(availableLocalTools).length > 0 ? availableLocalTools : undefined);
|
|
331
|
+
const mergedTools = applyRuntimeToolAllowlist(buildMergedTools(agent, input, deps.sessionManager, availableForwardedToolNames, Object.keys(availableLocalTools).length > 0 ? availableLocalTools : undefined), runtimeToolAllowlist, agent);
|
|
271
332
|
const runtimeAgent = {
|
|
272
333
|
...agent,
|
|
273
334
|
config: {
|