@nodii/dev 0.6.135 → 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,16 +210,17 @@ 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
216
218
  figma submit CHANGE_SET --file SUBMIT.json [--sync] [--dry-run] [--lane-reads FILE]
217
219
  # --dry-run (submit and resubmit) runs Dev's dry run of the
218
220
  # submit gate on the same body, as design check --change-set; never writes
219
- # --lane-reads (submit, resubmit, --dry-run): Dev runs no job and answers on
220
- # the request from your MCP and REST reads; 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
221
+ # --lane-reads (submit, resubmit, --dry-run): Dev runs the gate on your MCP and
222
+ # REST reads as a polled job (no Figma call; --sync answers on the request); it names any read it still needs
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.135";
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/design.js CHANGED
@@ -482,8 +482,8 @@ function mergedReports(reports) {
482
482
  */
483
483
  export async function designCheckChangeSet(target, flags, { request = devRequest, send, progress, read = (f) => readFile(f, "utf8"), laneReads, split = false } = {}) {
484
484
  const id = flags["change-set"];
485
- // On the lane's reads Dev answers on the request, with no job (hub-295).
486
- const sync = laneReads ? true : submitMode(flags);
485
+ // On the lane's reads too Dev runs the dry run as a job (hub-448); --sync sends the plain call.
486
+ const sync = submitMode(flags);
487
487
  if (id === true || !id) throw new CliError("USAGE", "--change-set needs a change set id, e.g. --change-set CS-123", 2);
488
488
  if (target !== undefined) throw new CliError("USAGE", "design check --change-set CS takes no file: Dev checks the set's own items", 2);
489
489
  if (flags["figma-version"] === true) throw new CliError("USAGE", "--figma-version needs a version id", 2);
package/dist/figma.js CHANGED
@@ -368,9 +368,10 @@ export async function figmaResubmit(id, file, { request = devRequest, read = (f)
368
368
  }
369
369
  const body = assertContext(resubmitPayload(text, file), { resubmit: true, file });
370
370
  try {
371
- // On the lane's reads Dev answers on the request, with no job (hub-295).
371
+ // On the lane's reads Dev runs the gate as a submit job too (hub-448), so
372
+ // they go async like any re-submit; --sync still sends the plain call.
372
373
  const reads = await laneReadsBody(id, laneReads, { request, ...(options.progress ? { progress: options.progress } : {}) });
373
- return await submitCall(id, "resubmit", { ...body, ...reads }, { request, ...options, ...(laneReads ? { sync: true } : {}) });
374
+ return await submitCall(id, "resubmit", { ...body, ...reads }, { request, ...options });
374
375
  } catch (error) {
375
376
  if (error?.code === "FIGMA_READS_NEEDED") throw laneReadsRefusal(error);
376
377
  const say = RESUBMIT_REFUSALS[error?.code];
@@ -754,10 +755,10 @@ export function checkSubmitPayload(payload, file = "the submit body") {
754
755
 
755
756
  export async function figmaSubmit(id, payload, { request = devRequest, file = "the submit body", laneReads, progress, ...options } = {}) {
756
757
  checkSubmitPayload(payload, file);
757
- // On the lane's reads Dev answers on the request, with no job (hub-295).
758
- const sync = laneReads ? { sync: true } : {};
758
+ // On the lane's reads Dev runs the gate as a submit job too (hub-448), so
759
+ // they go async like any submit; --sync still sends the plain call.
759
760
  const reads = await laneReadsBody(id, laneReads, { request, ...(progress ? { progress } : {}) });
760
- return changeSetCall(id, (method, path, body) => submitCall(id, "submit", body, { request, ...options, ...(progress ? { progress } : {}), ...sync }))(
761
+ return changeSetCall(id, (method, path, body) => submitCall(id, "submit", body, { request, ...options, ...(progress ? { progress } : {}) }))(
761
762
  "POST", `/api/v1/design/change-sets/${encode(id)}/submit`, { ...payload, ...reads }).catch((error) => {
762
763
  throw laneReadsRefusal(error);
763
764
  });
@@ -1042,16 +1043,19 @@ const WITHDRAW_ITEMS_REFUSALS = {
1042
1043
  * must already be back at the set's base version; apply then takes the
1043
1044
  * approved items alone, and the scopes only those items sat in are released.
1044
1045
  */
1045
- export async function figmaWithdrawItems(id, items, reason, { request = devRequest, laneReads, removedNodeIds } = {}) {
1046
+ export async function figmaWithdrawItems(id, items, reason, { request = devRequest, laneReads, removedNodeIds, ...upload } = {}) {
1046
1047
  if (!id || !items?.length) throw new CliError("USAGE", WITHDRAW_ITEMS_USAGE, 2);
1047
1048
  if (typeof reason !== "string" || !reason.trim()) throw new CliError("USAGE", `--reason needs a reason: ${WITHDRAW_ITEMS_USAGE}`, 2);
1048
1049
  const removed = removedNodeIds?.length ? removedNodeIds : null;
1049
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 });
1050
1054
  return await request("POST", `/api/v1/design/change-sets/${encode(id)}/withdraw-items`, {
1051
1055
  items,
1052
1056
  reason: reason.trim(),
1053
1057
  ...(removed ? { removedNodeIds: removed } : {}),
1054
- ...(laneReads ? { laneReads } : {}),
1058
+ ...reads,
1055
1059
  });
1056
1060
  } catch (error) {
1057
1061
  const say = WITHDRAW_ITEMS_REFUSALS[error?.code];
@@ -1060,6 +1064,16 @@ export async function figmaWithdrawItems(id, items, reason, { request = devReque
1060
1064
  }
1061
1065
  }
1062
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
+
1063
1077
  export const figmaWithdrawItemsText = (id, d = {}) => {
1064
1078
  const withdrawn = d.withdrawn ?? [];
1065
1079
  const released = d.released ?? [];
@@ -1077,7 +1091,10 @@ export const figmaWithdrawItemsText = (id, d = {}) => {
1077
1091
  // Dev in chunks of about this size, by id, so no submit body passes Dev's 32 MB
1078
1092
  // cap. Smaller reads still go inline. One read bigger than this goes up in
1079
1093
  // parts (laneReadsParts).
1080
- 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;
1081
1098
  const jsonBytes = (value) => Buffer.byteLength(JSON.stringify(value));
1082
1099
  // The lists that hold the bulk of a lane's reads; everything else rides in the
1083
1100
  // first chunk.
@@ -1124,8 +1141,9 @@ export function laneReadsChunks(reads, limit = LANE_READS_CHUNK_BYTES) {
1124
1141
  }
1125
1142
 
1126
1143
  // One part of a chunk that one read makes bigger than a chunk: about this many
1127
- // of the chunk's bytes, base64 encoded, under Dev's 16 MB request cap.
1128
- 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;
1129
1147
 
1130
1148
  /**
1131
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.135",
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": {