@superblocksteam/sdk 2.0.140 → 2.0.141-next.1

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.
Files changed (114) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/cli-replacement/dependency-install-classifier.d.mts +2 -6
  3. package/dist/cli-replacement/dependency-install-classifier.d.mts.map +1 -1
  4. package/dist/cli-replacement/dependency-install-classifier.mjs +1 -1
  5. package/dist/cli-replacement/dependency-install-classifier.mjs.map +1 -1
  6. package/dist/cli-replacement/dev-s3-restore.test.mjs +1 -0
  7. package/dist/cli-replacement/dev-s3-restore.test.mjs.map +1 -1
  8. package/dist/cli-replacement/dev-startup-git-before-dbfs-order.test.mjs +1 -0
  9. package/dist/cli-replacement/dev-startup-git-before-dbfs-order.test.mjs.map +1 -1
  10. package/dist/cli-replacement/dev.d.mts.map +1 -1
  11. package/dist/cli-replacement/dev.mjs +81 -27
  12. package/dist/cli-replacement/dev.mjs.map +1 -1
  13. package/dist/cli-replacement/disk-space.d.mts +7 -19
  14. package/dist/cli-replacement/disk-space.d.mts.map +1 -1
  15. package/dist/cli-replacement/disk-space.mjs +2 -2
  16. package/dist/cli-replacement/disk-space.mjs.map +1 -1
  17. package/dist/cli-replacement/home-npmrc.d.mts +4 -3
  18. package/dist/cli-replacement/home-npmrc.d.mts.map +1 -1
  19. package/dist/cli-replacement/normalize-workspace-protocol.d.ts +1 -1
  20. package/dist/cli-replacement/normalize-workspace-protocol.d.ts.map +1 -1
  21. package/dist/cli-replacement/package-json-snapshot.d.mts +0 -1
  22. package/dist/cli-replacement/package-json-snapshot.d.mts.map +1 -1
  23. package/dist/cli-replacement/package-json-snapshot.mjs +1 -1
  24. package/dist/cli-replacement/package-json-snapshot.mjs.map +1 -1
  25. package/dist/cli-replacement/post-upgrade-lockfile-strip.d.mts +3 -2
  26. package/dist/cli-replacement/post-upgrade-lockfile-strip.d.mts.map +1 -1
  27. package/dist/cli-replacement/version-detection.d.ts +2 -1
  28. package/dist/cli-replacement/version-detection.d.ts.map +1 -1
  29. package/dist/client.d.ts +6 -6
  30. package/dist/client.d.ts.map +1 -1
  31. package/dist/collect-sdk-apis.d.mts +4 -3
  32. package/dist/collect-sdk-apis.d.mts.map +1 -1
  33. package/dist/dev-utils/dedupe-async.d.ts +2 -1
  34. package/dist/dev-utils/dedupe-async.d.ts.map +1 -1
  35. package/dist/dev-utils/dev-server-metrics.d.mts +4 -3
  36. package/dist/dev-utils/dev-server-metrics.d.mts.map +1 -1
  37. package/dist/dev-utils/dev-server-metrics.mjs +3 -2
  38. package/dist/dev-utils/dev-server-metrics.mjs.map +1 -1
  39. package/dist/dev-utils/dev-server.d.mts +5 -1
  40. package/dist/dev-utils/dev-server.d.mts.map +1 -1
  41. package/dist/dev-utils/dev-server.mjs +12 -18
  42. package/dist/dev-utils/dev-server.mjs.map +1 -1
  43. package/dist/dev-utils/dev-server.optimize-deps.test.d.mts +2 -0
  44. package/dist/dev-utils/dev-server.optimize-deps.test.d.mts.map +1 -0
  45. package/dist/dev-utils/dev-server.optimize-deps.test.mjs +490 -0
  46. package/dist/dev-utils/dev-server.optimize-deps.test.mjs.map +1 -0
  47. package/dist/dev-utils/fatal-exit.d.mts +3 -2
  48. package/dist/dev-utils/fatal-exit.d.mts.map +1 -1
  49. package/dist/dev-utils/optimize-deps-config.d.mts +16 -0
  50. package/dist/dev-utils/optimize-deps-config.d.mts.map +1 -0
  51. package/dist/dev-utils/optimize-deps-config.mjs +95 -0
  52. package/dist/dev-utils/optimize-deps-config.mjs.map +1 -0
  53. package/dist/dev-utils/prepare-in-place-restart.d.mts +4 -3
  54. package/dist/dev-utils/prepare-in-place-restart.d.mts.map +1 -1
  55. package/dist/dev-utils/vite-dev-server-diagnostics.d.mts +1 -1
  56. package/dist/dev-utils/vite-dev-server-diagnostics.d.mts.map +1 -1
  57. package/dist/index.d.ts +0 -1
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +0 -3
  60. package/dist/index.js.map +1 -1
  61. package/dist/parse-sdk-registry.d.mts +2 -2
  62. package/dist/parse-sdk-registry.d.mts.map +1 -1
  63. package/dist/parse-sdk-registry.mjs.map +1 -1
  64. package/dist/sdk.d.ts +0 -1
  65. package/dist/sdk.d.ts.map +1 -1
  66. package/dist/sdk.js +0 -1
  67. package/dist/sdk.js.map +1 -1
  68. package/dist/socket/index.d.ts.map +1 -1
  69. package/dist/socket/index.js +9 -2
  70. package/dist/socket/index.js.map +1 -1
  71. package/dist/socket/index.test.d.ts +2 -0
  72. package/dist/socket/index.test.d.ts.map +1 -0
  73. package/dist/socket/index.test.js +25 -0
  74. package/dist/socket/index.test.js.map +1 -0
  75. package/dist/telemetry/attributes.d.ts +0 -1
  76. package/dist/telemetry/attributes.d.ts.map +1 -1
  77. package/dist/telemetry/attributes.js +0 -2
  78. package/dist/telemetry/attributes.js.map +1 -1
  79. package/dist/telemetry/local-obs.d.ts +0 -30
  80. package/dist/telemetry/local-obs.d.ts.map +1 -1
  81. package/dist/telemetry/local-obs.js +1 -1
  82. package/dist/telemetry/local-obs.js.map +1 -1
  83. package/dist/telemetry/logging.d.ts +2 -1
  84. package/dist/telemetry/logging.d.ts.map +1 -1
  85. package/package.json +15 -15
  86. package/src/cli-replacement/dependency-install-classifier.mts +2 -2
  87. package/src/cli-replacement/dev-s3-restore.test.mts +1 -0
  88. package/src/cli-replacement/dev-startup-git-before-dbfs-order.test.mts +1 -0
  89. package/src/cli-replacement/dev.mts +127 -34
  90. package/src/cli-replacement/disk-space.mts +8 -9
  91. package/src/cli-replacement/home-npmrc.mts +3 -3
  92. package/src/cli-replacement/normalize-workspace-protocol.ts +1 -1
  93. package/src/cli-replacement/package-json-snapshot.mts +1 -1
  94. package/src/cli-replacement/post-upgrade-lockfile-strip.mts +2 -2
  95. package/src/cli-replacement/version-detection.ts +1 -1
  96. package/src/client.ts +6 -6
  97. package/src/collect-sdk-apis.mts +3 -3
  98. package/src/dev-utils/dedupe-async.ts +1 -1
  99. package/src/dev-utils/dev-server-metrics.mts +4 -2
  100. package/src/dev-utils/dev-server.mts +23 -17
  101. package/src/dev-utils/dev-server.optimize-deps.test.mts +671 -0
  102. package/src/dev-utils/fatal-exit.mts +2 -2
  103. package/src/dev-utils/optimize-deps-config.mts +96 -0
  104. package/src/dev-utils/prepare-in-place-restart.mts +3 -3
  105. package/src/dev-utils/vite-dev-server-diagnostics.mts +1 -1
  106. package/src/index.ts +0 -7
  107. package/src/parse-sdk-registry.mts +1 -2
  108. package/src/sdk.ts +0 -5
  109. package/src/socket/index.test.ts +36 -0
  110. package/src/socket/index.ts +13 -1
  111. package/src/telemetry/attributes.ts +0 -2
  112. package/src/telemetry/local-obs.ts +2 -2
  113. package/src/telemetry/logging.ts +1 -1
  114. package/tsconfig.tsbuildinfo +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superblocksteam/sdk",
