Skip to content

Commit 9aaf698

Browse files
authored
Merge branch 'opensearch-project:main' into main
2 parents 7b98e78 + 3fca6bd commit 9aaf698

File tree

485 files changed

+60419
-13208
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

485 files changed

+60419
-13208
lines changed

.github/workflows/maven-publish.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ on:
55
push:
66
branches:
77
- main
8-
- 1.*
9-
- 2.*
8+
- '[0-9]+.[0-9]+'
9+
- '[0-9]+.x'
1010

1111
jobs:
1212
build-and-publish-snapshots:
@@ -33,8 +33,14 @@ jobs:
3333
export-env: true
3434
env:
3535
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
36-
SONATYPE_USERNAME: op://opensearch-infra-secrets/maven-central-portal-credentials/username
37-
SONATYPE_PASSWORD: op://opensearch-infra-secrets/maven-central-portal-credentials/password
36+
MAVEN_SNAPSHOTS_S3_REPO: op://opensearch-infra-secrets/maven-snapshots-s3/repo
37+
MAVEN_SNAPSHOTS_S3_ROLE: op://opensearch-infra-secrets/maven-snapshots-s3/role
38+
39+
- name: Configure AWS credentials
40+
uses: aws-actions/configure-aws-credentials@v5
41+
with:
42+
role-to-assume: ${{ env.MAVEN_SNAPSHOTS_S3_ROLE }}
43+
aws-region: us-east-1
3844

3945
- name: publish snapshots to maven
4046
run: |

