@dbx-tools/appkit-mastra 0.9.179 → 0.9.181
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/index.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/lib/src/mlflow.d.ts +1 -1
- package/lib/src/mlflow.js +18 -9
- package/lib/src/plugin.js +5 -5
- package/package.json +18 -18
- package/src/mlflow.ts +17 -8
- package/src/plugin.ts +9 -3
package/package.json
CHANGED
|
@@ -36,23 +36,23 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@databricks/appkit": "0.81.0",
|
|
39
|
-
"@dbx-tools/appkit": "^0.9.
|
|
40
|
-
"@dbx-tools/appkit-model-gateway": "^0.9.
|
|
41
|
-
"@dbx-tools/cache": "^0.9.
|
|
42
|
-
"@dbx-tools/core": "^0.9.
|
|
43
|
-
"@dbx-tools/databricks": "^0.9.
|
|
44
|
-
"@dbx-tools/fs": "^0.9.
|
|
45
|
-
"@dbx-tools/genie": "^0.9.
|
|
46
|
-
"@dbx-tools/model": "^0.9.
|
|
47
|
-
"@dbx-tools/model-protocol": "^0.9.
|
|
48
|
-
"@dbx-tools/path": "^0.9.
|
|
49
|
-
"@dbx-tools/postgres": "^0.9.
|
|
50
|
-
"@dbx-tools/shared-core": "^0.9.
|
|
51
|
-
"@dbx-tools/shared-fs": "^0.9.
|
|
52
|
-
"@dbx-tools/shared-genie": "^0.9.
|
|
53
|
-
"@dbx-tools/shared-mastra": "^0.9.
|
|
54
|
-
"@dbx-tools/shared-model": "^0.9.
|
|
55
|
-
"@dbx-tools/shared-model-gateway": "^0.9.
|
|
39
|
+
"@dbx-tools/appkit": "^0.9.181",
|
|
40
|
+
"@dbx-tools/appkit-model-gateway": "^0.9.181",
|
|
41
|
+
"@dbx-tools/cache": "^0.9.181",
|
|
42
|
+
"@dbx-tools/core": "^0.9.181",
|
|
43
|
+
"@dbx-tools/databricks": "^0.9.181",
|
|
44
|
+
"@dbx-tools/fs": "^0.9.181",
|
|
45
|
+
"@dbx-tools/genie": "^0.9.181",
|
|
46
|
+
"@dbx-tools/model": "^0.9.181",
|
|
47
|
+
"@dbx-tools/model-protocol": "^0.9.181",
|
|
48
|
+
"@dbx-tools/path": "^0.9.181",
|
|
49
|
+
"@dbx-tools/postgres": "^0.9.181",
|
|
50
|
+
"@dbx-tools/shared-core": "^0.9.181",
|
|
51
|
+
"@dbx-tools/shared-fs": "^0.9.181",
|
|
52
|
+
"@dbx-tools/shared-genie": "^0.9.181",
|
|
53
|
+
"@dbx-tools/shared-mastra": "^0.9.181",
|
|
54
|
+
"@dbx-tools/shared-model": "^0.9.181",
|
|
55
|
+
"@dbx-tools/shared-model-gateway": "^0.9.181",
|
|
56
56
|
"@mastra/ai-sdk": "1.10.5",
|
|
57
57
|
"@mastra/core": "1.71.0",
|
|
58
58
|
"@mastra/express": "1.5.15",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"./package.json": "./package.json"
|
|
91
91
|
}
|
|
92
92
|
},
|
|
93
|
-
"version": "0.9.
|
|
93
|
+
"version": "0.9.181",
|
|
94
94
|
"types": "./lib/index.d.ts",
|
|
95
95
|
"dbxToolsConfig": {
|
|
96
96
|
"tags": [
|
package/src/mlflow.ts
CHANGED
|
@@ -631,9 +631,10 @@ export function mlflowEnabled(): boolean {
|
|
|
631
631
|
*/
|
|
632
632
|
export async function mlflowExperimentManagerUrl(
|
|
633
633
|
client: WorkspaceClient,
|
|
634
|
+
viewerUserName?: string,
|
|
634
635
|
): Promise<string | undefined> {
|
|
635
636
|
try {
|
|
636
|
-
return await resolveMlflowExperimentManagerUrl(client);
|
|
637
|
+
return await resolveMlflowExperimentManagerUrl(client, viewerUserName);
|
|
637
638
|
} catch {
|
|
638
639
|
return undefined;
|
|
639
640
|
}
|
|
@@ -641,6 +642,7 @@ export async function mlflowExperimentManagerUrl(
|
|
|
641
642
|
|
|
642
643
|
async function resolveMlflowExperimentManagerUrl(
|
|
643
644
|
client: WorkspaceClient,
|
|
645
|
+
viewerUserName?: string,
|
|
644
646
|
): Promise<string | undefined> {
|
|
645
647
|
const experimentId = await resolveExperimentId(client);
|
|
646
648
|
if (!experimentId) return undefined;
|
|
@@ -653,21 +655,28 @@ async function resolveMlflowExperimentManagerUrl(
|
|
|
653
655
|
{ method: "GET" },
|
|
654
656
|
),
|
|
655
657
|
]);
|
|
656
|
-
if (!
|
|
658
|
+
if (!permissionsResponse.ok) return undefined;
|
|
657
659
|
|
|
658
|
-
const current =
|
|
660
|
+
const current = currentResponse.ok
|
|
661
|
+
? CurrentUserResponseSchema.safeParse(await readResponseJson(currentResponse))
|
|
662
|
+
: undefined;
|
|
659
663
|
const permissions = ExperimentPermissionsResponseSchema.safeParse(
|
|
660
664
|
await readResponseJson(permissionsResponse),
|
|
661
665
|
);
|
|
662
|
-
if (!
|
|
666
|
+
if (!permissions.success || (!viewerUserName && !current?.success)) return undefined;
|
|
663
667
|
|
|
664
668
|
const userNames = new Set(
|
|
665
|
-
[
|
|
666
|
-
|
|
667
|
-
|
|
669
|
+
[
|
|
670
|
+
viewerUserName,
|
|
671
|
+
...(current?.success
|
|
672
|
+
? [current.data.userName, current.data.applicationId, current.data.displayName]
|
|
673
|
+
: []),
|
|
674
|
+
]
|
|
675
|
+
.map((value) => value?.trim())
|
|
676
|
+
.filter((value): value is string => Boolean(value)),
|
|
668
677
|
);
|
|
669
678
|
const groupNames = new Set(
|
|
670
|
-
(current.data.groups ?? []).flatMap(({ value, display }) =>
|
|
679
|
+
(current?.success ? (current.data.groups ?? []) : []).flatMap(({ value, display }) =>
|
|
671
680
|
[value, display].filter((entry): entry is string => Boolean(entry)),
|
|
672
681
|
),
|
|
673
682
|
);
|
package/src/plugin.ts
CHANGED
|
@@ -64,6 +64,7 @@ import {
|
|
|
64
64
|
configureNativeHttpTelemetry,
|
|
65
65
|
excludeUnparentedOutgoingHttpTelemetry,
|
|
66
66
|
deferredNativeTracerProvider,
|
|
67
|
+
requestUserEmail,
|
|
67
68
|
requestUserId,
|
|
68
69
|
useServicePrincipal,
|
|
69
70
|
} from "@dbx-tools/appkit";
|
|
@@ -1049,7 +1050,7 @@ export class MastraPlugin extends Plugin<MastraPluginConfig> {
|
|
|
1049
1050
|
res.json({ url: null });
|
|
1050
1051
|
return;
|
|
1051
1052
|
}
|
|
1052
|
-
const result = await this.scopedSelf(req).fetchMlflowExperimentUrl();
|
|
1053
|
+
const result = await this.scopedSelf(req).fetchMlflowExperimentUrl(requestUserEmail(req));
|
|
1053
1054
|
res.json({ url: result.ok ? (result.data ?? null) : null });
|
|
1054
1055
|
},
|
|
1055
1056
|
});
|
|
@@ -1232,9 +1233,14 @@ export class MastraPlugin extends Plugin<MastraPluginConfig> {
|
|
|
1232
1233
|
* Resolve an experiment link under the active request identity. The helper
|
|
1233
1234
|
* returns no URL unless the viewer has effective `CAN_MANAGE` permission.
|
|
1234
1235
|
*/
|
|
1235
|
-
private async fetchMlflowExperimentUrl(
|
|
1236
|
+
private async fetchMlflowExperimentUrl(
|
|
1237
|
+
viewerUserName?: string,
|
|
1238
|
+
): Promise<ExecutionResult<string | undefined>> {
|
|
1236
1239
|
const client = getExecutionContext().client;
|
|
1237
|
-
return this.execute(
|
|
1240
|
+
return this.execute(
|
|
1241
|
+
() => mlflowExperimentManagerUrl(client, viewerUserName),
|
|
1242
|
+
feedbackWriteDefaults,
|
|
1243
|
+
);
|
|
1238
1244
|
}
|
|
1239
1245
|
|
|
1240
1246
|
/**
|