@nodii/dev 0.6.96 → 0.6.98

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/api.js CHANGED
@@ -171,9 +171,17 @@ export function flagsToOperation(entry, positional, flags) {
171
171
  return { params, body: schema ? body : undefined, consumed: pos };
172
172
  }
173
173
 
174
+ // Dev requires an Idempotency-Key on these, and a retry of the same call must be the same call.
175
+ const NEEDS_IDEMPOTENCY_KEY = new Set(["answerInboxItem"]);
176
+ export const idempotencyKey = (...parts) => createHash("sha256").update(JSON.stringify(parts)).digest("hex").slice(0, 32);
177
+
178
+ export const operationHeaders = (entry, request, text) =>
179
+ NEEDS_IDEMPOTENCY_KEY.has(entry.operationId) ? { "Idempotency-Key": idempotencyKey(request.method, request.path, text) } : {};
180
+
174
181
  export async function callOperation(entry, params, body) {
175
182
  const request = buildOperationRequest(entry, params, body);
176
- return devRawRequest(request.method, request.path, body === undefined ? undefined : JSON.stringify(body));
183
+ const text = body === undefined ? undefined : JSON.stringify(body);
184
+ return devRawRequest(request.method, request.path, text, "application/json", { headers: operationHeaders(entry, request, text) });
177
185
  }
178
186
 
