@proofofprotocol/inscribe-mcp 0.3.7 → 0.3.10
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/package.json +1 -1
- package/src/cli/commands/show.js +23 -14
- package/src/server.js +13 -11
package/package.json
CHANGED
package/src/cli/commands/show.js
CHANGED
|
@@ -336,11 +336,11 @@ export const showCommand = new Command('show')
|
|
|
336
336
|
if (sequences.length === 0) {
|
|
337
337
|
console.log(colors.dim('No complete sequences found.'));
|
|
338
338
|
} else {
|
|
339
|
-
// LAN Analyzer style header
|
|
339
|
+
// LAN Analyzer style header (wider Details column: 55 chars)
|
|
340
340
|
console.log('');
|
|
341
|
-
console.log(colors.dim('
|
|
342
|
-
console.log(colors.dim('│ Timestamp │ Dir │ Phase │ Details
|
|
343
|
-
console.log(colors.dim('
|
|
341
|
+
console.log(colors.dim('┌──────────────┬───────┬────────────────────┬─────────────────────────────────────────────────────────┐'));
|
|
342
|
+
console.log(colors.dim('│ Timestamp │ Dir │ Phase │ Details │'));
|
|
343
|
+
console.log(colors.dim('├──────────────┼───────┼────────────────────┼─────────────────────────────────────────────────────────┤'));
|
|
344
344
|
|
|
345
345
|
// Direction symbols
|
|
346
346
|
const dirSymbols = {
|
|
@@ -358,14 +358,20 @@ export const showCommand = new Command('show')
|
|
|
358
358
|
};
|
|
359
359
|
|
|
360
360
|
for (const seq of sequences.slice(-8)) { // Last 8 sequences
|
|
361
|
-
// Sequence header
|
|
361
|
+
// Sequence header with date
|
|
362
362
|
const seqTime = new Date(seq.timestamp);
|
|
363
|
+
const dateStr = seqTime.toLocaleDateString('en-CA'); // YYYY-MM-DD format
|
|
363
364
|
const timeStr = seqTime.toLocaleTimeString('en-US', { hour12: false });
|
|
364
365
|
const msStr = String(seqTime.getMilliseconds()).padStart(3, '0');
|
|
365
366
|
|
|
367
|
+
// Show [tool] and date on the right
|
|
368
|
+
const toolLabel = `[${seq.tool}]`;
|
|
369
|
+
const dateLabel = colors.dim(dateStr);
|
|
370
|
+
const headerDetails = `${toolLabel} ${dateLabel}`.padEnd(55);
|
|
371
|
+
|
|
366
372
|
console.log(colors.dim('│') + colors.bold(` ${timeStr}.${msStr}`) + colors.dim(' │ │ ') +
|
|
367
|
-
colors.cyan(colors.bold(
|
|
368
|
-
colors.dim('
|
|
373
|
+
colors.cyan(colors.bold(toolLabel)) + ' ' + dateLabel +
|
|
374
|
+
' '.repeat(Math.max(0, 55 - toolLabel.length - 1 - dateStr.length)) + colors.dim(' │'));
|
|
369
375
|
|
|
370
376
|
for (const phase of seq.phases) {
|
|
371
377
|
const phaseTime = new Date(phase.timestamp);
|
|
@@ -403,7 +409,7 @@ export const showCommand = new Command('show')
|
|
|
403
409
|
}
|
|
404
410
|
}
|
|
405
411
|
|
|
406
|
-
// Chain → MCP phase: show status, duration, txId
|
|
412
|
+
// Chain → MCP phase: show status, duration, txId/hash
|
|
407
413
|
if (phase.phase === 'chain_to_mcp') {
|
|
408
414
|
if (phase.status) {
|
|
409
415
|
const statusColor = phase.status === 'SUCCESS' ? colors.green : colors.red;
|
|
@@ -412,12 +418,15 @@ export const showCommand = new Command('show')
|
|
|
412
418
|
if (phase.duration !== undefined) {
|
|
413
419
|
details.push(colors.yellow(`${phase.duration}ms`));
|
|
414
420
|
}
|
|
415
|
-
if (phase.resultPreview
|
|
416
|
-
|
|
417
|
-
|
|
421
|
+
if (phase.resultPreview) {
|
|
422
|
+
// Show txId (full Hedera format: 0.0.xxx@timestamp)
|
|
423
|
+
if (phase.resultPreview.txId) {
|
|
424
|
+
const txId = String(phase.resultPreview.txId);
|
|
425
|
+
details.push(colors.cyan(`tx:${txId}`));
|
|
426
|
+
}
|
|
418
427
|
}
|
|
419
428
|
if (phase.error) {
|
|
420
|
-
details.push(colors.red(phase.error.slice(0,
|
|
429
|
+
details.push(colors.red(phase.error.slice(0, 30)));
|
|
421
430
|
}
|
|
422
431
|
}
|
|
423
432
|
|
|
@@ -448,14 +457,14 @@ export const showCommand = new Command('show')
|
|
|
448
457
|
}
|
|
449
458
|
}
|
|
450
459
|
|
|
451
|
-
const detailStr = details.join(' ').slice(0,
|
|
460
|
+
const detailStr = details.join(' ').slice(0, 55).padEnd(55);
|
|
452
461
|
|
|
453
462
|
console.log(colors.dim('│ ') + `${pTimeStr}.${pMsStr}` + colors.dim(' │ ') +
|
|
454
463
|
dir + colors.dim(' │ ') + phaseLabel + colors.dim(' │ ') + detailStr + colors.dim(' │'));
|
|
455
464
|
}
|
|
456
465
|
}
|
|
457
466
|
|
|
458
|
-
console.log(colors.dim('
|
|
467
|
+
console.log(colors.dim('└──────────────┴───────┴────────────────────┴─────────────────────────────────────────────────────────┘'));
|
|
459
468
|
console.log('');
|
|
460
469
|
console.log(colors.dim(`Showing last ${Math.min(8, sequences.length)} of ${sequences.length} sequences`));
|
|
461
470
|
}
|
package/src/server.js
CHANGED
|
@@ -161,14 +161,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
161
161
|
const startTime = Date.now();
|
|
162
162
|
const requestId = request.id || `req_${Date.now()}`;
|
|
163
163
|
|
|
164
|
-
// Debug: Agent → MCP (request received) -
|
|
164
|
+
// Debug: Agent → MCP (request received) - sequence diagram style
|
|
165
|
+
// 往路: Agent → MCP → Chain (all →OUT)
|
|
166
|
+
// 復路: Chain → MCP → Agent (all ←IN)
|
|
165
167
|
debugLog('agent_to_mcp', {
|
|
166
168
|
tool: name,
|
|
167
169
|
method: 'tools/call',
|
|
168
170
|
requestId,
|
|
169
171
|
argsKeys: args ? Object.keys(args) : [],
|
|
170
172
|
argsPreview: args ? JSON.stringify(args).slice(0, 100) : null,
|
|
171
|
-
direction: '
|
|
173
|
+
direction: 'OUT' // 往路: →
|
|
172
174
|
});
|
|
173
175
|
|
|
174
176
|
const tool = allTools.find(t => t.name === name);
|
|
@@ -208,24 +210,24 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
208
210
|
type: result.type
|
|
209
211
|
} : null;
|
|
210
212
|
|
|
211
|
-
// Debug: Chain → MCP (response)
|
|
213
|
+
// Debug: Chain → MCP (response) - 復路: ←
|
|
212
214
|
debugLog('chain_to_mcp', {
|
|
213
215
|
tool: name,
|
|
214
216
|
requestId,
|
|
215
217
|
status: 'SUCCESS',
|
|
216
218
|
duration,
|
|
217
219
|
resultPreview,
|
|
218
|
-
direction: 'IN'
|
|
220
|
+
direction: 'IN' // 復路: ←
|
|
219
221
|
});
|
|
220
222
|
|
|
221
|
-
// Debug: MCP → Agent (returning result)
|
|
223
|
+
// Debug: MCP → Agent (returning result) - 復路: ←
|
|
222
224
|
debugLog('mcp_to_agent', {
|
|
223
225
|
tool: name,
|
|
224
226
|
requestId,
|
|
225
227
|
status: 'SUCCESS',
|
|
226
228
|
duration,
|
|
227
229
|
responseSize: JSON.stringify(result).length,
|
|
228
|
-
direction: '
|
|
230
|
+
direction: 'IN' // 復路: ←
|
|
229
231
|
});
|
|
230
232
|
|
|
231
233
|
return {
|
|
@@ -234,7 +236,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
234
236
|
} catch (error) {
|
|
235
237
|
const duration = Date.now() - startTime;
|
|
236
238
|
|
|
237
|
-
// Debug: Chain → MCP (error)
|
|
239
|
+
// Debug: Chain → MCP (error) - 復路: ←
|
|
238
240
|
debugLog('chain_to_mcp', {
|
|
239
241
|
tool: name,
|
|
240
242
|
requestId,
|
|
@@ -242,17 +244,17 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
242
244
|
duration,
|
|
243
245
|
error: error.message,
|
|
244
246
|
errorType: error.constructor.name,
|
|
245
|
-
direction: 'IN'
|
|
247
|
+
direction: 'IN' // 復路: ←
|
|
246
248
|
});
|
|
247
249
|
|
|
248
|
-
// Debug: MCP → Agent (returning error)
|
|
250
|
+
// Debug: MCP → Agent (returning error) - 復路: ←
|
|
249
251
|
debugLog('mcp_to_agent', {
|
|
250
252
|
tool: name,
|
|
251
253
|
requestId,
|
|
252
254
|
status: 'ERROR',
|
|
253
255
|
duration,
|
|
254
256
|
error: error.message,
|
|
255
|
-
direction: '
|
|
257
|
+
direction: 'IN' // 復路: ←
|
|
256
258
|
});
|
|
257
259
|
|
|
258
260
|
return {
|
|
@@ -274,7 +276,7 @@ async function main() {
|
|
|
274
276
|
if (isDebugEnabled()) {
|
|
275
277
|
console.error('Debug mode is currently ON (hot-reloadable)');
|
|
276
278
|
debugLog('server_start', {
|
|
277
|
-
version: '0.3.
|
|
279
|
+
version: '0.3.10',
|
|
278
280
|
tools: allTools.map(t => t.name)
|
|
279
281
|
});
|
|
280
282
|
}
|