@keystrokehq/cli 0.1.162 → 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.
package/dist/index.mjs CHANGED
@@ -40,7 +40,7 @@ process.emitWarning = ((warning, ...args) => {
40
40
  if ((type === "ExperimentalWarning" || /ExperimentalWarning/i.test(type)) && /SQLite/i.test(message)) return;
41
41
  return Reflect.apply(originalEmitWarning, process, [warning, ...args]);
42
42
  });
43
- const { runCli } = await import("./program-BWeEKhR_.mjs");
43
+ const { runCli } = await import("./program-Ct4qJuBN.mjs");
44
44
  await runCli(process.argv);
45
45
  //#endregion
46
46
  export {};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { S as resolveCliRoot, a as formatReleaseAgeBlockMessage, b as shouldUpdateCliVersion, i as readPnpmMinimumReleaseAgeMinutes, o as isReleaseAgeBlock, r as computeReleaseAgeRetryAfter, s as detectCliInstall, t as runPackageManagerUpdate, v as fetchLatestCliRelease, w as getCliConfigDir, x as readCliVersion, y as resolveCliDistTag } from "./run-package-manager-update-CuLe-Jux.mjs";
2
+ import { S as resolveCliRoot, a as formatReleaseAgeBlockMessage, b as shouldUpdateCliVersion, i as readPnpmMinimumReleaseAgeMinutes, o as isReleaseAgeBlock, r as computeReleaseAgeRetryAfter, s as detectCliInstall, t as runPackageManagerUpdate, v as fetchLatestCliRelease, w as getCliConfigDir, x as readCliVersion, y as resolveCliDistTag } from "./run-package-manager-update-D6cBQMsZ.mjs";
3
3
  import { join } from "node:path";
4
4
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
5
5
  import { spawnSync } from "node:child_process";
