chatroom-cli 1.4.0 → 1.4.3
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 +45 -51
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10613,6 +10613,7 @@ class PiRpcReader {
|
|
|
10613
10613
|
thinkingDeltaCallbacks = [];
|
|
10614
10614
|
agentEndCallbacks = [];
|
|
10615
10615
|
toolCallCallbacks = [];
|
|
10616
|
+
toolResultCallbacks = [];
|
|
10616
10617
|
anyEventCallbacks = [];
|
|
10617
10618
|
constructor(stream) {
|
|
10618
10619
|
const rl = createInterface({ input: stream, crlfDelay: Infinity });
|
|
@@ -10630,6 +10631,9 @@ class PiRpcReader {
|
|
|
10630
10631
|
onToolCall(cb) {
|
|
10631
10632
|
this.toolCallCallbacks.push(cb);
|
|
10632
10633
|
}
|
|
10634
|
+
onToolResult(cb) {
|
|
10635
|
+
this.toolResultCallbacks.push(cb);
|
|
10636
|
+
}
|
|
10633
10637
|
onAnyEvent(cb) {
|
|
10634
10638
|
this.anyEventCallbacks.push(cb);
|
|
10635
10639
|
}
|
|
@@ -10677,6 +10681,15 @@ class PiRpcReader {
|
|
|
10677
10681
|
}
|
|
10678
10682
|
return;
|
|
10679
10683
|
}
|
|
10684
|
+
if (type === "tool_execution_end") {
|
|
10685
|
+
const toolName = event["toolName"];
|
|
10686
|
+
const toolResult = event["toolResult"] ?? event["output"] ?? event;
|
|
10687
|
+
if (typeof toolName === "string") {
|
|
10688
|
+
for (const cb of this.toolResultCallbacks)
|
|
10689
|
+
cb(toolName, toolResult);
|
|
10690
|
+
}
|
|
10691
|
+
return;
|
|
10692
|
+
}
|
|
10680
10693
|
}
|
|
10681
10694
|
}
|
|
10682
10695
|
var init_pi_rpc_reader = () => {};
|
|
@@ -10813,10 +10826,16 @@ var init_pi_agent_service = __esm(() => {
|
|
|
10813
10826
|
process.stdout.write(`${logPrefix} agent_end]
|
|
10814
10827
|
`);
|
|
10815
10828
|
});
|
|
10816
|
-
reader.onToolCall((name) => {
|
|
10829
|
+
reader.onToolCall((name, args2) => {
|
|
10817
10830
|
flushText();
|
|
10818
10831
|
flushThinking();
|
|
10819
|
-
|
|
10832
|
+
const argsStr = args2 != null ? ` args: ${JSON.stringify(args2)}` : "";
|
|
10833
|
+
process.stdout.write(`${logPrefix} tool: ${name}${argsStr}]
|
|
10834
|
+
`);
|
|
10835
|
+
});
|
|
10836
|
+
reader.onToolResult((name, result) => {
|
|
10837
|
+
const resultStr = typeof result === "string" ? result : JSON.stringify(result);
|
|
10838
|
+
process.stdout.write(`${logPrefix} tool_result: ${name} result: ${resultStr}]
|
|
10820
10839
|
`);
|
|
10821
10840
|
});
|
|
10822
10841
|
if (childProcess.stderr) {
|
|
@@ -11402,39 +11421,11 @@ var init_task_started = __esm(() => {
|
|
|
11402
11421
|
function getNextTaskGuidance() {
|
|
11403
11422
|
return `\uD83D\uDD17 STAYING CONNECTED TO YOUR TEAM
|
|
11404
11423
|
|
|
11405
|
-
Your primary directive: Stay available to
|
|
11406
|
-
|
|
11407
|
-
⚠️ CRITICAL: Run get-next-task in the FOREGROUND
|
|
11408
|
-
|
|
11409
|
-
Two requirements:
|
|
11424
|
+
Your primary directive: Stay available to receive tasks from your team.
|
|
11410
11425
|
|
|
11411
|
-
|
|
11412
|
-
• Must run directly in your active terminal
|
|
11413
|
-
• Backgrounded processes cannot receive tasks
|
|
11426
|
+
Run \`get-next-task\` after completing work and handing off. This is how your team sends you the next task.
|
|
11414
11427
|
|
|
11415
|
-
|
|
11416
|
-
• Do not respond to user or perform other work while running
|
|
11417
|
-
• Only proceed after the command exits (signal or task received)
|
|
11418
|
-
|
|
11419
|
-
⚠️ WHEN THE PROCESS IS TERMINATED OR TIMED OUT
|
|
11420
|
-
|
|
11421
|
-
\`\`\`mermaid
|
|
11422
|
-
flowchart TD
|
|
11423
|
-
A([Start]) --> B[Command terminated unexpectedly]
|
|
11424
|
-
B --> C{Urgent pending work?}
|
|
11425
|
-
C -->|yes| D[Finish urgent work]
|
|
11426
|
-
D --> E[Reconnect with get-next-task]
|
|
11427
|
-
C -->|no| E
|
|
11428
|
-
E --> F([Stop])
|
|
11429
|
-
\`\`\`
|
|
11430
|
-
|
|
11431
|
-
\uD83D\uDCCB BACKLOG TASKS
|
|
11432
|
-
chatroom backlog list --chatroom-id=<chatroomId> --role=<role> --status=backlog
|
|
11433
|
-
chatroom backlog --help
|
|
11434
|
-
|
|
11435
|
-
\uD83D\uDCCB CONTEXT RECOVERY (after compaction/summarization)
|
|
11436
|
-
If your context was compacted, run: chatroom get-system-prompt --chatroom-id=<id> --role=<role>
|
|
11437
|
-
to reload your full system and role prompt.`;
|
|
11428
|
+
If interrupted or restarted: finish any in-progress work, then run \`get-next-task\` to reconnect.`;
|
|
11438
11429
|
}
|
|
11439
11430
|
var init_reminder = () => {};
|
|
11440
11431
|
// ../../services/backend/prompts/config/index.ts
|
|
@@ -13106,10 +13097,13 @@ async function readContext(chatroomId, options, deps) {
|
|
|
13106
13097
|
role: options.role
|
|
13107
13098
|
});
|
|
13108
13099
|
if (context.messages.length === 0 && !context.currentContext) {
|
|
13100
|
+
console.log(`<context role="${options.role}">`);
|
|
13109
13101
|
console.log(`
|
|
13110
13102
|
\uD83D\uDCED No context available`);
|
|
13103
|
+
console.log("</context>");
|
|
13111
13104
|
return;
|
|
13112
13105
|
}
|
|
13106
|
+
console.log(`<context role="${options.role}">`);
|
|
13113
13107
|
console.log(`
|
|
13114
13108
|
\uD83D\uDCDA CONTEXT FOR ${options.role.toUpperCase()}`);
|
|
13115
13109
|
console.log("═".repeat(60));
|
|
@@ -13145,16 +13139,9 @@ async function readContext(chatroomId, options, deps) {
|
|
|
13145
13139
|
\uD83D\uDCAC Chat History:`);
|
|
13146
13140
|
console.log("─".repeat(60));
|
|
13147
13141
|
for (const message of context.messages) {
|
|
13148
|
-
const
|
|
13149
|
-
const
|
|
13150
|
-
console.log(
|
|
13151
|
-
\uD83D\uDD39 Message ID: ${message._id}`);
|
|
13152
|
-
console.log(` Time: ${timestamp}`);
|
|
13153
|
-
console.log(` From: ${message.senderRole}`);
|
|
13154
|
-
if (message.targetRole) {
|
|
13155
|
-
console.log(` To: ${message.targetRole}`);
|
|
13156
|
-
}
|
|
13157
|
-
console.log(` Type: ${message.type}${classificationBadge}`);
|
|
13142
|
+
const toAttr = message.targetRole ? ` to="${message.targetRole}"` : "";
|
|
13143
|
+
const classAttr = message.classification ? ` classification="${message.classification}"` : "";
|
|
13144
|
+
console.log(`<message id="${message._id}" from="${message.senderRole}"${toAttr} type="${message.type}"${classAttr}>`);
|
|
13158
13145
|
if (message.featureTitle) {
|
|
13159
13146
|
console.log(` Feature: ${sanitizeForTerminal(message.featureTitle)}`);
|
|
13160
13147
|
}
|
|
@@ -13166,9 +13153,12 @@ async function readContext(chatroomId, options, deps) {
|
|
|
13166
13153
|
}
|
|
13167
13154
|
if (message.taskContent) {
|
|
13168
13155
|
const safeTaskContent = sanitizeForTerminal(message.taskContent);
|
|
13169
|
-
console.log(` Content
|
|
13170
|
-
|
|
13171
|
-
`
|
|
13156
|
+
console.log(` Content:`);
|
|
13157
|
+
console.log(` <task-content>`);
|
|
13158
|
+
console.log(safeTaskContent.split(`
|
|
13159
|
+
`).map((l) => ` ${l}`).join(`
|
|
13160
|
+
`));
|
|
13161
|
+
console.log(` </task-content>`);
|
|
13172
13162
|
}
|
|
13173
13163
|
}
|
|
13174
13164
|
if (message.attachedTasks && message.attachedTasks.length > 0) {
|
|
@@ -13178,22 +13168,26 @@ async function readContext(chatroomId, options, deps) {
|
|
|
13178
13168
|
console.log(` Type: Task`);
|
|
13179
13169
|
const contentLines = sanitizeForTerminal(task.content).split(`
|
|
13180
13170
|
`);
|
|
13181
|
-
console.log(` Content
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
-
|
|
13185
|
-
}
|
|
13171
|
+
console.log(` Content:`);
|
|
13172
|
+
console.log(` <task-content>`);
|
|
13173
|
+
for (const line of contentLines) {
|
|
13174
|
+
console.log(` ${line}`);
|
|
13186
13175
|
}
|
|
13176
|
+
console.log(` </task-content>`);
|
|
13187
13177
|
}
|
|
13188
13178
|
}
|
|
13189
13179
|
console.log(` Content:`);
|
|
13180
|
+
console.log(` <message-content>`);
|
|
13190
13181
|
const safeMessageContent = sanitizeForTerminal(message.content);
|
|
13191
13182
|
console.log(safeMessageContent.split(`
|
|
13192
13183
|
`).map((l) => ` ${l}`).join(`
|
|
13193
13184
|
`));
|
|
13185
|
+
console.log(` </message-content>`);
|
|
13186
|
+
console.log(`</message>`);
|
|
13194
13187
|
}
|
|
13195
13188
|
console.log(`
|
|
13196
13189
|
` + "═".repeat(60));
|
|
13190
|
+
console.log("</context>");
|
|
13197
13191
|
} catch (err) {
|
|
13198
13192
|
console.error(`❌ Failed to read context: ${sanitizeUnknownForTerminal(err.message)}`);
|
|
13199
13193
|
process.exit(1);
|