@pactor-app/skills 1.24.0

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 (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +40 -0
  3. package/package.json +26 -0
  4. package/pactor/SKILL.md +373 -0
  5. package/pactor/references/dsl-authoring.md +448 -0
  6. package/prd-to-app/SKILL.md +75 -0
  7. package/prd-to-app/references/acceptance-checklist.md +47 -0
  8. package/prd-to-app/references/component-mapping.md +41 -0
  9. package/prd-to-app/references/mock-data-routes.md +66 -0
  10. package/prd-to-app/references/page-templates.md +274 -0
  11. package/prd-to-app/references/project-structure.md +89 -0
  12. package/prd-to-app/references/theme-and-style.md +41 -0
  13. package/prd-to-app/template/README.md +26 -0
  14. package/prd-to-app/template/app/[[...slug]]/page.tsx +7 -0
  15. package/prd-to-app/template/app/api/auth/login/route.ts +32 -0
  16. package/prd-to-app/template/app/api/auth/logout/route.ts +22 -0
  17. package/prd-to-app/template/app/api/data/[...parts]/route.ts +118 -0
  18. package/prd-to-app/template/app/api/public/pages/[id]/route.ts +40 -0
  19. package/prd-to-app/template/app/api/sitemap/route.ts +21 -0
  20. package/prd-to-app/template/app/api/users/route.ts +57 -0
  21. package/prd-to-app/template/app/favicon.ico +0 -0
  22. package/prd-to-app/template/app/globals.css +248 -0
  23. package/prd-to-app/template/app/layout.tsx +49 -0
  24. package/prd-to-app/template/app/login.css +122 -0
  25. package/prd-to-app/template/eslint.config.mjs +18 -0
  26. package/prd-to-app/template/next-env.d.ts +7 -0
  27. package/prd-to-app/template/next.config.js +32 -0
  28. package/prd-to-app/template/package.json +34 -0
  29. package/prd-to-app/template/pnpm-lock.yaml +6854 -0
  30. package/prd-to-app/template/pnpm-workspace.yaml +7 -0
  31. package/prd-to-app/template/postcss.config.mjs +7 -0
  32. package/prd-to-app/template/public/file.svg +1 -0
  33. package/prd-to-app/template/public/globe.svg +1 -0
  34. package/prd-to-app/template/public/next.svg +1 -0
  35. package/prd-to-app/template/public/skins/chenwunaifu.css +111 -0
  36. package/prd-to-app/template/public/skins/taijingshenlin.css +109 -0
  37. package/prd-to-app/template/public/skins/xuanzhimoyun.css +110 -0
  38. package/prd-to-app/template/public/vercel.svg +1 -0
  39. package/prd-to-app/template/public/window.svg +1 -0
  40. package/prd-to-app/template/scripts/build.mjs +35 -0
  41. package/prd-to-app/template/src/pactor/App.tsx +55 -0
  42. package/prd-to-app/template/src/pactor/actions.ts +438 -0
  43. package/prd-to-app/template/src/pactor/components/card-links.tsx +86 -0
  44. package/prd-to-app/template/src/pactor/components/chip-filter.tsx +89 -0
  45. package/prd-to-app/template/src/pactor/components/chip-node.tsx +46 -0
  46. package/prd-to-app/template/src/pactor/components/debug-chat.tsx +189 -0
  47. package/prd-to-app/template/src/pactor/components/index.ts +28 -0
  48. package/prd-to-app/template/src/pactor/components/log-status.tsx +64 -0
  49. package/prd-to-app/template/src/pactor/components/status-badge.tsx +46 -0
  50. package/prd-to-app/template/src/pactor/components/theme-switcher.tsx +136 -0
  51. package/prd-to-app/template/src/pactor/config.ts +28 -0
  52. package/prd-to-app/template/src/pactor/mocks/audit-mock.ts +403 -0
  53. package/prd-to-app/template/src/pactor/mocks/call-logs-mock.ts +875 -0
  54. package/prd-to-app/template/src/pactor/mocks/client-debug-mock.ts +188 -0
  55. package/prd-to-app/template/src/pactor/mocks/client-templates-mock.ts +497 -0
  56. package/prd-to-app/template/src/pactor/mocks/clients-mock.ts +483 -0
  57. package/prd-to-app/template/src/pactor/mocks/costs-mock.ts +406 -0
  58. package/prd-to-app/template/src/pactor/mocks/dashboard-mock.ts +192 -0
  59. package/prd-to-app/template/src/pactor/mocks/model-debug-mock.ts +144 -0
  60. package/prd-to-app/template/src/pactor/mocks/models-mock.ts +799 -0
  61. package/prd-to-app/template/src/pactor/mocks/ops-usage-mock.ts +806 -0
  62. package/prd-to-app/template/src/pactor/mocks/providers-mock.ts +424 -0
  63. package/prd-to-app/template/src/pactor/mocks/routes-mock.ts +604 -0
  64. package/prd-to-app/template/src/pactor/services.ts +185 -0
  65. package/prd-to-app/template/src/pactor/skin.ts +52 -0
  66. package/prd-to-app/template/src/server/accounts.ts +63 -0
  67. package/prd-to-app/template/src/server/cors.ts +34 -0
  68. package/prd-to-app/template/src/server/sitemap.ts +176 -0
  69. package/prd-to-app/template/src/server/yaml/common/dashboard.yaml +498 -0
  70. package/prd-to-app/template/src/server/yaml/common/login.yaml +84 -0
  71. package/prd-to-app/template/src/server/yaml/provider/provider-create.yaml +340 -0
  72. package/prd-to-app/template/src/server/yaml/provider/provider-detail.yaml +780 -0
  73. package/prd-to-app/template/src/server/yaml/provider/provider-edit.yaml +366 -0
  74. package/prd-to-app/template/src/server/yaml/provider/provider-list.yaml +1989 -0
  75. package/prd-to-app/template/src/server/yaml/route/route-create.yaml +511 -0
  76. package/prd-to-app/template/src/server/yaml/route/route-detail.yaml +610 -0
  77. package/prd-to-app/template/src/server/yaml/route/route-edit.yaml +809 -0
  78. package/prd-to-app/template/src/server/yaml/route/route-list.yaml +1793 -0
  79. package/prd-to-app/template/src/server/yaml/sitemap.yaml +250 -0
  80. package/prd-to-app/template/tsconfig.json +34 -0
@@ -0,0 +1,498 @@
1
+ dsl: "1.0"
2
+ page:
3
+ id: dashboard
4
+ title: 仪表盘
5
+ name: dashboard
6
+ description: GateWeave 运营概览:核心指标、趋势分析、用量构成
7
+ state:
8
+ range:
9
+ start: 2026-09-22
10
+ end: 2026-09-28
11
+ trendMetric: requests
12
+ dataSources:
13
+ dashboard:
14
+ type: http
15
+ autoLoad: true
16
+ request:
17
+ method: GET
18
+ url: /api/data/dashboard
19
+ params:
20
+ start: ${state.range.start}
21
+ end: ${state.range.end}
22
+ body:
23
+ type: Page
24
+ children:
25
+ - type: Flex
26
+ props:
27
+ justify: space-between
28
+ align: center
29
+ children:
30
+ - type: Flex
31
+ props:
32
+ align: baseline
33
+ gap: middle
34
+ children:
35
+ - type: Typography
36
+ props:
37
+ variant: h3
38
+ text: 仪表盘
39
+ - type: Typography
40
+ props:
41
+ variant: muted
42
+ text: GateWeave — 运营概览
43
+ - type: Flex
44
+ props:
45
+ align: center
46
+ gap: middle
47
+ children:
48
+ - type: Text
49
+ props:
50
+ text: 实时 ${data.dashboard.realtime.rpm} RPM · ${data.dashboard.realtime.tpm} TPM
51
+ type: secondary
52
+ className: tabular-nums
53
+ - type: Button
54
+ props:
55
+ text: ↻ 刷新
56
+ size: small
57
+ events:
58
+ onClick:
59
+ - action: reload
60
+ params:
61
+ dataSource: dashboard
62
+ - action: message
63
+ params:
64
+ messageType: success
65
+ text: 看板数据已刷新
66
+ - type: Card
67
+ children:
68
+ - type: Flex
69
+ props:
70
+ align: center
71
+ gap: middle
72
+ children:
73
+ - type: Text
74
+ props:
75
+ text: 分析时间范围
76
+ strong: true
77
+ - type: DatePicker
78
+ props:
79
+ mode: range
80
+ value: ${state.range}
81
+ placeholder: 选择时间范围
82
+ style:
83
+ width: 280
84
+ presets:
85
+ - label: 今天
86
+ days: 1
87
+ - key: thisWeek
88
+ - key: thisMonth
89
+ - label: 近3天
90
+ days: 3
91
+ - label: 近7天
92
+ days: 7
93
+ - label: 近14天
94
+ days: 14
95
+ - label: 近30天
96
+ days: 30
97
+ events:
98
+ onChange:
99
+ - action: setState
100
+ condition: ${event}
101
+ params:
102
+ range: ${event}
103
+ - action: reload
104
+ condition: ${event}
105
+ params:
106
+ dataSource: dashboard
107
+ - type: Typography
108
+ props:
109
+ variant: h4
110
+ text: 核心概览 · ${state.range.start} — ${state.range.end}
111
+ - type: Grid
112
+ props:
113
+ columns: 4
114
+ gap: 16
115
+ children:
116
+ - type: Card
117
+ props:
118
+ className: stat-card
119
+ children:
120
+ - type: Flex
121
+ props:
122
+ justify: space-between
123
+ align: start
124
+ children:
125
+ - type: Statistic
126
+ props:
127
+ title: 请求量
128
+ value: ${data.dashboard.stats.requests}
129
+ - type: Icon
130
+ props:
131
+ name: chart
132
+ size: lg
133
+ className: stat-card-icon
134
+ - type: Typography
135
+ props:
136
+ variant: muted
137
+ text: ${data.dashboard.stats.activeClients} 位活跃客户端 ·
138
+ ${data.dashboard.stats.tokens} Token
139
+ - type: Card
140
+ props:
141
+ className: stat-card
142
+ children:
143
+ - type: Flex
144
+ props:
145
+ justify: space-between
146
+ align: start
147
+ children:
148
+ - type: Statistic
149
+ props:
150
+ title: 成功率
151
+ value: ${data.dashboard.stats.successRate}
152
+ suffix: "%"
153
+ - type: Icon
154
+ props:
155
+ name: check-circle
156
+ size: lg
157
+ className: stat-card-icon
158
+ - type: Button
159
+ props:
160
+ text: ${data.dashboard.stats.failures} 个失败 · 错误率
161
+ ${data.dashboard.stats.errorRate}%
162
+ variant: link
163
+ size: small
164
+ style:
165
+ alignSelf: flex-start
166
+ className: p-0
167
+ events:
168
+ onClick:
169
+ - action: message
170
+ params:
171
+ messageType: info
172
+ text: 跳转调用日志(失败筛选,演示:目标页建设中)
173
+ - type: Card
174
+ props:
175
+ className: stat-card
176
+ children:
177
+ - type: Flex
178
+ props:
179
+ justify: space-between
180
+ align: start
181
+ children:
182
+ - type: Statistic
183
+ props:
184
+ title: 平均响应时间
185
+ value: ${data.dashboard.stats.avgLatency}
186
+ suffix: " ms"
187
+ - type: Icon
188
+ props:
189
+ name: clock
190
+ size: lg
191
+ className: stat-card-icon
192
+ - type: Button
193
+ props:
194
+ text: 查看可靠性分析 →
195
+ variant: link
196
+ size: small
197
+ style:
198
+ alignSelf: flex-start
199
+ className: p-0
200
+ events:
201
+ onClick:
202
+ - action: message
203
+ params:
204
+ messageType: info
205
+ text: 跳转供应商可用性(演示:目标页建设中)
206
+ - type: Card
207
+ props:
208
+ className: stat-card
209
+ children:
210
+ - type: Flex
211
+ props:
212
+ justify: space-between
213
+ align: start
214
+ children:
215
+ - type: Statistic
216
+ props:
217
+ title: 计费金额
218
+ value: ${data.dashboard.stats.cost}
219
+ - type: Icon
220
+ props:
221
+ name: credit-card
222
+ size: lg
223
+ className: stat-card-icon
224
+ - type: Typography
225
+ props:
226
+ variant: muted
227
+ text: 平均每次 ${data.dashboard.stats.avgCost}
228
+ - type: Card
229
+ props:
230
+ title: 趋势分析
231
+ children:
232
+ - type: Flex
233
+ props:
234
+ justify: space-between
235
+ align: center
236
+ children:
237
+ - type: Typography
238
+ props:
239
+ variant: muted
240
+ text: 观察流量变化与异常峰值
241
+ - type: ToggleGroup
242
+ props:
243
+ value: ${state.trendMetric}
244
+ options:
245
+ - label: 请求
246
+ value: requests
247
+ - label: Token
248
+ value: tokens
249
+ - label: 费用
250
+ value: cost
251
+ - label: 延迟
252
+ value: latency
253
+ events:
254
+ onChange:
255
+ - action: setState
256
+ condition: ${event}
257
+ params:
258
+ trendMetric: ${event}
259
+ - type: AreaChart
260
+ props:
261
+ data: ${data.dashboard.trend}
262
+ xKey: t
263
+ yKeys: ${data.dashboard.metricKeys[state.trendMetric]}
264
+ style:
265
+ height: 320
266
+ - type: Grid
267
+ props:
268
+ columns: 2
269
+ gap: 16
270
+ children:
271
+ - type: Card
272
+ props:
273
+ title: 用量构成 · 模型
274
+ children:
275
+ - type: Typography
276
+ props:
277
+ variant: muted
278
+ text: 按请求量分布,识别主要模型流量来源
279
+ - type: Flex
280
+ props:
281
+ align: center
282
+ gap: middle
283
+ children:
284
+ - type: Text
285
+ props:
286
+ text: ${data.dashboard.models[0].name}
287
+ style:
288
+ width: 110
289
+ - type: Progress
290
+ props:
291
+ value: ${data.dashboard.models[0].percent}
292
+ style:
293
+ flex: 1
294
+ - type: Text
295
+ props:
296
+ text: ${data.dashboard.models[0].percent}%
297
+ type: secondary
298
+ className: tabular-nums
299
+ style:
300
+ width: 40
301
+ textAlign: right
302
+ - type: Flex
303
+ props:
304
+ align: center
305
+ gap: middle
306
+ children:
307
+ - type: Text
308
+ props:
309
+ text: ${data.dashboard.models[1].name}
310
+ style:
311
+ width: 110
312
+ - type: Progress
313
+ props:
314
+ value: ${data.dashboard.models[1].percent}
315
+ style:
316
+ flex: 1
317
+ - type: Text
318
+ props:
319
+ text: ${data.dashboard.models[1].percent}%
320
+ type: secondary
321
+ className: tabular-nums
322
+ style:
323
+ width: 40
324
+ textAlign: right
325
+ - type: Flex
326
+ props:
327
+ align: center
328
+ gap: middle
329
+ children:
330
+ - type: Text
331
+ props:
332
+ text: ${data.dashboard.models[2].name}
333
+ style:
334
+ width: 110
335
+ - type: Progress
336
+ props:
337
+ value: ${data.dashboard.models[2].percent}
338
+ style:
339
+ flex: 1
340
+ - type: Text
341
+ props:
342
+ text: ${data.dashboard.models[2].percent}%
343
+ type: secondary
344
+ className: tabular-nums
345
+ style:
346
+ width: 40
347
+ textAlign: right
348
+ - type: Flex
349
+ props:
350
+ align: center
351
+ gap: middle
352
+ children:
353
+ - type: Text
354
+ props:
355
+ text: ${data.dashboard.models[3].name}
356
+ style:
357
+ width: 110
358
+ - type: Progress
359
+ props:
360
+ value: ${data.dashboard.models[3].percent}
361
+ style:
362
+ flex: 1
363
+ - type: Text
364
+ props:
365
+ text: ${data.dashboard.models[3].percent}%
366
+ type: secondary
367
+ className: tabular-nums
368
+ style:
369
+ width: 40
370
+ textAlign: right
371
+ - type: Button
372
+ props:
373
+ text: 查看全部 → 模型用量
374
+ variant: link
375
+ size: small
376
+ style:
377
+ alignSelf: flex-start
378
+ className: p-0
379
+ events:
380
+ onClick:
381
+ - action: message
382
+ params:
383
+ messageType: info
384
+ text: 跳转模型用量(演示:目标页建设中)
385
+ - type: Card
386
+ props:
387
+ title: 用量构成 · 客户端
388
+ children:
389
+ - type: Typography
390
+ props:
391
+ variant: muted
392
+ text: 按请求量分布,识别主要客户端流量来源
393
+ - type: Flex
394
+ props:
395
+ align: center
396
+ gap: middle
397
+ children:
398
+ - type: Text
399
+ props:
400
+ text: ${data.dashboard.clients[0].name}
401
+ style:
402
+ width: 110
403
+ - type: Progress
404
+ props:
405
+ value: ${data.dashboard.clients[0].percent}
406
+ style:
407
+ flex: 1
408
+ - type: Text
409
+ props:
410
+ text: ${data.dashboard.clients[0].percent}%
411
+ type: secondary
412
+ className: tabular-nums
413
+ style:
414
+ width: 40
415
+ textAlign: right
416
+ - type: Flex
417
+ props:
418
+ align: center
419
+ gap: middle
420
+ children:
421
+ - type: Text
422
+ props:
423
+ text: ${data.dashboard.clients[1].name}
424
+ style:
425
+ width: 110
426
+ - type: Progress
427
+ props:
428
+ value: ${data.dashboard.clients[1].percent}
429
+ style:
430
+ flex: 1
431
+ - type: Text
432
+ props:
433
+ text: ${data.dashboard.clients[1].percent}%
434
+ type: secondary
435
+ className: tabular-nums
436
+ style:
437
+ width: 40
438
+ textAlign: right
439
+ - type: Flex
440
+ props:
441
+ align: center
442
+ gap: middle
443
+ children:
444
+ - type: Text
445
+ props:
446
+ text: ${data.dashboard.clients[2].name}
447
+ style:
448
+ width: 110
449
+ - type: Progress
450
+ props:
451
+ value: ${data.dashboard.clients[2].percent}
452
+ style:
453
+ flex: 1
454
+ - type: Text
455
+ props:
456
+ text: ${data.dashboard.clients[2].percent}%
457
+ type: secondary
458
+ className: tabular-nums
459
+ style:
460
+ width: 40
461
+ textAlign: right
462
+ - type: Flex
463
+ props:
464
+ align: center
465
+ gap: middle
466
+ children:
467
+ - type: Text
468
+ props:
469
+ text: ${data.dashboard.clients[3].name}
470
+ style:
471
+ width: 110
472
+ - type: Progress
473
+ props:
474
+ value: ${data.dashboard.clients[3].percent}
475
+ style:
476
+ flex: 1
477
+ - type: Text
478
+ props:
479
+ text: ${data.dashboard.clients[3].percent}%
480
+ type: secondary
481
+ className: tabular-nums
482
+ style:
483
+ width: 40
484
+ textAlign: right
485
+ - type: Button
486
+ props:
487
+ text: 查看全部 → 客户端用量
488
+ variant: link
489
+ size: small
490
+ style:
491
+ alignSelf: flex-start
492
+ className: p-0
493
+ events:
494
+ onClick:
495
+ - action: message
496
+ params:
497
+ messageType: info
498
+ text: 跳转客户端用量(演示:目标页建设中)
@@ -0,0 +1,84 @@
1
+ # 登录页 DSL:卡片结构 + 提交/错误提示/跳转闭环,视觉样式在 app/login.css。
2
+ # 全屏渐变外壳(login-page 类)由 sitemap.yaml 的 login 布局提供,
3
+ # 提交动作为内置 request(POST /api/auth/login 写会话 cookie)+ app.reload
4
+ # 整页重载,sitemap 端点按已登录会话重新下发。
5
+ dsl: "1.0"
6
+ page:
7
+ id: login
8
+ title: 登录
9
+ name: login
10
+ description: 登录页
11
+
12
+ body:
13
+ type: Card
14
+ props:
15
+ className: login-card
16
+ children:
17
+ - type: Text
18
+ props:
19
+ text: RESTRICTED ACCESS
20
+ className: login-eyebrow
21
+ - type: Text
22
+ props:
23
+ text: 管理后台登录
24
+ className: login-heading
25
+ - type: Text
26
+ props:
27
+ text: 仅已分配平台审核角色的管理人员可以访问。
28
+ type: secondary
29
+ className: login-subtitle
30
+ - type: Form
31
+ props:
32
+ name: login
33
+ style: { marginTop: 16 }
34
+ events:
35
+ onSubmit:
36
+ - id: loginResult
37
+ action: request
38
+ params:
39
+ method: POST
40
+ url: http://localhost:9011/api/auth/login
41
+ body:
42
+ username: ${event.username}
43
+ password: ${event.password}
44
+ - action: if
45
+ params:
46
+ condition: ${actions.loginResult == null || actions.loginResult.token == null}
47
+ then:
48
+ - action: message
49
+ params:
50
+ messageType: error
51
+ text: 用户名或密码错误(演示账号 admin / pactor123)
52
+ - action: if
53
+ params:
54
+ condition: ${actions.loginResult != null && actions.loginResult.token != null}
55
+ then:
56
+ - action: message
57
+ params:
58
+ messageType: success
59
+ text: 登录成功,正在跳转…
60
+ - action: app.reload
61
+ params: { to: / }
62
+ children:
63
+ - type: Input
64
+ props:
65
+ name: username
66
+ label: 用户名
67
+ placeholder: 请输入用户名
68
+ rules:
69
+ - { required: true, message: 请输入用户名 }
70
+ - type: Input
71
+ props:
72
+ name: password
73
+ label: 密码
74
+ type: password
75
+ placeholder: 请输入密码
76
+ rules:
77
+ - { required: true, message: 请输入密码 }
78
+ - type: Button
79
+ props:
80
+ text: 登 录
81
+ variant: primary
82
+ submit: true
83
+ size: large
84
+ style: { width: 100%, marginTop: 8 }