@dmsdc-ai/aigentry-deliberation 0.0.28 → 0.0.29
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/index.js +22 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -946,16 +946,28 @@ async function ensureCdpAvailable() {
|
|
|
946
946
|
|
|
947
947
|
// Chrome 145+ requires --user-data-dir for CDP to work.
|
|
948
948
|
// The default data dir is rejected, so we copy the profile to ~/.chrome-cdp.
|
|
949
|
+
// Profile can be set via env DELIBERATION_CHROME_PROFILE or config.chrome_profile (e.g., "Profile 1").
|
|
949
950
|
const cdpDataDir = path.join(os.homedir(), ".chrome-cdp");
|
|
950
|
-
const
|
|
951
|
+
const cdpConfig = loadDeliberationConfig();
|
|
952
|
+
const profileDir = process.env.DELIBERATION_CHROME_PROFILE || cdpConfig.chrome_profile || "Default";
|
|
951
953
|
|
|
952
954
|
try {
|
|
953
955
|
if (chromeUserDataDir) {
|
|
954
956
|
const srcProfile = path.join(chromeUserDataDir, profileDir);
|
|
955
957
|
const dstProfile = path.join(cdpDataDir, profileDir);
|
|
956
|
-
|
|
958
|
+
// Track which profile was copied; re-copy if profile changed
|
|
959
|
+
const profileMarker = path.join(cdpDataDir, ".cdp-profile");
|
|
960
|
+
const lastProfile = fs.existsSync(profileMarker) ? fs.readFileSync(profileMarker, "utf8").trim() : null;
|
|
961
|
+
const needsCopy = !fs.existsSync(dstProfile) || (lastProfile && lastProfile !== profileDir);
|
|
962
|
+
if (needsCopy && fs.existsSync(srcProfile)) {
|
|
963
|
+
// Clean old profile if switching
|
|
964
|
+
if (lastProfile && lastProfile !== profileDir) {
|
|
965
|
+
const oldDst = path.join(cdpDataDir, lastProfile);
|
|
966
|
+
if (fs.existsSync(oldDst)) fs.rmSync(oldDst, { recursive: true, force: true });
|
|
967
|
+
}
|
|
957
968
|
fs.mkdirSync(cdpDataDir, { recursive: true });
|
|
958
969
|
execFileSync("cp", ["-R", srcProfile, dstProfile], { timeout: 30000, stdio: "ignore" });
|
|
970
|
+
fs.writeFileSync(profileMarker, profileDir);
|
|
959
971
|
// Create minimal Local State with single profile to avoid profile picker
|
|
960
972
|
const localStateSrc = path.join(chromeUserDataDir, "Local State");
|
|
961
973
|
if (fs.existsSync(localStateSrc)) {
|
|
@@ -3427,8 +3439,10 @@ server.tool(
|
|
|
3427
3439
|
.describe("Default number of rounds (1-10, default 3)"),
|
|
3428
3440
|
default_ordering: z.enum(["auto", "cyclic", "random", "weighted-random"]).optional()
|
|
3429
3441
|
.describe("Default ordering strategy: auto (automatic based on speaker count), cyclic, random, weighted-random"),
|
|
3442
|
+
chrome_profile: z.string().optional()
|
|
3443
|
+
.describe("Chrome profile directory name for CDP (e.g., \"Default\", \"Profile 1\"). Stored for auto-launch."),
|
|
3430
3444
|
},
|
|
3431
|
-
safeToolHandler("deliberation_cli_config", async ({ enabled_clis, require_speaker_selection, default_rounds, default_ordering }) => {
|
|
3445
|
+
safeToolHandler("deliberation_cli_config", async ({ enabled_clis, require_speaker_selection, default_rounds, default_ordering, chrome_profile }) => {
|
|
3432
3446
|
const config = loadDeliberationConfig();
|
|
3433
3447
|
|
|
3434
3448
|
// Handle setup config updates
|
|
@@ -3445,6 +3459,10 @@ server.tool(
|
|
|
3445
3459
|
config.default_ordering = default_ordering;
|
|
3446
3460
|
configChanged = true;
|
|
3447
3461
|
}
|
|
3462
|
+
if (chrome_profile !== undefined && chrome_profile !== null) {
|
|
3463
|
+
config.chrome_profile = chrome_profile;
|
|
3464
|
+
configChanged = true;
|
|
3465
|
+
}
|
|
3448
3466
|
if (configChanged) {
|
|
3449
3467
|
config.setup_complete = true;
|
|
3450
3468
|
saveDeliberationConfig(config);
|
|
@@ -3459,7 +3477,7 @@ server.tool(
|
|
|
3459
3477
|
return {
|
|
3460
3478
|
content: [{
|
|
3461
3479
|
type: "text",
|
|
3462
|
-
text: `## Deliberation CLI Settings\n\n**Mode:** ${mode}\n**Speaker selection:** ${config.require_speaker_selection === false ? "auto (all detected speakers join)" : "manual (user selects)"}\n**Default rounds:** ${config.default_rounds || 3}\n**Ordering:** ${config.default_ordering || "auto"}\n**Configured CLIs:** ${configured.length > 0 ? configured.join(", ") : "(none — full auto-detection)"}\n**Currently detected CLIs:** ${detected.join(", ") || "(none)"}\n**All supported CLIs:** ${DEFAULT_CLI_CANDIDATES.join(", ")}\n\nTo change:\n\`deliberation_cli_config(require_speaker_selection: false, default_rounds: 3, default_ordering: "auto")\`\n\nTo revert to full auto-detection:\n\`deliberation_cli_config(enabled_clis: [])\``,
|
|
3480
|
+
text: `## Deliberation CLI Settings\n\n**Mode:** ${mode}\n**Speaker selection:** ${config.require_speaker_selection === false ? "auto (all detected speakers join)" : "manual (user selects)"}\n**Default rounds:** ${config.default_rounds || 3}\n**Ordering:** ${config.default_ordering || "auto"}\n**Chrome profile:** ${config.chrome_profile || "Default"} (env: DELIBERATION_CHROME_PROFILE)\n**Configured CLIs:** ${configured.length > 0 ? configured.join(", ") : "(none — full auto-detection)"}\n**Currently detected CLIs:** ${detected.join(", ") || "(none)"}\n**All supported CLIs:** ${DEFAULT_CLI_CANDIDATES.join(", ")}\n\nTo change:\n\`deliberation_cli_config(require_speaker_selection: false, default_rounds: 3, default_ordering: "auto")\`\n\nTo set Chrome profile for CDP:\n\`deliberation_cli_config(chrome_profile: "Profile 1")\`\n\nTo revert to full auto-detection:\n\`deliberation_cli_config(enabled_clis: [])\``,
|
|
3463
3481
|
}],
|
|
3464
3482
|
};
|
|
3465
3483
|
}
|
package/package.json
CHANGED