@iinm/plain-agent 1.5.4 → 1.6.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.
@@ -745,7 +745,7 @@
745
745
  "unit": "1M",
746
746
  "costs": {
747
747
  "input_tokens": 0.75,
748
- "cached_tokens": -0.675,
748
+ "input_tokens_details.cached_tokens": -0.675,
749
749
  "output_tokens": 4.5
750
750
  }
751
751
  }
@@ -772,7 +772,7 @@
772
772
  "unit": "1M",
773
773
  "costs": {
774
774
  "input_tokens": 0.75,
775
- "cached_tokens": -0.675,
775
+ "input_tokens_details.cached_tokens": -0.675,
776
776
  "output_tokens": 4.5
777
777
  }
778
778
  }
@@ -799,7 +799,7 @@
799
799
  "unit": "1M",
800
800
  "costs": {
801
801
  "input_tokens": 0.75,
802
- "cached_tokens": -0.675,
802
+ "input_tokens_details.cached_tokens": -0.675,
803
803
  "output_tokens": 4.5
804
804
  }
805
805
  }
@@ -826,7 +826,7 @@
826
826
  "unit": "1M",
827
827
  "costs": {
828
828
  "input_tokens": 2.5,
829
- "cached_tokens": -2.25,
829
+ "input_tokens_details.cached_tokens": -2.25,
830
830
  "output_tokens": 15
831
831
  }
832
832
  }
@@ -853,7 +853,7 @@
853
853
  "unit": "1M",
854
854
  "costs": {
855
855
  "input_tokens": 2.5,
856
- "cached_tokens": -2.25,
856
+ "input_tokens_details.cached_tokens": -2.25,
857
857
  "output_tokens": 15
858
858
  }
859
859
  }
@@ -880,7 +880,7 @@
880
880
  "unit": "1M",
881
881
  "costs": {
882
882
  "input_tokens": 2.5,
883
- "cached_tokens": -2.25,
883
+ "input_tokens_details.cached_tokens": -2.25,
884
884
  "output_tokens": 15
885
885
  }
886
886
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iinm/plain-agent",
3
- "version": "1.5.4",
3
+ "version": "1.6.1",
4
4
  "description": "A lightweight CLI-based coding agent",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -36,11 +36,11 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@aws-crypto/sha256-js": "^5.2.0",
39
- "@aws-sdk/credential-providers": "^3.1024.0",
39
+ "@aws-sdk/credential-providers": "^3.1026.0",
40
40
  "@cfworker/json-schema": "^4.1.1",
41
41
  "@modelcontextprotocol/client": "^2.0.0-alpha.2",
42
- "@smithy/protocol-http": "^5.3.12",
43
- "@smithy/signature-v4": "^5.3.12",
42
+ "@smithy/protocol-http": "^5.3.13",
43
+ "@smithy/signature-v4": "^5.3.13",
44
44
  "diff": "^8.0.4",
45
45
  "js-yaml": "^4.1.1"
46
46
  },
