chatroom-cli 1.34.1 → 1.35.1
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 +34 -26
- package/dist/index.js.map +7 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11445,13 +11445,17 @@ import { randomUUID } from "node:crypto";
|
|
|
11445
11445
|
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2, renameSync } from "node:fs";
|
|
11446
11446
|
import { homedir as homedir2, hostname as hostname2 } from "node:os";
|
|
11447
11447
|
import { join as join3 } from "node:path";
|
|
11448
|
+
function chatroomConfigDir() {
|
|
11449
|
+
return join3(homedir2(), ".chatroom");
|
|
11450
|
+
}
|
|
11448
11451
|
function ensureConfigDir2() {
|
|
11449
|
-
|
|
11450
|
-
|
|
11452
|
+
const dir = chatroomConfigDir();
|
|
11453
|
+
if (!existsSync2(dir)) {
|
|
11454
|
+
mkdirSync2(dir, { recursive: true, mode: 448 });
|
|
11451
11455
|
}
|
|
11452
11456
|
}
|
|
11453
11457
|
function getMachineConfigPath() {
|
|
11454
|
-
return join3(
|
|
11458
|
+
return join3(chatroomConfigDir(), MACHINE_FILE);
|
|
11455
11459
|
}
|
|
11456
11460
|
function loadConfigFile() {
|
|
11457
11461
|
const configPath = getMachineConfigPath();
|
|
@@ -11505,9 +11509,14 @@ function createNewEndpointConfig() {
|
|
|
11505
11509
|
harnessVersions: detectHarnessVersions(availableHarnesses)
|
|
11506
11510
|
};
|
|
11507
11511
|
}
|
|
11508
|
-
function ensureMachineRegistered() {
|
|
11512
|
+
function ensureMachineRegistered(options = {}) {
|
|
11513
|
+
const { allowCreate = false } = options;
|
|
11509
11514
|
let config = loadMachineConfig();
|
|
11510
11515
|
if (!config) {
|
|
11516
|
+
if (!allowCreate) {
|
|
11517
|
+
const convexUrl = getConvexUrl();
|
|
11518
|
+
throw new Error(`Machine not registered for endpoint "${convexUrl}". Run "chatroom machine start" to create a new machine identity for this deployment.`);
|
|
11519
|
+
}
|
|
11511
11520
|
config = createNewEndpointConfig();
|
|
11512
11521
|
saveMachineConfig(config);
|
|
11513
11522
|
} else {
|
|
@@ -11529,11 +11538,10 @@ function getMachineId() {
|
|
|
11529
11538
|
const config = loadMachineConfig();
|
|
11530
11539
|
return config?.machineId ?? null;
|
|
11531
11540
|
}
|
|
11532
|
-
var
|
|
11541
|
+
var MACHINE_FILE = "machine.json";
|
|
11533
11542
|
var init_storage2 = __esm(() => {
|
|
11534
11543
|
init_detection();
|
|
11535
11544
|
init_client2();
|
|
11536
|
-
CHATROOM_DIR2 = join3(homedir2(), ".chatroom");
|
|
11537
11545
|
});
|
|
11538
11546
|
|
|
11539
11547
|
// src/infrastructure/machine/daemon-state.ts
|
|
@@ -11629,10 +11637,10 @@ function loadEventCursor(machineId) {
|
|
|
11629
11637
|
const state = loadDaemonState(machineId);
|
|
11630
11638
|
return state?.lastSeenEventId ?? null;
|
|
11631
11639
|
}
|
|
11632
|
-
var
|
|
11640
|
+
var CHATROOM_DIR2, STATE_DIR, STATE_VERSION = "1";
|
|
11633
11641
|
var init_daemon_state = __esm(() => {
|
|
11634
|
-
|
|
11635
|
-
STATE_DIR = join4(
|
|
11642
|
+
CHATROOM_DIR2 = join4(homedir3(), ".chatroom");
|
|
11643
|
+
STATE_DIR = join4(CHATROOM_DIR2, "machines", "state");
|
|
11636
11644
|
});
|
|
11637
11645
|
|
|
11638
11646
|
// src/infrastructure/machine/index.ts
|
|
@@ -11995,7 +12003,7 @@ var init_init = __esm(() => {
|
|
|
11995
12003
|
// src/tools/output.ts
|
|
11996
12004
|
import { join as join5 } from "node:path";
|
|
11997
12005
|
function resolveChatroomDir(workingDir) {
|
|
11998
|
-
return join5(workingDir,
|
|
12006
|
+
return join5(workingDir, CHATROOM_DIR3);
|
|
11999
12007
|
}
|
|
12000
12008
|
async function ensureChatroomDir(deps, workingDir) {
|
|
12001
12009
|
const dir = resolveChatroomDir(workingDir);
|
|
@@ -12004,7 +12012,7 @@ async function ensureChatroomDir(deps, workingDir) {
|
|
|
12004
12012
|
}
|
|
12005
12013
|
async function ensureGitignore(deps, workingDir) {
|
|
12006
12014
|
const gitignorePath = join5(workingDir, ".gitignore");
|
|
12007
|
-
const entry =
|
|
12015
|
+
const entry = CHATROOM_DIR3;
|
|
12008
12016
|
let content = "";
|
|
12009
12017
|
try {
|
|
12010
12018
|
content = await deps.fs.readFile(gitignorePath, "utf8");
|
|
@@ -12035,7 +12043,7 @@ function generateOutputPath(workingDir, toolName, extension, date) {
|
|
|
12035
12043
|
const filename = `${toolName}-${timestamp}.${extension}`;
|
|
12036
12044
|
return join5(resolveChatroomDir(workingDir), filename);
|
|
12037
12045
|
}
|
|
12038
|
-
var
|
|
12046
|
+
var CHATROOM_DIR3 = ".chatroom";
|
|
12039
12047
|
var init_output = () => {};
|
|
12040
12048
|
|
|
12041
12049
|
// ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
@@ -51072,7 +51080,7 @@ async function createDefaultDeps7() {
|
|
|
51072
51080
|
}
|
|
51073
51081
|
async function registerAgent(chatroomId, options, deps) {
|
|
51074
51082
|
const d = deps ?? await createDefaultDeps7();
|
|
51075
|
-
const { role, type } = options;
|
|
51083
|
+
const { role, type, allowTypeChange } = options;
|
|
51076
51084
|
const sessionId = d.session.getSessionId();
|
|
51077
51085
|
if (!sessionId) {
|
|
51078
51086
|
const otherUrls = d.session.getOtherSessionUrls();
|
|
@@ -51117,11 +51125,10 @@ async function registerAgent(chatroomId, options, deps) {
|
|
|
51117
51125
|
}
|
|
51118
51126
|
const config = loadMachineConfig();
|
|
51119
51127
|
try {
|
|
51120
|
-
await d.backend.mutation(api.machines.
|
|
51128
|
+
await d.backend.mutation(api.machines.recordRemoteAgentRegistered, {
|
|
51121
51129
|
sessionId,
|
|
51122
51130
|
chatroomId,
|
|
51123
51131
|
role,
|
|
51124
|
-
agentType: "remote",
|
|
51125
51132
|
machineId
|
|
51126
51133
|
});
|
|
51127
51134
|
} catch {}
|
|
@@ -51130,11 +51137,11 @@ async function registerAgent(chatroomId, options, deps) {
|
|
|
51130
51137
|
console.log(` Working directory: ${process.cwd()}`);
|
|
51131
51138
|
} else {
|
|
51132
51139
|
try {
|
|
51133
|
-
await d.backend.mutation(api.machines.
|
|
51140
|
+
await d.backend.mutation(api.machines.recordCustomAgentRegistered, {
|
|
51134
51141
|
sessionId,
|
|
51135
51142
|
chatroomId,
|
|
51136
51143
|
role,
|
|
51137
|
-
|
|
51144
|
+
allowTypeChange
|
|
51138
51145
|
});
|
|
51139
51146
|
console.log(`✅ Registered as custom agent for role "${role}"`);
|
|
51140
51147
|
} catch (error) {
|
|
@@ -54573,12 +54580,12 @@ function getPidFileName() {
|
|
|
54573
54580
|
return `daemon-${getUrlHash()}.pid`;
|
|
54574
54581
|
}
|
|
54575
54582
|
function ensureChatroomDir2() {
|
|
54576
|
-
if (!existsSync4(
|
|
54577
|
-
mkdirSync4(
|
|
54583
|
+
if (!existsSync4(CHATROOM_DIR4)) {
|
|
54584
|
+
mkdirSync4(CHATROOM_DIR4, { recursive: true, mode: 448 });
|
|
54578
54585
|
}
|
|
54579
54586
|
}
|
|
54580
54587
|
function getPidFilePath() {
|
|
54581
|
-
return join7(
|
|
54588
|
+
return join7(CHATROOM_DIR4, getPidFileName());
|
|
54582
54589
|
}
|
|
54583
54590
|
function isProcessRunning(pid) {
|
|
54584
54591
|
try {
|
|
@@ -54640,10 +54647,10 @@ function acquireLock() {
|
|
|
54640
54647
|
function releaseLock() {
|
|
54641
54648
|
removePid();
|
|
54642
54649
|
}
|
|
54643
|
-
var
|
|
54650
|
+
var CHATROOM_DIR4;
|
|
54644
54651
|
var init_pid = __esm(() => {
|
|
54645
54652
|
init_client2();
|
|
54646
|
-
|
|
54653
|
+
CHATROOM_DIR4 = join7(homedir4(), ".chatroom");
|
|
54647
54654
|
});
|
|
54648
54655
|
|
|
54649
54656
|
// src/commands/machine/daemon-start/utils.ts
|
|
@@ -57497,7 +57504,7 @@ Run: chatroom auth login`);
|
|
|
57497
57504
|
return typedNewSession;
|
|
57498
57505
|
}
|
|
57499
57506
|
function setupMachine() {
|
|
57500
|
-
ensureMachineRegistered();
|
|
57507
|
+
ensureMachineRegistered({ allowCreate: true });
|
|
57501
57508
|
const config3 = loadMachineConfig();
|
|
57502
57509
|
return config3;
|
|
57503
57510
|
}
|
|
@@ -58700,7 +58707,7 @@ toolCommand.command("parse-pdf").description("Parse a PDF file and extract text
|
|
|
58700
58707
|
console.log(result.message);
|
|
58701
58708
|
process.exit(result.success ? 0 : 1);
|
|
58702
58709
|
});
|
|
58703
|
-
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) => {
|
|
58710
|
+
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").option("--allow-type-change", "Required for --type=custom when the role is currently bound to a remote machine; explicitly opts into clearing the existing binding.").action(async (options) => {
|
|
58704
58711
|
await maybeRequireAuth();
|
|
58705
58712
|
if (options.type !== "remote" && options.type !== "custom") {
|
|
58706
58713
|
console.error(`❌ Invalid agent type: "${options.type}". Must be "remote" or "custom".`);
|
|
@@ -58709,7 +58716,8 @@ program2.command("register-agent").description("Register agent type for a chatro
|
|
|
58709
58716
|
const { registerAgent: registerAgent2 } = await Promise.resolve().then(() => (init_register_agent(), exports_register_agent));
|
|
58710
58717
|
await registerAgent2(options.chatroomId, {
|
|
58711
58718
|
role: options.role,
|
|
58712
|
-
type: options.type
|
|
58719
|
+
type: options.type,
|
|
58720
|
+
allowTypeChange: options.allowTypeChange
|
|
58713
58721
|
});
|
|
58714
58722
|
});
|
|
58715
58723
|
program2.command("get-next-task").description("Join a chatroom and get the next task").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Role to join as (e.g., builder, reviewer)").action(async (options) => {
|
|
@@ -59189,5 +59197,5 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
|
59189
59197
|
});
|
|
59190
59198
|
program2.parse();
|
|
59191
59199
|
|
|
59192
|
-
//# debugId=
|
|
59200
|
+
//# debugId=44A7863B280772E964756E2164756E21
|
|
59193
59201
|
//# sourceMappingURL=index.js.map
|