listspace 0.5.0 → 0.6.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/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  One version runs through the CLI, the skill and the Claude Code plugin, so each entry covers all three.
4
4
 
5
+ ## 0.6.0
6
+
7
+ - `listspace attach` takes files up to the plan's size of one file (Free 25 MB, Pro 2 GB, a team's boards 5 GB), at most 4 GB from the CLI. Up to 8 MB a file goes in the request as before; a larger one goes straight to Listspace's file storage: the CLI asks for an upload link with the file's size, sends the file from disk (it is never read into memory) and then finishes the upload. A file over the plan's size is refused before any byte is sent.
8
+ - The skill's file pages say how an agent sends a file over 8 MB with an upload link (`get_upload_link` with `size_bytes`, a PUT, then `finish_command`), that `attach_chat_file` takes files up to the plan's size, and what `virus_scan` `not_scanned_too_large` means.
9
+
5
10
  ## 0.5.0
6
11
 
7
12
  - New command `listspace call <tool> ['<json>']`: runs any tool of the Listspace MCP server by name, with its arguments as one JSON object, for example `listspace call get_item --json '{"item_id": "..."}'`. It goes to the MCP server with the same token, so the tools, the agent access level checks and the results are the same as for an MCP client, and a new tool works without a CLI update. A tool that refuses (a level, a wrong argument) exits 1 with `error.kind` `tool`. A call with an `idempotency_key` is sent once more after a network error or a 502, 503 or 504; one without is sent once.
package/README.md CHANGED
@@ -71,7 +71,7 @@ Every MCP tool (the same tools, levels and results as the MCP server)
71
71
  call <tool> ['<json>'] Run a tool with its arguments as one JSON object.
72
72
 
73
73
  Files from this computer (needs level 4, Act)
74
- attach <item> <file> [<file>...] At most 8 MB each.
74
+ attach <item> <file> [<file>...] Up to the plan's size of one file, at most 4 GB.
75
75
 
76
76
  Work on your own (needs level 4, Act)
77
77
  next <board> [--kinds todo,backlog] [--label <id>] [--no-move] [--ttl <minutes>]
@@ -115,7 +115,7 @@ PowerShell treats quotes in JSON differently. On Windows, run these commands fro
115
115
  npx listspace attach 2b6f0c1e-... ./contract.pdf ./screenshots/footer.png
116
116
  ```
117
117
 
118
- The type comes from the extension: images (jpg, png, gif, webp, svg), PDF, Word, Excel and PowerPoint files, text, Markdown, CSV, JSON, archives (zip, rar, 7z), audio and video. Each file can be at most 8 MB. Every file is checked before the first one is sent. Attaching needs level 4 (Act) on the board: a file cannot wait in the Inbox.
118
+ The type comes from the extension: images (jpg, png, gif, webp, svg), PDF, Word, Excel and PowerPoint files, text, Markdown, CSV, JSON, archives (zip, rar, 7z), audio and video. Each file can be as large as the plan of the board's owner allows (Free 25 MB, Pro 2 GB, a team's boards 5 GB), at most 4 GB from the CLI. A file over 8 MB goes straight to Listspace's file storage, sent from disk, and is put on the item when it has arrived. Every file is checked before the first one is sent. Attaching needs level 4 (Act) on the board: a file cannot wait in the Inbox.
119
119
 
120
120
  ## Output for agents and scripts
121
121
 
@@ -229,9 +229,13 @@ var attached = object({
229
229
  url: string
230
230
  })
231
231
  });
232
+ var largeUploadLink = object({
233
+ upload_url: string,
234
+ finish_url: nullable(string)
235
+ });
232
236
 
233
237
  // src/version.ts
234
- var VERSION = "0.5.0";
238
+ var VERSION = "0.6.0";
235
239
 
236
240
  // src/api.ts
237
241
  var DEFAULT_API_URL = "https://api.listspace.app/v1";
@@ -272,6 +276,31 @@ var ApiClient = class {
272
276
  const json = await this.send(method, path2, init);
273
277
  return { value: decodeOrFail(decoder, json, "body"), raw: json };
274
278
  }
279
+ /**
280
+ * PUTs a file to a signed storage link (get_upload_link for a large file).
281
+ * The link is the credential: no token is sent with it. The Blob's size
282
+ * is the Content-Length, which the link signed.
283
+ */
284
+ async putToStorage(url, file) {
285
+ let response;
286
+ try {
287
+ response = await this.options.fetch(url, { method: "PUT", body: file, headers: { "User-Agent": `listspace-cli/${VERSION}` } });
288
+ } catch (cause) {
289
+ const reason = cause instanceof Error ? cause.message : String(cause);
290
+ return fail({ kind: "network", message: `Could not send the file to Listspace's file storage: ${reason}` });
291
+ }
292
+ await response.body?.cancel();
293
+ if (!response.ok) {
294
+ return fail({ kind: "api", status: response.status, code: "upload_failed", message: `Listspace's file storage refused the file (HTTP ${response.status}). Run the command again for a new link.` });
295
+ }
296
+ }
297
+ /** POSTs to an upload link's finish address (no body; the link is the credential) and decodes `data`. */
298
+ async finishUpload(url, decoder) {
299
+ const { response, json } = await this.exchange(new URL(url), { method: "POST", headers: { Accept: "application/json", "User-Agent": `listspace-cli/${VERSION}` } }, false);
300
+ if (!response.ok) return fail(errorFor(response, json));
301
+ if (!isRecord(json) || !("data" in json)) return fail({ kind: "unexpected", message: "Unexpected response from Listspace: no data." });
302
+ return { value: decodeOrFail(decoder, json.data, "data"), raw: json.data };
303
+ }
275
304
  /** A new idempotency key: a random UUID, or the tests' own. */