179
187
  export const GROUPS = {
package/dist/cli.js CHANGED
@@ -83,6 +83,8 @@ import {
83
83
  GROUPS,
84
84
  buildOperationRequest,
85
85
  callOperation,
86
+ idempotencyKey,
87
+ operationHeaders,
86
88
  findFirstClass,
87
89
  flagsToOperation,
88
90
  refusePersonOnly,
@@ -120,6 +122,7 @@ import {
120
122
  import { superviseLane } from "./lane-supervisor.js";
121
123
  import { awsCli, superviseRemoteRun } from "./remote.js";
122
124
 
125
+ const NOTICE_KINDS = ["lane_wait", "lane_escalation", "credential_expiry"];
123
126
  const LANE_RUN_HOOKS = new Set(["nudge-pre", "nudge-stop", "lane-heartbeat", "session-start", "session-kind", "workflow-post"]);
124
127
 
125
128
  const HELP = `nodii-dev ${VERSION}
@@ -142,6 +145,8 @@ Usage: nodii-dev <command> [options] [--json]
142
145
  issues transition ISSUE --to STATUS [--reason TEXT] [--dev-check REF]
143
146
  # blocked and wont_do need --reason; done needs --dev-check
144
147
  inbox list|show
148
+ inbox ack <lane_wait|lane_escalation|credential_expiry> <id> [--note TEXT]
149
+ # acknowledge a notice; sending it again changes nothing
145
150
  drift file | request file
146
151
  drift accept <id> --decision DEC-nnnn [--reason TEXT] # staff or steward only (Dev refuses a lane)
147
152
  drift resolve <id> --reason TEXT # the operator resolution; staff or steward only
@@ -332,6 +337,7 @@ Usage: nodii-dev <command> [options] [--json]
332
337
  sync pending [--discard FILE --reason TEXT]
333
338
  # send the lane records queued while Dev was down (MW1-64); --discard drops
334
339
  # one Dev refuses for good, with a note on its lane
340
+ lane ready <key> --withdraw --reason TEXT # take READY back without closing the PR; a newer done check posts it again
335
341
  lane done-check <key> --evidence TEXT|URL # the done check is met; a launched run that exits after it ends finished
336
342
  lane subagent-quota <key> <n> # coordinator assigns 0-100 subagent slots
337
343
  lane cap <machine> <n> [--confirm-raise --reason TEXT]
@@ -809,7 +815,7 @@ export async function main(argv = process.argv.slice(2)) {
809
815
  refusePersonOnly(entry.operationId);
810
816
  const parsed = await readBody(f.body);
811
817
  const request = buildOperationRequest(entry, parseParams(f.param), parsed?.value);
812
- return emit(await devRawRequest(request.method, request.path, parsed?.text), json);
818
+ return emit(await devRawRequest(request.method, request.path, parsed?.text, "application/json", { headers: operationHeaders(entry, request, parsed?.text) }), json);
813
819
  }
814
820
  if (command === "login") return login(f, json);
815
821
  if (command === "logout") {
@@ -1104,6 +1110,22 @@ export async function main(argv = process.argv.slice(2)) {
1104
1110
  ),
1105
1111
  json,
1106
1112
  );
1113
+ // A notice only needs acknowledging. Answering a drift, request or question
1114
+ // decides it, so that stays the deliberate `api answerInboxItem`.
1115
+ if (action === "ack") {
1116
+ const [kind, id] = rest;
1117
+ if (!NOTICE_KINDS.includes(kind) || !id)
1118
+ throw new CliError("USAGE", `inbox ack needs <${NOTICE_KINDS.join("|")}> <id>`, 2);
1119
+ const path = `/api/v1/inbox/${encode(kind)}/${encode(id)}/answer`;
1120
+ const body = JSON.stringify({ bodyMd: f.note ? String(f.note) : "Acknowledged." });
1121
+ return emit(
1122
+ await devRawRequest("POST", path, body, "application/json", {
1123
+ headers: { "Idempotency-Key": idempotencyKey("inbox ack", kind, id) },
1124
+ }),
1125
+ json,
1126
+ `Acknowledged ${kind} ${id}.`,
1127
+ );
1128
+ }
1107
1129
  if (action === "show") {
1108
1130
  const [kind, id] = rest;
1109
1131
  if (!kind || !id)
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.96";
7
+ export const VERSION = "0.6.98";
8
8
  export const configPath = () =>
9
9
  process.env.NODII_DEV_CONFIG_PATH ??
10
10
  join(homedir(), ".config/nodii-dev/config.json");
package/dist/flags.js CHANGED
@@ -36,11 +36,13 @@ export const COMMAND_FLAGS = {
36
36
  "receipt verify": ["commit"],
37
37
  "sync pending": ["discard", "reason"],
38
38
  "lane done-check": ["evidence"],
39
+ "lane ready": ["withdraw", "reason"],
39
40
  "lane cap": ["confirm-raise", "reason"],
40
41
  "lane heartbeat": ["note", "waiting-on"],
41
42
  "lane waits": ["machine"],
42
43
  "lane resume": ["override", "reason", "host-lost", "min-free-gb", "stagger-seconds", "profile", "class"],
43
44
  "lane transfer": ["reason", "to-agent"],
45
+ "inbox ack": ["note"],
44
46
  "lane stop": ["reason", "sweeper", "no-closeout", "no-closeout-push"],
45
47
  "lane closeout": ["reason"],
46
48
  "lane repo": ["repo", "branch", "worktree", "read-only", "reason"],
package/dist/lanes.js CHANGED
@@ -905,6 +905,14 @@ export async function laneCommand(action, args, flags, deps = {}) {
905
905
  return { payload: { data: { queued: true, file } }, human: `${ref}: Dev is unreachable; ${body.kind} evidence is waiting at ${file}. Run nodii-dev sync pending before the lane closes (MW1-64).` };
906
906
  }
907
907
  }
908
+ // hub-277: READY is a done check and an open PR, so a lane can take it back
909
+ // without closing its PR. A newer done check posts READY again.
910
+ if (action === "ready") {
911
+ if (!flags.withdraw) throw new CliError("USAGE", "lane ready needs --withdraw: a lane posts READY by recording its done check and PR", 2);
912
+ const body = { kind: "ready_withdrawn", ref: requireFlag(flags, "reason") };
913
+ const payload = await request("POST", `/api/v1/lanes/${encode(id)}/evidence`, body);
914
+ return { payload, human: `${ref}: READY withdrawn. Record a done check to post it again.` };
915
+ }
908
916
  if (action === "done-check") {
909
917
  await assertNothingPending(ref);
910
918
  // NODII-DEV-CLI-4: the agent met the lane's done check. A launched run that
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.96",
3
+ "version": "0.6.98",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {