@townco/cli 0.1.44 → 0.1.46

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.
@@ -66,8 +66,6 @@ function CreateApp({ name: initialName, model: initialModel, tools: initialTools
66
66
  return "model";
67
67
  if (!initialTools || initialTools.length === 0)
68
68
  return "tools";
69
- if (!initialSystemPrompt)
70
- return "systemPrompt";
71
69
  return "review";
72
70
  };
73
71
  const [stage, setStage] = useState(determineInitialStage());
@@ -75,43 +73,14 @@ function CreateApp({ name: initialName, model: initialModel, tools: initialTools
75
73
  name: initialName || "",
76
74
  model: initialModel || "",
77
75
  tools: initialTools ? [...initialTools] : [],
78
- systemPrompt: initialSystemPrompt || "",
76
+ systemPrompt: initialSystemPrompt || "You are a helpful assistant.",
79
77
  });
80
78
  const [nameInput, setNameInput] = useState(initialName || "");
81
- const [systemPromptInput, setSystemPromptInput] = useState(initialSystemPrompt || "");
82
- const [isEditingPrompt, setIsEditingPrompt] = useState(false);
83
- const [promptEditMode, setPromptEditMode] = useState(null);
84
79
  const [reviewSelection, setReviewSelection] = useState(null);
85
80
  const [isEditingFromReview, setIsEditingFromReview] = useState(false);
86
81
  const [scaffoldStatus, setScaffoldStatus] = useState("pending");
87
82
  const [scaffoldError, setScaffoldError] = useState(null);
88
83
  const [agentPath, setAgentPath] = useState(null);
89
- // Handle opening editor when systemPrompt stage is entered from review
90
- useEffect(() => {
91
- (async () => {
92
- if (stage === "systemPrompt" &&
93
- isEditingFromReview &&
94
- !isEditingPrompt &&
95
- promptEditMode === null) {
96
- // Trigger editor opening
97
- setIsEditingPrompt(true);
98
- const editorContent = await openInEditor(agentDef.systemPrompt || "You are a helpful assistant.");
99
- if (editorContent !== null) {
100
- // Editor worked
101
- setAgentDef({ ...agentDef, systemPrompt: editorContent });
102
- setIsEditingPrompt(false);
103
- setIsEditingFromReview(false);
104
- setStage("review");
105
- }
106
- else {
107
- // Fallback to inline
108
- setPromptEditMode("inline");
109
- setIsEditingPrompt(false);
110
- setSystemPromptInput(agentDef.systemPrompt || "You are a helpful assistant.");
111
- }
112
- }
113
- })();
114
- }, [stage, isEditingFromReview, isEditingPrompt, promptEditMode, agentDef]);
115
84
  // Handle scaffolding when entering "done" stage
116
85
  useEffect(() => {
117
86
  if (stage === "done" && scaffoldStatus === "pending") {
@@ -126,8 +95,17 @@ function CreateApp({ name: initialName, model: initialModel, tools: initialTools
126
95
  const model = agentDef.model;
127
96
  const definition = {
128
97
  model,
129
- systemPrompt: agentDef.systemPrompt || null,
98
+ systemPrompt: agentDef.systemPrompt || "You are a helpful assistant.",
130
99
  tools: agentDef.tools || [],
100
+ hooks: [
101
+ {
102
+ type: "context_size",
103
+ setting: {
104
+ threshold: 95,
105
+ },
106
+ callback: "compaction_tool",
107
+ },
108
+ ],
131
109
  };
132
110
  // Create agent in project
133
111
  scaffoldAgent({
@@ -188,62 +166,15 @@ function CreateApp({ name: initialName, model: initialModel, tools: initialTools
188
166
  }
189
167
  // Tools selection stage
190
168
  if (stage === "tools") {
191
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { bold: true, children: ["Select tools for agent: ", agentDef.name] }) }), _jsx(MultiSelect, { options: AVAILABLE_TOOLS, selected: agentDef.tools || [], onChange: (tools) => setAgentDef({ ...agentDef, tools }), onSubmit: async () => {
169
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { bold: true, children: ["Select tools for agent: ", agentDef.name] }) }), _jsx(MultiSelect, { options: AVAILABLE_TOOLS, selected: agentDef.tools || [], onChange: (tools) => setAgentDef({ ...agentDef, tools }), onSubmit: () => {
192
170
  // If editing from review, just go back to review
193
171
  if (isEditingFromReview) {
194
172
  setIsEditingFromReview(false);
195
- setStage("review");
196
- return;
197
- }
198
- // If systemPrompt was provided via flag, skip to review
199
- if (initialSystemPrompt) {
200
- setStage("review");
201
- return;
202
- }
203
- setStage("systemPrompt");
204
- // Attempt to open editor
205
- setIsEditingPrompt(true);
206
- const editorContent = await openInEditor(agentDef.systemPrompt || "You are a helpful assistant.");
207
- if (editorContent !== null) {
208
- // Editor worked
209
- setAgentDef({ ...agentDef, systemPrompt: editorContent });
210
- setIsEditingPrompt(false);
211
- setStage("review");
212
- }
213
- else {
214
- // Fallback to inline
215
- setPromptEditMode("inline");
216
- setIsEditingPrompt(false);
217
- setSystemPromptInput(agentDef.systemPrompt || "You are a helpful assistant.");
218
173
  }
174
+ // Go directly to review stage
175
+ setStage("review");
219
176
  }, onCancel: () => setStage("model") })] }));
220
177
  }
221
- // System prompt stage (inline fallback)
222
- if (stage === "systemPrompt") {
223
- if (isEditingPrompt) {
224
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, children: "Opening editor for system prompt..." }) }), _jsx(Text, { dimColor: true, children: "You can edit the system prompt in your preferred editor." })] }));
225
- }
226
- if (promptEditMode === "inline") {
227
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, children: "Enter system prompt (multi-line supported):" }) }), _jsx(InputBox, { value: systemPromptInput, onChange: setSystemPromptInput, onSubmit: () => {
228
- setAgentDef({ ...agentDef, systemPrompt: systemPromptInput });
229
- if (isEditingFromReview) {
230
- setIsEditingFromReview(false);
231
- setPromptEditMode(null);
232
- }
233
- setStage("review");
234
- }, onEscape: () => {
235
- if (isEditingFromReview) {
236
- setIsEditingFromReview(false);
237
- setPromptEditMode(null);
238
- setStage("review");
239
- }
240
- else {
241
- setStage("tools");
242
- }
243
- }, isSubmitting: false, attachedFiles: [] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Enter: Continue \u2022 Esc: Back" }) })] }));
244
- }
245
- return null;
246
- }
247
178
  // Review stage