3
- "version": "2.0.140",
3
+ "version": "2.0.141-next.1",
4
4
  "description": "Superblocks JS SDK",
5
5
  "homepage": "https://www.superblocks.com",
6
6
  "license": "Superblocks Community Software License",
@@ -25,15 +25,15 @@
25
25
  "@babel/plugin-proposal-decorators": "^7.28.0",
26
26
  "@babel/plugin-transform-typescript": "7.28.0",
27
27
  "@opentelemetry/api": "^1.9.1",
28
- "@opentelemetry/api-logs": "^0.217.0",
29
- "@opentelemetry/context-async-hooks": "^2.6.1",
30
- "@opentelemetry/exporter-logs-otlp-http": "^0.217.0",
31
- "@opentelemetry/exporter-trace-otlp-http": "^0.217.0",
32
- "@opentelemetry/instrumentation-express": "^0.62.0",
33
- "@opentelemetry/instrumentation-http": "^0.217.0",
34
- "@opentelemetry/resources": "^2.6.1",
35
- "@opentelemetry/sdk-node": "^0.217.0",
36
- "@opentelemetry/semantic-conventions": "^1.36.0",
28
+ "@opentelemetry/api-logs": "^0.220.0",
29
+ "@opentelemetry/context-async-hooks": "^2.9.0",
30
+ "@opentelemetry/exporter-logs-otlp-http": "^0.220.0",
31
+ "@opentelemetry/exporter-trace-otlp-http": "^0.220.0",
32
+ "@opentelemetry/instrumentation-express": "^0.68.0",
33
+ "@opentelemetry/instrumentation-http": "^0.220.0",
34
+ "@opentelemetry/resources": "^2.9.0",
35
+ "@opentelemetry/sdk-node": "^0.220.0",
36
+ "@opentelemetry/semantic-conventions": "^1.41.1",
37
37
  "@superblocksteam/bucketeer-sdk": "1.1.0",
