@erdoai/cli 0.58.0 → 0.59.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.
- package/dist/index.js +67 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -579,6 +579,14 @@ var ErdoClient = class {
|
|
|
579
579
|
input
|
|
580
580
|
);
|
|
581
581
|
}
|
|
582
|
+
// --- page feedback ---
|
|
583
|
+
// Structured client page-feedback intake. Each item names its page by
|
|
584
|
+
// experiment_slug + variant_key and mints a 'defect' observation (judge_slug
|
|
585
|
+
// human:<you>) on the ledger with the feedback text stored verbatim as the
|
|
586
|
+
// reason — the same channel respondAttentionItem's defects flag writes to.
|
|
587
|
+
recordPageFeedback(items) {
|
|
588
|
+
return this.request("POST", "/v1/page-feedback", { items });
|
|
589
|
+
}
|
|
582
590
|
// --- activity feed ---
|
|
583
591
|
// The unified, ranked, read-only feed. It defaults to attention items,
|
|
584
592
|
// approvals, and workstream events; catalog and execution history are opt-in.
|
|
@@ -2077,7 +2085,7 @@ expCmd.command("create").description("Create an experiment with its variants, ev
|
|
|
2077
2085
|
}
|
|
2078
2086
|
}
|
|
2079
2087
|
);
|
|
2080
|
-
expCmd.command("observations <slug>").description("Read an experiment's observation log (
|
|
2088
|
+
expCmd.command("observations <slug>").description("Read an experiment's observation log (metrics / decisions / actions / judge forecasts / defects)").option("--variant <key>", "filter to one variant").option("--type <type>", "metric_read, decision_check, action_taken, prediction, comparison, defect").option("--judge <slug>", "filter to one judge's forecasts within this experiment").option("-n, --limit <n>", "max rows", (v) => parseInt(v, 10)).action(
|
|
2081
2089
|
async (slug, opts) => {
|
|
2082
2090
|
try {
|
|
2083
2091
|
print(
|
|
@@ -3105,6 +3113,64 @@ attnCmd.command("respond <id>").description(
|
|
|
3105
3113
|
}
|
|
3106
3114
|
}
|
|
3107
3115
|
);
|
|
3116
|
+
var pageFeedbackCmd = program.command("page-feedback").description(
|
|
3117
|
+
"Structured client page-feedback intake \u2014 mints defect observations bound to a page's experiment variant"
|
|
3118
|
+
);
|
|
3119
|
+
pageFeedbackCmd.command("record").description(
|
|
3120
|
+
"Record one or more page-feedback items. Each item's feedback text is stored VERBATIM as the resulting defect observation's reason \u2014 no summarizing or rewriting happens here. Use --experiment/--variant/--feedback for a single item, or --items for a whole round."
|
|
3121
|
+
).option("--experiment <slug>", "experiment slug or uuid the page belongs to (single-item form)").option("--variant <key>", "the page variant this feedback is about (single-item form)").option(
|
|
3122
|
+
"--feedback <text>",
|
|
3123
|
+
"the client's own words, stored byte-for-byte as supplied (single-item form)"
|
|
3124
|
+
).option(
|
|
3125
|
+
"--image-key <key>",
|
|
3126
|
+
"optional bucket_key from a prior image upload, anchoring this item to an image (single-item form)"
|
|
3127
|
+
).option(
|
|
3128
|
+
"--items <json>",
|
|
3129
|
+
`a whole feedback round as JSON, or @path to a JSON file: '[{"experiment_slug":"...","variant_key":"...","feedback":"..."}]'`
|
|
3130
|
+
).action(
|
|
3131
|
+
async (opts) => {
|
|
3132
|
+
try {
|
|
3133
|
+
const singleGiven = opts.experiment !== void 0 || opts.variant !== void 0 || opts.feedback !== void 0 || opts.imageKey !== void 0;
|
|
3134
|
+
if (opts.items !== void 0 && singleGiven) {
|
|
3135
|
+
fail(
|
|
3136
|
+
new Error(
|
|
3137
|
+
"provide either --items or the single-item flags (--experiment/--variant/--feedback/--image-key), not both"
|
|
3138
|
+
)
|
|
3139
|
+
);
|
|
3140
|
+
}
|
|
3141
|
+
let items;
|
|
3142
|
+
if (opts.items !== void 0) {
|
|
3143
|
+
let parsed;
|
|
3144
|
+
try {
|
|
3145
|
+
parsed = JSON.parse(readMaybeFile(opts.items));
|
|
3146
|
+
} catch {
|
|
3147
|
+
throw new Error(
|
|
3148
|
+
`--items must be valid JSON (or @path to a JSON file), e.g. '[{"experiment_slug":"...","variant_key":"...","feedback":"..."}]'`
|
|
3149
|
+
);
|
|
3150
|
+
}
|
|
3151
|
+
if (!Array.isArray(parsed)) {
|
|
3152
|
+
throw new Error("--items must be a JSON array of {experiment_slug, variant_key, feedback} objects");
|
|
3153
|
+
}
|
|
3154
|
+
items = parsed;
|
|
3155
|
+
} else {
|
|
3156
|
+
if (!opts.experiment || !opts.variant || !opts.feedback) {
|
|
3157
|
+
throw new Error("provide --items, or all of --experiment, --variant, --feedback");
|
|
3158
|
+
}
|
|
3159
|
+
items = [
|
|
3160
|
+
{
|
|
3161
|
+
experiment_slug: opts.experiment,
|
|
3162
|
+
variant_key: opts.variant,
|
|
3163
|
+
feedback: opts.feedback,
|
|
3164
|
+
image_bucket_key: opts.imageKey
|
|
3165
|
+
}
|
|
3166
|
+
];
|
|
3167
|
+
}
|
|
3168
|
+
print(await new ErdoClient().recordPageFeedback(items));
|
|
3169
|
+
} catch (e) {
|
|
3170
|
+
fail(e);
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
);
|
|
3108
3174
|
function activityLine(it) {
|
|
3109
3175
|
const handle = it.slug || it.id;
|
|
3110
3176
|
const parts = [it.title || it.type];
|