
























@@ -936,7 +936,7 @@ export function extractPluginCommandNames(payload) {
936936.toSorted((left, right) => left.localeCompare(right));
937937}
938938939-function extractToolEntries(payload) {
939+export function extractToolEntries(payload) {
940940return (Array.isArray(payload?.groups) ? payload.groups : []).flatMap((group) =>
941941Array.isArray(group?.tools) ? group.tools : [],
942942);
@@ -959,6 +959,31 @@ function assertIncludesAll(actual, expected, label) {
959959}
960960}
961961962+export function assertExpectedKitchenSinkToolEntries(
963+entries,
964+label,
965+{ requirePluginProvenance = false } = {},
966+) {
967+const ids = entries.map((entry) => entry?.id).filter(isNonEmptyString);
968+assertIncludesAll(ids, EXPECTED_TOOLS, label);
969+if (requirePluginProvenance) {
970+const wrongProvenance = entries
971+.filter((entry) => EXPECTED_TOOLS.includes(entry?.id))
972+.filter((entry) => entry.source !== "plugin" || entry.pluginId !== PLUGIN_ID)
973+.map((entry) => ({
974+id: entry?.id,
975+pluginId: entry?.pluginId,
976+source: entry?.source,
977+}));
978+if (wrongProvenance.length > 0) {
979+throw new Error(
980+`${label} plugin provenance mismatch: ${JSON.stringify(wrongProvenance)}`,
981+);
982+}
983+}
984+return ids;
985+}
986+962987function assertChannelAccountRunning(payload) {
963988const accounts = Array.isArray(payload?.channelAccounts?.[CHANNEL_ID])
964989 ? payload.channelAccounts[CHANNEL_ID]
@@ -970,13 +995,27 @@ function assertChannelAccountRunning(payload) {
970995return account;
971996}
972997973-function assertToolInvokeResult(payload) {
998+export function assertKitchenSinkSearchInvokeResult(payload) {
974999if (payload?.ok !== true || payload?.source !== "plugin") {
975-throw new Error(`Kitchen Sink tool invoke failed: ${JSON.stringify(payload)}`);
1000+throw new Error(`Kitchen Sink search tool invoke failed: ${JSON.stringify(payload)}`);
9761001}
9771002const text = JSON.stringify(payload.output ?? payload);
9781003if (!text.includes("Kitchen Sink image fixture")) {
979-throw new Error(`Kitchen Sink tool output missed expected fixture: ${text.slice(0, 1000)}`);
1004+throw new Error(
1005+`Kitchen Sink search tool output missed expected fixture: ${text.slice(0, 1000)}`,
1006+);
1007+}
1008+}
1009+1010+export function assertKitchenSinkTextInvokeResult(payload) {
1011+if (payload?.ok !== true || payload?.source !== "plugin") {
1012+throw new Error(`Kitchen Sink text tool invoke failed: ${JSON.stringify(payload)}`);
1013+}
1014+const text = JSON.stringify(payload.output ?? payload);
1015+if (!text.includes("tool:kitchen_sink_text") || !text.includes("Kitchen Sink")) {
1016+throw new Error(
1017+`Kitchen Sink text tool output missed expected fixture: ${text.slice(0, 1000)}`,
1018+);
9801019}
9811020}
9821021@@ -1608,12 +1647,11 @@ export async function main() {
16081647rpcOptions,
16091648);
16101649const catalogTools = extractToolEntries(catalog);
1611-const catalogToolIds = catalogTools.map((entry) => entry?.id).filter(isNonEmptyString);
1612-assertIncludesAny(catalogToolIds, EXPECTED_TOOLS, "tools.catalog plugin tools");
1613-const pluginTool = catalogTools.find((entry) => EXPECTED_TOOLS.includes(entry?.id));
1614-if (pluginTool?.source !== "plugin" || pluginTool?.pluginId !== PLUGIN_ID) {
1615-throw new Error(`tools.catalog plugin provenance missing: ${JSON.stringify(pluginTool)}`);
1616-}
1650+const catalogToolIds = assertExpectedKitchenSinkToolEntries(
1651+catalogTools,
1652+"tools.catalog plugin tools",
1653+{ requirePluginProvenance: true },
1654+);
1617165516181656const createdSession = await retryRpcCall(
16191657"sessions.create",
@@ -1625,10 +1663,12 @@ export async function main() {
16251663{ sessionKey: createdSession.key, agentId: "main" },
16261664rpcOptions,
16271665);
1628-const effectiveToolIds = extractToolEntries(effective).map((entry) => entry?.id);
1629-assertIncludesAny(effectiveToolIds, EXPECTED_TOOLS, "tools.effective plugin tools");
1666+assertExpectedKitchenSinkToolEntries(
1667+extractToolEntries(effective),
1668+"tools.effective plugin tools",
1669+);
163016701631-const invoked = await retryRpcCall(
1671+const searchInvoked = await retryRpcCall(
16321672"tools.invoke",
16331673{
16341674name: "kitchen_sink_search",
@@ -1639,7 +1679,20 @@ export async function main() {
16391679},
16401680rpcOptions,
16411681);
1642-assertToolInvokeResult(invoked);
1682+assertKitchenSinkSearchInvokeResult(searchInvoked);
1683+1684+const textInvoked = await retryRpcCall(
1685+"tools.invoke",
1686+{
1687+name: "kitchen_sink_text",
1688+args: { prompt: "explain kitchen sink rpc walk" },
1689+sessionKey: createdSession.key,
1690+agentId: "main",
1691+idempotencyKey: "kitchen-sink-rpc-text",
1692+},
1693+rpcOptions,
1694+);
1695+assertKitchenSinkTextInvokeResult(textInvoked);
1643169616441697const ttsProviders = await retryRpcCall("tts.providers", {}, rpcOptions);
16451698const ttsStatus = await retryRpcCall("tts.status", {}, rpcOptions);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。