chatroom-cli 1.0.0
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/api.d.ts +86 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +29 -0
- package/dist/api.js.map +1 -0
- package/dist/commands/auth-login.d.ts +10 -0
- package/dist/commands/auth-login.d.ts.map +1 -0
- package/dist/commands/auth-login.js +165 -0
- package/dist/commands/auth-login.js.map +1 -0
- package/dist/commands/auth-logout.d.ts +6 -0
- package/dist/commands/auth-logout.d.ts.map +1 -0
- package/dist/commands/auth-logout.js +21 -0
- package/dist/commands/auth-logout.js.map +1 -0
- package/dist/commands/auth-status.d.ts +6 -0
- package/dist/commands/auth-status.d.ts.map +1 -0
- package/dist/commands/auth-status.js +50 -0
- package/dist/commands/auth-status.js.map +1 -0
- package/dist/commands/complete.d.ts +5 -0
- package/dist/commands/complete.d.ts.map +1 -0
- package/dist/commands/complete.js +36 -0
- package/dist/commands/complete.js.map +1 -0
- package/dist/commands/create.d.ts +9 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +58 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +45 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts +5 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +22 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/send.d.ts +11 -0
- package/dist/commands/send.d.ts.map +1 -0
- package/dist/commands/send.js +55 -0
- package/dist/commands/send.js.map +1 -0
- package/dist/commands/task-complete.d.ts +12 -0
- package/dist/commands/task-complete.d.ts.map +1 -0
- package/dist/commands/task-complete.js +58 -0
- package/dist/commands/task-complete.js.map +1 -0
- package/dist/commands/wait-for-message.d.ts +11 -0
- package/dist/commands/wait-for-message.d.ts.map +1 -0
- package/dist/commands/wait-for-message.js +249 -0
- package/dist/commands/wait-for-message.js.map +1 -0
- package/dist/config/defaults.d.ts +16 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +78 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/loader.d.ts +52 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +204 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +56 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +106 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config.d.ts +18 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +18 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +132 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/auth/middleware.d.ts +20 -0
- package/dist/infrastructure/auth/middleware.d.ts.map +1 -0
- package/dist/infrastructure/auth/middleware.js +86 -0
- package/dist/infrastructure/auth/middleware.js.map +1 -0
- package/dist/infrastructure/auth/storage.d.ts +44 -0
- package/dist/infrastructure/auth/storage.d.ts.map +1 -0
- package/dist/infrastructure/auth/storage.js +113 -0
- package/dist/infrastructure/auth/storage.js.map +1 -0
- package/dist/infrastructure/convex/client.d.ts +16 -0
- package/dist/infrastructure/convex/client.d.ts.map +1 -0
- package/dist/infrastructure/convex/client.js +52 -0
- package/dist/infrastructure/convex/client.js.map +1 -0
- package/dist/infrastructure/history/storage.d.ts +21 -0
- package/dist/infrastructure/history/storage.d.ts.map +1 -0
- package/dist/infrastructure/history/storage.js +56 -0
- package/dist/infrastructure/history/storage.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List chatroom history
|
|
3
|
+
*/
|
|
4
|
+
import { listChatroomHistory } from '../infrastructure/history/storage.js';
|
|
5
|
+
export async function listChatrooms() {
|
|
6
|
+
const history = await listChatroomHistory();
|
|
7
|
+
if (history.length === 0) {
|
|
8
|
+
console.log('No chatrooms found in history.');
|
|
9
|
+
console.log('Run `chatroom create` to create a new chatroom.');
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
console.log('\n📋 Chatroom History\n');
|
|
13
|
+
console.log('─'.repeat(80));
|
|
14
|
+
for (const entry of history) {
|
|
15
|
+
console.log(`ID: ${entry.chatroomId}`);
|
|
16
|
+
console.log(`Team: ${entry.teamName} (${entry.teamRoles.join(', ')})`);
|
|
17
|
+
console.log(`Created: ${new Date(entry.createdAt).toLocaleString()}`);
|
|
18
|
+
console.log('─'.repeat(80));
|
|
19
|
+
}
|
|
20
|
+
console.log(`\nTotal: ${history.length} chatroom(s)`);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,OAAO,GAAG,MAAM,mBAAmB,EAAE,CAAC;IAE5C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;QAC/D,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAE5B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5E,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QACxE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,YAAY,OAAO,CAAC,MAAM,cAAc,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Send a message to a chatroom
|
|
3
|
+
*/
|
|
4
|
+
interface SendOptions {
|
|
5
|
+
message: string;
|
|
6
|
+
role?: string;
|
|
7
|
+
skipReadyCheck?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function sendMessage(chatroomId: string, options: SendOptions): Promise<void>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=send.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/commands/send.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,UAAU,WAAW;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAsB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAuDzF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Send a message to a chatroom
|
|
3
|
+
*/
|
|
4
|
+
import { api } from '../api.js';
|
|
5
|
+
import { getSessionId } from '../infrastructure/auth/storage.js';
|
|
6
|
+
import { getConvexClient } from '../infrastructure/convex/client.js';
|
|
7
|
+
export async function sendMessage(chatroomId, options) {
|
|
8
|
+
const client = await getConvexClient();
|
|
9
|
+
const role = options.role || 'user';
|
|
10
|
+
// Get session ID for authentication
|
|
11
|
+
const sessionId = getSessionId();
|
|
12
|
+
if (!sessionId) {
|
|
13
|
+
console.error(`❌ Not authenticated. Please run: chatroom auth login`);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
// Validate chatroom ID format
|
|
17
|
+
if (!chatroomId ||
|
|
18
|
+
typeof chatroomId !== 'string' ||
|
|
19
|
+
chatroomId.length < 20 ||
|
|
20
|
+
chatroomId.length > 40) {
|
|
21
|
+
console.error(`❌ Invalid chatroom ID format: ID must be 20-40 characters (got ${chatroomId?.length || 0})`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
// Check team readiness (unless skipped)
|
|
25
|
+
if (!options.skipReadyCheck && role.toLowerCase() === 'user') {
|
|
26
|
+
const readiness = await client.query(api.chatrooms.getTeamReadiness, {
|
|
27
|
+
sessionId,
|
|
28
|
+
chatroomId: chatroomId,
|
|
29
|
+
});
|
|
30
|
+
if (readiness && !readiness.isReady) {
|
|
31
|
+
console.log(`✅ Team ready: ${readiness.teamName} (${readiness.expectedRoles.join(', ')})`);
|
|
32
|
+
}
|
|
33
|
+
else if (readiness && readiness.missingRoles.length > 0) {
|
|
34
|
+
console.error(`⚠️ Team not ready. Missing: ${readiness.missingRoles.join(', ')}`);
|
|
35
|
+
console.error(' Use --skip-ready-check to send anyway');
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
const messageId = await client.mutation(api.messages.send, {
|
|
41
|
+
sessionId,
|
|
42
|
+
chatroomId: chatroomId,
|
|
43
|
+
senderRole: role,
|
|
44
|
+
content: options.message,
|
|
45
|
+
type: 'message',
|
|
46
|
+
});
|
|
47
|
+
console.log(`✅ Message sent!`);
|
|
48
|
+
console.log(`📋 Message ID: ${messageId}`);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error(`❌ Failed to send message: ${error.message}`);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=send.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send.js","sourceRoot":"","sources":["../../src/commands/send.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,GAAG,EAAW,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAQrE,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,UAAkB,EAAE,OAAoB;IACxE,MAAM,MAAM,GAAG,MAAM,eAAe,EAAE,CAAC;IACvC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC;IAEpC,oCAAoC;IACpC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,sDAAsD,CAAC,CAAC;QACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,8BAA8B;IAC9B,IACE,CAAC,UAAU;QACX,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,CAAC,MAAM,GAAG,EAAE;QACtB,UAAU,CAAC,MAAM,GAAG,EAAE,EACtB,CAAC;QACD,OAAO,CAAC,KAAK,CACX,kEAAkE,UAAU,EAAE,MAAM,IAAI,CAAC,GAAG,CAC7F,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,wCAAwC;IACxC,IAAI,CAAC,OAAO,CAAC,cAAc,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;QAC7D,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS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4
|
+
interface TaskCompleteOptions {
|
|
5
|
+
role: string;
|
|
6
|
+
message: string;
|
|
7
|
+
nextRole: string;
|
|
8
|
+
noWait?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function taskComplete(chatroomId: string, options: TaskCompleteOptions): Promise<void>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=task-complete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-complete.d.ts","sourceRoot":"","sources":["../../src/commands/task-complete.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA4Df"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Complete a task and hand off to the next role
|
|
3
|
+
*/
|
|
4
|
+
import { waitForMessage } from './wait-for-message.js';
|
|
5
|
+
import { api } from '../api.js';
|
|
6
|
+
import { getSessionId } from '../infrastructure/auth/storage.js';
|
|
7
|
+
import { getConvexClient } from '../infrastructure/convex/client.js';
|
|
8
|
+
export async function taskComplete(chatroomId, options) {
|
|
9
|
+
const client = await getConvexClient();
|
|
10
|
+
const { role, message, nextRole, noWait } = options;
|
|
11
|
+
// Get session ID for authentication
|
|
12
|
+
const sessionId = getSessionId();
|
|
13
|
+
if (!sessionId) {
|
|
14
|
+
console.error(`❌ Not authenticated. Please run: chatroom auth login`);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
// Validate chatroom ID format
|
|
18
|
+
if (!chatroomId ||
|
|
19
|
+
typeof chatroomId !== 'string' ||
|
|
20
|
+
chatroomId.length < 20 ||
|
|
21
|
+
chatroomId.length > 40) {
|
|
22
|
+
console.error(`❌ Invalid chatroom ID format: ID must be 20-40 characters (got ${chatroomId?.length || 0})`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
// Send handoff message
|
|
26
|
+
await client.mutation(api.messages.send, {
|
|
27
|
+
sessionId,
|
|
28
|
+
chatroomId: chatroomId,
|
|
29
|
+
senderRole: role,
|
|
30
|
+
content: message,
|
|
31
|
+
targetRole: nextRole,
|
|
32
|
+
type: 'handoff',
|
|
33
|
+
});
|
|
34
|
+
// Update participant status to waiting
|
|
35
|
+
await client.mutation(api.participants.updateStatus, {
|
|
36
|
+
sessionId,
|
|
37
|
+
chatroomId: chatroomId,
|
|
38
|
+
role,
|
|
39
|
+
status: 'waiting',
|
|
40
|
+
});
|
|
41
|
+
console.log(`✅ Task completed and handed off to ${nextRole}`);
|
|
42
|
+
console.log(`📋 Summary: ${message.substring(0, 100)}${message.length > 100 ? '...' : ''}`);
|
|
43
|
+
// Check if handing off to user (workflow completion)
|
|
44
|
+
if (nextRole.toLowerCase() === 'user') {
|
|
45
|
+
console.log(`\n🎉 Workflow complete! Control returned to user.`);
|
|
46
|
+
if (!noWait) {
|
|
47
|
+
console.log(`\n⏳ Waiting for next assignment...`);
|
|
48
|
+
await waitForMessage(chatroomId, { role, silent: true });
|
|
49
|
+
}
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// Auto-wait for next message unless --no-wait is specified
|
|
53
|
+
if (!noWait) {
|
|
54
|
+
console.log(`\n⏳ Waiting for next assignment...`);
|
|
55
|
+
await waitForMessage(chatroomId, { role, silent: true });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=task-complete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-complete.js","sourceRoot":"","sources":["../../src/commands/task-complete.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,u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,IAAI;QACJ,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,sCAAsC,QAAQ,EAAE,CAAC,CAAC;IAC9D,OAAO,CAAC,GAAG,CAAC,eAAe,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAE5F,qDAAqD;IACrD,IAAI,QAAQ,CAAC,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;QACjE,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;YAClD,MAAM,cAAc,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO;IACT,CAAC;IAED,2DAA2D;IAC3D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;QAClD,MAAM,cAAc,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wait for messages in a chatroom
|
|
3
|
+
*/
|
|
4
|
+
interface WaitForMessageOptions {
|
|
5
|
+
role: string;
|
|
6
|
+
timeout?: number;
|
|
7
|
+
silent?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function waitForMessage(chatroomId: string, options: WaitForMessageOptions): Promise<void>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=wait-for-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait-for-message.d.ts","sourceRoot":"","sources":["../../src/commands/wait-for-message.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,IAAI,CAAC,CA8Rf"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wait for messages in a chatroom
|
|
3
|
+
*/
|
|
4
|
+
import { api } from '../api.js';
|
|
5
|
+
import { WAIT_POLL_INTERVAL_MS, MAX_SILENT_ERRORS } from '../config.js';
|
|
6
|
+
import { getSessionId } from '../infrastructure/auth/storage.js';
|
|
7
|
+
import { getConvexClient } from '../infrastructure/convex/client.js';
|
|
8
|
+
export async function waitForMessage(chatroomId, options) {
|
|
9
|
+
const client = await getConvexClient();
|
|
10
|
+
const { role, timeout, silent } = options;
|
|
11
|
+
// Get session ID for authentication
|
|
12
|
+
const sessionId = getSessionId();
|
|
13
|
+
if (!sessionId) {
|
|
14
|
+
console.error(`❌ Not authenticated. Please run: chatroom auth login`);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
// Validate chatroom ID format before query
|
|
18
|
+
if (!chatroomId ||
|
|
19
|
+
typeof chatroomId !== 'string' ||
|
|
20
|
+
chatroomId.length < 20 ||
|
|
21
|
+
chatroomId.length > 40) {
|
|
22
|
+
console.error(`❌ Invalid chatroom ID format: ID must be 20-40 characters (got ${chatroomId?.length || 0})`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
if (!/^[a-zA-Z0-9_]+$/.test(chatroomId)) {
|
|
26
|
+
console.error(`❌ Invalid chatroom ID format: ID must contain only alphanumeric characters and underscores`);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
// Validate chatroom exists and user has access
|
|
30
|
+
const chatroom = (await client.query(api.chatrooms.get, {
|
|
31
|
+
sessionId,
|
|
32
|
+
chatroomId: chatroomId,
|
|
33
|
+
}));
|
|
34
|
+
if (!chatroom) {
|
|
35
|
+
console.error(`❌ Chatroom ${chatroomId} not found or access denied`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
// Join the chatroom
|
|
39
|
+
await client.mutation(api.participants.join, {
|
|
40
|
+
sessionId,
|
|
41
|
+
chatroomId: chatroomId,
|
|
42
|
+
role,
|
|
43
|
+
});
|
|
44
|
+
if (!silent) {
|
|
45
|
+
console.log(`✅ Joined chatroom as "${role}"`);
|
|
46
|
+
}
|
|
47
|
+
console.log(`⏳ Waiting for messages...`);
|
|
48
|
+
console.log(`\n${'─'.repeat(50)}`);
|
|
49
|
+
console.log(`After completing this task, run:\n`);
|
|
50
|
+
console.log(`\`\`\`bash`);
|
|
51
|
+
console.log(`chatroom wait-for-message ${chatroomId} --role=${role}`);
|
|
52
|
+
console.log(`\`\`\``);
|
|
53
|
+
console.log(`${'─'.repeat(50)}`);
|
|
54
|
+
console.log(`💡 NOTE: Remember to always wait for messages after your task is complete to prepare for the next task.`);
|
|
55
|
+
console.log(`${'─'.repeat(50)}\n`);
|
|
56
|
+
// Get the current latest message ID to know where to start listening
|
|
57
|
+
// Use pagination to avoid loading entire history
|
|
58
|
+
const existingMessages = (await client.query(api.messages.list, {
|
|
59
|
+
sessionId,
|
|
60
|
+
chatroomId: chatroomId,
|
|
61
|
+
limit: 1,
|
|
62
|
+
}));
|
|
63
|
+
const afterMessageId = existingMessages.length > 0 ? existingMessages[existingMessages.length - 1]._id : undefined;
|
|
64
|
+
// Track errors for better debugging with exponential backoff
|
|
65
|
+
let consecutiveErrors = 0;
|
|
66
|
+
let currentPollInterval = WAIT_POLL_INTERVAL_MS;
|
|
67
|
+
let pollTimeout;
|
|
68
|
+
// Set up optional timeout
|
|
69
|
+
const timeoutHandle = timeout
|
|
70
|
+
? setTimeout(() => {
|
|
71
|
+
if (pollTimeout)
|
|
72
|
+
clearTimeout(pollTimeout);
|
|
73
|
+
console.log(`\n⏱️ Timeout after ${timeout / 1000}s waiting for messages`);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}, timeout)
|
|
76
|
+
: null;
|
|
77
|
+
// Polling function with exponential backoff
|
|
78
|
+
const poll = async () => {
|
|
79
|
+
try {
|
|
80
|
+
const message = (await client.query(api.messages.getLatestForRole, {
|
|
81
|
+
sessionId,
|
|
82
|
+
chatroomId: chatroomId,
|
|
83
|
+
role,
|
|
84
|
+
afterMessageId,
|
|
85
|
+
}));
|
|
86
|
+
if (message) {
|
|
87
|
+
// CRITICAL: Claim the message atomically to handle race conditions
|
|
88
|
+
// This mutation uses Convex's ACID guarantees to ensure only one agent
|
|
89
|
+
// can successfully claim a broadcast message
|
|
90
|
+
const claimed = await client.mutation(api.messages.claimMessage, {
|
|
91
|
+
sessionId,
|
|
92
|
+
messageId: message._id,
|
|
93
|
+
role,
|
|
94
|
+
});
|
|
95
|
+
if (!claimed) {
|
|
96
|
+
// RACE CONDITION DETECTED: Another agent successfully claimed this message
|
|
97
|
+
// This is expected behavior when multiple agents are polling for broadcasts
|
|
98
|
+
console.log(`🔄 Message already claimed by another agent, continuing to wait...`);
|
|
99
|
+
// Schedule next poll with current interval and return early
|
|
100
|
+
pollTimeout = setTimeout(poll, currentPollInterval);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
// SUCCESS: This agent has exclusive claim on the message
|
|
104
|
+
if (pollTimeout)
|
|
105
|
+
clearTimeout(pollTimeout);
|
|
106
|
+
if (timeoutHandle)
|
|
107
|
+
clearTimeout(timeoutHandle);
|
|
108
|
+
// Update participant status to active
|
|
109
|
+
await client.mutation(api.participants.updateStatus, {
|
|
110
|
+
sessionId,
|
|
111
|
+
chatroomId: chatroomId,
|
|
112
|
+
role,
|
|
113
|
+
status: 'active',
|
|
114
|
+
});
|
|
115
|
+
// Get current chatroom state
|
|
116
|
+
const chatroomData = (await client.query(api.chatrooms.get, {
|
|
117
|
+
sessionId,
|
|
118
|
+
chatroomId: chatroomId,
|
|
119
|
+
}));
|
|
120
|
+
const participants = (await client.query(api.participants.list, {
|
|
121
|
+
sessionId,
|
|
122
|
+
chatroomId: chatroomId,
|
|
123
|
+
}));
|
|
124
|
+
// Handle interrupt
|
|
125
|
+
if (message.type === 'interrupt') {
|
|
126
|
+
console.log(`\n${'═'.repeat(50)}`);
|
|
127
|
+
console.log(`⚠️ INTERRUPT RECEIVED`);
|
|
128
|
+
console.log(`${'═'.repeat(50)}`);
|
|
129
|
+
console.log(`Message: ${message.content}`);
|
|
130
|
+
console.log(`\nAll agents have been reset to idle state.`);
|
|
131
|
+
console.log(`Rejoin the chatroom to continue participating.`);
|
|
132
|
+
process.exit(0);
|
|
133
|
+
}
|
|
134
|
+
// Print message details
|
|
135
|
+
console.log(`\n${'═'.repeat(50)}`);
|
|
136
|
+
console.log(`📨 MESSAGE RECEIVED`);
|
|
137
|
+
console.log(`${'═'.repeat(50)}`);
|
|
138
|
+
console.log(`From: ${message.senderRole}`);
|
|
139
|
+
console.log(`Type: ${message.type}`);
|
|
140
|
+
if (message.targetRole) {
|
|
141
|
+
console.log(`To: ${message.targetRole}`);
|
|
142
|
+
}
|
|
143
|
+
console.log(`\n📄 Content:\n${message.content}`);
|
|
144
|
+
// Print chatroom state
|
|
145
|
+
console.log(`\n${'─'.repeat(50)}`);
|
|
146
|
+
console.log(`📋 CHATROOM STATE`);
|
|
147
|
+
console.log(`${'─'.repeat(50)}`);
|
|
148
|
+
console.log(`Chatroom ID: ${chatroomId}`);
|
|
149
|
+
if (chatroomData && chatroomData.teamRoles && chatroomData.teamRoles.length > 0) {
|
|
150
|
+
console.log(`Team: ${chatroomData.teamName || 'Unknown'} (${chatroomData.teamRoles.join(', ')})`);
|
|
151
|
+
}
|
|
152
|
+
console.log(`\nParticipants:`);
|
|
153
|
+
for (const p of participants) {
|
|
154
|
+
const youMarker = p.role.toLowerCase() === role.toLowerCase() ? ' (you)' : '';
|
|
155
|
+
const statusIcon = p.status === 'active' ? '🔵' : p.status === 'waiting' ? '🟢' : '⚪';
|
|
156
|
+
const availableMarker = p.status === 'waiting' && p.role.toLowerCase() !== role.toLowerCase()
|
|
157
|
+
? ' ✓ available'
|
|
158
|
+
: '';
|
|
159
|
+
console.log(` ${statusIcon} ${p.role}${youMarker} - ${p.status}${availableMarker}`);
|
|
160
|
+
}
|
|
161
|
+
// Print next steps
|
|
162
|
+
console.log(`\n${'─'.repeat(50)}`);
|
|
163
|
+
console.log(`📝 NEXT STEPS`);
|
|
164
|
+
console.log(`${'─'.repeat(50)}`);
|
|
165
|
+
console.log(`When your task is complete, run:\n`);
|
|
166
|
+
console.log(` chatroom task-complete ${chatroomId} \\`);
|
|
167
|
+
console.log(` --role=${role} \\`);
|
|
168
|
+
console.log(` --message="<summary of what you accomplished>" \\`);
|
|
169
|
+
console.log(` --next-role=<target>\n`);
|
|
170
|
+
// Print reminder
|
|
171
|
+
console.log(`${'─'.repeat(50)}`);
|
|
172
|
+
console.log(`After completing this task, run:\n`);
|
|
173
|
+
console.log(`\`\`\`bash`);
|
|
174
|
+
console.log(`chatroom wait-for-message ${chatroomId} --role=${role}`);
|
|
175
|
+
console.log(`\`\`\``);
|
|
176
|
+
console.log(`${'─'.repeat(50)}`);
|
|
177
|
+
console.log(`💡 NOTE: Remember to always wait for messages after your task is complete to prepare for the next task.`);
|
|
178
|
+
console.log(`${'─'.repeat(50)}`);
|
|
179
|
+
// Output JSON for parsing
|
|
180
|
+
console.log(`${'─'.repeat(50)}`);
|
|
181
|
+
console.log(`📊 MESSAGE DATA (JSON)`);
|
|
182
|
+
console.log(`${'─'.repeat(50)}`);
|
|
183
|
+
const availableHandoffRoles = participants
|
|
184
|
+
.filter((p) => p.status === 'waiting' && p.role.toLowerCase() !== role.toLowerCase())
|
|
185
|
+
.map((p) => p.role);
|
|
186
|
+
const jsonOutput = {
|
|
187
|
+
message: {
|
|
188
|
+
id: message._id,
|
|
189
|
+
senderRole: message.senderRole,
|
|
190
|
+
content: message.content,
|
|
191
|
+
type: message.type,
|
|
192
|
+
},
|
|
193
|
+
chatroom: {
|
|
194
|
+
id: chatroomId,
|
|
195
|
+
participants: participants.map((p) => ({
|
|
196
|
+
role: p.role,
|
|
197
|
+
status: p.status,
|
|
198
|
+
isYou: p.role.toLowerCase() === role.toLowerCase(),
|
|
199
|
+
availableForHandoff: p.status === 'waiting' && p.role.toLowerCase() !== role.toLowerCase(),
|
|
200
|
+
})),
|
|
201
|
+
},
|
|
202
|
+
instructions: {
|
|
203
|
+
taskCompleteCommand: `chatroom task-complete ${chatroomId} --role=${role} --message="<summary>" --next-role=<target>`,
|
|
204
|
+
availableHandoffRoles: [...availableHandoffRoles, 'user'],
|
|
205
|
+
terminationRole: 'user',
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
console.log(JSON.stringify(jsonOutput, null, 2));
|
|
209
|
+
process.exit(0);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
// No message yet, schedule next poll
|
|
213
|
+
pollTimeout = setTimeout(poll, currentPollInterval);
|
|
214
|
+
}
|
|
215
|
+
// Reset error counter and poll interval on success
|
|
216
|
+
consecutiveErrors = 0;
|
|
217
|
+
currentPollInterval = WAIT_POLL_INTERVAL_MS;
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
consecutiveErrors++;
|
|
221
|
+
const err = error;
|
|
222
|
+
// Implement exponential backoff with max limit
|
|
223
|
+
const maxInterval = 30000; // Max 30 seconds
|
|
224
|
+
currentPollInterval = Math.min(WAIT_POLL_INTERVAL_MS * Math.pow(2, Math.min(consecutiveErrors - 1, 10)), maxInterval);
|
|
225
|
+
if (consecutiveErrors === MAX_SILENT_ERRORS) {
|
|
226
|
+
console.warn(`⚠️ Connection issues, retrying with backoff... (${err.message})`);
|
|
227
|
+
console.warn(` Next retry in ${currentPollInterval / 1000}s`);
|
|
228
|
+
}
|
|
229
|
+
else if (consecutiveErrors > MAX_SILENT_ERRORS && consecutiveErrors % 10 === 0) {
|
|
230
|
+
console.warn(`⚠️ Still experiencing issues after ${consecutiveErrors} attempts`);
|
|
231
|
+
console.warn(` Retry interval: ${currentPollInterval / 1000}s`);
|
|
232
|
+
}
|
|
233
|
+
// Schedule next poll with backoff
|
|
234
|
+
pollTimeout = setTimeout(poll, currentPollInterval);
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
// Start polling
|
|
238
|
+
poll();
|
|
239
|
+
// Handle interrupt
|
|
240
|
+
process.on('SIGINT', () => {
|
|
241
|
+
if (pollTimeout)
|
|
242
|
+
clearTimeout(pollTimeout);
|
|
243
|
+
if (timeoutHandle)
|
|
244
|
+
clearTimeout(timeoutHandle);
|
|
245
|
+
console.log(`\n⚠️ Interrupted`);
|
|
246
|
+
process.exit(0);
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=wait-for-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait-for-message.js","sourceRoot":"","sources":["../../src/commands/wait-for-message.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,GAAG,EAA0D,MAAM,WAAW,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAQrE,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,UAAkB,EAClB,OAA8B;IAE9B,MAAM,MAAM,GAAG,MAAM,eAAe,EAAE,CAAC;IACvC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAE1C,oCAAoC;IACpC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,IAAI,CAAC,SAAS,EAAE,CAAC;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C,CAAC;YAClE,CAAC;iBAAM,IAAI,iBAAiB,GAAG,iBAAiB,IAAI,iBAAiB,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC;gBACjF,OAAO,CAAC,IAAI,CAAC,uCAAuC,iBAAiB,WAAW,CAAC,CAAC;gBAClF,OAAO,CAAC,IAAI,CAAC,sBAAsB,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC;YACpE,CAAC;YAED,kCAAkC;YAClC,WAAW,GAAG,UAAU,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;QACtD,CAAC;IACH,CAAC,CAAC;IAEF,gBAAgB;IAChB,IAAI,EAAE,CAAC;IAEP,mBAAmB;IACnB,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACxB,IAAI,WAAW;YAAE,YAAY,CAAC,WAAW,CAAC,CAAC;QAC3C,IAAI,aAAa;YAAE,YAAY,CAAC,aAAa,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QACjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ChatroomConfig } from './schema';
|
|
2
|
+
/**
|
|
3
|
+
* Default Convex URL - this should be updated to your actual deployment
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_CONVEX_URL = "https://your-deployment.convex.cloud";
|
|
6
|
+
/**
|
|
7
|
+
* Default configuration used when no .chatroom/chatroom.jsonc is found
|
|
8
|
+
* or as the template for `chatroom init`
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_CONFIG: ChatroomConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Default configuration as JSONC string (with comments)
|
|
13
|
+
* Used when generating .chatroom/chatroom.jsonc via `chatroom init`
|
|
14
|
+
*/
|
|
15
|
+
export declare const DEFAULT_CONFIG_JSONC = "{\n // Chatroom CLI Configuration\n // This file defines the Convex backend, agent teams, and prompt customization.\n \n // The Convex deployment URL (required)\n \"convexUrl\": \"https://your-deployment.convex.cloud\",\n \n // The default team to use when --team flag is not specified\n \"defaultTeam\": \"pair\",\n \n // Team definitions\n // Each team specifies the roles that must be present before messages can be sent\n // entryPoint: The role that receives all user messages (defaults to first role)\n \"teams\": {\n // Pair: A minimal team for simple tasks\n \"pair\": {\n \"name\": \"Pair\",\n \"description\": \"A builder and reviewer working together\",\n \"roles\": [\"builder\", \"reviewer\"],\n \"entryPoint\": \"builder\"\n },\n \n // Squad: A full team for complex tasks\n \"squad\": {\n \"name\": \"Squad\",\n \"description\": \"Full team with manager, architects, builders, and reviewers\",\n \"roles\": [\"manager\", \"architect\", \"builder\", \"frontend-designer\", \"reviewer\", \"tester\"],\n \"entryPoint\": \"manager\"\n }\n }\n \n // Prompt customization (optional)\n // Uncomment to customize agent prompts\n // \"prompts\": {\n // // Path to custom init prompt template (replaces default)\n // // \"initPrompt\": \"prompts/init.md\",\n // \n // // System reminders shown to agents\n // \"systemReminders\": {\n // // Set to false to disable system reminders\n // \"enabled\": true\n // // Custom reminder file path\n // // \"waitReminder\": \"prompts/wait-reminder.md\"\n // }\n // }\n}\n";
|
|
16
|
+
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,kBAAkB,yCAAyC,CAAC;AAEzE;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,cAiB5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,umDA8ChC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default Convex URL - this should be updated to your actual deployment
|
|
3
|
+
*/
|
|
4
|
+
export const DEFAULT_CONVEX_URL = 'https://your-deployment.convex.cloud';
|
|
5
|
+
/**
|
|
6
|
+
* Default configuration used when no .chatroom/chatroom.jsonc is found
|
|
7
|
+
* or as the template for `chatroom init`
|
|
8
|
+
*/
|
|
9
|
+
export const DEFAULT_CONFIG = {
|
|
10
|
+
convexUrl: DEFAULT_CONVEX_URL,
|
|
11
|
+
defaultTeam: 'pair',
|
|
12
|
+
teams: {
|
|
13
|
+
pair: {
|
|
14
|
+
name: 'Pair',
|
|
15
|
+
description: 'A builder and reviewer working together',
|
|
16
|
+
roles: ['builder', 'reviewer'],
|
|
17
|
+
entryPoint: 'builder',
|
|
18
|
+
},
|
|
19
|
+
squad: {
|
|
20
|
+
name: 'Squad',
|
|
21
|
+
description: 'Full team with manager, architects, builders, and reviewers',
|
|
22
|
+
roles: ['manager', 'architect', 'builder', 'frontend-designer', 'reviewer', 'tester'],
|
|
23
|
+
entryPoint: 'manager',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Default configuration as JSONC string (with comments)
|
|
29
|
+
* Used when generating .chatroom/chatroom.jsonc via `chatroom init`
|
|
30
|
+
*/
|
|
31
|
+
export const DEFAULT_CONFIG_JSONC = `{
|
|
32
|
+
// Chatroom CLI Configuration
|
|
33
|
+
// This file defines the Convex backend, agent teams, and prompt customization.
|
|
34
|
+
|
|
35
|
+
// The Convex deployment URL (required)
|
|
36
|
+
"convexUrl": "${DEFAULT_CONVEX_URL}",
|
|
37
|
+
|
|
38
|
+
// The default team to use when --team flag is not specified
|
|
39
|
+
"defaultTeam": "pair",
|
|
40
|
+
|
|
41
|
+
// Team definitions
|
|
42
|
+
// Each team specifies the roles that must be present before messages can be sent
|
|
43
|
+
// entryPoint: The role that receives all user messages (defaults to first role)
|
|
44
|
+
"teams": {
|
|
45
|
+
// Pair: A minimal team for simple tasks
|
|
46
|
+
"pair": {
|
|
47
|
+
"name": "Pair",
|
|
48
|
+
"description": "A builder and reviewer working together",
|
|
49
|
+
"roles": ["builder", "reviewer"],
|
|
50
|
+
"entryPoint": "builder"
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
// Squad: A full team for complex tasks
|
|
54
|
+
"squad": {
|
|
55
|
+
"name": "Squad",
|
|
56
|
+
"description": "Full team with manager, architects, builders, and reviewers",
|
|
57
|
+
"roles": ["manager", "architect", "builder", "frontend-designer", "reviewer", "tester"],
|
|
58
|
+
"entryPoint": "manager"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Prompt customization (optional)
|
|
63
|
+
// Uncomment to customize agent prompts
|
|
64
|
+
// "prompts": {
|
|
65
|
+
// // Path to custom init prompt template (replaces default)
|
|
66
|
+
// // "initPrompt": "prompts/init.md",
|
|
67
|
+
//
|
|
68
|
+
// // System reminders shown to agents
|
|
69
|
+
// "systemReminders": {
|
|
70
|
+
// // Set to false to disable system reminders
|
|
71
|
+
// "enabled": true
|
|
72
|
+
// // Custom reminder file path
|
|
73
|
+
// // "waitReminder": "prompts/wait-reminder.md"
|
|
74
|
+
// }
|
|
75
|
+
// }
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,sCAAsC,CAAC;AAEzE;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,SAAS,EAAE,kBAAkB;IAC7B,WAAW,EAAE,MAAM;IACnB,KAAK,EAAE;QACL,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,yCAAyC;YACtD,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC;YAC9B,UAAU,EAAE,SAAS;SACtB;QACD,KAAK,EAAE;YACL,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,6DAA6D;YAC1E,KAAK,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,UAAU,EAAE,QAAQ,CAAC;YACrF,UAAU,EAAE,SAAS;SACtB;KACF;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;kBAKlB,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCnC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ChatroomConfig, TeamDefinition } from './schema';
|
|
2
|
+
/**
|
|
3
|
+
* Get the global config path in user's home directory
|
|
4
|
+
*/
|
|
5
|
+
export declare function getGlobalConfigPath(): string;
|
|
6
|
+
/**
|
|
7
|
+
* Get the global config directory in user's home directory
|
|
8
|
+
*/
|
|
9
|
+
export declare function getGlobalConfigDir(): string;
|
|
10
|
+
/**
|
|
11
|
+
* Find the config file by walking up the directory tree to home directory
|
|
12
|
+
* Then falls back to the global config in ~/.chatroom/chatroom.jsonc
|
|
13
|
+
*/
|
|
14
|
+
export declare function findConfigPath(startDir?: string): string | null;
|
|
15
|
+
/**
|
|
16
|
+
* Create a global config file with the given Convex URL
|
|
17
|
+
*/
|
|
18
|
+
export declare function createGlobalConfig(convexUrl: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Load and parse the configuration file
|
|
21
|
+
* Returns null if file doesn't exist, throws on parse/validation errors
|
|
22
|
+
*/
|
|
23
|
+
export declare function loadConfigFromPath(configPath: string): ChatroomConfig;
|
|
24
|
+
/**
|
|
25
|
+
* Load configuration from the nearest .chatroom/chatroom.jsonc or return defaults
|
|
26
|
+
*/
|
|
27
|
+
export declare function loadConfig(startDir?: string): {
|
|
28
|
+
config: ChatroomConfig;
|
|
29
|
+
configPath: string | null;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Get a specific team from the configuration
|
|
33
|
+
*/
|
|
34
|
+
export declare function getTeam(config: ChatroomConfig, teamId: string): TeamDefinition | null;
|
|
35
|
+
/**
|
|
36
|
+
* Get the default team from the configuration
|
|
37
|
+
*/
|
|
38
|
+
export declare function getDefaultTeam(config: ChatroomConfig): TeamDefinition;
|
|
39
|
+
/**
|
|
40
|
+
* List all available team IDs
|
|
41
|
+
*/
|
|
42
|
+
export declare function getTeamIds(config: ChatroomConfig): string[];
|
|
43
|
+
/**
|
|
44
|
+
* Load a prompt override file from a path (relative to config file or absolute)
|
|
45
|
+
* Returns null if the file doesn't exist
|
|
46
|
+
*/
|
|
47
|
+
export declare function loadPromptOverride(promptPath: string, configPath: string | null): string | null;
|
|
48
|
+
/**
|
|
49
|
+
* Check if system reminders are enabled in the configuration
|
|
50
|
+
*/
|
|
51
|
+
export declare function areSystemRemindersEnabled(config: ChatroomConfig): boolean;
|
|
52
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAM/D;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AA4ED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CA+B9E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAkB5D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,CAoBrE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,QAAQ,GAAE,MAAsB,GAAG;IAC5D,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CASA;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAErF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAMrE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,EAAE,CAE3D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAU/F;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAEzE"}
|