@erdoai/cli 0.26.0 → 0.27.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.
Files changed (2) hide show
  1. package/dist/index.js +50 -24
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2023,34 +2023,60 @@ attnCmd.command("list").description("List attention items").option("--status <st
2023
2023
  }
2024
2024
  );
2025
2025
  attnCmd.command("respond <id>").description(
2026
- `Respond to an attention item. A choice answer's shape is {"<question_id>": ["<option>", ...]}. Answering a choice mapped to experiment variants records your pick as a human comparison in the calibration ledger.`
2027
- ).option("--answer <json>", `a JSON answer, e.g. '{"q1":["option-a"]}'`).option("--ack", "mark read / acknowledge").option("--dismiss", "dismiss the item").action(async (id, opts) => {
2028
- try {
2029
- const given = [opts.answer !== void 0, !!opts.ack, !!opts.dismiss].filter(Boolean).length;
2030
- if (given !== 1) {
2031
- fail(new Error("provide exactly one of --answer, --ack, or --dismiss"));
2032
- }
2033
- let input;
2034
- if (opts.answer !== void 0) {
2035
- let parsed;
2036
- try {
2037
- parsed = JSON.parse(opts.answer);
2038
- } catch {
2039
- throw new Error(
2040
- `--answer must be valid JSON, e.g. '{"<question_id>": ["<option>", ...]}'`
2026
+ `Respond to an attention item. A choice answer's shape is {"<question_id>": ["<option>", ...]}. Answering a choice mapped to experiment variants records your pick as a human comparison in the calibration ledger. Use --flag-broken to flag one or more variants as broken (recorded as defect observations judge generation reads) \u2014 on its own or alongside --answer.`
2027
+ ).option("--answer <json>", `a JSON answer, e.g. '{"q1":["option-a"]}'`).option(
2028
+ "--flag-broken <json>",
2029
+ 'flag choice variants as broken: JSON array [{"variant_key":"...","reason":"..."}]'
2030
+ ).option("--ack", "mark read / acknowledge").option("--dismiss", "dismiss the item").action(
2031
+ async (id, opts) => {
2032
+ try {
2033
+ if (opts.ack || opts.dismiss) {
2034
+ if (opts.ack && opts.dismiss) {
2035
+ fail(new Error("provide only one of --ack or --dismiss"));
2036
+ }
2037
+ if (opts.answer !== void 0 || opts.flagBroken !== void 0) {
2038
+ fail(new Error("--answer / --flag-broken cannot be combined with --ack or --dismiss"));
2039
+ }
2040
+ print(
2041
+ await new ErdoClient().respondAttentionItem(id, {
2042
+ action: opts.ack ? "acknowledge" : "dismiss"
2043
+ })
2041
2044
  );
2045
+ return;
2042
2046
  }
2043
- input = { action: "answer", answer: parsed };
2044
- } else if (opts.ack) {
2045
- input = { action: "acknowledge" };
2046
- } else {
2047
- input = { action: "dismiss" };
2047
+ if (opts.answer === void 0 && opts.flagBroken === void 0) {
2048
+ fail(new Error("provide one of --answer, --flag-broken, --ack, or --dismiss"));
2049
+ }
2050
+ const input = { action: "answer" };
2051
+ if (opts.answer !== void 0) {
2052
+ try {
2053
+ input.answer = JSON.parse(opts.answer);
2054
+ } catch {
2055
+ throw new Error(
2056
+ `--answer must be valid JSON, e.g. '{"<question_id>": ["<option>", ...]}'`
2057
+ );
2058
+ }
2059
+ }
2060
+ if (opts.flagBroken !== void 0) {
2061
+ let parsed;
2062
+ try {
2063
+ parsed = JSON.parse(opts.flagBroken);
2064
+ } catch {
2065
+ throw new Error(
2066
+ `--flag-broken must be valid JSON, e.g. '[{"variant_key":"b","reason":"clipped hero"}]'`
2067
+ );
2068
+ }
2069
+ if (!Array.isArray(parsed)) {
2070
+ throw new Error('--flag-broken must be a JSON array of {"variant_key","reason"} objects');
2071
+ }
2072
+ input.defects = parsed;
2073
+ }
2074
+ print(await new ErdoClient().respondAttentionItem(id, input));
2075
+ } catch (e) {
2076
+ fail(e);
2048
2077
  }
2049
- print(await new ErdoClient().respondAttentionItem(id, input));
2050
- } catch (e) {
2051
- fail(e);
2052
2078
  }
2053
- });
2079
+ );
2054
2080
  var reviewsCmd = program.command("reviews").description(
2055
2081
  "The Knowledge Review queue \u2014 knowledge patches the critic proposes, investigations, and deduplicated failure signals awaiting a human decision"
2056
2082
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {