@tai42/studio-sdk 30.0.1 → 31.0.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 (215) hide show
  1. package/README.md +98 -10
  2. package/dist/components/agent-picker.d.ts +1 -1
  3. package/dist/components/agent-picker.d.ts.map +1 -1
  4. package/dist/components/agent-picker.js +1 -0
  5. package/dist/components/agent-picker.js.map +1 -1
  6. package/dist/components/channel-picker.d.ts +1 -1
  7. package/dist/components/channel-picker.d.ts.map +1 -1
  8. package/dist/components/channel-picker.js +1 -0
  9. package/dist/components/channel-picker.js.map +1 -1
  10. package/dist/components/components.css +53 -0
  11. package/dist/components/explorer-body.d.ts +1 -0
  12. package/dist/components/explorer-body.d.ts.map +1 -1
  13. package/dist/components/explorer-body.js +6 -4
  14. package/dist/components/explorer-body.js.map +1 -1
  15. package/dist/components/explorer-view.d.ts +16 -7
  16. package/dist/components/explorer-view.d.ts.map +1 -1
  17. package/dist/components/explorer-view.js +27 -13
  18. package/dist/components/explorer-view.js.map +1 -1
  19. package/dist/components/extension-config-editor.js.map +1 -1
  20. package/dist/components/field.d.ts +6 -0
  21. package/dist/components/field.d.ts.map +1 -1
  22. package/dist/components/field.js +15 -2
  23. package/dist/components/field.js.map +1 -1
  24. package/dist/components/folder-actions.d.ts +51 -0
  25. package/dist/components/folder-actions.d.ts.map +1 -0
  26. package/dist/components/folder-actions.js +173 -0
  27. package/dist/components/folder-actions.js.map +1 -0
  28. package/dist/components/folder-filing.d.ts +32 -0
  29. package/dist/components/folder-filing.d.ts.map +1 -0
  30. package/dist/components/folder-filing.js +51 -0
  31. package/dist/components/folder-filing.js.map +1 -0
  32. package/dist/components/folder-nav.d.ts +9 -4
  33. package/dist/components/folder-nav.d.ts.map +1 -1
  34. package/dist/components/folder-nav.js +18 -22
  35. package/dist/components/folder-nav.js.map +1 -1
  36. package/dist/components/folder-occupancy.d.ts +27 -0
  37. package/dist/components/folder-occupancy.d.ts.map +1 -0
  38. package/dist/components/folder-occupancy.js +54 -0
  39. package/dist/components/folder-occupancy.js.map +1 -0
  40. package/dist/components/named-list-picker.d.ts +5 -3
  41. package/dist/components/named-list-picker.d.ts.map +1 -1
  42. package/dist/components/named-list-picker.js +7 -7
  43. package/dist/components/named-list-picker.js.map +1 -1
  44. package/dist/components/primitives.d.ts +2 -1
  45. package/dist/components/primitives.d.ts.map +1 -1
  46. package/dist/components/primitives.js +2 -1
  47. package/dist/components/primitives.js.map +1 -1
  48. package/dist/components/searchable-select-model.d.ts +40 -0
  49. package/dist/components/searchable-select-model.d.ts.map +1 -0
  50. package/dist/components/searchable-select-model.js +69 -0
  51. package/dist/components/searchable-select-model.js.map +1 -0
  52. package/dist/components/searchable-select.d.ts +38 -0
  53. package/dist/components/searchable-select.d.ts.map +1 -0
  54. package/dist/components/searchable-select.js +200 -0
  55. package/dist/components/searchable-select.js.map +1 -0
  56. package/dist/components/subject-section.d.ts.map +1 -1
  57. package/dist/components/subject-section.js +2 -2
  58. package/dist/components/subject-section.js.map +1 -1
  59. package/dist/components/table.d.ts +7 -1
  60. package/dist/components/table.d.ts.map +1 -1
  61. package/dist/components/table.js +2 -2
  62. package/dist/components/table.js.map +1 -1
  63. package/dist/components/tool-meta-access.d.ts +28 -0
  64. package/dist/components/tool-meta-access.d.ts.map +1 -0
  65. package/dist/components/tool-meta-access.js +65 -0
  66. package/dist/components/tool-meta-access.js.map +1 -0
  67. package/dist/components/tool-name-entry.d.ts +26 -0
  68. package/dist/components/tool-name-entry.d.ts.map +1 -0
  69. package/dist/components/tool-name-entry.js +43 -0
  70. package/dist/components/tool-name-entry.js.map +1 -0
  71. package/dist/components/tool-picker.d.ts +23 -18
  72. package/dist/components/tool-picker.d.ts.map +1 -1
  73. package/dist/components/tool-picker.js +51 -33
  74. package/dist/components/tool-picker.js.map +1 -1
  75. package/dist/components/tool-select.d.ts +6 -5
  76. package/dist/components/tool-select.d.ts.map +1 -1
  77. package/dist/components/tool-select.js +31 -14
  78. package/dist/components/tool-select.js.map +1 -1
  79. package/dist/hooks/useApi.d.ts +1 -0
  80. package/dist/hooks/useApi.d.ts.map +1 -1
  81. package/dist/hooks/useSystemKinds.d.ts +27 -12
  82. package/dist/hooks/useSystemKinds.d.ts.map +1 -1
  83. package/dist/hooks/useSystemKinds.js +56 -16
  84. package/dist/hooks/useSystemKinds.js.map +1 -1
  85. package/dist/index.d.ts +51 -49
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +34 -26
  88. package/dist/index.js.map +1 -1
  89. package/dist/marketplace-install/use-mount-install.d.ts +6 -6
  90. package/dist/plugin/version.d.ts +1 -1
  91. package/dist/plugin/version.js +1 -1
  92. package/dist/schema-editor/SchemaEditor.d.ts +7 -2
  93. package/dist/schema-editor/SchemaEditor.d.ts.map +1 -1
  94. package/dist/schema-editor/SchemaEditor.js +1 -1
  95. package/dist/schema-editor/SchemaEditor.js.map +1 -1
  96. package/dist/schema-editor/index.d.ts +2 -2
  97. package/dist/schema-editor/index.d.ts.map +1 -1
  98. package/dist/schema-form/array-field.d.ts.map +1 -1
  99. package/dist/schema-form/array-field.js +6 -2
  100. package/dist/schema-form/array-field.js.map +1 -1
  101. package/dist/schema-form/classify.d.ts +4 -1
  102. package/dist/schema-form/classify.d.ts.map +1 -1
  103. package/dist/schema-form/classify.js +36 -15
  104. package/dist/schema-form/classify.js.map +1 -1
  105. package/dist/schema-form/collapsed-object-field.d.ts +20 -0
  106. package/dist/schema-form/collapsed-object-field.d.ts.map +1 -0
  107. package/dist/schema-form/collapsed-object-field.js +14 -0
  108. package/dist/schema-form/collapsed-object-field.js.map +1 -0
  109. package/dist/schema-form/context.d.ts +27 -1
  110. package/dist/schema-form/context.d.ts.map +1 -1
  111. package/dist/schema-form/context.js +14 -0
  112. package/dist/schema-form/context.js.map +1 -1
  113. package/dist/schema-form/default-value.d.ts +21 -6
  114. package/dist/schema-form/default-value.d.ts.map +1 -1
  115. package/dist/schema-form/default-value.js +74 -15
  116. package/dist/schema-form/default-value.js.map +1 -1
  117. package/dist/schema-form/expression-field.d.ts +48 -0
  118. package/dist/schema-form/expression-field.d.ts.map +1 -0
  119. package/dist/schema-form/expression-field.js +88 -0
  120. package/dist/schema-form/expression-field.js.map +1 -0
  121. package/dist/schema-form/field-model.d.ts +23 -4
  122. package/dist/schema-form/field-model.d.ts.map +1 -1
  123. package/dist/schema-form/field-node.d.ts.map +1 -1
  124. package/dist/schema-form/field-node.js +16 -3
  125. package/dist/schema-form/field-node.js.map +1 -1
  126. package/dist/schema-form/index.d.ts +3 -3
  127. package/dist/schema-form/index.d.ts.map +1 -1
  128. package/dist/schema-form/index.js +2 -2
  129. package/dist/schema-form/index.js.map +1 -1
  130. package/dist/schema-form/object-fields.d.ts +6 -3
  131. package/dist/schema-form/object-fields.d.ts.map +1 -1
  132. package/dist/schema-form/object-fields.js +14 -3
  133. package/dist/schema-form/object-fields.js.map +1 -1
  134. package/dist/schema-form/record-field.d.ts.map +1 -1
  135. package/dist/schema-form/record-field.js +6 -2
  136. package/dist/schema-form/record-field.js.map +1 -1
  137. package/dist/schema-form/seeding-action.d.ts +15 -0
  138. package/dist/schema-form/seeding-action.d.ts.map +1 -0
  139. package/dist/schema-form/seeding-action.js +35 -0
  140. package/dist/schema-form/seeding-action.js.map +1 -0
  141. package/dist/schema-form/string-annotations.d.ts +22 -8
  142. package/dist/schema-form/string-annotations.d.ts.map +1 -1
  143. package/dist/schema-form/string-annotations.js +39 -14
  144. package/dist/schema-form/string-annotations.js.map +1 -1
  145. package/dist/schema-form/string-field.js +2 -84
  146. package/dist/schema-form/string-field.js.map +1 -1
  147. package/dist/schema-form/templated-field.d.ts +13 -0
  148. package/dist/schema-form/templated-field.d.ts.map +1 -0
  149. package/dist/schema-form/templated-field.js +43 -0
  150. package/dist/schema-form/templated-field.js.map +1 -0
  151. package/dist/schema-form/union-field.d.ts.map +1 -1
  152. package/dist/schema-form/union-field.js +6 -2
  153. package/dist/schema-form/union-field.js.map +1 -1
  154. package/dist/schema-form/union.d.ts +4 -4
  155. package/dist/schema-form/union.d.ts.map +1 -1
  156. package/dist/schema-form/union.js +8 -1
  157. package/dist/schema-form/union.js.map +1 -1
  158. package/dist/schema-form/validate.d.ts.map +1 -1
  159. package/dist/schema-form/validate.js +28 -0
  160. package/dist/schema-form/validate.js.map +1 -1
  161. package/dist/search-match.d.ts +29 -0
  162. package/dist/search-match.d.ts.map +1 -0
  163. package/dist/search-match.js +38 -0
  164. package/dist/search-match.js.map +1 -0
  165. package/dist/tool-organization.d.ts +15 -0
  166. package/dist/tool-organization.d.ts.map +1 -0
  167. package/dist/tool-organization.js +6 -0
  168. package/dist/tool-organization.js.map +1 -0
  169. package/package.json +3 -2
  170. package/src/components/agent-picker.tsx +2 -1
  171. package/src/components/channel-picker.tsx +2 -1
  172. package/src/components/components.css +53 -0
  173. package/src/components/explorer-body.tsx +29 -5
  174. package/src/components/explorer-view.tsx +48 -17
  175. package/src/components/extension-config-editor.tsx +3 -3
  176. package/src/components/field.tsx +18 -2
  177. package/src/components/folder-actions.tsx +341 -0
  178. package/src/components/folder-filing.tsx +109 -0
  179. package/src/components/folder-nav.tsx +26 -10
  180. package/src/components/folder-occupancy.ts +83 -0
  181. package/src/components/named-list-picker.tsx +11 -7
  182. package/src/components/primitives.tsx +2 -1
  183. package/src/components/searchable-select-model.ts +105 -0
  184. package/src/components/searchable-select.tsx +432 -0
  185. package/src/components/subject-section.tsx +3 -2
  186. package/src/components/table.tsx +12 -2
  187. package/src/components/tool-meta-access.tsx +101 -0
  188. package/src/components/tool-name-entry.tsx +77 -0
  189. package/src/components/tool-picker.tsx +83 -50
  190. package/src/components/tool-select.tsx +49 -38
  191. package/src/hooks/useSystemKinds.tsx +77 -17
  192. package/src/index.ts +98 -94
  193. package/src/plugin/version.ts +1 -1
  194. package/src/schema-editor/SchemaEditor.tsx +9 -3
  195. package/src/schema-editor/index.ts +2 -2
  196. package/src/schema-form/array-field.tsx +10 -2
  197. package/src/schema-form/classify.ts +41 -15
  198. package/src/schema-form/collapsed-object-field.tsx +56 -0
  199. package/src/schema-form/context.ts +33 -1
  200. package/src/schema-form/default-value.ts +89 -15
  201. package/src/schema-form/expression-field.tsx +162 -0
  202. package/src/schema-form/field-model.ts +27 -4
  203. package/src/schema-form/field-node.tsx +41 -2
  204. package/src/schema-form/index.ts +3 -2
  205. package/src/schema-form/object-fields.tsx +11 -4
  206. package/src/schema-form/record-field.tsx +10 -2
  207. package/src/schema-form/seeding-action.ts +44 -0
  208. package/src/schema-form/string-annotations.ts +40 -14
  209. package/src/schema-form/string-field.tsx +2 -147
  210. package/src/schema-form/templated-field.tsx +124 -0
  211. package/src/schema-form/union-field.tsx +11 -2
  212. package/src/schema-form/union.ts +12 -5
  213. package/src/schema-form/validate.ts +28 -0
  214. package/src/search-match.ts +41 -0
  215. package/src/tool-organization.ts +34 -0
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Button } from '../components/primitives';
3
+ import { defaultValueForSchema } from './default-value';
4
+ import { FieldGroup } from './field-group';
5
+ import { useSeedingAction } from './seeding-action';
6
+ export function CollapsedObjectField({ heading, description, error, definition, shape, root, onChange, }) {
7
+ const add = useSeedingAction(shape);
8
+ return (_jsx(FieldGroup, { heading: heading, description: description, error: add.failure ?? error, atRoot: false, children: _jsx("div", { children: _jsx(Button, { type: "button", variant: "secondary", onClick: () => {
9
+ const level = add.seed(() => defaultValueForSchema(definition, root));
10
+ if (level.ok)
11
+ onChange(level.value);
12
+ }, children: "Add" }) }) }));
13
+ }
14
+ //# sourceMappingURL=collapsed-object-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collapsed-object-field.js","sourceRoot":"","sources":["../../src/schema-form/collapsed-object-field.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,MAAM,UAAU,oBAAoB,CAAC,EACnC,OAAO,EACP,WAAW,EACX,KAAK,EACL,UAAU,EACV,KAAK,EACL,IAAI,EACJ,QAAQ,GAWT;IACC,MAAM,GAAG,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACpC,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,GAAG,CAAC,OAAO,IAAI,KAAK,EAC3B,MAAM,EAAE,KAAK,YAEb,wBACE,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE;oBACZ,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;oBACtE,IAAI,KAAK,CAAC,EAAE;wBAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACtC,CAAC,oBAGM,GACL,GACK,CACd,CAAC;AACJ,CAAC"}
@@ -1,13 +1,22 @@
1
1
  /**
2
2
  * Ambient React contexts for the schema-form tree: the optional argument
3
3
  * completion provider, the default media-upload byte cap, the record-entry value
4
- * renderer, and the expression-field door. A field deep in the tree reads these
4
+ * renderer, the expression-field door, and the object shapes being drawn above a
5
+ * field. A field deep in the tree reads these
5
6
  * here rather than every intermediate node drilling the prop.
6
7
  */
