kenso 0.1.208 → 0.1.209
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/CHANGELOG.md +6 -0
- package/dist/discover.json +1 -1
- package/dist/kenso.js +737 -491
- package/dist/operations.index.json +1 -1
- package/dist/operations.json +1 -1
- package/docs/README.md +1 -0
- package/docs/batch.md +1 -0
- package/docs/images.md +49 -0
- package/docs/reference.md +27 -4
- package/package.json +2 -2
- package/skill/kenso-cli/SKILL.md +1 -0
- package/skill/shipped.json +2 -1
package/dist/kenso.js
CHANGED
|
@@ -1072,22 +1072,22 @@ var init_normalize_columns = __esm({
|
|
|
1072
1072
|
columns2 = newcolumns;
|
|
1073
1073
|
} else {
|
|
1074
1074
|
const newcolumns = [];
|
|
1075
|
-
for (const
|
|
1076
|
-
if (typeof
|
|
1075
|
+
for (const column2 of columns2) {
|
|
1076
|
+
if (typeof column2 === "string") {
|
|
1077
1077
|
newcolumns.push({
|
|
1078
|
-
key:
|
|
1079
|
-
header:
|
|
1078
|
+
key: column2,
|
|
1079
|
+
header: column2
|
|
1080
1080
|
});
|
|
1081
|
-
} else if (typeof
|
|
1082
|
-
if (!
|
|
1081
|
+
} else if (typeof column2 === "object" && column2 !== null && !Array.isArray(column2)) {
|
|
1082
|
+
if (!column2.key) {
|
|
1083
1083
|
return [
|
|
1084
1084
|
Error('Invalid column definition: property "key" is required')
|
|
1085
1085
|
];
|
|
1086
1086
|
}
|
|
1087
|
-
if (
|
|
1088
|
-
|
|
1087
|
+
if (column2.header === void 0) {
|
|
1088
|
+
column2.header = column2.key;
|
|
1089
1089
|
}
|
|
1090
|
-
newcolumns.push(
|
|
1090
|
+
newcolumns.push(column2);
|
|
1091
1091
|
} else {
|
|
1092
1092
|
return [
|
|
1093
1093
|
Error("Invalid column definition: expect a string or an object")
|
|
@@ -1591,7 +1591,7 @@ var init_api = __esm({
|
|
|
1591
1591
|
return;
|
|
1592
1592
|
}
|
|
1593
1593
|
let err;
|
|
1594
|
-
let headers = this.options.columns.map((
|
|
1594
|
+
let headers = this.options.columns.map((column2) => column2.header);
|
|
1595
1595
|
if (this.options.eof) {
|
|
1596
1596
|
[err, headers] = this.stringify(headers, true);
|
|
1597
1597
|
headers += this.options.record_delimiter;
|
|
@@ -3233,7 +3233,7 @@ function csvCell(value) {
|
|
|
3233
3233
|
return JSON.stringify(value);
|
|
3234
3234
|
}
|
|
3235
3235
|
function csvCells(row, columns2) {
|
|
3236
|
-
return isRecord(row) ? columns2.map((
|
|
3236
|
+
return isRecord(row) ? columns2.map((column2) => csvCell(getPath(row, column2.split(".")).value)) : [csvCell(row)];
|
|
3237
3237
|
}
|
|
3238
3238
|
function alignRows(rows) {
|
|
3239
3239
|
const widths = [];
|
|
@@ -3514,7 +3514,7 @@ var init_output = __esm({
|
|
|
3514
3514
|
}
|
|
3515
3515
|
}
|
|
3516
3516
|
}
|
|
3517
|
-
const rows = [columns2, ...records.map((record3) => columns2.map((
|
|
3517
|
+
const rows = [columns2, ...records.map((record3) => columns2.map((column2) => cellText(getPath(record3, column2.split(".")).value)))];
|
|
3518
3518
|
this.write(`${alignRows(rows)}
|
|
3519
3519
|
`);
|
|
3520
3520
|
}
|
|
@@ -3540,7 +3540,7 @@ var VERSION;
|
|
|
3540
3540
|
var init_version = __esm({
|
|
3541
3541
|
"src/core/version.ts"() {
|
|
3542
3542
|
"use strict";
|
|
3543
|
-
VERSION = true ? "0.1.
|
|
3543
|
+
VERSION = true ? "0.1.209" : "0.0.0-dev";
|
|
3544
3544
|
}
|
|
3545
3545
|
});
|
|
3546
3546
|
|
|
@@ -3837,9 +3837,9 @@ async function readAnswer(ctx) {
|
|
|
3837
3837
|
const lines = createInterface({ input: ctx.stdin ?? process.stdin, terminal: false });
|
|
3838
3838
|
let onAbort;
|
|
3839
3839
|
try {
|
|
3840
|
-
return await new Promise((
|
|
3841
|
-
lines.once("line",
|
|
3842
|
-
lines.once("close", () =>
|
|
3840
|
+
return await new Promise((resolve25, reject) => {
|
|
3841
|
+
lines.once("line", resolve25);
|
|
3842
|
+
lines.once("close", () => resolve25(""));
|
|
3843
3843
|
onAbort = () => reject(interrupted());
|
|
3844
3844
|
ctx.signal.addEventListener("abort", onAbort, { once: true });
|
|
3845
3845
|
});
|
|
@@ -4720,7 +4720,7 @@ function resultsToCsv(results) {
|
|
|
4720
4720
|
}
|
|
4721
4721
|
}
|
|
4722
4722
|
}
|
|
4723
|
-
const rows = results.map((result) => columns2.map((
|
|
4723
|
+
const rows = results.map((result) => columns2.map((column2) => cell(result[column2])));
|
|
4724
4724
|
return stringify([columns2, ...rows]);
|
|
4725
4725
|
}
|
|
4726
4726
|
function ndjson(results) {
|
|
@@ -4969,9 +4969,9 @@ async function readRun(dir3) {
|
|
|
4969
4969
|
return null;
|
|
4970
4970
|
}
|
|
4971
4971
|
if (!raw) return null;
|
|
4972
|
-
const { runId, command:
|
|
4972
|
+
const { runId, command: command92, createdAt, status } = raw;
|
|
4973
4973
|
if (typeof runId !== "string" || !RUN_ID_PATTERN.test(runId)) return null;
|
|
4974
|
-
if (typeof
|
|
4974
|
+
if (typeof command92 !== "string" || typeof createdAt !== "string") return null;
|
|
4975
4975
|
if (typeof status !== "string" || !STATUSES.includes(status)) return null;
|
|
4976
4976
|
let chunksDone = chunkList(raw.chunksDone) ?? [];
|
|
4977
4977
|
try {
|
|
@@ -4982,7 +4982,7 @@ async function readRun(dir3) {
|
|
|
4982
4982
|
const record3 = {
|
|
4983
4983
|
...raw,
|
|
4984
4984
|
runId,
|
|
4985
|
-
command:
|
|
4985
|
+
command: command92,
|
|
4986
4986
|
args: asRecord3(raw.args) ?? {},
|
|
4987
4987
|
createdAt,
|
|
4988
4988
|
status,
|
|
@@ -5042,11 +5042,11 @@ async function loadRun(runId, env = process.env) {
|
|
|
5042
5042
|
}
|
|
5043
5043
|
return run;
|
|
5044
5044
|
}
|
|
5045
|
-
async function findIdentical(
|
|
5045
|
+
async function findIdentical(command92, args, inputSha256, env, workspaceId, anyWorkspace = false) {
|
|
5046
5046
|
const identity = argsIdentity(args);
|
|
5047
5047
|
const runs = await listRuns(env);
|
|
5048
5048
|
return runs.filter(
|
|
5049
|
-
(run) => run.command ===
|
|
5049
|
+
(run) => run.command === command92 && (run.inputSha256 || void 0) === (inputSha256 || void 0) && (anyWorkspace || (run.workspaceId || void 0) === (workspaceId || void 0)) && argsIdentity(run.args) === identity
|
|
5050
5050
|
);
|
|
5051
5051
|
}
|
|
5052
5052
|
function isOtherLiveProcess(pid) {
|
|
@@ -5551,25 +5551,25 @@ var init_normalize_columns_array = __esm({
|
|
|
5551
5551
|
normalize_columns_array = function(columns2) {
|
|
5552
5552
|
const normalizedColumns = [];
|
|
5553
5553
|
for (let i = 0, l = columns2.length; i < l; i++) {
|
|
5554
|
-
const
|
|
5555
|
-
if (
|
|
5554
|
+
const column2 = columns2[i];
|
|
5555
|
+
if (column2 === void 0 || column2 === null || column2 === false) {
|
|
5556
5556
|
normalizedColumns[i] = { disabled: true };
|
|
5557
|
-
} else if (typeof
|
|
5558
|
-
normalizedColumns[i] = { name: `${
|
|
5559
|
-
} else if (is_object2(
|
|
5560
|
-
if (typeof
|
|
5557
|
+
} else if (typeof column2 === "string" || typeof column2 === "number") {
|
|
5558
|
+
normalizedColumns[i] = { name: `${column2}` };
|
|
5559
|
+
} else if (is_object2(column2)) {
|
|
5560
|
+
if (typeof column2.name !== "string") {
|
|
5561
5561
|
throw new CsvError2("CSV_OPTION_COLUMNS_MISSING_NAME", [
|
|
5562
5562
|
"Option columns missing name:",
|
|
5563
5563
|
`property "name" is required at position ${i}`,
|
|
5564
5564
|
"when column is an object literal"
|
|
5565
5565
|
]);
|
|
5566
5566
|
}
|
|
5567
|
-
normalizedColumns[i] =
|
|
5567
|
+
normalizedColumns[i] = column2;
|
|
5568
5568
|
} else {
|
|
5569
5569
|
throw new CsvError2("CSV_INVALID_COLUMN_DEFINITION", [
|
|
5570
5570
|
"Invalid column definition:",
|
|
5571
5571
|
"expect a string or a literal object,",
|
|
5572
|
-
`got ${JSON.stringify(
|
|
5572
|
+
`got ${JSON.stringify(column2)} at position ${i}`
|
|
5573
5573
|
]);
|
|
5574
5574
|
}
|
|
5575
5575
|
}
|
|
@@ -7394,31 +7394,31 @@ function idText(value) {
|
|
|
7394
7394
|
if (typeof value === "string" && value.trim() !== "") return value.trim();
|
|
7395
7395
|
return void 0;
|
|
7396
7396
|
}
|
|
7397
|
-
function looksLikeCsvHeader(text5,
|
|
7397
|
+
function looksLikeCsvHeader(text5, column2) {
|
|
7398
7398
|
const first = stripBom(text5).split("\n").map((l) => l.trim()).find((l) => l !== "");
|
|
7399
7399
|
if (first === void 0) return false;
|
|
7400
7400
|
if (first.includes(",")) return true;
|
|
7401
7401
|
const name = first.replace(/^"(.*)"$/, "$1");
|
|
7402
|
-
return name ===
|
|
7402
|
+
return name === column2 || name === "id" || name === "contactId";
|
|
7403
7403
|
}
|
|
7404
7404
|
async function readIds(pathOrDash, opts) {
|
|
7405
7405
|
const { path, bytes } = await readRaw(pathOrDash, opts?.stdin);
|
|
7406
7406
|
const text5 = bytes.toString("utf8");
|
|
7407
7407
|
const source = path === "-" ? "stdin" : pathOrDash;
|
|
7408
|
-
const
|
|
7408
|
+
const column2 = opts?.column?.trim() || void 0;
|
|
7409
7409
|
const ext = path === "-" ? "" : extname2(path).toLowerCase();
|
|
7410
7410
|
let format;
|
|
7411
7411
|
if (ext === ".csv" || ext === ".jsonl" || ext === ".ndjson") format = detectFormat(path, text5);
|
|
7412
7412
|
else if (stripBom(text5).trimStart().startsWith("{")) format = "jsonl";
|
|
7413
|
-
else format =
|
|
7413
|
+
else format = column2 !== void 0 || looksLikeCsvHeader(text5, column2) ? "csv" : "text";
|
|
7414
7414
|
if (format === "text") {
|
|
7415
7415
|
return stripBom(text5).split("\n").map((line) => line.trim()).filter((line) => line !== "");
|
|
7416
7416
|
}
|
|
7417
7417
|
const { headers, rows } = format === "csv" ? parseCsv(text5, source) : parseJsonl(text5, source);
|
|
7418
|
-
const key =
|
|
7418
|
+
const key = column2 ?? (headers.includes("id") ? "id" : headers.includes("contactId") ? "contactId" : void 0);
|
|
7419
7419
|
if (key === void 0 || !headers.includes(key)) {
|
|
7420
7420
|
throw usageError(
|
|
7421
|
-
`${source} has no ${
|
|
7421
|
+
`${source} has no ${column2 ? `"${column2}"` : '"id" or "contactId"'} column (columns: ${headers.join(", ") || "none"}).`,
|
|
7422
7422
|
{ field: "column", hint: "Name the id column with --column <name>, or pass one id per line." }
|
|
7423
7423
|
);
|
|
7424
7424
|
}
|
|
@@ -8578,8 +8578,8 @@ function mapColumns(headers, aliases) {
|
|
|
8578
8578
|
return { sources, mapping, ignored };
|
|
8579
8579
|
}
|
|
8580
8580
|
function firstValue(row, columns2) {
|
|
8581
|
-
for (const
|
|
8582
|
-
const value = row[
|
|
8581
|
+
for (const column2 of columns2 ?? []) {
|
|
8582
|
+
const value = row[column2];
|
|
8583
8583
|
if (value === void 0 || value === null) continue;
|
|
8584
8584
|
if (typeof value === "string") {
|
|
8585
8585
|
const text5 = value.trim();
|
|
@@ -8615,8 +8615,8 @@ function idValue(value, field) {
|
|
|
8615
8615
|
function shellQuote3(arg) {
|
|
8616
8616
|
return /^[A-Za-z0-9_./:=@%+,-]+$/.test(arg) ? arg : `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
8617
8617
|
}
|
|
8618
|
-
function commandLine2(ctx,
|
|
8619
|
-
const parts2 = ["kenso", ...
|
|
8618
|
+
function commandLine2(ctx, command92, args, extra = []) {
|
|
8619
|
+
const parts2 = ["kenso", ...command92.split(" "), ...(args.positionals ?? []).map(shellQuote3)];
|
|
8620
8620
|
for (const [name, value] of Object.entries(args.flags)) {
|
|
8621
8621
|
if (value === void 0 || value === false) continue;
|
|
8622
8622
|
if (value === true) parts2.push(`--${name}`);
|
|
@@ -8929,9 +8929,9 @@ function stringFlag2(flags, name) {
|
|
|
8929
8929
|
const text5 = value.trim();
|
|
8930
8930
|
return text5 === "" ? void 0 : text5;
|
|
8931
8931
|
}
|
|
8932
|
-
function requireFlag(flags, name,
|
|
8932
|
+
function requireFlag(flags, name, command92, hint) {
|
|
8933
8933
|
const value = stringFlag2(flags, name);
|
|
8934
|
-
if (value === void 0) throw usageError(`--${name} is required for ${
|
|
8934
|
+
if (value === void 0) throw usageError(`--${name} is required for ${command92}.`, { field: name, next: `${command92} --help`, ...hint ? { hint } : {} });
|
|
8935
8935
|
return value;
|
|
8936
8936
|
}
|
|
8937
8937
|
function positiveId(value) {
|
|
@@ -8940,8 +8940,8 @@ function positiveId(value) {
|
|
|
8940
8940
|
const id = Number(text5);
|
|
8941
8941
|
return Number.isSafeInteger(id) && id > 0 ? id : void 0;
|
|
8942
8942
|
}
|
|
8943
|
-
function idFlag(flags, name,
|
|
8944
|
-
const raw = requireFlag(flags, name,
|
|
8943
|
+
function idFlag(flags, name, command92) {
|
|
8944
|
+
const raw = requireFlag(flags, name, command92);
|
|
8945
8945
|
const id = positiveId(raw);
|
|
8946
8946
|
if (id === void 0) throw usageError(`--${name} must be a positive whole number (got "${raw}").`, { field: name });
|
|
8947
8947
|
return id;
|
|
@@ -8961,8 +8961,8 @@ function isDryRun(ctx) {
|
|
|
8961
8961
|
function shellQuote4(value) {
|
|
8962
8962
|
return /^[A-Za-z0-9_\-.,:/@=+%]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
|
|
8963
8963
|
}
|
|
8964
|
-
function sameCommand2(
|
|
8965
|
-
const parts2 = [
|
|
8964
|
+
function sameCommand2(command92, flags, ctx, extra = []) {
|
|
8965
|
+
const parts2 = [command92];
|
|
8966
8966
|
for (const [name, value] of Object.entries(flags)) {
|
|
8967
8967
|
if (value === void 0 || value === false) continue;
|
|
8968
8968
|
if (value === true) parts2.push(`--${name}`);
|
|
@@ -9201,14 +9201,14 @@ function viewId(flags) {
|
|
|
9201
9201
|
if (id === void 0) throw usageError(`--view takes a saved view's id (got "${raw}").`, { field: "view", next: "kenso views list" });
|
|
9202
9202
|
return id;
|
|
9203
9203
|
}
|
|
9204
|
-
function targetBody(flags, target2,
|
|
9204
|
+
function targetBody(flags, target2, command92) {
|
|
9205
9205
|
const ids2 = idList(flags, "ids");
|
|
9206
9206
|
const filter = filterBody(flags);
|
|
9207
9207
|
const view = viewId(flags);
|
|
9208
9208
|
const everything = flags.all === true;
|
|
9209
9209
|
const ways = [ids2, filter, view].filter((way) => way !== void 0).length;
|
|
9210
9210
|
if (ways > 1 || ways === 0 && !everything || ids2 !== void 0 && everything) {
|
|
9211
|
-
throw usageError(`Name the ${target2.plural} one way: --ids, --filter, --view, or --all for every ${target2.noun} in the workspace.`, { field: "ids", next: `${
|
|
9211
|
+
throw usageError(`Name the ${target2.plural} one way: --ids, --filter, --view, or --all for every ${target2.noun} in the workspace.`, { field: "ids", next: `${command92} --help` });
|
|
9212
9212
|
}
|
|
9213
9213
|
const exclude = idList(flags, "exclude-ids");
|
|
9214
9214
|
if (exclude !== void 0 && ids2 !== void 0) throw usageError("--exclude-ids goes with --filter, --view or --all.", { field: "exclude-ids" });
|
|
@@ -9230,14 +9230,14 @@ function tagSet(flags) {
|
|
|
9230
9230
|
return set2;
|
|
9231
9231
|
}
|
|
9232
9232
|
function requestBody(flags, target2, dryRun2) {
|
|
9233
|
-
const
|
|
9233
|
+
const command92 = `kenso ${target2.resource} bulk-update`;
|
|
9234
9234
|
const pairs = Array.isArray(flags.set) ? flags.set : typeof flags.set === "string" ? [flags.set] : [];
|
|
9235
9235
|
const tags = target2.tags ? tagSet(flags) : {};
|
|
9236
9236
|
if (pairs.length === 0 && Object.keys(tags).length === 0) {
|
|
9237
|
-
throw usageError(`--set${target2.tags ? " or --add-tag" : ""} is required for ${
|
|
9237
|
+
throw usageError(`--set${target2.tags ? " or --add-tag" : ""} is required for ${command92}.`, { field: "set", hint: "For example --set stage=engaged.", next: `${command92} --help` });
|
|
9238
9238
|
}
|
|
9239
9239
|
return {
|
|
9240
|
-
...targetBody(flags, target2,
|
|
9240
|
+
...targetBody(flags, target2, command92),
|
|
9241
9241
|
set: { ...parseSet(pairs, target2.aliases, target2.textFields), ...tags },
|
|
9242
9242
|
...dryRun2 ? { dryRun: true } : {},
|
|
9243
9243
|
...flags["overwrite-pinned"] === true ? { overwritePinned: true } : {}
|
|
@@ -9305,7 +9305,7 @@ function bulkUpdateCommand(target2) {
|
|
|
9305
9305
|
};
|
|
9306
9306
|
}
|
|
9307
9307
|
function bulkDeleteCommand(target2) {
|
|
9308
|
-
const
|
|
9308
|
+
const command92 = `kenso ${target2.resource} bulk-delete`;
|
|
9309
9309
|
return {
|
|
9310
9310
|
resource: target2.resource,
|
|
9311
9311
|
action: "bulk-delete",
|
|
@@ -9331,11 +9331,11 @@ function bulkDeleteCommand(target2) {
|
|
|
9331
9331
|
beta: { featureGates: { all: target2.featureGates } },
|
|
9332
9332
|
operationIds: [`${target2.resource}.bulk-delete`, "changes.get"],
|
|
9333
9333
|
dryRun: true,
|
|
9334
|
-
run: (ctx, { flags }) => runChange(ctx, flags, target2, "delete", `/v1/${target2.resource}/bulk-delete`, (dryRun2) => ({ ...targetBody(flags, target2,
|
|
9334
|
+
run: (ctx, { flags }) => runChange(ctx, flags, target2, "delete", `/v1/${target2.resource}/bulk-delete`, (dryRun2) => ({ ...targetBody(flags, target2, command92), dryRun: dryRun2 }))
|
|
9335
9335
|
};
|
|
9336
9336
|
}
|
|
9337
9337
|
async function applyPreview(ctx, flags, target2, action, raw) {
|
|
9338
|
-
const
|
|
9338
|
+
const command92 = `kenso ${target2.resource} bulk-${action}`;
|
|
9339
9339
|
const id = positiveId(raw);
|
|
9340
9340
|
if (id === void 0) throw usageError(`--change-id takes the id a dry run printed (got "${raw}").`, { field: "change-id" });
|
|
9341
9341
|
if (ctx.flags.yes !== true || ctx.flags.dryRun === true) {
|
|
@@ -9346,7 +9346,7 @@ async function applyPreview(ctx, flags, target2, action, raw) {
|
|
|
9346
9346
|
}
|
|
9347
9347
|
const extra = NEW_CHANGE_FLAGS.find((name) => flags[name] !== void 0 && flags[name] !== false && !(Array.isArray(flags[name]) && flags[name].length === 0));
|
|
9348
9348
|
if (extra !== void 0) {
|
|
9349
|
-
throw usageError(`--change-id applies the change as it was listed: leave out --${extra}.`, { field: extra, next: `${
|
|
9349
|
+
throw usageError(`--change-id applies the change as it was listed: leave out --${extra}.`, { field: extra, next: `${command92} --change-id ${id} --yes` });
|
|
9350
9350
|
}
|
|
9351
9351
|
const got = unwrap((await ctx.client.request({ method: "GET", path: `/v1/changes/${id}`, signal: ctx.signal })).body);
|
|
9352
9352
|
if (got.object !== void 0 && (got.object !== target2.resource || got.action !== action)) {
|
|
@@ -10100,7 +10100,7 @@ var init_auth = __esm({
|
|
|
10100
10100
|
var batch_default;
|
|
10101
10101
|
var init_batch = __esm({
|
|
10102
10102
|
"docs/batch.md"() {
|
|
10103
|
-
batch_default = '# Batch runs\n\nA batch command takes a file, sends its rows to Kenso in chunks, and prints one JSON summary. Every input row gets one line in a results file, every run can be resumed, and nothing is written until you pass `--yes`.\n\nThe batch commands:\n\n- `contacts import`, `update`, `remove`, `restore`, `pause`, `resume`, `tag`, `untag` ([Leads](leads.md))\n- `people import` and `accounts import` ([CRM](crm.md), beta)\n- `studio fill` ([Studio](studio.md), beta)\n- any generated command run with `--each <file>`, once per row (see below)\n\n## Plan, then apply\n\nWithout `--yes` a batch command plans and changes nothing. `--dry-run` asks for the plan explicitly. `--yes` applies. Passing both is a usage error. Two exceptions to the plan below: `studio fill` without `--yes` prints its credit estimate and `next`, with no run or `plan.json` ([Studio](studio.md)), and a non-GET `--each` without `--yes` or `--dry-run` is a usage error (exit 2) rather than a plan.\n\n```bash\nkenso contacts import --campaign 812 --file leads.csv --dry-run\nkenso contacts import --campaign 812 --file leads.csv --yes\n```\n\nThe dry run parses and checks every row, may call read-only endpoints (a campaign read, a credit estimate, a contacts search for `--where`), writes `plan.json`, and prints the plan:\n\n```json\n{"run":"r_ubqu7wtx","dryRun":true,"command":"contacts remove","rows":3,"valid":3,"invalid":0,"chunks":1,"chunkSize":1000,"source":"ids","count":3,"firstIds":[11,12,13],"next":"kenso contacts remove --ids ids.txt --yes","plan":"/home/you/.kenso/runs/r_ubqu7wtx/plan.json"}\n```\n\nEvery plan has `run`, `dryRun`, `command`, `rows`, `valid`, `invalid`, `chunks`, `chunkSize`, `next` (the exact command that applies it) and `plan` (the file), plus fields of its own command. It adds `invalidRows` when rows were refused, `chunksDone` when it continues an unfinished run, and `alreadyDone: true` when the apply would change nothing.\n\nA file the CLI cannot read stops the run before anything is planned, with `file_unreadable` (exit 2), the line at fault and a hint: `leads.csv line 3: a quote is not closed.`, `leads.csv does not exist.`, `rows.jsonl line 7 is not valid JSON.`\n\n## The summary\n\nAn applied run prints one JSON object:\n\n```json\n{"run":"r_ubqu7wtx","rows":3,"ok":2,"created":0,"updated":0,"skipped":{},"failed":0,"notFound":1,"invalid":0,"changed":2,"results":"/home/you/.kenso/runs/r_ubqu7wtx/results.csv","resultsNdjson":"/home/you/.kenso/runs/r_ubqu7wtx/results.ndjson","resumed":false,"durationMs":412,"undo":"kenso contacts restore --run r_ubqu7wtx"}\n```\n\n| Field | Meaning |\n|---|---|\n| `run` | The run id: `r_` and 8 characters |\n| `rows` | Input rows |\n| `ok`, `created`, `updated` | Rows that succeeded, by kind |\n| `skipped` | Rows Kenso left alone on purpose, counted by reason, for example `{"duplicate":12}` |\n| `failed`, `notFound`, `invalid` | Rows that did not go through: refused or errored, id not found, refused locally |\n| `changed` | Rows this invocation changed. 0 when a rerun had nothing left to do |\n| `results`, `resultsNdjson` | Absolute paths of the results files |\n| `invalidRows` | Path of `invalid.csv`, when rows were refused locally |\n| `resumed` | True when this invocation continued an earlier run |\n| `durationMs` | Wall time of this invocation |\n| `pending` | Rows without a result yet, when the run did not finish |\n| `stopped` | `{code, message, hint}` when a stop condition ended the run (for example `limit_reached`) |\n| `interrupted` | True after Ctrl-C |\n| `next` | `kenso runs resume <runId>` when the run can continue |\n\nCommands add their own fields: `contacts import` adds `campaignId` and `notSendable`, `contacts remove` adds `undo`, `people import` adds `matched`, `addedToAccounts` and `emailFindsQueued`, `accounts import` adds `researchQueued` and `researchWaitingCredits`, `studio fill` adds `templateId`, `runs` and the estimate.\n\nExit codes: 0 when every row succeeded or was skipped, 5 when some rows are `failed`, `not_found` or `invalid`, 6 when a limit stopped the run, 130 after Ctrl-C. The full table is in [Output and errors](output-and-errors.md).\n\n## The run folder\n\nEach run keeps its files in `~/.kenso/runs/<runId>/` (`KENSO_RUNS_DIR` moves the root), or in `--out <dir>` when you pass it. A run in `--out` is also linked under the runs folder, so `kenso runs` finds it. The folder is mode 0700 and its files 0600.\n\nThe CLI refuses (exit 2) a runs folder or `--out` folder that another user owns or that it cannot make 0700 (a runs folder of yours that others can write is made 0700 first; a sticky runs folder root owns, such as a Kenso sandbox\'s, passes). `kenso runs list` leaves out, and `kenso runs show` and `resume` refuse with `run_not_private`, a run whose folder or `run.json` another user owns or can write. On Windows, which has no such owners and modes, these checks are skipped.\n\n| File | What it holds |\n|---|---|\n| `run.json` | The command, its arguments, the input path and SHA-256, the workspace, the chunk plan and the status (`planned`, `running`, `done`, `failed`, `interrupted`) |\n| `state.json` | The chunks done so far, rewritten after every chunk |\n| `results.csv` | One line per input row: `row,status,id,reason,error`, then extra columns such as `email` or `sendable` |\n| `results.ndjson` | The same rows as JSON lines |\n| `invalid.csv` | Rows refused before sending, with the reason |\n| `plan.json` | The last dry run\'s plan |\n| `summary.json` | The last summary printed |\n\n`row` is the 1-based number of the data row in the input (the CSV header is not counted). `status` is one of `created`, `updated`, `ok`, `skipped`, `failed`, `not_found` or `invalid`.\n\n```bash\nkenso runs list\nkenso runs list --limit 5 -o json\nkenso runs show r_ubqu7wtx\n```\n\n## Rerun and resume\n\nA run is identified by its command, its arguments, the SHA-256 of its input file, the workspace and the chunk size. `--yes`, `--dry-run`, `--wait`, `--concurrency` and the output flags are not part of it. Running the same command again on the same file:\n\n- **continues an unfinished run** (interrupted, stopped or crashed): finished chunks are skipped and the summary says `"resumed":true`.\n- **answers from a finished run where every row succeeded:** it prints that run\'s summary with `"changed":0` and `"alreadyDone":true`, sends no writes and exits 0 (a command may still read first: `contacts import` reads the campaign, and `contacts update --match email` looks up the campaign\'s contacts).\n- **starts a new run** when the last one finished with failed or invalid rows, or when the file changed. Lead, people and account writes match existing records (an email in a campaign, a person by email or LinkedIn URL, an account by domain), so sending a row twice never creates a duplicate.\n\n`kenso runs resume <runId>` does the same from the run id: it rebuilds the command from `run.json` and runs it with `--yes` from the folder it started in. It replays only a batch command (`contacts import`, `update`, `remove`, `restore`, `pause`, `resume`, `tag` and `untag`, `people import`, `accounts import`, `studio fill`, or a command run with `--each`) and only the flags that command takes, never a `kenso work` run. It refuses when the input was stdin, or the file is gone or changed. Two processes cannot work on one run: the second gets `run_in_progress` (exit 7).\n\n```bash\nkenso runs resume r_ubqu7wtx\n```\n\n`studio fill` is the exception: a fill charges for every page it builds, so it never fills the same ids twice. See [Studio](studio.md).\n\n## Ctrl-C\n\nThe first Ctrl-C cancels the requests in flight and starts no new chunks. The CLI writes the state and prints the summary with `"interrupted":true` and `"next":"kenso runs resume <runId>"`, then exits 130. A chunk that did not finish is sent again when you resume, which is safe because the writes match existing records. A second Ctrl-C quits at once.\n\n## Chunks, concurrency and rate limits\n\n| Command | Rows per call | At once |\n|---|---|---|\n| `contacts import` | 1,000 | 1 per campaign |\n| `contacts update`, `remove`, `restore`, `pause`, `resume` | 1,000 | 4 (`--concurrency`) |\n| `contacts tag`, `untag` | 250 | 4 (`--concurrency`) |\n| `people import` | 200 | 4 (`--concurrency`) |\n| `accounts import` | 100 | 4 (`--concurrency`) |\n| `studio fill` | 500 ids per fill run | 1 |\n| `--each` | 1 | 4 (`--concurrency`) |\n\n`--concurrency` takes 1 to 16. When the API\'s `RateLimit-Remaining` header drops below 10, the CLI sends one chunk at a time until it is back above 30.\n\nRetries:\n\n- **429:** the CLI waits for `Retry-After` (at least 1 second, at most 60 seconds) plus a random 0 to 20%, so several agents on one key do not all retry at the same moment, and tries again, with up to 15 minutes of waiting per command. After that it exits 6 (`rate_limited`).\n- **502, 503, 504 and network errors:** up to 3 retries with backoff, for GET, PUT, PATCH and DELETE, and for the POST routes the CLI knows are safe to repeat.\n- **`contacts import`:** no quick retry. After a 5xx or a dropped connection it waits 130 seconds, longer than the gateway\'s request timeout, and resends the chunk once.\n- **`contacts remove`:** after a 5xx or a dropped connection it waits 2 seconds and resends once. Ids the first call already removed are reported `ok` (reason `already_removed`), so the undo still restores them.\n- **Other 4xx answers:** never retried. The row or chunk is marked `failed` with the API\'s code.\n\nKenso answers a bulk call with 200 even when some items fail, so the CLI reads each item\'s result and never trusts the HTTP status alone.\n\n## Progress\n\nProgress goes to stderr, at most one line every 2 seconds (`chunk 7/20, 7000 rows, 6 failed`), and only when stderr is a terminal or you pass `--progress`. An agent gets only the summary.\n\n## Run any API operation once per row: --each\n\nEvery generated command takes `--each <file>`, a CSV or JSONL file or `-` for stdin. The command runs once per row through the same engine: one results line per row, resume, `--concurrency`. Row keys fill the route, query and body by API name (`accountId`) or flag name (`account-id`). A blank cell is left out and the literal `null` sends null. A GET runs right away; any other method needs `--yes` or `--dry-run`.\n\n```bash\nkenso accounts update --each stages.csv --dry-run\nkenso accounts update --each stages.csv --yes --concurrency 8\n```\n\nWith `stages.csv`:\n\n```csv\naccountId,stage,overwritePinned\n501,engaged,true\n502,customer,true\n```\n\nEach row is `ok` on a 2xx answer (with the created or returned id), `not_found` on 404, `failed` otherwise, or `invalid` when a required value is missing.\n\n`--each` sends one request per row. Where the API has a bulk or batch route, call it once instead: `campaigns bulk-pause` and `campaigns bulk-resume` take up to 50 campaign ids and answer with one result per campaign, and `threads batch-messages` reads the messages of up to 50 email threads.\n\n```bash\nkenso campaigns bulk-pause --data \'{"ids": [812, 813, 814]}\' --dry-run\nkenso threads batch-messages --thread-ids thr_abc,thr_def\n```\n\n## The token-saving pattern for agents\n\n1. Pass a file path, never the rows: `--file leads.csv`.\n2. Run `--dry-run`, read the plan, then run its `next`.\n3. Read the summary. If `failed`, `notFound` and `invalid` are 0, you are done.\n4. Otherwise read only the problem rows, for example `grep -E \'^[0-9]+,(failed|not_found|invalid),\' results.csv | head -50`, or `invalid.csv`.\n';
|
|
10103
|
+
batch_default = '# Batch runs\n\nA batch command takes a file, sends its rows to Kenso in chunks, and prints one JSON summary. Every input row gets one line in a results file, every run can be resumed, and nothing is written until you pass `--yes`.\n\nThe batch commands:\n\n- `contacts import`, `update`, `remove`, `restore`, `pause`, `resume`, `tag`, `untag` ([Leads](leads.md))\n- `people import` and `accounts import` ([CRM](crm.md), beta)\n- `studio fill` ([Studio](studio.md), beta)\n- `images upload` ([Images](images.md), beta)\n- any generated command run with `--each <file>`, once per row (see below)\n\n## Plan, then apply\n\nWithout `--yes` a batch command plans and changes nothing. `--dry-run` asks for the plan explicitly. `--yes` applies. Passing both is a usage error. Two exceptions to the plan below: `studio fill` without `--yes` prints its credit estimate and `next`, with no run or `plan.json` ([Studio](studio.md)), and a non-GET `--each` without `--yes` or `--dry-run` is a usage error (exit 2) rather than a plan.\n\n```bash\nkenso contacts import --campaign 812 --file leads.csv --dry-run\nkenso contacts import --campaign 812 --file leads.csv --yes\n```\n\nThe dry run parses and checks every row, may call read-only endpoints (a campaign read, a credit estimate, a contacts search for `--where`), writes `plan.json`, and prints the plan:\n\n```json\n{"run":"r_ubqu7wtx","dryRun":true,"command":"contacts remove","rows":3,"valid":3,"invalid":0,"chunks":1,"chunkSize":1000,"source":"ids","count":3,"firstIds":[11,12,13],"next":"kenso contacts remove --ids ids.txt --yes","plan":"/home/you/.kenso/runs/r_ubqu7wtx/plan.json"}\n```\n\nEvery plan has `run`, `dryRun`, `command`, `rows`, `valid`, `invalid`, `chunks`, `chunkSize`, `next` (the exact command that applies it) and `plan` (the file), plus fields of its own command. It adds `invalidRows` when rows were refused, `chunksDone` when it continues an unfinished run, and `alreadyDone: true` when the apply would change nothing.\n\nA file the CLI cannot read stops the run before anything is planned, with `file_unreadable` (exit 2), the line at fault and a hint: `leads.csv line 3: a quote is not closed.`, `leads.csv does not exist.`, `rows.jsonl line 7 is not valid JSON.`\n\n## The summary\n\nAn applied run prints one JSON object:\n\n```json\n{"run":"r_ubqu7wtx","rows":3,"ok":2,"created":0,"updated":0,"skipped":{},"failed":0,"notFound":1,"invalid":0,"changed":2,"results":"/home/you/.kenso/runs/r_ubqu7wtx/results.csv","resultsNdjson":"/home/you/.kenso/runs/r_ubqu7wtx/results.ndjson","resumed":false,"durationMs":412,"undo":"kenso contacts restore --run r_ubqu7wtx"}\n```\n\n| Field | Meaning |\n|---|---|\n| `run` | The run id: `r_` and 8 characters |\n| `rows` | Input rows |\n| `ok`, `created`, `updated` | Rows that succeeded, by kind |\n| `skipped` | Rows Kenso left alone on purpose, counted by reason, for example `{"duplicate":12}` |\n| `failed`, `notFound`, `invalid` | Rows that did not go through: refused or errored, id not found, refused locally |\n| `changed` | Rows this invocation changed. 0 when a rerun had nothing left to do |\n| `results`, `resultsNdjson` | Absolute paths of the results files |\n| `invalidRows` | Path of `invalid.csv`, when rows were refused locally |\n| `resumed` | True when this invocation continued an earlier run |\n| `durationMs` | Wall time of this invocation |\n| `pending` | Rows without a result yet, when the run did not finish |\n| `stopped` | `{code, message, hint}` when a stop condition ended the run (for example `limit_reached`) |\n| `interrupted` | True after Ctrl-C |\n| `next` | `kenso runs resume <runId>` when the run can continue |\n\nCommands add their own fields: `contacts import` adds `campaignId` and `notSendable`, `contacts remove` adds `undo`, `people import` adds `matched`, `addedToAccounts` and `emailFindsQueued`, `accounts import` adds `researchQueued` and `researchWaitingCredits`, `studio fill` adds `templateId`, `runs` and the estimate.\n\nExit codes: 0 when every row succeeded or was skipped, 5 when some rows are `failed`, `not_found` or `invalid`, 6 when a limit stopped the run, 130 after Ctrl-C. The full table is in [Output and errors](output-and-errors.md).\n\n## The run folder\n\nEach run keeps its files in `~/.kenso/runs/<runId>/` (`KENSO_RUNS_DIR` moves the root), or in `--out <dir>` when you pass it. A run in `--out` is also linked under the runs folder, so `kenso runs` finds it. The folder is mode 0700 and its files 0600.\n\nThe CLI refuses (exit 2) a runs folder or `--out` folder that another user owns or that it cannot make 0700 (a runs folder of yours that others can write is made 0700 first; a sticky runs folder root owns, such as a Kenso sandbox\'s, passes). `kenso runs list` leaves out, and `kenso runs show` and `resume` refuse with `run_not_private`, a run whose folder or `run.json` another user owns or can write. On Windows, which has no such owners and modes, these checks are skipped.\n\n| File | What it holds |\n|---|---|\n| `run.json` | The command, its arguments, the input path and SHA-256, the workspace, the chunk plan and the status (`planned`, `running`, `done`, `failed`, `interrupted`) |\n| `state.json` | The chunks done so far, rewritten after every chunk |\n| `results.csv` | One line per input row: `row,status,id,reason,error`, then extra columns such as `email` or `sendable` |\n| `results.ndjson` | The same rows as JSON lines |\n| `invalid.csv` | Rows refused before sending, with the reason |\n| `plan.json` | The last dry run\'s plan |\n| `summary.json` | The last summary printed |\n\n`row` is the 1-based number of the data row in the input (the CSV header is not counted). `status` is one of `created`, `updated`, `ok`, `skipped`, `failed`, `not_found` or `invalid`.\n\n```bash\nkenso runs list\nkenso runs list --limit 5 -o json\nkenso runs show r_ubqu7wtx\n```\n\n## Rerun and resume\n\nA run is identified by its command, its arguments, the SHA-256 of its input file, the workspace and the chunk size. `--yes`, `--dry-run`, `--wait`, `--concurrency` and the output flags are not part of it. Running the same command again on the same file:\n\n- **continues an unfinished run** (interrupted, stopped or crashed): finished chunks are skipped and the summary says `"resumed":true`.\n- **answers from a finished run where every row succeeded:** it prints that run\'s summary with `"changed":0` and `"alreadyDone":true`, sends no writes and exits 0 (a command may still read first: `contacts import` reads the campaign, and `contacts update --match email` looks up the campaign\'s contacts).\n- **starts a new run** when the last one finished with failed or invalid rows, or when the file changed. Lead, people and account writes match existing records (an email in a campaign, a person by email or LinkedIn URL, an account by domain), so sending a row twice never creates a duplicate.\n\n`kenso runs resume <runId>` does the same from the run id: it rebuilds the command from `run.json` and runs it with `--yes` from the folder it started in. It replays only a batch command (`contacts import`, `update`, `remove`, `restore`, `pause`, `resume`, `tag` and `untag`, `people import`, `accounts import`, `studio fill`, or a command run with `--each`) and only the flags that command takes, never a `kenso work` run. It refuses when the input was stdin, or the file is gone or changed. Two processes cannot work on one run: the second gets `run_in_progress` (exit 7).\n\n```bash\nkenso runs resume r_ubqu7wtx\n```\n\n`studio fill` is the exception: a fill charges for every page it builds, so it never fills the same ids twice. See [Studio](studio.md).\n\n## Ctrl-C\n\nThe first Ctrl-C cancels the requests in flight and starts no new chunks. The CLI writes the state and prints the summary with `"interrupted":true` and `"next":"kenso runs resume <runId>"`, then exits 130. A chunk that did not finish is sent again when you resume, which is safe because the writes match existing records. A second Ctrl-C quits at once.\n\n## Chunks, concurrency and rate limits\n\n| Command | Rows per call | At once |\n|---|---|---|\n| `contacts import` | 1,000 | 1 per campaign |\n| `contacts update`, `remove`, `restore`, `pause`, `resume` | 1,000 | 4 (`--concurrency`) |\n| `contacts tag`, `untag` | 250 | 4 (`--concurrency`) |\n| `people import` | 200 | 4 (`--concurrency`) |\n| `accounts import` | 100 | 4 (`--concurrency`) |\n| `studio fill` | 500 ids per fill run | 1 |\n| `--each` | 1 | 4 (`--concurrency`) |\n\n`--concurrency` takes 1 to 16. When the API\'s `RateLimit-Remaining` header drops below 10, the CLI sends one chunk at a time until it is back above 30.\n\nRetries:\n\n- **429:** the CLI waits for `Retry-After` (at least 1 second, at most 60 seconds) plus a random 0 to 20%, so several agents on one key do not all retry at the same moment, and tries again, with up to 15 minutes of waiting per command. After that it exits 6 (`rate_limited`).\n- **502, 503, 504 and network errors:** up to 3 retries with backoff, for GET, PUT, PATCH and DELETE, and for the POST routes the CLI knows are safe to repeat.\n- **`contacts import`:** no quick retry. After a 5xx or a dropped connection it waits 130 seconds, longer than the gateway\'s request timeout, and resends the chunk once.\n- **`contacts remove`:** after a 5xx or a dropped connection it waits 2 seconds and resends once. Ids the first call already removed are reported `ok` (reason `already_removed`), so the undo still restores them.\n- **Other 4xx answers:** never retried. The row or chunk is marked `failed` with the API\'s code.\n\nKenso answers a bulk call with 200 even when some items fail, so the CLI reads each item\'s result and never trusts the HTTP status alone.\n\n## Progress\n\nProgress goes to stderr, at most one line every 2 seconds (`chunk 7/20, 7000 rows, 6 failed`), and only when stderr is a terminal or you pass `--progress`. An agent gets only the summary.\n\n## Run any API operation once per row: --each\n\nEvery generated command takes `--each <file>`, a CSV or JSONL file or `-` for stdin. The command runs once per row through the same engine: one results line per row, resume, `--concurrency`. Row keys fill the route, query and body by API name (`accountId`) or flag name (`account-id`). A blank cell is left out and the literal `null` sends null. A GET runs right away; any other method needs `--yes` or `--dry-run`.\n\n```bash\nkenso accounts update --each stages.csv --dry-run\nkenso accounts update --each stages.csv --yes --concurrency 8\n```\n\nWith `stages.csv`:\n\n```csv\naccountId,stage,overwritePinned\n501,engaged,true\n502,customer,true\n```\n\nEach row is `ok` on a 2xx answer (with the created or returned id), `not_found` on 404, `failed` otherwise, or `invalid` when a required value is missing.\n\n`--each` sends one request per row. Where the API has a bulk or batch route, call it once instead: `campaigns bulk-pause` and `campaigns bulk-resume` take up to 50 campaign ids and answer with one result per campaign, and `threads batch-messages` reads the messages of up to 50 email threads.\n\n```bash\nkenso campaigns bulk-pause --data \'{"ids": [812, 813, 814]}\' --dry-run\nkenso threads batch-messages --thread-ids thr_abc,thr_def\n```\n\n## The token-saving pattern for agents\n\n1. Pass a file path, never the rows: `--file leads.csv`.\n2. Run `--dry-run`, read the plan, then run its `next`.\n3. Read the summary. If `failed`, `notFound` and `invalid` are 0, you are done.\n4. Otherwise read only the problem rows, for example `grep -E \'^[0-9]+,(failed|not_found|invalid),\' results.csv | head -50`, or `invalid.csv`.\n';
|
|
10104
10104
|
}
|
|
10105
10105
|
});
|
|
10106
10106
|
|
|
@@ -10120,6 +10120,14 @@ var init_crm = __esm({
|
|
|
10120
10120
|
}
|
|
10121
10121
|
});
|
|
10122
10122
|
|
|
10123
|
+
// docs/images.md
|
|
10124
|
+
var images_default;
|
|
10125
|
+
var init_images = __esm({
|
|
10126
|
+
"docs/images.md"() {
|
|
10127
|
+
images_default = "# Images (beta)\n\nAn image variable is a `{{key}}` token a campaign's steps render as an image. A `per_prospect` variable has one image per lead. Kenso can generate those images, or you and your coding agent can make them your own way (an image tool, code, or SVG) and upload them. An upload costs no credits, and the generation job never replaces an uploaded image, also after a prompt change. Another upload, a regenerate or a workflow step that saves into the variable does.\n\nImages are in beta. A workspace with image variables turned off gets `404`.\n\n## Upload a folder of images\n\nName each file after its lead: the contact id (`21.png`) or the lead's email in the campaign (`ada@acme.io.svg`). Then plan and apply. Both first check that the campaign has the variable and that it is `per_prospect`, so a wrong key sends nothing:\n\n```bash\nkenso images upload --campaign 812 --variable hero_image ./images --dry-run\nkenso images upload --campaign 812 --variable hero_image ./images --yes\n```\n\nPNG, JPEG, WebP, GIF and SVG files upload, each at most 10 MB (an SVG at most 512 KB). Kenso converts an SVG to PNG, strips the image's metadata and scales it to at most 1200 px wide. Give an SVG a background: a transparent PNG can read badly in dark mode. A variable whose format is `gif` takes an animated GIF.\n\n## Upload from a CSV\n\nA CSV names the lead in a `contact_id` or `email` column and the image in a `file` column. A file path is relative to the CSV:\n\n```csv\ncontact_id,file\n21,images/ada.png\n22,images/bo.svg\n```\n\n```bash\nkenso images upload --campaign 812 --variable hero_image images.csv --yes\n```\n\n## What stays local\n\nThe plan keeps these rows out of the upload and lists them in `invalid.csv`:\n\n- a file that is not PNG, JPEG, WebP, GIF or SVG, an empty file, or one over 10 MB (`invalid`)\n- a name that is neither a contact id nor an email (`invalid`)\n- an email no lead of the campaign has (`not_found`)\n- a second file for a lead that already has one in the input (`invalid`)\n\nEach other row is one request. A row ends `ok` (the image is ready), `not_found` (the lead is not in the campaign) or `failed` with the API's reason, such as `image_in_use` (the lead already has a sent or queued step with its image), `blocked`, or `superseded` (another image of the lead was saved at the same moment: run it again). When Kenso cannot convert an SVG just now (the converter is down or busy), the API answers `503 svg_conversion_unavailable`: the CLI retries the row up to 3 times, and a row that still fails ends `failed` with that reason, so run the command again later. A `validation_failed` row that says the SVG could not be converted means the converter refused the SVG itself: fix the SVG or send a PNG. Results, resume and rate limits work as for every batch command: [Batch runs](batch.md).\n\n## One image\n\nUpload one lead's image with the generated command, from a file, a URL or SVG text:\n\n```bash\nkenso image-variables set-contact-image --campaign-id 812 --variable-key hero_image --contact-id 21 --file ada.png\n```\n";
|
|
10128
|
+
}
|
|
10129
|
+
});
|
|
10130
|
+
|
|
10123
10131
|
// docs/leads.md
|
|
10124
10132
|
var leads_default;
|
|
10125
10133
|
var init_leads = __esm({
|
|
@@ -10140,7 +10148,7 @@ var init_output_and_errors = __esm({
|
|
|
10140
10148
|
var README_default;
|
|
10141
10149
|
var init_README = __esm({
|
|
10142
10150
|
"docs/README.md"() {
|
|
10143
|
-
README_default = '# Kenso CLI\n\nThe Kenso CLI (`kenso`) is the command line for Kenso. It does bulk work in your Kenso workspace from files: add thousands of leads to a campaign, update or clean them up, import accounts and people, and build Studio templates. It is made for coding agents (Claude Code, Codex, Cursor) and the people who drive them: JSON on stdout, fixed exit codes, a dry run before every bulk write, and runs you can resume.\n\nEvery canonical API operation a workspace member can call is also a command, such as `kenso campaigns list` or `kenso tags create`. So the CLI reaches what the Kenso MCP reaches, straight against `https://api.ken.so`. The legacy routes with no canonical successor, such as sequence images, AI variables or thread opens, have no command: reach them with `kenso api <METHOD> <path>`.\n\n## Install\n\nOn macOS or Linux, with or without Node, run the [install script](https://ken.so/install.sh): fetch it with `curl -fsSL` and pipe it to `sh`. It installs a standalone build that brings its own Node.js, checks the release\'s `SHA256SUMS` against its signature by the Kenso release key (with `ssh-keygen`, part of OpenSSH) and the download against that list, puts the CLI in `~/.local/share/kenso` and links `~/.local/bin/kenso`. Run it again to update.\n\nWith Homebrew, on macOS or Linux, the same standalone build:\n\n```bash\nbrew install ken-technology/tap/kenso\n```\n\n`brew upgrade kenso` updates it.\n\nWith Node 22 or newer, on any system, Windows included:\n\n```bash\nnpm i -g kenso\nkenso --version\n```\n\nTo run it once without installing, use `npx kenso --version`. On an older Node, kenso stops with one line that says so.\n\nEvery way to install:\n\n| Way | Systems | Needs |\n|---|---|---|\n| Install script, above | macOS, Linux (glibc) | `ssh-keygen` from OpenSSH 8.1 or newer: macOS has it, and on Debian or Ubuntu it is in `openssh-client` |\n| Homebrew, above | macOS, Linux | Homebrew |\n| npm, above | Any | Node 22 or newer |\n| Standalone build: unpack it and put its `bin` folder on your PATH | macOS, Linux, Windows | Nothing |\n\nThe standalone builds are at `https://downloads.ken.so/desktop/cli/<version>/`, one per system: `kenso-<version>-darwin-arm64.tar.gz`, `darwin-x64`, `linux-arm64`, `linux-x64` and `kenso-<version>-windows-x64.zip`, with their `SHA256SUMS` and its signature `SHA256SUMS.sig` (0.1.184 and later). To check a list by hand, save the `SIGNERS` line of the install script, without its quotes, as `allowed_signers`, then run `ssh-keygen -Y verify -f allowed_signers -I kenso-cli-release -n file -s SHA256SUMS.sig < SHA256SUMS`. `https://downloads.ken.so/desktop/cli/latest.yml` names the newest version. The builds come out nightly and Homebrew follows them, so a command added that day reaches npm first.\n\n### Tab completion\n\nTab completes resources, actions and flags once you install the script for your shell. The script asks `kenso` for the candidates on each Tab, so it stays right as the CLI updates: install it once.\n\n```bash\n# zsh: add this line to ~/.zshrc\nsource <(kenso completion zsh)\n# bash: add this line to ~/.bashrc (on bash 3.2, the macOS default, use: eval "$(kenso completion bash)")\nsource <(kenso completion bash)\n# fish: save the script once\nkenso completion fish > ~/.config/fish/completions/kenso.fish\n```\n\n### Update notice\n\nWhen a newer version is out, `kenso` says so on stderr after the command\'s own output, at most once a week: `kenso 0.1.40 is out (you have 0.1.35): npm i -g kenso@latest`. It checks `registry.npmjs.org` at most once every 7 days and never delays a command by more than about a second. A standalone build checks `latest.yml` on `downloads.ken.so` instead and names its own update: the install script, or `brew upgrade kenso` when Homebrew installed it. It stays quiet in CI (`CI` set) and when stderr is not a terminal. Under a coding agent it asks nothing: it prints the line once per agent session, from the last check. Set `KENSO_NO_UPDATE_NOTIFIER=1` to turn it off.\n\n## 60-second quickstart\n\n1. Create an API key in app.ken.so at Settings > API keys.\n2. Save the key, pick a workspace, then plan and apply a CSV import:\n\n```bash\necho $KEY | kenso auth login --with-key\nkenso workspace list --search acme\nkenso workspace use 1234\nkenso campaigns list --limit 5\nkenso contacts import --campaign 812 --file leads.csv --dry-run\nkenso contacts import --campaign 812 --file leads.csv --yes\n```\n\n`workspace list` and `workspace use` are only needed when your key reaches more than one workspace.\n\nThe dry run reads the file, maps the columns, checks every row, asks Kenso for a credit estimate, and writes nothing. It prints the plan, with the exact apply command in `next`:\n\n```json\n{"run":"r_tdi5cdnx","dryRun":true,"command":"contacts import","rows":4,"valid":2,"invalid":2,"chunks":1,"chunkSize":1000,"campaignId":812,"mapping":{"Email":"email","First Name":"firstName","Last Name":"lastName","Company":"companyName","Pain Point":"customVariables.pain_point"},"customVariableKeys":["pain_point"],"estimate":{"kind":"leads","totalMillicredits":2000,"availableMillicredits":500000,"sufficient":true},"credits":{"needed":2,"available":500,"sufficient":true},"next":"kenso contacts import --campaign 812 --file leads.csv --yes","plan":"/home/you/.kenso/runs/r_tdi5cdnx/plan.json","invalidRows":"/home/you/.kenso/runs/r_tdi5cdnx/invalid.csv"}\n```\n\nThe apply sends the rows and prints one summary. Every input row has one line in `results.csv`:\n\n```json\n{"run":"r_tdi5cdnx","rows":4,"ok":0,"created":1,"updated":0,"skipped":{"duplicate":1},"failed":0,"notFound":0,"invalid":2,"changed":1,"results":"/home/you/.kenso/runs/r_tdi5cdnx/results.csv","resultsNdjson":"/home/you/.kenso/runs/r_tdi5cdnx/results.ndjson","invalidRows":"/home/you/.kenso/runs/r_tdi5cdnx/invalid.csv","resumed":false,"durationMs":1840,"campaignId":812,"notSendable":0}\n```\n\nThis run exits 5 because two rows were invalid: open `invalid.csv` to see why, fix those rows, and import them again. Running the same command again is safe: an email that is already in the campaign comes back `updated` or `skipped`, never as a second lead.\n\n## CLI or MCP\n\n- **Use the CLI for volume:** anything that starts from a file, anything over about 50 records, anything you may need to rerun or resume. Records never pass through the model\'s context: the agent passes a file path and reads a short summary.\n- **Use the MCP for conversation and single records:** look up a campaign, draft a reply, read a report. The MCP is at `https://mcp.ken.so/mcp`, signs in with OAuth and needs no install ([connection guide](https://ken.so/mcp)).\n- **Both use the same API and the same permissions.** `kenso mcp call` reaches MCP-only tools, such as skills, from the shell.\n\n## Docs\n\nEvery page is in the package and prints offline with `kenso docs <topic>`.\n\n| Page | Topic | What it covers |\n|---|---|---|\n| [Authentication](auth.md) | `auth` | API keys, browser login, profiles, workspaces, `doctor` |\n| [Leads](leads.md) | `leads` | Import, update, remove, pause, tag and export leads, with recipes |\n| [Batch runs](batch.md) | `batch` | Dry run and apply, run folders, results files, resume, rate limits, `--each` |\n| [Output and errors](output-and-errors.md) | `output-and-errors` | The output contract, error JSON, error codes, exit codes, live streams |\n| [CRM (beta)](crm.md) | `crm` | Accounts, people, opportunities and CRM sync |\n| [Studio (beta)](studio.md) | `studio` | Pull, push, validate, preview and fill templates |\n| [Workflows (beta)](workflows.md) | `workflows` | Keep a workflow as a file: `kenso.json`, init, pull, check, push, test, publish, and run it on ids or a CSV with a credit cap |\n| [Agent work (beta)](work.md) | `work` | My agent: your own coding agent writes Kenso\'s AI work with `kenso work run`, or pull and submit |\n| [Webhooks](webhooks.md) | `webhooks` | Build a webhook handler locally: `kenso webhooks listen --forward-to`, `trigger`, the signature |\n| [Developer sandbox](sandbox.md) | `sandbox` | `kenso sandbox`: a workspace of your own where sends are simulated, its test key, the reserved test leads |\n| [Connect accounts](connect.md) | `connect` | `kenso connect`: an inbox, calendar, CRM, GitHub or other OAuth account, signed in by the person in a browser |\n| [Coding agents](agents.md) | `agents` | Claude Code, Codex, Cursor, the Agent Skill, environment variables, sandboxes |\n| Command reference | `reference` | Every command with its flags, generated from the CLI at build time: `kenso docs reference`, or `docs/reference.md` in the installed package |\n\n```bash\nkenso docs\nkenso docs leads\n```\n\nFor machine-readable help, run `kenso describe`: it prints every command, its flags and its body schema as JSON.\n';
|
|
10151
|
+
README_default = '# Kenso CLI\n\nThe Kenso CLI (`kenso`) is the command line for Kenso. It does bulk work in your Kenso workspace from files: add thousands of leads to a campaign, update or clean them up, import accounts and people, and build Studio templates. It is made for coding agents (Claude Code, Codex, Cursor) and the people who drive them: JSON on stdout, fixed exit codes, a dry run before every bulk write, and runs you can resume.\n\nEvery canonical API operation a workspace member can call is also a command, such as `kenso campaigns list` or `kenso tags create`. So the CLI reaches what the Kenso MCP reaches, straight against `https://api.ken.so`. The legacy routes with no canonical successor, such as sequence images, AI variables or thread opens, have no command: reach them with `kenso api <METHOD> <path>`.\n\n## Install\n\nOn macOS or Linux, with or without Node, run the [install script](https://ken.so/install.sh): fetch it with `curl -fsSL` and pipe it to `sh`. It installs a standalone build that brings its own Node.js, checks the release\'s `SHA256SUMS` against its signature by the Kenso release key (with `ssh-keygen`, part of OpenSSH) and the download against that list, puts the CLI in `~/.local/share/kenso` and links `~/.local/bin/kenso`. Run it again to update.\n\nWith Homebrew, on macOS or Linux, the same standalone build:\n\n```bash\nbrew install ken-technology/tap/kenso\n```\n\n`brew upgrade kenso` updates it.\n\nWith Node 22 or newer, on any system, Windows included:\n\n```bash\nnpm i -g kenso\nkenso --version\n```\n\nTo run it once without installing, use `npx kenso --version`. On an older Node, kenso stops with one line that says so.\n\nEvery way to install:\n\n| Way | Systems | Needs |\n|---|---|---|\n| Install script, above | macOS, Linux (glibc) | `ssh-keygen` from OpenSSH 8.1 or newer: macOS has it, and on Debian or Ubuntu it is in `openssh-client` |\n| Homebrew, above | macOS, Linux | Homebrew |\n| npm, above | Any | Node 22 or newer |\n| Standalone build: unpack it and put its `bin` folder on your PATH | macOS, Linux, Windows | Nothing |\n\nThe standalone builds are at `https://downloads.ken.so/desktop/cli/<version>/`, one per system: `kenso-<version>-darwin-arm64.tar.gz`, `darwin-x64`, `linux-arm64`, `linux-x64` and `kenso-<version>-windows-x64.zip`, with their `SHA256SUMS` and its signature `SHA256SUMS.sig` (0.1.184 and later). To check a list by hand, save the `SIGNERS` line of the install script, without its quotes, as `allowed_signers`, then run `ssh-keygen -Y verify -f allowed_signers -I kenso-cli-release -n file -s SHA256SUMS.sig < SHA256SUMS`. `https://downloads.ken.so/desktop/cli/latest.yml` names the newest version. The builds come out nightly and Homebrew follows them, so a command added that day reaches npm first.\n\n### Tab completion\n\nTab completes resources, actions and flags once you install the script for your shell. The script asks `kenso` for the candidates on each Tab, so it stays right as the CLI updates: install it once.\n\n```bash\n# zsh: add this line to ~/.zshrc\nsource <(kenso completion zsh)\n# bash: add this line to ~/.bashrc (on bash 3.2, the macOS default, use: eval "$(kenso completion bash)")\nsource <(kenso completion bash)\n# fish: save the script once\nkenso completion fish > ~/.config/fish/completions/kenso.fish\n```\n\n### Update notice\n\nWhen a newer version is out, `kenso` says so on stderr after the command\'s own output, at most once a week: `kenso 0.1.40 is out (you have 0.1.35): npm i -g kenso@latest`. It checks `registry.npmjs.org` at most once every 7 days and never delays a command by more than about a second. A standalone build checks `latest.yml` on `downloads.ken.so` instead and names its own update: the install script, or `brew upgrade kenso` when Homebrew installed it. It stays quiet in CI (`CI` set) and when stderr is not a terminal. Under a coding agent it asks nothing: it prints the line once per agent session, from the last check. Set `KENSO_NO_UPDATE_NOTIFIER=1` to turn it off.\n\n## 60-second quickstart\n\n1. Create an API key in app.ken.so at Settings > API keys.\n2. Save the key, pick a workspace, then plan and apply a CSV import:\n\n```bash\necho $KEY | kenso auth login --with-key\nkenso workspace list --search acme\nkenso workspace use 1234\nkenso campaigns list --limit 5\nkenso contacts import --campaign 812 --file leads.csv --dry-run\nkenso contacts import --campaign 812 --file leads.csv --yes\n```\n\n`workspace list` and `workspace use` are only needed when your key reaches more than one workspace.\n\nThe dry run reads the file, maps the columns, checks every row, asks Kenso for a credit estimate, and writes nothing. It prints the plan, with the exact apply command in `next`:\n\n```json\n{"run":"r_tdi5cdnx","dryRun":true,"command":"contacts import","rows":4,"valid":2,"invalid":2,"chunks":1,"chunkSize":1000,"campaignId":812,"mapping":{"Email":"email","First Name":"firstName","Last Name":"lastName","Company":"companyName","Pain Point":"customVariables.pain_point"},"customVariableKeys":["pain_point"],"estimate":{"kind":"leads","totalMillicredits":2000,"availableMillicredits":500000,"sufficient":true},"credits":{"needed":2,"available":500,"sufficient":true},"next":"kenso contacts import --campaign 812 --file leads.csv --yes","plan":"/home/you/.kenso/runs/r_tdi5cdnx/plan.json","invalidRows":"/home/you/.kenso/runs/r_tdi5cdnx/invalid.csv"}\n```\n\nThe apply sends the rows and prints one summary. Every input row has one line in `results.csv`:\n\n```json\n{"run":"r_tdi5cdnx","rows":4,"ok":0,"created":1,"updated":0,"skipped":{"duplicate":1},"failed":0,"notFound":0,"invalid":2,"changed":1,"results":"/home/you/.kenso/runs/r_tdi5cdnx/results.csv","resultsNdjson":"/home/you/.kenso/runs/r_tdi5cdnx/results.ndjson","invalidRows":"/home/you/.kenso/runs/r_tdi5cdnx/invalid.csv","resumed":false,"durationMs":1840,"campaignId":812,"notSendable":0}\n```\n\nThis run exits 5 because two rows were invalid: open `invalid.csv` to see why, fix those rows, and import them again. Running the same command again is safe: an email that is already in the campaign comes back `updated` or `skipped`, never as a second lead.\n\n## CLI or MCP\n\n- **Use the CLI for volume:** anything that starts from a file, anything over about 50 records, anything you may need to rerun or resume. Records never pass through the model\'s context: the agent passes a file path and reads a short summary.\n- **Use the MCP for conversation and single records:** look up a campaign, draft a reply, read a report. The MCP is at `https://mcp.ken.so/mcp`, signs in with OAuth and needs no install ([connection guide](https://ken.so/mcp)).\n- **Both use the same API and the same permissions.** `kenso mcp call` reaches MCP-only tools, such as skills, from the shell.\n\n## Docs\n\nEvery page is in the package and prints offline with `kenso docs <topic>`.\n\n| Page | Topic | What it covers |\n|---|---|---|\n| [Authentication](auth.md) | `auth` | API keys, browser login, profiles, workspaces, `doctor` |\n| [Leads](leads.md) | `leads` | Import, update, remove, pause, tag and export leads, with recipes |\n| [Batch runs](batch.md) | `batch` | Dry run and apply, run folders, results files, resume, rate limits, `--each` |\n| [Output and errors](output-and-errors.md) | `output-and-errors` | The output contract, error JSON, error codes, exit codes, live streams |\n| [CRM (beta)](crm.md) | `crm` | Accounts, people, opportunities and CRM sync |\n| [Images (beta)](images.md) | `images` | Upload one image per lead into an image variable, from a folder or a CSV |\n| [Studio (beta)](studio.md) | `studio` | Pull, push, validate, preview and fill templates |\n| [Workflows (beta)](workflows.md) | `workflows` | Keep a workflow as a file: `kenso.json`, init, pull, check, push, test, publish, and run it on ids or a CSV with a credit cap |\n| [Agent work (beta)](work.md) | `work` | My agent: your own coding agent writes Kenso\'s AI work with `kenso work run`, or pull and submit |\n| [Webhooks](webhooks.md) | `webhooks` | Build a webhook handler locally: `kenso webhooks listen --forward-to`, `trigger`, the signature |\n| [Developer sandbox](sandbox.md) | `sandbox` | `kenso sandbox`: a workspace of your own where sends are simulated, its test key, the reserved test leads |\n| [Connect accounts](connect.md) | `connect` | `kenso connect`: an inbox, calendar, CRM, GitHub or other OAuth account, signed in by the person in a browser |\n| [Coding agents](agents.md) | `agents` | Claude Code, Codex, Cursor, the Agent Skill, environment variables, sandboxes |\n| Command reference | `reference` | Every command with its flags, generated from the CLI at build time: `kenso docs reference`, or `docs/reference.md` in the installed package |\n\n```bash\nkenso docs\nkenso docs leads\n```\n\nFor machine-readable help, run `kenso describe`: it prints every command, its flags and its body schema as JSON.\n';
|
|
10144
10152
|
}
|
|
10145
10153
|
});
|
|
10146
10154
|
|
|
@@ -10196,7 +10204,7 @@ var init_SKILL = __esm({
|
|
|
10196
10204
|
var SKILL_default2;
|
|
10197
10205
|
var init_SKILL2 = __esm({
|
|
10198
10206
|
"skill/kenso-cli/SKILL.md"() {
|
|
10199
|
-
SKILL_default2 = '---\nname: kenso-cli\ndescription: The Kenso CLI (kenso) for work from a file (of any size, even a few ids) or over about 50 records - import, update, remove (delete), pause, tag or export leads, import CRM accounts and people, edit Studio templates as local files and fill them, run an API operation per file row, resume an interrupted run, write the Kenso AI work a workspace gave to its own coding agent (My agent, with kenso work run, or work pull and submit with subagents), sign in with a key from a variable (pipe it to kenso auth login --with-key, no check first). For records listed in the message (under about 50), one record or a question, use the Kenso MCP.\n---\n\n1. Every write runs first with `--dry-run`; apply with the plan\'s `next` (a delete, archive or remove applies with `--yes`). `--yes` at once only to continue an interrupted run or apply what the person confirmed. A command with no dry run refuses `--dry-run` (exit 2, nothing ran): read its `--help`, then run it without.\n2. Many rows: one command on the file as it is (`--file`, `--ids`, `--each`). Run kenso only: no python, awk or shell tests, not even on a file or variable.\n3. Any output\'s `next` is the command to run; errors are JSON on stderr. `--force` only with the person\'s OK.\n4. Ids are flags: `--campaign-id 812` (or `--campaign 812`, the same flag). `--workspace <id>`; by name `kenso workspace list --search acme`. `--json` is `-o json`; `--query` takes JMESPath (there is no `--jq`). Other commands: `kenso --help`; `kenso api <METHOD> <path>` only when none fits.\n\n```bash\nkenso contacts import --campaign 812 --file leads.csv --dry-run # skips leads already in; --map \'{"Pain": "customVariables.pain_point", "Notes": null}\'; over 200 MB --server-import\nkenso contacts update --file edits.csv --match id --dry-run # also one lead; or --match email --campaign 812\nkenso contacts remove --ids ids.txt --dry-run # also pause, resume, restore; over 1,000: --confirm <count>\nkenso contacts remove --where \'{"campaignIds": [812], "filters": [{"conditions": {"field": "ContactCompany.Name", "operator": 2, "value": "acme"}}]}\' --dry-run # also pause, resume; 2 = contains; no search first\nkenso contacts tag --tag 31 --ids ids.txt --dry-run # tag, restore: --ids only, so first kenso contacts list --campaign-id 812 --all -o ids > ids.txt\nkenso contact-imports create --source campaign --source-campaign-id 10601 --campaign-id 812 --dry-run # copy another campaign\'s leads in\nkenso contacts export --campaign 812 --out leads.csv # a segment: kenso contact-exports create --segment-id 55\nkenso runs resume <runId> # an interrupted run; terminal lost: kenso runs list finds it. A changed file is a new run\nkenso accounts import --file accounts.csv --dry-run # companies; a file of people: kenso people import --file people.csv\nkenso studio push 12 --dir ./tpl # to preview local edits push first (draft; live needs --publish), then studio preview 12\nkenso studio fill 12 --accounts ids.txt --dry-run # or --campaign 10546 --contacts leads.csv\nkenso opportunities update --each rows.csv --dry-run # any API command on a file of rows (CSV or JSONL; keys fill flags and body). One record: kenso campaigns update --campaign-id 812 --name Q4 --dry-run\nkenso mcp call list_skills # only to list Ken\'s skills\nkenso logs tail --status 4xx,5xx --since 10m # stream the workspace\'s failed API calls, one line each; Ctrl-C stops (exit 4 = not on for the workspace yet)\nkenso connect inbox --provider google # also calendar, crm, github, linkedin ...: hand the printed link to the person (only they can sign in), it waits and prints the connection\nkenso onboarding-builds events --build-id obd_2x --until done,error # live streams: one JSON line per event, reconnects itself\n```\n\nCharges: follow the kenso skill\'s spend rules; the dry run of a `spend` command (one call or an `--each` file) and of `kenso workflows run` prints `credits` (`needed`, `available`, `sufficient`; `null` where it cannot tell, and an unknown `needed` is never free). `pinned_by_user`: with the person\'s OK, rerun with `--overwrite-pinned`. Workflows: `kenso docs workflows` first; secrets only as `{{secrets.NAME}}`. Key: `KENSO_API_KEY`, or pipe a variable, no check: `printf \'%s\' "$KEY" | kenso auth login --with-key`; never in a flag, output or file.\n\n## Work (beta): My agent\n\nA workspace can set a kind of Kenso AI work (personalization, qualification, segmentation, rewriting, meeting brief, call brief, workflow prompt) to My agent in Settings > AI work: then it waits for the person\'s own coding agent, at 0 Kenso AI credits. The `kenso work` commands take no `--dry-run`. Never read the items\' text into the chat: the files carry it.\n\n```bash\nkenso work status # what waits, per kind\nkenso work run --agent claude # does it all: claims, runs headless agents, submits; stops when the queue is empty. Other agents need --allow-unconfined; exit 6 = the plan\'s usage limit\nkenso work pull --files 4 --per-file 10 # by hand: prints the work file paths, never the items\nkenso work submit <dir>/*.answers.json # pull\'s next; exit 5 = some answers rejected (see each <claimId>.results.json)\nkenso work release <claimId> # give back work you will not finish\n```\n\nBy hand in a chat: run `kenso work pull`, then give each work file to its own subagent with only its path ("Read this work file and write its answers file as its rules say"), then run pull\'s `next`. More: `kenso docs work`.\n\n## Setup\n\n`kenso` missing: `curl -fsSL https://ken.so/install.sh | sh` (macOS or Linux, no Node needed) or `npm i -g kenso` (Node 22 or newer), or run a command as `npx -y kenso@latest <command>`. Then sign in: `kenso login --no-wait` prints a link and a code for the person to open and approve, then `kenso auth wait` saves the key. Then `kenso doctor`. `kenso agent setup -y` installs this skill and the Kenso MCP server (`https://mcp.ken.so/mcp`) for the agent; the person signs in to the MCP once in the agent.\n\n## No Kenso account yet\n\nThe CLI signs in with a Kenso API key. If the user has no Kenso account, send them to https://app.ken.so/get-started to create one, then create a key in Kenso at Settings > API keys.\n';
|
|
10207
|
+
SKILL_default2 = '---\nname: kenso-cli\ndescription: The Kenso CLI (kenso) for work from a file (of any size, even a few ids) or over about 50 records - import, update, remove (delete), pause, tag or export leads, import CRM accounts and people, edit Studio templates as local files and fill them, run an API operation per file row, resume an interrupted run, write the Kenso AI work a workspace gave to its own coding agent (My agent, with kenso work run, or work pull and submit with subagents), sign in with a key from a variable (pipe it to kenso auth login --with-key, no check first). For records listed in the message (under about 50), one record or a question, use the Kenso MCP.\n---\n\n1. Every write runs first with `--dry-run`; apply with the plan\'s `next` (a delete, archive or remove applies with `--yes`). `--yes` at once only to continue an interrupted run or apply what the person confirmed. A command with no dry run refuses `--dry-run` (exit 2, nothing ran): read its `--help`, then run it without.\n2. Many rows: one command on the file as it is (`--file`, `--ids`, `--each`). Run kenso only: no python, awk or shell tests, not even on a file or variable.\n3. Any output\'s `next` is the command to run; errors are JSON on stderr. `--force` only with the person\'s OK.\n4. Ids are flags: `--campaign-id 812` (or `--campaign 812`, the same flag). `--workspace <id>`; by name `kenso workspace list --search acme`. `--json` is `-o json`; `--query` takes JMESPath (there is no `--jq`). Other commands: `kenso --help`; `kenso api <METHOD> <path>` only when none fits.\n\n```bash\nkenso contacts import --campaign 812 --file leads.csv --dry-run # skips leads already in; --map \'{"Pain": "customVariables.pain_point", "Notes": null}\'; over 200 MB --server-import\nkenso contacts update --file edits.csv --match id --dry-run # also one lead; or --match email --campaign 812\nkenso contacts remove --ids ids.txt --dry-run # also pause, resume, restore; over 1,000: --confirm <count>\nkenso contacts remove --where \'{"campaignIds": [812], "filters": [{"conditions": {"field": "ContactCompany.Name", "operator": 2, "value": "acme"}}]}\' --dry-run # also pause, resume; 2 = contains; no search first\nkenso contacts tag --tag 31 --ids ids.txt --dry-run # tag, restore: --ids only, so first kenso contacts list --campaign-id 812 --all -o ids > ids.txt\nkenso contact-imports create --source campaign --source-campaign-id 10601 --campaign-id 812 --dry-run # copy another campaign\'s leads in\nkenso contacts export --campaign 812 --out leads.csv # a segment: kenso contact-exports create --segment-id 55\nkenso runs resume <runId> # an interrupted run; terminal lost: kenso runs list finds it. A changed file is a new run\nkenso accounts import --file accounts.csv --dry-run # companies; a file of people: kenso people import --file people.csv\nkenso studio push 12 --dir ./tpl # to preview local edits push first (draft; live needs --publish), then studio preview 12\nkenso studio fill 12 --accounts ids.txt --dry-run # or --campaign 10546 --contacts leads.csv\nkenso images upload --campaign 812 --variable hero_image ./images --dry-run # one image per lead you made (files <contactId>.png or <email>.svg, or a CSV); not charged\nkenso opportunities update --each rows.csv --dry-run # any API command on a file of rows (CSV or JSONL; keys fill flags and body). One record: kenso campaigns update --campaign-id 812 --name Q4 --dry-run\nkenso mcp call list_skills # only to list Ken\'s skills\nkenso logs tail --status 4xx,5xx --since 10m # stream the workspace\'s failed API calls, one line each; Ctrl-C stops (exit 4 = not on for the workspace yet)\nkenso connect inbox --provider google # also calendar, crm, github, linkedin ...: hand the printed link to the person (only they can sign in), it waits and prints the connection\nkenso onboarding-builds events --build-id obd_2x --until done,error # live streams: one JSON line per event, reconnects itself\n```\n\nCharges: follow the kenso skill\'s spend rules; the dry run of a `spend` command (one call or an `--each` file) and of `kenso workflows run` prints `credits` (`needed`, `available`, `sufficient`; `null` where it cannot tell, and an unknown `needed` is never free). `pinned_by_user`: with the person\'s OK, rerun with `--overwrite-pinned`. Workflows: `kenso docs workflows` first; secrets only as `{{secrets.NAME}}`. Key: `KENSO_API_KEY`, or pipe a variable, no check: `printf \'%s\' "$KEY" | kenso auth login --with-key`; never in a flag, output or file.\n\n## Work (beta): My agent\n\nA workspace can set a kind of Kenso AI work (personalization, qualification, segmentation, rewriting, meeting brief, call brief, workflow prompt) to My agent in Settings > AI work: then it waits for the person\'s own coding agent, at 0 Kenso AI credits. The `kenso work` commands take no `--dry-run`. Never read the items\' text into the chat: the files carry it.\n\n```bash\nkenso work status # what waits, per kind\nkenso work run --agent claude # does it all: claims, runs headless agents, submits; stops when the queue is empty. Other agents need --allow-unconfined; exit 6 = the plan\'s usage limit\nkenso work pull --files 4 --per-file 10 # by hand: prints the work file paths, never the items\nkenso work submit <dir>/*.answers.json # pull\'s next; exit 5 = some answers rejected (see each <claimId>.results.json)\nkenso work release <claimId> # give back work you will not finish\n```\n\nBy hand in a chat: run `kenso work pull`, then give each work file to its own subagent with only its path ("Read this work file and write its answers file as its rules say"), then run pull\'s `next`. More: `kenso docs work`.\n\n## Setup\n\n`kenso` missing: `curl -fsSL https://ken.so/install.sh | sh` (macOS or Linux, no Node needed) or `npm i -g kenso` (Node 22 or newer), or run a command as `npx -y kenso@latest <command>`. Then sign in: `kenso login --no-wait` prints a link and a code for the person to open and approve, then `kenso auth wait` saves the key. Then `kenso doctor`. `kenso agent setup -y` installs this skill and the Kenso MCP server (`https://mcp.ken.so/mcp`) for the agent; the person signs in to the MCP once in the agent.\n\n## No Kenso account yet\n\nThe CLI signs in with a Kenso API key. If the user has no Kenso account, send them to https://app.ken.so/get-started to create one, then create a key in Kenso at Settings > API keys.\n';
|
|
10200
10208
|
}
|
|
10201
10209
|
});
|
|
10202
10210
|
|
|
@@ -10216,6 +10224,7 @@ var init_embedded = __esm({
|
|
|
10216
10224
|
init_batch();
|
|
10217
10225
|
init_connect();
|
|
10218
10226
|
init_crm();
|
|
10227
|
+
init_images();
|
|
10219
10228
|
init_leads();
|
|
10220
10229
|
init_output_and_errors();
|
|
10221
10230
|
init_README();
|
|
@@ -10233,6 +10242,7 @@ var init_embedded = __esm({
|
|
|
10233
10242
|
"batch.md": batch_default,
|
|
10234
10243
|
"output-and-errors.md": output_and_errors_default,
|
|
10235
10244
|
"crm.md": crm_default,
|
|
10245
|
+
"images.md": images_default,
|
|
10236
10246
|
"studio.md": studio_default,
|
|
10237
10247
|
"workflows.md": workflows_default,
|
|
10238
10248
|
"work.md": work_default,
|
|
@@ -10343,7 +10353,8 @@ var init_shipped = __esm({
|
|
|
10343
10353
|
"b34e186f56f36b509bffa0dea2ee78b09e91654b90a659d6665563df4fa88f76",
|
|
10344
10354
|
"df7d86e0af12727cf15cf0620f26ef4fe9aac63f0180f3594e4d357cf14b40d2",
|
|
10345
10355
|
"812bb97591cefa7eb23596105ce63dfd382c0bd4c68e8b5d179775e9b72e927a",
|
|
10346
|
-
"d1319079d2ec55423764e214c7ab833c076da223b0880081c190d9adc677b1d1"
|
|
10356
|
+
"d1319079d2ec55423764e214c7ab833c076da223b0880081c190d9adc677b1d1",
|
|
10357
|
+
"171117b04b4082d8fc1e4309397b42fa8753f1b7780eafc23f1c1498b46009ce"
|
|
10347
10358
|
],
|
|
10348
10359
|
kenso: [
|
|
10349
10360
|
"6fb333a826726d51ba2ea3927745f843343490c8aa9098e5da682d24172323f7",
|
|
@@ -11475,8 +11486,8 @@ var init_browser_login = __esm({
|
|
|
11475
11486
|
defaultDeps = {
|
|
11476
11487
|
sleep: (ms, signal) => delay5(ms, void 0, signal ? { signal } : void 0),
|
|
11477
11488
|
now: () => Date.now(),
|
|
11478
|
-
spawn: (
|
|
11479
|
-
const child = nodeSpawn(
|
|
11489
|
+
spawn: (command92, args) => {
|
|
11490
|
+
const child = nodeSpawn(command92, args, { detached: true, stdio: "ignore" });
|
|
11480
11491
|
child.on("error", () => {
|
|
11481
11492
|
});
|
|
11482
11493
|
child.unref();
|
|
@@ -12888,8 +12899,8 @@ var init_run = __esm({
|
|
|
12888
12899
|
defaultDeps2 = {
|
|
12889
12900
|
sleep: (ms, signal) => delay6(ms, void 0, signal ? { signal } : void 0),
|
|
12890
12901
|
now: () => Date.now(),
|
|
12891
|
-
spawn: (
|
|
12892
|
-
const child = nodeSpawn2(
|
|
12902
|
+
spawn: (command92, args) => {
|
|
12903
|
+
const child = nodeSpawn2(command92, args, { detached: true, stdio: "ignore" });
|
|
12893
12904
|
child.on("error", () => {
|
|
12894
12905
|
});
|
|
12895
12906
|
child.unref();
|
|
@@ -13060,35 +13071,35 @@ function parseMapOverrides(value) {
|
|
|
13060
13071
|
});
|
|
13061
13072
|
}
|
|
13062
13073
|
const out = {};
|
|
13063
|
-
for (const [
|
|
13074
|
+
for (const [column2, target2] of Object.entries(value)) {
|
|
13064
13075
|
if (target2 !== null && typeof target2 !== "string") {
|
|
13065
|
-
throw usageError(`--map "${
|
|
13076
|
+
throw usageError(`--map "${column2}" must name a field, customVariables.<key>, or null.`, { field: "map" });
|
|
13066
13077
|
}
|
|
13067
|
-
out[
|
|
13078
|
+
out[column2] = target2;
|
|
13068
13079
|
}
|
|
13069
13080
|
return out;
|
|
13070
13081
|
}
|
|
13071
13082
|
function targetName(target2) {
|
|
13072
13083
|
return "field" in target2 ? target2.field : `${CUSTOM_PREFIX}${target2.customKey}`;
|
|
13073
13084
|
}
|
|
13074
|
-
function overrideTarget(
|
|
13085
|
+
function overrideTarget(column2, value, mode) {
|
|
13075
13086
|
const text5 = value.trim();
|
|
13076
13087
|
if (text5.startsWith(CUSTOM_PREFIX)) {
|
|
13077
13088
|
const raw = text5.slice(CUSTOM_PREFIX.length);
|
|
13078
13089
|
const problem = customVariableKeyProblem(raw);
|
|
13079
13090
|
if (problem) {
|
|
13080
13091
|
const why2 = problem === "reserved_name" ? "is a name Kenso keeps for its own fields" : "is not a usable variable key (a letter, then letters, digits and _)";
|
|
13081
|
-
throw usageError(`--map "${
|
|
13092
|
+
throw usageError(`--map "${column2}": customVariables.${raw} ${why2}.`, { field: "map", hint: "Pick another custom variable name." });
|
|
13082
13093
|
}
|
|
13083
13094
|
return { customKey: normalizeVariableName(raw) };
|
|
13084
13095
|
}
|
|
13085
13096
|
const field = fieldOf(text5);
|
|
13086
13097
|
if (!field) {
|
|
13087
|
-
throw usageError(`--map "${
|
|
13098
|
+
throw usageError(`--map "${column2}": "${value}" is not a field. Use one of ${FIELD_LIST}, customVariables.<key>, or null.`, { field: "map" });
|
|
13088
13099
|
}
|
|
13089
|
-
if (field === "id" && mode === "import") throw usageError(`--map "${
|
|
13100
|
+
if (field === "id" && mode === "import") throw usageError(`--map "${column2}": id is only for contacts update.`, { field: "map" });
|
|
13090
13101
|
if (mode === "update" && NOT_UPDATABLE.has(field)) {
|
|
13091
|
-
throw usageError(`--map "${
|
|
13102
|
+
throw usageError(`--map "${column2}": contacts update cannot change ${field}.`, { field: "map" });
|
|
13092
13103
|
}
|
|
13093
13104
|
return { field };
|
|
13094
13105
|
}
|
|
@@ -13397,7 +13408,7 @@ function csvTargetOf(header2, mapping) {
|
|
|
13397
13408
|
return CSV_IMPORT_TARGET_FIELDS.has(key) ? key : void 0;
|
|
13398
13409
|
}
|
|
13399
13410
|
function columnMappings(mapping) {
|
|
13400
|
-
const sent = new Map(mapping.columns.map((
|
|
13411
|
+
const sent = new Map(mapping.columns.map((column2) => [column2.header, column2.target]));
|
|
13401
13412
|
const out = [];
|
|
13402
13413
|
for (const header2 of Object.keys(mapping.mapping)) {
|
|
13403
13414
|
const target2 = sent.get(header2);
|
|
@@ -13673,6 +13684,7 @@ var init_import2 = __esm({
|
|
|
13673
13684
|
var update_exports = {};
|
|
13674
13685
|
__export(update_exports, {
|
|
13675
13686
|
default: () => update_default,
|
|
13687
|
+
emailIndex: () => emailIndex,
|
|
13676
13688
|
mapUpdateAnswer: () => mapUpdateAnswer,
|
|
13677
13689
|
planUpdate: () => planUpdate
|
|
13678
13690
|
});
|
|
@@ -13868,12 +13880,12 @@ import { join as join17 } from "node:path";
|
|
|
13868
13880
|
function whereDir(env) {
|
|
13869
13881
|
return join17(runsRoot(env), WHERE_DIR);
|
|
13870
13882
|
}
|
|
13871
|
-
async function unfinishedWhereIds(ctx,
|
|
13883
|
+
async function unfinishedWhereIds(ctx, command92, args) {
|
|
13872
13884
|
const dir3 = whereDir(ctx.env);
|
|
13873
13885
|
const identity = argsIdentity(args);
|
|
13874
13886
|
const workspaceId = ctx.client.workspaceId ?? ctx.auth.workspaceId;
|
|
13875
13887
|
for (const run of await listRuns(ctx.env)) {
|
|
13876
|
-
if (run.command !==
|
|
13888
|
+
if (run.command !== command92 || run.status === "done" || run.status === "planned") continue;
|
|
13877
13889
|
if ((run.workspaceId || void 0) !== (workspaceId || void 0) || argsIdentity(run.args) !== identity) continue;
|
|
13878
13890
|
if (run.inputPath?.startsWith(`${dir3}/`) && existsSync7(run.inputPath)) return run.inputPath;
|
|
13879
13891
|
}
|
|
@@ -14019,14 +14031,14 @@ async function idsFromRun(ctx, runId) {
|
|
|
14019
14031
|
return { ...idItems(ids2), source: "run" };
|
|
14020
14032
|
}
|
|
14021
14033
|
async function collectIds(ctx, flags, kind, dryRun2) {
|
|
14022
|
-
const
|
|
14034
|
+
const command92 = `kenso contacts ${kind}`;
|
|
14023
14035
|
const ids2 = stringFlag2(flags, "ids");
|
|
14024
14036
|
const where = kind === "restore" ? void 0 : stringFlag2(flags, "where");
|
|
14025
14037
|
const run = kind === "restore" ? stringFlag2(flags, "run") : void 0;
|
|
14026
14038
|
const given = [ids2, where, run].filter((v) => v !== void 0).length;
|
|
14027
14039
|
if (given !== 1) {
|
|
14028
14040
|
const choices = kind === "restore" ? "--ids <file|-> or --run <runId>" : "--ids <file|-> or --where '<json>'";
|
|
14029
|
-
throw usageError(`${
|
|
14041
|
+
throw usageError(`${command92} needs exactly one of ${choices}.`, { field: "ids", next: `${command92} --help` });
|
|
14030
14042
|
}
|
|
14031
14043
|
if (ids2 !== void 0) return idsFromFile(ctx, ids2);
|
|
14032
14044
|
if (where !== void 0) return idsFromWhere(ctx, kind, flags, where, dryRun2);
|
|
@@ -15296,6 +15308,7 @@ var init_content = __esm({
|
|
|
15296
15308
|
{ topic: "batch", file: "batch.md", title: "Batch runs", description: "Dry run and apply, run folders, results files, resume, rate limits, --each" },
|
|
15297
15309
|
{ topic: "output-and-errors", file: "output-and-errors.md", title: "Output and errors", description: "The output contract, error JSON, error codes, exit codes, live streams" },
|
|
15298
15310
|
{ topic: "crm", file: "crm.md", title: "CRM (beta)", description: "Accounts, people, opportunities and CRM sync" },
|
|
15311
|
+
{ topic: "images", file: "images.md", title: "Images (beta)", description: "Upload one image per lead into an image variable, from a folder or a CSV" },
|
|
15299
15312
|
{ topic: "studio", file: "studio.md", title: "Studio (beta)", description: "Pull, push, validate, preview and fill templates" },
|
|
15300
15313
|
{ topic: "workflows", file: "workflows.md", title: "Workflows (beta)", description: "Keep a workflow as a file: kenso.json, init, pull, check, push, test, publish, and run it on ids or a CSV with a credit cap" },
|
|
15301
15314
|
{ topic: "work", file: "work.md", title: "Agent work (beta)", description: "My agent: your own coding agent writes Kenso AI work with kenso work run, or pull and submit" },
|
|
@@ -15322,14 +15335,14 @@ function specEntry(spec) {
|
|
|
15322
15335
|
if (spec.brief?.startsWith("same as ")) return void 0;
|
|
15323
15336
|
const id = commandName(spec).slice("kenso ".length);
|
|
15324
15337
|
const credits3 = spec.cost ?? [];
|
|
15325
|
-
const
|
|
15338
|
+
const actions41 = credits3.map((c) => c.action);
|
|
15326
15339
|
return {
|
|
15327
15340
|
kind: "command",
|
|
15328
15341
|
id,
|
|
15329
15342
|
summary: spec.summary,
|
|
15330
|
-
terms: termsOf(id, spec.summary, spec.description, spec.doc?.when, Object.keys(spec.flags).join(" "),
|
|
15343
|
+
terms: termsOf(id, spec.summary, spec.description, spec.doc?.when, Object.keys(spec.flags).join(" "), actions41.join(" ")),
|
|
15331
15344
|
effect: spec.effect,
|
|
15332
|
-
...credits3.length > 0 ? { costActions:
|
|
15345
|
+
...credits3.length > 0 ? { costActions: actions41, credits: credits3 } : {},
|
|
15333
15346
|
...spec.beta ? { beta: true } : {},
|
|
15334
15347
|
describe: `kenso describe ${id}`
|
|
15335
15348
|
};
|
|
@@ -15899,6 +15912,237 @@ var init_export3 = __esm({
|
|
|
15899
15912
|
}
|
|
15900
15913
|
});
|
|
15901
15914
|
|
|
15915
|
+
// src/commands/images/upload.ts
|
|
15916
|
+
var upload_exports = {};
|
|
15917
|
+
__export(upload_exports, {
|
|
15918
|
+
default: () => upload_default,
|
|
15919
|
+
filesOfFolder: () => filesOfFolder,
|
|
15920
|
+
filesOfList: () => filesOfList,
|
|
15921
|
+
planUploads: () => planUploads
|
|
15922
|
+
});
|
|
15923
|
+
import { readdirSync, statSync as statSync6 } from "node:fs";
|
|
15924
|
+
import { basename as basename4, dirname as dirname3, extname as extname5, join as join18, resolve as resolve10 } from "node:path";
|
|
15925
|
+
function filesOfFolder(dir3) {
|
|
15926
|
+
const names = readdirSync(dir3, { withFileTypes: true }).filter((entry) => entry.isFile() && !entry.name.startsWith(".")).map((entry) => entry.name).sort();
|
|
15927
|
+
return names.map((name, index2) => {
|
|
15928
|
+
const stem2 = basename4(name, extname5(name));
|
|
15929
|
+
const file = join18(dir3, name);
|
|
15930
|
+
return stem2.includes("@") ? { row: index2 + 1, file, email: stem2 } : { row: index2 + 1, file, id: stem2 };
|
|
15931
|
+
});
|
|
15932
|
+
}
|
|
15933
|
+
function column(headers, names) {
|
|
15934
|
+
return headers.find((header2) => names.includes(header2.trim().toLowerCase().replace(/[\s-]/g, "_")));
|
|
15935
|
+
}
|
|
15936
|
+
async function filesOfList(path, stdin) {
|
|
15937
|
+
const input = await readInput(path, stdin ? { stdin } : void 0);
|
|
15938
|
+
const fileColumn = column(input.headers, ["file", "path", "image"]);
|
|
15939
|
+
const idColumn = column(input.headers, ["contact_id", "contactid", "id"]);
|
|
15940
|
+
const emailColumn = column(input.headers, ["email"]);
|
|
15941
|
+
if (input.rows.length > 0 && (fileColumn === void 0 || idColumn === void 0 && emailColumn === void 0)) {
|
|
15942
|
+
throw usageError(`${path} needs a file column and a contact_id or email column (columns: ${input.headers.join(", ") || "none"}).`, {
|
|
15943
|
+
field: "source",
|
|
15944
|
+
hint: "Name the columns contact_id (or email) and file. A file path is relative to the CSV."
|
|
15945
|
+
});
|
|
15946
|
+
}
|
|
15947
|
+
const base = input.path === "-" ? process.cwd() : dirname3(input.path);
|
|
15948
|
+
const text5 = (value) => typeof value === "string" || typeof value === "number" ? String(value).trim() : "";
|
|
15949
|
+
const named = input.rows.map((row, index2) => {
|
|
15950
|
+
const file = text5(fileColumn ? row[fileColumn] : void 0);
|
|
15951
|
+
const id = text5(idColumn ? row[idColumn] : void 0);
|
|
15952
|
+
const email = text5(emailColumn ? row[emailColumn] : void 0);
|
|
15953
|
+
return { row: index2 + 1, file: file === "" ? "" : resolve10(base, file), ...id !== "" ? { id } : email !== "" ? { email } : {} };
|
|
15954
|
+
});
|
|
15955
|
+
return { named, input: { path: input.path, sha256: input.sha256 } };
|
|
15956
|
+
}
|
|
15957
|
+
function fileProblem(file) {
|
|
15958
|
+
if (file === "") return { reason: "missing_file", error: "The row names no file." };
|
|
15959
|
+
if (!EXTENSIONS.has(extname5(file).toLowerCase())) return { reason: "unsupported_type", error: "Only PNG, JPEG, WebP, GIF and SVG files upload." };
|
|
15960
|
+
let size;
|
|
15961
|
+
try {
|
|
15962
|
+
const stat4 = statSync6(file);
|
|
15963
|
+
if (!stat4.isFile()) return { reason: "file_unreadable", error: "The path is not a file." };
|
|
15964
|
+
size = stat4.size;
|
|
15965
|
+
} catch {
|
|
15966
|
+
return { reason: "file_unreadable", error: "The file cannot be read." };
|
|
15967
|
+
}
|
|
15968
|
+
if (size === 0) return { reason: "empty_file", error: "The file is empty." };
|
|
15969
|
+
if (size > MAX_BYTES) return { reason: "too_large", error: `The file is over ${MAX_BYTES} bytes.` };
|
|
15970
|
+
return void 0;
|
|
15971
|
+
}
|
|
15972
|
+
function planUploads(named, emails) {
|
|
15973
|
+
const items = [];
|
|
15974
|
+
const local = [];
|
|
15975
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15976
|
+
for (const { row, file, id, email } of named) {
|
|
15977
|
+
const problem = fileProblem(file);
|
|
15978
|
+
if (problem) {
|
|
15979
|
+
local.push(invalidRow(row, problem.reason, problem.error, { file }));
|
|
15980
|
+
continue;
|
|
15981
|
+
}
|
|
15982
|
+
let contactId;
|
|
15983
|
+
if (email !== void 0) {
|
|
15984
|
+
contactId = emails?.get(email.toLowerCase());
|
|
15985
|
+
if (contactId === void 0) {
|
|
15986
|
+
local.push({ row, status: "not_found", reason: "not_in_campaign", error: "No contact of the campaign has this email.", email, file });
|
|
15987
|
+
continue;
|
|
15988
|
+
}
|
|
15989
|
+
} else {
|
|
15990
|
+
contactId = id === void 0 ? void 0 : positiveId(id);
|
|
15991
|
+
if (contactId === void 0) {
|
|
15992
|
+
local.push(invalidRow(row, "invalid_contact", "Name the lead by its contact id or email (<contactId>.<ext> or <email>.<ext>).", { file }));
|
|
15993
|
+
continue;
|
|
15994
|
+
}
|
|
15995
|
+
}
|
|
15996
|
+
if (seen.has(contactId)) {
|
|
15997
|
+
local.push(invalidRow(row, "duplicate_in_file", "An earlier row has an image for this contact.", { id: String(contactId), file }));
|
|
15998
|
+
continue;
|
|
15999
|
+
}
|
|
16000
|
+
seen.add(contactId);
|
|
16001
|
+
items.push({ row, contactId, file });
|
|
16002
|
+
}
|
|
16003
|
+
return { items, local };
|
|
16004
|
+
}
|
|
16005
|
+
async function requirePerProspect(ctx, campaignId, variable) {
|
|
16006
|
+
const res = await ctx.client.request({
|
|
16007
|
+
method: "GET",
|
|
16008
|
+
path: `/v1/campaigns/${campaignId}/image-variables/${encodeURIComponent(variable)}`
|
|
16009
|
+
});
|
|
16010
|
+
const data = unwrap(res.body);
|
|
16011
|
+
const kind = isRecord5(data) && typeof data.kind === "string" ? data.kind : "unknown";
|
|
16012
|
+
if (kind !== "per_prospect") {
|
|
16013
|
+
throw usageError(`${variable} is a ${kind} image variable. Only a per_prospect variable takes one image per lead.`, {
|
|
16014
|
+
field: "variable",
|
|
16015
|
+
next: `kenso image-variables list --campaign-id ${campaignId}`
|
|
16016
|
+
});
|
|
16017
|
+
}
|
|
16018
|
+
}
|
|
16019
|
+
async function uploadChunk(campaignId, variable, chunk, ctx) {
|
|
16020
|
+
const results = [];
|
|
16021
|
+
let remaining;
|
|
16022
|
+
for (const { row, contactId, file } of chunk) {
|
|
16023
|
+
const id = String(contactId);
|
|
16024
|
+
try {
|
|
16025
|
+
const { blob, name } = readUpload(file, "file");
|
|
16026
|
+
const form = new FormData();
|
|
16027
|
+
form.append("file", blob, name);
|
|
16028
|
+
const res = await ctx.client.request({
|
|
16029
|
+
method: "POST",
|
|
16030
|
+
path: `/v1/campaigns/${campaignId}/image-variables/${encodeURIComponent(variable)}/contacts/${contactId}/image`,
|
|
16031
|
+
form,
|
|
16032
|
+
retrySafe: true,
|
|
16033
|
+
signal: ctx.signal
|
|
16034
|
+
});
|
|
16035
|
+
remaining = rateLimitRemaining3(res.headers);
|
|
16036
|
+
const data = unwrap(res.body);
|
|
16037
|
+
const status = isRecord5(data) && typeof data.status === "string" ? data.status : "unknown";
|
|
16038
|
+
const imageKey = isRecord5(data) && typeof data.imageKey === "string" ? { imageKey: data.imageKey } : {};
|
|
16039
|
+
results.push(
|
|
16040
|
+
status === "ready" ? { row, status: "ok", id, file, ...imageKey } : { row, status: "failed", id, file, reason: "not_ready", error: `The image is ${status}, not ready.`, ...imageKey }
|
|
16041
|
+
);
|
|
16042
|
+
} catch (err) {
|
|
16043
|
+
rethrowIfRunStopping(err);
|
|
16044
|
+
const notFound = err instanceof KensoError && err.httpStatus === 404;
|
|
16045
|
+
results.push(notFound ? { row, status: "not_found", id, reason: "not_found", error: err.message, file } : failedRow(row, err, { id, file }));
|
|
16046
|
+
}
|
|
16047
|
+
}
|
|
16048
|
+
return { results, ...remaining !== void 0 ? { rateLimitRemaining: remaining } : {} };
|
|
16049
|
+
}
|
|
16050
|
+
var COMMAND5, EXTENSIONS, MAX_BYTES, command36, upload_default;
|
|
16051
|
+
var init_upload = __esm({
|
|
16052
|
+
"src/commands/images/upload.ts"() {
|
|
16053
|
+
"use strict";
|
|
16054
|
+
init_engine();
|
|
16055
|
+
init_input2();
|
|
16056
|
+
init_errors();
|
|
16057
|
+
init_http();
|
|
16058
|
+
init_transfer();
|
|
16059
|
+
init_common2();
|
|
16060
|
+
init_update();
|
|
16061
|
+
COMMAND5 = "kenso images upload";
|
|
16062
|
+
EXTENSIONS = /* @__PURE__ */ new Set([".png", ".jpg", ".jpeg", ".webp", ".gif", ".svg"]);
|
|
16063
|
+
MAX_BYTES = 1e7;
|
|
16064
|
+
command36 = {
|
|
16065
|
+
resource: "images",
|
|
16066
|
+
action: "upload",
|
|
16067
|
+
summary: "Upload one image per lead into a per_prospect image variable, from a folder or a CSV",
|
|
16068
|
+
brief: "a folder or CSV, one image per lead",
|
|
16069
|
+
effect: "write",
|
|
16070
|
+
doc: {
|
|
16071
|
+
when: "you or your agent made one image per lead (an image tool, code or SVG) and Kenso should store and send them",
|
|
16072
|
+
next: "kenso campaign-images list shows each lead's image"
|
|
16073
|
+
},
|
|
16074
|
+
description: "Sends each file to POST /v1/campaigns/{campaignId}/image-variables/{variableKey}/contacts/{contactId}/image. A folder holds files named <contactId>.<ext> or <email>.<ext>; a CSV has contact_id or email, and file (relative to the CSV). PNG, JPEG, WebP, GIF and SVG upload (Kenso converts an SVG to PNG); other files, emails the campaign lacks and a second file for one lead stay local. Uploads cost no credits and count toward the workspace's daily image uploads. It checks the variable first, so a wrong key or campaign sends nothing. The generation job never replaces an uploaded image, also after a prompt change. Without --yes it prints the plan. Exit 5 when some rows failed or were not found.",
|
|
16075
|
+
flags: {
|
|
16076
|
+
campaign: { type: "string", description: "The campaign id", aliases: ["campaign-id"] },
|
|
16077
|
+
variable: { type: "string", description: "The per_prospect image variable's key, such as hero_image", aliases: ["variable-key"] },
|
|
16078
|
+
out: OUT_FLAG2,
|
|
16079
|
+
concurrency: CONCURRENCY_FLAG
|
|
16080
|
+
},
|
|
16081
|
+
positionals: [
|
|
16082
|
+
{ name: "source", required: true, description: "A folder of <contactId>.<ext> or <email>.<ext> files, or a CSV with contact_id or email, and file" }
|
|
16083
|
+
],
|
|
16084
|
+
examples: [
|
|
16085
|
+
"kenso images upload --campaign 812 --variable hero_image ./images --dry-run",
|
|
16086
|
+
"kenso images upload --campaign 812 --variable hero_image ./images --yes",
|
|
16087
|
+
"kenso images upload --campaign 812 --variable hero_image images.csv --yes"
|
|
16088
|
+
],
|
|
16089
|
+
operationIds: ["image-variables.get", "image-variables.set-contact-image", "contacts.list"],
|
|
16090
|
+
beta: { featureGates: { all: ["campaign_images"] } },
|
|
16091
|
+
dryRun: true,
|
|
16092
|
+
batch: true,
|
|
16093
|
+
async run(ctx, { flags, positionals }) {
|
|
16094
|
+
const campaignId = idFlag(flags, "campaign", COMMAND5);
|
|
16095
|
+
const variable = requireFlag(flags, "variable", COMMAND5, "The key of a per_prospect image variable (kenso image-variables list).");
|
|
16096
|
+
const source = positionals[0];
|
|
16097
|
+
if (source === void 0 || source.trim() === "") {
|
|
16098
|
+
throw usageError(`${COMMAND5} needs a folder or a CSV.`, { field: "source", next: `${COMMAND5} --help` });
|
|
16099
|
+
}
|
|
16100
|
+
let isFolder = false;
|
|
16101
|
+
try {
|
|
16102
|
+
isFolder = source !== "-" && statSync6(source).isDirectory();
|
|
16103
|
+
} catch {
|
|
16104
|
+
throw usageError(`${source} does not exist.`, { field: "source" });
|
|
16105
|
+
}
|
|
16106
|
+
const { named, input } = isFolder ? { named: filesOfFolder(resolve10(source)), input: void 0 } : await filesOfList(source, ctx.stdin);
|
|
16107
|
+
await requirePerProspect(ctx, campaignId, variable);
|
|
16108
|
+
const emails = named.some((n) => n.email !== void 0) ? await emailIndex(ctx, campaignId) : void 0;
|
|
16109
|
+
const { items, local } = planUploads(named, emails);
|
|
16110
|
+
const outcome = await runBatch(
|
|
16111
|
+
{
|
|
16112
|
+
command: "images upload",
|
|
16113
|
+
args: { ...flags, source: source === "-" ? "-" : resolve10(source) },
|
|
16114
|
+
...input ? { input } : {},
|
|
16115
|
+
items,
|
|
16116
|
+
rowOf: (item) => item.row,
|
|
16117
|
+
chunkSize: 1,
|
|
16118
|
+
concurrency: concurrency(flags),
|
|
16119
|
+
execChunk: (chunk, chunkCtx) => uploadChunk(campaignId, variable, chunk, chunkCtx),
|
|
16120
|
+
invalid: local,
|
|
16121
|
+
dryRun: isDryRun(ctx),
|
|
16122
|
+
dryRunExtra: { campaignId, variable, source: isFolder ? "folder" : "file", count: items.length, firstFiles: items.slice(0, 10).map((i) => basename4(i.file)) },
|
|
16123
|
+
applyCommand: `${sameCommand2(COMMAND5, flags, ctx)} ${shellQuote4(source)} --yes`,
|
|
16124
|
+
outDir: stringFlag2(flags, "out")
|
|
16125
|
+
},
|
|
16126
|
+
ctx
|
|
16127
|
+
);
|
|
16128
|
+
return outcome.exitCode;
|
|
16129
|
+
}
|
|
16130
|
+
};
|
|
16131
|
+
upload_default = command36;
|
|
16132
|
+
}
|
|
16133
|
+
});
|
|
16134
|
+
|
|
16135
|
+
// src/commands/images/index.ts
|
|
16136
|
+
var actions16;
|
|
16137
|
+
var init_images2 = __esm({
|
|
16138
|
+
"src/commands/images/index.ts"() {
|
|
16139
|
+
"use strict";
|
|
16140
|
+
actions16 = {
|
|
16141
|
+
upload: () => Promise.resolve().then(() => (init_upload(), upload_exports)).then((m) => m.default)
|
|
16142
|
+
};
|
|
16143
|
+
}
|
|
16144
|
+
});
|
|
16145
|
+
|
|
15902
16146
|
// src/commands/import/import.ts
|
|
15903
16147
|
var import_exports3 = {};
|
|
15904
16148
|
__export(import_exports3, {
|
|
@@ -15906,14 +16150,14 @@ __export(import_exports3, {
|
|
|
15906
16150
|
default: () => import_default3
|
|
15907
16151
|
});
|
|
15908
16152
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
15909
|
-
import { basename as
|
|
16153
|
+
import { basename as basename5, extname as extname6, resolve as resolve11 } from "node:path";
|
|
15910
16154
|
import { setTimeout as delay8 } from "node:timers/promises";
|
|
15911
16155
|
async function readUpload3(file) {
|
|
15912
16156
|
if (file === "-") throw usageError("An import uploads a file: name the CSV file instead of - (stdin).", { field: "file" });
|
|
15913
|
-
if (
|
|
15914
|
-
const path =
|
|
16157
|
+
if (extname6(file).toLowerCase() !== ".csv") throw usageError("An import takes a .csv file with a header row.", { field: "file" });
|
|
16158
|
+
const path = resolve11(file);
|
|
15915
16159
|
try {
|
|
15916
|
-
return { bytes: await readFile8(path), name:
|
|
16160
|
+
return { bytes: await readFile8(path), name: basename5(path), path };
|
|
15917
16161
|
} catch (err) {
|
|
15918
16162
|
const code = err.code;
|
|
15919
16163
|
throw new KensoError({ code: "file_unreadable", message: `Cannot read ${file}${code ? ` (${code})` : ""}.`, exitCode: ExitCode.Usage, field: "file" });
|
|
@@ -15926,15 +16170,15 @@ function columnChanges(maps, columns2) {
|
|
|
15926
16170
|
if (at < 1) throw usageError(`--map takes "Header=field" (got "${entry}").`, { field: "map", hint: 'Skip a column with "Header=".' });
|
|
15927
16171
|
const header2 = entry.slice(0, at).trim();
|
|
15928
16172
|
const field = entry.slice(at + 1).trim();
|
|
15929
|
-
const
|
|
15930
|
-
if (!
|
|
16173
|
+
const column2 = byHeader.get(header2.toLowerCase());
|
|
16174
|
+
if (!column2) {
|
|
15931
16175
|
throw usageError(`The file has no column "${header2}".`, { field: "map", hint: `Columns: ${columns2.map((c) => c.header).join(", ")}.` });
|
|
15932
16176
|
}
|
|
15933
16177
|
if (field === "new" || field.startsWith("new:")) {
|
|
15934
16178
|
const type = field.slice(4).trim();
|
|
15935
|
-
return { index:
|
|
16179
|
+
return { index: column2.index, newField: type ? { type } : {} };
|
|
15936
16180
|
}
|
|
15937
|
-
return { index:
|
|
16181
|
+
return { index: column2.index, field: field === "" ? null : field };
|
|
15938
16182
|
});
|
|
15939
16183
|
}
|
|
15940
16184
|
function planView(found) {
|
|
@@ -15990,7 +16234,7 @@ async function waitUntilFinished(ctx, id, timeoutMs2) {
|
|
|
15990
16234
|
await delay8(POLL_MS2, void 0, { signal: ctx.signal });
|
|
15991
16235
|
}
|
|
15992
16236
|
}
|
|
15993
|
-
var OBJECTS2, DEFAULT_TIMEOUT3, POLL_MS2, FINISHED,
|
|
16237
|
+
var OBJECTS2, DEFAULT_TIMEOUT3, POLL_MS2, FINISHED, command37, import_default3;
|
|
15994
16238
|
var init_import3 = __esm({
|
|
15995
16239
|
"src/commands/import/import.ts"() {
|
|
15996
16240
|
"use strict";
|
|
@@ -16003,7 +16247,7 @@ var init_import3 = __esm({
|
|
|
16003
16247
|
DEFAULT_TIMEOUT3 = "30m";
|
|
16004
16248
|
POLL_MS2 = 2e3;
|
|
16005
16249
|
FINISHED = /* @__PURE__ */ new Set(["done", "failed"]);
|
|
16006
|
-
|
|
16250
|
+
command37 = {
|
|
16007
16251
|
resource: "import",
|
|
16008
16252
|
action: "",
|
|
16009
16253
|
summary: "Import accounts, people or deals from a CSV file: Kenso proposes the mapping, you approve, it runs in the background",
|
|
@@ -16115,27 +16359,27 @@ var init_import3 = __esm({
|
|
|
16115
16359
|
return finished.status === "done" ? ExitCode.Ok : ExitCode.Error;
|
|
16116
16360
|
}
|
|
16117
16361
|
};
|
|
16118
|
-
import_default3 =
|
|
16362
|
+
import_default3 = command37;
|
|
16119
16363
|
}
|
|
16120
16364
|
});
|
|
16121
16365
|
|
|
16122
16366
|
// src/commands/import/index.ts
|
|
16123
|
-
var
|
|
16367
|
+
var actions17;
|
|
16124
16368
|
var init_import4 = __esm({
|
|
16125
16369
|
"src/commands/import/index.ts"() {
|
|
16126
16370
|
"use strict";
|
|
16127
|
-
|
|
16371
|
+
actions17 = {
|
|
16128
16372
|
"": async () => (await Promise.resolve().then(() => (init_import3(), import_exports3))).default
|
|
16129
16373
|
};
|
|
16130
16374
|
}
|
|
16131
16375
|
});
|
|
16132
16376
|
|
|
16133
16377
|
// src/commands/jobs/index.ts
|
|
16134
|
-
var
|
|
16378
|
+
var actions18;
|
|
16135
16379
|
var init_jobs2 = __esm({
|
|
16136
16380
|
"src/commands/jobs/index.ts"() {
|
|
16137
16381
|
"use strict";
|
|
16138
|
-
|
|
16382
|
+
actions18 = {
|
|
16139
16383
|
wait: () => Promise.resolve().then(() => (init_wait(), wait_exports)).then((m) => m.default)
|
|
16140
16384
|
};
|
|
16141
16385
|
}
|
|
@@ -16289,11 +16533,11 @@ var init_layouts = __esm({
|
|
|
16289
16533
|
});
|
|
16290
16534
|
|
|
16291
16535
|
// src/commands/layouts/index.ts
|
|
16292
|
-
var
|
|
16536
|
+
var actions19;
|
|
16293
16537
|
var init_layouts2 = __esm({
|
|
16294
16538
|
"src/commands/layouts/index.ts"() {
|
|
16295
16539
|
"use strict";
|
|
16296
|
-
|
|
16540
|
+
actions19 = {
|
|
16297
16541
|
show: () => Promise.resolve().then(() => (init_layouts(), layouts_exports)).then((m) => m.show),
|
|
16298
16542
|
set: () => Promise.resolve().then(() => (init_layouts(), layouts_exports)).then((m) => m.set),
|
|
16299
16543
|
reset: () => Promise.resolve().then(() => (init_layouts(), layouts_exports)).then((m) => m.reset)
|
|
@@ -16328,7 +16572,7 @@ function readable(row) {
|
|
|
16328
16572
|
const parts2 = [time, `[${row.status}]`, row.method, row.pathTemplate, row.errorCode, `${row.durationMs}ms`, row.apiKeyId, row.requestId];
|
|
16329
16573
|
return parts2.filter((p) => p !== void 0 && p !== "").join(" ");
|
|
16330
16574
|
}
|
|
16331
|
-
var MIN_INTERVAL_MS, MAX_INTERVAL_MS, MAX_SINCE_MS, OVERLAP_MS, MAX_PAGES, RATE_LIMITED_WAIT_MS, isOwnPoll, pad,
|
|
16575
|
+
var MIN_INTERVAL_MS, MAX_INTERVAL_MS, MAX_SINCE_MS, OVERLAP_MS, MAX_PAGES, RATE_LIMITED_WAIT_MS, isOwnPoll, pad, command38, tail_default;
|
|
16332
16576
|
var init_tail = __esm({
|
|
16333
16577
|
"src/commands/logs/tail.ts"() {
|
|
16334
16578
|
"use strict";
|
|
@@ -16344,7 +16588,7 @@ var init_tail = __esm({
|
|
|
16344
16588
|
RATE_LIMITED_WAIT_MS = 3e4;
|
|
16345
16589
|
isOwnPoll = (row) => row.method === "GET" && row.pathTemplate === "/v1/api-requests" && row.userAgent?.startsWith("kenso-cli/") === true;
|
|
16346
16590
|
pad = (n) => String(n).padStart(2, "0");
|
|
16347
|
-
|
|
16591
|
+
command38 = {
|
|
16348
16592
|
resource: "logs",
|
|
16349
16593
|
action: "tail",
|
|
16350
16594
|
summary: "Stream your workspace's new API request log rows",
|
|
@@ -16451,16 +16695,16 @@ var init_tail = __esm({
|
|
|
16451
16695
|
return ExitCode.Ok;
|
|
16452
16696
|
}
|
|
16453
16697
|
};
|
|
16454
|
-
tail_default =
|
|
16698
|
+
tail_default = command38;
|
|
16455
16699
|
}
|
|
16456
16700
|
});
|
|
16457
16701
|
|
|
16458
16702
|
// src/commands/logs/index.ts
|
|
16459
|
-
var
|
|
16703
|
+
var actions20;
|
|
16460
16704
|
var init_logs = __esm({
|
|
16461
16705
|
"src/commands/logs/index.ts"() {
|
|
16462
16706
|
"use strict";
|
|
16463
|
-
|
|
16707
|
+
actions20 = {
|
|
16464
16708
|
tail: () => Promise.resolve().then(() => (init_tail(), tail_exports)).then((m) => m.default)
|
|
16465
16709
|
};
|
|
16466
16710
|
}
|
|
@@ -16524,7 +16768,7 @@ function isRecord9(value) {
|
|
|
16524
16768
|
function textOf(result) {
|
|
16525
16769
|
return (result.content ?? []).filter((part) => part.type === "text" && typeof part.text === "string").map((part) => part.text).join("\n");
|
|
16526
16770
|
}
|
|
16527
|
-
var
|
|
16771
|
+
var command39, call_default;
|
|
16528
16772
|
var init_call = __esm({
|
|
16529
16773
|
"src/commands/mcp/call.ts"() {
|
|
16530
16774
|
"use strict";
|
|
@@ -16532,7 +16776,7 @@ var init_call = __esm({
|
|
|
16532
16776
|
init_exit_codes();
|
|
16533
16777
|
init_input();
|
|
16534
16778
|
init_connect4();
|
|
16535
|
-
|
|
16779
|
+
command39 = {
|
|
16536
16780
|
resource: "mcp",
|
|
16537
16781
|
action: "call",
|
|
16538
16782
|
summary: "Call a hosted Kenso MCP tool, such as list_skills",
|
|
@@ -16592,7 +16836,7 @@ var init_call = __esm({
|
|
|
16592
16836
|
return ExitCode.Ok;
|
|
16593
16837
|
}
|
|
16594
16838
|
};
|
|
16595
|
-
call_default =
|
|
16839
|
+
call_default = command39;
|
|
16596
16840
|
}
|
|
16597
16841
|
});
|
|
16598
16842
|
|
|
@@ -16601,13 +16845,13 @@ var tools_exports = {};
|
|
|
16601
16845
|
__export(tools_exports, {
|
|
16602
16846
|
default: () => tools_default
|
|
16603
16847
|
});
|
|
16604
|
-
var
|
|
16848
|
+
var command40, tools_default;
|
|
16605
16849
|
var init_tools = __esm({
|
|
16606
16850
|
"src/commands/mcp/tools.ts"() {
|
|
16607
16851
|
"use strict";
|
|
16608
16852
|
init_exit_codes();
|
|
16609
16853
|
init_connect4();
|
|
16610
|
-
|
|
16854
|
+
command40 = {
|
|
16611
16855
|
resource: "mcp",
|
|
16612
16856
|
action: "tools",
|
|
16613
16857
|
summary: "List the hosted Kenso MCP's tools",
|
|
@@ -16623,16 +16867,16 @@ var init_tools = __esm({
|
|
|
16623
16867
|
return ExitCode.Ok;
|
|
16624
16868
|
}
|
|
16625
16869
|
};
|
|
16626
|
-
tools_default =
|
|
16870
|
+
tools_default = command40;
|
|
16627
16871
|
}
|
|
16628
16872
|
});
|
|
16629
16873
|
|
|
16630
16874
|
// src/commands/mcp/index.ts
|
|
16631
|
-
var
|
|
16875
|
+
var actions21;
|
|
16632
16876
|
var init_mcp = __esm({
|
|
16633
16877
|
"src/commands/mcp/index.ts"() {
|
|
16634
16878
|
"use strict";
|
|
16635
|
-
|
|
16879
|
+
actions21 = {
|
|
16636
16880
|
call: () => Promise.resolve().then(() => (init_call(), call_exports)).then((m) => m.default),
|
|
16637
16881
|
tools: () => Promise.resolve().then(() => (init_tools(), tools_exports)).then((m) => m.default)
|
|
16638
16882
|
};
|
|
@@ -16676,14 +16920,14 @@ var list_exports = {};
|
|
|
16676
16920
|
__export(list_exports, {
|
|
16677
16921
|
default: () => list_default
|
|
16678
16922
|
});
|
|
16679
|
-
var
|
|
16923
|
+
var command41, list_default;
|
|
16680
16924
|
var init_list = __esm({
|
|
16681
16925
|
"src/commands/notes/list.ts"() {
|
|
16682
16926
|
"use strict";
|
|
16683
16927
|
init_errors();
|
|
16684
16928
|
init_exit_codes();
|
|
16685
16929
|
init_target();
|
|
16686
|
-
|
|
16930
|
+
command41 = {
|
|
16687
16931
|
resource: "notes",
|
|
16688
16932
|
action: "list",
|
|
16689
16933
|
summary: "List the notes on an account, a person or a deal, or every comment under one note",
|
|
@@ -16717,7 +16961,7 @@ var init_list = __esm({
|
|
|
16717
16961
|
return ExitCode.Ok;
|
|
16718
16962
|
}
|
|
16719
16963
|
};
|
|
16720
|
-
list_default =
|
|
16964
|
+
list_default = command41;
|
|
16721
16965
|
}
|
|
16722
16966
|
});
|
|
16723
16967
|
|
|
@@ -16732,7 +16976,7 @@ async function bodyText(ctx, value, next) {
|
|
|
16732
16976
|
if (text5.trim() === "") throw usageError("--body cannot be empty: the note's text, in markdown (--body - reads stdin).", { field: "body", next });
|
|
16733
16977
|
return text5;
|
|
16734
16978
|
}
|
|
16735
|
-
var
|
|
16979
|
+
var command42, add_default;
|
|
16736
16980
|
var init_add = __esm({
|
|
16737
16981
|
"src/commands/notes/add.ts"() {
|
|
16738
16982
|
"use strict";
|
|
@@ -16742,7 +16986,7 @@ var init_add = __esm({
|
|
|
16742
16986
|
init_http();
|
|
16743
16987
|
init_input();
|
|
16744
16988
|
init_target();
|
|
16745
|
-
|
|
16989
|
+
command42 = {
|
|
16746
16990
|
resource: "notes",
|
|
16747
16991
|
action: "add",
|
|
16748
16992
|
summary: "Write a note on an account, a person or a deal, or a comment under a note",
|
|
@@ -16776,7 +17020,7 @@ var init_add = __esm({
|
|
|
16776
17020
|
return ExitCode.Ok;
|
|
16777
17021
|
}
|
|
16778
17022
|
};
|
|
16779
|
-
add_default =
|
|
17023
|
+
add_default = command42;
|
|
16780
17024
|
}
|
|
16781
17025
|
});
|
|
16782
17026
|
|
|
@@ -16785,7 +17029,7 @@ var edit_exports = {};
|
|
|
16785
17029
|
__export(edit_exports, {
|
|
16786
17030
|
default: () => edit_default
|
|
16787
17031
|
});
|
|
16788
|
-
var
|
|
17032
|
+
var command43, edit_default;
|
|
16789
17033
|
var init_edit = __esm({
|
|
16790
17034
|
"src/commands/notes/edit.ts"() {
|
|
16791
17035
|
"use strict";
|
|
@@ -16795,7 +17039,7 @@ var init_edit = __esm({
|
|
|
16795
17039
|
init_http();
|
|
16796
17040
|
init_add();
|
|
16797
17041
|
init_target();
|
|
16798
|
-
|
|
17042
|
+
command43 = {
|
|
16799
17043
|
resource: "notes",
|
|
16800
17044
|
action: "edit",
|
|
16801
17045
|
summary: "Change a note's text, or pin or unpin it",
|
|
@@ -16826,7 +17070,7 @@ var init_edit = __esm({
|
|
|
16826
17070
|
return ExitCode.Ok;
|
|
16827
17071
|
}
|
|
16828
17072
|
};
|
|
16829
|
-
edit_default =
|
|
17073
|
+
edit_default = command43;
|
|
16830
17074
|
}
|
|
16831
17075
|
});
|
|
16832
17076
|
|
|
@@ -16835,7 +17079,7 @@ var delete_exports = {};
|
|
|
16835
17079
|
__export(delete_exports, {
|
|
16836
17080
|
default: () => delete_default
|
|
16837
17081
|
});
|
|
16838
|
-
var
|
|
17082
|
+
var command44, delete_default;
|
|
16839
17083
|
var init_delete = __esm({
|
|
16840
17084
|
"src/commands/notes/delete.ts"() {
|
|
16841
17085
|
"use strict";
|
|
@@ -16843,7 +17087,7 @@ var init_delete = __esm({
|
|
|
16843
17087
|
init_dry_run();
|
|
16844
17088
|
init_exit_codes();
|
|
16845
17089
|
init_target();
|
|
16846
|
-
|
|
17090
|
+
command44 = {
|
|
16847
17091
|
resource: "notes",
|
|
16848
17092
|
action: "delete",
|
|
16849
17093
|
summary: "Delete a note or a comment (its author or a workspace admin)",
|
|
@@ -16869,16 +17113,16 @@ var init_delete = __esm({
|
|
|
16869
17113
|
return ExitCode.Ok;
|
|
16870
17114
|
}
|
|
16871
17115
|
};
|
|
16872
|
-
delete_default =
|
|
17116
|
+
delete_default = command44;
|
|
16873
17117
|
}
|
|
16874
17118
|
});
|
|
16875
17119
|
|
|
16876
17120
|
// src/commands/notes/index.ts
|
|
16877
|
-
var
|
|
17121
|
+
var actions22;
|
|
16878
17122
|
var init_notes = __esm({
|
|
16879
17123
|
"src/commands/notes/index.ts"() {
|
|
16880
17124
|
"use strict";
|
|
16881
|
-
|
|
17125
|
+
actions22 = {
|
|
16882
17126
|
list: () => Promise.resolve().then(() => (init_list(), list_exports)).then((m) => m.default),
|
|
16883
17127
|
add: () => Promise.resolve().then(() => (init_add(), add_exports)).then((m) => m.default),
|
|
16884
17128
|
edit: () => Promise.resolve().then(() => (init_edit(), edit_exports)).then((m) => m.default),
|
|
@@ -16905,7 +17149,7 @@ async function categoryOf(ctx, stage) {
|
|
|
16905
17149
|
throw err;
|
|
16906
17150
|
}
|
|
16907
17151
|
}
|
|
16908
|
-
var KEY, ID,
|
|
17152
|
+
var KEY, ID, command45, move_default;
|
|
16909
17153
|
var init_move = __esm({
|
|
16910
17154
|
"src/commands/opportunities/move.ts"() {
|
|
16911
17155
|
"use strict";
|
|
@@ -16915,7 +17159,7 @@ var init_move = __esm({
|
|
|
16915
17159
|
init_http();
|
|
16916
17160
|
KEY = /^[a-z][a-z0-9_]{0,62}$/;
|
|
16917
17161
|
ID = /^[1-9]\d*$/;
|
|
16918
|
-
|
|
17162
|
+
command45 = {
|
|
16919
17163
|
resource: "opportunities",
|
|
16920
17164
|
action: "move",
|
|
16921
17165
|
summary: "Move a deal to a stage or another pipeline, with its won or lost reason",
|
|
@@ -16984,7 +17228,7 @@ var init_move = __esm({
|
|
|
16984
17228
|
return ExitCode.Ok;
|
|
16985
17229
|
}
|
|
16986
17230
|
};
|
|
16987
|
-
move_default =
|
|
17231
|
+
move_default = command45;
|
|
16988
17232
|
}
|
|
16989
17233
|
});
|
|
16990
17234
|
|
|
@@ -16993,14 +17237,14 @@ var stage_history_exports = {};
|
|
|
16993
17237
|
__export(stage_history_exports, {
|
|
16994
17238
|
default: () => stage_history_default
|
|
16995
17239
|
});
|
|
16996
|
-
var
|
|
17240
|
+
var command46, stage_history_default;
|
|
16997
17241
|
var init_stage_history = __esm({
|
|
16998
17242
|
"src/commands/opportunities/stage-history.ts"() {
|
|
16999
17243
|
"use strict";
|
|
17000
17244
|
init_errors();
|
|
17001
17245
|
init_exit_codes();
|
|
17002
17246
|
init_http();
|
|
17003
|
-
|
|
17247
|
+
command46 = {
|
|
17004
17248
|
resource: "opportunities",
|
|
17005
17249
|
action: "stage-history",
|
|
17006
17250
|
summary: "Show a deal's stage history: each stage, when, who moved it and how long it sat there",
|
|
@@ -17025,7 +17269,7 @@ var init_stage_history = __esm({
|
|
|
17025
17269
|
return ExitCode.Ok;
|
|
17026
17270
|
}
|
|
17027
17271
|
};
|
|
17028
|
-
stage_history_default =
|
|
17272
|
+
stage_history_default = command46;
|
|
17029
17273
|
}
|
|
17030
17274
|
});
|
|
17031
17275
|
|
|
@@ -17081,11 +17325,11 @@ var init_bulk_delete2 = __esm({
|
|
|
17081
17325
|
});
|
|
17082
17326
|
|
|
17083
17327
|
// src/commands/opportunities/index.ts
|
|
17084
|
-
var
|
|
17328
|
+
var actions23;
|
|
17085
17329
|
var init_opportunities = __esm({
|
|
17086
17330
|
"src/commands/opportunities/index.ts"() {
|
|
17087
17331
|
"use strict";
|
|
17088
|
-
|
|
17332
|
+
actions23 = {
|
|
17089
17333
|
move: () => Promise.resolve().then(() => (init_move(), move_exports)).then((m) => m.default),
|
|
17090
17334
|
"stage-history": () => Promise.resolve().then(() => (init_stage_history(), stage_history_exports)).then((m) => m.default),
|
|
17091
17335
|
"bulk-update": () => Promise.resolve().then(() => (init_bulk_update3(), bulk_update_exports2)).then((m) => m.default),
|
|
@@ -17176,7 +17420,7 @@ async function emailFindCredits(ctx, items, findEmails) {
|
|
|
17176
17420
|
const credits3 = price === void 0 && rows > 0 ? { ...check, needed: null, sufficient: null } : check;
|
|
17177
17421
|
return { emailFindRows: rows, credits: credits3, ...estimateError ? { estimateError } : {} };
|
|
17178
17422
|
}
|
|
17179
|
-
var
|
|
17423
|
+
var COMMAND6, CHUNK_SIZE6, ALIASES3, PERSON_FIELDS, ACCOUNT_NOT_FOUND, command47, import_default4;
|
|
17180
17424
|
var init_import5 = __esm({
|
|
17181
17425
|
"src/commands/people/import.ts"() {
|
|
17182
17426
|
"use strict";
|
|
@@ -17188,7 +17432,7 @@ var init_import5 = __esm({
|
|
|
17188
17432
|
init_rate_card();
|
|
17189
17433
|
init_common();
|
|
17190
17434
|
init_columns();
|
|
17191
|
-
|
|
17435
|
+
COMMAND6 = "people import";
|
|
17192
17436
|
CHUNK_SIZE6 = 200;
|
|
17193
17437
|
ALIASES3 = {
|
|
17194
17438
|
email: "email",
|
|
@@ -17211,7 +17455,7 @@ var init_import5 = __esm({
|
|
|
17211
17455
|
};
|
|
17212
17456
|
PERSON_FIELDS = ["email", "fullName", "firstName", "lastName", "linkedinUrl", "title"];
|
|
17213
17457
|
ACCOUNT_NOT_FOUND = "No account in this workspace has that domain. The person was saved without an account: add the account (kenso accounts import) and run the same command again.";
|
|
17214
|
-
|
|
17458
|
+
command47 = {
|
|
17215
17459
|
resource: "people",
|
|
17216
17460
|
action: "import",
|
|
17217
17461
|
summary: "Create or match people from a CSV or JSONL file, optionally onto accounts",
|
|
@@ -17265,7 +17509,7 @@ var init_import5 = __esm({
|
|
|
17265
17509
|
const dryRun2 = ctx.flags.dryRun === true || ctx.flags.yes !== true;
|
|
17266
17510
|
const outcome = await runBatch(
|
|
17267
17511
|
{
|
|
17268
|
-
command:
|
|
17512
|
+
command: COMMAND6,
|
|
17269
17513
|
args: { ...flags },
|
|
17270
17514
|
input: { path: input.path, sha256: input.sha256 },
|
|
17271
17515
|
items,
|
|
@@ -17276,7 +17520,7 @@ var init_import5 = __esm({
|
|
|
17276
17520
|
invalid: invalid2,
|
|
17277
17521
|
dryRun: dryRun2,
|
|
17278
17522
|
dryRunExtra: dryRun2 ? { mapping: columns2.mapping, ignoredColumns: columns2.ignored, findEmails, ...await emailFindCredits(ctx, items, findEmails) } : void 0,
|
|
17279
|
-
applyCommand: commandLine2(ctx,
|
|
17523
|
+
applyCommand: commandLine2(ctx, COMMAND6, args, ["--yes"]),
|
|
17280
17524
|
outDir: stringFlag(flags.out),
|
|
17281
17525
|
summarize: summarize3
|
|
17282
17526
|
},
|
|
@@ -17285,7 +17529,7 @@ var init_import5 = __esm({
|
|
|
17285
17529
|
return outcome.exitCode;
|
|
17286
17530
|
}
|
|
17287
17531
|
};
|
|
17288
|
-
import_default4 =
|
|
17532
|
+
import_default4 = command47;
|
|
17289
17533
|
}
|
|
17290
17534
|
});
|
|
17291
17535
|
|
|
@@ -17346,7 +17590,7 @@ var merge_exports2 = {};
|
|
|
17346
17590
|
__export(merge_exports2, {
|
|
17347
17591
|
default: () => merge_default2
|
|
17348
17592
|
});
|
|
17349
|
-
var
|
|
17593
|
+
var command48, merge_default2;
|
|
17350
17594
|
var init_merge2 = __esm({
|
|
17351
17595
|
"src/commands/people/merge.ts"() {
|
|
17352
17596
|
"use strict";
|
|
@@ -17355,7 +17599,7 @@ var init_merge2 = __esm({
|
|
|
17355
17599
|
init_exit_codes();
|
|
17356
17600
|
init_http();
|
|
17357
17601
|
init_common2();
|
|
17358
|
-
|
|
17602
|
+
command48 = {
|
|
17359
17603
|
resource: "people",
|
|
17360
17604
|
action: "merge",
|
|
17361
17605
|
summary: "Merge a person into the one you keep. --dry-run shows what would move and writes nothing",
|
|
@@ -17406,16 +17650,16 @@ var init_merge2 = __esm({
|
|
|
17406
17650
|
return ExitCode.Ok;
|
|
17407
17651
|
}
|
|
17408
17652
|
};
|
|
17409
|
-
merge_default2 =
|
|
17653
|
+
merge_default2 = command48;
|
|
17410
17654
|
}
|
|
17411
17655
|
});
|
|
17412
17656
|
|
|
17413
17657
|
// src/commands/people/index.ts
|
|
17414
|
-
var
|
|
17658
|
+
var actions24;
|
|
17415
17659
|
var init_people = __esm({
|
|
17416
17660
|
"src/commands/people/index.ts"() {
|
|
17417
17661
|
"use strict";
|
|
17418
|
-
|
|
17662
|
+
actions24 = {
|
|
17419
17663
|
import: () => Promise.resolve().then(() => (init_import5(), import_exports4)).then((m) => m.default),
|
|
17420
17664
|
"bulk-update": () => Promise.resolve().then(() => (init_bulk_update4(), bulk_update_exports3)).then((m) => m.default),
|
|
17421
17665
|
"bulk-delete": () => Promise.resolve().then(() => (init_bulk_delete3(), bulk_delete_exports3)).then((m) => m.default),
|
|
@@ -17444,7 +17688,7 @@ function rule(stage) {
|
|
|
17444
17688
|
isDefault: stage.isDefaultRequiredFields
|
|
17445
17689
|
};
|
|
17446
17690
|
}
|
|
17447
|
-
var ID2,
|
|
17691
|
+
var ID2, command49, stage_rules_default;
|
|
17448
17692
|
var init_stage_rules = __esm({
|
|
17449
17693
|
"src/commands/pipelines/stage-rules.ts"() {
|
|
17450
17694
|
"use strict";
|
|
@@ -17453,7 +17697,7 @@ var init_stage_rules = __esm({
|
|
|
17453
17697
|
init_exit_codes();
|
|
17454
17698
|
init_http();
|
|
17455
17699
|
ID2 = /^[1-9]\d*$/;
|
|
17456
|
-
|
|
17700
|
+
command49 = {
|
|
17457
17701
|
resource: "pipelines",
|
|
17458
17702
|
action: "stage-rules",
|
|
17459
17703
|
summary: "List or set the fields a deal should have in each stage",
|
|
@@ -17527,16 +17771,16 @@ var init_stage_rules = __esm({
|
|
|
17527
17771
|
return ExitCode.Ok;
|
|
17528
17772
|
}
|
|
17529
17773
|
};
|
|
17530
|
-
stage_rules_default =
|
|
17774
|
+
stage_rules_default = command49;
|
|
17531
17775
|
}
|
|
17532
17776
|
});
|
|
17533
17777
|
|
|
17534
17778
|
// src/commands/pipelines/index.ts
|
|
17535
|
-
var
|
|
17779
|
+
var actions25;
|
|
17536
17780
|
var init_pipelines = __esm({
|
|
17537
17781
|
"src/commands/pipelines/index.ts"() {
|
|
17538
17782
|
"use strict";
|
|
17539
|
-
|
|
17783
|
+
actions25 = {
|
|
17540
17784
|
"stage-rules": () => Promise.resolve().then(() => (init_stage_rules(), stage_rules_exports)).then((m) => m.default)
|
|
17541
17785
|
};
|
|
17542
17786
|
}
|
|
@@ -17547,7 +17791,7 @@ var run_exports2 = {};
|
|
|
17547
17791
|
__export(run_exports2, {
|
|
17548
17792
|
default: () => run_default
|
|
17549
17793
|
});
|
|
17550
|
-
var REPORTS,
|
|
17794
|
+
var REPORTS, command50, run_default;
|
|
17551
17795
|
var init_run2 = __esm({
|
|
17552
17796
|
"src/commands/reports/run.ts"() {
|
|
17553
17797
|
"use strict";
|
|
@@ -17555,7 +17799,7 @@ var init_run2 = __esm({
|
|
|
17555
17799
|
init_exit_codes();
|
|
17556
17800
|
init_http();
|
|
17557
17801
|
REPORTS = ["pipeline_by_stage", "won_by_month", "stage_conversion", "time_in_stage", "won_by_source_campaign", "activity_by_member"];
|
|
17558
|
-
|
|
17802
|
+
command50 = {
|
|
17559
17803
|
resource: "reports",
|
|
17560
17804
|
action: "run",
|
|
17561
17805
|
summary: "Run a stock pipeline report and print its table",
|
|
@@ -17627,7 +17871,7 @@ var init_run2 = __esm({
|
|
|
17627
17871
|
return ExitCode.Ok;
|
|
17628
17872
|
}
|
|
17629
17873
|
};
|
|
17630
|
-
run_default =
|
|
17874
|
+
run_default = command50;
|
|
17631
17875
|
}
|
|
17632
17876
|
});
|
|
17633
17877
|
|
|
@@ -17636,14 +17880,14 @@ var summary_exports = {};
|
|
|
17636
17880
|
__export(summary_exports, {
|
|
17637
17881
|
default: () => summary_default
|
|
17638
17882
|
});
|
|
17639
|
-
var
|
|
17883
|
+
var command51, summary_default;
|
|
17640
17884
|
var init_summary = __esm({
|
|
17641
17885
|
"src/commands/reports/summary.ts"() {
|
|
17642
17886
|
"use strict";
|
|
17643
17887
|
init_errors();
|
|
17644
17888
|
init_exit_codes();
|
|
17645
17889
|
init_http();
|
|
17646
|
-
|
|
17890
|
+
command51 = {
|
|
17647
17891
|
resource: "reports",
|
|
17648
17892
|
action: "summary",
|
|
17649
17893
|
summary: "Read where the period stands and what needs you",
|
|
@@ -17705,16 +17949,16 @@ var init_summary = __esm({
|
|
|
17705
17949
|
return ExitCode.Ok;
|
|
17706
17950
|
}
|
|
17707
17951
|
};
|
|
17708
|
-
summary_default =
|
|
17952
|
+
summary_default = command51;
|
|
17709
17953
|
}
|
|
17710
17954
|
});
|
|
17711
17955
|
|
|
17712
17956
|
// src/commands/reports/index.ts
|
|
17713
|
-
var
|
|
17957
|
+
var actions26;
|
|
17714
17958
|
var init_reports = __esm({
|
|
17715
17959
|
"src/commands/reports/index.ts"() {
|
|
17716
17960
|
"use strict";
|
|
17717
|
-
|
|
17961
|
+
actions26 = {
|
|
17718
17962
|
run: () => Promise.resolve().then(() => (init_run2(), run_exports2)).then((m) => m.default),
|
|
17719
17963
|
summary: () => Promise.resolve().then(() => (init_summary(), summary_exports)).then((m) => m.default)
|
|
17720
17964
|
};
|
|
@@ -17726,14 +17970,14 @@ var list_exports2 = {};
|
|
|
17726
17970
|
__export(list_exports2, {
|
|
17727
17971
|
default: () => list_default2
|
|
17728
17972
|
});
|
|
17729
|
-
var
|
|
17973
|
+
var command52, list_default2;
|
|
17730
17974
|
var init_list2 = __esm({
|
|
17731
17975
|
"src/commands/runs/list.ts"() {
|
|
17732
17976
|
"use strict";
|
|
17733
17977
|
init_runs();
|
|
17734
17978
|
init_errors();
|
|
17735
17979
|
init_exit_codes();
|
|
17736
|
-
|
|
17980
|
+
command52 = {
|
|
17737
17981
|
resource: "runs",
|
|
17738
17982
|
action: "list",
|
|
17739
17983
|
summary: "List batch runs, newest first (finds an interrupted run)",
|
|
@@ -17755,7 +17999,7 @@ var init_list2 = __esm({
|
|
|
17755
17999
|
return ExitCode.Ok;
|
|
17756
18000
|
}
|
|
17757
18001
|
};
|
|
17758
|
-
list_default2 =
|
|
18002
|
+
list_default2 = command52;
|
|
17759
18003
|
}
|
|
17760
18004
|
});
|
|
17761
18005
|
|
|
@@ -17765,8 +18009,8 @@ __export(show_exports2, {
|
|
|
17765
18009
|
default: () => show_default2
|
|
17766
18010
|
});
|
|
17767
18011
|
import { existsSync as existsSync8, readFileSync as readFileSync16 } from "node:fs";
|
|
17768
|
-
import { join as
|
|
17769
|
-
var FILES,
|
|
18012
|
+
import { join as join19 } from "node:path";
|
|
18013
|
+
var FILES, command53, show_default2;
|
|
17770
18014
|
var init_show2 = __esm({
|
|
17771
18015
|
"src/commands/runs/show.ts"() {
|
|
17772
18016
|
"use strict";
|
|
@@ -17781,7 +18025,7 @@ var init_show2 = __esm({
|
|
|
17781
18025
|
["plan", "plan.json"],
|
|
17782
18026
|
["summary", "summary.json"]
|
|
17783
18027
|
];
|
|
17784
|
-
|
|
18028
|
+
command53 = {
|
|
17785
18029
|
resource: "runs",
|
|
17786
18030
|
action: "show",
|
|
17787
18031
|
summary: "Show one batch run and its files",
|
|
@@ -17794,7 +18038,7 @@ var init_show2 = __esm({
|
|
|
17794
18038
|
const { dir: dir3, ...record3 } = run;
|
|
17795
18039
|
const files = { dir: dir3 };
|
|
17796
18040
|
for (const [key, name] of FILES) {
|
|
17797
|
-
const path =
|
|
18041
|
+
const path = join19(dir3, name);
|
|
17798
18042
|
if (existsSync8(path)) files[key] = path;
|
|
17799
18043
|
}
|
|
17800
18044
|
let summary;
|
|
@@ -17809,7 +18053,7 @@ var init_show2 = __esm({
|
|
|
17809
18053
|
return ExitCode.Ok;
|
|
17810
18054
|
}
|
|
17811
18055
|
};
|
|
17812
|
-
show_default2 =
|
|
18056
|
+
show_default2 = command53;
|
|
17813
18057
|
}
|
|
17814
18058
|
});
|
|
17815
18059
|
|
|
@@ -17822,12 +18066,12 @@ __export(resume_exports, {
|
|
|
17822
18066
|
import { createHash as createHash6 } from "node:crypto";
|
|
17823
18067
|
import { existsSync as existsSync9 } from "node:fs";
|
|
17824
18068
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
17825
|
-
import { resolve as
|
|
18069
|
+
import { resolve as resolve12 } from "node:path";
|
|
17826
18070
|
function kebab(key) {
|
|
17827
18071
|
return key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
17828
18072
|
}
|
|
17829
|
-
function commandWords(
|
|
17830
|
-
return
|
|
18073
|
+
function commandWords(command92) {
|
|
18074
|
+
return command92.trim().split(/\s+/).filter((t) => t !== "");
|
|
17831
18075
|
}
|
|
17832
18076
|
function flagValue(value) {
|
|
17833
18077
|
return typeof value === "string" ? value : typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
@@ -17900,7 +18144,7 @@ async function refuseUnlessBatch(run, next) {
|
|
|
17900
18144
|
throw usageError(`Run ${run.runId} names flags kenso ${name} does not take (--${undeclared.join(", --")}), so it is not replayed.`, { next });
|
|
17901
18145
|
}
|
|
17902
18146
|
}
|
|
17903
|
-
var SKIPPED_KEYS,
|
|
18147
|
+
var SKIPPED_KEYS, command54, resume_default;
|
|
17904
18148
|
var init_resume = __esm({
|
|
17905
18149
|
"src/commands/runs/resume.ts"() {
|
|
17906
18150
|
"use strict";
|
|
@@ -17909,7 +18153,7 @@ var init_resume = __esm({
|
|
|
17909
18153
|
init_generated_hook();
|
|
17910
18154
|
init_registry();
|
|
17911
18155
|
SKIPPED_KEYS = /* @__PURE__ */ new Set(["positionals", "yes", "dryRun", "dry-run", "help", "version"]);
|
|
17912
|
-
|
|
18156
|
+
command54 = {
|
|
17913
18157
|
resource: "runs",
|
|
17914
18158
|
action: "resume",
|
|
17915
18159
|
summary: "Continue an interrupted batch run (its command with --yes, no dry run)",
|
|
@@ -17946,7 +18190,7 @@ var init_resume = __esm({
|
|
|
17946
18190
|
}
|
|
17947
18191
|
}
|
|
17948
18192
|
const env = { ...ctx.env, KENSO_RUNS_DIR: runsRoot(ctx.env), [RESUME_RUN_ENV]: run.runId };
|
|
17949
|
-
if (ctx.env.KENSO_CONFIG_DIR?.trim()) env.KENSO_CONFIG_DIR =
|
|
18193
|
+
if (ctx.env.KENSO_CONFIG_DIR?.trim()) env.KENSO_CONFIG_DIR = resolve12(ctx.env.KENSO_CONFIG_DIR.trim());
|
|
17950
18194
|
const previousCwd = process.cwd();
|
|
17951
18195
|
if (run.cwd && run.cwd !== previousCwd) {
|
|
17952
18196
|
if (!existsSync9(run.cwd)) throw usageError(`Run ${run.runId} started in ${run.cwd}, which no longer exists.`, { next });
|
|
@@ -17964,16 +18208,16 @@ var init_resume = __esm({
|
|
|
17964
18208
|
}
|
|
17965
18209
|
}
|
|
17966
18210
|
};
|
|
17967
|
-
resume_default =
|
|
18211
|
+
resume_default = command54;
|
|
17968
18212
|
}
|
|
17969
18213
|
});
|
|
17970
18214
|
|
|
17971
18215
|
// src/commands/runs/index.ts
|
|
17972
|
-
var
|
|
18216
|
+
var actions27;
|
|
17973
18217
|
var init_runs2 = __esm({
|
|
17974
18218
|
"src/commands/runs/index.ts"() {
|
|
17975
18219
|
"use strict";
|
|
17976
|
-
|
|
18220
|
+
actions27 = {
|
|
17977
18221
|
list: () => Promise.resolve().then(() => (init_list2(), list_exports2)).then((m) => m.default),
|
|
17978
18222
|
show: () => Promise.resolve().then(() => (init_show2(), show_exports2)).then((m) => m.default),
|
|
17979
18223
|
resume: () => Promise.resolve().then(() => (init_resume(), resume_exports)).then((m) => m.default)
|
|
@@ -18075,7 +18319,7 @@ var create_exports = {};
|
|
|
18075
18319
|
__export(create_exports, {
|
|
18076
18320
|
default: () => create_default
|
|
18077
18321
|
});
|
|
18078
|
-
var
|
|
18322
|
+
var command55, create_default;
|
|
18079
18323
|
var init_create = __esm({
|
|
18080
18324
|
"src/commands/sandbox/create.ts"() {
|
|
18081
18325
|
"use strict";
|
|
@@ -18083,7 +18327,7 @@ var init_create = __esm({
|
|
|
18083
18327
|
init_exit_codes();
|
|
18084
18328
|
init_http();
|
|
18085
18329
|
init_shared();
|
|
18086
|
-
|
|
18330
|
+
command55 = {
|
|
18087
18331
|
resource: "sandbox",
|
|
18088
18332
|
action: "create",
|
|
18089
18333
|
summary: "Create your developer sandbox and save its test key as the sandbox profile",
|
|
@@ -18126,7 +18370,7 @@ var init_create = __esm({
|
|
|
18126
18370
|
return ExitCode.Ok;
|
|
18127
18371
|
}
|
|
18128
18372
|
};
|
|
18129
|
-
create_default =
|
|
18373
|
+
create_default = command55;
|
|
18130
18374
|
}
|
|
18131
18375
|
});
|
|
18132
18376
|
|
|
@@ -18135,7 +18379,7 @@ var delete_exports2 = {};
|
|
|
18135
18379
|
__export(delete_exports2, {
|
|
18136
18380
|
default: () => delete_default2
|
|
18137
18381
|
});
|
|
18138
|
-
var
|
|
18382
|
+
var command56, delete_default2;
|
|
18139
18383
|
var init_delete2 = __esm({
|
|
18140
18384
|
"src/commands/sandbox/delete.ts"() {
|
|
18141
18385
|
"use strict";
|
|
@@ -18143,7 +18387,7 @@ var init_delete2 = __esm({
|
|
|
18143
18387
|
init_confirm();
|
|
18144
18388
|
init_exit_codes();
|
|
18145
18389
|
init_shared();
|
|
18146
|
-
|
|
18390
|
+
command56 = {
|
|
18147
18391
|
resource: "sandbox",
|
|
18148
18392
|
action: "delete",
|
|
18149
18393
|
summary: "Delete your sandbox and its test keys",
|
|
@@ -18175,7 +18419,7 @@ var init_delete2 = __esm({
|
|
|
18175
18419
|
return ExitCode.Ok;
|
|
18176
18420
|
}
|
|
18177
18421
|
};
|
|
18178
|
-
delete_default2 =
|
|
18422
|
+
delete_default2 = command56;
|
|
18179
18423
|
}
|
|
18180
18424
|
});
|
|
18181
18425
|
|
|
@@ -18184,14 +18428,14 @@ var key_exports = {};
|
|
|
18184
18428
|
__export(key_exports, {
|
|
18185
18429
|
default: () => key_default
|
|
18186
18430
|
});
|
|
18187
|
-
var
|
|
18431
|
+
var command57, key_default;
|
|
18188
18432
|
var init_key = __esm({
|
|
18189
18433
|
"src/commands/sandbox/key.ts"() {
|
|
18190
18434
|
"use strict";
|
|
18191
18435
|
init_exit_codes();
|
|
18192
18436
|
init_http();
|
|
18193
18437
|
init_shared();
|
|
18194
|
-
|
|
18438
|
+
command57 = {
|
|
18195
18439
|
resource: "sandbox",
|
|
18196
18440
|
action: "key",
|
|
18197
18441
|
summary: "Create a new test key for your sandbox and save it as the sandbox profile",
|
|
@@ -18212,7 +18456,7 @@ var init_key = __esm({
|
|
|
18212
18456
|
return ExitCode.Ok;
|
|
18213
18457
|
}
|
|
18214
18458
|
};
|
|
18215
|
-
key_default =
|
|
18459
|
+
key_default = command57;
|
|
18216
18460
|
}
|
|
18217
18461
|
});
|
|
18218
18462
|
|
|
@@ -18221,13 +18465,13 @@ var list_exports3 = {};
|
|
|
18221
18465
|
__export(list_exports3, {
|
|
18222
18466
|
default: () => list_default3
|
|
18223
18467
|
});
|
|
18224
|
-
var
|
|
18468
|
+
var command58, list_default3;
|
|
18225
18469
|
var init_list3 = __esm({
|
|
18226
18470
|
"src/commands/sandbox/list.ts"() {
|
|
18227
18471
|
"use strict";
|
|
18228
18472
|
init_exit_codes();
|
|
18229
18473
|
init_shared();
|
|
18230
|
-
|
|
18474
|
+
command58 = {
|
|
18231
18475
|
resource: "sandbox",
|
|
18232
18476
|
action: "list",
|
|
18233
18477
|
summary: "List your developer sandbox",
|
|
@@ -18244,7 +18488,7 @@ var init_list3 = __esm({
|
|
|
18244
18488
|
return ExitCode.Ok;
|
|
18245
18489
|
}
|
|
18246
18490
|
};
|
|
18247
|
-
list_default3 =
|
|
18491
|
+
list_default3 = command58;
|
|
18248
18492
|
}
|
|
18249
18493
|
});
|
|
18250
18494
|
|
|
@@ -18253,14 +18497,14 @@ var reset_exports = {};
|
|
|
18253
18497
|
__export(reset_exports, {
|
|
18254
18498
|
default: () => reset_default
|
|
18255
18499
|
});
|
|
18256
|
-
var
|
|
18500
|
+
var command59, reset_default;
|
|
18257
18501
|
var init_reset = __esm({
|
|
18258
18502
|
"src/commands/sandbox/reset.ts"() {
|
|
18259
18503
|
"use strict";
|
|
18260
18504
|
init_exit_codes();
|
|
18261
18505
|
init_http();
|
|
18262
18506
|
init_shared();
|
|
18263
|
-
|
|
18507
|
+
command59 = {
|
|
18264
18508
|
resource: "sandbox",
|
|
18265
18509
|
action: "reset",
|
|
18266
18510
|
summary: "Reset your sandbox to its seed data",
|
|
@@ -18283,16 +18527,16 @@ var init_reset = __esm({
|
|
|
18283
18527
|
return ExitCode.Ok;
|
|
18284
18528
|
}
|
|
18285
18529
|
};
|
|
18286
|
-
reset_default =
|
|
18530
|
+
reset_default = command59;
|
|
18287
18531
|
}
|
|
18288
18532
|
});
|
|
18289
18533
|
|
|
18290
18534
|
// src/commands/sandbox/index.ts
|
|
18291
|
-
var
|
|
18535
|
+
var actions28;
|
|
18292
18536
|
var init_sandbox2 = __esm({
|
|
18293
18537
|
"src/commands/sandbox/index.ts"() {
|
|
18294
18538
|
"use strict";
|
|
18295
|
-
|
|
18539
|
+
actions28 = {
|
|
18296
18540
|
create: () => Promise.resolve().then(() => (init_create(), create_exports)).then((m) => m.default),
|
|
18297
18541
|
delete: () => Promise.resolve().then(() => (init_delete2(), delete_exports2)).then((m) => m.default),
|
|
18298
18542
|
key: () => Promise.resolve().then(() => (init_key(), key_exports)).then((m) => m.default),
|
|
@@ -18333,9 +18577,9 @@ function scopeOf(inputSchema) {
|
|
|
18333
18577
|
}
|
|
18334
18578
|
function costOf(step, cards) {
|
|
18335
18579
|
if (step.cost?.free === true) return "free";
|
|
18336
|
-
const
|
|
18337
|
-
if (
|
|
18338
|
-
return
|
|
18580
|
+
const actions41 = step.cost?.action ? [step.cost.action] : [...new Set(Object.values(step.cost?.actionByTier ?? {}))];
|
|
18581
|
+
if (actions41.length === 0) return priceLine({ action: step.key, pricing: "unlisted" }, cards);
|
|
18582
|
+
return actions41.map((action) => priceLine({ action: rateCardAction(action), pricing: "fixed" }, cards)).join("; ");
|
|
18339
18583
|
}
|
|
18340
18584
|
function toRow(step, cards) {
|
|
18341
18585
|
return {
|
|
@@ -18349,7 +18593,7 @@ function toRow(step, cards) {
|
|
|
18349
18593
|
cost: costOf(step, cards)
|
|
18350
18594
|
};
|
|
18351
18595
|
}
|
|
18352
|
-
var WORKFLOW_TYPES, RECORD_TYPES, FOOTER,
|
|
18596
|
+
var WORKFLOW_TYPES, RECORD_TYPES, FOOTER, command60, types_default;
|
|
18353
18597
|
var init_types = __esm({
|
|
18354
18598
|
"src/commands/signals/types.ts"() {
|
|
18355
18599
|
"use strict";
|
|
@@ -18360,7 +18604,7 @@ var init_types = __esm({
|
|
|
18360
18604
|
WORKFLOW_TYPES = ["signal", "bulk_import", "all"];
|
|
18361
18605
|
RECORD_TYPES = ["account", "person", "lead", "place"];
|
|
18362
18606
|
FOOTER = "Hiring signals come from a scheduled source: kenso signals types --workflow-type bulk_import. Templates that start from a signal: kenso workflow-templates list";
|
|
18363
|
-
|
|
18607
|
+
command60 = {
|
|
18364
18608
|
resource: "signals",
|
|
18365
18609
|
action: "types",
|
|
18366
18610
|
summary: "List the signal triggers a workflow can start from, offline",
|
|
@@ -18389,16 +18633,16 @@ var init_types = __esm({
|
|
|
18389
18633
|
return ExitCode.Ok;
|
|
18390
18634
|
}
|
|
18391
18635
|
};
|
|
18392
|
-
types_default =
|
|
18636
|
+
types_default = command60;
|
|
18393
18637
|
}
|
|
18394
18638
|
});
|
|
18395
18639
|
|
|
18396
18640
|
// src/commands/signals/index.ts
|
|
18397
|
-
var
|
|
18641
|
+
var actions29;
|
|
18398
18642
|
var init_signals = __esm({
|
|
18399
18643
|
"src/commands/signals/index.ts"() {
|
|
18400
18644
|
"use strict";
|
|
18401
|
-
|
|
18645
|
+
actions29 = {
|
|
18402
18646
|
types: () => Promise.resolve().then(() => (init_types(), types_exports)).then((m) => m.default)
|
|
18403
18647
|
};
|
|
18404
18648
|
}
|
|
@@ -18516,7 +18760,7 @@ function render(simulation) {
|
|
|
18516
18760
|
return `${out.join("\n")}
|
|
18517
18761
|
`;
|
|
18518
18762
|
}
|
|
18519
|
-
var POLL_MS3, MAX_WAIT_MS, KINDS4, CHANNELS, TERMINAL, SOURCE_FLAGS, str, WHY_MAX, NOTE, LABEL_NOTES, score2, why,
|
|
18763
|
+
var POLL_MS3, MAX_WAIT_MS, KINDS4, CHANNELS, TERMINAL, SOURCE_FLAGS, str, WHY_MAX, NOTE, LABEL_NOTES, score2, why, command61, run_default2;
|
|
18520
18764
|
var init_run3 = __esm({
|
|
18521
18765
|
"src/commands/simulations/run.ts"() {
|
|
18522
18766
|
"use strict";
|
|
@@ -18545,7 +18789,7 @@ var init_run3 = __esm({
|
|
|
18545
18789
|
};
|
|
18546
18790
|
score2 = (likelihood) => String(Math.round(likelihood * 100));
|
|
18547
18791
|
why = (read2) => cut(read2.ignoreReasons[0]?.reason || read2.wouldReplyIf || read2.reaction);
|
|
18548
|
-
|
|
18792
|
+
command61 = {
|
|
18549
18793
|
resource: "simulations",
|
|
18550
18794
|
action: "run",
|
|
18551
18795
|
summary: "Run a response simulation and print how the readers reacted",
|
|
@@ -18606,16 +18850,16 @@ var init_run3 = __esm({
|
|
|
18606
18850
|
});
|
|
18607
18851
|
}
|
|
18608
18852
|
};
|
|
18609
|
-
run_default2 =
|
|
18853
|
+
run_default2 = command61;
|
|
18610
18854
|
}
|
|
18611
18855
|
});
|
|
18612
18856
|
|
|
18613
18857
|
// src/commands/simulations/index.ts
|
|
18614
|
-
var
|
|
18858
|
+
var actions30;
|
|
18615
18859
|
var init_simulations = __esm({
|
|
18616
18860
|
"src/commands/simulations/index.ts"() {
|
|
18617
18861
|
"use strict";
|
|
18618
|
-
|
|
18862
|
+
actions30 = {
|
|
18619
18863
|
run: () => Promise.resolve().then(() => (init_run3(), run_exports3)).then((m) => m.default)
|
|
18620
18864
|
};
|
|
18621
18865
|
}
|
|
@@ -18658,14 +18902,14 @@ function unexpectedAnswer(tool) {
|
|
|
18658
18902
|
exitCode: ExitCode.Server
|
|
18659
18903
|
});
|
|
18660
18904
|
}
|
|
18661
|
-
var
|
|
18905
|
+
var command62, list_default4;
|
|
18662
18906
|
var init_list4 = __esm({
|
|
18663
18907
|
"src/commands/skill/list.ts"() {
|
|
18664
18908
|
"use strict";
|
|
18665
18909
|
init_errors();
|
|
18666
18910
|
init_exit_codes();
|
|
18667
18911
|
init_connect4();
|
|
18668
|
-
|
|
18912
|
+
command62 = {
|
|
18669
18913
|
resource: "skill",
|
|
18670
18914
|
action: "list",
|
|
18671
18915
|
effect: "read",
|
|
@@ -18689,7 +18933,7 @@ var init_list4 = __esm({
|
|
|
18689
18933
|
return ExitCode.Ok;
|
|
18690
18934
|
}
|
|
18691
18935
|
};
|
|
18692
|
-
list_default4 =
|
|
18936
|
+
list_default4 = command62;
|
|
18693
18937
|
}
|
|
18694
18938
|
});
|
|
18695
18939
|
|
|
@@ -18698,7 +18942,7 @@ var show_exports3 = {};
|
|
|
18698
18942
|
__export(show_exports3, {
|
|
18699
18943
|
default: () => show_default3
|
|
18700
18944
|
});
|
|
18701
|
-
var
|
|
18945
|
+
var command63, show_default3;
|
|
18702
18946
|
var init_show3 = __esm({
|
|
18703
18947
|
"src/commands/skill/show.ts"() {
|
|
18704
18948
|
"use strict";
|
|
@@ -18706,7 +18950,7 @@ var init_show3 = __esm({
|
|
|
18706
18950
|
init_connect4();
|
|
18707
18951
|
init_bundled();
|
|
18708
18952
|
init_list4();
|
|
18709
|
-
|
|
18953
|
+
command63 = {
|
|
18710
18954
|
resource: "skill",
|
|
18711
18955
|
action: "show",
|
|
18712
18956
|
effect: "read",
|
|
@@ -18733,16 +18977,16 @@ var init_show3 = __esm({
|
|
|
18733
18977
|
return ExitCode.Ok;
|
|
18734
18978
|
}
|
|
18735
18979
|
};
|
|
18736
|
-
show_default3 =
|
|
18980
|
+
show_default3 = command63;
|
|
18737
18981
|
}
|
|
18738
18982
|
});
|
|
18739
18983
|
|
|
18740
18984
|
// src/commands/skill/index.ts
|
|
18741
|
-
var
|
|
18985
|
+
var actions31;
|
|
18742
18986
|
var init_skill = __esm({
|
|
18743
18987
|
"src/commands/skill/index.ts"() {
|
|
18744
18988
|
"use strict";
|
|
18745
|
-
|
|
18989
|
+
actions31 = {
|
|
18746
18990
|
install: () => Promise.resolve().then(() => (init_install(), install_exports)).then((m) => m.default),
|
|
18747
18991
|
list: () => Promise.resolve().then(() => (init_list4(), list_exports4)).then((m) => m.default),
|
|
18748
18992
|
show: () => Promise.resolve().then(() => (init_show3(), show_exports3)).then((m) => m.default)
|
|
@@ -18782,7 +19026,7 @@ var init_common4 = __esm({
|
|
|
18782
19026
|
// src/commands/studio/folder.ts
|
|
18783
19027
|
import { createHash as createHash7 } from "node:crypto";
|
|
18784
19028
|
import { lstat, readdir as readdir2, readFile as readFile10, stat as stat3, writeFile as writeFile4 } from "node:fs/promises";
|
|
18785
|
-
import { extname as
|
|
19029
|
+
import { extname as extname7, isAbsolute as isAbsolute2, join as join20, relative as relative2, resolve as resolve13, sep as sep2 } from "node:path";
|
|
18786
19030
|
function textOf2(bytes) {
|
|
18787
19031
|
if (bytes.length >= TEXT_MAX_BYTES || bytes.includes(0)) return void 0;
|
|
18788
19032
|
try {
|
|
@@ -18792,7 +19036,7 @@ function textOf2(bytes) {
|
|
|
18792
19036
|
}
|
|
18793
19037
|
}
|
|
18794
19038
|
async function existingDir(dir3) {
|
|
18795
|
-
const abs =
|
|
19039
|
+
const abs = resolve13(dir3);
|
|
18796
19040
|
const info = await stat3(abs).catch(() => void 0);
|
|
18797
19041
|
if (!info?.isDirectory()) throw usageError(`${dir3} is not a directory.`, { field: "dir" });
|
|
18798
19042
|
return abs;
|
|
@@ -18801,7 +19045,7 @@ function inBundleLayout(bundlePath) {
|
|
|
18801
19045
|
const segments = bundlePath.split("/");
|
|
18802
19046
|
if (bundlePath.length > 200 || !segments.every((s) => NAME.test(s) && !WINDOWS_DEVICE.test(s))) return false;
|
|
18803
19047
|
if (segments.length === 1) return TOP_FILES.has(bundlePath);
|
|
18804
|
-
if (segments[0] === "assets") return ASSET_TYPES.has(
|
|
19048
|
+
if (segments[0] === "assets") return ASSET_TYPES.has(extname7(bundlePath).toLowerCase());
|
|
18805
19049
|
const name = segments[1];
|
|
18806
19050
|
return segments[0] === "samples" && segments.length === 2 && SAMPLE_NAME.test(name) && !TOOL_CONFIG_NAMES.has(name.toLowerCase());
|
|
18807
19051
|
}
|
|
@@ -18825,7 +19069,7 @@ async function readFolder(dir3, skipped = []) {
|
|
|
18825
19069
|
const entries2 = await readdir2(folder, { withFileTypes: true });
|
|
18826
19070
|
for (const entry of entries2) {
|
|
18827
19071
|
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
18828
|
-
const abs =
|
|
19072
|
+
const abs = join20(folder, entry.name);
|
|
18829
19073
|
const path = relative2(root3, abs).split(sep2).join("/");
|
|
18830
19074
|
if (entry.isDirectory()) {
|
|
18831
19075
|
if (path === "assets" || path.startsWith("assets/") || path === "samples") await walk(abs);
|
|
@@ -18852,7 +19096,7 @@ async function readFolder(dir3, skipped = []) {
|
|
|
18852
19096
|
function safeJoin(root3, bundlePath) {
|
|
18853
19097
|
const segments = bundlePath.split("/");
|
|
18854
19098
|
const bad = !inBundleLayout(bundlePath) || isAbsolute2(bundlePath) || bundlePath.includes("\\") || bundlePath.includes("\0");
|
|
18855
|
-
const target2 =
|
|
19099
|
+
const target2 = resolve13(root3, ...segments);
|
|
18856
19100
|
if (bad || !target2.startsWith(root3.endsWith(sep2) ? root3 : root3 + sep2)) {
|
|
18857
19101
|
throw unsafePath(bundlePath, `it is not a file of a Studio bundle (${LAYOUT}) inside ${root3}`);
|
|
18858
19102
|
}
|
|
@@ -18862,7 +19106,7 @@ async function existingFileNoLinks(root3, target2, bundlePath) {
|
|
|
18862
19106
|
const parts2 = relative2(root3, target2).split(sep2);
|
|
18863
19107
|
let at = root3;
|
|
18864
19108
|
for (const [i, part] of parts2.entries()) {
|
|
18865
|
-
at =
|
|
19109
|
+
at = join20(at, part);
|
|
18866
19110
|
const info = await lstat(at).catch(() => void 0);
|
|
18867
19111
|
if (!info) return false;
|
|
18868
19112
|
if (info.isSymbolicLink()) throw unsafePath(bundlePath, `${at} is a symbolic link`);
|
|
@@ -18875,7 +19119,7 @@ async function existingFileNoLinks(root3, target2, bundlePath) {
|
|
|
18875
19119
|
}
|
|
18876
19120
|
async function readPullState(root3) {
|
|
18877
19121
|
try {
|
|
18878
|
-
const files = JSON.parse(await readFile10(
|
|
19122
|
+
const files = JSON.parse(await readFile10(join20(root3, PULL_STATE), "utf8"))?.files;
|
|
18879
19123
|
if (typeof files !== "object" || files === null) return {};
|
|
18880
19124
|
return Object.fromEntries(Object.entries(files).filter((entry) => typeof entry[1] === "string"));
|
|
18881
19125
|
} catch {
|
|
@@ -18883,7 +19127,7 @@ async function readPullState(root3) {
|
|
|
18883
19127
|
}
|
|
18884
19128
|
}
|
|
18885
19129
|
async function recordPullState(root3, entries2) {
|
|
18886
|
-
const path =
|
|
19130
|
+
const path = join20(root3, PULL_STATE);
|
|
18887
19131
|
await existingFileNoLinks(root3, path, PULL_STATE);
|
|
18888
19132
|
const files = { ...await readPullState(root3), ...Object.fromEntries(entries2) };
|
|
18889
19133
|
await writeFile4(path, `${JSON.stringify({ files }, null, 2)}
|
|
@@ -18907,7 +19151,7 @@ function unsafePath(bundlePath, why2) {
|
|
|
18907
19151
|
});
|
|
18908
19152
|
}
|
|
18909
19153
|
function contentTypeOf(path) {
|
|
18910
|
-
return CONTENT_TYPES2[
|
|
19154
|
+
return CONTENT_TYPES2[extname7(path).toLowerCase()] ?? "application/octet-stream";
|
|
18911
19155
|
}
|
|
18912
19156
|
async function mapLimit(items, limit, fn) {
|
|
18913
19157
|
const out = new Array(items.length);
|
|
@@ -19111,7 +19355,7 @@ __export(pull_exports, {
|
|
|
19111
19355
|
default: () => pull_default
|
|
19112
19356
|
});
|
|
19113
19357
|
import { mkdir, readFile as readFile11, writeFile as writeFile5 } from "node:fs/promises";
|
|
19114
|
-
import { dirname as
|
|
19358
|
+
import { dirname as dirname4, join as join21, resolve as resolve14 } from "node:path";
|
|
19115
19359
|
function caseTwins(paths) {
|
|
19116
19360
|
const kept = /* @__PURE__ */ new Map();
|
|
19117
19361
|
const twins = /* @__PURE__ */ new Map();
|
|
@@ -19123,7 +19367,7 @@ function caseTwins(paths) {
|
|
|
19123
19367
|
}
|
|
19124
19368
|
return twins;
|
|
19125
19369
|
}
|
|
19126
|
-
var
|
|
19370
|
+
var command64, pull_default;
|
|
19127
19371
|
var init_pull = __esm({
|
|
19128
19372
|
"src/commands/studio/pull.ts"() {
|
|
19129
19373
|
"use strict";
|
|
@@ -19134,7 +19378,7 @@ var init_pull = __esm({
|
|
|
19134
19378
|
init_common4();
|
|
19135
19379
|
init_folder2();
|
|
19136
19380
|
init_transfer2();
|
|
19137
|
-
|
|
19381
|
+
command64 = {
|
|
19138
19382
|
resource: "studio",
|
|
19139
19383
|
action: "pull",
|
|
19140
19384
|
summary: "Write a template version's files to a folder",
|
|
@@ -19157,7 +19401,7 @@ var init_pull = __esm({
|
|
|
19157
19401
|
if (version !== void 0 && !/^(draft|latest|\d+)$/.test(version)) {
|
|
19158
19402
|
throw usageError(`--template-version must be draft, latest or a version id (got "${version}").`, { field: "template-version" });
|
|
19159
19403
|
}
|
|
19160
|
-
const dir3 =
|
|
19404
|
+
const dir3 = resolve14(String(flags.dir));
|
|
19161
19405
|
const res = await ctx.client.request({
|
|
19162
19406
|
method: "GET",
|
|
19163
19407
|
path: `/v1/asset-templates/${templateId}/pull`,
|
|
@@ -19181,7 +19425,7 @@ var init_pull = __esm({
|
|
|
19181
19425
|
if (missing2) {
|
|
19182
19426
|
throw new KensoError({ code: "pull_incomplete", message: `${missing2.path} came back with neither text nor a download link.`, exitCode: ExitCode.Server });
|
|
19183
19427
|
}
|
|
19184
|
-
const statePath2 =
|
|
19428
|
+
const statePath2 = join21(dir3, PULL_STATE);
|
|
19185
19429
|
await existingFileNoLinks(dir3, statePath2, PULL_STATE);
|
|
19186
19430
|
const state2 = await readPullState(dir3);
|
|
19187
19431
|
const conflicts = [];
|
|
@@ -19216,7 +19460,7 @@ var init_pull = __esm({
|
|
|
19216
19460
|
await mkdir(dir3, { recursive: true });
|
|
19217
19461
|
const written = await mapLimit(files, PARALLEL_TRANSFERS, async ({ path, file, target: target2 }) => {
|
|
19218
19462
|
const content = typeof file.text === "string" ? Buffer.from(file.text, "utf8") : await download2(file.downloadUrl, path, file.sha256, ctx.signal);
|
|
19219
|
-
await mkdir(
|
|
19463
|
+
await mkdir(dirname4(target2), { recursive: true });
|
|
19220
19464
|
await writeFile5(target2, content);
|
|
19221
19465
|
return [path, sha2563(content)];
|
|
19222
19466
|
});
|
|
@@ -19225,7 +19469,7 @@ var init_pull = __esm({
|
|
|
19225
19469
|
return ExitCode.Ok;
|
|
19226
19470
|
}
|
|
19227
19471
|
};
|
|
19228
|
-
pull_default =
|
|
19472
|
+
pull_default = command64;
|
|
19229
19473
|
}
|
|
19230
19474
|
});
|
|
19231
19475
|
|
|
@@ -19265,8 +19509,8 @@ var push_exports = {};
|
|
|
19265
19509
|
__export(push_exports, {
|
|
19266
19510
|
default: () => push_default
|
|
19267
19511
|
});
|
|
19268
|
-
import { resolve as
|
|
19269
|
-
var BUILT_BY, DEFAULT_MESSAGE,
|
|
19512
|
+
import { resolve as resolve15 } from "node:path";
|
|
19513
|
+
var BUILT_BY, DEFAULT_MESSAGE, command65, push_default;
|
|
19270
19514
|
var init_push = __esm({
|
|
19271
19515
|
"src/commands/studio/push.ts"() {
|
|
19272
19516
|
"use strict";
|
|
@@ -19280,7 +19524,7 @@ var init_push = __esm({
|
|
|
19280
19524
|
init_transfer2();
|
|
19281
19525
|
BUILT_BY = "customer_agent";
|
|
19282
19526
|
DEFAULT_MESSAGE = "Pushed with the Kenso CLI";
|
|
19283
|
-
|
|
19527
|
+
command65 = {
|
|
19284
19528
|
resource: "studio",
|
|
19285
19529
|
action: "push",
|
|
19286
19530
|
summary: "Save a folder's files to a template's draft and print the validation",
|
|
@@ -19323,7 +19567,7 @@ var init_push = __esm({
|
|
|
19323
19567
|
signal: ctx.signal
|
|
19324
19568
|
});
|
|
19325
19569
|
const pushed = unwrap(res.body) ?? {};
|
|
19326
|
-
await recordPullState(
|
|
19570
|
+
await recordPullState(resolve15(String(flags.dir)), local.map((f) => [f.path, sha2563(f.bytes)]));
|
|
19327
19571
|
const versionId = pushed.version?.id;
|
|
19328
19572
|
const result = {
|
|
19329
19573
|
templateId,
|
|
@@ -19375,7 +19619,7 @@ var init_push = __esm({
|
|
|
19375
19619
|
);
|
|
19376
19620
|
}
|
|
19377
19621
|
};
|
|
19378
|
-
push_default =
|
|
19622
|
+
push_default = command65;
|
|
19379
19623
|
}
|
|
19380
19624
|
});
|
|
19381
19625
|
|
|
@@ -19384,7 +19628,7 @@ var validate_exports = {};
|
|
|
19384
19628
|
__export(validate_exports, {
|
|
19385
19629
|
default: () => validate_default
|
|
19386
19630
|
});
|
|
19387
|
-
var
|
|
19631
|
+
var command66, validate_default;
|
|
19388
19632
|
var init_validate = __esm({
|
|
19389
19633
|
"src/commands/studio/validate.ts"() {
|
|
19390
19634
|
"use strict";
|
|
@@ -19393,7 +19637,7 @@ var init_validate = __esm({
|
|
|
19393
19637
|
init_columns();
|
|
19394
19638
|
init_common4();
|
|
19395
19639
|
init_read();
|
|
19396
|
-
|
|
19640
|
+
command66 = {
|
|
19397
19641
|
resource: "studio",
|
|
19398
19642
|
action: "validate",
|
|
19399
19643
|
summary: "Validate a folder's files against a template without saving them",
|
|
@@ -19423,7 +19667,7 @@ var init_validate = __esm({
|
|
|
19423
19667
|
throw validationFailed(validation, "The files have validation errors", commandLine2(ctx, "studio validate", args));
|
|
19424
19668
|
}
|
|
19425
19669
|
};
|
|
19426
|
-
validate_default =
|
|
19670
|
+
validate_default = command66;
|
|
19427
19671
|
}
|
|
19428
19672
|
});
|
|
19429
19673
|
|
|
@@ -19472,7 +19716,7 @@ function accountIds(value) {
|
|
|
19472
19716
|
}
|
|
19473
19717
|
return ids2.map(Number);
|
|
19474
19718
|
}
|
|
19475
|
-
var SHOWN2,
|
|
19719
|
+
var SHOWN2, command67, preview_default;
|
|
19476
19720
|
var init_preview = __esm({
|
|
19477
19721
|
"src/commands/studio/preview.ts"() {
|
|
19478
19722
|
"use strict";
|
|
@@ -19484,7 +19728,7 @@ var init_preview = __esm({
|
|
|
19484
19728
|
init_common4();
|
|
19485
19729
|
init_folder2();
|
|
19486
19730
|
SHOWN2 = 5;
|
|
19487
|
-
|
|
19731
|
+
command67 = {
|
|
19488
19732
|
resource: "studio",
|
|
19489
19733
|
action: "preview",
|
|
19490
19734
|
summary: "Render a saved version for up to 3 accounts; for local edits, studio push them to the draft first",
|
|
@@ -19534,7 +19778,7 @@ var init_preview = __esm({
|
|
|
19534
19778
|
return ExitCode.Ok;
|
|
19535
19779
|
}
|
|
19536
19780
|
};
|
|
19537
|
-
preview_default =
|
|
19781
|
+
preview_default = command67;
|
|
19538
19782
|
}
|
|
19539
19783
|
});
|
|
19540
19784
|
|
|
@@ -19643,7 +19887,7 @@ __export(fill_exports, {
|
|
|
19643
19887
|
});
|
|
19644
19888
|
import { createHash as createHash10 } from "node:crypto";
|
|
19645
19889
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
19646
|
-
import { join as
|
|
19890
|
+
import { join as join22, resolve as resolve16 } from "node:path";
|
|
19647
19891
|
async function readTarget(ctx, flags) {
|
|
19648
19892
|
const accounts = stringFlag(flags.accounts);
|
|
19649
19893
|
const campaign = stringFlag(flags.campaign);
|
|
@@ -19676,14 +19920,14 @@ async function readTarget(ctx, flags) {
|
|
|
19676
19920
|
items: [...firstRow].map(([id, row]) => ({ id, row })),
|
|
19677
19921
|
duplicates: raw.length - firstRow.size,
|
|
19678
19922
|
...campaign !== void 0 ? { campaignId: positiveId3(campaign, "campaign") } : {},
|
|
19679
|
-
input: source === "-" ? { path: "-", sha256: sha2564(raw.join("\n")) } : { path:
|
|
19923
|
+
input: source === "-" ? { path: "-", sha256: sha2564(raw.join("\n")) } : { path: resolve16(source), sha256: sha2564(await readFile12(resolve16(source))) }
|
|
19680
19924
|
};
|
|
19681
19925
|
}
|
|
19682
19926
|
async function refuseRefill(ctx, args, target2) {
|
|
19683
19927
|
const workspaceId = ctx.client.workspaceId ?? ctx.auth.workspaceId;
|
|
19684
19928
|
const sameFill = (a) => argsIdentity({ ...a, wait: void 0 });
|
|
19685
19929
|
const earlier = (await listRuns(ctx.env)).find(
|
|
19686
|
-
(run) => run.command ===
|
|
19930
|
+
(run) => run.command === COMMAND7 && run.status !== "planned" && run.inputSha256 === target2.input.sha256 && (run.workspaceId || void 0) === (workspaceId || void 0) && sameFill(run.args) === sameFill(args)
|
|
19687
19931
|
);
|
|
19688
19932
|
if (!earlier) return;
|
|
19689
19933
|
const unfinished = earlier.status !== "done";
|
|
@@ -19694,7 +19938,7 @@ async function refuseRefill(ctx, args, target2) {
|
|
|
19694
19938
|
code: "already_filled",
|
|
19695
19939
|
exitCode: ExitCode.Conflict,
|
|
19696
19940
|
message: unfinished ? `Run ${earlier.runId} is already filling these ${ids2} (${earlier.status}).` : `Run ${earlier.runId} already filled these ${ids2}.`,
|
|
19697
|
-
hint: unfinished ? "Continue that run instead: a new fill would create every fill run again." : succeeded ? "Every page was filled. Filling again rebuilds and charges every page that is not building or live; to do that anyway, use kenso asset-runs create." : `Filling again rebuilds and charges every page that is not building or live. To retry only the failed ones, put the ${target2.key} values of the failed rows in ${
|
|
19941
|
+
hint: unfinished ? "Continue that run instead: a new fill would create every fill run again." : succeeded ? "Every page was filled. Filling again rebuilds and charges every page that is not building or live; to do that anyway, use kenso asset-runs create." : `Filling again rebuilds and charges every page that is not building or live. To retry only the failed ones, put the ${target2.key} values of the failed rows in ${join22(earlier.dir, "results.csv")} in a file and fill that file.`,
|
|
19698
19942
|
next: unfinished ? `kenso runs resume ${earlier.runId}` : `kenso runs show ${earlier.runId}`
|
|
19699
19943
|
});
|
|
19700
19944
|
}
|
|
@@ -19735,7 +19979,7 @@ function estimateOutput(templateId, target2, estimate2) {
|
|
|
19735
19979
|
...target2.campaignId !== void 0 ? { estimateNote: "An upper bound: it counts one page per lead, and a campaign run builds one page per company." } : {}
|
|
19736
19980
|
};
|
|
19737
19981
|
}
|
|
19738
|
-
var
|
|
19982
|
+
var COMMAND7, sha2564, command68, fill_default;
|
|
19739
19983
|
var init_fill = __esm({
|
|
19740
19984
|
"src/commands/studio/fill.ts"() {
|
|
19741
19985
|
"use strict";
|
|
@@ -19751,9 +19995,9 @@ var init_fill = __esm({
|
|
|
19751
19995
|
init_columns();
|
|
19752
19996
|
init_common4();
|
|
19753
19997
|
init_fill_runs();
|
|
19754
|
-
|
|
19998
|
+
COMMAND7 = "studio fill";
|
|
19755
19999
|
sha2564 = (data) => createHash10("sha256").update(data).digest("hex");
|
|
19756
|
-
|
|
20000
|
+
command68 = {
|
|
19757
20001
|
resource: "studio",
|
|
19758
20002
|
action: "fill",
|
|
19759
20003
|
summary: "Fill a template on many accounts or campaign leads (estimate first)",
|
|
@@ -19792,7 +20036,7 @@ var init_fill = __esm({
|
|
|
19792
20036
|
if (ctx.flags.yes === true) await refuseRefill(ctx, batchArgs, target2);
|
|
19793
20037
|
const estimate2 = await estimateFill(ctx, templateId, target2.items.length);
|
|
19794
20038
|
if (ctx.flags.yes !== true) {
|
|
19795
|
-
const next = commandLine2(ctx,
|
|
20039
|
+
const next = commandLine2(ctx, COMMAND7, { flags: { ...flags, estimate: void 0 }, positionals }, ["--yes"]);
|
|
19796
20040
|
const { available, estimateError } = await readAvailable(ctx);
|
|
19797
20041
|
const credits3 = creditsCheck(estimate2.millicredits, available);
|
|
19798
20042
|
ctx.output.object({ ...estimateOutput(templateId, target2, estimate2), credits: credits3, ...estimateError ? { estimateError } : {}, next });
|
|
@@ -19801,7 +20045,7 @@ var init_fill = __esm({
|
|
|
19801
20045
|
const wait3 = flags.wait === true;
|
|
19802
20046
|
const outcome = await runBatch(
|
|
19803
20047
|
{
|
|
19804
|
-
command:
|
|
20048
|
+
command: COMMAND7,
|
|
19805
20049
|
args: batchArgs,
|
|
19806
20050
|
input: target2.input,
|
|
19807
20051
|
items: target2.items,
|
|
@@ -19822,16 +20066,16 @@ var init_fill = __esm({
|
|
|
19822
20066
|
return outcome.exitCode;
|
|
19823
20067
|
}
|
|
19824
20068
|
};
|
|
19825
|
-
fill_default =
|
|
20069
|
+
fill_default = command68;
|
|
19826
20070
|
}
|
|
19827
20071
|
});
|
|
19828
20072
|
|
|
19829
20073
|
// src/commands/studio/index.ts
|
|
19830
|
-
var
|
|
20074
|
+
var actions32;
|
|
19831
20075
|
var init_studio2 = __esm({
|
|
19832
20076
|
"src/commands/studio/index.ts"() {
|
|
19833
20077
|
"use strict";
|
|
19834
|
-
|
|
20078
|
+
actions32 = {
|
|
19835
20079
|
pull: () => Promise.resolve().then(() => (init_pull(), pull_exports)).then((m) => m.default),
|
|
19836
20080
|
push: () => Promise.resolve().then(() => (init_push(), push_exports)).then((m) => m.default),
|
|
19837
20081
|
validate: () => Promise.resolve().then(() => (init_validate(), validate_exports)).then((m) => m.default),
|
|
@@ -19929,7 +20173,7 @@ var add_exports2 = {};
|
|
|
19929
20173
|
__export(add_exports2, {
|
|
19930
20174
|
default: () => add_default2
|
|
19931
20175
|
});
|
|
19932
|
-
var NEXT,
|
|
20176
|
+
var NEXT, command69, add_default2;
|
|
19933
20177
|
var init_add2 = __esm({
|
|
19934
20178
|
"src/commands/tasks/add.ts"() {
|
|
19935
20179
|
"use strict";
|
|
@@ -19939,7 +20183,7 @@ var init_add2 = __esm({
|
|
|
19939
20183
|
init_http();
|
|
19940
20184
|
init_shared2();
|
|
19941
20185
|
NEXT = 'kenso tasks add "Send the deck" --due tomorrow --account 812';
|
|
19942
|
-
|
|
20186
|
+
command69 = {
|
|
19943
20187
|
resource: "tasks",
|
|
19944
20188
|
action: "add",
|
|
19945
20189
|
summary: "Add a task: a title, an optional due day and time, assignee and the account, person or deal it is about",
|
|
@@ -19977,7 +20221,7 @@ var init_add2 = __esm({
|
|
|
19977
20221
|
return ExitCode.Ok;
|
|
19978
20222
|
}
|
|
19979
20223
|
};
|
|
19980
|
-
add_default2 =
|
|
20224
|
+
add_default2 = command69;
|
|
19981
20225
|
}
|
|
19982
20226
|
});
|
|
19983
20227
|
|
|
@@ -20014,7 +20258,7 @@ function stoppedAt(error, id, finished, status) {
|
|
|
20014
20258
|
details: error.details
|
|
20015
20259
|
});
|
|
20016
20260
|
}
|
|
20017
|
-
var
|
|
20261
|
+
var command70, done_default;
|
|
20018
20262
|
var init_done = __esm({
|
|
20019
20263
|
"src/commands/tasks/done.ts"() {
|
|
20020
20264
|
"use strict";
|
|
@@ -20023,7 +20267,7 @@ var init_done = __esm({
|
|
|
20023
20267
|
init_exit_codes();
|
|
20024
20268
|
init_http();
|
|
20025
20269
|
init_shared2();
|
|
20026
|
-
|
|
20270
|
+
command70 = {
|
|
20027
20271
|
resource: "tasks",
|
|
20028
20272
|
action: "done",
|
|
20029
20273
|
summary: "Complete one or more tasks (--undo reopens them)",
|
|
@@ -20057,7 +20301,7 @@ var init_done = __esm({
|
|
|
20057
20301
|
return ExitCode.Ok;
|
|
20058
20302
|
}
|
|
20059
20303
|
};
|
|
20060
|
-
done_default =
|
|
20304
|
+
done_default = command70;
|
|
20061
20305
|
}
|
|
20062
20306
|
});
|
|
20063
20307
|
|
|
@@ -20066,7 +20310,7 @@ var assign_exports = {};
|
|
|
20066
20310
|
__export(assign_exports, {
|
|
20067
20311
|
default: () => assign_default
|
|
20068
20312
|
});
|
|
20069
|
-
var NEXT2,
|
|
20313
|
+
var NEXT2, command71, assign_default;
|
|
20070
20314
|
var init_assign = __esm({
|
|
20071
20315
|
"src/commands/tasks/assign.ts"() {
|
|
20072
20316
|
"use strict";
|
|
@@ -20075,7 +20319,7 @@ var init_assign = __esm({
|
|
|
20075
20319
|
init_done();
|
|
20076
20320
|
init_shared2();
|
|
20077
20321
|
NEXT2 = "kenso tasks assign <taskId> <me|memberId|email>";
|
|
20078
|
-
|
|
20322
|
+
command71 = {
|
|
20079
20323
|
resource: "tasks",
|
|
20080
20324
|
action: "assign",
|
|
20081
20325
|
summary: "Give a task to a member",
|
|
@@ -20099,7 +20343,7 @@ var init_assign = __esm({
|
|
|
20099
20343
|
return ExitCode.Ok;
|
|
20100
20344
|
}
|
|
20101
20345
|
};
|
|
20102
|
-
assign_default =
|
|
20346
|
+
assign_default = command71;
|
|
20103
20347
|
}
|
|
20104
20348
|
});
|
|
20105
20349
|
|
|
@@ -20108,14 +20352,14 @@ var queue_exports = {};
|
|
|
20108
20352
|
__export(queue_exports, {
|
|
20109
20353
|
default: () => queue_default
|
|
20110
20354
|
});
|
|
20111
|
-
var SCOPES,
|
|
20355
|
+
var SCOPES, command72, queue_default;
|
|
20112
20356
|
var init_queue = __esm({
|
|
20113
20357
|
"src/commands/tasks/queue.ts"() {
|
|
20114
20358
|
"use strict";
|
|
20115
20359
|
init_errors();
|
|
20116
20360
|
init_exit_codes();
|
|
20117
20361
|
SCOPES = ["mine", "assigned_by_me", "everyone"];
|
|
20118
|
-
|
|
20362
|
+
command72 = {
|
|
20119
20363
|
resource: "tasks",
|
|
20120
20364
|
action: "queue",
|
|
20121
20365
|
summary: "Your open work by due day: tasks, touches, call tasks, reply reminders and Ken follow-ups",
|
|
@@ -20137,16 +20381,16 @@ var init_queue = __esm({
|
|
|
20137
20381
|
return ExitCode.Ok;
|
|
20138
20382
|
}
|
|
20139
20383
|
};
|
|
20140
|
-
queue_default =
|
|
20384
|
+
queue_default = command72;
|
|
20141
20385
|
}
|
|
20142
20386
|
});
|
|
20143
20387
|
|
|
20144
20388
|
// src/commands/tasks/index.ts
|
|
20145
|
-
var
|
|
20389
|
+
var actions33;
|
|
20146
20390
|
var init_tasks = __esm({
|
|
20147
20391
|
"src/commands/tasks/index.ts"() {
|
|
20148
20392
|
"use strict";
|
|
20149
|
-
|
|
20393
|
+
actions33 = {
|
|
20150
20394
|
add: () => Promise.resolve().then(() => (init_add2(), add_exports2)).then((m) => m.default),
|
|
20151
20395
|
done: () => Promise.resolve().then(() => (init_done(), done_exports)).then((m) => m.default),
|
|
20152
20396
|
assign: () => Promise.resolve().then(() => (init_assign(), assign_exports)).then((m) => m.default),
|
|
@@ -20236,11 +20480,11 @@ var init_pin = __esm({
|
|
|
20236
20480
|
});
|
|
20237
20481
|
|
|
20238
20482
|
// src/commands/views/index.ts
|
|
20239
|
-
var
|
|
20483
|
+
var actions34;
|
|
20240
20484
|
var init_views = __esm({
|
|
20241
20485
|
"src/commands/views/index.ts"() {
|
|
20242
20486
|
"use strict";
|
|
20243
|
-
|
|
20487
|
+
actions34 = {
|
|
20244
20488
|
pin: () => Promise.resolve().then(() => (init_pin(), pin_exports)).then((m) => m.pin),
|
|
20245
20489
|
unpin: () => Promise.resolve().then(() => (init_pin(), pin_exports)).then((m) => m.unpin)
|
|
20246
20490
|
};
|
|
@@ -20250,14 +20494,14 @@ var init_views = __esm({
|
|
|
20250
20494
|
// src/commands/webhooks/local.ts
|
|
20251
20495
|
import { createHmac, randomBytes as randomBytes4 } from "node:crypto";
|
|
20252
20496
|
import { mkdirSync as mkdirSync6, readFileSync as readFileSync17, rmSync as rmSync5, writeFileSync as writeFileSync8 } from "node:fs";
|
|
20253
|
-
import { join as
|
|
20497
|
+
import { join as join23 } from "node:path";
|
|
20254
20498
|
function webhooksDir(env) {
|
|
20255
|
-
const dir3 =
|
|
20499
|
+
const dir3 = join23(configDir(env), "webhooks");
|
|
20256
20500
|
mkdirSync6(dir3, { recursive: true, mode: 448 });
|
|
20257
20501
|
return dir3;
|
|
20258
20502
|
}
|
|
20259
20503
|
function signingSecretPath(env) {
|
|
20260
|
-
return
|
|
20504
|
+
return join23(webhooksDir(env), "signing-secret");
|
|
20261
20505
|
}
|
|
20262
20506
|
function signingSecret(env) {
|
|
20263
20507
|
const file = signingSecretPath(env);
|
|
@@ -20308,7 +20552,7 @@ async function forward(url, event, secret, signal) {
|
|
|
20308
20552
|
}
|
|
20309
20553
|
}
|
|
20310
20554
|
function statePath(env, workspaceId) {
|
|
20311
|
-
return
|
|
20555
|
+
return join23(webhooksDir(env), `listener-${(workspaceId ?? "default").replace(/[^A-Za-z0-9_-]/g, "_")}.json`);
|
|
20312
20556
|
}
|
|
20313
20557
|
function writeListenerState(env, workspaceId, state2) {
|
|
20314
20558
|
writeFileSync8(statePath(env, workspaceId), `${JSON.stringify(state2)}
|
|
@@ -20364,7 +20608,7 @@ async function poll2(ctx, types, cursor2) {
|
|
|
20364
20608
|
return unwrap(res.body) ?? {};
|
|
20365
20609
|
}
|
|
20366
20610
|
function readBody(req) {
|
|
20367
|
-
return new Promise((
|
|
20611
|
+
return new Promise((resolve25, reject) => {
|
|
20368
20612
|
let size = 0;
|
|
20369
20613
|
const chunks = [];
|
|
20370
20614
|
req.on("data", (chunk) => {
|
|
@@ -20372,14 +20616,14 @@ function readBody(req) {
|
|
|
20372
20616
|
if (size > MAX_TRIGGER_BYTES) req.destroy(new Error("too large"));
|
|
20373
20617
|
else chunks.push(chunk);
|
|
20374
20618
|
});
|
|
20375
|
-
req.on("end", () =>
|
|
20619
|
+
req.on("end", () => resolve25(Buffer.concat(chunks).toString("utf8")));
|
|
20376
20620
|
req.on("error", reject);
|
|
20377
20621
|
});
|
|
20378
20622
|
}
|
|
20379
20623
|
function reply(res, status, body2) {
|
|
20380
20624
|
res.writeHead(status, { "content-type": "application/json" }).end(JSON.stringify(body2));
|
|
20381
20625
|
}
|
|
20382
|
-
var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES,
|
|
20626
|
+
var MIN_POLL_MS, MAX_POLL_MS, MAX_TRIGGER_BYTES, command73, listen_default;
|
|
20383
20627
|
var init_listen = __esm({
|
|
20384
20628
|
"src/commands/webhooks/listen.ts"() {
|
|
20385
20629
|
"use strict";
|
|
@@ -20390,7 +20634,7 @@ var init_listen = __esm({
|
|
|
20390
20634
|
MIN_POLL_MS = 1e3;
|
|
20391
20635
|
MAX_POLL_MS = 6e4;
|
|
20392
20636
|
MAX_TRIGGER_BYTES = 1e6;
|
|
20393
|
-
|
|
20637
|
+
command73 = {
|
|
20394
20638
|
resource: "webhooks",
|
|
20395
20639
|
action: "listen",
|
|
20396
20640
|
summary: "Stream the workspace's events and forward them, signed, to a local handler",
|
|
@@ -20461,7 +20705,7 @@ var init_listen = __esm({
|
|
|
20461
20705
|
reply(res, 200, { forward: result ?? null });
|
|
20462
20706
|
}).catch(() => reply(res, 400, { error: "invalid_event" }));
|
|
20463
20707
|
});
|
|
20464
|
-
await new Promise((
|
|
20708
|
+
await new Promise((resolve25) => server.listen(0, "127.0.0.1", resolve25));
|
|
20465
20709
|
const url = `http://127.0.0.1:${server.address().port}/events`;
|
|
20466
20710
|
writeListenerState(ctx.env, workspaceId, { pid: process.pid, url, token, forwardTo: target2, startedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
20467
20711
|
try {
|
|
@@ -20497,7 +20741,7 @@ var init_listen = __esm({
|
|
|
20497
20741
|
return ExitCode.Ok;
|
|
20498
20742
|
}
|
|
20499
20743
|
};
|
|
20500
|
-
listen_default =
|
|
20744
|
+
listen_default = command73;
|
|
20501
20745
|
}
|
|
20502
20746
|
});
|
|
20503
20747
|
|
|
@@ -20516,7 +20760,7 @@ function notRunning() {
|
|
|
20516
20760
|
next: LISTEN_NEXT
|
|
20517
20761
|
});
|
|
20518
20762
|
}
|
|
20519
|
-
var LISTEN_NEXT,
|
|
20763
|
+
var LISTEN_NEXT, command74, trigger_default;
|
|
20520
20764
|
var init_trigger = __esm({
|
|
20521
20765
|
"src/commands/webhooks/trigger.ts"() {
|
|
20522
20766
|
"use strict";
|
|
@@ -20525,7 +20769,7 @@ var init_trigger = __esm({
|
|
|
20525
20769
|
init_http();
|
|
20526
20770
|
init_local();
|
|
20527
20771
|
LISTEN_NEXT = "kenso webhooks listen --forward-to http://localhost:3000/hook";
|
|
20528
|
-
|
|
20772
|
+
command74 = {
|
|
20529
20773
|
resource: "webhooks",
|
|
20530
20774
|
action: "trigger",
|
|
20531
20775
|
summary: "Send a sample event of one type through the running kenso webhooks listen",
|
|
@@ -20583,16 +20827,16 @@ var init_trigger = __esm({
|
|
|
20583
20827
|
return ExitCode.Ok;
|
|
20584
20828
|
}
|
|
20585
20829
|
};
|
|
20586
|
-
trigger_default =
|
|
20830
|
+
trigger_default = command74;
|
|
20587
20831
|
}
|
|
20588
20832
|
});
|
|
20589
20833
|
|
|
20590
20834
|
// src/commands/webhooks/index.ts
|
|
20591
|
-
var
|
|
20835
|
+
var actions35;
|
|
20592
20836
|
var init_webhooks2 = __esm({
|
|
20593
20837
|
"src/commands/webhooks/index.ts"() {
|
|
20594
20838
|
"use strict";
|
|
20595
|
-
|
|
20839
|
+
actions35 = {
|
|
20596
20840
|
listen: () => Promise.resolve().then(() => (init_listen(), listen_exports)).then((m) => m.default),
|
|
20597
20841
|
trigger: () => Promise.resolve().then(() => (init_trigger(), trigger_exports)).then((m) => m.default)
|
|
20598
20842
|
};
|
|
@@ -20604,14 +20848,14 @@ var status_exports3 = {};
|
|
|
20604
20848
|
__export(status_exports3, {
|
|
20605
20849
|
default: () => status_default3
|
|
20606
20850
|
});
|
|
20607
|
-
var
|
|
20851
|
+
var command75, status_default3;
|
|
20608
20852
|
var init_status3 = __esm({
|
|
20609
20853
|
"src/commands/work/status.ts"() {
|
|
20610
20854
|
"use strict";
|
|
20611
20855
|
init_exit_codes();
|
|
20612
20856
|
init_http();
|
|
20613
20857
|
init_common3();
|
|
20614
|
-
|
|
20858
|
+
command75 = {
|
|
20615
20859
|
resource: "work",
|
|
20616
20860
|
action: "status",
|
|
20617
20861
|
summary: "Show the Kenso AI work waiting for your own agent, per kind",
|
|
@@ -20646,13 +20890,13 @@ var init_status3 = __esm({
|
|
|
20646
20890
|
return ExitCode.Ok;
|
|
20647
20891
|
}
|
|
20648
20892
|
};
|
|
20649
|
-
status_default3 =
|
|
20893
|
+
status_default3 = command75;
|
|
20650
20894
|
}
|
|
20651
20895
|
});
|
|
20652
20896
|
|
|
20653
20897
|
// src/work/files.ts
|
|
20654
20898
|
import { closeSync as closeSync3, constants as constants2, fchmodSync as fchmodSync2, fstatSync, lstatSync, openSync as openSync3, readFileSync as readFileSync18, writeFileSync as writeFileSync9 } from "node:fs";
|
|
20655
|
-
import { join as
|
|
20899
|
+
import { join as join24 } from "node:path";
|
|
20656
20900
|
function agentName(value) {
|
|
20657
20901
|
if (typeof value !== "string") return void 0;
|
|
20658
20902
|
const name = value.trim().slice(0, MAX_AGENT_NAME);
|
|
@@ -20671,7 +20915,7 @@ function workFileName(claimId) {
|
|
|
20671
20915
|
function writeWorkFile(dir3, work, mode = 384) {
|
|
20672
20916
|
const name = workFileName(work.claimId);
|
|
20673
20917
|
if (!isPlainFileName(work.answersFile)) throw new Error("answersFile is not a plain file name");
|
|
20674
|
-
const path =
|
|
20918
|
+
const path = join24(dir3, name);
|
|
20675
20919
|
const fd = openSync3(path, "wx", mode);
|
|
20676
20920
|
try {
|
|
20677
20921
|
writeFileSync9(fd, JSON.stringify(work, null, 2) + "\n", "utf8");
|
|
@@ -20778,9 +21022,9 @@ var init_files = __esm({
|
|
|
20778
21022
|
import { execFile, spawnSync as spawnSync2 } from "node:child_process";
|
|
20779
21023
|
import { readFileSync as readFileSync19 } from "node:fs";
|
|
20780
21024
|
import { isAbsolute as isAbsolute3 } from "node:path";
|
|
20781
|
-
function sudoArgs(user,
|
|
21025
|
+
function sudoArgs(user, command92, args, keep = [], set2 = {}) {
|
|
20782
21026
|
const assignments = Object.entries(set2).map(([name, value]) => `${name}=${value}`);
|
|
20783
|
-
return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--",
|
|
21027
|
+
return ["-n", "-u", user, "-H", ...keep.length > 0 ? [`--preserve-env=${keep.join(",")}`] : [], ...assignments, "--", command92, ...args];
|
|
20784
21028
|
}
|
|
20785
21029
|
function agentKensoEnv(opts) {
|
|
20786
21030
|
return {
|
|
@@ -20790,16 +21034,16 @@ function agentKensoEnv(opts) {
|
|
|
20790
21034
|
AI_AGENT: opts.agentName
|
|
20791
21035
|
};
|
|
20792
21036
|
}
|
|
20793
|
-
function sudoExec(user,
|
|
21037
|
+
function sudoExec(user, command92, args, opts = {}) {
|
|
20794
21038
|
const [sudo = "/usr/bin/sudo", ...lead] = user.sudo;
|
|
20795
|
-
return new Promise((
|
|
21039
|
+
return new Promise((resolve25) => {
|
|
20796
21040
|
execFile(
|
|
20797
21041
|
sudo,
|
|
20798
|
-
[...lead, ...sudoArgs(user.name,
|
|
21042
|
+
[...lead, ...sudoArgs(user.name, command92, args)],
|
|
20799
21043
|
{ env: { PATH: SUDO_PATH }, cwd: "/", timeout: opts.timeoutMs ?? PROBE_TIMEOUT_MS, maxBuffer: opts.maxBuffer ?? 1024 * 1024, encoding: "utf8", windowsHide: true, shell: false },
|
|
20800
21044
|
(err, stdout, stderr) => {
|
|
20801
21045
|
const code = err ? err.code : 0;
|
|
20802
|
-
|
|
21046
|
+
resolve25({ exitCode: typeof code === "number" ? code : null, stdout, stderr });
|
|
20803
21047
|
}
|
|
20804
21048
|
);
|
|
20805
21049
|
});
|
|
@@ -20895,7 +21139,7 @@ var init_agent_user = __esm({
|
|
|
20895
21139
|
// src/commands/work/folder.ts
|
|
20896
21140
|
import { existsSync as existsSync10 } from "node:fs";
|
|
20897
21141
|
import { appendFile as appendFile3, symlink as symlink2, unlink as unlink3 } from "node:fs/promises";
|
|
20898
|
-
import { dirname as
|
|
21142
|
+
import { dirname as dirname5, join as join25, resolve as resolve17 } from "node:path";
|
|
20899
21143
|
var WorkRunFolder;
|
|
20900
21144
|
var init_folder3 = __esm({
|
|
20901
21145
|
"src/commands/work/folder.ts"() {
|
|
@@ -20905,9 +21149,9 @@ var init_folder3 = __esm({
|
|
|
20905
21149
|
init_redact();
|
|
20906
21150
|
init_agent_user();
|
|
20907
21151
|
WorkRunFolder = class {
|
|
20908
|
-
constructor(ctx,
|
|
21152
|
+
constructor(ctx, command92, args, outDir, shared = false) {
|
|
20909
21153
|
this.ctx = ctx;
|
|
20910
|
-
this.command =
|
|
21154
|
+
this.command = command92;
|
|
20911
21155
|
this.args = args;
|
|
20912
21156
|
this.outDir = outDir;
|
|
20913
21157
|
this.shared = shared;
|
|
@@ -20937,12 +21181,12 @@ var init_folder3 = __esm({
|
|
|
20937
21181
|
const makeDir = (path) => this.shared ? ensureDir(path, SHARED_DIR_MODE) : ensurePrivateDir2(path);
|
|
20938
21182
|
let dir3;
|
|
20939
21183
|
if (this.outDir === void 0) {
|
|
20940
|
-
dir3 =
|
|
21184
|
+
dir3 = join25(root3, this.runId);
|
|
20941
21185
|
if (!this.shared) ensurePrivateDir2(root3);
|
|
20942
21186
|
makeDir(dir3);
|
|
20943
21187
|
} else {
|
|
20944
|
-
dir3 =
|
|
20945
|
-
const existing = existsSync10(
|
|
21188
|
+
dir3 = resolve17(this.outDir);
|
|
21189
|
+
const existing = existsSync10(join25(dir3, "run.json")) ? await readRunDir(dir3) : null;
|
|
20946
21190
|
if (existing && !existing.command.startsWith("work ")) {
|
|
20947
21191
|
throw usageError(`${dir3} already holds run ${existing.runId} (${existing.command}).`, {
|
|
20948
21192
|
field: "out",
|
|
@@ -20950,17 +21194,17 @@ var init_folder3 = __esm({
|
|
|
20950
21194
|
});
|
|
20951
21195
|
}
|
|
20952
21196
|
makeDir(dir3);
|
|
20953
|
-
for (const name of ["results.ndjson", "summary.json"]) await unlink3(
|
|
21197
|
+
for (const name of ["results.ndjson", "summary.json"]) await unlink3(join25(dir3, name)).catch(() => void 0);
|
|
20954
21198
|
try {
|
|
20955
21199
|
if (!this.shared) ensurePrivateDir2(root3);
|
|
20956
|
-
await symlink2(dir3,
|
|
21200
|
+
await symlink2(dir3, join25(root3, this.runId), "junction");
|
|
20957
21201
|
} catch (err) {
|
|
20958
21202
|
this.ctx.output.warn(`Could not link ${dir3} into ${root3} (${err.message}): kenso runs will not list this run.`);
|
|
20959
21203
|
}
|
|
20960
21204
|
}
|
|
20961
21205
|
this.dir = dir3;
|
|
20962
21206
|
if (this.shared) {
|
|
20963
|
-
this.tmpDir =
|
|
21207
|
+
this.tmpDir = join25(dir3, "tmp");
|
|
20964
21208
|
ensureDir(this.tmpDir, JOB_DIR_MODE);
|
|
20965
21209
|
}
|
|
20966
21210
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -20987,9 +21231,9 @@ var init_folder3 = __esm({
|
|
|
20987
21231
|
* writes (3770) under a jobs folder it can only pass through (2750).
|
|
20988
21232
|
*/
|
|
20989
21233
|
async jobDir(claimId) {
|
|
20990
|
-
const dir3 =
|
|
21234
|
+
const dir3 = join25(await this.ensure(), "jobs", claimId);
|
|
20991
21235
|
if (this.shared) {
|
|
20992
|
-
ensureDir(
|
|
21236
|
+
ensureDir(dirname5(dir3), SHARED_DIR_MODE);
|
|
20993
21237
|
ensureDir(dir3, JOB_DIR_MODE);
|
|
20994
21238
|
} else {
|
|
20995
21239
|
ensurePrivateDir2(dir3);
|
|
@@ -21003,13 +21247,13 @@ var init_folder3 = __esm({
|
|
|
21003
21247
|
async append(line) {
|
|
21004
21248
|
if (!this.dir) return;
|
|
21005
21249
|
const json = JSON.stringify(line, (_key, value) => typeof value === "string" ? redact(value) : value);
|
|
21006
|
-
await appendFile3(
|
|
21250
|
+
await appendFile3(join25(this.dir, "results.ndjson"), `${json}
|
|
21007
21251
|
`, { mode: 384 });
|
|
21008
21252
|
}
|
|
21009
21253
|
/** summary.json, and run.json with the final status, the claims (chunkCount) and the items (rows). */
|
|
21010
21254
|
async finish(status, claims, items, summary) {
|
|
21011
21255
|
if (!this.dir || !this.record) return;
|
|
21012
|
-
await writeJsonAtomic(
|
|
21256
|
+
await writeJsonAtomic(join25(this.dir, "summary.json"), summary);
|
|
21013
21257
|
this.record = { ...this.record, status, chunkCount: claims, rows: items, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
21014
21258
|
await writeRunRecord(this.record);
|
|
21015
21259
|
}
|
|
@@ -21022,7 +21266,7 @@ var pull_exports2 = {};
|
|
|
21022
21266
|
__export(pull_exports2, {
|
|
21023
21267
|
default: () => pull_default2
|
|
21024
21268
|
});
|
|
21025
|
-
var MAX_FILES,
|
|
21269
|
+
var MAX_FILES, command76, pull_default2;
|
|
21026
21270
|
var init_pull2 = __esm({
|
|
21027
21271
|
"src/commands/work/pull.ts"() {
|
|
21028
21272
|
"use strict";
|
|
@@ -21031,7 +21275,7 @@ var init_pull2 = __esm({
|
|
|
21031
21275
|
init_common3();
|
|
21032
21276
|
init_folder3();
|
|
21033
21277
|
MAX_FILES = 100;
|
|
21034
|
-
|
|
21278
|
+
command76 = {
|
|
21035
21279
|
resource: "work",
|
|
21036
21280
|
action: "pull",
|
|
21037
21281
|
summary: "Claim waiting work into local work files, to answer by hand",
|
|
@@ -21110,14 +21354,14 @@ var init_pull2 = __esm({
|
|
|
21110
21354
|
return interrupted7 ? ExitCode.Interrupted : ExitCode.Ok;
|
|
21111
21355
|
}
|
|
21112
21356
|
};
|
|
21113
|
-
pull_default2 =
|
|
21357
|
+
pull_default2 = command76;
|
|
21114
21358
|
}
|
|
21115
21359
|
});
|
|
21116
21360
|
|
|
21117
21361
|
// src/commands/work/answers.ts
|
|
21118
21362
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
21119
21363
|
import { existsSync as existsSync11 } from "node:fs";
|
|
21120
|
-
import { basename as
|
|
21364
|
+
import { basename as basename6, dirname as dirname6, join as join26 } from "node:path";
|
|
21121
21365
|
function zeroTotals() {
|
|
21122
21366
|
return { accepted: 0, rejected: 0, expired: 0, duplicate: 0, dropped: 0 };
|
|
21123
21367
|
}
|
|
@@ -21189,7 +21433,7 @@ function droppedResult(d) {
|
|
|
21189
21433
|
return { itemId: d.itemId ?? null, status: "dropped", reason: d.reason, message: `Answer ${d.index + 1} of the file was not sent: ${d.reason.replace(/_/g, " ")}.` };
|
|
21190
21434
|
}
|
|
21191
21435
|
async function writeResults(answersPath, claimId, results, totals) {
|
|
21192
|
-
const path =
|
|
21436
|
+
const path = join26(dirname6(answersPath), `${claimId}.results.json`);
|
|
21193
21437
|
await writeJsonAtomic(path, { version: 1, claimId, submittedAt: (/* @__PURE__ */ new Date()).toISOString(), ...totals, results });
|
|
21194
21438
|
return path;
|
|
21195
21439
|
}
|
|
@@ -21205,7 +21449,7 @@ async function submitAnswersFile(ctx, answersPath, work, opts = {}) {
|
|
|
21205
21449
|
return { claimId: work.claimId, results, totals, resultsPath };
|
|
21206
21450
|
}
|
|
21207
21451
|
function claimIdOfFile(path, suffix) {
|
|
21208
|
-
const name =
|
|
21452
|
+
const name = basename6(path);
|
|
21209
21453
|
if (!name.endsWith(suffix)) return void 0;
|
|
21210
21454
|
const id = name.slice(0, -suffix.length);
|
|
21211
21455
|
return isPlainFileName(id) ? id : void 0;
|
|
@@ -21218,7 +21462,7 @@ function workFileNextTo(answersPath) {
|
|
|
21218
21462
|
hint: "Write the answers to <claimId>.answers.json next to its <claimId>.work.json, as the work file's rules say."
|
|
21219
21463
|
});
|
|
21220
21464
|
}
|
|
21221
|
-
const workPath =
|
|
21465
|
+
const workPath = join26(dirname6(answersPath), `${claimId}.work.json`);
|
|
21222
21466
|
if (!existsSync11(workPath)) {
|
|
21223
21467
|
throw usageError(`${workPath} is missing: kenso work submit reads it next to the answers file.`, { field: "answers-file" });
|
|
21224
21468
|
}
|
|
@@ -21251,8 +21495,8 @@ var submit_exports = {};
|
|
|
21251
21495
|
__export(submit_exports, {
|
|
21252
21496
|
default: () => submit_default
|
|
21253
21497
|
});
|
|
21254
|
-
import { resolve as
|
|
21255
|
-
var
|
|
21498
|
+
import { resolve as resolve18 } from "node:path";
|
|
21499
|
+
var command77, submit_default;
|
|
21256
21500
|
var init_submit = __esm({
|
|
21257
21501
|
"src/commands/work/submit.ts"() {
|
|
21258
21502
|
"use strict";
|
|
@@ -21261,7 +21505,7 @@ var init_submit = __esm({
|
|
|
21261
21505
|
init_files();
|
|
21262
21506
|
init_answers();
|
|
21263
21507
|
init_common3();
|
|
21264
|
-
|
|
21508
|
+
command77 = {
|
|
21265
21509
|
resource: "work",
|
|
21266
21510
|
action: "submit",
|
|
21267
21511
|
summary: "Send answers files to Kenso and write each one's results",
|
|
@@ -21274,7 +21518,7 @@ var init_submit = __esm({
|
|
|
21274
21518
|
beta: BETA,
|
|
21275
21519
|
operationIds: ["agent-work.submit-answers"],
|
|
21276
21520
|
async run(ctx, { positionals }) {
|
|
21277
|
-
const paths = [...new Set(positionals.map((p) =>
|
|
21521
|
+
const paths = [...new Set(positionals.map((p) => resolve18(p)))];
|
|
21278
21522
|
const jobs = paths.map((path) => {
|
|
21279
21523
|
const work = workFileNextTo(path);
|
|
21280
21524
|
const read2 = readAnswersFile(path, work);
|
|
@@ -21294,7 +21538,7 @@ var init_submit = __esm({
|
|
|
21294
21538
|
return totals.rejected > 0 ? ExitCode.Partial : ExitCode.Ok;
|
|
21295
21539
|
}
|
|
21296
21540
|
};
|
|
21297
|
-
submit_default =
|
|
21541
|
+
submit_default = command77;
|
|
21298
21542
|
}
|
|
21299
21543
|
});
|
|
21300
21544
|
|
|
@@ -21315,7 +21559,7 @@ function claimIdOf(arg) {
|
|
|
21315
21559
|
if (!CLAIM_ID.test(arg)) throw usageError(`"${arg}" is neither a claim id nor a work file.`, { field: "claim", hint: "Claim ids look like awc_8fK2..." });
|
|
21316
21560
|
return arg;
|
|
21317
21561
|
}
|
|
21318
|
-
var CLAIM_ID,
|
|
21562
|
+
var CLAIM_ID, command78, release_default;
|
|
21319
21563
|
var init_release = __esm({
|
|
21320
21564
|
"src/commands/work/release.ts"() {
|
|
21321
21565
|
"use strict";
|
|
@@ -21324,7 +21568,7 @@ var init_release = __esm({
|
|
|
21324
21568
|
init_files();
|
|
21325
21569
|
init_common3();
|
|
21326
21570
|
CLAIM_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
21327
|
-
|
|
21571
|
+
command78 = {
|
|
21328
21572
|
resource: "work",
|
|
21329
21573
|
action: "release",
|
|
21330
21574
|
summary: "Give claimed work back to the queue now",
|
|
@@ -21344,7 +21588,7 @@ var init_release = __esm({
|
|
|
21344
21588
|
return ExitCode.Ok;
|
|
21345
21589
|
}
|
|
21346
21590
|
};
|
|
21347
|
-
release_default =
|
|
21591
|
+
release_default = command78;
|
|
21348
21592
|
}
|
|
21349
21593
|
});
|
|
21350
21594
|
|
|
@@ -21392,9 +21636,9 @@ async function systemResolve() {
|
|
|
21392
21636
|
const { lookup } = await import("node:dns");
|
|
21393
21637
|
return (host, callback) => lookup(host, { all: true, verbatim: true }, callback);
|
|
21394
21638
|
}
|
|
21395
|
-
function guardedLookup(
|
|
21639
|
+
function guardedLookup(resolve25, isBlocked) {
|
|
21396
21640
|
return (hostname, options, callback) => {
|
|
21397
|
-
|
|
21641
|
+
resolve25(hostname, (err, addresses) => {
|
|
21398
21642
|
if (err) return callback(err, "", 4);
|
|
21399
21643
|
if (addresses.length === 0 || addresses.some((a) => isBlocked(a.address))) return callback(blockedError(hostname), "", 4);
|
|
21400
21644
|
if (options.all) return callback(null, addresses);
|
|
@@ -21436,30 +21680,30 @@ async function startWebGuard(opts = {}) {
|
|
|
21436
21680
|
sockets.add(socket);
|
|
21437
21681
|
socket.once("close", () => sockets.delete(socket));
|
|
21438
21682
|
};
|
|
21439
|
-
const checkHost = (host) => new Promise((
|
|
21440
|
-
if (isIP(host)) return isBlocked(host) ? reject(blockedError(host)) :
|
|
21683
|
+
const checkHost = (host) => new Promise((resolve25, reject) => {
|
|
21684
|
+
if (isIP(host)) return isBlocked(host) ? reject(blockedError(host)) : resolve25(host);
|
|
21441
21685
|
lookup(host, { all: true }, (err, found) => {
|
|
21442
21686
|
if (err) return reject(err);
|
|
21443
|
-
if (!opts.pin || !Array.isArray(found)) return
|
|
21444
|
-
|
|
21687
|
+
if (!opts.pin || !Array.isArray(found)) return resolve25(host);
|
|
21688
|
+
resolve25((found.find((a) => a.family === 4) ?? found[0]).address);
|
|
21445
21689
|
});
|
|
21446
21690
|
});
|
|
21447
21691
|
const dial = async (host, port2) => {
|
|
21448
21692
|
if (upstream === void 0) {
|
|
21449
|
-
return new Promise((
|
|
21693
|
+
return new Promise((resolve25, reject) => {
|
|
21450
21694
|
const socket = connect({ host, port: port2, lookup });
|
|
21451
21695
|
track(socket);
|
|
21452
21696
|
socket.setTimeout(CONNECT_TIMEOUT_MS, () => socket.destroy(new Error("timed out")));
|
|
21453
21697
|
socket.once("connect", () => {
|
|
21454
21698
|
socket.setTimeout(0);
|
|
21455
|
-
|
|
21699
|
+
resolve25(socket);
|
|
21456
21700
|
});
|
|
21457
21701
|
socket.once("error", reject);
|
|
21458
21702
|
});
|
|
21459
21703
|
}
|
|
21460
21704
|
const to = await checkHost(host);
|
|
21461
21705
|
const authority = `${isIP(to) === 6 ? `[${to}]` : to}:${port2}`;
|
|
21462
|
-
return new Promise((
|
|
21706
|
+
return new Promise((resolve25, reject) => {
|
|
21463
21707
|
const req = proxyRequest({ ...proxyAt, method: "CONNECT", path: authority, headers: { host: authority, ...proxyAuth } });
|
|
21464
21708
|
req.setTimeout(CONNECT_TIMEOUT_MS, () => req.destroy(new Error("timed out")));
|
|
21465
21709
|
req.once("connect", (answer, socket, head) => {
|
|
@@ -21471,7 +21715,7 @@ async function startWebGuard(opts = {}) {
|
|
|
21471
21715
|
return reject(upstreamTrouble(`answered ${status}`));
|
|
21472
21716
|
}
|
|
21473
21717
|
if (head.length > 0) socket.unshift(head);
|
|
21474
|
-
|
|
21718
|
+
resolve25(socket);
|
|
21475
21719
|
});
|
|
21476
21720
|
req.once("error", (err) => reject(proxyError(err)));
|
|
21477
21721
|
req.end();
|
|
@@ -21546,16 +21790,16 @@ ${body2}`);
|
|
|
21546
21790
|
}
|
|
21547
21791
|
);
|
|
21548
21792
|
});
|
|
21549
|
-
await new Promise((
|
|
21793
|
+
await new Promise((resolve25, reject) => {
|
|
21550
21794
|
server.once("error", reject);
|
|
21551
|
-
server.listen(0, "127.0.0.1", () =>
|
|
21795
|
+
server.listen(0, "127.0.0.1", () => resolve25());
|
|
21552
21796
|
});
|
|
21553
21797
|
const { port } = server.address();
|
|
21554
21798
|
return {
|
|
21555
21799
|
url: `http://127.0.0.1:${port}`,
|
|
21556
|
-
close: () => new Promise((
|
|
21800
|
+
close: () => new Promise((resolve25) => {
|
|
21557
21801
|
for (const socket of sockets) socket.destroy();
|
|
21558
|
-
server.close(() =>
|
|
21802
|
+
server.close(() => resolve25());
|
|
21559
21803
|
})
|
|
21560
21804
|
};
|
|
21561
21805
|
}
|
|
@@ -21624,9 +21868,9 @@ var init_egress = __esm({
|
|
|
21624
21868
|
|
|
21625
21869
|
// src/work/job.ts
|
|
21626
21870
|
import { spawn as nodeSpawn3 } from "node:child_process";
|
|
21627
|
-
import { rmSync as rmSync6, statSync as
|
|
21871
|
+
import { rmSync as rmSync6, statSync as statSync7 } from "node:fs";
|
|
21628
21872
|
import { access, constants as constants3 } from "node:fs/promises";
|
|
21629
|
-
import { delimiter as delimiter2, join as
|
|
21873
|
+
import { delimiter as delimiter2, join as join27 } from "node:path";
|
|
21630
21874
|
import { setTimeout as delay12 } from "node:timers/promises";
|
|
21631
21875
|
function childEnv(parent, adapter, extra) {
|
|
21632
21876
|
const scrub = new Set(adapter.scrubEnv.map((name) => name.toUpperCase()));
|
|
@@ -21645,7 +21889,7 @@ function childEnv(parent, adapter, extra) {
|
|
|
21645
21889
|
async function isExecutableFile(path) {
|
|
21646
21890
|
try {
|
|
21647
21891
|
await access(path, constants3.X_OK);
|
|
21648
|
-
return
|
|
21892
|
+
return statSync7(path).isFile();
|
|
21649
21893
|
} catch {
|
|
21650
21894
|
return false;
|
|
21651
21895
|
}
|
|
@@ -21665,7 +21909,7 @@ async function resolveBinary(adapter, env, override2) {
|
|
|
21665
21909
|
}
|
|
21666
21910
|
for (const dir3 of pathDirs(env)) {
|
|
21667
21911
|
for (const ext of extensions) {
|
|
21668
|
-
const candidate2 =
|
|
21912
|
+
const candidate2 = join27(dir3, name + ext);
|
|
21669
21913
|
if (await isExecutableFile(candidate2)) return candidate2;
|
|
21670
21914
|
}
|
|
21671
21915
|
}
|
|
@@ -21734,7 +21978,7 @@ async function groupGone(pid, runAs) {
|
|
|
21734
21978
|
}
|
|
21735
21979
|
}
|
|
21736
21980
|
function runChild(spawnFn, bin, built, job, env, signal, runAs) {
|
|
21737
|
-
return new Promise((
|
|
21981
|
+
return new Promise((resolve25) => {
|
|
21738
21982
|
const stdout = new Tail(OUTPUT_CAP_BYTES);
|
|
21739
21983
|
const stderr = new Tail(OUTPUT_CAP_BYTES);
|
|
21740
21984
|
let child;
|
|
@@ -21749,7 +21993,7 @@ function runChild(spawnFn, bin, built, job, env, signal, runAs) {
|
|
|
21749
21993
|
shell: false
|
|
21750
21994
|
});
|
|
21751
21995
|
} catch (err) {
|
|
21752
|
-
|
|
21996
|
+
resolve25({ exitCode: null, stdout: "", stderr: "", spawnError: err });
|
|
21753
21997
|
return;
|
|
21754
21998
|
}
|
|
21755
21999
|
let stopped;
|
|
@@ -21767,7 +22011,7 @@ function runChild(spawnFn, bin, built, job, env, signal, runAs) {
|
|
|
21767
22011
|
signal?.removeEventListener("abort", onAbort);
|
|
21768
22012
|
void groupGone(pid, runAs).then(() => {
|
|
21769
22013
|
if (pid !== void 0) liveGroups.delete(pid);
|
|
21770
|
-
|
|
22014
|
+
resolve25({ exitCode, stdout: stdout.text(), stderr: stderr.text(), stopped, spawnError });
|
|
21771
22015
|
});
|
|
21772
22016
|
};
|
|
21773
22017
|
const stop = (why2) => {
|
|
@@ -21831,11 +22075,11 @@ async function runAgentJob(adapter, job, deps) {
|
|
|
21831
22075
|
}
|
|
21832
22076
|
let work;
|
|
21833
22077
|
try {
|
|
21834
|
-
work = readWorkFile(
|
|
22078
|
+
work = readWorkFile(join27(job.cwd, job.workFile));
|
|
21835
22079
|
} catch (err) {
|
|
21836
22080
|
return result("fatal", null, `the work file could not be read: ${err.message}`);
|
|
21837
22081
|
}
|
|
21838
|
-
const answersPath =
|
|
22082
|
+
const answersPath = join27(job.cwd, job.answersFile);
|
|
21839
22083
|
try {
|
|
21840
22084
|
rmSync6(answersPath, { force: true });
|
|
21841
22085
|
} catch (err) {
|
|
@@ -22001,25 +22245,25 @@ function plain(text5) {
|
|
|
22001
22245
|
return text5.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, "");
|
|
22002
22246
|
}
|
|
22003
22247
|
function runStatus(bin, args, env, adapter, runAs) {
|
|
22004
|
-
const
|
|
22248
|
+
const command92 = runAs ? runAs.sudo[0] ?? "/usr/bin/sudo" : bin;
|
|
22005
22249
|
const commandArgs2 = runAs ? [...runAs.sudo.slice(1), ...sudoArgs(runAs.name, bin, args)] : args;
|
|
22006
22250
|
const options = runAs ? { env: { PATH: SUDO_PATH }, cwd: "/" } : { env: childEnv(env, adapter) };
|
|
22007
|
-
return new Promise((
|
|
22251
|
+
return new Promise((resolve25) => {
|
|
22008
22252
|
execFile2(
|
|
22009
|
-
|
|
22253
|
+
command92,
|
|
22010
22254
|
commandArgs2,
|
|
22011
22255
|
{ ...options, timeout: STATUS_TIMEOUT_MS, maxBuffer: 1024 * 1024, windowsHide: true, shell: false },
|
|
22012
22256
|
(err, stdout, stderr) => {
|
|
22013
22257
|
if (err && typeof err.code === "string") {
|
|
22014
|
-
|
|
22258
|
+
resolve25(void 0);
|
|
22015
22259
|
return;
|
|
22016
22260
|
}
|
|
22017
22261
|
if (err && err.killed) {
|
|
22018
|
-
|
|
22262
|
+
resolve25(void 0);
|
|
22019
22263
|
return;
|
|
22020
22264
|
}
|
|
22021
22265
|
const exitCode = err ? err.code ?? null : 0;
|
|
22022
|
-
|
|
22266
|
+
resolve25({ exitCode: typeof exitCode === "number" ? exitCode : null, stdout: plain(String(stdout)), stderr: plain(String(stderr)) });
|
|
22023
22267
|
}
|
|
22024
22268
|
);
|
|
22025
22269
|
});
|
|
@@ -22291,7 +22535,7 @@ ${out.stderr}`;
|
|
|
22291
22535
|
});
|
|
22292
22536
|
|
|
22293
22537
|
// src/work/adapters/opencode.ts
|
|
22294
|
-
import { basename as
|
|
22538
|
+
import { basename as basename7, join as join28 } from "node:path";
|
|
22295
22539
|
var opencode;
|
|
22296
22540
|
var init_opencode = __esm({
|
|
22297
22541
|
"src/work/adapters/opencode.ts"() {
|
|
@@ -22335,7 +22579,7 @@ ${out.stderr}`);
|
|
|
22335
22579
|
if (job.model) args.push("--model", job.model);
|
|
22336
22580
|
args.push(job.instruction);
|
|
22337
22581
|
const env = { OPENCODE_CONFIG_CONTENT: JSON.stringify(config) };
|
|
22338
|
-
if (job.tmpDir !== void 0) env.OPENCODE_DB =
|
|
22582
|
+
if (job.tmpDir !== void 0) env.OPENCODE_DB = join28(job.tmpDir, `opencode-${basename7(job.cwd)}.db`);
|
|
22339
22583
|
return { args, env };
|
|
22340
22584
|
},
|
|
22341
22585
|
classify: classifyByExit
|
|
@@ -22540,7 +22784,7 @@ var init_scan = __esm({
|
|
|
22540
22784
|
|
|
22541
22785
|
// src/work/credentials.ts
|
|
22542
22786
|
import { createHash as createHash11 } from "node:crypto";
|
|
22543
|
-
import { join as
|
|
22787
|
+
import { join as join29 } from "node:path";
|
|
22544
22788
|
function unreadable(why2) {
|
|
22545
22789
|
return new KensoError({
|
|
22546
22790
|
code: "credentials_unreadable",
|
|
@@ -22628,7 +22872,7 @@ var init_credentials = __esm({
|
|
|
22628
22872
|
}
|
|
22629
22873
|
}
|
|
22630
22874
|
async read(rel) {
|
|
22631
|
-
const r = await sudoExec(this.user, CAT, [
|
|
22875
|
+
const r = await sudoExec(this.user, CAT, [join29(this.user.home, rel)], { maxBuffer: MAX_CREDENTIAL_BYTES });
|
|
22632
22876
|
if (r.exitCode !== 0) return /No such file or directory/.test(r.stderr) ? "missing" : "unreadable";
|
|
22633
22877
|
const digest = createHash11("sha256").update(r.stdout).digest("hex");
|
|
22634
22878
|
if (this.seen.get(rel) !== digest) {
|
|
@@ -22643,7 +22887,7 @@ var init_credentials = __esm({
|
|
|
22643
22887
|
|
|
22644
22888
|
// src/work/guide.ts
|
|
22645
22889
|
import { closeSync as closeSync4, fchmodSync as fchmodSync3, openSync as openSync4, writeFileSync as writeFileSync10 } from "node:fs";
|
|
22646
|
-
import { join as
|
|
22890
|
+
import { join as join30 } from "node:path";
|
|
22647
22891
|
function agentGuide(opts) {
|
|
22648
22892
|
const browser = opts.browser ?? findOperation("browser-runs", "create") !== void 0;
|
|
22649
22893
|
const parts2 = opts.kensoKey ? [JOB, KENSO, ...browser ? [BROWSER] : [], NEVER] : [JOB, NO_KENSO, NEVER];
|
|
@@ -22651,7 +22895,7 @@ function agentGuide(opts) {
|
|
|
22651
22895
|
}
|
|
22652
22896
|
function writeAgentGuide(dir3, text5, mode = WORK_FILE_MODE) {
|
|
22653
22897
|
for (const name of GUIDE_FILES) {
|
|
22654
|
-
const fd = openSync4(
|
|
22898
|
+
const fd = openSync4(join30(dir3, name), "wx", mode);
|
|
22655
22899
|
try {
|
|
22656
22900
|
writeFileSync10(fd, text5, "utf8");
|
|
22657
22901
|
fchmodSync3(fd, mode);
|
|
@@ -22807,7 +23051,7 @@ var init_instruction = __esm({
|
|
|
22807
23051
|
// src/work/pool.ts
|
|
22808
23052
|
function runPool(opts) {
|
|
22809
23053
|
const limit = Math.min(MAX_PARALLEL, Math.max(1, Math.floor(Number.isFinite(opts.parallel) ? opts.parallel : 1)));
|
|
22810
|
-
return new Promise((
|
|
23054
|
+
return new Promise((resolve25, reject) => {
|
|
22811
23055
|
let running = 0;
|
|
22812
23056
|
let filling = false;
|
|
22813
23057
|
let again = false;
|
|
@@ -22847,7 +23091,7 @@ function runPool(opts) {
|
|
|
22847
23091
|
const stopping = empty || failure2 !== void 0 || opts.signal?.aborted === true;
|
|
22848
23092
|
if (stopping && running === 0 && !again) {
|
|
22849
23093
|
if (failure2) reject(failure2.error);
|
|
22850
|
-
else
|
|
23094
|
+
else resolve25();
|
|
22851
23095
|
return;
|
|
22852
23096
|
}
|
|
22853
23097
|
} while (again);
|
|
@@ -22951,7 +23195,7 @@ var init_agent3 = __esm({
|
|
|
22951
23195
|
});
|
|
22952
23196
|
|
|
22953
23197
|
// src/commands/work/box.ts
|
|
22954
|
-
import { resolve as
|
|
23198
|
+
import { resolve as resolve19, sep as sep3 } from "node:path";
|
|
22955
23199
|
function invalidToken(message) {
|
|
22956
23200
|
return new KensoError({ code: "invalid_token_format", message, exitCode: ExitCode.Usage, field: "token-stdin" });
|
|
22957
23201
|
}
|
|
@@ -22978,7 +23222,7 @@ function requireSharedRunsDir(ctx, out) {
|
|
|
22978
23222
|
if (!root3) {
|
|
22979
23223
|
throw usageError("--agent-user needs KENSO_RUNS_DIR: the job folders go there, where the agent user's group can reach them.", { field: "agent-user" });
|
|
22980
23224
|
}
|
|
22981
|
-
if (out !== void 0 && !
|
|
23225
|
+
if (out !== void 0 && !resolve19(out).startsWith(resolve19(root3) + sep3)) {
|
|
22982
23226
|
throw usageError(`--out must be inside KENSO_RUNS_DIR (${root3}) with --agent-user.`, { field: "out" });
|
|
22983
23227
|
}
|
|
22984
23228
|
}
|
|
@@ -23184,7 +23428,7 @@ var run_exports4 = {};
|
|
|
23184
23428
|
__export(run_exports4, {
|
|
23185
23429
|
default: () => run_default3
|
|
23186
23430
|
});
|
|
23187
|
-
var FAILURES_IN_A_ROW,
|
|
23431
|
+
var FAILURES_IN_A_ROW, command79, run_default3;
|
|
23188
23432
|
var init_run4 = __esm({
|
|
23189
23433
|
"src/commands/work/run.ts"() {
|
|
23190
23434
|
"use strict";
|
|
@@ -23207,7 +23451,7 @@ var init_run4 = __esm({
|
|
|
23207
23451
|
init_run_flags();
|
|
23208
23452
|
init_stop();
|
|
23209
23453
|
FAILURES_IN_A_ROW = 3;
|
|
23210
|
-
|
|
23454
|
+
command79 = {
|
|
23211
23455
|
resource: "work",
|
|
23212
23456
|
action: "run",
|
|
23213
23457
|
summary: "Run your own coding agent on the waiting work until the queue is empty",
|
|
@@ -23522,16 +23766,16 @@ var init_run4 = __esm({
|
|
|
23522
23766
|
return exitCodeFor(reason, totals.rejected > 0 || jobsFailed > 0);
|
|
23523
23767
|
}
|
|
23524
23768
|
};
|
|
23525
|
-
run_default3 =
|
|
23769
|
+
run_default3 = command79;
|
|
23526
23770
|
}
|
|
23527
23771
|
});
|
|
23528
23772
|
|
|
23529
23773
|
// src/commands/work/index.ts
|
|
23530
|
-
var
|
|
23774
|
+
var actions36;
|
|
23531
23775
|
var init_work2 = __esm({
|
|
23532
23776
|
"src/commands/work/index.ts"() {
|
|
23533
23777
|
"use strict";
|
|
23534
|
-
|
|
23778
|
+
actions36 = {
|
|
23535
23779
|
status: () => Promise.resolve().then(() => (init_status3(), status_exports3)).then((m) => m.default),
|
|
23536
23780
|
pull: () => Promise.resolve().then(() => (init_pull2(), pull_exports2)).then((m) => m.default),
|
|
23537
23781
|
submit: () => Promise.resolve().then(() => (init_submit(), submit_exports)).then((m) => m.default),
|
|
@@ -23543,12 +23787,12 @@ var init_work2 = __esm({
|
|
|
23543
23787
|
|
|
23544
23788
|
// src/commands/workflows/files.ts
|
|
23545
23789
|
import { mkdirSync as mkdirSync7, readFileSync as readFileSync20, writeFileSync as writeFileSync11 } from "node:fs";
|
|
23546
|
-
import { basename as
|
|
23790
|
+
import { basename as basename8, dirname as dirname7, join as join31, relative as relative3, resolve as resolve20, sep as sep4 } from "node:path";
|
|
23547
23791
|
function shownPath(path) {
|
|
23548
23792
|
return relative3(process.cwd(), path).split(sep4).join("/");
|
|
23549
23793
|
}
|
|
23550
23794
|
function readWorkflowFile(file) {
|
|
23551
|
-
const path =
|
|
23795
|
+
const path = resolve20(file);
|
|
23552
23796
|
let text5;
|
|
23553
23797
|
try {
|
|
23554
23798
|
text5 = readFileSync20(path, "utf8");
|
|
@@ -23576,8 +23820,8 @@ function fileExists(file, hint) {
|
|
|
23576
23820
|
return new KensoError({ code: "file_exists", message: `${file} already exists. Nothing was written.`, exitCode: ExitCode.Conflict, field: "file", hint });
|
|
23577
23821
|
}
|
|
23578
23822
|
function writeWorkflowFile(file, definition, opts = {}) {
|
|
23579
|
-
const path =
|
|
23580
|
-
mkdirSync7(
|
|
23823
|
+
const path = resolve20(file);
|
|
23824
|
+
mkdirSync7(dirname7(path), { recursive: true });
|
|
23581
23825
|
try {
|
|
23582
23826
|
writeFileSync11(path, `${JSON.stringify(definition, null, 2)}
|
|
23583
23827
|
`, { flag: opts.replace ? "w" : "wx" });
|
|
@@ -23588,10 +23832,10 @@ function writeWorkflowFile(file, definition, opts = {}) {
|
|
|
23588
23832
|
return path;
|
|
23589
23833
|
}
|
|
23590
23834
|
function findBinding(file, auth) {
|
|
23591
|
-
const path =
|
|
23592
|
-
const folder = findFolderFile(
|
|
23835
|
+
const path = resolve20(file);
|
|
23836
|
+
const folder = findFolderFile(dirname7(path));
|
|
23593
23837
|
if (!folder) {
|
|
23594
|
-
refuseUntrusted(
|
|
23838
|
+
refuseUntrusted(join31(dirname7(path), FOLDER_FILE));
|
|
23595
23839
|
return { path };
|
|
23596
23840
|
}
|
|
23597
23841
|
if (folder.workspaceId && auth.workspaceId && folder.workspaceId !== auth.workspaceId) {
|
|
@@ -23603,7 +23847,7 @@ function findBinding(file, auth) {
|
|
|
23603
23847
|
hint: `Its workflow ids belong to workspace ${folder.workspaceId}: run the command with --workspace ${folder.workspaceId}, or from a folder of workspace ${auth.workspaceId}.`
|
|
23604
23848
|
});
|
|
23605
23849
|
}
|
|
23606
|
-
const key = relative3(
|
|
23850
|
+
const key = relative3(dirname7(folder.path), path).split(sep4).join("/");
|
|
23607
23851
|
return { path, folder, key, workflowId: folder.workflows[key] };
|
|
23608
23852
|
}
|
|
23609
23853
|
function keyBoundTo(folder, workflowId, exceptKey) {
|
|
@@ -23624,8 +23868,8 @@ function bindWorkflow(binding, workflowId, auth) {
|
|
|
23624
23868
|
}
|
|
23625
23869
|
const other = keyBoundTo(binding.folder, workflowId, binding.key);
|
|
23626
23870
|
if (other) throw alreadyBound(`Workflow ${workflowId} is bound to ${other} in ${where}.`);
|
|
23627
|
-
const key = binding.key ??
|
|
23628
|
-
const folder = binding.folder ? { ...binding.folder, workflows: { ...binding.folder.workflows, [key]: workflowId } } : { path:
|
|
23871
|
+
const key = binding.key ?? basename8(binding.path);
|
|
23872
|
+
const folder = binding.folder ? { ...binding.folder, workflows: { ...binding.folder.workflows, [key]: workflowId } } : { path: join31(dirname7(binding.path), FOLDER_FILE), ...auth.workspaceId ? { workspaceId: auth.workspaceId } : {}, workflows: { [key]: workflowId } };
|
|
23629
23873
|
writeFolderFile(folder);
|
|
23630
23874
|
return { path: binding.path, folder, key, workflowId };
|
|
23631
23875
|
}
|
|
@@ -23799,7 +24043,7 @@ function header(run) {
|
|
|
23799
24043
|
const record3 = run.recordType && run.recordType !== "none" ? `${run.recordType} ${run.recordId ?? "?"}` : "no record";
|
|
23800
24044
|
return `run ${run.id}: ${run.status ?? "unknown"}, workflow ${run.workflowId ?? "?"}, ${record3}, charged ${runCredits(run) ?? 0} credits`;
|
|
23801
24045
|
}
|
|
23802
|
-
var
|
|
24046
|
+
var command80, logs_default;
|
|
23803
24047
|
var init_logs2 = __esm({
|
|
23804
24048
|
"src/commands/workflow-runs/logs.ts"() {
|
|
23805
24049
|
"use strict";
|
|
@@ -23807,7 +24051,7 @@ var init_logs2 = __esm({
|
|
|
23807
24051
|
init_exit_codes();
|
|
23808
24052
|
init_files2();
|
|
23809
24053
|
init_run_wait();
|
|
23810
|
-
|
|
24054
|
+
command80 = {
|
|
23811
24055
|
resource: "workflow-runs",
|
|
23812
24056
|
action: "logs",
|
|
23813
24057
|
summary: "Print a workflow run's steps: status, attempt, time, credits and error",
|
|
@@ -23853,16 +24097,16 @@ var init_logs2 = __esm({
|
|
|
23853
24097
|
return ExitCode.Ok;
|
|
23854
24098
|
}
|
|
23855
24099
|
};
|
|
23856
|
-
logs_default =
|
|
24100
|
+
logs_default = command80;
|
|
23857
24101
|
}
|
|
23858
24102
|
});
|
|
23859
24103
|
|
|
23860
24104
|
// src/commands/workflow-runs/index.ts
|
|
23861
|
-
var
|
|
24105
|
+
var actions37;
|
|
23862
24106
|
var init_workflow_runs = __esm({
|
|
23863
24107
|
"src/commands/workflow-runs/index.ts"() {
|
|
23864
24108
|
"use strict";
|
|
23865
|
-
|
|
24109
|
+
actions37 = {
|
|
23866
24110
|
logs: () => Promise.resolve().then(() => (init_logs2(), logs_exports)).then((m) => m.default)
|
|
23867
24111
|
};
|
|
23868
24112
|
}
|
|
@@ -23874,8 +24118,8 @@ __export(init_exports, {
|
|
|
23874
24118
|
default: () => init_default
|
|
23875
24119
|
});
|
|
23876
24120
|
import { existsSync as existsSync13 } from "node:fs";
|
|
23877
|
-
import { join as
|
|
23878
|
-
var STEM,
|
|
24121
|
+
import { join as join32, resolve as resolve21 } from "node:path";
|
|
24122
|
+
var STEM, command81, init_default;
|
|
23879
24123
|
var init_init = __esm({
|
|
23880
24124
|
"src/commands/workflows/init.ts"() {
|
|
23881
24125
|
"use strict";
|
|
@@ -23885,7 +24129,7 @@ var init_init = __esm({
|
|
|
23885
24129
|
init_http();
|
|
23886
24130
|
init_files2();
|
|
23887
24131
|
STEM = /^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/;
|
|
23888
|
-
|
|
24132
|
+
command81 = {
|
|
23889
24133
|
resource: "workflows",
|
|
23890
24134
|
action: "init",
|
|
23891
24135
|
summary: "Start a workflow file in this folder",
|
|
@@ -23907,11 +24151,11 @@ var init_init = __esm({
|
|
|
23907
24151
|
if (!STEM.test(stem2)) {
|
|
23908
24152
|
throw usageError(`<name> must be a file name of letters, digits, '.', '-' and '_' (got "${typed ?? stem2}").`, { field: "name" });
|
|
23909
24153
|
}
|
|
23910
|
-
const dir3 =
|
|
23911
|
-
const path =
|
|
24154
|
+
const dir3 = resolve21(typeof args.flags.dir === "string" ? args.flags.dir : ".");
|
|
24155
|
+
const path = join32(dir3, `${stem2}${WORKFLOW_FILE_SUFFIX}`);
|
|
23912
24156
|
if (existsSync13(path)) throw fileExists(shownPath(path), "Pick another name, or edit the file you have.");
|
|
23913
24157
|
const found = findFolderFile(dir3);
|
|
23914
|
-
if (!found) refuseUntrusted(
|
|
24158
|
+
if (!found) refuseUntrusted(join32(dir3, FOLDER_FILE));
|
|
23915
24159
|
let definition;
|
|
23916
24160
|
if (template2) {
|
|
23917
24161
|
const res = await ctx.client.request({ method: "GET", path: `/v1/workflow-templates/${encodeURIComponent(template2)}`, signal: ctx.signal });
|
|
@@ -23926,7 +24170,7 @@ var init_init = __esm({
|
|
|
23926
24170
|
writeWorkflowFile(path, definition);
|
|
23927
24171
|
let folder = found;
|
|
23928
24172
|
if (!folder) {
|
|
23929
|
-
folder = { path:
|
|
24173
|
+
folder = { path: join32(dir3, FOLDER_FILE), ...ctx.auth.workspaceId ? { workspaceId: ctx.auth.workspaceId } : {}, workflows: {} };
|
|
23930
24174
|
writeFolderFile(folder);
|
|
23931
24175
|
if (!folder.workspaceId) ctx.output.warn(`No workspace is set, so ${shownPath(folder.path)} names none: add "workspaceId": "<id>" to it.`);
|
|
23932
24176
|
}
|
|
@@ -23942,7 +24186,7 @@ var init_init = __esm({
|
|
|
23942
24186
|
return ExitCode.Ok;
|
|
23943
24187
|
}
|
|
23944
24188
|
};
|
|
23945
|
-
init_default =
|
|
24189
|
+
init_default = command81;
|
|
23946
24190
|
}
|
|
23947
24191
|
});
|
|
23948
24192
|
|
|
@@ -23955,7 +24199,7 @@ import { existsSync as existsSync14 } from "node:fs";
|
|
|
23955
24199
|
function slugOf(name) {
|
|
23956
24200
|
return name.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60).replace(/-+$/, "");
|
|
23957
24201
|
}
|
|
23958
|
-
var
|
|
24202
|
+
var command82, pull_default3;
|
|
23959
24203
|
var init_pull3 = __esm({
|
|
23960
24204
|
"src/commands/workflows/pull.ts"() {
|
|
23961
24205
|
"use strict";
|
|
@@ -23963,7 +24207,7 @@ var init_pull3 = __esm({
|
|
|
23963
24207
|
init_exit_codes();
|
|
23964
24208
|
init_common4();
|
|
23965
24209
|
init_files2();
|
|
23966
|
-
|
|
24210
|
+
command82 = {
|
|
23967
24211
|
resource: "workflows",
|
|
23968
24212
|
action: "pull",
|
|
23969
24213
|
summary: "Write a workflow's definition to a file and bind it",
|
|
@@ -24022,7 +24266,7 @@ var init_pull3 = __esm({
|
|
|
24022
24266
|
return ExitCode.Ok;
|
|
24023
24267
|
}
|
|
24024
24268
|
};
|
|
24025
|
-
pull_default3 =
|
|
24269
|
+
pull_default3 = command82;
|
|
24026
24270
|
}
|
|
24027
24271
|
});
|
|
24028
24272
|
|
|
@@ -24055,7 +24299,7 @@ function perRecord(estimate2) {
|
|
|
24055
24299
|
const max = bulk ? totals.bulkMaxMillicredits : totals.maxMillicredits;
|
|
24056
24300
|
return typeof expected === "number" && typeof max === "number" ? { expectedCredits: expected / 1e3, maxCredits: max / 1e3 } : null;
|
|
24057
24301
|
}
|
|
24058
|
-
var FILE3,
|
|
24302
|
+
var FILE3, command83, check_default;
|
|
24059
24303
|
var init_check = __esm({
|
|
24060
24304
|
"src/commands/workflows/check.ts"() {
|
|
24061
24305
|
"use strict";
|
|
@@ -24066,7 +24310,7 @@ var init_check = __esm({
|
|
|
24066
24310
|
init_columns();
|
|
24067
24311
|
init_files2();
|
|
24068
24312
|
FILE3 = { name: "file", required: true, description: "The workflow file (<name>.workflow.json)" };
|
|
24069
|
-
|
|
24313
|
+
command83 = {
|
|
24070
24314
|
resource: "workflows",
|
|
24071
24315
|
action: "check",
|
|
24072
24316
|
summary: "Validate a workflow file on the server and print one record's credit estimate",
|
|
@@ -24107,7 +24351,7 @@ var init_check = __esm({
|
|
|
24107
24351
|
return valid ? ExitCode.Ok : ExitCode.Partial;
|
|
24108
24352
|
}
|
|
24109
24353
|
};
|
|
24110
|
-
check_default =
|
|
24354
|
+
check_default = command83;
|
|
24111
24355
|
}
|
|
24112
24356
|
});
|
|
24113
24357
|
|
|
@@ -24171,7 +24415,7 @@ function state(workflow, saved, published, extra = {}) {
|
|
|
24171
24415
|
...extra
|
|
24172
24416
|
};
|
|
24173
24417
|
}
|
|
24174
|
-
var
|
|
24418
|
+
var command84, push_default2;
|
|
24175
24419
|
var init_push2 = __esm({
|
|
24176
24420
|
"src/commands/workflows/push.ts"() {
|
|
24177
24421
|
"use strict";
|
|
@@ -24181,7 +24425,7 @@ var init_push2 = __esm({
|
|
|
24181
24425
|
init_columns();
|
|
24182
24426
|
init_check();
|
|
24183
24427
|
init_files2();
|
|
24184
|
-
|
|
24428
|
+
command84 = {
|
|
24185
24429
|
resource: "workflows",
|
|
24186
24430
|
action: "push",
|
|
24187
24431
|
summary: "Save a workflow file as the workflow's draft, and publish it with --publish",
|
|
@@ -24285,7 +24529,7 @@ var init_push2 = __esm({
|
|
|
24285
24529
|
return ExitCode.Ok;
|
|
24286
24530
|
}
|
|
24287
24531
|
};
|
|
24288
|
-
push_default2 =
|
|
24532
|
+
push_default2 = command84;
|
|
24289
24533
|
}
|
|
24290
24534
|
});
|
|
24291
24535
|
|
|
@@ -24318,7 +24562,7 @@ async function startTest(ctx, workflowId, body2) {
|
|
|
24318
24562
|
});
|
|
24319
24563
|
}
|
|
24320
24564
|
}
|
|
24321
|
-
var RECORD_TYPES2, MAX_WAIT_SECONDS,
|
|
24565
|
+
var RECORD_TYPES2, MAX_WAIT_SECONDS, command85, test_default;
|
|
24322
24566
|
var init_test = __esm({
|
|
24323
24567
|
"src/commands/workflows/test.ts"() {
|
|
24324
24568
|
"use strict";
|
|
@@ -24330,7 +24574,7 @@ var init_test = __esm({
|
|
|
24330
24574
|
init_files2();
|
|
24331
24575
|
RECORD_TYPES2 = ["account", "person", "lead", "place"];
|
|
24332
24576
|
MAX_WAIT_SECONDS = 50;
|
|
24333
|
-
|
|
24577
|
+
command85 = {
|
|
24334
24578
|
resource: "workflows",
|
|
24335
24579
|
action: "test",
|
|
24336
24580
|
summary: "Run the saved draft of a workflow file on one record and print the hash to publish with",
|
|
@@ -24386,7 +24630,7 @@ var init_test = __esm({
|
|
|
24386
24630
|
return passed ? ExitCode.Ok : ExitCode.Error;
|
|
24387
24631
|
}
|
|
24388
24632
|
};
|
|
24389
|
-
test_default =
|
|
24633
|
+
test_default = command85;
|
|
24390
24634
|
}
|
|
24391
24635
|
});
|
|
24392
24636
|
|
|
@@ -24420,7 +24664,7 @@ function diffDefinitions(from, to) {
|
|
|
24420
24664
|
stepsChanged: [...after.keys()].filter((id) => before.has(id) && differs(before.get(id), after.get(id)))
|
|
24421
24665
|
};
|
|
24422
24666
|
}
|
|
24423
|
-
var
|
|
24667
|
+
var command86, diff_default;
|
|
24424
24668
|
var init_diff = __esm({
|
|
24425
24669
|
"src/commands/workflows/diff.ts"() {
|
|
24426
24670
|
"use strict";
|
|
@@ -24429,7 +24673,7 @@ var init_diff = __esm({
|
|
|
24429
24673
|
init_columns();
|
|
24430
24674
|
init_check();
|
|
24431
24675
|
init_files2();
|
|
24432
|
-
|
|
24676
|
+
command86 = {
|
|
24433
24677
|
resource: "workflows",
|
|
24434
24678
|
action: "diff",
|
|
24435
24679
|
summary: "Compare a workflow file with the published version or the draft",
|
|
@@ -24457,7 +24701,7 @@ var init_diff = __esm({
|
|
|
24457
24701
|
return ExitCode.Ok;
|
|
24458
24702
|
}
|
|
24459
24703
|
};
|
|
24460
|
-
diff_default =
|
|
24704
|
+
diff_default = command86;
|
|
24461
24705
|
}
|
|
24462
24706
|
});
|
|
24463
24707
|
|
|
@@ -24541,7 +24785,7 @@ function workflowFileSchema(stepTypes) {
|
|
|
24541
24785
|
}
|
|
24542
24786
|
};
|
|
24543
24787
|
}
|
|
24544
|
-
var SCHEMA_ID, STEP_ID, MORE_THAN_ZERO,
|
|
24788
|
+
var SCHEMA_ID, STEP_ID, MORE_THAN_ZERO, command87, schema_default;
|
|
24545
24789
|
var init_schema = __esm({
|
|
24546
24790
|
"src/commands/workflows/schema.ts"() {
|
|
24547
24791
|
"use strict";
|
|
@@ -24552,7 +24796,7 @@ var init_schema = __esm({
|
|
|
24552
24796
|
SCHEMA_ID = "https://ken.so/schemas/workflow-file.json";
|
|
24553
24797
|
STEP_ID = "^[a-z][a-z0-9_]{0,39}$";
|
|
24554
24798
|
MORE_THAN_ZERO = { type: "number", exclusiveMinimum: 0 };
|
|
24555
|
-
|
|
24799
|
+
command87 = {
|
|
24556
24800
|
resource: "workflows",
|
|
24557
24801
|
action: "schema",
|
|
24558
24802
|
summary: "Print a JSON Schema for workflow files, for editors",
|
|
@@ -24578,7 +24822,7 @@ var init_schema = __esm({
|
|
|
24578
24822
|
return ExitCode.Ok;
|
|
24579
24823
|
}
|
|
24580
24824
|
};
|
|
24581
|
-
schema_default =
|
|
24825
|
+
schema_default = command87;
|
|
24582
24826
|
}
|
|
24583
24827
|
});
|
|
24584
24828
|
|
|
@@ -24639,7 +24883,7 @@ var init_run_cap = __esm({
|
|
|
24639
24883
|
|
|
24640
24884
|
// src/commands/workflows/run-input.ts
|
|
24641
24885
|
import { createHash as createHash12 } from "node:crypto";
|
|
24642
|
-
import { resolve as
|
|
24886
|
+
import { resolve as resolve22 } from "node:path";
|
|
24643
24887
|
import { Readable as Readable2 } from "node:stream";
|
|
24644
24888
|
function validId(id, type) {
|
|
24645
24889
|
return type === "place" ? /^plc_[A-Za-z0-9_-]+$/.test(id) : /^[1-9]\d*$/.test(id);
|
|
@@ -24671,7 +24915,7 @@ async function readRunInput(ctx, opts) {
|
|
|
24671
24915
|
return { input: { path: "-", sha256: createHash12("sha256").update(text5).digest("hex") }, ...fromIds(ctx, ids2, type) };
|
|
24672
24916
|
}
|
|
24673
24917
|
if (opts.ids !== void 0) {
|
|
24674
|
-
return { input: { path:
|
|
24918
|
+
return { input: { path: resolve22(opts.ids), sha256: await fileSha256(opts.ids) }, ...fromIds(ctx, await readIds(opts.ids), type) };
|
|
24675
24919
|
}
|
|
24676
24920
|
const name = opts.file ?? "";
|
|
24677
24921
|
const file = await readInput(name, { stdin: ctx.stdin });
|
|
@@ -24752,7 +24996,7 @@ var init_run_input = __esm({
|
|
|
24752
24996
|
// src/commands/workflows/run-start.ts
|
|
24753
24997
|
import { readFileSync as readFileSync22 } from "node:fs";
|
|
24754
24998
|
import { unlink as unlink4 } from "node:fs/promises";
|
|
24755
|
-
import { dirname as
|
|
24999
|
+
import { dirname as dirname8, join as join33, relative as relative4, resolve as resolve23, sep as sep5 } from "node:path";
|
|
24756
25000
|
function readJournal(file) {
|
|
24757
25001
|
try {
|
|
24758
25002
|
return JSON.parse(readFileSync22(file, "utf8"));
|
|
@@ -24786,21 +25030,21 @@ function runIdentity(args, anyCap = false) {
|
|
|
24786
25030
|
}
|
|
24787
25031
|
function boundId(path) {
|
|
24788
25032
|
try {
|
|
24789
|
-
const folder = findFolderFile(
|
|
24790
|
-
return folder?.workflows[relative4(
|
|
25033
|
+
const folder = findFolderFile(dirname8(path));
|
|
25034
|
+
return folder?.workflows[relative4(dirname8(folder.path), path).split(sep5).join("/")];
|
|
24791
25035
|
} catch {
|
|
24792
25036
|
return void 0;
|
|
24793
25037
|
}
|
|
24794
25038
|
}
|
|
24795
25039
|
function argsOf(run, current) {
|
|
24796
25040
|
const target2 = Array.isArray(run.args.positionals) ? run.args.positionals[0] : void 0;
|
|
24797
|
-
const id = typeof target2 === "string" && !/^[1-9]\d*$/.test(target2) ? boundId(
|
|
25041
|
+
const id = typeof target2 === "string" && !/^[1-9]\d*$/.test(target2) ? boundId(resolve23(run.cwd ?? process.cwd(), target2)) : void 0;
|
|
24798
25042
|
return { ...run.args, "record-type": run.args["record-type"] ?? current["record-type"], ...id !== void 0 ? { positionals: [String(id)] } : {} };
|
|
24799
25043
|
}
|
|
24800
25044
|
async function runsOnInput(ctx, sha2566) {
|
|
24801
25045
|
const workspaceId = ctx.client.workspaceId ?? ctx.auth.workspaceId;
|
|
24802
25046
|
return (await listRuns(ctx.env)).filter(
|
|
24803
|
-
(run) => run.command ===
|
|
25047
|
+
(run) => run.command === COMMAND8 && run.status !== "planned" && run.inputSha256 === sha2566 && (run.workspaceId || void 0) === (workspaceId || void 0)
|
|
24804
25048
|
);
|
|
24805
25049
|
}
|
|
24806
25050
|
async function earlierRun(ctx, args, sha2566, workflowId) {
|
|
@@ -24823,7 +25067,7 @@ async function refuseRestart(ctx, run) {
|
|
|
24823
25067
|
for (const [row, { status }] of await readResults(filesOf(earlier.dir).resultsNdjson)) if (!["not_started", "invalid"].includes(status)) sent.add(row);
|
|
24824
25068
|
if (sent.size === 0) continue;
|
|
24825
25069
|
const rest = run.items.filter((item) => !sent.has(item.row));
|
|
24826
|
-
const file =
|
|
25070
|
+
const file = join33(earlier.dir, "not-started.txt");
|
|
24827
25071
|
if (rest.length > 0) await writeFileAtomic(file, rest.map((item) => `${item.id}
|
|
24828
25072
|
`).join(""));
|
|
24829
25073
|
throw new KensoError({
|
|
@@ -24886,7 +25130,7 @@ async function startChunk(chunk, cc, run) {
|
|
|
24886
25130
|
});
|
|
24887
25131
|
return { results: [...results, ...held], rateLimitRemaining: remaining };
|
|
24888
25132
|
}
|
|
24889
|
-
var
|
|
25133
|
+
var COMMAND8, journalFile, notStarted;
|
|
24890
25134
|
var init_run_start = __esm({
|
|
24891
25135
|
"src/commands/workflows/run-start.ts"() {
|
|
24892
25136
|
"use strict";
|
|
@@ -24897,8 +25141,8 @@ var init_run_start = __esm({
|
|
|
24897
25141
|
init_folder();
|
|
24898
25142
|
init_http();
|
|
24899
25143
|
init_columns();
|
|
24900
|
-
|
|
24901
|
-
journalFile = (dir3, index2) =>
|
|
25144
|
+
COMMAND8 = "workflows run";
|
|
25145
|
+
journalFile = (dir3, index2) => join33(dir3, `chunk-${index2}.json`);
|
|
24902
25146
|
notStarted = (items, reason) => items.map((item) => ({ row: item.row, ...item.id ? { id: item.id } : {}, status: "not_started", reason }));
|
|
24903
25147
|
}
|
|
24904
25148
|
});
|
|
@@ -24907,7 +25151,7 @@ var init_run_start = __esm({
|
|
|
24907
25151
|
import { createHash as createHash13 } from "node:crypto";
|
|
24908
25152
|
import { existsSync as existsSync16, readFileSync as readFileSync23 } from "node:fs";
|
|
24909
25153
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
24910
|
-
import { dirname as
|
|
25154
|
+
import { dirname as dirname9, join as join34, resolve as resolve24 } from "node:path";
|
|
24911
25155
|
function startKeys(results, workflowId) {
|
|
24912
25156
|
const count = (...statuses) => results.filter((result) => statuses.includes(result.status)).length;
|
|
24913
25157
|
return {
|
|
@@ -24934,9 +25178,9 @@ async function isOwnResultsFile(path, env) {
|
|
|
24934
25178
|
return false;
|
|
24935
25179
|
}
|
|
24936
25180
|
for (const record3 of await listRuns(env)) {
|
|
24937
|
-
if (record3.command !==
|
|
25181
|
+
if (record3.command !== COMMAND8) continue;
|
|
24938
25182
|
try {
|
|
24939
|
-
const marker = JSON.parse(await readFile13(
|
|
25183
|
+
const marker = JSON.parse(await readFile13(join34(record3.dir, OUT_MARKER), "utf8"));
|
|
24940
25184
|
if (marker.path === path && marker.sha256 === hash) return true;
|
|
24941
25185
|
} catch {
|
|
24942
25186
|
}
|
|
@@ -24956,8 +25200,8 @@ async function readResultFlags(ctx, flags) {
|
|
|
24956
25200
|
if (timeoutMs2 === void 0) {
|
|
24957
25201
|
throw usageError(`--timeout "${timeoutText}" is not a duration.`, { field: "timeout", hint: "Use 90s, 10m, 1h or a number of seconds." });
|
|
24958
25202
|
}
|
|
24959
|
-
const out = outText === void 0 ? void 0 :
|
|
24960
|
-
if (out !== void 0 && !existsSync16(
|
|
25203
|
+
const out = outText === void 0 ? void 0 : resolve24(outText);
|
|
25204
|
+
if (out !== void 0 && !existsSync16(dirname9(out))) throw usageError(`--out: the folder ${dirname9(out)} does not exist.`, { field: "out" });
|
|
24961
25205
|
if (out !== void 0 && existsSync16(out) && !await isOwnResultsFile(out, ctx.env)) {
|
|
24962
25206
|
throw new KensoError({
|
|
24963
25207
|
code: "file_exists",
|
|
@@ -25026,7 +25270,7 @@ function outCsv(rows) {
|
|
|
25026
25270
|
const stepIds = [];
|
|
25027
25271
|
for (const row of rows) for (const id of Object.keys(row.steps)) if (!stepIds.includes(id)) stepIds.push(id);
|
|
25028
25272
|
const json = (value) => value === void 0 || value === null ? "" : JSON.stringify(value);
|
|
25029
|
-
const lines = rows.map((row) => [...RESULT_COLUMNS2.map((
|
|
25273
|
+
const lines = rows.map((row) => [...RESULT_COLUMNS2.map((column2) => String(row[column2] ?? "")), ...stepIds.map((id) => json(row.steps[id]))]);
|
|
25030
25274
|
return stringify([[...RESULT_COLUMNS2, ...stepIds], ...lines]);
|
|
25031
25275
|
}
|
|
25032
25276
|
function isDataStepCheck() {
|
|
@@ -25079,7 +25323,7 @@ async function finishRun(ctx, input) {
|
|
|
25079
25323
|
if (flags.out) {
|
|
25080
25324
|
const text5 = outCsv(table2);
|
|
25081
25325
|
await writeFileAtomic(flags.out, text5);
|
|
25082
|
-
await writeJsonAtomic(
|
|
25326
|
+
await writeJsonAtomic(join34(outcome.dir, OUT_MARKER), { path: flags.out, sha256: sha2565(text5) });
|
|
25083
25327
|
summary.resultsCsv = flags.out;
|
|
25084
25328
|
}
|
|
25085
25329
|
const counts2 = waitedCounts(table2);
|
|
@@ -25092,7 +25336,7 @@ async function finishRun(ctx, input) {
|
|
|
25092
25336
|
if (!engineStopped && firstFailed?.runId !== void 0) summary.next = `kenso workflow-runs logs ${firstFailed.runId}`;
|
|
25093
25337
|
waitedLine = `; ${counts2.succeeded} succeeded, ${counts2.waiting} waiting, ${String(counts2.creditsCharged)} credits charged`;
|
|
25094
25338
|
}
|
|
25095
|
-
await writeJsonAtomic(
|
|
25339
|
+
await writeJsonAtomic(join34(outcome.dir, "summary.json"), summary);
|
|
25096
25340
|
ctx.output.summary(input.alreadyDone ? { ...summary, alreadyDone: true } : summary);
|
|
25097
25341
|
const n = (key) => Number(summary[key] ?? 0);
|
|
25098
25342
|
ctx.output.info(
|
|
@@ -25158,7 +25402,7 @@ var run_exports5 = {};
|
|
|
25158
25402
|
__export(run_exports5, {
|
|
25159
25403
|
default: () => run_default4
|
|
25160
25404
|
});
|
|
25161
|
-
import { join as
|
|
25405
|
+
import { join as join35 } from "node:path";
|
|
25162
25406
|
async function resolveTarget(ctx, target2) {
|
|
25163
25407
|
const isId = /^[1-9]\d*$/.test(target2);
|
|
25164
25408
|
const file = isId ? void 0 : readWorkflowFile(target2).definition;
|
|
@@ -25234,7 +25478,7 @@ function appUrl(workflowId, workspaceId) {
|
|
|
25234
25478
|
function summarize4(workflowId, records, cap, url) {
|
|
25235
25479
|
return (results) => ({ workflowId, records, ...startKeys(results, workflowId), cap: cap(), appUrl: url });
|
|
25236
25480
|
}
|
|
25237
|
-
var NAME2, CHUNK_SIZE7, APP_URL, LIST_HINT,
|
|
25481
|
+
var NAME2, CHUNK_SIZE7, APP_URL, LIST_HINT, command88, run_default4;
|
|
25238
25482
|
var init_run5 = __esm({
|
|
25239
25483
|
"src/commands/workflows/run.ts"() {
|
|
25240
25484
|
"use strict";
|
|
@@ -25252,11 +25496,11 @@ var init_run5 = __esm({
|
|
|
25252
25496
|
init_run_input();
|
|
25253
25497
|
init_run_results();
|
|
25254
25498
|
init_run_start();
|
|
25255
|
-
NAME2 = `kenso ${
|
|
25499
|
+
NAME2 = `kenso ${COMMAND8}`;
|
|
25256
25500
|
CHUNK_SIZE7 = 1e3;
|
|
25257
25501
|
APP_URL = "https://app.ken.so";
|
|
25258
25502
|
LIST_HINT = "A saved list runs through a workflow whose trigger is trigger.saved_list@1 or trigger.csv@1; kenso workflows run takes --ids or --file.";
|
|
25259
|
-
|
|
25503
|
+
command88 = {
|
|
25260
25504
|
resource: "workflows",
|
|
25261
25505
|
action: "run",
|
|
25262
25506
|
summary: "Run a published workflow on records from an ids file or a CSV",
|
|
@@ -25330,12 +25574,12 @@ var init_run5 = __esm({
|
|
|
25330
25574
|
const check = creditsCheck(totals?.max, available);
|
|
25331
25575
|
const hard = hardCeiling(target2.definition);
|
|
25332
25576
|
const ceiling = hard ?? (totals && basis > 0 ? totals.max / basis / 1e3 : void 0);
|
|
25333
|
-
const retry = (cap2) => commandLine2(ctx,
|
|
25577
|
+
const retry = (cap2) => commandLine2(ctx, COMMAND8, { flags: { ...flags, "max-credits": String(cap2) }, positionals });
|
|
25334
25578
|
const capFor = (count) => maxCredits !== void 0 && ceiling !== void 0 ? planCap(maxCredits, count, hard !== void 0 ? "hard" : "estimate", ceiling, retry) : null;
|
|
25335
25579
|
let cap = capFor(input.records.length);
|
|
25336
25580
|
const { timeout: _timeout, out: _out, ...identity } = flags;
|
|
25337
25581
|
const args = { ...identity, "record-type": type, positionals: [String(workflowId)] };
|
|
25338
|
-
const applyCommand = commandLine2(ctx,
|
|
25582
|
+
const applyCommand = commandLine2(ctx, COMMAND8, { flags, positionals }, ["--yes"]);
|
|
25339
25583
|
const plan2 = {
|
|
25340
25584
|
workflowId,
|
|
25341
25585
|
records: rows,
|
|
@@ -25349,14 +25593,14 @@ var init_run5 = __esm({
|
|
|
25349
25593
|
};
|
|
25350
25594
|
let start = /* @__PURE__ */ new Set();
|
|
25351
25595
|
const spec = (dryRun2, records2, invalid3) => ({
|
|
25352
|
-
command:
|
|
25596
|
+
command: COMMAND8,
|
|
25353
25597
|
args,
|
|
25354
25598
|
input: input.input,
|
|
25355
25599
|
items: records2.map((record3) => ({ row: record3.row, type, ...record3.id !== void 0 ? { id: record3.id } : {} })),
|
|
25356
25600
|
rowOf: (item) => item.row,
|
|
25357
25601
|
chunkSize: CHUNK_SIZE7,
|
|
25358
25602
|
concurrency: 1,
|
|
25359
|
-
execChunk: (chunk, cc) => startChunk(chunk, cc, { dirOf: (runId) =>
|
|
25603
|
+
execChunk: (chunk, cc) => startChunk(chunk, cc, { dirOf: (runId) => join35(runsRoot(ctx.env), runId), workflowId, start }),
|
|
25360
25604
|
invalid: invalid3,
|
|
25361
25605
|
dryRun: dryRun2,
|
|
25362
25606
|
dryRunExtra: plan2,
|
|
@@ -25383,14 +25627,14 @@ var init_run5 = __esm({
|
|
|
25383
25627
|
}
|
|
25384
25628
|
start = new Set(records.slice(0, cap ? cap.willStart : records.length).map((record3) => record3.row));
|
|
25385
25629
|
const applied = spec(false, records, invalid2);
|
|
25386
|
-
const rerun = (ids3) => commandLine2(ctx,
|
|
25630
|
+
const rerun = (ids3) => commandLine2(ctx, COMMAND8, { flags: { ...flags, ids: ids3, file: void 0 }, positionals }, ["--yes"]);
|
|
25387
25631
|
await refuseRestart(ctx, { args, sha256: input.input.sha256, workflowId, items: applied.items, rerun });
|
|
25388
25632
|
const hold = holdSummary(ctx);
|
|
25389
25633
|
const outcome = await runBatch(applied, hold.ctx);
|
|
25390
25634
|
return finishRun(ctx, { outcome, engineSummary: hold.held(), workflowId, flags: results });
|
|
25391
25635
|
}
|
|
25392
25636
|
};
|
|
25393
|
-
run_default4 =
|
|
25637
|
+
run_default4 = command88;
|
|
25394
25638
|
}
|
|
25395
25639
|
});
|
|
25396
25640
|
|
|
@@ -25406,13 +25650,13 @@ var init_run_actions = __esm({
|
|
|
25406
25650
|
});
|
|
25407
25651
|
|
|
25408
25652
|
// src/commands/workflows/index.ts
|
|
25409
|
-
var
|
|
25653
|
+
var actions38;
|
|
25410
25654
|
var init_workflows2 = __esm({
|
|
25411
25655
|
"src/commands/workflows/index.ts"() {
|
|
25412
25656
|
"use strict";
|
|
25413
25657
|
init_file_actions();
|
|
25414
25658
|
init_run_actions();
|
|
25415
|
-
|
|
25659
|
+
actions38 = { ...fileActions, ...runActions };
|
|
25416
25660
|
}
|
|
25417
25661
|
});
|
|
25418
25662
|
|
|
@@ -25437,7 +25681,7 @@ function rewrap(err, overrides2) {
|
|
|
25437
25681
|
details: err.details
|
|
25438
25682
|
});
|
|
25439
25683
|
}
|
|
25440
|
-
var TEMPLATES, APP_NEXT_STEP, NOT_AVAILABLE,
|
|
25684
|
+
var TEMPLATES, APP_NEXT_STEP, NOT_AVAILABLE, command89, keys_default;
|
|
25441
25685
|
var init_keys = __esm({
|
|
25442
25686
|
"src/commands/workspace/keys.ts"() {
|
|
25443
25687
|
"use strict";
|
|
@@ -25447,7 +25691,7 @@ var init_keys = __esm({
|
|
|
25447
25691
|
TEMPLATES = ["admin", "editor", "viewer"];
|
|
25448
25692
|
APP_NEXT_STEP = "A workspace admin can create it in the app: Settings > API keys > Workspace keys";
|
|
25449
25693
|
NOT_AVAILABLE = "Workspace keys are not available for this workspace yet.";
|
|
25450
|
-
|
|
25694
|
+
command89 = {
|
|
25451
25695
|
resource: "workspace",
|
|
25452
25696
|
action: "keys",
|
|
25453
25697
|
summary: "Create an API key the workspace owns",
|
|
@@ -25509,7 +25753,7 @@ var init_keys = __esm({
|
|
|
25509
25753
|
return ExitCode.Ok;
|
|
25510
25754
|
}
|
|
25511
25755
|
};
|
|
25512
|
-
keys_default =
|
|
25756
|
+
keys_default = command89;
|
|
25513
25757
|
}
|
|
25514
25758
|
});
|
|
25515
25759
|
|
|
@@ -25527,14 +25771,14 @@ function parseLimit2(value) {
|
|
|
25527
25771
|
}
|
|
25528
25772
|
return limit;
|
|
25529
25773
|
}
|
|
25530
|
-
var MAX_LIMIT2,
|
|
25774
|
+
var MAX_LIMIT2, command90, list_default5;
|
|
25531
25775
|
var init_list5 = __esm({
|
|
25532
25776
|
"src/commands/workspace/list.ts"() {
|
|
25533
25777
|
"use strict";
|
|
25534
25778
|
init_errors();
|
|
25535
25779
|
init_exit_codes();
|
|
25536
25780
|
MAX_LIMIT2 = 200;
|
|
25537
|
-
|
|
25781
|
+
command90 = {
|
|
25538
25782
|
resource: "workspace",
|
|
25539
25783
|
action: "list",
|
|
25540
25784
|
summary: "List the workspaces your key can use",
|
|
@@ -25563,7 +25807,7 @@ var init_list5 = __esm({
|
|
|
25563
25807
|
return ExitCode.Ok;
|
|
25564
25808
|
}
|
|
25565
25809
|
};
|
|
25566
|
-
list_default5 =
|
|
25810
|
+
list_default5 = command90;
|
|
25567
25811
|
}
|
|
25568
25812
|
});
|
|
25569
25813
|
|
|
@@ -25572,7 +25816,7 @@ var use_exports = {};
|
|
|
25572
25816
|
__export(use_exports, {
|
|
25573
25817
|
default: () => use_default
|
|
25574
25818
|
});
|
|
25575
|
-
var
|
|
25819
|
+
var command91, use_default;
|
|
25576
25820
|
var init_use = __esm({
|
|
25577
25821
|
"src/commands/workspace/use.ts"() {
|
|
25578
25822
|
"use strict";
|
|
@@ -25580,7 +25824,7 @@ var init_use = __esm({
|
|
|
25580
25824
|
init_errors();
|
|
25581
25825
|
init_exit_codes();
|
|
25582
25826
|
init_http();
|
|
25583
|
-
|
|
25827
|
+
command91 = {
|
|
25584
25828
|
resource: "workspace",
|
|
25585
25829
|
action: "use",
|
|
25586
25830
|
summary: "Set the profile's default workspace",
|
|
@@ -25642,16 +25886,16 @@ var init_use = __esm({
|
|
|
25642
25886
|
return ExitCode.Ok;
|
|
25643
25887
|
}
|
|
25644
25888
|
};
|
|
25645
|
-
use_default =
|
|
25889
|
+
use_default = command91;
|
|
25646
25890
|
}
|
|
25647
25891
|
});
|
|
25648
25892
|
|
|
25649
25893
|
// src/commands/workspace/index.ts
|
|
25650
|
-
var
|
|
25894
|
+
var actions39;
|
|
25651
25895
|
var init_workspace = __esm({
|
|
25652
25896
|
"src/commands/workspace/index.ts"() {
|
|
25653
25897
|
"use strict";
|
|
25654
|
-
|
|
25898
|
+
actions39 = {
|
|
25655
25899
|
keys: () => Promise.resolve().then(() => (init_keys(), keys_exports)).then((m) => m.default),
|
|
25656
25900
|
list: () => Promise.resolve().then(() => (init_list5(), list_exports5)).then((m) => m.default),
|
|
25657
25901
|
use: () => Promise.resolve().then(() => (init_use(), use_exports)).then((m) => m.default)
|
|
@@ -25702,6 +25946,7 @@ var init_registry = __esm({
|
|
|
25702
25946
|
init_docs2();
|
|
25703
25947
|
init_doctor();
|
|
25704
25948
|
init_export3();
|
|
25949
|
+
init_images2();
|
|
25705
25950
|
init_import4();
|
|
25706
25951
|
init_jobs2();
|
|
25707
25952
|
init_layouts2();
|
|
@@ -25741,32 +25986,33 @@ var init_registry = __esm({
|
|
|
25741
25986
|
docs: actions13,
|
|
25742
25987
|
doctor: actions14,
|
|
25743
25988
|
export: actions15,
|
|
25744
|
-
|
|
25745
|
-
|
|
25746
|
-
|
|
25989
|
+
images: actions16,
|
|
25990
|
+
import: actions17,
|
|
25991
|
+
jobs: actions18,
|
|
25992
|
+
layouts: actions19,
|
|
25747
25993
|
login: topLevel("login", actions4.login, "kenso auth login"),
|
|
25748
25994
|
logout: topLevel("logout", actions4.logout, "kenso auth logout"),
|
|
25749
|
-
logs:
|
|
25750
|
-
mcp:
|
|
25751
|
-
notes:
|
|
25752
|
-
opportunities:
|
|
25753
|
-
people:
|
|
25754
|
-
pipelines:
|
|
25755
|
-
reports:
|
|
25756
|
-
runs:
|
|
25757
|
-
sandbox:
|
|
25758
|
-
signals:
|
|
25759
|
-
simulations:
|
|
25760
|
-
skill:
|
|
25761
|
-
studio:
|
|
25762
|
-
tasks:
|
|
25763
|
-
views:
|
|
25764
|
-
webhooks:
|
|
25995
|
+
logs: actions20,
|
|
25996
|
+
mcp: actions21,
|
|
25997
|
+
notes: actions22,
|
|
25998
|
+
opportunities: actions23,
|
|
25999
|
+
people: actions24,
|
|
26000
|
+
pipelines: actions25,
|
|
26001
|
+
reports: actions26,
|
|
26002
|
+
runs: actions27,
|
|
26003
|
+
sandbox: actions28,
|
|
26004
|
+
signals: actions29,
|
|
26005
|
+
simulations: actions30,
|
|
26006
|
+
skill: actions31,
|
|
26007
|
+
studio: actions32,
|
|
26008
|
+
tasks: actions33,
|
|
26009
|
+
views: actions34,
|
|
26010
|
+
webhooks: actions35,
|
|
25765
26011
|
whoami: topLevel("whoami", actions4.status, "kenso auth status"),
|
|
25766
|
-
work:
|
|
25767
|
-
"workflow-runs":
|
|
25768
|
-
workflows:
|
|
25769
|
-
workspace:
|
|
26012
|
+
work: actions36,
|
|
26013
|
+
"workflow-runs": actions37,
|
|
26014
|
+
workflows: actions38,
|
|
26015
|
+
workspace: actions39
|
|
25770
26016
|
};
|
|
25771
26017
|
resourceAliases = { leads: "contacts" };
|
|
25772
26018
|
}
|
|
@@ -25896,8 +26142,8 @@ async function renderTopHelp(opts) {
|
|
|
25896
26142
|
names.push(withPositionals(spec, spec.action));
|
|
25897
26143
|
groups.set(hint, names);
|
|
25898
26144
|
}
|
|
25899
|
-
const
|
|
25900
|
-
if (
|
|
26145
|
+
const actions41 = [...groups.entries()].map(([hint, names]) => `${names.join(", ")}${hint}`);
|
|
26146
|
+
if (actions41.length > 0) rows.push([resource, actions41.join(", ")]);
|
|
25901
26147
|
}
|
|
25902
26148
|
const at = 4 + Math.min(22, Math.max(0, ...rows.map(([left]) => left.length)));
|
|
25903
26149
|
lines.push(
|
|
@@ -25910,7 +26156,7 @@ async function renderTopHelp(opts) {
|
|
|
25910
26156
|
const [area = "", action = ""] = name.split(" ");
|
|
25911
26157
|
byArea.set(area, [...byArea.get(area) ?? [], action]);
|
|
25912
26158
|
}
|
|
25913
|
-
const named = [...byArea.entries()].map(([area,
|
|
26159
|
+
const named = [...byArea.entries()].map(([area, actions41]) => `${area} ${actions41.join("|")}`);
|
|
25914
26160
|
lines.push(wrap(`Beta, hidden here but they run (the server decides): ${named.join(", ")}.`, " "));
|
|
25915
26161
|
}
|
|
25916
26162
|
const generated = await listGenerated({ features: opts.allCommands ? [] : getFeatures, env: opts.env });
|
|
@@ -25918,13 +26164,13 @@ async function renderTopHelp(opts) {
|
|
|
25918
26164
|
if (visible.length > 0) {
|
|
25919
26165
|
const byResource = /* @__PURE__ */ new Map();
|
|
25920
26166
|
for (const g of visible) {
|
|
25921
|
-
const
|
|
25922
|
-
|
|
25923
|
-
byResource.set(g.resource,
|
|
26167
|
+
const actions41 = byResource.get(g.resource) ?? [];
|
|
26168
|
+
actions41.push(`${g.action}${g.beta ? " (beta)" : ""}`);
|
|
26169
|
+
byResource.set(g.resource, actions41);
|
|
25924
26170
|
}
|
|
25925
26171
|
const sorted2 = [...byResource.entries()].sort(([a], [b]) => a.localeCompare(b));
|
|
25926
26172
|
if (opts.allCommands) {
|
|
25927
|
-
const generatedRows = sorted2.map(([resource,
|
|
26173
|
+
const generatedRows = sorted2.map(([resource, actions41]) => [resource, actions41.sort().join(", ")]);
|
|
25928
26174
|
lines.push("", "API resources (kenso <resource> <action>):", columns(generatedRows));
|
|
25929
26175
|
} else {
|
|
25930
26176
|
const names = new Set(sorted2.map(([resource]) => resource));
|
|
@@ -26264,13 +26510,13 @@ var init_pre_run = __esm({
|
|
|
26264
26510
|
|
|
26265
26511
|
// src/core/update-notice.ts
|
|
26266
26512
|
import { mkdirSync as mkdirSync8, readFileSync as readFileSync24, realpathSync as realpathSync2, renameSync as renameSync8, writeFileSync as writeFileSync13 } from "node:fs";
|
|
26267
|
-
import { dirname as
|
|
26513
|
+
import { dirname as dirname10, join as join36, sep as sep6 } from "node:path";
|
|
26268
26514
|
function installKind(script = process.argv[1], execPath = process.execPath, platform = process.platform) {
|
|
26269
26515
|
try {
|
|
26270
26516
|
if (!script) return "npm";
|
|
26271
26517
|
const bundle = realpathSync2(script);
|
|
26272
|
-
const lib =
|
|
26273
|
-
if (execPath !==
|
|
26518
|
+
const lib = dirname10(dirname10(dirname10(bundle)));
|
|
26519
|
+
if (execPath !== join36(lib, platform === "win32" ? "node.exe" : "node")) return "npm";
|
|
26274
26520
|
return bundle.includes(`${sep6}Cellar${sep6}kenso${sep6}`) ? "homebrew" : "standalone";
|
|
26275
26521
|
} catch {
|
|
26276
26522
|
return "npm";
|
|
@@ -26292,7 +26538,7 @@ function readCheck(file) {
|
|
|
26292
26538
|
}
|
|
26293
26539
|
function writeCheck(file, check) {
|
|
26294
26540
|
try {
|
|
26295
|
-
mkdirSync8(
|
|
26541
|
+
mkdirSync8(dirname10(file), { recursive: true, mode: 448 });
|
|
26296
26542
|
const temp = `${file}.${process.pid}.tmp`;
|
|
26297
26543
|
writeFileSync13(temp, `${JSON.stringify(check)}
|
|
26298
26544
|
`, { mode: 384 });
|
|
@@ -26324,13 +26570,13 @@ async function fetchLatest(fetchImpl, signal, install) {
|
|
|
26324
26570
|
return typeof body2?.version === "string" && RELEASE.test(body2.version) ? body2.version : void 0;
|
|
26325
26571
|
}
|
|
26326
26572
|
function agentNotice(env, agent, version, stderr, opts) {
|
|
26327
|
-
const latest = readCheck(
|
|
26573
|
+
const latest = readCheck(join36(configDir(env), UPDATE_CHECK_FILE))?.latest;
|
|
26328
26574
|
if (latest === void 0 || !isNewer(latest, version)) return done;
|
|
26329
26575
|
return async () => {
|
|
26330
26576
|
try {
|
|
26331
26577
|
if (!firstInSession(env, agent, "update")) return;
|
|
26332
|
-
const
|
|
26333
|
-
stderr.write(`kenso ${latest} is out (you have ${version}): ${
|
|
26578
|
+
const command92 = updateCommand(opts.install ?? installKind(), opts.platform ?? process.platform);
|
|
26579
|
+
stderr.write(`kenso ${latest} is out (you have ${version}): ${command92}
|
|
26334
26580
|
`);
|
|
26335
26581
|
} catch {
|
|
26336
26582
|
}
|
|
@@ -26346,7 +26592,7 @@ function startUpdateNotice(argv, opts = {}) {
|
|
|
26346
26592
|
const agent = detectAgent(env);
|
|
26347
26593
|
if (agent !== null) return agentNotice(env, agent, version, stderr, opts);
|
|
26348
26594
|
if (!(opts.stderrIsTTY ?? process.stderr.isTTY === true)) return done;
|
|
26349
|
-
const file =
|
|
26595
|
+
const file = join36(configDir(env), UPDATE_CHECK_FILE);
|
|
26350
26596
|
const now = (opts.now ?? Date.now)();
|
|
26351
26597
|
const cached = readCheck(file);
|
|
26352
26598
|
const checkedAt = Date.parse(cached?.checkedAt ?? "");
|
|
@@ -26365,8 +26611,8 @@ function startUpdateNotice(argv, opts = {}) {
|
|
|
26365
26611
|
if (!found) return;
|
|
26366
26612
|
writeCheck(file, { checkedAt: new Date(now).toISOString(), latest: found });
|
|
26367
26613
|
if (isNewer(found, version)) {
|
|
26368
|
-
const
|
|
26369
|
-
stderr.write(`kenso ${found} is out (you have ${version}): ${
|
|
26614
|
+
const command92 = updateCommand(install, opts.platform ?? process.platform);
|
|
26615
|
+
stderr.write(`kenso ${found} is out (you have ${version}): ${command92}
|
|
26370
26616
|
Turn this off with KENSO_NO_UPDATE_NOTIFIER=1.
|
|
26371
26617
|
`);
|
|
26372
26618
|
}
|
|
@@ -26409,7 +26655,7 @@ function resources() {
|
|
|
26409
26655
|
const names = Object.entries(handWritten).filter(([, area]) => Object.keys(area).length > 0).map(([resource]) => resource);
|
|
26410
26656
|
return sorted([...names, ...Object.keys(resourceAliases), ...listOperations().map((op) => op.resource)]);
|
|
26411
26657
|
}
|
|
26412
|
-
function
|
|
26658
|
+
function actions40(resource) {
|
|
26413
26659
|
const own = Object.keys(handWritten[resource] ?? {}).filter((action) => action !== "");
|
|
26414
26660
|
return sorted([...own, ...listOperations().filter((op) => op.resource === resource).map((op) => op.action)]);
|
|
26415
26661
|
}
|
|
@@ -26474,7 +26720,7 @@ async function completions(words2, globals) {
|
|
|
26474
26720
|
return flagsOf2(spec, globals, positionals.length === 0);
|
|
26475
26721
|
}
|
|
26476
26722
|
if (positionals.length === 0) return resources();
|
|
26477
|
-
if (!spec) return positionals.length === 1 ?
|
|
26723
|
+
if (!spec) return positionals.length === 1 ? actions40(resourceAliases[positionals[0]] ?? positionals[0]) : [];
|
|
26478
26724
|
const given = positionals.length - commandWords2;
|
|
26479
26725
|
const declared = spec.positionals ?? [];
|
|
26480
26726
|
if (given < declared.length || declared.at(-1)?.variadic === true) {
|
|
@@ -26540,9 +26786,9 @@ function leaveRun(active) {
|
|
|
26540
26786
|
async function knownCommands() {
|
|
26541
26787
|
const commands = /* @__PURE__ */ new Set();
|
|
26542
26788
|
for (const [resource, area] of Object.entries(handWritten)) {
|
|
26543
|
-
const
|
|
26544
|
-
if (
|
|
26545
|
-
for (const action of
|
|
26789
|
+
const actions41 = Object.keys(area);
|
|
26790
|
+
if (actions41.length > 0) commands.add(resource);
|
|
26791
|
+
for (const action of actions41) commands.add(action ? `${resource} ${action}` : resource);
|
|
26546
26792
|
}
|
|
26547
26793
|
for (const g of await listGenerated({ features: [] })) {
|
|
26548
26794
|
commands.add(g.resource);
|