altair-graphql-core 7.2.4 → 7.3.3
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/build/ai/constants.d.ts +12 -0
- package/build/ai/constants.js +14 -0
- package/build/ai/types.d.ts +22 -0
- package/build/ai/types.js +2 -0
- package/build/cjs/ai/constants.d.ts +12 -0
- package/build/cjs/ai/constants.js +17 -0
- package/build/cjs/ai/types.d.ts +22 -0
- package/build/cjs/ai/types.js +3 -0
- package/build/cjs/plugin/context/context.interface.d.ts +1 -0
- package/build/cjs/plugin/panel.d.ts +5 -1
- package/build/cjs/plugin/panel.js +6 -1
- package/build/cjs/plugin/v3/context.d.ts +18 -0
- package/build/cjs/plugin/v3/frame-engine.js +21 -0
- package/build/cjs/plugin/v3/manifest.d.ts +18 -1
- package/build/cjs/plugin/v3/parent-worker.d.ts +1 -0
- package/build/cjs/plugin/v3/parent-worker.js +4 -0
- package/build/cjs/types/state/account.interfaces.d.ts +6 -0
- package/build/cjs/utils/logger.js +6 -0
- package/build/plugin/context/context.interface.d.ts +1 -0
- package/build/plugin/panel.d.ts +5 -1
- package/build/plugin/panel.js +6 -1
- package/build/plugin/v3/context.d.ts +18 -0
- package/build/plugin/v3/frame-engine.js +21 -0
- package/build/plugin/v3/manifest.d.ts +18 -1
- package/build/plugin/v3/parent-worker.d.ts +1 -0
- package/build/plugin/v3/parent-worker.js +4 -0
- package/build/types/state/account.interfaces.d.ts +6 -0
- package/build/utils/logger.js +6 -0
- package/package.json +5 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const maxTotalSessionTokens = 50000;
|
|
2
|
+
export declare const maxTotalChars: number;
|
|
3
|
+
export declare const maxMessageTokens = 300;
|
|
4
|
+
export declare const maxMessageChars: number;
|
|
5
|
+
export declare const maxSdlTokens = 4096;
|
|
6
|
+
export declare const maxSdlChars: number;
|
|
7
|
+
export declare const maxGraphqlQueryTokens = 1000;
|
|
8
|
+
export declare const maxGraphqlQueryChars: number;
|
|
9
|
+
export declare const maxGraphqlVariablesTokens = 150;
|
|
10
|
+
export declare const maxGraphqlVariablesChars: number;
|
|
11
|
+
export declare const responseMaxTokens = 1000;
|
|
12
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// https://help.openai.com/en/articles/4936856-what-are-tokens-and-how-to-count-them
|
|
2
|
+
const avgCharsPerToken = 5; // assumed average characters per token
|
|
3
|
+
export const maxTotalSessionTokens = 50000;
|
|
4
|
+
export const maxTotalChars = maxTotalSessionTokens * avgCharsPerToken;
|
|
5
|
+
export const maxMessageTokens = 300;
|
|
6
|
+
export const maxMessageChars = maxMessageTokens * avgCharsPerToken;
|
|
7
|
+
export const maxSdlTokens = 4096;
|
|
8
|
+
export const maxSdlChars = maxSdlTokens * avgCharsPerToken;
|
|
9
|
+
export const maxGraphqlQueryTokens = 1000;
|
|
10
|
+
export const maxGraphqlQueryChars = maxGraphqlQueryTokens * avgCharsPerToken;
|
|
11
|
+
export const maxGraphqlVariablesTokens = 150;
|
|
12
|
+
export const maxGraphqlVariablesChars = maxGraphqlVariablesTokens * avgCharsPerToken;
|
|
13
|
+
export const responseMaxTokens = 1000;
|
|
14
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ISession {
|
|
2
|
+
id: string;
|
|
3
|
+
userId: string;
|
|
4
|
+
title: string;
|
|
5
|
+
isActive: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface IMessage {
|
|
8
|
+
id: string;
|
|
9
|
+
sessionId: string;
|
|
10
|
+
message: string;
|
|
11
|
+
role: 'USER' | 'ASSISTANT';
|
|
12
|
+
}
|
|
13
|
+
export interface ISendMessageDto {
|
|
14
|
+
message: string;
|
|
15
|
+
sdl?: string;
|
|
16
|
+
graphqlQuery?: string;
|
|
17
|
+
graphqlVariables?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface IRateMessageDto {
|
|
20
|
+
rating: number;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const maxTotalSessionTokens = 50000;
|
|
2
|
+
export declare const maxTotalChars: number;
|
|
3
|
+
export declare const maxMessageTokens = 300;
|
|
4
|
+
export declare const maxMessageChars: number;
|
|
5
|
+
export declare const maxSdlTokens = 4096;
|
|
6
|
+
export declare const maxSdlChars: number;
|
|
7
|
+
export declare const maxGraphqlQueryTokens = 1000;
|
|
8
|
+
export declare const maxGraphqlQueryChars: number;
|
|
9
|
+
export declare const maxGraphqlVariablesTokens = 150;
|
|
10
|
+
export declare const maxGraphqlVariablesChars: number;
|
|
11
|
+
export declare const responseMaxTokens = 1000;
|
|
12
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.responseMaxTokens = exports.maxGraphqlVariablesChars = exports.maxGraphqlVariablesTokens = exports.maxGraphqlQueryChars = exports.maxGraphqlQueryTokens = exports.maxSdlChars = exports.maxSdlTokens = exports.maxMessageChars = exports.maxMessageTokens = exports.maxTotalChars = exports.maxTotalSessionTokens = void 0;
|
|
4
|
+
// https://help.openai.com/en/articles/4936856-what-are-tokens-and-how-to-count-them
|
|
5
|
+
const avgCharsPerToken = 5; // assumed average characters per token
|
|
6
|
+
exports.maxTotalSessionTokens = 50000;
|
|
7
|
+
exports.maxTotalChars = exports.maxTotalSessionTokens * avgCharsPerToken;
|
|
8
|
+
exports.maxMessageTokens = 300;
|
|
9
|
+
exports.maxMessageChars = exports.maxMessageTokens * avgCharsPerToken;
|
|
10
|
+
exports.maxSdlTokens = 4096;
|
|
11
|
+
exports.maxSdlChars = exports.maxSdlTokens * avgCharsPerToken;
|
|
12
|
+
exports.maxGraphqlQueryTokens = 1000;
|
|
13
|
+
exports.maxGraphqlQueryChars = exports.maxGraphqlQueryTokens * avgCharsPerToken;
|
|
14
|
+
exports.maxGraphqlVariablesTokens = 150;
|
|
15
|
+
exports.maxGraphqlVariablesChars = exports.maxGraphqlVariablesTokens * avgCharsPerToken;
|
|
16
|
+
exports.responseMaxTokens = 1000;
|
|
17
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ISession {
|
|
2
|
+
id: string;
|
|
3
|
+
userId: string;
|
|
4
|
+
title: string;
|
|
5
|
+
isActive: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface IMessage {
|
|
8
|
+
id: string;
|
|
9
|
+
sessionId: string;
|
|
10
|
+
message: string;
|
|
11
|
+
role: 'USER' | 'ASSISTANT';
|
|
12
|
+
}
|
|
13
|
+
export interface ISendMessageDto {
|
|
14
|
+
message: string;
|
|
15
|
+
sdl?: string;
|
|
16
|
+
graphqlQuery?: string;
|
|
17
|
+
graphqlVariables?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface IRateMessageDto {
|
|
20
|
+
rating: number;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PluginParentEngine } from './v3/parent-engine';
|
|
2
|
+
import { SafeHtml } from '@angular/platform-browser';
|
|
2
3
|
export declare enum AltairPanelLocation {
|
|
3
4
|
HEADER = "header",
|
|
4
5
|
SIDEBAR = "sidebar",
|
|
@@ -12,9 +13,12 @@ export declare class AltairPanel {
|
|
|
12
13
|
element: HTMLElement;
|
|
13
14
|
location: AltairPanelLocation;
|
|
14
15
|
engine?: PluginParentEngine | undefined;
|
|
16
|
+
iconUrl?: string | undefined;
|
|
17
|
+
iconSvg?: SafeHtml | undefined;
|
|
15
18
|
id: string;
|
|
16
19
|
isActive: boolean;
|
|
17
|
-
constructor(title: string, element: HTMLElement, location: AltairPanelLocation, engine?: PluginParentEngine | undefined);
|
|
20
|
+
constructor(title: string, element: HTMLElement, location: AltairPanelLocation, engine?: PluginParentEngine | undefined, iconUrl?: string | undefined, iconSvg?: SafeHtml | undefined);
|
|
21
|
+
setActive(isActive: boolean): void;
|
|
18
22
|
destroy(): void;
|
|
19
23
|
}
|
|
20
24
|
//# sourceMappingURL=panel.d.ts.map
|
|
@@ -14,14 +14,19 @@ var AltairPanelLocation;
|
|
|
14
14
|
class AltairPanel {
|
|
15
15
|
constructor(title, element, location,
|
|
16
16
|
// TODO: Making this optional for now for backward compatibility. This should be required for v3 plugins.
|
|
17
|
-
engine) {
|
|
17
|
+
engine, iconUrl, iconSvg) {
|
|
18
18
|
this.title = title;
|
|
19
19
|
this.element = element;
|
|
20
20
|
this.location = location;
|
|
21
21
|
this.engine = engine;
|
|
22
|
+
this.iconUrl = iconUrl;
|
|
23
|
+
this.iconSvg = iconSvg;
|
|
22
24
|
this.id = (0, uuid_1.v4)();
|
|
23
25
|
this.isActive = false;
|
|
24
26
|
}
|
|
27
|
+
setActive(isActive) {
|
|
28
|
+
this.isActive = isActive;
|
|
29
|
+
}
|
|
25
30
|
destroy() {
|
|
26
31
|
this.element = null;
|
|
27
32
|
}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import { IMessage, ISendMessageDto, ISession } from '../../ai/types';
|
|
1
2
|
import { ICustomTheme } from '../../theme';
|
|
3
|
+
import { IPlan, IAvailableCredits } from '../../types/state/account.interfaces';
|
|
2
4
|
import { ExportWindowState } from '../../types/state/window.interfaces';
|
|
3
5
|
import { CreateActionOptions, CreatePanelOptions, PluginWindowState } from '../context/context.interface';
|
|
4
6
|
import { PluginEvent, PluginEventCallback } from '../event/event.interfaces';
|
|
7
|
+
export interface PluginUserInfo {
|
|
8
|
+
loggedIn: boolean;
|
|
9
|
+
name: string;
|
|
10
|
+
email: string;
|
|
11
|
+
avatar: string;
|
|
12
|
+
plan?: IPlan;
|
|
13
|
+
}
|
|
5
14
|
export interface PluginV3Context {
|
|
6
15
|
/**
|
|
7
16
|
* Returns data about a window (tab) in the app
|
|
@@ -75,5 +84,14 @@ export interface PluginV3Context {
|
|
|
75
84
|
* Enable a theme in the app
|
|
76
85
|
*/
|
|
77
86
|
enableTheme(name: string, darkMode?: boolean): Promise<void>;
|
|
87
|
+
getUserInfo(): Promise<PluginUserInfo | undefined>;
|
|
88
|
+
getAvailableCredits(): Promise<IAvailableCredits | undefined>;
|
|
89
|
+
getActiveAiSession(): Promise<ISession | undefined>;
|
|
90
|
+
createAiSession(): Promise<ISession | undefined>;
|
|
91
|
+
getAiSessionMessages(sessionId: string): Promise<IMessage[] | undefined>;
|
|
92
|
+
sendMessageToAiSession(sessionId: string, message: ISendMessageDto): Promise<{
|
|
93
|
+
response: string;
|
|
94
|
+
} | undefined>;
|
|
95
|
+
rateAiSessionMessage(sessionId: string, messageId: string, rating: number): Promise<IMessage | undefined>;
|
|
78
96
|
}
|
|
79
97
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -105,6 +105,27 @@ class PluginFrameEngine {
|
|
|
105
105
|
enableTheme: (...args) => {
|
|
106
106
|
return this.worker.request('enableTheme', ...args);
|
|
107
107
|
},
|
|
108
|
+
getUserInfo: async () => {
|
|
109
|
+
return this.worker.request('getUserInfo');
|
|
110
|
+
},
|
|
111
|
+
getAvailableCredits: async () => {
|
|
112
|
+
return this.worker.request('getAvailableCredits');
|
|
113
|
+
},
|
|
114
|
+
createAiSession: async (...args) => {
|
|
115
|
+
return this.worker.request('createAiSession', ...args);
|
|
116
|
+
},
|
|
117
|
+
getActiveAiSession: async (...args) => {
|
|
118
|
+
return this.worker.request('getActiveAiSession', ...args);
|
|
119
|
+
},
|
|
120
|
+
getAiSessionMessages: async (...args) => {
|
|
121
|
+
return this.worker.request('getAiSessionMessages', ...args);
|
|
122
|
+
},
|
|
123
|
+
sendMessageToAiSession: async (...args) => {
|
|
124
|
+
return this.worker.request('sendMessageToAiSession', ...args);
|
|
125
|
+
},
|
|
126
|
+
rateAiSessionMessage: async (...args) => {
|
|
127
|
+
return this.worker.request('rateAiSessionMessage', ...args);
|
|
128
|
+
},
|
|
108
129
|
};
|
|
109
130
|
this.ctx = ctx;
|
|
110
131
|
return ctx;
|
|
@@ -8,7 +8,16 @@ interface PluginJsEntry {
|
|
|
8
8
|
scripts: string[];
|
|
9
9
|
styles: string[];
|
|
10
10
|
}
|
|
11
|
-
type PluginEntry = PluginHtmlEntry | PluginJsEntry;
|
|
11
|
+
export type PluginEntry = PluginHtmlEntry | PluginJsEntry;
|
|
12
|
+
interface PluginIconImage {
|
|
13
|
+
type: 'image';
|
|
14
|
+
url: string;
|
|
15
|
+
}
|
|
16
|
+
interface PluginIconSvg {
|
|
17
|
+
type: 'svg';
|
|
18
|
+
src: string;
|
|
19
|
+
}
|
|
20
|
+
export type PluginIcon = PluginIconImage | PluginIconSvg;
|
|
12
21
|
export interface PluginV3Manifest {
|
|
13
22
|
/**
|
|
14
23
|
* Version of manifest (should be 3). It is a control measure for variations in the plugin versions
|
|
@@ -46,6 +55,14 @@ export interface PluginV3Manifest {
|
|
|
46
55
|
* Name of the author of the plugin
|
|
47
56
|
*/
|
|
48
57
|
author?: string;
|
|
58
|
+
/**
|
|
59
|
+
* The minimum version of Altair that the plugin is compatible with. This is useful for when the plugin uses features that are only available in a certain version of Altair
|
|
60
|
+
*/
|
|
61
|
+
minimum_altair_version?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The icon of the plugin. It can be an image or an SVG
|
|
64
|
+
*/
|
|
65
|
+
icon?: PluginIcon;
|
|
49
66
|
}
|
|
50
67
|
export {};
|
|
51
68
|
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -6,6 +6,7 @@ interface BasePluginParentWorkerOptions {
|
|
|
6
6
|
instanceType?: InstanceType;
|
|
7
7
|
additionalParams?: Record<string, string>;
|
|
8
8
|
additionalSandboxAttributes?: string[];
|
|
9
|
+
width?: number;
|
|
9
10
|
}
|
|
10
11
|
interface PluginParentWorkerOptionsWithScripts extends BasePluginParentWorkerOptions {
|
|
11
12
|
type: 'scripts';
|
|
@@ -22,6 +22,10 @@ class PluginParentWorker extends worker_1.EvaluatorWorker {
|
|
|
22
22
|
iframe.style.width = '100%';
|
|
23
23
|
iframe.style.height = '100%';
|
|
24
24
|
iframe.style.border = 'none';
|
|
25
|
+
iframe.style.display = 'block'; // fixes issue with vertical scrollbar appearing https://stackoverflow.com/a/9131632/3929126
|
|
26
|
+
if ('width' in this.opts && this.opts.width) {
|
|
27
|
+
iframe.style.minWidth = `${this.opts.width}px`;
|
|
28
|
+
}
|
|
25
29
|
}
|
|
26
30
|
else {
|
|
27
31
|
iframe.style.display = 'none';
|
|
@@ -26,6 +26,11 @@ export interface IPlanInfo {
|
|
|
26
26
|
currency: string;
|
|
27
27
|
interval: string;
|
|
28
28
|
}
|
|
29
|
+
export interface IAvailableCredits {
|
|
30
|
+
fixed: number;
|
|
31
|
+
monthly: number;
|
|
32
|
+
total: number;
|
|
33
|
+
}
|
|
29
34
|
export interface AccountState {
|
|
30
35
|
loggedIn: boolean;
|
|
31
36
|
accessToken: string;
|
|
@@ -37,6 +42,7 @@ export interface AccountState {
|
|
|
37
42
|
stats?: Stats;
|
|
38
43
|
plan?: IPlan;
|
|
39
44
|
planInfos?: IPlanInfo[];
|
|
45
|
+
availableCredits?: IAvailableCredits;
|
|
40
46
|
}
|
|
41
47
|
export declare class TeamId extends ValueObject<string> {
|
|
42
48
|
}
|
|
@@ -11,6 +11,9 @@ const createLogger = (environment) => {
|
|
|
11
11
|
if (!environment.production) {
|
|
12
12
|
loglevel_1.default.setLevel('TRACE');
|
|
13
13
|
}
|
|
14
|
+
else {
|
|
15
|
+
loglevel_1.default.setLevel('ERROR');
|
|
16
|
+
}
|
|
14
17
|
const PREVIOUS_VERSION_KEY = 'altair__debug_previous_version';
|
|
15
18
|
const CURRENT_VERSION_KEY = 'altair__debug_current_version';
|
|
16
19
|
const previousVersion = () => localStorage.getItem(PREVIOUS_VERSION_KEY);
|
|
@@ -38,6 +41,9 @@ const createLogger = (environment) => {
|
|
|
38
41
|
console.groupEnd();
|
|
39
42
|
loglevel_1.default.setLevel('TRACE');
|
|
40
43
|
}
|
|
44
|
+
else {
|
|
45
|
+
loglevel_1.default.setLevel('ERROR');
|
|
46
|
+
}
|
|
41
47
|
window._ALTAIR__ENABLE_DEBUG_MODE__ = value;
|
|
42
48
|
},
|
|
43
49
|
});
|
package/build/plugin/panel.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PluginParentEngine } from './v3/parent-engine';
|
|
2
|
+
import { SafeHtml } from '@angular/platform-browser';
|
|
2
3
|
export declare enum AltairPanelLocation {
|
|
3
4
|
HEADER = "header",
|
|
4
5
|
SIDEBAR = "sidebar",
|
|
@@ -12,9 +13,12 @@ export declare class AltairPanel {
|
|
|
12
13
|
element: HTMLElement;
|
|
13
14
|
location: AltairPanelLocation;
|
|
14
15
|
engine?: PluginParentEngine | undefined;
|
|
16
|
+
iconUrl?: string | undefined;
|
|
17
|
+
iconSvg?: SafeHtml | undefined;
|
|
15
18
|
id: string;
|
|
16
19
|
isActive: boolean;
|
|
17
|
-
constructor(title: string, element: HTMLElement, location: AltairPanelLocation, engine?: PluginParentEngine | undefined);
|
|
20
|
+
constructor(title: string, element: HTMLElement, location: AltairPanelLocation, engine?: PluginParentEngine | undefined, iconUrl?: string | undefined, iconSvg?: SafeHtml | undefined);
|
|
21
|
+
setActive(isActive: boolean): void;
|
|
18
22
|
destroy(): void;
|
|
19
23
|
}
|
|
20
24
|
//# sourceMappingURL=panel.d.ts.map
|
package/build/plugin/panel.js
CHANGED
|
@@ -11,14 +11,19 @@ export var AltairPanelLocation;
|
|
|
11
11
|
export class AltairPanel {
|
|
12
12
|
constructor(title, element, location,
|
|
13
13
|
// TODO: Making this optional for now for backward compatibility. This should be required for v3 plugins.
|
|
14
|
-
engine) {
|
|
14
|
+
engine, iconUrl, iconSvg) {
|
|
15
15
|
this.title = title;
|
|
16
16
|
this.element = element;
|
|
17
17
|
this.location = location;
|
|
18
18
|
this.engine = engine;
|
|
19
|
+
this.iconUrl = iconUrl;
|
|
20
|
+
this.iconSvg = iconSvg;
|
|
19
21
|
this.id = uuid();
|
|
20
22
|
this.isActive = false;
|
|
21
23
|
}
|
|
24
|
+
setActive(isActive) {
|
|
25
|
+
this.isActive = isActive;
|
|
26
|
+
}
|
|
22
27
|
destroy() {
|
|
23
28
|
this.element = null;
|
|
24
29
|
}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import { IMessage, ISendMessageDto, ISession } from '../../ai/types';
|
|
1
2
|
import { ICustomTheme } from '../../theme';
|
|
3
|
+
import { IPlan, IAvailableCredits } from '../../types/state/account.interfaces';
|
|
2
4
|
import { ExportWindowState } from '../../types/state/window.interfaces';
|
|
3
5
|
import { CreateActionOptions, CreatePanelOptions, PluginWindowState } from '../context/context.interface';
|
|
4
6
|
import { PluginEvent, PluginEventCallback } from '../event/event.interfaces';
|
|
7
|
+
export interface PluginUserInfo {
|
|
8
|
+
loggedIn: boolean;
|
|
9
|
+
name: string;
|
|
10
|
+
email: string;
|
|
11
|
+
avatar: string;
|
|
12
|
+
plan?: IPlan;
|
|
13
|
+
}
|
|
5
14
|
export interface PluginV3Context {
|
|
6
15
|
/**
|
|
7
16
|
* Returns data about a window (tab) in the app
|
|
@@ -75,5 +84,14 @@ export interface PluginV3Context {
|
|
|
75
84
|
* Enable a theme in the app
|
|
76
85
|
*/
|
|
77
86
|
enableTheme(name: string, darkMode?: boolean): Promise<void>;
|
|
87
|
+
getUserInfo(): Promise<PluginUserInfo | undefined>;
|
|
88
|
+
getAvailableCredits(): Promise<IAvailableCredits | undefined>;
|
|
89
|
+
getActiveAiSession(): Promise<ISession | undefined>;
|
|
90
|
+
createAiSession(): Promise<ISession | undefined>;
|
|
91
|
+
getAiSessionMessages(sessionId: string): Promise<IMessage[] | undefined>;
|
|
92
|
+
sendMessageToAiSession(sessionId: string, message: ISendMessageDto): Promise<{
|
|
93
|
+
response: string;
|
|
94
|
+
} | undefined>;
|
|
95
|
+
rateAiSessionMessage(sessionId: string, messageId: string, rating: number): Promise<IMessage | undefined>;
|
|
78
96
|
}
|
|
79
97
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -102,6 +102,27 @@ export class PluginFrameEngine {
|
|
|
102
102
|
enableTheme: (...args) => {
|
|
103
103
|
return this.worker.request('enableTheme', ...args);
|
|
104
104
|
},
|
|
105
|
+
getUserInfo: async () => {
|
|
106
|
+
return this.worker.request('getUserInfo');
|
|
107
|
+
},
|
|
108
|
+
getAvailableCredits: async () => {
|
|
109
|
+
return this.worker.request('getAvailableCredits');
|
|
110
|
+
},
|
|
111
|
+
createAiSession: async (...args) => {
|
|
112
|
+
return this.worker.request('createAiSession', ...args);
|
|
113
|
+
},
|
|
114
|
+
getActiveAiSession: async (...args) => {
|
|
115
|
+
return this.worker.request('getActiveAiSession', ...args);
|
|
116
|
+
},
|
|
117
|
+
getAiSessionMessages: async (...args) => {
|
|
118
|
+
return this.worker.request('getAiSessionMessages', ...args);
|
|
119
|
+
},
|
|
120
|
+
sendMessageToAiSession: async (...args) => {
|
|
121
|
+
return this.worker.request('sendMessageToAiSession', ...args);
|
|
122
|
+
},
|
|
123
|
+
rateAiSessionMessage: async (...args) => {
|
|
124
|
+
return this.worker.request('rateAiSessionMessage', ...args);
|
|
125
|
+
},
|
|
105
126
|
};
|
|
106
127
|
this.ctx = ctx;
|
|
107
128
|
return ctx;
|
|
@@ -8,7 +8,16 @@ interface PluginJsEntry {
|
|
|
8
8
|
scripts: string[];
|
|
9
9
|
styles: string[];
|
|
10
10
|
}
|
|
11
|
-
type PluginEntry = PluginHtmlEntry | PluginJsEntry;
|
|
11
|
+
export type PluginEntry = PluginHtmlEntry | PluginJsEntry;
|
|
12
|
+
interface PluginIconImage {
|
|
13
|
+
type: 'image';
|
|
14
|
+
url: string;
|
|
15
|
+
}
|
|
16
|
+
interface PluginIconSvg {
|
|
17
|
+
type: 'svg';
|
|
18
|
+
src: string;
|
|
19
|
+
}
|
|
20
|
+
export type PluginIcon = PluginIconImage | PluginIconSvg;
|
|
12
21
|
export interface PluginV3Manifest {
|
|
13
22
|
/**
|
|
14
23
|
* Version of manifest (should be 3). It is a control measure for variations in the plugin versions
|
|
@@ -46,6 +55,14 @@ export interface PluginV3Manifest {
|
|
|
46
55
|
* Name of the author of the plugin
|
|
47
56
|
*/
|
|
48
57
|
author?: string;
|
|
58
|
+
/**
|
|
59
|
+
* The minimum version of Altair that the plugin is compatible with. This is useful for when the plugin uses features that are only available in a certain version of Altair
|
|
60
|
+
*/
|
|
61
|
+
minimum_altair_version?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The icon of the plugin. It can be an image or an SVG
|
|
64
|
+
*/
|
|
65
|
+
icon?: PluginIcon;
|
|
49
66
|
}
|
|
50
67
|
export {};
|
|
51
68
|
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -6,6 +6,7 @@ interface BasePluginParentWorkerOptions {
|
|
|
6
6
|
instanceType?: InstanceType;
|
|
7
7
|
additionalParams?: Record<string, string>;
|
|
8
8
|
additionalSandboxAttributes?: string[];
|
|
9
|
+
width?: number;
|
|
9
10
|
}
|
|
10
11
|
interface PluginParentWorkerOptionsWithScripts extends BasePluginParentWorkerOptions {
|
|
11
12
|
type: 'scripts';
|
|
@@ -19,6 +19,10 @@ export class PluginParentWorker extends EvaluatorWorker {
|
|
|
19
19
|
iframe.style.width = '100%';
|
|
20
20
|
iframe.style.height = '100%';
|
|
21
21
|
iframe.style.border = 'none';
|
|
22
|
+
iframe.style.display = 'block'; // fixes issue with vertical scrollbar appearing https://stackoverflow.com/a/9131632/3929126
|
|
23
|
+
if ('width' in this.opts && this.opts.width) {
|
|
24
|
+
iframe.style.minWidth = `${this.opts.width}px`;
|
|
25
|
+
}
|
|
22
26
|
}
|
|
23
27
|
else {
|
|
24
28
|
iframe.style.display = 'none';
|
|
@@ -26,6 +26,11 @@ export interface IPlanInfo {
|
|
|
26
26
|
currency: string;
|
|
27
27
|
interval: string;
|
|
28
28
|
}
|
|
29
|
+
export interface IAvailableCredits {
|
|
30
|
+
fixed: number;
|
|
31
|
+
monthly: number;
|
|
32
|
+
total: number;
|
|
33
|
+
}
|
|
29
34
|
export interface AccountState {
|
|
30
35
|
loggedIn: boolean;
|
|
31
36
|
accessToken: string;
|
|
@@ -37,6 +42,7 @@ export interface AccountState {
|
|
|
37
42
|
stats?: Stats;
|
|
38
43
|
plan?: IPlan;
|
|
39
44
|
planInfos?: IPlanInfo[];
|
|
45
|
+
availableCredits?: IAvailableCredits;
|
|
40
46
|
}
|
|
41
47
|
export declare class TeamId extends ValueObject<string> {
|
|
42
48
|
}
|
package/build/utils/logger.js
CHANGED
|
@@ -5,6 +5,9 @@ export const createLogger = (environment) => {
|
|
|
5
5
|
if (!environment.production) {
|
|
6
6
|
loglevel.setLevel('TRACE');
|
|
7
7
|
}
|
|
8
|
+
else {
|
|
9
|
+
loglevel.setLevel('ERROR');
|
|
10
|
+
}
|
|
8
11
|
const PREVIOUS_VERSION_KEY = 'altair__debug_previous_version';
|
|
9
12
|
const CURRENT_VERSION_KEY = 'altair__debug_current_version';
|
|
10
13
|
const previousVersion = () => localStorage.getItem(PREVIOUS_VERSION_KEY);
|
|
@@ -32,6 +35,9 @@ export const createLogger = (environment) => {
|
|
|
32
35
|
console.groupEnd();
|
|
33
36
|
loglevel.setLevel('TRACE');
|
|
34
37
|
}
|
|
38
|
+
else {
|
|
39
|
+
loglevel.setLevel('ERROR');
|
|
40
|
+
}
|
|
35
41
|
window._ALTAIR__ENABLE_DEBUG_MODE__ = value;
|
|
36
42
|
},
|
|
37
43
|
});
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "altair-graphql-core",
|
|
3
3
|
"description": "Several of the core logic for altair graphql client",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.3.3",
|
|
5
5
|
"author": "Samuel Imolorhe <altair@sirmuel.design> (https://sirmuel.design)",
|
|
6
6
|
"bugs": "https://github.com/altair-graphql/altair/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
+
"@angular/platform-browser": "17.0.8",
|
|
8
9
|
"@apollo/client": "3.3.20",
|
|
9
10
|
"abab": "2.0.6",
|
|
10
11
|
"actioncable": "5.2.6",
|
|
@@ -34,8 +35,10 @@
|
|
|
34
35
|
"@angular/common": "17.0.8",
|
|
35
36
|
"@jest/globals": "^29.7.0",
|
|
36
37
|
"@types/actioncable": "^5.2.5",
|
|
38
|
+
"@types/color-name": "^1.1.4",
|
|
37
39
|
"@types/crypto-js": "^4.0.1",
|
|
38
40
|
"@types/jest": "^29.5.12",
|
|
41
|
+
"@types/json-bigint": "^1.0.1",
|
|
39
42
|
"@types/node": "^14.14.41",
|
|
40
43
|
"@types/uuid": "^9.0.5",
|
|
41
44
|
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
|
@@ -76,5 +79,5 @@
|
|
|
76
79
|
"test": "jest"
|
|
77
80
|
},
|
|
78
81
|
"types": "./build/index.d.ts",
|
|
79
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "2891694162b28e2b394ae6f984de8e7fc1b15a3f"
|
|
80
83
|
}
|