@kevisual/cnb 0.0.40 → 0.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent/app.ts +5 -5
- package/agent/modules/cnb-manager.ts +20 -2
- package/agent/npc.ts +94 -0
- package/agent/routes/build/docker.ts +66 -0
- package/agent/routes/build/index.ts +1 -0
- package/agent/routes/chat/chat.ts +41 -0
- package/agent/routes/index.ts +2 -0
- package/agent/routes/issues/comments.ts +177 -0
- package/agent/routes/issues/index.ts +2 -1
- package/agent/routes/issues/list.ts +35 -2
- package/agent/routes/opencode/index.ts +12 -0
- package/dist/cli.js +30601 -21685
- package/dist/keep.js +34 -16
- package/dist/opencode.js +56568 -47662
- package/dist/routes.d.ts +106 -5
- package/dist/routes.js +52900 -43995
- package/package.json +16 -11
- package/src/index.ts +14 -1
- package/src/issue/index.ts +72 -5
- package/src/issue/npc/build-env.ts +217 -0
- package/src/issue/npc/env.ts +194 -0
- package/src/issue/npc/pr-env.ts +95 -0
- package/src/issue/npc/repo-env.ts +56 -0
package/dist/routes.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QueryRouterServer } from '@kevisual/router';
|
|
2
2
|
import { Result as Result$1 } from '@kevisual/query/query';
|
|
3
3
|
import { Result as Result$2 } from '@kevisual/query';
|
|
4
|
+
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
|
|
4
5
|
|
|
5
6
|
type CNBCoreOptions<T = {}> = {
|
|
6
7
|
token: string;
|
|
@@ -512,6 +513,18 @@ type IssueLabel = {
|
|
|
512
513
|
description: string;
|
|
513
514
|
id: string;
|
|
514
515
|
name: string;
|
|
516
|
+
creator?: {
|
|
517
|
+
username: string;
|
|
518
|
+
nickname: string;
|
|
519
|
+
email: string;
|
|
520
|
+
is_npc: boolean;
|
|
521
|
+
};
|
|
522
|
+
applied_by?: {
|
|
523
|
+
username: string;
|
|
524
|
+
nickname: string;
|
|
525
|
+
email: string;
|
|
526
|
+
is_npc: boolean;
|
|
527
|
+
};
|
|
515
528
|
};
|
|
516
529
|
type IssueAuthor = {
|
|
517
530
|
name: string;
|
|
@@ -520,6 +533,21 @@ type IssueAuthor = {
|
|
|
520
533
|
created_at: string;
|
|
521
534
|
ended_at: string;
|
|
522
535
|
};
|
|
536
|
+
type IssueCommentUser = {
|
|
537
|
+
username: string;
|
|
538
|
+
nickname: string;
|
|
539
|
+
avatar: string;
|
|
540
|
+
is_npc: boolean;
|
|
541
|
+
};
|
|
542
|
+
type IssueCommentReaction = {};
|
|
543
|
+
type IssueComment = {
|
|
544
|
+
id: string;
|
|
545
|
+
body: string;
|
|
546
|
+
author: IssueCommentUser;
|
|
547
|
+
reactions: IssueCommentReaction[];
|
|
548
|
+
created_at: string;
|
|
549
|
+
updated_at: string;
|
|
550
|
+
};
|
|
523
551
|
type IssueItem = {
|
|
524
552
|
assignees: IssueAssignee[];
|
|
525
553
|
author: IssueAuthor;
|
|
@@ -536,11 +564,17 @@ type IssueItem = {
|
|
|
536
564
|
};
|
|
537
565
|
declare class Issue extends CNBCore {
|
|
538
566
|
constructor(options: CNBCoreOptions);
|
|
539
|
-
createIssue(repo: string, data: Partial<IssueItem>): Promise<
|
|
540
|
-
updateIssue(repo: string, issueNumber: string | number, data: Partial<IssueItem>): Promise<
|
|
567
|
+
createIssue(repo: string, data: Partial<IssueItem>): Promise<Result<IssueItem>>;
|
|
568
|
+
updateIssue(repo: string, issueNumber: string | number, data: Partial<IssueItem>): Promise<Result<IssueItem>>;
|
|
541
569
|
getItem(repo: string, issueNumber: string | number): Promise<Result<IssueItem>>;
|
|
542
570
|
getList(repo: string, params?: Partial<GetListParams>): Promise<Result<IssueItem[]>>;
|
|
543
|
-
getCommentList(repo: string, issueNumber: string | number
|
|
571
|
+
getCommentList(repo: string, issueNumber: string | number, params?: {
|
|
572
|
+
page?: number;
|
|
573
|
+
page_size?: number;
|
|
574
|
+
}): Promise<Result<IssueComment[]>>;
|
|
575
|
+
getComment(repo: string, issueNumber: string | number, commentId: string | number): Promise<Result<IssueComment>>;
|
|
576
|
+
createComment(repo: string, issueNumber: string | number, body: string): Promise<Result<IssueComment>>;
|
|
577
|
+
updateComment(repo: string, issueNumber: string | number, commentId: string | number, body: string): Promise<Result<IssueComment>>;
|
|
544
578
|
setIssueProperty(repo: string, issueNumber: string | number, properties: {
|
|
545
579
|
[key: string]: any;
|
|
546
580
|
}[]): Promise<any>;
|
|
@@ -551,6 +585,72 @@ declare class Issue extends CNBCore {
|
|
|
551
585
|
* @returns
|
|
552
586
|
*/
|
|
553
587
|
getAliveMetadata(repo: string, issueNumber: string | number): Promise<Result<AliveMetadata>>;
|
|
588
|
+
useNPCEnv(): {
|
|
589
|
+
npcSlug: any;
|
|
590
|
+
npcSlugLabel: string;
|
|
591
|
+
npcName: any;
|
|
592
|
+
npcNameLabel: string;
|
|
593
|
+
npcSha: any;
|
|
594
|
+
npcShaLabel: string;
|
|
595
|
+
npcPrompt: any;
|
|
596
|
+
npcPromptLabel: string;
|
|
597
|
+
npcAvatar: any;
|
|
598
|
+
npcAvatarLabel: string;
|
|
599
|
+
npcEnableThinking: any;
|
|
600
|
+
npcEnableThinkingLabel: string;
|
|
601
|
+
};
|
|
602
|
+
useCommentEnv(): {
|
|
603
|
+
commentId: any;
|
|
604
|
+
commentIdLabel: string;
|
|
605
|
+
commentBody: any;
|
|
606
|
+
commentBodyLabel: string;
|
|
607
|
+
commentType: any;
|
|
608
|
+
commentTypeLabel: string;
|
|
609
|
+
commentFilePath: any;
|
|
610
|
+
commentFilePathLabel: string;
|
|
611
|
+
commentRange: any;
|
|
612
|
+
commentRangeLabel: string;
|
|
613
|
+
reviewId: any;
|
|
614
|
+
reviewIdLabel: string;
|
|
615
|
+
};
|
|
616
|
+
usePullRequestEnv(): {
|
|
617
|
+
pullRequest: any;
|
|
618
|
+
pullRequestLabel: string;
|
|
619
|
+
pullRequestLike: any;
|
|
620
|
+
pullRequestLikeLabel: string;
|
|
621
|
+
pullRequestProposer: any;
|
|
622
|
+
pullRequestProposerLabel: string;
|
|
623
|
+
pullRequestTitle: any;
|
|
624
|
+
pullRequestTitleLabel: string;
|
|
625
|
+
pullRequestBranch: any;
|
|
626
|
+
pullRequestBranchLabel: string;
|
|
627
|
+
pullRequestSha: any;
|
|
628
|
+
pullRequestShaLabel: string;
|
|
629
|
+
pullRequestTargetSha: any;
|
|
630
|
+
pullRequestTargetShaLabel: string;
|
|
631
|
+
pullRequestMergeSha: any;
|
|
632
|
+
pullRequestMergeShaLabel: string;
|
|
633
|
+
pullRequestSlug: any;
|
|
634
|
+
pullRequestSlugLabel: string;
|
|
635
|
+
pullRequestAction: any;
|
|
636
|
+
pullRequestActionLabel: string;
|
|
637
|
+
pullRequestId: any;
|
|
638
|
+
pullRequestIdLabel: string;
|
|
639
|
+
};
|
|
640
|
+
useRepoInfoEnv(): {
|
|
641
|
+
repoSlug: any;
|
|
642
|
+
repoSlugLabel: string;
|
|
643
|
+
repoSlugLowercase: any;
|
|
644
|
+
repoSlugLowercaseLabel: string;
|
|
645
|
+
repoName: any;
|
|
646
|
+
repoNameLabel: string;
|
|
647
|
+
repoNameLowercase: any;
|
|
648
|
+
repoNameLowercaseLabel: string;
|
|
649
|
+
repoId: any;
|
|
650
|
+
repoIdLabel: string;
|
|
651
|
+
repoUrlHttps: any;
|
|
652
|
+
repoUrlHttpsLabel: string;
|
|
653
|
+
};
|
|
554
654
|
}
|
|
555
655
|
type GetListParams = {
|
|
556
656
|
/** 问题指派人名称,例如: 张三, 李四, -; - 表示不指派给任何人 */
|
|
@@ -748,6 +848,7 @@ type CNBItem = {
|
|
|
748
848
|
runAt?: number;
|
|
749
849
|
owner?: boolean;
|
|
750
850
|
cnb: CNB;
|
|
851
|
+
cnbAi: ReturnType<typeof createOpenAICompatible>;
|
|
751
852
|
};
|
|
752
853
|
declare class CNBManager {
|
|
753
854
|
cnbMap: Map<string, CNBItem>;
|
|
@@ -763,16 +864,16 @@ declare class CNBManager {
|
|
|
763
864
|
* @returns CNB 实例
|
|
764
865
|
*/
|
|
765
866
|
getContext(ctx: any): Promise<CNB>;
|
|
867
|
+
getCNBItem(ctx: any): Promise<CNBItem>;
|
|
766
868
|
addCNB(opts: Partial<CNBItem>): CNBItem;
|
|
767
869
|
clearExpiredCNB(expireTime?: number): void;
|
|
768
870
|
clearUsername(username: string): void;
|
|
769
871
|
}
|
|
770
872
|
|
|
771
873
|
declare const cnbManager: CNBManager;
|
|
772
|
-
declare const cnb: CNB;
|
|
773
874
|
declare const app: QueryRouterServer<{
|
|
774
875
|
[x: string]: any;
|
|
775
876
|
}>;
|
|
776
877
|
declare const notCNBCheck: (ctx: any) => boolean;
|
|
777
878
|
|
|
778
|
-
export { app,
|
|
879
|
+
export { app, cnbManager, notCNBCheck };
|