@guandata/guanmetric 0.1.18 → 0.1.20
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/CHANGELOG.md +10 -0
- package/README.md +23 -3
- package/bin/run.js +14 -1
- package/package.json +6 -6
- package/skills/guanmetric/SKILL.md +53 -8
- package/skills/guanmetric/evals/evals.json +117 -0
- package/skills/guanmetric/evals/fixtures/atomic-detail-read-model.json +18 -0
- package/skills/guanmetric/evals/fixtures/confirmed-template-summary.json +12 -0
- package/skills/guanmetric/evals/fixtures/create-result-unknown-state.json +13 -0
- package/skills/guanmetric/evals/forward-eval-2026-09-21.json +62 -0
- package/skills/guanmetric/references/metric-api-contract-examples.json +690 -0
- package/skills/guanmetric/references/metric-api-contract.schema.json +349 -0
- package/skills/guanmetric/references/metric-api-contracts.md +436 -0
- package/skills/guanmetric/references/metric-atomic-mutation.md +11 -0
- package/skills/guanmetric/references/metric-business-dictionary-api-contract-examples.json +53 -0
- package/skills/guanmetric/references/metric-business-dictionary-api-contract.schema.json +26 -0
- package/skills/guanmetric/references/metric-business-dictionary.md +4 -0
- package/skills/guanmetric/references/metric-composite-mutation.md +15 -17
- package/skills/guanmetric/references/metric-derived-mutation.md +14 -16
- package/skills/guanmetric/references/metric-excel-template.md +14 -4
- package/skills/guanmetric/references/metric-flow-generate-example.json +79 -0
- package/skills/guanmetric/references/metric-flow-generate.schema.json +93 -0
- package/skills/guanmetric/references/metric-flow.md +218 -0
- package/skills/guanmetric/references/metric-hierarchy-api-contract-examples.json +171 -0
- package/skills/guanmetric/references/metric-hierarchy-api-contract.schema.json +167 -0
- package/skills/guanmetric/references/metric-hierarchy-api-contracts.md +193 -0
- package/skills/guanmetric/references/metric-mutation.md +13 -9
- package/skills/guanmetric/references/metric-public-dimension-api-contract-examples.json +62 -0
- package/skills/guanmetric/references/metric-public-dimension-api-contract.schema.json +47 -0
- package/skills/guanmetric/references/metric-public-dimension.md +4 -0
- package/skills/guanmetric/references/metric-tree-api-contract-examples.json +277 -0
- package/skills/guanmetric/references/metric-tree-api-contract.schema.json +263 -0
- package/skills/guanmetric/references/metric-tree-api-contracts.md +53 -0
- package/skills/guanmetric/references/metric-tree-mutation.md +31 -3
- package/skills/guanmetric/references/metric-validation-ownership.md +74 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://guandata.dev/schemas/guanmetric/metric-api-contract-1.0.json",
|
|
4
|
+
"title": "GuanData metric create, update, detail and list API contract",
|
|
5
|
+
"description": "用于 Agent 构造指标写请求、解析后端原始响应的宽松契约。后端可能增加字段,因此响应对象允许 additionalProperties。",
|
|
6
|
+
"oneOf": [
|
|
7
|
+
{ "$ref": "#/$defs/createRequest" },
|
|
8
|
+
{ "$ref": "#/$defs/updateRequest" },
|
|
9
|
+
{ "$ref": "#/$defs/listRequest" },
|
|
10
|
+
{ "$ref": "#/$defs/mutationSuccessResponse" },
|
|
11
|
+
{ "$ref": "#/$defs/listResponse" },
|
|
12
|
+
{ "$ref": "#/$defs/detailResponse" }
|
|
13
|
+
],
|
|
14
|
+
"$defs": {
|
|
15
|
+
"nonEmptyString": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"minLength": 1
|
|
18
|
+
},
|
|
19
|
+
"user": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"required": ["uId", "name"],
|
|
22
|
+
"properties": {
|
|
23
|
+
"uId": { "$ref": "#/$defs/nonEmptyString" },
|
|
24
|
+
"name": { "type": "string" },
|
|
25
|
+
"email": { "type": "string" },
|
|
26
|
+
"avatar": { "type": "string" },
|
|
27
|
+
"isDel": { "type": "boolean" }
|
|
28
|
+
},
|
|
29
|
+
"additionalProperties": true
|
|
30
|
+
},
|
|
31
|
+
"field": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"required": ["fdId"],
|
|
34
|
+
"properties": {
|
|
35
|
+
"dsId": { "type": "string" },
|
|
36
|
+
"fdId": { "$ref": "#/$defs/nonEmptyString" },
|
|
37
|
+
"name": { "type": "string" },
|
|
38
|
+
"fdType": { "type": "string" },
|
|
39
|
+
"metaType": { "type": "string" },
|
|
40
|
+
"granularity": { "type": "string" },
|
|
41
|
+
"subs": { "type": "array", "items": { "$ref": "#/$defs/field" } },
|
|
42
|
+
"publicDimensions": { "type": "array" }
|
|
43
|
+
},
|
|
44
|
+
"additionalProperties": true
|
|
45
|
+
},
|
|
46
|
+
"metricReference": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"required": ["id", "name", "subType", "status"],
|
|
49
|
+
"properties": {
|
|
50
|
+
"id": { "$ref": "#/$defs/nonEmptyString" },
|
|
51
|
+
"name": { "type": "string" },
|
|
52
|
+
"subType": { "enum": ["ATOMIC", "COMPOSITE", "DERIVED", "SHORTCUT"] },
|
|
53
|
+
"status": { "type": "string" },
|
|
54
|
+
"desc": { "type": "string" },
|
|
55
|
+
"timeDim": { "oneOf": [{ "$ref": "#/$defs/field" }, { "type": "null" }] }
|
|
56
|
+
},
|
|
57
|
+
"additionalProperties": true
|
|
58
|
+
},
|
|
59
|
+
"commonCreateFields": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"required": ["projectId", "subType", "name", "desc", "parentDirId", "businessOwner", "publish"],
|
|
62
|
+
"properties": {
|
|
63
|
+
"projectId": { "$ref": "#/$defs/nonEmptyString" },
|
|
64
|
+
"subType": { "enum": ["ATOMIC", "COMPOSITE", "DERIVED"] },
|
|
65
|
+
"name": { "$ref": "#/$defs/nonEmptyString" },
|
|
66
|
+
"engName": { "type": "string" },
|
|
67
|
+
"desc": { "$ref": "#/$defs/nonEmptyString" },
|
|
68
|
+
"parentDirId": { "$ref": "#/$defs/nonEmptyString" },
|
|
69
|
+
"businessOwner": { "$ref": "#/$defs/nonEmptyString" },
|
|
70
|
+
"publish": { "type": "boolean" },
|
|
71
|
+
"format": { "type": "object" },
|
|
72
|
+
"filter": { "type": ["object", "null"] },
|
|
73
|
+
"bizAttrs": { "type": "array" },
|
|
74
|
+
"dynamicParameters": { "type": "array" },
|
|
75
|
+
"bizMetricId": { "type": "string" }
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"commonUpdateFields": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"required": ["projectId", "subType", "name", "desc", "publish"],
|
|
81
|
+
"properties": {
|
|
82
|
+
"projectId": { "$ref": "#/$defs/nonEmptyString" },
|
|
83
|
+
"subType": { "enum": ["ATOMIC", "COMPOSITE", "DERIVED"] },
|
|
84
|
+
"name": { "$ref": "#/$defs/nonEmptyString" },
|
|
85
|
+
"engName": { "type": "string" },
|
|
86
|
+
"desc": { "$ref": "#/$defs/nonEmptyString" },
|
|
87
|
+
"publish": { "type": "boolean" },
|
|
88
|
+
"format": { "type": "object" },
|
|
89
|
+
"filter": { "type": ["object", "null"] },
|
|
90
|
+
"bizAttrs": { "type": "array" },
|
|
91
|
+
"dynamicParameters": { "type": "array" },
|
|
92
|
+
"bizMetricId": { "type": "string" }
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"atomicSource": {
|
|
96
|
+
"oneOf": [
|
|
97
|
+
{
|
|
98
|
+
"type": "object",
|
|
99
|
+
"required": ["fdId", "aggrType"],
|
|
100
|
+
"properties": {
|
|
101
|
+
"fdId": { "$ref": "#/$defs/nonEmptyString" },
|
|
102
|
+
"aggrType": { "enum": ["SUM", "MIN", "MAX", "AVG", "CNT", "CNT_DISTINCT", "NUL"] }
|
|
103
|
+
},
|
|
104
|
+
"not": { "required": ["formulaField"] }
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"type": "object",
|
|
108
|
+
"required": ["formulaField"],
|
|
109
|
+
"properties": {
|
|
110
|
+
"formulaField": {
|
|
111
|
+
"type": "object",
|
|
112
|
+
"required": ["fdFormula"],
|
|
113
|
+
"properties": { "fdFormula": { "$ref": "#/$defs/nonEmptyString" } },
|
|
114
|
+
"additionalProperties": false
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"not": { "anyOf": [{ "required": ["fdId"] }, { "required": ["aggrType"] }] }
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
"atomicCreateRequest": {
|
|
122
|
+
"allOf": [
|
|
123
|
+
{ "$ref": "#/$defs/commonCreateFields" },
|
|
124
|
+
{ "$ref": "#/$defs/atomicSource" },
|
|
125
|
+
{
|
|
126
|
+
"type": "object",
|
|
127
|
+
"required": ["dsId", "applicableDims"],
|
|
128
|
+
"properties": {
|
|
129
|
+
"subType": { "const": "ATOMIC" },
|
|
130
|
+
"dsId": { "$ref": "#/$defs/nonEmptyString" },
|
|
131
|
+
"applicableDims": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/nonEmptyString" } },
|
|
132
|
+
"timeDim": { "type": "string" },
|
|
133
|
+
"sourceMetricId": { "type": "string" }
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
"unevaluatedProperties": true
|
|
138
|
+
},
|
|
139
|
+
"atomicUpdateRequest": {
|
|
140
|
+
"allOf": [
|
|
141
|
+
{ "$ref": "#/$defs/commonUpdateFields" },
|
|
142
|
+
{ "$ref": "#/$defs/atomicSource" },
|
|
143
|
+
{
|
|
144
|
+
"type": "object",
|
|
145
|
+
"required": ["dsId", "applicableDims"],
|
|
146
|
+
"properties": {
|
|
147
|
+
"subType": { "const": "ATOMIC" },
|
|
148
|
+
"dsId": { "$ref": "#/$defs/nonEmptyString" },
|
|
149
|
+
"applicableDims": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/nonEmptyString" } },
|
|
150
|
+
"timeDim": { "type": "string" },
|
|
151
|
+
"sourceMetricId": { "type": "string" }
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
"unevaluatedProperties": true
|
|
156
|
+
},
|
|
157
|
+
"compositeBody": {
|
|
158
|
+
"type": "object",
|
|
159
|
+
"required": ["formula", "useExpressionMetricCommonDims", "applicableDims"],
|
|
160
|
+
"properties": {
|
|
161
|
+
"subType": { "const": "COMPOSITE" },
|
|
162
|
+
"formula": { "$ref": "#/$defs/nonEmptyString" },
|
|
163
|
+
"useExpressionMetricCommonDims": { "type": "boolean" },
|
|
164
|
+
"applicableDims": { "type": "array", "items": { "$ref": "#/$defs/nonEmptyString" } },
|
|
165
|
+
"timeDim": { "type": "string" }
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"derivedBody": {
|
|
169
|
+
"type": "object",
|
|
170
|
+
"required": ["deriveSetting"],
|
|
171
|
+
"properties": {
|
|
172
|
+
"subType": { "const": "DERIVED" },
|
|
173
|
+
"baseMetricId": { "type": "string" },
|
|
174
|
+
"deriveSetting": { "$ref": "#/$defs/deriveSetting" }
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"deriveSetting": {
|
|
178
|
+
"oneOf": [
|
|
179
|
+
{
|
|
180
|
+
"type": "object",
|
|
181
|
+
"required": ["deriveType", "advType", "advValue"],
|
|
182
|
+
"properties": {
|
|
183
|
+
"deriveType": { "const": "ORDINARY" },
|
|
184
|
+
"advType": { "enum": ["COMPARATIVE", "RECENT_X", "XTD", "LAST", "BIZ_CONDITION"] },
|
|
185
|
+
"advValue": {
|
|
186
|
+
"type": "object",
|
|
187
|
+
"required": ["advType"],
|
|
188
|
+
"properties": {
|
|
189
|
+
"advType": { "enum": ["COMPARATIVE", "RECENT_X", "XTD", "LAST", "BIZ_CONDITION"] }
|
|
190
|
+
},
|
|
191
|
+
"additionalProperties": true
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"additionalProperties": true
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"type": "object",
|
|
198
|
+
"required": ["deriveType", "formula"],
|
|
199
|
+
"properties": {
|
|
200
|
+
"deriveType": { "const": "COMPOSITE" },
|
|
201
|
+
"formula": { "$ref": "#/$defs/nonEmptyString" }
|
|
202
|
+
},
|
|
203
|
+
"additionalProperties": true
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
},
|
|
207
|
+
"createRequest": {
|
|
208
|
+
"oneOf": [
|
|
209
|
+
{ "$ref": "#/$defs/atomicCreateRequest" },
|
|
210
|
+
{
|
|
211
|
+
"allOf": [{ "$ref": "#/$defs/commonCreateFields" }, { "$ref": "#/$defs/compositeBody" }],
|
|
212
|
+
"unevaluatedProperties": true
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"allOf": [{ "$ref": "#/$defs/commonCreateFields" }, { "$ref": "#/$defs/derivedBody" }],
|
|
216
|
+
"unevaluatedProperties": true
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
"updateRequest": {
|
|
221
|
+
"oneOf": [
|
|
222
|
+
{ "$ref": "#/$defs/atomicUpdateRequest" },
|
|
223
|
+
{
|
|
224
|
+
"allOf": [{ "$ref": "#/$defs/commonUpdateFields" }, { "$ref": "#/$defs/compositeBody" }],
|
|
225
|
+
"unevaluatedProperties": true
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"allOf": [{ "$ref": "#/$defs/commonUpdateFields" }, { "$ref": "#/$defs/derivedBody" }],
|
|
229
|
+
"unevaluatedProperties": true
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
},
|
|
233
|
+
"listRequest": {
|
|
234
|
+
"type": "object",
|
|
235
|
+
"properties": {
|
|
236
|
+
"projectId": { "type": "string" },
|
|
237
|
+
"dirId": { "type": "string" },
|
|
238
|
+
"status": { "type": "string" },
|
|
239
|
+
"nameLike": { "type": "string" },
|
|
240
|
+
"subTypes": { "type": "string", "description": "逗号分隔,不是 JSON 数组" },
|
|
241
|
+
"orderBy": { "type": "string" },
|
|
242
|
+
"creator": { "type": "array", "items": { "type": "string" } },
|
|
243
|
+
"businessOwner": { "type": "array", "items": { "type": "string" } },
|
|
244
|
+
"bizAttrSearch": { "type": "array" },
|
|
245
|
+
"desc": { "type": "string" },
|
|
246
|
+
"favorite": { "type": "boolean" },
|
|
247
|
+
"canUse": { "type": "boolean" },
|
|
248
|
+
"isMarket": { "type": "boolean" },
|
|
249
|
+
"offset": { "type": "integer", "minimum": 0 },
|
|
250
|
+
"limit": { "type": "integer", "minimum": 1, "maximum": 100 }
|
|
251
|
+
},
|
|
252
|
+
"additionalProperties": false
|
|
253
|
+
},
|
|
254
|
+
"mutationSuccessResponse": {
|
|
255
|
+
"type": "object",
|
|
256
|
+
"required": ["result", "response"],
|
|
257
|
+
"properties": {
|
|
258
|
+
"result": { "const": "ok" },
|
|
259
|
+
"response": {
|
|
260
|
+
"type": "object",
|
|
261
|
+
"required": ["id"],
|
|
262
|
+
"properties": { "id": { "$ref": "#/$defs/nonEmptyString" } },
|
|
263
|
+
"additionalProperties": true
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
"additionalProperties": true
|
|
267
|
+
},
|
|
268
|
+
"metricSummary": {
|
|
269
|
+
"type": "object",
|
|
270
|
+
"required": ["id", "projectId", "status", "subType", "name", "dirId", "canManage", "canUse"],
|
|
271
|
+
"properties": {
|
|
272
|
+
"id": { "$ref": "#/$defs/nonEmptyString" },
|
|
273
|
+
"projectId": { "$ref": "#/$defs/nonEmptyString" },
|
|
274
|
+
"status": { "type": "string" },
|
|
275
|
+
"subType": { "enum": ["ATOMIC", "COMPOSITE", "DERIVED", "SHORTCUT"] },
|
|
276
|
+
"name": { "type": "string" },
|
|
277
|
+
"desc": { "type": "string" },
|
|
278
|
+
"dirId": { "$ref": "#/$defs/nonEmptyString" },
|
|
279
|
+
"businessOwner": { "$ref": "#/$defs/user" },
|
|
280
|
+
"creator": { "$ref": "#/$defs/user" },
|
|
281
|
+
"canManage": { "type": "boolean" },
|
|
282
|
+
"canUse": { "type": "boolean" },
|
|
283
|
+
"timeDim": { "oneOf": [{ "$ref": "#/$defs/field" }, { "type": "null" }] },
|
|
284
|
+
"hasDraft": { "type": ["boolean", "null"] },
|
|
285
|
+
"favorite": { "type": "boolean" },
|
|
286
|
+
"approvalStatus": { "type": ["string", "null"] }
|
|
287
|
+
},
|
|
288
|
+
"additionalProperties": true
|
|
289
|
+
},
|
|
290
|
+
"listResponse": {
|
|
291
|
+
"type": "object",
|
|
292
|
+
"required": ["result", "response"],
|
|
293
|
+
"properties": {
|
|
294
|
+
"result": { "const": "ok" },
|
|
295
|
+
"response": {
|
|
296
|
+
"type": "object",
|
|
297
|
+
"required": ["contents", "count"],
|
|
298
|
+
"properties": {
|
|
299
|
+
"contents": { "type": "array", "items": { "$ref": "#/$defs/metricSummary" } },
|
|
300
|
+
"count": { "type": "integer", "minimum": 0 },
|
|
301
|
+
"limit": { "type": "integer" },
|
|
302
|
+
"returnedCount": { "type": "integer" },
|
|
303
|
+
"dirPath": { "type": "array" }
|
|
304
|
+
},
|
|
305
|
+
"additionalProperties": true
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
"additionalProperties": true
|
|
309
|
+
},
|
|
310
|
+
"metricDetail": {
|
|
311
|
+
"type": "object",
|
|
312
|
+
"required": ["id", "projectId", "parentDirId", "subType", "status", "name"],
|
|
313
|
+
"properties": {
|
|
314
|
+
"id": { "$ref": "#/$defs/nonEmptyString" },
|
|
315
|
+
"projectId": { "$ref": "#/$defs/nonEmptyString" },
|
|
316
|
+
"parentDirId": { "$ref": "#/$defs/nonEmptyString" },
|
|
317
|
+
"subType": { "enum": ["ATOMIC", "COMPOSITE", "DERIVED", "SHORTCUT"] },
|
|
318
|
+
"uniformResourceType": { "type": "string" },
|
|
319
|
+
"status": { "type": "string" },
|
|
320
|
+
"name": { "type": "string" },
|
|
321
|
+
"desc": { "type": "string" },
|
|
322
|
+
"dsInfo": { "type": "object" },
|
|
323
|
+
"fdInfos": { "type": "array", "items": { "$ref": "#/$defs/field" } },
|
|
324
|
+
"aggrType": { "type": ["string", "null"] },
|
|
325
|
+
"formulaField": { "type": ["object", "null"] },
|
|
326
|
+
"formula": { "type": "string" },
|
|
327
|
+
"deriveSetting": { "$ref": "#/$defs/deriveSetting" },
|
|
328
|
+
"baseMetric": { "$ref": "#/$defs/metricReference" },
|
|
329
|
+
"referencedMetrics": { "type": "array", "items": { "$ref": "#/$defs/metricReference" } },
|
|
330
|
+
"applicableDims": { "type": "array", "items": { "$ref": "#/$defs/field" } },
|
|
331
|
+
"timeDim": { "oneOf": [{ "$ref": "#/$defs/field" }, { "type": "null" }] },
|
|
332
|
+
"businessOwner": { "$ref": "#/$defs/user" },
|
|
333
|
+
"creator": { "$ref": "#/$defs/user" },
|
|
334
|
+
"canManage": { "type": "boolean" },
|
|
335
|
+
"canUse": { "type": "boolean" }
|
|
336
|
+
},
|
|
337
|
+
"additionalProperties": true
|
|
338
|
+
},
|
|
339
|
+
"detailResponse": {
|
|
340
|
+
"type": "object",
|
|
341
|
+
"required": ["result", "response"],
|
|
342
|
+
"properties": {
|
|
343
|
+
"result": { "const": "ok" },
|
|
344
|
+
"response": { "$ref": "#/$defs/metricDetail" }
|
|
345
|
+
},
|
|
346
|
+
"additionalProperties": true
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|