749 Commits

Author SHA1 Message Date
杨翊 SionYang 605a3fd2e4 [ISSUE #14804] Add shared AI resource search APIs (#15745)
* [ISSUE #14804] Add shared AI resource search APIs

Expose generic and resource-specific client search APIs backed by the shared AI Resource Search Core, with auth routing, specifications, and integration coverage.

Assisted-by: Claude Code

* [ISSUE #14804] Cover AI search authorization scenarios

Register the generic resource search and MCP client controllers in the authorization integration-test matrix.

Assisted-by: Claude Code
2026-08-21 13:39:28 +08:00
laomei 524e4b2105 [ISSUE #15675] Support nullable MCP tool output schemas (#15698)
Assisted-by: Claude Code
2026-08-13 15:33:51 +08:00
sai db7abe35b6 [ISSUE #15541] Improve ARD search index consistency (#15615)
* Fix ARD filter compatibility

* Remove ARD naming from AI search internals

* Document durable AI resource index enhancement

Assisted-by: Claude Code

* Extend AI resource index task schemas

Assisted-by: Claude Code

* Make AI resource index enhancement durable

Assisted-by: Claude Code

* Fix AI resource index task consumer injection

Assisted-by: Claude Code

* Refactor durable AI resource task model

Generalize the durable search-index task contract with versioned payload and result data while preserving lease, retry, and revision fencing semantics.

Assisted-by: Claude Code

* Update AI resource task schemas

Replace the search-index-specific task table with the generic AI resource task schema across supported databases and align Derby persistence test resources.

Assisted-by: Claude Code

* Use epoch millis for AI resource task scheduling

Assisted-by: Claude Code

* Improve AI resource index convergence

Harden task fencing, lease handling, reconciliation, vector readiness, and ARD filter compatibility.

Assisted-by: Claude Code

* fix: use latest published MCP version by default

Resolve omitted MCP versions through latestPublishedVersion so draft versions do not trigger repeated index reconciliation. Add unit and Admin API regression coverage.

Assisted-by: Claude Code

* fix: fence AI resource task leases

Preserve active leases across coalesced lifecycle schedules and use a monotonic lease token to fence stale workers from renewing, completing, retrying, or releasing newer work.

Assisted-by: Claude Code

* test: align MCP latest published version lookup

Assisted-by: Claude Code
2026-08-05 14:22:10 +08:00
杨翊 SionYang 6df7c8b770 [ISSUE #14804] Support rollout-safe Agent endpoint discovery (#15644)
Aggregate compatible runtime endpoints across online Agent versions by default while preserving explicit latest-only discovery.

Assisted-by: Claude Code
2026-08-04 14:34:24 +08:00
Zhengcy05 5e952c8d07 [ISSUE #15604] Add visibility permission management for AI resources (#15623)
* feat: add console-ui

* feat: add visibility permission management for AI resources

* feat: support standalone Console deployment

* feat: 1.Avoid losing the existing read permission during r → rw upgrade
2.Repeated revoke didn't report error

* spotless

* fix: ci
2026-08-04 14:33:26 +08:00
杨翊 SionYang eedacb4315 [ISSUE #14804] Add Agent code-first publication SDK (#15643)
Expose generic Agent definition publication over HTTP and gRPC with optional ordinary auto-submit semantics.

Complete A2A client multi-version endpoint redo and exact/latest polling subscription recovery, with specifications, unit tests, and standalone integration coverage.

Assisted-by: Claude Code
2026-08-04 11:14:11 +08:00
杨翊 SionYang 5b9a5e7873 [ISSUE #14804] Add Agent Console management UI (#15633)
* [ISSUE #14804] Add Agent Console management UI

Assisted-by: Claude Code

* [ISSUE #14804] Update Agent Console validation record

Assisted-by: Claude Code
2026-08-02 17:06:25 +08:00
杨翊 SionYang 59ca6199de [ISSUE #14804] Add Agent discovery Java SDK (#15624)
Assisted-by: Claude Code
2026-07-31 16:17:27 +08:00
杨翊 SionYang 4775159533 [ISSUE #14804] Add Agent client discovery and endpoint APIs (#15622)
* [ISSUE #14804] Add Agent client HTTP and gRPC API

Assisted-by: Claude Code

* [ISSUE #14804] Add Agent cross-API integration scenarios

Assisted-by: Claude Code
2026-07-30 20:30:50 +08:00
杨翊 SionYang 645f9a13ef Deprecate legacy plugin compatibility paths (#15614)
Continuous Integration / ci (push) Has been cancelled
Frontend Continuous Integration / frontend-ci (push) Has been cancelled
Frontend Continuous Integration / check-min-release-age (push) Has been cancelled
Assisted-by: Claude Code
2026-07-30 15:18:06 +08:00
sai d2656fde2b [ISSUE #15606] Return per-item Skill batch upload results (#15607)
* [ISSUE #15606] Return per-item Skill batch upload results

Return one structured result for each Skill or candidate directory and align errorCode with upload precheck business codes.

Assisted-by: Claude Code

* [ISSUE #15606] Preserve Skill batch upload response compatibility

* [ISSUE #15606] Read wrapped Skill batch results in console
2026-07-30 10:18:33 +08:00
杨翊 SionYang f68011b92b [ISSUE #14804] Improve Agent Admin test coverage (#15601)
Assisted-by: Claude Code
2026-07-29 13:51:58 +08:00
杨翊 SionYang dff2c7cd8c [ISSUE #14804] Add Agent Admin API and maintainer SDK (#15598)
* [ISSUE #14804] Add Agent Admin API and maintainer SDK

Add protocol-neutral Agent Admin endpoints and maintainer SDK support on the unified AI resource lifecycle. Align first-draft creation, namespace binding, metadata updates, visibility filters, specs, and integration-test coverage.

Assisted-by: Claude Code

* [ISSUE #14804] Fix default Agent owner

Assisted-by: Claude Code

* [ISSUE #14804] Fix agent admin OpenAPI error assertions

Assisted-by: Claude Code
2026-07-29 11:26:33 +08:00
sai 07a0ff15f8 [ISSUE #15541] Add Agentic Resource Discovery support (#15542)
* Add ARD search API contract

* Implement local ARD search service

* Add ARD search service tests

* Implement ARD P0 persistent indexing

* Add ARD PostgreSQL schema and cursor pagination

* Add ARD skill content and LLM index enhancement

* Rebuild latest ARD index on skill version changes

* Support dedicated ARD pgvector storage

# Conflicts:
#	plugin-default-impl/nacos-default-datasource-plugin/nacos-datasource-plugin-mysql/src/main/resources/META-INF/mysql-schema.sql

* Improve ARD search ranking

* Limit ARD pgvector search in SQL

* Make ARD pgvector embeddings extensible

* Enhance ARD source content for prompt and MCP

* Align ARD search protocol response

* Expose ARD resource artifact URLs

* Support ARD field path filters

* Add ARD agents endpoint

* Add ARD explore endpoint

* Add internal ARD catalog endpoint

* Add ARD catalog list explore DTOs

* Complete local ARD protocol endpoints

* Cover ARD catalog list explore artifacts

* Extract ARD index enhancement prompt

* Make ARD catalog host metadata configurable

* Add ARD vector index SPI

* Add default PostgreSQL ARD vector plugin

* Route ARD vector indexing through plugins

# Conflicts:
#	api/src/main/java/com/alibaba/nacos/api/plugin/PluginType.java

* Extract ARD index enhancement prompt

* refactor: flatten ARD enhancement search phrases

* refactor: split ARD enhancement search chunks

* feat: return complete skill packages from ARD

* test: cover ARD skill package URLs

* Add ARD well-known catalog endpoint

* Simplify ARD catalog base URL configuration

* Tighten ARD catalog base URL semantics

* Align ARD well-known catalog semantics

* Fix ARD namespace authorization parsing

* Clean up ARD index content storage

* Add ARD index backfill

* Add ARD global feature switch

* Move ARD protocol contracts to registry adaptor

* Align ARD vector plugin with unified loading

* Document ARD protocol adaptor ownership

* Decouple ARD protocol and storage concerns

* Fix AI vector plugin discovery

* Fix ARD endpoint authentication

* Fix PostgreSQL ARD vector schema isolation

* Fix ARD protocol compatibility and artifact routing

Pin the upstream ARD contract, align response and error models, and serve complete Skill artifacts from the adaptor web context.

* Move ARD discovery logic into AI module

* Make ARD index maintenance durable

Persist coalesced resource-level index tasks with leased retry, make relational and default PostgreSQL vector replacement transactional, and reconcile stale or orphaned indexes periodically.

* Fix ARD schema fixture RAT exclusion

Use a module-independent path pattern so the pinned upstream JSON Schema is excluded when RAT runs from either the repository root or the adaptor module.

* Refine ARD search architecture and compatibility

* Fix ARD release blockers

Align ARD authentication, catalog URLs and identifiers with the pinned protocol contract. Bound discovery/index queries, complete namespace catalogs, and document the three-table migration path.

* Fix ARD authentication in adaptor context

* Fix PluginType spotless formatting
2026-07-29 09:49:47 +08:00
杨翊 SionYang 1ecc39c45c [ISSUE #15475] Align plugin provider and configuration contracts (#15593)
Honor provider order before first-wins registration, align built-in plugin routers with the same conflict policy, and remove datasource fallback to an unrelated dialect.

Make standard configuration keys authoritative by presence and enable AI resource import unless explicitly disabled. Update bilingual plugin specs and tests accordingly.

Assisted-by: Claude Code
2026-07-28 17:47:39 +08:00
杨翊 SionYang 709bd78ab6 [ISSUE #15475] Integrate environment plugin pre-context configuration (#15590)
* [ISSUE #15475] Integrate environment plugin pre-context configuration

Unify environment plugin discovery, static configuration apply, and startup handoff through PRE_CONTEXT initialization.

Assisted-by: Claude Code

* Fix environment plugin initialization test

Assisted-by: Claude Code
2026-07-27 19:49:53 +08:00
杨翊 SionYang 79c8440794 [ISSUE #14804] Implement Agent Runtime Endpoint Registry (#15591)
Assisted-by: Claude Code
2026-07-27 19:38:05 +08:00
杨翊 SionYang 27d24e55e4 Integrate control plugin with unified configuration (#15572)
Assisted-by: Claude Code
2026-07-24 15:54:07 +08:00
杨翊 SionYang 58483bebb6 [ISSUE #14804] Align Agent contracts and improve test coverage (#15569)
Assisted-by: Claude Code
2026-07-23 19:55:00 +08:00
杨翊 SionYang 25c89158ba [ISSUE #14804] Add Agent resource persistence foundations (#15566)
* [ISSUE #14804] Add Agent resource metadata foundations

Add the typed Agent resource extension codec, strict version ordering, derived online catalog builder, and protocol search tokens.

Assisted-by: Claude Code

* [ISSUE #14804] Add Agent persistence orchestration

Persist Agent resources and their initial draft versions across AI Resource and AI Storage with idempotent recovery and verified content descriptors. Keep public tags separate from protocol discovery, clarify RAD protocol filtering, and rename JSON conversion helpers as serializers.

Assisted-by: Claude Code
2026-07-23 17:48:16 +08:00
杨翊 SionYang 8cd1910c32 Refine plugin loading and state lifecycle (#15564)
Assisted-by: Claude Code
2026-07-23 11:11:24 +08:00
sai b6895e5503 [ISSUE #15561] Unify Skill upload precheck with ZIP validation (#15562)
* Enhance skill upload precheck result

# Conflicts:
#	console/src/main/resources/static/next/js/client.js

# Conflicts:
#	ai/src/test/java/com/alibaba/nacos/ai/service/skills/SkillOperationServiceImplTest.java

* Enhance skill upload permission owner reporting

 Conflicts:
	ai/src/main/java/com/alibaba/nacos/ai/service/skills/SkillOperationServiceImpl.java
	ai/src/test/java/com/alibaba/nacos/ai/service/skills/SkillOperationServiceImplTest.java

* Support ZIP-based skill batch precheck

* [ISSUE #15486] Simplify Skill upload precheck contract

Return a compact single-code precheck result and expose the maximum published version across online and offline versions.

Assisted-by: Claude Code

* [ISSUE #15486] Adapt console UI to compact Skill precheck

Handle precheckCode directly and display the highest published version together with the version after upload.

Assisted-by: Claude Code

* [ISSUE #15486] Rebuild console next UI assets

* [ISSUE #15486] Unify Skill ZIP precheck API

Replace the unpublished metadata precheck contract with multipart ZIP precheck across Admin, Console, and Maintainer APIs. Return invalid ZIP entries with explicit precheck codes and cover the unified contract in specs and tests.\n\nAssisted-by: Claude Code

* [ISSUE #15486] Use server-side ZIP precheck in console UI

Send the original ZIP to the unified precheck endpoint, render server precheck codes, and keep full invalid-entry paths in tooltips while showing concise folder names.\n\nAssisted-by: Claude Code

* [ISSUE #15486] Refresh console assets for ZIP precheck

Regenerate the bundled Console Next assets after adopting the unified server-side Skill ZIP precheck flow.\n\nAssisted-by: Claude Code

* Stabilize OIDC authorization client test timeout
2026-07-23 11:07:31 +08:00
杨翊 SionYang a66d928bc6 Unify plugin configuration SPI contracts (#15555)
Assisted-by: Claude Code
2026-07-22 13:38:59 +08:00
杨翊 SionYang 80bee614ae [ISSUE #14804] Add Agent and RAD contract models (#15551)
Introduce protocol-neutral Agent management and RAD discovery models, deterministic endpoint and version utilities, validators, and comprehensive tests.

Assisted-by: OpenAI Codex
2026-07-21 20:42:09 +08:00
杨翊 SionYang ffa81ce810 Add plugin type policies and critical validation (#15548)
Assisted-by: Claude Code
2026-07-21 19:14:33 +08:00
yijie zhao 34d96aa311 [ISSUE #15486] Report skill owner on upload permission denial (#15525)
* fix: report skill owner on upload permission denial

* fix: report skill owner on upload permission denial

* style: format skill upload owner fields

* style: format skill upload owner handling
2026-07-21 17:23:42 +08:00
杨翊 SionYang 30c1398ab9 [ISSUE #15475] Standardize plugin state and AI pipeline lifecycle (#15537)
Centralize plugin execution capabilities and separate core module gates from plugin state. Migrate AI pipeline services to direct PluginConfigSpec lifecycle management with unified runtime ordering and legacy configuration compatibility.

Assisted-by: Claude Code
2026-07-20 17:51:59 +08:00
Sunrisea 0f3b14063d fix(ai): make config storage keys Nacos-safe (#15535)
Assisted-by: Claude Code
2026-07-20 14:29:27 +08:00
杨翊 SionYang b9333258be [ISSUE #15475] Complete plugin management foundation (#15500)
Complete unified plugin state enforcement for runtime-routed plugin families.

Add static configuration refresh snapshots, source resolver registry, restart-only field isolation, and shared plugin type capabilities before production plugins adopt PluginConfigSpec.

Assisted-by: Claude Code
2026-07-13 17:33:58 +08:00
杨翊 SionYang b1cd18225b [ISSUE #15475] Add plugin config metadata model (#15479)
Assisted-by: Claude Code
2026-07-09 13:56:14 +08:00
杨翊 SionYang 7ec791b394 [ISSUE #15305] Reject blank instance IP in naming registration (#15454)
Reject blank instance IP through the Java SDK naming validation path and the server-side gRPC instance registration handler.

Add unit coverage, update Java SDK IT coverage for the blank-IP contract, and fix existing tests that intentionally need valid instance identities.

Assisted-by: Claude Code
2026-07-01 13:35:14 +08:00
Vasiliy Mikhailov f8bcfabfe2 Avoid ArrayIndexOutOfBoundsException in getServiceName for trailing separator (#15447) 2026-06-29 11:49:31 +08:00
杨翊 SionYang 8847043c71 Polish unused code follow-up (#15441)
Remove the leftover unused pipeline resource SQL constant.

Mark IConfigRequest#getConfigContext as deprecated for compatibility.

Assisted-by: Claude Code
2026-06-26 14:32:49 +08:00
杨翊 SionYang 78229d6878 Remove reviewed unused Java code (#15440)
Remove confirmed unused Java methods and classes across AI, common, config, naming, persistence, copilot, CMDB, and client modules.

Mark preserved compatibility candidates as deprecated instead of removing them.

Assisted-by: Claude Code
2026-06-26 13:32:34 +08:00
杨翊 SionYang 162e53c6d7 Remove confirmed unused Java code follow-ups (#15432)
* Remove unused api AgentSpec group helper

* Remove unused common test field

* Remove unused ai pipeline SQL helper

* Remove unused copilot helpers

* Remove unused istio listener helper

* Remove unused lock wait queue helpers

* Remove unused core utilities

* Remove unused config code

* Remove unused naming code

* Fix ai prompt migration test isolation

Assisted-by: Codex

* Fix client test isolation

Assisted-by: Codex
2026-06-25 19:58:12 +08:00
杨翊 SionYang aa27c40a52 [ISSUE #14466] Move pipeline execution DTOs to api (#15422)
* [ISSUE #14466] Move pipeline execution DTOs to api

Assisted-by: Claude Code

* [ISSUE #14466] Fix console pipeline DTO imports

Assisted-by: Claude Code
2026-06-25 10:03:33 +08:00
杨翊 SionYang 3e34a6e8c4 [ISSUE #14466] Migrate maintainer client JSON parsing (#15373)
* [ISSUE #14466] Migrate maintainer client JSON parsing

Replace maintainer-client HTTP response parsing with neutral JsonUtils and NacosTypeReference while keeping legacy pipeline JsonNode compatibility.

Assisted-by: Claude Code

* Fix maintainer config boolean result unwrap

Assisted-by: Claude Code

* Fix copilot config idempotent save result

Assisted-by: Claude Code

* Fix copilot config maintainer context path

Assisted-by: Claude Code

* Fix copilot config console storage path

Assisted-by: Claude Code

* Stabilize copilot config controller test

Assisted-by: Claude Code

* Register selector subtypes for JsonUtils

Assisted-by: Claude Code

* Stabilize maintainer beta cleanup

Assisted-by: Claude Code
2026-06-24 16:22:11 +08:00
sai 2f8d884c9c [ISSUE #15315] Optimize Skill upload precheck and conflict handling (#15316)
* feat(ai): optimize upload skill with precheck, uploadAction and commitMsg support

- Add precheck endpoint for upload validation before actual upload
- Support uploadAction parameter (create_draft/overwrite_draft/create_version)
- Support commitMsg parameter for version commit messages
- Add SkillUploadPrecheckRequest/Result models in API module
- Refactor SkillOperationServiceImpl upload flow with UploadVersionCandidate
- Update SkillZipParser to extract version from skillMd front-matter
- Add upload precheck support to Console/Admin/Maintainer layers
- Update skill-spec documentation for new upload workflow
- Add integration tests for upload precheck scenarios

* feat(ui): upload skill dialog with precheck and conflict resolution

- Refactor UploadSkillDialog to use precheck-then-upload two-step flow
- Add client-side ZIP parsing with skillUploadParser utility
- Show parsed skill info (name, version, description) before upload
- Handle conflict scenarios: version exists, no permission, etc.
- Add uploadAction selection UI for overwrite/create options
- Support commitMsg input for version publishing
- Update locales (en-US, zh-CN) with new upload dialog strings
- Add unit tests for skillUploadParser

* chore(ui): rebuild console-ui-next static assets

Regenerated from source changes in the previous commit.

# Conflicts:
#	console/src/main/resources/static/next/js/main.js

* Strip wrapper directory from skill resources

* Update console static skill upload assets

* test: align skill upload precheck path

* test: align skill upload precheck path
2026-06-17 11:22:48 +08:00
杨翊 SionYang 3823101a94 [ISSUE #14466] Clean api Jackson databind usage (#15364)
Migrate HealthCheckerFactory to the neutral JsonUtils subtype registry and serialization facade. Replace ConfigBasicInfo databind serializer usage with annotation-only formatting, and move api Jackson core/databind dependencies to test scope while keeping annotations compile-scoped.

Assisted-by: Claude Code
2026-06-16 19:10:41 +08:00
杨翊 SionYang 714ccff2ed [ISSUE #14466] Add Jackson 2 JSON adapter (#15362)
* [ISSUE #14466] Improve JSON adapter API test coverage

Assisted-by: Claude Code

* [ISSUE #14466] Add Jackson 2 JSON adapter

Assisted-by: Claude Code
2026-06-16 12:16:57 +08:00
杨翊 SionYang 99acf6ba9f [ISSUE #14466] Add neutral JSON adapter API (#15361)
* [ISSUE #14466] Add neutral JSON adapter API

Assisted-by: Claude Code

* [ISSUE #14466] Stabilize GlobalExecutorTest environment setup
2026-06-16 10:30:50 +08:00
杨翊 SionYang 1f9f6ccc8e Remove confirmed unused Java code (#15358)
* Remove confirmed unused Java code

Remove validated unused helpers, constants, classes, and matching dedicated tests across Java modules.

Deprecate currently unused datasource mapper methods so downstream plugin usage can be confirmed before removal.

Validation:

- mvn spotless:check

- mvn -B clean compile apache-rat:check checkstyle:check spotbugs:check spotless:check -DskipTests

- mvn -B '-Prelease-nacos,!dev' clean install -Drat.skip=true -Dspotbugs.skip=true -Dcheckstyle.skip=true -DskipTests=false

- mvn -B clean install -Prelease-nacos -DskipTests=true

- mvn -B clean verify -Pintegration-test

- mvn -B -pl test/java-sdk-test clean verify -Pjava-sdk-integration-test -DskipTests=false

- mvn -B -pl test/maintainer-sdk-test clean verify -Pmaintainer-sdk-integration-test -DskipTests=false

Assisted-by: Codex

* Fix flaky unit test setup

Reuse the same version 0.2.0 tar.gz fixture bytes for digest validation and HTTP response payloads, and initialize EnvUtil in GlobalExecutorTest when the test runs without suite-level environment setup.

Assisted-by: Codex

* Fix config test isolation

Assisted-by: Claude Code

* Fix flaky failover reactor test

Assisted-by: Claude Code
2026-06-16 00:12:23 +08:00
帝皇侠 b3fd6634cc [ISSUE #15279]feat(lock): implement distributed reentrant/non-reentrant lock (#15280)
* feat(lock): implement distributed reentrant/non-reentrant lock with watchdog, wait queue and gRPC push notification

Phase 1 of the Nacos distributed lock system:
- Reentrant and non-reentrant lock types with owner-based identity
- Watchdog auto-renewal mechanism (30s timeout, 10s renewal interval)
- Wait queue with FIFO semantics and gRPC server-push notifications
- Raft consensus integration for strong consistency across cluster
- Connection disconnect detection with automatic lock release via Raft
- Lock expiration scanner with Raft-path release
- Defensive copy for waitQueue access and null-owner guard in scanner
- Client SDK implementing JUC Lock interface (lock/tryLock/unlock)
- 44 unit tests + 35 integration tests covering core flows and edge cases

* feat(lock): implement distributed reentrant/non-reentrant lock with watchdog, wait queue and gRPC push notification

Phase 1 of the Nacos distributed lock system:
- Reentrant and non-reentrant lock types with owner-based identity
- Watchdog auto-renewal mechanism (30s timeout, 10s renewal interval)
- Wait queue with FIFO semantics and gRPC server-push notifications
- Raft consensus integration for strong consistency across cluster
- Connection disconnect detection with automatic lock release via Raft
- Lock expiration scanner with Raft-path release
- Defensive copy for waitQueue access and null-owner guard in scanner
- Client SDK implementing JUC Lock interface (lock/tryLock/unlock)
- 44 unit tests + 35 integration tests covering core flows and edge cases

* fix(lock): prevent self-deadlock on non-reentrant lock reentry from same thread

Non-reentrant lock reentry on the same thread previously sent the request to
the server, which rejected it and placed the thread in the wait queue, causing
self-deadlock (thread waits for itself to release the lock). Add a client-side
guard (checkReentrantGuard) that throws IllegalMonitorStateException before any
network call when the current thread already holds the lock.

* fix(lock): connection disconnect fully releases reentrant locks via force release

releaseLocksByConnection() previously called unLock() once per lock, which only
decremented reentrantCount by 1. For locks acquired N times, the dead connection
held the lock with count N-1 until expiry.

Add forceRelease flag to MutexLockRequest. When set, onApply calls
forceRelease() which clears reentrantCount/owner/expiry in a single Raft
round-trip. releaseLocksByConnection() now uses this path.

* fix(lock): enforce FIFO wait queue semantics to prevent queue-jumping

Previously, acquireLock() allowed any new request to acquire a released
lock even when waiters were queued, breaking FIFO ordering. This fix:

- Add waiterRetry flag (LockInstance/LockInfo) so the server can
  distinguish queue re-entries from new requests
- Force-release and re-enqueue new requests when the wait queue is
  non-empty, preventing queue-jumping
- Change pollFirstWaiter() to peekFirstWaiter() on unlock/expire so
  entries stay in the queue until the waiter actually re-acquires
- Add removeStaleWaiter() for cleaning up entries on non-head retry
- Add FIFO integration tests (JUC-021, JUC-022)

Fixes: FIFO wait queue semantics not enforced in acquireLock()

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(lock): deduplicate wait queue entries by owner and connection

addWaiter() now checks for an existing entry with the same
owner+connectionId before inserting. If found, it updates the
deadline instead of adding a duplicate. This prevents queue
bloat when LockGrpcClient retries ACQUIRE during notification
wait, and avoids duplicate notifications for the same waiter.

Fixes: blocking lock retry causes duplicate entries in wait queue

* test(lock): add unit tests for distributed lock module

- NonReentrantAtomicLockTest: lock/unlock, reentry rejection, forceRelease, autoExpire
- AbstractAtomicLockTest: renew, isClear, hasWaiters, removeStaleWaiter, drainAllWaiters, removeExpiredWaiters, peekFirstWaiter with expired entries, null input handling, dedup
- MutexAtomicLockTest: migrateFromLegacy (FULL/EMPTY/null/idempotent)
- LockOperationServiceImplTest: acquireLock FIFO enforcement, releaseLock normal/force, renewLock, expireLock
- WaitEntryTest: isExpired, constructor, setters
- LockKeyTest: equals, hashCode, toString, getters/setters
- LockService: add @Since("3.3.0") to renew method

* fix(lock): use Raft CLEANUP_CONNECTION for connection disconnect cleanup

Replace direct forceUnLock with a Raft-consensus CLEANUP_CONNECTION
operation to ensure cluster-wide consistency for lock releases and
wait queue cleanup when a connection disconnects.

Also async-ize pushWithoutAck calls via notificationExecutor to avoid
blocking the Raft FSM thread on push failures.

* fix(lock): fix doUnLock semantics, endTime NPE risk, and showLocks encapsulation

- ReentrantAtomicLock/MutexAtomicLock/NonReentrantAtomicLock: doUnLock
  now returns false when the lock is not held, instead of silently
  succeeding and corrupting state
- LockInfo.endTime: Long → long to eliminate auto-unboxing NPE in
  AbstractAtomicLock.renew()
- LockManager.showLocks() returns Collections.unmodifiableMap();
  NacosLockManager.getRawLockMap() added for snapshot internals
- NacosLockSnapshotOperation uses getRawLockMap() for putAll()
- Add test for unlocking an unheld lock (null-owner bypass path)

* fix(lock): remove unused import, fix Javadoc placement, and add missing license header

* fix(lock): fix FIFO notification gap, ThreadLocal leak, batch cleanup, and metrics

- Add notifyFirstWaiter() after FIFO force-enqueue in acquireLock()
- Clean up ThreadLocal entries in NacosLock.unlock() when reentrantCount reaches 0
- Batch connection cleanup into single Raft consensus instead of N separate writes
- Add RENEW metrics (grpcRenewSuccess/grpcRenewTotal) to LockMetricsMonitor
- Add LockNotificationType enum replacing raw strings for notification types
- Add try-catch in async push callbacks for consistent error handling
- Copy lock map before snapshot serialization to avoid UnmodifiableMap issues
- Add owner null check in LockExpireScanner to reduce unnecessary Raft submissions

* fix(lock): enforce strict FIFO in acquireLock by skipping tryLock when queue has waiters

New requests no longer acquire-then-forceRelease when the wait queue is
non-empty. Instead, acquireLock() checks hasWaiters() before calling
tryLock(), and directly enqueues non-retry requests behind existing
waiters. This eliminates the unnecessary acquire-release dance while
maintaining strict FIFO ordering.

* test(lock): add cluster JUC lock concurrency stability IT

* Format distributed lock code

* test(lock): add lock waiter retry reproduction tests

Add lock-test coverage for non-head waiterRetry acquisition and stale waiter behavior.

* fix(lock): fix lock wait queue cancellation handling

Add server-side wait cancellation for interrupted lock acquisition and cover FIFO retry/cancel paths.

* fix(lock): improve stability and edge case handling for distributed lock

- Fix ThreadLocal leak in unlock() when server exception occurs
- Fix tryLock(time,unit) interrupt/timeout server queue cleanup
- Add null-safe response parsing in LockGrpcClient
- Add closed-state guard in NacosLockService and LockGrpcClient
- Add setResultCode in LockOperationResponse factory methods
- Clear stale state on LockResult.setSuccess(true)
- Remove empty shell locks in LockExpireScanner
- Remove HashMap copy in LockExpireScanner iteration

* fix(lock): improve lock stability, fix bugs, and add unit tests

- Remove redundant lock acquisition in AbstractAtomicLock subclass methods
- Fix deadline reset bug in tryLockAsQueueHead that prevented waiter expiration
- Fix watchdog NacosException not triggering unregister
- Change LockInstance.expiredTime from Long to long to avoid NPE risk
- Fix forceRelease not clearing connectionId field
- Add unit tests for AbstractAtomicLock, LockRequestHandler, LockExpireScanner,
  LockInfo, NacosLockWatchdog, NacosLock, and NacosLockInterrupt

* Fix CI failures - spotless formatting

* fix(lock): change lock model fields from primitive to boxed types and rename waitTimeMs to waitTime

LockInstance: expiredTime long→Long, waitTimeMs→waitTime Long
LockInfo: endTime long→Long, waitTimeMs→waitTime Long
Update all callers and unit tests accordingly.

* test: improve lock coverage

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-09 10:12:53 +08:00
杨翊 SionYang 4ac3b7dcbc Add since annotations for skill subscription APIs (#15267)
* Add since annotations for skill subscription APIs

* Stabilize AI cache holder tests
2026-05-28 17:43:30 +08:00
Sunrisea 0a69ba2430 [ISSUE #15263] Refactor AgentSpec subscription to HTTP polling with 304, and add Skill subscription (#15264)
* feat(ai): refactor AgentSpec and Skill client to HTTP polling with 304

- Replace ConfigService push subscription with periodic HTTP polling on
  AgentSpec and Skill cache holders, using ETag/MD5 conditional query
  (304 Not Modified) to avoid full content transfers when unchanged
- Add server-side support for 304 conditional response on AgentSpec and
  Skill query endpoints (SkillClientController, AgentSpecClientController,
  query result + digest utils)
- Introduce SkillQueryResponse / AgentSpecQueryResponse on the client and
  corresponding query result types on the server
- Add NacosSkillEvent, AbstractNacosSkillListener, SkillChangedEvent,
  SkillListenerInvoker for skill listener notification on the client
- Fix double-event bug on initial subscribe: NacosAgentSpecCacheHolder
  and NacosSkillCacheHolder no longer publish event during initial
  subscribe; the first listener notification is delivered synchronously
  by NacosAiService to avoid racing with NotifyCenter async dispatch
- Update unit tests to reflect the new single-channel notification
  semantics on initial subscribe
- Add AgentSpecExample and SkillExample under example/ for end-to-end
  integration testing against a real Nacos server
- Update agentspec-spec and skill-spec (en + zh-cn) accordingly

* fix(ai): fix CI failures - spotless formatting and test compilation errors

- Fix spotless violations in AgentSpecExample.java and SkillExample.java (blank line indentation)
- Fix SkillClientControllerTest to use SkillClientOperationService (matches controller constructor)
- Add missing updateStorageMd5 override in AgentSpecTypeIsolationTest and AgentSpecDeletionTest
- Refactor controllers to use result.isNotModified() instead of exception-based control flow
- Add notModified field to SkillQueryResult and AgentSpecQueryResult for clean 304 handling
2026-05-28 15:40:27 +08:00
杨翊 SionYang 9136e9864f Add @Since annotations for public APIs (#15266)
* chore(build): bump project revision from 3.2.1 to 3.2.2.

* Add since annotation requirements to API specs

* Add API since annotation

* Add since annotations to SDK service APIs

* Add since annotations to core APIs

* Add since annotations to config and naming APIs

* Add since annotations to AI and lock APIs

* Add since annotations to console and plugin APIs

* Add since annotations to address APIs
2026-05-28 15:40:04 +08:00
shiyiyue1102 f2ec3defd9 feat(config): support tagv2 gray rules (#15255)
Change-Id: I61ec478a5e7bc825858ad520159a706f8db4921f
2026-05-27 10:32:15 +08:00
杨翊 SionYang d13b2b40fa [ISSUE #15183] Add AI resource import SPI models (#15190)
* [ISSUE #15183] Add AI resource import SPI models

Add the AI resource import plugin type, public import API DTOs, and plugin importer SPI/model contracts for source-based search, validate, and execute flows.

Assisted-by: Claude Code

* [ISSUE #15183] Refine AI resource import models

Remove the unsupported dependency import abstraction from the initial API and SPI contract, align importer models with Spotless formatting, and add JSON serialization coverage for the public import DTOs.

Assisted-by: Claude Code
2026-05-20 13:35:58 +08:00
sai 91269793ab [ISSUE #15142] feat(ai): support drag-and-drop zip upload and batch skill upload (#15154)
* feat(console): support drag-and-drop zip upload in skill management

Add HTML5 drag-and-drop support to both console-ui (legacy) and
console-ui-next frontends, allowing users to drag .zip files directly
onto the skill management page for upload. Key changes:

- Add page-level drag overlay with visual feedback
- Add drag event handlers with dropEffect='copy' to prevent browser
  default file-open behavior
- Add drag-and-drop to UploadSkillDialog drop zone
- Add batchUpload API method calling /upload/batch endpoint
- Show per-skill colored results (green success / red failure) in toast
- Add i18n strings for drag hints and batch upload results

* feat(ai): support batch upload skills from multi-skill zip archive

Add batch upload endpoint that accepts a zip containing multiple skill
subdirectories (each with its own SKILL.md). Returns per-skill results
with succeeded/failed lists.

- Add BatchUploadResult model in api module for cross-module access
- Add /v3/console/ai/skills/upload/batch endpoint
- Add parseMultipleSkillsFromZip to SkillZipParser
- Wire batch upload through console handler chain and maintainer-client
- Add unit tests for multi-skill zip parsing

* refactor(console): simplify batch upload toast to show per-skill results

Show a one-line summary (succeeded/failed counts) as the toast title,
with per-skill details below: green checkmarks for succeeded skills and
red crosses with failure reasons for failed ones.

* fix(ai): align resolveUploadVersion call with updated method signature

Add missing third parameter to resolveUploadVersion in batch upload path
to match the method signature change.

* feat(console): update frontend static assets for skill management UI

Rebuild console static resources with latest skill management changes
including UI refinements and removal of unused BizTagEditDialog.

* refactor(ai): improve batch upload resilience and deduplicate upload logic

- Extract doUploadSingleSkill to eliminate duplicate logic between
  uploadSkillFromZip and batchUploadSkillsFromZip
- Make parseMultipleSkillsFromZip return MultiSkillParseResult carrying
  both parsed skills and parse failures, so invalid folders don't block
  the entire batch and failures are reported to the user
- Detect sibling folders missing SKILL.md and report them as warnings
  in the batch upload result (showing only the folder name)
- Silently ignore well-known non-skill directories (.git, __MACOSX, etc.)

* style(maintainer-client): apply spotless formatting to skill upload sources

Assisted-by: Claude Code

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* style(maintainer-client): apply spotless formatting

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 14:36:37 +08:00
cxhello 49f645b28a [ISSUE #14815] build(style): align Checkstyle with Spotless and enable spotless:check in CI (#15117)
- Change lineWrappingIndentation from 0 to 4 to match continuation_indentation=1
- Change arrayInitIndent from 8 to 4 to match continuation_indentation_for_array_initializer=1
- Remove all // @formatter:off/on workarounds (no longer needed)
- Re-format modules affected by continuation_indentation_for_array_initializer change
- Add checkstyle:check and spotless:check to CI check step

Signed-off-by: cxhello <caixiaohuichn@gmail.com>
2026-05-11 10:22:17 +08:00