7
8
  import type { ComponentType, ReactNode } from 'react';
9
+ import type { TemplatedTextCatalog } from '../state-binding/types';
8
10
  import type { CompletionProvider } from './SchemaForm';
9
11
  import type { JsonSchema } from './types';
10
12
  export declare const CompletionProviderContext: import("react").Context<CompletionProvider | undefined>;
13
+ /**
14
+ * The object shapes (an object model's `shape`) being drawn by the fields above
15
+ * this one. An object field whose shape is already here is a definition nested
16
+ * inside itself; it draws its fields only when its value holds that level, so a
17
+ * self-referencing schema draws to the depth of its data rather than forever.
18
+ */
19
+ export declare const ExpandedShapesContext: import("react").Context<ReadonlySet<object>>;
11
20
  export declare const MaxUploadBytesContext: import("react").Context<number>;
12
21
  /** One record entry, handed to a host-supplied value renderer. */
13
22
  export interface RecordEntryContext {
@@ -122,4 +131,21 @@ export type ExpressionFieldComponent = ComponentType<ExpressionFieldProps>;
122
131
  * single form.
123
132
  */
124
133
  export declare const ExpressionFieldContext: import("react").Context<ExpressionFieldComponent | undefined>;
134
+ /**
135
+ * The hook a host supplies so a form's templated-text fields can offer stored
136
+ * templates: it returns the catalog (the template ids plus the storage-presence and
137
+ * fetch state) the field's stored-template picker reads. The form holds no data edge,
138
+ * so the host owns the fetch; a field calls the hook only when it renders, so a form
139
+ * without a templated-text field never fetches the catalog.
140
+ *
141
+ * It is a HOOK, called on every render of a templated-text field, so the injected
142
+ * reference must be stable (a module-level function).
143
+ */
144
+ export type UseTemplatedTextCatalog = () => TemplatedTextCatalog | undefined;
145
+ /**
146
+ * The ambient stored-template source for the whole form. Absent (the default), a
147
+ * templated-text field gets no catalog, as every `TemplatedTextField` given none:
148
+ * the stored source offers no templates and inline content is authored as usual.
149
+ */
150
+ export declare const TemplatedTextCatalogContext: import("react").Context<UseTemplatedTextCatalog>;
125
151
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/schema-form/context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAItD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,eAAO,MAAM,yBAAyB,yDAA2D,CAAC;AAIlG,eAAO,MAAM,qBAAqB,iCAAkD,CAAC;AAErF,kEAAkE;AAClE,MAAM,WAAW,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  // tree reads it here rather than every intermediate node drilling the prop.
5
5
  export const CompletionProviderContext = createContext(undefined);
6
+ /**
7
+ * The object shapes (an object model's `shape`) being drawn by the fields above
8
+ * this one. An object field whose shape is already here is a definition nested
9
+ * inside itself; it draws its fields only when its value holds that level, so a
10
+ * self-referencing schema draws to the depth of its data rather than forever.
11
+ */
12
+ export const ExpandedShapesContext = createContext(new Set());
6
13
  // Ambient default upload cap for the whole form; a media field reads it here so
7
14
  // intermediate object/array nodes never drill the prop.
8
15
  export const MaxUploadBytesContext = createContext(DEFAULT_MAX_UPLOAD_BYTES);
@@ -22,4 +29,11 @@ export const RecordEntryRendererContext = createContext(undefined);
22
29
  * single form.
23
30
  */
24
31
  export const ExpressionFieldContext = createContext(undefined);
32
+ const useNoTemplatedTextCatalog = () => undefined;
33
+ /**
34
+ * The ambient stored-template source for the whole form. Absent (the default), a
35
+ * templated-text field gets no catalog, as every `TemplatedTextField` given none:
36
+ * the stored source offers no templates and inline content is authored as usual.
37
+ */
38
+ export const TemplatedTextCatalogContext = createContext(useNoTemplatedTextCatalog);
25
39
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/schema-form/context.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAInD,6EAA6E;AAC7E,4EAA4E;AAC5E,MAAM,CAAC,MAAM,yBAAyB,GAAG,aAAa,CAAiC,SAAS,CAAC,CAAC;AAElG,gFAAgF;AAChF,wDAAwD;AACxD,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAS,wBAAwB,CAAC,CAAC;AAyBrF,iFAAiF;AACjF,0EAA0E;AAC1E,MAAM,CAAC,MAAM,0BAA0B,GAAG,aAAa,CAAkC,SAAS,CAAC,CAAC;AAwFpG;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CACjD,SAAS,CACV,CAAC"}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/schema-form/context.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAInD,6EAA6E;AAC7E,4EAA4E;AAC5E,MAAM,CAAC,MAAM,yBAAyB,GAAG,aAAa,CAAiC,SAAS,CAAC,CAAC;AAElG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAsB,IAAI,GAAG,EAAE,CAAC,CAAC;AAEnF,gFAAgF;AAChF,wDAAwD;AACxD,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAS,wBAAwB,CAAC,CAAC;AAyBrF,iFAAiF;AACjF,0EAA0E;AAC1E,MAAM,CAAC,MAAM,0BAA0B,GAAG,aAAa,CAAkC,SAAS,CAAC,CAAC;AAwFpG;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CACjD,SAAS,CACV,CAAC;AAcF,MAAM,yBAAyB,GAA4B,GAAG,EAAE,CAAC,SAAS,CAAC;AAE3E;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GACtC,aAAa,CAA0B,yBAAyB,CAAC,CAAC"}
@@ -9,12 +9,27 @@ export declare function defaultValueForSchema(schema: JsonSchema, root?: JsonSch
9
9
  * A SELF-CONSISTENT skeleton for a schema — the seed a variant switch (or any
10
10
  * other programmatic reseed) commits as the field's new value. Where
11
11
  * {@link defaultValueForSchema} deliberately leaves a required scalar absent so
12
- * a fresh form flags it, a committed skeleton must validate against its own
13
- * schema, so here EVERY required field with a known empty value is minted:
14
- * required strings seed `''`, numbers `0`, booleans `false` — consistently with
15
- * the `[]` / `{}` / nested-object seeds the default path already mints. Kinds
16
- * with no empty value to name (enum, union, free-form JSON) stay absent either
17
- * way: inventing a choice would be a lie the user never made.
12
+ * a fresh form flags it, a committed skeleton carries no missing required field,
13
+ * so here EVERY required field with a known empty value is minted: required
14
+ * strings seed `''`, numbers `0`, booleans `false`, a templated text an empty
15
+ * inline source `{ content: '' }` — consistently with the `[]` / `{}` /
16
+ * nested-object seeds the default path already mints. A minted empty value is
17
+ * not promised to pass its own value check: an empty templated text fails it
18
+ * ("needs inline content or a stored template"), as does `''` under a
19
+ * `minLength` or a `pattern`, and validation reports that error like any
20
+ * other. Kinds with no empty value to name (enum,
21
+ * union, free-form JSON) stay absent either way: inventing a choice would be a
22
+ * lie the user never made.
18
23
  */
19
24
  export declare function skeletonValueForSchema(schema: JsonSchema, root?: JsonSchema): unknown;
25
+ /**
26
+ * Thrown by {@link defaultValueForSchema} and {@link skeletonValueForSchema} when the
27
+ * schema admits no finite value: a chain of required properties refers back to its
28
+ * own definition with no `null` accepted on the way. A caller that seeds on a user
29
+ * action catches exactly this type to show the failure on its field; any other error
30
+ * is not a seeding outcome and propagates.
31
+ */
32
+ export declare class NoFiniteValueError extends Error {
33
+ constructor();
34
+ }
20
35
  //# sourceMappingURL=default-value.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"default-value.d.ts","sourceRoot":"","sources":["../../src/schema-form/default-value.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAc1C;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,GAAE,UAAmB,GAAG,OAAO,CAE5F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,GAAE,UAAmB,GAAG,OAAO,CAE7F"}
1
+ {"version":3,"file":"default-value.d.ts","sourceRoot":"","sources":["../../src/schema-form/default-value.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAc1C;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,GAAE,UAAmB,GAAG,OAAO,CAE5F;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,GAAE,UAAmB,GAAG,OAAO,CAE7F;AASD;;;;;;GAMG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;;CAO5C"}
@@ -12,8 +12,9 @@
12
12
  * opted into.
13
13
  *
14
14
  * `skeletonValueForSchema` is the sibling entry for programmatic reseeds (a
15
- * union variant switch): same walk, but required scalars mint their type's
16
- * empty value so the committed seed validates against its own schema.
15
+ * union variant switch): same walk, but every required field with a known empty
16
+ * value is minted, so the committed seed has no missing required field. A minted
17
+ * empty value may still fail its own value check (see the sibling's docstring).
17
18
  */
18
19
  import { classifySchema } from './classify';
19
20
  /** The explicit `default` (wrapper takes precedence over the resolved node), if any. */
@@ -30,33 +31,85 @@ function explicitDefault(raw, resolved) {
30
31
  * whole-tool-schema call).
31
32
  */
32
33
  export function defaultValueForSchema(schema, root = schema) {
33
- return seedValue(schema, root, false);
34
+ return finiteSeed(seedValue(schema, root, false, new Set()));
34
35
  }
35
36
  /**
36
37
  * A SELF-CONSISTENT skeleton for a schema — the seed a variant switch (or any
37
38
  * other programmatic reseed) commits as the field's new value. Where
38
39
  * {@link defaultValueForSchema} deliberately leaves a required scalar absent so
39
- * a fresh form flags it, a committed skeleton must validate against its own
40
- * schema, so here EVERY required field with a known empty value is minted:
41
- * required strings seed `''`, numbers `0`, booleans `false` — consistently with
42
- * the `[]` / `{}` / nested-object seeds the default path already mints. Kinds
43
- * with no empty value to name (enum, union, free-form JSON) stay absent either
44
- * way: inventing a choice would be a lie the user never made.
40
+ * a fresh form flags it, a committed skeleton carries no missing required field,
41
+ * so here EVERY required field with a known empty value is minted: required
42
+ * strings seed `''`, numbers `0`, booleans `false`, a templated text an empty
43
+ * inline source `{ content: '' }` — consistently with the `[]` / `{}` /
44
+ * nested-object seeds the default path already mints. A minted empty value is
45
+ * not promised to pass its own value check: an empty templated text fails it
46
+ * ("needs inline content or a stored template"), as does `''` under a
47
+ * `minLength` or a `pattern`, and validation reports that error like any
48
+ * other. Kinds with no empty value to name (enum,
49
+ * union, free-form JSON) stay absent either way: inventing a choice would be a
50
+ * lie the user never made.
45
51
  */
46
52
  export function skeletonValueForSchema(schema, root = schema) {
47
- return seedValue(schema, root, true);
53
+ return finiteSeed(seedValue(schema, root, true, new Set()));
54
+ }
55
+ /**
56
+ * The walk's answer when an object's required structure leads back into an object
57
+ * shape it is already inside with no `null` accepted anywhere on the way: that
58
+ * nesting never ends, so the object has no finite value.
59
+ */
60
+ const NO_FINITE_VALUE = Symbol('no finite value');
61
+ /**
62
+ * Thrown by {@link defaultValueForSchema} and {@link skeletonValueForSchema} when the
63
+ * schema admits no finite value: a chain of required properties refers back to its
64
+ * own definition with no `null` accepted on the way. A caller that seeds on a user
65
+ * action catches exactly this type to show the failure on its field; any other error
66
+ * is not a seeding outcome and propagates.
67
+ */
68
+ export class NoFiniteValueError extends Error {
69
+ constructor() {
70
+ super('SchemaForm: the schema admits no finite value: its required properties refer back to their own definition with no null accepted on the way');
71
+ this.name = 'NoFiniteValueError';
72
+ }
73
+ }
74
+ /** The entry points' result: the seeded value, or {@link NoFiniteValueError} when none is finite. */
75
+ function finiteSeed(seed) {
76
+ if (seed === NO_FINITE_VALUE)
77
+ throw new NoFiniteValueError();
78
+ return seed;
48
79
  }
49
80
  /**
50
81
  * Seed an object's required nested structure and any optional property that
51
82
  * carries an explicit default. A required property recurses; an optional one is
52
83
  * materialized only when it declares a `default`, so its own required children
53
84
  * never raise errors on a field the user did not opt into.
85
+ *
86
+ * `expanding` holds the object shapes being seeded on the way down. Reaching one of
87
+ * them again (a self-referencing definition) answers {@link NO_FINITE_VALUE}, and
88
+ * so does an object with any required property that answers it. A `nullable` object
89
+ * turns that answer into `null`, the value that ends the nesting there. So the
90
+ * answer climbs to the nearest nullable object above the point where the cycle
91
+ * closes, and reaches the entry point only when no object on the way accepts
92
+ * `null`: then no finite value exists.
93
+ */
94
+ function seedObject(model, nullable, root, mintScalars, expanding) {
95
+ const seeded = seedProperties(model, root, mintScalars, expanding);
96
+ return seeded === NO_FINITE_VALUE && nullable ? null : seeded;
97
+ }
98
+ /**
99
+ * An object's own seed (see {@link seedObject}): its properties' seeds, or
100
+ * {@link NO_FINITE_VALUE} when its shape is already being seeded above or a required
101
+ * property has no finite value.
54
102
  */
55
- function seedObject(model, root, mintScalars) {
103
+ function seedProperties(model, root, mintScalars, expanding) {
104
+ if (expanding.has(model.shape))
105
+ return NO_FINITE_VALUE;
106
+ const inside = new Set(expanding).add(model.shape);
56
107
  const entries = [];
57
108
  for (const [name, propSchema] of model.properties) {
58
109
  if (model.required.has(name)) {
59
- const seeded = seedValue(propSchema, root, mintScalars);
110
+ const seeded = seedValue(propSchema, root, mintScalars, inside);
111
+ if (seeded === NO_FINITE_VALUE)
112
+ return NO_FINITE_VALUE;
60
113
  if (seeded !== undefined)
61
114
  entries.push([name, seeded]);
62
115
  continue;
@@ -89,9 +142,11 @@ function seedScalar(kind, mintScalars) {
89
142
  /**
90
143
  * The shared seeding walk. `mintScalars` distinguishes the two entry points
91
144
  * above: `false` leaves value-less required scalars absent; `true` mints their
92
- * type's empty value.
145
+ * type's empty value. `expanding` holds the object shapes being seeded on the way
146
+ * down; a nullable object whose own seed has no finite value seeds `null` (see
147
+ * {@link seedObject}).
93
148
  */
94
- function seedValue(schema, root, mintScalars) {
149
+ function seedValue(schema, root, mintScalars, expanding) {
95
150
  const classified = classifySchema(schema, root);
96
151
  const explicit = explicitDefault(schema, classified.schema);
97
152
  if (explicit.present)
@@ -101,7 +156,7 @@ function seedValue(schema, root, mintScalars) {
101
156
  case 'const':
102
157
  return model.value;
103
158
  case 'object':
104
- return seedObject(model, root, mintScalars);
159
+ return seedObject(model, classified.nullable, root, mintScalars, expanding);
105
160
  case 'array':
106
161
  case 'multiselect':
107
162
  return [];
@@ -111,6 +166,10 @@ function seedValue(schema, root, mintScalars) {
111
166
  case 'number':
112
167
  case 'boolean':
113
168
  return seedScalar(model.kind, mintScalars);
169
+ case 'templated-text':
170
+ // Inline is the templated text's own starting mode, so its empty value is an
171
+ // empty inline source; the default path leaves it absent like a scalar.
172
+ return mintScalars ? { content: '' } : undefined;
114
173
  case 'enum':
115
174
  case 'union':
116
175
  case 'json':
@@ -1 +1 @@
1
- {"version":3,"file":"default-value.js","sourceRoot":"","sources":["../../src/schema-form/default-value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAM5C,wFAAwF;AACxF,SAAS,eAAe,CACtB,GAAe,EACf,QAAoB;IAEpB,IAAI,SAAS,IAAI,GAAG;QAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;IACnE,IAAI,SAAS,IAAI,QAAQ;QAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC7E,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAkB,EAAE,OAAmB,MAAM;IACjF,OAAO,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAkB,EAAE,OAAmB,MAAM;IAClF,OAAO,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,SAAS,UAAU,CACjB,KAAwB,EACxB,IAAgB,EAChB,WAAoB;IAEpB,MAAM,OAAO,GAAwB,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,IAAI,E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AACH,SAAS,SAAS,CAChB,MAAkB,EAClB,IAAgB,EAChB,WAAoB,EACpB,SAA8B;IAE9B,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAC5D,IAAI,QAAQ,CAAC,OAAO;QAAE,OAAO,QAAQ,CAAC,KAAK,CAAC;IAE5C,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC;IAC7B,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,KAAK,CAAC;QACrB,KAAK,QAAQ;YACX,OAAO,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QAC9E,KAAK,OAAO,CAAC;QACb,KAAK,aAAa;YAChB,OAAO,EAAE,CAAC;QACZ,KAAK,QAAQ;YACX,OAAO,EAAE,CAAC;QACZ,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC7C,KAAK,gBAAgB;YACnB,6EAA6E;YAC7E,wEAAwE;YACxE,OAAO,WAAW,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QACnD,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO,CAAC;QACb,KAAK,MAAM;YACT,2EAA2E;YAC3E,0EAA0E;YAC1E,wEAAwE;YACxE,uEAAuE;YACvE,2DAA2D;YAC3D,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The injected expression door as a schema-form field: an `x-tai42-expression`
3
+ * annotation mapped onto the door's input-shape descriptor, and the door mounted
4
+ * inside a Suspense boundary that paints a resting shell while a lazily-injected
5
+ * door resolves. A jq-annotated string draws it as the whole field; a jq-annotated
6
+ * templated-text field draws it as its inline editor.
7
+ *
8
+ * NO JQ EDGE: the door arrives from the host (see `ExpressionFieldContext`);
9
+ * this module names no jq type.
10
+ */
11
+ import type { ReactNode } from 'react';
12
+ import type { ExpressionFieldComponent } from './context';
13
+ import type { ExpressionAnnotation } from './field-model';
14
+ /**
15
+ * An expression-annotated field, rendered through the injected door: a
16
+ * multiline resting control with the door's own visual-editor button. The door
17
+ * brings its own label/description/error chrome (a11y-linked slots), so it is NOT
18
+ * wrapped in the form's `Field` component — the annotation's descriptor fields map
19
+ * onto the input-shape descriptor, and the form's per-field error feeds `error`.
20
+ *
21
+ * The door is rendered as an ELEMENT, never called as a function, so its hooks and
22
+ * state (editor open, worker handle) belong to it and survive re-renders of this
23
+ * field.
24
+ *
25
+ * It mounts inside a `Suspense` boundary because a host is free to inject a `lazy`
26
+ * door to keep the jq subgraph in a split chunk of ITS OWN bundle. The fallback
27
+ * paints the resting shell — label/description/error chrome around the current
28
+ * value in a read-only multiline control — so the field holds its layout and keeps
29
+ * the value visible while that chunk resolves, and the swap does not flash. A door
30
+ * injected eagerly never suspends and renders straight through.
31
+ *
32
+ * The form passes only the props the field owns; a jq door's `serverValidate`,
33
+ * `onEditorOpenChange`, and `compact` stay unwired, because no author-time
34
+ * validation endpoint applies to a schema-declared field, the hosts that render
35
+ * `SchemaForm` register no global shortcuts to mute, and every sibling field shows
36
+ * a visible label (the compact variant is for dense host rows).
37
+ */
38
+ export declare function ExpressionField({ component: Door, heading, description, error, expression, argName, value, onChange, }: {
39
+ component: ExpressionFieldComponent;
40
+ heading: string;
41
+ description: string | undefined;
42
+ error: string | undefined;
43
+ expression: ExpressionAnnotation;
44
+ argName: string;
45
+ value: string;
46
+ onChange: (value: string) => void;
47
+ }): ReactNode;
48
+ //# sourceMappingURL=expression-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expression-field.d.ts","sourceRoot":"","sources":["../../src/schema-form/expression-field.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,KAAK,EAAE,wBAAwB,EAAwB,MAAM,WAAW,CAAC;AAChF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EAAE,IAAI,EACf,OAAO,EACP,WAAW,EACX,KAAK,EACL,UAAU,EACV,OAAO,EACP,KAAK,EACL,QAAQ,GACT,EAAE;IACD,SAAS,EAAE,wBAAwB,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,UAAU,EAAE,oBAAoB,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,GAAG,SAAS,CA0BZ"}
@@ -0,0 +1,88 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Suspense, useMemo } from 'react';
3
+ import { Field } from '../components/field';
4
+ import { Textarea } from '../components/inputs';
5
+ /**
6
+ * An expression-annotated field, rendered through the injected door: a
7
+ * multiline resting control with the door's own visual-editor button. The door
8
+ * brings its own label/description/error chrome (a11y-linked slots), so it is NOT
9
+ * wrapped in the form's `Field` component — the annotation's descriptor fields map
10
+ * onto the input-shape descriptor, and the form's per-field error feeds `error`.
11
+ *
12
+ * The door is rendered as an ELEMENT, never called as a function, so its hooks and
13
+ * state (editor open, worker handle) belong to it and survive re-renders of this
14
+ * field.
15
+ *
16
+ * It mounts inside a `Suspense` boundary because a host is free to inject a `lazy`
17
+ * door to keep the jq subgraph in a split chunk of ITS OWN bundle. The fallback
18
+ * paints the resting shell — label/description/error chrome around the current
19
+ * value in a read-only multiline control — so the field holds its layout and keeps
20
+ * the value visible while that chunk resolves, and the swap does not flash. A door
21
+ * injected eagerly never suspends and renders straight through.
22
+ *
23
+ * The form passes only the props the field owns; a jq door's `serverValidate`,
24
+ * `onEditorOpenChange`, and `compact` stay unwired, because no author-time
25
+ * validation endpoint applies to a schema-declared field, the hosts that render
26
+ * `SchemaForm` register no global shortcuts to mute, and every sibling field shows
27
+ * a visible label (the compact variant is for dense host rows).
28
+ */
29
+ export function ExpressionField({ component: Door, heading, description, error, expression, argName, value, onChange, }) {
30
+ // Memoised: the descriptor's identity feeds the door's own memoisation, so a
31
+ // fresh object each keystroke would defeat it.
32
+ const shape = useMemo(() => expressionShape(expression, argName), [expression, argName]);
33
+ return (_jsx(Suspense, { fallback: _jsx(ExpressionFieldSkeleton, { heading: heading, description: description, error: error, value: value }), children: _jsx(Door, { label: heading, description: description, error: error, shape: shape, multiline: true, value: value, onChange: onChange }) }));
34
+ }
35
+ /**
36
+ * The resting shell shown while a lazily-injected door resolves. It mirrors the
37
+ * live door's footprint — the same label/description/error chrome wrapping a
38
+ * multiline control seeded with the current value — but the control is
39
+ * non-interactive (read-only, `aria-busy`) because there is nothing to edit yet. Matching the
40
+ * footprint is what keeps the Suspense swap from shifting layout or flashing.
41
+ */
42
+ function ExpressionFieldSkeleton({ heading, description, error, value, }) {
43
+ return (_jsx(Field, { label: heading, description: description, error: error, children: _jsx(Textarea, { value: value, readOnly: true, "aria-busy": "true" }) }));
44
+ }
45
+ /**
46
+ * Map a classified expression annotation onto the door's input-shape descriptor.
47
+ * A bare annotation (`language` only) maps to NO descriptor — an undeclared shape
48
+ * is the honest rendering when the server said nothing about `.`. When any
49
+ * descriptor field is present, the required descriptor members the annotation
50
+ * omits fall back to neutral values rather than invented copy.
51
+ */
52
+ function expressionShape(expression, argName) {
53
+ const declared = [
54
+ expression.label,
55
+ expression.blurb,
56
+ expression.keys,
57
+ expression.variables,
58
+ expression.returns,
59
+ expression.caveats,
60
+ ].some((field) => field !== undefined) || expression.hasSample;
61
+ if (!declared)
62
+ return undefined;
63
+ return {
64
+ // Opaque, host-namespaced, stable per field (memoisation/telemetry only).
65
+ id: argName === '' ? 'tai42.schema-form' : `tai42.schema-form.${argName}`,
66
+ label: expression.label ?? 'input',
67
+ blurb: expression.blurb ?? '',
68
+ keys: expression.keys ?? [],
69
+ returns: expression.returns ?? '',
70
+ ...(expression.caveats === undefined ? {} : { caveats: expression.caveats }),
71
+ ...(expression.hasSample ? { sample: expression.sample } : {}),
72
+ ...(expression.variables === undefined
73
+ ? {}
74
+ : { variables: expression.variables.map(expressionVariable) }),
75
+ };
76
+ }
77
+ /** Map one classified annotation variable onto the door's variable descriptor. */
78
+ function expressionVariable(variable) {
79
+ return {
80
+ name: variable.name,
81
+ blurb: variable.blurb,
82
+ // The annotation glosses no sub-keys of a variable's value, so the door gets
83
+ // the variable's shape as untyped (empty keys).
84
+ keys: [],
85
+ ...(variable.hasSample ? { sample: variable.sample } : {}),
86
+ };
87
+ }
88
+ //# sourceMappingURL=expression-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expression-field.js","sourceRoot":"","sources":["../../src/schema-form/expression-field.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAIhD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,SAAS,EAAE,IAAI,EACf,OAAO,EACP,WAAW,EACX,KAAK,EACL,UAAU,EACV,OAAO,EACP,KAAK,EACL,QAAQ,GAUT;IACC,6EAA6E;IAC7E,+CAA+C;IAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,GA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CAAC,mBAAmB,CAAC,CAAC,CAAC,qBAAqB,OAAO,EAAE;QACzE,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,OAAO;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,EAAE;QAC7B,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,EAAE;QAC3B,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,EAAE;QACjC,GAAG,CAAC,UAAU,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC;QAC5E,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,GAAG,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS;YACpC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,CAAC;KACjE,CAAC;AACJ,CAAC;AAED,kFAAkF;AAClF,SAAS,kBAAkB,CACzB,QAAgE;IAEhE,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,6EAA6E;QAC7E,gDAAgD;QAChD,IAAI,EAAE,EAAE;QACR,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3D,CAAC;AACJ,CAAC"}
@@ -65,10 +65,11 @@ export interface ExpressionAnnotationVariable {
65
65
  readonly sample: unknown;
66
66
  }
67
67
  /**
68
- * The `x-tai42-expression` annotation on a string schema: the server declares
69
- * that the field's value is authored in a pipeline expression language (only jq
70
- * today) and optionally describes what `.` is for that expression. The renderer
71
- * uses it to open the visual-editor door instead of a plain text box. The shape
68
+ * The `x-tai42-expression` annotation on a string or templated-text property: the
69
+ * server declares that the field's value is authored in a pipeline expression
70
+ * language (only jq today) and optionally describes what `.` is for that expression.
71
+ * The renderer uses it to open the visual-editor door instead of a plain text box
72
+ * (on a templated-text field, as its inline editor). The shape
72
73
  * mirrors jq-studio's input-shape descriptor WITHOUT importing it — classification
73
74
  * stays a pure schema concern; the renderer maps this onto a jq field declaration.
74
75
  */
@@ -157,13 +158,31 @@ export type FieldModel = {
157
158
  readonly kind: 'object';
158
159
  readonly properties: readonly (readonly [string, JsonSchema])[];
159
160
  readonly required: ReadonlySet<string>;
161
+ /**
162
+ * The schema's own `properties` map, by identity. Every classification of one
163
+ * definition — through a `$ref`, a null-union or single-`allOf` wrapper, or an
164
+ * annotated property site — carries this same map, so a walker recognises a
165
+ * definition nested inside itself (a self-referencing schema) by it.
166
+ */
167
+ readonly shape: Readonly<Record<string, JsonSchema>>;
160
168
  } | {
161
169
  readonly kind: 'record';
162
170
  readonly values: JsonSchema;
171
+ } | {
172
+ readonly kind: 'templated-text';
173
+ /** Present when the property's `x-tai42-expression` annotation declares its
174
+ * inline content an expression: the inline editor is the expression door. */
175
+ readonly expression: ExpressionAnnotation | undefined;
163
176
  } | {
164
177
  readonly kind: 'union';
165
178
  readonly variants: readonly UnionVariant[];
166
179
  readonly discriminator: string | undefined;
180
+ /**
181
+ * The schema's own `anyOf`/`oneOf` member list, by identity: every
182
+ * classification of one union carries this same list, so a field can tell
183
+ * whether it still draws the union it drew before.
184
+ */
185
+ readonly members: readonly JsonSchema[];
167
186
  } | {
168
187
  readonly kind: 'json';
169
188
  readonly jsonType: 'object' | 'array' | 'any';
@@ -1 +1 @@
1
- {"version":3,"file":"field-model.d.ts","sourceRoot":"","sources":["../../src/schema-form/field-model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAA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AC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IAC7D,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC;CACjC;AAMD;;;;;;GAMG;AACH,iBAAS,aAAa,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,CA0BvD;AA8ND,eAAO,MAAM,SAAS,2DAAsB,CAAC"}
@@ -5,13 +5,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  * inline; every other kind delegates to a dedicated field component). Object,
6
6
  * array, and union renderers recurse back through here for their children.
7
7
  */
8
- import { memo } from 'react';
8
+ import { memo, useContext } from 'react';
9
9
  import { Checkbox } from '../components/checkbox';
10
10
  import { Field } from '../components/field';
11
11
  import { NumberInput, TextInput } from '../components/inputs';
12
- import { ownValue } from '../guards';
12
+ import { isRecord, ownValue } from '../guards';
13
13
  import { ArrayField } from './array-field';
14
14
  import { classifySchema } from './classify';
15
+ import { CollapsedObjectField } from './collapsed-object-field';
16
+ import { ExpandedShapesContext } from './context';
15
17
  import { EnumField } from './enum-field';
16
18
  import { FieldGroup } from './field-group';
17
19
  import { JsonField } from './json-field';
@@ -20,6 +22,7 @@ import { ObjectFields } from './object-fields';
20
22
  import { RecordField } from './record-field';
21
23
  import { scalarLabel } from './resolve';
22
24
  import { StringField } from './string-field';
25
+ import { TemplatedField } from './templated-field';
23
26
  import { UnionField } from './union-field';
24
27
  function labelText(explicit, label) {
25
28
  return explicit ?? label ?? 'Value';
@@ -33,12 +36,15 @@ function labelText(explicit, label) {
33
36
  */
34
37
  function FieldNodeImpl(props) {
35
38
  const { root, value, onChange, path, required, idPrefix, errors } = props;
39
+ const expanded = useContext(ExpandedShapesContext);
36
40
  const classified = classifySchema(props.schema, root);
37
41
  const base = labelText(classified.title, props.label);
38
42
  const heading = props.markRequired === true && required ? `${base} *` : base;
39
43
  const { model, description } = classified;
40
44
  return renderField({
41
45
  model,
46
+ definition: classified.schema,
47
+ expanded,
42
48
  nullable: classified.nullable,
43
49
  heading,
44
50
  description,
@@ -71,6 +77,8 @@ function renderField(args) {
71
77
  return (_jsx(NumberField, { heading: heading, description: description, error: error, integer: model.integer, value: value, onChange: onChange }));
72
78
  case 'boolean':
73
79
  return (_jsx(BooleanField, { heading: heading, description: description, error: error, value: value, onChange: onChange }));
80
+ case 'templated-text':
81
+ return (_jsx(TemplatedField, { heading: heading, description: description, error: error, expression: model.expression, argName: path, required: required, value: value, onChange: onChange }));
74
82
  case 'multiselect':
75
83
  return (_jsx(MultiSelectField, { heading: heading, description: description, error: error, model: model, value: value, onChange: onChange }));
76
84
  default:
@@ -85,7 +93,12 @@ function renderCompositeField(args, model) {
85
93
  case 'array':
86
94
  return (_jsx(ArrayField, { heading: heading, description: description, error: error, items: model.items, root: root, value: value, onChange: onChange, path: path, errors: errors, idPrefix: idPrefix, words: args.listWords }));
87
95
  case 'object':
88
- return (_jsx(FieldGroup, { heading: heading, description: description, error: error, atRoot: path === '', children: _jsx(ObjectFields, { properties: model.properties, requiredKeys: model.required, root: root, value: value, onChange: onChange, path: path, errors: errors, idPrefix: idPrefix, skip: undefined, fieldWording: fieldWording }) }));
96
+ // A definition nested inside itself draws its fields only for a level the
97
+ // value holds; an absent level is one Add button, so the nesting stops at the data.
98
+ if (args.expanded.has(model.shape) && !isRecord(value)) {
99
+ return (_jsx(CollapsedObjectField, { heading: heading, description: description, error: error, definition: args.definition, shape: model.shape, root: root, onChange: onChange }));
100
+ }
101
+ return (_jsx(FieldGroup, { heading: heading, description: description, error: error, atRoot: path === '', children: _jsx(ObjectFields, { properties: model.properties, shape: model.shape, requiredKeys: model.required, root: root, value: value, onChange: onChange, path: path, errors: errors, idPrefix: idPrefix, skip: undefined, fieldWording: fieldWording }) }));
89
102
  case 'record':
90
103
  return (_jsx(RecordField, { heading: heading, description: description, error: error, values: model.values, root: root, value: value, onChange: onChange, path: path, errors: errors, idPrefix: idPrefix }));
91
104
  case 'union':