@jupyter-ai/persona-manager 0.2.0-a4 → 0.2.0-a6

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.
@@ -744,9 +744,18 @@ export function PersonaControls(props) {
744
744
  // Stamp the current persona + its settings onto the input model's metadata,
745
745
  // so it rides out with the next message and the PersonaManager routes and
746
746
  // applies it. Keyed on a signature so we only write when it changes.
747
+ //
748
+ // This merges (updateMetadata), and deliberately does not clear first: the
749
+ // input's metadata map is shared with any other extension that stamps its own
750
+ // keys onto outgoing messages. For example, jupyterlab-commands-toolkit stamps
751
+ // a `web_client_id` there so an AI persona can route frontend commands back to
752
+ // the specific web client that triggered them. A clearMetadata() here would
753
+ // wipe those foreign keys. Since buildMessageMetadata always emits the same
754
+ // keys for a given selection, the merge fully overwrites our own previous
755
+ // values on each change; the only residue is switching a real persona back to
756
+ // "No one", which leaves an inert model/settings that no persona reads.
747
757
  const metadataSignature = JSON.stringify({ selectedId, settings });
748
758
  useEffect(() => {
749
- model.clearMetadata();
750
759
  model.updateMetadata(buildMessageMetadata(selectedId, settings));
751
760
  }, [model, metadataSignature]);
752
761
  // On selection, tell the server to prepare the persona by
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter-ai/persona-manager",
3
- "version": "0.2.0-a4",
3
+ "version": "0.2.0-a6",
4
4
  "description": "The core manager & registry for AI personas in Jupyter AI",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -1208,9 +1208,18 @@ export function PersonaControls(
1208
1208
  // Stamp the current persona + its settings onto the input model's metadata,
1209
1209
  // so it rides out with the next message and the PersonaManager routes and
1210
1210
  // applies it. Keyed on a signature so we only write when it changes.
1211
+ //
1212
+ // This merges (updateMetadata), and deliberately does not clear first: the
1213
+ // input's metadata map is shared with any other extension that stamps its own
1214
+ // keys onto outgoing messages. For example, jupyterlab-commands-toolkit stamps
1215
+ // a `web_client_id` there so an AI persona can route frontend commands back to
1216
+ // the specific web client that triggered them. A clearMetadata() here would
1217
+ // wipe those foreign keys. Since buildMessageMetadata always emits the same
1218
+ // keys for a given selection, the merge fully overwrites our own previous
1219
+ // values on each change; the only residue is switching a real persona back to
1220
+ // "No one", which leaves an inert model/settings that no persona reads.
1211
1221
  const metadataSignature = JSON.stringify({ selectedId, settings });
1212
1222
  useEffect(() => {
1213
- model.clearMetadata();
1214
1223
  model.updateMetadata(buildMessageMetadata(selectedId, settings));
1215
1224
  }, [model, metadataSignature]);
1216
1225