@townco/cli 0.1.15 → 0.1.17

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.
@@ -163,9 +163,19 @@ export async function runCommand(options) {
163
163
  }
164
164
  // Default: Start TUI interface with the agent
165
165
  console.log(`Starting interactive terminal for agent "${name}"...\n`);
166
- // Get path to bundled TUI app (relative to this compiled file)
167
- // When compiled: dist/commands/run.js -> ../../tui/index.js
168
- const tuiPath = join(import.meta.dirname, "..", "..", "tui", "index.js");
166
+ // Get path to TUI from @townco/tui-template npm package
167
+ let tuiPath;
168
+ try {
169
+ const { createRequire } = await import("node:module");
170
+ const require = createRequire(import.meta.url);
171
+ const tuiPackagePath = require.resolve("@townco/tui-template/package.json");
172
+ const tuiPackageDir = join(tuiPackagePath, "..");
173
+ tuiPath = join(tuiPackageDir, "dist", "index.js");
174
+ }
175
+ catch (error) {
176
+ console.error("Error: Could not find @townco/tui-template. Please ensure it is installed.");
177
+ process.exit(1);
178
+ }
169
179
  // Run TUI with the agent
170
180
  const tuiProcess = spawn("bun", [tuiPath, "--agent", binPath], {
171
181
  cwd: agentPath,
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@townco/cli",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "town": "./dist/index.js"
7
7
  },
8
8
  "files": [
9
9
  "dist",
10
- "tui",
11
10
  "README.md"
12
11
  ],
13
12
  "repository": {
@@ -19,16 +18,17 @@
19
18
  "build": "tsc"
20
19
  },
21
20
  "devDependencies": {
22
- "@townco/tsconfig": "0.1.7",
21
+ "@townco/tsconfig": "0.1.9",
23
22
  "@types/bun": "^1.3.1",
24
23
  "@types/react": "^19.2.2"
25
24
  },
26
25
  "dependencies": {
27
26
  "@optique/core": "^0.6.2",
28
27
  "@optique/run": "^0.6.2",
29
- "@townco/agent": "0.1.15",
30
- "@townco/secret": "0.1.10",
31
- "@townco/ui": "0.1.10",
28
+ "@townco/agent": "0.1.17",
29
+ "@townco/secret": "0.1.12",
30
+ "@townco/tui-template": "0.1.9",
31
+ "@townco/ui": "0.1.12",
32
32
  "@types/inquirer": "^9.0.9",
33
33
  "ink": "^6.4.0",
34
34
  "ink-text-input": "^6.0.0",
package/tui/App.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import type { CliConfig } from "./cli.js";
2
- export interface AppProps {
3
- config: CliConfig;
4
- }
5
- export declare function App({
6
- config,
7
- }: AppProps): import("react/jsx-runtime").JSX.Element;
package/tui/App.js DELETED
@@ -1,41 +0,0 @@
1
- import { AcpClient } from "@townco/ui";
2
- import { ChatView } from "@townco/ui/tui";
3
- import { Box, Text } from "ink";
4
- import { useMemo } from "react";
5
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
- export function App({ config }) {
7
- // Create ACP client
8
- const client = useMemo(() => {
9
- try {
10
- const newClient = new AcpClient({
11
- type: "stdio",
12
- options: {
13
- agentPath: config.agentPath,
14
- workingDirectory: config.workingDir ?? process.cwd(),
15
- },
16
- });
17
- return newClient;
18
- } catch (error) {
19
- console.error("Failed to create client:", error);
20
- return null;
21
- }
22
- }, [config.agentPath, config.workingDir]);
23
- if (!client) {
24
- return _jsxs(Box, {
25
- flexDirection: "column",
26
- padding: 1,
27
- children: [
28
- _jsx(Text, {
29
- color: "red",
30
- bold: true,
31
- children: "Error: Failed to create ACP client",
32
- }),
33
- _jsx(Text, {
34
- color: "gray",
35
- children: "Please check your agent path and try again.",
36
- }),
37
- ],
38
- });
39
- }
40
- return _jsx(ChatView, { client: client });
41
- }
package/tui/cli.d.ts DELETED
@@ -1,25 +0,0 @@
1
- import type { InferValue } from "@optique/core/parser";
2
- /**
3
- * CLI configuration using Optique
4
- */
5
- export declare const cliParser: import("@optique/core/parser").Parser<
6
- {
7
- readonly agentPath: string;
8
- readonly workingDir: string | undefined;
9
- },
10
- {
11
- readonly agentPath:
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
- >;
25
- export type CliConfig = InferValue<typeof cliParser>;
package/tui/cli.js DELETED
@@ -1,19 +0,0 @@
1
- import { text } from "@optique/core/message";
2
- import { object, option, optional, withDefault } from "@optique/core/parser";
3
- import { string } from "@optique/core/valueparser";
4
- /**
5
- * CLI configuration using Optique
6
- */
7
- export const cliParser = object({
8
- agentPath: option("-a", "--agent", string(), {
9
- description: [text("Path to the ACP agent executable")],
10
- }),
11
- workingDir: withDefault(
12
- optional(
13
- option("-d", "--dir", string(), {
14
- description: [text("Working directory for the agent")],
15
- }),
16
- ),
17
- process.cwd(),
18
- ),
19
- });
package/tui/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/tui/index.js DELETED
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env node
2
- import { run } from "@optique/run";
3
- import { render } from "ink";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- import { App } from "./App.js";
6
- import { cliParser } from "./cli.js";
7
-
8
- /**
9
- * Agent Hub TUI
10
- * Terminal chat interface for ACP agents
11
- */
12
- async function main() {
13
- // Parse CLI arguments
14
- const config = run(cliParser, {
15
- help: "both", // Show help for both commands and the program
16
- programName: "agent-tui",
17
- description: [
18
- {
19
- type: "text",
20
- text: "Terminal chat interface for Agent Client Protocol (ACP) agents",
21
- },
22
- ],
23
- version: "0.0.1",
24
- });
25
- // Render the app
26
- render(_jsx(App, { config: config }));
27
- }
28
- main().catch((error) => {
29
- console.error("Fatal error:", error);
30
- process.exit(1);
31
- });