276
305
  newKey() {
277
306
  return (this.options.newKey ?? (() => crypto.randomUUID()))();
@@ -433,8 +462,10 @@ function errorFor(response, json) {
433
462
  }
434
463
 
435
464
  // src/files.ts
465
+ import { openAsBlob } from "node:fs";
436
466
  import { readFile, stat } from "node:fs/promises";
437
467
  var MAX_FILE_BYTES = 8 * 1024 * 1024;
468
+ var MAX_LARGE_FILE_BYTES = 4 * 1024 * 1024 * 1024;
438
469
  var TYPES = {
439
470
  jpg: "image/jpeg",
440
471
  jpeg: "image/jpeg",
@@ -478,7 +509,7 @@ function mimeTypeFor(fileName) {
478
509
  if (dot <= 0 || dot === fileName.length - 1) return null;
479
510
  return TYPES[fileName.slice(dot + 1).toLowerCase()] ?? null;
480
511
  }
481
- async function readLocalFile(path2, maxBytes) {
512
+ async function readLocalFile(path2, maxBytes, largeMaxBytes = maxBytes) {
482
513
  let size;
483
514
  try {
484
515
  const info = await stat(path2);
@@ -488,7 +519,14 @@ async function readLocalFile(path2, maxBytes) {
488
519
  if (isErrnoCode(error, "ENOENT")) return { kind: "missing" };
489
520
  return { kind: "unreadable", reason: error instanceof Error ? error.message : String(error) };
490
521
  }
491
- if (size > maxBytes) return { kind: "too_large", sizeBytes: size };
522
+ if (size > largeMaxBytes) return { kind: "too_large", sizeBytes: size };
523
+ if (size > maxBytes) {
524
+ try {
525
+ return { kind: "large", blob: await openAsBlob(path2), sizeBytes: size };
526
+ } catch (error) {
527
+ return { kind: "unreadable", reason: error instanceof Error ? error.message : String(error) };
528
+ }
529
+ }
492
530
  try {
493
531
  const bytes = await readFile(path2);
494
532
  if (bytes.length > maxBytes) return { kind: "too_large", sizeBytes: bytes.length };
@@ -503,7 +541,8 @@ function isErrnoCode(error, code2) {
503
541
  function formatSize(bytes) {
504
542
  if (bytes < 1024) return `${bytes} bytes`;
505
543
  if (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)} KB`;
506
- return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
544
+ if (bytes < 1024 * 1024 * 1024) return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
545
+ return `${(bytes / 1024 / 1024 / 1024).toFixed(1)} GB`;
507
546
  }
508
547
 
509
548
  // src/format.ts
@@ -837,18 +876,21 @@ async function prepareFiles(paths, read) {
837
876
  if (mimeType === null) {
838
877
  return fail({ kind: "usage", message: `${fileName}: this type of file cannot be attached. Allowed: ${ATTACHABLE_EXTENSIONS.join(", ")}.` });
839
878
  }
840
- const file = await read(filePath, MAX_FILE_BYTES);
879
+ const file = await read(filePath, MAX_FILE_BYTES, MAX_LARGE_FILE_BYTES);
841
880
  switch (file.kind) {
842
881
  case "ok":
843
882
  if (file.bytes.length === 0) return fail({ kind: "usage", message: `${filePath} is empty.` });
844
- out.push({ path: filePath, fileName, mimeType, bytes: file.bytes });
883
+ out.push({ path: filePath, fileName, mimeType, content: { kind: "bytes", bytes: file.bytes } });
884
+ break;
885
+ case "large":
886
+ out.push({ path: filePath, fileName, mimeType, content: { kind: "blob", blob: file.blob, sizeBytes: file.sizeBytes } });
845
887
  break;
846
888
  case "missing":
847
889
  return fail({ kind: "usage", message: `${filePath}: no such file.` });
848
890
  case "not_a_file":
849
891
  return fail({ kind: "usage", message: `${filePath} is a folder, not a file.` });
850
892
  case "too_large":
851
- return fail({ kind: "usage", message: `${filePath} is ${formatSize(file.sizeBytes)}; a file can be at most ${formatSize(MAX_FILE_BYTES)}. Share a link with attach_url instead, or make it smaller.` });
893
+ return fail({ kind: "usage", message: `${filePath} is ${formatSize(file.sizeBytes)}; a file can be at most ${formatSize(MAX_LARGE_FILE_BYTES)} from here. Add it in the Listspace app instead, or make it smaller.` });
852
894
  case "unreadable":
853
895
  return fail({ kind: "unexpected", message: `Could not read ${filePath}: ${file.reason}` });
854
896
  default: {
@@ -864,9 +906,8 @@ async function attachCommand(client, input) {
864
906
  const results = [];
865
907
  const raw = [];
866
908
  for (const file of input.files) {
867
- const body = { filename: file.fileName, mime_type: file.mimeType, content_base64: Buffer.from(file.bytes).toString("base64") };
868
909
  try {
869
- const answer = await client.data("POST", `/items/${path(input.item)}/attachments`, attached, { body });
910
+ const answer = await attachOne(client, input.item, file);
870
911
  results.push(answer.value);
871
912
  raw.push(answer.raw);
872
913
  } catch (error) {
@@ -877,6 +918,24 @@ async function attachCommand(client, input) {
877
918
  }
878
919
  return { raw: { data: raw }, text: formatAttached(results) };
879
920
  }
921
+ async function attachOne(client, item2, file) {
922
+ switch (file.content.kind) {
923
+ case "bytes": {
924
+ const body = { filename: file.fileName, mime_type: file.mimeType, content_base64: Buffer.from(file.content.bytes).toString("base64") };
925
+ return client.data("POST", `/items/${path(item2)}/attachments`, attached, { body });
926
+ }
927
+ case "blob": {
928
+ const link = await client.data("POST", `/items/${path(item2)}/upload-links`, largeUploadLink, { body: { filename: file.fileName, size_bytes: file.content.sizeBytes } });
929
+ if (link.value.finish_url === null) return fail({ kind: "unexpected", message: "Listspace answered without a link to finish a large upload. Update the CLI, or the server is older than it." });
930
+ await client.putToStorage(link.value.upload_url, file.content.blob);
931
+ return client.finishUpload(link.value.finish_url, attached);
932
+ }
933
+ default: {
934
+ const exhaustive = file.content;
935
+ return exhaustive;
936
+ }
937
+ }
938
+ }
880
939
 
881
940
  // src/tools.ts
882
941
  var UUID2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
@@ -1089,9 +1148,12 @@ Every MCP tool (the same tools, levels and results as the MCP server)
1089
1148
 
1090
1149
  Files from this computer (needs level 4, Act; a file cannot wait in the Inbox)
1091
1150
  attach <item> <file> [<file>...]
1092
- Upload files to an item, at most 8 MB each:
1093
- images, PDF, Office files, text, Markdown, CSV,
1094
- JSON, archives, audio and video.
1151
+ Upload files to an item: images, PDF, Office
1152
+ files, text, Markdown, CSV, JSON, archives, audio
1153
+ and video. Up to the plan's size of one file
1154
+ (Free 25 MB, Pro 2 GB, a team's boards 5 GB), at
1155
+ most 4 GB from here; over 8 MB the file goes
1156
+ straight to file storage.
1095
1157
 
1096
1158
  Work on your own (needs level 4, Act; other agents leave a claimed item alone)
1097
1159
  next <board> [--kinds todo,backlog] [--label <id>] [--no-move] [--ttl <minutes>]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listspace",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Listspace from the command line: the agentic project memory, for people and coding agents.",
5
5
  "keywords": [
6
6
  "listspace",