diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cc4f07cf..cf0c8fff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,10 @@ name: Release to Maven Central # Publishes workflow-engine and spring-boot-starter to Maven Central. -# Trigger: push a version tag — `git tag v0.1.0 && git push origin v0.1.0`. -# Normal CI (branch pushes and PRs) is unaffected: this workflow only runs on v* tags. -# workflow_dispatch runs everything except the upload, for a dry run. +# Trigger: push a version tag whose commit is on the protected main branch: +# git tag v0.1.0 && git push origin v0.1.0 +# Tags on other branches are rejected. workflow_dispatch runs everything except the +# tag-gated steps, providing a real dry run without requiring secrets. # # One-time setup (required before the first release can succeed): # 1. Central Portal account: https://central.sonatype.com (register, then generate a @@ -21,8 +22,10 @@ name: Release to Maven Central # SIGNING_KEY_ID key id (last 8 hex chars is enough) # SIGNING_PASSWORD private key passphrase # -# Scope note: only workflow-engine and spring-boot-starter are deployed. samples is -# excluded via maven.deploy.skip and depends on a vendor jar not available on Central. +# Publishing scope: only workflow-engine and spring-boot-starter are deployed. +# samples is excluded from deployment via maven.deploy.skip, but the release gate still +# builds and tests the full main reactor (main has no vendor-jar dependency; the Eastcom +# adapter exists only on the dev branch). on: push: @@ -39,10 +42,27 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout + - name: Checkout (full history for tag ancestry validation) uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Validate release tag + if: startsWith(github.ref, 'refs/tags/v') + shell: bash + run: | + VERSION="${GITHUB_REF_NAME#v}" + if ! [[ "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9.-]+)?$ ]]; then + echo "Tag must be vX.Y.Z (got: ${GITHUB_REF_NAME})"; exit 1 + fi + git fetch origin +refs/heads/main:refs/remotes/origin/main + if ! git merge-base --is-ancestor "${GITHUB_SHA}" refs/remotes/origin/main; then + echo "Tag ${GITHUB_REF_NAME} points at a commit that is not on the protected main branch" + exit 1 + fi - name: Validate release secrets + if: startsWith(github.ref, 'refs/tags/v') shell: bash env: MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} @@ -69,6 +89,7 @@ jobs: SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - name: Configure Maven servers + if: startsWith(github.ref, 'refs/tags/v') shell: bash env: MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} @@ -87,8 +108,20 @@ jobs: EOF - - name: Verify - run: mvn -B clean verify -pl workflow-engine,spring-boot-starter -am + - name: Verify (full reactor, release gate) + run: mvn -B clean verify + + - name: Assert artifact license content + if: startsWith(github.ref, 'refs/tags/v') + shell: bash + run: | + for module in workflow-engine spring-boot-starter; do + jar=$(ls ${module}/target/*.jar | grep -v -E 'sources|javadoc' | head -1) + if [ -z "$jar" ]; then echo "no binary jar found for ${module}"; exit 1; fi + unzip -l "$jar" | grep -q "META-INF/LICENSE" || { echo "$jar is missing META-INF/LICENSE"; exit 1; } + unzip -l "$jar" | grep -q "META-INF/NOTICE" || { echo "$jar is missing META-INF/NOTICE"; exit 1; } + done + echo "License and notice files present in all publishable jars" - name: Publish if: startsWith(github.ref, 'refs/tags/v') @@ -98,12 +131,9 @@ jobs: MAVEN_GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSWORD }} run: | VERSION="${GITHUB_REF_NAME#v}" - if ! [[ "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9.-]+)?$ ]]; then - echo "Tag must be vX.Y.Z (got: ${GITHUB_REF_NAME})"; exit 1 - fi echo "Publishing version ${VERSION} from tag ${GITHUB_REF_NAME}" mvn -B -Prelease deploy \ - -pl workflow-engine,spring-boot-starter -am \ + -pl workflow-engine,spring-boot-starter \ -Drevision="${VERSION}" \ -Dgpg.executable=gpg \ -Dgpg.keyname="${SIGNING_KEY_ID}" diff --git a/LICENSE b/LICENSE index ce0ce848..261eeb9e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,8 +1,192 @@ - Apache License + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ - Copyright 2026 Huawei Technologies Co., Ltd. + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/NOTICE b/NOTICE new file mode 100644 index 00000000..ae730df2 --- /dev/null +++ b/NOTICE @@ -0,0 +1,5 @@ +workflow-engine-sdk-java +Copyright 2026 Huawei Technologies Co., Ltd. + +This product includes software developed as part of the OpenAN project +(https://github.com/project-openan). diff --git a/docs/en/API_REFERENCE.md b/docs/en/API_REFERENCE.md index f3db72c7..64823920 100644 --- a/docs/en/API_REFERENCE.md +++ b/docs/en/API_REFERENCE.md @@ -310,9 +310,9 @@ Override to receive real-time execution events. Event types are defined in `Even | `NEGOTIATION_REQUEST` | Agent requested negotiation (INPUT_REQUIRED) | | `NEGOTIATION_RESOLVED` | Clarification was sent to agent | | `NEGOTIATION_FAILED` | Negotiation could not be resolved | -| `AUTHORIZATION_REQUEST` | Agent requested authorization | -| `AUTHORIZATION_RESOLVED` | Authorization decision was made | -| `NOTIFICATION` | Notification received from agent | +| `AUTHORIZATION_REQUEST` | Reserved; not currently emitted (authorization results arrive via the `ExtensionSender` future) | +| `AUTHORIZATION_RESOLVED` | Reserved; not currently emitted | +| `NOTIFICATION` | Reserved; not currently emitted (subscription events arrive via the `NotificationSubscription` callback) | | `ROUTE_DECISION` | Route decision was made | | `WORKFLOW_COMPLETE` | DAG scheduling ended; check success, not all nodes necessarily ran | | `START` | Workflow execution started | diff --git a/docs/zh/API_REFERENCE.md b/docs/zh/API_REFERENCE.md index c69dbf6d..749c06cc 100644 --- a/docs/zh/API_REFERENCE.md +++ b/docs/zh/API_REFERENCE.md @@ -296,9 +296,9 @@ public class EventCallback { | `NEGOTIATION_REQUEST` | 智能体请求协商 | | `NEGOTIATION_RESOLVED` | 补充信息已发送 | | `NEGOTIATION_FAILED` | 协商无法解决 | -| `AUTHORIZATION_REQUEST` | 智能体请求授权 | -| `AUTHORIZATION_RESOLVED` | 授权决策已做出 | -| `NOTIFICATION` | 收到智能体通知 | +| `AUTHORIZATION_REQUEST` | 保留;当前不上报(授权结果经 `ExtensionSender` 返回) | +| `AUTHORIZATION_RESOLVED` | 保留;当前不上报 | +| `NOTIFICATION` | 保留;当前不上报(订阅事件经 `NotificationSubscription` 回调送达) | | `ROUTE_DECISION` | 路由决策已做出 | | `WORKFLOW_COMPLETE` | DAG 调度结束,需检查 success;不代表全部节点成功执行 | | `START` | 工作流执行开始 | diff --git a/docs/zh/DESIGN.md b/docs/zh/DESIGN.md index a4aae8f8..ff98787e 100644 --- a/docs/zh/DESIGN.md +++ b/docs/zh/DESIGN.md @@ -192,7 +192,7 @@ Authorization-T 和 Notification-T 是独立业务操作,不属于 DAG。宿 ## 7. 事件模型 -事件通过可选的 `EventCallback` 以稳定字符串类型(`EventType`)发射,按来源分组: +事件通过可选的 `EventCallback` 以稳定字符串类型(`EventType`)上报,按来源分组: - **运行器生命周期** — `start`、`complete`、`close` - **步骤/任务执行** — `step_start`、`step_complete`、`task_request`、`task_response`、 @@ -200,10 +200,10 @@ Authorization-T 和 Notification-T 是独立业务操作,不属于 DAG。宿 - **智能体流量** — `agent_request`、`agent_response`、`agent_status_update`、 `agent_artifact_update`、`agent_message_event` - **工作流内 A2A-T 扩展** — `negotiation_request`、`negotiation_resolved`、`negotiation_failed` -- **失败** — `error`,由执行器在步骤失败时和运行器在最终失败时发射 +- **失败** — `error`,由执行器在步骤失败时和运行器在最终失败时上报 `authorization_request`、`authorization_resolved` 和 `notification` 目前只是 `EventType` 中的保留常量, -工作流事件流不会发射它们。独立授权结果由 `ExtensionSender` 的返回值处理,订阅事件由 +工作流事件流不会上报这些事件。独立授权结果由 `ExtensionSender` 的返回值处理,订阅事件由 `NotificationSubscription` 回调处理。 --- diff --git a/pom.xml b/pom.xml index 0ad0697c..da7628ad 100644 --- a/pom.xml +++ b/pom.xml @@ -57,8 +57,8 @@ 1.1.0 1.18.38 - 2.21.1 - 2.0.17 + 2.22.0 + 2.0.18 5.10.2 2.24.3 3.3.10 @@ -89,6 +89,22 @@ + + + + src/main/resources + + + ${maven.multiModuleProjectDirectory} + + LICENSE + NOTICE + + META-INF + + @@ -112,7 +128,7 @@ ${maven.javadoc.plugin.version} none - false + true true @@ -125,6 +141,24 @@ + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-dependency-convergence + + enforce + + + + + + + + + org.codehaus.mojo flatten-maven-plugin diff --git a/workflow-engine/src/main/java/dev/openan/workflow/engine/client/A2ATransport.java b/workflow-engine/src/main/java/dev/openan/workflow/engine/client/A2ATransport.java index ba58ba5d..b3b9ca06 100644 --- a/workflow-engine/src/main/java/dev/openan/workflow/engine/client/A2ATransport.java +++ b/workflow-engine/src/main/java/dev/openan/workflow/engine/client/A2ATransport.java @@ -64,10 +64,10 @@ * the low-level layer over which two single-responsibility facades sit: * *
    - *
  • {@link DefaultWorkflowEngineClient} -- workflow execution path (Task-T prompt generation, - * Negotiation-T auto-loop, extension handlers, event callback, control point). - *
  • {@link DefaultExtensionSender} -- Authorization-T requests and Notification-T - * subscriptions. + *
  • {@link DefaultWorkflowEngineClient} -- workflow execution path (task dispatch, negotiation + * correlation and reply validation, event callback, control point). + *
  • {@link DefaultExtensionSender} -- sending host-generated Authorization-T requests and + * observing Notification-T subscriptions. *
* * Neither facade duplicates transport code; both delegate here. @@ -394,12 +394,7 @@ private static String taskState(Task task) { : null; } - /** - * Long-lived SSE stream for Notification-T subscription. Opens a daemon thread that keeps the SSE - * response stream open. The eventSink callback processes events in real-time (subscribed ack + - * later recovery results). The returned future completes on the first event carrying a concrete - * task state; an artifact alone is application data, not a protocol acknowledgement. - */ + /** Returns the loaded AgentCard for the given agent name. */ public AgentCard getCard(String agentName) { return cardMap.get(agentName); } @@ -533,7 +528,12 @@ public void closeConversation(AgentCard agentCard, String contextId) { } } - /** Opens a long-lived Notification-T stream and returns its explicit lifecycle handle. */ + /** + * Long-lived SSE stream for Notification-T subscription. Opens a daemon thread that keeps the + * SSE response stream open. The eventSink callback processes events in real-time (subscribed ack + * + later recovery results). The returned future completes on the first event carrying a + * concrete task state; an artifact alone is application data, not a protocol acknowledgement. + */ public NotificationSubscription openNotificationStream( AgentCard agentCard, String agentName,