@knime/scripting-editor 0.0.116 → 0.0.117
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/dist/main.js +8747 -8704
- package/dist/scripting-service-browser-mock.js +35 -28
- package/dist/src/components/ai-assistant/AiPopupContent.vue.d.ts +14 -0
- package/dist/src/scripting-service-browser-mock.d.ts +1 -0
- package/dist/src/scripting-service.d.ts +22 -3
- package/dist/src/store/ai-bar.d.ts +20 -4
- package/package.json +1 -1
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { l as
|
|
2
|
-
function
|
|
3
|
-
return new Promise((
|
|
1
|
+
import { l as i } from "./log-BmIREpQ5.js";
|
|
2
|
+
function l(r) {
|
|
3
|
+
return new Promise((s) => setTimeout(s, r));
|
|
4
4
|
}
|
|
5
|
-
const
|
|
6
|
-
typeof consola > "u" ? console.error(
|
|
7
|
-
},
|
|
8
|
-
let
|
|
5
|
+
const a = 100, c = 2e3, u = (r, ...s) => {
|
|
6
|
+
typeof consola > "u" ? console.error(r, ...s) : consola.error(r, ...s);
|
|
7
|
+
}, g = (r) => {
|
|
8
|
+
let s = 498;
|
|
9
9
|
const t = /* @__PURE__ */ new Map(), o = {
|
|
10
10
|
suggestCode: async () => {
|
|
11
|
-
await c
|
|
11
|
+
await l(c);
|
|
12
12
|
const e = t.get("codeSuggestion");
|
|
13
13
|
return typeof e < "u" && e({
|
|
14
14
|
status: "SUCCESS",
|
|
15
|
-
|
|
15
|
+
error: null,
|
|
16
|
+
response: {
|
|
16
17
|
code: "// THIS IS A FAKE AI SUGGESTION",
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
updatedUsage: {
|
|
19
|
+
type: "LIMITED",
|
|
19
20
|
limit: 500,
|
|
20
|
-
used:
|
|
21
|
+
used: ++s
|
|
21
22
|
}
|
|
22
|
-
}
|
|
23
|
+
}
|
|
23
24
|
}), {};
|
|
24
25
|
},
|
|
25
26
|
abortSuggestCodeRequest: () => Promise.resolve()
|
|
26
27
|
};
|
|
27
28
|
return {
|
|
28
|
-
async sendToService(e,
|
|
29
|
-
return
|
|
29
|
+
async sendToService(e, n) {
|
|
30
|
+
return i(`Called scriptingService.sendToService("${e}")`, n), await l(a), r.sendToServiceMockResponses && e in r.sendToServiceMockResponses ? r.sendToServiceMockResponses[e](...n ?? []) : e in o ? o[e](...n ?? []) : (u(
|
|
30
31
|
`${e} not implemented in sendToServiceMockResponses.
|
|
31
32
|
Returning undefined.`
|
|
32
33
|
), Promise.resolve());
|
|
@@ -36,40 +37,46 @@ const l = 100, a = 2e3, g = (i, ...n) => {
|
|
|
36
37
|
},
|
|
37
38
|
// Settings and dialog window
|
|
38
39
|
isCallKnimeUiApiAvailable() {
|
|
39
|
-
return
|
|
40
|
+
return i("Called scriptingService.isCallKnimeUiApiAvailable"), Promise.resolve(!1);
|
|
40
41
|
},
|
|
41
42
|
isKaiEnabled() {
|
|
42
|
-
return
|
|
43
|
+
return i("Called scriptingService.isKaiEnabled"), Promise.resolve(!0);
|
|
43
44
|
},
|
|
44
45
|
isLoggedIntoHub() {
|
|
45
|
-
return
|
|
46
|
+
return i("Called scriptingService.isLoggedIntoHub"), Promise.resolve(!0);
|
|
46
47
|
},
|
|
47
48
|
// Event handler
|
|
48
|
-
registerEventHandler(e,
|
|
49
|
-
|
|
49
|
+
registerEventHandler(e, n) {
|
|
50
|
+
i("Called scriptingService.registerEventHandler", e), t.set(e, n);
|
|
50
51
|
},
|
|
51
52
|
// Language server
|
|
52
53
|
connectToLanguageServer() {
|
|
53
|
-
return
|
|
54
|
+
return i("Called scriptingService.connectToLanguageServer"), Promise.reject(new Error("No language server in mock"));
|
|
54
55
|
},
|
|
55
56
|
getAiDisclaimer() {
|
|
56
|
-
return
|
|
57
|
+
return i("Called scriptingService.getAiDisclaimer"), Promise.resolve(
|
|
57
58
|
"This is a fake AI disclaimer. Enjoy the AI. It does nothing!"
|
|
58
59
|
);
|
|
59
60
|
},
|
|
60
61
|
getAiUsage() {
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
return i("Called scriptingService.getAiUsage"), Promise.resolve(
|
|
63
|
+
r.unlicensedKaiUser ? {
|
|
64
|
+
type: "UNLICENSED",
|
|
65
|
+
message: "You need a KNIME Hub team license to use AI features. Please contact your team administrator or upgrade your plan."
|
|
66
|
+
} : {
|
|
67
|
+
type: "LIMITED",
|
|
68
|
+
limit: 500,
|
|
69
|
+
used: s
|
|
70
|
+
}
|
|
71
|
+
);
|
|
65
72
|
},
|
|
66
73
|
sendAlert(e) {
|
|
67
|
-
|
|
74
|
+
i("Called scriptingService.sendAlert", e);
|
|
68
75
|
},
|
|
69
76
|
// Console handling
|
|
70
77
|
eventHandlers: t
|
|
71
78
|
};
|
|
72
79
|
};
|
|
73
80
|
export {
|
|
74
|
-
|
|
81
|
+
g as createScriptingServiceMock
|
|
75
82
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UsageData } from '../../scripting-service';
|
|
1
2
|
/**
|
|
2
3
|
* Content for the popup that contains the prompt for the KAi, as well as holding the components
|
|
3
4
|
* that show the diff and disclaimer.
|
|
@@ -12,3 +13,16 @@ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import
|
|
|
12
13
|
abortButton: any;
|
|
13
14
|
}, HTMLDivElement>;
|
|
14
15
|
export default _default;
|
|
16
|
+
type CodeRequestResponse = {
|
|
17
|
+
code: string;
|
|
18
|
+
updatedUsage: UsageData;
|
|
19
|
+
};
|
|
20
|
+
export type CodeSuggestion = {
|
|
21
|
+
response: null;
|
|
22
|
+
status: "ERROR" | "CANCELLED";
|
|
23
|
+
error: string;
|
|
24
|
+
} | {
|
|
25
|
+
response: CodeRequestResponse;
|
|
26
|
+
status: "SUCCESS";
|
|
27
|
+
error: null;
|
|
28
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ScriptingServiceType } from './scripting-service';
|
|
2
2
|
export type ScriptingServiceMockOptions = {
|
|
3
3
|
sendToServiceMockResponses?: Record<string, (...options: any) => Promise<any>>;
|
|
4
|
+
unlicensedKaiUser?: boolean;
|
|
4
5
|
};
|
|
5
6
|
export declare const createScriptingServiceMock: (opt: ScriptingServiceMockOptions) => ScriptingServiceType & {
|
|
6
7
|
eventHandlers: Map<string, (args: any) => void>;
|
|
@@ -2,10 +2,28 @@ import { AlertParams, AlertingService, JsonDataService } from '@knime/ui-extensi
|
|
|
2
2
|
import { PortConfig } from './initial-data-service';
|
|
3
3
|
import { MonacoLSPConnection } from './lsp/connection';
|
|
4
4
|
import { PublicAPI } from './types/public-api';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
type UnknownUsageData = {
|
|
6
|
+
type: "UNKNOWN";
|
|
7
|
+
};
|
|
8
|
+
type LimitedUsageData = {
|
|
9
|
+
type: "LIMITED";
|
|
10
|
+
limit: number;
|
|
7
11
|
used: number;
|
|
8
12
|
};
|
|
13
|
+
type UnlimitedUsageData = {
|
|
14
|
+
type: "UNLIMITED";
|
|
15
|
+
};
|
|
16
|
+
type UnlicensedUsageData = {
|
|
17
|
+
type: "UNLICENSED";
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Usage data for K-AI interactions.
|
|
22
|
+
*
|
|
23
|
+
* This type must match the JSON serialization of the Java type
|
|
24
|
+
* `org.knime.core.webui.node.dialog.scripting.kai.CodeKaiHandler.KaiUsage`.
|
|
25
|
+
*/
|
|
26
|
+
export type UsageData = UnknownUsageData | LimitedUsageData | UnlimitedUsageData | UnlicensedUsageData;
|
|
9
27
|
export declare class ScriptingService {
|
|
10
28
|
private readonly jsonDataService;
|
|
11
29
|
private readonly alertingService;
|
|
@@ -32,8 +50,9 @@ export declare class ScriptingService {
|
|
|
32
50
|
isKaiEnabled(): Promise<boolean>;
|
|
33
51
|
isLoggedIntoHub(): Promise<boolean>;
|
|
34
52
|
getAiDisclaimer(): Promise<string>;
|
|
35
|
-
getAiUsage(): Promise<UsageData
|
|
53
|
+
getAiUsage(): Promise<UsageData>;
|
|
36
54
|
sendAlert(alert: AlertParams): void;
|
|
37
55
|
}
|
|
38
56
|
/** Type representing the public API of ScriptingService */
|
|
39
57
|
export type ScriptingServiceType = PublicAPI<ScriptingService>;
|
|
58
|
+
export {};
|
|
@@ -20,9 +20,25 @@ export declare const activeEditorStore: import('vue').ShallowRef<UseCodeEditorRe
|
|
|
20
20
|
export declare const setActiveEditorStoreForAi: (store: UseCodeEditorReturn | undefined) => void;
|
|
21
21
|
export declare const currentInputOutputItems: Ref<InputOutputModel[]>;
|
|
22
22
|
export declare const usageData: Ref<{
|
|
23
|
-
|
|
23
|
+
type: "UNKNOWN";
|
|
24
|
+
} | {
|
|
25
|
+
type: "LIMITED";
|
|
26
|
+
limit: number;
|
|
24
27
|
used: number;
|
|
25
|
-
} |
|
|
26
|
-
|
|
28
|
+
} | {
|
|
29
|
+
type: "UNLIMITED";
|
|
30
|
+
} | {
|
|
31
|
+
type: "UNLICENSED";
|
|
32
|
+
message: string;
|
|
33
|
+
}, UsageData | {
|
|
34
|
+
type: "UNKNOWN";
|
|
35
|
+
} | {
|
|
36
|
+
type: "LIMITED";
|
|
37
|
+
limit: number;
|
|
27
38
|
used: number;
|
|
28
|
-
} |
|
|
39
|
+
} | {
|
|
40
|
+
type: "UNLIMITED";
|
|
41
|
+
} | {
|
|
42
|
+
type: "UNLICENSED";
|
|
43
|
+
message: string;
|
|
44
|
+
}>;
|