@roll-agent/runtime 0.7.0 → 0.7.1

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.
@@ -1 +1 @@
1
- import{tool as e}from"ai";import{z as r}from"zod";import{SKILL_TOOL_ID as n}from"@roll-agent/core/skills/library";export const SKILL_TOOL_AGENT_NAME="roll";export const SKILL_TOOL_NAME="skill";export{n as SKILL_TOOL_ID};const o=6e4,t=r.object({name:r.string().min(1).describe("要加载的 skill 名称(见 system prompt 中的 Skills 目录)"),reference:r.string().min(1).optional().describe("可选:加载该 skill 的 references/ 下的某个文件,传相对路径如 references/workflows.md")});function i(e){return e.length<=o?e:`${e.slice(0,o)}\n\n[内容过长已截断,共 ${String(e.length)} 字符]`}function l(e,r){return void 0===e?r:[`SKILL_ROOT=${e}`,"这是该 skill 的 canonical absolute root。所有 scripts/、references/ 和其它相对路径必须相对 SKILL_ROOT 解析;执行脚本时将 workdir 设为 SKILL_ROOT,不要搜索其它 skill 目录。","",r].join("\n")}function s(e,r){return{output:`skill "${r}" 不存在。可用 skill: ${e.list().map(e=>e.name).join(", ")}`,isError:!0}}function c(e,r){const n=e.load(r);if(!n)return s(e,r);const o=n.referencePaths.length>0?`\n\n可用 references(传 reference 参数加载):\n${n.referencePaths.map(e=>`- ${e}`).join("\n")}`:"";return{output:l(n.skillRoot,`${i(n.content)}${o}`),isError:!1}}function u(e,r,n){if(!e.list().some(e=>e.name===r))return s(e,r);const o=void 0===e.loadReferenceDocument?void 0:e.loadReferenceDocument(r,n),t=void 0===e.loadReferenceDocument?e.loadReference(r,n):o?.content;return void 0===t?{output:`skill "${r}" 中不存在 reference "${n}"(仅支持 skill 目录内 references/ 下的文件)`,isError:!0}:{output:l(o?.skillRoot,i(t)),isError:!1}}export function executeSkillTool(e,r){return void 0!==r.reference?u(e,r.name,r.reference):c(e,r.name)}export function buildSkillToolset(r,n){const o="function"==typeof r?r:()=>r,i=n.register("roll","skill");return{[i]:e({description:"加载一个 skill(技能说明书)的完整内容,或其 references/ 下的文件。执行涉及某个 skill 领域的任务前,先用它读取流程与约束。",inputSchema:t,execute:e=>executeSkillTool(o(),e)})}}
1
+ import{tool as e}from"ai";import{z as r}from"zod";import{SKILL_TOOL_ID as n}from"@roll-agent/core/skills/library";export const SKILL_TOOL_AGENT_NAME="roll";export const SKILL_TOOL_NAME="skill";export{n as SKILL_TOOL_ID};const o=6e4,t=new Set(["",".","./","/","skill.md","./skill.md","/skill.md"]),i=r.object({name:r.string().trim().min(1).describe("要加载的 skill 名称(见 system prompt 中的 Skills 目录)"),reference:r.string().optional().describe("仅在加载 references/ 下的文件时填写,如 references/workflows.md;加载主 SKILL.md 时省略此参数")});function l(e){return e.length<=o?e:`${e.slice(0,o)}\n\n[内容过长已截断,共 ${String(e.length)} 字符]`}function s(e){if(void 0===e)return;const r=e.trim();return t.has(r.toLowerCase())?void 0:r}function c(e,r){return void 0===e?r:[`SKILL_ROOT=${e}`,"这是该 skill 的 canonical absolute root。所有 scripts/、references/ 和其它相对路径必须相对 SKILL_ROOT 解析;执行脚本时将 workdir 设为 SKILL_ROOT,不要搜索其它 skill 目录。","",r].join("\n")}function u(e,r){return{output:`skill "${r}" 不存在。可用 skill: ${e.list().map(e=>e.name).join(", ")}`,isError:!0}}function f(e,r){const n=e.load(r);if(!n)return u(e,r);const o=n.referencePaths.length>0?`\n\n可用 references(传 reference 参数加载):\n${n.referencePaths.map(e=>`- ${e}`).join("\n")}`:"";return{output:c(n.skillRoot,`${l(n.content)}${o}`),isError:!1}}function m(e,r,n){if(!e.list().some(e=>e.name===r))return u(e,r);const o=void 0===e.loadReferenceDocument?void 0:e.loadReferenceDocument(r,n),t=void 0===e.loadReferenceDocument?e.loadReference(r,n):o?.content;return void 0===t?{output:`skill "${r}" 中不存在 reference "${n}"。加载主 SKILL.md 时请省略 reference;加载附加文档时仅支持 skill 目录内 references/ 下的文件。`,isError:!0}:{output:c(o?.skillRoot,l(t)),isError:!1}}export function executeSkillTool(e,r){const n=s(r.reference);return void 0!==n?m(e,r.name,n):f(e,r.name)}export function buildSkillToolset(r,n){const o="function"==typeof r?r:()=>r,t=n.register("roll","skill");return{[t]:e({description:"加载 skill 主说明书时只传 name,不要传 reference;仅加载其 references/ 下的文件时才传 reference。执行涉及某个 skill 领域的任务前,先用它读取流程与约束。",inputSchema:i,execute:e=>executeSkillTool(o(),e)})}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roll-agent/runtime",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/node": "^22.0.0",
36
- "@roll-agent/core": "0.18.0"
36
+ "@roll-agent/core": "0.19.0"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "rm -rf dist && tsc -p tsconfig.build.json && node ../../scripts/obfuscate.mjs",