@keystrokehq/cli 0.1.47 → 0.1.49
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/{dist-DtDJareY.mjs → dist-B4IgTkp3.mjs} +6 -2
- package/dist/{dist-DtDJareY.mjs.map → dist-B4IgTkp3.mjs.map} +1 -1
- package/dist/{dist-CTHhFGjP.mjs → dist-DJFUIl5O.mjs} +3 -3
- package/dist/{dist-CTHhFGjP.mjs.map → dist-DJFUIl5O.mjs.map} +1 -1
- package/dist/{dist-83uw4_yr.mjs → dist-oZ7xFzbc.mjs} +2 -2
- package/dist/{dist-83uw4_yr.mjs.map → dist-oZ7xFzbc.mjs.map} +1 -1
- package/dist/{dist-BmO-d0ms.mjs → dist-rdfKnOL3.mjs} +130 -6
- package/dist/dist-rdfKnOL3.mjs.map +1 -0
- package/dist/dist-vpjsc5px.mjs +3 -0
- package/dist/index.mjs +23 -15
- package/dist/index.mjs.map +1 -1
- package/dist/{maybe-auto-update-DPhUOdEF.mjs → maybe-auto-update-BIYrfgSX.mjs} +2 -2
- package/dist/{maybe-auto-update-DPhUOdEF.mjs.map → maybe-auto-update-BIYrfgSX.mjs.map} +1 -1
- package/dist/{version-key3f4tc.mjs → version-BWhENlum.mjs} +2 -2
- package/dist/{version-key3f4tc.mjs.map → version-BWhENlum.mjs.map} +1 -1
- package/package.json +3 -3
- package/dist/dist-BPmBLa_o.mjs +0 -3
- package/dist/dist-BmO-d0ms.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { n as __require, t as __commonJSMin } from "./chunk-DiodbrVj.mjs";
|
|
3
|
-
import { $n as normalizeCredentialList, Cr as object, Dr as string, Jn as credentialInputSchema, Kt as PromptResponseSchema, Mr as toJSONSchema, Or as union, Sr as number, Tr as preprocess, W as DEFAULT_CLOUD_PLATFORM_ORIGIN, Xt as ROUTE_MANIFEST_REL_PATH, _r as custom, br as literal, dr as _enum, fr as _function, gr as boolean$1, hr as array, ir as requiredDisplayTextSchema, qt as PublicModelsResponseSchema, rr as parseStoredRouteManifest, ur as ZodType, vr as discriminatedUnion } from "./dist-
|
|
4
|
-
import "./dist-
|
|
3
|
+
import { $n as normalizeCredentialList, Cr as object, Dr as string, Jn as credentialInputSchema, Kt as PromptResponseSchema, Mr as toJSONSchema, Or as union, Sr as number, Tr as preprocess, W as DEFAULT_CLOUD_PLATFORM_ORIGIN, Xt as ROUTE_MANIFEST_REL_PATH, _r as custom, br as literal, dr as _enum, fr as _function, gr as boolean$1, hr as array, ir as requiredDisplayTextSchema, qt as PublicModelsResponseSchema, rr as parseStoredRouteManifest, ur as ZodType, vr as discriminatedUnion } from "./dist-B4IgTkp3.mjs";
|
|
4
|
+
import "./dist-oZ7xFzbc.mjs";
|
|
5
5
|
import "./chunk-BZUGFHVS-CPWRFwK8.mjs";
|
|
6
6
|
import "./chunk-DLL7UR66-BUYgzxnR.mjs";
|
|
7
7
|
import "./chunk-TN7HHBQW-CSB_R-XD.mjs";
|
|
@@ -1672,6 +1672,70 @@ function computeCallSiteIds(sourceFile) {
|
|
|
1672
1672
|
});
|
|
1673
1673
|
return map;
|
|
1674
1674
|
}
|
|
1675
|
+
function isDefinePollSourceCallee(expr) {
|
|
1676
|
+
if (ts.isIdentifier(expr)) return expr.text === "definePollSource";
|
|
1677
|
+
if (ts.isPropertyAccessExpression(expr)) return expr.name.text === "definePollSource";
|
|
1678
|
+
return false;
|
|
1679
|
+
}
|
|
1680
|
+
function readPollObject(obj) {
|
|
1681
|
+
let slug;
|
|
1682
|
+
let body;
|
|
1683
|
+
for (const prop of obj.properties) {
|
|
1684
|
+
const name = prop.name && (ts.isIdentifier(prop.name) || ts.isStringLiteral(prop.name)) ? prop.name.text : void 0;
|
|
1685
|
+
if (name === "slug" && ts.isPropertyAssignment(prop) && ts.isStringLiteral(prop.initializer)) {
|
|
1686
|
+
slug = prop.initializer.text;
|
|
1687
|
+
continue;
|
|
1688
|
+
}
|
|
1689
|
+
if (name !== "run") continue;
|
|
1690
|
+
if (ts.isMethodDeclaration(prop) && prop.body) {
|
|
1691
|
+
body = prop.body;
|
|
1692
|
+
continue;
|
|
1693
|
+
}
|
|
1694
|
+
if (ts.isPropertyAssignment(prop)) {
|
|
1695
|
+
const init = prop.initializer;
|
|
1696
|
+
if (ts.isArrowFunction(init) || ts.isFunctionExpression(init)) body = init.body;
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
if (!body) return null;
|
|
1700
|
+
return {
|
|
1701
|
+
slug,
|
|
1702
|
+
body
|
|
1703
|
+
};
|
|
1704
|
+
}
|
|
1705
|
+
function locatePollSources(sourceFile) {
|
|
1706
|
+
const located = [];
|
|
1707
|
+
const visit = (node) => {
|
|
1708
|
+
if (ts.isCallExpression(node) && isDefinePollSourceCallee(node.expression)) {
|
|
1709
|
+
const [arg] = node.arguments;
|
|
1710
|
+
if (arg && ts.isObjectLiteralExpression(arg)) {
|
|
1711
|
+
const poll = readPollObject(arg);
|
|
1712
|
+
if (poll) {
|
|
1713
|
+
located.push(poll);
|
|
1714
|
+
return;
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
ts.forEachChild(node, visit);
|
|
1719
|
+
};
|
|
1720
|
+
visit(sourceFile);
|
|
1721
|
+
return located;
|
|
1722
|
+
}
|
|
1723
|
+
function nodeContains(ancestor, target) {
|
|
1724
|
+
let found = false;
|
|
1725
|
+
const walk = (node) => {
|
|
1726
|
+
if (found || node === target) {
|
|
1727
|
+
found = node === target || found;
|
|
1728
|
+
return;
|
|
1729
|
+
}
|
|
1730
|
+
ts.forEachChild(node, walk);
|
|
1731
|
+
};
|
|
1732
|
+
walk(ancestor);
|
|
1733
|
+
return found;
|
|
1734
|
+
}
|
|
1735
|
+
function isInsidePollRunBody(sourceFile, located, call) {
|
|
1736
|
+
if (ts.isBlock(located.body)) return nodeContains(located.body, call);
|
|
1737
|
+
return located.body === call || nodeContains(located.body, call);
|
|
1738
|
+
}
|
|
1675
1739
|
/**
|
|
1676
1740
|
* Static reliability checks over a single workflow (or would-be helper) source
|
|
1677
1741
|
* file. ERRORS block a deploy (they produce an invisible/misleading canvas):
|
|
@@ -1682,7 +1746,7 @@ function computeCallSiteIds(sourceFile) {
|
|
|
1682
1746
|
function diagnoseWorkflowSource(source, fileName) {
|
|
1683
1747
|
const sourceFile = ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
1684
1748
|
const located = locateWorkflow(sourceFile);
|
|
1685
|
-
if (!located) return crossFileStepDiagnostics(sourceFile, fileName);
|
|
1749
|
+
if (!located) return crossFileStepDiagnostics(sourceFile, fileName, locatePollSources(sourceFile));
|
|
1686
1750
|
const shared = sharedHelperNames(located, collectLocalFunctions(sourceFile));
|
|
1687
1751
|
return [
|
|
1688
1752
|
...nestedStepArgDiagnostics(sourceFile, fileName, located.ctxParamName),
|
|
@@ -1743,7 +1807,7 @@ function isFunctionLike(node) {
|
|
|
1743
1807
|
return ts.isArrowFunction(node) || ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node) || ts.isMethodDeclaration(node);
|
|
1744
1808
|
}
|
|
1745
1809
|
/** Durable step calls in a file that is not a workflow — invisible + un-injected. */
|
|
1746
|
-
function crossFileStepDiagnostics(sourceFile, fileName) {
|
|
1810
|
+
function crossFileStepDiagnostics(sourceFile, fileName, polls = []) {
|
|
1747
1811
|
const importsBySymbol = collectImportsBySymbol(sourceFile);
|
|
1748
1812
|
const out = [];
|
|
1749
1813
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -1751,6 +1815,7 @@ function crossFileStepDiagnostics(sourceFile, fileName) {
|
|
|
1751
1815
|
const info = classifyCall(call, void 0);
|
|
1752
1816
|
if (!info) return;
|
|
1753
1817
|
if (!(info.callKind === "llm" || (info.callKind === "workflow-step" || info.callKind === "agent") && info.importName !== void 0 && isStepBearingSpecifier(importsBySymbol.get(info.importName)))) return;
|
|
1818
|
+
if (polls.some((poll) => isInsidePollRunBody(sourceFile, poll, call))) return;
|
|
1754
1819
|
const { line, column } = lineColumn(sourceFile, call);
|
|
1755
1820
|
const dedupe = `${line}:${column}`;
|
|
1756
1821
|
if (seen.has(dedupe)) return;
|
|
@@ -29963,8 +30028,67 @@ function discoverSkillManifestEntries(projectRoot) {
|
|
|
29963
30028
|
walkSkillFiles(projectRoot, skillsDir, entries);
|
|
29964
30029
|
return entries;
|
|
29965
30030
|
}
|
|
30031
|
+
const EXPORT_FIX = "Use plain structural Zod only (objects, strings, literals, unions). Remap or validate in .attach({ transform }) or at the top of run() instead.";
|
|
30032
|
+
function zodDef(schema) {
|
|
30033
|
+
return schema._zod?.def;
|
|
30034
|
+
}
|
|
30035
|
+
/** Finds code-based Zod nodes that cannot be faithfully exported to JSON Schema. */
|
|
30036
|
+
function findNonExportableSchemaNode(schema, path = "schema") {
|
|
30037
|
+
const def = zodDef(schema);
|
|
30038
|
+
if (!def) return;
|
|
30039
|
+
if (def.type === "transform") return `${path} uses .transform()`;
|
|
30040
|
+
if (def.checks?.some((check) => check._zod?.def?.type === "custom")) return `${path} uses .refine() or .superRefine()`;
|
|
30041
|
+
if (def.type === "pipe") {
|
|
30042
|
+
if (def.in && zodDef(def.in)?.type === "transform") return `${path} uses .preprocess()`;
|
|
30043
|
+
const inIssue = def.in ? findNonExportableSchemaNode(def.in, `${path}.pipe(in)`) : void 0;
|
|
30044
|
+
if (inIssue) return inIssue;
|
|
30045
|
+
const outIssue = def.out ? findNonExportableSchemaNode(def.out, `${path}.pipe(out)`) : void 0;
|
|
30046
|
+
if (outIssue) return outIssue;
|
|
30047
|
+
}
|
|
30048
|
+
if (def.shape) for (const [key, child] of Object.entries(def.shape)) {
|
|
30049
|
+
const issue = findNonExportableSchemaNode(child, `${path}.${key}`);
|
|
30050
|
+
if (issue) return issue;
|
|
30051
|
+
}
|
|
30052
|
+
if (def.element) {
|
|
30053
|
+
const issue = findNonExportableSchemaNode(def.element, `${path}[]`);
|
|
30054
|
+
if (issue) return issue;
|
|
30055
|
+
}
|
|
30056
|
+
if (def.options) for (const [index, option] of def.options.entries()) {
|
|
30057
|
+
const issue = findNonExportableSchemaNode(option, `${path}[${index}]`);
|
|
30058
|
+
if (issue) return issue;
|
|
30059
|
+
}
|
|
30060
|
+
if (def.left) {
|
|
30061
|
+
const issue = findNonExportableSchemaNode(def.left, `${path}.left`);
|
|
30062
|
+
if (issue) return issue;
|
|
30063
|
+
}
|
|
30064
|
+
if (def.right) {
|
|
30065
|
+
const issue = findNonExportableSchemaNode(def.right, `${path}.right`);
|
|
30066
|
+
if (issue) return issue;
|
|
30067
|
+
}
|
|
30068
|
+
if (def.valueType) {
|
|
30069
|
+
const issue = findNonExportableSchemaNode(def.valueType, `${path}.value`);
|
|
30070
|
+
if (issue) return issue;
|
|
30071
|
+
}
|
|
30072
|
+
if (def.items) for (const [index, item] of def.items.entries()) {
|
|
30073
|
+
const issue = findNonExportableSchemaNode(item, `${path}[${index}]`);
|
|
30074
|
+
if (issue) return issue;
|
|
30075
|
+
}
|
|
30076
|
+
if (def.rest) {
|
|
30077
|
+
const issue = findNonExportableSchemaNode(def.rest, `${path}.rest`);
|
|
30078
|
+
if (issue) return issue;
|
|
30079
|
+
}
|
|
30080
|
+
}
|
|
30081
|
+
function formatSchemaExportError(cause) {
|
|
30082
|
+
return /* @__PURE__ */ new Error(`Cannot export schema to JSON Schema: ${cause}. ${EXPORT_FIX}`);
|
|
30083
|
+
}
|
|
29966
30084
|
function schemaToJson(schema) {
|
|
29967
|
-
|
|
30085
|
+
const issue = findNonExportableSchemaNode(schema);
|
|
30086
|
+
if (issue) throw formatSchemaExportError(issue);
|
|
30087
|
+
try {
|
|
30088
|
+
return toJSONSchema(schema, { target: "openapi-3.0" });
|
|
30089
|
+
} catch (error) {
|
|
30090
|
+
throw formatSchemaExportError(error instanceof Error ? error.message : String(error));
|
|
30091
|
+
}
|
|
29968
30092
|
}
|
|
29969
30093
|
function collectIntegrationKeys(integrations) {
|
|
29970
30094
|
return integrations.map((integration) => integration.key);
|
|
@@ -30745,4 +30869,4 @@ async function emitStoredRouteManifestForProject(projectRoot) {
|
|
|
30745
30869
|
//#endregion
|
|
30746
30870
|
export { validatePollGroups as A, attachmentSlugFromRecord as B, pollRouteFromSourceSlug as C, validateAttachmentTargets as D, toStoredRouteManifest as E, webhookManifestAttachmentSchemasFromBindings as F, packAssetDirs as G, computeCallSiteIds as H, webhookMatchSchemaForBindings as I, entryIdFromFile as J, discoverEntries as K, webhookRouteFromEndpoint as L, validateTriggerAttachments as M, validateUniqueAttachmentSlugs as N, validateImportedTriggerAttachment as O, validateUniqueTriggerSourceSlugs as P, walkTypeScriptFiles as Q, workflowKeyForAttachment as R, pollGroupRouteFromId as S, serializeRouteManifest as T, diagnoseWorkflowSource as U, classifyCall as V, locateWorkflow as W, shouldSkipKeystrokeModuleFile as X, readKeystrokeIgnoreDirective as Y, validateUniqueModuleKeys as Z, importAgentDefinition as _, buildStoredRouteManifestForProject as a, persistStoredRouteManifest as b, collectAgentAppSlugs as c, discoverAgentEntries as d, discoverSkillManifestEntries as f, emitStoredRouteManifestForProject as g, discoverWorkflows as h, buildPollGroups as i, validateProjectModules as j, validateImportedWorkflowDefinition as k, collectAgentToolSlugs as l, discoverWorkflowEntries as m, agentManifestEntry as n, buildStoredRouteManifestFromContext as o, discoverTriggerAttachments as p, discoverModuleFileEntries as q, agentRouteFromKey as r, buildWebhookBindingsByRoute as s, agentKeyForAttachment as t, countAgentCredentials as u, importTriggerAttachments as v, schemaToJson as w, pollGroupId as x, importWorkflowDefinition as y, workflowRouteFromKey as z };
|
|
30747
30871
|
|
|
30748
|
-
//# sourceMappingURL=dist-
|
|
30872
|
+
//# sourceMappingURL=dist-rdfKnOL3.mjs.map
|