From 31a2ac62b2f6b3384d2ff49fa3331d8218ee0acb Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 16 Mar 2025 17:05:03 -0700 Subject: [PATCH] use org scope to resolve org secrets --- core/package-lock.json | 8 ++++---- core/package.json | 2 +- gui/package-lock.json | 10 +++++----- gui/package.json | 2 +- packages/config-yaml/package.json | 2 +- packages/config-yaml/src/interfaces/index.ts | 19 ++++++++++++++----- packages/config-yaml/test/index.test.ts | 2 +- 7 files changed, 27 insertions(+), 18 deletions(-) diff --git a/core/package-lock.json b/core/package-lock.json index 2a0689ae5..529b3ac2b 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -13,7 +13,7 @@ "@aws-sdk/client-sagemaker-runtime": "^3.758.0", "@aws-sdk/credential-providers": "^3.758.0", "@continuedev/config-types": "^1.0.13", - "@continuedev/config-yaml": "^1.0.61", + "@continuedev/config-yaml": "^1.0.63", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", @@ -2972,9 +2972,9 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.0.61", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.61.tgz", - "integrity": "sha512-RJvZxPG9eicy1J0dXAKNH3UsGJdHVZgm8808QStQWW5p/eZEt3ZHeE8KHJ/IE6UylMyBlMYMNBYjC7VdLC4+qA==", + "version": "1.0.63", + "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.63.tgz", + "integrity": "sha512-KBfyOUU/mWOXeNf6v+4IfMkbvfEEe/YP6n/g/reJBhrpApchG2A/P11JviH87N2To1SrhZxnW//0g5FIGupDFw==", "dependencies": { "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", diff --git a/core/package.json b/core/package.json index d62c22e91..69e58b39b 100644 --- a/core/package.json +++ b/core/package.json @@ -46,7 +46,7 @@ "@aws-sdk/client-sagemaker-runtime": "^3.758.0", "@aws-sdk/credential-providers": "^3.758.0", "@continuedev/config-types": "^1.0.13", - "@continuedev/config-yaml": "^1.0.61", + "@continuedev/config-yaml": "^1.0.63", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", diff --git a/gui/package-lock.json b/gui/package-lock.json index fab9d1bdc..308663a02 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -7,7 +7,7 @@ "name": "gui", "license": "Apache-2.0", "dependencies": { - "@continuedev/config-yaml": "^1.0.61", + "@continuedev/config-yaml": "^1.0.63", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", @@ -107,7 +107,7 @@ "@aws-sdk/client-sagemaker-runtime": "^3.758.0", "@aws-sdk/credential-providers": "^3.758.0", "@continuedev/config-types": "^1.0.13", - "@continuedev/config-yaml": "^1.0.61", + "@continuedev/config-yaml": "^1.0.63", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", @@ -549,9 +549,9 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.0.61", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.61.tgz", - "integrity": "sha512-RJvZxPG9eicy1J0dXAKNH3UsGJdHVZgm8808QStQWW5p/eZEt3ZHeE8KHJ/IE6UylMyBlMYMNBYjC7VdLC4+qA==", + "version": "1.0.63", + "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.63.tgz", + "integrity": "sha512-KBfyOUU/mWOXeNf6v+4IfMkbvfEEe/YP6n/g/reJBhrpApchG2A/P11JviH87N2To1SrhZxnW//0g5FIGupDFw==", "dependencies": { "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", diff --git a/gui/package.json b/gui/package.json index 4ddba1da8..b7d9b3535 100644 --- a/gui/package.json +++ b/gui/package.json @@ -15,7 +15,7 @@ "test:watch": "vitest" }, "dependencies": { - "@continuedev/config-yaml": "^1.0.61", + "@continuedev/config-yaml": "^1.0.63", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", diff --git a/packages/config-yaml/package.json b/packages/config-yaml/package.json index 3205b9a6e..b395588ea 100644 --- a/packages/config-yaml/package.json +++ b/packages/config-yaml/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-yaml", - "version": "1.0.61", + "version": "1.0.63", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/config-yaml/src/interfaces/index.ts b/packages/config-yaml/src/interfaces/index.ts index 20d33db0b..a3f32e93a 100644 --- a/packages/config-yaml/src/interfaces/index.ts +++ b/packages/config-yaml/src/interfaces/index.ts @@ -32,6 +32,7 @@ export function getLocationsToLook( blockSlug: PackageSlug | undefined, currentUserSlug: string, secretName: string, + orgScopeSlug: string | null, ): SecretLocation[] { const locationsToLook: SecretLocation[] = [ ...(blockSlug @@ -57,11 +58,15 @@ export function getLocationsToLook( secretName, }, // Organization that owns assistant (org secrets can only be used in assistants owned by that org) - { - secretType: SecretType.Organization as const, - orgSlug: assistantSlug.ownerSlug, - secretName, - }, + ...(orgScopeSlug + ? [ + { + secretType: SecretType.Organization as const, + orgSlug: orgScopeSlug, + secretName, + }, + ] + : []), // User { secretType: SecretType.User as const, @@ -90,6 +95,7 @@ export function listAvailableSecrets( assistantSlug: PackageSlug, blockSlug: PackageSlug | undefined, currentUserSlug: string, + orgScopeSlug: string | null, ): SecretLocation[] { // Create a set of all secret names const allSecretNames = new Set([ @@ -108,6 +114,7 @@ export function listAvailableSecrets( blockSlug, currentUserSlug, secretName, + orgScopeSlug, ); // Go through the locations one by one @@ -155,6 +162,7 @@ export async function resolveFQSN( currentUserSlug: string, fqsn: FQSN, platformSecretStore: PlatformSecretStore, + orgScopeSlug: string | null, ): Promise { // First create the list of secret locations to try in order const assistantSlug = fqsn.packageSlugs[0]; @@ -164,6 +172,7 @@ export async function resolveFQSN( blockSlug, currentUserSlug, fqsn.secretName, + orgScopeSlug, ); // Then try to get the secret from each location diff --git a/packages/config-yaml/test/index.test.ts b/packages/config-yaml/test/index.test.ts index 16a531fac..71b073f42 100644 --- a/packages/config-yaml/test/index.test.ts +++ b/packages/config-yaml/test/index.test.ts @@ -44,7 +44,7 @@ describe("E2E Scenarios", () => { ): Promise<(SecretResult | undefined)[]> { return await Promise.all( fqsns.map((fqsn) => - resolveFQSN("test-user", fqsn, platformSecretStore), + resolveFQSN("test-user", fqsn, platformSecretStore, "test-org"), ), ); },