chatroom-cli 1.0.72 → 1.0.73
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/index.js +141 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10568,6 +10568,115 @@ var init_update = __esm(() => {
|
|
|
10568
10568
|
execAsync = promisify(exec);
|
|
10569
10569
|
log = console.log.bind(console);
|
|
10570
10570
|
});
|
|
10571
|
+
|
|
10572
|
+
// src/commands/register-agent.ts
|
|
10573
|
+
var exports_register_agent = {};
|
|
10574
|
+
__export(exports_register_agent, {
|
|
10575
|
+
registerAgent: () => registerAgent
|
|
10576
|
+
});
|
|
10577
|
+
async function registerAgent(chatroomId, options) {
|
|
10578
|
+
const client2 = await getConvexClient();
|
|
10579
|
+
const { role, type } = options;
|
|
10580
|
+
const sessionId = getSessionId();
|
|
10581
|
+
if (!sessionId) {
|
|
10582
|
+
const otherUrls = getOtherSessionUrls();
|
|
10583
|
+
const currentUrl = getConvexUrl();
|
|
10584
|
+
console.error(`❌ Not authenticated for: ${currentUrl}`);
|
|
10585
|
+
if (otherUrls.length > 0) {
|
|
10586
|
+
console.error(`
|
|
10587
|
+
\uD83D\uDCA1 You have sessions for other environments:`);
|
|
10588
|
+
for (const url of otherUrls) {
|
|
10589
|
+
console.error(` • ${url}`);
|
|
10590
|
+
}
|
|
10591
|
+
console.error(`
|
|
10592
|
+
To use a different environment, set CHATROOM_CONVEX_URL:`);
|
|
10593
|
+
console.error(` CHATROOM_CONVEX_URL=${otherUrls[0]} chatroom register-agent ...`);
|
|
10594
|
+
console.error(`
|
|
10595
|
+
Or to authenticate for the current environment:`);
|
|
10596
|
+
}
|
|
10597
|
+
console.error(` chatroom auth login`);
|
|
10598
|
+
process.exit(1);
|
|
10599
|
+
}
|
|
10600
|
+
if (!chatroomId || typeof chatroomId !== "string" || chatroomId.length < 20 || chatroomId.length > 40) {
|
|
10601
|
+
console.error(`❌ Invalid chatroom ID format: ID must be 20-40 characters (got ${chatroomId?.length || 0})`);
|
|
10602
|
+
process.exit(1);
|
|
10603
|
+
}
|
|
10604
|
+
if (!/^[a-zA-Z0-9_]+$/.test(chatroomId)) {
|
|
10605
|
+
console.error(`❌ Invalid chatroom ID format: ID must contain only alphanumeric characters and underscores`);
|
|
10606
|
+
process.exit(1);
|
|
10607
|
+
}
|
|
10608
|
+
const chatroom = await client2.query(api.chatrooms.get, {
|
|
10609
|
+
sessionId,
|
|
10610
|
+
chatroomId
|
|
10611
|
+
});
|
|
10612
|
+
if (!chatroom) {
|
|
10613
|
+
console.error(`❌ Chatroom ${chatroomId} not found or access denied`);
|
|
10614
|
+
process.exit(1);
|
|
10615
|
+
}
|
|
10616
|
+
if (type === "remote") {
|
|
10617
|
+
try {
|
|
10618
|
+
const machineInfo = ensureMachineRegistered();
|
|
10619
|
+
let availableModels = [];
|
|
10620
|
+
try {
|
|
10621
|
+
const registry = getDriverRegistry();
|
|
10622
|
+
for (const driver of registry.all()) {
|
|
10623
|
+
if (driver.capabilities.dynamicModelDiscovery) {
|
|
10624
|
+
const models = await driver.listModels();
|
|
10625
|
+
availableModels = availableModels.concat(models);
|
|
10626
|
+
}
|
|
10627
|
+
}
|
|
10628
|
+
} catch {}
|
|
10629
|
+
await client2.mutation(api.machines.register, {
|
|
10630
|
+
sessionId,
|
|
10631
|
+
machineId: machineInfo.machineId,
|
|
10632
|
+
hostname: machineInfo.hostname,
|
|
10633
|
+
os: machineInfo.os,
|
|
10634
|
+
availableHarnesses: machineInfo.availableHarnesses,
|
|
10635
|
+
harnessVersions: machineInfo.harnessVersions,
|
|
10636
|
+
availableModels
|
|
10637
|
+
});
|
|
10638
|
+
const agentHarness = machineInfo.availableHarnesses.length > 0 ? machineInfo.availableHarnesses[0] : undefined;
|
|
10639
|
+
await client2.mutation(api.machines.saveTeamAgentConfig, {
|
|
10640
|
+
sessionId,
|
|
10641
|
+
chatroomId,
|
|
10642
|
+
role,
|
|
10643
|
+
type: "remote",
|
|
10644
|
+
machineId: machineInfo.machineId,
|
|
10645
|
+
agentHarness,
|
|
10646
|
+
workingDir: process.cwd()
|
|
10647
|
+
});
|
|
10648
|
+
console.log(`✅ Registered as remote agent for role "${role}"`);
|
|
10649
|
+
console.log(` Machine: ${machineInfo.hostname} (${machineInfo.machineId})`);
|
|
10650
|
+
console.log(` Working directory: ${process.cwd()}`);
|
|
10651
|
+
if (agentHarness) {
|
|
10652
|
+
console.log(` Agent harness: ${agentHarness}`);
|
|
10653
|
+
}
|
|
10654
|
+
} catch (error) {
|
|
10655
|
+
console.error(`❌ Registration failed: ${error.message}`);
|
|
10656
|
+
process.exit(1);
|
|
10657
|
+
}
|
|
10658
|
+
} else {
|
|
10659
|
+
try {
|
|
10660
|
+
await client2.mutation(api.machines.saveTeamAgentConfig, {
|
|
10661
|
+
sessionId,
|
|
10662
|
+
chatroomId,
|
|
10663
|
+
role,
|
|
10664
|
+
type: "custom"
|
|
10665
|
+
});
|
|
10666
|
+
console.log(`✅ Registered as custom agent for role "${role}"`);
|
|
10667
|
+
} catch (error) {
|
|
10668
|
+
console.error(`❌ Registration failed: ${error.message}`);
|
|
10669
|
+
process.exit(1);
|
|
10670
|
+
}
|
|
10671
|
+
}
|
|
10672
|
+
}
|
|
10673
|
+
var init_register_agent = __esm(() => {
|
|
10674
|
+
init_api3();
|
|
10675
|
+
init_agent_drivers();
|
|
10676
|
+
init_storage();
|
|
10677
|
+
init_client2();
|
|
10678
|
+
init_machine();
|
|
10679
|
+
});
|
|
10571
10680
|
// ../../services/backend/prompts/base/cli/task-started/command.ts
|
|
10572
10681
|
function taskStartedCommand(params) {
|
|
10573
10682
|
const prefix = params.cliEnvPrefix || "";
|
|
@@ -10684,15 +10793,15 @@ var init_utils = __esm(() => {
|
|
|
10684
10793
|
init_env();
|
|
10685
10794
|
});
|
|
10686
10795
|
|
|
10687
|
-
// ../../services/backend/prompts/base/
|
|
10688
|
-
var
|
|
10796
|
+
// ../../services/backend/prompts/base/shared/getting-started-content.ts
|
|
10797
|
+
var init_getting_started_content = __esm(() => {
|
|
10689
10798
|
init_utils();
|
|
10690
10799
|
});
|
|
10691
10800
|
|
|
10692
10801
|
// ../../services/backend/prompts/base/cli/index.ts
|
|
10693
10802
|
var init_cli = __esm(() => {
|
|
10694
10803
|
init_task_started();
|
|
10695
|
-
|
|
10804
|
+
init_getting_started_content();
|
|
10696
10805
|
});
|
|
10697
10806
|
|
|
10698
10807
|
// ../../services/backend/prompts/base/cli/wait-for-task/command.ts
|
|
@@ -13302,7 +13411,23 @@ Listening for commands...`);
|
|
|
13302
13411
|
}, async (result) => {
|
|
13303
13412
|
if (!result.commands || result.commands.length === 0)
|
|
13304
13413
|
return;
|
|
13305
|
-
const parsed =
|
|
13414
|
+
const parsed = [];
|
|
13415
|
+
for (const raw of result.commands) {
|
|
13416
|
+
const command = parseMachineCommand(raw);
|
|
13417
|
+
if (command !== null) {
|
|
13418
|
+
parsed.push(command);
|
|
13419
|
+
} else {
|
|
13420
|
+
try {
|
|
13421
|
+
await ctx.client.mutation(api.machines.ackCommand, {
|
|
13422
|
+
sessionId: ctx.sessionId,
|
|
13423
|
+
commandId: raw._id,
|
|
13424
|
+
status: "failed",
|
|
13425
|
+
result: `Invalid command: type="${raw.type}" missing required payload fields`
|
|
13426
|
+
});
|
|
13427
|
+
console.warn(`[${formatTimestamp()}] ⚠️ Acked invalid command ${raw._id} (type=${raw.type}) as failed`);
|
|
13428
|
+
} catch {}
|
|
13429
|
+
}
|
|
13430
|
+
}
|
|
13306
13431
|
enqueueCommands(parsed);
|
|
13307
13432
|
await drainQueue();
|
|
13308
13433
|
});
|
|
@@ -13835,6 +13960,18 @@ program2.command("update").description("Update the CLI to the latest version").a
|
|
|
13835
13960
|
const { update: update2 } = await Promise.resolve().then(() => (init_update(), exports_update));
|
|
13836
13961
|
await update2();
|
|
13837
13962
|
});
|
|
13963
|
+
program2.command("register-agent").description("Register agent type for a chatroom role").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Role to register as (e.g., builder, reviewer)").requiredOption("--type <type>", "Agent type: remote or custom").action(async (options) => {
|
|
13964
|
+
await maybeRequireAuth();
|
|
13965
|
+
if (options.type !== "remote" && options.type !== "custom") {
|
|
13966
|
+
console.error(`❌ Invalid agent type: "${options.type}". Must be "remote" or "custom".`);
|
|
13967
|
+
process.exit(1);
|
|
13968
|
+
}
|
|
13969
|
+
const { registerAgent: registerAgent2 } = await Promise.resolve().then(() => (init_register_agent(), exports_register_agent));
|
|
13970
|
+
await registerAgent2(options.chatroomId, {
|
|
13971
|
+
role: options.role,
|
|
13972
|
+
type: options.type
|
|
13973
|
+
});
|
|
13974
|
+
});
|
|
13838
13975
|
program2.command("wait-for-task").description("Join a chatroom and wait for tasks").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Role to join as (e.g., builder, reviewer)").option("--timeout <ms>", "Optional timeout in milliseconds (deprecated, use --duration)").option("--duration <duration>", 'How long to wait (e.g., "1m", "5m", "30s")').action(async (options) => {
|
|
13839
13976
|
await maybeRequireAuth();
|
|
13840
13977
|
const { waitForTask: waitForTask2, parseDuration: parseDuration2 } = await Promise.resolve().then(() => (init_wait_for_task(), exports_wait_for_task));
|