chatroom-cli 1.0.73 → 1.0.74
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 +196 -6
- 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
|
|
|
@@ -11116,12 +11115,35 @@ Classification types: question, new_feature, follow_up`);
|
|
|
11116
11115
|
<!-- CONTEXT: Available Actions & Role Instructions`);
|
|
11117
11116
|
console.log(taskDeliveryPrompt.humanReadable);
|
|
11118
11117
|
console.log(`-->`);
|
|
11118
|
+
const currentContext = taskDeliveryPrompt.json?.contextWindow?.currentContext;
|
|
11119
11119
|
const originMessage = taskDeliveryPrompt.json?.contextWindow?.originMessage;
|
|
11120
11120
|
console.log(`
|
|
11121
11121
|
${"=".repeat(60)}`);
|
|
11122
11122
|
console.log(`\uD83D\uDCCD PINNED - Work on this immediately`);
|
|
11123
11123
|
console.log(`${"=".repeat(60)}`);
|
|
11124
|
-
if (
|
|
11124
|
+
if (currentContext) {
|
|
11125
|
+
console.log(`
|
|
11126
|
+
## Context`);
|
|
11127
|
+
console.log(`<context>`);
|
|
11128
|
+
console.log(currentContext.content);
|
|
11129
|
+
const messagesSinceContext = currentContext.messagesSinceContext ?? 0;
|
|
11130
|
+
const elapsedHours = currentContext.elapsedHours ?? 0;
|
|
11131
|
+
if (messagesSinceContext >= 10) {
|
|
11132
|
+
console.log(`
|
|
11133
|
+
⚠️ WARNING: ${messagesSinceContext} messages since this context was set.`);
|
|
11134
|
+
console.log(` Consider updating the context with a summary of recent developments.`);
|
|
11135
|
+
console.log(` Create a new context with:`);
|
|
11136
|
+
console.log(` ${cliEnvPrefix}chatroom context new --chatroom-id=${chatroomId} --role=${role} --content="<summary>"`);
|
|
11137
|
+
}
|
|
11138
|
+
if (elapsedHours >= 24) {
|
|
11139
|
+
const ageDays = Math.floor(elapsedHours / 24);
|
|
11140
|
+
console.log(`
|
|
11141
|
+
⚠️ WARNING: This context is ${ageDays} day(s) old.`);
|
|
11142
|
+
console.log(` Consider creating a new context with updated summary.`);
|
|
11143
|
+
console.log(` ${cliEnvPrefix}chatroom context new --chatroom-id=${chatroomId} --role=${role} --content="<summary>"`);
|
|
11144
|
+
}
|
|
11145
|
+
console.log(`</context>`);
|
|
11146
|
+
} else if (originMessage && originMessage.senderRole.toLowerCase() === "user") {
|
|
11125
11147
|
console.log(`
|
|
11126
11148
|
## User Message`);
|
|
11127
11149
|
console.log(`<user-message>`);
|
|
@@ -11139,7 +11161,8 @@ ATTACHED BACKLOG (${originMessage.attachedTasks.length})`);
|
|
|
11139
11161
|
console.log(`
|
|
11140
11162
|
⚠️ WARNING: ${followUpCount} follow-up messages since this pinned message.`);
|
|
11141
11163
|
console.log(` The user may have moved on to a different topic.`);
|
|
11142
|
-
console.log(` Consider
|
|
11164
|
+
console.log(` Consider creating a context with:`);
|
|
11165
|
+
console.log(` ${cliEnvPrefix}chatroom context new --chatroom-id=${chatroomId} --role=${role} --content="<summary>"`);
|
|
11143
11166
|
}
|
|
11144
11167
|
if (originCreatedAt) {
|
|
11145
11168
|
const ageMs = Date.now() - originCreatedAt;
|
|
@@ -11148,7 +11171,8 @@ ATTACHED BACKLOG (${originMessage.attachedTasks.length})`);
|
|
|
11148
11171
|
const ageDays = Math.floor(ageHours / 24);
|
|
11149
11172
|
console.log(`
|
|
11150
11173
|
⚠️ WARNING: This pinned message is ${ageDays} day(s) old.`);
|
|
11151
|
-
console.log(`
|
|
11174
|
+
console.log(` Consider creating a context with:`);
|
|
11175
|
+
console.log(` ${cliEnvPrefix}chatroom context new --chatroom-id=${chatroomId} --role=${role} --content="<summary>"`);
|
|
11152
11176
|
}
|
|
11153
11177
|
}
|
|
11154
11178
|
console.log(`</user-message>`);
|
|
@@ -12475,7 +12499,10 @@ var init_messages = __esm(() => {
|
|
|
12475
12499
|
// src/commands/context.ts
|
|
12476
12500
|
var exports_context = {};
|
|
12477
12501
|
__export(exports_context, {
|
|
12478
|
-
readContext: () => readContext
|
|
12502
|
+
readContext: () => readContext,
|
|
12503
|
+
newContext: () => newContext,
|
|
12504
|
+
listContexts: () => listContexts,
|
|
12505
|
+
inspectContext: () => inspectContext
|
|
12479
12506
|
});
|
|
12480
12507
|
async function readContext(chatroomId, options) {
|
|
12481
12508
|
const client2 = await getConvexClient();
|
|
@@ -12571,6 +12598,136 @@ async function readContext(chatroomId, options) {
|
|
|
12571
12598
|
process.exit(1);
|
|
12572
12599
|
}
|
|
12573
12600
|
}
|
|
12601
|
+
async function newContext(chatroomId, options) {
|
|
12602
|
+
const client2 = await getConvexClient();
|
|
12603
|
+
const sessionId = getSessionId();
|
|
12604
|
+
if (!sessionId) {
|
|
12605
|
+
console.error(`❌ Not authenticated. Please run: chatroom auth login`);
|
|
12606
|
+
process.exit(1);
|
|
12607
|
+
}
|
|
12608
|
+
if (!chatroomId || typeof chatroomId !== "string" || chatroomId.length < 20 || chatroomId.length > 40) {
|
|
12609
|
+
console.error(`❌ Invalid chatroom ID format: ID must be 20-40 characters (got ${chatroomId?.length || 0})`);
|
|
12610
|
+
process.exit(1);
|
|
12611
|
+
}
|
|
12612
|
+
if (!options.content || options.content.trim().length === 0) {
|
|
12613
|
+
console.error(`❌ Context content cannot be empty`);
|
|
12614
|
+
process.exit(1);
|
|
12615
|
+
}
|
|
12616
|
+
try {
|
|
12617
|
+
const contextId = await client2.mutation(api.contexts.createContext, {
|
|
12618
|
+
sessionId,
|
|
12619
|
+
chatroomId,
|
|
12620
|
+
content: options.content,
|
|
12621
|
+
role: options.role
|
|
12622
|
+
});
|
|
12623
|
+
console.log(`✅ Context created successfully`);
|
|
12624
|
+
console.log(` Context ID: ${contextId}`);
|
|
12625
|
+
console.log(` Created by: ${options.role}`);
|
|
12626
|
+
console.log(`
|
|
12627
|
+
\uD83D\uDCCC This context is now pinned for all agents in this chatroom.`);
|
|
12628
|
+
} catch (err) {
|
|
12629
|
+
console.error(`❌ Failed to create context: ${err.message}`);
|
|
12630
|
+
process.exit(1);
|
|
12631
|
+
}
|
|
12632
|
+
}
|
|
12633
|
+
async function listContexts(chatroomId, options) {
|
|
12634
|
+
const client2 = await getConvexClient();
|
|
12635
|
+
const sessionId = getSessionId();
|
|
12636
|
+
if (!sessionId) {
|
|
12637
|
+
console.error(`❌ Not authenticated. Please run: chatroom auth login`);
|
|
12638
|
+
process.exit(1);
|
|
12639
|
+
}
|
|
12640
|
+
if (!chatroomId || typeof chatroomId !== "string" || chatroomId.length < 20 || chatroomId.length > 40) {
|
|
12641
|
+
console.error(`❌ Invalid chatroom ID format: ID must be 20-40 characters (got ${chatroomId?.length || 0})`);
|
|
12642
|
+
process.exit(1);
|
|
12643
|
+
}
|
|
12644
|
+
try {
|
|
12645
|
+
const contexts = await client2.query(api.contexts.listContexts, {
|
|
12646
|
+
sessionId,
|
|
12647
|
+
chatroomId,
|
|
12648
|
+
limit: options.limit ?? 10
|
|
12649
|
+
});
|
|
12650
|
+
if (contexts.length === 0) {
|
|
12651
|
+
console.log(`
|
|
12652
|
+
\uD83D\uDCED No contexts found for this chatroom`);
|
|
12653
|
+
console.log(`
|
|
12654
|
+
\uD83D\uDCA1 Create a context with:`);
|
|
12655
|
+
console.log(` chatroom context new --chatroom-id=${chatroomId} --role=${options.role} --content="Your context summary"`);
|
|
12656
|
+
return;
|
|
12657
|
+
}
|
|
12658
|
+
console.log(`
|
|
12659
|
+
\uD83D\uDCDA CONTEXTS (${contexts.length} found)`);
|
|
12660
|
+
console.log("═".repeat(60));
|
|
12661
|
+
for (const context of contexts) {
|
|
12662
|
+
const timestamp = new Date(context.createdAt).toLocaleString();
|
|
12663
|
+
console.log(`
|
|
12664
|
+
\uD83D\uDD39 Context ID: ${context._id}`);
|
|
12665
|
+
console.log(` Created by: ${context.createdBy}`);
|
|
12666
|
+
console.log(` Created at: ${timestamp}`);
|
|
12667
|
+
if (context.messageCountAtCreation !== undefined) {
|
|
12668
|
+
console.log(` Messages at creation: ${context.messageCountAtCreation}`);
|
|
12669
|
+
}
|
|
12670
|
+
console.log(` Content:`);
|
|
12671
|
+
const truncatedContent = context.content.length > 200 ? context.content.slice(0, 200) + "..." : context.content;
|
|
12672
|
+
console.log(truncatedContent.split(`
|
|
12673
|
+
`).map((l) => ` ${l}`).join(`
|
|
12674
|
+
`));
|
|
12675
|
+
}
|
|
12676
|
+
console.log(`
|
|
12677
|
+
` + "═".repeat(60));
|
|
12678
|
+
} catch (err) {
|
|
12679
|
+
console.error(`❌ Failed to list contexts: ${err.message}`);
|
|
12680
|
+
process.exit(1);
|
|
12681
|
+
}
|
|
12682
|
+
}
|
|
12683
|
+
async function inspectContext(chatroomId, options) {
|
|
12684
|
+
const client2 = await getConvexClient();
|
|
12685
|
+
const sessionId = getSessionId();
|
|
12686
|
+
if (!sessionId) {
|
|
12687
|
+
console.error(`❌ Not authenticated. Please run: chatroom auth login`);
|
|
12688
|
+
process.exit(1);
|
|
12689
|
+
}
|
|
12690
|
+
try {
|
|
12691
|
+
const context = await client2.query(api.contexts.getContext, {
|
|
12692
|
+
sessionId,
|
|
12693
|
+
contextId: options.contextId
|
|
12694
|
+
});
|
|
12695
|
+
console.log(`
|
|
12696
|
+
\uD83D\uDCCB CONTEXT DETAILS`);
|
|
12697
|
+
console.log("═".repeat(60));
|
|
12698
|
+
console.log(`
|
|
12699
|
+
\uD83D\uDD39 Context ID: ${context._id}`);
|
|
12700
|
+
console.log(` Created by: ${context.createdBy}`);
|
|
12701
|
+
console.log(` Created at: ${new Date(context.createdAt).toLocaleString()}`);
|
|
12702
|
+
console.log(`
|
|
12703
|
+
\uD83D\uDCCA Staleness:`);
|
|
12704
|
+
console.log(` Messages since context: ${context.messagesSinceContext}`);
|
|
12705
|
+
console.log(` Time elapsed: ${context.elapsedHours.toFixed(1)} hours`);
|
|
12706
|
+
if (context.messagesSinceContext >= 10) {
|
|
12707
|
+
console.log(`
|
|
12708
|
+
⚠️ Many messages since this context was created.`);
|
|
12709
|
+
console.log(` Consider creating a new context with an updated summary.`);
|
|
12710
|
+
}
|
|
12711
|
+
if (context.elapsedHours >= 24) {
|
|
12712
|
+
console.log(`
|
|
12713
|
+
⚠️ This context is over 24 hours old.`);
|
|
12714
|
+
console.log(` Consider creating a new context with an updated summary.`);
|
|
12715
|
+
}
|
|
12716
|
+
console.log(`
|
|
12717
|
+
\uD83D\uDCDD Content:`);
|
|
12718
|
+
console.log("─".repeat(60));
|
|
12719
|
+
console.log(context.content);
|
|
12720
|
+
console.log("─".repeat(60));
|
|
12721
|
+
console.log(`
|
|
12722
|
+
\uD83D\uDCA1 To create a new context:`);
|
|
12723
|
+
console.log(` chatroom context new --chatroom-id=${chatroomId} --role=${options.role} --content="Your updated summary"`);
|
|
12724
|
+
console.log(`
|
|
12725
|
+
` + "═".repeat(60));
|
|
12726
|
+
} catch (err) {
|
|
12727
|
+
console.error(`❌ Failed to inspect context: ${err.message}`);
|
|
12728
|
+
process.exit(1);
|
|
12729
|
+
}
|
|
12730
|
+
}
|
|
12574
12731
|
var init_context = __esm(() => {
|
|
12575
12732
|
init_api3();
|
|
12576
12733
|
init_storage();
|
|
@@ -14194,12 +14351,45 @@ messagesCommand.command("list").description("List messages by sender role or sin
|
|
|
14194
14351
|
});
|
|
14195
14352
|
}
|
|
14196
14353
|
});
|
|
14197
|
-
var contextCommand = program2.command("context").description("
|
|
14354
|
+
var contextCommand = program2.command("context").description("Manage chatroom context and state (explicit context management)");
|
|
14198
14355
|
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
14356
|
await maybeRequireAuth();
|
|
14200
14357
|
const { readContext: readContext2 } = await Promise.resolve().then(() => (init_context(), exports_context));
|
|
14201
14358
|
await readContext2(options.chatroomId, options);
|
|
14202
14359
|
});
|
|
14360
|
+
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) => {
|
|
14361
|
+
await maybeRequireAuth();
|
|
14362
|
+
let content;
|
|
14363
|
+
if (options.content && options.content.trim().length > 0) {
|
|
14364
|
+
content = options.content.trim();
|
|
14365
|
+
} else {
|
|
14366
|
+
const stdinContent = await readStdin();
|
|
14367
|
+
if (!stdinContent.trim()) {
|
|
14368
|
+
console.error("❌ Context content cannot be empty.");
|
|
14369
|
+
console.error(' Provide content via --content="..." or stdin (heredoc):');
|
|
14370
|
+
console.error(" chatroom context new --chatroom-id=<id> --role=<role> << 'EOF'");
|
|
14371
|
+
console.error(" Your context summary here");
|
|
14372
|
+
console.error(" EOF");
|
|
14373
|
+
process.exit(1);
|
|
14374
|
+
}
|
|
14375
|
+
content = stdinContent.trim();
|
|
14376
|
+
}
|
|
14377
|
+
const { newContext: newContext2 } = await Promise.resolve().then(() => (init_context(), exports_context));
|
|
14378
|
+
await newContext2(options.chatroomId, { ...options, content });
|
|
14379
|
+
});
|
|
14380
|
+
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) => {
|
|
14381
|
+
await maybeRequireAuth();
|
|
14382
|
+
const { listContexts: listContexts2 } = await Promise.resolve().then(() => (init_context(), exports_context));
|
|
14383
|
+
await listContexts2(options.chatroomId, {
|
|
14384
|
+
role: options.role,
|
|
14385
|
+
limit: options.limit ? parseInt(options.limit, 10) : 10
|
|
14386
|
+
});
|
|
14387
|
+
});
|
|
14388
|
+
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) => {
|
|
14389
|
+
await maybeRequireAuth();
|
|
14390
|
+
const { inspectContext: inspectContext2 } = await Promise.resolve().then(() => (init_context(), exports_context));
|
|
14391
|
+
await inspectContext2(options.chatroomId, options);
|
|
14392
|
+
});
|
|
14203
14393
|
var guidelinesCommand = program2.command("guidelines").description("View review guidelines by type");
|
|
14204
14394
|
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
14395
|
await maybeRequireAuth();
|