@townco/tui-template 0.1.19 → 0.1.21
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/App.d.ts +2 -4
- package/dist/App.js +5 -1
- package/dist/cli.d.ts +7 -20
- package/dist/cli.js +6 -11
- package/dist/index.js +21 -18
- package/package.json +5 -7
- package/src/App.tsx +6 -1
- package/src/index.tsx +6 -1
package/dist/App.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { CliConfig } from "./cli.js";
|
|
2
2
|
export interface AppProps {
|
|
3
|
-
|
|
3
|
+
config: CliConfig;
|
|
4
4
|
}
|
|
5
|
-
export declare function App({
|
|
6
|
-
config,
|
|
7
|
-
}: AppProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function App({ config }: AppProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/App.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createLogger } from "@townco/core";
|
|
2
3
|
import { AcpClient } from "@townco/ui";
|
|
3
4
|
import { ChatView } from "@townco/ui/tui";
|
|
4
5
|
import { Box, Text } from "ink";
|
|
5
6
|
import { useMemo } from "react";
|
|
7
|
+
const logger = createLogger("tui-app", "debug");
|
|
6
8
|
export function App({ config }) {
|
|
7
9
|
// Create ACP client
|
|
8
10
|
const client = useMemo(() => {
|
|
@@ -17,7 +19,9 @@ export function App({ config }) {
|
|
|
17
19
|
return newClient;
|
|
18
20
|
}
|
|
19
21
|
catch (error) {
|
|
20
|
-
|
|
22
|
+
logger.error("Failed to create client", {
|
|
23
|
+
error: error instanceof Error ? error.message : String(error),
|
|
24
|
+
});
|
|
21
25
|
return null;
|
|
22
26
|
}
|
|
23
27
|
}, [config.agentPath, config.workingDir]);
|
package/dist/cli.d.ts
CHANGED
|
@@ -2,24 +2,11 @@ import type { InferValue } from "@optique/core/parser";
|
|
|
2
2
|
/**
|
|
3
3
|
* CLI configuration using Optique
|
|
4
4
|
*/
|
|
5
|
-
export declare const cliParser: import("@optique/core/parser").Parser<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
| import("@optique/core/valueparser").ValueParserResult<string>
|
|
13
|
-
| undefined;
|
|
14
|
-
readonly workingDir:
|
|
15
|
-
| [
|
|
16
|
-
| [
|
|
17
|
-
| import("@optique/core/valueparser").ValueParserResult<string>
|
|
18
|
-
| undefined,
|
|
19
|
-
]
|
|
20
|
-
| undefined,
|
|
21
|
-
]
|
|
22
|
-
| undefined;
|
|
23
|
-
}
|
|
24
|
-
>;
|
|
5
|
+
export declare const cliParser: import("@optique/core/parser").Parser<{
|
|
6
|
+
readonly agentPath: string;
|
|
7
|
+
readonly workingDir: string | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
readonly agentPath: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
10
|
+
readonly workingDir: [[import("@optique/core/valueparser").ValueParserResult<string> | undefined] | undefined] | undefined;
|
|
11
|
+
}>;
|
|
25
12
|
export type CliConfig = InferValue<typeof cliParser>;
|
package/dist/cli.js
CHANGED
|
@@ -5,15 +5,10 @@ import { string } from "@optique/core/valueparser";
|
|
|
5
5
|
* CLI configuration using Optique
|
|
6
6
|
*/
|
|
7
7
|
export const cliParser = object({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
description: [text("Working directory for the agent")],
|
|
15
|
-
}),
|
|
16
|
-
),
|
|
17
|
-
process.cwd(),
|
|
18
|
-
),
|
|
8
|
+
agentPath: option("-a", "--agent", string(), {
|
|
9
|
+
description: [text("Path to the ACP agent executable")],
|
|
10
|
+
}),
|
|
11
|
+
workingDir: withDefault(optional(option("-d", "--dir", string(), {
|
|
12
|
+
description: [text("Working directory for the agent")],
|
|
13
|
+
})), process.cwd()),
|
|
19
14
|
});
|
package/dist/index.js
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { run } from "@optique/run";
|
|
4
|
+
import { createLogger } from "@townco/core";
|
|
3
5
|
import { render } from "ink";
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
6
|
import { App } from "./App.js";
|
|
6
7
|
import { cliParser } from "./cli.js";
|
|
7
|
-
|
|
8
|
+
const logger = createLogger("tui-main", "debug");
|
|
8
9
|
/**
|
|
9
10
|
* Agent Hub TUI
|
|
10
11
|
* Terminal chat interface for ACP agents
|
|
11
12
|
*/
|
|
12
13
|
async function main() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
// Parse CLI arguments
|
|
15
|
+
const config = run(cliParser, {
|
|
16
|
+
help: "both", // Show help for both commands and the program
|
|
17
|
+
programName: "agent-tui",
|
|
18
|
+
description: [
|
|
19
|
+
{
|
|
20
|
+
type: "text",
|
|
21
|
+
text: "Terminal chat interface for Agent Client Protocol (ACP) agents",
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
version: "0.0.1",
|
|
25
|
+
});
|
|
26
|
+
// Render the app
|
|
27
|
+
render(_jsx(App, { config: config }));
|
|
27
28
|
}
|
|
28
29
|
main().catch((error) => {
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
logger.fatal("Fatal error", {
|
|
31
|
+
error: error instanceof Error ? error.message : String(error),
|
|
32
|
+
});
|
|
33
|
+
process.exit(1);
|
|
31
34
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@townco/tui-template",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"agent-tui": "./dist/index.js"
|
|
@@ -10,10 +10,7 @@
|
|
|
10
10
|
"src",
|
|
11
11
|
"README.md"
|
|
12
12
|
],
|
|
13
|
-
"repository":
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "git+https://github.com/federicoweber/agent_hub.git"
|
|
16
|
-
},
|
|
13
|
+
"repository": "github:townco/town",
|
|
17
14
|
"scripts": {
|
|
18
15
|
"build": "tsc",
|
|
19
16
|
"dev": "bun src/index.tsx --agent=./agent/index.ts",
|
|
@@ -24,14 +21,15 @@
|
|
|
24
21
|
"dependencies": {
|
|
25
22
|
"@optique/core": "^0.6.2",
|
|
26
23
|
"@optique/run": "^0.6.2",
|
|
27
|
-
"@townco/
|
|
24
|
+
"@townco/core": "0.0.2",
|
|
25
|
+
"@townco/ui": "0.1.24",
|
|
28
26
|
"ink": "^6.4.0",
|
|
29
27
|
"ink-text-input": "^6.0.0",
|
|
30
28
|
"react": "^19.2.0",
|
|
31
29
|
"zod": "^4.1.12"
|
|
32
30
|
},
|
|
33
31
|
"devDependencies": {
|
|
34
|
-
"@townco/tsconfig": "0.1.
|
|
32
|
+
"@townco/tsconfig": "0.1.21",
|
|
35
33
|
"@types/node": "^24.10.0",
|
|
36
34
|
"@types/react": "^19.2.2",
|
|
37
35
|
"tsx": "^4.20.6",
|
package/src/App.tsx
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { createLogger } from "@townco/core";
|
|
1
2
|
import { AcpClient } from "@townco/ui";
|
|
2
3
|
import { ChatView } from "@townco/ui/tui";
|
|
3
4
|
import { Box, Text } from "ink";
|
|
4
5
|
import { useMemo } from "react";
|
|
5
6
|
import type { CliConfig } from "./cli.js";
|
|
6
7
|
|
|
8
|
+
const logger = createLogger("tui-app", "debug");
|
|
9
|
+
|
|
7
10
|
export interface AppProps {
|
|
8
11
|
config: CliConfig;
|
|
9
12
|
}
|
|
@@ -21,7 +24,9 @@ export function App({ config }: AppProps) {
|
|
|
21
24
|
});
|
|
22
25
|
return newClient;
|
|
23
26
|
} catch (error) {
|
|
24
|
-
|
|
27
|
+
logger.error("Failed to create client", {
|
|
28
|
+
error: error instanceof Error ? error.message : String(error),
|
|
29
|
+
});
|
|
25
30
|
return null;
|
|
26
31
|
}
|
|
27
32
|
}, [config.agentPath, config.workingDir]);
|
package/src/index.tsx
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { run } from "@optique/run";
|
|
3
|
+
import { createLogger } from "@townco/core";
|
|
3
4
|
import { render } from "ink";
|
|
4
5
|
import { App } from "./App.js";
|
|
5
6
|
import { cliParser } from "./cli.js";
|
|
6
7
|
|
|
8
|
+
const logger = createLogger("tui-main", "debug");
|
|
9
|
+
|
|
7
10
|
/**
|
|
8
11
|
* Agent Hub TUI
|
|
9
12
|
* Terminal chat interface for ACP agents
|
|
@@ -28,6 +31,8 @@ async function main() {
|
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
main().catch((error) => {
|
|
31
|
-
|
|
34
|
+
logger.fatal("Fatal error", {
|
|
35
|
+
error: error instanceof Error ? error.message : String(error),
|
|
36
|
+
});
|
|
32
37
|
process.exit(1);
|
|
33
38
|
});
|