@townco/ui 0.1.43 → 0.1.44
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.
|
@@ -15,6 +15,7 @@ export declare class StdioTransport implements Transport {
|
|
|
15
15
|
private currentSessionId;
|
|
16
16
|
private chunkResolvers;
|
|
17
17
|
private streamComplete;
|
|
18
|
+
private originalConsole;
|
|
18
19
|
constructor(options: StdioTransportOptions);
|
|
19
20
|
connect(): Promise<void>;
|
|
20
21
|
disconnect(): Promise<void>;
|
|
@@ -18,6 +18,7 @@ export class StdioTransport {
|
|
|
18
18
|
currentSessionId = null;
|
|
19
19
|
chunkResolvers = [];
|
|
20
20
|
streamComplete = false;
|
|
21
|
+
originalConsole = null;
|
|
21
22
|
constructor(options) {
|
|
22
23
|
this.options = options;
|
|
23
24
|
}
|
|
@@ -41,7 +42,43 @@ export class StdioTransport {
|
|
|
41
42
|
const outputStream = Writable.toWeb(this.agentProcess.stdin);
|
|
42
43
|
const inputStream = Readable.toWeb(this.agentProcess.stdout);
|
|
43
44
|
// Create the bidirectional stream using ndJsonStream
|
|
45
|
+
// Intercept all console methods to redirect agent output to logger
|
|
46
|
+
// Store original console methods for later restoration
|
|
47
|
+
this.originalConsole = {
|
|
48
|
+
log: console.log,
|
|
49
|
+
error: console.error,
|
|
50
|
+
warn: console.warn,
|
|
51
|
+
info: console.info,
|
|
52
|
+
debug: console.debug,
|
|
53
|
+
};
|
|
54
|
+
console.log = (...args) => {
|
|
55
|
+
logger.info("Agent console.log", {
|
|
56
|
+
message: args.map(String).join(" "),
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
console.error = (...args) => {
|
|
60
|
+
logger.error("Agent console.error", {
|
|
61
|
+
message: args.map(String).join(" "),
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
console.warn = (...args) => {
|
|
65
|
+
logger.warn("Agent console.warn", {
|
|
66
|
+
message: args.map(String).join(" "),
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
console.info = (...args) => {
|
|
70
|
+
logger.info("Agent console.info", {
|
|
71
|
+
message: args.map(String).join(" "),
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
console.debug = (...args) => {
|
|
75
|
+
logger.debug("Agent console.debug", {
|
|
76
|
+
message: args.map(String).join(" "),
|
|
77
|
+
});
|
|
78
|
+
};
|
|
44
79
|
const stream = ndJsonStream(outputStream, inputStream);
|
|
80
|
+
// Keep console methods intercepted throughout the connection lifecycle
|
|
81
|
+
// They will be restored in disconnect()
|
|
45
82
|
// Create ACP client implementation factory
|
|
46
83
|
const self = this;
|
|
47
84
|
const clientFactory = (_agent) => {
|
|
@@ -321,6 +358,15 @@ export class StdioTransport {
|
|
|
321
358
|
}
|
|
322
359
|
catch (error) {
|
|
323
360
|
this.connected = false;
|
|
361
|
+
// Restore original console methods on error
|
|
362
|
+
if (this.originalConsole) {
|
|
363
|
+
console.log = this.originalConsole.log;
|
|
364
|
+
console.error = this.originalConsole.error;
|
|
365
|
+
console.warn = this.originalConsole.warn;
|
|
366
|
+
console.info = this.originalConsole.info;
|
|
367
|
+
console.debug = this.originalConsole.debug;
|
|
368
|
+
this.originalConsole = null;
|
|
369
|
+
}
|
|
324
370
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
325
371
|
this.notifyError(err);
|
|
326
372
|
throw err;
|
|
@@ -343,6 +389,15 @@ export class StdioTransport {
|
|
|
343
389
|
this.connection = null;
|
|
344
390
|
this.connected = false;
|
|
345
391
|
this.currentSessionId = null;
|
|
392
|
+
// Restore original console methods
|
|
393
|
+
if (this.originalConsole) {
|
|
394
|
+
console.log = this.originalConsole.log;
|
|
395
|
+
console.error = this.originalConsole.error;
|
|
396
|
+
console.warn = this.originalConsole.warn;
|
|
397
|
+
console.info = this.originalConsole.info;
|
|
398
|
+
console.debug = this.originalConsole.debug;
|
|
399
|
+
this.originalConsole = null;
|
|
400
|
+
}
|
|
346
401
|
}
|
|
347
402
|
catch (error) {
|
|
348
403
|
const err = error instanceof Error ? error : new Error(String(error));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@townco/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.44",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@agentclientprotocol/sdk": "^0.5.1",
|
|
43
|
-
"@townco/core": "0.0.
|
|
43
|
+
"@townco/core": "0.0.22",
|
|
44
44
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
45
45
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
46
46
|
"@radix-ui/react-label": "^2.1.8",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@tailwindcss/postcss": "^4.1.17",
|
|
66
|
-
"@townco/tsconfig": "0.1.
|
|
66
|
+
"@townco/tsconfig": "0.1.41",
|
|
67
67
|
"@types/node": "^24.10.0",
|
|
68
68
|
"@types/react": "^19.2.2",
|
|
69
69
|
"ink": "^6.4.0",
|