@letterstory/cli 0.31.0 → 0.31.1
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/lib/cli.mjs +1 -1
- package/lib/commands/lede.mjs +38 -1
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
} from "./commands.mjs";
|
|
45
45
|
|
|
46
46
|
// Keep in sync with cli/package.json.
|
|
47
|
-
export const VERSION = "0.31.
|
|
47
|
+
export const VERSION = "0.31.1";
|
|
48
48
|
|
|
49
49
|
// Flags that never take a value. Listing them explicitly means `deploy get --json <id>`
|
|
50
50
|
// can't accidentally swallow the id as --json's value.
|
package/lib/commands/lede.mjs
CHANGED
|
@@ -75,6 +75,22 @@ export const ARGS = {
|
|
|
75
75
|
days: { flag: "days", type: "num" },
|
|
76
76
|
limit: { flag: "limit", type: "num" },
|
|
77
77
|
},
|
|
78
|
+
// What actually happened to a lede after you sent it. The engine can measure
|
|
79
|
+
// everything up to handing the line over and nothing after, so this is the only
|
|
80
|
+
// path by which a send, a reply or a bad observation ever reaches it.
|
|
81
|
+
report_lede_outcome: {
|
|
82
|
+
run_id: { positional: 0, label: "run-id", required: true },
|
|
83
|
+
shipped_template_id: { flag: "shipped-template" },
|
|
84
|
+
sent: { value: (flags) => (flags.sent === true ? true : undefined) },
|
|
85
|
+
replied: { value: (flags) => (flags.replied === true ? true : undefined) },
|
|
86
|
+
reply_sentiment: { flag: "sentiment", enum: ["positive", "neutral", "negative"] },
|
|
87
|
+
flagged_wrong: { value: (flags) => (flags["flag-wrong"] === true ? true : undefined) },
|
|
88
|
+
flagged_reason: { flag: "reason" },
|
|
89
|
+
},
|
|
90
|
+
// Per line: picked, sent, replied, positive, flagged wrong.
|
|
91
|
+
lede_line_funnel: {
|
|
92
|
+
window_days: { flag: "days", type: "num" },
|
|
93
|
+
},
|
|
78
94
|
list_lede_endpoints: {},
|
|
79
95
|
get_lede_balance: {},
|
|
80
96
|
create_lede_endpoint: {
|
|
@@ -122,13 +138,34 @@ export async function cmdLede(ctx) {
|
|
|
122
138
|
return ledeEvals(rest);
|
|
123
139
|
case "balance":
|
|
124
140
|
return ledeBalance(rest);
|
|
141
|
+
case "outcome":
|
|
142
|
+
case "report":
|
|
143
|
+
return ledeOutcome(rest);
|
|
144
|
+
case "funnel":
|
|
145
|
+
return ledeFunnel(rest);
|
|
125
146
|
default:
|
|
126
147
|
throw new CliError(
|
|
127
|
-
`Unknown lede subcommand: ${sub ?? "(none)"}. Try: list, create, delete, endpoint, run, runs, history, evals, balance`
|
|
148
|
+
`Unknown lede subcommand: ${sub ?? "(none)"}. Try: list, create, delete, endpoint, run, runs, history, evals, balance, outcome, funnel`
|
|
128
149
|
);
|
|
129
150
|
}
|
|
130
151
|
}
|
|
131
152
|
|
|
153
|
+
async function ledeOutcome(ctx) {
|
|
154
|
+
const { client, flags, positionals, io } = ctx;
|
|
155
|
+
const args = argsFromFlags(ARGS.report_lede_outcome, flags, positionals);
|
|
156
|
+
const result = await client.callTool("report_lede_outcome", args);
|
|
157
|
+
ok(ctx, `Recorded the outcome for run ${args.run_id}.`);
|
|
158
|
+
printResult(io, flags, result);
|
|
159
|
+
return 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async function ledeFunnel(ctx) {
|
|
163
|
+
const { client, flags, io } = ctx;
|
|
164
|
+
const result = await client.callTool("lede_line_funnel", argsFromFlags(ARGS.lede_line_funnel, flags));
|
|
165
|
+
printResult(io, flags, result);
|
|
166
|
+
return 0;
|
|
167
|
+
}
|
|
168
|
+
|
|
132
169
|
async function ledeList(ctx) {
|
|
133
170
|
const { client, flags, io } = ctx;
|
|
134
171
|
const result = await client.callTool("list_lede_endpoints", argsFromFlags(ARGS.list_lede_endpoints, flags));
|