@keystrokehq/cli 0.1.163 → 0.1.164

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,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { n as __require, r as __toESM, t as __commonJSMin } from "./chunk-DiodbrVj.mjs";
3
- import { Ca as string, Da as datetime, Dn as ProjectArtifactIndexSchema, Ea as url, Ei as zodToStoredJsonSchema, Fi as getOpenApiJsonSchema, Ii as normalizeCredentialList, Li as requiredDisplayTextSchema, Ln as PromptResponseSchema, Oa as safeParse$1, Pi as credentialInputSchema, Ri as DEFAULT_CLOUD_PLATFORM_ORIGIN, Sa as record, Si as parseStoredRouteManifest, Ta as unknown, Wi as PublicModelsResponseSchema, _a as looseObject, aa as ZodType, an as PROJECT_MANIFEST_REL_PATH, ba as optional, bi as parseProjectManifest, ca as _null, da as boolean$1, fa as custom, ga as literal, ha as lazy, ia as ZodIssueCode, ka as NEVER, la as any, ma as intersection, oa as _enum, pa as discriminatedUnion, ra as number$1, sa as _function, ua as array, va as number, wa as union, xa as preprocess, ya as object } from "./dist-BgPOKEEt.mjs";
3
+ import { Aa as NEVER, Ca as record, Ci as parseStoredRouteManifest, Da as url, Di as zodToStoredJsonSchema, Ea as unknown, Fi as credentialInputSchema, Gi as PublicModelsResponseSchema, Ii as getOpenApiJsonSchema, Li as normalizeCredentialList, Oa as datetime, On as ProjectArtifactIndexSchema, Ri as requiredDisplayTextSchema, Rn as PromptResponseSchema, Sa as preprocess, Ta as union, _a as literal, aa as ZodIssueCode, ba as object, ca as _function, da as array, fa as boolean$1, ga as lazy, ha as intersection, ia as number$1, ka as safeParse$1, la as _null, ma as discriminatedUnion, oa as ZodType, on as PROJECT_MANIFEST_REL_PATH, pa as custom, sa as _enum, ua as any, va as looseObject, wa as string, xa as optional, xi as parseProjectManifest, ya as number, zi as DEFAULT_CLOUD_PLATFORM_ORIGIN } from "./dist-neAmdOvZ.mjs";
4
4
  import "./chunk-4RUAZWKT-D60fyWAB.mjs";
5
5
  import "./chunk-SAI2SPQQ-CVRoDNs9.mjs";
6
6
  import "./chunk-WNH3HOQA-BCZUOjCJ.mjs";
@@ -1833,64 +1833,17 @@ function buildWorkflowCanvasGraph(source, options = {}) {
1833
1833
  return buildGraph(sourceFile, located, { resolveSlug: options.resolveSlug });
1834
1834
  }
1835
1835
  //#endregion
1836
- //#region ../../packages/sandbox/dist/sizes-bFiP6d6Y.mjs
1837
- /** Author-facing VM size presets (t-shirt sizes; Daytona-aligned). */
1836
+ //#region ../../packages/sandbox/dist/sizes-CeGfTo5B.mjs
1837
+ /**
1838
+ * Author-facing VM size presets (legacy).
1839
+ * Hosted Modal ignores `size` (small request + burst). Local microsandbox still maps
1840
+ * presets to guest CPU/RAM via {@link resolveSandboxResources}.
1841
+ */
1838
1842
  const SandboxSizeSchema = _enum([
1839
1843
  "small",
1840
1844
  "medium",
1841
1845
  "large"
1842
1846
  ]);