.github/workflows/require-approval.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ jobs:
3535
else
3636
# Check if the author is in the approvers list
3737
approvers=$(cat .github/CODEOWNERS | grep @ | tr -d '* ' | sed 's/@/,/g' | sed 's/,//1')
38-
if [[ "$approvers" =~ "$author" ]]; then
38+
is_approved=false
39+
IFS=',' read -ra APPROVER_ARRAY <<< "$approvers"
40+
for approver in "${APPROVER_ARRAY[@]}"; do
41+
if [[ "$approver" == "$author" ]]; then
42+
is_approved=true
43+
break
44+
fi
45+
done
46+
if [[ "$is_approved" == "true" ]]; then
3947
echo "$author is in the approval list."
4048
echo "is-require-approval=ml-commons-cicd-env" >> $GITHUB_OUTPUT
4149
else

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ ml-algorithms/build/
1010
plugin/build/
1111
.DS_Store
1212
*/bin/
13+
**/*.factorypath

build-tools/repositories.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
repositories {
77
mavenLocal()
8-
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
9-
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
8+
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/maven/" }
109
mavenCentral()
1110
maven {url 'https://oss.sonatype.org/content/repositories/snapshots/'}
1211
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/lucene/" }

build.gradle

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ buildscript {
1111
ext {
1212
opensearch_group = "org.opensearch"
1313
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
14-
opensearch_version = System.getProperty("opensearch.version", "3.3.0-SNAPSHOT")
14+
opensearch_version = System.getProperty("opensearch.version", "3.4.0-SNAPSHOT")
1515
buildVersionQualifier = System.getProperty("build.version_qualifier", "")
1616
asm_version = "9.7"
1717

@@ -31,8 +31,7 @@ buildscript {
3131

3232
repositories {
3333
mavenLocal()
34-
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
35-
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
34+
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/maven/" }
3635
mavenCentral()
3736
maven { url "https://plugins.gradle.org/m2/" }
3837
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/lucene/" }
@@ -97,6 +96,24 @@ subprojects {
9796
// Force spotless depending on newer version of guava due to CVE-2023-2976. Remove after spotless upgrades.
9897
resolutionStrategy.force "com.google.guava:guava:32.1.3-jre"
9998
resolutionStrategy.force 'org.apache.commons:commons-compress:1.26.0'
99+
resolutionStrategy.force "io.netty:netty-buffer:${versions.netty}"
100+
resolutionStrategy.force "io.netty:netty-codec:${versions.netty}"
101+
resolutionStrategy.force "io.netty:netty-codec-http:${versions.netty}"
102+
resolutionStrategy.force "io.netty:netty-codec-http2:${versions.netty}"
103+
resolutionStrategy.force "io.netty:netty-common:${versions.netty}"
104+
resolutionStrategy.force "io.netty:netty-handler:${versions.netty}"
105+
resolutionStrategy.force "io.netty:netty-resolver:${versions.netty}"
106+
resolutionStrategy.force "io.netty:netty-transport:${versions.netty}"
107+
resolutionStrategy.force "io.netty:netty-transport-native-unix-common:${versions.netty}"
108+
resolutionStrategy.force "software.amazon.awssdk:bom:${versions.aws}"
109+
resolutionStrategy.force "software.amazon.awssdk:kms:${versions.aws}"
110+
resolutionStrategy.force "software.amazon.awssdk:dynamodb:${versions.aws}"
111+
resolutionStrategy.force "software.amazon.awssdk:dynamodb-enhanced:${versions.aws}"
112+
resolutionStrategy.force "org.dafny:DafnyRuntime:4.9.0"
113+
}
114+
115+
configurations.all {
116+
exclude group: 'org.bouncycastle', module: 'bcprov-jdk18on'
100117
}
101118

102119
apply plugin: 'com.diffplug.spotless'

client/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ publishing {
7272
}
7373
maven {
7474
name = "Snapshots"
75-
url = "https://central.sonatype.com/repository/maven-snapshots/"
76-
credentials {
77-
username "$System.env.SONATYPE_USERNAME"
78-
password "$System.env.SONATYPE_PASSWORD"
75+
url = System.getenv("MAVEN_SNAPSHOTS_S3_REPO")
76+
credentials(AwsCredentials) {
77+
accessKey = System.getenv("AWS_ACCESS_KEY_ID")
78+
secretKey = System.getenv("AWS_SECRET_ACCESS_KEY")
79+
sessionToken = System.getenv("AWS_SESSION_TOKEN")
7980
}
8081
}
8182
}

common/build.gradle

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ dependencies {
2222
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.15.2'
2323
testImplementation "org.opensearch.test:framework:${opensearch_version}"
2424

25-
compileOnly group: 'org.apache.commons', name: 'commons-text', version: '1.10.0'
26-
compileOnly group: 'com.google.code.gson', name: 'gson', version: '2.13.2'
25+
compileOnly group: 'org.opensearch', name:'opensearch-security-spi', version:"${opensearch_build}"
26+
27+
compileOnly group: 'org.apache.commons', name: 'commons-text', version: '1.14.0'
28+
compileOnly group: 'com.google.code.gson', name: 'gson', version: "${versions.gson}"
2729
compileOnly group: 'org.json', name: 'json', version: '20231013'
2830
testImplementation group: 'org.json', name: 'json', version: '20231013'
2931
implementation('com.google.guava:guava:32.1.3-jre') {
@@ -43,6 +45,10 @@ dependencies {
4345
compileOnly group: 'com.networknt' , name: 'json-schema-validator', version: '1.4.0'
4446
// Multi-tenant SDK Client
4547
compileOnly "org.opensearch:opensearch-remote-metadata-sdk:${opensearch_build}"
48+
compileOnly (group: 'software.amazon.awssdk', name: 'netty-nio-client', version: "${versions.aws}") {
49+
exclude(group: 'org.reactivestreams', module: 'reactive-streams')
50+
exclude(group: 'org.slf4j', module: 'slf4j-api')
51+
}
4652
}
4753

4854
lombok {
@@ -107,10 +113,11 @@ publishing {
107113
}
108114
maven {
109115
name = "Snapshots" // optional target repository name
110-
url = "https://central.sonatype.com/repository/maven-snapshots/"
111-
credentials {
112-
username "$System.env.SONATYPE_USERNAME"
113-
password "$System.env.SONATYPE_PASSWORD"
116+
url = System.getenv("MAVEN_SNAPSHOTS_S3_REPO")
117+
credentials(AwsCredentials) {
118+
accessKey = System.getenv("AWS_ACCESS_KEY_ID")
119+
secretKey = System.getenv("AWS_SECRET_ACCESS_KEY")
120+
sessionToken = System.getenv("AWS_SESSION_TOKEN")
114121
}
115122
}
116123
}

common/src/main/java/org/opensearch/ml/common/CommonValue.java

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ public class CommonValue {
4646
public static final String ML_AGENT_INDEX = ".plugins-ml-agent";
4747
public static final String ML_MEMORY_META_INDEX = ".plugins-ml-memory-meta";
4848
public static final String ML_MEMORY_MESSAGE_INDEX = ".plugins-ml-memory-message";
49-
public static final String ML_MEMORY_CONTAINER_INDEX = ".plugins-ml-memory-container";
49+
public static final String ML_MEMORY_CONTAINER_INDEX = ".plugins-ml-am-memory-container";
50+
public static final String ML_AGENTIC_MEMORY_SYSTEM_INDEX_PREFIX = ".plugins-ml-am";
51+
public static final String ML_AGENTIC_MEMORY_INDEX_PATTERN = ML_AGENTIC_MEMORY_SYSTEM_INDEX_PREFIX + "*";
5052
public static final String ML_STOP_WORDS_INDEX = ".plugins-ml-stop-words";
5153
// index used in 2.19 to track MlTaskBatchUpdate task
5254
public static final String TASK_POLLING_JOB_INDEX = ".ml_commons_task_polling_job";
@@ -68,12 +70,19 @@ public class CommonValue {
6870
public static final String ML_MEMORY_META_INDEX_MAPPING_PATH = "index-mappings/ml_memory_meta.json";
6971
public static final String ML_MEMORY_MESSAGE_INDEX_MAPPING_PATH = "index-mappings/ml_memory_message.json";
7072
public static final String ML_MEMORY_CONTAINER_INDEX_MAPPING_PATH = "index-mappings/ml_memory_container.json";
73+
public static final String ML_MEMORY_SESSION_INDEX_MAPPING_PATH = "index-mappings/ml_memory_sessions.json";
74+
public static final String ML_WORKING_MEMORY_INDEX_MAPPING_PATH = "index-mappings/ml_memory_working.json";
75+
public static final String ML_LONG_TERM_MEMORY_INDEX_MAPPING_PATH = "index-mappings/ml_memory_long_term.json";
76+
public static final String ML_LONG_MEMORY_HISTORY_INDEX_MAPPING_PATH = "index-mappings/ml_memory_long_term_history.json";
7177
public static final String ML_MCP_SESSION_MANAGEMENT_INDEX_MAPPING_PATH = "index-mappings/ml_mcp_session_management.json";
7278
public static final String ML_MCP_TOOLS_INDEX_MAPPING_PATH = "index-mappings/ml_mcp_tools.json";
7379
public static final String ML_JOBS_INDEX_MAPPING_PATH = "index-mappings/ml_jobs.json";
7480
public static final String ML_INDEX_INSIGHT_CONFIG_INDEX_MAPPING_PATH = "index-mappings/ml_index_insight_config.json";
7581
public static final String ML_INDEX_INSIGHT_STORAGE_INDEX_MAPPING_PATH = "index-mappings/ml_index_insight_storage.json";
7682

83+
// Resource type used in resource-access-control
84+
public static final String ML_MODEL_GROUP_RESOURCE_TYPE = "ml-model-group";
85+
7786
// Calculate Versions independently of OpenSearch core version
7887
public static final Version VERSION_2_11_0 = Version.fromString("2.11.0");
7988
public static final Version VERSION_2_12_0 = Version.fromString("2.12.0");
@@ -86,6 +95,8 @@ public class CommonValue {
8695
public static final Version VERSION_2_19_0 = Version.fromString("2.19.0");
8796
public static final Version VERSION_3_0_0 = Version.fromString("3.0.0");
8897
public static final Version VERSION_3_1_0 = Version.fromString("3.1.0");
98+
public static final Version VERSION_3_2_0 = Version.fromString("3.2.0");
99+
public static final Version VERSION_3_3_0 = Version.fromString("3.3.0");
89100

90101
// Connector Constants
91102
public static final String NAME_FIELD = "name";
@@ -112,7 +123,9 @@ public class CommonValue {
112123
public static final String MCP_CONNECTORS_FIELD = "mcp_connectors";
113124
public static final String MCP_CONNECTOR_ID_FIELD = "mcp_connector_id";
114125
public static final String MCP_DEFAULT_SSE_ENDPOINT = "/sse";
115-
public static final String SSE_ENDPOINT_FILED = "sse_endpoint";
126+
public static final String SSE_ENDPOINT_FIELD = "sse_endpoint";
127+
public static final String MCP_DEFAULT_STREAMABLE_HTTP_ENDPOINT = "/mcp/";
128+
public static final String ENDPOINT_FIELD = "endpoint";
116129

117130
// TOOL Constants
118131
public static final String TOOL_INPUT_SCHEMA_FIELD = "input_schema";
@@ -121,4 +134,16 @@ public class CommonValue {
121134
public static final long INDEX_INSIGHT_GENERATING_TIMEOUT = 3 * 60 * 1000;
122135
public static final long INDEX_INSIGHT_UPDATE_INTERVAL = 24 * 60 * 60 * 1000;
123136

137+
// JSON-RPC Error Codes
138+
public static final int JSON_RPC_PARSE_ERROR = -32700;
139+
public static final int JSON_RPC_INTERNAL_ERROR = -32603;
140+
public static final int JSON_RPC_SERVER_NOT_READY_ERROR = -32000;
141+
142+
// MCP Server response fields
143+
public static final String ACKNOWLEDGE_FIELD = "acknowledged";
144+
public static final String MCP_RESPONSE_FIELD = "mcp_response";
145+
public static final String ERROR_FIELD = "error";
146+
public static final String MESSAGE_FIELD = "message";
147+
public static final String ID_FIELD = "id";
148+
public static final String ERROR_CODE_FIELD = "error_code";
124149
}

common/src/main/java/org/opensearch/ml/common/MLModel.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -863,17 +863,17 @@ public Tags getTags() {
863863
public Tags getTags(Connector connector) {
864864
// if connector is present, model is a remote model
865865
if (this.algorithm == FunctionName.REMOTE && connector != null) {
866-
return getRemoteModelTags(connector);
866+
return getRemoteModelTags(connector).addTag(IS_HIDDEN_FIELD, isHidden != null && isHidden);
867867
}
868868

869869
// pre-trained models follow a specific naming convention, relying on that to identify a pre-trained model
870870
if (this.name != null
871871
&& (this.name.startsWith("amazon/") || this.name.startsWith("huggingface/"))
872872
&& this.name.split("/").length >= 3) {
873-
return getPreTrainedModelTags();
873+
return getPreTrainedModelTags().addTag(IS_HIDDEN_FIELD, isHidden != null && isHidden);
874874
}
875875

876-
return getCustomModelTags();
876+
return getCustomModelTags().addTag(IS_HIDDEN_FIELD, isHidden != null && isHidden);
877877
}
878878

879879
/**

common/src/main/java/org/opensearch/ml/common/MLModelGroup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package org.opensearch.ml.common;
77

88
import static org.opensearch.core.xcontent.XContentParserUtils.ensureExpectedToken;
9+
import static org.opensearch.ml.common.CommonValue.BACKEND_ROLES_FIELD;
910
import static org.opensearch.ml.common.CommonValue.TENANT_ID_FIELD;
1011
import static org.opensearch.ml.common.CommonValue.VERSION_2_19_0;
1112

@@ -33,7 +34,6 @@ public class MLModelGroup implements ToXContentObject {
3334
public static final String MODEL_GROUP_NAME_FIELD = "name"; // name of the model group
3435
public static final String DESCRIPTION_FIELD = "description"; // description of the model group
3536
public static final String LATEST_VERSION_FIELD = "latest_version"; // latest model version added to the model group
36-
public static final String BACKEND_ROLES_FIELD = "backend_roles"; // back_end roles as specified by the owner/admin
3737
public static final String OWNER = "owner"; // user who creates/owns the model group
3838

3939
public static final String ACCESS = "access"; // assigned to public, private, or null when model group created

0 commit comments

Comments
 (0)