@myskyline_ai/ccdebug 0.2.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.
- package/LICENSE +201 -0
- package/README.md +129 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +674 -0
- package/dist/html-generator.d.ts +24 -0
- package/dist/html-generator.d.ts.map +1 -0
- package/dist/html-generator.js +141 -0
- package/dist/index-generator.d.ts +29 -0
- package/dist/index-generator.d.ts.map +1 -0
- package/dist/index-generator.js +271 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/interceptor-loader.js +59 -0
- package/dist/interceptor.d.ts +46 -0
- package/dist/interceptor.d.ts.map +1 -0
- package/dist/interceptor.js +555 -0
- package/dist/log-file-manager.d.ts +15 -0
- package/dist/log-file-manager.d.ts.map +1 -0
- package/dist/log-file-manager.js +41 -0
- package/dist/shared-conversation-processor.d.ts +114 -0
- package/dist/shared-conversation-processor.d.ts.map +1 -0
- package/dist/shared-conversation-processor.js +663 -0
- package/dist/token-extractor.js +28 -0
- package/dist/types.d.ts +95 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/frontend/dist/index.global.js +1522 -0
- package/frontend/dist/styles.css +985 -0
- package/frontend/template.html +19 -0
- package/package.json +83 -0
- package/web/debug.html +14 -0
- package/web/dist/assets/index-BIP9r3RA.js +48 -0
- package/web/dist/assets/index-BIP9r3RA.js.map +1 -0
- package/web/dist/assets/index-De3gn-G-.css +1 -0
- package/web/dist/favicon.svg +4 -0
- package/web/dist/index.html +15 -0
- package/web/index.html +14 -0
- package/web/package.json +47 -0
- package/web/server/conversation-parser.d.ts +47 -0
- package/web/server/conversation-parser.d.ts.map +1 -0
- package/web/server/conversation-parser.js +564 -0
- package/web/server/conversation-parser.js.map +1 -0
- package/web/server/index.d.ts +16 -0
- package/web/server/index.d.ts.map +1 -0
- package/web/server/index.js +60 -0
- package/web/server/index.js.map +1 -0
- package/web/server/log-file-manager.d.ts +98 -0
- package/web/server/log-file-manager.d.ts.map +1 -0
- package/web/server/log-file-manager.js +512 -0
- package/web/server/log-file-manager.js.map +1 -0
- package/web/server/src/types/index.d.ts +68 -0
- package/web/server/src/types/index.d.ts.map +1 -0
- package/web/server/src/types/index.js +3 -0
- package/web/server/src/types/index.js.map +1 -0
- package/web/server/test-path.js +48 -0
- package/web/server/web-server.d.ts +41 -0
- package/web/server/web-server.d.ts.map +1 -0
- package/web/server/web-server.js +807 -0
- package/web/server/web-server.js.map +1 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { Message, MessageCreateParams, MessageParam, TextBlockParam, ToolResultBlockParam } from "@anthropic-ai/sdk/resources/messages";
|
|
2
|
+
import type { RawPair } from "./types";
|
|
3
|
+
export interface ProcessedPair {
|
|
4
|
+
id: string;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
request: MessageCreateParams;
|
|
7
|
+
response: Message;
|
|
8
|
+
model: string;
|
|
9
|
+
isStreaming: boolean;
|
|
10
|
+
rawStreamData?: string;
|
|
11
|
+
streamFormat?: "standard" | "bedrock" | null;
|
|
12
|
+
}
|
|
13
|
+
export interface EnhancedMessageParam extends MessageParam {
|
|
14
|
+
toolResults?: Record<string, ToolResultBlockParam>;
|
|
15
|
+
hide?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface SimpleConversation {
|
|
18
|
+
id: string;
|
|
19
|
+
models: Set<string>;
|
|
20
|
+
system?: string | TextBlockParam[];
|
|
21
|
+
messages: EnhancedMessageParam[];
|
|
22
|
+
response: Message;
|
|
23
|
+
allPairs: ProcessedPair[];
|
|
24
|
+
finalPair: ProcessedPair;
|
|
25
|
+
compacted?: boolean;
|
|
26
|
+
metadata: {
|
|
27
|
+
startTime: string;
|
|
28
|
+
endTime: string;
|
|
29
|
+
totalPairs: number;
|
|
30
|
+
inputTokens: number;
|
|
31
|
+
outputTokens: number;
|
|
32
|
+
totalTokens: number;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Shared conversation processing functionality for both frontend and backend
|
|
37
|
+
*/
|
|
38
|
+
export declare class SharedConversationProcessor {
|
|
39
|
+
/**
|
|
40
|
+
* Process raw JSONL pairs into ProcessedPairs
|
|
41
|
+
*/
|
|
42
|
+
processRawPairs(rawPairs: RawPair[]): ProcessedPair[];
|
|
43
|
+
/**
|
|
44
|
+
* Detect if the response is from Bedrock by checking for binary event stream format
|
|
45
|
+
*/
|
|
46
|
+
private isBedrockResponse;
|
|
47
|
+
/**
|
|
48
|
+
* Parse Bedrock binary event stream and extract the standard message events
|
|
49
|
+
*/
|
|
50
|
+
private parseBedrockStreamingResponse;
|
|
51
|
+
/**
|
|
52
|
+
* Decode base64 string to UTF-8, compatible with both browser and Node.js environments
|
|
53
|
+
*/
|
|
54
|
+
private decodeBase64ToUtf8;
|
|
55
|
+
/**
|
|
56
|
+
* Extract JSON chunks from AWS EventStream binary format
|
|
57
|
+
*/
|
|
58
|
+
private extractJsonChunksFromEventStream;
|
|
59
|
+
/**
|
|
60
|
+
* Extract Bedrock invocation metrics from the response
|
|
61
|
+
*/
|
|
62
|
+
private extractBedrockMetrics;
|
|
63
|
+
/**
|
|
64
|
+
* Parse streaming response from raw SSE data
|
|
65
|
+
*/
|
|
66
|
+
private parseStreamingResponse;
|
|
67
|
+
/**
|
|
68
|
+
* Parse standard Anthropic API streaming response
|
|
69
|
+
*/
|
|
70
|
+
private parseStandardStreamingResponse;
|
|
71
|
+
/**
|
|
72
|
+
* Build a Message object from a list of streaming events
|
|
73
|
+
*/
|
|
74
|
+
private buildMessageFromEvents;
|
|
75
|
+
/**
|
|
76
|
+
* Extract model name from the raw pair
|
|
77
|
+
*/
|
|
78
|
+
private extractModel;
|
|
79
|
+
/**
|
|
80
|
+
* Normalize model names from different formats to a consistent display format
|
|
81
|
+
*/
|
|
82
|
+
private normalizeModelName;
|
|
83
|
+
/**
|
|
84
|
+
* Group processed pairs into conversations
|
|
85
|
+
*/
|
|
86
|
+
mergeConversations(pairs: ProcessedPair[], options?: {
|
|
87
|
+
includeShortConversations?: boolean;
|
|
88
|
+
}): SimpleConversation[];
|
|
89
|
+
/**
|
|
90
|
+
* Process messages to pair tool_use with tool_result
|
|
91
|
+
*/
|
|
92
|
+
private processToolResults;
|
|
93
|
+
/**
|
|
94
|
+
* Detect and merge compact conversations
|
|
95
|
+
*/
|
|
96
|
+
private detectAndMergeCompactConversations;
|
|
97
|
+
/**
|
|
98
|
+
* Merge a compact conversation with its original counterpart
|
|
99
|
+
*/
|
|
100
|
+
private mergeCompactConversation;
|
|
101
|
+
/**
|
|
102
|
+
* Compare two messages to see if they're roughly equal
|
|
103
|
+
*/
|
|
104
|
+
private messagesRoughlyEqual;
|
|
105
|
+
/**
|
|
106
|
+
* Normalize message for grouping (removes dynamic content)
|
|
107
|
+
*/
|
|
108
|
+
private normalizeMessageForGrouping;
|
|
109
|
+
/**
|
|
110
|
+
* Generate hash string for conversation grouping
|
|
111
|
+
*/
|
|
112
|
+
private hashString;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=shared-conversation-processor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-conversation-processor.d.ts","sourceRoot":"","sources":["../src/shared-conversation-processor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGR,OAAO,EACP,mBAAmB,EACnB,YAAY,EAGZ,cAAc,EACd,oBAAoB,EAGvB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAA4B,MAAM,SAAS,CAAC;AAGjE,MAAM,WAAW,aAAa;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;I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