@airalogy/aimd-recorder 1.22.0 → 1.23.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 (85) hide show
  1. package/README.md +61 -0
  2. package/README.zh-CN.md +61 -0
  3. package/dist/{AimdDnaSequenceField-Bhj28fP8.js → AimdDnaSequenceField-JzxsGmRf.js} +1 -1
  4. package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-D7c01UqN.js → AimdEditor.vue_vue_type_style_index_0_lang-v82TdP_I.js} +1978 -1899
  5. package/dist/AimdEntityRefField-O0FwJDC0.js +229 -0
  6. package/dist/{AimdMarkdownField-GS15pv4z.js → AimdMarkdownField-Dd6M3zOI.js} +18 -18
  7. package/dist/{AimdMarkdownNoteField-H9WP8tR6.js → AimdMarkdownNoteField-DCkJg80X.js} +23 -23
  8. package/dist/aimd-recorder.css +1 -1
  9. package/dist/{arc-B50G9-kH.js → arc-Bw7VOW6S.js} +1 -1
  10. package/dist/{architectureDiagram-3BPJPVTR-D9mBEbpY.js → architectureDiagram-3BPJPVTR-B4RdL02h.js} +2 -2
  11. package/dist/{blockDiagram-GPEHLZMM-Cs4swgto.js → blockDiagram-GPEHLZMM-B5skMgx6.js} +4 -4
  12. package/dist/{c4Diagram-AAUBKEIU-C12HKS3r.js → c4Diagram-AAUBKEIU-DDxL4a7C.js} +2 -2
  13. package/dist/{channel-D69VnjVz.js → channel-CQ1fnqoz.js} +1 -1
  14. package/dist/{chunk-2J33WTMH-oc-89G5c.js → chunk-2J33WTMH-B08Yr5NK.js} +1 -1
  15. package/dist/{chunk-4BX2VUAB-BDJS9G3r.js → chunk-4BX2VUAB-CyCffaPa.js} +1 -1
  16. package/dist/{chunk-55IACEB6-BPl3uHcA.js → chunk-55IACEB6-CztHyBOI.js} +1 -1
  17. package/dist/{chunk-727SXJPM-pWe-vDGf.js → chunk-727SXJPM-CEVNkjmn.js} +5 -5
  18. package/dist/{chunk-AQP2D5EJ-D-R5sIr1.js → chunk-AQP2D5EJ-C9t9hFOg.js} +3 -3
  19. package/dist/{chunk-FMBD7UC4-bo6Qyom1.js → chunk-FMBD7UC4-ulCTg3qb.js} +1 -1
  20. package/dist/{chunk-ND2GUHAM-DQMvtYV7.js → chunk-ND2GUHAM-D4Cbj52r.js} +1 -1
  21. package/dist/{chunk-QZHKN3VN-DlCn3HON.js → chunk-QZHKN3VN-Rpw3UPGi.js} +1 -1
  22. package/dist/{classDiagram-v2-Q7XG4LA2-DzUwWFwr.js → classDiagram-4FO5ZUOK-D8dNLFoj.js} +2 -2
  23. package/dist/{classDiagram-4FO5ZUOK-DzUwWFwr.js → classDiagram-v2-Q7XG4LA2-D8dNLFoj.js} +2 -2
  24. package/dist/components.js +3459 -3146
  25. package/dist/composables.js +94 -90
  26. package/dist/{cose-bilkent-S5V4N54A-BXLMzfpO.js → cose-bilkent-S5V4N54A-CzjADqxr.js} +1 -1
  27. package/dist/{dagre-BM42HDAG-DHnofIh9.js → dagre-BM42HDAG-C79MwQe7.js} +3 -3
  28. package/dist/{diagram-2AECGRRQ-BqTTVPsm.js → diagram-2AECGRRQ-DaQ7DMBK.js} +2 -2
  29. package/dist/{diagram-5GNKFQAL-D5p1UVbw.js → diagram-5GNKFQAL-BpWKnfL3.js} +3 -3
  30. package/dist/{diagram-KO2AKTUF-Uuoz9cFn.js → diagram-KO2AKTUF-CedxET4p.js} +2 -2
  31. package/dist/{diagram-LMA3HP47-W001U31X.js → diagram-LMA3HP47-FKe9tb0g.js} +2 -2
  32. package/dist/{diagram-OG6HWLK6-DL516LDr.js → diagram-OG6HWLK6-Bmb8IKvp.js} +3 -3
  33. package/dist/{erDiagram-TEJ5UH35-CCxgMb67.js → erDiagram-TEJ5UH35-Chalz_c9.js} +4 -4
  34. package/dist/{flowDiagram-I6XJVG4X-nXGdmC0O.js → flowDiagram-I6XJVG4X-DPelWotf.js} +6 -6
  35. package/dist/{ganttDiagram-6RSMTGT7-Bi9Ro7_Z.js → ganttDiagram-6RSMTGT7-o_Jm8a5l.js} +2 -2
  36. package/dist/{gitGraphDiagram-PVQCEYII-w1kNAy4E.js → gitGraphDiagram-PVQCEYII-BiwDVfiM.js} +3 -3
  37. package/dist/{graph-CpOkL_eZ.js → graph-_GsibXVP.js} +1 -1
  38. package/dist/index-CGb0O6x4.js +2660 -0
  39. package/dist/index.js +118 -112
  40. package/dist/{infoDiagram-5YYISTIA-Bde_w9T1.js → infoDiagram-5YYISTIA-CaVHW6oJ.js} +1 -1
  41. package/dist/{ishikawaDiagram-YF4QCWOH-x5M1KR0l.js → ishikawaDiagram-YF4QCWOH--qCCMUuo.js} +1 -1
  42. package/dist/{journeyDiagram-JHISSGLW-CIDQP8Zm.js → journeyDiagram-JHISSGLW-BsT-p1ex.js} +4 -4
  43. package/dist/{kanban-definition-UN3LZRKU-CKgO7sG8.js → kanban-definition-UN3LZRKU-oCTOaobR.js} +2 -2
  44. package/dist/{layout-BZYprqYR.js → layout-CAhsv4x8.js} +2 -2
  45. package/dist/{linear-ClSH2F_v.js → linear-CumggsyF.js} +1 -1
  46. package/dist/{mermaid.core-CcRV6K2R.js → mermaid.core-D4wVfZ2X.js} +34 -34
  47. package/dist/{mindmap-definition-RKZ34NQL-s3h6uszV.js → mindmap-definition-RKZ34NQL-NTgweVec.js} +3 -3
  48. package/dist/{pieDiagram-4H26LBE5-CgiazyWv.js → pieDiagram-4H26LBE5-C1UJkrIn.js} +3 -3
  49. package/dist/{quadrantDiagram-W4KKPZXB-DCPVgHoW.js → quadrantDiagram-W4KKPZXB-rCJc8QbP.js} +2 -2
  50. package/dist/record.js +4 -4
  51. package/dist/{requirementDiagram-4Y6WPE33-DE6F9oSB.js → requirementDiagram-4Y6WPE33-BzHGaPaB.js} +3 -3
  52. package/dist/{sankeyDiagram-5OEKKPKP-DZZoFFr-.js → sankeyDiagram-5OEKKPKP-B--uus9e.js} +1 -1
  53. package/dist/{sequenceDiagram-3UESZ5HK-DaYEOl60.js → sequenceDiagram-3UESZ5HK-D7javnYQ.js} +3 -3
  54. package/dist/{stateDiagram-AJRCARHV-BmgpHJlH.js → stateDiagram-AJRCARHV-DPsstQ8f.js} +4 -4
  55. package/dist/{stateDiagram-v2-BHNVJYJU-D49CHQD6.js → stateDiagram-v2-BHNVJYJU-BhhRcq6R.js} +2 -2
  56. package/dist/{timeline-definition-PNZ67QCA-DdVLoCkC.js → timeline-definition-PNZ67QCA-DgnJrK74.js} +2 -2
  57. package/dist/useCodeBlockRendering-f5pBgZ96.js +5083 -0
  58. package/dist/{vennDiagram-CIIHVFJN-CCcMKcd7.js → vennDiagram-CIIHVFJN-D1Q51ENl.js} +1 -1
  59. package/dist/{wardleyDiagram-YWT4CUSO-R4UGgGWY.js → wardleyDiagram-YWT4CUSO-DMfLoeaa.js} +2 -2
  60. package/dist/{xychartDiagram-2RQKCTM6-DyFhCubk.js → xychartDiagram-2RQKCTM6-DzF8t-UA.js} +2 -2
  61. package/package.json +4 -4
  62. package/src/__tests__/collector-field.test.ts +269 -0
  63. package/src/__tests__/record-search-render.test.ts +1 -0
  64. package/src/__tests__/var-field-render.test.ts +64 -2
  65. package/src/components/AimdCollectorField.vue +233 -0
  66. package/src/components/AimdEntityRefField.vue +314 -0
  67. package/src/components/AimdRecorder.vue +109 -2
  68. package/src/components/AimdRecorderEditor.vue +23 -0
  69. package/src/components/AimdRecorderWysiwygFieldHost.vue +6 -0
  70. package/src/components/AimdRecorderWysiwygSurface.vue +31 -0
  71. package/src/components/AimdVarField.vue +39 -2
  72. package/src/components/index.ts +4 -0
  73. package/src/components/recorderMilkdownPlugin.ts +9 -0
  74. package/src/composables/__tests__/useVarHelpers.test.ts +32 -0
  75. package/src/composables/index.ts +12 -0
  76. package/src/composables/useCollectors.ts +399 -0
  77. package/src/composables/useVarHelpers.ts +130 -2
  78. package/src/index.ts +20 -2
  79. package/src/locales.ts +110 -2
  80. package/src/styles/collector-field.css +281 -0
  81. package/src/styles/recorder-surface.css +163 -0
  82. package/src/styles/recorder.css +1 -0
  83. package/src/types.ts +127 -1
  84. package/dist/index-Dkrf2LJl.js +0 -1308
  85. package/dist/useCodeBlockRendering-CCuoP52e.js +0 -6103