@@ -141,4 +141,4 @@ async function maybeAutoUpdate(argv) {
141
141
  //#endregion
142
142
  export { maybeAutoUpdate };
143
143
 
144
- //# sourceMappingURL=maybe-auto-update-J-Am1CbS.mjs.map
144
+ //# sourceMappingURL=maybe-auto-update-B-zGDplJ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"maybe-auto-update-J-Am1CbS.mjs","names":[],"sources":["../src/update/update-block-cache.ts","../src/update/maybe-auto-update.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nimport { getCliConfigDir } from \"../config\";\n\nexport type UpdateBlockCache = {\n registryLatest?: string;\n blockedUntil?: string;\n lastFailedAt?: string;\n};\n\nconst CACHE_FILE = \"update-check.json\";\nconst GENERIC_RETRY_MS = 24 * 60 * 60 * 1000;\n\nfunction cachePath(configDir = getCliConfigDir()): string {\n return join(configDir, CACHE_FILE);\n}\n\nexport function readUpdateBlockCache(configDir?: string): UpdateBlockCache {\n const path = cachePath(configDir);\n if (!existsSync(path)) {\n return {};\n }\n\n try {\n return JSON.parse(readFileSync(path, \"utf8\")) as UpdateBlockCache;\n } catch {\n return {};\n }\n}\n\nexport function writeUpdateBlockCache(cache: UpdateBlockCache, configDir?: string): void {\n const dir = configDir ?? getCliConfigDir();\n mkdirSync(dir, { recursive: true });\n writeFileSync(cachePath(dir), `${JSON.stringify(cache, null, 2)}\\n`, \"utf8\");\n}\n\nexport function shouldSkipCachedUpdate(\n cache: UpdateBlockCache,\n registryLatest: string,\n now = Date.now(),\n): boolean {\n if (cache.registryLatest !== registryLatest) {\n return false;\n }\n\n if (cache.blockedUntil) {\n const blockedUntilMs = Date.parse(cache.blockedUntil);\n if (Number.isFinite(blockedUntilMs) && blockedUntilMs > now) {\n return true;\n }\n }\n\n if (cache.lastFailedAt) {\n const lastFailedMs = Date.parse(cache.lastFailedAt);\n if (Number.isFinite(lastFailedMs) && now - lastFailedMs < GENERIC_RETRY_MS) {\n return true;\n }\n }\n\n return false;\n}\n\nexport function clearUpdateBlockCache(configDir?: string): void {\n writeUpdateBlockCache({}, configDir);\n}\n\nexport function recordReleaseAgeBlock(options: {\n registryLatest: string;\n retryAfter?: Date;\n configDir?: string;\n}): void {\n writeUpdateBlockCache(\n {\n registryLatest: options.registryLatest,\n blockedUntil: options.retryAfter?.toISOString(),\n },\n options.configDir,\n );\n}\n\nexport function recordGenericUpdateFailure(registryLatest: string, configDir?: string): void {\n writeUpdateBlockCache(\n {\n registryLatest,\n lastFailedAt: new Date().toISOString(),\n },\n configDir,\n );\n}\n","import { spawnSync } from \"node:child_process\";\n\nimport { resolveCliRoot } from \"../project/resolve-cli-root\";\nimport { readCliVersion } from \"../version\";\nimport { shouldUpdateCliVersion } from \"./compare-version\";\nimport { detectCliInstall } from \"./detect-cli-install\";\nimport { formatReleaseAgeBlockMessage, isReleaseAgeBlock } from \"./detect-release-age-block\";\nimport { fetchLatestCliRelease } from \"./fetch-latest-version\";\nimport {\n computeReleaseAgeRetryAfter,\n readPnpmMinimumReleaseAgeMinutes,\n} from \"./read-pnpm-release-age-minutes\";\nimport { resolveCliDistTag } from \"./resolve-cli-dist-tag\";\nimport { runPackageManagerUpdate } from \"./run-package-manager-update\";\nimport {\n clearUpdateBlockCache,\n readUpdateBlockCache,\n recordGenericUpdateFailure,\n recordReleaseAgeBlock,\n shouldSkipCachedUpdate,\n} from \"./update-block-cache\";\n\nfunction isTopLevelUpdateCommand(args: string[]): boolean {\n const valueFlags = new Set([\"--project\", \"--organization\", \"--dir\"]);\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg === undefined) {\n return false;\n }\n\n if (arg === \"--\") {\n return args[i + 1] === \"update\";\n }\n\n if (arg.startsWith(\"-\")) {\n if (\n arg === \"-h\" ||\n arg === \"--help\" ||\n arg === \"-V\" ||\n arg === \"--version\" ||\n arg.startsWith(\"-V\")\n ) {\n continue;\n }\n\n if (arg.includes(\"=\")) {\n continue;\n }\n\n if (valueFlags.has(arg) || arg.startsWith(\"--\")) {\n i++;\n }\n continue;\n }\n\n return arg === \"update\";\n }\n\n return false;\n}\n\nfunction shouldSkipAutoUpdate(argv: string[]): boolean {\n if (\n process.env.KEYSTROKE_DEV ||\n process.env.KEYSTROKE_SKIP_UPDATE ||\n process.env.KEYSTROKE_UPDATING\n ) {\n return true;\n }\n\n if (process.env.CI === \"true\" || process.env.CI === \"1\") {\n return true;\n }\n\n const args = argv.slice(2);\n if (args.length === 0) {\n return false;\n }\n\n // Explicit `keystroke update` owns CLI + project package updates.\n if (isTopLevelUpdateCommand(args)) {\n return true;\n }\n\n return args.every(\n (arg) =>\n arg === \"-V\" ||\n arg === \"--version\" ||\n arg === \"-h\" ||\n arg === \"--help\" ||\n arg.startsWith(\"-V\"),\n );\n}\n\nfunction reexecCli(argv: string[]): never {\n const result = spawnSync(process.execPath, argv.slice(1), {\n stdio: \"inherit\",\n env: {\n ...process.env,\n KEYSTROKE_UPDATING: \"1\",\n },\n });\n\n process.exit(result.status ?? 1);\n}\n\nfunction releaseAgeRetryAfter(\n install: NonNullable<ReturnType<typeof detectCliInstall>>,\n publishedAt: string | undefined,\n): Date | undefined {\n if (install.packageManager !== \"pnpm\") {\n return undefined;\n }\n\n return computeReleaseAgeRetryAfter(publishedAt, readPnpmMinimumReleaseAgeMinutes());\n}\n\nexport async function maybeAutoUpdate(argv: string[]): Promise<void> {\n if (shouldSkipAutoUpdate(argv)) {\n return;\n }\n\n const install = detectCliInstall(resolveCliRoot(import.meta.url));\n if (!install || (install.kind === \"local\" && !install.projectRoot)) {\n return;\n }\n\n const currentVersion = readCliVersion();\n const distTag = resolveCliDistTag();\n const release = await fetchLatestCliRelease(distTag);\n\n if (\n !release ||\n !shouldUpdateCliVersion({\n registryVersion: release.version,\n currentVersion,\n distTag,\n })\n ) {\n clearUpdateBlockCache();\n return;\n }\n\n const cache = readUpdateBlockCache();\n if (shouldSkipCachedUpdate(cache, release.version)) {\n return;\n }\n\n process.stderr.write(\n `Updating @keystrokehq/cli ${currentVersion} -> ${release.version} (@${distTag}) via ${install.packageManager}...\\n`,\n );\n\n const result = runPackageManagerUpdate(install, distTag);\n const installedVersion = readCliVersion();\n\n if (installedVersion.trim() !== currentVersion.trim()) {\n clearUpdateBlockCache();\n process.stderr.write(`Updated @keystrokehq/cli ${currentVersion} -> ${installedVersion}.\\n`);\n reexecCli(argv);\n }\n\n if (result.ok) {\n clearUpdateBlockCache();\n return;\n }\n\n if (isReleaseAgeBlock(result.output)) {\n const retryAfter = releaseAgeRetryAfter(install, release.publishedAt);\n recordReleaseAgeBlock({\n registryLatest: release.version,\n retryAfter,\n });\n process.stderr.write(\n `${formatReleaseAgeBlockMessage({\n currentVersion,\n availableVersion: release.version,\n retryAfter,\n })}\\n`,\n );\n return;\n }\n\n recordGenericUpdateFailure(release.version);\n process.stderr.write(\"Auto-update failed; continuing with the current version.\\n\");\n}\n"],"mappings":";;;;;;AAWA,MAAM,aAAa;AACnB,MAAM,mBAAmB,OAAU,KAAK;AAExC,SAAS,UAAU,YAAY,gBAAgB,GAAW;CACxD,OAAO,KAAK,WAAW,UAAU;AACnC;AAEA,SAAgB,qBAAqB,WAAsC;CACzE,MAAM,OAAO,UAAU,SAAS;CAChC,IAAI,CAAC,WAAW,IAAI,GAClB,OAAO,CAAC;CAGV,IAAI;EACF,OAAO,KAAK,MAAM,aAAa,MAAM,MAAM,CAAC;CAC9C,QAAQ;EACN,OAAO,CAAC;CACV;AACF;AAEA,SAAgB,sBAAsB,OAAyB,WAA0B;CACvF,MAAM,MAAM,aAAa,gBAAgB;CACzC,UAAU,KAAK,EAAE,WAAW,KAAK,CAAC;CAClC,cAAc,UAAU,GAAG,GAAG,GAAG,KAAK,UAAU,OAAO,MAAM,CAAC,EAAE,KAAK,MAAM;AAC7E;AAEA,SAAgB,uBACd,OACA,gBACA,MAAM,KAAK,IAAI,GACN;CACT,IAAI,MAAM,mBAAmB,gBAC3B,OAAO;CAGT,IAAI,MAAM,cAAc;EACtB,MAAM,iBAAiB,KAAK,MAAM,MAAM,YAAY;EACpD,IAAI,OAAO,SAAS,cAAc,KAAK,iBAAiB,KACtD,OAAO;CAEX;CAEA,IAAI,MAAM,cAAc;EACtB,MAAM,eAAe,KAAK,MAAM,MAAM,YAAY;EAClD,IAAI,OAAO,SAAS,YAAY,KAAK,MA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sBAAsB;GACpB,gBAAgB,QAAQ;GACxB;EACF,CAAC;EACD,QAAQ,OAAO,MACb,GAAG,6BAA6B;GAC9B;GACA,kBAAkB,QAAQ;GAC1B;EACF,CAAC,EAAE,GACL;EACA;CACF;CAEA,2BAA2B,QAAQ,OAAO;CAC1C,QAAQ,OAAO,MAAM,4DAA4D;AACnF"}
1
+ {"version":3,"file":"maybe-auto-update-B-zGDplJ.mjs","names":[],"sources":["../src/update/update-block-cache.ts","../src/update/maybe-auto-update.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nimport { getCliConfigDir } from \"../config\";\n\nexport type UpdateBlockCache = {\n registryLatest?: string;\n blockedUntil?: string;\n lastFailedAt?: string;\n};\n\nconst CACHE_FILE = \"update-check.json\";\nconst GENERIC_RETRY_MS = 24 * 60 * 60 * 1000;\n\nfunction cachePath(configDir = getCliConfigDir()): string {\n return join(configDir, CACHE_FILE);\n}\n\nexport function readUpdateBlockCache(configDir?: string): UpdateBlockCache {\n const path = cachePath(configDir);\n if (!existsSync(path)) {\n return {};\n }\n\n try {\n return JSON.parse(readFileSync(path, \"utf8\")) as UpdateBlockCache;\n } catch {\n return {};\n }\n}\n\nexport function writeUpdateBlockCache(cache: UpdateBlockCache, configDir?: string): void {\n const dir = configDir ?? getCliConfigDir();\n mkdirSync(dir, { recursive: true });\n writeFileSync(cachePath(dir), `${JSON.stringify(cache, null, 2)}\\n`, \"utf8\");\n}\n\nexport function shouldSkipCachedUpdate(\n cache: UpdateBlockCache,\n registryLatest: string,\n now = Date.now(),\n): boolean {\n if (cache.registryLatest !== registryLatest) {\n return false;\n }\n\n if (cache.blockedUntil) {\n const blockedUntilMs = Date.parse(cache.blockedUntil);\n if (Number.isFinite(blockedUntilMs) && blockedUntilMs > now) {\n return true;\n }\n }\n\n if (cache.lastFailedAt) {\n const lastFailedMs = Date.parse(cache.lastFailedAt);\n if (Number.isFinite(lastFailedMs) && now - lastFailedMs < GENERIC_RETRY_MS) {\n return true;\n }\n }\n\n return false;\n}\n\nexport function clearUpdateBlockCache(configDir?: string): void {\n writeUpdateBlockCache({}, configDir);\n}\n\nexport function recordReleaseAgeBlock(options: {\n registryLatest: string;\n retryAfter?: Date;\n configDir?: string;\n}): void {\n writeUpdateBlockCache(\n {\n registryLatest: options.registryLatest,\n blockedUntil: options.retryAfter?.toISOString(),\n },\n options.configDir,\n );\n}\n\nexport function recordGenericUpdateFailure(registryLatest: string, configDir?: string): void {\n writeUpdateBlockCache(\n {\n registryLatest,\n lastFailedAt: new Date().toISOString(),\n },\n configDir,\n );\n}\n","import { spawnSync } from \"node:child_process\";\n\nimport { resolveCliRoot } from \"../project/resolve-cli-root\";\nimport { readCliVersion } from \"../version\";\nimport { shouldUpdateCliVersion } from \"./compare-version\";\nimport { detectCliInstall } from \"./detect-cli-install\";\nimport { formatReleaseAgeBlockMessage, isReleaseAgeBlock } from \"./detect-release-age-block\";\nimport { fetchLatestCliRelease } from \"./fetch-latest-version\";\nimport {\n computeReleaseAgeRetryAfter,\n readPnpmMinimumReleaseAgeMinutes,\n} from \"./read-pnpm-release-age-minutes\";\nimport { resolveCliDistTag } from \"./resolve-cli-dist-tag\";\nimport { runPackageManagerUpdate } from \"./run-package-manager-update\";\nimport {\n clearUpdateBlockCache,\n readUpdateBlockCache,\n recordGenericUpdateFailure,\n recordReleaseAgeBlock,\n shouldSkipCachedUpdate,\n} from \"./update-block-cache\";\n\nfunction isTopLevelUpdateCommand(args: string[]): boolean {\n const valueFlags = new Set([\"--project\", \"--organization\", \"--dir\"]);\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg === undefined) {\n return false;\n }\n\n if (arg === \"--\") {\n return args[i + 1] === \"update\";\n }\n\n if (arg.startsWith(\"-\")) {\n if (\n arg === \"-h\" ||\n arg === \"--help\" ||\n arg === \"-V\" ||\n arg === \"--version\" ||\n arg.startsWith(\"-V\")\n ) {\n continue;\n }\n\n if (arg.includes(\"=\")) {\n continue;\n }\n\n if (valueFlags.has(arg) || arg.startsWith(\"--\")) {\n i++;\n }\n continue;\n }\n\n return arg === \"update\";\n }\n\n return false;\n}\n\nfunction shouldSkipAutoUpdate(argv: string[]): boolean {\n if (\n process.env.KEYSTROKE_DEV ||\n process.env.KEYSTROKE_SKIP_UPDATE ||\n process.env.KEYSTROKE_UPDATING\n ) {\n return true;\n }\n\n if (process.env.CI === \"true\" || process.env.CI === \"1\") {\n return true;\n }\n\n const args = argv.slice(2);\n if (args.length === 0) {\n return false;\n }\n\n // Explicit `keystroke update` owns CLI + project package updates.\n if (isTopLevelUpdateCommand(args)) {\n return true;\n }\n\n return args.every(\n (arg) =>\n arg === \"-V\" ||\n arg === \"--version\" ||\n arg === \"-h\" ||\n arg === \"--help\" ||\n arg.startsWith(\"-V\"),\n );\n}\n\nfunction reexecCli(argv: string[]): never {\n const result = spawnSync(process.execPath, argv.slice(1), {\n stdio: \"inherit\",\n env: {\n ...process.env,\n KEYSTROKE_UPDATING: \"1\",\n },\n });\n\n process.exit(result.status ?? 1);\n}\n\nfunction releaseAgeRetryAfter(\n install: NonNullable<ReturnType<typeof detectCliInstall>>,\n publishedAt: string | undefined,\n): Date | undefined {\n if (install.packageManager !== \"pnpm\") {\n return undefined;\n }\n\n return computeReleaseAgeRetryAfter(publishedAt, readPnpmMinimumReleaseAgeMinutes());\n}\n\nexport async function maybeAutoUpdate(argv: string[]): Promise<void> {\n if (shouldSkipAutoUpdate(argv)) {\n return;\n }\n\n const install = detectCliInstall(resolveCliRoot(import.meta.url));\n if (!install || (install.kind === \"local\" && !install.projectRoot)) {\n return;\n }\n\n const currentVersion = readCliVersion();\n const distTag = resolveCliDistTag();\n const release = await fetchLatestCliRelease(distTag);\n\n if (\n !release ||\n !shouldUpdateCliVersion({\n registryVersion: release.version,\n currentVersion,\n distTag,\n })\n ) {\n clearUpdateBlockCache();\n return;\n }\n\n const cache = readUpdateBlockCache();\n if (shouldSkipCachedUpdate(cache, release.version)) {\n return;\n }\n\n process.stderr.write(\n `Updating @keystrokehq/cli ${currentVersion} -> ${release.version} (@${distTag}) via ${install.packageManager}...\\n`,\n );\n\n const result = runPackageManagerUpdate(install, distTag);\n const installedVersion = readCliVersion();\n\n if (installedVersion.trim() !== currentVersion.trim()) {\n clearUpdateBlockCache();\n process.stderr.write(`Updated @keystrokehq/cli ${currentVersion} -> ${installedVersion}.\\n`);\n reexecCli(argv);\n }\n\n if (result.ok) {\n clearUpdateBlockCache();\n return;\n }\n\n if (isReleaseAgeBlock(result.output)) {\n const retryAfter = releaseAgeRetryAfter(install, release.publishedAt);\n recordReleaseAgeBlock({\n registryLatest: release.version,\n retryAfter,\n });\n process.stderr.write(\n `${formatReleaseAgeBlockMessage({\n currentVersion,\n availableVersion: release.version,\n retryAfter,\n })}\\n`,\n );\n return;\n }\n\n recordGenericUpdateFailure(release.version);\n process.stderr.write(\"Auto-update failed; continuing with the current version.\\n\");\n}\n"],"mappings":";;;;;;AAWA,MAAM,aAAa;AACnB,MAAM,mBAAmB,OAAU,KAAK;AAExC,SAAS,UAAU,YAAY,gBAAgB,GAAW;CACxD,OAAO,KAAK,WAAW,UAAU;AACnC;AAEA,SAAgB,qBAAqB,WAAsC;CACzE,MAAM,OAAO,UAAU,SAAS;CAChC,IAAI,CAAC,WAAW,IAAI,GAClB,OAAO,CAAC;CAGV,IAAI;EACF,OAAO,KAAK,MAAM,aAAa,MAAM,MAAM,CAAC;CAC9C,QAAQ;EACN,OAAO,CAAC;CACV;AACF;AAEA,SAAgB,sBAAsB,OAAyB,WAA0B;CACvF,MAAM,MAAM,aAAa,gBAAgB;CACzC,UAAU,KAAK,EAAE,WAAW,KAAK,CAAC;CAClC,cAAc,UAAU,GAAG,GAAG,GAAG,KAAK,UAAU,OAAO,MAAM,CAAC,EAAE,KAAK,MAAM;AAC7E;AAEA,SAAgB,uBACd,OACA,gBACA,MAAM,KAAK,IAAI,GACN;CACT,IAAI,MAAM,mBAAmB,gBAC3B,OAAO;CA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,sBAAsB;EACtB,QAAQ,OAAO,MAAM,4BAA4B,eAAe,MAAM,iBAAiB,IAAI;EAC3F,UAAU,IAAI;CAChB;CAEA,IAAI,OAAO,IAAI;EACb,sBAAsB;EACtB;CACF;CAEA,IAAI,kBAAkB,OAAO,MAAM,GAAG;EACpC,MAAM,aAAa,qBAAqB,SAAS,QAAQ,WAAW;EACpE,sBAAsB;GACpB,gBAAgB,QAAQ;GACxB;EACF,CAAC;EACD,QAAQ,OAAO,MACb,GAAG,6BAA6B;GAC9B;GACA,kBAAkB,QAAQ;GAC1B;EACF,CAAC,EAAE,GACL;EACA;CACF;CAEA,2BAA2B,QAAQ,OAAO;CAC1C,QAAQ,OAAO,MAAM,4DAA4D;AACnF"}
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { A as resolvePlatformUrlForWebUrl, C as createCliConfig, D as getWebUrl, E as getPlatformUrl, M as ExpectedCliError, N as isExpectedCliError, O as DEFAULT_PLATFORM_URL, S as resolveCliRoot, T as getCredentialStorage, _ as isLocalSdkSpec, a as formatReleaseAgeBlockMessage, b as shouldUpdateCliVersion, c as detectManagerFromLockfile, d as installDependencies$1, f as installPlaygroundDependencies, g as ensureSdkCurrent, i as readPnpmMinimumReleaseAgeMinutes, j as parseCredentialStorage, l as buildPlaygroundWorkspace, m as resolvePackageManager, n as ensureMinimumReleaseAgeExclude, o as isReleaseAgeBlock, p as resolveGithubPackagesToken, r as computeReleaseAgeRetryAfter, s as detectCliInstall, t as runPackageManagerUpdate, u as detectPackageManager$2, v as fetchLatestCliRelease, w as getCliConfigDir, x as readCliVersion, y as resolveCliDistTag } from "./run-package-manager-update-CuLe-Jux.mjs";
3
- import { $ as DownloadActiveProjectArtifactResponseSchema, $i as CreateBillingPortalRequestSchema, $n as SkillSummaryDetailResponseSchema, $r as WorkflowSummaryDetailResponseSchema, $t as OpenApiDiscoverResponseSchema, A as CreateApiKeyResponseSchema, Ai as CredentialAssignmentRecordSchema, An as ProjectGitStatusResponseSchema, Ar as UpdateOrganizationRequestSchema, At as ListApiKeysResponseSchema, B as CreateProjectArtifactRequestSchema, Bi as ACTIVE_ORG_HEADER, Bn as PublicFormSubmitResponseSchema, Br as UserPreferencesPatchSchema, Bt as ListOrganizationMembersPageResponseSchema, C as CompleteManagedDeployArtifactResponseSchema, Ci as resolveConnectAppSlug, Cn as PresignProjectSourceRequestSchema, Cr as TriggerRunListResponseSchema, Ct as HistoryRunListResponseSchema, D as ConnectManagedServiceCredentialRequestSchema, Di as AssignCredentialBodySchema, Dr as UpdateManagedServiceCredentialRequestSchema, Dt as InviteProjectMembersResponseSchema, E as ConnectAuthorizeUrlResponseSchema, En as PresignUserAvatarResponseSchema, Er as UpdateCredentialRequestSchema, Et as InviteProjectMembersRequestSchema, F as CreateCustomAppResponseSchema, Fn as ProjectSlugAvailabilityResponseSchema, Fr as UploadProjectSourceManifestRequestSchema, Ft as ListDraftFilesResponseSchema, G as CreateSlackAppResponseSchema, Gi as AutoTopupSummarySchema, Gn as QueuedAgentPromptResponseSchema, Gr as WorkflowFormResponseSchema, Gt as ListProjectMetricsResponseSchema, H as CreateProjectRequestSchema, Hi as PresignChatAttachmentRequestSchema, Hn as PublishManagedDeployCandidateResponseSchema, Hr as WorkflowCanvasCredentialBindingsSchema, Ht as ListProjectDeploymentsResponseSchema, I as CreateDraftCommitRequestSchema, In as PromptInputSchema, Ir as UploadProjectSourceResponseSchema, It as ListManagedServiceCredentialsResponseSchema, J as CredentialInstanceListResponseSchema, Ji as BillingRedirectResponseSchema, Jn as RenewManagedDeployUploadRequestSchema, Jr as WorkflowRunHooksResponseSchema, Jt as MANAGED_DEPLOY_REQUEST_TIMEOUT_MS, K as CreateSlackChannelBodySchema, Ki as BillingActivityResponseSchema, Kn as QueuedRunResponseSchema, Kr as WorkflowFormUpsertBodySchema, Kt as ListProjectsResponseSchema, L as CreateDraftDiffCommitRequestSchema, Ln as PromptResponseSchema, Lr as UpsertGatewayAttachmentBodySchema, Lt as ListMcpAppToolsResponseSchema, M as CreateCredentialsRequestSchema, Mi as CredentialConsumerListResponseSchema, Mn as ProjectReachabilityResponseSchema, Mr as UpdateProjectMemberResponseSchema, Mt as ListChannelPlatformsResponseSchema, N as CreateCredentialsResponseSchema, Ni as ExecuteKeystrokeToolRequestSchema, Nn as ProjectResponseSchema, Nr as UpdateProjectRequestSchema, Nt as ListCredentialsPageQuerySchema, O as ConnectProvidersResponseSchema, Oi as CredentialAssignmentListQuerySchema, On as ProjectGitRemoteRequestSchema, Or as UpdateOrganizationMemberRequestSchema, Ot as ListAgentMemoryFilesResponseSchema, P as CreateCustomAppRequestSchema, Pn as ProjectSettingsResponseSchema, Pr as UpdateProjectSettingsRequestSchema, Pt as ListCredentialsPageResponseSchema, Q as DeclineOrganizationInvitationResponseSchema, Qi as ConfirmCheckoutResponseSchema, Qr as WorkflowRunResponseSchema, Qt as McpDiscoverResponseSchema, R as CreateOrganizationRequestSchema, Rn as PublicFormMetadataSchema, Rr as UserAvatarPatchSchema, Rt as ListOrganizationInvitationsResponseSchema, S as CompleteManagedDeployArtifactRequestSchema, Sn as PresignOrgLogoResponseSchema, Sr as TriggerRunDetailResponseSchema, St as HistoryRunListQuerySchema, T as CompleteProjectArtifactResponseSchema, Ti as slugifyAppName, Tn as PresignUserAvatarRequestSchema, Tr as UpdateCredentialInstanceBodySchema, Tt as InviteOrganizationMembersResponseSchema, U as CreateProjectResponseSchema, Ui as PresignChatAttachmentResponseSchema, Un as PublishedFormListResponseSchema, Ur as WorkflowCanvasRunSchema, Ut as ListProjectFilesResponseSchema, V as CreateProjectArtifactResponseSchema, Vi as CLIENT_CHANNEL_HEADER, Vn as PublishManagedDeployCandidateRequestSchema, Vr as UserPreferencesSchema, Vt as ListOrganizationsResponseSchema, W as CreateSlackAppRequestSchema, Wn as PublishedFormSchema, Wr as WorkflowCanvasSchema, Wt as ListProjectMembersResponseSchema, X as DOCS_QUERY_TOOL, Xi as BillingUsageResponseSchema, Xr as WorkflowRunInputsSchema, Xt as ManagedServiceCredentialSchema, Y as CredentialInstanceRecordSchema, Yi as BillingSummaryResponseSchema, Yn as RenewManagedDeployUploadResponseSchema, Yr as WorkflowRunInputsPutBodySchema, Yt as ManagedDeployResourceKeySchema, Z as DOCS_SEARCH_TOOL, Zi as ConfirmCheckoutRequestSchema, Zn as SLACK_PERSONAL_APP_SLUG, Zr as WorkflowRunListResponseSchema, Zt as ManagedServiceKindSchema, _ as CatalogAppsPageResponseSchema, _n as PrepareManagedDeployRequestSchema, _r as TemplateFilesResponseSchema, _t as HealthResponseSchema, a as AgentSessionListResponseSchema, ai as WorkspaceTriggerRunListResponseSchema, ar as SlackAppManifestResponseSchema, at as DraftUpdateEventSchema, b as ChannelConnectionSchema, bn as PresignCustomAppLogoResponseSchema, br as TriggerInvokeResponseSchema, bt as HistoryRunCancelResponseSchema, c as AgentTriggerSummaryListResponseSchema, ci as buildConnectDeeplink, cr as StartKeystrokeConnectionInputSchema, ct as FinalizeCustomAppLogoRequestSchema, d as BindChannelBodySchema, di as gitPorcelainLineTouchesManagedDraftPublishPath, dr as StartMcpOAuthConnectionResultSchema, dt as GatewayAttachmentRecordSchema, ea as CreateCreditsCheckoutRequestSchema, ei as WorkflowSummaryListResponseSchema, en as OrganizationSidebarBrandingPatchSchema, er as SkillSummaryListResponseSchema, et as DownloadActiveProjectSourceResponseSchema, f as CancelManagedDeployRequestSchema, fi as isAcceptableInstallExit, fn as PlatformAgentCancelResponseSchema, fr as StartOAuthConnectionInputSchema, ft as GetAppCatalogEntryResponseSchema, g as CatalogAppDetailResponseSchema, gi as normalizeDocsSearchPaths, gn as PlatformAgentSessionListResponseSchema, gr as SubmitTeamRequestRequestSchema, gt as GraphqlDiscoverResponseSchema, h as CatalogActionsPageResponseSchema, hn as PlatformAgentSessionDetailResponseSchema, hr as SubmitMarketingContactRequestSchema, ht as GetTemplateResponseSchema, i as AgentSessionDetailResponseSchema, ii as WorkspaceTriggerOverviewSchema, in as PROJECT_DRAFT_DIFF_MAX_BYTES, ir as SlackAppManifestRequestSchema, it as DraftRevisionResponseSchema, j as CreateCredentialInstanceBodySchema, ji as CredentialConsumerListQuerySchema, jn as ProjectPullStateSchema, jr as UpdateProjectMemberRequestSchema, jt as ListAppsResponseSchema, k as CreateApiKeyRequestSchema, ki as CredentialAssignmentListResponseSchema, kn as ProjectGitRemoteResponseSchema, kr as UpdateOrganizationMemberResponseSchema, kt as ListAgentWorkspaceFilesResponseSchema, l as AppSlugAvailabilityResponseSchema, li as deriveCustomAppDisplay, lr as StartKeystrokeConnectionResultSchema, lt as FinalizeCustomAppLogoResponseSchema, m as CatalogActionDetailResponseSchema, mi as isIgnoredProjectSourcePath, mn as PlatformAgentPromptResponseSchema, mr as SubmitAgentFeedbackRequestSchema, mt as GetCustomAppResponseSchema, n as ActiveOrganizationResponseSchema, na as UpdateAutoTopupRequestSchema, ni as WorkspaceTriggerFileSchema, nn as PNPM_FROZEN_INSTALL_ARGS, nr as SlackAppInstallStartResponseSchema, nt as DraftConflictResponseSchema, o as AgentSummaryDetailResponseSchema, oi as WorkspaceWorkflowOverviewSchema, on as PROJECT_PULL_STATE_RELATIVE_PATH, or as SlackMembershipChannelBodySchema, ot as DuplicateCredentialRequestSchema, p as CancelManagedDeployResponseSchema, pn as PlatformAgentPromptInputSchema, pr as StartOAuthConnectionResultSchema, pt as GetCredentialResponseSchema, q as CreateSlackChannelResponseSchema, qi as BillingInvoiceUrlResponseSchema, qn as RecentResourceListResponseSchema, qr as WorkflowRunDetailResponseSchema, qt as ListTemplatesResponseSchema, r as ActiveProjectSourceRevisionSchema, ri as WorkspaceTriggerListResponseSchema, rn as PROJECT_DRAFT_COMMIT_REQUEST_TIMEOUT_MS, rr as SlackAppListResponseSchema, rt as DraftFileContentResponseSchema, s as AgentSummaryListResponseSchema, si as buildAgentSlackDeeplink, sn as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, sr as SlugAvailabilityResponseSchema, st as DuplicateCredentialsResponseSchema, t as AcceptOrganizationInvitationResponseSchema, ta as CreateSubscriptionCheckoutRequestSchema, ti as WorkspaceTriggerDetailSchema, tn as OrganizationSidebarBrandingSchema, tr as SlackAgentMembershipsResponseSchema, tt as DraftCommitResponseSchema, u as BindAgentSlackAppBodySchema, ui as detectProjectPackageManagerFromSnapshot, ur as StartMcpOAuthConnectionInputSchema, ut as FormFieldConfigSchema, v as ChannelAccountListResponseSchema, vi as parseAppSlug, vn as PrepareManagedDeployResponseSchema, vr as TriggerDetailResponseSchema, vt as HeartbeatManagedDeployRequestSchema, w as CompleteProjectArtifactRequestSchema, wi as resolveDocsMcpUrl, wn as PresignProjectSourceResponseSchema, wr as UpdateChannelBindingBodySchema, wt as InviteOrganizationMembersRequestSchema, x as ChannelDirectoryListResponseSchema, xi as parseSlackConnectFlow, xn as PresignOrgLogoRequestSchema, xr as TriggerListResponseSchema, xt as HistoryRunDetailResponseSchema, y as ChannelConnectionListResponseSchema, yi as parseErrorResponse, yn as PresignCustomAppLogoRequestSchema, yr as TriggerInvokeInputsSchema, yt as HeartbeatManagedDeployResponseSchema, z as CreateOrganizationResponseSchema, zn as PublicFormSubmitBodySchema, zr as UserAvatarSchema, zt as ListOrganizationMembersPageQuerySchema } from "./dist-Cy2nsWsI.mjs";
4
- import { $ as artifactIndexFromModules, Q as withMcpReadClient, X as PublicHttpUrlError, Z as assertPublicHttpUrl, _t as configureTelemetry, bt as shutdownTelemetry, et as collectArtifactModules, gt as captureException, ht as alias, nt as moduleBlobRefsFromModules, tt as mapInParallelBatches, vt as event, yt as flushTelemetry } from "./dist-Dg-PHK0j.mjs";
5
- import { a as buildApp, c as computeSafeFilteredDeploy, r as analyzeDeployableClosures, t as ANALYZER_CONTRACT_VERSION } from "./dist-DeMzV-BR.mjs";
2
+ import { A as resolvePlatformUrlForWebUrl, C as createCliConfig, D as getWebUrl, E as getPlatformUrl, M as ExpectedCliError, N as isExpectedCliError, O as DEFAULT_PLATFORM_URL, S as resolveCliRoot, T as getCredentialStorage, _ as isLocalSdkSpec, a as formatReleaseAgeBlockMessage, b as shouldUpdateCliVersion, c as detectManagerFromLockfile, d as installDependencies$1, f as installPlaygroundDependencies, g as ensureSdkCurrent, i as readPnpmMinimumReleaseAgeMinutes, j as parseCredentialStorage, l as buildPlaygroundWorkspace, m as resolvePackageManager, n as ensureMinimumReleaseAgeExclude, o as isReleaseAgeBlock, p as resolveGithubPackagesToken, r as computeReleaseAgeRetryAfter, s as detectCliInstall, t as runPackageManagerUpdate, u as detectPackageManager$2, v as fetchLatestCliRelease, w as getCliConfigDir, x as readCliVersion, y as resolveCliDistTag } from "./run-package-manager-update-D6cBQMsZ.mjs";
3
+ import { $ as DeclineOrganizationInvitationResponseSchema, $i as ConfirmCheckoutResponseSchema, $r as WorkflowRunResponseSchema, $t as McpDiscoverResponseSchema, A as CreateApiKeyRequestSchema, Ai as CredentialAssignmentListResponseSchema, An as ProjectGitRemoteResponseSchema, Ar as UpdateOrganizationMemberResponseSchema, At as ListAgentWorkspaceFilesResponseSchema, B as CreateOrganizationResponseSchema, Bn as PublicFormSubmitBodySchema, Br as UserAvatarSchema, Bt as ListOrganizationMembersPageQuerySchema, C as CompleteManagedDeployArtifactRequestSchema, Cn as PresignOrgLogoResponseSchema, Cr as TriggerRunDetailResponseSchema, Ct as HistoryRunListQuerySchema, D as ConnectAuthorizeUrlResponseSchema, Dn as PresignUserAvatarResponseSchema, Dr as UpdateCredentialRequestSchema, Dt as InviteProjectMembersRequestSchema, E as CompleteProjectArtifactResponseSchema, Ei as slugifyAppName, En as PresignUserAvatarRequestSchema, Er as UpdateCredentialInstanceBodySchema, Et as InviteOrganizationMembersResponseSchema, F as CreateCustomAppRequestSchema, Fn as ProjectSettingsResponseSchema, Fr as UpdateProjectSettingsRequestSchema, Ft as ListCredentialsPageResponseSchema, G as CreateSlackAppRequestSchema, Gn as PublishedFormSchema, Gr as WorkflowCanvasSchema, Gt as ListProjectMembersResponseSchema, H as CreateProjectArtifactResponseSchema, Hi as CLIENT_CHANNEL_HEADER, Hn as PublishManagedDeployCandidateRequestSchema, Hr as UserPreferencesSchema, Ht as ListOrganizationsResponseSchema, I as CreateCustomAppResponseSchema, In as ProjectSlugAvailabilityResponseSchema, Ir as UploadProjectSourceManifestRequestSchema, It as ListDraftFilesResponseSchema, J as CreateSlackChannelResponseSchema, Ji as BillingInvoiceUrlResponseSchema, Jn as RecentResourceListResponseSchema, Jr as WorkflowRunDetailResponseSchema, Jt as ListTemplatesResponseSchema, K as CreateSlackAppResponseSchema, Ki as AutoTopupSummarySchema, Kn as QueuedAgentPromptResponseSchema, Kr as WorkflowFormResponseSchema, Kt as ListProjectMetricsResponseSchema, L as CreateDraftCommitRequestSchema, Ln as PromptInputSchema, Lr as UploadProjectSourceResponseSchema, Lt as ListManagedServiceCredentialsResponseSchema, M as CreateCredentialInstanceBodySchema, Mi as CredentialConsumerListQuerySchema, Mn as ProjectPullStateSchema, Mr as UpdateProjectMemberRequestSchema, Mt as ListAppsResponseSchema, N as CreateCredentialsRequestSchema, Ni as CredentialConsumerListResponseSchema, Nn as ProjectReachabilityResponseSchema, Nr as UpdateProjectMemberResponseSchema, Nt as ListChannelPlatformsResponseSchema, O as ConnectManagedServiceCredentialRequestSchema, Oi as AssignCredentialBodySchema, Or as UpdateManagedServiceCredentialRequestSchema, Ot as InviteProjectMembersResponseSchema, P as CreateCredentialsResponseSchema, Pi as ExecuteKeystrokeToolRequestSchema, Pn as ProjectResponseSchema, Pr as UpdateProjectRequestSchema, Pt as ListCredentialsPageQuerySchema, Q as DOCS_SEARCH_TOOL, Qi as ConfirmCheckoutRequestSchema, Qn as SLACK_PERSONAL_APP_SLUG, Qr as WorkflowRunListResponseSchema, Qt as ManagedServiceKindSchema, R as CreateDraftDiffCommitRequestSchema, Rn as PromptResponseSchema, Rr as UpsertGatewayAttachmentBodySchema, Rt as ListMcpAppToolsResponseSchema, S as ChannelDirectoryListResponseSchema, Si as parseSlackConnectFlow, Sn as PresignOrgLogoRequestSchema, Sr as TriggerListResponseSchema, St as HistoryRunDetailResponseSchema, T as CompleteProjectArtifactRequestSchema, Ti as resolveDocsMcpUrl, Tn as PresignProjectSourceResponseSchema, Tr as UpdateChannelBindingBodySchema, Tt as InviteOrganizationMembersRequestSchema, U as CreateProjectRequestSchema, Ui as PresignChatAttachmentRequestSchema, Un as PublishManagedDeployCandidateResponseSchema, Ur as WorkflowCanvasCredentialBindingsSchema, Ut as ListProjectDeploymentsResponseSchema, V as CreateProjectArtifactRequestSchema, Vi as ACTIVE_ORG_HEADER, Vn as PublicFormSubmitResponseSchema, Vr as UserPreferencesPatchSchema, Vt as ListOrganizationMembersPageResponseSchema, W as CreateProjectResponseSchema, Wi as PresignChatAttachmentResponseSchema, Wn as PublishedFormListResponseSchema, Wr as WorkflowCanvasRunSchema, Wt as ListProjectFilesResponseSchema, X as CredentialInstanceRecordSchema, Xi as BillingSummaryResponseSchema, Xn as RenewManagedDeployUploadResponseSchema, Xr as WorkflowRunInputsPutBodySchema, Xt as ManagedDeployResourceKeySchema, Y as CredentialInstanceListResponseSchema, Yi as BillingRedirectResponseSchema, Yn as RenewManagedDeployUploadRequestSchema, Yr as WorkflowRunHooksResponseSchema, Yt as MANAGED_DEPLOY_REQUEST_TIMEOUT_MS, Z as DOCS_QUERY_TOOL, Zi as BillingUsageResponseSchema, Zr as WorkflowRunInputsSchema, Zt as ManagedServiceCredentialSchema, _ as CatalogAppDetailResponseSchema, _i as normalizeDocsSearchPaths, _n as PlatformAgentSessionListResponseSchema, _r as SubmitTeamRequestRequestSchema, _t as GraphqlDiscoverResponseSchema, a as AgentSessionDetailResponseSchema, ai as WorkspaceTriggerOverviewSchema, an as PROJECT_DRAFT_DIFF_MAX_BYTES, ar as SlackAppManifestRequestSchema, at as DraftRevisionResponseSchema, b as ChannelConnectionListResponseSchema, bi as parseErrorResponse, bn as PresignCustomAppLogoRequestSchema, br as TriggerInvokeInputsSchema, bt as HeartbeatManagedDeployResponseSchema, c as AgentSummaryListResponseSchema, ci as buildAgentSlackDeeplink, cn as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, cr as SlugAvailabilityResponseSchema, ct as DuplicateCredentialsResponseSchema, d as BindAgentSlackAppBodySchema, di as detectProjectPackageManagerFromSnapshot, dr as StartMcpOAuthConnectionInputSchema, dt as FormFieldConfigSchema, ea as CreateBillingPortalRequestSchema, ei as WorkflowSummaryDetailResponseSchema, en as OpenApiDiscoverResponseSchema, er as SkillSummaryDetailResponseSchema, et as DownloadActiveProjectArtifactResponseSchema, f as BindChannelBodySchema, fi as gitPorcelainLineTouchesManagedDraftPublishPath, fr as StartMcpOAuthConnectionResultSchema, ft as GatewayAttachmentRecordSchema, g as CatalogActionsPageResponseSchema, gn as PlatformAgentSessionDetailResponseSchema, gr as SubmitMarketingContactRequestSchema, gt as GetTemplateResponseSchema, h as CatalogActionDetailResponseSchema, hi as isIgnoredProjectSourcePath, hn as PlatformAgentPromptResponseSchema, hr as SubmitAgentFeedbackRequestSchema, ht as GetCustomAppResponseSchema, i as AgentEnvImageSnapshotResponseSchema, ii as WorkspaceTriggerListResponseSchema, in as PROJECT_DRAFT_COMMIT_REQUEST_TIMEOUT_MS, ir as SlackAppListResponseSchema, it as DraftFileContentResponseSchema, j as CreateApiKeyResponseSchema, ji as CredentialAssignmentRecordSchema, jn as ProjectGitStatusResponseSchema, jr as UpdateOrganizationRequestSchema, jt as ListApiKeysResponseSchema, k as ConnectProvidersResponseSchema, ki as CredentialAssignmentListQuerySchema, kn as ProjectGitRemoteRequestSchema, kr as UpdateOrganizationMemberRequestSchema, kt as ListAgentMemoryFilesResponseSchema, l as AgentTriggerSummaryListResponseSchema, li as buildConnectDeeplink, lr as StartKeystrokeConnectionInputSchema, lt as FinalizeCustomAppLogoRequestSchema, m as CancelManagedDeployResponseSchema, mn as PlatformAgentPromptInputSchema, mr as StartOAuthConnectionResultSchema, mt as GetCredentialResponseSchema, n as ActiveOrganizationResponseSchema, na as CreateSubscriptionCheckoutRequestSchema, ni as WorkspaceTriggerDetailSchema, nn as OrganizationSidebarBrandingSchema, nr as SlackAgentMembershipsResponseSchema, nt as DraftCommitResponseSchema, o as AgentSessionListResponseSchema, oi as WorkspaceTriggerRunListResponseSchema, or as SlackAppManifestResponseSchema, ot as DraftUpdateEventSchema, p as CancelManagedDeployRequestSchema, pi as isAcceptableInstallExit, pn as PlatformAgentCancelResponseSchema, pr as StartOAuthConnectionInputSchema, pt as GetAppCatalogEntryResponseSchema, q as CreateSlackChannelBodySchema, qi as BillingActivityResponseSchema, qn as QueuedRunResponseSchema, qr as WorkflowFormUpsertBodySchema, qt as ListProjectsResponseSchema, r as ActiveProjectSourceRevisionSchema, ra as UpdateAutoTopupRequestSchema, ri as WorkspaceTriggerFileSchema, rn as PNPM_FROZEN_INSTALL_ARGS, rr as SlackAppInstallStartResponseSchema, rt as DraftConflictResponseSchema, s as AgentSummaryDetailResponseSchema, si as WorkspaceWorkflowOverviewSchema, sn as PROJECT_PULL_STATE_RELATIVE_PATH, sr as SlackMembershipChannelBodySchema, st as DuplicateCredentialRequestSchema, t as AcceptOrganizationInvitationResponseSchema, ta as CreateCreditsCheckoutRequestSchema, ti as WorkflowSummaryListResponseSchema, tn as OrganizationSidebarBrandingPatchSchema, tr as SkillSummaryListResponseSchema, tt as DownloadActiveProjectSourceResponseSchema, u as AppSlugAvailabilityResponseSchema, ui as deriveCustomAppDisplay, ur as StartKeystrokeConnectionResultSchema, ut as FinalizeCustomAppLogoResponseSchema, v as CatalogAppsPageResponseSchema, vn as PrepareManagedDeployRequestSchema, vr as TemplateFilesResponseSchema, vt as HealthResponseSchema, w as CompleteManagedDeployArtifactResponseSchema, wi as resolveConnectAppSlug, wn as PresignProjectSourceRequestSchema, wr as TriggerRunListResponseSchema, wt as HistoryRunListResponseSchema, x as ChannelConnectionSchema, xn as PresignCustomAppLogoResponseSchema, xr as TriggerInvokeResponseSchema, xt as HistoryRunCancelResponseSchema, y as ChannelAccountListResponseSchema, yi as parseAppSlug, yn as PrepareManagedDeployResponseSchema, yr as TriggerDetailResponseSchema, yt as HeartbeatManagedDeployRequestSchema, z as CreateOrganizationRequestSchema, zn as PublicFormMetadataSchema, zr as UserAvatarPatchSchema, zt as ListOrganizationInvitationsResponseSchema } from "./dist-neAmdOvZ.mjs";
4
+ import { $ as artifactIndexFromModules, Q as withMcpReadClient, X as PublicHttpUrlError, Z as assertPublicHttpUrl, _t as configureTelemetry, bt as shutdownTelemetry, et as collectArtifactModules, gt as captureException, ht as alias, nt as moduleBlobRefsFromModules, tt as mapInParallelBatches, vt as event, yt as flushTelemetry } from "./dist-CGeyFdzI.mjs";
5
+ import { a as buildApp, c as computeSafeFilteredDeploy, r as analyzeDeployableClosures, t as ANALYZER_CONTRACT_VERSION } from "./dist-DesBaiNo.mjs";
6
6
  import { createRequire } from "node:module";
7
7
  import { Command } from "commander";
8
8
  import { homedir, platform, release, tmpdir } from "node:os";
@@ -11,7 +11,7 @@ import { chmodSync, cpSync, existsSync, lstatSync, mkdirSync, readFileSync, real
11
11
  import { execFile, spawn, spawnSync } from "node:child_process";
12
12
  import { Entry } from "@napi-rs/keyring";
13
13
  import { PostHog } from "posthog-node";
14
- import { access, chmod, copyFile, lstat, mkdir, mkdtemp, readFile, readdir, rm, stat, symlink, writeFile } from "node:fs/promises";
14
+ import { access, chmod, lstat, mkdir, mkdtemp, readFile, readdir, rm, stat, symlink, writeFile } from "node:fs/promises";
15
15
  import { confirm, input } from "@inquirer/prompts";
16
16
  import { createHash, randomUUID } from "node:crypto";
17
17
  //#region ../../node_modules/.pnpm/ky@2.0.2/node_modules/ky/distribution/errors/KyError.js
@@ -4804,6 +4804,14 @@ function createAgentsResource(http) {
4804
4804
  throw await toPlatformError(error);
4805
4805
  }
4806
4806
  },
4807
+ async snapshotEnvImage(projectId, agentSlug) {
4808
+ try {
4809
+ const data = await (await http.post(`api/projects/${encodeURIComponent(projectId)}/agents/${encodeURIComponent(agentSlug)}/env-image`)).json();
4810
+ return AgentEnvImageSnapshotResponseSchema.parse(data);
4811
+ } catch (error) {
4812
+ throw await toPlatformError(error);
4813
+ }
4814
+ },
4807
4815
  /** Deletes an agent-owned ephemeral trigger; throws if it is not deletable (404). */
4808
4816
  async deleteTrigger(projectId, agentSlug, triggerId) {
4809
4817
  try {
@@ -7529,12 +7537,36 @@ Examples:
7529
7537
  });
7530
7538
  }