248
179
  if (stage === "review") {
249
180
  return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, children: "Review Agent Configuration:" }) }), _jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Name: " }), agentDef.name] }), _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Model: " }), agentDef.model] }), _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Tools: " }), agentDef.tools && agentDef.tools.length > 0
@@ -269,11 +200,6 @@ function CreateApp({ name: initialName, model: initialModel, tools: initialTools
269
200
  value: "tools",
270
201
  description: "Go back and change tool selection",
271
202
  },
272
- {
273
- label: "Edit system prompt",
274
- value: "systemPrompt",
275
- description: "Go back and change the system prompt",
276
- },
277
203
  ], selected: reviewSelection, onChange: (value) => {
278
204
  setReviewSelection(value);
279
205
  }, onSubmit: (value) => {
@@ -284,8 +210,7 @@ function CreateApp({ name: initialName, model: initialModel, tools: initialTools
284
210
  }
285
211
  else if (value === "name" ||
286
212
  value === "model" ||
287
- value === "tools" ||
288
- value === "systemPrompt") {
213
+ value === "tools") {
289
214
  // Set flag so we return to review after editing
290
215
  setIsEditingFromReview(true);
291
216
  setStage(value);
@@ -1,9 +1,14 @@
1
1
  interface MCPAddProps {
2
- name?: string;
3
- url?: string;
4
- command?: string;
5
- args?: readonly string[];
2
+ name?: string;
3
+ url?: string;
4
+ command?: string;
5
+ args?: readonly string[];
6
6
  }
7
- declare function MCPAddApp({ name: initialName, url: initialUrl, command: initialCommand, args: initialArgs, }: MCPAddProps): import("react/jsx-runtime").JSX.Element | null;
7
+ declare function MCPAddApp({
8
+ name: initialName,
9
+ url: initialUrl,
10
+ command: initialCommand,
11
+ args: initialArgs,
12
+ }: MCPAddProps): import("react/jsx-runtime").JSX.Element | null;
8
13
  export default MCPAddApp;
9
14
  export declare function runMCPAdd(props?: MCPAddProps): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@townco/cli",
3
- "version": "0.1.44",
3
+ "version": "0.1.46",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "town": "./dist/index.js"
@@ -15,17 +15,17 @@
15
15
  "build": "tsc"
16
16
  },
17
17
  "devDependencies": {
18
- "@townco/tsconfig": "0.1.36",
18
+ "@townco/tsconfig": "0.1.38",
19
19
  "@types/bun": "^1.3.1",
20
20
  "@types/react": "^19.2.2"
21
21
  },
22
22
  "dependencies": {
23
23
  "@optique/core": "^0.6.2",
24
24
  "@optique/run": "^0.6.2",
25
- "@townco/agent": "0.1.44",
26
- "@townco/core": "0.0.17",
27
- "@townco/secret": "0.1.39",
28
- "@townco/ui": "0.1.39",
25
+ "@townco/agent": "0.1.46",
26
+ "@townco/core": "0.0.19",
27
+ "@townco/secret": "0.1.41",
28
+ "@townco/ui": "0.1.41",
29
29
  "@types/inquirer": "^9.0.9",
30
30
  "ink": "^6.4.0",
31
31
  "ink-text-input": "^6.0.0",