@@ -70,6 +70,12 @@ export type FileInputConfig = AimdFileInputConfig
70
70
  export type ScalarListItemType = "string" | "int" | "float"
71
71
  export type ScalarListInputItem = string | number
72
72
 
73
+ export interface EntityRefTypeConfig {
74
+ multiple: boolean
75
+ entity?: string
76
+ source?: string
77
+ }
78
+
73
79
  export function getFileInputConfig(
74
80
  type: string | undefined,
75
81
  kwargs?: Record<string, unknown>,
@@ -189,6 +195,10 @@ function resolveOverrideInputKind(inputType: string | undefined, codeLanguage: s
189
195
  return 'scalar-list'
190
196
  }
191
197
 
198
+ if (normalized === 'entityref' || normalized === 'entityreference' || normalized === 'entity-ref') {
199
+ return 'entity-ref'
200
+ }
201
+
192
202
  if (normalized === 'dna') {
193
203
  return 'dna'
194
204
  }
@@ -334,6 +344,83 @@ function getScalarListItemTypeFromExpression(type: string | undefined): ScalarLi
334
344
  return undefined
335
345
  }
336
346
 
347
+ function normalizeEntityRefMetadataString(value: unknown): string | undefined {
348
+ if (typeof value !== "string") {
349
+ return undefined
350
+ }
351
+ const trimmed = value.trim()
352
+ return trimmed || undefined
353
+ }
354
+
355
+ function stripTypeArgumentQuotes(value: string | undefined): string | undefined {
356
+ if (!value) {
357
+ return undefined
358
+ }
359
+ const trimmed = value.trim()
360
+ if ((trimmed.startsWith("\"") && trimmed.endsWith("\"")) || (trimmed.startsWith("'") && trimmed.endsWith("'"))) {
361
+ return trimmed.slice(1, -1).trim() || undefined
362
+ }
363
+ return trimmed || undefined
364
+ }
365
+
366
+ function getEntityFromEntityRefExpression(type: string | undefined): string | undefined {
367
+ const normalized = canonicalizeTypeExpression(type).replace(/^typing\./, "")
368
+ const match = normalized.match(/^(?:airalogy\.types\.)?entityref(?:\[(.*)\])?$/)
369
+ return match ? stripTypeArgumentQuotes(match[1]) : undefined
370
+ }
371
+
372
+ function isEntityRefExpression(type: string | undefined): boolean {
373
+ const normalized = canonicalizeTypeExpression(type).replace(/^typing\./, "")
374
+ return /^(?:airalogy\.types\.)?entityref(?:\[.*\])?$/.test(normalized)
375
+ }
376
+
377
+ export function getEntityRefTypeConfig(
378
+ type: string | undefined,
379
+ kwargs?: Record<string, unknown>,
380
+ fieldMeta?: AimdFieldMeta,
381
+ ): EntityRefTypeConfig | undefined {
382
+ const unwrapped = unwrapOptionalTypeAnnotation(type)
383
+ const compact = canonicalizeTypeExpression(unwrapped).replace(/^typing\./, "")
384
+ const directEntity = getEntityFromEntityRefExpression(unwrapped)
385
+
386
+ let multiple = false
387
+ let expressionEntity = directEntity
388
+ let isEntityRef = isEntityRefExpression(unwrapped)
389
+
390
+ const listMatch = compact.match(/^(?:list|array)\[(.*)\]$/)
391
+ if (listMatch) {
392
+ multiple = true
393
+ expressionEntity = getEntityFromEntityRefExpression(listMatch[1])
394
+ isEntityRef = isEntityRefExpression(listMatch[1])
395
+ } else if (compact.endsWith("[]")) {
396
+ multiple = true
397
+ const itemType = compact.slice(0, -2)
398
+ expressionEntity = getEntityFromEntityRefExpression(itemType)
399
+ isEntityRef = isEntityRefExpression(itemType)
400
+ }
401
+
402
+ if (!isEntityRef) {
403
+ return undefined
404
+ }
405
+
406
+ return {
407
+ multiple,
408
+ entity: normalizeEntityRefMetadataString(fieldMeta?.entity)
409
+ ?? normalizeEntityRefMetadataString(kwargs?.entity)
410
+ ?? expressionEntity,
411
+ source: normalizeEntityRefMetadataString(fieldMeta?.source)
412
+ ?? normalizeEntityRefMetadataString(kwargs?.source),
413
+ }
414
+ }
415
+
416
+ export function isEntityRefVarType(
417
+ type: string | undefined,
418
+ kwargs?: Record<string, unknown>,
419
+ fieldMeta?: AimdFieldMeta,
420
+ ): boolean {
421
+ return getEntityRefTypeConfig(type, kwargs, fieldMeta) !== undefined
422
+ }
423
+
337
424
  export function getScalarListItemType(type: string | undefined): ScalarListItemType | undefined {
338
425
  const compact = canonicalizeTypeExpression(unwrapOptionalTypeAnnotation(type)).replace(/^typing\./, "")
339
426
 
@@ -377,6 +464,10 @@ export function getVarInputKind(type: string | undefined, options: VarInputKindO
377
464
  return typePlugin.inputKind
378
465
  }
379
466
 
467
+ if (isEntityRefVarType(type, options.kwargs, options.fieldMeta)) {
468
+ return "entity-ref"
469
+ }
470
+
380
471
  if (isScalarListVarType(type)) {
381
472
  return "scalar-list"
382
473
  }
@@ -496,6 +587,37 @@ export function getScalarListInputItems(value: unknown): string[] {
496
587
  return [String(normalized)]
497
588
  }
498
589
 
590
+ function getEntityRefDisplayToken(value: unknown): string {
591
+ const normalized = unwrapStructuredValue(value)
592
+ if (typeof normalized === "string") {
593
+ return normalized.trim()
594
+ }
595
+ if (!normalized || typeof normalized !== "object" || Array.isArray(normalized)) {
596
+ return ""
597
+ }
598
+
599
+ const record = normalized as Record<string, unknown>
600
+ const label = record.label ?? record.name ?? record.title
601
+ const id = record.id ?? record.value ?? record.key
602
+ const labelText = typeof label === "string" ? label.trim() : ""
603
+ const idText = typeof id === "string" || typeof id === "number" ? String(id).trim() : ""
604
+ if (labelText && idText && labelText !== idText) {
605
+ return `${labelText} (${idText})`
606
+ }
607
+ return labelText || idText
608
+ }
609
+
610
+ function getEntityRefDisplayValue(value: unknown): string {
611
+ const normalized = unwrapStructuredValue(value)
612
+ if (Array.isArray(normalized)) {
613
+ return normalized
614
+ .map(item => getEntityRefDisplayToken(item))
615
+ .filter(Boolean)
616
+ .join(", ")
617
+ }
618
+ return getEntityRefDisplayToken(normalized)
619
+ }
620
+
499
621
  function toFiniteNumber(value: unknown): number | undefined {
500
622
  if (typeof value === "number") {
501
623
  return Number.isFinite(value) ? value : undefined
@@ -782,6 +904,10 @@ export function getVarInputDisplayValue(
782
904
  ))
783
905
  }
784
906
 
907
+ if (kind === "entity-ref") {
908
+ return getEntityRefDisplayValue(normalized)
909
+ }
910
+
785
911
  if (isStructuredVarType(options.type)) {
786
912
  return stringifyStructuredInputValue(normalized)
787
913
  }
@@ -890,7 +1016,8 @@ function getVarControlMinWidth(inputKind: VarInputKind): number {
890
1016
  case "code":
891
1017
  case "file":
892
1018
  case "scalar-list":
893
- return inputKind === "scalar-list" ? 220 : 160
1019
+ case "entity-ref":
1020
+ return inputKind === "scalar-list" || inputKind === "entity-ref" ? 220 : 160
894
1021
  default:
895
1022
  return 0
896
1023
  }
@@ -907,6 +1034,7 @@ function getVarControlExtraWidth(inputKind: VarInputKind): number {
907
1034
  case "file":
908
1035
  return 24
909
1036
  case "scalar-list":
1037
+ case "entity-ref":
910
1038
  return 16
911
1039
  default:
912
1040
  return 4
@@ -1102,7 +1230,7 @@ export function applyVarStackWidth(target: HTMLElement, inputKind: VarInputKind)
1102
1230
  return
1103
1231
  }
1104
1232
 
1105
- if (inputKind === "scalar-list") {
1233
+ if (inputKind === "scalar-list" || inputKind === "entity-ref") {
1106
1234
  wrapper.style.width = "100%"
1107
1235
  wrapper.style.maxWidth = "100%"
1108
1236
  return
package/src/index.ts CHANGED
@@ -10,8 +10,8 @@
10
10
  import './styles/recorder.css'
11
11
  import { AimdProtocolRecorder as DeprecatedAimdProtocolRecorder } from './components'
12
12
 
13
- export { AimdAssignerGraph, AimdRecorder, AimdRecorderEditor, AimdQuizRecorder } from './components'
14
- export { AimdDnaSequenceField, AimdMarkdownField } from './components'
13
+ export { AimdAssignerGraph, AimdCollectorField, AimdRecorder, AimdRecorderEditor, AimdQuizRecorder } from './components'
14
+ export { AimdDnaSequenceField, AimdEntityRefField, AimdMarkdownField } from './components'
15
15
  /**
16
16
  * @deprecated Use `AimdRecorder` instead.
17
17
  */
@@ -38,8 +38,26 @@ export type {
38
38
  AimdServerAssignerRunnerRequest,
39
39
  AimdFileUploadContext,
40
40
  AimdFileUploadHandler,
41
+ AimdCollectorObservation,
42
+ AimdCollectorObservationInput,
43
+ AimdCollectorObservationSource,
44
+ AimdCollectorPermissionDecision,
45
+ AimdCollectorPermissionHandler,
46
+ AimdCollectorPermissionRequest,
47
+ AimdCollectorProviderMap,
48
+ AimdCollectorProviderRequest,
49
+ AimdCollectorRuntimeState,
50
+ AimdCollectorRuntimeStatus,
51
+ AimdDataSourceProvider,
41
52
  AimdFileResolveContext,
42
53
  AimdFileInfoResolver,
54
+ AimdEntityResolveContext,
55
+ AimdEntityResolver,
56
+ AimdEntityResolverEntry,
57
+ AimdEntityResolverMap,
58
+ AimdEntityRefOption,
59
+ AimdEntityRefValue,
60
+ AimdEntitySearchHandler,
43
61
  AimdResolvedFileInfo,
44
62
  AimdSelectedFileValue,
45
63
  AimdTypePlugin,
package/src/locales.ts CHANGED
@@ -107,6 +107,36 @@ export interface AimdRecorderMessages {
107
107
  jsonInvalidArray: string
108
108
  jsonInvalidItem: string
109
109
  }
110
+ entityRef: {
111
+ searchPlaceholder: (entity: string) => string
112
+ manualIdPlaceholder: string
113
+ add: string
114
+ select: string
115
+ clear: string
116
+ remove: string
117
+ noResolver: string
118
+ noMatches: string
119
+ searchFailed: string
120
+ }
121
+ collector: {
122
+ snapshot: string
123
+ start: string
124
+ stop: string
125
+ retry: string
126
+ manualEntry: string
127
+ cancelManual: string
128
+ saveManual: string
129
+ valuePlaceholder: string
130
+ reasonPlaceholder: string
131
+ reasonRequired: string
132
+ invalidValue: string
133
+ providerUnavailable: string
134
+ permissionDenied: string
135
+ unsupported: string
136
+ sampleCount: (count: number) => string
137
+ lastObserved: (value: string) => string
138
+ status: Record<"idle" | "waiting_for_permission" | "connecting" | "collecting" | "stopping" | "completed" | "error" | "unsupported", string>
139
+ }
110
140
  boolean: {
111
141
  unset: string
112
142
  true: string
@@ -321,13 +351,52 @@ const EN_US_MESSAGES: AimdRecorderMessages = {
321
351
  jsonInvalidArray: "JSON value must be an array.",
322
352
  jsonInvalidItem: "JSON array items do not match this list type.",
323
353
  },
354
+ entityRef: {
355
+ searchPlaceholder: entity => `Search ${entity}`,
356
+ manualIdPlaceholder: "Entity id",
357
+ add: "Add",
358
+ select: "Select",
359
+ clear: "Clear",
360
+ remove: "Remove",
361
+ noResolver: "No entity source is connected. Enter an id manually.",
362
+ noMatches: "No matching entities",
363
+ searchFailed: "Entity search failed.",
364
+ },
365
+ collector: {
366
+ snapshot: "Read now",
367
+ start: "Start collecting",
368
+ stop: "Stop",
369
+ retry: "Retry",
370
+ manualEntry: "Enter manually",
371
+ cancelManual: "Cancel",
372
+ saveManual: "Save observation",
373
+ valuePlaceholder: "Observed value",
374
+ reasonPlaceholder: "Reason for manual entry",
375
+ reasonRequired: "A reason is required for manual entry.",
376
+ invalidValue: "Enter a value that matches the Observation type.",
377
+ providerUnavailable: "This data source is not available in the current host.",
378
+ permissionDenied: "Collector access was not authorized.",
379
+ unsupported: "This Collector mode requires a host runtime that is not available here.",
380
+ sampleCount: count => `${count} sample${count === 1 ? "" : "s"}`,
381
+ lastObserved: value => `Observed ${value}`,
382
+ status: {
383
+ idle: "Ready",
384
+ waiting_for_permission: "Waiting for permission",
385
+ connecting: "Connecting",
386
+ collecting: "Collecting",
387
+ stopping: "Stopping",
388
+ completed: "Completed",
389
+ error: "Error",
390
+ unsupported: "Unavailable",
391
+ },
392
+ },
324
393
  boolean: {
325
394
  unset: "Not set",
326
395
  true: "True",
327
396
  false: "False",
328
397
  },
329
398
  search: {
330
- label: "Search record",
399
+ label: "Search current record",
331
400
  fieldLabel: "Search field",
332
401
  placeholder: "Search this record",
333
402
  allFields: "All fields",
@@ -508,13 +577,52 @@ const ZH_CN_MESSAGES: AimdRecorderMessages = {
508
577
  jsonInvalidArray: "JSON 值必须是数组。",
509
578
  jsonInvalidItem: "JSON 数组项与当前列表类型不匹配。",
510
579
  },
580
+ entityRef: {
581
+ searchPlaceholder: entity => `搜索${entity}`,
582
+ manualIdPlaceholder: "实体 ID",
583
+ add: "添加",
584
+ select: "选择",
585
+ clear: "清除",
586
+ remove: "移除",
587
+ noResolver: "未连接实体来源,可手动输入 ID。",
588
+ noMatches: "没有匹配的实体",
589
+ searchFailed: "实体搜索失败。",
590
+ },
591
+ collector: {
592
+ snapshot: "立即采集",
593
+ start: "开始采集",
594
+ stop: "停止",
595
+ retry: "重试",
596
+ manualEntry: "手工填写",
597
+ cancelManual: "取消",
598
+ saveManual: "保存观测值",
599
+ valuePlaceholder: "观测值",
600
+ reasonPlaceholder: "手工填写原因",
601
+ reasonRequired: "手工填写必须说明原因。",
602
+ invalidValue: "请输入符合 Observation 类型的值。",
603
+ providerUnavailable: "当前宿主未提供这个数据源。",
604
+ permissionDenied: "未获得 Collector 访问授权。",
605
+ unsupported: "该 Collector 模式需要当前宿主尚未提供的运行时。",
606
+ sampleCount: count => `${count} 个观测值`,
607
+ lastObserved: value => `观测于 ${value}`,
608
+ status: {
609
+ idle: "就绪",
610
+ waiting_for_permission: "等待授权",
611
+ connecting: "连接中",
612
+ collecting: "采集中",
613
+ stopping: "停止中",
614
+ completed: "已完成",
615
+ error: "错误",
616
+ unsupported: "不可用",
617
+ },
618
+ },
511
619
  boolean: {
512
620
  unset: "未填写",
513
621
  true: "是",
514
622
  false: "否",
515
623
  },
516
624
  search: {
517
- label: "搜索记录",
625
+ label: "搜索当前记录",
518
626
  fieldLabel: "搜索字段",
519
627
  placeholder: "搜索当前记录",
520
628
  allFields: "全部字段",
@@ -0,0 +1,281 @@
1
+ .aimd-rec-collector {
2
+ display: inline-flex;
3
+ flex-direction: column;
4
+ width: min(100%, 680px);
5
+ min-width: min(320px, 100%);
6
+ max-width: 100%;
7
+ overflow: hidden;
8
+ vertical-align: middle;
9
+ border: 1px solid var(--aimd-border-color, #90caf9);
10
+ border-radius: 6px;
11
+ background: #fff;
12
+ }
13
+
14
+ .aimd-rec-collector__header {
15
+ display: flex;
16
+ align-items: stretch;
17
+ min-width: 0;
18
+ min-height: 30px;
19
+ border-bottom: 1px solid var(--aimd-border-color, #90caf9);
20
+ background: var(--aimd-var-bg, #e3f2fd);
21
+ }
22
+
23
+ .aimd-rec-collector__header > .aimd-field__scope {
24
+ display: inline-flex;
25
+ flex: 0 0 auto;
26
+ align-items: center;
27
+ padding: 4px 8px;
28
+ font-size: 12px;
29
+ font-weight: 600;
30
+ color: #1565c0;
31
+ background: #bbdefb;
32
+ }
33
+
34
+ .aimd-rec-collector__identity {
35
+ display: flex;
36
+ flex: 1 1 auto;
37
+ min-width: 0;
38
+ align-items: baseline;
39
+ gap: 6px;
40
+ padding: 4px 8px;
41
+ }
42
+
43
+ .aimd-rec-collector__title,
44
+ .aimd-rec-collector__key {
45
+ overflow-wrap: anywhere;
46
+ }
47
+
48
+ .aimd-rec-collector__title {
49
+ font-weight: 600;
50
+ color: #1565c0;
51
+ }
52
+
53
+ .aimd-rec-collector__key,
54
+ .aimd-rec-collector__source,
55
+ .aimd-rec-collector__meta {
56
+ font-size: 12px;
57
+ color: #64748b;
58
+ }
59
+
60
+ .aimd-rec-collector__source {
61
+ align-self: center;
62
+ max-width: 180px;
63
+ overflow: hidden;
64
+ padding: 2px 6px;
65
+ text-overflow: ellipsis;
66
+ white-space: nowrap;
67
+ }
68
+
69
+ .aimd-rec-collector__status {
70
+ display: inline-flex;
71
+ flex: 0 0 auto;
72
+ align-items: center;
73
+ gap: 5px;
74
+ padding: 4px 8px;
75
+ border-left: 1px solid rgba(25, 118, 210, 0.18);
76
+ font-size: 12px;
77
+ font-weight: 600;
78
+ color: #475569;
79
+ }
80
+
81
+ .aimd-rec-collector__status-dot {
82
+ width: 7px;
83
+ height: 7px;
84
+ border-radius: 50%;
85
+ background: #94a3b8;
86
+ }
87
+
88
+ .aimd-rec-collector__status--connecting .aimd-rec-collector__status-dot,
89
+ .aimd-rec-collector__status--waiting_for_permission .aimd-rec-collector__status-dot,
90
+ .aimd-rec-collector__status--stopping .aimd-rec-collector__status-dot {
91
+ background: #f59e0b;
92
+ }
93
+
94
+ .aimd-rec-collector__status--collecting .aimd-rec-collector__status-dot {
95
+ background: #16a34a;
96
+ box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
97
+ }
98
+
99
+ .aimd-rec-collector__status--error .aimd-rec-collector__status-dot,
100
+ .aimd-rec-collector__status--unsupported .aimd-rec-collector__status-dot {
101
+ background: #dc2626;
102
+ }
103
+
104
+ .aimd-rec-collector__body {
105
+ display: flex;
106
+ flex-wrap: wrap;
107
+ align-items: center;
108
+ gap: 8px 12px;
109
+ min-height: 42px;
110
+ padding: 7px 8px;
111
+ }
112
+
113
+ .aimd-rec-collector__reading {
114
+ display: inline-flex;
115
+ flex: 1 1 140px;
116
+ min-width: 0;
117
+ align-items: baseline;
118
+ gap: 5px;
119
+ }
120
+
121
+ .aimd-rec-collector__value {
122
+ min-width: 0;
123
+ overflow: hidden;
124
+ font-size: 16px;
125
+ font-weight: 600;
126
+ color: #1e293b;
127
+ text-overflow: ellipsis;
128
+ white-space: nowrap;
129
+ }
130
+
131
+ .aimd-rec-collector__unit,
132
+ .aimd-rec-collector__empty {
133
+ font-size: 13px;
134
+ color: #64748b;
135
+ }
136
+
137
+ .aimd-rec-collector__meta {
138
+ display: inline-flex;
139
+ flex: 0 1 auto;
140
+ flex-wrap: wrap;
141
+ gap: 4px 10px;
142
+ }
143
+
144
+ .aimd-rec-collector__actions {
145
+ display: inline-flex;
146
+ flex: 0 0 auto;
147
+ gap: 6px;
148
+ margin-left: auto;
149
+ }
150
+
151
+ .aimd-rec-collector__button {
152
+ min-height: 30px;
153
+ padding: 4px 10px;
154
+ border: 1px solid #cbd5e1;
155
+ border-radius: 5px;
156
+ color: #334155;
157
+ background: #fff;
158
+ font: inherit;
159
+ font-size: 13px;
160
+ font-weight: 600;
161
+ cursor: pointer;
162
+ }
163
+
164
+ .aimd-rec-collector__button:hover:not(:disabled) {
165
+ border-color: #60a5fa;
166
+ background: #eff6ff;
167
+ }
168
+
169
+ .aimd-rec-collector__button:focus-visible,
170
+ .aimd-rec-collector__manual-value:focus,
171
+ .aimd-rec-collector__manual-reason:focus {
172
+ outline: 2px solid #60a5fa;
173
+ outline-offset: 1px;
174
+ }
175
+
176
+ .aimd-rec-collector__button:disabled {
177
+ cursor: not-allowed;
178
+ opacity: 0.5;
179
+ }
180
+
181
+ .aimd-rec-collector__button--primary {
182
+ border-color: #1976d2;
183
+ color: #fff;
184
+ background: #1976d2;
185
+ }
186
+
187
+ .aimd-rec-collector__button--primary:hover:not(:disabled) {
188
+ border-color: #1565c0;
189
+ background: #1565c0;
190
+ }
191
+
192
+ .aimd-rec-collector__button--danger {
193
+ border-color: #ef4444;
194
+ color: #b91c1c;
195
+ background: #fff;
196
+ }
197
+
198
+ .aimd-rec-collector__message {
199
+ display: block;
200
+ padding: 0 8px 7px;
201
+ font-size: 12px;
202
+ color: #b45309;
203
+ }
204
+
205
+ .aimd-rec-collector__message--error,
206
+ .aimd-rec-collector--error .aimd-rec-collector__message {
207
+ color: #b91c1c;
208
+ }
209
+
210
+ .aimd-rec-collector__manual {
211
+ display: grid;
212
+ grid-template-columns: minmax(120px, 1fr) minmax(180px, 1.4fr) auto;
213
+ gap: 6px;
214
+ padding: 8px;
215
+ border-top: 1px solid #dbeafe;
216
+ background: #f8fafc;
217
+ }
218
+
219
+ .aimd-rec-collector__manual-value,
220
+ .aimd-rec-collector__manual-reason {
221
+ box-sizing: border-box;
222
+ min-width: 0;
223
+ min-height: 30px;
224
+ padding: 5px 8px;
225
+ border: 1px solid #cbd5e1;
226
+ border-radius: 5px;
227
+ color: #1e293b;
228
+ background: #fff;
229
+ font: inherit;
230
+ font-size: 13px;
231
+ resize: vertical;
232
+ }
233
+
234
+ .aimd-rec-collector__manual > .aimd-rec-collector__message {
235
+ grid-column: 1 / -1;
236
+ padding: 0;
237
+ }
238
+
239
+ @media (max-width: 640px) {
240
+ .aimd-rec-collector {
241
+ width: 100%;
242
+ min-width: 0;
243
+ }
244
+
245
+ .aimd-rec-collector__header {
246
+ flex-wrap: wrap;
247
+ }
248
+
249
+ .aimd-rec-collector__identity {
250
+ flex-basis: calc(100% - 54px);
251
+ }
252
+
253
+ .aimd-rec-collector__source {
254
+ max-width: 55%;
255
+ margin-left: 8px;
256
+ }
257
+
258
+ .aimd-rec-collector__status {
259
+ margin-left: auto;
260
+ border-left: 0;
261
+ }
262
+
263
+ .aimd-rec-collector__actions {
264
+ width: 100%;
265
+ margin-left: 0;
266
+ }
267
+
268
+ .aimd-rec-collector__actions > .aimd-rec-collector__button {
269
+ flex: 1 1 auto;
270
+ }
271
+
272
+ .aimd-rec-collector__manual {
273
+ grid-template-columns: 1fr;
274
+ }
275
+ }
276
+
277
+ @media (prefers-reduced-motion: reduce) {
278
+ .aimd-rec-collector__status-dot {
279
+ box-shadow: none;
280
+ }
281
+ }