@ghostystudio/cli 0.28.0 → 0.29.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.
Files changed (3) hide show
  1. package/README.md +8 -1
  2. package/dist/index.js +108 -37
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -20,7 +20,7 @@ ghosty engines ls [--models] # valid --engine / --model
20
20
  ghosty bags ls|create|set|rm <workspace> ["bag"] [--tokens 20M] [--recurring on|off] [--hard-cap on|off] [--note] # token bags (changing: staff)
21
21
  ghosty spaces renew <workspace> --until YYYY-MM-DD [--note] [--dry-run] # staff
22
22
  ghosty spaces rename <old> <new> [--dry-run] # staff, slug only
23
- ghosty agents ls
23
+ ghosty agents ls [--engine E] [--ids] [--sponsor EMAIL | --owner EMAIL] # --sponsor/--owner: any account (Ghosty staff)
24
24
  ghosty agents create --name NAME [--engine E] [--model M] [--prompt TEXT | --prompt-file FILE] [--env K=V,…] [--workspace SLUG] [--channels teams=off]
25
25
  ghosty agents get <id> [--fields name,model,prompt] [--prompt-out FILE]
26
26
  ghosty agents export <id> [--out DIR] # the agent as a YAML file (+ its skills with --out)
@@ -89,6 +89,13 @@ Every command has its own help with examples: `ghosty <command> --help` or `ghos
89
89
 
90
90
  Exit codes: `0` ok · `1` API error · `2` usage error · `3` not signed in.
91
91
 
92
+ ### Changes in 0.29.0
93
+
94
+ - `agents ls --engine E --ids` (ids only, for `xargs`); staff: `agents ls --sponsor EMAIL | --owner EMAIL` lists any account's agents, and `agents get|set|box` work on them by id (logged).
95
+ - `try --media FILE` and `chat --media FILE` attach files as from the app (no `--waba` needed).
96
+ - `turns cancel <agent> <conversation>`: stops the turn AND that conversation's background jobs (video, subagents, pending wake-ups).
97
+ - `agents box --recycle` on Ghosty · Lite / Goose recreates its box with the current image (`--reenv`, `--force`); `agents set --prompt-mode append|replace`.
98
+
92
99
  ### Changes in 0.28.0
93
100
 
94
101
  - `ghosty demos try <slug> "…"`: try a public demo as a visitor from the terminal (keeps the thread; `--new`; `--recycle-between --agent X` checks memory across boxes). `ghosty demos history <agent>` (Ghosty staff): visitors' turns, messages, files and clones, `--timeline`.
package/dist/index.js CHANGED
@@ -8016,6 +8016,10 @@ var SERVER_MESSAGES = [
8016
8016
  ["no hay un turno pendiente con ese id (\xBFya corri\xF3?)", "no pending turn with that id (did it already run?)"],
8017
8017
  ["los chats de los visitantes de un demo: s\xF3lo el staff de Ghosty", "a demo's visitor chats: Ghosty staff only"],
8018
8018
  ["since inv\xE1lido: \xAB{}\xBB (7d, 12h o una fecha ISO)", "invalid since: \xAB{}\xBB (7d, 12h or an ISO date)"],
8019
+ ["buscar agentes de otras cuentas: s\xF3lo el staff de Ghosty", "searching other accounts' agents: Ghosty staff only"],
8020
+ ["pon al menos un filtro: sponsor, owner, workspace o engine", "add at least one filter: sponsor, owner, workspace or engine"],
8021
+ ["no hay una cuenta con ese correo", "there's no account with that email"],
8022
+ ["files: [{ name, mimeType, data (base64) }], hasta 8 de 10 MB", "files: [{ name, mimeType, data (base64) }], up to 8 of 10 MB"],
8019
8023
  // — Infra interna (casi nunca llega al CLI, pero por si acaso)
8020
8024
  ["SESSION_SECRET ausente en producci\xF3n \u2014 las cookies quedar\xEDan firmadas con un valor p\xFAblico. Inyectarlo con ./scripts/set_gs_secret.sh SESSION_SECRET (openssl rand -hex 32).", "SESSION_SECRET missing in production \u2014 cookies would be signed with a public value. Inject it with ./scripts/set_gs_secret.sh SESSION_SECRET (openssl rand -hex 32)."],
8021
8025
  ["sqld: fetch sin namespace", "sqld: fetch without namespace"],
@@ -8318,7 +8322,7 @@ async function postLong(path, body, timeoutMs = 9e5) {
8318
8322
  const req = httpsRequest(`${base}${path}`, {
8319
8323
  method: "POST",
8320
8324
  timeout: timeoutMs,
8321
- headers: { authorization: `Bearer ${token}`, "user-agent": `ghosty-cli/${"0.28.0"}`, "content-type": "application/json", "content-length": Buffer.byteLength(data) }
8325
+ headers: { authorization: `Bearer ${token}`, "user-agent": `ghosty-cli/${"0.29.0"}`, "content-type": "application/json", "content-length": Buffer.byteLength(data) }
8322
8326
  }, (res) => {
8323
8327
  let buf = "";
8324
8328
  res.on("data", (c) => buf += c);
@@ -8360,7 +8364,7 @@ async function request(path, opts = {}, retried = false) {
8360
8364
  method: opts.method ?? (opts.body !== void 0 || opts.raw !== void 0 ? "POST" : "GET"),
8361
8365
  headers: {
8362
8366
  authorization: `Bearer ${token}`,
8363
- "user-agent": `ghosty-cli/${"0.28.0"}`,
8367
+ "user-agent": `ghosty-cli/${"0.29.0"}`,
8364
8368
  "accept-language": lang(),
8365
8369
  ...opts.body !== void 0 ? { "content-type": "application/json" } : {},
8366
8370
  ...opts.headers
@@ -8438,6 +8442,16 @@ import { basename, join as join2 } from "node:path";
8438
8442
  var enc = encodeURIComponent;
8439
8443
  var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
8440
8444
  var MIME = { jpg: "image/jpeg", jpeg: "image/jpeg", png: "image/png", webp: "image/webp", gif: "image/gif", pdf: "application/pdf", ogg: "audio/ogg", opus: "audio/ogg", mp3: "audio/mpeg", m4a: "audio/mp4", wav: "audio/wav", mp4: "video/mp4" };
8445
+ async function localFiles(paths) {
8446
+ const { readFile: readFile13 } = await import("node:fs/promises");
8447
+ const { basename: basename4 } = await import("node:path");
8448
+ return Promise.all(
8449
+ paths.map(async (p) => {
8450
+ const ext = p.toLowerCase().split(".").pop() ?? "";
8451
+ return { name: basename4(p), mimeType: MIME[ext] ?? "application/octet-stream", data: (await readFile13(p)).toString("base64") };
8452
+ })
8453
+ );
8454
+ }
8441
8455
  async function tryPost(id, body) {
8442
8456
  for (let attempt = 0; ; attempt++) {
8443
8457
  const r = await postLong(`/api/v2/agents/${enc(id)}/try`, body);
@@ -8563,9 +8577,16 @@ var need = (v, what, example) => {
8563
8577
  if (!v) throw usage(t(`Missing ${what}.`, `Falta ${WHAT_ES[what] ?? what}.`), `${t("Example", "Ejemplo")}: ${example}`);
8564
8578
  return v;
8565
8579
  };
8566
- async function agentsLs(workspace) {
8580
+ async function agentsLs(workspace, f = {}) {
8581
+ if (f.sponsor || f.owner) {
8582
+ const q = new URLSearchParams({ ...f.sponsor ? { sponsor: f.sponsor } : {}, ...f.owner ? { owner: f.owner } : {}, ...f.engine ? { engine: f.engine } : {}, ...workspace && !f.all ? { workspace } : {} });
8583
+ const s = await api(`/api/v2/agents?${q}`);
8584
+ if (f.ids) return void process.stdout.write(s.agents.map((a) => a.id).join("\n") + (s.agents.length ? "\n" : ""));
8585
+ return out(s.agents, () => table(s.agents.map((a) => ({ id: a.id, name: a.name, engine: a.engine, model: a.model, owner: a.owner, sponsored: a.sponsored ? t("yes", "s\xED") : "" })), ["id", "name", "engine", "model", "owner", "sponsored"]));
8586
+ }
8567
8587
  const r = await api("/api/v2/me/agents?client=cli");
8568
- const list = workspace ? r.agentes.filter((a) => a.espacio?.nombre === workspace) : r.agentes;
8588
+ const list = (workspace ? r.agentes.filter((a) => a.espacio?.nombre === workspace) : r.agentes).filter((a) => !f.engine || (a.motor ?? a.origen) === f.engine);
8589
+ if (f.ids) return void process.stdout.write(list.map((a) => a.id).join("\n") + (list.length ? "\n" : ""));
8569
8590
  const spaceOf = (a) => a.espacio?.tipo === "workspace" ? a.espacio.nombre : a.espacio?.tipo ?? "";
8570
8591
  const rows = list.map((a) => ({
8571
8592
  id: a.id,
@@ -8664,12 +8685,24 @@ ${dim(t("Dry run: nothing changed.", "Simulacro: no se cambi\xF3 nada."))}`);
8664
8685
  }
