0agent 1.0.18 → 1.0.19
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/bin/0agent.js +17 -8
- package/package.json +2 -1
package/bin/0agent.js
CHANGED
|
@@ -112,20 +112,28 @@ switch (cmd) {
|
|
|
112
112
|
// Arrow-key select using enquirer (falls back to number input if not available)
|
|
113
113
|
async function arrowSelect(message, choices, initial = 0) {
|
|
114
114
|
try {
|
|
115
|
-
const
|
|
116
|
-
const
|
|
115
|
+
const mod = await import('enquirer');
|
|
116
|
+
const Enquirer = mod.default ?? mod;
|
|
117
|
+
const prompt = new Enquirer.Select({
|
|
118
|
+
message,
|
|
119
|
+
choices: choices.map((c, i) => ({ name: c, value: String(i) })),
|
|
120
|
+
initial,
|
|
121
|
+
});
|
|
117
122
|
const answer = await prompt.run();
|
|
118
|
-
|
|
123
|
+
// answer is the name string — find its index
|
|
124
|
+
const idx = choices.indexOf(answer);
|
|
125
|
+
return idx >= 0 ? idx : initial;
|
|
119
126
|
} catch {
|
|
120
|
-
// Fallback: number-based selection
|
|
127
|
+
// Fallback: number-based selection if enquirer unavailable or non-TTY
|
|
121
128
|
return choose(message, choices, initial);
|
|
122
129
|
}
|
|
123
130
|
}
|
|
124
131
|
|
|
125
132
|
async function arrowInput(message, initial = '') {
|
|
126
133
|
try {
|
|
127
|
-
const
|
|
128
|
-
const
|
|
134
|
+
const mod = await import('enquirer');
|
|
135
|
+
const Enquirer = mod.default ?? mod;
|
|
136
|
+
const prompt = new Enquirer.Input({ message, initial });
|
|
129
137
|
return await prompt.run();
|
|
130
138
|
} catch {
|
|
131
139
|
return ask(` ${message}: `);
|
|
@@ -134,8 +142,9 @@ async function arrowInput(message, initial = '') {
|
|
|
134
142
|
|
|
135
143
|
async function arrowPassword(message) {
|
|
136
144
|
try {
|
|
137
|
-
const
|
|
138
|
-
const
|
|
145
|
+
const mod = await import('enquirer');
|
|
146
|
+
const Enquirer = mod.default ?? mod;
|
|
147
|
+
const prompt = new Enquirer.Password({ message });
|
|
139
148
|
return await prompt.run();
|
|
140
149
|
} catch {
|
|
141
150
|
return ask(` ${message}: `);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "0agent",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "A persistent, learning AI agent that runs on your machine. An agent that learns.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@hono/node-server": "^1.13.0",
|
|
26
26
|
"better-sqlite3": "^11.6.0",
|
|
27
|
+
"enquirer": "^2.4.1",
|
|
27
28
|
"hono": "^4.6.0",
|
|
28
29
|
"ws": "^8.18.0",
|
|
29
30
|
"yaml": "^2.6.0",
|