json-object-editor 0.10.642 → 0.10.650

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.
@@ -0,0 +1,280 @@
1
+ var thought = {
2
+ display:'Thought',
3
+ title: 'Thought | ${thought_type}: ${statement}',
4
+ info: "Persistent reasoning artifact (hypothesis, synthesis, or link) used to build an auditable world model in JOE.",
5
+ menuicon:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
6
+ <path d="M418.79 152.21c54.1-4.68 106.11 14.11 145.57 50.7 179.88-61.28 357.82 94.91 322.09 281.77-17.7 92.57-93.99 170.46-185.58 191.53-7.83 1.8-34.03 4.23-38 6.47-2.3 1.29-14.64 18.32-18.65 22.27-82.76 81.43-218.9 67.72-286.83-24.62l-35.16 3.37c-205.89-4.36-263.08-280.1-74.73-364.78 10.05-87.72 83.39-159.08 171.29-166.69Zm-39.41 491.05c4.96 4.51 11.22 16.94 16.69 23.33 46.94 54.84 121.44 70.23 186.17 36.84 26.3-13.56 42.96-35.52 62.34-56.84 75.92-4.51 145.19-42.32 182.22-109.5 88.11-159.86-57.37-346.63-233.69-303.07-9.81 2.43-27.09 11.14-35.93 10.11-8.59-1-28.84-22.68-38.58-29.14-86.51-57.47-207.06-11.17-229.88 89.98-3.02 13.37-1.37 36.64-13.02 43.9-16.07 10.02-32.75 13.56-49.51 26.98-116.69 93.45-38.49 282 110.22 268.53 13.11-1.19 31.88-11.21 42.98-1.12Z"/>
7
+ <path d="M272.86 721.35c102.07-14 117.43 140.12 22.44 150.52-105.24 11.51-116.96-137.56-22.44-150.52Zm7.15 37.31c-50.22 5.28-41.54 82.79 10.03 75.91 46.11-6.15 39.26-81.09-10.03-75.91Zm164.98-272.61v24.28c0 8.44.36 13.35 1.07 14.73a6.8 6.8 0 0 0 4.63 3.66c3.46.8 7 1.14 10.55 1h6.52c7.08 0 10.62 2.27 10.62 6.82 0 5.26-3.74 8.48-11.22 9.65a209.9 209.9 0 0 1-27.69 1.27c-11.25 0-19.21-2.18-23.89-6.54-4.68-4.36-7.02-11.83-7.04-22.39V488c.32-4.26-.43-8.54-2.19-12.44a14.22 14.22 0 0 0-8.83-5.5 8.79 8.79 0 0 1-6.62-9.26 8.7 8.7 0 0 1 6.62-9.26 14.7 14.7 0 0 0 8.83-5.67 25.36 25.36 0 0 0 2.19-12.44v-30.45c0-10.4 2.34-17.78 7.02-22.14 4.68-4.36 12.64-6.54 23.89-6.52 9.84-.27 19.68.25 29.43 1.57 2.61.4 5.03 1.57 6.97 3.36a8.05 8.05 0 0 1 2.49 5.9c0 4.54-3.54 6.82-10.62 6.82H461c-6.04 0-10.18.65-12.44 1.94a7.7 7.7 0 0 0-3.41 6.72v34.91c-.13 11.76-3.28 19.59-9.45 23.49-.49.33-.77.88-.77 1.47 0 .91 1.1 2.28 3.31 4.11a18.05 18.05 0 0 1 5.18 8.34c1.2 4.27 1.74 8.7 1.59 13.14Zm68.84-76.43a22.82 22.82 0 0 1 22.72 22.72 22.38 22.38 0 0 1-6.92 16.87 23.34 23.34 0 0 1-32.17 0 22.42 22.42 0 0 1-6.92-16.87 21.04 21.04 0 0 1 5.85-15.1 22.79 22.79 0 0 1 17.44-7.61Zm0 56.35a22.82 22.82 0 0 1 22.72 22.72 22.38 22.38 0 0 1-6.94 16.89 23.34 23.34 0 0 1-32.17 0 22.42 22.42 0 0 1-6.92-16.87 21.08 21.08 0 0 1 5.85-15.1 22.78 22.78 0 0 1 17.47-7.64Zm68.15-30.53v-24.18c0-8.44-.36-13.35-1.07-14.73a6.8 6.8 0 0 0-4.63-3.66c-3.46-.8-7-1.14-10.55-1h-6.47c-7.08 0-10.62-2.27-10.62-6.82 0-5.26 3.74-8.44 11.22-9.55a211.64 211.64 0 0 1 27.69-1.27c11.25 0 19.21 2.18 23.89 6.54 4.68 4.36 7.02 11.74 7.02 22.14v30.6c-.33 4.27.42 8.55 2.19 12.44a14.68 14.68 0 0 0 8.83 5.55 8.68 8.68 0 0 1 6.59 9.28 8.7 8.7 0 0 1-4.58 8.38c-1.54.7-3.14 1.26-4.78 1.67a11.2 11.2 0 0 0-7.02 6.54 31.79 31.79 0 0 0-1.27 10.62v30.5c0 10.47-2.34 17.87-7.02 22.22-4.68 4.35-12.64 6.53-23.89 6.54-9.84.28-19.68-.25-29.43-1.57a13.22 13.22 0 0 1-6.97-3.36 8.2 8.2 0 0 1-2.49-6c0-4.54 3.54-6.82 10.62-6.82.85 0 3.09.07 6.72.2 4.24.21 8.47-.45 12.44-1.94a5.76 5.76 0 0 0 2.99-3.96c.5-4.48.68-9 .55-13.51v-24.28c-.19-4.85.52-9.69 2.09-14.28a21.27 21.27 0 0 1 7.46-9.11c.49-.33.77-.88.77-1.47 0-.91-1.1-2.28-3.31-4.11a17.91 17.91 0 0 1-5.18-8.34 43.8 43.8 0 0 1-1.82-13.31Z"/>
8
+ </svg>`,
9
+ // Curated summary for agents and tools
10
+ summary: {
11
+ description: 'Structured “Thought” records that capture hypotheses, syntheses, and explicit links between JOE objects.',
12
+ purpose: 'Use thoughts to store inspectable reasoning: hypotheses to be vetted, syntheses that compress many objects, and binary links (A↔B) with receipts. Thoughts are reusable as context in pipelines and agent runs.',
13
+ labelField: 'name',
14
+ defaultSort: { field: 'joeUpdated', dir: 'desc' },
15
+ searchableFields: ['name', 'statement', 'info', 'thought_type', 'status', 'relationship_type', 'tags', '_id'],
16
+ allowedSorts: ['joeUpdated', 'created', 'thought_type', 'status', 'certainty'],
17
+ relationships: {
18
+ outbound: [
19
+ { field: 'tags', targetSchema: 'tag', cardinality: 'many' },
20
+ // Polymorphic references: the actual target schema comes from each entry's itemtype/id
21
+ { field: 'about', targetSchema: '<schemaName>', cardinality: 'many' },
22
+ { field: 'because', targetSchema: '<schemaName>', cardinality: 'many' },
23
+ { field: 'a', targetSchema: '<schemaName>', cardinality: 'one' },
24
+ { field: 'b', targetSchema: '<schemaName>', cardinality: 'one' }
25
+ ],
26
+ inbound: { graphRef: 'server/relationships.graph.json' }
27
+ },
28
+ joeManagedFields: ['created', 'joeUpdated'],
29
+ fields: [
30
+ { name: '_id', type: 'string', required: true },
31
+ { name: 'itemtype', type: 'string', required: true, const: 'thought' },
32
+ { name: 'name', type: 'string', required: true },
33
+ { name: 'thought_type', type: 'string', required: true, enumValues: ['hypothesis', 'synthesis', 'link'] },
34
+ { name: 'statement', type: 'string', required: true },
35
+ { name: 'certainty', type: 'number' },
36
+ // Reference to the status object used for this Thought
37
+ { name: 'status', type: 'string', isReference: true, targetSchema: 'status' },
38
+ { name: 'tags', type: 'string', isArray: true, isReference: true, targetSchema: 'tag' },
39
+ // Derived field built in onload: array of itemtypes from about[]
40
+ { name: 'about_itemtypes', type: 'string', isArray: true },
41
+ // What this thought is about (objects or schemas)
42
+ { name: 'about', type: 'objectList' },
43
+ // Why we believe the thought (receipts / evidence)
44
+ { name: 'because', type: 'objectList' },
45
+ // Link-specific shape (only used when thought_type === 'link')
46
+ { name: 'a', type: 'object' },
47
+ { name: 'b', type: 'object' },
48
+ { name: 'relationship_type', type: 'string' },
49
+ { name: 'rationale', type: 'string' },
50
+ // Lineage / provenance (ai_response_id, created_by, reviewed_by, etc.)
51
+ { name: 'source_ai_response', type: 'string', isReference: true, targetSchema: 'ai_response' },
52
+ { name: 'created_by', type: 'string' },
53
+ { name: 'lineage', type: 'object' },
54
+ { name: 'joeUpdated', type: 'string', format: 'date-time', required: true },
55
+ { name: 'created', type: 'string', format: 'date-time', required: true }
56
+ ]
57
+ },
58
+ sorter:['!created','name'],
59
+ // Simple subsets to quickly slice by type/status
60
+ subsets: function () {
61
+ return [
62
+ { name: 'Hypotheses', filter: { thought_type: 'hypothesis' } },
63
+ { name: 'Syntheses', filter: { thought_type: 'synthesis' } },
64
+ { name: 'Links', filter: { thought_type: 'link' } }].concat(_joe.Filter.Options.status({group:'status',collapsed:false}));
65
+
66
+ },
67
+ filters: function () {
68
+ var filters = [];
69
+ // Tag-based filters are the main cross-cutting dimension for Thoughts
70
+ filters = filters.concat(
71
+ _joe.Filter.Options.tags({ group: 'tags', untagged: true, collapsed: true })
72
+ );
73
+
74
+ // Group thoughts by what they are about (about[].itemtype).
75
+ // We build filters manually so that each itemtype gets its own filter
76
+ // on the nested path "about.itemtype". JOE's search engine treats this
77
+ // as "array of objects contains an element whose itemtype matches".
78
+ try {
79
+ var dataset = _joe.getDataset('thought') || [];
80
+ var typeMap = {};
81
+ dataset.map(function (t) {
82
+ if (Array.isArray(t.about)) {
83
+ t.about.map(function (a) {
84
+ if (a && a.itemtype) {
85
+ typeMap[a.itemtype] = true;
86
+ }
87
+ });
88
+ }
89
+ });
90
+ var types = Object.keys(typeMap).sort();
91
+ if (types.length) {
92
+ filters.push({ group_start: 'about itemtype', collapsed: true });
93
+ types.map(function (tp) {
94
+ filters.push({
95
+ name: tp,
96
+ filter: { 'about.itemtype': tp }
97
+ });
98
+ });
99
+ filters.push({ group_end: 'about itemtype' });
100
+ }
101
+ } catch (_e) { /* best-effort only */ }
102
+
103
+ return filters;
104
+ },
105
+ listView: {
106
+ title: function (th) {
107
+ var html = `<joe-subtext>${_joe.Utils.prettyPrintDTS(th.created)}</joe-subtext><joe-title>${th.name}</joe-title>`;
108
+ html += `<joe-subtitle>${th.statement}</joe-subtitle>`;
109
+
110
+ return html;
111
+ },
112
+ listWindowTitle: 'Thoughts'
113
+ },
114
+ // No special stripe color logic for now; could later reflect status/certainty.
115
+ stripeColor: function () { },
116
+ fields: [
117
+ { extend: 'name', specs:{ comment: 'Short label for this Thought used in lists and filters.' }},
118
+ { name: 'thought_type', type: 'select', values: ['hypothesis', 'synthesis', 'link'], width: '25%' },
119
+ //{ name: 'status', type: 'select', values: ['draft', 'proposed', 'accepted', 'rejected', 'superseded'], width: '25%' },
120
+ { name: 'certainty', type: 'number', width: '25%', comment: '0–1 confidence score for this thought.' },
121
+
122
+ { name: 'statement', width: '100%', comment: 'Short, human-readable statement of the thought.' },
123
+
124
+ { section_start: 'about', display: 'About (what this thought concerns)', anchor:'about', collapsed: false },
125
+ {
126
+ name: 'about',
127
+ type: 'objectList',
128
+ properties: [
129
+ {
130
+ name: 'itemtype',
131
+ type: 'select',
132
+ width: '140px',
133
+ values: function () {
134
+ return (typeof __collectionNames !== 'undefined' && __collectionNames) || [];
135
+ }
136
+ },
137
+ { name: 'id', width: '220px' },
138
+ 'role',
139
+ 'note'
140
+ ],
141
+ comment: 'Objects or schemas this thought is about. Each entry can include an optional role and note.'
142
+ },
143
+ { section_end: 'about' },
144
+
145
+ { section_start: 'because', display: 'Because (why we believe it)', anchor:'because', collapsed: false },
146
+ {
147
+ name: 'because',
148
+ type: 'objectList',
149
+ properties: [
150
+ {
151
+ name: 'itemtype',
152
+ type: 'select',
153
+ width: '140px',
154
+ values: function () {
155
+ return (typeof __collectionNames !== 'undefined' && __collectionNames) || [];
156
+ }
157
+ },
158
+ { name: 'id', width: '220px' },
159
+ 'role',
160
+ 'note'
161
+ ],
162
+ comment: 'Receipts/evidence supporting this thought. Each entry can include a role (why it matters) and note.'
163
+ },
164
+ { section_end: 'because' },
165
+
166
+ {
167
+ section_start: 'link',
168
+ display: 'Link details (only for link thoughts)',
169
+ anchor:'link',
170
+ collapsed: false,
171
+ hidden: function (item) {
172
+ return item.thought_type !== 'link';
173
+ }
174
+ },
175
+ {
176
+ name: 'a',
177
+ type: 'objectList',
178
+ properties: [
179
+ {
180
+ name: 'itemtype',
181
+ type: 'select',
182
+ width: '140px',
183
+ values: function () {
184
+ return (typeof __collectionNames !== 'undefined' && __collectionNames) || [];
185
+ }
186
+ },
187
+ { name: 'id', width: '220px' }
188
+ ],
189
+ display: 'Endpoint A',
190
+ comment: 'First endpoint of the link. Store itemtype and id.',
191
+ hidden: function (item) {
192
+ return item.thought_type !== 'link';
193
+ }
194
+ },
195
+ {
196
+ name: 'b',
197
+ type: 'objectList',
198
+ properties: [
199
+ {
200
+ name: 'itemtype',
201
+ type: 'select',
202
+ width: '140px',
203
+ values: function () {
204
+ return (typeof __collectionNames !== 'undefined' && __collectionNames) || [];
205
+ }
206
+ },
207
+ { name: 'id', width: '220px' }
208
+ ],
209
+ display: 'Endpoint B',
210
+ comment: 'Second endpoint of the link. Store itemtype and id.',
211
+ hidden: function (item) {
212
+ return item.thought_type !== 'link';
213
+ }
214
+ },
215
+ {
216
+ name: 'relationship_type',
217
+ comment: 'Short verb/label for how A relates to B (e.g., included_in, supports, contradicts).',
218
+ hidden: function (item) {
219
+ return item.thought_type !== 'link';
220
+ }
221
+ },
222
+ {
223
+ name: 'rationale',
224
+ comment: 'One-sentence rationale for why this link exists.',
225
+ hidden: function (item) {
226
+ return item.thought_type !== 'link';
227
+ }
228
+ },
229
+ { section_end: 'link' },
230
+
231
+ { section_start: 'lineage', display: 'Lineage & provenance', collapsed: true },
232
+ {
233
+ name: 'source_ai_response',
234
+ type: 'objectReference',
235
+ values: 'ai_response',
236
+ display: 'Source AI Response',
237
+ locked: true
238
+ },
239
+ { name: 'created_by', type: 'string', locked: true },
240
+ {
241
+ name: 'lineage',
242
+ type: 'rendering',
243
+ hidden: false,
244
+ run:function(item){
245
+ console.log(item.lineage);
246
+ return JSON.stringify(item.lineage, null, 2);
247
+ },
248
+ comment: 'Provenance for this thought (ai_response_id, created_by, created_at, reviewed_by, reviewed_at, etc.).'
249
+ },
250
+ { section_end: 'lineage' },
251
+ { sidebar_start:'right'},
252
+ 'status',
253
+ 'tags',
254
+
255
+ { sidebar_end:'right'},
256
+ { section_start: 'system', collapsed: true },
257
+ '_id',
258
+ 'created',
259
+ 'itemtype',
260
+ { section_end: 'system' }
261
+ ],
262
+ // Populate derived helper fields on load
263
+ onload: function (dataset) {
264
+ if (!Array.isArray(dataset)) {
265
+ return;
266
+ }
267
+ dataset.map(function (t) {
268
+ if (Array.isArray(t.about)) {
269
+ var types = t.about.map(function (a) { return a && a.itemtype; }).filter(Boolean);
270
+ // Deduplicate
271
+ t.about_itemtypes = Array.from(new Set(types));
272
+ }
273
+ });
274
+ },
275
+ idprop: '_id'
276
+ };
277
+
278
+ module.exports = thought;
279
+
280
+
@@ -21,7 +21,7 @@ var joewebconfig = {
21
21
  templatesDir:'_templates',
22
22
  //httpsPort:2100,
23
23
  default_schemas:['user','group','goal','initiative','event','report','tag','status','workflow','list','notification','note','include','instance','setting',
24
- 'ai_assistant','ai_conversation','ai_response','ai_tool','ai_prompt','ai_widget_conversation'
24
+ 'ai_assistant','ai_conversation','ai_response','ai_tool','ai_prompt','ai_widget_conversation','thought'
25
25
  ]
26
26
  };
27
27