@todoforai/tfa-surface 0.1.3 → 0.1.5

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 (2) hide show
  1. package/dist/cli.js +13 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -10,6 +10,9 @@ import { readFileSync, writeFileSync, mkdirSync, chmodSync } from "node:fs";
10
10
  import { join, dirname } from "node:path";
11
11
  import { homedir, platform } from "node:os";
12
12
  var DEFAULT_API_URL = "https://api.todofor.ai";
13
+ function runActorToken() {
14
+ return process.env.TODOFORAI_USER_ID ? process.env.TODOFORAI_API_TOKEN || "" : "";
15
+ }
13
16
  function normalizeApiUrl(url) {
14
17
  if (url.startsWith("localhost"))
15
18
  return `http://${url}`;
@@ -67,6 +70,8 @@ async function refreshDeviceToken(opts = {}) {
67
70
  const apiUrl = normalizeApiUrl(opts.apiUrl || envUrl || stored.apiUrl || DEFAULT_API_URL);
68
71
  if (!stored.deviceId || !stored.deviceSecret)
69
72
  return "";
73
+ if (runActorToken())
74
+ return "";
70
75
  if (stored.apiUrl && normalizeApiUrl(stored.apiUrl) !== apiUrl)
71
76
  return "";
72
77
  try {
@@ -116,7 +121,7 @@ function resolveToken(opts = {}) {
116
121
  // package.json
117
122
  var package_default = {
118
123
  name: "@todoforai/tfa-surface",
119
- version: "0.1.3",
124
+ version: "0.1.5",
120
125
  description: "TODOforAI surface CLI — see and drive what is shown in the user's live UI (describe, todo/panel views, renderer cards, surface render, controls). Replaces tfa-frontend. Reuses bridge credentials.",
121
126
  type: "module",
122
127
  bin: {
@@ -163,7 +168,8 @@ Discovery:
163
168
 
164
169
  Surfaces — a ref is a todo id, <todoId>:<alias> (a shown artifact, live) or an http(s) url:
165
170
  open overlay <todoId> The full-page todo (todos only).
166
- open window <ref> A floating preview window (any ref).
171
+ open window <ref> [--detached] A floating preview window (any ref); --detached: out of
172
+ the grid, own size, resizable. connect:/stream: refs always are.
167
173
  open panel <view> [--todo <id>] [--url <url>]
168
174
  A todo's side panel: changes|agents|preview|browser|terminal
169
175
  (--todo defaults to $TODOFORAI_TODO_ID).
@@ -206,6 +212,7 @@ Examples:
206
212
  tfa-surface card add kpi-tile dashboards/kpi.html --title "KPI tile"
207
213
  tfa-surface open window 3f2a91...
208
214
  tfa-surface open window $TODOFORAI_TODO_ID:kpi # a shown artifact, in its own window
215
+ tfa-surface open window connect:<deviceId>/zele # a sign-in card for the user
209
216
  tfa-surface open card $TODOFORAI_TODO_ID:kpi --title "Weekly KPIs" --group marketing
210
217
  tfa-surface open panel browser --url https://example.com
211
218
  tfa-surface close card weekly-kpis
@@ -291,7 +298,7 @@ function printDescribe(d) {
291
298
  console.log(`sidebar: ${d.sidebar}`);
292
299
  console.log(d.surfaces.length ? "surfaces:" : "surfaces: []");
293
300
  for (const s of d.surfaces) {
294
- const flags = [s.focused ? "focused" : "", s.docked ? "docked" : "", s.view ?? "", s.group ? `in ${s.group}` : ""].filter(Boolean).join(", ");
301
+ const flags = [s.focused ? "focused" : "", s.docked ? "docked" : "", s.size ? `detached ${s.size.w}x${s.size.h}` : "", s.view ?? "", s.group ? `in ${s.group}` : ""].filter(Boolean).join(", ");
295
302
  const id = s.kind === "overlay" || s.id === s.ref ? "" : ` ${s.id}`;
296
303
  console.log(` ${s.kind}${id}: ${s.ref}${flags ? ` ${flags}` : ""}${s.title ? ` # ${s.title}` : ""}`);
297
304
  if (s.browser)
@@ -319,6 +326,7 @@ async function main() {
319
326
  "api-url": { type: "string" },
320
327
  "api-token": { type: "string" },
321
328
  json: { type: "boolean", default: false },
329
+ detached: { type: "boolean", default: false },
322
330
  help: { type: "boolean", short: "h", default: false },
323
331
  version: { type: "boolean", default: false }
324
332
  },
@@ -356,11 +364,11 @@ async function main() {
356
364
  }
357
365
  case "open": {
358
366
  const [kind, arg] = args;
359
- const usage = "usage: tfa-surface open overlay <todoId> | window <ref> | panel <view> [--todo <id>] [--url <url>] | card <ref> [--id <id>] [--title <t>] [--group <slug>]";
367
+ const usage = "usage: tfa-surface open overlay <todoId> | window <ref> [--detached] | panel <view> [--todo <id>] [--url <url>] | card <ref> [--id <id>] [--title <t>] [--group <slug>]";
360
368
  if (kind === "overlay" || kind === "window") {
361
369
  if (!arg)
362
370
  die(usage);
363
- const result = await uiCall(ctx, "surface.open", { kind, ref: arg });
371
+ const result = await uiCall(ctx, "surface.open", { kind, ref: arg, ...values.detached && { detached: true } });
364
372
  console.log(ctx.json ? JSON.stringify(result) : `${result.created ? "opened" : "already open"} (${kind})`);
365
373
  } else if (kind === "panel") {
366
374
  if (!arg)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todoforai/tfa-surface",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "TODOforAI surface CLI — see and drive what is shown in the user's live UI (describe, todo/panel views, renderer cards, surface render, controls). Replaces tfa-frontend. Reuses bridge credentials.",
5
5
  "type": "module",
6
6
  "bin": {