7531
7539
  //#endregion
7540
+ //#region src/commands/channels/resolve-channel-project.ts
7541
+ async function resolveChannelProjectId(config) {
7542
+ await resolveActiveOrganization(config);
7543
+ const platform = createCliPlatformClient(config);
7544
+ const ref = resolveActiveProjectRef();
7545
+ if (!ref) throw missingProjectRefError();
7546
+ return (await resolveProjectRef(platform, ref)).id;
7547
+ }
7548
+ //#endregion
7549
+ //#region src/commands/agents/snapshot.ts
7550
+ function registerAgentSnapshotCommand(agent) {
7551
+ agent.command("snapshot").description("Build (or reuse) an org-scoped Modal env Image from the agent's defineSandbox({ setup })").argument("<agent>", "Agent slug").addHelpText("after", `
7552
+ Examples:
7553
+ keystroke agents snapshot support
7554
+ `).action((agentSlug) => runCliCommand("Agent env snapshot failed", async () => {
7555
+ const config = createCliConfig();
7556
+ await resolveActiveOrganization(config);
7557
+ const projectId = await resolveChannelProjectId(config);
7558
+ const result = await createCliPlatformClient(config).agents.snapshotEnvImage(projectId, agentSlug);
7559
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
7560
+ }, void 0, { orgScoped: true }));
7561
+ }
7562
+ //#endregion
7532
7563
  //#region src/commands/agents/index.ts
