fix: resolve plugin tool meta typing
This commit is contained in:
@@ -3,7 +3,8 @@ import type { SessionManager } from "@mariozechner/pi-coding-agent";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import * as helpers from "./pi-embedded-helpers.js";
|
||||
|
||||
type SanitizeSessionHistory = typeof import("./pi-embedded-runner/google.js").sanitizeSessionHistory;
|
||||
type SanitizeSessionHistory =
|
||||
typeof import("./pi-embedded-runner/google.js").sanitizeSessionHistory;
|
||||
let sanitizeSessionHistory: SanitizeSessionHistory;
|
||||
|
||||
// Mock dependencies
|
||||
|
||||
@@ -262,20 +262,11 @@ export function createClawdbotCodingTools(options?: {
|
||||
toolMeta: (tool) => getPluginToolMeta(tool),
|
||||
});
|
||||
const profilePolicyExpanded = expandPolicyWithPluginGroups(profilePolicy, pluginGroups);
|
||||
const providerProfileExpanded = expandPolicyWithPluginGroups(
|
||||
providerProfilePolicy,
|
||||
pluginGroups,
|
||||
);
|
||||
const providerProfileExpanded = expandPolicyWithPluginGroups(providerProfilePolicy, pluginGroups);
|
||||
const globalPolicyExpanded = expandPolicyWithPluginGroups(globalPolicy, pluginGroups);
|
||||
const globalProviderExpanded = expandPolicyWithPluginGroups(
|
||||
globalProviderPolicy,
|
||||
pluginGroups,
|
||||
);
|
||||
const globalProviderExpanded = expandPolicyWithPluginGroups(globalProviderPolicy, pluginGroups);
|
||||
const agentPolicyExpanded = expandPolicyWithPluginGroups(agentPolicy, pluginGroups);
|
||||
const agentProviderExpanded = expandPolicyWithPluginGroups(
|
||||
agentProviderPolicy,
|
||||
pluginGroups,
|
||||
);
|
||||
const agentProviderExpanded = expandPolicyWithPluginGroups(agentProviderPolicy, pluginGroups);
|
||||
const sandboxPolicyExpanded = expandPolicyWithPluginGroups(sandbox?.tools, pluginGroups);
|
||||
const subagentPolicyExpanded = expandPolicyWithPluginGroups(subagentPolicy, pluginGroups);
|
||||
|
||||
|
||||
@@ -109,9 +109,7 @@ export function expandToolGroups(list?: string[]) {
|
||||
return Array.from(new Set(expanded));
|
||||
}
|
||||
|
||||
export function collectExplicitAllowlist(
|
||||
policies: Array<ToolPolicyLike | undefined>,
|
||||
): string[] {
|
||||
export function collectExplicitAllowlist(policies: Array<ToolPolicyLike | undefined>): string[] {
|
||||
const entries: string[] = [];
|
||||
for (const policy of policies) {
|
||||
if (!policy?.allow) continue;
|
||||
@@ -124,9 +122,9 @@ export function collectExplicitAllowlist(
|
||||
return entries;
|
||||
}
|
||||
|
||||
export function buildPluginToolGroups(params: {
|
||||
tools: Array<{ name: string }>;
|
||||
toolMeta: (tool: { name: string }) => { pluginId: string } | undefined;
|
||||
export function buildPluginToolGroups<T extends { name: string }>(params: {
|
||||
tools: T[];
|
||||
toolMeta: (tool: T) => { pluginId: string } | undefined;
|
||||
}): PluginToolGroups {
|
||||
const all: string[] = [];
|
||||
const byPlugin = new Map<string, string[]>();
|
||||
|
||||
Reference in New Issue
Block a user