@tpsdev-ai/flair 0.44.6 → 0.44.7

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.
@@ -392,14 +392,29 @@ async function bootstrap(agent, args) {
392
392
  }
393
393
  async function soulSet(agent, args) {
394
394
  const Cls = await handler("Soul");
395
- const h = new Cls(undefined, delegationContext(agent));
396
- // Soul records are keyed `id = agentId:key` (see flair-client SoulApi.set and
397
- // schemas/memory.graphql). Use PUT with the explicit id so soul_get's
398
- // `${agentId}:${key}` lookup finds it a plain post() would mint a random id
399
- // and orphan the entry from get(). Soul.put enforces write ownership via
400
- // resolveAgentAuth (non-admin can only write agentId === self).
395
+ // flair#1181 this write MUST go through a COLLECTION-bound instance
396
+ // (`collectionResource(Cls, ctx).post(...)`), the same create path the sibling
397
+ // write tools use (memoryStore / workspaceSet / orgEvent). The previous
398
+ // `new Cls(undefined, ctx).put({ id, ... })` was a PUT on an UNLOADED instance:
399
+ // an unloaded instance has no primary key, so Harper's instance put()/save()
400
+ // threw `Invalid primary key type: undefined` (the same defect class the
401
+ // memoryGet/update/delete/soulGet by-id READS were migrated off of — see those
402
+ // wrappers, and resources/in-process.ts's header: "flair itself got [collection
403
+ // binding] wrong in four MCP tool paths"). soul_set's only prior test drove a
404
+ // MOCKED handler, so the real instance-put never ran and it shipped broken on
405
+ // the connector path.
406
+ //
407
+ // A COLLECTION post (not a static `Cls.put(record, ctx)`) is the right form:
408
+ // it routes through Soul.post(), which stamps createdAt (a schema-required,
409
+ // non-null field). Static `Cls.put` reaches Soul.put(), which does NOT stamp
410
+ // createdAt on a create, so it fails a "Property createdAt is required"
411
+ // validation. Soul.post honors the explicit body `id`, so the record is still
412
+ // keyed `id = agentId:key` and soul_get's `${agentId}:${key}` lookup finds it —
413
+ // a random-id create would orphan the entry from get(). Soul.post enforces
414
+ // write ownership via resolveAgentAuth (non-admin can only write agentId === self).
401
415
  const id = `${agent.agentId}:${args?.key}`;
402
- return unwrap(await h.put({
416
+ const h = await collectionResource(Cls, delegationContext(agent));
417
+ return unwrap(await h.post({
403
418
  id,
404
419
  agentId: agent.agentId,
405
420
  key: args?.key,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tpsdev-ai/flair",
3
- "version": "0.44.6",
3
+ "version": "0.44.7",
4
4
  "packageManager": "bun@1.3.10",
5
5
  "description": "Identity, memory, and soul for AI agents. Cryptographic identity (Ed25519), semantic memory with local embeddings, and persistent personality — all in a single process.",
6
6
  "type": "module",