cicy-desktop 2.1.34 → 2.1.36
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 +51 -0
package/package.json
CHANGED
|
@@ -97,6 +97,14 @@ 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 note + a service→account map (e.g. {github:"octocat",
|
|
101
|
+
// gmail:"me@gmail.com"}) for `list profile with <svc>` — written via
|
|
102
|
+
// chrome_set_profile_meta. Legacy array values normalize to {}.
|
|
103
|
+
const note = typeof safeEntry.note === "string" ? safeEntry.note : "";
|
|
104
|
+
const accounts =
|
|
105
|
+
safeEntry.accounts && typeof safeEntry.accounts === "object" && !Array.isArray(safeEntry.accounts)
|
|
106
|
+
? safeEntry.accounts
|
|
107
|
+
: {};
|
|
100
108
|
|
|
101
109
|
return {
|
|
102
110
|
profileKey,
|
|
@@ -108,6 +116,8 @@ function normalizePrivateChromeEntry(profileKey, accountIdx, entry) {
|
|
|
108
116
|
proxy: safeEntry.proxy,
|
|
109
117
|
proxyUrl,
|
|
110
118
|
platform,
|
|
119
|
+
note,
|
|
120
|
+
accounts,
|
|
111
121
|
expanded: {
|
|
112
122
|
orgPath: orgPath ? expandHome(orgPath) : null,
|
|
113
123
|
rpaDir: rpaDir ? expandHome(rpaDir) : null,
|
|
@@ -654,6 +664,47 @@ function registerChromeTools(registerTool) {
|
|
|
654
664
|
{ tag: "Chrome" }
|
|
655
665
|
);
|
|
656
666
|
|
|
667
|
+
registerTool(
|
|
668
|
+
"chrome_set_profile_meta",
|
|
669
|
+
"设置 ~/cicy-ai/db/chrome.json 中指定 accountIdx 的 note(备注)/ accounts(服务→账号 map,用于 list profile with <svc>)",
|
|
670
|
+
z.object({
|
|
671
|
+
accountIdx: z.number().describe("账户索引"),
|
|
672
|
+
note: z.string().optional().describe("自由文本备注;省略则不动"),
|
|
673
|
+
accounts: z
|
|
674
|
+
.record(z.string())
|
|
675
|
+
.optional()
|
|
676
|
+
.describe("服务→账号 map,如 {github:'octocat',gmail:'me@gmail.com'};空值删除该服务;省略则整体不动;与现有合并"),
|
|
677
|
+
}),
|
|
678
|
+
async ({ accountIdx, note, accounts } = {}) => {
|
|
679
|
+
const data = readPrivateChromeConfig();
|
|
680
|
+
const key = `account_${accountIdx}`;
|
|
681
|
+
if (!data[key]) {
|
|
682
|
+
return toToolResult({ error: `Missing chrome.json entry: ${key}` }, { isError: true });
|
|
683
|
+
}
|
|
684
|
+
const patch = { ...data[key], ...(note !== undefined ? { note: String(note) } : {}) };
|
|
685
|
+
if (accounts !== undefined) {
|
|
686
|
+
// Merge into the existing service→account map; empty value deletes a service.
|
|
687
|
+
const cur =
|
|
688
|
+
data[key].accounts && typeof data[key].accounts === "object" && !Array.isArray(data[key].accounts)
|
|
689
|
+
? data[key].accounts
|
|
690
|
+
: {};
|
|
691
|
+
const next = { ...cur };
|
|
692
|
+
for (const [k, v] of Object.entries(accounts)) {
|
|
693
|
+
const svc = String(k).trim().toLowerCase();
|
|
694
|
+
const val = String(v ?? "").trim();
|
|
695
|
+
if (!svc) continue;
|
|
696
|
+
if (val === "") delete next[svc];
|
|
697
|
+
else next[svc] = val;
|
|
698
|
+
}
|
|
699
|
+
patch.accounts = next;
|
|
700
|
+
}
|
|
701
|
+
data[key] = patch;
|
|
702
|
+
writePrivateChromeConfig(data);
|
|
703
|
+
return toToolResult({ success: true, profileKey: key, privateConfig: data[key] });
|
|
704
|
+
},
|
|
705
|
+
{ tag: "Chrome" }
|
|
706
|
+
);
|
|
707
|
+
|
|
657
708
|
registerTool(
|
|
658
709
|
"chrome_close_profile",
|
|
659
710
|
"关闭指定 accountIdx 对应的真实 Chrome profile 进程",
|