@nodii/dev 0.6.136 → 0.6.137

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/dist/cli.js CHANGED
@@ -55,6 +55,7 @@ import {
55
55
  figmaScopeSet,
56
56
  figmaScopeSetText,
57
57
  figmaSubmit,
58
+ figmaApplyLaneReads,
58
59
  figmaWithdrawItems,
59
60
  laneReadsRefusal,
60
61
  laneReadsScript,
@@ -199,7 +200,7 @@ Usage: nodii-dev <command> [options] [--json]
199
200
  figma scope add CHANGE_SET --scope KIND:ID [--scope ...] # widen a held set's scopes
200
201
  figma scope set CHANGE_SET --scope KIND:ID [--scope ...] [--lane-reads FILE]
201
202
  # narrow to exactly these; the rest frees. The gate runs on your
202
- # MCP and REST reads; reads over 8 MB go up to the set in chunks (hub-310)
203
+ # MCP and REST reads; reads over 1 MB go up to the set in chunks (hub-310)
203
204
  figma publish-plan FILE_KEY [--lane-reads FILE]
204
205
  # what to publish, and what to leave unchecked in Figma's dialog. With
205
206
  # --lane-reads Dev runs no job: it takes your MCP reads, and the version
@@ -209,7 +210,8 @@ Usage: nodii-dev <command> [options] [--json]
209
210
  # FIGMA_READS_NEEDED names a node to place, or a version it hasn't seen
210
211
  figma apply CHANGE_SET --lane-reads FILE
211
212
  # MW1-57.11: what you read through the Figma MCP, sent as data. Dev runs its
212
- # gates on it with no job and no Figma call; FIGMA_READS_NEEDED names what's missing
213
+ # gates on it with no job and no Figma call; FIGMA_READS_NEEDED names what's missing.
214
+ # Reads over 1 MB go up to the set in chunks first, as for submit (and withdraw)
213
215
  figma lane-reads-script --nodes ID[,ID]
214
216
  # prints the read-only use_figma script that gathers the nodes for --lane-reads
215
217
  figma check|log-write|submit|apply|abandon|release
@@ -218,7 +220,7 @@ Usage: nodii-dev <command> [options] [--json]
218
220
  # submit gate on the same body, as design check --change-set; never writes
219
221
  # --lane-reads (submit, resubmit, --dry-run): Dev runs the gate on your MCP and
220
222
  # REST reads as a polled job (no Figma call; --sync answers on the request); it names any read it still needs
221
- # reads over 8 MB go up to the set in chunks first (hub-310), and a chunk
223
+ # reads over 1 MB go up to the set in chunks first (hub-310), and a chunk
222
224
  # that drops is sent again; the dry run of a submit past 300 node ids
223
225
  # runs in parts and reports once
224
226
  # SUBMIT.json: { figmaVersion, writeUp, items: [{ figmaNodeId, change, context,
@@ -1515,12 +1517,9 @@ export async function main(argv = process.argv.slice(2)) {
1515
1517
  }
1516
1518
  if (action === "apply" && f["lane-reads"]) {
1517
1519
  const laneReads = await readLaneReads(f["lane-reads"]);
1520
+ const figmaVersion = f["figma-version"] && f["figma-version"] !== true ? f["figma-version"] : undefined;
1518
1521
  return emit(
1519
- await devRequest(
1520
- "POST",
1521
- `/api/v1/design/change-sets/${encode(rest[0])}/apply`,
1522
- { figmaVersion: f["figma-version"] && f["figma-version"] !== true ? f["figma-version"] : laneReads.figmaVersion, laneReads },
1523
- ).catch((error) => { throw laneReadsRefusal(error); }),
1522
+ await figmaApplyLaneReads(rest[0], laneReads, { figmaVersion }).catch((error) => { throw laneReadsRefusal(error); }),
1524
1523
  json,
1525
1524
  );
1526
1525
  }
package/dist/core.js CHANGED
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
4
4
  import { homedir, platform } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
6
 
7
- export const VERSION = "0.6.136";
7
+ export const VERSION = "0.6.137";
8
8
  export const configPath = () =>
9
9
  process.env.NODII_DEV_CONFIG_PATH ??
10
10
  join(homedir(), ".config/nodii-dev/config.json");
package/dist/figma.js CHANGED
@@ -1043,16 +1043,19 @@ const WITHDRAW_ITEMS_REFUSALS = {
1043
1043
  * must already be back at the set's base version; apply then takes the
1044
1044
  * approved items alone, and the scopes only those items sat in are released.
1045
1045
  */
1046
- export async function figmaWithdrawItems(id, items, reason, { request = devRequest, laneReads, removedNodeIds } = {}) {
1046
+ export async function figmaWithdrawItems(id, items, reason, { request = devRequest, laneReads, removedNodeIds, ...upload } = {}) {
1047
1047
  if (!id || !items?.length) throw new CliError("USAGE", WITHDRAW_ITEMS_USAGE, 2);
1048
1048
  if (typeof reason !== "string" || !reason.trim()) throw new CliError("USAGE", `--reason needs a reason: ${WITHDRAW_ITEMS_USAGE}`, 2);
1049
1049
  const removed = removedNodeIds?.length ? removedNodeIds : null;
1050
1050
  try {
1051
+ // NODII-DEV-CLI-126: reads over a chunk go up to the set first and are
1052
+ // named by readIds, so the withdraw's body stays inside edge's 30 s timer.
1053
+ const reads = await laneReadsBody(id, laneReads, { request, ...upload });
1051
1054
  return await request("POST", `/api/v1/design/change-sets/${encode(id)}/withdraw-items`, {
1052
1055
  items,
1053
1056
  reason: reason.trim(),
1054
1057
  ...(removed ? { removedNodeIds: removed } : {}),
1055
- ...(laneReads ? { laneReads } : {}),
1058
+ ...reads,
1056
1059
  });
1057
1060
  } catch (error) {
1058
1061
  const say = WITHDRAW_ITEMS_REFUSALS[error?.code];
@@ -1061,6 +1064,16 @@ export async function figmaWithdrawItems(id, items, reason, { request = devReque
1061
1064
  }
1062
1065
  }
1063
1066
 
1067
+ /**
1068
+ * Apply on the lane's reads (MW1-57.11): the reads' Figma version unless one
1069
+ * is named. Reads over a chunk go up to the set first and are named by
1070
+ * readIds, as submit does (NODII-DEV-CLI-126).
1071
+ */
1072
+ export async function figmaApplyLaneReads(id, laneReads, { request = devRequest, figmaVersion, ...upload } = {}) {
1073
+ const reads = await laneReadsBody(id, laneReads, { request, ...upload });
1074
+ return request("POST", `/api/v1/design/change-sets/${encode(id)}/apply`, { figmaVersion: figmaVersion ?? laneReads.figmaVersion, ...reads });
1075
+ }
1076
+
1064
1077
  export const figmaWithdrawItemsText = (id, d = {}) => {
1065
1078
  const withdrawn = d.withdrawn ?? [];
1066
1079
  const released = d.released ?? [];
@@ -1078,7 +1091,10 @@ export const figmaWithdrawItemsText = (id, d = {}) => {
1078
1091
  // Dev in chunks of about this size, by id, so no submit body passes Dev's 32 MB
1079
1092
  // cap. Smaller reads still go inline. One read bigger than this goes up in
1080
1093
  // parts (laneReadsParts).
1081
- export const LANE_READS_CHUNK_BYTES = 8 * 1024 * 1024;
1094
+ // NODII-DEV-CLI-126: 1 MB, not 8. Through nodii-edge a body takes 0.8 s at
1095
+ // 1 MB, 4.1 s at 3 MB and 19.1 s at 6 MB (hub-448, 14 Nov), under edge's 30 s
1096
+ // proxy timer, which counts the upload; an 8 MB chunk or inline body met it.
1097
+ export const LANE_READS_CHUNK_BYTES = 1024 * 1024;
1082
1098
  const jsonBytes = (value) => Buffer.byteLength(JSON.stringify(value));
1083
1099
  // The lists that hold the bulk of a lane's reads; everything else rides in the
1084
1100
  // first chunk.
@@ -1125,8 +1141,9 @@ export function laneReadsChunks(reads, limit = LANE_READS_CHUNK_BYTES) {
1125
1141
  }
1126
1142
 
1127
1143
  // One part of a chunk that one read makes bigger than a chunk: about this many
1128
- // of the chunk's bytes, base64 encoded, under Dev's 16 MB request cap.
1129
- export const LANE_READS_PART_BYTES = 6 * 1024 * 1024;
1144
+ // of the chunk's bytes, base64 encoded: 768 KB is about 1 MB on the wire, so a
1145
+ // part uploads as fast as a chunk (NODII-DEV-CLI-126).
1146
+ export const LANE_READS_PART_BYTES = 768 * 1024;
1130
1147
 
1131
1148
  /**
1132
1149
  * A chunk's JSON split by bytes into parts, each with the whole chunk's hash,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.136",
3
+ "version": "0.6.137",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {