@keystrokehq/cli 0.1.68 → 0.1.70

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 { Br as object, Dr as ZodType, Fr as discriminatedUnion, Gr as union, Hr as preprocess, Lr as literal, Mr as array, Nr as boolean$1, Or as _enum, Pr as custom, Wr as string, Yr as toJSONSchema, br as parseStoredRouteManifest, cn as PublicModelsResponseSchema, dn as ROUTE_MANIFEST_REL_PATH, dr as credentialInputSchema, gr as normalizeCredentialList, kr as _function, nt as DEFAULT_CLOUD_PLATFORM_ORIGIN, sn as PromptResponseSchema, xr as requiredDisplayTextSchema, zr as number } from "./dist-qP0YVL-T.mjs";
4
- import "./dist-lGYSzJPL.mjs";
3
+ import { Ar as _null, Br as number, Dr as ZodType, Fr as discriminatedUnion, Gr as string, Kr as union, Lr as lazy, Mr as array, Nr as boolean$1, Or as _enum, Pr as custom, Rr as literal, Ur as preprocess, Vr as object, Wr as record, Xr as toJSONSchema, br as parseStoredRouteManifest, cn as PublicModelsResponseSchema, dn as ROUTE_MANIFEST_REL_PATH, dr as credentialInputSchema, gr as normalizeCredentialList, kr as _function, nt as DEFAULT_CLOUD_PLATFORM_ORIGIN, sn as PromptResponseSchema, xr as requiredDisplayTextSchema } from "./dist-Bzry3J_e.mjs";
4
+ import "./dist-Dfp6ywxz.mjs";
5
5
  import "./chunk-BZUGFHVS-CPWRFwK8.mjs";
6
6
  import "./chunk-DLL7UR66-BUYgzxnR.mjs";
7
7
  import "./chunk-TN7HHBQW-CSB_R-XD.mjs";
