Refactor skill definitions into SSOT structure
Move onboarding intents, prompt data, and tools behind skill-local sources. Register skills through factories and add a moderation skill PoC.
This commit is contained in:
1 parent
b1cc27f6ad
commit
fb189330da
29 files changed
+993
-494
No files matched your search
@@ -0,0 +1,52 @@
|
||||
import { z } from "zod";
|
||||
import { analyzeNicknameIssues } from "@skills/onboarding/onboarding-templates";
|
||||
import type { Tool } from "../tool.js";
|
||||
|
||||
const argsSchema = z.object({
|
||||
nickname: z.string().min(1),
|
||||
});
|
||||
|
||||
const nicknameIssueSchema = z.object({
|
||||
kind: z.enum([
|
||||
"missing-tier",
|
||||
"invalid-age",
|
||||
"missing-gender",
|
||||
"wrong-separator",
|
||||
"unknown-tier",
|
||||
"other",
|
||||
]),
|
||||
message: z.string(),
|
||||
suggestion: z.string().optional(),
|
||||
});
|
||||
|
||||
const resultSchema = z.object({
|
||||
valid: z.boolean(),
|
||||
issues: z.array(nicknameIssueSchema),
|
||||
normalized: z.string().optional(),
|
||||
});
|
||||
|
||||
export const validateNicknameTool: Tool<
|
||||
z.infer<typeof argsSchema>,
|
||||
z.infer<typeof resultSchema>
|
||||
> = {
|
||||
name: "validate-nickname",
|
||||
description:
|
||||
"새내기 닉네임 형식이 이름/출생 연도/성별/티어 규칙에 맞는지 검사하고, 틀린 부분을 구조화해서 반환한다.",
|
||||
argsSchema,
|
||||
resultSchema,
|
||||
execute(args) {
|
||||
const normalized = args.nickname.trim();
|
||||
const issues = analyzeNicknameIssues(normalized);
|
||||
|
||||
const result: z.infer<typeof resultSchema> = {
|
||||
valid: issues.length === 0,
|
||||
issues,
|
||||
};
|
||||
|
||||
if (issues.length === 0) {
|
||||
result.normalized = normalized;
|
||||
}
|
||||
|
||||
return Promise.resolve(result);
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user