@nodii/dev 0.6.96 → 0.6.97

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
@@ -809,7 +814,7 @@ export async function main(argv = process.argv.slice(2)) {
809
814
  refusePersonOnly(entry.operationId);
810
815
  const parsed = await readBody(f.body);
811
816
  const request = buildOperationRequest(entry, parseParams(f.param), parsed?.value);
812
- return emit(await devRawRequest(request.method, request.path, parsed?.text), json);
817
+ return emit(await devRawRequest(request.method, request.path, parsed?.text, "application/json", { headers: operationHeaders(entry, request, parsed?.text) }), json);
813
818
  }
814
819
  if (command === "login") return login(f, json);
815
820
  if (command === "logout") {
@@ -1104,6 +1109,22 @@ export async function main(argv = process.argv.slice(2)) {
1104
1109
  ),
1105
1110
  json,
1106
1111
  );
1112
+ // A notice only needs acknowledging. Answering a drift, request or question
1113
+ // decides it, so that stays the deliberate `api answerInboxItem`.
1114
+ if (action === "ack") {
1115
+ const [kind, id] = rest;
1116
+ if (!NOTICE_KINDS.includes(kind) || !id)
1117
+ throw new CliError("USAGE", `inbox ack needs <${NOTICE_KINDS.join("|")}> <id>`, 2);
1118
+ const path = `/api/v1/inbox/${encode(kind)}/${encode(id)}/answer`;
1119
+ const body = JSON.stringify({ bodyMd: f.note ? String(f.note) : "Acknowledged." });
1120
+ return emit(
1121
+ await devRawRequest("POST", path, body, "application/json", {
1122
+ headers: { "Idempotency-Key": idempotencyKey("inbox ack", kind, id) },
1123
+ }),
1124
+ json,
1125
+ `Acknowledged ${kind} ${id}.`,
1126
+ );
1127
+ }
1107
1128
  if (action === "show") {
1108
1129
  const [kind, id] = rest;
1109
1130
  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.97";
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
@@ -41,6 +41,7 @@ export const COMMAND_FLAGS = {
41
41
  "lane waits": ["machine"],
42
42
  "lane resume": ["override", "reason", "host-lost", "min-free-gb", "stagger-seconds", "profile", "class"],
43
43
  "lane transfer": ["reason", "to-agent"],
44
+ "inbox ack": ["note"],
44
45
  "lane stop": ["reason", "sweeper", "no-closeout", "no-closeout-push"],
45
46
  "lane closeout": ["reason"],
46
47
  "lane repo": ["repo", "branch", "worktree", "read-only", "reason"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.96",
3
+ "version": "0.6.97",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {