@todoforai/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.
@@ -42949,25 +42949,15 @@ class ApiClient {
42949
42949
  throw new Error(`API GET /resources/show failed: ${res.status} ${await res.text()}`);
42950
42950
  return res.json();
42951
42951
  }
42952
- async patchSite(siteId, body) {
42953
- const res = await fetch(`${this.apiUrl}${restBasePath(this.apiKey)}/resources/sites/${siteId}`, {
42954
- method: "PATCH",
42955
- headers: { "x-api-key": this.apiKey, "Content-Type": "application/json" },
42956
- body: JSON.stringify(body),
42957
- signal: AbortSignal.timeout(30000)
42958
- });
42959
- if (!res.ok)
42960
- throw new Error(`API PATCH site failed: ${res.status} ${await res.text()}`);
42961
- return res.json();
42962
- }
42963
- async deleteSite(siteId) {
42964
- const res = await fetch(`${this.apiUrl}${restBasePath(this.apiKey)}/resources/sites/${siteId}`, {
42952
+ async removeShow(todoId, key) {
42953
+ const url = `${this.apiUrl}${restBasePath(this.apiKey)}/resources/show/${encodeURIComponent(todoId)}/${encodeURIComponent(key)}`;
42954
+ const res = await fetch(url, {
42965
42955
  method: "DELETE",
42966
42956
  headers: { "x-api-key": this.apiKey },
42967
42957
  signal: AbortSignal.timeout(30000)
42968
42958
  });
42969
42959
  if (!res.ok)
42970
- throw new Error(`API DELETE site failed: ${res.status} ${await res.text()}`);
42960
+ throw new Error(`API DELETE /resources/show failed: ${res.status} ${await res.text()}`);
42971
42961
  }
42972
42962
  async upsertCard(projectId, name, html, opts = {}) {
42973
42963
  const form = new FormData;
@@ -43703,6 +43693,7 @@ var SERVER_TO_FRONTENDS = {
43703
43693
  msgMetaUsr: (todoId) => `${"todo:msg_meta_usr" /* TODO_MSG_META_USR */}:${todoId}`,
43704
43694
  msgMetaAi: (todoId) => `${"todo:msg_meta_ai" /* TODO_MSG_META_AI */}:${todoId}`,
43705
43695
  msgQueueUpdate: (todoId) => `${"todo:msg_queue_update" /* TODO_MSG_QUEUE_UPDATE */}:${todoId}`,
43696
+ message_removed: (todoId) => `${"todo:message_removed" /* TODO_MESSAGE_REMOVED */}:${todoId}`,
43706
43697
  start_universal: (todoId) => `${"block:start_universal" /* BLOCK_START_UNIVERSAL */}:${todoId}`,
43707
43698
  message: (todoId) => `${"block:message" /* BLOCK_MESSAGE */}:${todoId}`,
43708
43699
  end: (todoId) => `${"block:end" /* BLOCK_END */}:${todoId}`,
@@ -44378,6 +44369,10 @@ var TOPICS = {
44378
44369
  channel: (p) => SERVER_TO_FRONTENDS.todo.msgQueueUpdate(p.todoId),
44379
44370
  audience: "frontend"
44380
44371
  },
44372
+ ["todo:message_removed" /* TODO_MESSAGE_REMOVED */]: {
44373
+ channel: (p) => SERVER_TO_FRONTENDS.todo.message_removed(p.todoId),
44374
+ audience: "frontend"
44375
+ },
44381
44376
  ["todo:msg_meta_usr" /* TODO_MSG_META_USR */]: {
44382
44377
  channel: (p) => SERVER_TO_FRONTENDS.todo.msgMetaUsr(p.todoId),
44383
44378
  audience: "frontend"
@@ -44454,11 +44449,12 @@ import { parseArgs } from "util";
44454
44449
  // package.json
44455
44450
  var package_default = {
44456
44451
  name: "@todoforai/cli",
44457
- version: "0.1.44",
44452
+ version: "0.1.46",
44458
44453
  type: "module",
44459
44454
  bin: {
44460
44455
  "todoforai-cli": "bin/todoforai-cli.js",
44461
44456
  "tfa-cli": "bin/todoforai-cli.js",
44457
+ "tfa-code": "bin/todoforai-cli.js",
44462
44458
  todoai: "bin/todoforai-cli.js"
44463
44459
  },
44464
44460
  files: [
@@ -44518,10 +44514,10 @@ Usage:
44518
44514
  tfa-cli show <file|-> [todo-id] # Show a file in the chat (rendered by mimetype; - reads stdin)
44519
44515
  # [--title T] [--alias A] [--mime M] [--card <name>] [--link] [--json]
44520
44516
  # --link = compact chip (name+size+download) instead of inline render
44521
- # The file gets a stable public url: show.todofor.ai/<site-id>
44522
- # (latest; /<site-id>/<attachment-id> = frozen version). --site <id>
44523
- # pushes a new version to an existing url (from any todo).
44524
- tfa-cli show rm <site-id> # Take a shown file down (all versions)
44517
+ # Prints "<todoId>:<alias|id> <public url>". Re-showing with the same
44518
+ # --alias updates that block in place and pushes a new version to the
44519
+ # same url (older versions stay reachable at /<id>/<version>).
44520
+ tfa-cli show rm <ref|alias> # Take a shown file down (block, url, every version)
44525
44521
  tfa-cli show list [todo-id] # List show blocks (ref, title, mime/url, card)
44526
44522
  # [--project <id>] [--card <name>] [--json]
44527
44523
  # no todo-id + --project (or $TODOFORAI_PROJECT_ID) = every todo
@@ -44615,7 +44611,6 @@ function parseCliArgs() {
44615
44611
  mime: { type: "string" },
44616
44612
  card: { type: "string" },
44617
44613
  link: { type: "boolean", default: false },
44618
- site: { type: "string" },
44619
44614
  direction: { type: "string" },
44620
44615
  "business-context": { type: "string" },
44621
44616
  seed: { type: "string" },
@@ -52934,13 +52929,18 @@ var log2 = (...a) => process.stderr.write(`[acp] ${a.join(" ")}
52934
52929
  var ACP_KIND = { create: "edit", edit: "edit", read: "read", search: "search", shell: "execute" };
52935
52930
  var toolTitle = (info) => {
52936
52931
  const target = info.path || info.filePath || info.cmd || info.name || info.url || info.query || "";
52937
- return target ? `${info.block_type || "tool"}: ${String(target).slice(0, 120)}` : info.block_type || "tool";
52932
+ if (target)
52933
+ return `${info.block_type || "tool"}: ${String(target).split(`
52934
+ `)[0].slice(0, 120)}`;
52935
+ return info.title || info.block_type || "tool";
52938
52936
  };
52939
52937
 
52940
52938
  class BlockView {
52941
52939
  info = {};
52942
52940
  announced = false;
52943
52941
  permissionAsked = false;
52942
+ title = "";
52943
+ kind = "other";
52944
52944
  output = "";
52945
52945
  content() {
52946
52946
  const c3 = [];
@@ -53085,11 +53085,18 @@ ${b.resource.text}
53085
53085
  const blocks4 = new Map;
53086
53086
  const view = (id) => blocks4.get(id) ?? blocks4.set(id, new BlockView).get(id);
53087
53087
  const announce = (id, b) => {
53088
- if (b.announced)
53088
+ if (b.info.block_type === "text")
53089
53089
  return;
53090
- b.announced = true;
53090
+ const title = toolTitle(b.info), kind = ACP_KIND[classifyBlock2(b.info)] ?? "other";
53091
53091
  const path4 = b.info.path || b.info.filePath;
53092
- update({ sessionUpdate: "tool_call", toolCallId: id, title: toolTitle(b.info), kind: ACP_KIND[classifyBlock2(b.info)] ?? "other", status: "pending", locations: path4 ? [{ path: path4 }] : [], rawInput: { block_type: b.info.block_type, cmd: b.info.cmd, path: path4, changes: b.info.changes } });
53092
+ if (!b.announced) {
53093
+ b.announced = true;
53094
+ update({ sessionUpdate: "tool_call", toolCallId: id, title, kind, status: "pending", locations: path4 ? [{ path: path4 }] : [], rawInput: { block_type: b.info.block_type, cmd: b.info.cmd, path: path4, changes: b.info.changes } });
53095
+ } else if (title !== b.title || kind !== b.kind) {
53096
+ update({ sessionUpdate: "tool_call_update", toolCallId: id, title, kind, ...path4 && { locations: [{ path: path4 }] } });
53097
+ }
53098
+ b.title = title;
53099
+ b.kind = kind;
53093
53100
  };
53094
53101
  const askPermission = async (id, b, messageId) => {
53095
53102
  if (b.permissionAsked || turn.done)
@@ -53125,6 +53132,7 @@ ${b.resource.text}
53125
53132
  const b = view(id);
53126
53133
  if (type.startsWith("block:start_")) {
53127
53134
  b.info = { ...b.info, ...payload };
53135
+ announce(id, b);
53128
53136
  return;
53129
53137
  }
53130
53138
  if (type === "block:sh_msg_result") {
@@ -53142,8 +53150,10 @@ ${b.resource.text}
53142
53150
  return;
53143
53151
  const u = payload.updates || {};
53144
53152
  b.info = { ...b.info, ...u };
53145
- announce(id, b);
53146
53153
  const st = u.status;
53154
+ if (!b.info.block_type && !st)
53155
+ return;
53156
+ announce(id, b);
53147
53157
  const status = st === "RUNNING" ? "in_progress" : st === "COMPLETED" ? "completed" : ["DENIED", "FAILED", "ERROR"].includes(st) ? "failed" : undefined;
53148
53158
  const contentChanged = u.originalContent !== undefined || u.modifiedContent !== undefined;
53149
53159
  if (status || contentChanged || u.result) {
@@ -53488,14 +53498,22 @@ Cancelled by user (Ctrl+C)
53488
53498
  return;
53489
53499
  }
53490
53500
  if (positionals[0] === "show" && positionals[1] === "rm") {
53491
- const id = positionals[2];
53492
- if (!id) {
53493
- process.stderr.write(`${RED3}Usage: tfa-cli show rm <site-id>${RESET2}
53501
+ const arg = positionals[2];
53502
+ if (!arg) {
53503
+ process.stderr.write(`${RED3}Usage: tfa-cli show rm <ref|alias>${RESET2}
53504
+ `);
53505
+ process.exit(2);
53506
+ }
53507
+ const sep = arg.indexOf(":");
53508
+ const todoId = sep >= 0 ? arg.slice(0, sep) : getEnv("TODO_ID") || cfgScope.data.last_todo_id;
53509
+ const key = sep >= 0 ? arg.slice(sep + 1) : arg;
53510
+ if (!todoId || !key) {
53511
+ process.stderr.write(`${RED3}show rm: need <todoId>:<alias> (no current todo)${RESET2}
53494
53512
  `);
53495
53513
  process.exit(2);
53496
53514
  }
53497
- await api.deleteSite(id);
53498
- process.stderr.write(`${GREEN2}\u2705 deleted ${id}${RESET2}
53515
+ await api.removeShow(todoId, key);
53516
+ process.stderr.write(`${GREEN2}\u2705 removed ${todoId}:${key}${RESET2}
53499
53517
  `);
53500
53518
  return;
53501
53519
  }
@@ -53503,7 +53521,7 @@ Cancelled by user (Ctrl+C)
53503
53521
  const [, filePath, todoArg] = positionals;
53504
53522
  const todoId = todoArg || getEnv("TODO_ID") || cfgScope.data.last_todo_id;
53505
53523
  if (!filePath || !todoId) {
53506
- process.stderr.write(`${RED3}Usage: tfa-cli show <file|-> [todo-id] [--title T] [--alias A] [--mime M] [--card <name>] [--link] [--site <id>]${RESET2}
53524
+ process.stderr.write(`${RED3}Usage: tfa-cli show <file|-> [todo-id] [--title T] [--alias A] [--mime M] [--card <name>] [--link]${RESET2}
53507
53525
  `);
53508
53526
  process.exit(2);
53509
53527
  }
@@ -53534,13 +53552,12 @@ Cancelled by user (Ctrl+C)
53534
53552
  alias: args.alias,
53535
53553
  mime: args.mime,
53536
53554
  card: args.card,
53537
- display: args.link ? "link" : undefined,
53538
- site: args.site
53555
+ display: args.link ? "link" : undefined
53539
53556
  });
53540
53557
  if (args.json)
53541
53558
  console.log(JSON.stringify(res, null, 2));
53542
53559
  else
53543
- console.log(res.url ? `${res.ref} site=${res.siteId} ${res.url}` : res.ref);
53560
+ console.log(res.url ? `${res.ref} ${res.url}` : res.ref);
53544
53561
  return;
53545
53562
  }
53546
53563
  if (positionals[0] === "open") {
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@todoforai/cli",
3
- "version": "0.1.44",
3
+ "version": "0.1.46",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "todoforai-cli": "bin/todoforai-cli.js",
7
7
  "tfa-cli": "bin/todoforai-cli.js",
8
+ "tfa-code": "bin/todoforai-cli.js",
8
9
  "todoai": "bin/todoforai-cli.js"
9
10
  },
10
11
  "files": [