@@ -0,0 +1,270 @@
1
+ /**
2
+ * @import { UserEventEmitter, AgentCommands } from "./agent"
3
+ * @import { ClaudeCodePlugin } from "./claudeCodePlugin.mjs"
4
+ */
5
+
6
+ import { execFileSync } from "node:child_process";
7
+ import { styleText } from "node:util";
8
+ import { formatCostSummary } from "./cliFormatter.mjs";
9
+ import { loadAgentRoles } from "./context/loadAgentRoles.mjs";
10
+ import { loadPrompts } from "./context/loadPrompts.mjs";
11
+ import { loadUserMessageContext } from "./context/loadUserMessageContext.mjs";
12
+ import { CLAUDE_CODE_COMPATIBILITY_NOTES } from "./prompt.mjs";
13
+ import { parseFileRange } from "./utils/parseFileRange.mjs";
14
+ import { readFileRange } from "./utils/readFileRange.mjs";
15
+
16
+ /**
17
+ * @typedef {"prompt" | "continue"} CommandResult
18
+ * - "prompt": return control to prompt (state.turn = true; cli.prompt())
19
+ * - "continue": agent is now running, do nothing
20
+ */
21
+
22
+ /**
23
+ * @typedef {object} CommandHandlerDeps
24
+ * @property {AgentCommands} agentCommands
25
+ * @property {UserEventEmitter} userEventEmitter
26
+ * @property {ClaudeCodePlugin[] | undefined} claudeCodePlugins
27
+ * @property {string} helpMessage
28
+ */
29
+
30
+ /**
31
+ * Create command handler function for processing slash commands.
32
+ *
33
+ * @param {CommandHandlerDeps} deps
34
+ * @returns {(input: string) => Promise<CommandResult>}
35
+ */
36
+ export function createCommandHandler({
37
+ agentCommands,
38
+ userEventEmitter,
39
+ claudeCodePlugins,
40
+ helpMessage,
41
+ }) {
42
+ /**
43
+ * Invoke an agent with the given id and goal.
44
+ * @param {string} id
45
+ * @param {string} goal
46
+ * @returns {Promise<CommandResult>}
47
+ */
48
+ async function invokeAgent(id, goal) {
49
+ const agentRoles = await loadAgentRoles(claudeCodePlugins);
50
+ const agent = agentRoles.get(id);
51
+ const name = agent ? id : `custom:${id}`;
52
+
53
+ const [goalTextContent, ...goalImages] = await loadUserMessageContext(goal);
54
+ const goalText =
55
+ goalTextContent?.type === "text" ? goalTextContent.text : goal;
56
+
57
+ const messageText = `Delegate to "${name}" agent with goal: ${goalText}`;
58
+ userEventEmitter.emit("userInput", [
59
+ { type: "text", text: messageText },
60
+ ...goalImages,
61
+ ]);
62
+ return "continue";
63
+ }
64
+
65
+ /**
66
+ * Invoke a prompt with the given id, args, and display invocation.
67
+ * @param {string} id
68
+ * @param {string} args
69
+ * @param {string} displayInvocation
70
+ * @returns {Promise<CommandResult>}
71
+ */
72
+ async function invokePrompt(id, args, displayInvocation) {
73
+ const prompts = await loadPrompts(claudeCodePlugins);
74
+ const prompt = prompts.get(id);
75
+
76
+ if (!prompt) {
77
+ console.log(styleText("red", `\nPrompt not found: ${id}`));
78
+ return "prompt";
79
+ }
80
+
81
+ const [argsTextContent, ...argsImages] = args
82
+ ? await loadUserMessageContext(args)
83
+ : [];
84
+ const argsText =
85
+ argsTextContent?.type === "text" ? argsTextContent.text : args;
86
+
87
+ const invocation = `${displayInvocation}${argsText ? ` ${argsText}` : ""}`;
88
+ const promptContent = prompt.claudeOriginated
89
+ ? `${prompt.content}\n\n---\n\n${CLAUDE_CODE_COMPATIBILITY_NOTES}`
90
+ : prompt.content;
91
+ const message = prompt.isSkill
92
+ ? `System: This prompt was invoked as "${invocation}".\nPrompt path: ${prompt.filePath}\n\n${promptContent}`
93
+ : `System: This prompt was invoked as "${invocation}".\n\n${promptContent}`;
94
+
95
+ userEventEmitter.emit("userInput", [
96
+ { type: "text", text: message },
97
+ ...argsImages,
98
+ ]);
99
+ return "continue";
100
+ }
101
+
102
+ /**
103
+ * Handle a complete user input string and return a CommandResult.
104
+ * @param {string} inputTrimmed
105
+ * @returns {Promise<CommandResult>}
106
+ */
107
+ return async function handleCommand(inputTrimmed) {
108
+ // /help or help
109
+ if (["/help", "help"].includes(inputTrimmed.toLowerCase())) {
110
+ console.log(`\n${helpMessage}`);
111
+ return "prompt";
112
+ }
113
+
114
+ // !path — read file content and emit as user input
115
+ if (inputTrimmed.startsWith("!")) {
116
+ const fileRange = parseFileRange(inputTrimmed.slice(1));
117
+ if (fileRange instanceof Error) {
118
+ console.log(styleText("red", `\n${fileRange.message}`));
119
+ return "prompt";
120
+ }
121
+
122
+ const fileContent = await readFileRange(fileRange);
123
+ if (fileContent instanceof Error) {
124
+ console.log(styleText("red", `\n${fileContent.message}`));
125
+ return "prompt";
126
+ }
127
+
128
+ const messageWithContext = await loadUserMessageContext(fileContent);
129
+ userEventEmitter.emit("userInput", messageWithContext);
130
+ return "continue";
131
+ }
132
+
133
+ // /dump
134
+ if (inputTrimmed.toLowerCase() === "/dump") {
135
+ await agentCommands.dumpMessages();
136
+ return "prompt";
137
+ }
138
+
139
+ // /load
140
+ if (inputTrimmed.toLowerCase() === "/load") {
141
+ await agentCommands.loadMessages();
142
+ return "prompt";
143
+ }
144
+
145
+ // /cost
146
+ if (inputTrimmed.toLowerCase() === "/cost") {
147
+ const summary = agentCommands.getCostSummary();
148
+ console.log(formatCostSummary(summary));
149
+ return "prompt";
150
+ }
151
+
152
+ // /agents or /agents:id
153
+ if (inputTrimmed === "/agents") {
154
+ const agentRoles = await loadAgentRoles(claudeCodePlugins);
155
+
156
+ console.log(styleText("bold", "\nAvailable Agent Roles:"));
157
+ if (agentRoles.size === 0) {
158
+ console.log(" No agent roles found.");
159
+ } else {
160
+ for (const role of agentRoles.values()) {
161
+ const maxLength = process.stdout.columns ?? 100;
162
+ const line = ` ${styleText("cyan", role.id.padEnd(20))} - ${role.description}`;
163
+ console.log(
164
+ line.length > maxLength ? `${line.slice(0, maxLength)}...` : line,
165
+ );
166
+ }
167
+ }
168
+ return "prompt";
169
+ }
170
+
171
+ if (inputTrimmed.startsWith("/agents:")) {
172
+ const match = inputTrimmed.match(/^\/agents:([^ ]+)(?:\s+(.*))?$/s);
173
+ if (!match) {
174
+ console.log(styleText("red", "\nInvalid agent invocation format."));
175
+ return "prompt";
176
+ }
177
+ return await invokeAgent(match[1], match[2] || "");
178
+ }
179
+
180
+ // /prompts or /prompts:id
181
+ if (inputTrimmed.startsWith("/prompts")) {
182
+ const prompts = await loadPrompts(claudeCodePlugins);
183
+
184
+ if (inputTrimmed === "/prompts") {
185
+ console.log(styleText("bold", "\nAvailable Prompts:"));
186
+ if (prompts.size === 0) {
187
+ console.log(" No prompts found.");
188
+ } else {
189
+ for (const prompt of prompts.values()) {
190
+ const maxLength = process.stdout.columns ?? 100;
191
+ const line = ` ${styleText("cyan", prompt.id.padEnd(20))} - ${prompt.description}`;
192
+ console.log(
193
+ line.length > maxLength ? `${line.slice(0, maxLength)}...` : line,
194
+ );
195
+ }
196
+ }
197
+ return "prompt";
198
+ }
199
+
200
+ if (inputTrimmed.startsWith("/prompts:")) {
201
+ const match = inputTrimmed.match(/^\/prompts:([^ ]+)(?:\s+(.*))?$/s);
202
+ if (!match) {
203
+ console.log(styleText("red", "\nInvalid prompt invocation format."));
204
+ return "prompt";
205
+ }
206
+ return await invokePrompt(
207
+ match[1],
208
+ match[2] || "",
209
+ `/prompts:${match[1]}`,
210
+ );
211
+ }
212
+ }
213
+
214
+ // /paste — read clipboard and emit as user input
215
+ if (inputTrimmed.startsWith("/paste")) {
216
+ const prompt = inputTrimmed.slice("/paste".length).trim();
217
+ let clipboard;
218
+ try {
219
+ if (process.platform === "darwin") {
220
+ clipboard = execFileSync("pbpaste", { encoding: "utf8" });
221
+ } else if (process.platform === "linux") {
222
+ clipboard = execFileSync("xsel", ["--clipboard", "--output"], {
223
+ encoding: "utf8",
224
+ });
225
+ } else {
226
+ console.log(
227
+ styleText(
228
+ "red",
229
+ `\nUnsupported platform for /paste: ${process.platform}`,
230
+ ),
231
+ );
232
+ return "prompt";
233
+ }
234
+ } catch (e) {
235
+ const errorMessage = e instanceof Error ? e.message : String(e);
236
+ console.log(
237
+ styleText(
238
+ "red",
239
+ `\nFailed to get clipboard content: ${errorMessage}`,
240
+ ),
241
+ );
242
+ return "prompt";
243
+ }
244
+
245
+ const combinedInput = prompt ? `${prompt}\n\n${clipboard}` : clipboard;
246
+ const messageWithContext = await loadUserMessageContext(combinedInput);
247
+ userEventEmitter.emit("userInput", messageWithContext);
248
+ return "continue";
249
+ }
250
+
251
+ // /<id> — shortcut for prompts in shortcuts/ directory
252
+ if (inputTrimmed.startsWith("/")) {
253
+ const match = inputTrimmed.match(/^\/([^ ]+)(?:\s+(.*))?$/);
254
+ if (match) {
255
+ const id = match[1];
256
+ const prompts = await loadPrompts(claudeCodePlugins);
257
+ const prompt = prompts.get(id);
258
+
259
+ if (prompt?.isShortcut) {
260
+ return await invokePrompt(id, match[2] || "", `/${id}`);
261
+ }
262
+ }
263
+ }
264
+
265
+ // Default: emit as plain user input
266
+ const messageWithContext = await loadUserMessageContext(inputTrimmed);
267
+ userEventEmitter.emit("userInput", messageWithContext);
268
+ return "continue";
269
+ };
270
+ }
@@ -0,0 +1,222 @@
1
+ /**
2
+ * @import { ClaudeCodePlugin } from "./claudeCodePlugin.mjs"
3
+ */
4
+
5
+ import { styleText } from "node:util";
6
+ import { loadAgentRoles } from "./context/loadAgentRoles.mjs";
7
+ import { loadPrompts } from "./context/loadPrompts.mjs";
8
+
9
+ // Define available slash commands for tab completion
10
+ export const SLASH_COMMANDS = [
11
+ { name: "/help", description: "Display this help message" },
12
+ { name: "/agents", description: "List available agent roles" },
13
+ {
14
+ name: "/agents:<id>",
15
+ description:
16
+ "Delegate to an agent with the given ID (e.g., /agents:code-simplifier)",
17
+ },
18
+ { name: "/prompts", description: "List available prompts" },
19
+ {
20
+ name: "/prompts:<id>",
21
+ description:
22
+ "Invoke a prompt with the given ID (e.g., /prompts:feature-dev)",
23
+ },
24
+ {
25
+ name: "/<id>",
26
+ description:
27
+ "Shortcut for prompts in the shortcuts/ directory (e.g., /commit)",
28
+ },
29
+ { name: "/paste", description: "Paste content from clipboard" },
30
+ {
31
+ name: "/resume",
32
+ description: "Resume conversation after an LLM provider error",
33
+ },
34
+ { name: "/dump", description: "Save current messages to a JSON file" },
35
+ { name: "/load", description: "Load messages from a JSON file" },
36
+ { name: "/cost", description: "Display session cost and token usage" },
37
+ ];
38
+
39
+ /**
40
+ * @typedef {Object} CompletionCandidate
41
+ * @property {string} name
42
+ * @property {string} description
43
+ */
44
+
45
+ /**
46
+ * Find candidates that match the line, prioritizing prefix matches.
47
+ * @param {(string | CompletionCandidate)[]} candidates
48
+ * @param {string} line
49
+ * @param {number} queryStartIndex
50
+ * @returns {(string | CompletionCandidate)[]}
51
+ */
52
+ function findMatches(candidates, line, queryStartIndex) {
53
+ const query = line.slice(queryStartIndex);
54
+ const prefixMatches = [];
55
+ const partialMatches = [];
56
+
57
+ for (const candidate of candidates) {
58
+ const name = typeof candidate === "string" ? candidate : candidate.name;
59
+ if (name.startsWith(line)) {
60
+ prefixMatches.push(candidate);
61
+ } else if (
62
+ query.length > 0 &&
63
+ name.slice(queryStartIndex).includes(query)
64
+ ) {
65
+ partialMatches.push(candidate);
66
+ }
67
+ }
68
+
69
+ return [...prefixMatches, ...partialMatches];
70
+ }
71
+
72
+ /**
73
+ * Return the longest common prefix of the given strings.
74
+ * @param {string[]} strings
75
+ * @returns {string}
76
+ */
77
+ function commonPrefix(strings) {
78
+ if (strings.length === 0) return "";
79
+ let prefix = strings[0];
80
+ for (let i = 1; i < strings.length; i++) {
81
+ while (!strings[i].startsWith(prefix)) {
82
+ prefix = prefix.slice(0, -1);
83
+ }
84
+ }
85
+ return prefix;
86
+ }
87
+
88
+ /**
89
+ * Display completion candidates and invoke the readline callback.
90
+ *
91
+ * Node.js readline normally requires two consecutive Tab presses to show the
92
+ * candidate list. This helper lets readline handle the common-prefix
93
+ * auto-completion first, then prints the candidate list on the next tick and
94
+ * redraws the prompt so the display stays clean.
95
+ *
96
+ * @param {import("node:readline").Interface} rl
97
+ * @param {(string | CompletionCandidate)[]} candidates
98
+ * @param {string} line
99
+ * @param {(err: Error | null, result: [string[], string]) => void} callback
100
+ */
101
+ function showCompletions(rl, candidates, line, callback) {
102
+ const names = candidates.map((c) => (typeof c === "string" ? c : c.name));
103
+ if (candidates.length <= 1) {
104
+ callback(null, [names, line]);
105
+ return;
106
+ }
107
+ const prefix = commonPrefix(names);
108
+ if (prefix.length > line.length) {
109
+ // Let readline insert the common prefix.
110
+ callback(null, [[prefix], line]);
111
+ } else {
112
+ // Nothing new to insert.
113
+ callback(null, [[], line]);
114
+ }
115
+ // After readline finishes its own refresh, print the candidate list and
116
+ // redraw the prompt line. We cannot use rl.prompt(true) because its
117
+ // internal _refreshLine clears everything below the prompt start, which
118
+ // erases the candidate list we just wrote. Instead we manually re-output
119
+ // the prompt and current line content.
120
+ setTimeout(() => {
121
+ const maxLength = process.stdout.columns ?? 100;
122
+ const list = candidates
123
+ .map((c) => {
124
+ if (typeof c === "string") return c;
125
+ const nameText = c.name.padEnd(25);
126
+ const separator = " - ";
127
+ const descText = c.description;
128
+
129
+ // 画面幅に合わせて説明文をカット(色を付ける前に計算)
130
+ const availableWidth =
131
+ maxLength - nameText.length - separator.length - 3;
132
+ const displayDesc =
133
+ descText.length > availableWidth && availableWidth > 0
134
+ ? `${descText.slice(0, availableWidth)}...`
135
+ : descText;
136
+
137
+ const name = styleText("cyan", nameText);
138
+ const description = styleText("dim", displayDesc);
139
+ return `${name}${separator}${description}`;
140
+ })
141
+ .join("\r\n");
142
+ process.stdout.write(`\r\n${list}\r\n`);
143
+ process.stdout.write(`${rl.getPrompt()}${rl.line}`);
144
+ }, 0);
145
+ }
146
+
147
+ /**
148
+ * Create a completer function for readline.
149
+ *
150
+ * Because the readline.Interface instance (`cli`) is not available until after
151
+ * `readline.createInterface` returns, we accept a getter function so the
152
+ * completer can resolve the reference lazily at call time.
153
+ *
154
+ * @param {() => import("node:readline").Interface} getCliRef - A function that returns the readline Interface
155
+ * @param {ClaudeCodePlugin[] | undefined} claudeCodePlugins
156
+ * @returns {(line: string, callback: (err?: Error | null, result?: [string[], string]) => void) => void}
157
+ */
158
+ export function createCompleter(getCliRef, claudeCodePlugins) {
159
+ return (line, callback) => {
160
+ (async () => {
161
+ try {
162
+ const cli = getCliRef();
163
+ const prompts = await loadPrompts(claudeCodePlugins);
164
+ const agentRoles = await loadAgentRoles(claudeCodePlugins);
165
+
166
+ if (line.startsWith("/agents:")) {
167
+ const prefix = "/agents:";
168
+ const candidates = Array.from(agentRoles.values()).map((a) => ({
169
+ name: `${prefix}${a.id}`,
170
+ description: a.description,
171
+ }));
172
+ const hits = findMatches(candidates, line, prefix.length);
173
+
174
+ showCompletions(cli, hits, line, callback);
175
+ return;
176
+ }
177
+
178
+ if (line.startsWith("/prompts:")) {
179
+ const prefix = "/prompts:";
180
+ const candidates = Array.from(prompts.values()).map((p) => ({
181
+ name: `${prefix}${p.id}`,
182
+ description: p.description,
183
+ }));
184
+ const hits = findMatches(candidates, line, prefix.length);
185
+
186
+ showCompletions(cli, hits, line, callback);
187
+ return;
188
+ }
189
+
190
+ if (line.startsWith("/")) {
191
+ const shortcuts = Array.from(prompts.values())
192
+ .filter((p) => p.isShortcut)
193
+ .map((p) => ({
194
+ name: `/${p.id}`,
195
+ description: p.description,
196
+ }));
197
+
198
+ const allCommands = [...SLASH_COMMANDS, ...shortcuts].filter(
199
+ (cmd) => {
200
+ const name = typeof cmd === "string" ? cmd : cmd.name;
201
+ return (
202
+ name !== "/<id>" &&
203
+ (name === "/agents:" || !name.startsWith("/agent:")) &&
204
+ (name === "/prompts:" || !name.startsWith("/prompt:"))
205
+ );
206
+ },
207
+ );
208
+
209
+ const hits = findMatches(allCommands, line, 1);
210
+
211
+ showCompletions(cli, hits, line, callback);
212
+ return;
213
+ }
214
+
215
+ callback(null, [[], line]);
216
+ } catch (err) {
217
+ const error = err instanceof Error ? err : new Error(String(err));
218
+ callback(error, [[], line]);
219
+ }
220
+ })();
221
+ };
222
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @import { MessageContentToolUse, MessageContentToolResult, ProviderTokenUsage } from "./model"
2
+ * @import { Message, MessageContentToolUse, MessageContentToolResult, ProviderTokenUsage } from "./model"
3
3
  * @import { ExecCommandInput } from "./tools/execCommand"
4
4
  * @import { PatchFileInput } from "./tools/patchFile"
5
5
  * @import { WriteFileInput } from "./tools/writeFile"
@@ -266,3 +266,65 @@ export function formatCostForBatch(summary) {
266
266
  ),
267
267
  };
