ac-storage 0.16.2 → 0.16.4

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.
Files changed (82) hide show
  1. package/afron/.vscode/launch.json +43 -0
  2. package/afron/.vscode/tasks.json +56 -0
  3. package/afron/LICENSE +674 -0
  4. package/afron/README.md +23 -0
  5. package/afron/_img/01.png +0 -0
  6. package/afron/_img/02.png +0 -0
  7. package/afron/package.json +40 -0
  8. package/afron/packages/chatai-models/package.json +34 -0
  9. package/afron/packages/core/package.json +65 -0
  10. package/afron/packages/core/vite.config.ts +17 -0
  11. package/afron/packages/electron/build/entitlements.mac.plist +33 -0
  12. package/afron/packages/electron/forge.config.js +66 -0
  13. package/afron/packages/electron/import-static.ps1 +14 -0
  14. package/afron/packages/electron/package.json +147 -0
  15. package/afron/packages/electron/rebuild.bat +1 -0
  16. package/afron/packages/front/.env.development +1 -0
  17. package/afron/packages/front/.github/copilot-instructions.md +88 -0
  18. package/afron/packages/front/eslint.config.js +33 -0
  19. package/afron/packages/front/index.html +13 -0
  20. package/afron/packages/front/package.json +74 -0
  21. package/afron/packages/front/public/favicon.icns +0 -0
  22. package/afron/packages/front/public/favicon.ico +0 -0
  23. package/afron/packages/front/public/favicon.png +0 -0
  24. package/afron/packages/front/public/robots.txt +3 -0
  25. package/afron/packages/front/public/vite.svg +1 -0
  26. package/afron/packages/front/tsconfig.app.json +44 -0
  27. package/afron/packages/front/tsconfig.node.json +24 -0
  28. package/afron/packages/front/vite.config.ts +53 -0
  29. package/afron/packages/locale/package.json +65 -0
  30. package/afron/packages/locale/vite.config.ts +17 -0
  31. package/afron/packages/types/index.js +3 -0
  32. package/afron/packages/types/package.json +6 -0
  33. package/afron/packages/types/types/chatai/chatai-model.d.ts +73 -0
  34. package/afron/packages/types/types/chatai/gemini-safety-setting.d.ts +15 -0
  35. package/afron/packages/types/types/chatai/index.d.ts +3 -0
  36. package/afron/packages/types/types/chatai/thinking-efforts.d.ts +4 -0
  37. package/afron/packages/types/types/event-pipe/global-event.d.ts +43 -0
  38. package/afron/packages/types/types/event-pipe/index.d.ts +1 -0
  39. package/afron/packages/types/types/index.d.ts +8 -0
  40. package/afron/packages/types/types/ipc/data.ts +114 -0
  41. package/afron/packages/types/types/ipc/declared.d.ts +1 -0
  42. package/afron/packages/types/types/ipc/index.ts +6 -0
  43. package/afron/packages/types/types/ipc/interface.d.ts +46 -0
  44. package/afron/packages/types/types/ipc/invokers.d.ts +181 -0
  45. package/afron/packages/types/types/ipc/listeners.d.ts +7 -0
  46. package/afron/packages/types/types/ipc/result.d.ts +3 -0
  47. package/afron/packages/types/types/ipc-invokers.d.ts +111 -0
  48. package/afron/packages/types/types/ipc-listeners.d.ts +6 -0
  49. package/afron/packages/types/types/prompt-form.d.ts +65 -0
  50. package/afron/packages/types/types/rt/event.d.ts +71 -0
  51. package/afron/packages/types/types/rt/flow.d.ts +63 -0
  52. package/afron/packages/types/types/rt/form.d.ts +41 -0
  53. package/afron/packages/types/types/rt/index.d.ts +4 -0
  54. package/afron/packages/types/types/rt/rt.d.ts +61 -0
  55. package/afron/packages/types/types/rt-var/index.ts +5 -0
  56. package/afron/packages/types/types/rt-var/rt-var-create.ts +39 -0
  57. package/afron/packages/types/types/rt-var/rt-var-stored.ts +30 -0
  58. package/afron/packages/types/types/rt-var/rt-var-update.ts +45 -0
  59. package/afron/packages/types/types/rt-var/rt-var.ts +36 -0
  60. package/afron/packages/types/types/rt-var/var-data.d.ts +108 -0
  61. package/afron/packages/types/types/storage-schema/ProfileStorageSchema.d.ts +2 -0
  62. package/afron/packages/types/types/storage-schema/RT/Flow.d.ts +20 -0
  63. package/afron/packages/types/types/storage-schema/RT/Metadata.d.ts +16 -0
  64. package/afron/packages/types/types/storage-schema/RT/Prompts.d.ts +39 -0
  65. package/afron/packages/types/types/storage-schema/RT/RT.d.ts +4 -0
  66. package/afron/packages/types/types/storage-schema/RT/index.d.ts +1 -0
  67. package/afron/packages/types/types/storage-schema/Session/Cache.d.ts +18 -0
  68. package/afron/packages/types/types/storage-schema/Session/Config.d.ts +7 -0
  69. package/afron/packages/types/types/storage-schema/Session/Data.d.ts +19 -0
  70. package/afron/packages/types/types/storage-schema/Session/Session.d.ts +3 -0
  71. package/afron/packages/types/types/storage-schema/Session/index.d.ts +1 -0
  72. package/afron/packages/types/types/storage-schema/index.d.ts +116 -0
  73. package/afron/packages/types/types/utils/index.ts +1 -0
  74. package/afron/packages/types/types.d.ts +3 -0
  75. package/afron/scripts/remove-dist.ps1 +10 -0
  76. package/afron/scripts/remove-install.ps1 +9 -0
  77. package/afron/scripts/win-vscode.ps1 +17 -0
  78. package/dist/bundle.cjs +43 -2
  79. package/dist/bundle.cjs.map +1 -1
  80. package/dist/bundle.mjs +43 -2
  81. package/dist/bundle.mjs.map +1 -1
  82. package/package.json +2 -2
