@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
@@ -452,6 +452,11 @@
452
452
  vertical-align: top;
453
453
  box-sizing: border-box;
454
454
  }
455
+ .aimd-protocol-recorder__content .aimd-rec-inline--var-stacked--entity-ref {
456
+ display: inline-flex;
457
+ width: min(100%, 520px);
458
+ max-width: 100%;
459
+ }
455
460
  .aimd-protocol-recorder__content .aimd-rec-inline--var-stacked:focus-within {
456
461
  border-color: var(--aimd-border-color-focus, #4181fd);
457
462
  box-shadow: 0 0 0 2px rgba(65, 129, 253, 0.14);
@@ -1037,6 +1042,164 @@
1037
1042
  white-space: nowrap;
1038
1043
  }
1039
1044
 
1045
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref {
1046
+ display: flex;
1047
+ flex-direction: column;
1048
+ gap: 6px;
1049
+ width: 100%;
1050
+ min-width: 0;
1051
+ padding: 8px;
1052
+ border-top: 1px solid var(--aimd-border-color, #90caf9);
1053
+ background: #fff;
1054
+ box-sizing: border-box;
1055
+ }
1056
+
1057
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__selected,
1058
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__options {
1059
+ display: flex;
1060
+ flex-wrap: wrap;
1061
+ gap: 6px;
1062
+ min-width: 0;
1063
+ }
1064
+
1065
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__chip {
1066
+ display: inline-flex;
1067
+ align-items: center;
1068
+ max-width: 100%;
1069
+ min-height: 28px;
1070
+ overflow: hidden;
1071
+ border: 1px solid #b7d7ff;
1072
+ border-radius: 7px;
1073
+ background: #eef6ff;
1074
+ color: #1f3656;
1075
+ font-size: 13px;
1076
+ font-weight: 600;
1077
+ }
1078
+
1079
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__entity {
1080
+ align-self: stretch;
1081
+ display: inline-flex;
1082
+ align-items: center;
1083
+ padding: 0 7px;
1084
+ border-right: 1px solid #c8dcf1;
1085
+ background: #d8ebff;
1086
+ color: #075ebf;
1087
+ font-size: 12px;
1088
+ }
1089
+
1090
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__label {
1091
+ min-width: 0;
1092
+ max-width: min(34ch, 52vw);
1093
+ overflow: hidden;
1094
+ padding: 0 8px;
1095
+ text-overflow: ellipsis;
1096
+ white-space: nowrap;
1097
+ }
1098
+
1099
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__id {
1100
+ overflow: hidden;
1101
+ max-width: 22ch;
1102
+ padding: 0 8px 0 0;
1103
+ color: #667085;
1104
+ font-size: 12px;
1105
+ font-weight: 500;
1106
+ text-overflow: ellipsis;
1107
+ white-space: nowrap;
1108
+ }
1109
+
1110
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__chip-remove {
1111
+ align-self: stretch;
1112
+ width: 28px;
1113
+ border: 0;
1114
+ border-left: 1px solid #c8dcf1;
1115
+ background: #f8fbff;
1116
+ color: #56657a;
1117
+ font-size: 18px;
1118
+ line-height: 1;
1119
+ cursor: pointer;
1120
+ }
1121
+
1122
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__search-row {
1123
+ display: flex;
1124
+ align-items: center;
1125
+ gap: 6px;
1126
+ min-width: 0;
1127
+ }
1128
+
1129
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__input {
1130
+ flex: 1 1 180px;
1131
+ min-width: 120px;
1132
+ }
1133
+
1134
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__action,
1135
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__option {
1136
+ min-height: 30px;
1137
+ border: 1px solid #bfd0e5;
1138
+ border-radius: 7px;
1139
+ background: #f8fbff;
1140
+ color: #075ebf;
1141
+ font-size: 13px;
1142
+ font-weight: 700;
1143
+ cursor: pointer;
1144
+ }
1145
+
1146
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__action {
1147
+ flex: 0 0 auto;
1148
+ padding: 0 10px;
1149
+ }
1150
+
1151
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__action--secondary {
1152
+ color: #4b5f7a;
1153
+ }
1154
+
1155
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__hint,
1156
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__error {
1157
+ color: #667085;
1158
+ font-size: 12px;
1159
+ }
1160
+
1161
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__error {
1162
+ color: var(--rec-error);
1163
+ }
1164
+
1165
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__option {
1166
+ display: inline-flex;
1167
+ flex-direction: column;
1168
+ align-items: flex-start;
1169
+ max-width: min(100%, 260px);
1170
+ padding: 6px 9px;
1171
+ text-align: left;
1172
+ }
1173
+
1174
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__option:hover:not(:disabled),
1175
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__action:hover:not(:disabled),
1176
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__chip-remove:hover:not(:disabled) {
1177
+ border-color: #76b9ff;
1178
+ background: #edf6ff;
1179
+ }
1180
+
1181
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__option:disabled,
1182
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__action:disabled {
1183
+ cursor: not-allowed;
1184
+ opacity: 0.6;
1185
+ }
1186
+
1187
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__option-label,
1188
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__option-id,
1189
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__option-description {
1190
+ max-width: 100%;
1191
+ overflow: hidden;
1192
+ text-overflow: ellipsis;
1193
+ white-space: nowrap;
1194
+ }
1195
+
1196
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__option-id,
1197
+ .aimd-protocol-recorder__content .aimd-rec-entity-ref__option-description {
1198
+ color: #667085;
1199
+ font-size: 12px;
1200
+ font-weight: 500;
1201
+ }
1202
+
1040
1203
  .aimd-protocol-recorder__content .aimd-rec-inline__file-control {
1041
1204
  display: flex;
1042
1205
  flex-direction: column;
@@ -6,6 +6,7 @@
6
6
  */
7
7
  @import "@airalogy/aimd-renderer/styles";
8
8
  @import "./recorder-surface.css";
9
+ @import "./collector-field.css";
9
10
 
10
11
  /* Recorder-specific reference wrappers */
11
12
  .aimd-ref--step .research-step__sequence {
package/src/types.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type { VNode } from "vue"
2
2
  import type {
3
+ AimdCollectorField,
4
+ AimdConnectorField,
3
5
  AimdCheckNode,
4
6
  AimdQuizNode,
5
7
  AimdStepNode,
@@ -112,7 +114,128 @@ export type AimdFileInfoResolver = (
112
114
  context: AimdFileResolveContext,
113
115
  ) => AimdResolvedFileInfo | string | null | undefined | Promise<AimdResolvedFileInfo | string | null | undefined>
114
116
 
115
- export type AimdVarInputKind = "text" | "number" | "checkbox" | "boolean-select" | "textarea" | "scalar-list" | "date" | "datetime" | "time" | "dna" | "code" | "file"
117
+ export interface AimdEntityRefValue {
118
+ entity: string
119
+ id: string
120
+ source?: string
121
+ label?: string
122
+ version?: string | number
123
+ snapshot?: Record<string, unknown>
124
+ [key: string]: unknown
125
+ }
126
+
127
+ export interface AimdEntityRefOption extends AimdEntityRefValue {
128
+ description?: string
129
+ disabled?: boolean
130
+ }
131
+
132
+ export interface AimdEntityResolveContext {
133
+ type: string
134
+ normalizedType: string
135
+ fieldKey: string
136
+ node: AimdVarNode
137
+ fieldMeta?: AimdFieldMeta
138
+ entity?: string
139
+ source?: string
140
+ query: string
141
+ multiple: boolean
142
+ record: AimdProtocolRecordData
143
+ }
144
+
145
+ export type AimdEntitySearchHandler = (
146
+ query: string,
147
+ context: AimdEntityResolveContext,
148
+ ) => AimdEntityRefOption[] | Promise<AimdEntityRefOption[]>
149
+
150
+ export interface AimdEntityResolver {
151
+ search: AimdEntitySearchHandler
152
+ resolve?: (
153
+ id: string,
154
+ context: AimdEntityResolveContext,
155
+ ) => AimdEntityRefOption | null | undefined | Promise<AimdEntityRefOption | null | undefined>
156
+ }
157
+
158
+ export type AimdEntityResolverEntry = AimdEntityResolver | AimdEntitySearchHandler
159
+ export type AimdEntityResolverMap = Record<string, AimdEntityResolverEntry>
160
+
161
+ export type AimdCollectorRuntimeStatus =
162
+ | "idle"
163
+ | "waiting_for_permission"
164
+ | "connecting"
165
+ | "collecting"
166
+ | "stopping"
167
+ | "completed"
168
+ | "error"
169
+ | "unsupported"
170
+
171
+ export interface AimdCollectorRuntimeState {
172
+ status: AimdCollectorRuntimeStatus
173
+ error?: string
174
+ lastObservedAt?: string
175
+ sampleCount: number
176
+ }
177
+
178
+ export interface AimdCollectorObservationSource {
179
+ kind: "collector" | "manual"
180
+ collector: string
181
+ connector?: string
182
+ device_id?: string
183
+ reason?: string
184
+ actor_id?: string
185
+ }
186
+
187
+ export interface AimdCollectorObservation<T = unknown> {
188
+ value: T
189
+ observed_at: string
190
+ received_at: string
191
+ source: AimdCollectorObservationSource
192
+ unit?: string
193
+ quality?: string
194
+ sequence?: number
195
+ metadata?: Record<string, unknown>
196
+ }
197
+
198
+ /** Optional structured envelope returned by a Collector provider. */
199
+ export interface AimdCollectorObservationInput<T = unknown> {
200
+ value: T
201
+ observed_at?: string
202
+ unit?: string
203
+ quality?: string
204
+ sequence?: number
205
+ metadata?: Record<string, unknown>
206
+ device_id?: string
207
+ }
208
+
209
+ export interface AimdCollectorProviderRequest {
210
+ connector: AimdConnectorField
211
+ collector: AimdCollectorField
212
+ fieldKey: string
213
+ record: AimdProtocolRecordData
214
+ signal: AbortSignal
215
+ }
216
+
217
+ export interface AimdDataSourceProvider {
218
+ /** Read one sample. A raw scalar or an observation envelope may be returned. */
219
+ read: (request: AimdCollectorProviderRequest) => unknown | Promise<unknown>
220
+ }
221
+
222
+ /** Providers are keyed by connector id from the Protocol's `connectors` block. */
223
+ export type AimdCollectorProviderMap = Record<string, AimdDataSourceProvider>
224
+
225
+ export interface AimdCollectorPermissionRequest {
226
+ connector: AimdConnectorField
227
+ collector: AimdCollectorField
228
+ fieldKey: string
229
+ record: AimdProtocolRecordData
230
+ }
231
+
232
+ /** `record` remembers approval for the current Recorder record; `once` applies to one start. */
233
+ export type AimdCollectorPermissionDecision = "once" | "record" | boolean
234
+ export type AimdCollectorPermissionHandler = (
235
+ request: AimdCollectorPermissionRequest,
236
+ ) => AimdCollectorPermissionDecision | Promise<AimdCollectorPermissionDecision>
237
+
238
+ export type AimdVarInputKind = "text" | "number" | "checkbox" | "boolean-select" | "textarea" | "scalar-list" | "entity-ref" | "date" | "datetime" | "time" | "dna" | "code" | "file"
116
239
  export type AimdStepDetailDisplay = "auto" | "always"
117
240
  export type AimdChoiceOptionExplanationMode = "hidden" | "selected" | "submitted" | "graded"
118
241
  export type AimdScaleGradeDisplayMode = "hidden" | "completed" | "submitted" | "graded"
@@ -146,6 +269,8 @@ export interface AimdFieldMeta {
146
269
  disabled?: boolean
147
270
  placeholder?: string
148
271
  accept?: string // native file input accept string for file-like vars
272
+ entity?: string // entity namespace for EntityRef fields
273
+ source?: string // connector id/source for EntityRef fields
149
274
  assigner?: { mode: AimdAssignerMode }
150
275
  }
151
276
 
@@ -280,6 +405,7 @@ export interface AimdTypePluginRenderContext extends AimdTypePluginValueContext
280
405
  uploadFile?: AimdFileUploadHandler
281
406
  resolveFile?: (src: string) => string | null
282
407
  resolveFileInfo?: AimdFileInfoResolver
408
+ entityResolvers?: AimdEntityResolverMap
283
409
  emitChange: (value: unknown) => void
284
410
  emitBlur: () => void
285
411
  }