268
268
  }
269
+
270
+ /**
271
+ * Print a message to the console.
272
+ * @param {Message} message
273
+ */
274
+ export function printMessage(message) {
275
+ switch (message.role) {
276
+ case "assistant": {
277
+ // console.log(styleText("bold", "\nAgent:"));
278
+ for (const part of message.content) {
279
+ switch (part.type) {
280
+ // Note: Streamで表示するためここでは表示しない
281
+ // case "thinking":
282
+ // console.log(
283
+ // [
284
+ // styleText("blue", "<thinking>"),
285
+ // part.thinking,
286
+ // styleText("blue", "</thinking>\n"),
287
+ // ].join("\n"),
288
+ // );
289
+ // break;
290
+ // case "text":
291
+ // console.log(part.text);
292
+ // break;
293
+ case "tool_use":
294
+ console.log(styleText("bold", "\nTool call:"));
295
+ console.log(formatToolUse(part));
296
+ break;
297
+ }
298
+ }
299
+ break;
300
+ }
301
+ case "user": {
302
+ for (const part of message.content) {
303
+ switch (part.type) {
304
+ case "tool_result": {
305
+ console.log(styleText("bold", "\nTool result:"));
306
+ console.log(formatToolResult(part));
307
+ break;
308
+ }
309
+ case "text": {
310
+ console.log(styleText("bold", "\nUser:"));
311
+ console.log(part.text);
312
+ break;
313
+ }
314
+ case "image": {
315
+ break;
316
+ }
317
+ default: {
318
+ console.log(styleText("bold", "\nUnknown Message Format:"));
319
+ console.log(JSON.stringify(part, null, 2));
320
+ }
321
+ }
322
+ }
323
+ break;
324
+ }
325
+ default: {
326
+ console.log(styleText("bold", "\nUnknown Message Format:"));
327
+ console.log(JSON.stringify(message, null, 2));
328
+ }
329
+ }
330
+ }