@@ -0,0 +1,181 @@
1
+ import { ChatAIModelData } from '../chatai/chatai-model';
2
+ import { GlobalModelConfiguration, ProfileStorage } from '../storage-struct';
3
+ import { RTMetadata, RTMetadataTree } from '../rt/rt';
4
+ import { RTFormNaive, RTPromptDataEditable, RTPromptMetadata } from '../rt/form';
5
+ import { RTFlowData } from '../rt';
6
+
7
+ import { EResult, ENoResult, } from './result';
8
+ import { CustomModel, HistoryMessage, HistoryMetadata, HistorySearch, InputFileHash, InputFilePreview, InputFilesUpdateInfo, VersionInfo } from './data';
9
+ import { KeyValueInput } from './declared';
10
+ import { RTVar, RTVarCreate, RTVarUpdate } from '../rt-var';
11
+
12
+ export interface IPCInvokerGeneral {
13
+ echo(message: string): EResult<string>;
14
+ openBrowser(url: string): ENoResult;
15
+ getCurrentVersion(): EResult<string>;
16
+ getAvailableVersion(prerelease: boolean): EResult<VersionInfo>;
17
+ getChatAIModels(): EResult<ChatAIModelData>;
18
+
19
+ existsLegacyData(): EResult<boolean>;
20
+ migrateLegacyData(): ENoResult;
21
+ ignoreLegacyData(): ENoResult;
22
+ }
23
+ export declare namespace IPCInvokers {
24
+ interface General {
25
+ echo(message: string): EResult<string>;
26
+ openBrowser(url: string): ENoResult;
27
+ getCurrentVersion(): EResult<string>;
28
+ getAvailableVersion(prerelease: boolean): EResult<VersionInfo>;
29
+ getChatAIModels(): EResult<ChatAIModelData>;
30
+
31
+ existsLegacyData(): EResult<boolean>;
32
+ migrateLegacyData(): ENoResult;
33
+ ignoreLegacyData(): ENoResult;
34
+ }
35
+
36
+ interface GlobalStorage {
37
+ get(storageName: string, keys: string[]): EResult<Record<string, any>>;
38
+ set(storageName: string, data: KeyValueInput): ENoResult;
39
+ }
40
+
41
+ interface MasterKey {
42
+ init(): EResult<'normal' | 'need-recovery' | 'no-data' | 'invalid-data'>;
43
+ reset(recoveryKey: string): ENoResult;
44
+ recover(recoveryKey: string): EResult<boolean>;
45
+ }
46
+
47
+ interface Profiles {
48
+ create(): EResult<string>;
49
+ delete(profileName: string): ENoResult;
50
+ getIds(): EResult<string[]>;
51
+
52
+ getLast(): EResult<string | null>;
53
+ setLast(profileName: string | null): ENoResult;
54
+
55
+ getOrphanIds(): EResult<string[]>;
56
+ recoverOrphan(profileId: string): ENoResult;
57
+ }
58
+
59
+ interface Profile {
60
+ getCustomModels(profileId: string): EResult<CustomModel[]>;
61
+ setCustomModel(profileId: string, model: CustomModel): EResult<string>;
62
+ removeCustomModel(profileId: string, customId: string): ENoResult;
63
+
64
+ getGlobalModelConfig(profileId: string, modelId: string): EResult<GlobalModelConfiguration>;
65
+ setGlobalModelConfig(profileId: string, modelId: string, config: GlobalModelConfiguration): ENoResult;
66
+ }
67
+
68
+ interface ProfileStorage {
69
+ get(profileId: string, accessor: string, keys: string[]): EResult<Record<string, any>>;
70
+ set(profileId: string, accessor: string, data: KeyValueInput): ENoResult;
71
+ getAsText(profileId: string, accessor: string): EResult<string>;
72
+ setAsText(profileId: string, accessor: string, value: string): ENoResult;
73
+ getAsBinary(profileId: string, accessor: string): EResult<Buffer>;
74
+ setAsBinary(profileId: string, accessor: string, content: Buffer): ENoResult;
75
+ verifyAsSecret(profileId: string, accessor: string, keys: string[]): EResult<boolean[]>;
76
+ setAsSecret(profileId: string, accessor: string, data: KeyValueInput): ENoResult;
77
+ removeAsSecret(profileId: string, accessor: string, keys: string[]): ENoResult;
78
+ }
79
+
80
+ interface ProfileSessions {
81
+ add(profileId: string): EResult<string>;
82
+ remove(profileId: string, sessionId: string): ENoResult;
83
+ undoRemoved(profileId: string): EResult<string>;
84
+ reorder(profileId: string, sessions: string[]): ENoResult;
85
+ getIds(profileId: string): EResult<string[]>;
86
+ }
87
+
88
+ interface ProfileSession {
89
+ getFormValues(profileId: string, sessionId: string, rtId: string): EResult<Record<string, any>>;
90
+ setFormValues(profileId: string, sessionId: string, rtId: string, values: Record<string, any>): ENoResult;
91
+ }
92
+
93
+ interface ProfileSessionStorage {
94
+ get(profileId: string, sessionId: string, accessor: string, keys: string[]): EResult<Record<string, any>>;
95
+ set(profileId: string, sessionId: string, accessor: string, key: KeyValueInput): ENoResult;
96
+ // getInputFiles(profileId: string, sessionId: string, fileHashes: string[]): EResult<InputFileEntry[]>;
97
+ getInputFilePreviews(profileId: string, sessionId: string): EResult<InputFilePreview[]>;
98
+ addInputFile(profileId: string, sessionId: string, filename: string, dataURI: string): EResult<InputFilePreview>;
99
+ updateInputFiles(profileId: string, sessionId: string, fileHashes: InputFileHash[]): EResult<InputFilesUpdateInfo>;
100
+ }
101
+
102
+ interface ProfileSessionHistory {
103
+ get(profileId: string, sessionId: string, offset: number, limit: number, desc: boolean): EResult<HistoryMetadata[]>;
104
+ search(profileId: string, sessionId: string, offset: number, limit: number, search: HistorySearch): EResult<HistoryMetadata[]>;
105
+ getMessage(profileId: string, sessionId: string, historyId: number[]): EResult<HistoryMessage[]>;
106
+ deleteMessage(profileId: string, sessionId: string, historyId: number, origin: 'in' | 'out' | 'both'): ENoResult;
107
+ delete(profileId: string, sessionId: string, historyKey: number): ENoResult;
108
+ deleteAll(profileId: string, sessionId: string): ENoResult;
109
+ }
110
+
111
+ interface ProfileRTs {
112
+ getTree(profileId: string): EResult<RTMetadataTree>;
113
+ updateTree(profileId: string, tree: RTMetadataTree): ENoResult;
114
+ /** @deprecated use createUsingTemplate instead */
115
+ add(profileId: string, rt: RTMetadata): ENoResult;
116
+ createUsingTemplate(profileId: string, rtMetadata: RTMetadata, templateId: string): ENoResult;
117
+ remove(profileId: string, rtId: string): ENoResult;
118
+
119
+ existsId(profileId: string, rtId: string): EResult<boolean>;
120
+
121
+ generateId(profileId: string): EResult<string>;
122
+ changeId(profileId: string, oldRTId: string, newRTId: string): ENoResult;
123
+
124
+ importFile(token: string, profileId: string): ENoResult;
125
+ exportFile(token: string, profileId: string, rtId: string): ENoResult;
126
+ }
127
+
128
+ interface ProfileRT {
129
+ getMetadata(profileId: string, rtId: string): EResult<ProfileStorage.RT.Index>;
130
+ setMetadata(profileId: string, rtId: string, metadata: KeyValueInput): ENoResult;
131
+ reflectMetadata(profileId: string, rtId: string): ENoResult;
132
+
133
+ getForms(profileId: string, rtId: string): EResult<RTFormNaive[]>;
134
+ }
135
+
136
+ interface ProfileRTStorage {
137
+ get(profileId: string, rtId: string, accessor: string, keys: string[]): EResult<Record<string, any>>;
138
+ set(profileId: string, rtId: string, accessor: string, data: KeyValueInput): ENoResult;
139
+ }
140
+
141
+ interface ProfileRTPrompt {
142
+ getMetadata(profileId: string, rtId: string, promptId: string): EResult<RTPromptMetadata>;
143
+ setMetadata(profileId: string, rtId: string, promptId: string, metadata: RTPromptDataEditable): ENoResult;
144
+
145
+ getName(profileId: string, rtId: string, promptId: string): EResult<string>;
146
+ setName(profileId: string, rtId: string, promptId: string, name: string): ENoResult;
147
+
148
+ getVariableNames(profileId: string, rtId: string, promptId: string): EResult<string[]>;
149
+
150
+ getVariables(profileId: string, rtId: string, promptId: string): EResult<RTVar[]>;
151
+ setVariables(profileId: string, rtId: string, promptId: string, forms: (RTVarCreate | RTVarUpdate)[]): EResult<string[]>;
152
+ removeVariables(profileId: string, rtId: string, promptId: string, formIds: string[]): ENoResult;
153
+ getContents(profileId: string, rtId: string, promptId: string): EResult<string>;
154
+ setContents(profileId: string, rtId: string, promptId: string, contents: string): ENoResult;
155
+ }
156
+
157
+ interface ProfileRTFlow {
158
+ getFlowData(profileId: string, rtId: string): EResult<RTFlowData>;
159
+ setFlowData(profileId: string, rtId: string, data: RTFlowData): ENoResult;
160
+
161
+ getPrompts(profileId: string, rtId: string): EResult<ProfileStorage.RT.PromptOrder>;
162
+ setPrompts(profileId: string, rtId: string, order: ProfileStorage.RT.PromptOrder): ENoResult;
163
+
164
+ /**
165
+ * 프롬프트 추가
166
+ * @return 갱신된 프롬프트 순서 정보
167
+ */
168
+ addPrompt(profileId: string, rtId: string, promptId: string, promptName: string): EResult<ProfileStorage.RT.PromptOrder>;
169
+ /**
170
+ * 프롬프트 제거
171
+ * @return 갱신된 프롬프트 순서 정보
172
+ */
173
+ removePrompt(profileId: string, rtId: string, promptId: string): EResult<ProfileStorage.RT.PromptOrder>;
174
+ }
175
+
176
+ interface Request {
177
+ requestRT(token: string, profileId: string, sessionId: string): ENoResult;
178
+ previewPrompt(token: string, profileId: string, sessionId: string): ENoResult;
179
+ abort(token: string): ENoResult;
180
+ }
181
+ }
@@ -0,0 +1,7 @@
1
+ import { ENoResult, EResult } from './result';
2
+
3
+ export type IPCListenersInterface = {
4
+ AddRequestListener(listener: (event: any, token: string, data: any) => void): EResult<number>;
5
+ RemoveRequestListener(bindId: number): ENoResult;
6
+ }
7
+
@@ -0,0 +1,3 @@
1
+ export type EError = { name: string, message: string, [key: string]: any };
2
+ export type EResult<T> = Promise<readonly [EError] | readonly [null, T]>;
3
+ export type ENoResult = Promise<readonly [EError | null]>;
@@ -0,0 +1,111 @@
1
+ /**
2
+ * electron에서 ipcRenderer.invoke() 를 통해 front로 노출시킬 명령어
3
+ *
4
+ * share/ipc-command.d.ts 와 electron/types/ipc.ts 는 동일하게 유지되어야 함
5
+ */
6
+ export enum IPCInvokerName {
7
+ Echo = 'Echo',
8
+ OpenBrowser = 'OpenBrowser',
9
+ GetChatAIModels = 'GetChatAIModels',
10
+
11
+ /* 요청 수행 */
12
+ FetchData = 'FetchData',
13
+ AbortFetchRequest = 'AbortFetchRequest',
14
+ GetFetchResponse = 'GetFetchResponse',
15
+
16
+ /* 마스터 키 */
17
+ InitMasterKey = 'InitMasterKey',
18
+ ResetMasterKey = 'ResetMasterKey',
19
+ RecoverMasterKey = 'RecoverMasterKey',
20
+
21
+ /* 전역 스토리지 */
22
+ GetGlobalData = 'GetGlobalData',
23
+ SetGlobalData = 'SetGlobalData',
24
+
25
+ /* 프로필 */
26
+ CreateProfile = 'CreateProfile',
27
+ DeleteProfile = 'DeleteProfile',
28
+
29
+ /* 프로필 목록 */
30
+ GetProfileList = 'GetProfileList',
31
+ GetLastProfile = 'GetLastProfile',
32
+ SetLastProfile = 'SetLastProfile',
33
+
34
+ /* 프로필 저장소 */
35
+ GetProfileData = 'GetProfileData',
36
+ SetProfileData = 'SetProfileData',
37
+ PushProfileDataToArray = 'PushProfileDataToArray',
38
+ GetProfileDataAsText = 'GetProfileDataAsText',
39
+ SetProfileDataAsText = 'SetProfileDataAsText',
40
+ GetProfileDataAsBinary = 'GetProfileDataAsBinary',
41
+ SetProfileDataAsBinary = 'SetProfileDataAsBinary',
42
+ VerifyProfileDataAsSecret = 'VerifyProfileDataAsSecret',
43
+ SetProfileDataAsSecret = 'SetProfileDataAsSecret',
44
+ RemoveProfileDataAsSecret = 'RemoveProfileDataAsSecret',
45
+ PushProfileDataToArrayAsSecret = 'PushProfileDataToArrayAsSecret',
46
+
47
+ /* 프로필 프롬프트 */
48
+ GetProfilePromptTree = 'GetProfilePromptTree',
49
+ UpdateProfilePromptTree = 'UpdateProfilePromptTree',
50
+ AddProfilePrompt = 'AddProfilePrompt',
51
+ RemoveProfilePrompt = 'RemoveProfilePrompt',
52
+
53
+ /* 프로필 세션 */
54
+ AddProfileSession = 'AddProfileSession',
55
+ RemoveProfileSession = 'RemoveProfileSession',
56
+ GetProfileSessionIds = 'GetProfileSessionIds',
57
+ ReorderProfileSessions = 'ReorderProfileSessions',
58
+ UndoRemoveProfileSession = 'UndoRemoveProfileSession',
59
+
60
+ /* 프로필 세션 저장소 */
61
+ GetProfileSessionData = 'GetProfileSessionData',
62
+ SetProfileSessionData = 'SetProfileSessionData',
63
+
64
+ /* 프로필 세션 히스토리 */
65
+ GetProfileSessionHistoryMetadata = 'GetProfileSessionHistoryMetadata',
66
+ SearchProfileSessionHistoryMetadata = 'SearchProfileSessionHistoryMetadata',
67
+ GetProfileSessionHistoryMessage = 'GetProfileSessionHistoryMessage',
68
+ AddProfileSessionHistory = 'AddProfileSessionHistory',
69
+ DeleteProfileSessionHistory = 'DeleteProfileSessionHistory',
70
+ DeleteAllProfileSessionHistory = 'DeleteAllProfileSessionHistory',
71
+
72
+ /* 프로필 RT (전역) */
73
+ GetProfileRTTree = 'GetProfileRTTree',
74
+ UpdateProfileRTTree = 'UpdateProfileRTTree',
75
+ AddProfileRT = 'AddProfileRT',
76
+ RemoveProfileRT = 'RemoveProfileRT',
77
+ GetProfileRTMode = 'GetProfileRTMode',
78
+ SetProfileRTMode = 'SetProfileRTMode',
79
+ GetProfileRTPromptData = 'GetProfileRTPromptData',
80
+ SetProfileRTPromptData = 'SetProfileRTPromptData',
81
+ HasProfileRTId = 'HasProfileRTId',
82
+ GenerateProfileRTId = 'GenerateProfileRTId',
83
+ ChangeProfileRTId = 'ChangeProfileRTId',
84
+ GetProfileRTData = 'GetProfileRTData',
85
+ SetProfileRTData = 'SetProfileRTData',
86
+ ReflectProfileRTMetadata = 'ReflectProfileRTMetadata',
87
+
88
+ /* 프로필 RT */
89
+ AddProfileRTNode = 'AddProfileRTNode',
90
+ RemoveProfileRTNode = 'RemoveProfileRTNode',
91
+ UpdateProfileRTNodeData = 'UpdateProfileRTNodeData',
92
+ ConnectProfileRTNode = 'ConnectProfileRTNode',
93
+ DisconnectProfileRTNode = 'DisconnectProfileRTNode',
94
+
95
+ GetProfileRTMetadata = 'GetProfileRTMetadata',
96
+ SetProfileRTMetadata = 'SetProfileRTMetadata',
97
+
98
+ GetProfileRTPromptMetadata = 'GetProfileRTPromptMetadata',
99
+ SetProfileRTPromptMetadata = 'SetProfileRTPromptMetadata',
100
+ GetProfileRTPromptForms = 'GetProfileRTPromptForms',
101
+ SetProfileRTPromptForm = 'SetProfileRTPromptForm',
102
+ RemoveProfileRTPromptForm = 'RemoveProfileRTPromptForm',
103
+ GetProfileRTPromptContents = 'GetProfileRTPromptContents',
104
+ SetProfileRTPromptContents = 'SetProfileRTPromptContents',
105
+
106
+ /* 프로필 RT 요청 */
107
+ RequestProfileRT = 'RequestProfileRT',
108
+ AbortProfileRTRequest = 'AbortProfileRTRequest',
109
+ }
110
+
111
+ export {};
@@ -0,0 +1,6 @@
1
+ export enum IPCListenerName {
2
+ AddRequestListener = 'AddRequestListener',
3
+ RemoveRequestListener = 'RemoveRequestListener',
4
+ }
5
+
6
+ export {};
@@ -0,0 +1,65 @@
1
+ // declare global {
2
+ // type PromptVarType = 'text' | 'number' | 'checkbox' | 'select' | 'struct' | 'array';
3
+
4
+ // type PromptVar = (
5
+ // PromptVarText | PromptVarNumber | PromptVarCheckbox | PromptVarSelect | PromptVarStruct | PromptVarArray
6
+ // );
7
+
8
+ // type BasePromptVar = {
9
+ // /**
10
+ // * setter 작업시 id가 없다면 생성, 있다면 갱신 작업 수행
11
+ // */
12
+ // id?: string;
13
+ // name: string;
14
+ // display_name: string;
15
+
16
+ // include_type: 'form' | 'constant' | 'external';
17
+ // /** include_type='constant' 인 경우 값 */
18
+ // value?: unknown;
19
+ // /** include_type='external' 인 경우 외부 id 값 */
20
+ // external_id?: string;
21
+ // /**
22
+ // * include_type='form' 인 경우 외부 form Id
23
+ // *
24
+ // * null인 경우 promptVar의 id가 form_id가 됨 (이전버전 호환성)
25
+ // */
26
+ // form_id?: string | null;
27
+ // }
28
+ // interface PromptVarText extends BasePromptVar {
29
+ // type: 'text';
30
+ // default_value?: string;
31
+ // placeholder: string;
32
+ // allow_multiline: boolean;
33
+ // }
34
+ // interface PromptVarNumber extends BasePromptVar {
35
+ // type: 'number';
36
+ // allow_decimal: boolean;
37
+ // default_value?: number;
38
+ // maximum_value?: number;
39
+ // minimum_value?: number;
40
+ // }
41
+ // interface PromptVarCheckbox extends BasePromptVar {
42
+ // type: 'checkbox';
43
+ // default_value?: boolean;
44
+ // }
45
+ // interface PromptVarSelect extends BasePromptVar {
46
+ // type: 'select';
47
+ // default_value?: string;
48
+ // options: {
49
+ // name: string;
50
+ // value: string;
51
+ // }[];
52
+ // }
53
+ // interface PromptVarStruct extends BasePromptVar {
54
+ // type: 'struct';
55
+ // fields: Exclude<PromptVar, PromptVarStruct | PromptVarArray>[];
56
+ // }
57
+ // interface PromptVarArray extends BasePromptVar {
58
+ // type: 'array';
59
+ // minimum_length?: number;
60
+ // maximum_length?: number;
61
+ // element: Exclude<PromptVar, PromptVarArray>;
62
+ // }
63
+ // }
64
+
65
+ export { };
@@ -0,0 +1,71 @@
1
+ import '../prompt-form';
2
+
3
+ type RTEventDataError = {
4
+ type: 'error'
5
+ detail: string[];
6
+ } & (
7
+ {
8
+ reason_id:
9
+ 'no_result'
10
+ | 'prompt_build_failed'
11
+ | 'prompt_execute_failed'
12
+ | 'fetch_failed'
13
+ | 'request_failed'
14
+ | 'invalid_model'
15
+ | 'aborted'
16
+ | 'other';
17
+ } | {
18
+ reason_id: 'http_error'
19
+ http_status: number;
20
+ } | {
21
+ reason_id: 'env_error';
22
+ title: string;
23
+ }
24
+ )
25
+ type RTEventDataUpdate = {
26
+ type: 'update'
27
+ update_types: ('input' | 'output' | 'history')[];
28
+ }
29
+ type RTEventDataSend = {
30
+ type: 'send_raw_request_preview';
31
+ preview: RTEventPreviewData;
32
+ } | {
33
+ type: 'send_info';
34
+
35
+ title: string;
36
+ description: string;
37
+ item: Array<{
38
+ name?: string;
39
+ value: string;
40
+ }>;
41
+ }
42
+ type RTEventDataOutput = {
43
+ type: 'stream_output';
44
+ text: string;
45
+ } | {
46
+ type: 'clear_output';
47
+ } | {
48
+ type: 'set_output';
49
+ text: string;
50
+ }
51
+ type RTEventDataOthers = {
52
+ type: 'close';
53
+ }
54
+
55
+ export type RTEventPreviewData = {
56
+ url: string;
57
+ headers: object;
58
+ data: object;
59
+ };
60
+
61
+ export type RTEventDataWithoutId = (
62
+ RTEventDataError
63
+ | RTEventDataSend
64
+ | RTEventDataUpdate
65
+ | RTEventDataOutput
66
+ | RTEventDataOthers
67
+ );
68
+
69
+ export type RTEventData = {
70
+ id: string;
71
+ } & RTEventDataWithoutId;
@@ -0,0 +1,63 @@
1
+ import { SupportedVerbosity } from '../chatai';
2
+
3
+ export type FlowNodeType = (
4
+ 'rt-run'
5
+ | 'rt-output'
6
+ | 'prompt-template'
7
+ | 'llm-fetch'
8
+ );
9
+
10
+ export type RTFlowData = Record<string, RTFlowNodeData>;
11
+ export type RTFlowNodeData<TData = Record<string, any>> = {
12
+ type: FlowNodeType;
13
+ description: string;
14
+ data: TData;
15
+ connection: Array<{
16
+ from_handle: string;
17
+ to_node: string;
18
+ to_handle: string;
19
+ }>;
20
+ position: {
21
+ x: number;
22
+ y: number;
23
+ };
24
+ }
25
+
26
+ export declare namespace RTFlowNodeOptions {
27
+ interface RTStart {
28
+ start_trigger: 'start' | 'press-button';
29
+
30
+ button_label: string;
31
+
32
+ include_chat_history: boolean;
33
+
34
+ allow_input_text: boolean;
35
+ allow_input_image: boolean;
36
+ allow_input_pdf: boolean;
37
+ allow_input_files: boolean;
38
+ }
39
+
40
+ interface PromptTemplate {
41
+ prompt_id: string | null;
42
+ }
43
+
44
+ interface LLM {
45
+ model: string;
46
+ model_selection: boolean;
47
+
48
+
49
+ temperature: number;
50
+ top_p: number;
51
+ max_tokens: number;
52
+ use_thinking: boolean;
53
+ thinking_tokens: number;
54
+ gpt_reasoning_effort: SupportedVerbosity;
55
+ gpt_verbosity: SupportedVerbosity;
56
+ }
57
+
58
+ interface Output {
59
+ include_history: boolean;
60
+ }
61
+ }
62
+
63
+ export { };
@@ -0,0 +1,41 @@
1
+ import { ProfileStorage } from '../storage-struct';
2
+ import { RTVarDataNaive, RTVarData } from '../rt-var';
3
+
4
+ export type RTPromptMetadata = Pick<ProfileStorage.RT.Prompt,
5
+ 'id' | 'name' | 'variables' | 'model'
6
+ >
7
+
8
+ export type RTPromptDataEditable = {
9
+ name?: string;
10
+ model?: {
11
+ temperature?: number;
12
+ top_p?: number;
13
+ max_tokens?: number;
14
+ use_thinking?: boolean;
15
+ thinking_tokens?: number;
16
+ };
17
+ contents?: string;
18
+ }
19
+
20
+ export type BaseRTForm = {
21
+ display_name: string;
22
+ display_on_header: boolean;
23
+ }
24
+
25
+ export type RTFormNaive = BaseRTForm & RTVarDataNaive & {
26
+ id: string;
27
+ refs: RTFormRef[];
28
+ };
29
+ export type RTForm = BaseRTForm & RTVarData & {
30
+ id: string;
31
+ refs: RTFormRef[];
32
+ };
33
+
34
+ /** 이 Form을 참조하는 RT 변수 */
35
+ export type RTFormRef = {
36
+ type: 'prompt' | 'global';
37
+ prompt_id?: string;
38
+ variable_id: string;
39
+ };
40
+
41
+ export { }
@@ -0,0 +1,4 @@
1
+ export * from './flow';
2
+ export * from './form';
3
+ export * from './event';
4
+ export * from './rt';
@@ -0,0 +1,61 @@
1
+ import '../prompt-form';
2
+
3
+ export type RTMetadata = {
4
+ name: string;
5
+ id: string;
6
+ mode: RTMode;
7
+ }
8
+
9
+ /** RT 트리 구조 */
10
+ export type RTMetadataTree = (
11
+ RTMetadataNode | RTMetadataDirectory
12
+ )[];
13
+ export type RTMetadataNode = {
14
+ type: 'node';
15
+ name: string;
16
+ id: string;
17
+ }
18
+ export type RTMetadataDirectory = {
19
+ type: 'directory';
20
+ name: string;
21
+ children: RTMetadataNode[];
22
+ }
23
+
24
+
25
+ export declare namespace RTMetadatas {
26
+ type Tree = (Node | Directory)[]
27
+ type Node = {
28
+ type: 'node';
29
+ name: string;
30
+ id: string;
31
+ }
32
+ type Directory = {
33
+ type: 'directory';
34
+ name: string;
35
+ children: Node[];
36
+ }
37
+ }
38
+
39
+
40
+ export type RTMode = 'prompt_only' | 'flow';
41
+
42
+ export type RTInput = {
43
+ input: string;
44
+ inputFiles: InputFile[];
45
+ chat?: RTInputMessage[];
46
+
47
+ form: Record<string, any>;
48
+ modelId: string;
49
+ rtId: string;
50
+ sessionId: string;
51
+ }
52
+ export type RTInputMessage = {
53
+ type: 'chat';
54
+ message: RTInputMessagePart[];
55
+ }
56
+ export type RTInputMessagePart = {
57
+ type: 'text' | 'image';
58
+ value: string;
59
+ }
60
+
61
+ export { };
@@ -0,0 +1,5 @@
1
+ export * from './rt-var';
2
+ export * from './rt-var-stored';
3
+ export * from './rt-var-create';
4
+ export * from './rt-var-update';
5
+ export * from './var-data';
@@ -0,0 +1,39 @@
1
+ import { RTVarData } from './var-data';
2
+
3
+ /**
4
+ * RTVar 생성 타입 정의
5
+ *
6
+ * 기존 PromptVar과 비교해 id 필드의 유무로 생성 구분
7
+ */
8
+ export type RTVarCreate = (
9
+ RTVarExternalCreate
10
+ | RTVarConstantCreate
11
+ | RTVarFormCreate
12
+ );
13
+
14
+ export type BaseRTVarCreate = {
15
+ name: string;
16
+ }
17
+
18
+ export interface RTVarExternalCreate extends BaseRTVarCreate {
19
+ include_type: 'external';
20
+ external_id: string;
21
+ }
22
+ export interface RTVarConstantCreate extends BaseRTVarCreate {
23
+ include_type: 'constant';
24
+ value: any;
25
+ }
26
+ export type RTVarFormCreate = BaseRTVarCreate & {
27
+ include_type: 'form';
28
+ } & (
29
+ {
30
+ // form_id가 없는 경우 새로운 form 생성
31
+ form_id?: undefined | null;
32
+ form_name?: string;
33
+ // 생성한 form의 RTVarData 정의
34
+ data: RTVarData;
35
+ } | {
36
+ // form_id가 있으면 존재하는 form을 참조
37
+ form_id: string;
38
+ }
39
+ )