@keystrokehq/cli 0.1.48 → 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.
@@ -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-DtDJareY.mjs";
4
- import "./dist-83uw4_yr.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-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;
@@ -30804,4 +30869,4 @@ async function emitStoredRouteManifestForProject(projectRoot) {
30804
30869
  //#endregion
30805
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 };
30806
30871
 
30807
- //# sourceMappingURL=dist-BhVoGfcQ.mjs.map
30872
+ //# sourceMappingURL=dist-rdfKnOL3.mjs.map