8665
8686
  return out(r2, () => r2.unlinked ? `${lavender("\u2713")} ${t("Unlinked: the prompt stays as it is and is edited by hand again.", "Desenlazado: el prompt se queda como est\xE1 y se vuelve a editar a mano.")}` : `${lavender("\u2713")} Prompt = ${v["prompt-base"]} + ${v["prompt-overlay"]} ${t(`(${r2.chars} chars). It regenerates when the base changes; ghosty agents doctor ${id} tells if the overlay stops applying.`, `(${r2.chars} caracteres). Se regenera cuando cambia la base; ghosty agents doctor ${id} avisa si la capa deja de aplicar.`)}`);
8666
8687
  }
8688
+ if (v.engine && v["dry-run"]) {
8689
+ const p = await api(agentPath(id), { method: "PATCH", body: { engine: v.engine, ...v.model ? { model: v.model } : {}, dryRun: true } });
8690
+ return out(p, () => [
8691
+ `${p.from.engine}/${p.from.model ?? "?"} \u2192 ${p.to ? `${p.to.engine}/${p.to.model ?? "?"}` : v.engine}`,
8692
+ ...(p.steps ?? []).map((x) => ` \xB7 ${serverText(x)}`),
8693
+ p.ok ? dim(t("Dry run: nothing changed. Run it again without --dry-run to apply.", "Simulacro: no se cambi\xF3 nada. Repite sin --dry-run para aplicarlo.")) : `\u2717 ${serverText(p.error ?? "")}`
8694
+ ].join("\n"));
8695
+ }
8667
8696
  const body = {};
8668
8697
  if (v.name) body.name = v.name;
8669
8698
  if (v.engine) body.engine = v.engine;
8670
8699
  if (v.model) body.model = v.model;
8671
8700
  if (v.prompt) body.prompt = v.prompt;
8672
8701
  if (v["prompt-file"]) body.prompt = await readFile3(v["prompt-file"], "utf8");
8702
+ if (v["prompt-mode"]) {
8703
+ if (v["prompt-mode"] !== "append" && v["prompt-mode"] !== "replace") throw usage(t("--prompt-mode takes append or replace.", "--prompt-mode acepta append o replace."));
8704
+ body.promptMode = v["prompt-mode"];
8705
+ }
8673
8706
  const channels = parseChannels(v.channels);
8674
8707
  if (channels) body.channels = channels;
