@opensumi/ide-core-common 3.3.1-next-1725521190.0 → 3.3.1
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/lib/node/index.d.ts +2 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +5 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/utils.d.ts +13 -0
- package/lib/node/utils.d.ts.map +1 -0
- package/lib/node/utils.js +51 -0
- package/lib/node/utils.js.map +1 -0
- package/lib/types/ai-native/reporter.d.ts +33 -0
- package/lib/types/ai-native/reporter.d.ts.map +1 -1
- package/lib/types/ai-native/reporter.js +45 -1
- package/lib/types/ai-native/reporter.js.map +1 -1
- package/package.json +4 -4
- package/src/node/index.ts +1 -0
- package/src/node/utils.ts +51 -0
- package/src/types/ai-native/reporter.ts +61 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* modified from: https://github.com/mhart/epipebomb
|
|
4
|
+
*
|
|
5
|
+
* support EIO
|
|
6
|
+
*/
|
|
7
|
+
export declare function epipeBomb(stream: NodeJS.WriteStream, callback: (code?: number) => void): void;
|
|
8
|
+
/**
|
|
9
|
+
* 参考:https://github.com/camunda/camunda-modeler/pull/3314
|
|
10
|
+
* fix(app): suppress EPIPE errors for app output
|
|
11
|
+
*/
|
|
12
|
+
export declare function suppressNodeJSEpipeError(_process: NodeJS.Process, error: (msg: string) => void): void;
|
|
13
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/node/utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,QA0BtF;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,QAa9F"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.suppressNodeJSEpipeError = exports.epipeBomb = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* modified from: https://github.com/mhart/epipebomb
|
|
6
|
+
*
|
|
7
|
+
* support EIO
|
|
8
|
+
*/
|
|
9
|
+
function epipeBomb(stream, callback) {
|
|
10
|
+
if (!stream) {
|
|
11
|
+
stream = process.stdout;
|
|
12
|
+
}
|
|
13
|
+
if (!callback) {
|
|
14
|
+
callback = process.exit;
|
|
15
|
+
}
|
|
16
|
+
function epipeFilter(err) {
|
|
17
|
+
if (err.code === 'EPIPE') {
|
|
18
|
+
return callback();
|
|
19
|
+
}
|
|
20
|
+
if (err.code === 'EIO') {
|
|
21
|
+
return callback();
|
|
22
|
+
}
|
|
23
|
+
// If there's more than one error handler (ie, us),
|
|
24
|
+
// then the error won't be bubbled up anyway
|
|
25
|
+
if (stream.listeners('error').length <= 1) {
|
|
26
|
+
stream.removeAllListeners('error'); // Pretend we were never here
|
|
27
|
+
stream.emit('error', err); // Then emit as if we were never here
|
|
28
|
+
stream.on('error', epipeFilter); // Then reattach, ready for the next error!
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
stream.on('error', epipeFilter);
|
|
32
|
+
}
|
|
33
|
+
exports.epipeBomb = epipeBomb;
|
|
34
|
+
/**
|
|
35
|
+
* 参考:https://github.com/camunda/camunda-modeler/pull/3314
|
|
36
|
+
* fix(app): suppress EPIPE errors for app output
|
|
37
|
+
*/
|
|
38
|
+
function suppressNodeJSEpipeError(_process, error) {
|
|
39
|
+
let suppressing = false;
|
|
40
|
+
const logEPIPEErrorOnce = () => {
|
|
41
|
+
if (suppressing) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
suppressing = true;
|
|
45
|
+
error('Detected EPIPE error; suppressing further EPIPE errors');
|
|
46
|
+
};
|
|
47
|
+
_process.stdout && epipeBomb(_process.stdout, logEPIPEErrorOnce);
|
|
48
|
+
_process.stderr && epipeBomb(_process.stderr, logEPIPEErrorOnce);
|
|
49
|
+
}
|
|
50
|
+
exports.suppressNodeJSEpipeError = suppressNodeJSEpipeError;
|
|
51
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/node/utils.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,SAAgB,SAAS,CAAC,MAA0B,EAAE,QAAiC;IACrF,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;KACzB;IACD,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;KACzB;IAED,SAAS,WAAW,CAAC,GAAQ;QAC3B,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE;YACxB,OAAO,QAAQ,EAAE,CAAC;SACnB;QACD,IAAI,GAAG,CAAC,IAAI,KAAK,KAAK,EAAE;YACtB,OAAO,QAAQ,EAAE,CAAC;SACnB;QAED,mDAAmD;QACnD,4CAA4C;QAC5C,IAAI,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,EAAE;YACzC,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,6BAA6B;YACjE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,qCAAqC;YAChE,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,2CAA2C;SAC7E;IACH,CAAC;IAED,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAClC,CAAC;AA1BD,8BA0BC;AAED;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,QAAwB,EAAE,KAA4B;IAC7F,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,MAAM,iBAAiB,GAAG,GAAG,EAAE;QAC7B,IAAI,WAAW,EAAE;YACf,OAAO;SACR;QAED,WAAW,GAAG,IAAI,CAAC;QACnB,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAClE,CAAC,CAAC;IAEF,QAAQ,CAAC,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACjE,QAAQ,CAAC,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AACnE,CAAC;AAbD,4DAaC"}
|
|
@@ -2,6 +2,7 @@ export declare const AI_REPORTER_NAME = "AI";
|
|
|
2
2
|
export declare enum AISerivceType {
|
|
3
3
|
Chat = "chat",
|
|
4
4
|
InlineChat = "inlineChat",
|
|
5
|
+
CodeAction = "codeAction",
|
|
5
6
|
InlineChatInput = "inlineChatInput",
|
|
6
7
|
CustomReplay = "customReplay",
|
|
7
8
|
Completion = "completion",
|
|
@@ -10,6 +11,28 @@ export declare enum AISerivceType {
|
|
|
10
11
|
Rename = "rename",
|
|
11
12
|
TerminalAICommand = "terminalAICommand"
|
|
12
13
|
}
|
|
14
|
+
export declare enum ActionSourceEnum {
|
|
15
|
+
Chat = "chat",
|
|
16
|
+
InlineChat = "inlineChat",
|
|
17
|
+
CodeAction = "codeAction",
|
|
18
|
+
Terminal = "terminal",
|
|
19
|
+
Completion = "completion"
|
|
20
|
+
}
|
|
21
|
+
export declare enum ActionTypeEnum {
|
|
22
|
+
Completion = "completion",
|
|
23
|
+
DropdownCompletion = "dropdownCompletion",
|
|
24
|
+
Rename = "rename",
|
|
25
|
+
ChatInsertCode = "chatInsertCode",
|
|
26
|
+
ChatCopyCode = "chatCopyCode",
|
|
27
|
+
Welcome = "welcome",
|
|
28
|
+
Followup = "followup",
|
|
29
|
+
Send = "send",
|
|
30
|
+
Accept = "accept",
|
|
31
|
+
lineAccept = "lineAccept",
|
|
32
|
+
Discard = "discard",
|
|
33
|
+
LineDiscard = "lineDiscard",
|
|
34
|
+
Regenerate = "regenerate"
|
|
35
|
+
}
|
|
13
36
|
export interface CommonLogInfo {
|
|
14
37
|
msgType: AISerivceType | string;
|
|
15
38
|
relationId: string;
|
|
@@ -24,6 +47,13 @@ export interface CommonLogInfo {
|
|
|
24
47
|
insert: boolean;
|
|
25
48
|
isRetry: boolean;
|
|
26
49
|
isDrop: boolean;
|
|
50
|
+
language?: string;
|
|
51
|
+
code?: string;
|
|
52
|
+
originCode?: string;
|
|
53
|
+
fileUrl?: string;
|
|
54
|
+
repo?: string;
|
|
55
|
+
actionSource?: ActionSourceEnum | string;
|
|
56
|
+
actionType?: ActionTypeEnum | string;
|
|
27
57
|
}
|
|
28
58
|
export interface CompletionRT extends Partial<CommonLogInfo> {
|
|
29
59
|
isReceive?: boolean;
|
|
@@ -38,6 +68,7 @@ export interface IAIReportCompletionOption {
|
|
|
38
68
|
repo?: string;
|
|
39
69
|
completionUseTime?: number;
|
|
40
70
|
renderingTime?: number;
|
|
71
|
+
code?: string;
|
|
41
72
|
}
|
|
42
73
|
export declare enum MergeConflictEditorMode {
|
|
43
74
|
'3way' = "3way",
|
|
@@ -45,6 +76,7 @@ export declare enum MergeConflictEditorMode {
|
|
|
45
76
|
}
|
|
46
77
|
export interface ChatRT extends Partial<CommonLogInfo> {
|
|
47
78
|
agentId?: string;
|
|
79
|
+
command?: string;
|
|
48
80
|
userMessage?: string;
|
|
49
81
|
assistantMessage?: string;
|
|
50
82
|
}
|
|
@@ -102,6 +134,7 @@ export interface IAIReporter {
|
|
|
102
134
|
getCommonReportInfo(): Record<string, unknown>;
|
|
103
135
|
getCacheReportInfo<T = ReportInfo>(relationId: string): T | undefined;
|
|
104
136
|
record(data: ReportInfo, relationId?: string): ReportInfo;
|
|
137
|
+
getRelationId(): string;
|
|
105
138
|
start(msg: string, data: ReportInfo): string;
|
|
106
139
|
end(relationId: string, data: ReportInfo): void;
|
|
107
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../../../src/types/ai-native/reporter.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAErC,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;IAC7B,UAAU,eAAe;IACzB,KAAK,UAAU;IACf,aAAa,kBAAkB;IAC/B,MAAM,WAAW;IACjB,iBAAiB,sBAAsB;CACxC;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,aAAa,GAAG,MAAM,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAEhB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../../../src/types/ai-native/reporter.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,OAAO,CAAC;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AI,MAAM,CAAC;IAExB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC;IAC7C,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;CACjD"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IAIReporter = exports.MergeConflictEditorMode = exports.AISerivceType = exports.AI_REPORTER_NAME = void 0;
|
|
3
|
+
exports.IAIReporter = exports.MergeConflictEditorMode = exports.ActionTypeEnum = exports.ActionSourceEnum = exports.AISerivceType = exports.AI_REPORTER_NAME = void 0;
|
|
4
4
|
exports.AI_REPORTER_NAME = 'AI';
|
|
5
5
|
var AISerivceType;
|
|
6
6
|
(function (AISerivceType) {
|
|
7
7
|
AISerivceType["Chat"] = "chat";
|
|
8
8
|
AISerivceType["InlineChat"] = "inlineChat";
|
|
9
|
+
AISerivceType["CodeAction"] = "codeAction";
|
|
9
10
|
AISerivceType["InlineChatInput"] = "inlineChatInput";
|
|
10
11
|
AISerivceType["CustomReplay"] = "customReplay";
|
|
11
12
|
AISerivceType["Completion"] = "completion";
|
|
@@ -14,6 +15,49 @@ var AISerivceType;
|
|
|
14
15
|
AISerivceType["Rename"] = "rename";
|
|
15
16
|
AISerivceType["TerminalAICommand"] = "terminalAICommand";
|
|
16
17
|
})(AISerivceType = exports.AISerivceType || (exports.AISerivceType = {}));
|
|
18
|
+
var ActionSourceEnum;
|
|
19
|
+
(function (ActionSourceEnum) {
|
|
20
|
+
// 聊天面板
|
|
21
|
+
ActionSourceEnum["Chat"] = "chat";
|
|
22
|
+
// 编辑器内联 Chat
|
|
23
|
+
ActionSourceEnum["InlineChat"] = "inlineChat";
|
|
24
|
+
// 编辑器内 Action
|
|
25
|
+
ActionSourceEnum["CodeAction"] = "codeAction";
|
|
26
|
+
// 终端
|
|
27
|
+
ActionSourceEnum["Terminal"] = "terminal";
|
|
28
|
+
// 下拉补全 | 自动补全
|
|
29
|
+
ActionSourceEnum["Completion"] = "completion";
|
|
30
|
+
})(ActionSourceEnum = exports.ActionSourceEnum || (exports.ActionSourceEnum = {}));
|
|
31
|
+
var ActionTypeEnum;
|
|
32
|
+
(function (ActionTypeEnum) {
|
|
33
|
+
// 自动补全
|
|
34
|
+
ActionTypeEnum["Completion"] = "completion";
|
|
35
|
+
// 下拉补全
|
|
36
|
+
ActionTypeEnum["DropdownCompletion"] = "dropdownCompletion";
|
|
37
|
+
// ai重命名
|
|
38
|
+
ActionTypeEnum["Rename"] = "rename";
|
|
39
|
+
// Chat面板 插入代码
|
|
40
|
+
ActionTypeEnum["ChatInsertCode"] = "chatInsertCode";
|
|
41
|
+
// Chat面板 复制代码
|
|
42
|
+
ActionTypeEnum["ChatCopyCode"] = "chatCopyCode";
|
|
43
|
+
// Chat面板 欢迎语的Action
|
|
44
|
+
ActionTypeEnum["Welcome"] = "welcome";
|
|
45
|
+
// Chat面板 回复消息的Action
|
|
46
|
+
ActionTypeEnum["Followup"] = "followup";
|
|
47
|
+
// 发送消息
|
|
48
|
+
ActionTypeEnum["Send"] = "send";
|
|
49
|
+
// 生成代码后的行动点:全部采纳
|
|
50
|
+
ActionTypeEnum["Accept"] = "accept";
|
|
51
|
+
// 生成代码后的行动点:单模块采纳
|
|
52
|
+
ActionTypeEnum["lineAccept"] = "lineAccept";
|
|
53
|
+
// 生成代码后的行动点:全部拒绝
|
|
54
|
+
ActionTypeEnum["Discard"] = "discard";
|
|
55
|
+
// 生成代码后的行动点:全部拒绝
|
|
56
|
+
ActionTypeEnum["LineDiscard"] = "lineDiscard";
|
|
57
|
+
// 生成代码后的行动点:重新生成
|
|
58
|
+
ActionTypeEnum["Regenerate"] = "regenerate";
|
|
59
|
+
// 包含业务自定义的Action
|
|
60
|
+
})(ActionTypeEnum = exports.ActionTypeEnum || (exports.ActionTypeEnum = {}));
|
|
17
61
|
var MergeConflictEditorMode;
|
|
18
62
|
(function (MergeConflictEditorMode) {
|
|
19
63
|
MergeConflictEditorMode["3way"] = "3way";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reporter.js","sourceRoot":"","sources":["../../../src/types/ai-native/reporter.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,IAAI,CAAC;AAErC,IAAY,
|
|
1
|
+
{"version":3,"file":"reporter.js","sourceRoot":"","sources":["../../../src/types/ai-native/reporter.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,IAAI,CAAC;AAErC,IAAY,aAWX;AAXD,WAAY,aAAa;IACvB,8BAAa,CAAA;IACb,0CAAyB,CAAA;IACzB,0CAAyB,CAAA;IACzB,oDAAmC,CAAA;IACnC,8CAA6B,CAAA;IAC7B,0CAAyB,CAAA;IACzB,gCAAe,CAAA;IACf,gDAA+B,CAAA;IAC/B,kCAAiB,CAAA;IACjB,wDAAuC,CAAA;AACzC,CAAC,EAXW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAWxB;AAED,IAAY,gBAWX;AAXD,WAAY,gBAAgB;IAC1B,OAAO;IACP,iCAAa,CAAA;IACb,aAAa;IACb,6CAAyB,CAAA;IACzB,cAAc;IACd,6CAAyB,CAAA;IACzB,KAAK;IACL,yCAAqB,CAAA;IACrB,cAAc;IACd,6CAAyB,CAAA;AAC3B,CAAC,EAXW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAW3B;AAED,IAAY,cA4BX;AA5BD,WAAY,cAAc;IACxB,OAAO;IACP,2CAAyB,CAAA;IACzB,OAAO;IACP,2DAAyC,CAAA;IACzC,QAAQ;IACR,mCAAiB,CAAA;IACjB,cAAc;IACd,mDAAiC,CAAA;IACjC,cAAc;IACd,+CAA6B,CAAA;IAC7B,oBAAoB;IACpB,qCAAmB,CAAA;IACnB,qBAAqB;IACrB,uCAAqB,CAAA;IACrB,OAAO;IACP,+BAAa,CAAA;IACb,iBAAiB;IACjB,mCAAiB,CAAA;IACjB,kBAAkB;IAClB,2CAAyB,CAAA;IACzB,iBAAiB;IACjB,qCAAmB,CAAA;IACnB,iBAAiB;IACjB,6CAA2B,CAAA;IAC3B,iBAAiB;IACjB,2CAAyB,CAAA;IACzB,iBAAiB;AACnB,CAAC,EA5BW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QA4BzB;AAqDD,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IACjC,wCAAe,CAAA;IACf,sDAA6B,CAAA;AAC/B,CAAC,EAHW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAGlC;AAiEY,QAAA,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensumi/ide-core-common",
|
|
3
|
-
"version": "3.3.1
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "@opensumi/ide-core-common",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@opensumi/di": "^1.8.0",
|
|
22
|
-
"@opensumi/ide-utils": "3.3.1
|
|
22
|
+
"@opensumi/ide-utils": "3.3.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@opensumi/ide-dev-tool": "3.3.1
|
|
25
|
+
"@opensumi/ide-dev-tool": "3.3.1"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "66b0b56b0586a4f7be6c448db58e70010e943603"
|
|
28
28
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './utils';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* modified from: https://github.com/mhart/epipebomb
|
|
3
|
+
*
|
|
4
|
+
* support EIO
|
|
5
|
+
*/
|
|
6
|
+
export function epipeBomb(stream: NodeJS.WriteStream, callback: (code?: number) => void) {
|
|
7
|
+
if (!stream) {
|
|
8
|
+
stream = process.stdout;
|
|
9
|
+
}
|
|
10
|
+
if (!callback) {
|
|
11
|
+
callback = process.exit;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function epipeFilter(err: any) {
|
|
15
|
+
if (err.code === 'EPIPE') {
|
|
16
|
+
return callback();
|
|
17
|
+
}
|
|
18
|
+
if (err.code === 'EIO') {
|
|
19
|
+
return callback();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// If there's more than one error handler (ie, us),
|
|
23
|
+
// then the error won't be bubbled up anyway
|
|
24
|
+
if (stream.listeners('error').length <= 1) {
|
|
25
|
+
stream.removeAllListeners('error'); // Pretend we were never here
|
|
26
|
+
stream.emit('error', err); // Then emit as if we were never here
|
|
27
|
+
stream.on('error', epipeFilter); // Then reattach, ready for the next error!
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
stream.on('error', epipeFilter);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 参考:https://github.com/camunda/camunda-modeler/pull/3314
|
|
36
|
+
* fix(app): suppress EPIPE errors for app output
|
|
37
|
+
*/
|
|
38
|
+
export function suppressNodeJSEpipeError(_process: NodeJS.Process, error: (msg: string) => void) {
|
|
39
|
+
let suppressing = false;
|
|
40
|
+
const logEPIPEErrorOnce = () => {
|
|
41
|
+
if (suppressing) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
suppressing = true;
|
|
46
|
+
error('Detected EPIPE error; suppressing further EPIPE errors');
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
_process.stdout && epipeBomb(_process.stdout, logEPIPEErrorOnce);
|
|
50
|
+
_process.stderr && epipeBomb(_process.stderr, logEPIPEErrorOnce);
|
|
51
|
+
}
|
|
@@ -3,6 +3,7 @@ export const AI_REPORTER_NAME = 'AI';
|
|
|
3
3
|
export enum AISerivceType {
|
|
4
4
|
Chat = 'chat',
|
|
5
5
|
InlineChat = 'inlineChat',
|
|
6
|
+
CodeAction = 'codeAction',
|
|
6
7
|
InlineChatInput = 'inlineChatInput',
|
|
7
8
|
CustomReplay = 'customReplay',
|
|
8
9
|
Completion = 'completion',
|
|
@@ -12,6 +13,49 @@ export enum AISerivceType {
|
|
|
12
13
|
TerminalAICommand = 'terminalAICommand',
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
export enum ActionSourceEnum {
|
|
17
|
+
// 聊天面板
|
|
18
|
+
Chat = 'chat',
|
|
19
|
+
// 编辑器内联 Chat
|
|
20
|
+
InlineChat = 'inlineChat',
|
|
21
|
+
// 编辑器内 Action
|
|
22
|
+
CodeAction = 'codeAction',
|
|
23
|
+
// 终端
|
|
24
|
+
Terminal = 'terminal',
|
|
25
|
+
// 下拉补全 | 自动补全
|
|
26
|
+
Completion = 'completion',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export enum ActionTypeEnum {
|
|
30
|
+
// 自动补全
|
|
31
|
+
Completion = 'completion',
|
|
32
|
+
// 下拉补全
|
|
33
|
+
DropdownCompletion = 'dropdownCompletion',
|
|
34
|
+
// ai重命名
|
|
35
|
+
Rename = 'rename',
|
|
36
|
+
// Chat面板 插入代码
|
|
37
|
+
ChatInsertCode = 'chatInsertCode',
|
|
38
|
+
// Chat面板 复制代码
|
|
39
|
+
ChatCopyCode = 'chatCopyCode',
|
|
40
|
+
// Chat面板 欢迎语的Action
|
|
41
|
+
Welcome = 'welcome',
|
|
42
|
+
// Chat面板 回复消息的Action
|
|
43
|
+
Followup = 'followup',
|
|
44
|
+
// 发送消息
|
|
45
|
+
Send = 'send',
|
|
46
|
+
// 生成代码后的行动点:全部采纳
|
|
47
|
+
Accept = 'accept',
|
|
48
|
+
// 生成代码后的行动点:单模块采纳
|
|
49
|
+
lineAccept = 'lineAccept',
|
|
50
|
+
// 生成代码后的行动点:全部拒绝
|
|
51
|
+
Discard = 'discard',
|
|
52
|
+
// 生成代码后的行动点:全部拒绝
|
|
53
|
+
LineDiscard = 'lineDiscard',
|
|
54
|
+
// 生成代码后的行动点:重新生成
|
|
55
|
+
Regenerate = 'regenerate',
|
|
56
|
+
// 包含业务自定义的Action
|
|
57
|
+
}
|
|
58
|
+
|
|
15
59
|
export interface CommonLogInfo {
|
|
16
60
|
msgType: AISerivceType | string;
|
|
17
61
|
relationId: string;
|
|
@@ -27,6 +71,20 @@ export interface CommonLogInfo {
|
|
|
27
71
|
insert: boolean;
|
|
28
72
|
isRetry: boolean;
|
|
29
73
|
isDrop: boolean;
|
|
74
|
+
language?: string;
|
|
75
|
+
// 针对新版数据增加额外参数
|
|
76
|
+
// 采纳代码
|
|
77
|
+
code?: string;
|
|
78
|
+
// 原始代码
|
|
79
|
+
originCode?: string;
|
|
80
|
+
// 文件路径
|
|
81
|
+
fileUrl?: string;
|
|
82
|
+
// 仓库地址
|
|
83
|
+
repo?: string;
|
|
84
|
+
// 行动点来源
|
|
85
|
+
actionSource?: ActionSourceEnum | string;
|
|
86
|
+
// 行动点类型,内置通用,但是很多来自业务
|
|
87
|
+
actionType?: ActionTypeEnum | string;
|
|
30
88
|
}
|
|
31
89
|
|
|
32
90
|
export interface CompletionRT extends Partial<CommonLogInfo> {
|
|
@@ -46,6 +104,7 @@ export interface IAIReportCompletionOption {
|
|
|
46
104
|
repo?: string;
|
|
47
105
|
completionUseTime?: number;
|
|
48
106
|
renderingTime?: number;
|
|
107
|
+
code?: string;
|
|
49
108
|
}
|
|
50
109
|
|
|
51
110
|
export enum MergeConflictEditorMode {
|
|
@@ -55,6 +114,7 @@ export enum MergeConflictEditorMode {
|
|
|
55
114
|
|
|
56
115
|
export interface ChatRT extends Partial<CommonLogInfo> {
|
|
57
116
|
agentId?: string;
|
|
117
|
+
command?: string;
|
|
58
118
|
userMessage?: string;
|
|
59
119
|
assistantMessage?: string;
|
|
60
120
|
}
|
|
@@ -121,6 +181,7 @@ export interface IAIReporter {
|
|
|
121
181
|
getCommonReportInfo(): Record<string, unknown>;
|
|
122
182
|
getCacheReportInfo<T = ReportInfo>(relationId: string): T | undefined;
|
|
123
183
|
record(data: ReportInfo, relationId?: string): ReportInfo;
|
|
184
|
+
getRelationId(): string;
|
|
124
185
|
// 返回关联 ID
|
|
125
186
|
start(msg: string, data: ReportInfo): string;
|
|
126
187
|
end(relationId: string, data: ReportInfo): void;
|