1843
- const SIZE_RESOURCES = {
1844
- small: {
1845
- cpu: 1,
1846
- memoryGiB: 1,
1847
- diskGiB: 3,
1848
- memoryMiB: 1024
1849
- },
1850
- medium: {
1851
- cpu: 2,
1852
- memoryGiB: 4,
1853
- diskGiB: 8,
1854
- memoryMiB: 4096
1855
- },
1856
- large: {
1857
- cpu: 4,
1858
- memoryGiB: 8,
1859
- diskGiB: 10,
1860
- memoryMiB: 8192
1861
- }
1862
- };
1863
- /**
1864
- * Daytona pay-as-you-go rates (USD per second of reserved resource).
1865
- * @see https://www.daytona.io/docs/en/billing/
1866
- */
1867
- const DAYTONA_CPU_USD_PER_SECOND = 14e-6;
1868
- const DAYTONA_MEMORY_USD_PER_GIB_SECOND = 45e-7;
1869
- const DAYTONA_DISK_USD_PER_GIB_SECOND = 3e-8;
1870
- function daytonaSandboxUsdPerSecond(resources) {
1871
- return resources.cpu * DAYTONA_CPU_USD_PER_SECOND + resources.memoryGiB * DAYTONA_MEMORY_USD_PER_GIB_SECOND + resources.diskGiB * DAYTONA_DISK_USD_PER_GIB_SECOND;
1872
- }
1873
- /**
1874
- * Pass-through µc/s for a size (ceil to match historical small rate: 18.59 → 19).
1875
- * small 1/1/3 → 19, medium 2/4/8 → 47, large 4/8/10 → 93.
1876
- */
1877
- function vmSecondRateMicroCredits(size) {
1878
- return Math.ceil(daytonaSandboxUsdPerSecond(resolveSandboxResources(size)) * 1e6);
1879
- }
1880
- /**
1881
- * Scale factor for `vm_second` quantity so `quantity * 19µc` ≈ Daytona cost.
1882
- * Fractional on purpose — charge math rounds after multiplying the small rate.
1883
- */
1884
- function vmSecondSizeMultiplier(size) {
1885
- return vmSecondRateMicroCredits(normalizeSandboxSize(size)) / vmSecondRateMicroCredits("small");
1886
- }
1887
- vmSecondSizeMultiplier("small"), vmSecondSizeMultiplier("medium"), vmSecondSizeMultiplier("large");
1888
- function normalizeSandboxSize(size) {
1889
- return size ?? "small";
1890
- }
1891
- function resolveSandboxResources(size) {
1892
- return SIZE_RESOURCES[normalizeSandboxSize(size)];
1893
- }
1894
1847
  //#endregion
1895
1848
  //#region ../../packages/sandbox/dist/resolve-sandbox-definition-Bgbd2rfm.mjs
1896
1849
  const SKIP_DIRS$1$1 = new Set([".git", "node_modules"]);
@@ -1928,7 +1881,7 @@ function runWithAppRoot(appRoot, fn) {
1928
1881
  return appRootStorage.run(appRoot, fn);
1929
1882
  }
1930
1883
  //#endregion
1931
- //#region ../../packages/sandbox/dist/files-Bo1xCPZl.mjs
1884
+ //#region ../../packages/sandbox/dist/files-Ds9QSoth.mjs
1932
1885
  const SandboxModeSchema = _enum(["in-process", "vm"]);
