@airalogy/aimd-recorder 1.22.0 → 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 (95) hide show
  1. package/README.md +80 -0
  2. package/README.zh-CN.md +80 -0
  3. package/dist/{AimdCodeField-BN_0UQMx.js → AimdCodeField-CPjcXY4D.js} +1 -1
  4. package/dist/{AimdDnaSequenceField-Bhj28fP8.js → AimdDnaSequenceField-Dz-IONoA.js} +5 -4
  5. package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-D7c01UqN.js → AimdEditor.vue_vue_type_style_index_0_lang-JAD--qFs.js} +1999 -1900
  6. package/dist/AimdEntityRefField-BE0s2o5T.js +229 -0
  7. package/dist/{AimdMarkdownField-GS15pv4z.js → AimdMarkdownField-BeD2t9JY.js} +5 -5
  8. package/dist/{AimdMarkdownNoteField-H9WP8tR6.js → AimdMarkdownNoteField-DIgGEYpj.js} +16 -16
  9. package/dist/{_commonjsHelpers-B5RozER-.js → _commonjsHelpers-ByX85dGu.js} +12 -19
  10. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  11. package/dist/aimd-recorder.css +1 -1
  12. package/dist/{arc-B50G9-kH.js → arc-CLJJdrm0.js} +1 -1
  13. package/dist/{architectureDiagram-3BPJPVTR-D9mBEbpY.js → architectureDiagram-3BPJPVTR-BizrFPnS.js} +3 -3
  14. package/dist/{blockDiagram-GPEHLZMM-Cs4swgto.js → blockDiagram-GPEHLZMM-IHDih8JW.js} +4 -4
  15. package/dist/{c4Diagram-AAUBKEIU-C12HKS3r.js → c4Diagram-AAUBKEIU-BQtg8m_M.js} +2 -2
  16. package/dist/{channel-D69VnjVz.js → channel-D8q7AX1Z.js} +1 -1
  17. package/dist/{chunk-2J33WTMH-oc-89G5c.js → chunk-2J33WTMH-C24lbKon.js} +1 -1
  18. package/dist/{chunk-4BX2VUAB-BDJS9G3r.js → chunk-4BX2VUAB-1m_lB_xe.js} +1 -1
  19. package/dist/{chunk-55IACEB6-BPl3uHcA.js → chunk-55IACEB6-BE5Nj-sd.js} +1 -1
  20. package/dist/{chunk-727SXJPM-pWe-vDGf.js → chunk-727SXJPM-Cg-Xw_d_.js} +5 -5
  21. package/dist/{chunk-AQP2D5EJ-D-R5sIr1.js → chunk-AQP2D5EJ-BvRpPCiY.js} +3 -3
  22. package/dist/{chunk-FMBD7UC4-bo6Qyom1.js → chunk-FMBD7UC4-D_44MTsg.js} +1 -1
  23. package/dist/{chunk-ND2GUHAM-DQMvtYV7.js → chunk-ND2GUHAM-tVBIo4LA.js} +1 -1
  24. package/dist/{chunk-QZHKN3VN-DlCn3HON.js → chunk-QZHKN3VN-B91HYLks.js} +1 -1
  25. package/dist/{classDiagram-v2-Q7XG4LA2-DzUwWFwr.js → classDiagram-4FO5ZUOK-CkejvTAN.js} +2 -2
  26. package/dist/{classDiagram-4FO5ZUOK-DzUwWFwr.js → classDiagram-v2-Q7XG4LA2-CkejvTAN.js} +2 -2
  27. package/dist/components.js +3869 -3359
  28. package/dist/composables.js +98 -93
  29. package/dist/{cose-bilkent-S5V4N54A-BXLMzfpO.js → cose-bilkent-S5V4N54A-CNcuriOF.js} +2 -2
  30. package/dist/{dagre-BM42HDAG-DHnofIh9.js → dagre-BM42HDAG-DMqFGafq.js} +3 -3
  31. package/dist/{diagram-2AECGRRQ-BqTTVPsm.js → diagram-2AECGRRQ-Cksd3pP3.js} +2 -2
  32. package/dist/{diagram-5GNKFQAL-D5p1UVbw.js → diagram-5GNKFQAL-SVjLnDJG.js} +3 -3
  33. package/dist/{diagram-KO2AKTUF-Uuoz9cFn.js → diagram-KO2AKTUF-DfNIAG6w.js} +2 -2
  34. package/dist/{diagram-LMA3HP47-W001U31X.js → diagram-LMA3HP47-DPOyCMGB.js} +2 -2
  35. package/dist/{diagram-OG6HWLK6-DL516LDr.js → diagram-OG6HWLK6-BDURmT37.js} +3 -3
  36. package/dist/{erDiagram-TEJ5UH35-CCxgMb67.js → erDiagram-TEJ5UH35-N991qII9.js} +4 -4
  37. package/dist/{flowDiagram-I6XJVG4X-nXGdmC0O.js → flowDiagram-I6XJVG4X-BABRFuk-.js} +6 -6
  38. package/dist/{ganttDiagram-6RSMTGT7-Bi9Ro7_Z.js → ganttDiagram-6RSMTGT7-BMDnK96S.js} +3 -3
  39. package/dist/{gitGraphDiagram-PVQCEYII-w1kNAy4E.js → gitGraphDiagram-PVQCEYII-cEvL7Dss.js} +3 -3
  40. package/dist/{graph-CpOkL_eZ.js → graph-BA09aCvZ.js} +1 -1
  41. package/dist/index.js +125 -113
  42. package/dist/{infoDiagram-5YYISTIA-Bde_w9T1.js → infoDiagram-5YYISTIA-DpC1Zthd.js} +1 -1
  43. package/dist/{ishikawaDiagram-YF4QCWOH-x5M1KR0l.js → ishikawaDiagram-YF4QCWOH-CMEt_f-x.js} +1 -1
  44. package/dist/{journeyDiagram-JHISSGLW-CIDQP8Zm.js → journeyDiagram-JHISSGLW-C0Qw169C.js} +4 -4
  45. package/dist/{kanban-definition-UN3LZRKU-CKgO7sG8.js → kanban-definition-UN3LZRKU-caROmSUy.js} +2 -2
  46. package/dist/{layout-BZYprqYR.js → layout-CH65__O4.js} +2 -2
  47. package/dist/{linear-ClSH2F_v.js → linear-B1VXpcsy.js} +1 -1
  48. package/dist/{mermaid.core-CcRV6K2R.js → mermaid.core-Cbmwvfvk.js} +35 -35
  49. package/dist/{mindmap-definition-RKZ34NQL-s3h6uszV.js → mindmap-definition-RKZ34NQL-DpTR5ilS.js} +3 -3
  50. package/dist/{pieDiagram-4H26LBE5-CgiazyWv.js → pieDiagram-4H26LBE5-Cb_KrmWC.js} +3 -3
  51. package/dist/{quadrantDiagram-W4KKPZXB-DCPVgHoW.js → quadrantDiagram-W4KKPZXB-B5_NswmK.js} +2 -2
  52. package/dist/record.js +77 -72
  53. package/dist/{requirementDiagram-4Y6WPE33-DE6F9oSB.js → requirementDiagram-4Y6WPE33-OFwfat5D.js} +3 -3
  54. package/dist/{sankeyDiagram-5OEKKPKP-DZZoFFr-.js → sankeyDiagram-5OEKKPKP-BaawdZEE.js} +1 -1
  55. package/dist/{sequenceDiagram-3UESZ5HK-DaYEOl60.js → sequenceDiagram-3UESZ5HK-DLv8X8ef.js} +3 -3
  56. package/dist/{stateDiagram-AJRCARHV-BmgpHJlH.js → stateDiagram-AJRCARHV-B6F3wrsd.js} +4 -4
  57. package/dist/{stateDiagram-v2-BHNVJYJU-D49CHQD6.js → stateDiagram-v2-BHNVJYJU-BcNEoshv.js} +2 -2
  58. package/dist/{timeline-definition-PNZ67QCA-DdVLoCkC.js → timeline-definition-PNZ67QCA-CvdHJ4eQ.js} +2 -2
  59. package/dist/useCodeBlockRendering-D2viVPtA.js +3158 -0
  60. package/dist/useFieldRendering-Co4DOOvL.js +1120 -0
  61. package/dist/useVarHelpers-Du2obGza.js +3474 -0
  62. package/dist/validation-oyqyD7Jp.js +5601 -0
  63. package/dist/{vennDiagram-CIIHVFJN-CCcMKcd7.js → vennDiagram-CIIHVFJN-U0GlQDjX.js} +1 -1
  64. package/dist/{wardleyDiagram-YWT4CUSO-R4UGgGWY.js → wardleyDiagram-YWT4CUSO-CzF_KMcn.js} +2 -2
  65. package/dist/{xychartDiagram-2RQKCTM6-DyFhCubk.js → xychartDiagram-2RQKCTM6-Cljki2Vk.js} +2 -2
  66. package/package.json +6 -4
  67. package/src/__tests__/collector-field.test.ts +269 -0
  68. package/src/__tests__/record-search-render.test.ts +1 -0
  69. package/src/__tests__/record-validation.test.ts +378 -0
  70. package/src/__tests__/recorder-wysiwyg-field-host.test.ts +26 -0
  71. package/src/__tests__/var-field-render.test.ts +64 -2
  72. package/src/components/AimdCollectorField.vue +233 -0
  73. package/src/components/AimdEntityRefField.vue +314 -0
  74. package/src/components/AimdRecorder.vue +285 -7
  75. package/src/components/AimdRecorderEditor.vue +51 -1
  76. package/src/components/AimdRecorderWysiwygFieldHost.vue +10 -0
  77. package/src/components/AimdRecorderWysiwygSurface.vue +166 -4
  78. package/src/components/AimdVarField.vue +39 -2
  79. package/src/components/AimdVarTableField.vue +38 -21
  80. package/src/components/index.ts +4 -0
  81. package/src/components/recorderMilkdownPlugin.ts +16 -0
  82. package/src/composables/__tests__/useVarHelpers.test.ts +32 -0
  83. package/src/composables/index.ts +12 -0
  84. package/src/composables/useCollectors.ts +399 -0
  85. package/src/composables/useVarHelpers.ts +130 -2
  86. package/src/index.ts +32 -2
  87. package/src/locales.ts +140 -2
  88. package/src/record/index.ts +14 -0
  89. package/src/record/validation.ts +772 -0
  90. package/src/styles/collector-field.css +281 -0
  91. package/src/styles/recorder-surface.css +163 -0
  92. package/src/styles/recorder.css +33 -0
  93. package/src/types.ts +168 -1
  94. package/dist/index-Dkrf2LJl.js +0 -1308
  95. 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,
