cicy-desktop 2.1.34 → 2.1.35
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/package.json +1 -1
- package/src/tools/chrome-tools.js +33 -0
package/package.json
CHANGED
|
@@ -97,6 +97,10 @@ function normalizePrivateChromeEntry(profileKey, accountIdx, entry) {
|
|
|
97
97
|
const port = typeof safeEntry.port === "number" ? safeEntry.port : null;
|
|
98
98
|
const proxyUrl = normalizePrivateProxy(safeEntry.proxy);
|
|
99
99
|
const platform = safeEntry.platform && typeof safeEntry.platform === "object" ? safeEntry.platform : {};
|
|
100
|
+
// Free-text label + account tags (e.g. ["github","gmail"]) for
|
|
101
|
+
// `list profile with <svc>` — written via chrome_set_profile_meta.
|
|
102
|
+
const note = typeof safeEntry.note === "string" ? safeEntry.note : "";
|
|
103
|
+
const accounts = Array.isArray(safeEntry.accounts) ? safeEntry.accounts : [];
|
|
100
104
|
|
|
101
105
|
return {
|
|
102
106
|
profileKey,
|
|
@@ -108,6 +112,8 @@ function normalizePrivateChromeEntry(profileKey, accountIdx, entry) {
|
|
|
108
112
|
proxy: safeEntry.proxy,
|
|
109
113
|
proxyUrl,
|
|
110
114
|
platform,
|
|
115
|
+
note,
|
|
116
|
+
accounts,
|
|
111
117
|
expanded: {
|
|
112
118
|
orgPath: orgPath ? expandHome(orgPath) : null,
|
|
113
119
|
rpaDir: rpaDir ? expandHome(rpaDir) : null,
|
|
@@ -654,6 +660,33 @@ function registerChromeTools(registerTool) {
|
|
|
654
660
|
{ tag: "Chrome" }
|
|
655
661
|
);
|
|
656
662
|
|
|
663
|
+
registerTool(
|
|
664
|
+
"chrome_set_profile_meta",
|
|
665
|
+
"设置 ~/cicy-ai/db/chrome.json 中指定 accountIdx 的 note(备注)/ accounts(账号标签,用于 list profile with <svc>)",
|
|
666
|
+
z.object({
|
|
667
|
+
accountIdx: z.number().describe("账户索引"),
|
|
668
|
+
note: z.string().optional().describe("自由文本备注;省略则不动"),
|
|
669
|
+
accounts: z.array(z.string()).optional().describe("账号标签数组,如 ['github','gmail'];去重小写;省略则不动"),
|
|
670
|
+
}),
|
|
671
|
+
async ({ accountIdx, note, accounts } = {}) => {
|
|
672
|
+
const data = readPrivateChromeConfig();
|
|
673
|
+
const key = `account_${accountIdx}`;
|
|
674
|
+
if (!data[key]) {
|
|
675
|
+
return toToolResult({ error: `Missing chrome.json entry: ${key}` }, { isError: true });
|
|
676
|
+
}
|
|
677
|
+
data[key] = {
|
|
678
|
+
...data[key],
|
|
679
|
+
...(note !== undefined ? { note: String(note) } : {}),
|
|
680
|
+
...(accounts !== undefined
|
|
681
|
+
? { accounts: [...new Set(accounts.map((a) => String(a).trim().toLowerCase()).filter(Boolean))] }
|
|
682
|
+
: {}),
|
|
683
|
+
};
|
|
684
|
+
writePrivateChromeConfig(data);
|
|
685
|
+
return toToolResult({ success: true, profileKey: key, privateConfig: data[key] });
|
|
686
|
+
},
|
|
687
|
+
{ tag: "Chrome" }
|
|
688
|
+
);
|
|
689
|
+
|
|
657
690
|
registerTool(
|
|
658
691
|
"chrome_close_profile",
|
|
659
692
|
"关闭指定 accountIdx 对应的真实 Chrome profile 进程",
|