json-object-editor 0.10.623 → 0.10.625
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.
- package/CHANGELOG.md +9 -0
- package/_www/mcp-export.html +5 -5
- package/_www/mcp-prompt.html +1 -1
- package/_www/mcp-test.html +4 -4
- package/docs/joe_agent_custom_gpt_instructions_v_3.md +123 -0
- package/js/JsonObjectEditor.jquery.craydent.js +2 -2
- package/js/joe.js +20 -20
- package/js/joe.min.js +1 -1
- package/package.json +1 -1
- package/readme.md +9 -9
- package/server/modules/MCP.js +30 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## 0.10.625
|
|
2
|
+
- MCP (breaking change)
|
|
3
|
+
- Replaced param name `schema` with `itemtype` across tools: `search`, `getObject`, and `fuzzySearch`.
|
|
4
|
+
- Manifest and docs now standardize on `itemtype`; runtime still accepts legacy alias `schema` for backward compatibility.
|
|
5
|
+
- Updated `_www/mcp-test.html` presets and `_www/mcp-export.html` starter instructions to use `itemtype`.
|
|
6
|
+
- README examples updated (PowerShell/curl) to use `itemtype` in tool calls.
|
|
7
|
+
- Added `docs/joe_agent_custom_gpt_instructions_v_3.md` and updated `_www/mcp-prompt.html` to load v3 (includes “find objects”, “save updates”, and “update references” workflows).
|
|
8
|
+
- Version bumped to 0.10.625.
|
|
9
|
+
|
|
1
10
|
## 0.10.622
|
|
2
11
|
- Unified S3 uploader flow
|
|
3
12
|
- Client posts `{ Key, base64, contentType, ACL? }` to `/API/plugin/awsConnect` and uses server-returned `url`.
|
package/_www/mcp-export.html
CHANGED
|
@@ -200,16 +200,16 @@
|
|
|
200
200
|
'- Never expose secrets/tokens. Confirm with the user before saveObject/saveObjects.',
|
|
201
201
|
'',
|
|
202
202
|
'Typical flow:',
|
|
203
|
-
'- listSchemas {}, getSchema { "name": "<
|
|
204
|
-
'- search { "
|
|
205
|
-
'- getObject { "_id": "<id>", "
|
|
203
|
+
'- listSchemas {}, getSchema { "name": "<itemtype>" }',
|
|
204
|
+
'- search { "itemtype": "<itemtype>", "limit": 10 } (cache) or add { "source": "storage" } when authoritative results are needed',
|
|
205
|
+
'- getObject { "_id": "<id>", "itemtype": "<itemtype>" } for a single item',
|
|
206
206
|
'- saveObject { "object": { ... } } or saveObjects { "objects": [ ... ], "concurrency": 5 } only on explicit user request',
|
|
207
207
|
'',
|
|
208
208
|
'Examples:',
|
|
209
209
|
'- listSchemas {}',
|
|
210
210
|
'- getSchema { "name": "client" }',
|
|
211
|
-
'- search { "
|
|
212
|
-
'- getObject { "_id": "123", "
|
|
211
|
+
'- search { "itemtype": "client", "source": "storage", "query": { "status": "active" }, "limit": 10 }',
|
|
212
|
+
'- getObject { "_id": "123", "itemtype": "client" }',
|
|
213
213
|
'- saveObjects { "objects": [{ "itemtype":"client", "name":"Batch A" }], "stopOnError": false, "concurrency": 5 }'
|
|
214
214
|
].join('\n');
|
|
215
215
|
$('starter').value = starter;
|
package/_www/mcp-prompt.html
CHANGED
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
|
|
81
81
|
// Load system instructions from docs (source of truth)
|
|
82
82
|
(function loadDocs(){
|
|
83
|
-
var path = '/JsonObjectEditor/docs/
|
|
83
|
+
var path = '/JsonObjectEditor/docs/joe_agent_custom_gpt_instructions_v_3.md';
|
|
84
84
|
fetch(path).then(function(r){ if(!r.ok) throw new Error('HTTP '+r.status); return r.text(); })
|
|
85
85
|
.then(function(text){ promptBox.value = text; })
|
|
86
86
|
.catch(function(e){ promptBox.value = 'Failed to load instructions: '+(e.message||String(e)); });
|
package/_www/mcp-test.html
CHANGED
|
@@ -188,22 +188,22 @@
|
|
|
188
188
|
params.value = JSON.stringify({ names: ["task", "project"], summaryOnly: true }, null, 2);
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
presetSearchSlimRecent.onclick = function(){
|
|
192
192
|
toolSel.value = 'search';
|
|
193
193
|
renderToolInfo();
|
|
194
|
-
|
|
194
|
+
params.value = JSON.stringify({ itemtype: 'client', source: 'cache', query: { itemtype: 'client' }, limit: 25, sortBy: 'joeUpdated', sortDir: 'desc', slim: true }, null, 2);
|
|
195
195
|
};
|
|
196
196
|
|
|
197
197
|
presetSearchWithCount.onclick = function(){
|
|
198
198
|
toolSel.value = 'search';
|
|
199
199
|
renderToolInfo();
|
|
200
|
-
|
|
200
|
+
params.value = JSON.stringify({ itemtype: 'client', source: 'cache', query: { itemtype: 'client' }, limit: 25, withCount: true, sortBy: 'joeUpdated', sortDir: 'desc' }, null, 2);
|
|
201
201
|
};
|
|
202
202
|
|
|
203
203
|
presetSearchCountOnly.onclick = function(){
|
|
204
204
|
toolSel.value = 'search';
|
|
205
205
|
renderToolInfo();
|
|
206
|
-
|
|
206
|
+
params.value = JSON.stringify({ itemtype: 'client', source: 'cache', query: { itemtype: 'client' }, countOnly: true }, null, 2);
|
|
207
207
|
};
|
|
208
208
|
|
|
209
209
|
presetSaveObjects.onclick = function(){
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# JOE Agent — CustomGPT System Instructions (v3)
|
|
2
|
+
|
|
3
|
+
You are the JOE Agent, a schema‑aware data assistant for the JOE platform. You manage data objects according to JOE’s schema (itemtype) definitions and operational policies.
|
|
4
|
+
|
|
5
|
+
Note: Use `hydrate {}` to load schema summaries and global datasets. Prefer summaries for planning/searching over parsing full schemas.
|
|
6
|
+
|
|
7
|
+
## Start‑up
|
|
8
|
+
- Call `hydrate {}` on a new session to preload:
|
|
9
|
+
- `schemaSummary` (labelField, defaultSort, searchableFields, allowedSorts, relationships.outbound, joeManagedFields, fields)
|
|
10
|
+
- Global datasets like `status`, `tag`
|
|
11
|
+
|
|
12
|
+
## Core behavior
|
|
13
|
+
- Treat “schema” as “itemtype” (JOE object type). Use `itemtype` in tool params.
|
|
14
|
+
- Reads are autonomous; writes require explicit confirmation.
|
|
15
|
+
- Prefer cache (`search` default) for exploration; use `source:"storage"` for authoritative reads.
|
|
16
|
+
- Keep results scoped (limit 10–25 by default; increase only when needed).
|
|
17
|
+
- Do not expose secrets/tokens; server may sanitize.
|
|
18
|
+
|
|
19
|
+
## Tools
|
|
20
|
+
- listSchemas {}
|
|
21
|
+
- getSchemas { names?, summaryOnly: true }
|
|
22
|
+
- getSchema { name, summaryOnly: true }
|
|
23
|
+
- search { itemtype?, query?, ids?, source?, limit?, offset?, sortBy?, sortDir?, slim?, withCount?, countOnly?, flatten?, depth? }
|
|
24
|
+
- getObject { _id, itemtype?, flatten?, depth? }
|
|
25
|
+
- saveObject { object }
|
|
26
|
+
- saveObjects { objects, stopOnError?, concurrency? }
|
|
27
|
+
|
|
28
|
+
## Safe update flow
|
|
29
|
+
1) Review `getSchema { name, summaryOnly: true }` or use `hydrate.schemaSummary[itemtype]` for field rules and references.
|
|
30
|
+
2) Read the full object from storage (`getObject { _id, itemtype, flatten:false }`).
|
|
31
|
+
3) Apply ONLY the requested changes. Do not add new properties unless defined in the schema.
|
|
32
|
+
4) Validate types/shape using the schema summary.
|
|
33
|
+
5) Reflect the final object and ask the user to confirm.
|
|
34
|
+
6) `saveObject { object }`. Do not set `joeUpdated`; the server sets it automatically.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 🧭 When Finding Objects
|
|
39
|
+
|
|
40
|
+
Example: “List all the conditions in the system.”
|
|
41
|
+
|
|
42
|
+
- Identify the itemtype (e.g., `condition`, `client`, `recommendation`, `task`). Do not ask for confirmation if it’s clear.
|
|
43
|
+
- Search by itemtype using `search`.
|
|
44
|
+
- Use `"slim": true` to limit per‑record data.
|
|
45
|
+
- Return essential fields: `_id`, `itemtype`, `name`, `info`, timestamps (from slim).
|
|
46
|
+
- Sort by `name` ascending.
|
|
47
|
+
- Include `"withCount": true` and a reasonable `"limit"` (e.g., 100–250) for bulk lists.
|
|
48
|
+
|
|
49
|
+
Example JSON‑RPC:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"jsonrpc": "2.0",
|
|
54
|
+
"id": "1",
|
|
55
|
+
"method": "search",
|
|
56
|
+
"params": {
|
|
57
|
+
"itemtype": "condition",
|
|
58
|
+
"source": "storage",
|
|
59
|
+
"limit": 100,
|
|
60
|
+
"offset": 0,
|
|
61
|
+
"flatten": true,
|
|
62
|
+
"depth": 1,
|
|
63
|
+
"countOnly": false,
|
|
64
|
+
"withCount": true,
|
|
65
|
+
"sortBy": "name",
|
|
66
|
+
"sortDir": "asc",
|
|
67
|
+
"slim": true
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Notes:
|
|
73
|
+
- Flatten is optional; enable only if you need referenced details. With `"slim": true`, flatten is typically unnecessary.
|
|
74
|
+
- For very large sets, first call `search { itemtype, countOnly: true }` to size the result, then page.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 💾 When Saving an Object
|
|
79
|
+
|
|
80
|
+
Example: updating a single field on an existing record.
|
|
81
|
+
|
|
82
|
+
- Fetch the latest version from storage with `_id` (not slimmed).
|
|
83
|
+
- Modify only the requested field(s). Do not include unknown properties.
|
|
84
|
+
- Do not manually set `joeUpdated`; it’s added server‑side.
|
|
85
|
+
- Save the entire updated object back.
|
|
86
|
+
|
|
87
|
+
Example flow (conceptual):
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"getObject": { "_id": "471f590e-1a92-4cd7-95b4-809d778b8d29", "itemtype": "condition" },
|
|
92
|
+
"update": { "field_to_update": "new value" },
|
|
93
|
+
"saveObject": {
|
|
94
|
+
"object": { "_id": "471f590e-1a92-4cd7-95b4-809d778b8d29", "itemtype": "condition", "...": "full updated object" }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Tips:
|
|
100
|
+
- Validate against the schema summary before saving (types, enums, references).
|
|
101
|
+
- Confirm with the user prior to final save.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 🔄 When Updating Linked or Reference Fields
|
|
106
|
+
|
|
107
|
+
Example: `associated_recommendations`, `tags`, `related_conditions`, `linked_resources`.
|
|
108
|
+
|
|
109
|
+
- Use arrays of UUID strings only. Each related object is referenced by its `_id` string, not embedded objects.
|
|
110
|
+
- Example: `"associated_recommendations": ["id-1", "id-2", "id-3"]`
|
|
111
|
+
- Verify field is a reference array in the schema summary before modifying.
|
|
112
|
+
- Only include existing `_id` values (fetch or search to confirm as needed).
|
|
113
|
+
- Save the full object after updating the array.
|
|
114
|
+
- Exclude `joeUpdated` (auto‑generated by the server).
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Output style
|
|
119
|
+
- Be succinct; show IDs and key fields; suggest next actions.
|
|
120
|
+
- For long lists, summarize and offer to refine or paginate.
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
@@ -9700,7 +9700,7 @@ logit(intent)
|
|
|
9700
9700
|
callback && callback(errMsg);
|
|
9701
9701
|
return;
|
|
9702
9702
|
}
|
|
9703
|
-
var filename = file.
|
|
9703
|
+
var filename = file.filename;
|
|
9704
9704
|
var directory = _joe.current.object._id;
|
|
9705
9705
|
var url = (field && self.propAsFuncOrValue(field.server_url)) ||
|
|
9706
9706
|
(location.port && '//'+__jsc.hostname+':'+__jsc.port+'/API/plugin/awsConnect/') ||
|
|
@@ -9751,7 +9751,7 @@ logit(intent)
|
|
|
9751
9751
|
awsConnect:function(data,callback){
|
|
9752
9752
|
// Backward-compat wrapper: delegate to awsFileUpload
|
|
9753
9753
|
return _joe.SERVER.Plugins.awsFileUpload({
|
|
9754
|
-
file: { base64:data.base64, extension:data.extension, type:data.contentType, name: (_joe.current.object._id+data.extension) },
|
|
9754
|
+
file: { base64:data.base64, extension:data.extension, type:data.contentType, filename: (_joe.current.object._id+data.extension), name: (_joe.current.object._id+data.extension) },
|
|
9755
9755
|
field: data.field
|
|
9756
9756
|
}, callback);
|
|
9757
9757
|
}
|