@@ -62,6 +80,11 @@ export type {
62
80
  AimdStepOrCheckRecordItem,
63
81
  AimdFieldMeta,
64
82
  AimdFieldState,
83
+ AimdRecorderValidationCode,
84
+ AimdRecorderValidationTrigger,
85
+ AimdRecordValidationSchema,
86
+ AimdRecorderValidationIssue,
87
+ AimdRecorderValidationResult,
65
88
  AimdDnaSequenceAnnotation,
66
89
  AimdDnaSequenceQualifier,
67
90
  AimdDnaSequenceSegment,
@@ -69,6 +92,13 @@ export type {
69
92
  FieldEventPayload,
70
93
  TableEventPayload,
71
94
  } from './types'
95
+ export {
96
+ getAimdVarTableCellFieldKey,
97
+ matchesAimdValidationFieldSelector,
98
+ validateAimdField,
99
+ validateAimdRecord,
100
+ type ValidateAimdRecordOptions,
101
+ } from './record/validation'
72
102
  export { createEmptyProtocolRecordData } from './types'
73
103
  export {
74
104
  BUILT_IN_AIMD_TYPE_PLUGINS,
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
@@ -124,6 +154,16 @@ export interface AimdRecorderMessages {
124
154
  noMatches: string
125
155
  matchCount: (current: number, total: number) => string
126
156
  }
157
+ validation: {
158
+ required: (label: string) => string
159
+ pattern: (label: string) => string
160
+ enum: (label: string) => string
161
+ numeric: (label: string, detail: string) => string
162
+ type: (label: string, expected: string) => string
163
+ format: (label: string, format: string) => string
164
+ schema: (label: string, detail: string) => string
165
+ tableCell: (row: number, column: string) => string
166
+ }
127
167
  dna: {
128
168
  editMode: string
129
169
  interactiveMode: string
@@ -321,13 +361,52 @@ const EN_US_MESSAGES: AimdRecorderMessages = {
321
361
  jsonInvalidArray: "JSON value must be an array.",
322
362
  jsonInvalidItem: "JSON array items do not match this list type.",
323
363
  },
364
+ entityRef: {
365
+ searchPlaceholder: entity => `Search ${entity}`,
366
+ manualIdPlaceholder: "Entity id",
367
+ add: "Add",
368
+ select: "Select",
369
+ clear: "Clear",
370
+ remove: "Remove",
371
+ noResolver: "No entity source is connected. Enter an id manually.",
372
+ noMatches: "No matching entities",
373
+ searchFailed: "Entity search failed.",
374
+ },
375
+ collector: {
376
+ snapshot: "Read now",
377
+ start: "Start collecting",
378
+ stop: "Stop",
379
+ retry: "Retry",
380
+ manualEntry: "Enter manually",
381
+ cancelManual: "Cancel",
382
+ saveManual: "Save observation",
383
+ valuePlaceholder: "Observed value",
384
+ reasonPlaceholder: "Reason for manual entry",
385
+ reasonRequired: "A reason is required for manual entry.",
386
+ invalidValue: "Enter a value that matches the Observation type.",
387
+ providerUnavailable: "This data source is not available in the current host.",
388
+ permissionDenied: "Collector access was not authorized.",
389
+ unsupported: "This Collector mode requires a host runtime that is not available here.",
390
+ sampleCount: count => `${count} sample${count === 1 ? "" : "s"}`,
391
+ lastObserved: value => `Observed ${value}`,
392
+ status: {
393
+ idle: "Ready",
394
+ waiting_for_permission: "Waiting for permission",
395
+ connecting: "Connecting",
396
+ collecting: "Collecting",
397
+ stopping: "Stopping",
398
+ completed: "Completed",
399
+ error: "Error",
400
+ unsupported: "Unavailable",
401
+ },
402
+ },
324
403
  boolean: {
325
404
  unset: "Not set",
326
405
  true: "True",
327
406
  false: "False",
328
407
  },
329
408
  search: {
330
- label: "Search record",
409
+ label: "Search current record",
331
410
  fieldLabel: "Search field",
332
411
  placeholder: "Search this record",
333
412
  allFields: "All fields",
@@ -338,6 +417,16 @@ const EN_US_MESSAGES: AimdRecorderMessages = {
338
417
  noMatches: "No matches",
339
418
  matchCount: (current, total) => `${current} / ${total}`,
340
419
  },
420
+ validation: {
421
+ required: label => `${label} is required.`,
422
+ pattern: label => `${label} has an invalid format.`,
423
+ enum: label => `${label} must use one of the allowed values.`,
424
+ numeric: (label, detail) => `${label}: ${detail}`,
425
+ type: (label, expected) => `${label} must be ${expected}.`,
426
+ format: (label, format) => `${label} must use ${format} format.`,
427
+ schema: (label, detail) => `${label}: ${detail}`,
428
+ tableCell: (row, column) => `Row ${row}, ${column}`,
429
+ },
341
430
  dna: {
342
431
  editMode: "Edit mode",
343
432
  interactiveMode: "Interactive",
@@ -508,13 +597,52 @@ const ZH_CN_MESSAGES: AimdRecorderMessages = {
508
597
  jsonInvalidArray: "JSON 值必须是数组。",
509
598
  jsonInvalidItem: "JSON 数组项与当前列表类型不匹配。",
510
599
  },
600
+ entityRef: {
601
+ searchPlaceholder: entity => `搜索${entity}`,
602
+ manualIdPlaceholder: "实体 ID",
603
+ add: "添加",
604
+ select: "选择",
605
+ clear: "清除",
606
+ remove: "移除",
607
+ noResolver: "未连接实体来源,可手动输入 ID。",
608
+ noMatches: "没有匹配的实体",
609
+ searchFailed: "实体搜索失败。",
610
+ },
611
+ collector: {
612
+ snapshot: "立即采集",
613
+ start: "开始采集",
614
+ stop: "停止",
615
+ retry: "重试",
616
+ manualEntry: "手工填写",
617
+ cancelManual: "取消",
618
+ saveManual: "保存观测值",
619
+ valuePlaceholder: "观测值",
620
+ reasonPlaceholder: "手工填写原因",
621
+ reasonRequired: "手工填写必须说明原因。",
622
+ invalidValue: "请输入符合 Observation 类型的值。",
623
+ providerUnavailable: "当前宿主未提供这个数据源。",
624
+ permissionDenied: "未获得 Collector 访问授权。",
625
+ unsupported: "该 Collector 模式需要当前宿主尚未提供的运行时。",
626
+ sampleCount: count => `${count} 个观测值`,
627
+ lastObserved: value => `观测于 ${value}`,
628
+ status: {
629
+ idle: "就绪",
630
+ waiting_for_permission: "等待授权",
631
+ connecting: "连接中",
632
+ collecting: "采集中",
633
+ stopping: "停止中",
634
+ completed: "已完成",
635
+ error: "错误",
636
+ unsupported: "不可用",
637
+ },
638
+ },
511
639
  boolean: {
512
640
  unset: "未填写",
513
641
  true: "是",
514
642
  false: "否",
515
643
  },
516
644
  search: {
517
- label: "搜索记录",
645
+ label: "搜索当前记录",
518
646
  fieldLabel: "搜索字段",
519
647
  placeholder: "搜索当前记录",
520
648
  allFields: "全部字段",
@@ -525,6 +653,16 @@ const ZH_CN_MESSAGES: AimdRecorderMessages = {
525
653
  noMatches: "无匹配",
526
654
  matchCount: (current, total) => `${current} / ${total}`,
527
655
  },
656
+ validation: {
657
+ required: label => `${label}为必填项。`,
658
+ pattern: label => `${label}格式不正确。`,
659
+ enum: label => `${label}必须使用允许的选项。`,
660
+ numeric: (label, detail) => `${label}:${detail}`,
661
+ type: (label, expected) => `${label}必须是${expected}类型。`,
662
+ format: (label, format) => `${label}必须使用 ${format} 格式。`,
663
+ schema: (label, detail) => `${label}:${detail}`,
664
+ tableCell: (row, column) => `第 ${row} 行,${column}`,
665
+ },
528
666
  dna: {
529
667
  editMode: "编辑模式",
530
668
  interactiveMode: "交互式",
@@ -9,6 +9,20 @@ export type {
9
9
  AimdStepOrCheckRecordItem,
10
10
  } from '../types'
11
11
  export { createEmptyProtocolRecordData } from '../types'
12
+ export type {
13
+ AimdRecorderValidationCode,
14
+ AimdRecorderValidationTrigger,
15
+ AimdRecordValidationSchema,
16
+ AimdRecorderValidationIssue,
17
+ AimdRecorderValidationResult,
18
+ } from '../types'
19
+ export {
20
+ getAimdVarTableCellFieldKey,
21
+ matchesAimdValidationFieldSelector,
22
+ validateAimdField,
23
+ validateAimdRecord,
24
+ type ValidateAimdRecordOptions,
25
+ } from './validation'
12
26
 
13
27
  export {
14
28
  applyIncomingRecord,