danny-avila--librechat
e115934061
Publish `@librechat/data-schemas` to NPM / pack (push) Failing after 8s
Publish `@librechat/client` to NPM / pack (push) Failing after 0s
GitNexus Index / index (push) Failing after 1s
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Has been skipped
Sync Helm Chart Tags / Sync chart tags (push) Failing after 2s
Publish `librechat-data-provider` to NPM / pack (push) Failing after 1s
Docker Dev Images Build / build (Dockerfile, librechat-dev, node) (push) Failing after 1s
Docker Dev Images Build / build (Dockerfile.multi, librechat-dev-api, api-build) (push) Failing after 0s
Sync Helm Chart Tags / Ignore non-main push (push) Has been skipped
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Failing after 1s
Publish `@librechat/client` to NPM / publish-npm (push) Has been cancelled
Publish `librechat-data-provider` to NPM / publish-npm (push) Has been cancelled
GitNexus Index / post-index (push) Has been cancelled
Publish `@librechat/data-schemas` to NPM / publish-npm (push) Has been cancelled
42 行
1.2 KiB
JavaScript
42 行
1.2 KiB
JavaScript
const availableTools = require('./manifest.json');
|
|
|
|
/** @type {Record<string, TPlugin | undefined>} */
|
|
const manifestToolMap = {};
|
|
|
|
/** @type {Array<TPlugin>} */
|
|
const toolkits = [];
|
|
|
|
availableTools.forEach((tool) => {
|
|
manifestToolMap[tool.pluginKey] = tool;
|
|
if (tool.toolkit === true) {
|
|
toolkits.push(tool);
|
|
}
|
|
});
|
|
|
|
/**
|
|
* Whether a tool (string pluginKey, or an OpenAI function-tool object) is
|
|
* flagged `agentsOnly` in the manifest — usable only on the agents runtime
|
|
* (e.g. `ask_user_question`, which pauses a LangGraph run via `interrupt()`).
|
|
* The legacy assistants runtime executes tools with no run to pause and no
|
|
* resume surface, so these must be rejected before assistant create/update —
|
|
* the tools-dialog scoping alone doesn't stop a REST client or a stale saved
|
|
* payload from posting the tool string directly.
|
|
*
|
|
* @param {string | { function?: { name?: string } } | undefined} tool
|
|
* @returns {boolean}
|
|
*/
|
|
function isAgentsOnlyTool(tool) {
|
|
const name = typeof tool === 'string' ? tool : tool?.function?.name;
|
|
if (!name) {
|
|
return false;
|
|
}
|
|
return manifestToolMap[name]?.agentsOnly === true;
|
|
}
|
|
|
|
module.exports = {
|
|
toolkits,
|
|
availableTools,
|
|
manifestToolMap,
|
|
isAgentsOnlyTool,
|
|
};
|