@runuai/host 0.7.1 → 0.8.0

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/lib/agent-cli.ts CHANGED
@@ -239,6 +239,41 @@ async function main() {
239
239
  out(action + " #" + t.shortId + ": " + t.text);
240
240
  break;
241
241
  }
242
+ case "preview add": {
243
+ const name = pos[0] || flags.name;
244
+ const port = Number(pos[1] || flags.port);
245
+ if (!name || !Number.isInteger(port)) { console.error("uai: preview add <name> <containerPort>"); process.exit(1); }
246
+ const r = await api("POST", "/api/agent/previews", { name, containerPort: port });
247
+ out("preview '" + r.name + "' on port " + r.containerPort + " — enable it in the task's preview menu to get a URL");
248
+ break;
249
+ }
250
+ case "project create": {
251
+ const name = flags.name || pos.join(" ");
252
+ if (!name || !flags.repo) { console.error("uai: project create --name <n> --repo <git-url> [--prompt <p>]"); process.exit(1); }
253
+ const p = (await api("POST", "/api/agent/projects", { name, repoUrl: flags.repo, defaultPrompt: flags.prompt || undefined })).project;
254
+ out("created project " + p.slug + " (" + p.id + ")");
255
+ break;
256
+ }
257
+ case "task search": {
258
+ const q = pos.join(" ") || flags.q || "";
259
+ if (!q) { console.error("uai: task search <query>"); process.exit(1); }
260
+ const hits = (await api("GET", "/api/agent/history?q=" + encodeURIComponent(q))).messages || [];
261
+ if (!hits.length) { out("no matches in your past tasks"); break; }
262
+ out(hits.map((h) => "[" + h.taskName + "] @" + h.author + ": " + h.snippet).join("\\n"));
263
+ break;
264
+ }
265
+ case "task read": {
266
+ const id = pos[0] || flags.id;
267
+ if (!id) { console.error("uai: task read <taskId> (see 'uai task history')"); process.exit(1); }
268
+ const chat = await api("GET", "/api/agent/history?taskId=" + encodeURIComponent(id));
269
+ out("# " + chat.taskName + "\\n" + (chat.messages || []).map((m) => "@" + m.author + ": " + m.snippet).join("\\n"));
270
+ break;
271
+ }
272
+ case "task history": {
273
+ const tasks = (await api("GET", "/api/agent/history")).tasks || [];
274
+ out(tasks.length ? tasks.map((t) => t.taskId + " " + t.taskName + " (" + t.status + ")").join("\\n") : "no past tasks");
275
+ break;
276
+ }
242
277
  case "whoami ": case "whoami undefined": out({ apiUrl: API_URL }); break;
243
278
  case "react heart": case "react check": case "react x": {
244
279
  const r = await api("POST", "/api/agent/react", { emoji: action, msg: flags.msg || undefined });
@@ -258,6 +293,11 @@ async function main() {
258
293
  " uai todo list",
259
294
  " uai todo add <text>",
260
295
  " uai todo claim|done|reopen|unclaim <#id>",
296
+ " uai preview add <name> <containerPort>",
297
+ " uai project create --name <n> --repo <git-url> [--prompt <p>]",
298
+ " uai task search <query> (your own past tasks)",
299
+ " uai task history (list your past tasks)",
300
+ " uai task read <taskId> (full chat of a past task you were on)",
261
301
  " uai react <heart|check|x> [--msg #id] (no --msg = the message you were last handed)",
262
302
  " uai whoami",
263
303
  ].join("\\n"));
@@ -1230,6 +1230,15 @@ export function buildSystemPreamble(
1230
1230
  (agent.permissions?.includes("todo.write")
1231
1231
  ? ", `todo list|add|claim|done`"
1232
1232
  : "") +
1233
+ (agent.permissions?.includes("previews.write")
1234
+ ? ", `preview add <name> <port>`"
1235
+ : "") +
1236
+ (agent.permissions?.includes("projects.write")
1237
+ ? ", `project create --name --repo`"
1238
+ : "") +
1239
+ (agent.permissions?.includes("tasks.history")
1240
+ ? ", `task search <query>` / `task read <id>`"
1241
+ : "") +
1233
1242
  ", `react <heart|check|x> [--msg #id]`.",
1234
1243
  "**Reacting:** `uai react check` is a lightweight ack of the message",
1235
1244
  "you were last handed — use it to acknowledge an instruction or",
@@ -1271,6 +1280,23 @@ export function buildSystemPreamble(
1271
1280
  "watches the same list in the task UI.",
1272
1281
  ]
1273
1282
  : []),
1283
+ ...(agent.permissions?.includes("tasks.history")
1284
+ ? [
1285
+ "**Your task history:** you can recall your OWN past work —",
1286
+ `\`node ${CONTAINER_CLI_PATH} task search <query>\` searches the`,
1287
+ "chat of every past task you were on (not the human's tasks —",
1288
+ "yours), and `task read <taskId>` pulls a full transcript. Use",
1289
+ "it like a broader memory: before reinventing something, check",
1290
+ "whether you've solved it before.",
1291
+ ]
1292
+ : []),
1293
+ ...(agent.permissions?.includes("previews.write")
1294
+ ? [
1295
+ "**Previews:** started a dev server? `preview add <name>",
1296
+ "<containerPort>` exposes it so the human can open it (they",
1297
+ "enable it from the task's preview menu).",
1298
+ ]
1299
+ : []),
1274
1300
  "",
1275
1301
  ]
1276
1302
  : []),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runuai/host",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "Uai host — runs ephemeral AI coding tasks in Docker on a machine you control.",
5
5
  "license": "MIT",
6
6
  "author": "Diogo Perillo <diogo.perillo@gmail.com>",