38
38
  "@vitejs/plugin-react": "4.3.4",
39
39
  "axios": "^1.15.2",
@@ -57,11 +57,11 @@
57
57
  "vite-tsconfig-paths": "^6.0.4",
58
58
  "winston": "^3.17.0",
59
59
  "yaml": "^2.7.1",
60
- "@superblocksteam/library-shared": "2.0.140",
61
- "@superblocksteam/shared": "0.9597.1",
62
- "@superblocksteam/telemetry": "2.0.140",
63
- "@superblocksteam/util": "2.0.140",
64
- "@superblocksteam/vite-plugin-file-sync": "2.0.140"
60
+ "@superblocksteam/library-shared": "2.0.141-next.1",
61
+ "@superblocksteam/shared": "0.9598.1",
62
+ "@superblocksteam/telemetry": "2.0.141-next.1",
63
+ "@superblocksteam/util": "2.0.141-next.1",
64
+ "@superblocksteam/vite-plugin-file-sync": "2.0.141-next.1"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@eslint/js": "^9.39.2",
@@ -39,7 +39,7 @@ export class UpgradeFailed extends Error {
39
39
  }
40
40
  }
41
41
 
42
- export interface ExecFailure {
42
+ interface ExecFailure {
43
43
  stdout?: string;
44
44
  stderr?: string;
45
45
  message?: string;
@@ -58,7 +58,7 @@ const REASON_TO_CATEGORY: Record<
58
58
  const DEP_CONFLICT_CODES = /\b(ERESOLVE|ETARGET|EPEERINVALID)\b/;
59
59
 
60
60
  /** Best-effort: pull package specs out of an ERESOLVE/ETARGET `--json` detail. */
61
- export function parseDependencyConflict(
61
+ function parseDependencyConflict(
62
62
  text: string,
63
63
  ): { name: string; version?: string }[] {
64
64
  const out: { name: string; version?: string }[] = [];
@@ -115,6 +115,7 @@ vi.mock("@superblocksteam/util", () => ({
115
115
  vi.mock("@superblocksteam/vite-plugin-file-sync/ai-service", () => ({
116
116
  AiService: class {
117
117
  initialize = vi.fn(async () => undefined);
118
+ notifyMigrationAppArtifactsReady = vi.fn();
118
119
  removeIntegrationCache = vi.fn(async () => undefined);
119
120
  chatSessionStore = { invalidateCache: vi.fn() };
120
121
  // `dev.mts` reads this at startup for two paths: `syncHomeNpmrc`
@@ -115,6 +115,7 @@ vi.mock("@superblocksteam/util", () => ({
115
115
  vi.mock("@superblocksteam/vite-plugin-file-sync/ai-service", () => ({
116
116
  AiService: class {
117
117
  initialize = vi.fn(async () => undefined);
118
+ notifyMigrationAppArtifactsReady = vi.fn();
118
119
  removeIntegrationCache = vi.fn(async () => undefined);
119
120
  chatSessionStore = { invalidateCache: vi.fn() };
120
121
  getNpmRegistryClient = vi.fn(() => undefined);
@@ -17,6 +17,7 @@ import {
17
17
  buildGithubSuperblocksSyncWorkflowFromBaseUrl,
18
18
  ConflictError,
19
19
  DEFAULT_NON_GIT_BRANCH,
20
+ isGitAuthErrorMessage,
20
21
  isGitHubRemoteUrl,
21
22
  SUPERBLOCKS_LIVE_GIT_BRANCH,
22
23
  } from "@superblocksteam/shared";
@@ -1007,6 +1008,7 @@ export async function dev(options: {
1007
1008
 
1008
1009
  const fsOperationQueue = new OperationQueue();
1009
1010
  let activeDbfsBranchName = applicationConfig?.branchName ?? "main";
1011
+ let devStartupGitBootstrapAuthFailed = false;
1010
1012
  let devStartupGitOutcome:
1011
1013
  | "skipped_no_remote"
1012
1014
  | "bootstrap_failed"
@@ -1186,6 +1188,7 @@ export async function dev(options: {
1186
1188
  logger,
1187
1189
  tokenManager,
1188
1190
  features: AiServiceFeatureFlags.create(flagBootstrap),
1191
+ flagBootstrap,
1189
1192
  pluginExecutionVersions:
1190
1193
  currentUser.organizations[0].pluginExecutionVersions,
1191
1194
  });
@@ -1201,6 +1204,10 @@ export async function dev(options: {
1201
1204
  },
1202
1205
  );
1203
1206
 
1207
+ if (uploadFirst) {
1208
+ aiService?.notifyMigrationAppArtifactsReady();
1209
+ }
1210
+
1204
1211
  logger.info(
1205
1212
  `[dev-startup] Starting git sync (${downloadFirst ? "download" : "upload"}-first) on branch '${activeDbfsBranchName}'`,
1206
1213
  );
@@ -1281,6 +1288,8 @@ export async function dev(options: {
1281
1288
  } catch (gitError) {
1282
1289
  // Init/configure/ensureGitRepo failed — repo is not usable
1283
1290
  devStartupGitOutcome = "bootstrap_failed";
1291
+ devStartupGitBootstrapAuthFailed =
1292
+ isGitAuthErrorMessage(gitError);
1284
1293
  gitService = undefined;
1285
1294
  logger.warn(
1286
1295
  "[git] startup git setup failed, continuing without git",
@@ -1392,6 +1401,10 @@ export async function dev(options: {
1392
1401
  logger.info("[dev-startup] Skipping download, already in sync");
1393
1402
  }
1394
1403
 
1404
+ if (downloadFirst) {
1405
+ aiService?.notifyMigrationAppArtifactsReady();
1406
+ }
1407
+
1395
1408
  const npmRegistryClient = aiService?.getNpmRegistryClient();
1396
1409
  const registryValidationResult =
1397
1410
  await privateRegistryValidationResult(npmRegistryClient, logger);
@@ -1938,6 +1951,33 @@ export async function dev(options: {
1938
1951
  }
1939
1952
  };
1940
1953
 
1954
+ const refreshRuntimeGitCredentials = async (): Promise<
1955
+ GitService | undefined
1956
+ > => {
1957
+ const gitConfigSdk = sdk as unknown as GitConfigSdk;
1958
+ const gitConfig = await gitConfigSdk.getApplicationGitConfig(
1959
+ applicationConfig.id,
1960
+ );
1961
+ if (!gitConfig?.gitRemoteUrl) {
1962
+ return undefined;
1963
+ }
1964
+
1965
+ if (gitService) {
1966
+ const refreshed = await refreshGitServiceCredentials({
1967
+ applicationId: applicationConfig.id,
1968
+ gitRemoteUrl: gitConfig.gitRemoteUrl,
1969
+ logger,
1970
+ sdk,
1971
+ service: gitService,
1972
+ userEmail: gitUserEmail,
1973
+ userName: gitUserName,
1974
+ });
1975
+ return refreshed ? gitService : undefined;
1976
+ }
1977
+
1978
+ return activateRuntimeGitService();
1979
+ };
1980
+
1941
1981
  const httpServer = await tracer.startActiveSpan(
1942
1982
  "createDevServer",
1943
1983
  async (span) => {
@@ -1949,10 +1989,13 @@ export async function dev(options: {
1949
1989
  fsOperationQueue,
1950
1990
  syncService: syncService,
1951
1991
  lockService: lockService,
1992
+ tokenManager,
1952
1993
  aiService: aiService,
1953
1994
  gitService: gitService,
1995
+ gitBootstrapAuthFailed: devStartupGitBootstrapAuthFailed,
1954
1996
  gitBootstrapFailed: devStartupGitOutcome === "bootstrap_failed",
1955
1997
  activateGitService: activateRuntimeGitService,
1998
+ refreshGitCredentials: refreshRuntimeGitCredentials,
1956
1999
  snapshotManager: snapshotManager,
1957
2000
  logger: options.logger,
1958
2001
  sdk,
@@ -2021,6 +2064,84 @@ export async function dev(options: {
2021
2064
  // Git sync helpers
2022
2065
  // ---------------------------------------------------------------------------
2023
2066
 
2067
+ interface GitConfigSdk {
2068
+ getApplicationGitConfig(applicationId: string): Promise<{
2069
+ gitRemoteUrl?: string;
2070
+ hasCredential?: boolean;
2071
+ } | null>;
2072
+ getGitFreshToken(
2073
+ host: string,
2074
+ applicationId: string,
2075
+ ): Promise<{ username: string; token: string }>;
2076
+ }
2077
+
2078
+ async function fetchGitCredentials({
2079
+ applicationId,
2080
+ gitRemoteUrl,
2081
+ logger,
2082
+ sdk,
2083
+ }: {
2084
+ applicationId: string;
2085
+ gitRemoteUrl: string;
2086
+ logger: Logger;
2087
+ sdk: SuperblocksSdk;
2088
+ }): Promise<{ username: string; token: string } | undefined> {
2089
+ const gitConfigSdk = sdk as unknown as GitConfigSdk;
2090
+
2091
+ try {
2092
+ const host = new URL(gitRemoteUrl).hostname;
2093
+ const freshToken = await gitConfigSdk.getGitFreshToken(host, applicationId);
2094
+ return freshToken ?? undefined;
2095
+ } catch (error) {
2096
+ let gitRemoteHost: string | undefined;
2097
+ try {
2098
+ gitRemoteHost = new URL(gitRemoteUrl).hostname;
2099
+ } catch {
2100
+ // ignore invalid URL for logging only
2101
+ }
2102
+ logger.warn("[git] credential fetch failed, continuing without auth", {
2103
+ gitCategory: "setup",
2104
+ gitOperation: "fetch-credentials",
2105
+ gitOutcome: "failed",
2106
+ applicationId,
2107
+ gitRemoteHost,
2108
+ ...getGitErrorFields(error),
2109
+ });
2110
+ return undefined;
2111
+ }
2112
+ }
2113
+
2114
+ async function refreshGitServiceCredentials({
2115
+ applicationId,
2116
+ gitRemoteUrl,
2117
+ logger,
2118
+ sdk,
2119
+ service,
2120
+ userEmail,
2121
+ userName,
2122
+ }: {
2123
+ applicationId: string;
2124
+ gitRemoteUrl: string;
2125
+ logger: Logger;
2126
+ sdk: SuperblocksSdk;
2127
+ service: GitService;
2128
+ userEmail?: string;
2129
+ userName?: string;
2130
+ }): Promise<boolean> {
2131
+ const credentials = await fetchGitCredentials({
2132
+ applicationId,
2133
+ gitRemoteUrl,
2134
+ logger,
2135
+ sdk,
2136
+ });
2137
+ if (!credentials) {
2138
+ return false;
2139
+ }
2140
+
2141
+ await service.configure({ credentials, userEmail, userName });
2142
+ return true;
2143
+ }
2144
+
2024
2145
  async function bootstrapGitService({
2025
2146
  sdk,
2026
2147
  applicationId,
@@ -2038,16 +2159,6 @@ async function bootstrapGitService({
2038
2159
  userEmail?: string;
2039
2160
  superblocksBaseUrl?: string;
2040
2161
  }): Promise<GitService | undefined> {
2041
- interface GitConfigSdk {
2042
- getApplicationGitConfig(applicationId: string): Promise<{
2043
- gitRemoteUrl?: string;
2044
- hasCredential?: boolean;
2045
- } | null>;
2046
- getGitFreshToken(
2047
- host: string,
2048
- applicationId: string,
2049
- ): Promise<{ username: string; token: string }>;
2050
- }
2051
2162
  const gitConfigSdk = sdk as unknown as GitConfigSdk;
2052
2163
  const gitConfig = await gitConfigSdk.getApplicationGitConfig(applicationId);
2053
2164
  if (!gitConfig?.gitRemoteUrl) {
@@ -2055,32 +2166,14 @@ async function bootstrapGitService({
2055
2166
  }
2056
2167
 
2057
2168
  const service = createGitService(cwd);
2058
- let credentials: { username: string; token: string } | undefined;
2059
- let gitRemoteHost: string | undefined;
2060
-
2061
- if (gitConfig.hasCredential) {
2062
- try {
2063
- const host = new URL(gitConfig.gitRemoteUrl).hostname;
2064
- gitRemoteHost = host;
2065
- const freshToken = await gitConfigSdk.getGitFreshToken(
2066
- host,
2169
+ const credentials = gitConfig.hasCredential
2170
+ ? await fetchGitCredentials({
2067
2171
  applicationId,
2068
- );
2069
- if (freshToken) {
2070
- credentials = freshToken;
2071
- }
2072
- } catch (error) {
2073
- logger.warn("[git] credential fetch failed, continuing without auth", {
2074
- gitCategory: "setup",
2075
- gitOperation: "fetch-credentials",
2076
- gitOutcome: "failed",
2077
- applicationId,
2078
- gitRemoteHost,
2079
2172
  gitRemoteUrl: gitConfig.gitRemoteUrl,
2080
- ...getGitErrorFields(error),
2081
- });
2082
- }
2083
- }
2173
+ logger,
2174
+ sdk,
2175
+ })
2176
+ : undefined;
2084
2177
 
2085
2178
  await service.configure({ credentials, userName, userEmail });
2086
2179
  logger.info("[git] configure complete, proceeding to ensureGitRepo", {
@@ -3,12 +3,12 @@ import path from "node:path";
3
3
 
4
4
  /** Minimal logger surface so this helper stays decoupled from the winston
5
5
  * instance threaded through `dev.mts` (and trivially fakeable in tests). */
6
- export interface ReclaimLogger {
6
+ interface ReclaimLogger {
7
7
  info: (message: string, meta?: unknown) => void;
8
8
  warn: (message: string, meta?: unknown) => void;
9
9
  }
10
10
 
11
- export interface DiskSpace {
11
+ interface DiskSpace {
12
12
  totalBytes: number;
13
13
  freeBytes: number;
14
14
  usedBytes: number;
@@ -21,12 +21,11 @@ export interface DiskSpace {
21
21
  * `errno -28`, or the kernel string — match all three. Centralised here (the
22
22
  * disk domain) so both the install classifier and the recovery escalation
23
23
  * gate agree on what "still out of space" means. */
24
- export const DISK_FULL_PATTERN =
25
- /\bENOSPC\b|no space left on device|\berrno -28\b/i;
24
+ const DISK_FULL_PATTERN = /\bENOSPC\b|no space left on device|\berrno -28\b/i;
26
25
 
27
26
  /** The error shape `util.promisify(exec)` rejects with (stdout/stderr/message
28
27
  * preserved separately). */
29
- export interface ExecLikeFailure {
28
+ interface ExecLikeFailure {
30
29
  stdout?: string;
31
30
  stderr?: string;
32
31
  message?: string;
@@ -66,7 +65,7 @@ export async function getDiskSpace(
66
65
  * reclaim is composition-agnostic (delete whatever exists) precisely because
67
66
  * it only ever touches throwaway build output. `node_modules` is deliberately
68
67
  * excluded here and gated behind `includeNodeModules` (tier 2). */
69
- export const RECLAIMABLE_ARTIFACTS: readonly string[] = [
68
+ const RECLAIMABLE_ARTIFACTS: readonly string[] = [
70
69
  ".turbo",
71
70
  ".vite",
72
71
  "build",
@@ -75,7 +74,7 @@ export const RECLAIMABLE_ARTIFACTS: readonly string[] = [
75
74
  "node_modules/.vite",
76
75
  ];
77
76
 
78
- export interface ReclaimResult {
77
+ interface ReclaimResult {
79
78
  /** Bytes reclaimed, measured as the increase in filesystem free space across
80
79
  * the deletions (a `statfs` delta). O(1) — deliberately NOT a directory walk:
81
80
  * sizing a real `node_modules` (50k–200k files) on an already-ENOSPC volume
@@ -85,7 +84,7 @@ export interface ReclaimResult {
85
84
  removed: string[];
86
85
  }
87
86
 
88
- export interface ReclaimOptions {
87
+ interface ReclaimOptions {
89
88
  /** Also remove `node_modules` — the tier-2 lever. After an ENOSPC mid-
90
89
  * install the tree is half-written anyway, so a clean reinstall is the
91
90
  * correct recovery AND it collapses the "old tree + new tree" 2× peak that
@@ -142,7 +141,7 @@ export async function reclaimDiskSpace(
142
141
  return { bytesFreed, removed };
143
142
  }
144
143
 
145
- export interface DiskRecoveryResult {
144
+ interface DiskRecoveryResult {
146
145
  recovered: boolean;
147
146
  /** The error from the final failed install attempt, when recovery failed —
148
147
  * so the caller can reclassify it for the most accurate surfaced error. */
@@ -108,7 +108,7 @@ export function superblocksNpmrcBackupPath(homeDir?: string): string {
108
108
  * success from the dev-startup point of view (the writer is best-effort
109
109
  * and never throws).
110
110
  */
111
- export type SyncHomeNpmrcOutcome =
111
+ type SyncHomeNpmrcOutcome =
112
112
  /** Config is set and `~/.superblocks/npmrc` was created or rewritten. */
113
113
  | "written"
114
114
  /**
@@ -160,7 +160,7 @@ export type SyncHomeNpmrcOutcome =
160
160
  /** The sync failed; the file is unchanged. Details in the warn log. */
161
161
  | "error";
162
162
 
163
- export interface SyncHomeNpmrcResult {
163
+ interface SyncHomeNpmrcResult {
164
164
  outcome: SyncHomeNpmrcOutcome;
165
165
  /** Absolute path that was inspected / mutated. */
166
166
  path: string;
@@ -168,7 +168,7 @@ export interface SyncHomeNpmrcResult {
168
168
  source?: NpmRegistryFetchResult["source"];
169
169
  }
170
170
 
171
- export interface SyncHomeNpmrcDeps {
171
+ interface SyncHomeNpmrcDeps {
172
172
  /**
173
173
  * Pre-constructed client with the LD-flag check, JWT provider, and
174
174
  * `refreshJwt` hook bound. We deliberately do not instantiate one
@@ -23,7 +23,7 @@ const DEPENDENCY_BUCKETS = [
23
23
 
24
24
  const WORKSPACE_PROTOCOL = "workspace:";
25
25
 
26
- export interface NormalizeResult {
26
+ interface NormalizeResult {
27
27
  changed: boolean;
28
28
  warnings: string[];
29
29
  packageJson: PackageJson;
@@ -10,7 +10,7 @@ export const MANAGED_PACKAGE_DEPENDENCIES = [
10
10
  SUPERBLOCKS_SDK_API_PACKAGE,
11
11
  ] as const;
12
12
 
13
- export const MANAGED_OVERRIDE_PACKAGES = ["zod"] as const;
13
+ const MANAGED_OVERRIDE_PACKAGES = ["zod"] as const;
14
14
 
15
15
  export const PACKAGE_DEPENDENCY_FIELDS = [
16
16
  "dependencies",
@@ -66,7 +66,7 @@ const CLI_PACKAGE_NAMES = new Set<string>([
66
66
  * Injectable subset of `child_process.exec` so tests can stub the
67
67
  * `which`/`where` lookup without spawning a real subprocess.
68
68
  */
69
- export type WhichRunner = (binary: string) => Promise<string>;
69
+ type WhichRunner = (binary: string) => Promise<string>;
70
70
 
71
71
  const defaultWhichRunner: WhichRunner = async (binary) => {
72
72
  const cmd = process.platform === "win32" ? "where" : "which";
@@ -186,7 +186,7 @@ export async function findGlobalCliInstallDir(
186
186
  return undefined;
187
187
  }
188
188
 
189
- export interface StripUpgradedCliLockfilesOptions {
189
+ interface StripUpgradedCliLockfilesOptions {
190
190
  /**
191
191
  * Pre-resolved install root. If omitted, `findGlobalCliInstallDir` is used.
192
192
  * Tests pass this directly to avoid stubbing `which`.
@@ -23,7 +23,7 @@ const logger = getLogger();
23
23
  /**
24
24
  * Package version information returned by version detection.
25
25
  */
26
- export interface PackageVersionInfo {
26
+ interface PackageVersionInfo {
27
27
  /** Semantic version string (e.g., "2.0.0-next.1") */
28
28
  version: string;
29
29
  /** Optional package alias for ephemeral builds (e.g., "@superblocksteam/cli-ephemeral") */
package/src/client.ts CHANGED
@@ -998,7 +998,7 @@ export async function fetchOrganizationSummary(
998
998
  }
999
999
  }
1000
1000
 
1001
- export interface CreateApplicationParams {
1001
+ interface CreateApplicationParams {
1002
1002
  cliVersion: string;
1003
1003
  token: string;
1004
1004
  superblocksBaseUrl: string;
@@ -2046,7 +2046,7 @@ export async function fetchAuditLogs({
2046
2046
  }
2047
2047
  }
2048
2048
 
2049
- export interface AuditEventFilters {
2049
+ interface AuditEventFilters {
2050
2050
  timeStart: string;
2051
2051
  timeEnd: string;
2052
2052
  activityId?: number;
@@ -2062,12 +2062,12 @@ export interface AuditEventFilters {
2062
2062
  status?: number;
2063
2063
  }
2064
2064
 
2065
- export interface AuditEventsResponse {
2065
+ interface AuditEventsResponse {
2066
2066
  events: OCSFAuditEvent[];
2067
2067
  next_cursor: string | null;
2068
2068
  }
2069
2069
 
2070
- export interface ChatHistoryMessage {
2070
+ interface ChatHistoryMessage {
2071
2071
  id: string;
2072
2072
  created: string;
2073
2073
  chatPayload: AiChatMessagePayload;
@@ -2798,13 +2798,13 @@ export interface UsageRecordRow {
2798
2798
  source: string;
2799
2799
  }
2800
2800
 
2801
- export interface AgentUsageRow {
2801
+ interface AgentUsageRow {
2802
2802
  agentId: string;
2803
2803
  name: string;
2804
2804
  creditsUsed: number;
2805
2805
  }
2806
2806
 
2807
- export interface ApplicationUsageRow {
2807
+ interface ApplicationUsageRow {
2808
2808
  applicationId: string;
2809
2809
  applicationName: string;
2810
2810
  creditsUsed: number;
@@ -6,15 +6,15 @@ import {
6
6
  } from "./extract-api-integrations.mjs";
7
7
  import { parseSdkRegistryWithExportNames } from "./parse-sdk-registry.mjs";
8
8
 
9
- export type SdkApiEntry = {
9
+ type SdkApiEntry = {
10
10
  entryPoint: string;
11
11
  exportName?: string;
12
12
  integrations?: IntegrationInfo[];
13
13
  };
14
14
 
15
- export type SdkApisResult = Record<string, SdkApiEntry>;
15
+ type SdkApisResult = Record<string, SdkApiEntry>;
16
16
 
17
- export type CollectSdkApisFs = {
17
+ type CollectSdkApisFs = {
18
18
  pathExists: (p: string) => Promise<boolean>;
19
19
  readFile: (p: string, encoding: "utf-8") => Promise<string>;
20
20
  };
@@ -14,7 +14,7 @@
14
14
  // as `double free or corruption (fasttop)` from glibc and SIGABRT killing the
15
15
  // process before it can exit cleanly.
16
16
 
17
- export interface DedupeAsyncOptions<TArgs extends unknown[]> {
17
+ interface DedupeAsyncOptions<TArgs extends unknown[]> {
18
18
  /**
19
19
  * Optional callback invoked when a duplicate call is detected. The first
20
20
  * caller's invocation runs normally; this fires for the 2nd, 3rd, …
@@ -3,8 +3,9 @@
3
3
  *
4
4
  * Records counters and histograms for the dev-server endpoints that the editor
5
5
  * and SABS hit during a live-edit connection: `/_sb_health`, `/_sb_connect`,
6
- * `/_sb_activate`, `/_sb_disconnect`, `/_sb_status`, `/_sb_activity`, plus
7
- * WebSocket upgrades, Vite eager-init, and warm-standby activation.
6
+ * `/_sb_activate`, `/_sb_disconnect`, `/_sb_status`, `/_sb_activity`,
7
+ * `/_sb_update_token`, plus WebSocket upgrades, Vite eager-init, and
8
+ * warm-standby activation.
8
9
  *
9
10
  * Metrics are scoped to the dev-server's existing OTel pipeline. When telemetry
10
11
  * has not yet initialized (warm-standby pre-activation), record calls are
@@ -138,6 +139,7 @@ export type DevServerEndpoint =
138
139
  | "_sb_disconnect"
139
140
  | "_sb_status"
140
141
  | "_sb_activity"
142
+ | "_sb_update_token"
141
143
  | "_sb_persist"
142
144
  | "_sb_ready";
143
145