7533
7564
  function registerAgentsCommand(program) {
7534
7565
  const agents = program.command("agents").description("Invoke and inspect agents");
7535
7566
  registerAgentListCommand(agents);
7536
7567
  registerAgentPromptCommand(agents);
7537
7568
  registerAgentSessionsCommand(agents);
7569
+ registerAgentSnapshotCommand(agents);
7538
7570
  }
7539
7571
  //#endregion
7540
7572
  //#region src/commands/api-key/run-api-key.ts
@@ -7739,21 +7771,21 @@ function listActionsHint(app) {
7739
7771
  /** Hint when listing actions for a custom org app (no toolkit tools). */
7740
7772
  function listCustomAppActionsHint(app) {
7741
7773
  const bin = cliBinaryName();
7742
- return `\nCustom org apps have no catalog action list.\n Inspect app: ${bin} apps get ${app}\n Scaffold code: ${bin} apps sync ${app}\n Connect secret: ${bin} connect ${app}\n Author actions: defineApp({ slug: "${app}", ... }).action(...)\n Smoke-test: deploy a thin workflow that calls the action, then\n ${bin} workflows run <workflow-slug> --input '{...}' --wait\n (${bin} apps execute is catalog-only not for custom app actions.)\n`;
7774
+ return `\nCustom org apps have no catalog action list.\n Inspect app: ${bin} apps get ${app}\n Scaffold code: ${bin} apps sync ${app}\n Connect secret: ${bin} connect ${app}\n Author actions: defineApp({ slug: "${app}", ... }).action(...)\n Smoke-test: deploy a thin workflow that calls the action, then\n ${bin} workflows run <workflow-slug> --input '{...}' --wait\n (${bin} apps execute is for catalog toolkit actions and custom MCP tools.)\n`;
7743
7775
  }
7744
7776
  /**
7745
- * Error when `apps execute` is pointed at a custom org app (`{org}/{name}`).
7777
+ * Error when `apps execute` is pointed at a non-MCP custom org app (`{org}/{name}`).
7746
7778
  * Catalog toolkit execute cannot reach defineApp(...).action(...) project code.
7747
7779
  */
7748
7780
  function customAppExecuteError(app, options) {
7749
7781
  const bin = cliBinaryName();
7750
- const mcpLine = options?.source === "mcp" ? ` Live MCP tools: ${bin} apps actions list ${app} (after connect)\n` : "";
7751
- return `${bin} apps execute only runs built-in catalog toolkit actions.\n"${app}" is a custom org app — its actions live in project code as defineApp(...).action(...), not in the catalog.\n\nSmoke-test a custom app action by deploying a thin workflow that calls it, then:\n ${bin} workflows run <workflow-slug> --input '{...}' --wait\n\n Inspect app: ${bin} apps get ${app}\n Scaffold/author: ${bin} apps sync ${app}\n` + mcpLine;
7782
+ if (options?.source === "mcp") return `"${app}" is a custom MCP app. Smoke-test a remote tool after connect:\n ${bin} apps actions list ${app}\n ${bin} apps execute ${app} <tool> --input '{...}'\n`;
7783
+ return `${bin} apps execute runs catalog toolkit actions and custom MCP tools.\n"${app}" is a custom org app — its actions live in project code as defineApp(...).action(...), not in the catalog.\n\nSmoke-test a custom app action by deploying a thin workflow that calls it, then:\n ${bin} workflows run <workflow-slug> --input '{...}' --wait\n\n Inspect app: ${bin} apps get ${app}\n Scaffold/author: ${bin} apps sync ${app}\n`;
7752
7784
  }
7753
7785
  /** Hint after listing live tools on a connected custom MCP app. */
7754
7786
  function listMcpAppActionsHint(app) {
7755
7787
  const bin = cliBinaryName();
7756
- return `\nMCP tool registry (live tools/list).\n Docs first: ${bin} docs search "custom apps MCP"\n Inspect app: ${bin} apps get ${app}\n Scaffold code: ${bin} apps sync ${app}\n Author actions: defineApp({ slug: "${app}", ... }).action(...) for tools you need\n Do not use defineMcp from @keystrokehq/keystroke/agent.\n`;
7788
+ return `\nMCP tool registry (live tools/list).\n Docs first: ${bin} docs search "custom apps MCP"\n Inspect app: ${bin} apps get ${app}\n Smoke-test tool: ${bin} apps execute ${app} <tool> --input '{...}'\n Scaffold code: ${bin} apps sync ${app}\n Author actions: defineApp(...).action(...) from the tool schemas above\n Attach to agent: tools: [<app>] for every registered action, or pick actions\n Do not use defineMcp from @keystrokehq/keystroke/agent.\n`;
7757
7789
  }
7758
7790
  /** Hint when MCP list fails because the app is not connected. */
7759
7791
  function listMcpAppConnectHint(app) {
@@ -8101,10 +8133,27 @@ function isNotFoundError(error) {
8101
8133
  if (error.status === 404) return true;
8102
8134
  return /not found/i.test(error.message);
8103
8135
  }
8136
+ async function executeConnectedAppTool(client, app, tool, options) {
8137
+ const credentialSlug = options.credentialSlug?.trim() || void 0;
8138
+ const projectSlug = options.projectSlug?.trim() || void 0;
8139
+ try {
8140
+ const { result } = await client.apps.executeTool({
8141
+ app,
8142
+ tool,
8143
+ ...options.version ? { version: options.version } : {},
8144
+ arguments: typeof options.input === "object" && options.input !== null && !Array.isArray(options.input) ? options.input : {},
8145
+ ...credentialSlug ? { credentialSlug } : {},
8146
+ ...projectSlug ? { projectSlug } : {}
8147
+ });
8148
+ return result;
8149
+ } catch (error) {
8150
+ if (isNotConnectedError(error) && !credentialSlug) throw new Error(`Not connected to ${app}. Run: ${cliBinaryName()} connect ${app}`);
8151
+ throw error;
8152
+ }
8153
+ }
8104
8154
  async function runAppExecute(client, appSlug, toolSlug, options) {
8105
8155
  const app = appSlug.trim().toLowerCase();
8106
- const tool = toolSlug.trim().toUpperCase();
8107
- if (!app || !tool) throw new Error("App and tool slugs are required (e.g. github github_get_the_authenticated_user)");
8156
+ if (!app || !toolSlug.trim()) throw new Error("App and tool slugs are required (e.g. github github_get_the_authenticated_user)");
8108
8157
  const parsed = parseAppSlug(app);
8109
8158
  if (parsed.kind === "org") {
8110
8159
  let source;
@@ -8112,35 +8161,26 @@ async function runAppExecute(client, appSlug, toolSlug, options) {
8112
8161
  const shown = await runAppShow(client, parsed.slug);
8113
8162
  if (shown.kind === "custom") source = shown.app.source;
8114
8163
  } catch {}
8164
+ if (source === "mcp") return executeConnectedAppTool(client, parsed.slug, toolSlug.trim(), options);
8115
8165
  throw new Error(customAppExecuteError(parsed.slug, { source }));
8116
8166
  }
8117
- const credentialSlug = options.credentialSlug?.trim() || void 0;
8118
- const projectSlug = options.projectSlug?.trim() || void 0;
8167
+ const tool = toolSlug.trim().toUpperCase();
8119
8168
  let version = options.version?.trim() || void 0;
8120
8169
  if (!version) try {
8121
8170
  version = (await client.apps.getCatalogAction(tool)).version?.trim() || void 0;
8122
8171
  } catch (error) {
8123
8172
  if (isNotFoundError(error)) {
8124
8173
  const shown = await runAppShow(client, app).catch(() => null);
8174
+ if (shown?.kind === "custom" && shown.app.source === "mcp") return executeConnectedAppTool(client, shown.app.slug, toolSlug.trim(), options);
8125
8175
  if (shown?.kind === "custom") throw new Error(customAppExecuteError(shown.app.slug, { source: shown.app.source }));
8126
8176
  }
8127
8177
  throw error;
8128
8178
  }
8129
8179
  if (!version) throw new Error(`Catalog action "${tool}" has no pinned version. Pass --version explicitly.`);
8130
- try {
8131
- const { result } = await client.apps.executeTool({
8132
- app,
8133
- tool,
8134
- version,
8135
- arguments: typeof options.input === "object" && options.input !== null && !Array.isArray(options.input) ? options.input : {},
8136
- ...credentialSlug ? { credentialSlug } : {},
8137
- ...projectSlug ? { projectSlug } : {}
8138
- });
8139
- return result;
8140
- } catch (error) {
8141
- if (isNotConnectedError(error) && !credentialSlug) throw new Error(`Not connected to ${app}. Run: ${cliBinaryName()} connect ${app}`);
8142
- throw error;
8143
- }
8180
+ return executeConnectedAppTool(client, app, tool, {
8181
+ ...options,
8182
+ version
8183
+ });
8144
8184
  }
8145
8185
  //#endregion
8146
8186
  //#region src/commands/apps/execute.ts
@@ -8228,13 +8268,15 @@ function resolveSyncedAppDirName(slug) {
8228
8268
  }
8229
8269
  function generateAppStub(app) {
8230
8270
  const exportName = resolveSyncedAppExportName(app.slug);
8231
- const mcpNote = app.source === "mcp" ? `\n * MCP URL: ${app.url ?? "(missing)"}. Prefer \`keystroke docs search "custom apps MCP"\`, then \`keystroke apps actions list ${app.slug}\` after connect.` : "";
8271
+ const isMcp = app.source === "mcp";
8272
+ const mcpNote = isMcp ? `\n * MCP URL: ${app.url ?? "(missing)"}. After connect, run \`keystroke apps actions list ${app.slug}\` to inspect tools, author \`app.action(...)\` wrappers, then put \`${exportName}\` in an agent's \`tools: [${exportName}]\` (or pick individual actions).` : "";
8273
+ const sourceField = isMcp ? `\n source: "mcp",` : "";
8232
8274
  if (app.authKind === "oauth") return `import { defineApp } from "@keystrokehq/keystroke/app";
8233
8275
 
8234
8276
  /** Synced from platform app \`${app.slug}\`. Re-run \`keystroke apps sync ${app.slug}\` after template changes.${mcpNote} */
8235
8277
  export const ${exportName} = defineApp({
8236
8278
  slug: ${JSON.stringify(app.slug)},
8237
- auth: "oauth",
8279
+ auth: "oauth",${sourceField}
8238
8280
  });
8239
8281
  `;
8240
8282
  const credentialLines = Object.entries(app.credentialFields ?? {}).map(([key, field]) => {
@@ -8246,7 +8288,7 @@ import { z } from "zod";
8246
8288
  /** Synced from platform app \`${app.slug}\`. Re-run \`keystroke apps sync ${app.slug}\` after template changes.${mcpNote} */
8247
8289
  export const ${exportName} = defineApp({
8248
8290
  slug: ${JSON.stringify(app.slug)},
8249
- auth: "api_key",
8291
+ auth: "api_key",${sourceField}
8250
8292
  credential: {
8251
8293
  ${credentialLines}
8252
8294
  },
@@ -8401,15 +8443,6 @@ function registerTemplatesCommand(program) {
8401
8443
  registerTemplatesApplyCommand(templates);
8402
8444
  }
8403
8445
  //#endregion
8404
- //#region src/commands/channels/resolve-channel-project.ts
8405
- async function resolveChannelProjectId(config) {
8406
- await resolveActiveOrganization(config);
8407
- const platform = createCliPlatformClient(config);
8408
- const ref = resolveActiveProjectRef();
8409
- if (!ref) throw missingProjectRefError();
8410
- return (await resolveProjectRef(platform, ref)).id;
8411
- }
8412
- //#endregion
8413
8446
  //#region src/auth/open-url.ts
8414
8447
  function openUrl(url) {
8415
8448
  const platform = process.platform;
@@ -8966,7 +8999,7 @@ function registerBuildCommand(program) {
8966
8999
  try {
8967
9000
  const root = resolveProjectRoot(options.dir);
8968
9001
  await ensureSdkCurrent(root);
8969
- const { buildApp } = await import("./dist-B_Dy4mW_.mjs");
9002
+ const { buildApp } = await import("./dist-CI6ZB7F4.mjs");
8970
9003
  await buildApp({ root });
8971
9004
  process.stdout.write(`Built ${root}\n`);
8972
9005
  } catch (error) {
@@ -8978,12 +9011,17 @@ function registerBuildCommand(program) {
8978
9011
  }
8979
9012
  //#endregion
8980
9013
  //#region src/deploy/assert-portable-dependencies.ts
9014
+ const LINK_SPEC = /^link:/i;
8981
9015
  const NONPORTABLE_SPEC = /^(?:link:|workspace:|file:(?:\.\.?(?:\/|$)|\/|[A-Za-z]:\\|~))/i;
8982
9016
  /**
8983
9017
  * Reject tracked dependency specs that cannot resolve in disposable/server
8984
9018
  * checkouts (absolute/local link:, external file:, unresolved workspace:).
9019
+ *
9020
+ * `KEYSTROKE_ALLOW_NONPORTABLE_DEPS=1` (local packs / soak deploys) permits
9021
+ * `link:` only — `file:` and unresolved `workspace:` still fail the gate.
8985
9022
  */
8986
9023
  async function assertPortableProjectDependencies(projectRoot) {
9024
+ const allowLinkDeps = process.env.KEYSTROKE_ALLOW_NONPORTABLE_DEPS === "1";
8987
9025
  const packageJsonPath = join(projectRoot, "package.json");
8988
9026
  let raw;
8989
9027
  try {
@@ -9011,7 +9049,9 @@ async function assertPortableProjectDependencies(projectRoot) {
9011
9049
  if (!deps || typeof deps !== "object") continue;
9012
9050
  for (const [name, spec] of Object.entries(deps)) {
9013
9051
  if (typeof spec !== "string") continue;
9014
- if (NONPORTABLE_SPEC.test(spec.trim())) offenders.push(`${name}@${spec}`);
9052
+ const trimmed = spec.trim();
9053
+ if (allowLinkDeps && LINK_SPEC.test(trimmed)) continue;
9054
+ if (NONPORTABLE_SPEC.test(trimmed)) offenders.push(`${name}@${spec}`);
9015
9055
  }
9016
9056
  }
9017
9057
  if (offenders.length === 0) return;
@@ -9793,136 +9833,31 @@ function managedDeployNeedsImpactAcceptance(preflight) {
9793
9833
  return preflight.mode === "filtered" && (preflight.impactCompleteness === "unknown" || preflight.impactedResourceKeys.length > 0 || preflight.expansions.length > 0 || preflight.requestedResourceKeys.length !== preflight.resourceKeys.length || !preflight.requestedResourceKeys.every((key) => preflight.resourceKeys.includes(key)));
9794
9834
  }
9795
9835
  //#endregion
9796
- //#region src/git/compute-working-tree-diff.ts
9797
- /** Resolve a path returned by `git rev-parse --git-path` (absolute or cwd-relative). */
9798
- function resolveGitPath(cwd, gitPath) {
9799
- return isAbsolute(gitPath) ? gitPath : resolve(cwd, gitPath);
9800
- }
9801
- async function listNullSeparatedPaths(cwd, args, env) {
9802
- const { stdout } = await runGit(args, {
9803
- cwd,
9804
- env
9805
- });
9806
- return stdout.split("\0").filter((path) => path.length > 0);
9807
- }
9808
- /**
9809
- * Build a `git diff --binary` from `baseSha` to the desired working tree
9810
- * (staged + unstaged + untracked), without mutating the real index.
9811
- *
9812
- * Uses `GIT_INDEX_FILE` against a copied index. Source-excluded paths
9813
- * (`.env`, `node_modules`, `.keystroke`, …) keep their `baseSha` blob when
9814
- * present on D0 (so the patch never deletes or locally-edits them); otherwise
9815
- * they are dropped from the temp index so untracked secrets stay out.
9816
- */
9817
- async function computeWorkingTreeDiff(input) {
9818
- const baseEnv = input.env;
9819
- const gitIndexPath = (await runGit([
9820
- "rev-parse",
9821
- "--git-path",
9822
- "index"
9823
- ], {
9824
- cwd: input.cwd,
9825
- env: baseEnv
9826
- })).stdout.trim();
9827
- const realIndexPath = resolveGitPath(input.cwd, gitIndexPath);
9828
- const tempDir = await mkdtemp(join(tmpdir(), "keystroke-draft-index-"));
9829
- const tempIndexPath = input.resolveTempIndexPath?.() ?? join(tempDir, "index");
9830
- try {
9831
- await copyFile(realIndexPath, tempIndexPath);
9832
- const indexEnv = {
9833
- ...baseEnv,
9834
- GIT_INDEX_FILE: tempIndexPath
9835
- };
9836
- await runGit([
9837
- "add",
9838
- "-A",
9839
- "--",
9840
- "."
9841
- ], {
9842
- cwd: input.cwd,
9843
- env: indexEnv
9844
- });
9845
- const baseExcluded = (await listNullSeparatedPaths(input.cwd, [
9846
- "ls-tree",
9847
- "-r",
9848
- "--name-only",
9849
- "-z",
9850
- input.baseSha
9851
- ], baseEnv)).filter((path) => isIgnoredProjectSourcePath(path));
9852
- for (const path of baseExcluded) await runGit([
9853
- "restore",
9854
- "--source",
9855
- input.baseSha,
9856
- "--staged",
9857
- "--",
9858
- path
9859
- ], {
9860
- cwd: input.cwd,
9861
- env: indexEnv
9862
- });
9863
- const indexExcluded = (await listNullSeparatedPaths(input.cwd, ["ls-files", "-z"], indexEnv)).filter((path) => isIgnoredProjectSourcePath(path));
9864
- const baseExcludedSet = new Set(baseExcluded);
9865
- const toRemove = indexExcluded.filter((path) => !baseExcludedSet.has(path));
9866
- if (toRemove.length > 0) await runGit([
9867
- "rm",
9868
- "--cached",
9869
- "-f",
9870
- "-q",
9871
- "--",
9872
- ...toRemove
9873
- ], {
9874
- cwd: input.cwd,
9875
- env: indexEnv
9876
- });
9877
- const diff = await runGitBuffer([
9878
- "diff",
9879
- "--binary",
9880
- "--cached",
9881
- input.baseSha
9882
- ], {
9883
- cwd: input.cwd,
9884
- env: indexEnv,
9885
- reject: false
9886
- });
9887
- if (diff.code !== 0 && diff.code !== 1) throw new Error(`git diff --binary failed (exit ${diff.code}): ${diff.stderr.toString("utf8")}`);
9888
- if (diff.stdout.byteLength > 2097152) throw new ExpectedCliError(`Working tree diff exceeds the ${PROJECT_DRAFT_DIFF_MAX_BYTES} byte limit. Reduce local changes or split them before syncing.`);
9889
- return new Uint8Array(diff.stdout);
9890
- } finally {
9891
- await rm(tempDir, {
9892
- recursive: true,
9893
- force: true
9894
- }).catch(() => {});
9895
- }
9896
- }
9897
- //#endregion
9898
9836
  //#region src/git/commit-working-tree.ts
9899
9837
  /**
9900
9838
  * Create a local commit from the desired working tree (source-filtered),
9901
9839
  * parented by `baseSha`, without mutating the real index. Returns null when
9902
9840
  * the resulting tree matches `baseSha`.
9841
+ *
9842
+ * Seeds the temp index with `read-tree baseSha` (not a copy of the real index)
9843
+ * so same-size same-mtime worktree rewrites cannot be skipped under racy-git.
9903
9844
  */
9904
9845
  async function commitWorkingTreeOntoBase(input) {
9905
9846
  const baseEnv = await resolveGitCommitEnv({
9906
9847
  cwd: input.cwd,
9907
9848
  env: input.env
9908
9849
  });
9909
- const gitIndexPath = (await runGit([
9910
- "rev-parse",
9911
- "--git-path",
9912
- "index"
9913
- ], {
9914
- cwd: input.cwd,
9915
- env: baseEnv
9916
- })).stdout.trim();
9917
- const realIndexPath = resolveGitPath(input.cwd, gitIndexPath);
9918
9850
  const tempDir = await mkdtemp(join(tmpdir(), "keystroke-draft-commit-"));
9919
9851
  const tempIndexPath = join(tempDir, "index");
9920
9852
  try {
9921
- await copyFile(realIndexPath, tempIndexPath);
9922
9853
  const indexEnv = {
9923
9854
  ...baseEnv,
9924
9855
  GIT_INDEX_FILE: tempIndexPath
9925
9856
  };
9857
+ await runGit(["read-tree", input.baseSha], {
9858
+ cwd: input.cwd,
9859
+ env: indexEnv
9860
+ });
9926
9861
  await runGit([
9927
9862
  "add",
9928
9863
  "-A",
@@ -10000,6 +9935,101 @@ async function commitWorkingTreeOntoBase(input) {
10000
9935
  }
10001
9936
  }
10002
9937
  //#endregion
9938
+ //#region src/git/compute-working-tree-diff.ts
9939
+ async function listNullSeparatedPaths(cwd, args, env) {
9940
+ const { stdout } = await runGit(args, {
9941
+ cwd,
9942
+ env
9943
+ });
9944
+ return stdout.split("\0").filter((path) => path.length > 0);
9945
+ }
9946
+ /**
9947
+ * Build a `git diff --binary` from `baseSha` to the desired working tree
9948
+ * (staged + unstaged + untracked), without mutating the real index.
9949
+ *
9950
+ * Seeds a temp `GIT_INDEX_FILE` with `read-tree baseSha` (zeroed stats) then
9951
+ * `git add -A`. Copying the real index is unsafe: same-size same-mtime rewrites
9952
+ * can look clean under racy-git once the copied index file is newer than the
9953
+ * worktree. Source-excluded paths (`.env`, `node_modules`, `.keystroke`, …)
9954
+ * keep their `baseSha` blob when present on D0 (so the patch never deletes or
9955
+ * locally-edits them); otherwise they are dropped from the temp index so
9956
+ * untracked secrets stay out.
9957
+ */
9958
+ async function computeWorkingTreeDiff(input) {
9959
+ const baseEnv = input.env;
9960
+ const tempDir = await mkdtemp(join(tmpdir(), "keystroke-draft-index-"));
9961
+ const tempIndexPath = input.resolveTempIndexPath?.() ?? join(tempDir, "index");
9962
+ try {
9963
+ const indexEnv = {
9964
+ ...baseEnv,
9965
+ GIT_INDEX_FILE: tempIndexPath
9966
+ };
9967
+ await runGit(["read-tree", input.baseSha], {
9968
+ cwd: input.cwd,
9969
+ env: indexEnv
9970
+ });
9971
+ await runGit([
9972
+ "add",
9973
+ "-A",
9974
+ "--",
9975
+ "."
9976
+ ], {
9977
+ cwd: input.cwd,
9978
+ env: indexEnv
9979
+ });
9980
+ const baseExcluded = (await listNullSeparatedPaths(input.cwd, [
9981
+ "ls-tree",
9982
+ "-r",
9983
+ "--name-only",
9984
+ "-z",
9985
+ input.baseSha
9986
+ ], baseEnv)).filter((path) => isIgnoredProjectSourcePath(path));
9987
+ for (const path of baseExcluded) await runGit([
9988
+ "restore",
9989
+ "--source",
9990
+ input.baseSha,
9991
+ "--staged",
9992
+ "--",
9993
+ path
9994
+ ], {
9995
+ cwd: input.cwd,
9996
+ env: indexEnv
9997
+ });
9998
+ const indexExcluded = (await listNullSeparatedPaths(input.cwd, ["ls-files", "-z"], indexEnv)).filter((path) => isIgnoredProjectSourcePath(path));
9999
+ const baseExcludedSet = new Set(baseExcluded);
10000
+ const toRemove = indexExcluded.filter((path) => !baseExcludedSet.has(path));
10001
+ if (toRemove.length > 0) await runGit([
10002
+ "rm",
10003
+ "--cached",
10004
+ "-f",
10005
+ "-q",
10006
+ "--",
10007
+ ...toRemove
10008
+ ], {
10009
+ cwd: input.cwd,
10010
+ env: indexEnv
10011
+ });
10012
+ const diff = await runGitBuffer([
10013
+ "diff",
10014
+ "--binary",
10015
+ "--cached",
10016
+ input.baseSha
10017
+ ], {
10018
+ cwd: input.cwd,
10019
+ env: indexEnv,
10020
+ reject: false
10021
+ });
10022
+ if (diff.code !== 0 && diff.code !== 1) throw new Error(`git diff --binary failed (exit ${diff.code}): ${diff.stderr.toString("utf8")}`);
10023
+ if (diff.stdout.byteLength > 2097152) throw new ExpectedCliError(`Working tree diff exceeds the ${PROJECT_DRAFT_DIFF_MAX_BYTES} byte limit. Reduce local changes or split them before syncing.`);
10024
+ return new Uint8Array(diff.stdout);
10025
+ } finally {
10026
+ await rm(tempDir, {
10027
+ recursive: true,
10028
+ force: true
10029
+ }).catch(() => {});
10030
+ }
10031
+ }
10032
+ //#endregion
10003
10033
  //#region src/git/managed-transport.ts
10004
10034
  /**
10005
10035
  * Fetch a remote branch into a temporary ref, then pin to an exact commit SHA.
@@ -14210,7 +14240,7 @@ function createProgram() {
14210
14240
  async function runCli(argv) {
14211
14241
  initCliTelemetry();
14212
14242
  try {
14213
- const { maybeAutoUpdate } = await import("./maybe-auto-update-J-Am1CbS.mjs");
14243
+ const { maybeAutoUpdate } = await import("./maybe-auto-update-B-zGDplJ.mjs");
14214
14244
  await maybeAutoUpdate(argv);
14215
14245
  await createProgram().parseAsync(argv);
14216
14246
  } finally {
@@ -14220,4 +14250,4 @@ async function runCli(argv) {
14220
14250
  //#endregion
14221
14251
  export { runCli };
14222
14252
 
14223
- //# sourceMappingURL=program-BWeEKhR_.mjs.map
14253
+ //# sourceMappingURL=program-Ct4qJuBN.mjs.map