@opensumi/ide-core-common 2.27.3-rc-1708399099.0 → 2.27.3-rc-1710489030.0
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/codicons.d.ts +687 -0
- package/lib/codicons.d.ts.map +1 -0
- package/lib/codicons.js +735 -0
- package/lib/codicons.js.map +1 -0
- package/lib/command.d.ts.map +1 -1
- package/lib/const/application.d.ts +4 -4
- package/lib/const/application.d.ts.map +1 -1
- package/lib/const/application.js +7 -7
- package/lib/const/application.js.map +1 -1
- package/lib/contribution-provider.d.ts +1 -1
- package/lib/contribution-provider.d.ts.map +1 -1
- package/lib/di-helper/domain-helper.d.ts +0 -6
- package/lib/di-helper/domain-helper.d.ts.map +1 -1
- package/lib/di-helper/domain-helper.js +1 -33
- package/lib/di-helper/domain-helper.js.map +1 -1
- package/lib/electron.d.ts +1 -1
- package/lib/electron.d.ts.map +1 -1
- package/lib/event-bus/event-bus.d.ts +1 -1
- package/lib/event-bus/event-bus.d.ts.map +1 -1
- package/lib/hash-calculate/WASMInterface.d.ts.map +1 -1
- package/lib/hash-calculate/lockedCreate.d.ts.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/json-schema.d.ts +25 -1
- package/lib/json-schema.d.ts.map +1 -1
- package/lib/line-text.d.ts.map +1 -1
- package/lib/localize.d.ts.map +1 -1
- package/lib/module.d.ts +7 -1
- package/lib/module.d.ts.map +1 -1
- package/lib/module.js.map +1 -1
- package/lib/network.d.ts +1 -0
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js +1 -0
- package/lib/network.js.map +1 -1
- package/lib/problem-matcher.d.ts +2 -2
- package/lib/problem-matcher.d.ts.map +1 -1
- package/lib/problem-pattern.d.ts.map +1 -1
- package/lib/problem-pattern.js.map +1 -1
- package/lib/reference.d.ts +1 -1
- package/lib/reference.d.ts.map +1 -1
- package/lib/reporter.d.ts +1 -1
- package/lib/reporter.d.ts.map +1 -1
- package/lib/settings/ai-native.d.ts +5 -0
- package/lib/settings/ai-native.d.ts.map +1 -0
- package/lib/settings/ai-native.js +9 -0
- package/lib/settings/ai-native.js.map +1 -0
- package/lib/settings/general.d.ts +2 -1
- package/lib/settings/general.d.ts.map +1 -1
- package/lib/settings/index.d.ts +1 -0
- package/lib/settings/index.d.ts.map +1 -1
- package/lib/settings/index.js +1 -0
- package/lib/settings/index.js.map +1 -1
- package/lib/storage.d.ts +1 -1
- package/lib/storage.d.ts.map +1 -1
- package/lib/task-definition.d.ts +1 -1
- package/lib/task-definition.d.ts.map +1 -1
- package/lib/theme.d.ts +23 -0
- package/lib/theme.d.ts.map +1 -1
- package/lib/theme.js +82 -1
- package/lib/theme.js.map +1 -1
- package/lib/types/ai-native/index.d.ts +169 -0
- package/lib/types/ai-native/index.d.ts.map +1 -0
- package/lib/types/ai-native/index.js +23 -0
- package/lib/types/ai-native/index.js.map +1 -0
- package/lib/types/ai-native/reporter.d.ts +95 -0
- package/lib/types/ai-native/reporter.d.ts.map +1 -0
- package/lib/types/ai-native/reporter.js +21 -0
- package/lib/types/ai-native/reporter.js.map +1 -0
- package/lib/types/application.d.ts +1 -2
- package/lib/types/application.d.ts.map +1 -1
- package/lib/types/authentication.d.ts +1 -5
- package/lib/types/authentication.d.ts.map +1 -1
- package/lib/types/authentication.js.map +1 -1
- package/lib/types/file.d.ts +6 -0
- package/lib/types/file.d.ts.map +1 -1
- package/lib/types/file.js.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +1 -0
- package/lib/types/index.js.map +1 -1
- package/lib/types/markdown.d.ts +1 -11
- package/lib/types/markdown.d.ts.map +1 -1
- package/lib/types/markers/markers-manager.d.ts.map +1 -1
- package/lib/types/markers/markers-manager.js +3 -4
- package/lib/types/markers/markers-manager.js.map +1 -1
- package/lib/types/markers/markers.d.ts.map +1 -1
- package/lib/types/rpc.d.ts +1 -5
- package/lib/types/rpc.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/codicons.ts +751 -0
- package/src/command.ts +1 -1
- package/src/comparers.ts +1 -1
- package/src/const/application.ts +4 -4
- package/src/contribution-provider.ts +1 -1
- package/src/di-helper/domain-helper.ts +1 -34
- package/src/electron.ts +2 -2
- package/src/event-bus/event-bus.ts +2 -2
- package/src/hash-calculate/WASMInterface.ts +1 -1
- package/src/hash-calculate/lockedCreate.ts +1 -1
- package/src/index.ts +0 -1
- package/src/json-schema.ts +34 -10
- package/src/line-text.ts +1 -1
- package/src/localize.ts +1 -1
- package/src/module.ts +8 -1
- package/src/network.ts +2 -0
- package/src/problem-matcher.ts +5 -5
- package/src/problem-pattern.ts +2 -1
- package/src/reference.ts +1 -1
- package/src/reporter.ts +4 -4
- package/src/settings/ai-native.ts +4 -0
- package/src/settings/general.ts +1 -0
- package/src/settings/index.ts +1 -0
- package/src/storage.ts +2 -2
- package/src/task-definition.ts +2 -2
- package/src/theme.ts +92 -0
- package/src/types/ai-native/index.ts +205 -0
- package/src/types/ai-native/reporter.ts +109 -0
- package/src/types/application.ts +1 -2
- package/src/types/authentication.ts +1 -6
- package/src/types/file.ts +8 -0
- package/src/types/index.ts +1 -0
- package/src/types/markdown.ts +1 -10
- package/src/types/markers/markers-manager.ts +1 -2
- package/src/types/markers/markers.ts +1 -1
- package/src/types/rpc.ts +1 -5
- package/src/utils/ipc.ts +2 -2
package/src/command.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Autowired, Injectable } from '@opensumi/di';
|
|
|
2
2
|
import { Disposable, Emitter, Event, IDisposable, MaybePromise } from '@opensumi/ide-utils';
|
|
3
3
|
|
|
4
4
|
import { ContributionProvider } from './contribution-provider';
|
|
5
|
-
import {
|
|
5
|
+
import { ILocalizedStr, createLocalizedStr, replaceLocalizePlaceholder } from './localize';
|
|
6
6
|
import { getDebugLogger } from './log';
|
|
7
7
|
import { IExtensionInfo } from './types';
|
|
8
8
|
|
package/src/comparers.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
// Some code copied and modified from https://github.com/microsoft/vscode/blob/1.44.0/src/vs/base/common/comparers.ts
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { IdleValue, path } from '@opensumi/ide-utils';
|
|
8
8
|
|
|
9
9
|
import { IRange } from './types';
|
|
10
10
|
const { sep } = path;
|
package/src/const/application.ts
CHANGED
|
@@ -4,10 +4,10 @@ export const DEFAULT_APPLICATION_WEB_HOST = 'web';
|
|
|
4
4
|
export const DEFAULT_URI_SCHEME = 'sumi';
|
|
5
5
|
export const DEFAULT_OPENVSX_REGISTRY = 'https://open-vsx.org'; // Official Registry
|
|
6
6
|
|
|
7
|
-
export namespace
|
|
8
|
-
export const ENDPOINT = 'https://
|
|
9
|
-
export const ACCOUNT_ID = '
|
|
10
|
-
export const MASTER_KEY = '
|
|
7
|
+
export namespace DEFAULT_ALIPAY_CLOUD_REGISTRY {
|
|
8
|
+
export const ENDPOINT = 'https://twebgwnet.alipay.com/atsmarketplace';
|
|
9
|
+
export const ACCOUNT_ID = 'WWPLOa7vWXCUTSHCfV5FK7Su';
|
|
10
|
+
export const MASTER_KEY = 'i6rkupqyvC6Bc6CiO0yVLNqq';
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const DEFAULT_VSCODE_ENGINE_VERSION = '1.68.0';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Domain, getInjectableOpts, markInjectable } from '@opensumi/di';
|
|
2
2
|
|
|
3
3
|
import { ConstructorOf } from '../declare';
|
|
4
4
|
|
|
@@ -13,36 +13,3 @@ export function Domain(...domains: Domain[]) {
|
|
|
13
13
|
markInjectable(target, opts);
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
const domainMap = new Map<Domain, ConstructorOf<any>>();
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 带全局记录的 Domain 装饰器
|
|
21
|
-
* @param domain
|
|
22
|
-
*/
|
|
23
|
-
export function EffectDomain(domain: Domain) {
|
|
24
|
-
return (target: ConstructorOf<any>) => {
|
|
25
|
-
const opts = getInjectableOpts(target) || {};
|
|
26
|
-
opts.domain = domain;
|
|
27
|
-
markInjectable(target, opts);
|
|
28
|
-
|
|
29
|
-
const tmp = domainMap.get(domain);
|
|
30
|
-
if (!tmp) {
|
|
31
|
-
domainMap.set(domain, target);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function getDomainConstructors(...domains: Domain[]) {
|
|
37
|
-
const constructorSet = new Set<ConstructorOf<any>>();
|
|
38
|
-
for (const domain of domains) {
|
|
39
|
-
const constructor = domainMap.get(domain);
|
|
40
|
-
if (constructor) {
|
|
41
|
-
constructorSet.add(constructor);
|
|
42
|
-
} else {
|
|
43
|
-
// eslint-disable-next-line no-console
|
|
44
|
-
console.error(`Unable to retrieve the Constructor for ${String(domain)}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return Array.from(constructorSet);
|
|
48
|
-
}
|
package/src/electron.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type Electron from 'electron';
|
|
2
|
-
|
|
3
1
|
import { IDisposable } from '@opensumi/ide-utils';
|
|
4
2
|
|
|
5
3
|
import { ExtensionCandidate } from './types';
|
|
6
4
|
|
|
5
|
+
import type Electron from 'electron';
|
|
6
|
+
|
|
7
7
|
export interface IElectronMainApi<Events> {
|
|
8
8
|
on(event: Events, listener: (...args) => void): IDisposable;
|
|
9
9
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Injectable } from '@opensumi/di';
|
|
2
|
-
import { Emitter,
|
|
2
|
+
import { Emitter, Event, IAsyncResult } from '@opensumi/ide-utils';
|
|
3
3
|
|
|
4
4
|
import { ConstructorOf } from '../declare';
|
|
5
5
|
|
|
6
6
|
import { BasicEvent } from './basic-event';
|
|
7
|
-
import {
|
|
7
|
+
import { IAsyncEventFireOpts, IEventBus, IEventFireOpts, IEventListener } from './event-bus-types';
|
|
8
8
|
|
|
9
9
|
@Injectable()
|
|
10
10
|
export class EventBusImpl implements IEventBus {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// copy and modified from https://github.com/Daninet/hash-wasm/blob/bd3a205ca5603fc80adf71d0966fc72e8d4fa0ef/lib/WASMInterface.ts
|
|
8
8
|
|
|
9
9
|
import { Mutex } from './mutex';
|
|
10
|
-
import { decodeBase64, getDigestHex, getUInt8Buffer,
|
|
10
|
+
import { IDataType, decodeBase64, getDigestHex, getUInt8Buffer, hexStringEqualsUInt8, writeHexToUInt8 } from './util';
|
|
11
11
|
|
|
12
12
|
export const MAX_HEAP = 16 * 1024;
|
|
13
13
|
const WASM_FUNC_HASH_LENGTH = 4;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// copy and modified from https://github.com/Daninet/hash-wasm/blob/bd3a205ca5603fc80adf71d0966fc72e8d4fa0ef/lib/lockedCreate.ts
|
|
8
8
|
|
|
9
9
|
import { Mutex } from './mutex';
|
|
10
|
-
import {
|
|
10
|
+
import { IWASMInterface, WASMInterface } from './WASMInterface';
|
|
11
11
|
|
|
12
12
|
export async function lockedCreate(mutex: Mutex, binary: any, hashLength: number): Promise<IWASMInterface> {
|
|
13
13
|
const unlock = await mutex.lock();
|
package/src/index.ts
CHANGED
package/src/json-schema.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
export type JSONSchemaType = string | 'number' | 'integer' | 'boolean' | 'null' | 'array' | 'object';
|
|
2
|
+
|
|
1
3
|
export interface IJSONSchema {
|
|
2
4
|
id?: string;
|
|
3
5
|
$id?: string;
|
|
4
6
|
$schema?: string;
|
|
5
|
-
type?:
|
|
7
|
+
type?: JSONSchemaType | JSONSchemaType[];
|
|
6
8
|
title?: string;
|
|
7
9
|
default?: any;
|
|
8
10
|
definitions?: IJSONSchemaMap;
|
|
@@ -39,6 +41,7 @@ export interface IJSONSchema {
|
|
|
39
41
|
const?: any;
|
|
40
42
|
contains?: IJSONSchema;
|
|
41
43
|
propertyNames?: IJSONSchema;
|
|
44
|
+
examples?: any[];
|
|
42
45
|
|
|
43
46
|
// schema draft 07
|
|
44
47
|
$comment?: string;
|
|
@@ -46,16 +49,37 @@ export interface IJSONSchema {
|
|
|
46
49
|
then?: IJSONSchema;
|
|
47
50
|
else?: IJSONSchema;
|
|
48
51
|
|
|
52
|
+
unevaluatedProperties?: boolean | IJSONSchema;
|
|
53
|
+
unevaluatedItems?: boolean | IJSONSchema;
|
|
54
|
+
minContains?: number;
|
|
55
|
+
maxContains?: number;
|
|
56
|
+
deprecated?: boolean;
|
|
57
|
+
dependentRequired?: { [prop: string]: string[] };
|
|
58
|
+
dependentSchemas?: IJSONSchemaMap;
|
|
59
|
+
$defs?: { [name: string]: IJSONSchema };
|
|
60
|
+
$anchor?: string;
|
|
61
|
+
$recursiveRef?: string;
|
|
62
|
+
$recursiveAnchor?: string;
|
|
63
|
+
$vocabulary?: any;
|
|
64
|
+
|
|
65
|
+
prefixItems?: IJSONSchema[];
|
|
66
|
+
$dynamicRef?: string;
|
|
67
|
+
$dynamicAnchor?: string;
|
|
68
|
+
|
|
49
69
|
// VSCode extensions
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
|
|
71
|
+
defaultSnippets?: IJSONSchemaSnippet[];
|
|
72
|
+
errorMessage?: string;
|
|
73
|
+
patternErrorMessage?: string;
|
|
74
|
+
deprecationMessage?: string;
|
|
75
|
+
markdownDeprecationMessage?: string;
|
|
76
|
+
enumDescriptions?: string[];
|
|
77
|
+
markdownEnumDescriptions?: string[];
|
|
78
|
+
markdownDescription?: string;
|
|
79
|
+
doNotSuggest?: boolean;
|
|
80
|
+
suggestSortText?: string;
|
|
81
|
+
allowComments?: boolean;
|
|
82
|
+
allowTrailingCommas?: boolean;
|
|
59
83
|
}
|
|
60
84
|
|
|
61
85
|
export interface IJSONSchemaMap {
|
package/src/line-text.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 用于实现效率更高的编辑操作
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { IEditOperation, IPosition, IRange } from './types/editor';
|
|
6
6
|
|
|
7
7
|
export class BasicTextLines {
|
|
8
8
|
constructor(protected readonly _lines: string[], protected _eol: '\n' | '\r\n') {}
|
package/src/localize.ts
CHANGED
package/src/module.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 项目中会使用到的模块接口定义
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { Autowired, INJECTOR_TOKEN, Injector, Provider,
|
|
5
|
+
import { Autowired, ConstructorOf, Domain, INJECTOR_TOKEN, Injector, Provider, Token } from '@opensumi/di';
|
|
6
6
|
|
|
7
7
|
import { RPCProtocol } from './types/rpc';
|
|
8
8
|
|
|
@@ -22,8 +22,15 @@ export interface BackService {
|
|
|
22
22
|
export class BasicModule {
|
|
23
23
|
@Autowired(INJECTOR_TOKEN)
|
|
24
24
|
protected injector: Injector;
|
|
25
|
+
|
|
25
26
|
providers?: Provider[];
|
|
27
|
+
/**
|
|
28
|
+
* providers only avaiable in electron
|
|
29
|
+
*/
|
|
26
30
|
electronProviders?: Provider[];
|
|
31
|
+
/**
|
|
32
|
+
* providers only avaiable in web
|
|
33
|
+
*/
|
|
27
34
|
webProviders?: Provider[];
|
|
28
35
|
backServices?: BackService[];
|
|
29
36
|
frontServices?: FrontService[];
|
package/src/network.ts
CHANGED
package/src/problem-matcher.ts
CHANGED
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
// Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/task/src/browser/task-problem-matcher-registry.ts
|
|
17
17
|
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
18
|
+
import { Autowired, Injectable } from '@opensumi/di';
|
|
19
|
+
import { Disposable, DisposableCollection, Emitter, IDisposable, URI } from '@opensumi/ide-utils';
|
|
20
20
|
|
|
21
21
|
import {
|
|
22
|
-
IProblemPatternRegistry,
|
|
23
22
|
ApplyToKind,
|
|
24
23
|
FileLocationKind,
|
|
25
|
-
|
|
26
|
-
ProblemPatternContribution,
|
|
24
|
+
IProblemPatternRegistry,
|
|
27
25
|
ProblemPattern,
|
|
26
|
+
ProblemPatternContribution,
|
|
27
|
+
Severity,
|
|
28
28
|
WatchingPattern,
|
|
29
29
|
} from './problem-pattern';
|
|
30
30
|
|
package/src/problem-pattern.ts
CHANGED
|
@@ -15,10 +15,11 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
// Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/core/src/common/severity.ts
|
|
17
17
|
|
|
18
|
+
// eslint-disable-next-line import/no-unresolved
|
|
18
19
|
import { Diagnostic } from 'vscode';
|
|
19
20
|
|
|
20
21
|
import { Injectable } from '@opensumi/di';
|
|
21
|
-
import {
|
|
22
|
+
import { Disposable, DisposableCollection, IDisposable, URI, isArray, isString } from '@opensumi/ide-utils';
|
|
22
23
|
|
|
23
24
|
import { ProblemMatcher } from './problem-matcher';
|
|
24
25
|
|
package/src/reference.ts
CHANGED
package/src/reporter.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Inject, Injectable } from '@opensumi/di';
|
|
2
2
|
import { IDisposable } from '@opensumi/ide-utils';
|
|
3
3
|
|
|
4
4
|
import { getDebugLogger } from './log';
|
|
5
5
|
import {
|
|
6
|
-
IReporterService,
|
|
7
|
-
ReporterMetadata,
|
|
8
6
|
IReporter,
|
|
7
|
+
IReporterService,
|
|
8
|
+
IReporterTimer,
|
|
9
9
|
PerformanceData,
|
|
10
10
|
PointData,
|
|
11
|
-
IReporterTimer,
|
|
12
11
|
REPORT_NAME,
|
|
12
|
+
ReporterMetadata,
|
|
13
13
|
} from './types/reporter';
|
|
14
14
|
|
|
15
15
|
class ReporterTimer implements IReporterTimer {
|
package/src/settings/general.ts
CHANGED
package/src/settings/index.ts
CHANGED
package/src/storage.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IDisposable, MaybePromise,
|
|
1
|
+
import { Autowired, Injectable } from '@opensumi/di';
|
|
2
|
+
import { Event, IDisposable, MaybePromise, URI } from '@opensumi/ide-utils';
|
|
3
3
|
|
|
4
4
|
import { ContributionProvider } from './contribution-provider';
|
|
5
5
|
|
package/src/task-definition.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Injectable } from '@opensumi/di';
|
|
2
|
-
import {
|
|
2
|
+
import { Disposable, IDisposable, objects } from '@opensumi/ide-utils';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { IJSONSchema, IJSONSchemaMap } from './json-schema';
|
|
5
5
|
import { formatLocalize } from './localize';
|
|
6
6
|
import { IStringDictionary } from './types/string';
|
|
7
7
|
|
package/src/theme.ts
CHANGED
|
@@ -1,7 +1,99 @@
|
|
|
1
|
+
import { isObject, isString, isUndefined } from '@opensumi/ide-utils';
|
|
2
|
+
|
|
3
|
+
import { Codicon } from './codicons';
|
|
4
|
+
|
|
1
5
|
export interface IThemeColor {
|
|
2
6
|
id: string;
|
|
3
7
|
}
|
|
4
8
|
|
|
9
|
+
export interface ThemeIcon {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly color?: IThemeColor;
|
|
12
|
+
// for sumiicon proxy
|
|
13
|
+
readonly alias?: string[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export namespace IThemeColor {
|
|
17
|
+
export function isThemeColor(obj: any): obj is IThemeColor {
|
|
18
|
+
return obj && typeof obj === 'object' && typeof obj.id === 'string';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
5
22
|
export function isThemeColor(obj: any): obj is IThemeColor {
|
|
6
23
|
return obj && typeof obj === 'object' && typeof (obj as IThemeColor).id === 'string';
|
|
7
24
|
}
|
|
25
|
+
|
|
26
|
+
export namespace ThemeIcon {
|
|
27
|
+
export const iconNameSegment = '[A-Za-z0-9]+';
|
|
28
|
+
export const iconNameExpression = '[A-Za-z0-9-]+';
|
|
29
|
+
export const iconModifierExpression = '~[A-Za-z]+';
|
|
30
|
+
export const iconNameCharacter = '[A-Za-z0-9~-]';
|
|
31
|
+
|
|
32
|
+
const ThemeIconIdRegex = new RegExp(`^(${iconNameExpression})(${iconModifierExpression})?$`);
|
|
33
|
+
|
|
34
|
+
export function asClassNameArray(icon: ThemeIcon): string[] {
|
|
35
|
+
const match = ThemeIconIdRegex.exec(icon.id);
|
|
36
|
+
if (!match) {
|
|
37
|
+
return asClassNameArray(Codicon.error);
|
|
38
|
+
}
|
|
39
|
+
const [, id, modifier] = match;
|
|
40
|
+
const classNames = ['codicon', 'codicon-' + id];
|
|
41
|
+
if (modifier) {
|
|
42
|
+
classNames.push('codicon-modifier-' + modifier.substring(1));
|
|
43
|
+
}
|
|
44
|
+
return classNames;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function asClassName(icon: ThemeIcon): string {
|
|
48
|
+
return asClassNameArray(icon).join(' ');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function asCSSSelector(icon: ThemeIcon): string {
|
|
52
|
+
return '.' + asClassNameArray(icon).join('.');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function isThemeIcon(obj: any): obj is ThemeIcon {
|
|
56
|
+
return isObject(obj) && isString(obj.id) && (isUndefined(obj.color) || IThemeColor.isThemeColor(obj.color));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const _regexFromString = new RegExp(
|
|
60
|
+
`^\\$\\((${ThemeIcon.iconNameExpression}(?:${ThemeIcon.iconModifierExpression})?)\\)$`,
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
export function fromString(str: string): ThemeIcon | undefined {
|
|
64
|
+
const match = _regexFromString.exec(str);
|
|
65
|
+
if (!match) {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
const [, name] = match;
|
|
69
|
+
return { id: name };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function fromId(id: string): ThemeIcon {
|
|
73
|
+
return { id };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function modify(icon: ThemeIcon, modifier: 'disabled' | 'spin' | undefined): ThemeIcon {
|
|
77
|
+
let id = icon.id;
|
|
78
|
+
const tildeIndex = id.lastIndexOf('~');
|
|
79
|
+
if (tildeIndex !== -1) {
|
|
80
|
+
id = id.substring(0, tildeIndex);
|
|
81
|
+
}
|
|
82
|
+
if (modifier) {
|
|
83
|
+
id = `${id}~${modifier}`;
|
|
84
|
+
}
|
|
85
|
+
return { id };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function getModifier(icon: ThemeIcon): string | undefined {
|
|
89
|
+
const tildeIndex = icon.id.lastIndexOf('~');
|
|
90
|
+
if (tildeIndex !== -1) {
|
|
91
|
+
return icon.id.substring(tildeIndex + 1);
|
|
92
|
+
}
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function isEqual(ti1: ThemeIcon, ti2: ThemeIcon): boolean {
|
|
97
|
+
return ti1.id === ti2.id && ti1.color?.id === ti2.color?.id;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { CancellationToken } from '../../utils';
|
|
2
|
+
|
|
3
|
+
export interface IAINativeCapabilities {
|
|
4
|
+
/**
|
|
5
|
+
* Use opensumi design UI style
|
|
6
|
+
*/
|
|
7
|
+
supportsOpenSumiDesign?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Problem panel uses ai capabilities
|
|
10
|
+
*/
|
|
11
|
+
supportsMarkers?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Use ai chat capabilities
|
|
14
|
+
*/
|
|
15
|
+
supportsChatAssistant?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Use inline chat capabilities
|
|
18
|
+
*/
|
|
19
|
+
supportsInlineChat?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Use code intelligent completion capabilities
|
|
22
|
+
*/
|
|
23
|
+
supportsInlineCompletion?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Use ai to intelligently resolve conflicts
|
|
26
|
+
*/
|
|
27
|
+
supportsConflictResolve?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface IAINativeConfig {
|
|
31
|
+
capabilities?: IAINativeCapabilities;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface IAICompletionResultModel {
|
|
35
|
+
sessionId: string;
|
|
36
|
+
codeModelList: Array<{ content: string }>;
|
|
37
|
+
isCancel?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const AIBackSerivceToken = Symbol('AIBackSerivceToken');
|
|
41
|
+
export const AIBackSerivcePath = 'AIBackSerivcePath';
|
|
42
|
+
|
|
43
|
+
export interface IAIBackServiceResponse<T = string> {
|
|
44
|
+
errorCode?: number;
|
|
45
|
+
errorMsg?: string;
|
|
46
|
+
isCancel?: boolean;
|
|
47
|
+
data?: T;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface IAIBackServiceOption {
|
|
51
|
+
type?: string;
|
|
52
|
+
model?: string;
|
|
53
|
+
enableGptCache?: boolean;
|
|
54
|
+
sessionId?: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface IAICompletionOption {
|
|
58
|
+
prompt: string;
|
|
59
|
+
suffix?: string;
|
|
60
|
+
language?: string;
|
|
61
|
+
fileUrl?: string;
|
|
62
|
+
sessionId?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface IAIReportCompletionOption {
|
|
66
|
+
relationId: string;
|
|
67
|
+
sessionId: string;
|
|
68
|
+
accept: boolean;
|
|
69
|
+
repo?: string;
|
|
70
|
+
completionUseTime?: number;
|
|
71
|
+
renderingTime?: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface IAIBackService<
|
|
75
|
+
BaseResponse extends IAIBackServiceResponse = IAIBackServiceResponse,
|
|
76
|
+
StreamResponse extends NodeJS.ReadableStream = NodeJS.ReadableStream,
|
|
77
|
+
CompletionResponse = IAICompletionResultModel,
|
|
78
|
+
> {
|
|
79
|
+
request<O extends IAIBackServiceOption>(
|
|
80
|
+
input: string,
|
|
81
|
+
options: O,
|
|
82
|
+
cancelToken?: CancellationToken,
|
|
83
|
+
): Promise<BaseResponse>;
|
|
84
|
+
requestStream<O extends IAIBackServiceOption>(
|
|
85
|
+
input: string,
|
|
86
|
+
options: O,
|
|
87
|
+
cancelToken?: CancellationToken,
|
|
88
|
+
): Promise<StreamResponse>;
|
|
89
|
+
requestCompletion<I extends IAICompletionOption>(
|
|
90
|
+
input: I,
|
|
91
|
+
cancelToken?: CancellationToken,
|
|
92
|
+
): Promise<CompletionResponse>;
|
|
93
|
+
reportCompletion<I extends IAIReportCompletionOption>(input: I): Promise<void>;
|
|
94
|
+
destroyStreamRequest?: (sessionId: string) => Promise<void>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const AI_REPORTER_NAME = 'AI';
|
|
98
|
+
|
|
99
|
+
export enum AISerivceType {
|
|
100
|
+
SearchDoc = 'searchDoc',
|
|
101
|
+
SearchCode = 'searchCode',
|
|
102
|
+
Sumi = 'sumi',
|
|
103
|
+
GPT = 'chat',
|
|
104
|
+
Explain = 'explain',
|
|
105
|
+
Run = 'run',
|
|
106
|
+
Test = 'test',
|
|
107
|
+
Optimize = 'optimize',
|
|
108
|
+
Generate = 'generate',
|
|
109
|
+
Completion = 'completion',
|
|
110
|
+
Agent = 'agent',
|
|
111
|
+
MergeConflict = 'mergeConflict',
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface CommonLogInfo {
|
|
115
|
+
msgType: AISerivceType | string;
|
|
116
|
+
relationId: string;
|
|
117
|
+
replytime: number;
|
|
118
|
+
success: boolean;
|
|
119
|
+
message: string;
|
|
120
|
+
isStart: boolean;
|
|
121
|
+
isLike: boolean;
|
|
122
|
+
// 是否有效
|
|
123
|
+
isValid: boolean;
|
|
124
|
+
model: string;
|
|
125
|
+
copy: boolean;
|
|
126
|
+
insert: boolean;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface QuestionRT extends Partial<CommonLogInfo> {
|
|
130
|
+
isRetry: boolean;
|
|
131
|
+
isStop: boolean;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface CodeRT extends Partial<CommonLogInfo> {
|
|
135
|
+
isReceive: boolean;
|
|
136
|
+
isDrop: boolean;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface GenerateRT extends Partial<CommonLogInfo> {
|
|
140
|
+
fileCount: number;
|
|
141
|
+
requirment: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface CommandRT extends Partial<CommonLogInfo> {
|
|
145
|
+
useCommand: boolean;
|
|
146
|
+
useCommandSuccess: boolean;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface RunRT extends Partial<CommonLogInfo> {
|
|
150
|
+
runSuccess: boolean;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface CompletionRT extends Partial<CommonLogInfo> {
|
|
154
|
+
isReceive?: boolean;
|
|
155
|
+
// 是否取消
|
|
156
|
+
isStop?: boolean;
|
|
157
|
+
// 补全条数
|
|
158
|
+
completionNum?: number;
|
|
159
|
+
// 渲染时长
|
|
160
|
+
renderingTime?: number;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface MergeConflictRT extends Partial<CommonLogInfo> {
|
|
164
|
+
// 解决冲突模式 (3-way 或 传统模式)
|
|
165
|
+
editorMode: '3way' | 'traditional';
|
|
166
|
+
// 冲突点数量(仅包含 AI 冲突点)
|
|
167
|
+
conflictPointNum: number;
|
|
168
|
+
// 使用了 ai 处理的冲突点数量
|
|
169
|
+
useAiConflictPointNum: number;
|
|
170
|
+
// 被用户采纳了的冲突点数量
|
|
171
|
+
receiveNum: number;
|
|
172
|
+
// 点击了 ai 解决冲突的数量
|
|
173
|
+
clickNum: number;
|
|
174
|
+
// 点击了一键解决的次数
|
|
175
|
+
clickAllNum: number;
|
|
176
|
+
// ai 成功输出了的数量
|
|
177
|
+
aiOutputNum: number;
|
|
178
|
+
// 取消次数
|
|
179
|
+
cancelNum: number;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export type ReportInfo =
|
|
183
|
+
| Partial<CommonLogInfo>
|
|
184
|
+
| ({ type: AISerivceType.GPT } & QuestionRT)
|
|
185
|
+
| ({ type: AISerivceType.Explain } & QuestionRT)
|
|
186
|
+
| ({ type: AISerivceType.SearchCode } & QuestionRT)
|
|
187
|
+
| ({ type: AISerivceType.SearchDoc } & QuestionRT)
|
|
188
|
+
| ({ type: AISerivceType.Test } & QuestionRT)
|
|
189
|
+
| ({ type: AISerivceType.Optimize } & CodeRT)
|
|
190
|
+
| ({ type: AISerivceType.Generate } & GenerateRT)
|
|
191
|
+
| ({ type: AISerivceType.Sumi } & CommandRT)
|
|
192
|
+
| ({ type: AISerivceType.Run } & RunRT)
|
|
193
|
+
| ({ type: AISerivceType.Completion } & CompletionRT)
|
|
194
|
+
| ({ type: AISerivceType.MergeConflict } & MergeConflictRT);
|
|
195
|
+
|
|
196
|
+
export const IAIReporter = Symbol('IAIReporter');
|
|
197
|
+
|
|
198
|
+
export interface IAIReporter {
|
|
199
|
+
getCommonReportInfo(): Record<string, unknown>;
|
|
200
|
+
getCacheReportInfo<T = ReportInfo>(relationId: string): T | undefined;
|
|
201
|
+
record(data: ReportInfo, relationId?: string): ReportInfo;
|
|
202
|
+
// 返回关联 ID
|
|
203
|
+
start(msg: string, data: ReportInfo): string;
|
|
204
|
+
end(relationId: string, data: ReportInfo): void;
|
|
205
|
+
}
|