|
1 | | -package io.github.hiwepy.opencode; |
| 1 | +package io.github.easy4j.opencode; |
2 | 2 |
|
3 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; |
4 | | -import io.github.hiwepy.opencode.api.mapper.ChatMessageMapper; |
5 | | -import io.github.hiwepy.opencode.api.model.*; |
6 | | -import io.github.hiwepy.opencode.cli.OpenCodeCli; |
7 | | -import io.github.hiwepy.opencode.cli.OpenCodeCliExecutor; |
8 | | -import io.github.hiwepy.opencode.api.OpenCodeHttpClient; |
9 | | -import io.github.hiwepy.opencode.api.OpenCodeRequestContext; |
10 | | -import io.github.hiwepy.opencode.api.OpenCodeSseClient; |
| 4 | +import io.github.easy4j.opencode.api.mapper.ChatMessageMapper; |
| 5 | +import io.github.easy4j.opencode.api.model.*; |
| 6 | +import io.github.easy4j.opencode.cli.OpenCodeCli; |
| 7 | +import io.github.easy4j.opencode.cli.OpenCodeCliExecutor; |
| 8 | +import io.github.easy4j.opencode.api.OpenCodeHttpClient; |
| 9 | +import io.github.easy4j.opencode.api.OpenCodeRequestContext; |
| 10 | +import io.github.easy4j.opencode.api.OpenCodeSseClient; |
11 | 11 | import okhttp3.OkHttpClient; |
12 | 12 |
|
13 | 13 | import java.util.List; |
@@ -164,7 +164,7 @@ public PromptResult chatCompletion(String sessionId, String text, String provide |
164 | 164 | * <p>底层基于会话模型(ensureSession + prompt),对外封装为与 Hermes/OpenClaw 对称的 |
165 | 165 | * {@code chatCompletionWithSession} 接口。sessionKey 同时作为 session 的 title, |
166 | 166 | * {@code ensureSession} 保证 session 存在(不存在则创建)。 |
167 | | - * 建议用 {@link io.github.hiwepy.opencode.api.OpenCodeSessionKeys} 生成 sessionKey。</p> |
| 167 | + * 建议用 {@link io.github.easy4j.opencode.api.OpenCodeSessionKeys} 生成 sessionKey。</p> |
168 | 168 | * |
169 | 169 | * @param request prompt 请求 |
170 | 170 | * @param sessionKey 会话复用 key |
@@ -423,20 +423,20 @@ public OpenCodeSseClient eventStream() { |
423 | 423 | } |
424 | 424 |
|
425 | 425 | /** |
426 | | - * 订阅指定 session 的事件,使用类型化 {@link io.github.hiwepy.opencode.api.event.EventHandler}。 |
| 426 | + * 订阅指定 session 的事件,使用类型化 {@link io.github.easy4j.opencode.api.event.EventHandler}。 |
427 | 427 | * |
428 | 428 | * @return EventSource,可调用 cancel() 停止订阅 |
429 | 429 | */ |
430 | 430 | public okhttp3.sse.EventSource onSessionEvent(String sessionId, |
431 | | - io.github.hiwepy.opencode.api.event.EventHandler handler) { |
| 431 | + io.github.easy4j.opencode.api.event.EventHandler handler) { |
432 | 432 | return sseClient.subscribeHandler(sessionId, handler); |
433 | 433 | } |
434 | 434 |
|
435 | 435 | /** |
436 | 436 | * 订阅全局事件流(不按 session 过滤),使用类型化 handler。 |
437 | 437 | */ |
438 | 438 | public okhttp3.sse.EventSource onEvent( |
439 | | - io.github.hiwepy.opencode.api.event.EventHandler handler) { |
| 439 | + io.github.easy4j.opencode.api.event.EventHandler handler) { |
440 | 440 | return sseClient.subscribeHandler(null, handler); |
441 | 441 | } |
442 | 442 |
|
@@ -714,167 +714,167 @@ public boolean globalUpgrade(String target) { |
714 | 714 | // CLI facade(cliServe、cliWeb 等是新增的便捷别名,与 cli().serve() 等价) |
715 | 715 | // ============================================================ |
716 | 716 |
|
717 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliServe() { |
| 717 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliServe() { |
718 | 718 | return cli.serve(null, null); |
719 | 719 | } |
720 | 720 |
|
721 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliServe(Integer port, String hostname) { |
| 721 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliServe(Integer port, String hostname) { |
722 | 722 | return cli.serve(port, hostname); |
723 | 723 | } |
724 | 724 |
|
725 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliWeb() { |
| 725 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliWeb() { |
726 | 726 | return cli.web(null, null); |
727 | 727 | } |
728 | 728 |
|
729 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliWeb(Integer port, String hostname) { |
| 729 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliWeb(Integer port, String hostname) { |
730 | 730 | return cli.web(port, hostname); |
731 | 731 | } |
732 | 732 |
|
733 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliAcp(String cwd) { |
| 733 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliAcp(String cwd) { |
734 | 734 | return cli.acp(cwd); |
735 | 735 | } |
736 | 736 |
|
737 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliGenerate() { |
| 737 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliGenerate() { |
738 | 738 | return cli.generate(); |
739 | 739 | } |
740 | 740 |
|
741 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliAttach(String url, String dir, |
| 741 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliAttach(String url, String dir, |
742 | 742 | String sessionId, |
743 | 743 | String username, String password) { |
744 | 744 | return cli.attach(url, dir, sessionId, username, password); |
745 | 745 | } |
746 | 746 |
|
747 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliUpgrade() { |
| 747 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliUpgrade() { |
748 | 748 | return cli.upgrade(); |
749 | 749 | } |
750 | 750 |
|
751 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliUpgrade(String target, String method) { |
| 751 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliUpgrade(String target, String method) { |
752 | 752 | return cli.upgrade(target, method); |
753 | 753 | } |
754 | 754 |
|
755 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliUninstall(boolean keepConfig, |
| 755 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliUninstall(boolean keepConfig, |
756 | 756 | boolean keepData, |
757 | 757 | boolean dryRun, |
758 | 758 | boolean force) { |
759 | 759 | return cli.uninstall(keepConfig, keepData, dryRun, force); |
760 | 760 | } |
761 | 761 |
|
762 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliStats() { |
| 762 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliStats() { |
763 | 763 | return cli.stats(null, null, null, null); |
764 | 764 | } |
765 | 765 |
|
766 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliStats(Integer days, Integer tools, |
| 766 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliStats(Integer days, Integer tools, |
767 | 767 | Integer models, String project) { |
768 | 768 | return cli.stats(days, tools, models, project); |
769 | 769 | } |
770 | 770 |
|
771 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliExport(String sessionId, boolean sanitize) { |
| 771 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliExport(String sessionId, boolean sanitize) { |
772 | 772 | return cli.export(sessionId, sanitize); |
773 | 773 | } |
774 | 774 |
|
775 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliImport(String fileOrUrl) { |
| 775 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliImport(String fileOrUrl) { |
776 | 776 | return cli.importSession(fileOrUrl); |
777 | 777 | } |
778 | 778 |
|
779 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliSessionList() { |
| 779 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliSessionList() { |
780 | 780 | return cli.sessionList(); |
781 | 781 | } |
782 | 782 |
|
783 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliSessionList(int maxCount) { |
| 783 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliSessionList(int maxCount) { |
784 | 784 | return cli.sessionList(maxCount); |
785 | 785 | } |
786 | 786 |
|
787 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliAgentList() { |
| 787 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliAgentList() { |
788 | 788 | return cli.agentList(); |
789 | 789 | } |
790 | 790 |
|
791 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliAgentCreate(String path, |
| 791 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliAgentCreate(String path, |
792 | 792 | String description, |
793 | 793 | String mode, |
794 | 794 | String permissions, |
795 | 795 | String model) { |
796 | 796 | return cli.agentCreate(path, description, mode, permissions, model); |
797 | 797 | } |
798 | 798 |
|
799 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliModels() { |
| 799 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliModels() { |
800 | 800 | return cli.models(); |
801 | 801 | } |
802 | 802 |
|
803 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliModels(String provider, boolean verbose, |
| 803 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliModels(String provider, boolean verbose, |
804 | 804 | boolean refresh) { |
805 | 805 | return cli.models(provider, verbose, refresh); |
806 | 806 | } |
807 | 807 |
|
808 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliProvidersList() { |
| 808 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliProvidersList() { |
809 | 809 | return cli.providersList(); |
810 | 810 | } |
811 | 811 |
|
812 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliProvidersLogin(String provider, |
| 812 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliProvidersLogin(String provider, |
813 | 813 | String method) { |
814 | 814 | return cli.providersLogin(provider, method); |
815 | 815 | } |
816 | 816 |
|
817 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliProvidersLogout(String provider) { |
| 817 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliProvidersLogout(String provider) { |
818 | 818 | return cli.providersLogout(provider); |
819 | 819 | } |
820 | 820 |
|
821 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliAuthList() { |
| 821 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliAuthList() { |
822 | 822 | return cli.authList(); |
823 | 823 | } |
824 | 824 |
|
825 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliAuthLogin(String provider, String method) { |
| 825 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliAuthLogin(String provider, String method) { |
826 | 826 | return cli.authLogin(provider, method); |
827 | 827 | } |
828 | 828 |
|
829 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliAuthLogout(String provider) { |
| 829 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliAuthLogout(String provider) { |
830 | 830 | return cli.authLogout(provider); |
831 | 831 | } |
832 | 832 |
|
833 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliMcpList() { |
| 833 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliMcpList() { |
834 | 834 | return cli.mcpList(); |
835 | 835 | } |
836 | 836 |
|
837 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliMcpAdd(String name, String url) { |
| 837 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliMcpAdd(String name, String url) { |
838 | 838 | return cli.mcpAdd(name, url); |
839 | 839 | } |
840 | 840 |
|
841 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliMcpLogout(String name) { |
| 841 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliMcpLogout(String name) { |
842 | 842 | return cli.mcpLogout(name); |
843 | 843 | } |
844 | 844 |
|
845 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliMcpAuth(String name) { |
| 845 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliMcpAuth(String name) { |
846 | 846 | return cli.mcpAuth(name); |
847 | 847 | } |
848 | 848 |
|
849 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliDb(String query, String format) { |
| 849 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliDb(String query, String format) { |
850 | 850 | return cli.db(query, format); |
851 | 851 | } |
852 | 852 |
|
853 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliDbPath() { |
| 853 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliDbPath() { |
854 | 854 | return cli.dbPath(); |
855 | 855 | } |
856 | 856 |
|
857 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliDebugConfig() { |
| 857 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliDebugConfig() { |
858 | 858 | return cli.debugConfig(); |
859 | 859 | } |
860 | 860 |
|
861 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliDebugPaths() { |
| 861 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliDebugPaths() { |
862 | 862 | return cli.debugPaths(); |
863 | 863 | } |
864 | 864 |
|
865 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliDebugInfo() { |
| 865 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliDebugInfo() { |
866 | 866 | return cli.debugInfo(); |
867 | 867 | } |
868 | 868 |
|
869 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliGithubInstall() { |
| 869 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliGithubInstall() { |
870 | 870 | return cli.githubInstall(); |
871 | 871 | } |
872 | 872 |
|
873 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliGithubRun(String event, String token) { |
| 873 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliGithubRun(String event, String token) { |
874 | 874 | return cli.githubRun(event, token); |
875 | 875 | } |
876 | 876 |
|
877 | | - public io.github.hiwepy.opencode.cli.OpenCodeCliResult cliPr(int number) { |
| 877 | + public io.github.easy4j.opencode.cli.OpenCodeCliResult cliPr(int number) { |
878 | 878 | return cli.pr(number); |
879 | 879 | } |
880 | 880 |
|
|
0 commit comments