agenticmail 0.3.22 → 0.3.23
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/dist/cli.js +26 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4489,8 +4489,32 @@ async function registerWithOpenClaw(config) {
|
|
|
4489
4489
|
} catch {
|
|
4490
4490
|
}
|
|
4491
4491
|
if (!agentApiKey) {
|
|
4492
|
-
|
|
4493
|
-
|
|
4492
|
+
const createSpinner = new Spinner("config", "Creating default agent...");
|
|
4493
|
+
createSpinner.start();
|
|
4494
|
+
try {
|
|
4495
|
+
const base = `http://${config.api.host}:${config.api.port}`;
|
|
4496
|
+
const createResp = await fetch(`${base}/api/agenticmail/accounts`, {
|
|
4497
|
+
method: "POST",
|
|
4498
|
+
headers: {
|
|
4499
|
+
"Authorization": `Bearer ${config.masterKey}`,
|
|
4500
|
+
"Content-Type": "application/json"
|
|
4501
|
+
},
|
|
4502
|
+
body: JSON.stringify({ name: "secretary", role: "secretary" }),
|
|
4503
|
+
signal: AbortSignal.timeout(1e4)
|
|
4504
|
+
});
|
|
4505
|
+
if (createResp.ok) {
|
|
4506
|
+
const agent = await createResp.json();
|
|
4507
|
+
agentApiKey = agent.apiKey;
|
|
4508
|
+
createSpinner.succeed(`Default agent ${c2.bold('"secretary"')} created`);
|
|
4509
|
+
} else {
|
|
4510
|
+
const errText = await createResp.text();
|
|
4511
|
+
createSpinner.fail(`Could not create agent: ${errText}`);
|
|
4512
|
+
return;
|
|
4513
|
+
}
|
|
4514
|
+
} catch (err) {
|
|
4515
|
+
createSpinner.fail(`Could not create agent: ${err.message}`);
|
|
4516
|
+
return;
|
|
4517
|
+
}
|
|
4494
4518
|
}
|
|
4495
4519
|
const apiUrl = `http://${config.api.host}:${config.api.port}`;
|
|
4496
4520
|
const updated = mergePluginConfig(existing, apiUrl, config.masterKey, agentApiKey, pluginDir);
|