8675
8708
  if (v.toolsets) {
@@ -8781,11 +8814,12 @@ async function tryTurn(id, text, v) {
8781
8814
  id = need(id, "agent id", 'ghosty try <agent-id> "hello"');
8782
8815
  if (v.replay) return tryReplay(id, v);
8783
8816
  if (v.whatsapp && !v.waba) info(dim(t("Note: --whatsapp is now --waba (the real WhatsApp path).", "Nota: --whatsapp ahora es --waba (el camino real de WhatsApp).")));
8784
- if (v.waba || v.whatsapp || v.media?.length || v.history) return tryWaba(id, text, v);
8785
- if (!text && !v.reset) throw usage(t("Missing message.", "Falta el mensaje."), t("Example", "Ejemplo") + ': ghosty try <agent-id> "hello"');
8817
+ if (v.waba || v.whatsapp || v.history) return tryWaba(id, text, v);
8818
+ const files = v.media?.length ? await localFiles(v.media) : [];
8819
+ if (!text && !v.reset && !files.length) throw usage(t("Missing message.", "Falta el mensaje."), t("Example", "Ejemplo") + ': ghosty try <agent-id> "hello"');
8786
8820
  if (process.stderr.isTTY && text && !globals.json) info(dim(t("Thinking\u2026 (a test turn can take up to 3 minutes)", "Pensando\u2026 (un turno de prueba puede tardar hasta 3 minutos)")));
8787
8821
  const r = await api(agentPath(id, "/try"), {
8788
- body: { text, session: v.session, reset: v.reset }
8822
+ body: { text, session: v.session, reset: v.reset, ...files.length ? { files } : {} }
8789
8823
  });
8790
8824
  out(r, () => (r.text ?? "") + (r.error ? `
8791
8825
  ${dim(`(${t("warning", "aviso")}: ${serverText(r.error)})`)}` : ""));
@@ -9005,7 +9039,7 @@ async function agentsDemo(id, v) {
9005
9039
  async function agentsBox(id, v) {
9006
9040
  id = need(id, "agent id", "ghosty agents box <agent-id> [--check PATH] [--contains PATH=TEXT] [--recycle]");
9007
9041
  if (v.recycle) {
9008
- const r2 = await api(agentPath(id, "/box"), { method: "POST", body: { recycle: true } });
9042
+ const r2 = await api(agentPath(id, "/box"), { method: "POST", body: { recycle: true, ...v.force ? { force: true } : {}, ...v.reenv ? { reenv: true } : {} } });
9009
9043
  out(r2, () => `${lavender("\u2713")} ${t("Recycled.", "Reciclada.")} ${dim(serverText(r2?.note ?? ""))}
9010
9044
  ${dim(`${t("Verify after one turn", "Verifica despu\xE9s de un turno")}: ghosty agents box ${id} --check <path>`)}`);
9011
9045
  return;
@@ -9088,7 +9122,7 @@ async function conversationsShow(agent, sid, v) {
9088
9122
  return [...head, ...lines, ...tailNote].join("\n\n") || dim(t("(empty)", "(vac\xEDa)"));
9089
9123
  });
9090
9124
  }
9091
- async function turn(agent, sid, text, first) {
9125
+ async function turn(agent, sid, text, first, images = []) {
9092
9126
  const turnId = randomUUID();
9093
9127
  const ctrl = new AbortController();
9094
9128
  const res = await request(convPath(agent, `/${enc3(sid)}/events`), { signal: ctrl.signal, headers: { accept: "text/event-stream" } });
@@ -9101,7 +9135,7 @@ async function turn(agent, sid, text, first) {
9101
9135
  });
9102
9136
  };
9103
9137
  process.on("SIGINT", onSigint);
9104
- const sent = api(convPath(agent, `/${enc3(sid)}/messages`), { body: { content: text, turnId, primerTurno: first } });
9138
+ const sent = api(convPath(agent, `/${enc3(sid)}/messages`), { body: { content: text, turnId, primerTurno: first, ...images.length ? { images } : {} } });
9105
9139
  let answer = "";
9106
9140
  let usageData;
9107
9141
  let ours = false;
@@ -9143,8 +9177,9 @@ async function chat(agent, message, v) {
9143
9177
  first = true;
9144
9178
  if (!globals.json) info(dim(t(`conversation ${sid} (continue it with --conversation ${sid})`, `conversaci\xF3n ${sid} (s\xEDguela con --conversation ${sid})`)));
9145
9179
  }
9146
- if (message) {
9147
- await turn(agent, sid, message, first);
9180
+ const images = v.media?.length ? await localFiles(v.media) : [];
9181
+ if (message || images.length) {
9182
+ await turn(agent, sid, message ?? "", first, images);
9148
9183
  return;
9149
9184
  }
9150
9185
  if (!process.stdin.isTTY) {
@@ -9430,7 +9465,7 @@ async function call(path, v, init = {}) {
9430
9465
  "x-ghosty-ts": ts,
9431
9466
  "x-ghosty-sig": sig,
9432
9467
  "content-type": "application/json",
9433
- "user-agent": `ghosty-cli/${"0.28.0"}`
9468
+ "user-agent": `ghosty-cli/${"0.29.0"}`
9434
9469
  },
9435
9470
  body: method === "GET" ? void 0 : raw
9436
9471
  });
@@ -9963,9 +9998,22 @@ async function turnsSkipped(id, v) {
9963
9998
  out(r, () => rows.length ? `${table(rows, ["at", "reason", "phone", "message"])}
9964
9999
  ${dim(tally)}` : dim(t(`Every customer message${v.since ? ` since ${v.since}` : ""} opened a turn (or none arrived: check ghosty channels whatsapp ls ${id}, "formmy forwards").`, `Todo mensaje de cliente${v.since ? ` desde ${v.since}` : ""} abri\xF3 turno (o no lleg\xF3 ninguno: revisa ghosty channels whatsapp ls ${id}, \xABformmy forwards\xBB).`)));
9965
10000
  }
10001
+ async function turnsCancel(id, sid) {
10002
+ const ex = "ghosty turns cancel <agent-id> <conversation-id>";
10003
+ id = need2(id, t("agent id", "el id del agente"), ex);
10004
+ sid = need2(sid, t("conversation id", "el id de la conversaci\xF3n"), ex);
10005
+ const r = await api(`/api/v2/me/agents/${enc6(id)}/conversations/${enc6(sid)}/cancel`, { method: "POST", body: {} });
10006
+ const b = r.background ?? { videos: 0, subagents: 0, wakes: 0 };
10007
+ const bg = b.videos + b.subagents + b.wakes;
10008
+ out(
10009
+ r,
10010
+ () => !r.detenido && !bg ? dim(t("Nothing running in that conversation.", "No hab\xEDa nada corriendo en esa conversaci\xF3n.")) : `${lavender("\u2713")} ${[r.detenido ? t("turn stopped", "turno detenido") : "", b.videos ? t(`${b.videos} video job(s)`, `${b.videos} encargo(s) de video`) : "", b.subagents ? t(`${b.subagents} subagent(s)`, `${b.subagents} subagente(s)`) : "", b.wakes ? t(`${b.wakes} pending wake-up(s)`, `${b.wakes} despertador(es) pendiente(s)`) : ""].filter(Boolean).join(" \xB7 ")}${bg ? dim(t(" \u2014 work already running in its box finishes on its own, but nothing is delivered and the agent isn't woken.", " \u2014 lo que ya corre en su caja termina solo, pero no se entrega ni despierta al agente.")) : ""}`
10011
+ );
10012
+ }
9966
10013
  async function turnsCmd(sub, id, turnId, v) {
9967
10014
  if (sub === "show") return turnShow(id, turnId, !!v.full);
9968
- if (sub && sub !== "ls" && sub !== "list") throw usage(t(`Unknown turns subcommand: ${sub}.`, `Subcomando de turns desconocido: ${sub}.`), t("Try", "Prueba") + ": ghosty turns ls <agent-id> --errors --since 1h \xB7 ghosty turns show <agent-id> [turn-id|last]");
10015
+ if (sub === "cancel" || sub === "stop") return turnsCancel(id, turnId);
10016
+ if (sub && sub !== "ls" && sub !== "list") throw usage(t(`Unknown turns subcommand: ${sub}.`, `Subcomando de turns desconocido: ${sub}.`), t("Try", "Prueba") + ": ghosty turns ls <agent-id> --errors --since 1h \xB7 ghosty turns show <agent-id> [turn-id|last] \xB7 ghosty turns cancel <agent-id> <conversation>");
9969
10017
  id = need2(id, t("agent id", "el id del agente"), "ghosty turns ls <agent-id> --errors --since 1h");
9970
10018
  if (v.skipped) return turnsSkipped(id, v);
9971
10019
  const q = new URLSearchParams();
@@ -10596,6 +10644,7 @@ var HELPS_ES = {
10596
10644
  ["--no-notify", "create --like: lo comparte con las mismas personas SIN mandarles correo"],
10597
10645
  ["--workspace SLUG", "create: nace en ese espacio (del que eres due\xF1o o admin), a nombre de su due\xF1o y activo en su Teams"],
10598
10646
  ["--channels k=on|off,\u2026", "create/set: prende/apaga canales: teams, web, whatsapp, messenger, wa (WhatsApp personal)"],
10647
+ ["--engine E --dry-run", "set: qu\xE9 hace cambiar de motor (sesiones que se olvidan, caja que se levanta y cu\xE1l se destruye, si est\xE1 trabajando) sin cambiarlo; cada hilo conserva su conversaci\xF3n"],
10599
10648
  ["--toolsets LIST", "set: grupos de tools de gs que recibe (crm, sales\u2026): una lista reemplaza; +x / -x agrega o quita"],
10600
10649
  ["--prompt-base ID", "set: el prompt de este agente = el prompt de ese agente + --prompt-overlay; se regenera cuando cambia la base. none = desliga (conserva el prompt de hoy)"],
10601
10650
  ["--prompt-overlay FILE", 'set: JSON {"edits":[{"what","find","replace","regex"?,"all"?}]}, aplicados en orden; cada uno debe encontrar su lugar o no cambia nada'],
@@ -10621,12 +10670,16 @@ var HELPS_ES = {
10621
10670
  ["--rotate", "demo: c\xF3digo nuevo; la liga vieja deja de servir"],
10622
10671
  ["--check PATH", "box: este archivo debe existir en la m\xE1quina (repetible), p. ej. un archivo que trae la imagen nueva"],
10623
10672
  ["--contains PATH=TEXT", "box: ese archivo debe contener TEXT (un cambio que no agrega archivos)"],
10624
- ["--recycle", "box: reemplaza sus m\xE1quinas (no a media respuesta); la nueva arranca en el siguiente turno. ACP: usa restart"],
10673
+ ["--recycle", "box: reemplaza sus m\xE1quinas (nunca a media respuesta); pool: la nueva nace en el siguiente turno; ACP (goose, lite): su caja se recrea ya con la imagen actual"],
10674
+ ["--reenv / --force", "box --recycle en ACP: --reenv s\xF3lo re-hornea el env en la misma caja; --force la recrea aunque est\xE9 ocupada (due\xF1o o staff)"],
10625
10675
  ["--unset-env K1,K2", "set: borra esas variables del env (--env K= tambi\xE9n borra K)"],
10626
10676
  ["--tool [ch:]tool=on|off", "set: prende/apaga una tool en un canal (wa:actualizar_identidad=off) o en todos (crm_buscar=off); separadas por comas"],
10627
10677
  ["--bag NAME|none", "set: de qu\xE9 bolsa de tokens de su espacio gasta; none = el saldo del espacio (s\xF3lo staff)"],
10628
10678
  ["--avatar URL|FILE", "set: su cara en Teams: una liga https o un JPEG/PNG/WebP local (se guarda en img.ghosty.studio)"],
10629
- ["--from-workspace", "rm: lo desactiva en cada Teams donde est\xE9 y luego lo borra (due\xF1o o staff)"]
10679
+ ["--from-workspace", "rm: lo desactiva en cada Teams donde est\xE9 y luego lo borra (due\xF1o o staff)"],
10680
+ ["--prompt-mode M", "set: append (default: su prompt + la persona de Ghosty) o replace (s\xF3lo su prompt)"],
10681
+ ["--sponsor/--owner EMAIL", "ls: agentes de CUALQUIER cuenta que paga / de quien es ese correo (staff de Ghosty); luego se operan por id"],
10682
+ ["--ids", "ls: s\xF3lo los ids, uno por rengl\xF3n (para xargs)"]
10630
10683
  ],
10631
10684
  notes: [
10632
10685
  "doctor sale con 1 cuando encuentra un problema, as\xED puede frenar un script o un CI.",
@@ -10680,7 +10733,7 @@ var HELPS_ES = {
10680
10733
  },
10681
10734
  turns: {
10682
10735
  summary: "Los turnos recientes de un agente: qu\xE9 contest\xF3, qu\xE9 fall\xF3 y por qu\xE9, y en qu\xE9 se fue el tiempo de un turno.",
10683
- replace: [["# last turn: each tool, its seconds, output tokens", "# \xFAltimo turno: cada tool, sus segundos, tokens de salida"]],
10736
+ replace: [["# last turn: each tool, its seconds, output tokens", "# \xFAltimo turno: cada tool, sus segundos, tokens de salida"], ["# stop the turn AND its background jobs", "# detiene el turno Y sus encargos en fondo"]],
10684
10737
  flags: [
10685
10738
  ["--errors", "s\xF3lo turnos fallidos (igual que --status error)"],
10686
10739
  ["--skipped", "ls: mensajes de clientes de WhatsApp Business que NO abrieron turno, y por qu\xE9 (operador activo, s\xF3lo registra, pausa, reacci\xF3n, canal apagado, sin saldo)"],
@@ -10701,7 +10754,7 @@ var HELPS_ES = {
10701
10754
  flags: [
10702
10755
  ["--waba", "el camino real de WhatsApp Business: contexto heredado, regla de precios, tablero, voz. Muestra lo que MANDAR\xCDA"],
10703
10756
  ["--session PHONE", "con --waba: un tel\xE9fono de cliente inventado (10-15 d\xEDgitos); cada tel\xE9fono es su propia conversaci\xF3n"],
10704
- ["--media FILE", "con --waba: el cliente manda esta foto/audio/PDF (uno por turno)"],
10757
+ ["--media FILE", "adjunta esta foto/PDF/audio. Solo: como desde la app (se repite, hasta 8). Con --waba: la manda el cliente (una por turno)"],
10705
10758
  ["--as-formmy", "con --media: llega como un reenv\xEDo real de Formmy (proxy con credencial, copia a gs, transcripci\xF3n) y dice si la copia funcion\xF3"],
10706
10759
  ["--keep", "con --waba: deja la tarjeta de prueba en el tablero (por default se archiva al terminar, y el tablero autom\xE1tico nunca corre en pruebas)"],
10707
10760
  ["--history FILE", "con --waba: lo que se dijo antes, como [{role: user|agent, text, at?}]; cuenta en el primer turno (--reset)"],
@@ -10912,11 +10965,12 @@ var HELPS = {
10912
10965
  agents: {
10913
10966
  summary: "Create, inspect, change, check and delete agents.",
10914
10967
  usage: [
10915
- "ghosty agents ls",
10968
+ "ghosty agents ls [--engine E] [--ids] [--sponsor EMAIL | --owner EMAIL]",
10916
10969
  "ghosty agents create --name NAME [--engine E] [--model M] [--prompt TEXT | --prompt-file FILE] [--env K=V,\u2026] [--workspace SLUG] [--channels teams=off,\u2026] [--like AGENT [--copy-dbs] [--board same|main|new|NAME] [--no-notify] [--dry-run]]",
10917
10970
  "ghosty agents get <agent-id> [--fields name,model,prompt] [--prompt-out FILE]",
10918
10971
  "ghosty agents export <agent-id> [--out DIR] # the agent as a file; see ghosty apply --help",
10919
10972
  "ghosty agents set <agent-id> [--name] [--engine] [--model] [--prompt | --prompt-file] [--env K=V,\u2026] [--unset-env K1,K2] [--connect ID,\u2026] [--disconnect ID,\u2026] [--voice E:ID] [--voice-replies auto|off] [--auto-stage on|off] [--toolsets crm,sales | +crm,-sales] [--tool [channel:]tool=on|off,\u2026] [--bag NAME|none] [--avatar URL|FILE]",
10973
+ "ghosty agents set <agent-id> --engine E [--model M] --dry-run # what changing the engine does (sessions, machines, memory), without changing it",
10920
10974
  "ghosty agents set <agent-id> --prompt-base <base-agent-id> --prompt-overlay overlay.json [--dry-run [--out FILE]] | --prompt-base none",
10921
10975
  "ghosty agents doctor <agent-id> [--verbose]",
10922
10976
  "ghosty agents docs ls|grant|revoke <agent-id> [doc\u2026] [--write] [--no-deliver] [--like AGENT]",
@@ -10941,6 +10995,7 @@ var HELPS = {
10941
10995
  ["--no-notify", "create --like: share it with the same people WITHOUT emailing them"],
10942
10996
  ["--workspace SLUG", "create: born in that workspace (you own or administer it), owned by its owner and active in its Teams"],
10943
10997
  ["--channels k=on|off,\u2026", "create/set: turn channels on/off: teams, web, whatsapp, messenger, wa (personal WhatsApp)"],
10998
+ ["--engine E --dry-run", "set: what changing the engine does (sessions forgotten, machine started and which one is destroyed, whether it is busy) without changing it; each conversation keeps its history"],
10944
10999
  ["--toolsets LIST", "set: gs tool groups it gets (crm, sales\u2026): a list replaces; +x / -x add or remove"],
10945
11000
  ["--prompt-base ID", "set: this agent's prompt = that agent's prompt + --prompt-overlay; regenerates when the base changes. none = unlink (keeps today's prompt)"],
10946
11001
  ["--prompt-overlay FILE", 'set: JSON {"edits":[{"what","find","replace","regex"?,"all"?}]}, applied in order; each must find its place or nothing changes'],
@@ -10966,12 +11021,16 @@ var HELPS = {
10966
11021
  ["--rotate", "demo: new code; the old link stops working"],
10967
11022
  ["--check PATH", "box: this file must exist in the machine (repeatable), e.g. a file the new image brings"],
10968
11023
  ["--contains PATH=TEXT", "box: that file must contain TEXT (a change that adds no files)"],
10969
- ["--recycle", "box: replace its machines (not mid-turn); the new one starts on the next turn. ACP: use restart"],
11024
+ ["--recycle", "box: replace its machines (not mid-turn); pool: the new one starts on the next turn; ACP (goose, lite): its box is recreated now with the current image"],
11025
+ ["--reenv / --force", "box --recycle on ACP: --reenv only re-bakes the env in the same box; --force recreates it even if busy (owner or staff)"],
10970
11026
  ["--unset-env K1,K2", "set: delete these env variables (--env K= also deletes K)"],
10971
11027
  ["--tool [ch:]tool=on|off", "set: one tool on/off in one channel (wa:actualizar_identidad=off) or everywhere (crm_buscar=off); comma-separated"],
10972
11028
  ["--bag NAME|none", "set: the token bag of its workspace it spends from; none = the workspace balance (staff only)"],
10973
11029
  ["--avatar URL|FILE", "set: its face in Teams: an https link or a local JPEG/PNG/WebP (stored at img.ghosty.studio)"],
10974
- ["--from-workspace", "rm: turn it off in every Teams where it's active, then delete it (owner or staff)"]
11030
+ ["--from-workspace", "rm: turn it off in every Teams where it's active, then delete it (owner or staff)"],
11031
+ ["--prompt-mode M", "set: append (default: its prompt + Ghosty's persona) or replace (its prompt only)"],
11032
+ ["--sponsor/--owner EMAIL", "ls: agents of ANY account paid by / owned by that email (Ghosty staff); then operate them by id"],
11033
+ ["--ids", "ls: only the ids, one per line (for xargs)"]
10975
11034
  ],
10976
11035
  examples: [
10977
11036
  "ghosty agents doctor cmu7pgbyr0001gee3ruk172mm",
@@ -10995,7 +11054,8 @@ var HELPS = {
10995
11054
  "ghosty agents box <id> --contains /opt/claude-worker/skills/pdf-doc/render-doc.mjs=pdf-templates",
10996
11055
  "ghosty agents set <id> --tool wa:actualizar_identidad=off,teams:actualizar_identidad=on",
10997
11056
  'ghosty agents set minighosty --bag "MiniGhosty" --avatar https://www.ghosty.studio/avatars/minighosty.png',
10998
- "ghosty agents rm fable --from-workspace"
11057
+ "ghosty agents rm fable --from-workspace",
11058
+ "ghosty agents ls --sponsor testers@ghosty.studio --engine ghosty-lite --ids | xargs -I{} ghosty agents set {} --engine claude --dry-run"
10999
11059
  ],
11000
11060
  notes: ["doctor exits 1 when it finds a problem, so it can gate a script or CI.", "A derived prompt can't be edited directly (409): change the base or the overlay, or unlink it with --prompt-base none.", "demo with no flags only prints its status: link, expiry, caps and numbers."],
11001
11061
  learn: `${REF}#agentes`
@@ -11081,7 +11141,7 @@ var HELPS = {
11081
11141
  },
11082
11142
  turns: {
11083
11143
  summary: "An agent's recent turns: what answered, what failed and why, and where one turn's time went.",
11084
- usage: ["ghosty turns ls <agent-id> [--errors | --status STATE | --skipped] [--since 1h] [--limit N]", "ghosty turns ls --workspace <slug> --quota-hits [--days 14]", "ghosty turns show <agent-id> [turn-id | last] [--full]"],
11144
+ usage: ["ghosty turns ls <agent-id> [--errors | --status STATE | --skipped] [--since 1h] [--limit N]", "ghosty turns ls --workspace <slug> --quota-hits [--days 14]", "ghosty turns show <agent-id> [turn-id | last] [--full]", "ghosty turns cancel <agent-id> <conversation-id> # stop the turn AND its background jobs"],
11085
11145
  flags: [
11086
11146
  ["--errors", "only failed turns (same as --status error)"],
11087
11147
  ["--skipped", "ls: WhatsApp Business customer messages that did NOT open a turn, and why (operator active, records only, paused, reaction, channel off, no balance)"],
@@ -11118,7 +11178,7 @@ var HELPS = {
11118
11178
  flags: [
11119
11179
  ["--waba", "the real WhatsApp Business path: inherited context, price rule, board, voice. Shows what it WOULD send"],
11120
11180
  ["--session PHONE", "with --waba: a made-up customer phone (10-15 digits); each phone is its own conversation"],
11121
- ["--media FILE", "with --waba: the customer sends this photo/audio/PDF (one per turn)"],
11181
+ ["--media FILE", "attach this photo/PDF/audio. Alone: as from the app (repeatable, up to 8). With --waba: the customer sends it (one per turn)"],
11122
11182
  ["--as-formmy", "with --media: it arrives like a real Formmy forward (proxy with credential, copy to gs, transcription) and says if the copy worked"],
11123
11183
  ["--keep", "with --waba: leave the test card on the board (by default it's archived when the test ends, and auto-stage never runs on tests)"],
11124
11184
  ["--history FILE", "with --waba: what was said before, as [{role: user|agent, text, at?}]; counts on the first turn (--reset)"],
@@ -11144,8 +11204,8 @@ var HELPS = {
11144
11204
  },
11145
11205
  chat: {
11146
11206
  summary: "Stream a conversation; with no message it is interactive.",
11147
- usage: ['ghosty chat <agent-id> ["message"] [--conversation ID]', "ghosty conversations ls <agent-id>", "ghosty conversations show <agent-id> <conversation-id> [--limit 20]"],
11148
- examples: ['ghosty chat <id> "hola"', "ghosty chat <id>"],
11207
+ usage: ['ghosty chat <agent-id> ["message"] [--conversation ID] [--media FILE]\u2026', "ghosty conversations ls <agent-id>", "ghosty conversations show <agent-id> <conversation-id> [--limit 20]"],
11208
+ examples: ['ghosty chat <id> "hola"', "ghosty chat <id>", 'ghosty chat <id> "p\xE1salo a PDF" --media foto.jpg'],
11149
11209
  learn: `${REF}#conversaciones`
11150
11210
  },
11151
11211
  schedule: {
@@ -12095,7 +12155,8 @@ ${bold("Workspaces")} ${dim("(changing them: Ghosty staff)")}
12095
12155
  spaces rename <old> <new> Change its slug only [--dry-run]
12096
12156
 
12097
12157
  ${bold("Agents")}
12098
- agents ls List your agents
12158
+ agents ls List your agents [--engine E] [--ids: only ids, for xargs]
12159
+ [--sponsor EMAIL | --owner EMAIL] any account's agents (Ghosty staff)
12099
12160
  agents create Create an agent --name [--engine] [--model] [--prompt | --prompt-file FILE] [--env K=V,\u2026]
12100
12161
  [--workspace SLUG] [--channels teams=off,\u2026] born in a workspace, active in its Teams
12101
12162
  [--like AGENT [--copy-dbs] [--board same|main|new|NAME] [--no-notify] [--dry-run]] with another agent's setup (not its prompt, env or channels)
@@ -12109,6 +12170,7 @@ ${bold("Agents")}
12109
12170
  [--toolsets crm,sales | +crm,-sales] gs tool groups it gets
12110
12171
  [--prompt-base AGENT|none --prompt-overlay FILE [--dry-run]] prompt = another agent's + edits, kept in sync
12111
12172
  [--tool wa:tool=off,\u2026] [--bag NAME|none] [--avatar URL|FILE] a tool per channel \xB7 its token bag (staff) \xB7 its face in Teams
12173
+ [--prompt-mode append|replace] replace = its prompt WITHOUT Ghosty's house persona
12112
12174
  agents doctor <id> Check the config: overlapping skills, tools the prompt names, broken grants, failing turns
12113
12175
  agents docs ls|grant|revoke <id> [doc] Documents it reads and may send [--write] [--no-deliver]
12114
12176
  agents docs grant <id> A B\u2026 Grant several documents at once [--like AGENT] copies another agent's
@@ -12118,7 +12180,7 @@ ${bold("Agents")}
12118
12180
  agents share|unshare <id> <email> Share it without handing it over [--role editor|admin] \xB7 agents shares <id> lists them
12119
12181
  agents rm <id> Delete an agent (owner only; asks you to type its name, or --yes) [--from-workspace: turn it off in Teams first]
12120
12182
  agents restart <id> Restart an ACP agent (needsRestart) so it loads new skills
12121
- agents box <id> The machine serving it: is it on the new image? [--check PATH]\u2026 [--contains PATH=TEXT]\u2026 [--recycle]
12183
+ agents box <id> The machine serving it: is it on the new image? [--check PATH]\u2026 [--contains PATH=TEXT]\u2026 [--recycle [--reenv] [--force]]
12122
12184
  agents demo enable|disable <id> Turn its public demo link on or off
12123
12185
  agents demo <id> Public demo link /p/<slug>: anyone tries it without an account, "Keep it" clones it to theirs
12124
12186
  [--slug NAME] [--expires "YYYY-MM-DDTHH:MM"|no] [--turns N] [--per-ip N] [--welcome TEXT] [--chips "a|b|c"] [--starter TEXT] [--sponsor on|off] [--rotate]
@@ -12150,15 +12212,16 @@ ${bold("Demos")}
12150
12212
  demos history <id> What visitors did: turns, messages, files (Ghosty staff) [--since 2d] [--session web:\u2026] [--timeline] [--full]
12151
12213
 
12152
12214
  ${bold("Talk to an agent")}
12153
- try <id> "message" One test turn, prints the full answer [--session] [--reset]
12215
+ try <id> "message" One test turn, prints the full answer [--session] [--reset] [--media FILE: attach, as from the app]
12154
12216
  --waba --session PHONE \u2026through the real WhatsApp path, nothing sent; lists what it would send (tools too) [--media FILE [--as-formmy]] [--history FILE]
12155
12217
  --replay FILE --out DIR Replay real conversations; report written locally [--max 15] [--concurrency 8] [--resume]
12156
- chat <id> ["message"] Stream a conversation (no message = interactive) [--conversation ID]
12218
+ chat <id> ["message"] Stream a conversation (no message = interactive) [--conversation ID] [--media FILE]
12157
12219
  conversations ls <id> List conversations
12158
12220
  conversations show <id> <conversation> What was said [--limit 20] (0 = all)
12159
12221
  turns ls <id> Recent turns and why they failed [--errors] [--skipped] [--since 1h] [--limit N]
12160
12222
  turns ls --workspace SLUG --quota-hits Messages that got no turn because the balance ran out [--days 14]
12161
12223
  turns show <id> [turn] What came in, what it answered, and where the time went (default: last) [--full]
12224
+ turns cancel <id> <conv> Stop: the running turn AND that conversation's background jobs (video, subagents, pending wake-ups)
12162
12225
 
12163
12226
  ${bold("Schedule turns")} ${dim("(each run lands in a conversation and notifies your phone; an answer of exactly OK stays silent)")}
12164
12227
  schedule ls <id> Pending turns and recent runs
@@ -12207,7 +12270,8 @@ ${bold("Espacios")} ${dim("(cambiarlos: staff de Ghosty)")}
12207
12270
  spaces rename <viejo> <nuevo> Cambia s\xF3lo su slug [--dry-run]
12208
12271
 
12209
12272
  ${bold("Agentes")}
12210
- agents ls Lista tus agentes
12273
+ agents ls Lista tus agentes [--engine E] [--ids: s\xF3lo ids, para xargs]
12274
+ [--sponsor CORREO | --owner CORREO] agentes de cualquier cuenta (staff de Ghosty)
12211
12275
  agents create Crea un agente --name [--engine] [--model] [--prompt | --prompt-file ARCHIVO] [--env K=V,\u2026]
12212
12276
  [--workspace SLUG] [--channels teams=off,\u2026] nace en un espacio, activo en su Teams
12213
12277
  [--like AGENTE [--copy-dbs] [--board same|main|new|NOMBRE] [--no-notify] [--dry-run]] con la configuraci\xF3n de otro agente (no su prompt, env ni canales)
@@ -12221,6 +12285,7 @@ ${bold("Agentes")}
12221
12285
  [--toolsets crm,sales | +crm,-sales] grupos de tools de gs que recibe
12222
12286
  [--prompt-base AGENTE|none --prompt-overlay ARCHIVO [--dry-run]] prompt = el de otro agente + ediciones, sincronizado
12223
12287
  [--tool wa:tool=off,\u2026] [--bag NOMBRE|none] [--avatar URL|ARCHIVO] una tool por canal \xB7 su bolsa de tokens (staff) \xB7 su cara en Teams
12288
+ [--prompt-mode append|replace] replace = su prompt SIN la persona de casa de Ghosty
12224
12289
  agents doctor <id> Revisa la configuraci\xF3n: skills encimadas, tools que nombra el prompt, permisos rotos, turnos que fallan
12225
12290
  agents docs ls|grant|revoke <id> [doc] Documentos que lee y puede enviar [--write] [--no-deliver]
12226
12291
  agents docs grant <id> A B\u2026 Da varios documentos a la vez [--like AGENTE] copia los de otro agente
@@ -12230,7 +12295,7 @@ ${bold("Agentes")}
12230
12295
  agents share|unshare <id> <correo> Comp\xE1rtelo sin cederlo [--role editor|admin] \xB7 agents shares <id> los lista
12231
12296
  agents rm <id> Borra un agente (s\xF3lo el due\xF1o; te pide escribir su nombre, o --yes) [--from-workspace: antes lo desactiva en Teams]
12232
12297
  agents restart <id> Reinicia un agente ACP (needsRestart) para que cargue skills nuevas
12233
- agents box <id> La m\xE1quina que lo atiende: \xBFya trae la imagen nueva? [--check RUTA]\u2026 [--contains RUTA=TEXTO]\u2026 [--recycle]
12298
+ agents box <id> La m\xE1quina que lo atiende: \xBFya trae la imagen nueva? [--check RUTA]\u2026 [--contains RUTA=TEXTO]\u2026 [--recycle [--reenv] [--force]]
12234
12299
  agents demo enable|disable <id> Prende o apaga su liga p\xFAblica de demo
12235
12300
  agents demo <id> Liga p\xFAblica de demo /p/<slug>: cualquiera lo prueba sin cuenta y \xABQued\xE1rmelo\xBB lo clona a la suya
12236
12301
  [--slug NOMBRE] [--expires "AAAA-MM-DDTHH:MM"|no] [--turns N] [--per-ip N] [--welcome TEXTO] [--chips "a|b|c"] [--starter TEXTO] [--sponsor on|off] [--rotate]
@@ -12262,15 +12327,16 @@ ${bold("Demos")}
12262
12327
  demos history <id> Qu\xE9 hicieron los visitantes: turnos, mensajes, archivos (staff de Ghosty) [--since 2d] [--session web:\u2026] [--timeline] [--full]
12263
12328
 
12264
12329
  ${bold("Hablar con un agente")}
12265
- try <id> "mensaje" Un turno de prueba; imprime la respuesta completa [--session] [--reset]
12330
+ try <id> "mensaje" Un turno de prueba; imprime la respuesta completa [--session] [--reset] [--media ARCHIVO: adjunto, como desde la app]
12266
12331
  --waba --session TEL \u2026por el camino real de WhatsApp, sin enviar nada; lista lo que mandar\xEDa (tools tambi\xE9n) [--media ARCHIVO [--as-formmy]] [--history ARCHIVO]
12267
12332
  --replay ARCHIVO --out DIR Repite conversaciones reales; el reporte se escribe local [--max 15] [--concurrency 8] [--resume]
12268
- chat <id> ["mensaje"] Conversaci\xF3n en streaming (sin mensaje = interactivo) [--conversation ID]
12333
+ chat <id> ["mensaje"] Conversaci\xF3n en streaming (sin mensaje = interactivo) [--conversation ID] [--media ARCHIVO]
12269
12334
  conversations ls <id> Lista conversaciones
12270
12335
  conversations show <id> <conversaci\xF3n> Qu\xE9 se dijo [--limit 20] (0 = todo)
12271
12336
  turns ls <id> Turnos recientes y por qu\xE9 fallaron [--errors] [--skipped] [--since 1h] [--limit N]
12272
12337
  turns ls --workspace SLUG --quota-hits Mensajes que no abrieron turno porque se acab\xF3 el saldo [--days 14]
12273
12338
  turns show <id> [turno] Qu\xE9 lleg\xF3, qu\xE9 contest\xF3 y en qu\xE9 se fue el tiempo (default: el \xFAltimo) [--full]
12339
+ turns cancel <id> <conv> Detener: el turno en curso Y los encargos en fondo de esa conversaci\xF3n (video, subagentes, despertadores)
12274
12340
 
12275
12341
  ${bold("Turnos programados")} ${dim("(cada corrida cae en una conversaci\xF3n y avisa a tu tel\xE9fono; una respuesta de exactamente OK no avisa)")}
12276
12342
  schedule ls <id> Turnos pendientes y corridas recientes
@@ -12471,6 +12537,11 @@ async function main() {
12471
12537
  by: { type: "string" },
12472
12538
  models: { type: "boolean" },
12473
12539
  teams: { type: "string" },
12540
+ owner: { type: "string" },
12541
+ ids: { type: "boolean" },
12542
+ force: { type: "boolean" },
12543
+ reenv: { type: "boolean" },
12544
+ "prompt-mode": { type: "string" },
12474
12545
  format: { type: "string" },
12475
12546
  timeline: { type: "boolean" },
12476
12547
  new: { type: "boolean" },
@@ -12483,7 +12554,7 @@ async function main() {
12483
12554
  const tokens = splitTokens(pos, v);
12484
12555
  globals.token = tokens.session;
12485
12556
  globals.profile = v.profile;
12486
- if (v.version) return out({ version: "0.28.0" }, () => "0.28.0");
12557
+ if (v.version) return out({ version: "0.29.0" }, () => "0.29.0");
12487
12558
  for (const n of normalizeArgs(pos, v)) if (!globals.json) info(dim(n));
12488
12559
  const context = (await readConfig()).workspace;
12489
12560
  if (!explicitToken()?.startsWith("gat_")) {
@@ -12529,7 +12600,7 @@ async function main() {
12529
12600
  case "apply":
12530
12601
  return applyCmd(sub, v);
12531
12602
  case "agents":
12532
- if (sub === "ls" || sub === "list" || !sub) return agentsLs(v.all ? void 0 : context);
12603
+ if (sub === "ls" || sub === "list" || !sub) return agentsLs(v.all ? void 0 : v.workspace ?? context, { sponsor: v.sponsor, owner: v.owner, engine: v.engine, ids: v.ids, all: v.all });
12533
12604
  if (sub === "create" || sub === "new") {
12534
12605
  if (v.workspace === "none") delete v.workspace;
12535
12606
  else if (!v.workspace && context) {
@@ -12615,7 +12686,7 @@ async function main() {
12615
12686
  throw unknown(cmd, cmd, COMMANDS, "ghosty --help");
12616
12687
  }
12617
12688
  }
12618
- var notice = updateNotice("0.28.0").catch(() => null);
12689
+ var notice = updateNotice("0.29.0").catch(() => null);
12619
12690
  main().then(
12620
12691
  async () => {
12621
12692
  const n = await notice;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghostystudio/cli",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "Official Ghosty Studio CLI — configure, test and chat with your agents from the terminal. Built for humans and coding agents.",
5
5
  "type": "module",
6
6
  "bin": {