@xtalpi/agentic-lab-skills 0.0.9 → 0.0.11

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 (68) hide show
  1. package/README.md +1 -1
  2. package/package.json +14 -14
  3. package/skills/lab-flow-designer/SKILL.md +612 -593
  4. package/skills/lab-flow-designer/embedded-template/SKILL.md +103 -88
  5. package/skills/lab-flow-designer/embedded-template/pools//345/205/245/345/217/243/346/261/240.md +21 -12
  6. package/skills/lab-flow-designer/embedded-template/pools//345/207/272/345/217/243/346/261/240.md +21 -12
  7. package/skills/lab-flow-designer/embedded-template/scripts//347/244/272/344/276/213/346/225/260/346/215/256/344/270/216/346/240/241/351/252/214/351/227/250/346/216/247.js +142 -142
  8. package/skills/lab-flow-designer/embedded-template/valves//347/244/272/344/276/213/346/225/260/346/215/256/344/270/216/346/240/241/351/252/214/351/227/250/346/216/247.md +114 -99
  9. package/skills/lab-flow-designer/references/agentic-lab-processer.md +122 -78
  10. package/skills/lab-flow-designer/references/agentic-lab-sdk.md +534 -361
  11. package/skills/lab-flow-designer/references/rhea-api/README.md +7 -7
  12. package/skills/lab-flow-designer/references/rhea-api/execute_process_batch.md +58 -58
  13. package/skills/lab-flow-designer/references/skill-package-layout.md +268 -204
  14. package/skills/lab-flow-designer/references//344/270/232/345/212/241/346/265/201/347/250/213/346/226/207/346/241/243/346/240/207/345/207/206.md +216 -208
  15. package/skills/lab-flow-designer/templates//344/270/232/345/212/241/346/265/201/347/250/213/346/226/207/346/241/243/346/250/241/346/235/277.md +192 -169
  16. package/skills/lab-flow-designer/templates//344/270/232/345/212/241/346/265/201/347/250/213/346/226/207/346/241/243/347/244/272/344/276/213.md +207 -197
  17. package/skills/lab-flow-designer/testing/test-processer.mjs +1240 -1075
  18. package/skills/lab-nocobase-flow-generator/SKILL.md +164 -164
  19. package/skills/lab-nocobase-flow-generator/examples/setting/350/241/250/350/216/267/345/217/226/345/244/226/351/203/250/346/234/215/345/212/241.js +70 -70
  20. package/skills/lab-nocobase-flow-generator/examples//346/237/245/350/257/242/345/214/226/345/255/246/345/223/201/344/277/241/346/201/257.js +30 -30
  21. package/skills/lab-nocobase-flow-generator/references/doc-standard.md +84 -84
  22. package/skills/lab-nocobase-flow-generator/references/runtime-api.md +224 -224
  23. package/skills/lab-nocobase-flow-generator/templates//350/204/232/346/234/254/351/200/273/350/276/221/346/226/207/346/241/243/346/250/241/346/235/277.md +121 -121
  24. package/skills/lab-nocobase-flow-generator/templates//350/204/232/346/234/254/351/200/273/350/276/221/346/226/207/346/241/243/347/244/272/344/276/213.md +67 -67
  25. package/skills/lab-orbit-component-builder/SKILL.md +353 -353
  26. package/skills/lab-orbit-component-builder/examples/xnb-component-template/.env.local.example +27 -27
  27. package/skills/lab-orbit-component-builder/examples/xnb-component-template/.eslintignore +7 -7
  28. package/skills/lab-orbit-component-builder/examples/xnb-component-template/.eslintrc.cjs +88 -88
  29. package/skills/lab-orbit-component-builder/examples/xnb-component-template/.nvmrc +1 -1
  30. package/skills/lab-orbit-component-builder/examples/xnb-component-template/AgenticAppAPI.md +268 -268
  31. package/skills/lab-orbit-component-builder/examples/xnb-component-template/Jenkinsfile +106 -106
  32. package/skills/lab-orbit-component-builder/examples/xnb-component-template/OrbitAPI.md +453 -453
  33. package/skills/lab-orbit-component-builder/examples/xnb-component-template/README.md +176 -176
  34. package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/public/index.html +12 -12
  35. package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/App.vue +151 -151
  36. package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/components/DevOpenerLauncher.vue +143 -143
  37. package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/global.d.ts +77 -77
  38. package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/main.ts +308 -308
  39. package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/mockXNBBitable.ts +119 -119
  40. package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/shims-vue.d.ts +6 -6
  41. package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/utils/devOpenerHost.ts +75 -75
  42. package/skills/lab-orbit-component-builder/examples/xnb-component-template/index.html +13 -13
  43. package/skills/lab-orbit-component-builder/examples/xnb-component-template/package.json +60 -60
  44. package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/api/agenticlabTickets.ts +110 -110
  45. package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/entries/bitable.ts +4 -4
  46. package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/entries/custom-page.ts +4 -4
  47. package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/index.ts +1 -1
  48. package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/styles/orbit-quasar-host.scss +19 -19
  49. package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/types/context.ts +15 -15
  50. package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/types/xnb-context.ts +70 -70
  51. package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/use/useBitablePage.ts +189 -189
  52. package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/use/useSuperCellDemo.ts +257 -257
  53. package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/use/useSuperTableBitableLifecycle.ts +555 -555
  54. package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/utils/openerInitParams.ts +158 -158
  55. package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/utils/openerTicketIds.ts +32 -32
  56. package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/utils/orbitHttpClient.ts +110 -110
  57. package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/utils/request.ts +92 -92
  58. package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/views/bitable.vue +67 -67
  59. package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/views/custom-page.vue +140 -140
  60. package/skills/lab-orbit-component-builder/examples/xnb-component-template/tsconfig.json +45 -45
  61. package/skills/lab-orbit-component-builder/examples/xnb-component-template/vite.config.ts +170 -170
  62. package/skills/lab-orbit-component-builder/examples/xnb-component-template/vite.dev.config.ts +58 -58
  63. package/skills/lab-orbit-component-builder/references/flow-document-human-ui.md +65 -65
  64. package/skills/lab-orbit-component-builder/references/orbit-vue-conventions.md +133 -133
  65. package/skills/lab-orbit-component-builder/references/pool-schema-to-columns.md +67 -67
  66. package/skills/lab-orbit-component-builder/references/vue-template-checklist.md +179 -179
  67. package/skills/lab-orbit-component-builder/references/xnb-context-vue-props.md +49 -49
  68. package/skills/lab-orbit-component-builder/references/xnbitable-vue-parity.md +32 -32
