@tenex-chat/backend 0.9.4 → 0.9.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/dist/src/index.js +14 -2
- package/package.json +1 -1
- package/src/commands/agent.ts +20 -0
package/dist/src/index.js
CHANGED
|
@@ -46571,7 +46571,7 @@ async function addAgent(eventId) {
|
|
|
46571
46571
|
console.log(chalk15.green(`✓ Installed agent "${stored.name}" (${stored.slug})`));
|
|
46572
46572
|
console.log(chalk15.gray(` pubkey: ${pubkey}`));
|
|
46573
46573
|
}
|
|
46574
|
-
var OPENCLAW_STATE_DIR_NAMES, OPENCLAW_CONFIG_NAMES, importOpenClawCommand, importCommand, addCommand, agentCommand;
|
|
46574
|
+
var OPENCLAW_STATE_DIR_NAMES, OPENCLAW_CONFIG_NAMES, importOpenClawCommand, importCommand, addCommand, assignCommand, agentCommand;
|
|
46575
46575
|
var init_agent2 = __esm(() => {
|
|
46576
46576
|
init_AgentStorage();
|
|
46577
46577
|
init_agent_installer();
|
|
@@ -46589,7 +46589,19 @@ var init_agent2 = __esm(() => {
|
|
|
46589
46589
|
addCommand = new Command10("add").description("Install an agent from a Nostr event ID or stdin JSON").argument("[event-id]", "Nostr event ID of the agent definition").action(async (eventId) => {
|
|
46590
46590
|
await addAgent(eventId);
|
|
46591
46591
|
});
|
|
46592
|
-
|
|
46592
|
+
assignCommand = new Command10("assign").description("Assign an agent to a project by slug").argument("<slug>", "Agent slug").argument("<project-dtag>", "Project d-tag").action(async (slug, projectDTag) => {
|
|
46593
|
+
await agentStorage.initialize();
|
|
46594
|
+
const agent = await agentStorage.getAgentBySlug(slug);
|
|
46595
|
+
if (!agent) {
|
|
46596
|
+
console.error(chalk15.red(`Agent '${slug}' not found.`));
|
|
46597
|
+
process.exitCode = 1;
|
|
46598
|
+
return;
|
|
46599
|
+
}
|
|
46600
|
+
const pubkey = new NDKPrivateKeySigner20(agent.nsec).pubkey;
|
|
46601
|
+
await agentStorage.addAgentToProject(pubkey, projectDTag);
|
|
46602
|
+
console.log(chalk15.green(`Assigned '${slug}' to project '${projectDTag}'.`));
|
|
46603
|
+
});
|
|
46604
|
+
agentCommand = new Command10("agent").description("Manage TENEX agents").addCommand(assignCommand).addCommand(importCommand).addCommand(addCommand);
|
|
46593
46605
|
});
|
|
46594
46606
|
|
|
46595
46607
|
// src/utils/cli-error.ts
|
package/package.json
CHANGED
package/src/commands/agent.ts
CHANGED
|
@@ -209,7 +209,27 @@ const addCommand = new Command("add")
|
|
|
209
209
|
await addAgent(eventId);
|
|
210
210
|
});
|
|
211
211
|
|
|
212
|
+
const assignCommand = new Command("assign")
|
|
213
|
+
.description("Assign an agent to a project by slug")
|
|
214
|
+
.argument("<slug>", "Agent slug")
|
|
215
|
+
.argument("<project-dtag>", "Project d-tag")
|
|
216
|
+
.action(async (slug: string, projectDTag: string) => {
|
|
217
|
+
await agentStorage.initialize();
|
|
218
|
+
|
|
219
|
+
const agent = await agentStorage.getAgentBySlug(slug);
|
|
220
|
+
if (!agent) {
|
|
221
|
+
console.error(chalk.red(`Agent '${slug}' not found.`));
|
|
222
|
+
process.exitCode = 1;
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const pubkey = new NDKPrivateKeySigner(agent.nsec).pubkey;
|
|
227
|
+
await agentStorage.addAgentToProject(pubkey, projectDTag);
|
|
228
|
+
console.log(chalk.green(`Assigned '${slug}' to project '${projectDTag}'.`));
|
|
229
|
+
});
|
|
230
|
+
|
|
212
231
|
export const agentCommand = new Command("agent")
|
|
213
232
|
.description("Manage TENEX agents")
|
|
233
|
+
.addCommand(assignCommand)
|
|
214
234
|
.addCommand(importCommand)
|
|
215
235
|
.addCommand(addCommand);
|