conduyt 1.13.0 → 1.15.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 +104 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1633,6 +1633,12 @@ ai
|
|
|
1633
1633
|
.description("AI-recommended next actions for a user (defaults to you; other users need admin/owner)")
|
|
1634
1634
|
.option("--user <id>", "user UUID")
|
|
1635
1635
|
.action(run(async (client, opts) => client.get(`/api/v1/ai/next-actions${buildQuery({ userId: opts.user })}`)));
|
|
1636
|
+
ai
|
|
1637
|
+
.command("agenda")
|
|
1638
|
+
.description("Today's agenda for a user: calendar, callbacks, replies waiting, tasks due, new leads, follow-ups, quiet deals, with a brief on top")
|
|
1639
|
+
.option("--user <id>", "user UUID (admins/owners only; defaults to you)")
|
|
1640
|
+
.option("--no-narrative", "skip the AI-composed brief (returns the deterministic one; spends no AI budget)")
|
|
1641
|
+
.action(run(async (client, opts) => client.get(`/api/v1/ai/agenda${buildQuery({ userId: opts.user, narrative: opts.narrative === false ? "0" : undefined })}`)));
|
|
1636
1642
|
ai
|
|
1637
1643
|
.command("daily-brief")
|
|
1638
1644
|
.description("Your AI daily brief (task-focused summary)")
|
|
@@ -2110,6 +2116,104 @@ ringGroups
|
|
|
2110
2116
|
}
|
|
2111
2117
|
return client.post("/api/v1/ring-groups/release-number", body);
|
|
2112
2118
|
}));
|
|
2119
|
+
// ---------------------------------------------------------------------------
|
|
2120
|
+
// Smart Views + Smart Dialing (#53). The dial-enabled Smart Views are the
|
|
2121
|
+
// Smart Dialing priorities: agents dial them one lead at a time, top to
|
|
2122
|
+
// bottom. Dialing settings + reorder are admin-only in the API.
|
|
2123
|
+
// ---------------------------------------------------------------------------
|
|
2124
|
+
const smartViews = program.command("smart-views").description("Smart Views and their Smart Dialing priorities");
|
|
2125
|
+
smartViews
|
|
2126
|
+
.command("list")
|
|
2127
|
+
.description("List Smart Views in sidebar order (= Smart Dialing priority) with lead counts and dialing settings")
|
|
2128
|
+
.option("--dialing", "only the dial-enabled views (the Smart Dialing priorities)")
|
|
2129
|
+
.action(run(async (client, opts) => {
|
|
2130
|
+
const views = (await client.get("/api/v1/smart-views"));
|
|
2131
|
+
const rows = Array.isArray(views) ? views : [];
|
|
2132
|
+
const sorted = [...rows].sort((a, b) => Number(a.sortPosition ?? 0) - Number(b.sortPosition ?? 0));
|
|
2133
|
+
return opts.dialing ? sorted.filter((v) => v.dialEnabled === true) : sorted;
|
|
2134
|
+
}));
|
|
2135
|
+
smartViews
|
|
2136
|
+
.command("dialing <id>")
|
|
2137
|
+
.description("Change one Smart View's Smart Dialing settings (PATCH — only the flags you pass change)")
|
|
2138
|
+
.option("--enable", "make this view a Smart Dialing priority")
|
|
2139
|
+
.option("--disable", "stop dialing this view")
|
|
2140
|
+
.option("--max-attempts <n>", "stop after N calls to a lead, ever (1-20)")
|
|
2141
|
+
.option("--per-day <n>", "most calls to one lead per account-local day (1-20); pass 'none' to remove the daily cap")
|
|
2142
|
+
.option("--cooldown <minutes>", "minutes to wait between calls to the same lead (0-10080)")
|
|
2143
|
+
.option("--schedule <json>", 'retry schedule JSON, e.g. \'[{"attemptNumber":1,"delayMinutes":0},{"attemptNumber":2,"delayMinutes":60}]\'')
|
|
2144
|
+
.action(run(async (client, id, opts) => {
|
|
2145
|
+
assertUuid(id, "smart view id");
|
|
2146
|
+
if (opts.enable && opts.disable)
|
|
2147
|
+
throw new Error("Pass --enable or --disable, not both.");
|
|
2148
|
+
const body = {};
|
|
2149
|
+
if (opts.enable)
|
|
2150
|
+
body.dialEnabled = true;
|
|
2151
|
+
if (opts.disable)
|
|
2152
|
+
body.dialEnabled = false;
|
|
2153
|
+
const intFlag = (raw, flag, min, max) => {
|
|
2154
|
+
if (raw === undefined)
|
|
2155
|
+
return undefined;
|
|
2156
|
+
const n = Number(raw);
|
|
2157
|
+
if (!Number.isInteger(n) || n < min || n > max)
|
|
2158
|
+
throw new Error(`${flag} must be an integer between ${min} and ${max}.`);
|
|
2159
|
+
return n;
|
|
2160
|
+
};
|
|
2161
|
+
const maxAttempts = intFlag(opts.maxAttempts, "--max-attempts", 1, 20);
|
|
2162
|
+
if (maxAttempts !== undefined)
|
|
2163
|
+
body.maxDialAttempts = maxAttempts;
|
|
2164
|
+
if (opts.perDay !== undefined) {
|
|
2165
|
+
body.maxDialAttemptsPerDay = opts.perDay.trim().toLowerCase() === "none" ? null : intFlag(opts.perDay, "--per-day", 1, 20);
|
|
2166
|
+
}
|
|
2167
|
+
const cooldown = intFlag(opts.cooldown, "--cooldown", 0, 10080);
|
|
2168
|
+
if (cooldown !== undefined)
|
|
2169
|
+
body.dialCooldownMinutes = cooldown;
|
|
2170
|
+
if (opts.schedule !== undefined) {
|
|
2171
|
+
let parsed;
|
|
2172
|
+
try {
|
|
2173
|
+
parsed = JSON.parse(opts.schedule);
|
|
2174
|
+
}
|
|
2175
|
+
catch {
|
|
2176
|
+
throw new Error("--schedule must be valid JSON.");
|
|
2177
|
+
}
|
|
2178
|
+
if (!Array.isArray(parsed) || parsed.length === 0 || parsed.length > 20)
|
|
2179
|
+
throw new Error("--schedule must be a JSON array of 1-20 steps.");
|
|
2180
|
+
for (const step of parsed) {
|
|
2181
|
+
if (!step || !Number.isInteger(step.attemptNumber) || Number(step.attemptNumber) < 1 || !Number.isInteger(step.delayMinutes) || Number(step.delayMinutes) < 0) {
|
|
2182
|
+
throw new Error("Each --schedule step needs attemptNumber (>= 1) and delayMinutes (>= 0).");
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
body.dialSchedule = parsed;
|
|
2186
|
+
}
|
|
2187
|
+
if (Object.keys(body).length === 0)
|
|
2188
|
+
throw new Error("Nothing to change. Pass --enable/--disable, --max-attempts, --per-day, --cooldown or --schedule.");
|
|
2189
|
+
return client.patch(`/api/v1/smart-views/${encodeURIComponent(id)}`, body);
|
|
2190
|
+
}));
|
|
2191
|
+
smartViews
|
|
2192
|
+
.command("dial-order [ids...]")
|
|
2193
|
+
.description("No ids: show the Smart Dialing priorities, uncapped (every dial-enabled view in dial order + candidates). With ids: set the priority order — every dial-enabled view id, first = dialed first (the server keeps non-priority views in their slots)")
|
|
2194
|
+
.action(run(async (client, ids) => {
|
|
2195
|
+
if (!ids || ids.length === 0)
|
|
2196
|
+
return client.get("/api/v1/smart-views/dial-order");
|
|
2197
|
+
if (ids.length > 2000)
|
|
2198
|
+
throw new Error("Pass at most 2000 Smart View ids.");
|
|
2199
|
+
if (new Set(ids).size !== ids.length)
|
|
2200
|
+
throw new Error("Smart View ids must not repeat.");
|
|
2201
|
+
for (const id of ids)
|
|
2202
|
+
assertUuid(id, "smart view id");
|
|
2203
|
+
return client.patch("/api/v1/smart-views/dial-order", { order: ids });
|
|
2204
|
+
}));
|
|
2205
|
+
smartViews
|
|
2206
|
+
.command("reorder <ids...>")
|
|
2207
|
+
.description("Set the SIDEBAR order of Smart Views. Pass EVERY view id; views left out keep a stale position. For the dialing priority use dial-order")
|
|
2208
|
+
.action(run(async (client, ids) => {
|
|
2209
|
+
if (ids.length === 0 || ids.length > 200)
|
|
2210
|
+
throw new Error("Pass 1-200 Smart View ids.");
|
|
2211
|
+
if (new Set(ids).size !== ids.length)
|
|
2212
|
+
throw new Error("Smart View ids must not repeat.");
|
|
2213
|
+
for (const id of ids)
|
|
2214
|
+
assertUuid(id, "smart view id");
|
|
2215
|
+
return client.patch("/api/v1/smart-views/reorder", { order: ids });
|
|
2216
|
+
}));
|
|
2113
2217
|
program.parseAsync(process.argv).catch(fail);
|
|
2114
2218
|
// helpers
|
|
2115
2219
|
// Parse a --json / --stages style argument, throwing a clear CLI error (caught
|
package/package.json
CHANGED