@knime/scripting-editor 0.0.107 → 0.0.108
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 +2621 -2585
- package/dist/scripting-service-browser-mock.js +33 -19
- package/dist/src/scripting-service.d.ts +5 -0
- package/dist/src/store/ai-bar.d.ts +8 -0
- package/package.json +1 -1
|
@@ -1,55 +1,69 @@
|
|
|
1
|
-
import { l as
|
|
2
|
-
function
|
|
3
|
-
return new Promise((
|
|
1
|
+
import { l as i } from "./log-BmIREpQ5.js";
|
|
2
|
+
function c(r) {
|
|
3
|
+
return new Promise((n) => setTimeout(n, r));
|
|
4
4
|
}
|
|
5
|
-
const
|
|
6
|
-
typeof consola > "u" ? console.error(r, ...
|
|
7
|
-
},
|
|
8
|
-
|
|
5
|
+
const l = 100, a = 2e3, g = (r, ...n) => {
|
|
6
|
+
typeof consola > "u" ? console.error(r, ...n) : consola.error(r, ...n);
|
|
7
|
+
}, u = (r) => {
|
|
8
|
+
let n = 498;
|
|
9
|
+
const o = /* @__PURE__ */ new Map(), t = {
|
|
9
10
|
suggestCode: async () => {
|
|
10
|
-
await
|
|
11
|
-
const e =
|
|
11
|
+
await c(a);
|
|
12
|
+
const e = o.get("codeSuggestion");
|
|
12
13
|
return typeof e < "u" && e({
|
|
13
14
|
status: "SUCCESS",
|
|
14
|
-
code: JSON.stringify({
|
|
15
|
+
code: JSON.stringify({
|
|
16
|
+
code: "// THIS IS A FAKE AI SUGGESTION",
|
|
17
|
+
interactionId: "mock-interaction-id",
|
|
18
|
+
usage: {
|
|
19
|
+
limit: 500,
|
|
20
|
+
used: n++
|
|
21
|
+
}
|
|
22
|
+
})
|
|
15
23
|
}), {};
|
|
16
24
|
},
|
|
17
25
|
abortSuggestCodeRequest: () => Promise.resolve()
|
|
18
26
|
};
|
|
19
27
|
return {
|
|
20
28
|
async sendToService(e, s) {
|
|
21
|
-
return
|
|
29
|
+
return i(`Called scriptingService.sendToService("${e}")`, s), await c(l), r.sendToServiceMockResponses && e in r.sendToServiceMockResponses ? r.sendToServiceMockResponses[e](s) : e in t ? t[e](s) : (g(
|
|
22
30
|
`${e} not implemented in sendToServiceMockResponses.
|
|
23
31
|
Returning undefined.`
|
|
24
32
|
), Promise.resolve());
|
|
25
33
|
},
|
|
26
34
|
// Settings and dialog window
|
|
27
35
|
isCallKnimeUiApiAvailable() {
|
|
28
|
-
return
|
|
36
|
+
return i("Called scriptingService.isCallKnimeUiApiAvailable"), Promise.resolve(!0);
|
|
29
37
|
},
|
|
30
38
|
isKaiEnabled() {
|
|
31
|
-
return
|
|
39
|
+
return i("Called scriptingService.isKaiEnabled"), Promise.resolve(!0);
|
|
32
40
|
},
|
|
33
41
|
isLoggedIntoHub() {
|
|
34
|
-
return
|
|
42
|
+
return i("Called scriptingService.isLoggedIntoHub"), Promise.resolve(!0);
|
|
35
43
|
},
|
|
36
44
|
// Event handler
|
|
37
45
|
registerEventHandler(e, s) {
|
|
38
|
-
|
|
46
|
+
i("Called scriptingService.registerEventHandler", e), o.set(e, s);
|
|
39
47
|
},
|
|
40
48
|
// Language server
|
|
41
49
|
connectToLanguageServer() {
|
|
42
|
-
return
|
|
50
|
+
return i("Called scriptingService.connectToLanguageServer"), Promise.reject(new Error("No language server in mock"));
|
|
43
51
|
},
|
|
44
52
|
getAiDisclaimer() {
|
|
45
|
-
return
|
|
53
|
+
return i("Called scriptingService.getAiDisclaimer"), Promise.resolve(
|
|
46
54
|
"This is a fake AI disclaimer. Enjoy the AI. It does nothing!"
|
|
47
55
|
);
|
|
48
56
|
},
|
|
57
|
+
getAiUsage() {
|
|
58
|
+
return i("Called scriptingService.getAiUsage"), Promise.resolve({
|
|
59
|
+
limit: 500,
|
|
60
|
+
used: n
|
|
61
|
+
});
|
|
62
|
+
},
|
|
49
63
|
// Console handling
|
|
50
|
-
eventHandlers:
|
|
64
|
+
eventHandlers: o
|
|
51
65
|
};
|
|
52
66
|
};
|
|
53
67
|
export {
|
|
54
|
-
|
|
68
|
+
u as createScriptingServiceMock
|
|
55
69
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { PortConfig } from './initial-data-service';
|
|
2
2
|
import { MonacoLSPConnection } from './lsp/connection';
|
|
3
|
+
export type UsageData = {
|
|
4
|
+
limit: number | null;
|
|
5
|
+
used: number;
|
|
6
|
+
};
|
|
3
7
|
declare const scriptingService: {
|
|
4
8
|
sendToService(methodName: string, options?: any[] | undefined): Promise<any>;
|
|
5
9
|
registerEventHandler(type: string, handler: (args: any) => void): void;
|
|
@@ -8,6 +12,7 @@ declare const scriptingService: {
|
|
|
8
12
|
isKaiEnabled(): Promise<boolean>;
|
|
9
13
|
isLoggedIntoHub(): Promise<boolean>;
|
|
10
14
|
getAiDisclaimer(): Promise<string>;
|
|
15
|
+
getAiUsage(): Promise<UsageData | null>;
|
|
11
16
|
};
|
|
12
17
|
export type ScriptingServiceType = typeof scriptingService;
|
|
13
18
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { InputOutputModel } from '../components/InputOutputItem.vue';
|
|
3
3
|
import { UseCodeEditorReturn } from '../editor';
|
|
4
|
+
import { UsageData } from '../scripting-service';
|
|
4
5
|
export interface Message {
|
|
5
6
|
role: "reply" | "request";
|
|
6
7
|
content: string;
|
|
@@ -18,3 +19,10 @@ export declare const showDisclaimer: Ref<boolean, boolean>;
|
|
|
18
19
|
export declare const activeEditorStore: import('vue').ShallowRef<UseCodeEditorReturn | undefined, UseCodeEditorReturn | undefined>;
|
|
19
20
|
export declare const setActiveEditorStoreForAi: (store: UseCodeEditorReturn | undefined) => void;
|
|
20
21
|
export declare const currentInputOutputItems: Ref<InputOutputModel[]>;
|
|
22
|
+
export declare const usageData: Ref<{
|
|
23
|
+
limit: number | null;
|
|
24
|
+
used: number;
|
|
25
|
+
} | null, UsageData | {
|
|
26
|
+
limit: number | null;
|
|
27
|
+
used: number;
|
|
28
|
+
} | null>;
|
package/package.json
CHANGED