@superblocksteam/sdk 2.0.64 → 2.0.65-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.
- package/.prettierrc +1 -1
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-publish-package.log +0 -0
- package/dist/cli-replacement/automatic-upgrades.d.ts.map +1 -1
- package/dist/cli-replacement/automatic-upgrades.js +4 -2
- package/dist/cli-replacement/automatic-upgrades.js.map +1 -1
- package/dist/cli-replacement/dev.d.mts.map +1 -1
- package/dist/cli-replacement/dev.mjs +1 -0
- package/dist/cli-replacement/dev.mjs.map +1 -1
- package/dist/dbfs/local.d.ts.map +1 -1
- package/dist/dbfs/local.js +1 -1
- package/dist/dbfs/local.js.map +1 -1
- package/dist/dev-utils/dev-server.d.mts.map +1 -1
- package/dist/dev-utils/dev-server.mjs +29 -11
- package/dist/dev-utils/dev-server.mjs.map +1 -1
- package/dist/flag.d.ts +1 -0
- package/dist/flag.d.ts.map +1 -1
- package/dist/flag.js +3 -0
- package/dist/flag.js.map +1 -1
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +12 -4
- package/dist/telemetry/index.js.map +1 -1
- package/dist/types/common.d.ts +3 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js.map +1 -1
- package/eslint.config.js +3 -2
- package/package.json +17 -18
- package/src/cli-replacement/automatic-upgrades.ts +4 -2
- package/src/cli-replacement/dev.mts +1 -0
- package/src/dbfs/local.ts +3 -1
- package/src/dev-utils/dev-server.mts +37 -13
- package/src/flag.ts +4 -0
- package/src/telemetry/index.ts +26 -4
- package/src/types/common.ts +3 -0
- package/test/clients.test.mts +2 -0
- package/test/version-control.test.mts +4 -4
- package/tsconfig.json +2 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/turbo.json +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superblocksteam/sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.65-next.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Superblocks JS SDK",
|
|
6
6
|
"homepage": "https://www.superblocks.com",
|
|
@@ -33,11 +33,6 @@
|
|
|
33
33
|
"@opentelemetry/sdk-node": "^0.55.0",
|
|
34
34
|
"@opentelemetry/semantic-conventions": "^1.28.0",
|
|
35
35
|
"@superblocksteam/bucketeer-sdk": "0.5.0",
|
|
36
|
-
"@superblocksteam/library": "2.0.64",
|
|
37
|
-
"@superblocksteam/library-shared": "2.0.64",
|
|
38
|
-
"@superblocksteam/shared": "v0.9548.4",
|
|
39
|
-
"@superblocksteam/util": "2.0.64",
|
|
40
|
-
"@superblocksteam/vite-plugin-file-sync": "2.0.64",
|
|
41
36
|
"@vitejs/plugin-react": "4.3.4",
|
|
42
37
|
"axios": "^1.4.0",
|
|
43
38
|
"chokidar": "^4.0.3",
|
|
@@ -54,7 +49,7 @@
|
|
|
54
49
|
"jwt-decode": "^4.0.0",
|
|
55
50
|
"lodash-es": "^4.17.21",
|
|
56
51
|
"package-manager-detector": "^1.3.0",
|
|
57
|
-
"prettier": "^3.
|
|
52
|
+
"prettier": "^3.6.2",
|
|
58
53
|
"read-pkg": "^9.0.1",
|
|
59
54
|
"semver": "^7.5.4",
|
|
60
55
|
"simple-git": "^3.20.0",
|
|
@@ -63,7 +58,12 @@
|
|
|
63
58
|
"vite-tsconfig-paths": "^5.1.4",
|
|
64
59
|
"winston": "^3.17.0",
|
|
65
60
|
"ws": "^8.17.0",
|
|
66
|
-
"yaml": "^2.7.1"
|
|
61
|
+
"yaml": "^2.7.1",
|
|
62
|
+
"@superblocksteam/library": "2.0.65-next.1",
|
|
63
|
+
"@superblocksteam/library-shared": "2.0.65-next.1",
|
|
64
|
+
"@superblocksteam/shared": "v0.9550.0",
|
|
65
|
+
"@superblocksteam/util": "2.0.65-next.1",
|
|
66
|
+
"@superblocksteam/vite-plugin-file-sync": "2.0.65-next.1"
|
|
67
67
|
},
|
|
68
68
|
"optionalDependencies": {
|
|
69
69
|
"@rollup/rollup-darwin-arm64": "^4.34.9",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@babel/types": "7.28.2",
|
|
78
|
-
"@eslint/js": "^9.
|
|
78
|
+
"@eslint/js": "^9.39.1",
|
|
79
79
|
"@types/babel__core": "^7.20.5",
|
|
80
80
|
"@types/babel__traverse": "^7.20.6",
|
|
81
81
|
"@types/chai": "^4",
|
|
@@ -90,23 +90,21 @@
|
|
|
90
90
|
"@types/node": "^20",
|
|
91
91
|
"@types/semver": "^7.5.8",
|
|
92
92
|
"@types/ws": "^8.5.13",
|
|
93
|
-
"@typescript-eslint/eslint-plugin": "^5.60.1",
|
|
94
|
-
"@typescript-eslint/parser": "^5.60.1",
|
|
95
93
|
"chai": "^4",
|
|
96
94
|
"chai-as-promised": "^8.0.1",
|
|
97
|
-
"eslint": "^9.
|
|
95
|
+
"eslint": "^9.39.1",
|
|
98
96
|
"eslint-config-prettier": "^10.1.8",
|
|
99
|
-
"eslint-config-turbo": "^2.
|
|
97
|
+
"eslint-config-turbo": "^2.6.1",
|
|
100
98
|
"eslint-plugin-import": "^2.32.0",
|
|
101
|
-
"eslint-plugin-mocha": "^
|
|
99
|
+
"eslint-plugin-mocha": "^11.2.0",
|
|
102
100
|
"eslint-plugin-prettier": "^5.5.4",
|
|
103
|
-
"eslint-plugin-unicorn": "^
|
|
104
|
-
"globals": "^
|
|
101
|
+
"eslint-plugin-unicorn": "^62.0.0",
|
|
102
|
+
"globals": "^16.5.0",
|
|
105
103
|
"mocha": "^11.1.0",
|
|
106
104
|
"tslib": "^2.8.0",
|
|
107
105
|
"tsx": "^4.19.2",
|
|
108
|
-
"typescript": "^5.
|
|
109
|
-
"typescript-eslint": "^8.
|
|
106
|
+
"typescript": "^5.9.3",
|
|
107
|
+
"typescript-eslint": "^8.47.0"
|
|
110
108
|
},
|
|
111
109
|
"publishConfig": {
|
|
112
110
|
"registry": "https://registry.npmjs.org"
|
|
@@ -118,6 +116,7 @@
|
|
|
118
116
|
"dev": "tsc --build --watch --preserveWatchOutput",
|
|
119
117
|
"lint": "eslint --concurrency=auto",
|
|
120
118
|
"lint:fix": "eslint --fix --concurrency=auto",
|
|
119
|
+
"publish-package": "pnpm publish",
|
|
121
120
|
"test": "mocha \"test/**/*.test.mts\"",
|
|
122
121
|
"typecheck": "tsc --noEmit"
|
|
123
122
|
}
|
|
@@ -87,7 +87,7 @@ export async function getCurrentCliVersion(): Promise<
|
|
|
87
87
|
`${superblocksPath} version --json`,
|
|
88
88
|
);
|
|
89
89
|
const json = JSON.parse(versionOutput) as Record<string, string>;
|
|
90
|
-
// Extract version from string like "@superblocksteam/cli/2.0.0-next.1" or "@superblocksteam/cli-ephemeral/2.0.0-SNAPSHOT.
|
|
90
|
+
// Extract version from string like "@superblocksteam/cli/2.0.0-next.1" or "@superblocksteam/cli-ephemeral/2.0.0-SNAPSHOT.ebd2b86d643331f5"
|
|
91
91
|
const version = json.cliVersion?.replace(
|
|
92
92
|
/@superblocksteam\/cli(-ephemeral)?\//,
|
|
93
93
|
"",
|
|
@@ -269,7 +269,9 @@ export async function checkVersionsAndWritePackageJson(
|
|
|
269
269
|
currentCliInfo.version.startsWith("link:")
|
|
270
270
|
) &&
|
|
271
271
|
targetVersions.cli &&
|
|
272
|
-
|
|
272
|
+
(currentCliInfo.version.toLowerCase().includes("snapshot")
|
|
273
|
+
? targetVersions.cli !== currentCliInfo.version
|
|
274
|
+
: gt(targetVersions.cli, currentCliInfo.version)),
|
|
273
275
|
);
|
|
274
276
|
} catch (error) {
|
|
275
277
|
logger.error(
|
|
@@ -467,6 +467,7 @@ export async function dev(options: {
|
|
|
467
467
|
userId: currentUser.user.id,
|
|
468
468
|
userEmail: currentUser.user.email,
|
|
469
469
|
organizationId: currentUser.user.currentOrganizationId,
|
|
470
|
+
featureFlags: sdk.getFeatureFlagsForUser(currentUser),
|
|
470
471
|
};
|
|
471
472
|
|
|
472
473
|
const result = await checkVersionsAndWritePackageJson(
|
package/src/dbfs/local.ts
CHANGED
|
@@ -84,7 +84,9 @@ export async function hashLocalDirectory(localDirectoryPath: string): Promise<{
|
|
|
84
84
|
let entry: any;
|
|
85
85
|
switch (localDirEntry.type) {
|
|
86
86
|
case "-": {
|
|
87
|
-
const hash = await hashFileContents(
|
|
87
|
+
const hash = await hashFileContents(
|
|
88
|
+
new Uint8Array(localDirEntry.contents),
|
|
89
|
+
);
|
|
88
90
|
entry = {
|
|
89
91
|
type: "-",
|
|
90
92
|
executable: localDirEntry.executable,
|
|
@@ -43,22 +43,46 @@ const tracer = getTracer();
|
|
|
43
43
|
export const RESTART_EXIT_CODE = 98;
|
|
44
44
|
|
|
45
45
|
function getJwksUriWithBaseUrl(superblocksBaseUrl?: string): string {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
superblocksBaseUrl || process.env.SUPERBLOCKS_BASE_URL || "",
|
|
46
|
+
if (process.env.SUPERBLOCKS_JWKS_URI) {
|
|
47
|
+
console.debug(
|
|
48
|
+
`[JWKS] Using override SUPERBLOCKS_JWKS_URI=${process.env.SUPERBLOCKS_JWKS_URI}`,
|
|
50
49
|
);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
return process.env.SUPERBLOCKS_JWKS_URI;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const baseUrl = superblocksBaseUrl || process.env.SUPERBLOCKS_BASE_URL || "";
|
|
54
|
+
|
|
55
|
+
const PROD_CLOUD_HOSTS = [
|
|
56
|
+
"app.superblocks.com",
|
|
57
|
+
"app.superblockshq.com",
|
|
58
|
+
"eu.superblocks.com",
|
|
59
|
+
];
|
|
60
|
+
const STAGING_CLOUD_HOSTS = ["app.staging.superblocks.com"];
|
|
61
|
+
|
|
62
|
+
let jwksUri: string;
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
const url = new URL(baseUrl);
|
|
66
|
+
const hostname = url.hostname;
|
|
67
|
+
|
|
68
|
+
if (PROD_CLOUD_HOSTS.includes(hostname)) {
|
|
69
|
+
jwksUri = "https://prod-cdn.superblocks.com/.well-known/jwks.json";
|
|
70
|
+
} else if (
|
|
71
|
+
STAGING_CLOUD_HOSTS.includes(hostname) ||
|
|
72
|
+
hostname === "localhost" ||
|
|
73
|
+
hostname === "127.0.0.1"
|
|
74
|
+
) {
|
|
75
|
+
jwksUri = "https://staging-cdn.superblocks.com/.well-known/jwks.json";
|
|
76
|
+
} else {
|
|
77
|
+
// For cloud-prem if env var is not set use the base URL
|
|
78
|
+
jwksUri = `${url.origin}/.well-known/jwks.json`;
|
|
79
|
+
}
|
|
56
80
|
} catch {
|
|
57
|
-
|
|
81
|
+
jwksUri = "https://staging-cdn.superblocks.com/.well-known/jwks.json";
|
|
58
82
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
83
|
+
|
|
84
|
+
console.debug(`[JWKS] Derived jwksUri=${jwksUri} from baseUrl=${baseUrl}`);
|
|
85
|
+
return jwksUri;
|
|
62
86
|
}
|
|
63
87
|
|
|
64
88
|
interface CreateDevServerOptions {
|
package/src/flag.ts
CHANGED
|
@@ -38,4 +38,8 @@ export class FeatureFlags {
|
|
|
38
38
|
devServerLocalInactivityTimeoutMinutes(): number {
|
|
39
39
|
return this.flags["superblocks.dev-server.inactivity-timeout.local"] ?? 1;
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
devServerLlmobsEnabled(): boolean {
|
|
43
|
+
return this.flags["superblocks.dev-server.llmobs.enabled"] ?? false;
|
|
44
|
+
}
|
|
41
45
|
}
|
package/src/telemetry/index.ts
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
ATTR_SUPERBLOCKS_USER_ID,
|
|
29
29
|
getEnvironmentFromHostname,
|
|
30
30
|
} from "./attributes.js";
|
|
31
|
+
import { getLogger as getStandardLogger } from "./logging.js";
|
|
31
32
|
import { getConfiguration, SERVICE_NAME } from "./util.js";
|
|
32
33
|
import type { ApplicationConfigWithTokenConfigAndUserInfo } from "../types/index.js";
|
|
33
34
|
import type { Tracer } from "@opentelemetry/api";
|
|
@@ -48,6 +49,7 @@ async function shutdownTelemetry(): Promise<void> {
|
|
|
48
49
|
export async function configureTelemetry(
|
|
49
50
|
applicationConfig?: ApplicationConfigWithTokenConfigAndUserInfo,
|
|
50
51
|
) {
|
|
52
|
+
const logger = getStandardLogger();
|
|
51
53
|
if (configured) {
|
|
52
54
|
await shutdownTelemetry();
|
|
53
55
|
}
|
|
@@ -61,6 +63,18 @@ export async function configureTelemetry(
|
|
|
61
63
|
configured = false;
|
|
62
64
|
return;
|
|
63
65
|
}
|
|
66
|
+
|
|
67
|
+
logger.info(
|
|
68
|
+
`[INIT] Initializing telemetry for service ${config.serviceName} at Superblocks instance ${config.superblocksHostname}`,
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const llmobsEnabled =
|
|
72
|
+
applicationConfig?.featureFlags.devServerLlmobsEnabled() ?? false;
|
|
73
|
+
|
|
74
|
+
logger.debug(
|
|
75
|
+
`[INIT] superblocks.dev-server.llmobs.enabled=${llmobsEnabled} for service ${config.serviceName}`,
|
|
76
|
+
);
|
|
77
|
+
|
|
64
78
|
// First, configure dd-trace for LLM tracing
|
|
65
79
|
process.env.DD_SITE = "datadoghq.com";
|
|
66
80
|
// stop ddTrace from trying to get remote configuration
|
|
@@ -83,12 +97,20 @@ export async function configureTelemetry(
|
|
|
83
97
|
[OBS_TAG_APPLICATION_ID]: applicationConfig?.id,
|
|
84
98
|
[OBS_TAG_BRANCH]: applicationConfig?.branchName,
|
|
85
99
|
},
|
|
86
|
-
llmobs:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
llmobs: llmobsEnabled
|
|
101
|
+
? {
|
|
102
|
+
mlApp: SERVICE_NAME_LLM,
|
|
103
|
+
agentlessEnabled: true,
|
|
104
|
+
}
|
|
105
|
+
: undefined,
|
|
90
106
|
});
|
|
91
107
|
|
|
108
|
+
logger.info(
|
|
109
|
+
`[INIT] Datadog LLM tracing is ${
|
|
110
|
+
ddTrace.llmobs.enabled ? "enabled" : "disabled"
|
|
111
|
+
} for service ${config.serviceName}`,
|
|
112
|
+
);
|
|
113
|
+
|
|
92
114
|
// Next, configure the OpenTelemetry traces, metrics, and logs
|
|
93
115
|
sdkInstance = new NodeSDK({
|
|
94
116
|
resource: Resource.default().merge(
|
package/src/types/common.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FeatureFlags } from "../flag.js";
|
|
1
2
|
import type { Api } from "@superblocksteam/util";
|
|
2
3
|
|
|
3
4
|
export interface UserMeDto {
|
|
@@ -15,6 +16,7 @@ export interface FlagBootstrap {
|
|
|
15
16
|
"ui.code-mode.enable-session-recording"?: boolean;
|
|
16
17
|
"superblocks.dev-server.inactivity-timeout.cloud"?: number;
|
|
17
18
|
"superblocks.dev-server.inactivity-timeout.local"?: number;
|
|
19
|
+
"superblocks.dev-server.llmobs.enabled"?: boolean;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export interface TokenConfig {
|
|
@@ -26,6 +28,7 @@ export interface UserInfo {
|
|
|
26
28
|
userId: string;
|
|
27
29
|
userEmail: string;
|
|
28
30
|
organizationId: string;
|
|
31
|
+
featureFlags: FeatureFlags;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
export interface ApplicationConfig {
|
package/test/clients.test.mts
CHANGED
|
@@ -19,6 +19,7 @@ const currentGitBranch = await getCurrentGitBranch();
|
|
|
19
19
|
describe("get current branch info", () => {
|
|
20
20
|
let createdSuperblocksFolder = false;
|
|
21
21
|
|
|
22
|
+
// eslint-disable-next-line mocha/no-top-level-hooks
|
|
22
23
|
before(async function () {
|
|
23
24
|
// Make the .superblocks folder in the test directory, if it is missing. It should be git-ignored.
|
|
24
25
|
if (!fs.existsSync(superblocksTestFolder)) {
|
|
@@ -39,6 +40,7 @@ describe("get current branch info", () => {
|
|
|
39
40
|
);
|
|
40
41
|
});
|
|
41
42
|
|
|
43
|
+
// eslint-disable-next-line mocha/no-top-level-hooks
|
|
42
44
|
after(async function () {
|
|
43
45
|
// Delete the .superblocks folder in the test directory.
|
|
44
46
|
if (createdSuperblocksFolder && fs.existsSync(superblocksTestFolder)) {
|
|
@@ -45,17 +45,17 @@ const NO_EXTRACT_SOURCE_CODE: ApiRepresentation = {
|
|
|
45
45
|
|
|
46
46
|
describe("version-control", function () {
|
|
47
47
|
const testDir = USE_TEMP_TEST_DIR
|
|
48
|
-
?
|
|
49
|
-
|
|
50
|
-
: // eslint-disable-next-line mocha/no-setup-in-describe
|
|
51
|
-
new URL("../../test-output", import.meta.url).pathname;
|
|
48
|
+
? fs.mkdtempSync(path.join(os.tmpdir(), "test-output"))
|
|
49
|
+
: new URL("../../test-output", import.meta.url).pathname;
|
|
52
50
|
|
|
51
|
+
// eslint-disable-next-line mocha/no-top-level-hooks
|
|
53
52
|
beforeEach(async function () {
|
|
54
53
|
// Clean up the temporary directory before each test, then create it
|
|
55
54
|
await fs.rm(testDir, { recursive: true, force: true });
|
|
56
55
|
await fs.ensureDir(testDir);
|
|
57
56
|
});
|
|
58
57
|
|
|
58
|
+
// eslint-disable-next-line mocha/no-top-level-hooks
|
|
59
59
|
afterEach(async function () {
|
|
60
60
|
// Clean up the temporary directory after each test
|
|
61
61
|
await fs.rm(testDir, { recursive: true, force: true });
|
package/tsconfig.json
CHANGED