@keystrokehq/cli 0.1.154 → 0.1.156

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-BRBV4UYO.mjs");
43
+ const { runCli } = await import("./program-CH1W0mPS.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-CNku7nyL.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-CuLe-Jux.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-DSecmpgs.mjs.map
144
+ //# sourceMappingURL=maybe-auto-update-J-Am1CbS.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"maybe-auto-update-DSecmpgs.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,MAAM,eA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B;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-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,IA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sB;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-CNku7nyL.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-CzjQQX4X.mjs";
4
- import { $ as withMcpReadClient, Q as assertPublicHttpUrl, Z as PublicHttpUrlError, _t as captureException, bt as flushTelemetry, et as artifactIndexFromModules, gt as alias, nt as mapInParallelBatches, rt as moduleBlobRefsFromModules, tt as collectArtifactModules, vt as configureTelemetry, xt as shutdownTelemetry, yt as event } from "./dist-BvOVZp_0.mjs";
5
- import { a as buildApp, c as computeSafeFilteredDeploy, r as analyzeDeployableClosures, t as ANALYZER_CONTRACT_VERSION } from "./dist-CK9_DSoK.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-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-D-qnmHDz.mjs";
5
+ import { a as buildApp, c as computeSafeFilteredDeploy, r as analyzeDeployableClosures, t as ANALYZER_CONTRACT_VERSION } from "./dist-BJAZiZG-.mjs";
6
6
  import { createRequire } from "node:module";
7
7
  import { Command } from "commander";
8
8
  import { homedir, platform, release, tmpdir } from "node:os";
@@ -8966,7 +8966,7 @@ function registerBuildCommand(program) {
8966
8966
  try {
8967
8967
  const root = resolveProjectRoot(options.dir);
8968
8968
  await ensureSdkCurrent(root);
8969
- const { buildApp } = await import("./dist-BMzrjzk7.mjs");
8969
+ const { buildApp } = await import("./dist-Bu6eqCZI.mjs");
8970
8970
  await buildApp({ root });
8971
8971
  process.stdout.write(`Built ${root}\n`);
8972
8972
  } catch (error) {
@@ -9132,6 +9132,106 @@ async function runGitBuffer(args, options) {
9132
9132
  });
9133
9133
  }
9134
9134
  //#endregion
9135
+ //#region src/git/git-identity.ts
9136
+ /** Fallback when neither env nor git config defines a commit identity. */
9137
+ const DEFAULT_GIT_COMMIT_IDENTITY = {
9138
+ name: "Keystroke",
9139
+ email: "noreply@keystroke.dev"
9140
+ };
9141
+ function trimOrUndefined(value) {
9142
+ const trimmed = value?.trim();
9143
+ return trimmed && trimmed.length > 0 ? trimmed : void 0;
9144
+ }
9145
+ async function readGitConfigValue(cwd, env, key) {
9146
+ const result = await runGit([
9147
+ "config",
9148
+ "--get",
9149
+ key
9150
+ ], {
9151
+ cwd,
9152
+ env,
9153
+ reject: false
9154
+ });
9155
+ if (result.code !== 0) return;
9156
+ return trimOrUndefined(result.stdout);
9157
+ }
9158
+ /**
9159
+ * Resolve one identity role without borrowing fields from the other role.
9160
+ * Prefer a complete env pair for that role, else git config, else fallback.
9161
+ */
9162
+ async function resolveRoleIdentity(input) {
9163
+ const envName = trimOrUndefined(input.env[input.nameKey]);
9164
+ const envEmail = trimOrUndefined(input.env[input.emailKey]);
9165
+ if (envName && envEmail) return {
9166
+ name: envName,
9167
+ email: envEmail
9168
+ };
9169
+ const name = input.configName ?? await readGitConfigValue(input.cwd, input.env, "user.name");
9170
+ const email = input.configEmail ?? await readGitConfigValue(input.cwd, input.env, "user.email");
9171
+ return {
9172
+ name: name ?? input.fallback.name,
9173
+ email: email ?? input.fallback.email
9174
+ };
9175
+ }
9176
+ /**
9177
+ * Ensure `git commit-tree` / commit operations have an author identity.
9178
+ * Prefer complete GIT_AUTHOR_* / GIT_COMMITTER_* pairs, then repo/global git
9179
+ * config, then a Keystroke fallback. Does not mutate the caller's git config.
9180
+ */
9181
+ async function resolveGitCommitEnv(input) {
9182
+ const base = input.env ?? process.env;
9183
+ const fallback = input.fallback ?? DEFAULT_GIT_COMMIT_IDENTITY;
9184
+ const [configName, configEmail] = await Promise.all([readGitConfigValue(input.cwd, base, "user.name"), readGitConfigValue(input.cwd, base, "user.email")]);
9185
+ const author = await resolveRoleIdentity({
9186
+ cwd: input.cwd,
9187
+ env: base,
9188
+ nameKey: "GIT_AUTHOR_NAME",
9189
+ emailKey: "GIT_AUTHOR_EMAIL",
9190
+ fallback,
9191
+ ...configName !== void 0 ? { configName } : {},
9192
+ ...configEmail !== void 0 ? { configEmail } : {}
9193
+ });
9194
+ const committer = await resolveRoleIdentity({
9195
+ cwd: input.cwd,
9196
+ env: base,
9197
+ nameKey: "GIT_COMMITTER_NAME",
9198
+ emailKey: "GIT_COMMITTER_EMAIL",
9199
+ fallback: author,
9200
+ ...configName !== void 0 ? { configName } : {},
9201
+ ...configEmail !== void 0 ? { configEmail } : {}
9202
+ });
9203
+ return {
9204
+ ...base,
9205
+ GIT_AUTHOR_NAME: author.name,
9206
+ GIT_AUTHOR_EMAIL: author.email,
9207
+ GIT_COMMITTER_NAME: committer.name,
9208
+ GIT_COMMITTER_EMAIL: committer.email
9209
+ };
9210
+ }
9211
+ /**
9212
+ * For managed sidecar repos, persist a local identity when git config is empty
9213
+ * so subsequent commit-tree / commit calls work without ambient user config.
9214
+ */
9215
+ async function ensureManagedGitIdentity(cwd, env, fallback = DEFAULT_GIT_COMMIT_IDENTITY) {
9216
+ const [name, email] = await Promise.all([readGitConfigValue(cwd, env, "user.name"), readGitConfigValue(cwd, env, "user.email")]);
9217
+ if (!name) await runGit([
9218
+ "config",
9219
+ "user.name",
9220
+ fallback.name
9221
+ ], {
9222
+ cwd,
9223
+ env
9224
+ });
9225
+ if (!email) await runGit([
9226
+ "config",
9227
+ "user.email",
9228
+ fallback.email
9229
+ ], {
9230
+ cwd,
9231
+ env
9232
+ });
9233
+ }
9234
+ //#endregion
9135
9235
  //#region src/git/managed-git-env.ts
9136
9236
  /** Work-tree ignore entry so `git add` never walks the in-tree `GIT_DIR`. */
9137
9237
  const MANAGED_GIT_EXCLUDE_ENTRY = ".keystroke/";
@@ -9236,6 +9336,7 @@ async function ensureManagedGit(projectRoot) {
9236
9336
  reject: false
9237
9337
  })).code === 0) {
9238
9338
  await ensureManagedGitExclude(root, env);
9339
+ await ensureManagedGitIdentity(root, env);
9239
9340
  return {
9240
9341
  env,
9241
9342
  created: false
@@ -9251,6 +9352,7 @@ async function ensureManagedGit(projectRoot) {
9251
9352
  env
9252
9353
  });
9253
9354
  await ensureManagedGitExclude(root, env);
9355
+ await ensureManagedGitIdentity(root, env);
9254
9356
  return {
9255
9357
  env,
9256
9358
  created: true
@@ -9800,7 +9902,10 @@ async function computeWorkingTreeDiff(input) {
9800
9902
  * the resulting tree matches `baseSha`.
9801
9903
  */
9802
9904
  async function commitWorkingTreeOntoBase(input) {
9803
- const baseEnv = input.env;
9905
+ const baseEnv = await resolveGitCommitEnv({
9906
+ cwd: input.cwd,
9907
+ env: input.env
9908
+ });
9804
9909
  const gitIndexPath = (await runGit([
9805
9910
  "rev-parse",
9806
9911
  "--git-path",
@@ -10905,9 +11010,13 @@ function assertSha(value, label) {
10905
11010
  if (!SHA_RE.test(value)) throw new Error(`${label} is not a valid 40-char hex SHA: ${value}`);
10906
11011
  }
10907
11012
  async function composeManagedCandidate(input) {
10908
- const { cwd, env, mainSha, draftSha, mode, message } = input;
11013
+ const { cwd, mainSha, draftSha, mode, message } = input;
10909
11014
  assertSha(mainSha, "mainSha");
10910
11015
  assertSha(draftSha, "draftSha");
11016
+ const env = await resolveGitCommitEnv({
11017
+ cwd,
11018
+ env: input.env
11019
+ });
10911
11020
  const gitOpts = {
10912
11021
  cwd,
10913
11022
  env
@@ -11195,6 +11304,11 @@ const DEPLOY_TIMEOUT_MS = 12e4;
11195
11304
  const DEPLOY_LEASE_HEARTBEAT_MS = 3e4;
11196
11305
  const ARTIFACT_STORAGE_NETWORK_MESSAGE = "Could not reach artifact storage. Check your network/DNS and retry; corporate proxies or DNS policies sometimes block storage hosts.";
11197
11306
  const NON_INTERACTIVE_CONFIRM_HINT = "Pass --accept-impact to accept the current filtered deploy impact, or run interactively in a TTY.";
11307
+ /** Platform complete mapped a missing CAS blob after upload (often Tigris read lag). */
11308
+ /** @internal Exported for unit tests. */
11309
+ function isMissingModuleBlobCompleteError(error) {
11310
+ return error instanceof PlatformError && error.status === 400 && /Missing or incomplete module blob/i.test(error.message);
11311
+ }
11198
11312
  function asExpectedAuthoringOrNetworkError(error) {
11199
11313
  if (!(error instanceof Error)) return error;
11200
11314
  if (error instanceof PlatformError) {
@@ -11524,30 +11638,42 @@ async function runManagedDeploy(client, config, options) {
11524
11638
  if (verbose) process.stdout.write(` build: ${buildMs}ms\n`);
11525
11639
  assertLease();
11526
11640
  if (!verbose) process.stdout.write("Uploading…\n");
11527
- const uploadStarted = Date.now();
11528
- const renewed = await client.projectGit.renewDeployUpload(options.projectId, {
11529
- artifactId: prepared.artifact.id,
11530
- blobs: built.blobs
11531
- });
11532
11641
  const bytesByHash = new Map(built.modules.map((mod) => [mod.hash, mod.bytes]));
11533
- await Promise.all(renewed.uploads.map(async (upload) => {
11534
- const body = bytesByHash.get(upload.hash);
11535
- if (!body) throw new Error(`Missing bytes for module blob ${upload.hash}`);
11536
- const uploadResponse = await fetch(upload.url, {
11537
- method: "PUT",
11538
- body,
11539
- headers: { "Content-Type": "application/octet-stream" }
11642
+ const uploadAndComplete = async () => {
11643
+ const uploadStarted = Date.now();
11644
+ const renewed = await client.projectGit.renewDeployUpload(options.projectId, {
11645
+ artifactId: prepared.artifact.id,
11646
+ blobs: built.blobs
11540
11647
  });
11541
- if (!uploadResponse.ok) throw new Error(`Module upload failed (${uploadResponse.status}) for ${upload.hash}`);
11542
- }));
11543
- phase("upload", uploadStarted);
11544
- assertLease();
11545
- const completeStarted = Date.now();
11546
- const completed = await client.projectGit.completeDeployArtifact(options.projectId, {
11547
- artifactId: prepared.artifact.id,
11548
- index: built.index
11549
- });
11550
- phase("complete", completeStarted);
11648
+ await Promise.all(renewed.uploads.map(async (upload) => {
11649
+ const body = bytesByHash.get(upload.hash);
11650
+ if (!body) throw new Error(`Missing bytes for module blob ${upload.hash}`);
11651
+ const uploadResponse = await fetch(upload.url, {
11652
+ method: "PUT",
11653
+ body,
11654
+ headers: { "Content-Type": "application/octet-stream" }
11655
+ });
11656
+ if (!uploadResponse.ok) throw new Error(`Module upload failed (${uploadResponse.status}) for ${upload.hash}`);
11657
+ }));
11658
+ phase("upload", uploadStarted);
11659
+ assertLease();
11660
+ const completeStarted = Date.now();
11661
+ const completed = await client.projectGit.completeDeployArtifact(options.projectId, {
11662
+ artifactId: prepared.artifact.id,
11663
+ index: built.index
11664
+ });
11665
+ phase("complete", completeStarted);
11666
+ return completed;
11667
+ };
11668
+ let completed;
11669
+ try {
11670
+ completed = await uploadAndComplete();
11671
+ } catch (error) {
11672
+ if (!isMissingModuleBlobCompleteError(error)) throw error;
11673
+ if (verbose) process.stdout.write("Retrying upload after missing module blob…\n");
11674
+ else process.stdout.write("Retrying upload…\n");
11675
+ completed = await uploadAndComplete();
11676
+ }
11551
11677
  if (verbose) process.stdout.write(`Deploy ${completed.artifact.id} started (${completed.mode})\n`);
11552
11678
  return completed.artifact.id;
11553
11679
  }
@@ -14084,7 +14210,7 @@ function createProgram() {
14084
14210
  async function runCli(argv) {
14085
14211
  initCliTelemetry();
14086
14212
  try {
14087
- const { maybeAutoUpdate } = await import("./maybe-auto-update-DSecmpgs.mjs");
14213
+ const { maybeAutoUpdate } = await import("./maybe-auto-update-J-Am1CbS.mjs");
14088
14214
  await maybeAutoUpdate(argv);
14089
14215
  await createProgram().parseAsync(argv);
14090
14216
  } finally {
@@ -14094,4 +14220,4 @@ async function runCli(argv) {
14094
14220
  //#endregion
14095
14221
  export { runCli };
14096
14222
 
14097
- //# sourceMappingURL=program-BRBV4UYO.mjs.map
14223
+ //# sourceMappingURL=program-CH1W0mPS.mjs.map