Files
hose-use/src/packaging/embedded-skill.ts
T
gitea ed9fa979e0 feat(assist-platform): add assist platform automation and tenant onboarding
- Add SSO QR status poller and assist platform HTTP client
- Add assist-platform session store with 0600 secure permissions
- Implement domains/assist-platform (api, services, types) for corporation search, detail, tickets, staff query and passwordless token generation
- Implement cli/commands/assist-platform with aliases assist-center and ap
- Support seamless --save --switch --elevate pipeline to import tenant and extract persistent OpenAPI credentials
- Update embedded skill documentation, reference guide, and test suites
2026-10-21 10:33:27 +08:00

80 lines
3.6 KiB
TypeScript

import { mkdirSync, writeFileSync } from "node:fs";
import { homedir } from "node:os";
import { dirname, join } from "node:path";
import skillMain from "../../skills/hose-use/SKILL.md" with { type: "text" };
import agentOpenAi from "../../skills/hose-use/agents/openai.yaml" with { type: "text" };
import refAuth from "../../skills/hose-use/references/auth.md" with { type: "text" };
import refBill from "../../skills/hose-use/references/bill.md" with { type: "text" };
import refWorkflow from "../../skills/hose-use/references/workflow.md" with { type: "text" };
import refService from "../../skills/hose-use/references/service.md" with { type: "text" };
import refContact from "../../skills/hose-use/references/contact.md" with { type: "text" };
import refTask from "../../skills/hose-use/references/task.md" with { type: "text" };
import refMessage from "../../skills/hose-use/references/message.md" with { type: "text" };
import refDimension from "../../skills/hose-use/references/dimension.md" with { type: "text" };
import refRole from "../../skills/hose-use/references/role.md" with { type: "text" };
import refApproval from "../../skills/hose-use/references/approval.md" with { type: "text" };
import refFeeType from "../../skills/hose-use/references/feetype.md" with { type: "text" };
import refStore from "../../skills/hose-use/references/store.md" with { type: "text" };
import refAssistPlatform from "../../skills/hose-use/references/assist-platform.md" with { type: "text" };
import multiMvel from "../../skills/hose-use/multi/ekuaibao-mvel/SKILL.md" with { type: "text" };
import multiMvelAgent from "../../skills/hose-use/multi/ekuaibao-mvel/agents/openai.yaml" with { type: "text" };
import multiNodes from "../../skills/hose-use/multi/ekuaibao-nodes/SKILL.md" with { type: "text" };
import multiNodesGray from "../../skills/hose-use/multi/ekuaibao-nodes/references/gray-nodes.md" with { type: "text" };
export const EMBEDDED_SKILL_FILES: Record<string, string> = {
"SKILL.md": skillMain,
"agents/openai.yaml": agentOpenAi,
"references/auth.md": refAuth,
"references/approval.md": refApproval,
"references/bill.md": refBill,
"references/feetype.md": refFeeType,
"references/contact.md": refContact,
"references/task.md": refTask,
"references/message.md": refMessage,
"references/dimension.md": refDimension,
"references/role.md": refRole,
"references/workflow.md": refWorkflow,
"references/service.md": refService,
"references/store.md": refStore,
"references/assist-platform.md": refAssistPlatform,
"multi/ekuaibao-mvel/SKILL.md": multiMvel,
"multi/ekuaibao-mvel/agents/openai.yaml": multiMvelAgent,
"multi/ekuaibao-nodes/SKILL.md": multiNodes,
"multi/ekuaibao-nodes/references/gray-nodes.md": multiNodesGray,
};
export function getSkillContent(): string {
return EMBEDDED_SKILL_FILES["SKILL.md"] || "";
}
export function getDefaultGlobalSkillDir(): string {
return join(homedir(), ".agents", "skills", "hose-use");
}
export function installSkillFiles(targetDir: string = getDefaultGlobalSkillDir()): {
targetDir: string;
files: string[];
} {
mkdirSync(targetDir, { recursive: true });
const installed: string[] = [];
for (const [relPath, content] of Object.entries(EMBEDDED_SKILL_FILES)) {
const fullPath = join(targetDir, relPath);
mkdirSync(dirname(fullPath), { recursive: true });
writeFileSync(fullPath, content, "utf8");
installed.push(relPath);
}
return {
targetDir,
files: installed,
};
}
export function syncGlobalSkillIfPresent(): { synced: boolean; targetDir?: string } {
const globalDir = getDefaultGlobalSkillDir();
installSkillFiles(globalDir);
return { synced: true, targetDir: globalDir };
}