@kitman-sh/go-to-market 0.45.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +302 -17
- package/dist/declarations.json +1 -1
- package/package.json +3 -3
package/dist/bundle.js
CHANGED
|
@@ -12362,6 +12362,12 @@ var AgentSandboxPolicy = Struct({
|
|
|
12362
12362
|
|
|
12363
12363
|
// ../../packages/core/src/runtime-type.ts
|
|
12364
12364
|
var UnsafeJsonObjectKeys = new Set(["__proto__", "constructor", "prototype"]);
|
|
12365
|
+
function isBoolean2(value) {
|
|
12366
|
+
return isBoolean(value);
|
|
12367
|
+
}
|
|
12368
|
+
function isNumber2(value) {
|
|
12369
|
+
return isNumber(value);
|
|
12370
|
+
}
|
|
12365
12371
|
function isObject2(value) {
|
|
12366
12372
|
return isObjectOrArray(value);
|
|
12367
12373
|
}
|
|
@@ -13097,6 +13103,22 @@ function looksLikeCredential(raw, matched) {
|
|
|
13097
13103
|
return /^[^\s:=]+=\S/u.test(matched) || value.length >= 6 && /[0-9]/u.test(value) || value.length >= 20 && /[a-z]/u.test(value) && /[A-Z]/u.test(value);
|
|
13098
13104
|
}
|
|
13099
13105
|
var globalPatterns = new WeakMap;
|
|
13106
|
+
var globalPattern = (rule) => {
|
|
13107
|
+
const known = globalPatterns.get(rule);
|
|
13108
|
+
if (known !== undefined)
|
|
13109
|
+
return known;
|
|
13110
|
+
const pattern = new RegExp(rule.pattern.source, `${rule.pattern.flags}g`);
|
|
13111
|
+
globalPatterns.set(rule, pattern);
|
|
13112
|
+
return pattern;
|
|
13113
|
+
};
|
|
13114
|
+
var redactedBy = (text, rule) => text.replace(globalPattern(rule), (matched, ...rest) => {
|
|
13115
|
+
const groups = rest.at(-1);
|
|
13116
|
+
const offset = isObject2(groups) ? rest.at(-3) : rest.at(-2);
|
|
13117
|
+
const named = isObject2(groups) && groups !== null && "value" in groups ? groups.value : undefined;
|
|
13118
|
+
const value = isString2(named) ? named : matched;
|
|
13119
|
+
const start = (isNumber2(offset) ? offset : 0) + matched.lastIndexOf(value);
|
|
13120
|
+
return rule.holds === undefined || rule.holds(value, matched, text, start) ? `[REDACTED:${rule.classification}]` : matched;
|
|
13121
|
+
});
|
|
13100
13122
|
var credentialUrlRule = {
|
|
13101
13123
|
classification: "url",
|
|
13102
13124
|
name: "credential-url",
|
|
@@ -13106,6 +13128,9 @@ var keptClassifications = new Set(["secret", "credential", "unknown"]);
|
|
|
13106
13128
|
var normalizedKeys = new Map;
|
|
13107
13129
|
var CREDENTIAL_RULES = VALUE_RULES.filter((rule) => rule.classification === "secret" || rule.classification === "credential");
|
|
13108
13130
|
var RESPONSE_RULES = [...CREDENTIAL_RULES, credentialUrlRule];
|
|
13131
|
+
function redactCredentialText(text) {
|
|
13132
|
+
return RESPONSE_RULES.reduce(redactedBy, text);
|
|
13133
|
+
}
|
|
13109
13134
|
|
|
13110
13135
|
// ../../packages/core/src/run.ts
|
|
13111
13136
|
var RunContractVersion = Literal2("run.v1");
|
|
@@ -14025,6 +14050,193 @@ var failedFileLine = new RegExp(`^${failedFileStart}((?:${failedFilePaths.join("
|
|
|
14025
14050
|
var attempt = String.raw`(?:\d+ times in )?(?:initial run|\d+[a-z]{2} (?:retry(?: of \d+[a-z]{2} repeat)?|repeat))`;
|
|
14026
14051
|
var vitestAttempts = new RegExp(String.raw` \(${attempt}(?:, ${attempt})*\)$`, "u");
|
|
14027
14052
|
|
|
14053
|
+
// ../../packages/core/src/json.ts
|
|
14054
|
+
var JsonFromString = fromJsonString2(Json2);
|
|
14055
|
+
var decodeJsonString = decodeUnknownEffect2(JsonFromString);
|
|
14056
|
+
var decodeJsonStringOption = decodeUnknownOption2(JsonFromString);
|
|
14057
|
+
var encodeJsonStringSync = encodeSync(JsonFromString);
|
|
14058
|
+
var encodePrettyJsonString = encodeEffect(fromJsonString2(Json2, { space: 2 }));
|
|
14059
|
+
var decodeJsonStringSync = decodeUnknownSync(JsonFromString);
|
|
14060
|
+
var encodeUnknownJsonStringSync = encodeSync(fromJsonString2(Unknown2));
|
|
14061
|
+
|
|
14062
|
+
// ../../packages/core/src/question-answer.ts
|
|
14063
|
+
var AnswerSchemaJson = Record(String5, Json2);
|
|
14064
|
+
var description = optionalKey2(String5);
|
|
14065
|
+
var Count = Int.check(isGreaterThanOrEqualTo3(0));
|
|
14066
|
+
var Nested = suspend3(() => DeclaredAnswerSchema);
|
|
14067
|
+
var DeclaredAnswerSchema = Union2([
|
|
14068
|
+
Struct({ description, type: Literal2("boolean"), const: optionalKey2(Boolean3) }),
|
|
14069
|
+
Struct({
|
|
14070
|
+
description,
|
|
14071
|
+
type: Literal2("string"),
|
|
14072
|
+
const: optionalKey2(String5),
|
|
14073
|
+
enum: optionalKey2(ArraySchema(String5).check(isMinLength(1))),
|
|
14074
|
+
minLength: optionalKey2(Count),
|
|
14075
|
+
maxLength: optionalKey2(Count)
|
|
14076
|
+
}),
|
|
14077
|
+
Struct({
|
|
14078
|
+
description,
|
|
14079
|
+
type: Literal2("integer"),
|
|
14080
|
+
const: optionalKey2(Int),
|
|
14081
|
+
minimum: optionalKey2(Int),
|
|
14082
|
+
maximum: optionalKey2(Int)
|
|
14083
|
+
}),
|
|
14084
|
+
Struct({
|
|
14085
|
+
description,
|
|
14086
|
+
type: Literal2("array"),
|
|
14087
|
+
items: Nested,
|
|
14088
|
+
minItems: optionalKey2(Count),
|
|
14089
|
+
maxItems: optionalKey2(Count)
|
|
14090
|
+
}),
|
|
14091
|
+
Struct({
|
|
14092
|
+
description,
|
|
14093
|
+
type: Literal2("object"),
|
|
14094
|
+
properties: Record(String5, Nested),
|
|
14095
|
+
required: ArraySchema(String5),
|
|
14096
|
+
additionalProperties: Literal2(false)
|
|
14097
|
+
}),
|
|
14098
|
+
Struct({ description, anyOf: ArraySchema(Nested).check(isMinLength(1)) })
|
|
14099
|
+
]);
|
|
14100
|
+
var decodeDeclared = decodeUnknownExit2(DeclaredAnswerSchema, { onExcessProperty: "error" });
|
|
14101
|
+
var inverted = (low, high) => low !== undefined && high !== undefined && low > high;
|
|
14102
|
+
var declarationProblem = (schema, path) => {
|
|
14103
|
+
if ("anyOf" in schema) {
|
|
14104
|
+
for (const [index, form] of schema.anyOf.entries()) {
|
|
14105
|
+
const problem = declarationProblem(form, `${path}anyOf[${index}].`);
|
|
14106
|
+
if (problem !== undefined)
|
|
14107
|
+
return problem;
|
|
14108
|
+
}
|
|
14109
|
+
return;
|
|
14110
|
+
}
|
|
14111
|
+
switch (schema.type) {
|
|
14112
|
+
case "boolean":
|
|
14113
|
+
return;
|
|
14114
|
+
case "string":
|
|
14115
|
+
return inverted(schema.minLength, schema.maxLength) ? `${path}minLength is past maxLength` : undefined;
|
|
14116
|
+
case "integer":
|
|
14117
|
+
return inverted(schema.minimum, schema.maximum) ? `${path}minimum is past maximum` : undefined;
|
|
14118
|
+
case "array":
|
|
14119
|
+
return inverted(schema.minItems, schema.maxItems) ? `${path}minItems is past maxItems` : declarationProblem(schema.items, `${path}items.`);
|
|
14120
|
+
case "object": {
|
|
14121
|
+
const missing = schema.required.find((key) => !Object.hasOwn(schema.properties, key));
|
|
14122
|
+
if (missing !== undefined)
|
|
14123
|
+
return `${path}required names "${missing}", which is not one of its properties`;
|
|
14124
|
+
for (const [key, field] of Object.entries(schema.properties)) {
|
|
14125
|
+
const problem = declarationProblem(field, `${path}properties.${key}.`);
|
|
14126
|
+
if (problem !== undefined)
|
|
14127
|
+
return problem;
|
|
14128
|
+
}
|
|
14129
|
+
return;
|
|
14130
|
+
}
|
|
14131
|
+
}
|
|
14132
|
+
};
|
|
14133
|
+
var decodeAnswerSchema = (declared) => {
|
|
14134
|
+
const decoded = decodeDeclared(declared);
|
|
14135
|
+
if (decoded._tag === "Failure")
|
|
14136
|
+
return {
|
|
14137
|
+
problem: `The answer schema is not one Kitman supports: boolean, string, integer, array, object with additionalProperties false, or anyOf, each with only their own keywords`
|
|
14138
|
+
};
|
|
14139
|
+
const problem = declarationProblem(decoded.value, "");
|
|
14140
|
+
return problem === undefined ? { schema: decoded.value } : { problem: `The answer schema is invalid: ${problem}` };
|
|
14141
|
+
};
|
|
14142
|
+
var shown = (value) => encodeJsonStringSync(value);
|
|
14143
|
+
var valueProblem = (schema, value, path) => {
|
|
14144
|
+
const at = path === "" ? "The answer" : path;
|
|
14145
|
+
if ("anyOf" in schema)
|
|
14146
|
+
return schema.anyOf.some((form) => valueProblem(form, value, path) === undefined) ? undefined : `${at} is none of the forms it accepts`;
|
|
14147
|
+
switch (schema.type) {
|
|
14148
|
+
case "boolean":
|
|
14149
|
+
if (!isBoolean2(value))
|
|
14150
|
+
return `${at} must be true or false`;
|
|
14151
|
+
return schema.const !== undefined && value !== schema.const ? `${at} must be ${schema.const}` : undefined;
|
|
14152
|
+
case "string":
|
|
14153
|
+
if (!isString2(value))
|
|
14154
|
+
return `${at} must be a string`;
|
|
14155
|
+
if (schema.const !== undefined && value !== schema.const)
|
|
14156
|
+
return `${at} must be ${shown(schema.const)}`;
|
|
14157
|
+
if (schema.enum !== undefined && !schema.enum.includes(value))
|
|
14158
|
+
return `${at} must be one of ${schema.enum.map(shown).join(", ")}`;
|
|
14159
|
+
if (schema.minLength !== undefined && value.length < schema.minLength)
|
|
14160
|
+
return `${at} must be at least ${schema.minLength} characters`;
|
|
14161
|
+
return schema.maxLength !== undefined && value.length > schema.maxLength ? `${at} must be at most ${schema.maxLength} characters` : undefined;
|
|
14162
|
+
case "integer":
|
|
14163
|
+
if (!Number.isInteger(value))
|
|
14164
|
+
return `${at} must be an integer`;
|
|
14165
|
+
if (schema.const !== undefined && value !== schema.const)
|
|
14166
|
+
return `${at} must be ${schema.const}`;
|
|
14167
|
+
if (schema.minimum !== undefined && Number(value) < schema.minimum)
|
|
14168
|
+
return `${at} must be at least ${schema.minimum}`;
|
|
14169
|
+
return schema.maximum !== undefined && Number(value) > schema.maximum ? `${at} must be at most ${schema.maximum}` : undefined;
|
|
14170
|
+
case "array": {
|
|
14171
|
+
if (!Array.isArray(value))
|
|
14172
|
+
return `${at} must be an array`;
|
|
14173
|
+
if (schema.minItems !== undefined && value.length < schema.minItems)
|
|
14174
|
+
return `${at} must hold at least ${schema.minItems} item${schema.minItems === 1 ? "" : "s"}`;
|
|
14175
|
+
if (schema.maxItems !== undefined && value.length > schema.maxItems)
|
|
14176
|
+
return `${at} must hold at most ${schema.maxItems} item${schema.maxItems === 1 ? "" : "s"}`;
|
|
14177
|
+
for (const [index, item] of value.entries()) {
|
|
14178
|
+
const problem = valueProblem(schema.items, item, `${path === "" ? "" : path}[${index}]`);
|
|
14179
|
+
if (problem !== undefined)
|
|
14180
|
+
return problem;
|
|
14181
|
+
}
|
|
14182
|
+
return;
|
|
14183
|
+
}
|
|
14184
|
+
case "object": {
|
|
14185
|
+
if (!isJsonObject(value))
|
|
14186
|
+
return `${at} must be an object`;
|
|
14187
|
+
const extra = Object.keys(value).find((key) => !Object.hasOwn(schema.properties, key));
|
|
14188
|
+
if (extra !== undefined)
|
|
14189
|
+
return `${at} must not have "${extra}"`;
|
|
14190
|
+
const missing = schema.required.find((key) => !Object.hasOwn(value, key));
|
|
14191
|
+
if (missing !== undefined)
|
|
14192
|
+
return `${at} must have "${missing}"`;
|
|
14193
|
+
for (const [key, field] of Object.entries(schema.properties)) {
|
|
14194
|
+
const given = value[key];
|
|
14195
|
+
if (given === undefined)
|
|
14196
|
+
continue;
|
|
14197
|
+
const problem = valueProblem(field, given, path === "" ? key : `${path}.${key}`);
|
|
14198
|
+
if (problem !== undefined)
|
|
14199
|
+
return problem;
|
|
14200
|
+
}
|
|
14201
|
+
return;
|
|
14202
|
+
}
|
|
14203
|
+
}
|
|
14204
|
+
};
|
|
14205
|
+
var sketch = (schema) => {
|
|
14206
|
+
if ("anyOf" in schema)
|
|
14207
|
+
return schema.anyOf.map(sketch).join(" or ");
|
|
14208
|
+
switch (schema.type) {
|
|
14209
|
+
case "boolean":
|
|
14210
|
+
return schema.const === undefined ? "<true or false>" : String(schema.const);
|
|
14211
|
+
case "string":
|
|
14212
|
+
if (schema.const !== undefined)
|
|
14213
|
+
return shown(schema.const);
|
|
14214
|
+
return schema.enum === undefined ? '"<text>"' : schema.enum.map(shown).join(" or ");
|
|
14215
|
+
case "integer":
|
|
14216
|
+
return schema.const === undefined ? "<integer>" : String(schema.const);
|
|
14217
|
+
case "array":
|
|
14218
|
+
return `[${sketch(schema.items)}, \u2026]`;
|
|
14219
|
+
case "object":
|
|
14220
|
+
return `{${Object.entries(schema.properties).map(([key, field]) => `${shown(key)}${schema.required.includes(key) ? "" : "?"}:${sketch(field)}`).join(",")}}`;
|
|
14221
|
+
}
|
|
14222
|
+
};
|
|
14223
|
+
var answerAccepts = (declared) => {
|
|
14224
|
+
const read = decodeAnswerSchema(declared);
|
|
14225
|
+
if ("problem" in read)
|
|
14226
|
+
return "JSON its schema accepts";
|
|
14227
|
+
const described = read.schema.description?.trim();
|
|
14228
|
+
return redactCredentialText(described === undefined || described === "" ? `JSON like ${sketch(read.schema)}` : described);
|
|
14229
|
+
};
|
|
14230
|
+
var answerProblem = (schema, answer) => {
|
|
14231
|
+
const decoded = decodeJsonStringOption(answer);
|
|
14232
|
+
const problem = decoded._tag === "None" ? "The answer is not JSON" : valueProblem(schema, decoded.value, "");
|
|
14233
|
+
return problem === undefined ? undefined : redactCredentialText(`${problem}. It accepts ${answerAccepts(schema)}`);
|
|
14234
|
+
};
|
|
14235
|
+
var answerValue = (schema, answer) => {
|
|
14236
|
+
const decoded = decodeJsonStringOption(answer);
|
|
14237
|
+
return decoded._tag === "Some" && valueProblem(schema, decoded.value, "") === undefined ? { value: decoded.value } : undefined;
|
|
14238
|
+
};
|
|
14239
|
+
|
|
14028
14240
|
// ../../packages/core/src/loop.ts
|
|
14029
14241
|
var LoopStatuses = ["draft", "active", "disabled", "archived"];
|
|
14030
14242
|
var LoopStepImplementationKinds = [
|
|
@@ -14251,6 +14463,7 @@ var LoopSafeInternalReferenceString = String5.check(isMinLength(1), isMaxLength(
|
|
|
14251
14463
|
var loopSafeTextMaxLength = 4000;
|
|
14252
14464
|
var LoopSafeText = String5.check(isMaxLength(loopSafeTextMaxLength), isPattern2(new RegExp(`^(?![\\s\\S]*(?:${LoopCredentialContentPattern}|[A-Za-z][A-Za-z0-9+.-]*://(?:[^\\s/?#]*@|[^\\s?#]*\\?)))[\\s\\S]*$`, "u")));
|
|
14253
14465
|
var recommendedDefault = (recommended) => recommended !== undefined && is2(LoopSafeText)(recommended) ? recommended : undefined;
|
|
14466
|
+
var isLoopSafeText = is2(LoopSafeText);
|
|
14254
14467
|
var QuestionText = String5;
|
|
14255
14468
|
var LoopSafeOutputDataString = String5.check(isMaxLength(4000), isPattern2(new RegExp(LoopSafeInternalReferencePattern, "u")));
|
|
14256
14469
|
var LoopSafePackageName = String5.check(isMinLength(1), isMaxLength(200), isPattern2(new RegExp(LoopSafeReferencePattern, "u")));
|
|
@@ -14863,6 +15076,7 @@ var Question = Struct({
|
|
|
14863
15076
|
prompt: QuestionText,
|
|
14864
15077
|
options: optionalKey2(ArraySchema(QuestionText)),
|
|
14865
15078
|
freeText: optionalKey2(Boolean3),
|
|
15079
|
+
answerSchema: optionalKey2(AnswerSchemaJson),
|
|
14866
15080
|
optionDescriptions: optionalKey2(Record(String5, QuestionText)),
|
|
14867
15081
|
recommended: optionalKey2(QuestionText),
|
|
14868
15082
|
recommendationReason: optionalKey2(QuestionText),
|
|
@@ -20008,6 +20222,11 @@ var noteInBranches = (take) => map8(FirstBranches, (branches) => branches.forEac
|
|
|
20008
20222
|
var agentDeferredNamed = (deferredName) => make15(deferredName, { success: Json2, error: StepFailed });
|
|
20009
20223
|
var syncDeferred = (step) => agentDeferredNamed(`sync/${step}`);
|
|
20010
20224
|
var answerDeferred = (step) => make15(`ask/${step}`, { success: String5, error: StepFailed });
|
|
20225
|
+
var AnswerTakenBy = Literals(["person", "default", "auto"]);
|
|
20226
|
+
var structuredAnswerDeferred = (step) => make15(`ask/${step}`, {
|
|
20227
|
+
success: Struct({ answer: String5, by: AnswerTakenBy }),
|
|
20228
|
+
error: StepFailed
|
|
20229
|
+
});
|
|
20011
20230
|
var childDeferred = (step) => make15(`call/${step}`, { success: Json2, error: ChildFailed });
|
|
20012
20231
|
var eventDeferred = (step) => make15(`wait_for/${step}`, { success: LoopEvent, error: WaitTimedOut });
|
|
20013
20232
|
var verifyDeferred = (step) => make15(`verify/${step}`, { success: VerifyResult, error: StepFailed });
|
|
@@ -20090,14 +20309,22 @@ var submittedBy = (step, deferred, options) => gen2(function* () {
|
|
|
20090
20309
|
});
|
|
20091
20310
|
var decodeOutput = (step, schema, submitted) => decodeEffect2(toCodecJson2(schema))(submitted).pipe(mapError3((error) => new OutputInvalid({ step, message: error.message })));
|
|
20092
20311
|
var agentWorkAs = (deferredOf, name, options) => takeStep(name, "agent_work", "agent_work", (step) => flatMap3(submittedBy(step, deferredOf(step), options), (submitted) => decodeOutput(step, options.output, submitted)));
|
|
20093
|
-
|
|
20094
|
-
|
|
20095
|
-
|
|
20096
|
-
|
|
20097
|
-
|
|
20098
|
-
|
|
20312
|
+
class Words {
|
|
20313
|
+
text;
|
|
20314
|
+
constructor(text) {
|
|
20315
|
+
this.text = text;
|
|
20316
|
+
}
|
|
20317
|
+
get blank() {
|
|
20318
|
+
return this.text.trim() === "";
|
|
20319
|
+
}
|
|
20320
|
+
toString() {
|
|
20321
|
+
return this.text;
|
|
20322
|
+
}
|
|
20323
|
+
}
|
|
20324
|
+
var putQuestion = (name, question, deferred) => gen2(function* () {
|
|
20325
|
+
const { options, recommended, informationOnly } = question;
|
|
20099
20326
|
const advice = questionAdvice({
|
|
20100
|
-
...
|
|
20327
|
+
...question.optionDescriptions === undefined ? undefined : { optionDescriptions: question.optionDescriptions },
|
|
20101
20328
|
...recommended === undefined ? undefined : { recommended },
|
|
20102
20329
|
recommendationReason: question.recommendationReason,
|
|
20103
20330
|
...informationOnly === undefined ? undefined : { informationOnly }
|
|
@@ -20116,6 +20343,7 @@ var ask = (name, question) => takeStep(name, "ask", "ask", (name) => gen2(functi
|
|
|
20116
20343
|
step: name,
|
|
20117
20344
|
prompt: question.prompt,
|
|
20118
20345
|
...options === undefined ? undefined : { options },
|
|
20346
|
+
...question.answerSchema === undefined ? undefined : { answerSchema: question.answerSchema },
|
|
20119
20347
|
...advice,
|
|
20120
20348
|
...fallback === undefined ? undefined : { default: fallback },
|
|
20121
20349
|
...question.auto === undefined ? undefined : { auto: question.auto },
|
|
@@ -20124,15 +20352,62 @@ var ask = (name, question) => takeStep(name, "ask", "ask", (name) => gen2(functi
|
|
|
20124
20352
|
...question.timeout === undefined ? undefined : { timeoutMillis: toMillis(fromInputUnsafe2(question.timeout)) },
|
|
20125
20353
|
token: token2
|
|
20126
20354
|
}));
|
|
20127
|
-
|
|
20128
|
-
|
|
20129
|
-
|
|
20130
|
-
}
|
|
20131
|
-
const
|
|
20132
|
-
if (
|
|
20355
|
+
return yield* await_2(deferred);
|
|
20356
|
+
});
|
|
20357
|
+
var askOptions = (name, question) => gen2(function* () {
|
|
20358
|
+
const { options, optionDescriptions } = splitQuestionOptions(question.options);
|
|
20359
|
+
const answer = yield* putQuestion(name, { ...question, options, ...optionDescriptions === undefined ? undefined : { optionDescriptions } }, answerDeferred(name));
|
|
20360
|
+
if (!options.includes(answer))
|
|
20133
20361
|
return yield* new QuestionRefused({ step: name, answer, options });
|
|
20134
|
-
return
|
|
20135
|
-
})
|
|
20362
|
+
return answer;
|
|
20363
|
+
});
|
|
20364
|
+
var askStructured = (name, question) => gen2(function* () {
|
|
20365
|
+
const read = decodeAnswerSchema(question.answer);
|
|
20366
|
+
if ("problem" in read)
|
|
20367
|
+
return yield* new StepFailed({ step: name, reason: read.problem });
|
|
20368
|
+
const { schema } = read;
|
|
20369
|
+
const declared = (what, value, stored) => {
|
|
20370
|
+
const answer = encodeUnknownJsonStringSync(value);
|
|
20371
|
+
const problem = stored && !isLoopSafeText(answer) ? "it is too long, or holds a credential" : answerProblem(schema, answer);
|
|
20372
|
+
return problem === undefined ? succeed7(answer) : fail7(new StepFailed({ step: name, reason: `The ${what} is refused: ${problem}` }));
|
|
20373
|
+
};
|
|
20374
|
+
const taken = yield* putQuestion(name, {
|
|
20375
|
+
prompt: question.prompt,
|
|
20376
|
+
answerSchema: schema,
|
|
20377
|
+
recommended: yield* declared("recommended answer", question.recommended, false),
|
|
20378
|
+
recommendationReason: question.recommendationReason,
|
|
20379
|
+
...question.default === undefined ? undefined : { default: question.default === null ? null : yield* declared("default", question.default, true) },
|
|
20380
|
+
...question.auto === undefined ? undefined : { auto: yield* declared("full-auto answer", question.auto, true) },
|
|
20381
|
+
...question.unattendedAuto === undefined ? undefined : { unattendedAuto: yield* declared("full-auto answer", question.unattendedAuto, true) },
|
|
20382
|
+
...question.evidence === undefined ? undefined : { evidence: question.evidence },
|
|
20383
|
+
...question.timeout === undefined ? undefined : { timeout: question.timeout }
|
|
20384
|
+
}, structuredAnswerDeferred(name));
|
|
20385
|
+
const decoded = answerValue(schema, taken.answer);
|
|
20386
|
+
if (decoded === undefined)
|
|
20387
|
+
return yield* new QuestionRefused({ step: name, answer: taken.answer, options: [] });
|
|
20388
|
+
return { answer: decoded.value, by: taken.by };
|
|
20389
|
+
});
|
|
20390
|
+
function ask(name, question) {
|
|
20391
|
+
return takeStep(name, "ask", "ask", (name) => {
|
|
20392
|
+
const modes = [
|
|
20393
|
+
"options" in question && question.options !== undefined ? "options" : [],
|
|
20394
|
+
"answer" in question && question.answer !== undefined ? "answer" : [],
|
|
20395
|
+
"freeText" in question && question.freeText !== undefined ? "freeText" : []
|
|
20396
|
+
].flat();
|
|
20397
|
+
if (modes.length === 1) {
|
|
20398
|
+
if ("options" in question && question.options !== undefined)
|
|
20399
|
+
return askOptions(name, question);
|
|
20400
|
+
if ("answer" in question && question.answer !== undefined)
|
|
20401
|
+
return askStructured(name, question);
|
|
20402
|
+
if ("freeText" in question && question.freeText === true)
|
|
20403
|
+
return map8(putQuestion(name, question, answerDeferred(name)), (text) => new Words(text));
|
|
20404
|
+
}
|
|
20405
|
+
return fail7(new StepFailed({
|
|
20406
|
+
step: name,
|
|
20407
|
+
reason: `A Question declares exactly one of options, answer or freeText: true; this one declares ${modes.length === 0 ? "none" : modes.join(" and ")}`
|
|
20408
|
+
}));
|
|
20409
|
+
});
|
|
20410
|
+
}
|
|
20136
20411
|
var waitFor = (name, wait) => takeStep(name, "wait_for", undefined, (name) => gen2(function* () {
|
|
20137
20412
|
const deferred = eventDeferred(name);
|
|
20138
20413
|
const timeoutMillis = toMillis(fromInputUnsafe2(wait.timeout));
|
|
@@ -22728,7 +23003,14 @@ var scriptedHost = (script, engine, agentLaunches, childLaunches, waits, verifyL
|
|
|
22728
23003
|
value: answer,
|
|
22729
23004
|
...scripted === undefined && auto !== undefined ? { byAuto: true, ...launch.evidence === undefined ? undefined : { evidence: launch.evidence } } : undefined
|
|
22730
23005
|
});
|
|
22731
|
-
return andThen2(sync2(() => questions.push({
|
|
23006
|
+
return andThen2(sync2(() => questions.push({
|
|
23007
|
+
step: launch.step,
|
|
23008
|
+
prompt: launch.prompt,
|
|
23009
|
+
...launch.answerSchema === undefined ? undefined : { answerSchema: launch.answerSchema }
|
|
23010
|
+
})), answer === undefined ? resolve(answerDeferred(launch.step), launch.token, fail5(new StepFailed({ step: launch.step, reason: "no answer was scripted" }))) : launch.answerSchema === undefined ? resolve(answerDeferred(launch.step), launch.token, succeed4(answer)) : resolve(structuredAnswerDeferred(launch.step), launch.token, succeed4({
|
|
23011
|
+
answer,
|
|
23012
|
+
by: scripted !== undefined ? "person" : auto !== undefined ? "auto" : "default"
|
|
23013
|
+
})));
|
|
22732
23014
|
},
|
|
22733
23015
|
admitChild: (launch) => {
|
|
22734
23016
|
const refused = script.refusedChildren?.[launch.step];
|
|
@@ -25362,6 +25644,7 @@ class RunnerCapabilityRpcs extends make32(make31("PutQuestion", {
|
|
|
25362
25644
|
step: String5,
|
|
25363
25645
|
prompt: String5,
|
|
25364
25646
|
options: optional2(ArraySchema(String5)),
|
|
25647
|
+
answerSchema: optional2(AnswerSchemaJson),
|
|
25365
25648
|
optionDescriptions: optional2(Record(String5, String5)),
|
|
25366
25649
|
recommended: optional2(String5),
|
|
25367
25650
|
recommendationReason: optional2(String5),
|
|
@@ -26080,6 +26363,7 @@ var runnerHost = (capabilities) => ({
|
|
|
26080
26363
|
deferredName: answerDeferred(launch.step).name,
|
|
26081
26364
|
...questionAdvice(launch),
|
|
26082
26365
|
...launch.options === undefined ? undefined : { options: launch.options },
|
|
26366
|
+
...launch.answerSchema === undefined ? undefined : { answerSchema: launch.answerSchema },
|
|
26083
26367
|
...launch.verification === undefined ? undefined : { verification: launch.verification },
|
|
26084
26368
|
...launch.default === undefined ? undefined : { default: launch.default },
|
|
26085
26369
|
...launch.auto === undefined ? undefined : { auto: launch.auto },
|
|
@@ -26266,6 +26550,7 @@ var rpcProgramPorts = (rpc, work) => {
|
|
|
26266
26550
|
deferredName: question.deferredName,
|
|
26267
26551
|
...questionAdvice(question),
|
|
26268
26552
|
...question.options === undefined ? undefined : { options: [...question.options] },
|
|
26553
|
+
...question.answerSchema === undefined ? undefined : { answerSchema: question.answerSchema },
|
|
26269
26554
|
...question.verification === undefined ? undefined : { verification: question.verification },
|
|
26270
26555
|
...question.default === undefined ? undefined : { default: question.default },
|
|
26271
26556
|
...question.auto === undefined ? undefined : { auto: question.auto },
|
|
@@ -28581,4 +28866,4 @@ var runKit = (config, identity, packages) => {
|
|
|
28581
28866
|
runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
|
|
28582
28867
|
};
|
|
28583
28868
|
// .kitman-build-entry.ts
|
|
28584
|
-
runKit(kitman_config_default, { name: "@kitman-sh/go-to-market", version: "0.
|
|
28869
|
+
runKit(kitman_config_default, { name: "@kitman-sh/go-to-market", version: "0.46.0" }, []);
|
package/dist/declarations.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitman-sh/go-to-market",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.0",
|
|
4
4
|
"description": "Copywriting, marketing psychology and SEO audits.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"LICENSE.md"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@kitman-sh/sdk": "0.
|
|
18
|
+
"@kitman-sh/sdk": "0.46.0"
|
|
19
19
|
},
|
|
20
20
|
"kitman": {
|
|
21
21
|
"bundle": "dist/bundle.js",
|
|
22
|
-
"digest": "
|
|
22
|
+
"digest": "74887a29ad8b44e287cbbb6969d02c13382ceabc0d26239d25c5fc5858dffa75",
|
|
23
23
|
"protocolVersion": 5,
|
|
24
24
|
"declarations": "dist/declarations.json",
|
|
25
25
|
"setup": {
|