@townco/ui 0.1.22 → 0.1.24
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/core/hooks/use-chat-input.js +5 -1
- package/dist/core/hooks/use-chat-messages.js +7 -3
- package/dist/core/hooks/use-chat-session.js +5 -1
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +0 -1
- package/dist/core/store/chat-store.d.ts +6 -0
- package/dist/core/store/chat-store.js +27 -13
- package/dist/gui/components/Button.d.ts +1 -1
- package/dist/gui/components/Button.js +5 -5
- package/dist/gui/components/ChatPanelTabContent.d.ts +5 -0
- package/dist/gui/components/ChatPanelTabContent.js +5 -0
- package/dist/gui/components/ChatSecondaryPanel.d.ts +1 -1
- package/dist/gui/components/ChatSecondaryPanel.js +8 -3
- package/dist/gui/components/Input.js +1 -1
- package/dist/gui/components/PanelTabsHeader.d.ts +1 -1
- package/dist/gui/components/PanelTabsHeader.js +6 -1
- package/dist/gui/components/SourceListItem.d.ts +15 -0
- package/dist/gui/components/SourceListItem.js +7 -0
- package/dist/gui/components/ToolCall.js +7 -7
- package/dist/gui/components/index.d.ts +2 -1
- package/dist/gui/components/index.js +3 -2
- package/dist/sdk/client/acp-client.js +11 -3
- package/dist/sdk/transports/http.js +1 -1
- package/dist/sdk/transports/stdio.js +1 -1
- package/dist/tui/components/ChatView.d.ts +3 -0
- package/dist/tui/components/ChatView.js +20 -8
- package/dist/tui/components/InputBox.js +22 -3
- package/dist/tui/components/MessageList.js +1 -1
- package/dist/tui/components/SimpleTextInput.d.ts +7 -0
- package/dist/tui/components/SimpleTextInput.js +208 -0
- package/dist/tui/components/StatusBar.js +3 -3
- package/dist/tui/components/index.d.ts +1 -0
- package/dist/tui/components/index.js +1 -0
- package/package.json +3 -3
- package/src/styles/global.css +138 -84
- package/dist/core/lib/logger.d.ts +0 -24
- package/dist/core/lib/logger.js +0 -108
package/dist/core/lib/logger.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser-compatible logger
|
|
3
|
-
* Outputs structured JSON logs to console with color-coding
|
|
4
|
-
*/
|
|
5
|
-
const LOG_LEVELS = {
|
|
6
|
-
trace: 0,
|
|
7
|
-
debug: 1,
|
|
8
|
-
info: 2,
|
|
9
|
-
warn: 3,
|
|
10
|
-
error: 4,
|
|
11
|
-
fatal: 5,
|
|
12
|
-
};
|
|
13
|
-
const _LOG_COLORS = {
|
|
14
|
-
trace: "#6B7280", // gray
|
|
15
|
-
debug: "#3B82F6", // blue
|
|
16
|
-
info: "#10B981", // green
|
|
17
|
-
warn: "#F59E0B", // orange
|
|
18
|
-
error: "#EF4444", // red
|
|
19
|
-
fatal: "#DC2626", // dark red
|
|
20
|
-
};
|
|
21
|
-
const LOG_STYLES = {
|
|
22
|
-
trace: "color: #6B7280",
|
|
23
|
-
debug: "color: #3B82F6; font-weight: bold",
|
|
24
|
-
info: "color: #10B981; font-weight: bold",
|
|
25
|
-
warn: "color: #F59E0B; font-weight: bold",
|
|
26
|
-
error: "color: #EF4444; font-weight: bold",
|
|
27
|
-
fatal: "color: #DC2626; font-weight: bold; background: #FEE2E2",
|
|
28
|
-
};
|
|
29
|
-
export class Logger {
|
|
30
|
-
service;
|
|
31
|
-
minLevel;
|
|
32
|
-
constructor(service, minLevel = "debug") {
|
|
33
|
-
this.service = service;
|
|
34
|
-
this.minLevel = minLevel;
|
|
35
|
-
// In production, suppress trace and debug logs
|
|
36
|
-
if (typeof process !== "undefined" &&
|
|
37
|
-
process.env?.NODE_ENV === "production") {
|
|
38
|
-
this.minLevel = "info";
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
shouldLog(level) {
|
|
42
|
-
return LOG_LEVELS[level] >= LOG_LEVELS[this.minLevel];
|
|
43
|
-
}
|
|
44
|
-
log(level, message, metadata) {
|
|
45
|
-
if (!this.shouldLog(level)) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const entry = {
|
|
49
|
-
timestamp: new Date().toISOString(),
|
|
50
|
-
level,
|
|
51
|
-
service: this.service,
|
|
52
|
-
message,
|
|
53
|
-
...(metadata && { metadata }),
|
|
54
|
-
};
|
|
55
|
-
// Console output with color-coding
|
|
56
|
-
const style = LOG_STYLES[level];
|
|
57
|
-
const levelUpper = level.toUpperCase().padEnd(5);
|
|
58
|
-
if (typeof console !== "undefined") {
|
|
59
|
-
// Format: [timestamp] [SERVICE] [LEVEL] message
|
|
60
|
-
const prefix = `%c[${entry.timestamp}] [${this.service}] [${levelUpper}]`;
|
|
61
|
-
const msg = metadata ? `${message} %o` : message;
|
|
62
|
-
switch (level) {
|
|
63
|
-
case "trace":
|
|
64
|
-
case "debug":
|
|
65
|
-
case "info":
|
|
66
|
-
console.log(prefix, style, msg, ...(metadata ? [metadata] : []));
|
|
67
|
-
break;
|
|
68
|
-
case "warn":
|
|
69
|
-
console.warn(prefix, style, msg, ...(metadata ? [metadata] : []));
|
|
70
|
-
break;
|
|
71
|
-
case "error":
|
|
72
|
-
case "fatal":
|
|
73
|
-
console.error(prefix, style, msg, ...(metadata ? [metadata] : []));
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
// Also log the structured JSON for debugging
|
|
78
|
-
if (level === "fatal" || level === "error") {
|
|
79
|
-
console.debug("Structured log:", JSON.stringify(entry));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
trace(message, metadata) {
|
|
83
|
-
this.log("trace", message, metadata);
|
|
84
|
-
}
|
|
85
|
-
debug(message, metadata) {
|
|
86
|
-
this.log("debug", message, metadata);
|
|
87
|
-
}
|
|
88
|
-
info(message, metadata) {
|
|
89
|
-
this.log("info", message, metadata);
|
|
90
|
-
}
|
|
91
|
-
warn(message, metadata) {
|
|
92
|
-
this.log("warn", message, metadata);
|
|
93
|
-
}
|
|
94
|
-
error(message, metadata) {
|
|
95
|
-
this.log("error", message, metadata);
|
|
96
|
-
}
|
|
97
|
-
fatal(message, metadata) {
|
|
98
|
-
this.log("fatal", message, metadata);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Create a logger instance for a service
|
|
103
|
-
* @param service - Service name (e.g., "gui", "http-agent", "tui")
|
|
104
|
-
* @param minLevel - Minimum log level to display (default: "debug")
|
|
105
|
-
*/
|
|
106
|
-
export function createLogger(service, minLevel = "debug") {
|
|
107
|
-
return new Logger(service, minLevel);
|
|
108
|
-
}
|