@@ -1,308 +1,308 @@
1
- import * as Vue from 'vue'
2
- import dayjs from 'dayjs'
3
-
4
- import {
5
- Quasar,
6
- Notify,
7
- Loading,
8
- Dialog,
9
- Dark,
10
- QBtn,
11
- QIcon,
12
- QBanner,
13
- QSpace,
14
- QSeparator,
15
- QTable,
16
- QTd,
17
- QTr,
18
- QTh,
19
- QChip,
20
- QInput,
21
- QSelect,
22
- QToggle,
23
- QBadge,
24
- QList,
25
- QItem,
26
- QItemSection,
27
- QCard,
28
- QCardSection,
29
- QCardActions,
30
- QDialog,
31
- QLinearProgress,
32
- QTooltip,
33
- QCheckbox,
34
- QSpinnerGears,
35
- QSpinnerDots,
36
- QPagination,
37
- QExpansionItem,
38
- ClosePopup,
39
- Ripple
40
- } from 'quasar'
41
- import quasarLangEN from 'quasar/lang/en-US'
42
- import '@quasar/extras/material-icons/material-icons.css'
43
- import 'quasar/src/css/index.sass'
44
-
45
- import { Webb } from '@xtalpi/webb-api'
46
- import axios from 'axios'
47
- import lodash from 'lodash'
48
-
49
- import App from './App.vue'
50
-
51
- // ==================== 多入口视图加载 ====================
52
-
53
- const viewModules = import.meta.glob('../../src/views/*.vue', { eager: true })
54
- const viewKeys = Object.keys(viewModules)
55
- const COMPONENT_ID = import.meta.env.VITE_COMPONENT_ID
56
- || (viewKeys.length === 1 ? viewKeys[0].replace('../../src/views/', '').replace('.vue', '') : '')
57
-
58
- const viewKey = `../../src/views/${COMPONENT_ID}.vue`
59
- const viewModule = viewModules[viewKey] as { default: any } | undefined
60
- if (!viewModule) {
61
- const available = viewKeys.map((k: string) => k.replace('../../src/views/', '').replace('.vue', '')).join(', ')
62
- throw new Error(
63
- `[dev] VITE_COMPONENT_ID=${COMPONENT_ID} 无对应视图。可用: ${available}。请在 .env.local 设置 VITE_COMPONENT_ID 或使用 npm run dev:<id>`
64
- )
65
- }
66
- const View = viewModule.default
67
-
68
- // ==================== Store ====================
69
-
70
- const cached: Record<string, any> = {}
71
- const store = {
72
- getToken: (): string | null => localStorage.getItem('access_token'),
73
- onLogout: (): void => {},
74
- set: (key: string, value: any): void => {
75
- cached[key] = value
76
- },
77
- get: (key: string): any => {
78
- return cached[key]
79
- },
80
- getUser: (): any => ({
81
- email: 'dev@local.test',
82
- userName: 'DevUser'
83
- })
84
- }
85
-
86
- const utils = {
87
- lodash,
88
- axios
89
- }
90
- Webb.register('store', store)
91
- Webb.register('utils', utils)
92
-
93
- const app = Vue.createApp(App)
94
-
95
- app.use(Quasar, {
96
- plugins: {
97
- Notify,
98
- Loading,
99
- Dialog
100
- },
101
- components: {
102
- QBtn,
103
- QIcon,
104
- QBanner,
105
- QSpace,
106
- QSeparator,
107
- QTable,
108
- QTd,
109
- QTr,
110
- QTh,
111
- QChip,
112
- QInput,
113
- QSelect,
114
- QToggle,
115
- QBadge,
116
- QList,
117
- QItem,
118
- QItemSection,
119
- QCard,
120
- QCardSection,
121
- QCardActions,
122
- QDialog,
123
- QLinearProgress,
124
- QTooltip,
125
- QCheckbox,
126
- QSpinnerGears,
127
- QSpinnerDots,
128
- QPagination,
129
- QExpansionItem
130
- },
131
- directives: {
132
- ClosePopup,
133
- Ripple
134
- },
135
- lang: quasarLangEN
136
- })
137
- Dark.set(false)
138
-
139
- app.component('View', View)
140
-
141
- window.Vue = Vue
142
- window.vueInstance = app
143
- window.webb = (Webb as unknown as any)
144
-
145
- if (!window.webb.getUrl) {
146
- window.webb.getUrl = (): { webbHost: string } => ({
147
- webbHost: import.meta.env.VITE_REQUEST_URL || `${window.location.protocol}//${window.location.host}`
148
- })
149
- }
150
- if (!window.webb.ui) {
151
- window.webb.ui = {
152
- message (opts: any): void {
153
- const type = opts?.type === 'error' ? 'negative' : opts?.type === 'success' ? 'positive' : 'info'
154
- Notify.create({ type, message: opts?.message || '', position: 'top', timeout: 3000 })
155
- }
156
- }
157
- }
158
- if (!window.webb.method) {
159
- window.webb.method = {
160
- call (_module: string, _method: string, ..._args: any[]): any {
161
- console.log(`[dev mock] webb.method.call(${_module}, ${_method})`, _args)
162
- return {}
163
- }
164
- }
165
- }
166
-
167
- // ==================== Mock: window.xnb ====================
168
-
169
- const DEV_TOKEN = import.meta.env.VITE_DEV_TOKEN || ''
170
-
171
- const ResponseType = { JSON: 1, Text: 2, Binary: 3 }
172
-
173
- const Body = {
174
- json: (data: any): { type: string; data: any } => ({ type: 'json', data }),
175
- text: (text: string): { type: string; data: string } => ({ type: 'text', data: text }),
176
- form: (data: Record<string, any>): { type: string; data: Record<string, any> } => ({ type: 'form', data })
177
- }
178
-
179
- const httpClient = {
180
- async request (options: {
181
- method: string;
182
- url: string;
183
- headers?: Record<string, string>;
184
- responseType?: number;
185
- query?: Record<string, string | number | boolean | string[] | null | undefined>;
186
- body?: { type: string; data: any };
187
- }): Promise<any> {
188
- const { method, url, headers, query, body } = options
189
-
190
- const axiosConfig: Record<string, any> = {
191
- method: method.toLowerCase(),
192
- url,
193
- headers: headers || {}
194
- }
195
-
196
- if (query != null && Object.keys(query).length > 0) {
197
- axiosConfig.params = query
198
- }
199
-
200
- if (body) {
201
- axiosConfig.data = body.data
202
- }
203
-
204
- try {
205
- const res = await axios(axiosConfig)
206
- return {
207
- data: res.data,
208
- headers: res.headers as Record<string, string>
209
- }
210
- } catch (err: any) {
211
- if (err.response) {
212
- return {
213
- data: err.response.data,
214
- headers: err.response.headers as Record<string, string>
215
- }
216
- }
217
- throw err
218
- }
219
- }
220
- }
221
-
222
- window.xnb = {
223
- book: {
224
- async getCell (): Promise<any> {
225
- const _d = localStorage.getItem('CH_CELL_DATA')
226
- return { data: _d ? JSON.parse(_d) : {} }
227
- },
228
- async updateCellData (_bookPath: string, _cellUid: string, data: any): Promise<void> {
229
- localStorage.setItem('CH_CELL_DATA', JSON.stringify(data))
230
- },
231
- async getBookMeta (_bookPath: string): Promise<any> {
232
- return {
233
- name: 'DevBook',
234
- runtimes: {
235
- bookId: 'dev-book-001',
236
- project: { data_link: '', project_id: 'dev-project-001', project_name: 'Dev Project' }
237
- }
238
- }
239
- },
240
- async getBookFromRemoteRepo (_bookId: string): Promise<any> {
241
- return { parent: { id: 1, name: 'DevFolder' }, creator: 'DevUser', name: 'DevBook', page_number: 1 }
242
- },
243
- async getCurrentBookPermission (_type: string): Promise<boolean> {
244
- return true
245
- }
246
- },
247
-
248
- store,
249
- event: window.webb?.event || { on: (): void => {}, emit: (): void => {}, off: (): void => {} },
250
-
251
- kernel: {
252
- async runCode (_bookPath: string, _code: string, onUpdate: any): Promise<void> {
253
- onUpdate('status: 200')
254
- }
255
- },
256
-
257
- choreo: {
258
- async getUserToken (_bookPath?: string): Promise<string> {
259
- if (!DEV_TOKEN) {
260
- console.warn('[dev mock] VITE_DEV_TOKEN 未在 .env.local 中配置')
261
- }
262
- return DEV_TOKEN
263
- },
264
- async getUserInfo (_options?: any): Promise<{ userName: string; email: string }> {
265
- return { userName: 'DevUser', email: 'dev@local.test' }
266
- }
267
- },
268
-
269
- http: { client: httpClient, Body, ResponseType },
270
-
271
- app: {
272
- alarm (info: string, _options?: any): void {
273
- Notify.create({ type: 'warning', message: `[Alarm] ${info}`, position: 'top' })
274
- },
275
- notifySuccess (content: string, _options?: any): void {
276
- Notify.create({ type: 'positive', message: content, position: 'top' })
277
- }
278
- },
279
-
280
- utils: { dayjs, lodash }
281
- }
282
-
283
- app.mount('#app')
284
-
285
- window.$q = {
286
- loading: {
287
- show (opts?: any): void {
288
- Loading.show(typeof opts === 'string' ? { message: opts } : opts)
289
- },
290
- hide (): void {
291
- Loading.hide()
292
- }
293
- },
294
- notify: Notify.create.bind(Notify),
295
- dialog: Dialog.create.bind(Dialog),
296
- dark: Dark
297
- }
298
-
299
- axios.interceptors.request.use((config: any) => {
300
- if (config.headers?.Authorization) return config
301
- const token = DEV_TOKEN || localStorage.getItem('access_token')
302
- if (token && config.headers) {
303
- config.headers.Authorization = `Bearer ${token}`
304
- }
305
- return config
306
- }, (err: any) => {
307
- return Promise.reject(err)
308
- })
1
+ import * as Vue from 'vue'
2
+ import dayjs from 'dayjs'
3
+
4
+ import {
5
+ Quasar,
6
+ Notify,
7
+ Loading,
8
+ Dialog,
9
+ Dark,
10
+ QBtn,
11
+ QIcon,
12
+ QBanner,
13
+ QSpace,
14
+ QSeparator,
15
+ QTable,
16
+ QTd,
17
+ QTr,
18
+ QTh,
19
+ QChip,
20
+ QInput,
21
+ QSelect,
22
+ QToggle,
23
+ QBadge,
24
+ QList,
25
+ QItem,
26
+ QItemSection,
27
+ QCard,
28
+ QCardSection,
29
+ QCardActions,
30
+ QDialog,
31
+ QLinearProgress,
32
+ QTooltip,
33
+ QCheckbox,
34
+ QSpinnerGears,
35
+ QSpinnerDots,
36
+ QPagination,
37
+ QExpansionItem,
38
+ ClosePopup,
39
+ Ripple
40
+ } from 'quasar'
41
+ import quasarLangEN from 'quasar/lang/en-US'
42
+ import '@quasar/extras/material-icons/material-icons.css'
43
+ import 'quasar/src/css/index.sass'
44
+
45
+ import { Webb } from '@xtalpi/webb-api'
46
+ import axios from 'axios'
47
+ import lodash from 'lodash'
48
+
49
+ import App from './App.vue'
50
+
51
+ // ==================== 多入口视图加载 ====================
52
+
53
+ const viewModules = import.meta.glob('../../src/views/*.vue', { eager: true })
54
+ const viewKeys = Object.keys(viewModules)
55
+ const COMPONENT_ID = import.meta.env.VITE_COMPONENT_ID
56
+ || (viewKeys.length === 1 ? viewKeys[0].replace('../../src/views/', '').replace('.vue', '') : '')
57
+
58
+ const viewKey = `../../src/views/${COMPONENT_ID}.vue`
59
+ const viewModule = viewModules[viewKey] as { default: any } | undefined
60
+ if (!viewModule) {
61
+ const available = viewKeys.map((k: string) => k.replace('../../src/views/', '').replace('.vue', '')).join(', ')
62
+ throw new Error(
63
+ `[dev] VITE_COMPONENT_ID=${COMPONENT_ID} 无对应视图。可用: ${available}。请在 .env.local 设置 VITE_COMPONENT_ID 或使用 npm run dev:<id>`
64
+ )
65
+ }
66
+ const View = viewModule.default
67
+
68
+ // ==================== Store ====================
69
+
70
+ const cached: Record<string, any> = {}
71
+ const store = {
72
+ getToken: (): string | null => localStorage.getItem('access_token'),
73
+ onLogout: (): void => {},
74
+ set: (key: string, value: any): void => {
75
+ cached[key] = value
76
+ },
77
+ get: (key: string): any => {
78
+ return cached[key]
79
+ },
80
+ getUser: (): any => ({
81
+ email: 'dev@local.test',
82
+ userName: 'DevUser'
83
+ })
84
+ }
85
+
86
+ const utils = {
87
+ lodash,
88
+ axios
89
+ }
90
+ Webb.register('store', store)
91
+ Webb.register('utils', utils)
92
+
93
+ const app = Vue.createApp(App)
94
+
95
+ app.use(Quasar, {
96
+ plugins: {
97
+ Notify,
98
+ Loading,
99
+ Dialog
100
+ },
101
+ components: {
102
+ QBtn,
103
+ QIcon,
104
+ QBanner,
105
+ QSpace,
106
+ QSeparator,
107
+ QTable,
108
+ QTd,
109
+ QTr,
110
+ QTh,
111
+ QChip,
112
+ QInput,
113
+ QSelect,
114
+ QToggle,
115
+ QBadge,
116
+ QList,
117
+ QItem,
118
+ QItemSection,
119
+ QCard,
120
+ QCardSection,
121
+ QCardActions,
122
+ QDialog,
123
+ QLinearProgress,
124
+ QTooltip,
125
+ QCheckbox,
126
+ QSpinnerGears,
127
+ QSpinnerDots,
128
+ QPagination,
129
+ QExpansionItem
130
+ },
131
+ directives: {
132
+ ClosePopup,
133
+ Ripple
134
+ },
135
+ lang: quasarLangEN
136
+ })
137
+ Dark.set(false)
138
+
139
+ app.component('View', View)
140
+
141
+ window.Vue = Vue
142
+ window.vueInstance = app
143
+ window.webb = (Webb as unknown as any)
144
+
145
+ if (!window.webb.getUrl) {
146
+ window.webb.getUrl = (): { webbHost: string } => ({
147
+ webbHost: import.meta.env.VITE_REQUEST_URL || `${window.location.protocol}//${window.location.host}`
148
+ })
149
+ }
150
+ if (!window.webb.ui) {
151
+ window.webb.ui = {
152
+ message (opts: any): void {
153
+ const type = opts?.type === 'error' ? 'negative' : opts?.type === 'success' ? 'positive' : 'info'
154
+ Notify.create({ type, message: opts?.message || '', position: 'top', timeout: 3000 })
155
+ }
156
+ }
157
+ }
158
+ if (!window.webb.method) {
159
+ window.webb.method = {
160
+ call (_module: string, _method: string, ..._args: any[]): any {
161
+ console.log(`[dev mock] webb.method.call(${_module}, ${_method})`, _args)
162
+ return {}
163
+ }
164
+ }
165
+ }
166
+
167
+ // ==================== Mock: window.xnb ====================
168
+
169
+ const DEV_TOKEN = import.meta.env.VITE_DEV_TOKEN || ''
170
+
171
+ const ResponseType = { JSON: 1, Text: 2, Binary: 3 }
172
+
173
+ const Body = {
174
+ json: (data: any): { type: string; data: any } => ({ type: 'json', data }),
175
+ text: (text: string): { type: string; data: string } => ({ type: 'text', data: text }),
176
+ form: (data: Record<string, any>): { type: string; data: Record<string, any> } => ({ type: 'form', data })
177
+ }
178
+
179
+ const httpClient = {
180
+ async request (options: {
181
+ method: string;
182
+ url: string;
183
+ headers?: Record<string, string>;
184
+ responseType?: number;
185
+ query?: Record<string, string | number | boolean | string[] | null | undefined>;
186
+ body?: { type: string; data: any };
187
+ }): Promise<any> {
188
+ const { method, url, headers, query, body } = options
189
+
190
+ const axiosConfig: Record<string, any> = {
191
+ method: method.toLowerCase(),
192
+ url,
193
+ headers: headers || {}
194
+ }
195
+
196
+ if (query != null && Object.keys(query).length > 0) {
197
+ axiosConfig.params = query
198
+ }
199
+
200
+ if (body) {
201
+ axiosConfig.data = body.data
202
+ }
203
+
204
+ try {
205
+ const res = await axios(axiosConfig)
206
+ return {
207
+ data: res.data,
208
+ headers: res.headers as Record<string, string>
209
+ }
210
+ } catch (err: any) {
211
+ if (err.response) {
212
+ return {
213
+ data: err.response.data,
214
+ headers: err.response.headers as Record<string, string>
215
+ }
216
+ }
217
+ throw err
218
+ }
219
+ }
220
+ }
221
+
222
+ window.xnb = {
223
+ book: {
224
+ async getCell (): Promise<any> {
225
+ const _d = localStorage.getItem('CH_CELL_DATA')
226
+ return { data: _d ? JSON.parse(_d) : {} }
227
+ },
228
+ async updateCellData (_bookPath: string, _cellUid: string, data: any): Promise<void> {
229
+ localStorage.setItem('CH_CELL_DATA', JSON.stringify(data))
230
+ },
231
+ async getBookMeta (_bookPath: string): Promise<any> {
232
+ return {
233
+ name: 'DevBook',
234
+ runtimes: {
235
+ bookId: 'dev-book-001',
236
+ project: { data_link: '', project_id: 'dev-project-001', project_name: 'Dev Project' }
237
+ }
238
+ }
239
+ },
240
+ async getBookFromRemoteRepo (_bookId: string): Promise<any> {
241
+ return { parent: { id: 1, name: 'DevFolder' }, creator: 'DevUser', name: 'DevBook', page_number: 1 }
242
+ },
243
+ async getCurrentBookPermission (_type: string): Promise<boolean> {
244
+ return true
245
+ }
246
+ },
247
+
248
+ store,
249
+ event: window.webb?.event || { on: (): void => {}, emit: (): void => {}, off: (): void => {} },
250
+
251
+ kernel: {
252
+ async runCode (_bookPath: string, _code: string, onUpdate: any): Promise<void> {
253
+ onUpdate('status: 200')
254
+ }
255
+ },
256
+
257
+ choreo: {
258
+ async getUserToken (_bookPath?: string): Promise<string> {
259
+ if (!DEV_TOKEN) {
260
+ console.warn('[dev mock] VITE_DEV_TOKEN 未在 .env.local 中配置')
261
+ }
262
+ return DEV_TOKEN
263
+ },
264
+ async getUserInfo (_options?: any): Promise<{ userName: string; email: string }> {
265
+ return { userName: 'DevUser', email: 'dev@local.test' }
266
+ }
267
+ },
268
+
269
+ http: { client: httpClient, Body, ResponseType },
270
+
271
+ app: {
272
+ alarm (info: string, _options?: any): void {
273
+ Notify.create({ type: 'warning', message: `[Alarm] ${info}`, position: 'top' })
274
+ },
275
+ notifySuccess (content: string, _options?: any): void {
276
+ Notify.create({ type: 'positive', message: content, position: 'top' })
277
+ }
278
+ },
279
+
280
+ utils: { dayjs, lodash }
281
+ }
282
+
283
+ app.mount('#app')
284
+
285
+ window.$q = {
286
+ loading: {
287
+ show (opts?: any): void {
288
+ Loading.show(typeof opts === 'string' ? { message: opts } : opts)
289
+ },
290
+ hide (): void {
291
+ Loading.hide()
292
+ }
293
+ },
294
+ notify: Notify.create.bind(Notify),
295
+ dialog: Dialog.create.bind(Dialog),
296
+ dark: Dark
297
+ }
298
+
299
+ axios.interceptors.request.use((config: any) => {
300
+ if (config.headers?.Authorization) return config
301
+ const token = DEV_TOKEN || localStorage.getItem('access_token')
302
+ if (token && config.headers) {
303
+ config.headers.Authorization = `Bearer ${token}`
304
+ }
305
+ return config
306
+ }, (err: any) => {
307
+ return Promise.reject(err)
308
+ })