1933
1886
  const SandboxFileContentSchema = object({
1934
1887
  path: string(),
@@ -1957,7 +1910,19 @@ const SandboxGitSchema = object({
1957
1910
  clone: object({
1958
1911
  repository: string().trim().min(1).regex(GITHUB_REPOSITORY_PATTERN, "repository must be \"owner/repo\""),
1959
1912
  credential: string().trim().min(1),
1913
+ /** Branch or tag to check out. Ignored when `commit` is set. */
1960
1914
  branch: string().trim().min(1).optional(),
1915
+ /**
1916
+ * Full 40-character commit SHA. Checked out after clone/fetch.
1917
+ * Prefer this over `branch` when pinning an exact revision.
1918
+ * Abbreviated SHAs are rejected — `git fetch origin <sha>` requires the full object id.
1919
+ */
1920
+ commit: string().trim().regex(/^[0-9a-f]{40}$/i, "commit must be a full 40-character hex SHA").optional(),
1921
+ /**
1922
+ * When true (default), use a shallow clone/fetch (`--depth 1`).
1923
+ * Set `false` for full history.
1924
+ */
1925
+ shallow: boolean$1().optional(),
1961
1926
  path: string().trim().min(1).optional()
1962
1927
  }),
1963
1928
  user: SandboxGitUserSchema.optional()
@@ -1970,7 +1935,10 @@ object({
1970
1935
  /** Sandbox execution mode. Defaults to in-process when omitted. */
1971
1936
  mode: SandboxModeSchema.optional(),
1972
1937
  files: SandboxFilesInputSchema.optional(),
1973
- /** VM size preset. Requires `mode: "vm"`. Defaults to `small` when omitted. */
1938
+ /**
1939
+ * Legacy VM size preset. Requires `mode: "vm"`. Hosted Modal ignores this;
1940
+ * microsandbox may still map it to guest resources.
1941
+ */
1974
1942
  size: SandboxSizeSchema.optional(),
1975
1943
  credentials: array(credentialInputSchema).optional(),
1976
1944
  env: SandboxEnvFnSchema.optional(),
@@ -2910,6 +2878,8 @@ object({
2910
2878
  repository: string().trim().min(1),
2911
2879
  credential: string().trim().min(1),
2912
2880
  branch: string().trim().min(1).optional(),
2881
+ commit: string().trim().min(1).optional(),
2882
+ shallow: boolean$1().optional(),
2913
2883
  path: string().trim().min(1).optional()
2914
2884
  }),
2915
2885
  user: object({
@@ -25437,6 +25407,77 @@ const platformAgentProjectSnapshotsSqlite = sqliteTable("platform_agent_project_
25437
25407
  updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull(),
25438
25408
  createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull()
25439
25409
  });
25410
+ /**
25411
+ * Org-scoped Modal env Images for project-agent `defineSandbox({ setup })`.
25412
+ * Keyed by setup fingerprint so agents with identical setup share one Image.
25413
+ * No RLS — platform Modal jobs read/write globally by organization id.
25414
+ */
25415
+ const projectAgentEnvImages = pgTable("project_agent_env_images", {
25416
+ id: text$1("id").primaryKey(),
25417
+ organizationId: text$1("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
25418
+ /** sha256 of setup commands + base image name. */
25419
+ setupHash: text$1("setup_hash").notNull(),
25420
+ baseImageName: text$1("base_image_name").notNull(),
25421
+ /** JSON array of setup command strings used for this fingerprint. */
25422
+ setupCommands: text$1("setup_commands").notNull(),
25423
+ modalImageId: text$1("modal_image_id"),
25424
+ buildStatus: text$1("build_status").$type().notNull(),
25425
+ buildStartedAt: timestamp("build_started_at", { withTimezone: true }),
25426
+ lastError: text$1("last_error"),
25427
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
25428
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
25429
+ }, (table) => [uniqueIndex$1("project_agent_env_images_org_hash_idx").on(table.organizationId, table.setupHash)]);
25430
+ const projectAgentEnvImagesSqlite = sqliteTable("project_agent_env_images", {
25431
+ id: text("id").primaryKey(),
25432
+ organizationId: text("organization_id").notNull().references(() => organizationsSqlite.id, { onDelete: "cascade" }),
25433
+ setupHash: text("setup_hash").notNull(),
25434
+ baseImageName: text("base_image_name").notNull(),
25435
+ setupCommands: text("setup_commands").notNull(),
25436
+ modalImageId: text("modal_image_id"),
25437
+ buildStatus: text("build_status").$type().notNull(),
25438
+ buildStartedAt: integer("build_started_at", { mode: "timestamp_ms" }),
25439
+ lastError: text("last_error"),
25440
+ createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
25441
+ updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull()
25442
+ }, (table) => [uniqueIndex("project_agent_env_images_org_hash_idx").on(table.organizationId, table.setupHash)]);
25443
+ /**
25444
+ * Control-plane pointers for hosted project-agent (`mode: "vm"`) Modal sandboxes.
25445
+ * Keyed by product `agent_sessions.id`. No RLS — maintenance GC lists globally.
25446
+ *
25447
+ * - `sandbox_id`: live Modal sandbox while warm (cleared on grace detach / GC)
25448
+ * - `modal_image_id`: last successful per-session filesystem Image for cold boot
25449
+ * - `sandbox_last_used_at`: activity clock for warm touch + 24h idle GC
25450
+ */
25451
+ const projectAgentSessionSandboxes = pgTable("project_agent_session_sandboxes", {
25452
+ sessionId: text$1("session_id").primaryKey(),
25453
+ organizationId: text$1("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
25454
+ projectId: text$1("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
25455
+ agentId: text$1("agent_id").notNull(),
25456
+ sandboxId: text$1("sandbox_id"),
25457
+ sandboxLastUsedAt: timestamp("sandbox_last_used_at", { withTimezone: true }),
25458
+ modalImageId: text$1("modal_image_id"),
25459
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
25460
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
25461
+ }, (table) => [
25462
+ index$1("project_agent_session_sandboxes_project_idx").on(table.projectId),
25463
+ index$1("project_agent_session_sandboxes_sandbox_last_used_idx").on(table.sandboxLastUsedAt).where(sql`${table.sandboxId} IS NOT NULL`),
25464
+ index$1("project_agent_session_sandboxes_image_last_used_idx").on(table.sandboxLastUsedAt).where(sql`${table.modalImageId} IS NOT NULL`)
25465
+ ]);
25466
+ const projectAgentSessionSandboxesSqlite = sqliteTable("project_agent_session_sandboxes", {
25467
+ sessionId: text("session_id").primaryKey(),
25468
+ organizationId: text("organization_id").notNull().references(() => organizationsSqlite.id, { onDelete: "cascade" }),
25469
+ projectId: text("project_id").notNull().references(() => projectsSqlite.id, { onDelete: "cascade" }),
25470
+ agentId: text("agent_id").notNull(),
25471
+ sandboxId: text("sandbox_id"),
25472
+ sandboxLastUsedAt: integer("sandbox_last_used_at", { mode: "timestamp_ms" }),
25473
+ modalImageId: text("modal_image_id"),
25474
+ createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
25475
+ updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull()
25476
+ }, (table) => [
25477
+ index("project_agent_session_sandboxes_project_idx").on(table.projectId),
25478
+ index("project_agent_session_sandboxes_sandbox_last_used_idx").on(table.sandboxLastUsedAt).where(sql`${table.sandboxId} IS NOT NULL`),
25479
+ index("project_agent_session_sandboxes_image_last_used_idx").on(table.sandboxLastUsedAt).where(sql`${table.modalImageId} IS NOT NULL`)
25480
+ ]);
25440
25481
  const publishedForms = pgTable("published_forms", {
25441
25482
  id: text$1("id").primaryKey(),
25442
25483
  organizationId: text$1("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
@@ -26504,6 +26545,14 @@ const tableRegistry = {
26504
26545
  pg: platformAgentProjectSnapshots,
26505
26546
  sqlite: platformAgentProjectSnapshotsSqlite
26506
26547
  },
26548
+ projectAgentSessionSandboxes: {
26549
+ pg: projectAgentSessionSandboxes,
26550
+ sqlite: projectAgentSessionSandboxesSqlite
26551
+ },
26552
+ projectAgentEnvImages: {
26553
+ pg: projectAgentEnvImages,
26554
+ sqlite: projectAgentEnvImagesSqlite
26555
+ },
26507
26556
  publishedForms: {
26508
26557
  pg: publishedForms,
26509
26558
  sqlite: publishedFormsSqlite
@@ -45221,6 +45270,7 @@ function countAgentCredentials(agent) {
45221
45270
  function agentManifestEntry(agent, options) {
45222
45271
  const toolRequirements = collectAgentToolRequirements(agent);
45223
45272
  const sandboxRequirements = collectAgentSandboxRequirements(agent);
45273
+ const sandboxSetup = agent.sandbox?.setup?.map((c) => c.trim()).filter(Boolean);
45224
45274
  return {
45225
45275
  kind: "agent",
45226
45276
  slug: agent.slug,
@@ -45235,7 +45285,8 @@ function agentManifestEntry(agent, options) {
45235
45285
  appSlugs: collectAgentAppSlugs(agent),
45236
45286
  toolSlugs: collectAgentToolSlugs(agent),
45237
45287
  ...Object.keys(toolRequirements).length ? { toolRequirements } : {},
45238
- ...sandboxRequirements.length ? { sandboxRequirements } : {}
45288
+ ...sandboxRequirements.length ? { sandboxRequirements } : {},
45289
+ ...sandboxSetup?.length ? { sandboxSetup } : {}
45239
45290
  };
45240
45291
  }
45241
45292
  function resolveActionFromModule(mod, filePath) {
@@ -45577,7 +45628,8 @@ function serializeRouteManifest(manifest) {
45577
45628
  appSlugs: entry.appSlugs,
45578
45629
  toolSlugs: entry.toolSlugs,
45579
45630
  ...entry.toolRequirements ? { toolRequirements: entry.toolRequirements } : {},
45580
- ...entry.sandboxRequirements?.length ? { sandboxRequirements: entry.sandboxRequirements } : {}
45631
+ ...entry.sandboxRequirements?.length ? { sandboxRequirements: entry.sandboxRequirements } : {},
45632
+ ...entry.sandboxSetup?.length ? { sandboxSetup: entry.sandboxSetup } : {}
45581
45633
  });
45582
45634
  break;
45583
45635
  case "action":
@@ -46731,4 +46783,4 @@ async function emitStoredRouteManifestForProject(projectRoot) {
46731
46783
  //#endregion
46732
46784
  export { artifactIndexFromModules as $, serializeRouteManifest as A, validateProjectModules as B, isModularManifestEmitCacheHit as C, pollRouteFromSourceSlug as D, pollGroupRouteFromId as E, tryReadProjectManifest as F, webhookMatchSchemaForBindings as G, validateUniqueAttachmentSlugs as H, validateAttachmentTargets as I, workflowRouteFromKey as J, webhookRouteFromEndpoint as K, validateImportedTriggerAttachment as L, sha256File as M, splitStoredRouteManifest as N, projectActionsFingerprint as O, toStoredRouteManifest as P, withMcpReadClient as Q, validateImportedWorkflowDefinition as R, integrationPackagesFingerprint as S, pollGroupId as T, validateUniqueTriggerSourceSlugs as U, validateTriggerAttachments as V, webhookManifestAttachmentSchemasFromBindings as W, PublicHttpUrlError as X, attachmentSlugFromRecord as Y, assertPublicHttpUrl as Z, emitStoredRouteManifestForProject as _, configureTelemetry as _t, buildPollGroups as a, computeCallSiteIds as at, importTriggerAttachments as b, shutdownTelemetry as bt, collectAgentAppSlugs as c, discoverEntries as ct, countAgentCredentials as d, readKeystrokeIgnoreDirective as dt, collectArtifactModules as et, discoverAgentEntries as f, shouldSkipKeystrokeModuleFile as ft, discoverWorkflows as g, captureException as gt, discoverWorkflowEntries as h, alias as ht, agentRouteFromKey as i, classifyCall as it, sha256Bytes as j, schemaToJson as k, collectAgentToolSlugs as l, discoverModuleFileEntries as lt, discoverTriggerAttachments as m, walkTypeScriptFiles as mt, agentKeyForAttachment as n, moduleBlobRefsFromModules as nt, buildStoredRouteManifestForProject as o, diagnoseWorkflowSource as ot, discoverSkillManifestEntries as p, validateUniqueModuleKeys as pt, workflowKeyForAttachment as q, agentManifestEntry as r, packDirFromDisk as rt, buildStoredRouteManifestFromContext as s, locateWorkflow as st, actionsCatalogFingerprint as t, mapInParallelBatches as tt, contentHashForModule as u, entryIdFromFile as ut, hashDirectoryContents as v, event as vt, persistModularRouteManifest as w, importWorkflowDefinition as x, importAgentDefinition as y, flushTelemetry as yt, validatePollGroups as z };
46733
46785
 
46734
- //# sourceMappingURL=dist-fy1jz-eq.mjs.map
46786
+ //# sourceMappingURL=dist-CGeyFdzI.mjs.map