@kevisual/cnb 0.0.42 → 0.0.44
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 -4
- package/agent/modules/cnb-manager.ts +22 -2
- package/agent/npc.ts +94 -0
- package/agent/routes/chat/chat.ts +41 -0
- package/agent/routes/cnb-manager/index.ts +3 -2
- package/agent/routes/index.ts +1 -0
- package/agent/routes/issues/comments.ts +14 -4
- package/agent/routes/issues/list.ts +33 -0
- package/agent/routes/opencode/index.ts +12 -0
- package/dist/cli.js +30522 -21934
- package/dist/keep.js +14 -14
- package/dist/opencode.js +48222 -39644
- package/dist/routes.d.ts +53 -4
- package/dist/routes.js +30393 -21816
- package/package.json +17 -12
- package/readme.md +1 -0
- package/src/issue/index.ts +14 -3
- package/src/issue/npc/build-env.ts +217 -0
- package/src/issue/npc/env.ts +73 -296
- package/src/issue/npc/pr-env.ts +95 -0
- package/src/issue/npc/repo-env.ts +56 -0
- package/src/repo/index.ts +14 -1
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;
|
|
@@ -281,6 +282,12 @@ declare class Repo extends CNBCore {
|
|
|
281
282
|
createRepo(data: CreateRepoData): Promise<any>;
|
|
282
283
|
deleteRepoCookie(repo: string): Promise<any>;
|
|
283
284
|
deleteRepo(repo: string): Promise<any>;
|
|
285
|
+
/**
|
|
286
|
+
* 使用cookie创建提交,如果没有指定parent_commit_sha,则会自动获取最新的提交作为父提交
|
|
287
|
+
* @param repo
|
|
288
|
+
* @param data
|
|
289
|
+
* @returns
|
|
290
|
+
*/
|
|
284
291
|
createCommit(repo: string, data: CreateCommitData): Promise<any>;
|
|
285
292
|
createBlobs(repo: string, data: {
|
|
286
293
|
content: string;
|
|
@@ -512,6 +519,18 @@ type IssueLabel = {
|
|
|
512
519
|
description: string;
|
|
513
520
|
id: string;
|
|
514
521
|
name: string;
|
|
522
|
+
creator?: {
|
|
523
|
+
username: string;
|
|
524
|
+
nickname: string;
|
|
525
|
+
email: string;
|
|
526
|
+
is_npc: boolean;
|
|
527
|
+
};
|
|
528
|
+
applied_by?: {
|
|
529
|
+
username: string;
|
|
530
|
+
nickname: string;
|
|
531
|
+
email: string;
|
|
532
|
+
is_npc: boolean;
|
|
533
|
+
};
|
|
515
534
|
};
|
|
516
535
|
type IssueAuthor = {
|
|
517
536
|
name: string;
|
|
@@ -551,8 +570,8 @@ type IssueItem = {
|
|
|
551
570
|
};
|
|
552
571
|
declare class Issue extends CNBCore {
|
|
553
572
|
constructor(options: CNBCoreOptions);
|
|
554
|
-
createIssue(repo: string, data: Partial<IssueItem>): Promise<
|
|
555
|
-
updateIssue(repo: string, issueNumber: string | number, data: Partial<IssueItem>): Promise<
|
|
573
|
+
createIssue(repo: string, data: Partial<IssueItem>): Promise<Result<IssueItem>>;
|
|
574
|
+
updateIssue(repo: string, issueNumber: string | number, data: Partial<IssueItem>): Promise<Result<IssueItem>>;
|
|
556
575
|
getItem(repo: string, issueNumber: string | number): Promise<Result<IssueItem>>;
|
|
557
576
|
getList(repo: string, params?: Partial<GetListParams>): Promise<Result<IssueItem[]>>;
|
|
558
577
|
getCommentList(repo: string, issueNumber: string | number, params?: {
|
|
@@ -574,40 +593,69 @@ declare class Issue extends CNBCore {
|
|
|
574
593
|
getAliveMetadata(repo: string, issueNumber: string | number): Promise<Result<AliveMetadata>>;
|
|
575
594
|
useNPCEnv(): {
|
|
576
595
|
npcSlug: any;
|
|
596
|
+
npcSlugLabel: string;
|
|
577
597
|
npcName: any;
|
|
598
|
+
npcNameLabel: string;
|
|
578
599
|
npcSha: any;
|
|
600
|
+
npcShaLabel: string;
|
|
579
601
|
npcPrompt: any;
|
|
602
|
+
npcPromptLabel: string;
|
|
580
603
|
npcAvatar: any;
|
|
604
|
+
npcAvatarLabel: string;
|
|
581
605
|
npcEnableThinking: any;
|
|
606
|
+
npcEnableThinkingLabel: string;
|
|
582
607
|
};
|
|
583
608
|
useCommentEnv(): {
|
|
584
609
|
commentId: any;
|
|
610
|
+
commentIdLabel: string;
|
|
585
611
|
commentBody: any;
|
|
612
|
+
commentBodyLabel: string;
|
|
586
613
|
commentType: any;
|
|
614
|
+
commentTypeLabel: string;
|
|
587
615
|
commentFilePath: any;
|
|
616
|
+
commentFilePathLabel: string;
|
|
588
617
|
commentRange: any;
|
|
618
|
+
commentRangeLabel: string;
|
|
589
619
|
reviewId: any;
|
|
620
|
+
reviewIdLabel: string;
|
|
590
621
|
};
|
|
591
622
|
usePullRequestEnv(): {
|
|
592
623
|
pullRequest: any;
|
|
624
|
+
pullRequestLabel: string;
|
|
593
625
|
pullRequestLike: any;
|
|
626
|
+
pullRequestLikeLabel: string;
|
|
594
627
|
pullRequestProposer: any;
|
|
628
|
+
pullRequestProposerLabel: string;
|
|
595
629
|
pullRequestTitle: any;
|
|
630
|
+
pullRequestTitleLabel: string;
|
|
596
631
|
pullRequestBranch: any;
|
|
632
|
+
pullRequestBranchLabel: string;
|
|
597
633
|
pullRequestSha: any;
|
|
634
|
+
pullRequestShaLabel: string;
|
|
598
635
|
pullRequestTargetSha: any;
|
|
636
|
+
pullRequestTargetShaLabel: string;
|
|
599
637
|
pullRequestMergeSha: any;
|
|
638
|
+
pullRequestMergeShaLabel: string;
|
|
600
639
|
pullRequestSlug: any;
|
|
640
|
+
pullRequestSlugLabel: string;
|
|
601
641
|
pullRequestAction: any;
|
|
642
|
+
pullRequestActionLabel: string;
|
|
602
643
|
pullRequestId: any;
|
|
644
|
+
pullRequestIdLabel: string;
|
|
603
645
|
};
|
|
604
646
|
useRepoInfoEnv(): {
|
|
605
647
|
repoSlug: any;
|
|
648
|
+
repoSlugLabel: string;
|
|
606
649
|
repoSlugLowercase: any;
|
|
650
|
+
repoSlugLowercaseLabel: string;
|
|
607
651
|
repoName: any;
|
|
652
|
+
repoNameLabel: string;
|
|
608
653
|
repoNameLowercase: any;
|
|
654
|
+
repoNameLowercaseLabel: string;
|
|
609
655
|
repoId: any;
|
|
656
|
+
repoIdLabel: string;
|
|
610
657
|
repoUrlHttps: any;
|
|
658
|
+
repoUrlHttpsLabel: string;
|
|
611
659
|
};
|
|
612
660
|
}
|
|
613
661
|
type GetListParams = {
|
|
@@ -806,6 +854,7 @@ type CNBItem = {
|
|
|
806
854
|
runAt?: number;
|
|
807
855
|
owner?: boolean;
|
|
808
856
|
cnb: CNB;
|
|
857
|
+
cnbAi: ReturnType<typeof createOpenAICompatible>;
|
|
809
858
|
};
|
|
810
859
|
declare class CNBManager {
|
|
811
860
|
cnbMap: Map<string, CNBItem>;
|
|
@@ -821,16 +870,16 @@ declare class CNBManager {
|
|
|
821
870
|
* @returns CNB 实例
|
|
822
871
|
*/
|
|
823
872
|
getContext(ctx: any): Promise<CNB>;
|
|
873
|
+
getCNBItem(ctx: any): Promise<CNBItem>;
|
|
824
874
|
addCNB(opts: Partial<CNBItem>): CNBItem;
|
|
825
875
|
clearExpiredCNB(expireTime?: number): void;
|
|
826
876
|
clearUsername(username: string): void;
|
|
827
877
|
}
|
|
828
878
|
|
|
829
879
|
declare const cnbManager: CNBManager;
|
|
830
|
-
declare const cnb: CNB;
|
|
831
880
|
declare const app: QueryRouterServer<{
|
|
832
881
|
[x: string]: any;
|
|
833
882
|
}>;
|
|
834
883
|
declare const notCNBCheck: (ctx: any) => boolean;
|
|
835
884
|
|
|
836
|
-
export { app,
|
|
885
|
+
export { app, cnbManager, notCNBCheck };
|