@claypi/cli 0.0.4 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1346 -269
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -47835,7 +47835,7 @@ var require_lodash = __commonJS({
|
|
|
47835
47835
|
function object() {
|
|
47836
47836
|
}
|
|
47837
47837
|
return function(proto) {
|
|
47838
|
-
if (!
|
|
47838
|
+
if (!isObject7(proto)) {
|
|
47839
47839
|
return {};
|
|
47840
47840
|
}
|
|
47841
47841
|
if (objectCreate) {
|
|
@@ -48237,7 +48237,7 @@ var require_lodash = __commonJS({
|
|
|
48237
48237
|
if (result2 !== undefined2) {
|
|
48238
48238
|
return result2;
|
|
48239
48239
|
}
|
|
48240
|
-
if (!
|
|
48240
|
+
if (!isObject7(value)) {
|
|
48241
48241
|
return value;
|
|
48242
48242
|
}
|
|
48243
48243
|
var isArr = isArray4(value);
|
|
@@ -48584,7 +48584,7 @@ var require_lodash = __commonJS({
|
|
|
48584
48584
|
return true;
|
|
48585
48585
|
}
|
|
48586
48586
|
function baseIsNative(value) {
|
|
48587
|
-
if (!
|
|
48587
|
+
if (!isObject7(value) || isMasked(value)) {
|
|
48588
48588
|
return false;
|
|
48589
48589
|
}
|
|
48590
48590
|
var pattern = isFunction4(value) ? reIsNative : reIsHostCtor;
|
|
@@ -48624,7 +48624,7 @@ var require_lodash = __commonJS({
|
|
|
48624
48624
|
return result2;
|
|
48625
48625
|
}
|
|
48626
48626
|
function baseKeysIn(object) {
|
|
48627
|
-
if (!
|
|
48627
|
+
if (!isObject7(object)) {
|
|
48628
48628
|
return nativeKeysIn(object);
|
|
48629
48629
|
}
|
|
48630
48630
|
var isProto = isPrototype(object), result2 = [];
|
|
@@ -48669,7 +48669,7 @@ var require_lodash = __commonJS({
|
|
|
48669
48669
|
}
|
|
48670
48670
|
baseFor(source, function(srcValue, key) {
|
|
48671
48671
|
stack || (stack = new Stack());
|
|
48672
|
-
if (
|
|
48672
|
+
if (isObject7(srcValue)) {
|
|
48673
48673
|
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
|
48674
48674
|
} else {
|
|
48675
48675
|
var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2;
|
|
@@ -48709,7 +48709,7 @@ var require_lodash = __commonJS({
|
|
|
48709
48709
|
newValue = objValue;
|
|
48710
48710
|
if (isArguments(objValue)) {
|
|
48711
48711
|
newValue = toPlainObject(objValue);
|
|
48712
|
-
} else if (!
|
|
48712
|
+
} else if (!isObject7(objValue) || isFunction4(objValue)) {
|
|
48713
48713
|
newValue = initCloneObject(srcValue);
|
|
48714
48714
|
}
|
|
48715
48715
|
} else {
|
|
@@ -48848,7 +48848,7 @@ var require_lodash = __commonJS({
|
|
|
48848
48848
|
return shuffleSelf(array, baseClamp(n, 0, array.length));
|
|
48849
48849
|
}
|
|
48850
48850
|
function baseSet(object, path7, value, customizer) {
|
|
48851
|
-
if (!
|
|
48851
|
+
if (!isObject7(object)) {
|
|
48852
48852
|
return object;
|
|
48853
48853
|
}
|
|
48854
48854
|
path7 = castPath(path7, object);
|
|
@@ -48862,7 +48862,7 @@ var require_lodash = __commonJS({
|
|
|
48862
48862
|
var objValue = nested[key];
|
|
48863
48863
|
newValue = customizer ? customizer(objValue, key, nested) : undefined2;
|
|
48864
48864
|
if (newValue === undefined2) {
|
|
48865
|
-
newValue =
|
|
48865
|
+
newValue = isObject7(objValue) ? objValue : isIndex(path7[index + 1]) ? [] : {};
|
|
48866
48866
|
}
|
|
48867
48867
|
}
|
|
48868
48868
|
assignValue(nested, key, newValue);
|
|
@@ -49332,7 +49332,7 @@ var require_lodash = __commonJS({
|
|
|
49332
49332
|
return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
|
|
49333
49333
|
}
|
|
49334
49334
|
var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
|
|
49335
|
-
return
|
|
49335
|
+
return isObject7(result2) ? result2 : thisBinding;
|
|
49336
49336
|
};
|
|
49337
49337
|
}
|
|
49338
49338
|
function createCurry(func, bitmask, arity) {
|
|
@@ -49668,7 +49668,7 @@ var require_lodash = __commonJS({
|
|
|
49668
49668
|
return objValue;
|
|
49669
49669
|
}
|
|
49670
49670
|
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
|
|
49671
|
-
if (
|
|
49671
|
+
if (isObject7(objValue) && isObject7(srcValue)) {
|
|
49672
49672
|
stack.set(srcValue, objValue);
|
|
49673
49673
|
baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
|
|
49674
49674
|
stack["delete"](srcValue);
|
|
@@ -50016,7 +50016,7 @@ var require_lodash = __commonJS({
|
|
|
50016
50016
|
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
50017
50017
|
}
|
|
50018
50018
|
function isIterateeCall(value, index, object) {
|
|
50019
|
-
if (!
|
|
50019
|
+
if (!isObject7(object)) {
|
|
50020
50020
|
return false;
|
|
50021
50021
|
}
|
|
50022
50022
|
var type = typeof index;
|
|
@@ -50059,7 +50059,7 @@ var require_lodash = __commonJS({
|
|
|
50059
50059
|
return value === proto;
|
|
50060
50060
|
}
|
|
50061
50061
|
function isStrictComparable(value) {
|
|
50062
|
-
return value === value && !
|
|
50062
|
+
return value === value && !isObject7(value);
|
|
50063
50063
|
}
|
|
50064
50064
|
function matchesStrictComparable(key, srcValue) {
|
|
50065
50065
|
return function(object) {
|
|
@@ -50941,7 +50941,7 @@ var require_lodash = __commonJS({
|
|
|
50941
50941
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
50942
50942
|
}
|
|
50943
50943
|
wait = toNumber(wait) || 0;
|
|
50944
|
-
if (
|
|
50944
|
+
if (isObject7(options)) {
|
|
50945
50945
|
leading = !!options.leading;
|
|
50946
50946
|
maxing = "maxWait" in options;
|
|
50947
50947
|
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
@@ -51111,7 +51111,7 @@ var require_lodash = __commonJS({
|
|
|
51111
51111
|
if (typeof func != "function") {
|
|
51112
51112
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
51113
51113
|
}
|
|
51114
|
-
if (
|
|
51114
|
+
if (isObject7(options)) {
|
|
51115
51115
|
leading = "leading" in options ? !!options.leading : leading;
|
|
51116
51116
|
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
51117
51117
|
}
|
|
@@ -51219,7 +51219,7 @@ var require_lodash = __commonJS({
|
|
|
51219
51219
|
return typeof value == "number" && nativeIsFinite(value);
|
|
51220
51220
|
}
|
|
51221
51221
|
function isFunction4(value) {
|
|
51222
|
-
if (!
|
|
51222
|
+
if (!isObject7(value)) {
|
|
51223
51223
|
return false;
|
|
51224
51224
|
}
|
|
51225
51225
|
var tag = baseGetTag4(value);
|
|
@@ -51231,7 +51231,7 @@ var require_lodash = __commonJS({
|
|
|
51231
51231
|
function isLength(value) {
|
|
51232
51232
|
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
51233
51233
|
}
|
|
51234
|
-
function
|
|
51234
|
+
function isObject7(value) {
|
|
51235
51235
|
var type = typeof value;
|
|
51236
51236
|
return value != null && (type == "object" || type == "function");
|
|
51237
51237
|
}
|
|
@@ -51338,9 +51338,9 @@ var require_lodash = __commonJS({
|
|
|
51338
51338
|
if (isSymbol(value)) {
|
|
51339
51339
|
return NAN;
|
|
51340
51340
|
}
|
|
51341
|
-
if (
|
|
51341
|
+
if (isObject7(value)) {
|
|
51342
51342
|
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
51343
|
-
value =
|
|
51343
|
+
value = isObject7(other) ? other + "" : other;
|
|
51344
51344
|
}
|
|
51345
51345
|
if (typeof value != "string") {
|
|
51346
51346
|
return value === 0 ? value : +value;
|
|
@@ -51561,7 +51561,7 @@ var require_lodash = __commonJS({
|
|
|
51561
51561
|
var Ctor = object && object.constructor;
|
|
51562
51562
|
if (isArrLike) {
|
|
51563
51563
|
accumulator = isArr ? new Ctor() : [];
|
|
51564
|
-
} else if (
|
|
51564
|
+
} else if (isObject7(object)) {
|
|
51565
51565
|
accumulator = isFunction4(Ctor) ? baseCreate(getPrototype(object)) : {};
|
|
51566
51566
|
} else {
|
|
51567
51567
|
accumulator = {};
|
|
@@ -51846,7 +51846,7 @@ var require_lodash = __commonJS({
|
|
|
51846
51846
|
}
|
|
51847
51847
|
function truncate3(string, options) {
|
|
51848
51848
|
var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
|
|
51849
|
-
if (
|
|
51849
|
+
if (isObject7(options)) {
|
|
51850
51850
|
var separator = "separator" in options ? options.separator : separator;
|
|
51851
51851
|
length = "length" in options ? toInteger(options.length) : length;
|
|
51852
51852
|
omission = "omission" in options ? baseToString(options.omission) : omission;
|
|
@@ -51976,13 +51976,13 @@ var require_lodash = __commonJS({
|
|
|
51976
51976
|
});
|
|
51977
51977
|
function mixin(object, source, options) {
|
|
51978
51978
|
var props = keys(source), methodNames = baseFunctions(source, props);
|
|
51979
|
-
if (options == null && !(
|
|
51979
|
+
if (options == null && !(isObject7(source) && (methodNames.length || !props.length))) {
|
|
51980
51980
|
options = source;
|
|
51981
51981
|
source = object;
|
|
51982
51982
|
object = this;
|
|
51983
51983
|
methodNames = baseFunctions(source, keys(source));
|
|
51984
51984
|
}
|
|
51985
|
-
var chain2 = !(
|
|
51985
|
+
var chain2 = !(isObject7(options) && "chain" in options) || !!options.chain, isFunc = isFunction4(object);
|
|
51986
51986
|
arrayEach(methodNames, function(methodName) {
|
|
51987
51987
|
var func = source[methodName];
|
|
51988
51988
|
object[methodName] = func;
|
|
@@ -52328,7 +52328,7 @@ var require_lodash = __commonJS({
|
|
|
52328
52328
|
lodash.isNil = isNil;
|
|
52329
52329
|
lodash.isNull = isNull;
|
|
52330
52330
|
lodash.isNumber = isNumber;
|
|
52331
|
-
lodash.isObject =
|
|
52331
|
+
lodash.isObject = isObject7;
|
|
52332
52332
|
lodash.isObjectLike = isObjectLike4;
|
|
52333
52333
|
lodash.isPlainObject = isPlainObject5;
|
|
52334
52334
|
lodash.isRegExp = isRegExp2;
|
|
@@ -56770,7 +56770,7 @@ function withLoginHint(message) {
|
|
|
56770
56770
|
}
|
|
56771
56771
|
var MissingApiKeyError = class extends Error {
|
|
56772
56772
|
constructor() {
|
|
56773
|
-
super("No API key configured. Run `clay login` to set one.");
|
|
56773
|
+
super("No API key configured. Run `clay login` to set one, or set the CLAY_API_KEY environment variable.");
|
|
56774
56774
|
this.name = "MissingApiKeyError";
|
|
56775
56775
|
}
|
|
56776
56776
|
};
|
|
@@ -56816,6 +56816,12 @@ var UploadFailedError = class extends Error {
|
|
|
56816
56816
|
this.name = "UploadFailedError";
|
|
56817
56817
|
}
|
|
56818
56818
|
};
|
|
56819
|
+
var FileWriteError = class extends Error {
|
|
56820
|
+
constructor(message) {
|
|
56821
|
+
super(message);
|
|
56822
|
+
this.name = "FileWriteError";
|
|
56823
|
+
}
|
|
56824
|
+
};
|
|
56819
56825
|
var HttpStatusError = class extends Error {
|
|
56820
56826
|
status;
|
|
56821
56827
|
retryAfter;
|
|
@@ -56839,6 +56845,12 @@ function mapError(err) {
|
|
|
56839
56845
|
exitCode: EXIT_CODES.VALIDATION
|
|
56840
56846
|
};
|
|
56841
56847
|
}
|
|
56848
|
+
if (err instanceof FileWriteError) {
|
|
56849
|
+
return {
|
|
56850
|
+
envelope: { code: "validation_error", message: err.message },
|
|
56851
|
+
exitCode: EXIT_CODES.VALIDATION
|
|
56852
|
+
};
|
|
56853
|
+
}
|
|
56842
56854
|
if (err instanceof ApiKeyInvalidCharactersError) {
|
|
56843
56855
|
return {
|
|
56844
56856
|
envelope: { code: "validation_error", message: err.message },
|
|
@@ -61375,14 +61387,47 @@ function clearDefaultProfile() {
|
|
|
61375
61387
|
writeConfig({ ...existing, profiles: rest });
|
|
61376
61388
|
}
|
|
61377
61389
|
|
|
61390
|
+
// src/auth/credentials-file.ts
|
|
61391
|
+
var import_node_fs4 = require("fs");
|
|
61392
|
+
var CREDENTIALS_FILE_PATH = "/mnt/session/uploads/.clay-credentials";
|
|
61393
|
+
function parseDotenv(content) {
|
|
61394
|
+
const out = {};
|
|
61395
|
+
for (const line of content.split("\n")) {
|
|
61396
|
+
const trimmed = line.trim();
|
|
61397
|
+
if (trimmed === "" || trimmed.startsWith("#")) continue;
|
|
61398
|
+
const eq = trimmed.indexOf("=");
|
|
61399
|
+
if (eq <= 0) continue;
|
|
61400
|
+
out[trimmed.slice(0, eq).trim()] = trimmed.slice(eq + 1).trim();
|
|
61401
|
+
}
|
|
61402
|
+
return out;
|
|
61403
|
+
}
|
|
61404
|
+
function credentialFromFile(key) {
|
|
61405
|
+
let content;
|
|
61406
|
+
try {
|
|
61407
|
+
content = (0, import_node_fs4.readFileSync)(CREDENTIALS_FILE_PATH, "utf-8");
|
|
61408
|
+
} catch {
|
|
61409
|
+
return void 0;
|
|
61410
|
+
}
|
|
61411
|
+
const value = parseDotenv(content)[key]?.trim();
|
|
61412
|
+
return value === void 0 || value === "" ? void 0 : value;
|
|
61413
|
+
}
|
|
61414
|
+
|
|
61378
61415
|
// src/auth/api-key-provider.ts
|
|
61379
61416
|
var ApiKeyProvider = class {
|
|
61380
61417
|
getApiKey() {
|
|
61381
|
-
const
|
|
61382
|
-
if (
|
|
61383
|
-
return Promise.
|
|
61418
|
+
const stored = getDefaultApiKey();
|
|
61419
|
+
if (stored !== void 0 && stored !== "") {
|
|
61420
|
+
return Promise.resolve(stored);
|
|
61421
|
+
}
|
|
61422
|
+
const fromEnv = process.env.CLAY_API_KEY?.trim();
|
|
61423
|
+
if (fromEnv !== void 0 && fromEnv !== "") {
|
|
61424
|
+
return Promise.resolve(fromEnv);
|
|
61384
61425
|
}
|
|
61385
|
-
|
|
61426
|
+
const fromFile = credentialFromFile("CLAY_API_KEY");
|
|
61427
|
+
if (fromFile !== void 0) {
|
|
61428
|
+
return Promise.resolve(fromFile);
|
|
61429
|
+
}
|
|
61430
|
+
return Promise.reject(new MissingApiKeyError());
|
|
61386
61431
|
}
|
|
61387
61432
|
};
|
|
61388
61433
|
|
|
@@ -61402,11 +61447,18 @@ function normalizeBaseUrl(raw) {
|
|
|
61402
61447
|
}
|
|
61403
61448
|
return trimmed.replace(/\/+$/, "");
|
|
61404
61449
|
}
|
|
61450
|
+
function resolveBaseUrl() {
|
|
61451
|
+
const fromEnv = process.env.CLAY_API_URL?.trim();
|
|
61452
|
+
if (fromEnv !== void 0 && fromEnv !== "") {
|
|
61453
|
+
return normalizeBaseUrl(fromEnv);
|
|
61454
|
+
}
|
|
61455
|
+
return normalizeBaseUrl(credentialFromFile("CLAY_API_URL"));
|
|
61456
|
+
}
|
|
61405
61457
|
|
|
61406
61458
|
// src/version.ts
|
|
61407
|
-
var
|
|
61459
|
+
var import_node_fs5 = require("fs");
|
|
61408
61460
|
var import_node_path3 = require("path");
|
|
61409
|
-
var pkg = JSON.parse((0,
|
|
61461
|
+
var pkg = JSON.parse((0, import_node_fs5.readFileSync)((0, import_node_path3.join)(__dirname, "..", "package.json"), "utf8"));
|
|
61410
61462
|
var CLI_VERSION = pkg.version;
|
|
61411
61463
|
|
|
61412
61464
|
// src/clients/cli-attribution-headers.ts
|
|
@@ -61451,6 +61503,13 @@ var timeoutApiFetcher = (args) => tsRestFetchApi({
|
|
|
61451
61503
|
signal: withTimeoutSignal(requestTimeoutMs(), args.fetchOptions?.signal)
|
|
61452
61504
|
}
|
|
61453
61505
|
});
|
|
61506
|
+
var largeTransferTimeoutApiFetcher = (args) => tsRestFetchApi({
|
|
61507
|
+
...args,
|
|
61508
|
+
fetchOptions: {
|
|
61509
|
+
...args.fetchOptions,
|
|
61510
|
+
signal: withTimeoutSignal(uploadTimeoutMs(), args.fetchOptions?.signal)
|
|
61511
|
+
}
|
|
61512
|
+
});
|
|
61454
61513
|
async function fetchWithTimeout(input, init3, timeoutMs = requestTimeoutMs()) {
|
|
61455
61514
|
return fetch(input, { ...init3, signal: withTimeoutSignal(timeoutMs, init3?.signal) });
|
|
61456
61515
|
}
|
|
@@ -61460,7 +61519,7 @@ var PUBLIC_API_V0_PREFIX = "/public/v0";
|
|
|
61460
61519
|
var cache = /* @__PURE__ */ new Map();
|
|
61461
61520
|
function createPublicApiClient(contract, apiKey) {
|
|
61462
61521
|
return initClient(contract, {
|
|
61463
|
-
baseUrl: `${
|
|
61522
|
+
baseUrl: `${resolveBaseUrl()}${PUBLIC_API_V0_PREFIX}`,
|
|
61464
61523
|
baseHeaders: {
|
|
61465
61524
|
[CLAY_API_KEY_HEADER]: apiKey,
|
|
61466
61525
|
...cliAttributionHeaders()
|
|
@@ -61485,26 +61544,30 @@ function invalidatePublicApiClient() {
|
|
|
61485
61544
|
|
|
61486
61545
|
// src/clients/v3-client.ts
|
|
61487
61546
|
var cache2 = /* @__PURE__ */ new Map();
|
|
61488
|
-
|
|
61489
|
-
|
|
61547
|
+
var largeTransferCache = /* @__PURE__ */ new Map();
|
|
61548
|
+
async function v3Client(contract, options = {}) {
|
|
61549
|
+
const useLargeTransfer = options.timeout === "large-transfer";
|
|
61550
|
+
const store = useLargeTransfer ? largeTransferCache : cache2;
|
|
61551
|
+
const cached2 = store.get(contract);
|
|
61490
61552
|
if (cached2 !== void 0) {
|
|
61491
61553
|
return cached2;
|
|
61492
61554
|
}
|
|
61493
61555
|
const apiKey = await tokenProvider.getApiKey();
|
|
61494
61556
|
const client = initClient(contract, {
|
|
61495
|
-
baseUrl: `${
|
|
61557
|
+
baseUrl: `${resolveBaseUrl()}/v3`,
|
|
61496
61558
|
baseHeaders: {
|
|
61497
61559
|
[CLAY_API_KEY_HEADER]: apiKey,
|
|
61498
61560
|
...cliAttributionHeaders()
|
|
61499
61561
|
},
|
|
61500
61562
|
validateResponse: true,
|
|
61501
|
-
api: timeoutApiFetcher
|
|
61563
|
+
api: useLargeTransfer ? largeTransferTimeoutApiFetcher : timeoutApiFetcher
|
|
61502
61564
|
});
|
|
61503
|
-
|
|
61565
|
+
store.set(contract, client);
|
|
61504
61566
|
return client;
|
|
61505
61567
|
}
|
|
61506
61568
|
function invalidateV3Client() {
|
|
61507
61569
|
cache2.clear();
|
|
61570
|
+
largeTransferCache.clear();
|
|
61508
61571
|
}
|
|
61509
61572
|
|
|
61510
61573
|
// ../../node_modules/@sentry/node/build/esm/integrations/http.js
|
|
@@ -75834,12 +75897,12 @@ function captureWorkerThreadEvents(worker, options) {
|
|
|
75834
75897
|
|
|
75835
75898
|
// ../../node_modules/@sentry/node/node_modules/@sentry/node-core/build/esm/integrations/context.js
|
|
75836
75899
|
var import_node_child_process = require("child_process");
|
|
75837
|
-
var
|
|
75900
|
+
var import_node_fs6 = require("fs");
|
|
75838
75901
|
var os = __toESM(require("os"), 1);
|
|
75839
75902
|
var import_node_path4 = require("path");
|
|
75840
75903
|
var import_node_util = require("util");
|
|
75841
|
-
var readFileAsync = (0, import_node_util.promisify)(
|
|
75842
|
-
var readDirAsync = (0, import_node_util.promisify)(
|
|
75904
|
+
var readFileAsync = (0, import_node_util.promisify)(import_node_fs6.readFile);
|
|
75905
|
+
var readDirAsync = (0, import_node_util.promisify)(import_node_fs6.readdir);
|
|
75843
75906
|
var INTEGRATION_NAME12 = "Context";
|
|
75844
75907
|
var _nodeContextIntegration = ((options = {}) => {
|
|
75845
75908
|
let cachedContext;
|
|
@@ -76122,7 +76185,7 @@ function getCloudResourceContext() {
|
|
|
76122
76185
|
}
|
|
76123
76186
|
|
|
76124
76187
|
// ../../node_modules/@sentry/node/node_modules/@sentry/node-core/build/esm/integrations/contextlines.js
|
|
76125
|
-
var
|
|
76188
|
+
var import_node_fs7 = require("fs");
|
|
76126
76189
|
var import_node_readline = require("readline");
|
|
76127
76190
|
var LRU_FILE_CONTENTS_CACHE = new LRUMap(10);
|
|
76128
76191
|
var LRU_FILE_CONTENTS_FS_READ_FAILED = new LRUMap(20);
|
|
@@ -76193,7 +76256,7 @@ function makeLineReaderRanges(lines, linecontext) {
|
|
|
76193
76256
|
}
|
|
76194
76257
|
function getContextLinesFromFile(path7, ranges, output) {
|
|
76195
76258
|
return new Promise((resolve2, _reject) => {
|
|
76196
|
-
const stream = (0,
|
|
76259
|
+
const stream = (0, import_node_fs7.createReadStream)(path7);
|
|
76197
76260
|
const lineReaded = (0, import_node_readline.createInterface)({
|
|
76198
76261
|
input: stream
|
|
76199
76262
|
});
|
|
@@ -76797,7 +76860,7 @@ var localVariablesIntegration = (options = {}) => {
|
|
|
76797
76860
|
};
|
|
76798
76861
|
|
|
76799
76862
|
// ../../node_modules/@sentry/node/node_modules/@sentry/node-core/build/esm/integrations/modules.js
|
|
76800
|
-
var
|
|
76863
|
+
var import_node_fs8 = require("fs");
|
|
76801
76864
|
var import_node_path5 = require("path");
|
|
76802
76865
|
|
|
76803
76866
|
// ../../node_modules/@sentry/node/node_modules/@sentry/node-core/build/esm/utils/detection.js
|
|
@@ -76877,11 +76940,11 @@ function collectRequireModules() {
|
|
|
76877
76940
|
}
|
|
76878
76941
|
const pkgfile = (0, import_node_path5.join)(orig, "package.json");
|
|
76879
76942
|
seen.add(orig);
|
|
76880
|
-
if (!(0,
|
|
76943
|
+
if (!(0, import_node_fs8.existsSync)(pkgfile)) {
|
|
76881
76944
|
return updir();
|
|
76882
76945
|
}
|
|
76883
76946
|
try {
|
|
76884
|
-
const info = JSON.parse((0,
|
|
76947
|
+
const info = JSON.parse((0, import_node_fs8.readFileSync)(pkgfile, "utf8"));
|
|
76885
76948
|
infos[info.name] = info.version;
|
|
76886
76949
|
} catch {
|
|
76887
76950
|
}
|
|
@@ -76899,7 +76962,7 @@ function _getModules() {
|
|
|
76899
76962
|
function getPackageJson() {
|
|
76900
76963
|
try {
|
|
76901
76964
|
const filePath = (0, import_node_path5.join)(process.cwd(), "package.json");
|
|
76902
|
-
const packageJson = JSON.parse((0,
|
|
76965
|
+
const packageJson = JSON.parse((0, import_node_fs8.readFileSync)(filePath, "utf8"));
|
|
76903
76966
|
return packageJson;
|
|
76904
76967
|
} catch {
|
|
76905
76968
|
return {};
|
|
@@ -82695,7 +82758,7 @@ Examples:
|
|
|
82695
82758
|
// src/commands/logout.ts
|
|
82696
82759
|
function registerLogout(program3) {
|
|
82697
82760
|
program3.command("logout").description(
|
|
82698
|
-
"Remove the saved API key from the config file. Idempotent \u2014 succeeds even if no key is currently saved. Subsequent authenticated commands will fail with auth_missing_api_key (exit 3) until you run `clay login` again."
|
|
82761
|
+
"Remove the saved API key from the config file. Idempotent \u2014 succeeds even if no key is currently saved. Subsequent authenticated commands will fail with auth_missing_api_key (exit 3) until you run `clay login` again \u2014 unless CLAY_API_KEY is set in the environment, which logout cannot remove and which keeps the CLI authenticated."
|
|
82699
82762
|
).addHelpText(
|
|
82700
82763
|
"after",
|
|
82701
82764
|
`
|
|
@@ -82703,10 +82766,11 @@ Output (success, exit 0):
|
|
|
82703
82766
|
{ "ok": true }
|
|
82704
82767
|
Removes only the "default" profile; other profiles in the file are preserved.
|
|
82705
82768
|
Idempotent \u2014 if no key is saved (or the config file is missing), the command is a no-op and still exits 0.
|
|
82769
|
+
Does not unset the CLAY_API_KEY environment variable; if it is set, the CLI stays authenticated via that fallback after logout.
|
|
82706
82770
|
|
|
82707
82771
|
Examples:
|
|
82708
82772
|
$ clay logout
|
|
82709
|
-
$ clay logout && clay whoami # confirms the key was removed (whoami \u2192 auth_missing_api_key, exit 3)
|
|
82773
|
+
$ clay logout && clay whoami # confirms the key was removed (whoami \u2192 auth_missing_api_key, exit 3, when CLAY_API_KEY is unset)
|
|
82710
82774
|
`
|
|
82711
82775
|
).action(() => {
|
|
82712
82776
|
clearDefaultProfile();
|
|
@@ -82728,6 +82792,25 @@ function applyClaySettings(cmd) {
|
|
|
82728
82792
|
return cmd;
|
|
82729
82793
|
}
|
|
82730
82794
|
|
|
82795
|
+
// ../../libs/api-contract/src/public-api-v0/pagination.ts
|
|
82796
|
+
var DEFAULT_PAGE_LIMIT = 20;
|
|
82797
|
+
var MAX_PAGE_LIMIT = 100;
|
|
82798
|
+
function paginatedQuerySchema({
|
|
82799
|
+
defaultLimit = DEFAULT_PAGE_LIMIT,
|
|
82800
|
+
maxLimit = MAX_PAGE_LIMIT
|
|
82801
|
+
} = {}) {
|
|
82802
|
+
return external_exports.object({
|
|
82803
|
+
cursor: external_exports.string().optional(),
|
|
82804
|
+
limit: external_exports.coerce.number().int().min(1).max(maxLimit).default(defaultLimit)
|
|
82805
|
+
});
|
|
82806
|
+
}
|
|
82807
|
+
function paginatedResponse(itemSchema) {
|
|
82808
|
+
return external_exports.object({
|
|
82809
|
+
data: external_exports.array(itemSchema),
|
|
82810
|
+
cursor: external_exports.string().optional()
|
|
82811
|
+
});
|
|
82812
|
+
}
|
|
82813
|
+
|
|
82731
82814
|
// ../../libs/api-contract/src/common/interfaces.ts
|
|
82732
82815
|
var SerializedTimestamp = external_exports.object({
|
|
82733
82816
|
createdAt: external_exports.string(),
|
|
@@ -82834,58 +82917,60 @@ var tablesSummaryContract = {
|
|
|
82834
82917
|
}
|
|
82835
82918
|
};
|
|
82836
82919
|
|
|
82837
|
-
// src/commands/
|
|
82838
|
-
var
|
|
82839
|
-
|
|
82840
|
-
|
|
82841
|
-
|
|
82842
|
-
|
|
82843
|
-
|
|
82844
|
-
get cursor() {
|
|
82845
|
-
return this.currentCursor;
|
|
82846
|
-
}
|
|
82847
|
-
advance(nextCursor, pageItemCount) {
|
|
82848
|
-
if (nextCursor === this.currentCursor) {
|
|
82849
|
-
throw new IncompatibleApiServerError(
|
|
82850
|
-
"Clay API returned the same pagination cursor twice in a row; aborting auto-pagination."
|
|
82851
|
-
);
|
|
82852
|
-
}
|
|
82853
|
-
this.itemsFetched += pageItemCount;
|
|
82854
|
-
this.pagesFetched += 1;
|
|
82855
|
-
if (this.itemsFetched >= MAX_AUTO_PAGINATE_ITEMS) {
|
|
82856
|
-
throw new IncompatibleApiServerError(
|
|
82857
|
-
`Auto-pagination stopped after ${MAX_AUTO_PAGINATE_ITEMS} items without reaching the end of the result set; narrow the request to fetch fewer rows.`
|
|
82858
|
-
);
|
|
82920
|
+
// src/commands/flag-parsers.ts
|
|
82921
|
+
var import_node_fs9 = require("fs");
|
|
82922
|
+
function parsePositiveIntegerFlag(flagName, max) {
|
|
82923
|
+
return (value) => {
|
|
82924
|
+
const n = Number.parseInt(value, 10);
|
|
82925
|
+
if (!Number.isInteger(n) || n < 1 || String(n) !== value.trim()) {
|
|
82926
|
+
throw new InvalidArgumentError(`${flagName} must be a positive integer`);
|
|
82859
82927
|
}
|
|
82860
|
-
if (
|
|
82861
|
-
throw new
|
|
82862
|
-
`Clay API returned ${MAX_AUTO_PAGINATE_PAGES} pages without reaching the end of the result set; aborting auto-pagination.`
|
|
82863
|
-
);
|
|
82928
|
+
if (max && n > max) {
|
|
82929
|
+
throw new InvalidArgumentError(`${flagName} must be less than or equal to ${max}`);
|
|
82864
82930
|
}
|
|
82865
|
-
|
|
82931
|
+
return n;
|
|
82932
|
+
};
|
|
82933
|
+
}
|
|
82934
|
+
var parseLimitFlag = parsePositiveIntegerFlag("--limit");
|
|
82935
|
+
function parseLimitFlagWithMax(max) {
|
|
82936
|
+
return parsePositiveIntegerFlag("--limit", max);
|
|
82937
|
+
}
|
|
82938
|
+
function parseBooleanFlag(flagName) {
|
|
82939
|
+
return (value) => {
|
|
82940
|
+
if (value === "true") return true;
|
|
82941
|
+
if (value === "false") return false;
|
|
82942
|
+
throw new InvalidArgumentError(`${flagName} must be true or false`);
|
|
82943
|
+
};
|
|
82944
|
+
}
|
|
82945
|
+
function readJsonFlag(flagName, source) {
|
|
82946
|
+
const display = source === "-" ? "stdin" : source;
|
|
82947
|
+
let raw;
|
|
82948
|
+
try {
|
|
82949
|
+
raw = source === "-" ? (0, import_node_fs9.readFileSync)(0, "utf8") : (0, import_node_fs9.readFileSync)(source, "utf8");
|
|
82950
|
+
} catch (err) {
|
|
82951
|
+
throw new InvalidArgumentError(`${flagName}: could not read ${display} (${err.message})`);
|
|
82866
82952
|
}
|
|
82867
|
-
|
|
82868
|
-
|
|
82869
|
-
|
|
82870
|
-
|
|
82871
|
-
|
|
82872
|
-
|
|
82873
|
-
|
|
82874
|
-
|
|
82875
|
-
throw new InvalidArgumentError("must be a positive integer");
|
|
82953
|
+
const trimmed = raw.trim();
|
|
82954
|
+
if (trimmed === "") {
|
|
82955
|
+
throw new InvalidArgumentError(`${flagName}: ${display} is empty`);
|
|
82956
|
+
}
|
|
82957
|
+
try {
|
|
82958
|
+
return JSON.parse(trimmed);
|
|
82959
|
+
} catch (err) {
|
|
82960
|
+
throw new InvalidArgumentError(`${flagName}: not valid JSON (${err.message})`);
|
|
82876
82961
|
}
|
|
82877
|
-
return n;
|
|
82878
82962
|
}
|
|
82963
|
+
|
|
82964
|
+
// src/commands/tables/list.ts
|
|
82879
82965
|
function buildListCommand() {
|
|
82880
82966
|
const cmd = new Command("list");
|
|
82881
82967
|
cmd.description(
|
|
82882
82968
|
"List tables in the workspace pinned to your API key. Each row carries an `apiEnabled` flag for whether the table is enabled for public-API sync."
|
|
82883
82969
|
).option(
|
|
82884
82970
|
"--limit <n>",
|
|
82885
|
-
`
|
|
82886
|
-
|
|
82887
|
-
|
|
82888
|
-
).option("--api-enabled", "Only return tables enabled for the public API.").addHelpText(
|
|
82971
|
+
`Max tables to return per page. Defaults to ${DEFAULT_PAGE_LIMIT}.`,
|
|
82972
|
+
parseLimitFlagWithMax(MAX_PAGE_LIMIT)
|
|
82973
|
+
).option("--cursor <token>", "Resume from a previous response's `cursor` to fetch the next page.").option("--api-enabled", "Only return tables enabled for the public API.").addHelpText(
|
|
82889
82974
|
"after",
|
|
82890
82975
|
`
|
|
82891
82976
|
Output (success, exit 0):
|
|
@@ -82898,49 +82983,48 @@ Output (success, exit 0):
|
|
|
82898
82983
|
"workbook": { "id": <string>, "name": <string> } | null,
|
|
82899
82984
|
"apiEnabled": <boolean>
|
|
82900
82985
|
}
|
|
82901
|
-
]
|
|
82986
|
+
],
|
|
82987
|
+
"cursor": <string|undefined>
|
|
82902
82988
|
}
|
|
82903
82989
|
|
|
82990
|
+
Pagination:
|
|
82991
|
+
--limit <n> max tables per call. Defaults to ${DEFAULT_PAGE_LIMIT}.
|
|
82992
|
+
--cursor <token> resume from a previous response's \`cursor\`
|
|
82993
|
+
When more results exist, the response includes a top-level \`cursor\`; pass it back via
|
|
82994
|
+
--cursor to fetch the next page.
|
|
82995
|
+
|
|
82904
82996
|
Common errors:
|
|
82905
|
-
validation_error (exit 2) --limit is not a positive integer.
|
|
82997
|
+
validation_error (exit 2) --limit is not a positive integer or exceeds ${MAX_PAGE_LIMIT}.
|
|
82906
82998
|
auth_forbidden (exit 3) Key lacks the cli:all scope, or the workspace is not in the public-API beta.
|
|
82907
82999
|
|
|
82908
83000
|
Examples:
|
|
82909
83001
|
$ clay tables list
|
|
82910
83002
|
$ clay tables list --api-enabled | jq -r '.data[].id'
|
|
82911
|
-
$ clay tables list --limit
|
|
83003
|
+
$ clay tables list --limit 50 --cursor "$CURSOR"
|
|
83004
|
+
$ clay tables list --api-enabled | jq -r '.data[] | select(.apiEnabled) | .name'
|
|
82912
83005
|
`
|
|
82913
83006
|
).action(async (opts) => {
|
|
82914
83007
|
const workspaceId = await currentWorkspaceId();
|
|
82915
83008
|
const client = await v3Client(tablesSummaryContract);
|
|
82916
|
-
const
|
|
82917
|
-
|
|
82918
|
-
|
|
82919
|
-
|
|
82920
|
-
|
|
82921
|
-
|
|
82922
|
-
|
|
82923
|
-
|
|
82924
|
-
|
|
82925
|
-
|
|
82926
|
-
...pager.cursor === void 0 ? {} : { cursor: pager.cursor },
|
|
82927
|
-
...opts.apiEnabled === true ? { apiEnabled: "true" } : {}
|
|
82928
|
-
}
|
|
82929
|
-
})
|
|
82930
|
-
);
|
|
82931
|
-
accumulated.push(...page.data);
|
|
82932
|
-
if (page.cursor === void 0) break;
|
|
82933
|
-
if (accumulated.length >= opts.limit) break;
|
|
82934
|
-
pager.advance(page.cursor, page.data.length);
|
|
82935
|
-
}
|
|
83009
|
+
const page = await unwrap(
|
|
83010
|
+
client.listTablesSummary({
|
|
83011
|
+
params: { workspaceId },
|
|
83012
|
+
query: {
|
|
83013
|
+
cursor: opts.cursor,
|
|
83014
|
+
limit: opts.limit ?? DEFAULT_PAGE_LIMIT,
|
|
83015
|
+
apiEnabled: opts.apiEnabled === true ? "true" : void 0
|
|
83016
|
+
}
|
|
83017
|
+
})
|
|
83018
|
+
);
|
|
82936
83019
|
writeJson({
|
|
82937
|
-
data:
|
|
83020
|
+
data: page.data.map((t) => ({
|
|
82938
83021
|
id: t.id,
|
|
82939
83022
|
name: t.name,
|
|
82940
83023
|
description: t.description,
|
|
82941
83024
|
workbook: t.workbook,
|
|
82942
83025
|
apiEnabled: t.apiEnabled
|
|
82943
|
-
}))
|
|
83026
|
+
})),
|
|
83027
|
+
cursor: page.cursor
|
|
82944
83028
|
});
|
|
82945
83029
|
});
|
|
82946
83030
|
return cmd;
|
|
@@ -83077,25 +83161,6 @@ var StructuredQueryRequest = external_exports.preprocess((raw, ctx) => {
|
|
|
83077
83161
|
return raw;
|
|
83078
83162
|
}, StructuredQueryRequestShape);
|
|
83079
83163
|
|
|
83080
|
-
// ../../libs/api-contract/src/public-api-v0/pagination.ts
|
|
83081
|
-
var DEFAULT_PAGE_LIMIT = 20;
|
|
83082
|
-
var MAX_PAGE_LIMIT = 100;
|
|
83083
|
-
function paginatedQuerySchema({
|
|
83084
|
-
defaultLimit = DEFAULT_PAGE_LIMIT,
|
|
83085
|
-
maxLimit = MAX_PAGE_LIMIT
|
|
83086
|
-
} = {}) {
|
|
83087
|
-
return external_exports.object({
|
|
83088
|
-
cursor: external_exports.string().optional(),
|
|
83089
|
-
limit: external_exports.coerce.number().int().min(1).max(maxLimit).default(defaultLimit)
|
|
83090
|
-
});
|
|
83091
|
-
}
|
|
83092
|
-
function paginatedResponse(itemSchema) {
|
|
83093
|
-
return external_exports.object({
|
|
83094
|
-
data: external_exports.array(itemSchema),
|
|
83095
|
-
cursor: external_exports.string().optional()
|
|
83096
|
-
});
|
|
83097
|
-
}
|
|
83098
|
-
|
|
83099
83164
|
// ../../libs/api-contract/src/public-api-v0/tables-contract.ts
|
|
83100
83165
|
var c = initContract();
|
|
83101
83166
|
var CellSuccessSchema = external_exports.object({
|
|
@@ -83147,44 +83212,6 @@ var publicApiTablesContract = c.router({
|
|
|
83147
83212
|
}
|
|
83148
83213
|
});
|
|
83149
83214
|
|
|
83150
|
-
// src/commands/flag-parsers.ts
|
|
83151
|
-
var import_node_fs8 = require("fs");
|
|
83152
|
-
function parsePositiveIntegerFlag(flagName) {
|
|
83153
|
-
return (value) => {
|
|
83154
|
-
const n = Number.parseInt(value, 10);
|
|
83155
|
-
if (!Number.isInteger(n) || n < 1 || String(n) !== value.trim()) {
|
|
83156
|
-
throw new InvalidArgumentError(`${flagName} must be a positive integer`);
|
|
83157
|
-
}
|
|
83158
|
-
return n;
|
|
83159
|
-
};
|
|
83160
|
-
}
|
|
83161
|
-
var parseLimitFlag = parsePositiveIntegerFlag("--limit");
|
|
83162
|
-
function parseBooleanFlag(flagName) {
|
|
83163
|
-
return (value) => {
|
|
83164
|
-
if (value === "true") return true;
|
|
83165
|
-
if (value === "false") return false;
|
|
83166
|
-
throw new InvalidArgumentError(`${flagName} must be true or false`);
|
|
83167
|
-
};
|
|
83168
|
-
}
|
|
83169
|
-
function readJsonFlag(flagName, source) {
|
|
83170
|
-
const display = source === "-" ? "stdin" : source;
|
|
83171
|
-
let raw;
|
|
83172
|
-
try {
|
|
83173
|
-
raw = source === "-" ? (0, import_node_fs8.readFileSync)(0, "utf8") : (0, import_node_fs8.readFileSync)(source, "utf8");
|
|
83174
|
-
} catch (err) {
|
|
83175
|
-
throw new InvalidArgumentError(`${flagName}: could not read ${display} (${err.message})`);
|
|
83176
|
-
}
|
|
83177
|
-
const trimmed = raw.trim();
|
|
83178
|
-
if (trimmed === "") {
|
|
83179
|
-
throw new InvalidArgumentError(`${flagName}: ${display} is empty`);
|
|
83180
|
-
}
|
|
83181
|
-
try {
|
|
83182
|
-
return JSON.parse(trimmed);
|
|
83183
|
-
} catch (err) {
|
|
83184
|
-
throw new InvalidArgumentError(`${flagName}: not valid JSON (${err.message})`);
|
|
83185
|
-
}
|
|
83186
|
-
}
|
|
83187
|
-
|
|
83188
83215
|
// src/commands/tables/projection.ts
|
|
83189
83216
|
function projectCell(cell) {
|
|
83190
83217
|
if (cell.status === "success") {
|
|
@@ -83226,7 +83253,7 @@ function projectQueryResponse(response) {
|
|
|
83226
83253
|
}
|
|
83227
83254
|
|
|
83228
83255
|
// src/commands/tables/query.ts
|
|
83229
|
-
function
|
|
83256
|
+
function parseLimit(raw) {
|
|
83230
83257
|
const n = Number.parseInt(raw, 10);
|
|
83231
83258
|
if (!Number.isInteger(n) || String(n) !== raw.trim()) {
|
|
83232
83259
|
throw new InvalidArgumentError("must be an integer");
|
|
@@ -83255,7 +83282,7 @@ function buildQueryCommand() {
|
|
|
83255
83282
|
).requiredOption(
|
|
83256
83283
|
"--query <file|->",
|
|
83257
83284
|
"Path to a JSON file containing the structured query. Use - to read from stdin."
|
|
83258
|
-
).option("--limit <n>", "Max rows to return (1-100, default 50).",
|
|
83285
|
+
).option("--limit <n>", "Max rows to return (1-100, default 50).", parseLimit).option("--cursor <token>", "Resume from a previous response's `cursor` to fetch the next page.").addHelpText(
|
|
83259
83286
|
"after",
|
|
83260
83287
|
`
|
|
83261
83288
|
Output (success, exit 0):
|
|
@@ -83819,6 +83846,18 @@ var FetchSmartleadCampaignDayWiseAnalyticsRequest = external_exports.object({
|
|
|
83819
83846
|
campaign_ids: external_exports.string().optional()
|
|
83820
83847
|
})
|
|
83821
83848
|
});
|
|
83849
|
+
var FetchSmartleadCampaignsForClientIdRequest = external_exports.object({});
|
|
83850
|
+
var SmartleadCampaignListItem = external_exports.object({
|
|
83851
|
+
id: external_exports.number(),
|
|
83852
|
+
name: external_exports.string(),
|
|
83853
|
+
status: SmartleadCampaignStatusSchema,
|
|
83854
|
+
created_at: external_exports.string(),
|
|
83855
|
+
updated_at: external_exports.string(),
|
|
83856
|
+
send_as_plain_text: external_exports.boolean()
|
|
83857
|
+
});
|
|
83858
|
+
var FetchSmartleadCampaignsForClientIdResponse = external_exports.object({
|
|
83859
|
+
campaigns: external_exports.array(SmartleadCampaignListItem)
|
|
83860
|
+
});
|
|
83822
83861
|
var SmartleadMasterInboxReply = external_exports.object({
|
|
83823
83862
|
// An ID used to identify a specific email reply for a lead (e.g. to mark Unread/Read).
|
|
83824
83863
|
// This is the unique ID for a given reply in the master inbox.
|
|
@@ -83996,6 +84035,8 @@ var MutateSmartleadMasterInboxForwardEmailRequest = external_exports.object({
|
|
|
83996
84035
|
message_id: external_exports.string(),
|
|
83997
84036
|
stats_id: external_exports.string(),
|
|
83998
84037
|
to_emails: external_exports.string(),
|
|
84038
|
+
cc_emails: external_exports.string().optional(),
|
|
84039
|
+
bcc_emails: external_exports.string().optional(),
|
|
83999
84040
|
forward_email_subject: external_exports.string().optional(),
|
|
84000
84041
|
forward_email_body: external_exports.string().optional()
|
|
84001
84042
|
})
|
|
@@ -84384,7 +84425,9 @@ var ImageDataTypeSettings = external_exports.object({
|
|
|
84384
84425
|
lowercaseUrl: external_exports.boolean().optional()
|
|
84385
84426
|
});
|
|
84386
84427
|
var DateDataTypeSettings = external_exports.object({
|
|
84387
|
-
type: external_exports.literal("date" /* DATE */)
|
|
84428
|
+
type: external_exports.literal("date" /* DATE */),
|
|
84429
|
+
// 'date' stores a timezone-less calendar day (YYYY-MM-DD); 'datetime' (default) stores a UTC instant.
|
|
84430
|
+
precision: external_exports.enum(["date", "datetime"]).optional()
|
|
84388
84431
|
});
|
|
84389
84432
|
var SelectDataTypeSettings = external_exports.object({
|
|
84390
84433
|
type: external_exports.literal("select" /* SELECT */),
|
|
@@ -84693,6 +84736,7 @@ var ConditionalBinaryOperator = /* @__PURE__ */ ((ConditionalBinaryOperator2) =>
|
|
|
84693
84736
|
ConditionalBinaryOperator2["Before"] = "Before";
|
|
84694
84737
|
ConditionalBinaryOperator2["After"] = "After";
|
|
84695
84738
|
ConditionalBinaryOperator2["On"] = "On";
|
|
84739
|
+
ConditionalBinaryOperator2["SimilarTo"] = "SimilarTo";
|
|
84696
84740
|
ConditionalBinaryOperator2["Empty"] = "Empty";
|
|
84697
84741
|
ConditionalBinaryOperator2["NotEmpty"] = "NotEmpty";
|
|
84698
84742
|
return ConditionalBinaryOperator2;
|
|
@@ -84966,6 +85010,8 @@ var ActionFieldSettings = external_exports.object({
|
|
|
84966
85010
|
customRateLimitRules: RateLimitRulesV1.nullish(),
|
|
84967
85011
|
batchRunSettings: BatchRunSettings.optional(),
|
|
84968
85012
|
delaySettings: DelaySettings.nullish(),
|
|
85013
|
+
// `JAVASCRIPT_V1` is deprecated: its raw-JS evaluation path has been removed and no live cells use
|
|
85014
|
+
// it. The value is kept in the enum so stored field settings carrying it remain parseable
|
|
84969
85015
|
formulaEvaluationType: external_exports.enum(["JAVASCRIPT_V1", "LEGACY_CLAYSCRIPT"]).optional(),
|
|
84970
85016
|
inputsBinding: external_exports.array(InputsBinding).optional(),
|
|
84971
85017
|
optionalPathsInInputs: external_exports.record(external_exports.string(), external_exports.array(external_exports.union([external_exports.string(), external_exports.number()])).array()).optional(),
|
|
@@ -85192,6 +85238,7 @@ var SchedulePeriodUnit = /* @__PURE__ */ ((SchedulePeriodUnit2) => {
|
|
|
85192
85238
|
SchedulePeriodUnit2["Quarter"] = "quarterly";
|
|
85193
85239
|
return SchedulePeriodUnit2;
|
|
85194
85240
|
})(SchedulePeriodUnit || {});
|
|
85241
|
+
var SCHEDULE_PERIOD_UNITS = Object.values(SchedulePeriodUnit);
|
|
85195
85242
|
var ScheduleSettings = external_exports.object({
|
|
85196
85243
|
periodUnit: external_exports.nativeEnum(SchedulePeriodUnit),
|
|
85197
85244
|
periodAmount: external_exports.number().int().positive()
|
|
@@ -85850,6 +85897,15 @@ var FunctionUpdateToolInput = FunctionUpdateToolRequest.extend({
|
|
|
85850
85897
|
toolId: external_exports.string(),
|
|
85851
85898
|
outputFormat: MCPOutputFormat.optional()
|
|
85852
85899
|
});
|
|
85900
|
+
var EnrichmentUpsertToolRequest = UpsertToolBase.extend({
|
|
85901
|
+
type: external_exports.literal("enrichment"),
|
|
85902
|
+
actionPackageId: external_exports.string(),
|
|
85903
|
+
actionKey: external_exports.string(),
|
|
85904
|
+
appAccountId: external_exports.string().nullable().optional()
|
|
85905
|
+
});
|
|
85906
|
+
var EnrichmentUpdateToolRequest = UpdateToolBase.extend({
|
|
85907
|
+
type: external_exports.literal("enrichment")
|
|
85908
|
+
});
|
|
85853
85909
|
var EnrichmentCreateToolInput = external_exports.object({
|
|
85854
85910
|
workspaceId: external_exports.number(),
|
|
85855
85911
|
type: external_exports.literal("enrichment"),
|
|
@@ -85858,13 +85914,17 @@ var EnrichmentCreateToolInput = external_exports.object({
|
|
|
85858
85914
|
description: external_exports.string().max(500).nullable().optional(),
|
|
85859
85915
|
access: ToolAccess
|
|
85860
85916
|
});
|
|
85861
|
-
var
|
|
85917
|
+
var EnrichmentUpsertToolInput = UpsertToolBase.extend({
|
|
85918
|
+
type: external_exports.literal("enrichment"),
|
|
85862
85919
|
workspaceId: external_exports.number(),
|
|
85863
|
-
|
|
85864
|
-
|
|
85920
|
+
id: external_exports.string()
|
|
85921
|
+
});
|
|
85922
|
+
var EnrichmentUpdateToolInput = EnrichmentUpdateToolRequest.extend({
|
|
85923
|
+
workspaceId: external_exports.number(),
|
|
85924
|
+
toolId: external_exports.string()
|
|
85865
85925
|
});
|
|
85866
85926
|
var CreateToolInputSchema = external_exports.discriminatedUnion("type", [FunctionCreateToolInput, EnrichmentCreateToolInput]);
|
|
85867
|
-
var UpsertToolInputSchema = external_exports.discriminatedUnion("type", [FunctionUpsertToolInput]);
|
|
85927
|
+
var UpsertToolInputSchema = external_exports.discriminatedUnion("type", [FunctionUpsertToolInput, EnrichmentUpsertToolInput]);
|
|
85868
85928
|
var UpdateToolInputSchema = external_exports.discriminatedUnion("type", [FunctionUpdateToolInput, EnrichmentUpdateToolInput]);
|
|
85869
85929
|
|
|
85870
85930
|
// ../../libs/api-contract/src/public-api-v0/tools-contract.ts
|
|
@@ -85875,8 +85935,10 @@ var RunToolItemSchema = external_exports.object({
|
|
|
85875
85935
|
inputs: external_exports.record(external_exports.unknown())
|
|
85876
85936
|
});
|
|
85877
85937
|
var MAX_RUN_ITEMS = 100;
|
|
85938
|
+
var WEBHOOK_ID_DESCRIPTION = "ID of a registered Clay webhook to notify when the run finishes.";
|
|
85878
85939
|
var RunToolRequestSchema = external_exports.object({
|
|
85879
|
-
items: external_exports.array(RunToolItemSchema).min(1).max(MAX_RUN_ITEMS)
|
|
85940
|
+
items: external_exports.array(RunToolItemSchema).min(1).max(MAX_RUN_ITEMS),
|
|
85941
|
+
webhook_id: external_exports.string().min(1).max(MAX_ID_LENGTH).optional().describe(WEBHOOK_ID_DESCRIPTION)
|
|
85880
85942
|
});
|
|
85881
85943
|
var RunToolResponseSchema = external_exports.object({
|
|
85882
85944
|
tool_run_id: external_exports.string(),
|
|
@@ -85910,7 +85972,8 @@ var BatchUploadUrlResponseSchema = external_exports.object({
|
|
|
85910
85972
|
file_id: external_exports.string()
|
|
85911
85973
|
});
|
|
85912
85974
|
var StartBatchRequestSchema = external_exports.object({
|
|
85913
|
-
file_id: external_exports.string()
|
|
85975
|
+
file_id: external_exports.string(),
|
|
85976
|
+
webhook_id: external_exports.string().min(1).max(MAX_ID_LENGTH).optional().describe(WEBHOOK_ID_DESCRIPTION)
|
|
85914
85977
|
});
|
|
85915
85978
|
var StartBatchResponseSchema = external_exports.object({
|
|
85916
85979
|
tool_run_id: external_exports.string(),
|
|
@@ -86041,8 +86104,14 @@ var ToolAccess2 = external_exports.object({
|
|
|
86041
86104
|
integrations: external_exports.array(ToolSurface).transform((arr) => [...new Set(arr)])
|
|
86042
86105
|
});
|
|
86043
86106
|
var CreateToolRequestSchema = external_exports.discriminatedUnion("type", [FunctionCreateToolRequest]);
|
|
86044
|
-
var UpsertToolRequestSchema = external_exports.discriminatedUnion("type", [
|
|
86045
|
-
|
|
86107
|
+
var UpsertToolRequestSchema = external_exports.discriminatedUnion("type", [
|
|
86108
|
+
FunctionUpsertToolRequest,
|
|
86109
|
+
EnrichmentUpsertToolRequest
|
|
86110
|
+
]);
|
|
86111
|
+
var UpdateToolRequestSchema = external_exports.discriminatedUnion("type", [
|
|
86112
|
+
FunctionUpdateToolRequest,
|
|
86113
|
+
EnrichmentUpdateToolRequest
|
|
86114
|
+
]);
|
|
86046
86115
|
var ToolResponse = external_exports.object({
|
|
86047
86116
|
id: external_exports.string(),
|
|
86048
86117
|
type: ToolType,
|
|
@@ -86307,64 +86376,95 @@ function buildListCommand2() {
|
|
|
86307
86376
|
])
|
|
86308
86377
|
).option(
|
|
86309
86378
|
"--limit <n>",
|
|
86310
|
-
|
|
86311
|
-
|
|
86312
|
-
).addHelpText(
|
|
86379
|
+
`Max tools to return per page. Defaults to ${DEFAULT_PAGE_LIMIT}.`,
|
|
86380
|
+
parseLimitFlagWithMax(MAX_PAGE_LIMIT)
|
|
86381
|
+
).option("--cursor <token>", "Resume from a previous response's `cursor` to fetch the next page.").addHelpText(
|
|
86313
86382
|
"after",
|
|
86314
86383
|
`
|
|
86315
86384
|
Output (success, exit 0):
|
|
86316
86385
|
{
|
|
86317
86386
|
"data": [
|
|
86318
86387
|
{ "id": "function:tbl_abc", "name": <string>, "description": <string|null> }
|
|
86319
|
-
]
|
|
86388
|
+
],
|
|
86389
|
+
"cursor": <string|undefined>
|
|
86320
86390
|
}
|
|
86321
86391
|
|
|
86322
86392
|
${TOOL_INTEGRATION_VALUES_HELP}
|
|
86323
86393
|
|
|
86394
|
+
Pagination:
|
|
86395
|
+
--limit <n> max tools per call. Defaults to ${DEFAULT_PAGE_LIMIT}.
|
|
86396
|
+
--cursor <token> resume from a previous response's \`cursor\`
|
|
86397
|
+
When more results exist, the response includes a top-level \`cursor\`; pass it back via
|
|
86398
|
+
--cursor to fetch the next page.
|
|
86399
|
+
|
|
86324
86400
|
Common errors:
|
|
86325
|
-
|
|
86401
|
+
validation_error (exit 2) --limit is not a positive integer or exceeds ${MAX_PAGE_LIMIT}.
|
|
86402
|
+
auth_forbidden (exit 3) Key lacks the cli:all scope (or 'all').
|
|
86326
86403
|
|
|
86327
86404
|
Examples:
|
|
86328
86405
|
$ clay tools list
|
|
86329
86406
|
$ clay tools list --integration api
|
|
86330
86407
|
$ clay tools list --integration mcp
|
|
86331
86408
|
$ clay tools list --limit 10 | jq -r '.data[].id'
|
|
86409
|
+
$ clay tools list --limit 10 --cursor "$CURSOR"
|
|
86332
86410
|
`
|
|
86333
86411
|
).action(async (opts) => {
|
|
86334
86412
|
const workspaceId = await currentWorkspaceId();
|
|
86335
86413
|
const client = await v3Client(toolsContract);
|
|
86336
|
-
const
|
|
86337
|
-
|
|
86338
|
-
|
|
86339
|
-
|
|
86340
|
-
|
|
86341
|
-
|
|
86342
|
-
|
|
86343
|
-
|
|
86344
|
-
|
|
86345
|
-
|
|
86346
|
-
...pager.cursor !== void 0 ? { cursor: pager.cursor } : {},
|
|
86347
|
-
limit: pageSize
|
|
86348
|
-
}
|
|
86349
|
-
})
|
|
86350
|
-
);
|
|
86351
|
-
accumulated.push(...result.data);
|
|
86352
|
-
if (result.cursor === void 0) break;
|
|
86353
|
-
if (opts.limit !== void 0 && accumulated.length >= opts.limit) break;
|
|
86354
|
-
pager.advance(result.cursor, result.data.length);
|
|
86355
|
-
}
|
|
86356
|
-
const trimmed = opts.limit === void 0 ? accumulated : accumulated.slice(0, opts.limit);
|
|
86414
|
+
const result = await unwrap(
|
|
86415
|
+
client.listTools({
|
|
86416
|
+
params: { workspaceId },
|
|
86417
|
+
query: {
|
|
86418
|
+
integration: opts.integration,
|
|
86419
|
+
cursor: opts.cursor,
|
|
86420
|
+
limit: opts.limit ?? DEFAULT_PAGE_LIMIT
|
|
86421
|
+
}
|
|
86422
|
+
})
|
|
86423
|
+
);
|
|
86357
86424
|
writeJson({
|
|
86358
|
-
data:
|
|
86425
|
+
data: result.data.map((tool) => ({
|
|
86359
86426
|
id: tool.id,
|
|
86360
86427
|
name: tool.name,
|
|
86361
86428
|
description: tool.description
|
|
86362
|
-
}))
|
|
86429
|
+
})),
|
|
86430
|
+
cursor: result.cursor
|
|
86363
86431
|
});
|
|
86364
86432
|
});
|
|
86365
86433
|
return cmd;
|
|
86366
86434
|
}
|
|
86367
86435
|
|
|
86436
|
+
// src/commands/pagination.ts
|
|
86437
|
+
var MAX_AUTO_PAGINATE_ITEMS = 1e4;
|
|
86438
|
+
var MAX_AUTO_PAGINATE_PAGES = 500;
|
|
86439
|
+
var CursorPager = class {
|
|
86440
|
+
currentCursor;
|
|
86441
|
+
itemsFetched = 0;
|
|
86442
|
+
pagesFetched = 1;
|
|
86443
|
+
get cursor() {
|
|
86444
|
+
return this.currentCursor;
|
|
86445
|
+
}
|
|
86446
|
+
advance(nextCursor, pageItemCount) {
|
|
86447
|
+
if (nextCursor === this.currentCursor) {
|
|
86448
|
+
throw new IncompatibleApiServerError(
|
|
86449
|
+
"Clay API returned the same pagination cursor twice in a row; aborting auto-pagination."
|
|
86450
|
+
);
|
|
86451
|
+
}
|
|
86452
|
+
this.itemsFetched += pageItemCount;
|
|
86453
|
+
this.pagesFetched += 1;
|
|
86454
|
+
if (this.itemsFetched >= MAX_AUTO_PAGINATE_ITEMS) {
|
|
86455
|
+
throw new IncompatibleApiServerError(
|
|
86456
|
+
`Auto-pagination stopped after ${MAX_AUTO_PAGINATE_ITEMS} items without reaching the end of the result set; narrow the request to fetch fewer rows.`
|
|
86457
|
+
);
|
|
86458
|
+
}
|
|
86459
|
+
if (this.pagesFetched >= MAX_AUTO_PAGINATE_PAGES) {
|
|
86460
|
+
throw new IncompatibleApiServerError(
|
|
86461
|
+
`Clay API returned ${MAX_AUTO_PAGINATE_PAGES} pages without reaching the end of the result set; aborting auto-pagination.`
|
|
86462
|
+
);
|
|
86463
|
+
}
|
|
86464
|
+
this.currentCursor = nextCursor;
|
|
86465
|
+
}
|
|
86466
|
+
};
|
|
86467
|
+
|
|
86368
86468
|
// src/commands/tools/runs/projection.ts
|
|
86369
86469
|
function projectInlineStart(response) {
|
|
86370
86470
|
return {
|
|
@@ -86544,9 +86644,9 @@ function buildListCommand3() {
|
|
|
86544
86644
|
const cmd = new Command("list");
|
|
86545
86645
|
cmd.description("List recent async tool runs and their statuses.").option(
|
|
86546
86646
|
"--limit <n>",
|
|
86547
|
-
|
|
86548
|
-
|
|
86549
|
-
).addHelpText(
|
|
86647
|
+
`Max runs to return per page. Defaults to ${DEFAULT_PAGE_LIMIT}.`,
|
|
86648
|
+
parseLimitFlagWithMax(MAX_PAGE_LIMIT)
|
|
86649
|
+
).option("--cursor <token>", "Resume from a previous response's `cursor` to fetch the next page.").addHelpText(
|
|
86550
86650
|
"after",
|
|
86551
86651
|
`
|
|
86552
86652
|
Output (success, exit 0):
|
|
@@ -86559,49 +86659,48 @@ Output (success, exit 0):
|
|
|
86559
86659
|
"total": <number>,
|
|
86560
86660
|
"finished": <number>
|
|
86561
86661
|
}
|
|
86562
|
-
]
|
|
86662
|
+
],
|
|
86663
|
+
"cursor": <string|undefined>
|
|
86563
86664
|
}
|
|
86564
86665
|
|
|
86666
|
+
Pagination:
|
|
86667
|
+
--limit <n> max runs per call. Defaults to ${DEFAULT_PAGE_LIMIT}.
|
|
86668
|
+
--cursor <token> resume from a previous response's \`cursor\`
|
|
86669
|
+
When more results exist, the response includes a top-level \`cursor\`; pass it back via
|
|
86670
|
+
--cursor to fetch the next page.
|
|
86671
|
+
|
|
86565
86672
|
Common errors:
|
|
86566
|
-
|
|
86673
|
+
validation_error (exit 2) --limit is not a positive integer or exceeds ${MAX_PAGE_LIMIT}.
|
|
86674
|
+
auth_forbidden (exit 3) Key lacks the cli:all scope (or 'all').
|
|
86567
86675
|
|
|
86568
86676
|
Examples:
|
|
86569
86677
|
$ clay tools runs list
|
|
86570
86678
|
$ clay tools runs list --limit 10 | jq -r '.data[].toolRunId'
|
|
86679
|
+
$ clay tools runs list --limit 10 --cursor "$CURSOR"
|
|
86571
86680
|
$ clay tools runs list | jq '.data[] | select(.status == "in_progress")'
|
|
86572
86681
|
`
|
|
86573
86682
|
).action(async (opts) => {
|
|
86574
86683
|
const workspaceId = await currentWorkspaceId();
|
|
86575
86684
|
const client = await v3Client(toolsContract);
|
|
86576
|
-
const
|
|
86577
|
-
|
|
86578
|
-
|
|
86579
|
-
|
|
86580
|
-
|
|
86581
|
-
|
|
86582
|
-
|
|
86583
|
-
|
|
86584
|
-
|
|
86585
|
-
...pager.cursor !== void 0 ? { cursor: pager.cursor } : {},
|
|
86586
|
-
limit: pageSize
|
|
86587
|
-
}
|
|
86588
|
-
})
|
|
86589
|
-
);
|
|
86590
|
-
accumulated.push(...result.data);
|
|
86591
|
-
if (result.cursor === void 0) break;
|
|
86592
|
-
if (opts.limit !== void 0 && accumulated.length >= opts.limit) break;
|
|
86593
|
-
pager.advance(result.cursor, result.data.length);
|
|
86594
|
-
}
|
|
86595
|
-
const trimmed = opts.limit === void 0 ? accumulated : accumulated.slice(0, opts.limit);
|
|
86685
|
+
const result = await unwrap(
|
|
86686
|
+
client.listToolRuns({
|
|
86687
|
+
params: { workspaceId },
|
|
86688
|
+
query: {
|
|
86689
|
+
cursor: opts.cursor,
|
|
86690
|
+
limit: opts.limit ?? DEFAULT_PAGE_LIMIT
|
|
86691
|
+
}
|
|
86692
|
+
})
|
|
86693
|
+
);
|
|
86596
86694
|
writeJson({
|
|
86597
|
-
data:
|
|
86695
|
+
data: result.data.map(projectRunListItem),
|
|
86696
|
+
cursor: result.cursor
|
|
86598
86697
|
});
|
|
86599
86698
|
});
|
|
86600
86699
|
return cmd;
|
|
86601
86700
|
}
|
|
86602
86701
|
|
|
86603
86702
|
// src/commands/tools/runs/input.ts
|
|
86604
|
-
var
|
|
86703
|
+
var import_node_fs10 = require("fs");
|
|
86605
86704
|
function readRunToolRequest(source) {
|
|
86606
86705
|
const raw = readUtf8Source("--input", source);
|
|
86607
86706
|
let parsed;
|
|
@@ -86610,7 +86709,7 @@ function readRunToolRequest(source) {
|
|
|
86610
86709
|
} catch (err) {
|
|
86611
86710
|
throw new InvalidArgumentError(`--input: not valid JSON (${err.message})`);
|
|
86612
86711
|
}
|
|
86613
|
-
const request2 = RunToolRequestSchema.safeParse(parsed);
|
|
86712
|
+
const request2 = RunToolRequestSchema.pick({ items: true }).safeParse(parsed);
|
|
86614
86713
|
if (!request2.success) {
|
|
86615
86714
|
const issue = request2.error.issues[0];
|
|
86616
86715
|
const path7 = issue?.path.length ? ` at ${issue.path.join(".")}` : "";
|
|
@@ -86624,7 +86723,7 @@ function readRunToolRequest(source) {
|
|
|
86624
86723
|
function readJsonlFile(source) {
|
|
86625
86724
|
let buf;
|
|
86626
86725
|
try {
|
|
86627
|
-
buf = (0,
|
|
86726
|
+
buf = (0, import_node_fs10.readFileSync)(source);
|
|
86628
86727
|
} catch (err) {
|
|
86629
86728
|
throw new InvalidArgumentError(`--bulk: could not read ${source} (${err.message})`);
|
|
86630
86729
|
}
|
|
@@ -86665,7 +86764,7 @@ function validateJsonl(buf) {
|
|
|
86665
86764
|
function readUtf8Source(flagName, source) {
|
|
86666
86765
|
const display = source === "-" ? "stdin" : source;
|
|
86667
86766
|
try {
|
|
86668
|
-
return source === "-" ? (0,
|
|
86767
|
+
return source === "-" ? (0, import_node_fs10.readFileSync)(0, "utf8") : (0, import_node_fs10.readFileSync)(source, "utf8");
|
|
86669
86768
|
} catch (err) {
|
|
86670
86769
|
throw new InvalidArgumentError(`${flagName}: could not read ${display} (${err.message})`);
|
|
86671
86770
|
}
|
|
@@ -86676,7 +86775,7 @@ function buildStartCommand() {
|
|
|
86676
86775
|
const cmd = new Command("start");
|
|
86677
86776
|
cmd.description(
|
|
86678
86777
|
"Start an async tool run through the API & CLI integration. Returns immediately; this command does not poll or wait."
|
|
86679
|
-
).argument("<toolId>", "Tool id, e.g. function:tbl_abc123").option("--input <file|->", "Inline run body JSON. Use - to read from stdin.").option("--bulk <file.jsonl>", 'Batch run input JSONL file. Each line is { "id": <string>, "inputs": <object> }.').addHelpText(
|
|
86778
|
+
).argument("<toolId>", "Tool id, e.g. function:tbl_abc123").option("--input <file|->", "Inline run body JSON. Use - to read from stdin.").option("--bulk <file.jsonl>", 'Batch run input JSONL file. Each line is { "id": <string>, "inputs": <object> }.').option("--webhook-id <id>", "Registered webhook id (wh_...) to notify when the run finishes.").addHelpText(
|
|
86680
86779
|
"after",
|
|
86681
86780
|
`
|
|
86682
86781
|
Output (success, exit 0):
|
|
@@ -86700,7 +86799,9 @@ Examples:
|
|
|
86700
86799
|
$ clay tools update function:tbl_x --integrations api
|
|
86701
86800
|
$ cat input.json | clay tools runs start function:tbl_x --input -
|
|
86702
86801
|
$ clay tools runs start function:tbl_x --input input.json | jq -r '.toolRunId'
|
|
86802
|
+
$ clay tools runs start function:tbl_x --input input.json --webhook-id wh_abc123 | jq -r '.toolRunId'
|
|
86703
86803
|
$ clay tools runs start function:tbl_x --bulk rows.jsonl
|
|
86804
|
+
$ clay tools runs start function:tbl_x --bulk rows.jsonl --webhook-id wh_abc123
|
|
86704
86805
|
`
|
|
86705
86806
|
).action(async (toolId, opts) => {
|
|
86706
86807
|
const hasInput = opts.input !== void 0;
|
|
@@ -86711,6 +86812,7 @@ Examples:
|
|
|
86711
86812
|
const client = await publicApiClient(publicApiToolsContract);
|
|
86712
86813
|
if (opts.input !== void 0) {
|
|
86713
86814
|
const body2 = readRunToolRequest(opts.input);
|
|
86815
|
+
body2.webhook_id = opts.webhookId;
|
|
86714
86816
|
const response2 = await unwrap(client.runTool({ params: { tool_id: toolId }, body: body2 }));
|
|
86715
86817
|
writeJson(projectInlineStart(response2));
|
|
86716
86818
|
return;
|
|
@@ -86722,7 +86824,10 @@ Examples:
|
|
|
86722
86824
|
const upload = await unwrap(client.runToolBatchUploadUrl({ params: { tool_id: toolId } }));
|
|
86723
86825
|
await uploadJsonl(upload.upload_url, body);
|
|
86724
86826
|
const response = await unwrap(
|
|
86725
|
-
client.startToolRunBatch({
|
|
86827
|
+
client.startToolRunBatch({
|
|
86828
|
+
params: { tool_id: toolId },
|
|
86829
|
+
body: { file_id: upload.file_id, webhook_id: opts.webhookId }
|
|
86830
|
+
})
|
|
86726
86831
|
);
|
|
86727
86832
|
writeJson(projectBulkStart(response, upload.file_id));
|
|
86728
86833
|
});
|
|
@@ -86851,6 +86956,9 @@ Subcommands:
|
|
|
86851
86956
|
update Update name, description, entity-type, or integrations.
|
|
86852
86957
|
runs Start async tool runs and fetch run status/results.
|
|
86853
86958
|
|
|
86959
|
+
These are workspace function tools. For workflow building blocks (actions you add
|
|
86960
|
+
to a node\u2019s "tools"), see \`clay workflows actions\` instead.
|
|
86961
|
+
|
|
86854
86962
|
See \`clay tools <subcommand> --help\` for per-subcommand JSON shape, error codes, and examples.
|
|
86855
86963
|
`
|
|
86856
86964
|
);
|
|
@@ -86861,6 +86969,277 @@ See \`clay tools <subcommand> --help\` for per-subcommand JSON shape, error code
|
|
|
86861
86969
|
program3.addCommand(tools);
|
|
86862
86970
|
}
|
|
86863
86971
|
|
|
86972
|
+
// ../../libs/api-contract/src/webhooks/contract.ts
|
|
86973
|
+
var WebhookSummary = external_exports.object({
|
|
86974
|
+
id: external_exports.string(),
|
|
86975
|
+
url: external_exports.string(),
|
|
86976
|
+
createdAt: external_exports.string()
|
|
86977
|
+
});
|
|
86978
|
+
var WebhookCreatedResponse = WebhookSummary.extend({
|
|
86979
|
+
signingSecret: external_exports.string()
|
|
86980
|
+
});
|
|
86981
|
+
var ListWebhooksResponse = external_exports.object({
|
|
86982
|
+
data: external_exports.array(WebhookSummary),
|
|
86983
|
+
cursor: external_exports.string().nullable()
|
|
86984
|
+
});
|
|
86985
|
+
var WebhookTestResult = external_exports.object({
|
|
86986
|
+
id: external_exports.string(),
|
|
86987
|
+
status: external_exports.enum(["success", "failed"]),
|
|
86988
|
+
statusCode: external_exports.number().int().optional()
|
|
86989
|
+
});
|
|
86990
|
+
var CreateWebhookBody = external_exports.object({
|
|
86991
|
+
url: external_exports.string().url()
|
|
86992
|
+
});
|
|
86993
|
+
var webhooksContract = {
|
|
86994
|
+
createWebhook: {
|
|
86995
|
+
method: "POST",
|
|
86996
|
+
path: "/workspaces/:workspaceId/webhooks",
|
|
86997
|
+
pathParams: external_exports.object({
|
|
86998
|
+
workspaceId: external_exports.string()
|
|
86999
|
+
}),
|
|
87000
|
+
body: CreateWebhookBody,
|
|
87001
|
+
responses: {
|
|
87002
|
+
201: WebhookCreatedResponse
|
|
87003
|
+
},
|
|
87004
|
+
summary: "Create a webhook for a workspace; returns the signing secret once",
|
|
87005
|
+
metadata: { team: "rep-tools" /* RepTools */ }
|
|
87006
|
+
},
|
|
87007
|
+
listWebhooks: {
|
|
87008
|
+
method: "GET",
|
|
87009
|
+
path: "/workspaces/:workspaceId/webhooks",
|
|
87010
|
+
pathParams: external_exports.object({
|
|
87011
|
+
workspaceId: external_exports.string()
|
|
87012
|
+
}),
|
|
87013
|
+
query: external_exports.object({
|
|
87014
|
+
cursor: external_exports.string().optional(),
|
|
87015
|
+
limit: external_exports.coerce.number().int().positive().max(200).optional()
|
|
87016
|
+
}),
|
|
87017
|
+
responses: {
|
|
87018
|
+
200: ListWebhooksResponse
|
|
87019
|
+
},
|
|
87020
|
+
summary: "List active webhooks for a workspace (cursor-paginated, newest first)",
|
|
87021
|
+
metadata: { team: "rep-tools" /* RepTools */ }
|
|
87022
|
+
},
|
|
87023
|
+
deleteWebhook: {
|
|
87024
|
+
method: "DELETE",
|
|
87025
|
+
path: "/workspaces/:workspaceId/webhooks/:webhookId",
|
|
87026
|
+
pathParams: external_exports.object({
|
|
87027
|
+
workspaceId: external_exports.string(),
|
|
87028
|
+
webhookId: external_exports.string()
|
|
87029
|
+
}),
|
|
87030
|
+
body: external_exports.object({}),
|
|
87031
|
+
responses: {
|
|
87032
|
+
200: external_exports.object({ success: external_exports.literal(true) }),
|
|
87033
|
+
404: external_exports.object({ message: external_exports.string() })
|
|
87034
|
+
},
|
|
87035
|
+
summary: "Soft-delete a webhook",
|
|
87036
|
+
metadata: { team: "rep-tools" /* RepTools */ }
|
|
87037
|
+
},
|
|
87038
|
+
testWebhook: {
|
|
87039
|
+
method: "POST",
|
|
87040
|
+
path: "/workspaces/:workspaceId/webhooks/:webhookId/test",
|
|
87041
|
+
pathParams: external_exports.object({
|
|
87042
|
+
workspaceId: external_exports.string(),
|
|
87043
|
+
webhookId: external_exports.string()
|
|
87044
|
+
}),
|
|
87045
|
+
body: external_exports.object({}),
|
|
87046
|
+
responses: {
|
|
87047
|
+
200: WebhookTestResult,
|
|
87048
|
+
404: external_exports.object({ message: external_exports.string() })
|
|
87049
|
+
},
|
|
87050
|
+
summary: "Send a signed test event to a webhook and report the delivery outcome",
|
|
87051
|
+
metadata: { team: "rep-tools" /* RepTools */ }
|
|
87052
|
+
}
|
|
87053
|
+
};
|
|
87054
|
+
|
|
87055
|
+
// src/commands/webhooks/create.ts
|
|
87056
|
+
function buildCreateCommand() {
|
|
87057
|
+
const cmd = new Command("create");
|
|
87058
|
+
cmd.description(
|
|
87059
|
+
"Create a webhook. The signing secret is returned exactly once \u2014 capture it now; it can never be read again."
|
|
87060
|
+
).argument("<url>", "HTTPS endpoint that will receive signed webhook deliveries.").addHelpText(
|
|
87061
|
+
"after",
|
|
87062
|
+
`
|
|
87063
|
+
Output (success, exit 0):
|
|
87064
|
+
{
|
|
87065
|
+
"id": <string>,
|
|
87066
|
+
"url": <string>,
|
|
87067
|
+
"createdAt": <string>,
|
|
87068
|
+
"signingSecret": <string>
|
|
87069
|
+
}
|
|
87070
|
+
|
|
87071
|
+
Common errors:
|
|
87072
|
+
validation_error (exit 2) <url> is not a valid URL.
|
|
87073
|
+
auth_forbidden (exit 3) Key lacks permission to manage webhooks.
|
|
87074
|
+
not_found (exit 6) Webhooks are not enabled for this workspace.
|
|
87075
|
+
|
|
87076
|
+
Examples:
|
|
87077
|
+
$ clay webhooks create https://example.com/hooks/clay
|
|
87078
|
+
$ clay webhooks create https://example.com/hooks/clay | jq -r '.signingSecret'
|
|
87079
|
+
`
|
|
87080
|
+
).action(async (url) => {
|
|
87081
|
+
const workspaceId = await currentWorkspaceId();
|
|
87082
|
+
const client = await v3Client(webhooksContract);
|
|
87083
|
+
const webhook = await unwrap(client.createWebhook({ params: { workspaceId }, body: { url } }));
|
|
87084
|
+
writeJson({
|
|
87085
|
+
id: webhook.id,
|
|
87086
|
+
url: webhook.url,
|
|
87087
|
+
createdAt: webhook.createdAt,
|
|
87088
|
+
signingSecret: webhook.signingSecret
|
|
87089
|
+
});
|
|
87090
|
+
});
|
|
87091
|
+
return cmd;
|
|
87092
|
+
}
|
|
87093
|
+
|
|
87094
|
+
// src/commands/webhooks/delete.ts
|
|
87095
|
+
function buildDeleteCommand() {
|
|
87096
|
+
const cmd = new Command("delete");
|
|
87097
|
+
cmd.description("Delete a webhook by id").argument("<webhookId>", "Webhook id, e.g. the `id` returned by `clay webhooks list`.").addHelpText(
|
|
87098
|
+
"after",
|
|
87099
|
+
`
|
|
87100
|
+
Output (success, exit 0):
|
|
87101
|
+
{ "ok": true }
|
|
87102
|
+
|
|
87103
|
+
Common errors:
|
|
87104
|
+
auth_forbidden (exit 3) Key lacks permission to manage webhooks.
|
|
87105
|
+
not_found (exit 6) No webhook with that id in this workspace.
|
|
87106
|
+
|
|
87107
|
+
Examples:
|
|
87108
|
+
$ clay webhooks delete whk_abc123
|
|
87109
|
+
$ clay webhooks list | jq -r '.data[0].id' | xargs clay webhooks delete
|
|
87110
|
+
`
|
|
87111
|
+
).action(async (webhookId) => {
|
|
87112
|
+
const workspaceId = await currentWorkspaceId();
|
|
87113
|
+
const client = await v3Client(webhooksContract);
|
|
87114
|
+
await unwrap(client.deleteWebhook({ params: { workspaceId, webhookId }, body: {} }));
|
|
87115
|
+
writeJson({ ok: true });
|
|
87116
|
+
});
|
|
87117
|
+
return cmd;
|
|
87118
|
+
}
|
|
87119
|
+
|
|
87120
|
+
// src/commands/webhooks/list.ts
|
|
87121
|
+
function buildListCommand4() {
|
|
87122
|
+
const cmd = new Command("list");
|
|
87123
|
+
cmd.description("List active webhooks with the most recently created first").option("--limit <n>", "Max webhooks to return per page (1-200, default 50).", parseLimitFlag).option("--cursor <token>", "Resume from a previous response's `cursor` to fetch the next page.").addHelpText(
|
|
87124
|
+
"after",
|
|
87125
|
+
`
|
|
87126
|
+
Output (success, exit 0):
|
|
87127
|
+
{
|
|
87128
|
+
"data": [
|
|
87129
|
+
{
|
|
87130
|
+
"id": <string>,
|
|
87131
|
+
"url": <string>,
|
|
87132
|
+
"createdAt": <string>
|
|
87133
|
+
}
|
|
87134
|
+
],
|
|
87135
|
+
"cursor": <string|undefined>
|
|
87136
|
+
}
|
|
87137
|
+
|
|
87138
|
+
Pagination:
|
|
87139
|
+
Page size and position are flags:
|
|
87140
|
+
--limit <n> max webhooks per call (1-200, default 50)
|
|
87141
|
+
--cursor <token> resume from a previous response's \`cursor\`
|
|
87142
|
+
When more results exist, the response includes a top-level \`cursor\`; pass it back via
|
|
87143
|
+
--cursor to fetch the next page.
|
|
87144
|
+
|
|
87145
|
+
Common errors:
|
|
87146
|
+
validation_error (exit 2) --limit is not a positive integer.
|
|
87147
|
+
auth_forbidden (exit 3) Key lacks permission to manage webhooks.
|
|
87148
|
+
not_found (exit 6) Webhooks are not enabled for this workspace.
|
|
87149
|
+
|
|
87150
|
+
Examples:
|
|
87151
|
+
$ clay webhooks list
|
|
87152
|
+
$ clay webhooks list --limit 100 | jq -r '.data[].url'
|
|
87153
|
+
$ clay webhooks list --limit 100 --cursor "$CURSOR"
|
|
87154
|
+
`
|
|
87155
|
+
).action(async (opts) => {
|
|
87156
|
+
const workspaceId = await currentWorkspaceId();
|
|
87157
|
+
const client = await v3Client(webhooksContract);
|
|
87158
|
+
const page = await unwrap(
|
|
87159
|
+
client.listWebhooks({
|
|
87160
|
+
params: { workspaceId },
|
|
87161
|
+
query: {
|
|
87162
|
+
limit: opts.limit,
|
|
87163
|
+
cursor: opts.cursor
|
|
87164
|
+
}
|
|
87165
|
+
})
|
|
87166
|
+
);
|
|
87167
|
+
writeJson({
|
|
87168
|
+
data: page.data.map((w) => ({
|
|
87169
|
+
id: w.id,
|
|
87170
|
+
url: w.url,
|
|
87171
|
+
createdAt: w.createdAt
|
|
87172
|
+
})),
|
|
87173
|
+
...page.cursor === null ? {} : { cursor: page.cursor }
|
|
87174
|
+
});
|
|
87175
|
+
});
|
|
87176
|
+
return cmd;
|
|
87177
|
+
}
|
|
87178
|
+
|
|
87179
|
+
// src/commands/webhooks/test.ts
|
|
87180
|
+
function buildTestCommand() {
|
|
87181
|
+
const cmd = new Command("test");
|
|
87182
|
+
cmd.description("Send a signed test event to a webhook and report the delivery outcome.").argument("<webhookId>", "Webhook id, e.g. the `id` returned by `clay webhooks list`.").addHelpText(
|
|
87183
|
+
"after",
|
|
87184
|
+
`
|
|
87185
|
+
Output (success, exit 0):
|
|
87186
|
+
{
|
|
87187
|
+
"id": <string>,
|
|
87188
|
+
"status": "success" | "failed",
|
|
87189
|
+
"statusCode": <number|undefined>
|
|
87190
|
+
}
|
|
87191
|
+
|
|
87192
|
+
status values:
|
|
87193
|
+
success The endpoint accepted the delivery (2xx response).
|
|
87194
|
+
failed The endpoint rejected the delivery or was unreachable.
|
|
87195
|
+
|
|
87196
|
+
Common errors:
|
|
87197
|
+
auth_forbidden (exit 3) Key lacks permission to manage webhooks.
|
|
87198
|
+
not_found (exit 6) No webhook with that id in this workspace.
|
|
87199
|
+
|
|
87200
|
+
Examples:
|
|
87201
|
+
$ clay webhooks test whk_abc123
|
|
87202
|
+
$ clay webhooks test whk_abc123 | jq -r '.status'
|
|
87203
|
+
`
|
|
87204
|
+
).action(async (webhookId) => {
|
|
87205
|
+
const workspaceId = await currentWorkspaceId();
|
|
87206
|
+
const client = await v3Client(webhooksContract);
|
|
87207
|
+
const result = await unwrap(client.testWebhook({ params: { workspaceId, webhookId }, body: {} }));
|
|
87208
|
+
writeJson({
|
|
87209
|
+
id: result.id,
|
|
87210
|
+
status: result.status,
|
|
87211
|
+
...result.statusCode === void 0 ? {} : { statusCode: result.statusCode }
|
|
87212
|
+
});
|
|
87213
|
+
});
|
|
87214
|
+
return cmd;
|
|
87215
|
+
}
|
|
87216
|
+
|
|
87217
|
+
// src/commands/webhooks/index.ts
|
|
87218
|
+
function registerWebhooks(program3) {
|
|
87219
|
+
const webhooks = applyClaySettings(
|
|
87220
|
+
new Command("webhooks").description(
|
|
87221
|
+
"Manage webhooks in the authenticated workspace. Subcommands: create, list, delete, test."
|
|
87222
|
+
)
|
|
87223
|
+
);
|
|
87224
|
+
webhooks.addHelpText(
|
|
87225
|
+
"after",
|
|
87226
|
+
`
|
|
87227
|
+
Subcommands:
|
|
87228
|
+
create Create a webhook; returns the signing secret exactly once.
|
|
87229
|
+
list List active webhooks in the workspace (newest first).
|
|
87230
|
+
delete Delete a webhook by id.
|
|
87231
|
+
test Send a signed test event to a webhook and report the outcome.
|
|
87232
|
+
|
|
87233
|
+
See \`clay webhooks <subcommand> --help\` for per-subcommand JSON shape, error codes, and examples.
|
|
87234
|
+
`
|
|
87235
|
+
);
|
|
87236
|
+
webhooks.addCommand(applyClaySettings(buildCreateCommand()));
|
|
87237
|
+
webhooks.addCommand(applyClaySettings(buildListCommand4()));
|
|
87238
|
+
webhooks.addCommand(applyClaySettings(buildDeleteCommand()));
|
|
87239
|
+
webhooks.addCommand(applyClaySettings(buildTestCommand()));
|
|
87240
|
+
program3.addCommand(webhooks);
|
|
87241
|
+
}
|
|
87242
|
+
|
|
86864
87243
|
// src/commands/whoami.ts
|
|
86865
87244
|
function registerWhoami(program3) {
|
|
86866
87245
|
program3.command("whoami").description(
|
|
@@ -86898,6 +87277,204 @@ Examples:
|
|
|
86898
87277
|
});
|
|
86899
87278
|
}
|
|
86900
87279
|
|
|
87280
|
+
// ../../libs/api-contract/src/terracotta/clay-actions/contract.ts
|
|
87281
|
+
var terracottaClayActionsContract = {
|
|
87282
|
+
getClayActions: {
|
|
87283
|
+
method: "GET",
|
|
87284
|
+
path: "/workspaces/:workspaceId/tc-clay-actions",
|
|
87285
|
+
pathParams: external_exports.object({
|
|
87286
|
+
workspaceId: external_exports.string()
|
|
87287
|
+
}),
|
|
87288
|
+
responses: {
|
|
87289
|
+
// Returns raw JSON array of action objects — no strict schema since
|
|
87290
|
+
// the shape comes from the clay_actions.json catalog file
|
|
87291
|
+
200: external_exports.unknown()
|
|
87292
|
+
},
|
|
87293
|
+
summary: "Get filtered and annotated Clay actions catalog for a workspace",
|
|
87294
|
+
metadata: { team: "workflows" /* Workflows */ }
|
|
87295
|
+
},
|
|
87296
|
+
getClayActionSchema: {
|
|
87297
|
+
method: "GET",
|
|
87298
|
+
path: "/workspaces/:workspaceId/tc-clay-action-schemas/:packageId/:actionKey",
|
|
87299
|
+
pathParams: external_exports.object({
|
|
87300
|
+
workspaceId: external_exports.string(),
|
|
87301
|
+
packageId: external_exports.string(),
|
|
87302
|
+
actionKey: external_exports.string()
|
|
87303
|
+
}),
|
|
87304
|
+
responses: {
|
|
87305
|
+
200: external_exports.unknown(),
|
|
87306
|
+
404: external_exports.object({ error: external_exports.string() })
|
|
87307
|
+
},
|
|
87308
|
+
summary: "Get input schema for a specific Clay action by packageId and actionKey",
|
|
87309
|
+
metadata: { team: "workflows" /* Workflows */ }
|
|
87310
|
+
}
|
|
87311
|
+
};
|
|
87312
|
+
|
|
87313
|
+
// src/commands/workflows/actions/projection.ts
|
|
87314
|
+
var ACTION_FIELDS = [
|
|
87315
|
+
"type",
|
|
87316
|
+
"actionKey",
|
|
87317
|
+
"functionId",
|
|
87318
|
+
"name",
|
|
87319
|
+
"displayName",
|
|
87320
|
+
"description",
|
|
87321
|
+
"packageId",
|
|
87322
|
+
"packageDisplayName",
|
|
87323
|
+
"packageDescription",
|
|
87324
|
+
"documentationUri",
|
|
87325
|
+
"categories",
|
|
87326
|
+
"actionLabels",
|
|
87327
|
+
"creditCost",
|
|
87328
|
+
"usesPrivateKeyCost",
|
|
87329
|
+
"paymentType",
|
|
87330
|
+
"outputParameters",
|
|
87331
|
+
"dataStrengths",
|
|
87332
|
+
"whyUseful",
|
|
87333
|
+
"useCaseExamples",
|
|
87334
|
+
"providerDescription",
|
|
87335
|
+
"clayUseCase",
|
|
87336
|
+
"configuredTools",
|
|
87337
|
+
"availableAppAccounts",
|
|
87338
|
+
"priorityTier"
|
|
87339
|
+
];
|
|
87340
|
+
function isObject6(value) {
|
|
87341
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
87342
|
+
}
|
|
87343
|
+
function projectAction(entry) {
|
|
87344
|
+
if (!isObject6(entry)) {
|
|
87345
|
+
throw new IncompatibleApiServerError("Clay actions catalog entry was not an object.");
|
|
87346
|
+
}
|
|
87347
|
+
const projected = {};
|
|
87348
|
+
for (const field of ACTION_FIELDS) {
|
|
87349
|
+
if (entry[field] !== void 0) {
|
|
87350
|
+
projected[field] = entry[field];
|
|
87351
|
+
}
|
|
87352
|
+
}
|
|
87353
|
+
return projected;
|
|
87354
|
+
}
|
|
87355
|
+
function projectActions(body) {
|
|
87356
|
+
if (!Array.isArray(body)) {
|
|
87357
|
+
throw new IncompatibleApiServerError("Clay actions catalog was not a JSON array.");
|
|
87358
|
+
}
|
|
87359
|
+
return body.map(projectAction);
|
|
87360
|
+
}
|
|
87361
|
+
function projectActionSchema(body) {
|
|
87362
|
+
if (!isObject6(body)) {
|
|
87363
|
+
throw new IncompatibleApiServerError("Clay action schema response was not an object.");
|
|
87364
|
+
}
|
|
87365
|
+
if (typeof body.packageId !== "string" || typeof body.actionKey !== "string" || typeof body.displayName !== "string" || !Array.isArray(body.inputParameters)) {
|
|
87366
|
+
throw new IncompatibleApiServerError("Clay action schema response is missing required fields.");
|
|
87367
|
+
}
|
|
87368
|
+
return {
|
|
87369
|
+
packageId: body.packageId,
|
|
87370
|
+
actionKey: body.actionKey,
|
|
87371
|
+
displayName: body.displayName,
|
|
87372
|
+
inputParameters: body.inputParameters
|
|
87373
|
+
};
|
|
87374
|
+
}
|
|
87375
|
+
|
|
87376
|
+
// src/commands/workflows/actions/list.ts
|
|
87377
|
+
function buildListCommand5() {
|
|
87378
|
+
const cmd = new Command("list");
|
|
87379
|
+
cmd.description('Dump the Clay action catalog \u2014 the building blocks for a workflow node\u2019s "tools".').addHelpText(
|
|
87380
|
+
"after",
|
|
87381
|
+
`
|
|
87382
|
+
Output (success, exit 0):
|
|
87383
|
+
{ "data": [ <action>, ... ] }
|
|
87384
|
+
|
|
87385
|
+
Each action carries its full documented field set so the catalog stays
|
|
87386
|
+
greppable: "type", "actionKey", "functionId", "name", "displayName",
|
|
87387
|
+
"description", "packageId", "packageDisplayName", "packageDescription",
|
|
87388
|
+
"documentationUri", "categories", "actionLabels", "creditCost",
|
|
87389
|
+
"usesPrivateKeyCost", "paymentType", "outputParameters", "dataStrengths",
|
|
87390
|
+
"whyUseful", "useCaseExamples", "providerDescription", "clayUseCase",
|
|
87391
|
+
"configuredTools", "availableAppAccounts", "priorityTier" (lower ranks higher).
|
|
87392
|
+
Fields are present only when the catalog supplies them.
|
|
87393
|
+
|
|
87394
|
+
The catalog is large (~1.5k entries). The intended flow is dump-then-filter:
|
|
87395
|
+
write it to a file once, then grep/jq it repeatedly. To *use* an action in a
|
|
87396
|
+
node\u2019s tools, take its "packageId" + "actionKey" (or reuse a
|
|
87397
|
+
"configuredTools[].toolId"); fetch its inputs with \`workflows actions schema\`.
|
|
87398
|
+
|
|
87399
|
+
Not to be confused with \`clay tools\`, which lists workspace *function tools* \u2014
|
|
87400
|
+
a different concept. Use this command for workflow building blocks.
|
|
87401
|
+
|
|
87402
|
+
Common errors:
|
|
87403
|
+
auth_forbidden (exit 3) API key lacks permission for this command (insufficient scope).
|
|
87404
|
+
|
|
87405
|
+
Examples:
|
|
87406
|
+
$ clay workflows actions list > catalog.json
|
|
87407
|
+
$ jq -r '.data[] | select(.name | test("email";"i")) | "\\(.packageId) \\(.actionKey)"' catalog.json
|
|
87408
|
+
$ clay workflows actions list | jq '.data | length'
|
|
87409
|
+
`
|
|
87410
|
+
).action(async () => {
|
|
87411
|
+
const workspaceId = await currentWorkspaceId();
|
|
87412
|
+
const client = await v3Client(terracottaClayActionsContract);
|
|
87413
|
+
const result = await unwrap(client.getClayActions({ params: { workspaceId } }));
|
|
87414
|
+
writeJson({ data: projectActions(result) });
|
|
87415
|
+
});
|
|
87416
|
+
return cmd;
|
|
87417
|
+
}
|
|
87418
|
+
|
|
87419
|
+
// src/commands/workflows/actions/schema.ts
|
|
87420
|
+
function buildSchemaCommand() {
|
|
87421
|
+
const cmd = new Command("schema");
|
|
87422
|
+
cmd.description("Fetch the input schema for one Clay action, to wire it into a node\u2019s tools.").argument("<packageId>", "Action package id, from `workflows actions list`").argument("<actionKey>", "Action key, from `workflows actions list`").addHelpText(
|
|
87423
|
+
"after",
|
|
87424
|
+
`
|
|
87425
|
+
Output (success, exit 0):
|
|
87426
|
+
{
|
|
87427
|
+
"packageId": <string>,
|
|
87428
|
+
"actionKey": <string>,
|
|
87429
|
+
"displayName": <string>,
|
|
87430
|
+
"inputParameters": [ <parameter>, ... ]
|
|
87431
|
+
}
|
|
87432
|
+
|
|
87433
|
+
"inputParameters" is an array of the action\u2019s input parameters \u2014 one entry per
|
|
87434
|
+
field you can pass when adding this action to a node\u2019s "tools" (each typically
|
|
87435
|
+
has name/displayName/type/required/description).
|
|
87436
|
+
|
|
87437
|
+
Common errors:
|
|
87438
|
+
validation_error (exit 2) packageId and actionKey arguments are required.
|
|
87439
|
+
not_found (exit 6) No action with that packageId/actionKey.
|
|
87440
|
+
auth_forbidden (exit 3) API key lacks permission for this command (insufficient scope).
|
|
87441
|
+
|
|
87442
|
+
Examples:
|
|
87443
|
+
$ clay workflows actions schema 56058efe-4757-4fe7-a44b-39c2d730c47a find-email-from-name
|
|
87444
|
+
$ clay workflows actions schema <packageId> <actionKey> | jq '.inputParameters'
|
|
87445
|
+
`
|
|
87446
|
+
).action(async (packageId, actionKey) => {
|
|
87447
|
+
const workspaceId = await currentWorkspaceId();
|
|
87448
|
+
const client = await v3Client(terracottaClayActionsContract);
|
|
87449
|
+
const result = await unwrap(client.getClayActionSchema({ params: { workspaceId, packageId, actionKey } }));
|
|
87450
|
+
writeJson(projectActionSchema(result));
|
|
87451
|
+
});
|
|
87452
|
+
return cmd;
|
|
87453
|
+
}
|
|
87454
|
+
|
|
87455
|
+
// src/commands/workflows/actions/index.ts
|
|
87456
|
+
function buildActionsCommand() {
|
|
87457
|
+
const cmd = new Command("actions");
|
|
87458
|
+
cmd.description("Browse the Clay action catalog \u2014 the building blocks for a workflow node\u2019s tools.").addHelpText(
|
|
87459
|
+
"after",
|
|
87460
|
+
`
|
|
87461
|
+
Subcommands:
|
|
87462
|
+
list Dump the full action catalog (greppable JSON).
|
|
87463
|
+
schema Fetch one action\u2019s input schema by packageId + actionKey.
|
|
87464
|
+
|
|
87465
|
+
These are workflow building blocks (actions you add to a node\u2019s "tools"). For
|
|
87466
|
+
workspace *function tools*, a different concept, see \`clay tools\`.
|
|
87467
|
+
|
|
87468
|
+
Examples:
|
|
87469
|
+
$ clay workflows actions list > catalog.json
|
|
87470
|
+
$ clay workflows actions schema <packageId> <actionKey> | jq '.inputParameters'
|
|
87471
|
+
`
|
|
87472
|
+
);
|
|
87473
|
+
cmd.addCommand(applyClaySettings(buildListCommand5()));
|
|
87474
|
+
cmd.addCommand(applyClaySettings(buildSchemaCommand()));
|
|
87475
|
+
return cmd;
|
|
87476
|
+
}
|
|
87477
|
+
|
|
86901
87478
|
// ../../libs/shared/src/agents/json-schema-validation.ts
|
|
86902
87479
|
var JSONSchemaType = external_exports.enum(["string", "number", "integer", "boolean", "array", "object"]);
|
|
86903
87480
|
var BaseJSONSchemaProperty = external_exports.object({
|
|
@@ -87361,7 +87938,8 @@ var TCNodeConfig = external_exports.discriminatedUnion("nodeType", [
|
|
|
87361
87938
|
...TCNodeConfigShared,
|
|
87362
87939
|
modelId: external_exports.string().optional(),
|
|
87363
87940
|
claygentId: external_exports.string().optional(),
|
|
87364
|
-
claygentVersionId: external_exports.string().optional()
|
|
87941
|
+
claygentVersionId: external_exports.string().optional(),
|
|
87942
|
+
authAccountId: external_exports.string().nullable().optional()
|
|
87365
87943
|
}),
|
|
87366
87944
|
TCForkNodeConfig.unwrap().extend({
|
|
87367
87945
|
nodeType: external_exports.literal("fork"),
|
|
@@ -87393,7 +87971,8 @@ var TCNodeConfig = external_exports.discriminatedUnion("nodeType", [
|
|
|
87393
87971
|
// When mode is 'agent', either mapConfig.agentConfig or claygentId must be present.
|
|
87394
87972
|
// This invariant is enforced at runtime in claygent-node-execution.service.ts.
|
|
87395
87973
|
claygentId: external_exports.string().optional(),
|
|
87396
|
-
claygentVersionId: external_exports.string().optional()
|
|
87974
|
+
claygentVersionId: external_exports.string().optional(),
|
|
87975
|
+
authAccountId: external_exports.string().nullable().optional()
|
|
87397
87976
|
}),
|
|
87398
87977
|
external_exports.object({
|
|
87399
87978
|
nodeType: external_exports.literal("reduce"),
|
|
@@ -87879,6 +88458,117 @@ var TCWorkflowSnapshotContent = external_exports.object({
|
|
|
87879
88458
|
containsCycles: external_exports.boolean()
|
|
87880
88459
|
});
|
|
87881
88460
|
|
|
88461
|
+
// ../../libs/terracotta/src/step-outputs.ts
|
|
88462
|
+
var ModelAwareUsageSchema = external_exports.custom();
|
|
88463
|
+
var ConditionalEvaluationSchema = external_exports.object({
|
|
88464
|
+
mode: external_exports.enum(["rules", "code", "agentic"]).optional(),
|
|
88465
|
+
matchedRuleIndex: external_exports.number().nullable(),
|
|
88466
|
+
matchedRuleName: external_exports.string().nullable(),
|
|
88467
|
+
usedDefault: external_exports.boolean(),
|
|
88468
|
+
targetNodeId: external_exports.string(),
|
|
88469
|
+
targetNodeName: external_exports.string(),
|
|
88470
|
+
reasoning: external_exports.string().optional(),
|
|
88471
|
+
modelId: external_exports.string().optional()
|
|
88472
|
+
});
|
|
88473
|
+
var ToolResultSchema = external_exports.object({
|
|
88474
|
+
success: external_exports.boolean(),
|
|
88475
|
+
result: external_exports.unknown().optional(),
|
|
88476
|
+
metadata: external_exports.unknown().optional()
|
|
88477
|
+
});
|
|
88478
|
+
var ToolCallErrorSchema = external_exports.object({
|
|
88479
|
+
toolName: external_exports.string(),
|
|
88480
|
+
toolCallId: external_exports.string(),
|
|
88481
|
+
errorMessage: external_exports.string(),
|
|
88482
|
+
failureCount: external_exports.number()
|
|
88483
|
+
});
|
|
88484
|
+
var StepOutputsBaseSchema = external_exports.object({
|
|
88485
|
+
usage: ModelAwareUsageSchema.optional(),
|
|
88486
|
+
error: external_exports.string().optional(),
|
|
88487
|
+
isTerminal: external_exports.boolean().optional()
|
|
88488
|
+
});
|
|
88489
|
+
var AgentStepOutputsSchema = StepOutputsBaseSchema.extend({
|
|
88490
|
+
structuredOutputs: external_exports.record(external_exports.unknown()).optional(),
|
|
88491
|
+
reasoning: external_exports.string().optional(),
|
|
88492
|
+
stepsTaken: external_exports.array(external_exports.string()).optional(),
|
|
88493
|
+
toolResult: ToolResultSchema.optional(),
|
|
88494
|
+
summarizedToolResults: external_exports.string().optional(),
|
|
88495
|
+
nodeId: external_exports.string().optional(),
|
|
88496
|
+
nodeName: external_exports.string().optional(),
|
|
88497
|
+
nextNodeId: external_exports.string().optional(),
|
|
88498
|
+
toolCallError: ToolCallErrorSchema.optional(),
|
|
88499
|
+
entryOutput: external_exports.record(external_exports.unknown()).optional(),
|
|
88500
|
+
executedAt: external_exports.string().optional(),
|
|
88501
|
+
failedToolName: external_exports.string().optional()
|
|
88502
|
+
}).catchall(external_exports.unknown());
|
|
88503
|
+
var CodeStepOutputsSchema = StepOutputsBaseSchema.extend({
|
|
88504
|
+
structuredOutputs: external_exports.record(external_exports.unknown()).optional(),
|
|
88505
|
+
capturedStdout: external_exports.string().optional(),
|
|
88506
|
+
explicitTransition: CodeTransition.optional(),
|
|
88507
|
+
executedAt: external_exports.string().optional()
|
|
88508
|
+
}).catchall(external_exports.unknown());
|
|
88509
|
+
var ConditionalStepOutputsSchema = StepOutputsBaseSchema.extend({
|
|
88510
|
+
conditionalEvaluation: ConditionalEvaluationSchema.optional(),
|
|
88511
|
+
resolvedVariables: external_exports.record(external_exports.unknown()).optional(),
|
|
88512
|
+
matchedRuleIndex: external_exports.number().nullable().optional(),
|
|
88513
|
+
usedDefault: external_exports.boolean().optional(),
|
|
88514
|
+
mode: external_exports.enum(["rules", "code", "agentic"]).optional(),
|
|
88515
|
+
modelId: external_exports.string().optional(),
|
|
88516
|
+
reasoning: external_exports.string().optional()
|
|
88517
|
+
}).catchall(external_exports.unknown());
|
|
88518
|
+
var ToolStepOutputsSchema = StepOutputsBaseSchema.extend({
|
|
88519
|
+
toolResult: ToolResultSchema.optional()
|
|
88520
|
+
}).catchall(external_exports.unknown());
|
|
88521
|
+
var MapStepOutputsSchema = StepOutputsBaseSchema.extend({
|
|
88522
|
+
dataListId: external_exports.string().optional(),
|
|
88523
|
+
totalEntries: external_exports.number().optional(),
|
|
88524
|
+
totalChunks: external_exports.number().optional(),
|
|
88525
|
+
successCount: external_exports.number().optional(),
|
|
88526
|
+
failedCount: external_exports.number().optional(),
|
|
88527
|
+
tokensUsed: external_exports.number().optional(),
|
|
88528
|
+
creditsUsed: external_exports.number().optional(),
|
|
88529
|
+
results: external_exports.array(external_exports.unknown()).optional(),
|
|
88530
|
+
errors: external_exports.unknown().optional(),
|
|
88531
|
+
autoGathered: external_exports.boolean().optional(),
|
|
88532
|
+
entryOutput: external_exports.record(external_exports.unknown()).optional()
|
|
88533
|
+
}).catchall(external_exports.unknown());
|
|
88534
|
+
var ReduceStepOutputsSchema = StepOutputsBaseSchema.extend({
|
|
88535
|
+
dataListId: external_exports.string().optional(),
|
|
88536
|
+
reduceInitiated: external_exports.boolean().optional(),
|
|
88537
|
+
sourceDataListId: external_exports.string().optional(),
|
|
88538
|
+
outputDataListId: external_exports.string().optional(),
|
|
88539
|
+
keyCount: external_exports.number().optional(),
|
|
88540
|
+
totalKeys: external_exports.number().optional(),
|
|
88541
|
+
successCount: external_exports.number().optional(),
|
|
88542
|
+
failedCount: external_exports.number().optional(),
|
|
88543
|
+
tokensUsed: external_exports.number().optional(),
|
|
88544
|
+
creditsUsed: external_exports.number().optional(),
|
|
88545
|
+
results: external_exports.array(external_exports.unknown()).optional(),
|
|
88546
|
+
autoGathered: external_exports.boolean().optional(),
|
|
88547
|
+
errors: external_exports.unknown().optional()
|
|
88548
|
+
}).catchall(external_exports.unknown());
|
|
88549
|
+
var CollectStepOutputsSchema = StepOutputsBaseSchema.extend({
|
|
88550
|
+
dataListId: external_exports.string().optional(),
|
|
88551
|
+
results: external_exports.array(external_exports.unknown()).optional(),
|
|
88552
|
+
totalCount: external_exports.number().optional(),
|
|
88553
|
+
successCount: external_exports.number().optional(),
|
|
88554
|
+
failedCount: external_exports.number().optional(),
|
|
88555
|
+
tokensUsed: external_exports.number().optional(),
|
|
88556
|
+
creditsUsed: external_exports.number().optional(),
|
|
88557
|
+
errors: external_exports.unknown().optional(),
|
|
88558
|
+
rawErrors: external_exports.array(external_exports.unknown()).optional()
|
|
88559
|
+
}).catchall(external_exports.unknown());
|
|
88560
|
+
var ForkJoinStepOutputsSchema = StepOutputsBaseSchema.catchall(external_exports.unknown());
|
|
88561
|
+
var TCWorkflowRunStepOutputsSchema = external_exports.union([
|
|
88562
|
+
AgentStepOutputsSchema,
|
|
88563
|
+
CodeStepOutputsSchema,
|
|
88564
|
+
ConditionalStepOutputsSchema,
|
|
88565
|
+
ToolStepOutputsSchema,
|
|
88566
|
+
MapStepOutputsSchema,
|
|
88567
|
+
ReduceStepOutputsSchema,
|
|
88568
|
+
CollectStepOutputsSchema,
|
|
88569
|
+
ForkJoinStepOutputsSchema
|
|
88570
|
+
]);
|
|
88571
|
+
|
|
87882
88572
|
// ../../libs/terracotta/src/types.ts
|
|
87883
88573
|
var TCContextDropletContentType = /* @__PURE__ */ ((TCContextDropletContentType2) => {
|
|
87884
88574
|
TCContextDropletContentType2["tool_result"] = "tool_result";
|
|
@@ -88239,6 +88929,8 @@ var SerializedWorkflowRun = external_exports.object({
|
|
|
88239
88929
|
workflowSnapshotId: external_exports.string(),
|
|
88240
88930
|
batchId: external_exports.string().nullable(),
|
|
88241
88931
|
streamId: external_exports.string().nullable(),
|
|
88932
|
+
triggerId: external_exports.string().nullish(),
|
|
88933
|
+
trigger: SerializedTrigger.nullish(),
|
|
88242
88934
|
runStatus: TCWorkflowRunStatus2,
|
|
88243
88935
|
runState: TCWorkflowRunState,
|
|
88244
88936
|
maxUninterruptedSteps: external_exports.number(),
|
|
@@ -88291,7 +88983,7 @@ var BaseWorkflowRunStepFields = {
|
|
|
88291
88983
|
data: TCWorkflowRunStepData,
|
|
88292
88984
|
functionExecutionMetadata: TCWorkflowRunStepFunctionExecutionMetadata.nullable().optional(),
|
|
88293
88985
|
stepInputs: external_exports.record(external_exports.unknown()).nullable(),
|
|
88294
|
-
stepOutputs:
|
|
88986
|
+
stepOutputs: TCWorkflowRunStepOutputsSchema.nullable(),
|
|
88295
88987
|
creditUsageMetadata: WorkflowCreditUsageMetadata.nullable(),
|
|
88296
88988
|
status: TCWorkflowRunStepStatus,
|
|
88297
88989
|
inCurrentStatusSince: external_exports.number(),
|
|
@@ -88302,6 +88994,7 @@ var BaseWorkflowRunStepFields = {
|
|
|
88302
88994
|
nodeName: external_exports.string().nullable(),
|
|
88303
88995
|
// Enriched fields (present when API computes them)
|
|
88304
88996
|
stepType: WorkflowRunStepType.optional(),
|
|
88997
|
+
nodeType: TCWorkflowNodeType.optional(),
|
|
88305
88998
|
statusDetail: StepStatusDetail.nullable().optional(),
|
|
88306
88999
|
statusDetailLabel: external_exports.string().nullable().optional()
|
|
88307
89000
|
};
|
|
@@ -88362,6 +89055,16 @@ var SerializedWorkflow = external_exports.object({
|
|
|
88362
89055
|
var SerializedWorkflows = external_exports.object({
|
|
88363
89056
|
workflows: external_exports.array(SerializedWorkflow)
|
|
88364
89057
|
});
|
|
89058
|
+
var WORKFLOW_LIST_DEFAULT_PAGE_SIZE = 50;
|
|
89059
|
+
var WORKFLOW_LIST_MAX_PAGE_SIZE = 200;
|
|
89060
|
+
var ListWorkflowsQuerySchema = external_exports.object({
|
|
89061
|
+
cursor: external_exports.string().optional(),
|
|
89062
|
+
limit: external_exports.coerce.number().int().positive().max(WORKFLOW_LIST_MAX_PAGE_SIZE).optional()
|
|
89063
|
+
});
|
|
89064
|
+
var ListWorkflowsResponseSchema = external_exports.object({
|
|
89065
|
+
workflows: external_exports.array(SerializedWorkflow),
|
|
89066
|
+
nextCursor: external_exports.string().nullable()
|
|
89067
|
+
});
|
|
88365
89068
|
|
|
88366
89069
|
// ../../libs/api-contract/src/terracotta/workflows/contract.ts
|
|
88367
89070
|
var terracottaWorkflowsContract = {
|
|
@@ -88377,6 +89080,19 @@ var terracottaWorkflowsContract = {
|
|
|
88377
89080
|
summary: "Get workflows for workspace",
|
|
88378
89081
|
metadata: { team: "workflows" /* Workflows */ }
|
|
88379
89082
|
},
|
|
89083
|
+
listWorkflows: {
|
|
89084
|
+
method: "GET",
|
|
89085
|
+
path: "/workspaces/:workspaceId/tc-workflows-paginated",
|
|
89086
|
+
pathParams: external_exports.object({
|
|
89087
|
+
workspaceId: external_exports.string()
|
|
89088
|
+
}),
|
|
89089
|
+
query: ListWorkflowsQuerySchema.optional(),
|
|
89090
|
+
responses: {
|
|
89091
|
+
200: ListWorkflowsResponseSchema
|
|
89092
|
+
},
|
|
89093
|
+
summary: "List workflows for workspace (paginated)",
|
|
89094
|
+
metadata: { team: "workflows" /* Workflows */ }
|
|
89095
|
+
},
|
|
88380
89096
|
getWorkflow: {
|
|
88381
89097
|
method: "GET",
|
|
88382
89098
|
path: "/workspaces/:workspaceId/tc-workflows/:workflowId",
|
|
@@ -88496,8 +89212,7 @@ var terracottaWorkflowsContract = {
|
|
|
88496
89212
|
workflowId: external_exports.string()
|
|
88497
89213
|
}),
|
|
88498
89214
|
body: external_exports.object({
|
|
88499
|
-
name: external_exports.string().max(255).optional()
|
|
88500
|
-
lastRunAt: external_exports.string().datetime().optional()
|
|
89215
|
+
name: external_exports.string().max(255).optional()
|
|
88501
89216
|
}),
|
|
88502
89217
|
responses: {
|
|
88503
89218
|
200: external_exports.object({ workflow: SerializedWorkflow })
|
|
@@ -88576,7 +89291,7 @@ function parseNameFlag(value) {
|
|
|
88576
89291
|
}
|
|
88577
89292
|
return trimmed;
|
|
88578
89293
|
}
|
|
88579
|
-
function
|
|
89294
|
+
function buildCreateCommand2() {
|
|
88580
89295
|
const cmd = new Command("create");
|
|
88581
89296
|
cmd.description("Create a new empty workflow.").requiredOption("--name <name>", "Workflow name.", parseNameFlag).addHelpText(
|
|
88582
89297
|
"after",
|
|
@@ -88639,13 +89354,13 @@ Examples:
|
|
|
88639
89354
|
}
|
|
88640
89355
|
|
|
88641
89356
|
// src/commands/workflows/list.ts
|
|
88642
|
-
function
|
|
89357
|
+
function buildListCommand6() {
|
|
88643
89358
|
const cmd = new Command("list");
|
|
88644
89359
|
cmd.description("List workflows in the workspace.").option(
|
|
88645
89360
|
"--limit <n>",
|
|
88646
|
-
|
|
88647
|
-
|
|
88648
|
-
).addHelpText(
|
|
89361
|
+
`The number of workflows returned (1 - ${WORKFLOW_LIST_MAX_PAGE_SIZE}). Defaults to ${WORKFLOW_LIST_DEFAULT_PAGE_SIZE}`,
|
|
89362
|
+
parseLimitFlagWithMax(WORKFLOW_LIST_MAX_PAGE_SIZE)
|
|
89363
|
+
).option("--cursor <string>", "Resume from a previous response's `cursor` to fetch the next page.").addHelpText(
|
|
88649
89364
|
"after",
|
|
88650
89365
|
`
|
|
88651
89366
|
Output (success, exit 0):
|
|
@@ -88656,11 +89371,18 @@ Output (success, exit 0):
|
|
|
88656
89371
|
"name": <string>,
|
|
88657
89372
|
"url": <string>
|
|
88658
89373
|
}
|
|
88659
|
-
]
|
|
89374
|
+
],
|
|
89375
|
+
"cursor": <string|undefined>
|
|
88660
89376
|
}
|
|
88661
89377
|
|
|
89378
|
+
Pagination:
|
|
89379
|
+
--limit <n> max workflows per call. Defaults to ${WORKFLOW_LIST_DEFAULT_PAGE_SIZE}.
|
|
89380
|
+
--cursor <token> resume from a previous response's \`cursor\`
|
|
89381
|
+
When more results exist, the response includes a top-level \`cursor\`; pass it back via
|
|
89382
|
+
--cursor to fetch the next page.
|
|
89383
|
+
|
|
88662
89384
|
Common errors:
|
|
88663
|
-
validation_error (exit 2) --limit is not a positive integer.
|
|
89385
|
+
validation_error (exit 2) --limit is not a positive integer or exceeds ${WORKFLOW_LIST_MAX_PAGE_SIZE}.
|
|
88664
89386
|
auth_forbidden (exit 3) Key lacks the terracotta:cli scope.
|
|
88665
89387
|
|
|
88666
89388
|
Examples:
|
|
@@ -88671,9 +89393,140 @@ Examples:
|
|
|
88671
89393
|
).action(async (opts) => {
|
|
88672
89394
|
const workspaceId = await currentWorkspaceId();
|
|
88673
89395
|
const client = await v3Client(terracottaWorkflowsContract);
|
|
88674
|
-
const result = await unwrap(
|
|
88675
|
-
|
|
88676
|
-
|
|
89396
|
+
const result = await unwrap(
|
|
89397
|
+
client.listWorkflows({
|
|
89398
|
+
params: { workspaceId },
|
|
89399
|
+
query: { limit: opts.limit ?? WORKFLOW_LIST_DEFAULT_PAGE_SIZE, cursor: opts.cursor ?? void 0 }
|
|
89400
|
+
})
|
|
89401
|
+
);
|
|
89402
|
+
writeJson({
|
|
89403
|
+
data: result.workflows.map((workflow) => projectWorkflow(workflow, workspaceId)),
|
|
89404
|
+
cursor: result.nextCursor ?? void 0
|
|
89405
|
+
});
|
|
89406
|
+
});
|
|
89407
|
+
return cmd;
|
|
89408
|
+
}
|
|
89409
|
+
|
|
89410
|
+
// src/commands/workflows/runs/download-file.ts
|
|
89411
|
+
var import_node_fs11 = require("fs");
|
|
89412
|
+
var import_node_path7 = require("path");
|
|
89413
|
+
|
|
89414
|
+
// ../../libs/api-contract/src/terracotta/code-tool/interfaces.ts
|
|
89415
|
+
var ToolExecutionRequest = external_exports.object({
|
|
89416
|
+
toolId: external_exports.string().describe('Tool ID in format "actionPackageId:actionKey"'),
|
|
89417
|
+
inputs: external_exports.record(external_exports.unknown()).describe("Tool input parameters")
|
|
89418
|
+
});
|
|
89419
|
+
var ToolExecutionResponse = external_exports.object({
|
|
89420
|
+
success: external_exports.boolean(),
|
|
89421
|
+
result: external_exports.unknown().optional(),
|
|
89422
|
+
error: external_exports.string().optional()
|
|
89423
|
+
});
|
|
89424
|
+
var ToolExecutionErrorResponse = external_exports.object({
|
|
89425
|
+
error: external_exports.string()
|
|
89426
|
+
});
|
|
89427
|
+
var SandboxFileDownloadRequest = external_exports.object({
|
|
89428
|
+
filePath: external_exports.string().describe("Path to the file in the sandbox filesystem")
|
|
89429
|
+
});
|
|
89430
|
+
var SandboxFileDownloadErrorResponse = external_exports.object({
|
|
89431
|
+
error: external_exports.string()
|
|
89432
|
+
});
|
|
89433
|
+
|
|
89434
|
+
// ../../libs/api-contract/src/terracotta/code-tool/contract.ts
|
|
89435
|
+
var terracottaCodeToolContract = {
|
|
89436
|
+
executeToolFromCode: {
|
|
89437
|
+
method: "POST",
|
|
89438
|
+
path: "/terracotta/internal/workflow-run/:workflowRunId/step/:stepId/execute-tool",
|
|
89439
|
+
pathParams: external_exports.object({
|
|
89440
|
+
workflowRunId: external_exports.string(),
|
|
89441
|
+
stepId: external_exports.string()
|
|
89442
|
+
}),
|
|
89443
|
+
responses: {
|
|
89444
|
+
200: ToolExecutionResponse,
|
|
89445
|
+
401: ToolExecutionErrorResponse,
|
|
89446
|
+
403: ToolExecutionErrorResponse,
|
|
89447
|
+
422: ToolExecutionErrorResponse,
|
|
89448
|
+
500: ToolExecutionErrorResponse
|
|
89449
|
+
},
|
|
89450
|
+
body: ToolExecutionRequest,
|
|
89451
|
+
summary: "Execute a tool from code node",
|
|
89452
|
+
description: "Internal endpoint for executing Clay actions from Python code running in Daytona sandboxes",
|
|
89453
|
+
metadata: { team: "workflows" /* Workflows */ }
|
|
89454
|
+
},
|
|
89455
|
+
downloadFileFromSandbox: {
|
|
89456
|
+
method: "POST",
|
|
89457
|
+
path: "/terracotta/internal/workflow-run/:workflowRunId/download-file",
|
|
89458
|
+
pathParams: external_exports.object({
|
|
89459
|
+
workflowRunId: external_exports.string()
|
|
89460
|
+
}),
|
|
89461
|
+
responses: {
|
|
89462
|
+
200: external_exports.object({
|
|
89463
|
+
success: external_exports.literal(true),
|
|
89464
|
+
fileData: external_exports.string().describe("Base64-encoded file contents"),
|
|
89465
|
+
filename: external_exports.string().describe("Basename of the file")
|
|
89466
|
+
}),
|
|
89467
|
+
401: SandboxFileDownloadErrorResponse,
|
|
89468
|
+
403: SandboxFileDownloadErrorResponse,
|
|
89469
|
+
404: SandboxFileDownloadErrorResponse,
|
|
89470
|
+
500: SandboxFileDownloadErrorResponse
|
|
89471
|
+
},
|
|
89472
|
+
body: SandboxFileDownloadRequest,
|
|
89473
|
+
summary: "Download a file from a workflow run sandbox",
|
|
89474
|
+
description: "Downloads a file from the Daytona sandbox associated with a workflow run. Returns the raw file contents as a binary response.",
|
|
89475
|
+
metadata: { team: "workflows" /* Workflows */ }
|
|
89476
|
+
}
|
|
89477
|
+
};
|
|
89478
|
+
|
|
89479
|
+
// src/commands/workflows/runs/download-file.ts
|
|
89480
|
+
function buildDownloadFileCommand() {
|
|
89481
|
+
const cmd = new Command("download-file");
|
|
89482
|
+
cmd.description("Download a file written by a code node from a workflow run sandbox onto local disk.").argument("<workflowId>", "Workflow id, e.g. wf_abc123").argument("<runId>", "Run id, e.g. wfr_xyz789").requiredOption(
|
|
89483
|
+
"--path <sandbox-path>",
|
|
89484
|
+
"Absolute path of the file inside the run sandbox, e.g. /home/daytona/report.csv"
|
|
89485
|
+
).option(
|
|
89486
|
+
"--output <local>",
|
|
89487
|
+
"Local path to write the file to. Defaults to the basename of --path in the current directory."
|
|
89488
|
+
).addHelpText(
|
|
89489
|
+
"after",
|
|
89490
|
+
`
|
|
89491
|
+
Output (success, exit 0):
|
|
89492
|
+
{ "path": <string>, "size": <number> }
|
|
89493
|
+
|
|
89494
|
+
"path" is the local path the file was written to; "size" is its size in bytes.
|
|
89495
|
+
The file contents are written to disk only \u2014 never to stdout \u2014 so the JSON
|
|
89496
|
+
envelope stays clean for piping. Code nodes run in an ephemeral per-run sandbox
|
|
89497
|
+
(cwd /home/daytona) that is torn down after the run, so download artifacts
|
|
89498
|
+
before the run is archived.
|
|
89499
|
+
|
|
89500
|
+
The run is resolved by runId alone \u2014 workflowId is positional only for parity
|
|
89501
|
+
with the other "runs" subcommands and is NOT validated against the run. Passing
|
|
89502
|
+
a runId that belongs to a different workflow still downloads from that run, so
|
|
89503
|
+
make sure the runId is correct (e.g. from "runs get"/"runs start" output).
|
|
89504
|
+
|
|
89505
|
+
Common errors:
|
|
89506
|
+
validation_error (exit 2) workflowId, runId, or --path is missing, or --output could not be written.
|
|
89507
|
+
not_found (exit 6) No run with that runId, or no file at --path in its sandbox.
|
|
89508
|
+
auth_forbidden (exit 3) API key lacks permission for this command (insufficient scope).
|
|
89509
|
+
|
|
89510
|
+
Examples:
|
|
89511
|
+
$ clay workflows runs download-file wf_abc123 wfr_xyz789 --path /home/daytona/report.csv
|
|
89512
|
+
$ clay workflows runs download-file wf_abc123 wfr_xyz789 --path /home/daytona/out.json --output ./out.json
|
|
89513
|
+
$ clay workflows runs download-file wf_abc123 wfr_xyz789 --path /home/daytona/report.csv | jq -r '.size'
|
|
89514
|
+
`
|
|
89515
|
+
).action(async (_workflowId, runId, opts) => {
|
|
89516
|
+
const client = await v3Client(terracottaCodeToolContract, { timeout: "large-transfer" });
|
|
89517
|
+
const result = await unwrap(
|
|
89518
|
+
client.downloadFileFromSandbox({ params: { workflowRunId: runId }, body: { filePath: opts.path } })
|
|
89519
|
+
);
|
|
89520
|
+
const outputPath = opts.output ?? (0, import_node_path7.basename)(opts.path);
|
|
89521
|
+
const bytes = Buffer.from(result.fileData, "base64");
|
|
89522
|
+
try {
|
|
89523
|
+
(0, import_node_fs11.writeFileSync)(outputPath, bytes);
|
|
89524
|
+
} catch (err) {
|
|
89525
|
+
throw new FileWriteError(
|
|
89526
|
+
`Could not write to ${outputPath}: ${err instanceof Error ? err.message : String(err)}`
|
|
89527
|
+
);
|
|
89528
|
+
}
|
|
89529
|
+
writeJson({ path: outputPath, size: bytes.length });
|
|
88677
89530
|
});
|
|
88678
89531
|
return cmd;
|
|
88679
89532
|
}
|
|
@@ -89426,11 +90279,12 @@ function buildRunsCommand2() {
|
|
|
89426
90279
|
"after",
|
|
89427
90280
|
`
|
|
89428
90281
|
Subcommands:
|
|
89429
|
-
start
|
|
89430
|
-
get
|
|
89431
|
-
steps
|
|
89432
|
-
pause
|
|
89433
|
-
resume
|
|
90282
|
+
start Start a workflow run.
|
|
90283
|
+
get Fetch status, progress, and per-node summary for a run.
|
|
90284
|
+
steps List the individual execution steps of a run, with filters.
|
|
90285
|
+
pause Pause an active run.
|
|
90286
|
+
resume Resume a paused run.
|
|
90287
|
+
download-file Download a file written by a code node from a run sandbox.
|
|
89434
90288
|
|
|
89435
90289
|
Examples:
|
|
89436
90290
|
$ clay workflows runs start wf_abc123 | jq -r '.runId'
|
|
@@ -89443,6 +90297,224 @@ Examples:
|
|
|
89443
90297
|
cmd.addCommand(applyClaySettings(buildStepsCommand()));
|
|
89444
90298
|
cmd.addCommand(applyClaySettings(buildPauseCommand()));
|
|
89445
90299
|
cmd.addCommand(applyClaySettings(buildResumeCommand()));
|
|
90300
|
+
cmd.addCommand(applyClaySettings(buildDownloadFileCommand()));
|
|
90301
|
+
return cmd;
|
|
90302
|
+
}
|
|
90303
|
+
|
|
90304
|
+
// src/commands/workflows/snapshots/projection.ts
|
|
90305
|
+
function projectSnapshotSummary(snapshot) {
|
|
90306
|
+
return {
|
|
90307
|
+
id: snapshot.id,
|
|
90308
|
+
hash: snapshot.hash,
|
|
90309
|
+
createdAt: snapshot.createdAt,
|
|
90310
|
+
nodeCount: snapshot.content.nodes.length,
|
|
90311
|
+
edgeCount: snapshot.content.edges.length
|
|
90312
|
+
};
|
|
90313
|
+
}
|
|
90314
|
+
function projectNode(n) {
|
|
90315
|
+
return {
|
|
90316
|
+
id: n.id,
|
|
90317
|
+
name: n.name,
|
|
90318
|
+
description: n.description,
|
|
90319
|
+
nodeType: n.nodeType,
|
|
90320
|
+
isInitial: n.isInitial,
|
|
90321
|
+
isTerminal: n.isTerminal,
|
|
90322
|
+
tools: n.tools,
|
|
90323
|
+
position: n.position,
|
|
90324
|
+
// Coalesce null → undefined so absent optional fields are omitted from the
|
|
90325
|
+
// JSON (matching the help's <object|undefined>) rather than emitted as null.
|
|
90326
|
+
nodeConfig: n.nodeConfig ?? void 0,
|
|
90327
|
+
retryConfig: n.retryConfig ?? void 0,
|
|
90328
|
+
scriptVersionId: n.scriptVersionId ?? void 0,
|
|
90329
|
+
currentScriptVersion: n.currentScriptVersion ?? void 0,
|
|
90330
|
+
claygentSnapshot: n.claygentSnapshot ?? void 0
|
|
90331
|
+
};
|
|
90332
|
+
}
|
|
90333
|
+
function projectEdge(e) {
|
|
90334
|
+
return {
|
|
90335
|
+
id: e.id,
|
|
90336
|
+
sourceNodeId: e.sourceNodeId,
|
|
90337
|
+
targetNodeId: e.targetNodeId,
|
|
90338
|
+
// Rebuild rather than pass through by reference so a future field on the
|
|
90339
|
+
// server edge type does not silently leak into the CLI output.
|
|
90340
|
+
metadata: e.metadata ? { conditionalSourceHandle: e.metadata.conditionalSourceHandle } : null
|
|
90341
|
+
};
|
|
90342
|
+
}
|
|
90343
|
+
function projectSnapshotGraph(snapshot, options = {}) {
|
|
90344
|
+
const { nodeId } = options;
|
|
90345
|
+
const nodes = nodeId === void 0 ? snapshot.content.nodes : snapshot.content.nodes.filter((n) => n.id === nodeId);
|
|
90346
|
+
return {
|
|
90347
|
+
id: snapshot.id,
|
|
90348
|
+
workflowId: snapshot.workflowId,
|
|
90349
|
+
hash: snapshot.hash,
|
|
90350
|
+
createdAt: snapshot.createdAt,
|
|
90351
|
+
containsCycles: snapshot.content.containsCycles,
|
|
90352
|
+
nodes: nodes.map(projectNode),
|
|
90353
|
+
edges: snapshot.content.edges.map(projectEdge)
|
|
90354
|
+
};
|
|
90355
|
+
}
|
|
90356
|
+
|
|
90357
|
+
// src/commands/workflows/snapshots/get.ts
|
|
90358
|
+
function buildGetCommand5() {
|
|
90359
|
+
const cmd = new Command("get");
|
|
90360
|
+
cmd.description("Fetch a single snapshot\u2019s full workflow graph (nodes, edges, agent prompts, code).").argument("<workflowId>", "Workflow id, e.g. wf_abc123").argument("<snapshotId>", "Snapshot id, from `snapshots list`").option("--node-id <id>", 'Only include the node with this id in "nodes" (edges are left intact).').addHelpText(
|
|
90361
|
+
"after",
|
|
90362
|
+
`
|
|
90363
|
+
Output (success, exit 0):
|
|
90364
|
+
{
|
|
90365
|
+
"id": <string>,
|
|
90366
|
+
"workflowId": <string>,
|
|
90367
|
+
"hash": <string>,
|
|
90368
|
+
"createdAt": <string>,
|
|
90369
|
+
"containsCycles": <boolean>,
|
|
90370
|
+
"nodes": [ { "id": <string>, "name": <string>, "description": <string|null>,
|
|
90371
|
+
"nodeType": <string>, "isInitial": <boolean>, "isTerminal": <boolean>,
|
|
90372
|
+
"tools": <array>, "position": { "x": <number>, "y": <number> },
|
|
90373
|
+
"nodeConfig": <object|undefined>, "retryConfig": <object|undefined>,
|
|
90374
|
+
"scriptVersionId": <string|undefined>, "currentScriptVersion": <object|undefined>,
|
|
90375
|
+
"claygentSnapshot": <object|undefined> } ],
|
|
90376
|
+
"edges": [ { "id": <string>, "sourceNodeId": <string>, "targetNodeId": <string>,
|
|
90377
|
+
"metadata": { "conditionalSourceHandle": <string|undefined> } | null } ]
|
|
90378
|
+
}
|
|
90379
|
+
|
|
90380
|
+
"nodes"/"edges" are the captured graph (the documented fields above) \u2014 stable
|
|
90381
|
+
for diffing two \`snapshots get\` outputs with jq (there is no built-in diff).
|
|
90382
|
+
"claygentSnapshot" holds the agent prompt and model/tool settings on agent
|
|
90383
|
+
nodes. An edge's "metadata.conditionalSourceHandle" names the branch handle on
|
|
90384
|
+
a "conditional" source node, so it identifies which branch the edge routes from.
|
|
90385
|
+
A --node-id that matches no node yields "nodes": [] with exit 0 (not an error);
|
|
90386
|
+
"edges" are still returned in full.
|
|
90387
|
+
|
|
90388
|
+
Node type values:
|
|
90389
|
+
agent Claygent (LLM) node
|
|
90390
|
+
code Python code node
|
|
90391
|
+
tool Single-tool action node
|
|
90392
|
+
conditional Branches on a condition expression
|
|
90393
|
+
fork Splits execution into parallel branches
|
|
90394
|
+
join Merges parallel branches
|
|
90395
|
+
map Fans out over a list
|
|
90396
|
+
reduce Aggregates map results
|
|
90397
|
+
collect Collects streamed outputs into a list
|
|
90398
|
+
trigger Workflow entry-point node
|
|
90399
|
+
|
|
90400
|
+
Common errors:
|
|
90401
|
+
validation_error (exit 2) workflowId and snapshotId arguments are required.
|
|
90402
|
+
not_found (exit 6) No workflow or snapshot with that id in this workspace.
|
|
90403
|
+
auth_forbidden (exit 3) API key lacks permission for this command (insufficient scope).
|
|
90404
|
+
|
|
90405
|
+
Examples:
|
|
90406
|
+
$ clay workflows snapshots get wf_abc123 snap_xyz
|
|
90407
|
+
$ clay workflows snapshots get wf_abc123 snap_xyz --node-id node_3 | jq '.nodes[0]'
|
|
90408
|
+
$ clay workflows snapshots get wf_abc123 snap_xyz | jq -r '.nodes[].name'
|
|
90409
|
+
`
|
|
90410
|
+
).action(async (workflowId, snapshotId, opts) => {
|
|
90411
|
+
const workspaceId = await currentWorkspaceId();
|
|
90412
|
+
const client = await v3Client(terracottaWorkflowsContract);
|
|
90413
|
+
const result = await unwrap(client.getWorkflowSnapshot({ params: { workspaceId, workflowId, snapshotId } }));
|
|
90414
|
+
writeJson(projectSnapshotGraph(result.snapshot, { nodeId: opts.nodeId }));
|
|
90415
|
+
});
|
|
90416
|
+
return cmd;
|
|
90417
|
+
}
|
|
90418
|
+
|
|
90419
|
+
// src/commands/workflows/snapshots/list.ts
|
|
90420
|
+
function buildListCommand7() {
|
|
90421
|
+
const cmd = new Command("list");
|
|
90422
|
+
cmd.description("List a workflow\u2019s snapshots (automatic version history), newest first.").argument("<workflowId>", "Workflow id, e.g. wf_abc123").addHelpText(
|
|
90423
|
+
"after",
|
|
90424
|
+
`
|
|
90425
|
+
Output (success, exit 0):
|
|
90426
|
+
{ "data": [ { "id": <string>, "hash": <string>, "createdAt": <string>,
|
|
90427
|
+
"nodeCount": <number>, "edgeCount": <number> } ] }
|
|
90428
|
+
|
|
90429
|
+
Snapshots are an immutable, content-addressed capture of the whole workflow
|
|
90430
|
+
graph, auto-created before every node edit and at run start. They are returned
|
|
90431
|
+
newest-first, so data[0] is the most recent. This is the undo log: find the
|
|
90432
|
+
snapshot from just before a bad change, then \`snapshots get\` to inspect it or
|
|
90433
|
+
\`snapshots restore\` to roll back to it.
|
|
90434
|
+
|
|
90435
|
+
Common errors:
|
|
90436
|
+
validation_error (exit 2) workflowId argument is required.
|
|
90437
|
+
not_found (exit 6) No workflow with that id in this workspace.
|
|
90438
|
+
auth_forbidden (exit 3) API key lacks permission for this command (insufficient scope).
|
|
90439
|
+
|
|
90440
|
+
Examples:
|
|
90441
|
+
$ clay workflows snapshots list wf_abc123
|
|
90442
|
+
$ clay workflows snapshots list wf_abc123 | jq -r '.data[0].id'
|
|
90443
|
+
$ clay workflows snapshots list wf_abc123 | jq '.data | length'
|
|
90444
|
+
`
|
|
90445
|
+
).action(async (workflowId) => {
|
|
90446
|
+
const workspaceId = await currentWorkspaceId();
|
|
90447
|
+
const client = await v3Client(terracottaWorkflowsContract);
|
|
90448
|
+
const result = await unwrap(client.getWorkflowSnapshots({ params: { workspaceId, workflowId } }));
|
|
90449
|
+
writeJson({ data: result.snapshots.map(projectSnapshotSummary) });
|
|
90450
|
+
});
|
|
90451
|
+
return cmd;
|
|
90452
|
+
}
|
|
90453
|
+
|
|
90454
|
+
// src/commands/workflows/snapshots/restore.ts
|
|
90455
|
+
function buildRestoreCommand() {
|
|
90456
|
+
const cmd = new Command("restore");
|
|
90457
|
+
cmd.description("Restore a workflow to a previous snapshot, replacing its current graph.").argument("<workflowId>", "Workflow id, e.g. wf_abc123").argument("<snapshotId>", "Snapshot id to restore to, from `snapshots list`").addHelpText(
|
|
90458
|
+
"after",
|
|
90459
|
+
`
|
|
90460
|
+
Output (success, exit 0):
|
|
90461
|
+
{ "ok": true }
|
|
90462
|
+
|
|
90463
|
+
Overwrites the workflow\u2019s current graph with the snapshot\u2019s. This is the undo
|
|
90464
|
+
action \u2014 pair it with \`snapshots list\` to find the snapshot from just before
|
|
90465
|
+
an unwanted edit. Restore is destructive and does NOT itself snapshot the
|
|
90466
|
+
current graph; the pre-restore state is recoverable only if it was already
|
|
90467
|
+
captured (snapshots are taken automatically before each edit and at run
|
|
90468
|
+
start). Check \`snapshots list\` first if you might need the current graph back.
|
|
90469
|
+
|
|
90470
|
+
Common errors:
|
|
90471
|
+
validation_error (exit 2) workflowId and snapshotId arguments are required.
|
|
90472
|
+
not_found (exit 6) No workflow or snapshot with that id in this workspace.
|
|
90473
|
+
auth_forbidden (exit 3) API key lacks permission for this command (insufficient scope).
|
|
90474
|
+
|
|
90475
|
+
Examples:
|
|
90476
|
+
$ clay workflows snapshots restore wf_abc123 snap_xyz
|
|
90477
|
+
$ clay workflows snapshots list wf_abc123 | jq -r '.data[0].id' | xargs clay workflows snapshots restore wf_abc123
|
|
90478
|
+
`
|
|
90479
|
+
).action(async (workflowId, snapshotId) => {
|
|
90480
|
+
const workspaceId = await currentWorkspaceId();
|
|
90481
|
+
const client = await v3Client(terracottaWorkflowsContract);
|
|
90482
|
+
const result = await unwrap(
|
|
90483
|
+
client.restoreWorkflowFromSnapshot({ params: { workspaceId, workflowId, snapshotId }, body: {} })
|
|
90484
|
+
);
|
|
90485
|
+
if (!result.success) {
|
|
90486
|
+
throw new IncompatibleApiServerError("Workflow snapshot restore returned success: false.");
|
|
90487
|
+
}
|
|
90488
|
+
writeJson({ ok: true });
|
|
90489
|
+
});
|
|
90490
|
+
return cmd;
|
|
90491
|
+
}
|
|
90492
|
+
|
|
90493
|
+
// src/commands/workflows/snapshots/index.ts
|
|
90494
|
+
function buildSnapshotsCommand() {
|
|
90495
|
+
const cmd = new Command("snapshots");
|
|
90496
|
+
cmd.description("Inspect and restore a workflow\u2019s automatic version history (snapshots).").addHelpText(
|
|
90497
|
+
"after",
|
|
90498
|
+
`
|
|
90499
|
+
Subcommands:
|
|
90500
|
+
list List a workflow\u2019s snapshots, newest first.
|
|
90501
|
+
get Fetch one snapshot\u2019s full graph (with optional --node-id).
|
|
90502
|
+
restore Roll a workflow back to a snapshot.
|
|
90503
|
+
|
|
90504
|
+
Snapshots are git-style autosaves: an immutable, content-addressed capture of the
|
|
90505
|
+
entire workflow graph, taken before every node edit and at run start. They are the
|
|
90506
|
+
undo button for agent-driven editing \u2014 \`list\` to find the snapshot before a bad
|
|
90507
|
+
change, then \`restore\`. There is no built-in diff; compare two \`get\` outputs with jq.
|
|
90508
|
+
|
|
90509
|
+
Examples:
|
|
90510
|
+
$ clay workflows snapshots list wf_abc123 | jq -r '.data[0].id'
|
|
90511
|
+
$ clay workflows snapshots get wf_abc123 snap_xyz | jq '.nodes | length'
|
|
90512
|
+
$ clay workflows snapshots restore wf_abc123 snap_xyz
|
|
90513
|
+
`
|
|
90514
|
+
);
|
|
90515
|
+
cmd.addCommand(applyClaySettings(buildListCommand7()));
|
|
90516
|
+
cmd.addCommand(applyClaySettings(buildGetCommand5()));
|
|
90517
|
+
cmd.addCommand(applyClaySettings(buildRestoreCommand()));
|
|
89446
90518
|
return cmd;
|
|
89447
90519
|
}
|
|
89448
90520
|
|
|
@@ -89453,18 +90525,22 @@ function registerWorkflows(program3) {
|
|
|
89453
90525
|
"after",
|
|
89454
90526
|
`
|
|
89455
90527
|
Subcommands:
|
|
89456
|
-
list
|
|
89457
|
-
get
|
|
89458
|
-
create
|
|
89459
|
-
runs
|
|
90528
|
+
list List workflows in the workspace.
|
|
90529
|
+
get Fetch a workflow by id.
|
|
90530
|
+
create Create a new empty workflow.
|
|
90531
|
+
runs Start and inspect workflow runs.
|
|
90532
|
+
snapshots Inspect and restore a workflow\u2019s version history.
|
|
90533
|
+
actions Browse the Clay action catalog (node building blocks).
|
|
89460
90534
|
|
|
89461
90535
|
See \`clay workflows <subcommand> --help\` for per-subcommand JSON shape, error codes, and examples.
|
|
89462
90536
|
`
|
|
89463
90537
|
);
|
|
89464
|
-
workflows.addCommand(applyClaySettings(
|
|
90538
|
+
workflows.addCommand(applyClaySettings(buildListCommand6()));
|
|
89465
90539
|
workflows.addCommand(applyClaySettings(buildGetCommand3()));
|
|
89466
|
-
workflows.addCommand(applyClaySettings(
|
|
90540
|
+
workflows.addCommand(applyClaySettings(buildCreateCommand2()));
|
|
89467
90541
|
workflows.addCommand(applyClaySettings(buildRunsCommand2()));
|
|
90542
|
+
workflows.addCommand(applyClaySettings(buildSnapshotsCommand()));
|
|
90543
|
+
workflows.addCommand(applyClaySettings(buildActionsCommand()));
|
|
89468
90544
|
program3.addCommand(workflows);
|
|
89469
90545
|
}
|
|
89470
90546
|
|
|
@@ -89523,11 +90599,11 @@ Authentication:
|
|
|
89523
90599
|
1. $CLAY_CONFIG_HOME/clay, if set
|
|
89524
90600
|
2. $XDG_CONFIG_HOME/clay, if set
|
|
89525
90601
|
3. ~/.config/clay (default)
|
|
89526
|
-
|
|
90602
|
+
If no key is stored, the CLI falls back to the CLAY_API_KEY environment variable (a stored key from \`clay login\` always wins). The env var is the right fit for agents and CI that already export it; the env path is not validated up front, so a bad key surfaces as auth_invalid on the first call.
|
|
89527
90603
|
Values derived from the key (e.g. the resolved workspace id) are cached alongside in \`<config-dir>/cache.json\`; it is disposable and safe to delete.
|
|
89528
90604
|
|
|
89529
90605
|
Environment variables:
|
|
89530
|
-
|
|
90606
|
+
CLAY_API_KEY API key used when none is stored by \`clay login\`. A stored key takes precedence. Surfaces as auth_invalid (exit 3) on first use if invalid.
|
|
89531
90607
|
CLAY_CONFIG_HOME Override the parent of the config directory. The CLI appends \`clay/\` to it, matching XDG semantics. Useful for isolating tests or alternate setups. Both config.json and the sibling cache.json live under this directory.
|
|
89532
90608
|
CLAY_REQUEST_TIMEOUT_MS Per-request network timeout in milliseconds (default: 60000). Each HTTP request the CLI makes is bounded by this; on expiry the command fails with network_timeout (exit 5).
|
|
89533
90609
|
CLAY_UPLOAD_TIMEOUT_MS File-upload timeout in milliseconds (default: 600000). Bounds bulk file uploads (e.g. \`clay tools runs start --bulk\`), which move whole payloads and so get a longer budget than CLAY_REQUEST_TIMEOUT_MS; on expiry the command fails with network_timeout (exit 5).
|
|
@@ -89547,6 +90623,7 @@ registerLogout(program2);
|
|
|
89547
90623
|
registerTools(program2);
|
|
89548
90624
|
registerTables(program2);
|
|
89549
90625
|
registerWorkflows(program2);
|
|
90626
|
+
registerWebhooks(program2);
|
|
89550
90627
|
registerHelp(program2);
|
|
89551
90628
|
async function main() {
|
|
89552
90629
|
try {
|