chatroom-cli 1.0.73 → 1.0.75
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 +199 -208
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10707,7 +10707,6 @@ var init_new_feature = () => {};
|
|
|
10707
10707
|
var init_classification = __esm(() => {
|
|
10708
10708
|
init_new_feature();
|
|
10709
10709
|
});
|
|
10710
|
-
|
|
10711
10710
|
// ../../services/backend/prompts/base/cli/task-started/main-prompt.ts
|
|
10712
10711
|
var init_main_prompt = () => {};
|
|
10713
10712
|
|
|
@@ -10718,9 +10717,6 @@ var init_task_started = __esm(() => {
|
|
|
10718
10717
|
});
|
|
10719
10718
|
|
|
10720
10719
|
// ../../services/backend/prompts/base/cli/wait-for-task/reminder.ts
|
|
10721
|
-
function getWaitForTaskReminder() {
|
|
10722
|
-
return "Message availability is critical: Use `wait-for-task` in the foreground to stay connected, otherwise your team cannot reach you";
|
|
10723
|
-
}
|
|
10724
10720
|
function getWaitForTaskGuidance() {
|
|
10725
10721
|
return `\uD83D\uDD17 STAYING CONNECTED TO YOUR TEAM
|
|
10726
10722
|
|
|
@@ -10736,11 +10732,11 @@ Two requirements:
|
|
|
10736
10732
|
|
|
10737
10733
|
2. **Blocking execution** - Wait for command completion
|
|
10738
10734
|
• Do not respond to user or perform other work while running
|
|
10739
|
-
• Only proceed after the command exits (
|
|
10735
|
+
• Only proceed after the command exits (signal or task received)
|
|
10740
10736
|
|
|
10741
|
-
|
|
10742
|
-
•
|
|
10743
|
-
• When the command terminates:
|
|
10737
|
+
⚠️ WHEN THE PROCESS IS TERMINATED OR TIMED OUT
|
|
10738
|
+
• Your harness may kill long-running commands after a set duration
|
|
10739
|
+
• When the command terminates unexpectedly:
|
|
10744
10740
|
1. Do you have urgent pending work?
|
|
10745
10741
|
2. Without wait-for-task, your team cannot reach you
|
|
10746
10742
|
3. If no urgent work, reconnect immediately
|
|
@@ -10813,9 +10809,8 @@ function waitForTaskCommand(params) {
|
|
|
10813
10809
|
}
|
|
10814
10810
|
|
|
10815
10811
|
// src/config.ts
|
|
10816
|
-
var
|
|
10812
|
+
var DEFAULT_ACTIVE_TIMEOUT_MS, WEB_SERVER_PORT;
|
|
10817
10813
|
var init_config2 = __esm(() => {
|
|
10818
|
-
DEFAULT_WAIT_TIMEOUT_MS = 10 * 60 * 1000;
|
|
10819
10814
|
DEFAULT_ACTIVE_TIMEOUT_MS = 60 * 60 * 1000;
|
|
10820
10815
|
WEB_SERVER_PORT = parseInt(process.env.WEB_PORT || "3456", 10);
|
|
10821
10816
|
});
|
|
@@ -10823,38 +10818,11 @@ var init_config2 = __esm(() => {
|
|
|
10823
10818
|
// src/commands/wait-for-task.ts
|
|
10824
10819
|
var exports_wait_for_task = {};
|
|
10825
10820
|
__export(exports_wait_for_task, {
|
|
10826
|
-
waitForTask: () => waitForTask
|
|
10827
|
-
parseDuration: () => parseDuration
|
|
10821
|
+
waitForTask: () => waitForTask
|
|
10828
10822
|
});
|
|
10829
|
-
function parseDuration(duration) {
|
|
10830
|
-
const match = duration.trim().match(/^(\d+(?:\.\d+)?)\s*(s|sec|second|seconds|m|min|minute|minutes|h|hr|hour|hours)?$/i);
|
|
10831
|
-
if (!match)
|
|
10832
|
-
return null;
|
|
10833
|
-
const value = parseFloat(match[1]);
|
|
10834
|
-
const unit = (match[2] || "s").toLowerCase();
|
|
10835
|
-
switch (unit) {
|
|
10836
|
-
case "s":
|
|
10837
|
-
case "sec":
|
|
10838
|
-
case "second":
|
|
10839
|
-
case "seconds":
|
|
10840
|
-
return value * 1000;
|
|
10841
|
-
case "m":
|
|
10842
|
-
case "min":
|
|
10843
|
-
case "minute":
|
|
10844
|
-
case "minutes":
|
|
10845
|
-
return value * 60 * 1000;
|
|
10846
|
-
case "h":
|
|
10847
|
-
case "hr":
|
|
10848
|
-
case "hour":
|
|
10849
|
-
case "hours":
|
|
10850
|
-
return value * 60 * 60 * 1000;
|
|
10851
|
-
default:
|
|
10852
|
-
return null;
|
|
10853
|
-
}
|
|
10854
|
-
}
|
|
10855
10823
|
async function waitForTask(chatroomId, options) {
|
|
10856
10824
|
const client2 = await getConvexClient();
|
|
10857
|
-
const { role,
|
|
10825
|
+
const { role, silent } = options;
|
|
10858
10826
|
const convexUrl = getConvexUrl();
|
|
10859
10827
|
const cliEnvPrefix = getCliEnvPrefix(convexUrl);
|
|
10860
10828
|
const sessionId = getSessionId();
|
|
@@ -10931,14 +10899,11 @@ async function waitForTask(chatroomId, options) {
|
|
|
10931
10899
|
console.warn(`⚠️ Machine registration failed: ${machineError.message}`);
|
|
10932
10900
|
}
|
|
10933
10901
|
}
|
|
10934
|
-
const effectiveTimeout = timeout || DEFAULT_WAIT_TIMEOUT_MS;
|
|
10935
|
-
const readyUntil = Date.now() + effectiveTimeout;
|
|
10936
10902
|
const connectionId = `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
10937
10903
|
await client2.mutation(api.participants.join, {
|
|
10938
10904
|
sessionId,
|
|
10939
10905
|
chatroomId,
|
|
10940
10906
|
role,
|
|
10941
|
-
readyUntil,
|
|
10942
10907
|
connectionId
|
|
10943
10908
|
});
|
|
10944
10909
|
const connectionTime = new Date().toISOString().replace("T", " ").substring(0, 19);
|
|
@@ -10976,22 +10941,6 @@ async function waitForTask(chatroomId, options) {
|
|
|
10976
10941
|
} catch {}
|
|
10977
10942
|
let taskProcessed = false;
|
|
10978
10943
|
let unsubscribe = null;
|
|
10979
|
-
const timeoutHandle = setTimeout(() => {
|
|
10980
|
-
if (unsubscribe)
|
|
10981
|
-
unsubscribe();
|
|
10982
|
-
const timeoutTime = new Date().toISOString().replace("T", " ").substring(0, 19);
|
|
10983
|
-
console.log(`
|
|
10984
|
-
${"─".repeat(50)}`);
|
|
10985
|
-
console.log(`⚠️ RECONNECTION REQUIRED
|
|
10986
|
-
`);
|
|
10987
|
-
console.log(`[${timeoutTime}] Why: Session timeout reached (normal and expected behavior)`);
|
|
10988
|
-
console.log(`Impact: You are no longer listening for tasks`);
|
|
10989
|
-
console.log(`Action: Run this command immediately to resume availability
|
|
10990
|
-
`);
|
|
10991
|
-
console.log(waitForTaskCommand({ chatroomId, role, cliEnvPrefix }));
|
|
10992
|
-
console.log(`${"─".repeat(50)}`);
|
|
10993
|
-
process.exit(0);
|
|
10994
|
-
}, effectiveTimeout);
|
|
10995
10944
|
const handlePendingTasks = async (pendingTasks) => {
|
|
10996
10945
|
if (taskProcessed)
|
|
10997
10946
|
return;
|
|
@@ -11003,7 +10952,6 @@ ${"─".repeat(50)}`);
|
|
|
11003
10952
|
if (currentConnectionId && currentConnectionId !== connectionId) {
|
|
11004
10953
|
if (unsubscribe)
|
|
11005
10954
|
unsubscribe();
|
|
11006
|
-
clearTimeout(timeoutHandle);
|
|
11007
10955
|
const takeoverTime = new Date().toISOString().replace("T", " ").substring(0, 19);
|
|
11008
10956
|
console.log(`
|
|
11009
10957
|
${"─".repeat(50)}`);
|
|
@@ -11023,15 +10971,26 @@ ${"─".repeat(50)}`);
|
|
|
11023
10971
|
return;
|
|
11024
10972
|
}
|
|
11025
10973
|
const { task, message } = taskWithMessage;
|
|
11026
|
-
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
10974
|
+
if (task.status === "acknowledged") {
|
|
10975
|
+
const acknowledgedAt = task.acknowledgedAt || task.updatedAt;
|
|
10976
|
+
const elapsedMs = Date.now() - acknowledgedAt;
|
|
10977
|
+
const RECOVERY_GRACE_PERIOD_MS = 60 * 1000;
|
|
10978
|
+
if (elapsedMs < RECOVERY_GRACE_PERIOD_MS) {
|
|
10979
|
+
const remainingSec = Math.ceil((RECOVERY_GRACE_PERIOD_MS - elapsedMs) / 1000);
|
|
10980
|
+
console.log(`\uD83D\uDD04 Task was recently acknowledged (${remainingSec}s remaining). ` + `Re-run wait-for-task in 1 minute to recover it if the other agent is unresponsive.`);
|
|
10981
|
+
return;
|
|
10982
|
+
}
|
|
10983
|
+
} else {
|
|
10984
|
+
try {
|
|
10985
|
+
await client2.mutation(api.tasks.claimTask, {
|
|
10986
|
+
sessionId,
|
|
10987
|
+
chatroomId,
|
|
10988
|
+
role
|
|
10989
|
+
});
|
|
10990
|
+
} catch (_claimError) {
|
|
10991
|
+
console.log(`\uD83D\uDD04 Task already claimed by another agent, continuing to wait...`);
|
|
10992
|
+
return;
|
|
10993
|
+
}
|
|
11035
10994
|
}
|
|
11036
10995
|
taskProcessed = true;
|
|
11037
10996
|
if (message) {
|
|
@@ -11043,7 +11002,6 @@ ${"─".repeat(50)}`);
|
|
|
11043
11002
|
}
|
|
11044
11003
|
if (unsubscribe)
|
|
11045
11004
|
unsubscribe();
|
|
11046
|
-
clearTimeout(timeoutHandle);
|
|
11047
11005
|
const activeUntil = Date.now() + DEFAULT_ACTIVE_TIMEOUT_MS;
|
|
11048
11006
|
await client2.mutation(api.participants.updateStatus, {
|
|
11049
11007
|
sessionId,
|
|
@@ -11064,126 +11022,7 @@ ${"─".repeat(50)}`);
|
|
|
11064
11022
|
console.log(`
|
|
11065
11023
|
[${taskReceivedTime}] \uD83D\uDCE8 Task received!
|
|
11066
11024
|
`);
|
|
11067
|
-
console.log(
|
|
11068
|
-
console.log(`\uD83C\uDD94 TASK INFORMATION`);
|
|
11069
|
-
console.log(`${"=".repeat(60)}`);
|
|
11070
|
-
console.log(`Task ID: ${task._id}`);
|
|
11071
|
-
if (message) {
|
|
11072
|
-
console.log(`Message ID: ${message._id}`);
|
|
11073
|
-
}
|
|
11074
|
-
console.log(`
|
|
11075
|
-
\uD83D\uDCCB NEXT STEPS`);
|
|
11076
|
-
console.log(`${"=".repeat(60)}`);
|
|
11077
|
-
const isUserMessage = message && message.senderRole.toLowerCase() === "user";
|
|
11078
|
-
if (isUserMessage) {
|
|
11079
|
-
console.log(`To acknowledge and classify this message, run:
|
|
11080
|
-
`);
|
|
11081
|
-
const baseCmd = taskStartedCommand({
|
|
11082
|
-
chatroomId,
|
|
11083
|
-
role,
|
|
11084
|
-
taskId: task._id,
|
|
11085
|
-
classification: "question",
|
|
11086
|
-
cliEnvPrefix
|
|
11087
|
-
}).replace("--origin-message-classification=question", "--origin-message-classification=<type>");
|
|
11088
|
-
console.log(baseCmd);
|
|
11089
|
-
console.log(`
|
|
11090
|
-
\uD83D\uDCDD Classification Requirements:`);
|
|
11091
|
-
console.log(` • question: No additional fields required`);
|
|
11092
|
-
console.log(` • follow_up: No additional fields required`);
|
|
11093
|
-
console.log(` • new_feature: REQUIRES --title, --description, --tech-specs`);
|
|
11094
|
-
console.log(`
|
|
11095
|
-
\uD83D\uDCA1 Example for new_feature:`);
|
|
11096
|
-
console.log(taskStartedCommand({
|
|
11097
|
-
chatroomId,
|
|
11098
|
-
role,
|
|
11099
|
-
taskId: task._id,
|
|
11100
|
-
classification: "new_feature",
|
|
11101
|
-
title: "<title>",
|
|
11102
|
-
description: "<description>",
|
|
11103
|
-
techSpecs: "<tech-specs>",
|
|
11104
|
-
cliEnvPrefix
|
|
11105
|
-
}));
|
|
11106
|
-
console.log(`
|
|
11107
|
-
Classification types: question, new_feature, follow_up`);
|
|
11108
|
-
} else if (message) {
|
|
11109
|
-
console.log(`Task handed off from ${message.senderRole}.`);
|
|
11110
|
-
console.log(`The original user message was already classified - you can start work immediately.`);
|
|
11111
|
-
} else {
|
|
11112
|
-
console.log(`No message found. Task ID: ${task._id}`);
|
|
11113
|
-
}
|
|
11114
|
-
console.log(`${"=".repeat(60)}`);
|
|
11115
|
-
console.log(`
|
|
11116
|
-
<!-- CONTEXT: Available Actions & Role Instructions`);
|
|
11117
|
-
console.log(taskDeliveryPrompt.humanReadable);
|
|
11118
|
-
console.log(`-->`);
|
|
11119
|
-
const originMessage = taskDeliveryPrompt.json?.contextWindow?.originMessage;
|
|
11120
|
-
console.log(`
|
|
11121
|
-
${"=".repeat(60)}`);
|
|
11122
|
-
console.log(`\uD83D\uDCCD PINNED - Work on this immediately`);
|
|
11123
|
-
console.log(`${"=".repeat(60)}`);
|
|
11124
|
-
if (originMessage && originMessage.senderRole.toLowerCase() === "user") {
|
|
11125
|
-
console.log(`
|
|
11126
|
-
## User Message`);
|
|
11127
|
-
console.log(`<user-message>`);
|
|
11128
|
-
console.log(originMessage.content);
|
|
11129
|
-
if (originMessage.attachedTasks && originMessage.attachedTasks.length > 0) {
|
|
11130
|
-
console.log(`
|
|
11131
|
-
ATTACHED BACKLOG (${originMessage.attachedTasks.length})`);
|
|
11132
|
-
for (const attachedTask of originMessage.attachedTasks) {
|
|
11133
|
-
console.log(`${attachedTask.content}`);
|
|
11134
|
-
}
|
|
11135
|
-
}
|
|
11136
|
-
const followUpCount = taskDeliveryPrompt.json?.contextWindow?.followUpCountSinceOrigin ?? 0;
|
|
11137
|
-
const originCreatedAt = taskDeliveryPrompt.json?.contextWindow?.originMessageCreatedAt;
|
|
11138
|
-
if (followUpCount >= 5) {
|
|
11139
|
-
console.log(`
|
|
11140
|
-
⚠️ WARNING: ${followUpCount} follow-up messages since this pinned message.`);
|
|
11141
|
-
console.log(` The user may have moved on to a different topic.`);
|
|
11142
|
-
console.log(` Consider asking if this context is still relevant.`);
|
|
11143
|
-
}
|
|
11144
|
-
if (originCreatedAt) {
|
|
11145
|
-
const ageMs = Date.now() - originCreatedAt;
|
|
11146
|
-
const ageHours = ageMs / (1000 * 60 * 60);
|
|
11147
|
-
if (ageHours >= 24) {
|
|
11148
|
-
const ageDays = Math.floor(ageHours / 24);
|
|
11149
|
-
console.log(`
|
|
11150
|
-
⚠️ WARNING: This pinned message is ${ageDays} day(s) old.`);
|
|
11151
|
-
console.log(` The context may be outdated.`);
|
|
11152
|
-
}
|
|
11153
|
-
}
|
|
11154
|
-
console.log(`</user-message>`);
|
|
11155
|
-
}
|
|
11156
|
-
console.log(`
|
|
11157
|
-
## Task`);
|
|
11158
|
-
console.log(task.content);
|
|
11159
|
-
const existingClassification = originMessage?.classification;
|
|
11160
|
-
if (existingClassification) {
|
|
11161
|
-
console.log(`
|
|
11162
|
-
Classification: ${existingClassification.toUpperCase()}`);
|
|
11163
|
-
}
|
|
11164
|
-
console.log(`
|
|
11165
|
-
${"=".repeat(60)}`);
|
|
11166
|
-
console.log(`\uD83D\uDCCB PROCESS`);
|
|
11167
|
-
console.log(`${"=".repeat(60)}`);
|
|
11168
|
-
console.log(`
|
|
11169
|
-
1. Mark task as started:`);
|
|
11170
|
-
if (isUserMessage) {
|
|
11171
|
-
console.log(` ${taskStartedCommand({ chatroomId, role, taskId: task._id, classification: "follow_up", cliEnvPrefix })}`);
|
|
11172
|
-
} else {
|
|
11173
|
-
console.log(` ${cliEnvPrefix}chatroom task-started --chatroom-id=${chatroomId} --role=${role} --task-id=${task._id} --no-classify`);
|
|
11174
|
-
}
|
|
11175
|
-
console.log(`
|
|
11176
|
-
2. Do the work`);
|
|
11177
|
-
console.log(`
|
|
11178
|
-
3. Hand off when complete:`);
|
|
11179
|
-
console.log(` ${cliEnvPrefix}chatroom handoff --chatroom-id=${chatroomId} --role=${role} --next-role=<target>`);
|
|
11180
|
-
console.log(`
|
|
11181
|
-
4. Resume listening:`);
|
|
11182
|
-
console.log(` ${waitForTaskCommand({ chatroomId, role, cliEnvPrefix })}`);
|
|
11183
|
-
console.log(`
|
|
11184
|
-
${"=".repeat(60)}`);
|
|
11185
|
-
console.log(getWaitForTaskReminder());
|
|
11186
|
-
console.log(`${"=".repeat(60)}`);
|
|
11025
|
+
console.log(taskDeliveryPrompt.fullCliOutput);
|
|
11187
11026
|
process.exit(0);
|
|
11188
11027
|
};
|
|
11189
11028
|
const wsClient2 = await getConvexWsClient();
|
|
@@ -11199,7 +11038,6 @@ ${"=".repeat(60)}`);
|
|
|
11199
11038
|
const handleSignal = (_signal) => {
|
|
11200
11039
|
if (unsubscribe)
|
|
11201
11040
|
unsubscribe();
|
|
11202
|
-
clearTimeout(timeoutHandle);
|
|
11203
11041
|
const signalTime = new Date().toISOString().replace("T", " ").substring(0, 19);
|
|
11204
11042
|
console.log(`
|
|
11205
11043
|
${"─".repeat(50)}`);
|
|
@@ -12475,7 +12313,10 @@ var init_messages = __esm(() => {
|
|
|
12475
12313
|
// src/commands/context.ts
|
|
12476
12314
|
var exports_context = {};
|
|
12477
12315
|
__export(exports_context, {
|
|
12478
|
-
readContext: () => readContext
|
|
12316
|
+
readContext: () => readContext,
|
|
12317
|
+
newContext: () => newContext,
|
|
12318
|
+
listContexts: () => listContexts,
|
|
12319
|
+
inspectContext: () => inspectContext
|
|
12479
12320
|
});
|
|
12480
12321
|
async function readContext(chatroomId, options) {
|
|
12481
12322
|
const client2 = await getConvexClient();
|
|
@@ -12571,6 +12412,136 @@ async function readContext(chatroomId, options) {
|
|
|
12571
12412
|
process.exit(1);
|
|
12572
12413
|
}
|
|
12573
12414
|
}
|
|
12415
|
+
async function newContext(chatroomId, options) {
|
|
12416
|
+
const client2 = await getConvexClient();
|
|
12417
|
+
const sessionId = getSessionId();
|
|
12418
|
+
if (!sessionId) {
|
|
12419
|
+
console.error(`❌ Not authenticated. Please run: chatroom auth login`);
|
|
12420
|
+
process.exit(1);
|
|
12421
|
+
}
|
|
12422
|
+
if (!chatroomId || typeof chatroomId !== "string" || chatroomId.length < 20 || chatroomId.length > 40) {
|
|
12423
|
+
console.error(`❌ Invalid chatroom ID format: ID must be 20-40 characters (got ${chatroomId?.length || 0})`);
|
|
12424
|
+
process.exit(1);
|
|
12425
|
+
}
|
|
12426
|
+
if (!options.content || options.content.trim().length === 0) {
|
|
12427
|
+
console.error(`❌ Context content cannot be empty`);
|
|
12428
|
+
process.exit(1);
|
|
12429
|
+
}
|
|
12430
|
+
try {
|
|
12431
|
+
const contextId = await client2.mutation(api.contexts.createContext, {
|
|
12432
|
+
sessionId,
|
|
12433
|
+
chatroomId,
|
|
12434
|
+
content: options.content,
|
|
12435
|
+
role: options.role
|
|
12436
|
+
});
|
|
12437
|
+
console.log(`✅ Context created successfully`);
|
|
12438
|
+
console.log(` Context ID: ${contextId}`);
|
|
12439
|
+
console.log(` Created by: ${options.role}`);
|
|
12440
|
+
console.log(`
|
|
12441
|
+
\uD83D\uDCCC This context is now pinned for all agents in this chatroom.`);
|
|
12442
|
+
} catch (err) {
|
|
12443
|
+
console.error(`❌ Failed to create context: ${err.message}`);
|
|
12444
|
+
process.exit(1);
|
|
12445
|
+
}
|
|
12446
|
+
}
|
|
12447
|
+
async function listContexts(chatroomId, options) {
|
|
12448
|
+
const client2 = await getConvexClient();
|
|
12449
|
+
const sessionId = getSessionId();
|
|
12450
|
+
if (!sessionId) {
|
|
12451
|
+
console.error(`❌ Not authenticated. Please run: chatroom auth login`);
|
|
12452
|
+
process.exit(1);
|
|
12453
|
+
}
|
|
12454
|
+
if (!chatroomId || typeof chatroomId !== "string" || chatroomId.length < 20 || chatroomId.length > 40) {
|
|
12455
|
+
console.error(`❌ Invalid chatroom ID format: ID must be 20-40 characters (got ${chatroomId?.length || 0})`);
|
|
12456
|
+
process.exit(1);
|
|
12457
|
+
}
|
|
12458
|
+
try {
|
|
12459
|
+
const contexts = await client2.query(api.contexts.listContexts, {
|
|
12460
|
+
sessionId,
|
|
12461
|
+
chatroomId,
|
|
12462
|
+
limit: options.limit ?? 10
|
|
12463
|
+
});
|
|
12464
|
+
if (contexts.length === 0) {
|
|
12465
|
+
console.log(`
|
|
12466
|
+
\uD83D\uDCED No contexts found for this chatroom`);
|
|
12467
|
+
console.log(`
|
|
12468
|
+
\uD83D\uDCA1 Create a context with:`);
|
|
12469
|
+
console.log(` chatroom context new --chatroom-id=${chatroomId} --role=${options.role} --content="Your context summary"`);
|
|
12470
|
+
return;
|
|
12471
|
+
}
|
|
12472
|
+
console.log(`
|
|
12473
|
+
\uD83D\uDCDA CONTEXTS (${contexts.length} found)`);
|
|
12474
|
+
console.log("═".repeat(60));
|
|
12475
|
+
for (const context of contexts) {
|
|
12476
|
+
const timestamp = new Date(context.createdAt).toLocaleString();
|
|
12477
|
+
console.log(`
|
|
12478
|
+
\uD83D\uDD39 Context ID: ${context._id}`);
|
|
12479
|
+
console.log(` Created by: ${context.createdBy}`);
|
|
12480
|
+
console.log(` Created at: ${timestamp}`);
|
|
12481
|
+
if (context.messageCountAtCreation !== undefined) {
|
|
12482
|
+
console.log(` Messages at creation: ${context.messageCountAtCreation}`);
|
|
12483
|
+
}
|
|
12484
|
+
console.log(` Content:`);
|
|
12485
|
+
const truncatedContent = context.content.length > 200 ? context.content.slice(0, 200) + "..." : context.content;
|
|
12486
|
+
console.log(truncatedContent.split(`
|
|
12487
|
+
`).map((l) => ` ${l}`).join(`
|
|
12488
|
+
`));
|
|
12489
|
+
}
|
|
12490
|
+
console.log(`
|
|
12491
|
+
` + "═".repeat(60));
|
|
12492
|
+
} catch (err) {
|
|
12493
|
+
console.error(`❌ Failed to list contexts: ${err.message}`);
|
|
12494
|
+
process.exit(1);
|
|
12495
|
+
}
|
|
12496
|
+
}
|
|
12497
|
+
async function inspectContext(chatroomId, options) {
|
|
12498
|
+
const client2 = await getConvexClient();
|
|
12499
|
+
const sessionId = getSessionId();
|
|
12500
|
+
if (!sessionId) {
|
|
12501
|
+
console.error(`❌ Not authenticated. Please run: chatroom auth login`);
|
|
12502
|
+
process.exit(1);
|
|
12503
|
+
}
|
|
12504
|
+
try {
|
|
12505
|
+
const context = await client2.query(api.contexts.getContext, {
|
|
12506
|
+
sessionId,
|
|
12507
|
+
contextId: options.contextId
|
|
12508
|
+
});
|
|
12509
|
+
console.log(`
|
|
12510
|
+
\uD83D\uDCCB CONTEXT DETAILS`);
|
|
12511
|
+
console.log("═".repeat(60));
|
|
12512
|
+
console.log(`
|
|
12513
|
+
\uD83D\uDD39 Context ID: ${context._id}`);
|
|
12514
|
+
console.log(` Created by: ${context.createdBy}`);
|
|
12515
|
+
console.log(` Created at: ${new Date(context.createdAt).toLocaleString()}`);
|
|
12516
|
+
console.log(`
|
|
12517
|
+
\uD83D\uDCCA Staleness:`);
|
|
12518
|
+
console.log(` Messages since context: ${context.messagesSinceContext}`);
|
|
12519
|
+
console.log(` Time elapsed: ${context.elapsedHours.toFixed(1)} hours`);
|
|
12520
|
+
if (context.messagesSinceContext >= 10) {
|
|
12521
|
+
console.log(`
|
|
12522
|
+
⚠️ Many messages since this context was created.`);
|
|
12523
|
+
console.log(` Consider creating a new context with an updated summary.`);
|
|
12524
|
+
}
|
|
12525
|
+
if (context.elapsedHours >= 24) {
|
|
12526
|
+
console.log(`
|
|
12527
|
+
⚠️ This context is over 24 hours old.`);
|
|
12528
|
+
console.log(` Consider creating a new context with an updated summary.`);
|
|
12529
|
+
}
|
|
12530
|
+
console.log(`
|
|
12531
|
+
\uD83D\uDCDD Content:`);
|
|
12532
|
+
console.log("─".repeat(60));
|
|
12533
|
+
console.log(context.content);
|
|
12534
|
+
console.log("─".repeat(60));
|
|
12535
|
+
console.log(`
|
|
12536
|
+
\uD83D\uDCA1 To create a new context:`);
|
|
12537
|
+
console.log(` chatroom context new --chatroom-id=${chatroomId} --role=${options.role} --content="Your updated summary"`);
|
|
12538
|
+
console.log(`
|
|
12539
|
+
` + "═".repeat(60));
|
|
12540
|
+
} catch (err) {
|
|
12541
|
+
console.error(`❌ Failed to inspect context: ${err.message}`);
|
|
12542
|
+
process.exit(1);
|
|
12543
|
+
}
|
|
12544
|
+
}
|
|
12574
12545
|
var init_context = __esm(() => {
|
|
12575
12546
|
init_api3();
|
|
12576
12547
|
init_storage();
|
|
@@ -13972,24 +13943,11 @@ program2.command("register-agent").description("Register agent type for a chatro
|
|
|
13972
13943
|
type: options.type
|
|
13973
13944
|
});
|
|
13974
13945
|
});
|
|
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)").
|
|
13946
|
+
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)").action(async (options) => {
|
|
13976
13947
|
await maybeRequireAuth();
|
|
13977
|
-
const { waitForTask: waitForTask2
|
|
13978
|
-
let timeoutMs;
|
|
13979
|
-
if (options.duration) {
|
|
13980
|
-
const parsed = parseDuration2(options.duration);
|
|
13981
|
-
if (parsed === null) {
|
|
13982
|
-
console.error(`❌ Invalid duration format: "${options.duration}". Use formats like "1m", "5m", "30s".`);
|
|
13983
|
-
process.exit(1);
|
|
13984
|
-
}
|
|
13985
|
-
timeoutMs = parsed;
|
|
13986
|
-
} else if (options.timeout) {
|
|
13987
|
-
timeoutMs = parseInt(options.timeout, 10);
|
|
13988
|
-
}
|
|
13948
|
+
const { waitForTask: waitForTask2 } = await Promise.resolve().then(() => (init_wait_for_task(), exports_wait_for_task));
|
|
13989
13949
|
await waitForTask2(options.chatroomId, {
|
|
13990
|
-
role: options.role
|
|
13991
|
-
timeout: timeoutMs,
|
|
13992
|
-
duration: options.duration
|
|
13950
|
+
role: options.role
|
|
13993
13951
|
});
|
|
13994
13952
|
});
|
|
13995
13953
|
program2.command("task-started").description("Acknowledge a task and optionally classify the user message").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role").option("--origin-message-classification <type>", "Original message classification: question, new_feature, or follow_up (for entry point roles)").option("--no-classify", "Skip classification (for handoff recipients - classification already done by entry point)").requiredOption("--task-id <taskId>", "Task ID to acknowledge").action(async (options) => {
|
|
@@ -14194,12 +14152,45 @@ messagesCommand.command("list").description("List messages by sender role or sin
|
|
|
14194
14152
|
});
|
|
14195
14153
|
}
|
|
14196
14154
|
});
|
|
14197
|
-
var contextCommand = program2.command("context").description("
|
|
14155
|
+
var contextCommand = program2.command("context").description("Manage chatroom context and state (explicit context management)");
|
|
14198
14156
|
contextCommand.command("read").description("Read context for your role (conversation history, tasks, status)").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role").action(async (options) => {
|
|
14199
14157
|
await maybeRequireAuth();
|
|
14200
14158
|
const { readContext: readContext2 } = await Promise.resolve().then(() => (init_context(), exports_context));
|
|
14201
14159
|
await readContext2(options.chatroomId, options);
|
|
14202
14160
|
});
|
|
14161
|
+
contextCommand.command("new").description("Create a new context and pin it for all agents").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role (creator of the context)").option("--content <content>", "Context summary/description (alternative: provide via stdin/heredoc)").action(async (options) => {
|
|
14162
|
+
await maybeRequireAuth();
|
|
14163
|
+
let content;
|
|
14164
|
+
if (options.content && options.content.trim().length > 0) {
|
|
14165
|
+
content = options.content.trim();
|
|
14166
|
+
} else {
|
|
14167
|
+
const stdinContent = await readStdin();
|
|
14168
|
+
if (!stdinContent.trim()) {
|
|
14169
|
+
console.error("❌ Context content cannot be empty.");
|
|
14170
|
+
console.error(' Provide content via --content="..." or stdin (heredoc):');
|
|
14171
|
+
console.error(" chatroom context new --chatroom-id=<id> --role=<role> << 'EOF'");
|
|
14172
|
+
console.error(" Your context summary here");
|
|
14173
|
+
console.error(" EOF");
|
|
14174
|
+
process.exit(1);
|
|
14175
|
+
}
|
|
14176
|
+
content = stdinContent.trim();
|
|
14177
|
+
}
|
|
14178
|
+
const { newContext: newContext2 } = await Promise.resolve().then(() => (init_context(), exports_context));
|
|
14179
|
+
await newContext2(options.chatroomId, { ...options, content });
|
|
14180
|
+
});
|
|
14181
|
+
contextCommand.command("list").description("List recent contexts for a chatroom").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role").option("--limit <n>", "Maximum number of contexts to show (default: 10)").action(async (options) => {
|
|
14182
|
+
await maybeRequireAuth();
|
|
14183
|
+
const { listContexts: listContexts2 } = await Promise.resolve().then(() => (init_context(), exports_context));
|
|
14184
|
+
await listContexts2(options.chatroomId, {
|
|
14185
|
+
role: options.role,
|
|
14186
|
+
limit: options.limit ? parseInt(options.limit, 10) : 10
|
|
14187
|
+
});
|
|
14188
|
+
});
|
|
14189
|
+
contextCommand.command("inspect").description("View a specific context with staleness information").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role").requiredOption("--context-id <contextId>", "Context ID to inspect").action(async (options) => {
|
|
14190
|
+
await maybeRequireAuth();
|
|
14191
|
+
const { inspectContext: inspectContext2 } = await Promise.resolve().then(() => (init_context(), exports_context));
|
|
14192
|
+
await inspectContext2(options.chatroomId, options);
|
|
14193
|
+
});
|
|
14203
14194
|
var guidelinesCommand = program2.command("guidelines").description("View review guidelines by type");
|
|
14204
14195
|
guidelinesCommand.command("view").description("View guidelines for a specific review type").requiredOption("--type <type>", "Guideline type (coding|security|design|performance|all)").action(async (options) => {
|
|
14205
14196
|
await maybeRequireAuth();
|