pybao-cli 1.3.4 → 1.3.5
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.
- package/README.zh-CN.md +35 -35
- package/cli-acp.js +3 -3
- package/cli.js +4 -4
- package/dist/REPL-4YZC3LJO.js +42 -0
- package/dist/{acp-ZK4PEHBS.js → acp-SE4B3WSL.js} +43 -43
- package/dist/acp-SE4B3WSL.js.map +7 -0
- package/dist/{agentsValidate-CNLZLCPF.js → agentsValidate-LZISHE5F.js} +15 -15
- package/dist/agentsValidate-LZISHE5F.js.map +7 -0
- package/dist/{ask-NQBBFHNS.js → ask-5IDOHI4E.js} +26 -26
- package/dist/ask-5IDOHI4E.js.map +7 -0
- package/dist/{autoUpdater-7SQ4X6WM.js → autoUpdater-ECGS62JN.js} +3 -3
- package/dist/{chunk-DS3EM3LE.js → chunk-3X2KNIS3.js} +5 -5
- package/dist/chunk-3X2KNIS3.js.map +7 -0
- package/dist/{chunk-FPLHZKHG.js → chunk-4U4MLA4R.js} +18 -18
- package/dist/chunk-4U4MLA4R.js.map +7 -0
- package/dist/{chunk-PCXUZ6AT.js → chunk-5AGDLQAW.js} +3 -3
- package/dist/chunk-5AGDLQAW.js.map +7 -0
- package/dist/{chunk-27GYWUY2.js → chunk-5JHD6MUL.js} +3 -3
- package/dist/chunk-5JHD6MUL.js.map +7 -0
- package/dist/{chunk-ONRCOGHT.js → chunk-5JTKXNG4.js} +6 -6
- package/dist/chunk-5JTKXNG4.js.map +7 -0
- package/dist/{chunk-UWYVKM6V.js → chunk-5UJ7KHM7.js} +34 -33
- package/dist/chunk-5UJ7KHM7.js.map +7 -0
- package/dist/{chunk-LQH5OITU.js → chunk-6BSVSUGW.js} +3 -3
- package/dist/{chunk-UEANWPJI.js → chunk-AT7FEIUK.js} +7 -7
- package/dist/chunk-AT7FEIUK.js.map +7 -0
- package/dist/{chunk-T6GVXTNQ.js → chunk-B6IMQJZM.js} +7 -7
- package/dist/chunk-B6IMQJZM.js.map +7 -0
- package/dist/{chunk-H5WLCP2Q.js → chunk-BO63S4OP.js} +9 -9
- package/dist/chunk-BO63S4OP.js.map +7 -0
- package/dist/{chunk-EMMXJ26S.js → chunk-C66U55GA.js} +11 -11
- package/dist/chunk-C66U55GA.js.map +7 -0
- package/dist/{chunk-66YCDEA2.js → chunk-CTKC574I.js} +11 -11
- package/dist/chunk-CTKC574I.js.map +7 -0
- package/dist/{chunk-YPIUGZMS.js → chunk-E2R24MD6.js} +139 -129
- package/dist/chunk-E2R24MD6.js.map +7 -0
- package/dist/{chunk-EREH4M6C.js → chunk-EGHIB45T.js} +5 -5
- package/dist/chunk-EGHIB45T.js.map +7 -0
- package/dist/{chunk-VVZQUQB5.js → chunk-G2W2B3A3.js} +25 -25
- package/dist/chunk-G2W2B3A3.js.map +7 -0
- package/dist/{chunk-2QWJPY3A.js → chunk-HBWCMS4E.js} +7 -7
- package/dist/chunk-HBWCMS4E.js.map +7 -0
- package/dist/{chunk-7X3QUKZJ.js → chunk-KVP2VINI.js} +4 -4
- package/dist/chunk-KVP2VINI.js.map +7 -0
- package/dist/{chunk-JL3N5JHZ.js → chunk-MLU76W2R.js} +3 -3
- package/dist/{chunk-G2IOASOV.js → chunk-MRHGVQ5T.js} +1 -1
- package/dist/{chunk-G2IOASOV.js.map → chunk-MRHGVQ5T.js.map} +1 -1
- package/dist/{chunk-VRGR4ZTQ.js → chunk-MWPFU2KU.js} +2 -2
- package/dist/chunk-MWPFU2KU.js.map +7 -0
- package/dist/{chunk-Z7YDRXPH.js → chunk-NAXCFXKW.js} +7 -7
- package/dist/chunk-NAXCFXKW.js.map +7 -0
- package/dist/{chunk-HIP7XQSM.js → chunk-NRKOXQT5.js} +11 -11
- package/dist/chunk-NRKOXQT5.js.map +7 -0
- package/dist/{chunk-QLP2QCPC.js → chunk-OTNHBUGC.js} +5 -5
- package/dist/chunk-OTNHBUGC.js.map +7 -0
- package/dist/{chunk-T7WZHV42.js → chunk-PGLKCZAE.js} +2 -2
- package/dist/{chunk-6UHQEJU5.js → chunk-PMKSJ3AZ.js} +3 -3
- package/dist/chunk-PMKSJ3AZ.js.map +7 -0
- package/dist/{chunk-QM5NC7TO.js → chunk-R6WNNB47.js} +6 -6
- package/dist/{chunk-QM5NC7TO.js.map → chunk-R6WNNB47.js.map} +2 -2
- package/dist/{chunk-CY54GWA4.js → chunk-V3AKMLFM.js} +14 -14
- package/dist/chunk-V3AKMLFM.js.map +7 -0
- package/dist/{chunk-TCCONYNZ.js → chunk-VF3J4G4Z.js} +27 -27
- package/dist/chunk-VF3J4G4Z.js.map +7 -0
- package/dist/{chunk-EAXM67TE.js → chunk-VKMVP2QQ.js} +12 -12
- package/dist/chunk-VKMVP2QQ.js.map +7 -0
- package/dist/chunk-XI4LTVYT.js.map +7 -0
- package/dist/{chunk-S74HKDFU.js → chunk-YDXW3IJK.js} +4 -4
- package/dist/{chunk-S74HKDFU.js.map → chunk-YDXW3IJK.js.map} +1 -1
- package/dist/{chunk-TM6EL75Y.js → chunk-ZZQ6WGYG.js} +4 -4
- package/dist/{cli-ZJ7IBHJY.js → cli-MBYLENJH.js} +119 -119
- package/dist/cli-MBYLENJH.js.map +7 -0
- package/dist/commands-ECIN5O3E.js +46 -0
- package/dist/{config-EUUK7YTG.js → config-45ETSXTS.js} +4 -4
- package/dist/{context-MQKNXW2P.js → context-34YXWOMP.js} +5 -5
- package/dist/{customCommands-G6OTNNST.js → customCommands-J52KDUBX.js} +4 -4
- package/dist/{env-3A7JSF3L.js → env-ODQXSPMW.js} +8 -8
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/{llm-TFMCL3FJ.js → llm-BBYIGM3X.js} +34 -34
- package/dist/llm-BBYIGM3X.js.map +7 -0
- package/dist/{llmLazy-JF4W3ECN.js → llmLazy-VHWTJ7FY.js} +1 -1
- package/dist/{loader-E3DJWZ43.js → loader-TXZ3EJZO.js} +4 -4
- package/dist/{mcp-CLIGTX2Y.js → mcp-SHR6KH2Y.js} +7 -7
- package/dist/{mentionProcessor-D44ZKAHF.js → mentionProcessor-CDELTWDV.js} +5 -5
- package/dist/{messages-IFBBCPBX.js → messages-R4ICGYOI.js} +1 -1
- package/dist/{model-KHNUZMSI.js → model-AO4OE46E.js} +5 -5
- package/dist/{openai-4XFA4KMK.js → openai-F7WL45GM.js} +5 -5
- package/dist/{outputStyles-NUAH4FME.js → outputStyles-BWAE3CTZ.js} +4 -4
- package/dist/{pluginRuntime-KYFB3F2O.js → pluginRuntime-AHKVCUSE.js} +8 -8
- package/dist/pluginRuntime-AHKVCUSE.js.map +7 -0
- package/dist/{pluginValidation-TCIL3PVT.js → pluginValidation-YSUVH4GM.js} +6 -6
- package/dist/prompts-4AUAETB4.js +48 -0
- package/dist/pybAgentSessionId-3HDHCCI5.js +13 -0
- package/dist/pybAgentSessionLoad-5FMAFO4P.js +18 -0
- package/dist/pybAgentSessionResume-GCVJHXVV.js +16 -0
- package/dist/{kodeAgentStreamJson-3T26CHCP.js → pybAgentStreamJson-UG22YE4Z.js} +5 -5
- package/dist/{kodeAgentStreamJsonSession-E2WXNFYU.js → pybAgentStreamJsonSession-BRWXPZ5Z.js} +9 -9
- package/dist/pybAgentStreamJsonSession-BRWXPZ5Z.js.map +7 -0
- package/dist/{kodeAgentStructuredStdio-TNB6U6SP.js → pybAgentStructuredStdio-QDF6UGAJ.js} +3 -3
- package/dist/{kodeHooks-KEIFTKSA.js → pybHooks-WXEUSK2Y.js} +7 -7
- package/dist/query-JNWSOFYQ.js +50 -0
- package/dist/{ripgrep-BQTXXOCY.js → ripgrep-ON745BFW.js} +3 -3
- package/dist/{skillMarketplace-WPLPA36Z.js → skillMarketplace-ZLW4PQFC.js} +3 -3
- package/dist/{state-6OLUFGTV.js → state-E57SH5ZM.js} +2 -2
- package/dist/{theme-FKIHHDYJ.js → theme-XJG6O2YU.js} +5 -5
- package/dist/{toolPermissionSettings-2YSDIYCD.js → toolPermissionSettings-BXLCU7BK.js} +6 -6
- package/dist/tools-UJZBVLIU.js +47 -0
- package/dist/{userInput-5HJRPHLY.js → userInput-IVM4BDPE.js} +34 -34
- package/dist/userInput-IVM4BDPE.js.map +7 -0
- package/package.json +1 -1
- package/scripts/binary-utils.cjs +8 -8
- package/scripts/cli-acp-wrapper.cjs +3 -3
- package/scripts/cli-wrapper.cjs +4 -4
- package/scripts/postinstall.js +7 -7
- package/dist/REPL-DWIFIJDL.js +0 -42
- package/dist/acp-ZK4PEHBS.js.map +0 -7
- package/dist/agentsValidate-CNLZLCPF.js.map +0 -7
- package/dist/ask-NQBBFHNS.js.map +0 -7
- package/dist/chunk-27GYWUY2.js.map +0 -7
- package/dist/chunk-2QWJPY3A.js.map +0 -7
- package/dist/chunk-66YCDEA2.js.map +0 -7
- package/dist/chunk-6UHQEJU5.js.map +0 -7
- package/dist/chunk-7X3QUKZJ.js.map +0 -7
- package/dist/chunk-CY54GWA4.js.map +0 -7
- package/dist/chunk-DS3EM3LE.js.map +0 -7
- package/dist/chunk-EAXM67TE.js.map +0 -7
- package/dist/chunk-EMMXJ26S.js.map +0 -7
- package/dist/chunk-EREH4M6C.js.map +0 -7
- package/dist/chunk-FPLHZKHG.js.map +0 -7
- package/dist/chunk-H5WLCP2Q.js.map +0 -7
- package/dist/chunk-HIP7XQSM.js.map +0 -7
- package/dist/chunk-M624LT6O.js.map +0 -7
- package/dist/chunk-ONRCOGHT.js.map +0 -7
- package/dist/chunk-PCXUZ6AT.js.map +0 -7
- package/dist/chunk-QLP2QCPC.js.map +0 -7
- package/dist/chunk-T6GVXTNQ.js.map +0 -7
- package/dist/chunk-TCCONYNZ.js.map +0 -7
- package/dist/chunk-UEANWPJI.js.map +0 -7
- package/dist/chunk-UWYVKM6V.js.map +0 -7
- package/dist/chunk-VRGR4ZTQ.js.map +0 -7
- package/dist/chunk-VVZQUQB5.js.map +0 -7
- package/dist/chunk-YPIUGZMS.js.map +0 -7
- package/dist/chunk-Z7YDRXPH.js.map +0 -7
- package/dist/cli-ZJ7IBHJY.js.map +0 -7
- package/dist/commands-26Q4GJ7U.js +0 -46
- package/dist/kodeAgentSessionId-PROTVRBR.js +0 -13
- package/dist/kodeAgentSessionLoad-63BYTKTV.js +0 -18
- package/dist/kodeAgentSessionResume-B74VONCU.js +0 -16
- package/dist/kodeAgentStreamJsonSession-E2WXNFYU.js.map +0 -7
- package/dist/llm-TFMCL3FJ.js.map +0 -7
- package/dist/pluginRuntime-KYFB3F2O.js.map +0 -7
- package/dist/prompts-JD7BGHKJ.js +0 -48
- package/dist/query-J5JOOKFI.js +0 -50
- package/dist/tools-S6P5P65H.js +0 -47
- package/dist/userInput-5HJRPHLY.js.map +0 -7
- /package/dist/{REPL-DWIFIJDL.js.map → REPL-4YZC3LJO.js.map} +0 -0
- /package/dist/{autoUpdater-7SQ4X6WM.js.map → autoUpdater-ECGS62JN.js.map} +0 -0
- /package/dist/{chunk-LQH5OITU.js.map → chunk-6BSVSUGW.js.map} +0 -0
- /package/dist/{chunk-JL3N5JHZ.js.map → chunk-MLU76W2R.js.map} +0 -0
- /package/dist/{chunk-T7WZHV42.js.map → chunk-PGLKCZAE.js.map} +0 -0
- /package/dist/{chunk-M624LT6O.js → chunk-XI4LTVYT.js} +0 -0
- /package/dist/{chunk-TM6EL75Y.js.map → chunk-ZZQ6WGYG.js.map} +0 -0
- /package/dist/{commands-26Q4GJ7U.js.map → commands-ECIN5O3E.js.map} +0 -0
- /package/dist/{config-EUUK7YTG.js.map → config-45ETSXTS.js.map} +0 -0
- /package/dist/{context-MQKNXW2P.js.map → context-34YXWOMP.js.map} +0 -0
- /package/dist/{customCommands-G6OTNNST.js.map → customCommands-J52KDUBX.js.map} +0 -0
- /package/dist/{env-3A7JSF3L.js.map → env-ODQXSPMW.js.map} +0 -0
- /package/dist/{kodeAgentSessionId-PROTVRBR.js.map → llmLazy-VHWTJ7FY.js.map} +0 -0
- /package/dist/{kodeAgentSessionLoad-63BYTKTV.js.map → loader-TXZ3EJZO.js.map} +0 -0
- /package/dist/{kodeAgentSessionResume-B74VONCU.js.map → mcp-SHR6KH2Y.js.map} +0 -0
- /package/dist/{mentionProcessor-D44ZKAHF.js.map → mentionProcessor-CDELTWDV.js.map} +0 -0
- /package/dist/{kodeAgentStreamJson-3T26CHCP.js.map → messages-R4ICGYOI.js.map} +0 -0
- /package/dist/{kodeAgentStructuredStdio-TNB6U6SP.js.map → model-AO4OE46E.js.map} +0 -0
- /package/dist/{kodeHooks-KEIFTKSA.js.map → openai-F7WL45GM.js.map} +0 -0
- /package/dist/{llmLazy-JF4W3ECN.js.map → outputStyles-BWAE3CTZ.js.map} +0 -0
- /package/dist/{loader-E3DJWZ43.js.map → pluginValidation-YSUVH4GM.js.map} +0 -0
- /package/dist/{mcp-CLIGTX2Y.js.map → prompts-4AUAETB4.js.map} +0 -0
- /package/dist/{messages-IFBBCPBX.js.map → pybAgentSessionId-3HDHCCI5.js.map} +0 -0
- /package/dist/{model-KHNUZMSI.js.map → pybAgentSessionLoad-5FMAFO4P.js.map} +0 -0
- /package/dist/{openai-4XFA4KMK.js.map → pybAgentSessionResume-GCVJHXVV.js.map} +0 -0
- /package/dist/{outputStyles-NUAH4FME.js.map → pybAgentStreamJson-UG22YE4Z.js.map} +0 -0
- /package/dist/{pluginValidation-TCIL3PVT.js.map → pybAgentStructuredStdio-QDF6UGAJ.js.map} +0 -0
- /package/dist/{prompts-JD7BGHKJ.js.map → pybHooks-WXEUSK2Y.js.map} +0 -0
- /package/dist/{query-J5JOOKFI.js.map → query-JNWSOFYQ.js.map} +0 -0
- /package/dist/{ripgrep-BQTXXOCY.js.map → ripgrep-ON745BFW.js.map} +0 -0
- /package/dist/{skillMarketplace-WPLPA36Z.js.map → skillMarketplace-ZLW4PQFC.js.map} +0 -0
- /package/dist/{state-6OLUFGTV.js.map → state-E57SH5ZM.js.map} +0 -0
- /package/dist/{theme-FKIHHDYJ.js.map → theme-XJG6O2YU.js.map} +0 -0
- /package/dist/{toolPermissionSettings-2YSDIYCD.js.map → toolPermissionSettings-BXLCU7BK.js.map} +0 -0
- /package/dist/{tools-S6P5P65H.js.map → tools-UJZBVLIU.js.map} +0 -0
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
} from "./chunk-BJSWTHRM.js";
|
|
6
6
|
import {
|
|
7
7
|
debug
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CTKC574I.js";
|
|
9
9
|
import {
|
|
10
10
|
getCwd,
|
|
11
|
-
|
|
11
|
+
getPybBaseDir,
|
|
12
12
|
logError
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-G2W2B3A3.js";
|
|
14
14
|
|
|
15
15
|
// src/services/plugins/customCommands.ts
|
|
16
16
|
import { existsSync, readFileSync, readdirSync, statSync } from "fs";
|
|
@@ -110,8 +110,8 @@ function parseFrontmatter(content) {
|
|
|
110
110
|
function isSkillMarkdownFile(filePath) {
|
|
111
111
|
return /^skill\.md$/i.test(basename(filePath));
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
return
|
|
113
|
+
function getUserPybBaseDir() {
|
|
114
|
+
return getPybBaseDir();
|
|
115
115
|
}
|
|
116
116
|
function toBoolean(value) {
|
|
117
117
|
if (typeof value === "boolean") return value;
|
|
@@ -289,7 +289,7 @@ function loadPluginSkillDirectoryCommandsFromBaseDir(args) {
|
|
|
289
289
|
} catch {
|
|
290
290
|
return [];
|
|
291
291
|
}
|
|
292
|
-
const strictMode = toBoolean(process.env.
|
|
292
|
+
const strictMode = toBoolean(process.env.PYB_SKILLS_STRICT);
|
|
293
293
|
const validateName = (skillName) => {
|
|
294
294
|
if (skillName.length < 1 || skillName.length > 64) return false;
|
|
295
295
|
return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(skillName);
|
|
@@ -514,7 +514,7 @@ function loadSkillDirectoryCommandsFromBaseDir(skillsDir, source, scope) {
|
|
|
514
514
|
} catch {
|
|
515
515
|
return [];
|
|
516
516
|
}
|
|
517
|
-
const strictMode = toBoolean(process.env.
|
|
517
|
+
const strictMode = toBoolean(process.env.PYB_SKILLS_STRICT);
|
|
518
518
|
const validateName = (skillName) => {
|
|
519
519
|
if (skillName.length < 1 || skillName.length > 64) return false;
|
|
520
520
|
return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(skillName);
|
|
@@ -609,16 +609,16 @@ ARGUMENTS: ${trimmedArgs}`;
|
|
|
609
609
|
var loadCustomCommands = memoize(
|
|
610
610
|
async () => {
|
|
611
611
|
const cwd = getCwd();
|
|
612
|
-
const
|
|
612
|
+
const userPybBaseDir = getUserPybBaseDir();
|
|
613
613
|
const sessionPlugins = getSessionPlugins();
|
|
614
614
|
const projectLegacyCommandsDir = join(cwd, ".claude", "commands");
|
|
615
615
|
const userLegacyCommandsDir = join(homedir(), ".claude", "commands");
|
|
616
|
-
const
|
|
617
|
-
const
|
|
616
|
+
const projectPybCommandsDir = join(cwd, ".pyb", "commands");
|
|
617
|
+
const userPybCommandsDir = join(userPybBaseDir, "commands");
|
|
618
618
|
const projectLegacySkillsDir = join(cwd, ".claude", "skills");
|
|
619
619
|
const userLegacySkillsDir = join(homedir(), ".claude", "skills");
|
|
620
|
-
const
|
|
621
|
-
const
|
|
620
|
+
const projectPybSkillsDir = join(cwd, ".pyb", "skills");
|
|
621
|
+
const userPybSkillsDir = join(userPybBaseDir, "skills");
|
|
622
622
|
const abortController = new AbortController();
|
|
623
623
|
const timeout = setTimeout(() => abortController.abort(), 3e3);
|
|
624
624
|
try {
|
|
@@ -630,7 +630,7 @@ var loadCustomCommands = memoize(
|
|
|
630
630
|
abortController.signal
|
|
631
631
|
),
|
|
632
632
|
...loadCommandMarkdownFilesFromBaseDir(
|
|
633
|
-
|
|
633
|
+
projectPybCommandsDir,
|
|
634
634
|
"localSettings",
|
|
635
635
|
"project",
|
|
636
636
|
abortController.signal
|
|
@@ -642,7 +642,7 @@ var loadCustomCommands = memoize(
|
|
|
642
642
|
abortController.signal
|
|
643
643
|
),
|
|
644
644
|
...loadCommandMarkdownFilesFromBaseDir(
|
|
645
|
-
|
|
645
|
+
userPybCommandsDir,
|
|
646
646
|
"userSettings",
|
|
647
647
|
"user",
|
|
648
648
|
abortController.signal
|
|
@@ -656,7 +656,7 @@ var loadCustomCommands = memoize(
|
|
|
656
656
|
"project"
|
|
657
657
|
),
|
|
658
658
|
...loadSkillDirectoryCommandsFromBaseDir(
|
|
659
|
-
|
|
659
|
+
projectPybSkillsDir,
|
|
660
660
|
"localSettings",
|
|
661
661
|
"project"
|
|
662
662
|
),
|
|
@@ -666,7 +666,7 @@ var loadCustomCommands = memoize(
|
|
|
666
666
|
"user"
|
|
667
667
|
),
|
|
668
668
|
...loadSkillDirectoryCommandsFromBaseDir(
|
|
669
|
-
|
|
669
|
+
userPybSkillsDir,
|
|
670
670
|
"userSettings",
|
|
671
671
|
"user"
|
|
672
672
|
)
|
|
@@ -719,16 +719,16 @@ var loadCustomCommands = memoize(
|
|
|
719
719
|
},
|
|
720
720
|
() => {
|
|
721
721
|
const cwd = getCwd();
|
|
722
|
-
const
|
|
722
|
+
const userPybBaseDir = getUserPybBaseDir();
|
|
723
723
|
const dirs = [
|
|
724
724
|
join(homedir(), ".claude", "commands"),
|
|
725
725
|
join(cwd, ".claude", "commands"),
|
|
726
|
-
join(
|
|
727
|
-
join(cwd, ".
|
|
726
|
+
join(userPybBaseDir, "commands"),
|
|
727
|
+
join(cwd, ".pyb", "commands"),
|
|
728
728
|
join(homedir(), ".claude", "skills"),
|
|
729
729
|
join(cwd, ".claude", "skills"),
|
|
730
|
-
join(
|
|
731
|
-
join(cwd, ".
|
|
730
|
+
join(userPybBaseDir, "skills"),
|
|
731
|
+
join(cwd, ".pyb", "skills")
|
|
732
732
|
];
|
|
733
733
|
const exists = dirs.map((d) => existsSync(d) ? "1" : "0").join("");
|
|
734
734
|
return `${cwd}:${exists}:${Math.floor(Date.now() / 6e4)}`;
|
|
@@ -738,21 +738,21 @@ var reloadCustomCommands = () => {
|
|
|
738
738
|
loadCustomCommands.cache.clear();
|
|
739
739
|
};
|
|
740
740
|
function getCustomCommandDirectories() {
|
|
741
|
-
const
|
|
741
|
+
const userPybBaseDir = getUserPybBaseDir();
|
|
742
742
|
return {
|
|
743
743
|
userClaudeCommands: join(homedir(), ".claude", "commands"),
|
|
744
744
|
projectClaudeCommands: join(getCwd(), ".claude", "commands"),
|
|
745
745
|
userClaudeSkills: join(homedir(), ".claude", "skills"),
|
|
746
746
|
projectClaudeSkills: join(getCwd(), ".claude", "skills"),
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
747
|
+
userPybCommands: join(userPybBaseDir, "commands"),
|
|
748
|
+
projectPybCommands: join(getCwd(), ".pyb", "commands"),
|
|
749
|
+
userPybSkills: join(userPybBaseDir, "skills"),
|
|
750
|
+
projectPybSkills: join(getCwd(), ".pyb", "skills")
|
|
751
751
|
};
|
|
752
752
|
}
|
|
753
753
|
function hasCustomCommands() {
|
|
754
754
|
const dirs = getCustomCommandDirectories();
|
|
755
|
-
return existsSync(dirs.userClaudeCommands) || existsSync(dirs.projectClaudeCommands) || existsSync(dirs.userClaudeSkills) || existsSync(dirs.projectClaudeSkills) || existsSync(dirs.
|
|
755
|
+
return existsSync(dirs.userClaudeCommands) || existsSync(dirs.projectClaudeCommands) || existsSync(dirs.userClaudeSkills) || existsSync(dirs.projectClaudeSkills) || existsSync(dirs.userPybCommands) || existsSync(dirs.projectPybCommands) || existsSync(dirs.userPybSkills) || existsSync(dirs.projectPybSkills);
|
|
756
756
|
}
|
|
757
757
|
|
|
758
758
|
export {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/services/plugins/customCommands.ts"],
|
|
4
|
+
"sourcesContent": ["import { existsSync, readFileSync, readdirSync, statSync } from 'fs'\nimport { basename, dirname, join, relative, resolve, sep } from 'path'\nimport { homedir } from 'os'\nimport { memoize } from 'lodash-es'\nimport type { MessageParam } from '@anthropic-ai/sdk/resources/index.mjs'\nimport type { Command } from '@commands'\nimport { getCwd } from '@utils/state'\nimport { getSessionPlugins } from '@utils/session/sessionPlugins'\nimport { getPybBaseDir } from '@utils/config/env'\nimport { debug as debugLogger } from '@utils/log/debugLogger'\nimport { logError } from '@utils/log'\nimport { execFile } from 'child_process'\nimport { promisify } from 'util'\nimport matter from 'gray-matter'\nimport yaml from 'js-yaml'\n\nconst execFileAsync = promisify(execFile)\n\nexport async function executeBashCommands(content: string): Promise<string> {\n const bashCommandRegex = /!\\`([^`]+)\\`/g\n const matches = [...content.matchAll(bashCommandRegex)]\n\n if (matches.length === 0) {\n return content\n }\n\n let result = content\n\n for (const match of matches) {\n const fullMatch = match[0]\n const command = match[1].trim()\n\n try {\n const parts = command.split(/\\s+/)\n const cmd = parts[0]\n const args = parts.slice(1)\n\n const { stdout, stderr } = await execFileAsync(cmd, args, {\n timeout: 5000,\n encoding: 'utf8',\n cwd: getCwd(),\n })\n\n const output = stdout.trim() || stderr.trim() || '(no output)'\n result = result.replace(fullMatch, output)\n } catch (error) {\n logError(error)\n debugLogger.warn('CUSTOM_COMMAND_BASH_EXEC_FAILED', {\n command,\n error: error instanceof Error ? error.message : String(error),\n })\n result = result.replace(fullMatch, `(error executing: ${command})`)\n }\n }\n\n return result\n}\n\nexport async function resolveFileReferences(content: string): Promise<string> {\n const fileRefRegex = /@([a-zA-Z0-9/._-]+(?:\\.[a-zA-Z0-9]+)?)/g\n const matches = [...content.matchAll(fileRefRegex)]\n\n if (matches.length === 0) {\n return content\n }\n\n let result = content\n\n for (const match of matches) {\n const fullMatch = match[0]\n const filePath = match[1]\n\n if (filePath.startsWith('agent-')) {\n continue\n }\n\n try {\n const fullPath = join(getCwd(), filePath)\n\n if (existsSync(fullPath)) {\n const fileContent = readFileSync(fullPath, { encoding: 'utf-8' })\n\n const formattedContent = `\\n\\n## File: ${filePath}\\n\\`\\`\\`\\n${fileContent}\\n\\`\\`\\`\\n`\n result = result.replace(fullMatch, formattedContent)\n } else {\n result = result.replace(fullMatch, `(file not found: ${filePath})`)\n }\n } catch (error) {\n logError(error)\n debugLogger.warn('CUSTOM_COMMAND_FILE_READ_FAILED', {\n filePath,\n error: error instanceof Error ? error.message : String(error),\n })\n result = result.replace(fullMatch, `(error reading: ${filePath})`)\n }\n }\n\n return result\n}\n\nexport interface CustomCommandFrontmatter {\n description?: string\n 'allowed-tools'?: string[]\n 'argument-hint'?: string\n when_to_use?: string\n version?: string\n model?: string\n maxThinkingTokens?: number | string\n max_thinking_tokens?: number | string\n 'max-thinking-tokens'?: number | string\n name?: string\n 'disable-model-invocation'?: boolean | string\n}\n\nexport interface CustomCommandWithScope {\n type: 'prompt'\n name: string\n description: string\n isEnabled: boolean\n isHidden: boolean\n aliases?: string[]\n progressMessage: string\n userFacingName(): string\n getPromptForCommand(args: string): Promise<MessageParam[]>\n allowedTools?: string[]\n maxThinkingTokens?: number\n argumentHint?: string\n whenToUse?: string\n version?: string\n model?: string\n isSkill?: boolean\n disableModelInvocation?: boolean\n hasUserSpecifiedDescription?: boolean\n source?: 'localSettings' | 'userSettings' | 'pluginDir'\n scope?: 'user' | 'project'\n filePath?: string\n}\n\nexport interface CustomCommandFile {\n frontmatter: CustomCommandFrontmatter\n content: string\n filePath: string\n}\n\nexport function parseFrontmatter(content: string): {\n frontmatter: CustomCommandFrontmatter\n content: string\n} {\n const yamlSchema = (yaml as any).JSON_SCHEMA\n const parsed = matter(content, {\n engines: {\n yaml: {\n parse: (input: string) =>\n yaml.load(input, yamlSchema ? { schema: yamlSchema } : undefined) ??\n {},\n },\n },\n })\n return {\n frontmatter: (parsed.data ?? {}) as CustomCommandFrontmatter,\n content: parsed.content ?? '',\n }\n}\n\ntype CommandSource = 'localSettings' | 'userSettings' | 'pluginDir'\n\nfunction isSkillMarkdownFile(filePath: string): boolean {\n return /^skill\\.md$/i.test(basename(filePath))\n}\n\nfunction getUserPybBaseDir(): string {\n return getPybBaseDir()\n}\n\nfunction toBoolean(value: unknown): boolean {\n if (typeof value === 'boolean') return value\n if (typeof value === 'string') {\n const normalized = value.trim().toLowerCase()\n if (['1', 'true', 'yes', 'on'].includes(normalized)) return true\n if (['0', 'false', 'no', 'off'].includes(normalized)) return false\n }\n return false\n}\n\nfunction parseAllowedTools(value: unknown): string[] {\n if (Array.isArray(value)) {\n return value.map(v => String(v).trim()).filter(Boolean)\n }\n if (typeof value === 'string') {\n const trimmed = value.trim()\n if (!trimmed) return []\n return trimmed\n .split(/\\s+/)\n .map(v => v.trim())\n .filter(Boolean)\n }\n return []\n}\n\nfunction parseMaxThinkingTokens(\n frontmatter: CustomCommandFrontmatter,\n): number | undefined {\n const raw =\n (frontmatter as any).maxThinkingTokens ??\n (frontmatter as any).max_thinking_tokens ??\n (frontmatter as any)['max-thinking-tokens'] ??\n (frontmatter as any)['max_thinking_tokens']\n if (raw === undefined || raw === null) return undefined\n const value = typeof raw === 'number' ? raw : Number(String(raw).trim())\n if (!Number.isFinite(value) || value < 0) return undefined\n return Math.floor(value)\n}\n\nfunction sourceLabel(source: CommandSource): string {\n if (source === 'localSettings') return 'project'\n if (source === 'userSettings') return 'user'\n if (source === 'pluginDir') return 'plugin'\n return 'unknown'\n}\n\nfunction extractDescriptionFromMarkdown(\n markdown: string,\n fallback: string,\n): string {\n const lines = markdown.split(/\\r?\\n/)\n for (const line of lines) {\n const trimmed = line.trim()\n if (!trimmed) continue\n const heading = trimmed.match(/^#{1,6}\\s+(.*)$/)\n if (heading?.[1]) return heading[1].trim()\n return trimmed.length > 120 ? `${trimmed.slice(0, 117)}...` : trimmed\n }\n return fallback\n}\n\nfunction namespaceFromDirPath(dirPath: string, baseDir: string): string {\n const relPath = relative(baseDir, dirPath)\n if (!relPath || relPath === '.' || relPath.startsWith('..')) return ''\n return relPath.split(sep).join(':')\n}\n\nfunction nameForCommandFile(filePath: string, baseDir: string): string {\n if (isSkillMarkdownFile(filePath)) {\n const skillDir = dirname(filePath)\n const parentDir = dirname(skillDir)\n const skillName = basename(skillDir)\n const namespace = namespaceFromDirPath(parentDir, baseDir)\n return namespace ? `${namespace}:${skillName}` : skillName\n }\n\n const dir = dirname(filePath)\n const namespace = namespaceFromDirPath(dir, baseDir)\n const fileName = basename(filePath).replace(/\\.md$/i, '')\n return namespace ? `${namespace}:${fileName}` : fileName\n}\n\ntype CommandFileRecord = {\n baseDir: string\n filePath: string\n frontmatter: CustomCommandFrontmatter\n content: string\n source: CommandSource\n scope: 'user' | 'project'\n}\n\nfunction buildPluginQualifiedName(\n pluginName: string,\n localName: string,\n): string {\n const p = pluginName.trim()\n const l = localName.trim()\n if (!p) return l\n if (!l || l === p) return p\n return `${p}:${l}`\n}\n\nfunction nameForPluginCommandFile(\n filePath: string,\n commandsDir: string,\n pluginName: string,\n): string {\n const rel = relative(commandsDir, filePath)\n const noExt = rel.replace(/\\.md$/i, '')\n const localName = noExt.split(sep).filter(Boolean).join(':')\n return buildPluginQualifiedName(pluginName, localName)\n}\n\nfunction createPluginPromptCommandFromFile(record: {\n pluginName: string\n commandsDir: string\n filePath: string\n frontmatter: CustomCommandFrontmatter\n content: string\n}): CustomCommandWithScope | null {\n const name = nameForPluginCommandFile(\n record.filePath,\n record.commandsDir,\n record.pluginName,\n )\n if (!name) return null\n\n const descriptionText =\n record.frontmatter.description ??\n extractDescriptionFromMarkdown(record.content, 'Custom command')\n const allowedTools = parseAllowedTools(record.frontmatter['allowed-tools'])\n const maxThinkingTokens = parseMaxThinkingTokens(record.frontmatter)\n const argumentHint = record.frontmatter['argument-hint']\n const whenToUse = record.frontmatter.when_to_use\n const version = record.frontmatter.version\n const disableModelInvocation = toBoolean(\n record.frontmatter['disable-model-invocation'],\n )\n const model =\n record.frontmatter.model === 'inherit'\n ? undefined\n : record.frontmatter.model\n\n return {\n type: 'prompt',\n name,\n description: `${descriptionText} (${sourceLabel('pluginDir')})`,\n isEnabled: true,\n isHidden: false,\n filePath: record.filePath,\n aliases: [],\n progressMessage: 'running',\n allowedTools,\n maxThinkingTokens,\n argumentHint,\n whenToUse,\n version,\n model,\n isSkill: false,\n disableModelInvocation,\n hasUserSpecifiedDescription: !!record.frontmatter.description,\n source: 'pluginDir',\n scope: 'project',\n userFacingName() {\n return name\n },\n async getPromptForCommand(args: string): Promise<MessageParam[]> {\n let prompt = record.content\n const trimmedArgs = args.trim()\n if (trimmedArgs) {\n if (prompt.includes('$ARGUMENTS')) {\n prompt = prompt.replaceAll('$ARGUMENTS', trimmedArgs)\n } else {\n prompt = `${prompt}\\n\\nARGUMENTS: ${trimmedArgs}`\n }\n }\n return [{ role: 'user', content: prompt }]\n },\n }\n}\n\nfunction loadPluginCommandsFromDir(args: {\n pluginName: string\n commandsDir: string\n signal: AbortSignal\n}): CustomCommandWithScope[] {\n let commandsBaseDir = args.commandsDir\n let files: string[] = []\n try {\n const st = statSync(args.commandsDir)\n if (st.isFile()) {\n if (!args.commandsDir.toLowerCase().endsWith('.md')) return []\n files = [args.commandsDir]\n commandsBaseDir = dirname(args.commandsDir)\n } else if (st.isDirectory()) {\n files = listMarkdownFilesRecursively(args.commandsDir, args.signal)\n } else {\n return []\n }\n } catch {\n return []\n }\n\n const out: CustomCommandWithScope[] = []\n for (const filePath of files) {\n if (args.signal.aborted) break\n try {\n const raw = readFileSync(filePath, 'utf8')\n const { frontmatter, content } = parseFrontmatter(raw)\n const cmd = createPluginPromptCommandFromFile({\n pluginName: args.pluginName,\n commandsDir: commandsBaseDir,\n filePath,\n frontmatter,\n content,\n })\n if (cmd) out.push(cmd)\n } catch {\n }\n }\n return out\n}\n\nfunction loadPluginSkillDirectoryCommandsFromBaseDir(args: {\n pluginName: string\n skillsDir: string\n}): CustomCommandWithScope[] {\n if (!existsSync(args.skillsDir)) return []\n\n const out: CustomCommandWithScope[] = []\n let entries\n try {\n entries = readdirSync(args.skillsDir, { withFileTypes: true })\n } catch {\n return []\n }\n\n const strictMode = toBoolean(process.env.PYB_SKILLS_STRICT)\n const validateName = (skillName: string): boolean => {\n if (skillName.length < 1 || skillName.length > 64) return false\n return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(skillName)\n }\n\n for (const entry of entries) {\n if (!entry.isDirectory() && !entry.isSymbolicLink()) continue\n const skillDir = join(args.skillsDir, entry.name)\n const skillFileCandidates = [\n join(skillDir, 'SKILL.md'),\n join(skillDir, 'skill.md'),\n ]\n const skillFile = skillFileCandidates.find(p => existsSync(p))\n if (!skillFile) continue\n\n try {\n const raw = readFileSync(skillFile, 'utf8')\n const { frontmatter, content } = parseFrontmatter(raw)\n\n const dirName = entry.name\n const declaredName =\n typeof (frontmatter as any).name === 'string'\n ? String((frontmatter as any).name).trim()\n : ''\n const effectiveDeclaredName =\n declaredName && declaredName === dirName ? declaredName : ''\n if (declaredName && declaredName !== dirName) {\n if (strictMode) continue\n debugLogger.warn('CUSTOM_COMMAND_SKILL_NAME_MISMATCH', {\n dirName,\n declaredName,\n skillFile,\n })\n }\n const name = buildPluginQualifiedName(args.pluginName, dirName)\n if (!validateName(dirName)) {\n if (strictMode) continue\n debugLogger.warn('CUSTOM_COMMAND_SKILL_DIR_INVALID', { dirName, skillFile })\n }\n const descriptionText =\n frontmatter.description ??\n extractDescriptionFromMarkdown(content, 'Skill')\n if (strictMode) {\n const d =\n typeof frontmatter.description === 'string'\n ? frontmatter.description.trim()\n : ''\n if (!d || d.length > 1024) continue\n }\n\n const allowedTools = parseAllowedTools(frontmatter['allowed-tools'])\n const maxThinkingTokens = parseMaxThinkingTokens(frontmatter as any)\n const argumentHint = frontmatter['argument-hint']\n const whenToUse = frontmatter.when_to_use\n const version = frontmatter.version\n const disableModelInvocation = toBoolean(\n frontmatter['disable-model-invocation'],\n )\n const model =\n frontmatter.model === 'inherit' ? undefined : frontmatter.model\n\n out.push({\n type: 'prompt',\n name,\n description: `${descriptionText} (${sourceLabel('pluginDir')})`,\n isEnabled: true,\n isHidden: true,\n aliases: [],\n filePath: skillFile,\n progressMessage: 'loading',\n allowedTools,\n maxThinkingTokens,\n argumentHint,\n whenToUse,\n version,\n model,\n isSkill: true,\n disableModelInvocation,\n hasUserSpecifiedDescription: !!frontmatter.description,\n source: 'pluginDir',\n scope: 'project',\n userFacingName() {\n return effectiveDeclaredName\n ? buildPluginQualifiedName(args.pluginName, effectiveDeclaredName)\n : name\n },\n async getPromptForCommand(argsText: string): Promise<MessageParam[]> {\n let prompt = `Base directory for this skill: ${skillDir}\\n\\n${content}`\n const trimmedArgs = argsText.trim()\n if (trimmedArgs) {\n if (prompt.includes('$ARGUMENTS')) {\n prompt = prompt.replaceAll('$ARGUMENTS', trimmedArgs)\n } else {\n prompt = `${prompt}\\n\\nARGUMENTS: ${trimmedArgs}`\n }\n }\n return [{ role: 'user', content: prompt }]\n },\n })\n } catch {\n }\n }\n\n return out\n}\n\nfunction applySkillFilePreference(\n files: CommandFileRecord[],\n): CommandFileRecord[] {\n const grouped = new Map<string, CommandFileRecord[]>()\n for (const file of files) {\n const key = dirname(file.filePath)\n const existing = grouped.get(key) ?? []\n existing.push(file)\n grouped.set(key, existing)\n }\n\n const result: CommandFileRecord[] = []\n for (const group of grouped.values()) {\n const skillFiles = group.filter(f => isSkillMarkdownFile(f.filePath))\n if (skillFiles.length > 0) {\n result.push(skillFiles[0]!)\n continue\n }\n result.push(...group)\n }\n return result\n}\n\nfunction createPromptCommandFromFile(\n record: CommandFileRecord,\n): CustomCommandWithScope | null {\n const isSkill = isSkillMarkdownFile(record.filePath)\n const name = nameForCommandFile(record.filePath, record.baseDir)\n if (!name) return null\n\n const descriptionText =\n record.frontmatter.description ??\n extractDescriptionFromMarkdown(\n record.content,\n isSkill ? 'Skill' : 'Custom command',\n )\n\n const allowedTools = parseAllowedTools(record.frontmatter['allowed-tools'])\n const maxThinkingTokens = parseMaxThinkingTokens(record.frontmatter)\n const argumentHint = record.frontmatter['argument-hint']\n const whenToUse = record.frontmatter.when_to_use\n const version = record.frontmatter.version\n const disableModelInvocation = toBoolean(\n record.frontmatter['disable-model-invocation'],\n )\n const model =\n record.frontmatter.model === 'inherit'\n ? undefined\n : record.frontmatter.model\n\n const description = `${descriptionText} (${sourceLabel(record.source)})`\n const progressMessage = isSkill ? 'loading' : 'running'\n const skillBaseDir = isSkill ? dirname(record.filePath) : undefined\n\n return {\n type: 'prompt',\n name,\n description,\n isEnabled: true,\n isHidden: false,\n filePath: record.filePath,\n aliases: [],\n progressMessage,\n allowedTools,\n maxThinkingTokens,\n argumentHint,\n whenToUse,\n version,\n model,\n isSkill,\n disableModelInvocation,\n hasUserSpecifiedDescription: !!record.frontmatter.description,\n source: record.source,\n scope: record.scope,\n userFacingName() {\n return name\n },\n async getPromptForCommand(args: string): Promise<MessageParam[]> {\n let prompt = record.content\n if (isSkill && skillBaseDir) {\n prompt = `Base directory for this skill: ${skillBaseDir}\\n\\n${prompt}`\n }\n const trimmedArgs = args.trim()\n if (trimmedArgs) {\n if (prompt.includes('$ARGUMENTS')) {\n prompt = prompt.replaceAll('$ARGUMENTS', trimmedArgs)\n } else {\n prompt = `${prompt}\\n\\nARGUMENTS: ${trimmedArgs}`\n }\n }\n return [{ role: 'user', content: prompt }]\n },\n }\n}\n\nfunction listMarkdownFilesRecursively(\n baseDir: string,\n signal: AbortSignal,\n): string[] {\n const results: string[] = []\n const queue: string[] = [baseDir]\n while (queue.length > 0) {\n if (signal.aborted) break\n const currentDir = queue.pop()!\n let entries\n try {\n entries = readdirSync(currentDir, { withFileTypes: true })\n } catch {\n continue\n }\n for (const entry of entries) {\n if (signal.aborted) break\n const fullPath = join(currentDir, entry.name)\n if (entry.isDirectory()) {\n queue.push(fullPath)\n continue\n }\n if (entry.isFile() && entry.name.toLowerCase().endsWith('.md')) {\n results.push(fullPath)\n }\n }\n }\n return results\n}\n\nfunction loadCommandMarkdownFilesFromBaseDir(\n baseDir: string,\n source: CommandSource,\n scope: 'user' | 'project',\n signal: AbortSignal,\n): CommandFileRecord[] {\n if (!existsSync(baseDir)) return []\n const files = listMarkdownFilesRecursively(baseDir, signal)\n const records: CommandFileRecord[] = []\n for (const filePath of files) {\n if (signal.aborted) break\n try {\n const raw = readFileSync(filePath, 'utf8')\n const { frontmatter, content } = parseFrontmatter(raw)\n records.push({ baseDir, filePath, frontmatter, content, source, scope })\n } catch {\n }\n }\n return records\n}\n\nfunction loadSkillDirectoryCommandsFromBaseDir(\n skillsDir: string,\n source: CommandSource,\n scope: 'user' | 'project',\n): CustomCommandWithScope[] {\n if (!existsSync(skillsDir)) return []\n\n const out: CustomCommandWithScope[] = []\n let entries\n try {\n entries = readdirSync(skillsDir, { withFileTypes: true })\n } catch {\n return []\n }\n\n const strictMode = toBoolean(process.env.PYB_SKILLS_STRICT)\n const validateName = (skillName: string): boolean => {\n if (skillName.length < 1 || skillName.length > 64) return false\n return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(skillName)\n }\n\n for (const entry of entries) {\n if (!entry.isDirectory() && !entry.isSymbolicLink()) continue\n const skillDir = join(skillsDir, entry.name)\n const skillFileCandidates = [\n join(skillDir, 'SKILL.md'),\n join(skillDir, 'skill.md'),\n ]\n const skillFile = skillFileCandidates.find(p => existsSync(p))\n if (!skillFile) continue\n\n try {\n const raw = readFileSync(skillFile, 'utf8')\n const { frontmatter, content } = parseFrontmatter(raw)\n\n const dirName = entry.name\n const declaredName =\n typeof (frontmatter as any).name === 'string'\n ? String((frontmatter as any).name).trim()\n : ''\n const effectiveDeclaredName =\n declaredName && declaredName === dirName ? declaredName : ''\n if (declaredName && declaredName !== dirName) {\n if (strictMode) continue\n debugLogger.warn('CUSTOM_COMMAND_SKILL_NAME_MISMATCH', {\n dirName,\n declaredName,\n skillFile,\n })\n }\n const name = dirName\n if (!validateName(name)) {\n if (strictMode) continue\n debugLogger.warn('CUSTOM_COMMAND_SKILL_DIR_INVALID', { name, skillFile })\n }\n const descriptionText =\n frontmatter.description ??\n extractDescriptionFromMarkdown(content, 'Skill')\n if (strictMode) {\n const d =\n typeof frontmatter.description === 'string'\n ? frontmatter.description.trim()\n : ''\n if (!d || d.length > 1024) continue\n }\n\n const allowedTools = parseAllowedTools(frontmatter['allowed-tools'])\n const maxThinkingTokens = parseMaxThinkingTokens(frontmatter as any)\n const argumentHint = frontmatter['argument-hint']\n const whenToUse = frontmatter.when_to_use\n const version = frontmatter.version\n const disableModelInvocation = toBoolean(\n frontmatter['disable-model-invocation'],\n )\n const model =\n frontmatter.model === 'inherit' ? undefined : frontmatter.model\n\n out.push({\n type: 'prompt',\n name,\n description: `${descriptionText} (${sourceLabel(source)})`,\n isEnabled: true,\n isHidden: true,\n aliases: [],\n filePath: skillFile,\n progressMessage: 'loading',\n allowedTools,\n maxThinkingTokens,\n argumentHint,\n whenToUse,\n version,\n model,\n isSkill: true,\n disableModelInvocation,\n hasUserSpecifiedDescription: !!frontmatter.description,\n source,\n scope,\n userFacingName() {\n return effectiveDeclaredName || name\n },\n async getPromptForCommand(args: string): Promise<MessageParam[]> {\n let prompt = `Base directory for this skill: ${skillDir}\\n\\n${content}`\n const trimmedArgs = args.trim()\n if (trimmedArgs) {\n if (prompt.includes('$ARGUMENTS')) {\n prompt = prompt.replaceAll('$ARGUMENTS', trimmedArgs)\n } else {\n prompt = `${prompt}\\n\\nARGUMENTS: ${trimmedArgs}`\n }\n }\n return [{ role: 'user', content: prompt }]\n },\n })\n } catch {\n }\n }\n\n return out\n}\n\nexport const loadCustomCommands = memoize(\n async (): Promise<CustomCommandWithScope[]> => {\n const cwd = getCwd()\n const userPybBaseDir = getUserPybBaseDir()\n const sessionPlugins = getSessionPlugins()\n\n const projectLegacyCommandsDir = join(cwd, '.claude', 'commands')\n const userLegacyCommandsDir = join(homedir(), '.claude', 'commands')\n const projectPybCommandsDir = join(cwd, '.pyb', 'commands')\n const userPybCommandsDir = join(userPybBaseDir, 'commands')\n\n const projectLegacySkillsDir = join(cwd, '.claude', 'skills')\n const userLegacySkillsDir = join(homedir(), '.claude', 'skills')\n const projectPybSkillsDir = join(cwd, '.pyb', 'skills')\n const userPybSkillsDir = join(userPybBaseDir, 'skills')\n\n const abortController = new AbortController()\n const timeout = setTimeout(() => abortController.abort(), 3000)\n\n try {\n const commandFiles = applySkillFilePreference([\n ...loadCommandMarkdownFilesFromBaseDir(\n projectLegacyCommandsDir,\n 'localSettings',\n 'project',\n abortController.signal,\n ),\n ...loadCommandMarkdownFilesFromBaseDir(\n projectPybCommandsDir,\n 'localSettings',\n 'project',\n abortController.signal,\n ),\n ...loadCommandMarkdownFilesFromBaseDir(\n userLegacyCommandsDir,\n 'userSettings',\n 'user',\n abortController.signal,\n ),\n ...loadCommandMarkdownFilesFromBaseDir(\n userPybCommandsDir,\n 'userSettings',\n 'user',\n abortController.signal,\n ),\n ])\n\n const fileCommands = commandFiles\n .map(createPromptCommandFromFile)\n .filter((cmd): cmd is CustomCommandWithScope => cmd !== null)\n\n const skillDirCommands: CustomCommandWithScope[] = [\n ...loadSkillDirectoryCommandsFromBaseDir(\n projectLegacySkillsDir,\n 'localSettings',\n 'project',\n ),\n ...loadSkillDirectoryCommandsFromBaseDir(\n projectPybSkillsDir,\n 'localSettings',\n 'project',\n ),\n ...loadSkillDirectoryCommandsFromBaseDir(\n userLegacySkillsDir,\n 'userSettings',\n 'user',\n ),\n ...loadSkillDirectoryCommandsFromBaseDir(\n userPybSkillsDir,\n 'userSettings',\n 'user',\n ),\n ]\n\n const pluginCommands: CustomCommandWithScope[] = []\n if (sessionPlugins.length > 0) {\n for (const plugin of sessionPlugins) {\n for (const commandsDir of plugin.commandsDirs) {\n pluginCommands.push(\n ...loadPluginCommandsFromDir({\n pluginName: plugin.name,\n commandsDir,\n signal: abortController.signal,\n }),\n )\n }\n for (const skillsDir of plugin.skillsDirs) {\n pluginCommands.push(\n ...loadPluginSkillDirectoryCommandsFromBaseDir({\n pluginName: plugin.name,\n skillsDir,\n }),\n )\n }\n }\n }\n\n const ordered = [\n ...fileCommands,\n ...skillDirCommands,\n ...pluginCommands,\n ].filter(cmd => cmd.isEnabled)\n\n const seen = new Set<string>()\n const unique: CustomCommandWithScope[] = []\n for (const cmd of ordered) {\n const key = cmd.userFacingName()\n if (seen.has(key)) continue\n seen.add(key)\n unique.push(cmd)\n }\n\n return unique\n } catch (error) {\n logError(error)\n debugLogger.warn('CUSTOM_COMMANDS_LOAD_FAILED', {\n error: error instanceof Error ? error.message : String(error),\n })\n return []\n } finally {\n clearTimeout(timeout)\n }\n },\n () => {\n const cwd = getCwd()\n const userPybBaseDir = getUserPybBaseDir()\n const dirs = [\n join(homedir(), '.claude', 'commands'),\n join(cwd, '.claude', 'commands'),\n join(userPybBaseDir, 'commands'),\n join(cwd, '.pyb', 'commands'),\n join(homedir(), '.claude', 'skills'),\n join(cwd, '.claude', 'skills'),\n join(userPybBaseDir, 'skills'),\n join(cwd, '.pyb', 'skills'),\n ]\n const exists = dirs.map(d => (existsSync(d) ? '1' : '0')).join('')\n return `${cwd}:${exists}:${Math.floor(Date.now() / 60000)}`\n },\n)\n\nexport const reloadCustomCommands = (): void => {\n loadCustomCommands.cache.clear()\n}\n\nexport function getCustomCommandDirectories(): {\n userClaudeCommands: string\n projectClaudeCommands: string\n userClaudeSkills: string\n projectClaudeSkills: string\n userPybCommands: string\n projectPybCommands: string\n userPybSkills: string\n projectPybSkills: string\n} {\n const userPybBaseDir = getUserPybBaseDir()\n return {\n userClaudeCommands: join(homedir(), '.claude', 'commands'),\n projectClaudeCommands: join(getCwd(), '.claude', 'commands'),\n userClaudeSkills: join(homedir(), '.claude', 'skills'),\n projectClaudeSkills: join(getCwd(), '.claude', 'skills'),\n userPybCommands: join(userPybBaseDir, 'commands'),\n projectPybCommands: join(getCwd(), '.pyb', 'commands'),\n userPybSkills: join(userPybBaseDir, 'skills'),\n projectPybSkills: join(getCwd(), '.pyb', 'skills'),\n }\n}\n\nexport function hasCustomCommands(): boolean {\n const dirs = getCustomCommandDirectories()\n return (\n existsSync(dirs.userClaudeCommands) ||\n existsSync(dirs.projectClaudeCommands) ||\n existsSync(dirs.userClaudeSkills) ||\n existsSync(dirs.projectClaudeSkills) ||\n existsSync(dirs.userPybCommands) ||\n existsSync(dirs.projectPybCommands) ||\n existsSync(dirs.userPybSkills) ||\n existsSync(dirs.projectPybSkills)\n )\n}\n"],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BAAoB,KAAK,QAAQ,GAAG,WAAW,UAAU;AAAA,IACzD,uBAAuB,KAAK,OAAO,GAAG,WAAW,UAAU;AAAA,IAC3D,kBAAkB,KAAK,QAAQ,GAAG,WAAW,QAAQ;AAAA,IACrD,qBAAqB,KAAK,OAAO,GAAG,WAAW,QAAQ;AAAA,IACvD,iBAAiB,KAAK,gBAAgB,UAAU;AAAA,IAChD,oBAAoB,KAAK,OAAO,GAAG,QAAQ,UAAU;AAAA,IACrD,eAAe,KAAK,gBAAgB,QAAQ;AAAA,IAC5C,kBAAkB,KAAK,OAAO,GAAG,QAAQ,QAAQ;AAAA,EACnD;AACF;AAEO,SAAS,oBAA6B;AAC3C,QAAM,OAAO,4BAA4B;AACzC,SACE,WAAW,KAAK,kBAAkB,KAClC,WAAW,KAAK,qBAAqB,KACrC,WAAW,KAAK,gBAAgB,KAChC,WAAW,KAAK,mBAAmB,KACnC,WAAW,KAAK,eAAe,KAC/B,WAAW,KAAK,kBAAkB,KAClC,WAAW,KAAK,aAAa,KAC7B,WAAW,KAAK,gBAAgB;AAEpC;",
|
|
6
|
+
"names": ["namespace"]
|
|
7
|
+
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
getSettingsFileCandidates,
|
|
5
5
|
loadSettingsWithLegacyFallback,
|
|
6
6
|
saveSettingsToPrimaryAndSyncLegacy
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-NAXCFXKW.js";
|
|
8
8
|
import {
|
|
9
9
|
isSettingSourceEnabled
|
|
10
10
|
} from "./chunk-A3BVXXA3.js";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-BJSWTHRM.js";
|
|
14
14
|
import {
|
|
15
15
|
getCwd
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-G2W2B3A3.js";
|
|
17
17
|
|
|
18
18
|
// src/services/ui/outputStyles.ts
|
|
19
19
|
import figures from "figures";
|
|
@@ -76,24 +76,24 @@ function getClaudePolicyBaseDir() {
|
|
|
76
76
|
}
|
|
77
77
|
function getUserConfigBaseDirs() {
|
|
78
78
|
const out = [];
|
|
79
|
-
const hasAnyOverride = typeof process.env.CLAUDE_CONFIG_DIR === "string" || typeof process.env.
|
|
79
|
+
const hasAnyOverride = typeof process.env.CLAUDE_CONFIG_DIR === "string" || typeof process.env.PYB_CONFIG_DIR === "string";
|
|
80
80
|
const claudeBase = normalizeString(process.env.CLAUDE_CONFIG_DIR);
|
|
81
|
-
const
|
|
82
|
-
if (claudeBase) out.push({ claude: resolve(claudeBase),
|
|
83
|
-
if (
|
|
81
|
+
const pybBase = normalizeString(process.env.PYB_CONFIG_DIR);
|
|
82
|
+
if (claudeBase) out.push({ claude: resolve(claudeBase), pyb: resolve(claudeBase) });
|
|
83
|
+
if (pybBase) out.push({ claude: resolve(pybBase), pyb: resolve(pybBase) });
|
|
84
84
|
if (hasAnyOverride) {
|
|
85
85
|
return dedupeConfigBases(out);
|
|
86
86
|
}
|
|
87
87
|
return dedupeConfigBases([
|
|
88
|
-
{ claude: join(homedir(), ".claude"),
|
|
89
|
-
{ claude: join(homedir(), ".
|
|
88
|
+
{ claude: join(homedir(), ".claude"), pyb: join(homedir(), ".claude") },
|
|
89
|
+
{ claude: join(homedir(), ".pyb"), pyb: join(homedir(), ".pyb") }
|
|
90
90
|
]);
|
|
91
91
|
}
|
|
92
92
|
function dedupeConfigBases(bases) {
|
|
93
93
|
const seen = /* @__PURE__ */ new Set();
|
|
94
94
|
const out = [];
|
|
95
95
|
for (const base of bases) {
|
|
96
|
-
const key = `${base.claude}::${base.
|
|
96
|
+
const key = `${base.claude}::${base.pyb}`;
|
|
97
97
|
if (seen.has(key)) continue;
|
|
98
98
|
seen.add(key);
|
|
99
99
|
out.push(base);
|
|
@@ -107,8 +107,8 @@ function findProjectSubdirs(subdir, cwd) {
|
|
|
107
107
|
while (current !== home) {
|
|
108
108
|
const claudeDir = join(current, ".claude", subdir);
|
|
109
109
|
if (existsSync(claudeDir)) result.push(claudeDir);
|
|
110
|
-
const
|
|
111
|
-
if (existsSync(
|
|
110
|
+
const pybDir = join(current, ".pyb", subdir);
|
|
111
|
+
if (existsSync(pybDir)) result.push(pybDir);
|
|
112
112
|
const parent = dirname(current);
|
|
113
113
|
if (parent === current) break;
|
|
114
114
|
current = parent;
|
|
@@ -410,7 +410,7 @@ function loadCustomOutputStyles(options) {
|
|
|
410
410
|
if (isSettingSourceEnabled("userSettings")) {
|
|
411
411
|
const userBases = getUserConfigBaseDirs();
|
|
412
412
|
for (const base of userBases) {
|
|
413
|
-
for (const userBaseDir of /* @__PURE__ */ new Set([base.claude, base.
|
|
413
|
+
for (const userBaseDir of /* @__PURE__ */ new Set([base.claude, base.pyb])) {
|
|
414
414
|
const dirPath = join(userBaseDir, "output-styles");
|
|
415
415
|
for (const filePath of listMarkdownFilesRecursively(dirPath)) {
|
|
416
416
|
const inodeKey = inodeKeyForPath(filePath);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/services/ui/outputStyles.ts", "../src/utils/config/localSettings.ts"],
|
|
4
|
+
"sourcesContent": ["import figures from 'figures'\nimport { memoize } from 'lodash-es'\nimport { existsSync, readdirSync, readFileSync, statSync } from 'fs'\nimport { basename, dirname, join, resolve } from 'path'\nimport { homedir } from 'os'\nimport matter from 'gray-matter'\nimport yaml from 'js-yaml'\nimport { getSessionPlugins } from '@utils/session/sessionPlugins'\nimport { readLocalSettings, updateLocalSettings } from '@utils/config/localSettings'\nimport { getCwd } from '@utils/state'\nimport { isSettingSourceEnabled } from '@utils/config/settingSources'\n\nexport type OutputStyleSource =\n | 'built-in'\n | 'plugin'\n | 'userSettings'\n | 'projectSettings'\n | 'policySettings'\n\nexport type OutputStyleDefinition = {\n name: string\n description: string\n prompt: string\n source: OutputStyleSource\n keepCodingInstructions?: boolean\n}\n\nexport type OutputStyleMap = Record<string, OutputStyleDefinition | null>\n\nexport const DEFAULT_OUTPUT_STYLE = 'default'\n\nfunction normalizeString(value: unknown): string | null {\n if (typeof value !== 'string') return null\n const trimmed = value.trim()\n return trimmed ? trimmed : null\n}\n\nfunction getClaudePolicyBaseDir(): string {\n switch (process.platform) {\n case 'darwin':\n return '/Library/Application Support/ClaudeCode'\n case 'win32':\n return existsSync('C:\\\\Program Files\\\\ClaudeCode')\n ? 'C:\\\\Program Files\\\\ClaudeCode'\n : 'C:\\\\ProgramData\\\\ClaudeCode'\n default:\n return '/etc/claude-code'\n }\n}\n\nfunction getUserConfigBaseDirs(): { claude: string; pyb: string }[] {\n const out: { claude: string; pyb: string }[] = []\n\n const hasAnyOverride =\n typeof process.env.CLAUDE_CONFIG_DIR === 'string' ||\n typeof process.env.PYB_CONFIG_DIR === 'string'\n\n const claudeBase = normalizeString(process.env.CLAUDE_CONFIG_DIR)\n const pybBase = normalizeString(process.env.PYB_CONFIG_DIR)\n\n if (claudeBase) out.push({ claude: resolve(claudeBase), pyb: resolve(claudeBase) })\n if (pybBase) out.push({ claude: resolve(pybBase), pyb: resolve(pybBase) })\n\n if (hasAnyOverride) {\n return dedupeConfigBases(out)\n }\n\n return dedupeConfigBases([\n { claude: join(homedir(), '.claude'), pyb: join(homedir(), '.claude') },\n { claude: join(homedir(), '.pyb'), pyb: join(homedir(), '.pyb') },\n ])\n}\n\nfunction dedupeConfigBases(\n bases: Array<{ claude: string; pyb: string }>,\n): Array<{ claude: string; pyb: string }> {\n const seen = new Set<string>()\n const out: Array<{ claude: string; pyb: string }> = []\n for (const base of bases) {\n const key = `${base.claude}::${base.pyb}`\n if (seen.has(key)) continue\n seen.add(key)\n out.push(base)\n }\n return out\n}\n\nfunction findProjectSubdirs(subdir: string, cwd: string): string[] {\n const result: string[] = []\n const home = resolve(homedir())\n let current = resolve(cwd)\n\n while (current !== home) {\n const claudeDir = join(current, '.claude', subdir)\n if (existsSync(claudeDir)) result.push(claudeDir)\n\n const pybDir = join(current, '.pyb', subdir)\n if (existsSync(pybDir)) result.push(pybDir)\n\n const parent = dirname(current)\n if (parent === current) break\n current = parent\n }\n\n return result\n}\n\nfunction markdownFirstLineOrHeading(content: string, fallback: string): string {\n const lines = content.split('\\n')\n for (const line of lines) {\n const trimmed = line.trim()\n if (!trimmed) continue\n const heading = trimmed.match(/^#+\\s+(.+)$/)?.[1] ?? trimmed\n return heading.length > 100 ? `${heading.substring(0, 97)}...` : heading\n }\n return fallback\n}\n\nfunction listMarkdownFilesRecursively(rootDir: string): string[] {\n const files: string[] = []\n const visitedDirs = new Set<string>()\n\n const walk = (dirPath: string) => {\n let dirStat: ReturnType<typeof statSync>\n try {\n dirStat = statSync(dirPath)\n } catch {\n return\n }\n if (!dirStat.isDirectory()) return\n\n const dirKey = `${dirStat.dev}:${dirStat.ino}`\n if (visitedDirs.has(dirKey)) return\n visitedDirs.add(dirKey)\n\n let entries: Array<{ name: string; isDirectory(): boolean; isFile(): boolean; isSymbolicLink(): boolean }>\n try {\n entries = readdirSync(dirPath, { withFileTypes: true, encoding: 'utf8' }) as any\n } catch {\n return\n }\n\n for (const entry of entries) {\n const name = String(entry.name ?? '')\n const fullPath = join(dirPath, name)\n\n if (entry.isDirectory()) {\n walk(fullPath)\n continue\n }\n\n if (entry.isFile()) {\n if (name.endsWith('.md')) files.push(fullPath)\n continue\n }\n\n if (entry.isSymbolicLink()) {\n try {\n const st = statSync(fullPath)\n if (st.isDirectory()) {\n walk(fullPath)\n } else if (st.isFile() && name.endsWith('.md')) {\n files.push(fullPath)\n }\n } catch {\n continue\n }\n }\n }\n }\n\n if (!existsSync(rootDir)) return []\n walk(rootDir)\n return files\n}\n\nfunction readMarkdownFile(filePath: string): { frontmatter: any; content: string } | null {\n try {\n const raw = readFileSync(filePath, 'utf8')\n const yamlSchema = (yaml as any).JSON_SCHEMA\n const matterOptions = {\n engines: {\n yaml: {\n parse: (input: string) =>\n yaml.load(input, yamlSchema ? { schema: yamlSchema } : undefined) ??\n {},\n },\n },\n }\n const parsed = matter(raw, matterOptions)\n return { frontmatter: (parsed.data as any) ?? {}, content: String(parsed.content ?? '') }\n } catch {\n return null\n }\n}\n\nfunction inodeKeyForPath(filePath: string): string | null {\n try {\n const st = statSync(filePath)\n if (typeof (st as any).dev === 'number' && typeof (st as any).ino === 'number') {\n return `${(st as any).dev}:${(st as any).ino}`\n }\n return null\n } catch {\n return null\n }\n}\n\nconst INSIGHTS_SECTION = `\n## Insights\nIn order to encourage learning, before and after writing code, always provide brief educational explanations about implementation choices using (with backticks):\n\"\\`${figures.star} Insight \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\\`\n[2-3 key educational points]\n\\`\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\\`\"\n\nThese insights should be included in the conversation, not in the codebase. You should generally focus on interesting insights that are specific to the codebase or the code you just wrote, rather than general programming concepts.`\n\nfunction getBuiltInOutputStyles(): OutputStyleMap {\n return {\n [DEFAULT_OUTPUT_STYLE]: null,\n Explanatory: {\n name: 'Explanatory',\n source: 'built-in',\n description: 'Claude explains its implementation choices and codebase patterns',\n keepCodingInstructions: true,\n prompt: `You are an interactive CLI tool that helps users with software engineering tasks. In addition to software engineering tasks, you should provide educational insights about the codebase along the way.\n\nYou should be clear and educational, providing helpful explanations while remaining focused on the task. Balance educational content with task completion. When providing insights, you may exceed typical length constraints, but remain focused and relevant.\n\n# Explanatory Style Active\n${INSIGHTS_SECTION}`,\n },\n Learning: {\n name: 'Learning',\n source: 'built-in',\n description:\n 'Claude pauses and asks you to write small pieces of code for hands-on practice',\n keepCodingInstructions: true,\n prompt: `You are an interactive CLI tool that helps users with software engineering tasks. In addition to software engineering tasks, you should help users learn more about the codebase through hands-on practice and educational insights.\n\nYou should be collaborative and encouraging. Balance task completion with learning by requesting user input for meaningful design decisions while handling routine implementation yourself. \n\n# Learning Style Active\n## Requesting Human Contributions\nIn order to encourage learning, ask the human to contribute 2-10 line code pieces when generating 20+ lines involving:\n- Design decisions (error handling, data structures)\n- Business logic with multiple valid approaches \n- Key algorithms or interface definitions\n\n**TodoList Integration**: If using a TodoList for the overall task, include a specific todo item like \"Request human input on [specific decision]\" when planning to request human input. This ensures proper task tracking. Note: TodoList is not required for all tasks.\n\nExample TodoList flow:\n \u2713 \"Set up component structure with placeholder for logic\"\n \u2713 \"Request human collaboration on decision logic implementation\"\n \u2713 \"Integrate contribution and complete feature\"\n\n### Request Format\n\\`\\`\\`\n${figures.bullet} **Learn by Doing**\n**Context:** [what's built and why this decision matters]\n**Your Task:** [specific function/section in file, mention file and TODO(human) but do not include line numbers]\n**Guidance:** [trade-offs and constraints to consider]\n\\`\\`\\`\n\n### Key Guidelines\n- Frame contributions as valuable design decisions, not busy work\n- You must first add a TODO(human) section into the codebase with your editing tools before making the Learn by Doing request \n- Make sure there is one and only one TODO(human) section in the code\n- Don't take any action or output anything after the Learn by Doing request. Wait for human implementation before proceeding.\n\n### Example Requests\n\n**Whole Function Example:**\n\\`\\`\\`\n${figures.bullet} **Learn by Doing**\n\n**Context:** I've set up the hint feature UI with a button that triggers the hint system. The infrastructure is ready: when clicked, it calls selectHintCell() to determine which cell to hint, then highlights that cell with a yellow background and shows possible values. The hint system needs to decide which empty cell would be most helpful to reveal to the user.\n\n**Your Task:** In sudoku.js, implement the selectHintCell(board) function. Look for TODO(human). This function should analyze the board and return {row, col} for the best cell to hint, or null if the puzzle is complete.\n\n**Guidance:** Consider multiple strategies: prioritize cells with only one possible value (naked singles), or cells that appear in rows/columns/boxes with many filled cells. You could also consider a balanced approach that helps without making it too easy. The board parameter is a 9x9 array where 0 represents empty cells.\n\\`\\`\\`\n\n**Partial Function Example:**\n\\`\\`\\`\n${figures.bullet} **Learn by Doing**\n\n**Context:** I've built a file upload component that validates files before accepting them. The main validation logic is complete, but it needs specific handling for different file type categories in the switch statement.\n\n**Your Task:** In upload.js, inside the validateFile() function's switch statement, implement the 'case \"document\":' branch. Look for TODO(human). This should validate document files (pdf, doc, docx).\n\n**Guidance:** Consider checking file size limits (maybe 10MB for documents?), validating the file extension matches the MIME type, and returning {valid: boolean, error?: string}. The file object has properties: name, size, type.\n\\`\\`\\`\n\n**Debugging Example:**\n\\`\\`\\`\n${figures.bullet} **Learn by Doing**\n\n**Context:** The user reported that number inputs aren't working correctly in the calculator. I've identified the handleInput() function as the likely source, but need to understand what values are being processed.\n\n**Your Task:** In calculator.js, inside the handleInput() function, add 2-3 console.log statements after the TODO(human) comment to help debug why number inputs fail.\n\n**Guidance:** Consider logging: the raw input value, the parsed result, and any validation state. This will help us understand where the conversion breaks.\n\\`\\`\\`\n\n### After Contributions\nShare one insight connecting their code to broader patterns or system effects. Avoid praise or repetition.\n\n## Insights\n${INSIGHTS_SECTION}`,\n },\n }\n}\n\nfunction parseKeepCodingInstructions(value: unknown): boolean | undefined {\n if (value === 'true') return true\n if (value === 'false') return false\n return undefined\n}\n\nfunction parseCustomOutputStyleFile(options: {\n filePath: string\n source: Exclude<OutputStyleSource, 'built-in' | 'plugin'>\n}): OutputStyleDefinition | null {\n const parsed = readMarkdownFile(options.filePath)\n if (!parsed) return null\n\n const base = basename(options.filePath, '.md')\n const name = normalizeString(parsed.frontmatter?.name) ?? base\n const description =\n normalizeString(parsed.frontmatter?.description) ??\n markdownFirstLineOrHeading(parsed.content, `Custom ${base} output style`)\n const keepCodingInstructions = parseKeepCodingInstructions(\n parsed.frontmatter?.['keep-coding-instructions'],\n )\n const prompt = parsed.content.trim()\n\n return {\n name,\n description,\n prompt,\n source: options.source,\n ...(keepCodingInstructions !== undefined ? { keepCodingInstructions } : {}),\n }\n}\n\nfunction parsePluginOutputStyleFile(options: {\n filePath: string\n pluginName: string\n seen: Set<string>\n}): OutputStyleDefinition | null {\n const inodeKey = inodeKeyForPath(options.filePath)\n const dedupeKey = inodeKey ? `inode:${inodeKey}` : `path:${options.filePath}`\n if (options.seen.has(dedupeKey)) return null\n options.seen.add(dedupeKey)\n\n const parsed = readMarkdownFile(options.filePath)\n if (!parsed) return null\n\n const base = basename(options.filePath, '.md')\n const styleName = normalizeString(parsed.frontmatter?.name) ?? base\n const fullName = `${options.pluginName}:${styleName}`\n const description =\n normalizeString(parsed.frontmatter?.description) ??\n markdownFirstLineOrHeading(\n parsed.content,\n `Output style from ${options.pluginName} plugin`,\n )\n const prompt = parsed.content.trim()\n\n return {\n name: fullName,\n description,\n prompt,\n source: 'plugin',\n }\n}\n\nfunction loadPluginOutputStyles(): OutputStyleDefinition[] {\n const out: OutputStyleDefinition[] = []\n const plugins = getSessionPlugins()\n for (const plugin of plugins) {\n const pluginName = plugin.name\n const seen = new Set<string>()\n for (const dir of plugin.outputStylesDirs ?? []) {\n let st: ReturnType<typeof statSync>\n try {\n st = statSync(dir)\n } catch {\n continue\n }\n if (st.isFile()) {\n if (!dir.endsWith('.md')) continue\n const style = parsePluginOutputStyleFile({\n filePath: dir,\n pluginName,\n seen,\n })\n if (style) out.push(style)\n continue\n }\n\n if (st.isDirectory()) {\n const files = listMarkdownFilesRecursively(dir)\n for (const filePath of files) {\n const style = parsePluginOutputStyleFile({\n filePath,\n pluginName,\n seen,\n })\n if (style) out.push(style)\n }\n }\n }\n }\n return out\n}\n\nfunction loadCustomOutputStyles(options: { cwd: string }): OutputStyleDefinition[] {\n const out: OutputStyleDefinition[] = []\n const seen = new Set<string>()\n\n const policyDir = join(\n getClaudePolicyBaseDir(),\n '.claude',\n 'output-styles',\n )\n for (const filePath of listMarkdownFilesRecursively(policyDir)) {\n const inodeKey = inodeKeyForPath(filePath)\n const dedupeKey = inodeKey ? `inode:${inodeKey}` : `path:${filePath}`\n if (seen.has(dedupeKey)) continue\n seen.add(dedupeKey)\n const style = parseCustomOutputStyleFile({\n filePath,\n source: 'policySettings',\n })\n if (style) out.push(style)\n }\n\n if (isSettingSourceEnabled('userSettings')) {\n const userBases = getUserConfigBaseDirs()\n for (const base of userBases) {\n for (const userBaseDir of new Set([base.claude, base.pyb])) {\n const dirPath = join(userBaseDir, 'output-styles')\n for (const filePath of listMarkdownFilesRecursively(dirPath)) {\n const inodeKey = inodeKeyForPath(filePath)\n const dedupeKey = inodeKey ? `inode:${inodeKey}` : `path:${filePath}`\n if (seen.has(dedupeKey)) continue\n seen.add(dedupeKey)\n const style = parseCustomOutputStyleFile({\n filePath,\n source: 'userSettings',\n })\n if (style) out.push(style)\n }\n }\n }\n }\n\n if (isSettingSourceEnabled('projectSettings')) {\n for (const dirPath of findProjectSubdirs('output-styles', options.cwd)) {\n for (const filePath of listMarkdownFilesRecursively(dirPath)) {\n const inodeKey = inodeKeyForPath(filePath)\n const dedupeKey = inodeKey ? `inode:${inodeKey}` : `path:${filePath}`\n if (seen.has(dedupeKey)) continue\n seen.add(dedupeKey)\n const style = parseCustomOutputStyleFile({\n filePath,\n source: 'projectSettings',\n })\n if (style) out.push(style)\n }\n }\n }\n\n return out\n}\n\nexport const getAvailableOutputStyles = memoize((): OutputStyleMap => {\n const cwd = getCwd()\n const builtIn = getBuiltInOutputStyles()\n const merged: OutputStyleMap = { ...builtIn }\n\n for (const style of loadPluginOutputStyles()) {\n merged[style.name] = style\n }\n\n const custom = loadCustomOutputStyles({ cwd })\n const user = custom.filter(s => s.source === 'userSettings')\n const project = custom.filter(s => s.source === 'projectSettings')\n const policy = custom.filter(s => s.source === 'policySettings')\n\n for (const style of user) merged[style.name] = style\n for (const style of project) merged[style.name] = style\n for (const style of policy) merged[style.name] = style\n\n return merged\n})\n\nexport function clearOutputStyleCache(): void {\n ;(getAvailableOutputStyles as any).cache?.clear?.()\n}\n\nexport function getCurrentOutputStyle(): string {\n if (!isSettingSourceEnabled('localSettings')) return DEFAULT_OUTPUT_STYLE\n\n const settings = readLocalSettings()\n const candidate = normalizeString(settings.outputStyle)\n return candidate ?? DEFAULT_OUTPUT_STYLE\n}\n\nexport function setCurrentOutputStyle(styleName: string): void {\n updateLocalSettings({ outputStyle: styleName })\n}\n\nexport function resolveOutputStyleName(input: string): string | null {\n const raw = normalizeString(input)\n if (!raw) return null\n const styles = getAvailableOutputStyles()\n if (raw in styles) return raw\n const lower = raw.toLowerCase()\n for (const name of Object.keys(styles)) {\n if (name.toLowerCase() === lower) return name\n }\n return null\n}\n\nexport function getCurrentOutputStyleDefinition(): OutputStyleDefinition | null {\n const current = getCurrentOutputStyle()\n const styles = getAvailableOutputStyles()\n return styles[current] ?? null\n}\n\nexport function getOutputStyleSystemPromptAdditions(): string[] {\n const style = getCurrentOutputStyleDefinition()\n if (!style) return []\n const prompt = style.prompt.trim()\n if (!prompt) return []\n return [`\\n# Output Style: ${style.name}\\n${prompt}\\n`]\n}\n", "import { join } from 'path'\nimport { getCwd } from '@utils/state'\nimport {\n getSettingsFileCandidates,\n loadSettingsWithLegacyFallback,\n saveSettingsToPrimaryAndSyncLegacy,\n} from '@utils/config/settingsFiles'\n\nexport type LocalSettings = {\n outputStyle?: unknown\n [key: string]: unknown\n}\n\nexport function getLocalSettingsPath(options?: {\n projectDir?: string\n}): string {\n const projectDir = options?.projectDir ?? getCwd()\n return join(projectDir, '.pyb', 'settings.local.json')\n}\n\nexport function readLocalSettings(options?: {\n projectDir?: string\n}): LocalSettings {\n const projectDir = options?.projectDir ?? getCwd()\n const loaded = loadSettingsWithLegacyFallback({\n destination: 'localSettings',\n projectDir,\n migrateToPrimary: true,\n })\n return (loaded.settings as LocalSettings | null) ?? {}\n}\n\nexport function updateLocalSettings(\n patch: Record<string, unknown>,\n options?: {\n projectDir?: string\n },\n): LocalSettings {\n const projectDir = options?.projectDir ?? getCwd()\n const candidates = getSettingsFileCandidates({\n destination: 'localSettings',\n projectDir,\n })\n const existing =\n (candidates\n ? loadSettingsWithLegacyFallback({\n destination: 'localSettings',\n projectDir,\n migrateToPrimary: true,\n }).settings\n : null) ?? {}\n\n const next = { ...(existing as Record<string, unknown>), ...patch }\n\n if (candidates) {\n saveSettingsToPrimaryAndSyncLegacy({\n destination: 'localSettings',\n projectDir,\n settings: next,\n syncLegacyIfExists: true,\n })\n }\n\n return next as LocalSettings\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA,OAAO,aAAa;AACpB,SAAS,eAAe;AACxB,SAAS,YAAY,aAAa,cAAc,gBAAgB;AAChE,SAAS,UAAU,SAAS,MAAM,eAAe;AACjD,SAAS,eAAe;AACxB,OAAO,YAAY;AACnB,OAAO,UAAU;;;ACcV,SAAS,kBAAkB,SAEhB;AAChB,QAAM,aAAa,SAAS,cAAc,OAAO;AACjD,QAAM,SAAS,+BAA+B;AAAA,IAC5C,aAAa;AAAA,IACb;AAAA,IACA,kBAAkB;AAAA,EACpB,CAAC;AACD,SAAQ,OAAO,YAAqC,CAAC;AACvD;AAEO,SAAS,oBACd,OACA,SAGe;AACf,QAAM,aAAa,SAAS,cAAc,OAAO;AACjD,QAAM,aAAa,0BAA0B;AAAA,IAC3C,aAAa;AAAA,IACb;AAAA,EACF,CAAC;AACD,QAAM,YACH,aACG,+BAA+B;AAAA,IAC7B,aAAa;AAAA,IACb;AAAA,IACA,kBAAkB;AAAA,EACpB,CAAC,EAAE,WACH,SAAS,CAAC;AAEhB,QAAM,OAAO,EAAE,GAAI,UAAsC,GAAG,MAAM;AAElE,MAAI,YAAY;AACd,uCAAmC;AAAA,MACjC,aAAa;AAAA,MACb;AAAA,MACA,UAAU;AAAA,MACV,oBAAoB;AAAA,IACtB,CAAC;AAAA,EACH;AAEA,SAAO;AACT;;;ADnCO,IAAM,uBAAuB;AAEpC,SAAS,gBAAgB,OAA+B;AACtD,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,UAAU,MAAM,KAAK;AAC3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|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/core/tools/tool.ts"],
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod'\nimport type * as React from 'react'\nimport type { PermissionMode } from '@pyb-types/permissionMode'\nimport type { ToolPermissionContext } from '@pyb-types/toolPermissionContext'\n\nexport type SetToolJSXFn = (\n jsx: {\n jsx: React.ReactNode | null\n shouldHidePromptInput: boolean\n } | null,\n) => void\n\nexport interface ToolUseContext {\n messageId: string | undefined\n toolUseId?: string\n agentId?: string\n safeMode?: boolean\n abortController: AbortController\n readFileTimestamps: { [filePath: string]: number }\n options?: {\n commands?: any[]\n tools?: any[]\n verbose?: boolean\n slowAndCapableModel?: string\n safeMode?: boolean\n permissionMode?: PermissionMode\n toolPermissionContext?: ToolPermissionContext\n lastUserPrompt?: string\n forkNumber?: number\n messageLogName?: string\n maxThinkingTokens?: any\n model?: string\n commandAllowedTools?: string[]\n isPybRequest?: boolean\n pybContext?: string\n isCustomCommand?: boolean\n mcpClients?: any[]\n disableSlashCommands?: boolean\n persistSession?: boolean\n shouldAvoidPermissionPrompts?: boolean\n }\n responseState?: {\n previousResponseId?: string\n conversationId?: string\n }\n}\n\nexport interface ExtendedToolUseContext extends ToolUseContext {\n setToolJSX: SetToolJSXFn\n}\n\nexport interface ValidationResult {\n result: boolean\n message?: string\n errorCode?: number\n meta?: any\n}\n\nexport interface Tool<\n TInput extends z.ZodTypeAny = z.ZodTypeAny,\n TOutput = any,\n> {\n name: string\n description?: string | ((input?: z.infer<TInput>) => Promise<string>)\n inputSchema: TInput\n inputJSONSchema?: Record<string, unknown>\n prompt: (options?: { safeMode?: boolean }) => Promise<string>\n userFacingName?: (input?: z.infer<TInput>) => string\n cachedDescription?: string\n isEnabled: () => Promise<boolean>\n isReadOnly: (input?: z.infer<TInput>) => boolean\n isConcurrencySafe: (input?: z.infer<TInput>) => boolean\n needsPermissions: (input?: z.infer<TInput>) => boolean\n requiresUserInteraction?: (input?: z.infer<TInput>) => boolean\n validateInput?: (\n input: z.infer<TInput>,\n context?: ToolUseContext,\n ) => Promise<ValidationResult>\n renderResultForAssistant: (output: TOutput) => string | any[]\n renderToolUseMessage: (\n input: z.infer<TInput>,\n options: { verbose: boolean },\n ) => string | React.ReactElement | null\n renderToolUseRejectedMessage?: (...args: any[]) => React.ReactElement\n renderToolResultMessage?: (\n output: TOutput,\n options: { verbose: boolean },\n ) => React.ReactNode\n call: (\n input: z.infer<TInput>,\n context: ToolUseContext,\n ) => AsyncGenerator<\n | {\n type: 'result'\n data: TOutput\n resultForAssistant?: string | any[]\n newMessages?: unknown[]\n contextModifier?: {\n modifyContext: (ctx: ToolUseContext) => ToolUseContext\n }\n }\n | {\n type: 'progress'\n content: any\n normalizedMessages?: any[]\n tools?: any[]\n },\n void,\n unknown\n >\n}\n\nexport function getToolDescription(tool: Tool): string {\n if (tool.cachedDescription) {\n return tool.cachedDescription\n }\n\n if (typeof tool.description === 'string') {\n return tool.description\n }\n\n return `Tool: ${tool.name}`\n}\n"],
|
|
5
|
+
"mappings": ";;;;AAgHO,SAAS,mBAAmB,MAAoB;AACrD,MAAI,KAAK,mBAAmB;AAC1B,WAAO,KAAK;AAAA,EACd;AAEA,MAAI,OAAO,KAAK,gBAAgB,UAAU;AACxC,WAAO,KAAK;AAAA,EACd;AAEA,SAAO,SAAS,KAAK,IAAI;AAC3B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -4,7 +4,7 @@ const require = __pybCreateRequire(import.meta.url);
|
|
|
4
4
|
// package.json
|
|
5
5
|
var package_default = {
|
|
6
6
|
name: "pybao-cli",
|
|
7
|
-
version: "1.3.
|
|
7
|
+
version: "1.3.5",
|
|
8
8
|
bin: {
|
|
9
9
|
pyb: "cli.js",
|
|
10
10
|
"pyb-acp": "cli-acp.js"
|
|
@@ -142,9 +142,9 @@ var package_default = {
|
|
|
142
142
|
// src/constants/macros.ts
|
|
143
143
|
var MACRO = {
|
|
144
144
|
VERSION: package_default.version,
|
|
145
|
-
README_URL: "https://github.com/shareAI-lab/
|
|
146
|
-
PACKAGE_URL: "@shareai-lab/
|
|
147
|
-
ISSUES_EXPLAINER: "report the issue at https://github.com/shareAI-lab/
|
|
145
|
+
README_URL: "https://github.com/shareAI-lab/pyb#readme",
|
|
146
|
+
PACKAGE_URL: "@shareai-lab/pyb",
|
|
147
|
+
ISSUES_EXPLAINER: "report the issue at https://github.com/shareAI-lab/pyb/issues"
|
|
148
148
|
};
|
|
149
149
|
|
|
150
150
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../package.json", "../src/constants/macros.ts"],
|
|
4
|
-
"sourcesContent": ["{\n \"name\": \"pybao-cli\",\n \"version\": \"1.3.
|
|
4
|
+
"sourcesContent": ["{\n \"name\": \"pybao-cli\",\n \"version\": \"1.3.5\",\n \"bin\": {\n \"pyb\": \"cli.js\",\n \"pyb-acp\": \"cli-acp.js\"\n },\n \"engines\": {\n \"node\": \">=20.18.1\"\n },\n \"main\": \"cli.js\",\n \"author\": \"PYB-XC\",\n \"license\": \"MIT\",\n \"description\": \"PYB-CLI - Minimal AI Agent with multi-model support and CLI interface\",\n \"keywords\": [\n \"ai\",\n \"agent\",\n \"minimal\",\n \"claude\"\n ],\n \"homepage\": \"https://github.com/pyb-xc/pyb-ts\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/pyb-xc/pyb-ts.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/pyb-xc/pyb-ts/issues\"\n },\n \"files\": [\n \"cli.js\",\n \"cli-acp.js\",\n \"yoga.wasm\",\n \"dist/**/*\",\n \"scripts/binary-utils.cjs\",\n \"scripts/cli-wrapper.cjs\",\n \"scripts/cli-acp-wrapper.cjs\",\n \"scripts/postinstall.js\",\n \".npmrc\"\n ],\n \"scripts\": {\n \"dev\": \"bun run ./src/entrypoints/cli.tsx --verbose\",\n \"build:npm\": \"bun run scripts/build.mjs\",\n \"build\": \"bun run build:npm\",\n \"build:binary\": \"bun run scripts/build-binary.mjs\",\n \"clean\": \"bun run scripts/clean.mjs\",\n \"prepublishOnly\": \"bun run build:npm && bun run scripts/prepublish-check.js\",\n \"postinstall\": \"node scripts/postinstall.js || true\",\n \"format\": \"prettier --write \\\"src/**/*.{ts,tsx,js,jsx,json}\\\" \\\"tests/**/*.{ts,tsx,js,jsx,json}\\\"\",\n \"format:check\": \"prettier --check \\\"src/**/*.{ts,tsx,js,jsx,json}\\\" \\\"tests/**/*.{ts,tsx,js,jsx,json}\\\"\",\n \"lint\": \"eslint . --ext .ts,.tsx,.js --max-warnings 0\",\n \"lint:fix\": \"eslint . --ext .ts,.tsx,.js --fix\",\n \"test\": \"bun test\",\n \"test:unit\": \"bun test tests/unit\",\n \"test:integration\": \"bun test tests/integration\",\n \"test:e2e\": \"bun test tests/e2e\",\n \"typecheck\": \"tsc --noEmit\",\n \"prepare\": \"bun run scripts/install-hooks.mjs\",\n \"publish:dev\": \"bun run scripts/publish-dev.js\",\n \"publish:release\": \"bun run scripts/publish-release.js\",\n \"bench:startup\": \"bun run scripts/bench-startup.mjs\",\n \"parity:reference\": \"bun run scripts/reference-parity-check.mjs\"\n },\n \"dependencies\": {\n \"@anthropic-ai/bedrock-sdk\": \"^0.12.6\",\n \"@anthropic-ai/sdk\": \"^0.39.0\",\n \"@anthropic-ai/vertex-sdk\": \"^0.7.0\",\n \"@aws-sdk/client-bedrock-runtime\": \"3.797.0\",\n \"@commander-js/extra-typings\": \"^13.1.0\",\n \"@inkjs/ui\": \"^2.0.0\",\n \"@modelcontextprotocol/sdk\": \"^1.15.1\",\n \"@types/lodash-es\": \"^4.17.12\",\n \"@types/react\": \"^19.1.8\",\n \"@vscode/ripgrep\": \"^1.17.0\",\n \"ajv\": \"^8.17.1\",\n \"ansi-escapes\": \"^7.0.0\",\n \"chalk\": \"^5.4.1\",\n \"cli-highlight\": \"^2.1.11\",\n \"cli-table3\": \"^0.6.5\",\n \"commander\": \"^13.1.0\",\n \"debug\": \"^4.4.1\",\n \"diff\": \"^7.0.0\",\n \"dotenv\": \"^16.6.1\",\n \"env-paths\": \"^3.0.0\",\n \"fflate\": \"^0.8.2\",\n \"figures\": \"^6.1.0\",\n \"glob\": \"^11.0.3\",\n \"gray-matter\": \"^4.0.3\",\n \"highlight.js\": \"^11.11.1\",\n \"ignore\": \"^7.0.5\",\n \"ink\": \"5.2.1\",\n \"ink-link\": \"^4.1.0\",\n \"ink-select-input\": \"^6.2.0\",\n \"ink-text-input\": \"^6.0.0\",\n \"js-yaml\": \"^4.1.1\",\n \"lodash-es\": \"^4.17.21\",\n \"lru-cache\": \"^11.1.0\",\n \"marked\": \"^15.0.12\",\n \"minimatch\": \"^10.1.1\",\n \"nanoid\": \"^5.1.5\",\n \"node-fetch\": \"^3.3.2\",\n \"node-html-parser\": \"^7.0.1\",\n \"openai\": \"4.104.0\",\n \"react\": \"18.3.1\",\n \"semver\": \"^7.7.2\",\n \"shell-quote\": \"^1.8.3\",\n \"spawn-rx\": \"^5.1.2\",\n \"string-width\": \"^7.2.0\",\n \"strip-ansi\": \"^7.1.0\",\n \"tsx\": \"^4.20.3\",\n \"turndown\": \"^7.2.0\",\n \"undici\": \"^7.11.0\",\n \"which\": \"^6.0.0\",\n \"wrap-ansi\": \"^9.0.0\",\n \"zod\": \"^3.25.76\",\n \"zod-to-json-schema\": \"^3.24.6\"\n },\n \"devDependencies\": {\n \"@types/bun\": \"latest\",\n \"@types/jest\": \"^30.0.0\",\n \"@types/node\": \"^24.1.0\",\n \"@types/which\": \"^3.0.4\",\n \"@typescript-eslint/eslint-plugin\": \"^8.50.1\",\n \"@typescript-eslint/parser\": \"^8.50.1\",\n \"bun-types\": \"latest\",\n \"esbuild\": \"^0.25.9\",\n \"eslint\": \"8.57.0\",\n \"eslint-plugin-react-hooks\": \"^7.0.1\",\n \"prettier\": \"^3.6.2\",\n \"react-devtools-core\": \"^7.0.1\",\n \"typescript\": \"^5.9.2\"\n },\n \"overrides\": {\n \"@aws-sdk/client-bedrock-runtime\": \"3.797.0\",\n \"@smithy/smithy-client\": \"2.5.1\"\n }\n}\n", "import pkg from '../../package.json'\n\nexport const MACRO = {\n VERSION: pkg.version,\n README_URL: 'https://github.com/shareAI-lab/pyb#readme',\n PACKAGE_URL: '@shareai-lab/pyb',\n ISSUES_EXPLAINER:\n 'report the issue at https://github.com/shareAI-lab/pyb/issues',\n}\n"],
|
|
5
5
|
"mappings": ";;;;AAAA;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,KAAO;AAAA,IACL,KAAO;AAAA,IACP,WAAW;AAAA,EACb;AAAA,EACA,SAAW;AAAA,IACT,MAAQ;AAAA,EACV;AAAA,EACA,MAAQ;AAAA,EACR,QAAU;AAAA,EACV,SAAW;AAAA,EACX,aAAe;AAAA,EACf,UAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,UAAY;AAAA,EACZ,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,MAAQ;AAAA,IACN,KAAO;AAAA,EACT;AAAA,EACA,OAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,SAAW;AAAA,IACT,KAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,OAAS;AAAA,IACT,gBAAkB;AAAA,IAClB,aAAe;AAAA,IACf,QAAU;AAAA,IACV,gBAAgB;AAAA,IAChB,MAAQ;AAAA,IACR,YAAY;AAAA,IACZ,MAAQ;AAAA,IACR,aAAa;AAAA,IACb,oBAAoB;AAAA,IACpB,YAAY;AAAA,IACZ,WAAa;AAAA,IACb,SAAW;AAAA,IACX,eAAe;AAAA,IACf,mBAAmB;AAAA,IACnB,iBAAiB;AAAA,IACjB,o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BAAuB;AAAA,IACvB,YAAc;AAAA,EAChB;AAAA,EACA,WAAa;AAAA,IACX,mCAAmC;AAAA,IACnC,yBAAyB;AAAA,EAC3B;AACF;;;ACrIO,IAAM,QAAQ;AAAA,EACnB,SAAS,gBAAI;AAAA,EACb,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,kBACE;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,7 +3,7 @@ const require = __pybCreateRequire(import.meta.url);
|
|
|
3
3
|
|
|
4
4
|
// src/services/ai/llmLazy.ts
|
|
5
5
|
async function queryLLM(messages, systemPrompt, maxThinkingTokens, tools, signal, options) {
|
|
6
|
-
const { queryLLM: inner } = await import("./llm-
|
|
6
|
+
const { queryLLM: inner } = await import("./llm-BBYIGM3X.js");
|
|
7
7
|
return inner(
|
|
8
8
|
messages,
|
|
9
9
|
systemPrompt,
|
|
@@ -14,15 +14,15 @@ async function queryLLM(messages, systemPrompt, maxThinkingTokens, tools, signal
|
|
|
14
14
|
);
|
|
15
15
|
}
|
|
16
16
|
async function queryQuick(args) {
|
|
17
|
-
const { queryQuick: inner } = await import("./llm-
|
|
17
|
+
const { queryQuick: inner } = await import("./llm-BBYIGM3X.js");
|
|
18
18
|
return inner(args);
|
|
19
19
|
}
|
|
20
20
|
async function verifyApiKey(apiKey, baseURL, provider) {
|
|
21
|
-
const { verifyApiKey: inner } = await import("./llm-
|
|
21
|
+
const { verifyApiKey: inner } = await import("./llm-BBYIGM3X.js");
|
|
22
22
|
return inner(apiKey, baseURL, provider);
|
|
23
23
|
}
|
|
24
24
|
async function fetchAnthropicModels(apiKey, baseURL) {
|
|
25
|
-
const { fetchAnthropicModels: inner } = await import("./llm-
|
|
25
|
+
const { fetchAnthropicModels: inner } = await import("./llm-BBYIGM3X.js");
|
|
26
26
|
return inner(apiKey, baseURL);
|
|
27
27
|
}
|
|
28
28
|
|