@@ -28,6 +28,7 @@ import ts from "typescript";
28
28
  import { bigint, boolean, doublePrecision, index, integer, jsonb, pgEnum, pgTable, primaryKey, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
29
29
  import { index as index$1, integer as integer$1, primaryKey as primaryKey$1, real, sqliteTable, text as text$1, uniqueIndex as uniqueIndex$1 } from "drizzle-orm/sqlite-core";
30
30
  import { sql } from "drizzle-orm";
31
+ import "drizzle-orm/pg-proxy";
31
32
  import "better-sqlite3";
32
33
  import "drizzle-orm/better-sqlite3";
33
34
  import "drizzle-orm/migrator";
@@ -242,7 +243,7 @@ function isCommentLine(line) {
242
243
  return line.startsWith("//") || line.startsWith("/*") || line.startsWith("*");
243
244
  }
244
245
  //#endregion
245
- //#region ../../packages/sandbox/dist/files-BOUCjfCQ.mjs
246
+ //#region ../../packages/sandbox/dist/files-EBXCAi4v.mjs
246
247
  const SandboxModeSchema = _enum(["in-process", "vm"]);
247
248
  const SandboxFileContentSchema = object({
248
249
  path: string(),
@@ -29638,6 +29639,16 @@ function isParseableCron(value) {
29638
29639
  return false;
29639
29640
  }
29640
29641
  }
29642
+ const jsonValueSchema = lazy(() => union([
29643
+ string(),
29644
+ number(),
29645
+ boolean$1(),
29646
+ _null(),
29647
+ array(jsonValueSchema),
29648
+ record(string(), jsonValueSchema)
29649
+ ]));
29650
+ /** Runtime schema for an optional static cron payload (JSON only). */
29651
+ const cronPayloadSchema = jsonValueSchema;
29641
29652
  const zodSchema$1 = custom((v) => v instanceof ZodType, "must be a Zod schema");
29642
29653
  const workflowSchema$1 = custom((v) => isWorkflow(v), "must be defineWorkflow(...)");
29643
29654
  const agentSchema$1 = custom((v) => typeof v === "object" && v !== null && typeof v.slug === "string" && v.slug.trim().length > 0 && typeof v.prompt === "function", "must be defineAgent(...)");
@@ -29666,14 +29677,15 @@ const triggerSourceSchema$1 = preprocess(normalizeLegacySlugFields$1, discrimina
29666
29677
  kind: literal("webhook"),
29667
29678
  ...baseSourceShape$1,
29668
29679
  endpoint: string().min(1),
29669
- request: zodSchema$1,
29680
+ payload: zodSchema$1,
29670
29681
  filter: zodSchema$1.optional(),
29671
29682
  passes: _function()
29672
29683
  }),
29673
29684
  object({
29674
29685
  kind: literal("cron"),
29675
29686
  ...baseSourceShape$1,
29676
- schedule: cronScheduleSchema$1
29687
+ schedule: cronScheduleSchema$1,
29688
+ payload: cronPayloadSchema.optional()
29677
29689
  }),
29678
29690
  object({
29679
29691
  kind: literal("poll"),
@@ -30192,11 +30204,16 @@ function findNonExportableSchemaNode(schema, path = "schema") {
30192
30204
  function formatSchemaExportError(cause) {
30193
30205
  return /* @__PURE__ */ new Error(`Cannot export schema to JSON Schema: ${cause}. ${EXPORT_FIX}`);
30194
30206
  }
30195
- function schemaToJson(schema) {
30207
+ function schemaToJson(schema, options = {}) {
30196
30208
  const issue = findNonExportableSchemaNode(schema);
30197
30209
  if (issue) throw formatSchemaExportError(issue);
30198
30210
  try {
30199
- return toJSONSchema(schema, { target: "openapi-3.0" });
30211
+ return toJSONSchema(schema, {
30212
+ target: "openapi-3.0",
30213
+ ...options.allowAdditionalProperties ? { override(ctx) {
30214
+ if (ctx.jsonSchema.type === "object") ctx.jsonSchema.additionalProperties = true;
30215
+ } } : {}
30216
+ });
30200
30217
  } catch (error) {
30201
30218
  throw formatSchemaExportError(error instanceof Error ? error.message : String(error));
30202
30219
  }
@@ -30262,10 +30279,7 @@ function serializeRouteManifest(manifest) {
30262
30279
  attachmentIds: entry.attachmentIds,
30263
30280
  moduleFile: entry.moduleFile,
30264
30281
  ...entry.sourceHash ? { sourceHash: entry.sourceHash } : {},
30265
- attachmentSchemas: Object.fromEntries(Object.entries(entry.attachmentSchemas).map(([attachmentSlug, schemas]) => [attachmentSlug, {
30266
- requestSchema: schemaToJson(schemas.request),
30267
- ...schemas.filter ? { filterSchema: schemaToJson(schemas.filter) } : {}
30268
- }])),
30282
+ attachmentSchemas: Object.fromEntries(Object.entries(entry.attachmentSchemas).map(([attachmentSlug, schemas]) => [attachmentSlug, { requestSchema: schemaToJson(schemas.request, { allowAdditionalProperties: true }) }])),
30269
30283
  ...entry.attachmentMeta ? { attachmentMeta: entry.attachmentMeta } : {}
30270
30284
  });
30271
30285
  break;
@@ -30362,14 +30376,15 @@ const triggerSourceSchema = preprocess(normalizeLegacySlugFields, discriminatedU
30362
30376
  kind: literal("webhook"),
30363
30377
  ...baseSourceShape,
30364
30378
  endpoint: string().min(1),
30365
- request: zodSchema,
30379
+ payload: zodSchema,
30366
30380
  filter: zodSchema.optional(),
30367
30381
  passes: _function()
30368
30382
  }),
30369
30383
  object({
30370
30384
  kind: literal("cron"),
30371
30385
  ...baseSourceShape,
30372
- schedule: cronScheduleSchema
30386
+ schedule: cronScheduleSchema,
30387
+ payload: cronPayloadSchema.optional()
30373
30388
  }),
30374
30389
  object({
30375
30390
  kind: literal("poll"),
@@ -30465,9 +30480,11 @@ function webhookSchemaEntriesFromBindings(bindings) {
30465
30480
  return bindings.flatMap((binding) => {
30466
30481
  const source = binding.discovered.attachment.source;
30467
30482
  if (source.kind !== "webhook") return [];
30483
+ const triggerId = typeof binding.options.triggerId === "string" ? binding.options.triggerId : void 0;
30468
30484
  return [{
30469
30485
  attachmentSlug: binding.discovered.slug,
30470
- request: source.request,
30486
+ ...triggerId ? { triggerId } : {},
30487
+ payload: source.payload,
30471
30488
  ...source.filter ? { filter: source.filter } : {}
30472
30489
  }];
30473
30490
  });
@@ -30475,17 +30492,14 @@ function webhookSchemaEntriesFromBindings(bindings) {
30475
30492
  function webhookMatchSchemaForBindings(bindings) {
30476
30493
  const schemas = bindings.flatMap((binding) => {
30477
30494
  const source = binding.discovered.attachment.source;
30478
- return source.kind === "webhook" ? [source.request] : [];
30495
+ return source.kind === "webhook" ? [source.payload] : [];
30479
30496
  });
30480
30497
  if (schemas.length === 0) throw new Error("Webhook bindings require at least one webhook source");
30481
30498
  if (schemas.length === 1) return schemas[0];
30482
30499
  return union(schemas);
30483
30500
  }
30484
30501
  function webhookManifestAttachmentSchemasFromBindings(bindings) {
30485
- return Object.fromEntries(webhookSchemaEntriesFromBindings(bindings).map((entry) => [entry.attachmentSlug, {
30486
- request: entry.request,
30487
- ...entry.filter ? { filter: entry.filter } : {}
30488
- }]));
30502
+ return Object.fromEntries(webhookSchemaEntriesFromBindings(bindings).map((entry) => [entry.attachmentSlug, { request: entry.payload }]));
30489
30503
  }
30490
30504
  async function discoverWorkflowEntries(workflowsDir, options) {
30491
30505
  const files = await discoverModuleFileEntries(workflowsDir, {
@@ -30980,4 +30994,4 @@ async function emitStoredRouteManifestForProject(projectRoot) {
30980
30994
  //#endregion
30981
30995
  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 };
30982
30996
 
30983
- //# sourceMappingURL=dist-DNsgHccO.mjs.map
30997
+ //# sourceMappingURL=dist-JMNXwH6-.mjs.map