molroo docs
Guides

Migrating to SDK v1.0

How to move from the 0.9.x method-per-verb API to the unified react() / update() shape in 0.10.0.

v0.10.0 introduces the two methods that v1.0 will keep: Persona.react() and Persona.update(). Everything else still works — this release is additive — but the legacy input/admin methods will be removed in v1.0.

Why

The 0.9.x surface had 5 input methods (perceive, hear, experience, event, socialize) that all routed to the same endpoint with different defaults, and 6 admin setters (setEmotion, annotate, setNextResponse, setStyleProfile, patch, putSnapshot) that each modified one slice of persona state. The shape encouraged callers to memorize verb names instead of thinking about what they were actually sending.

v1.0 collapses both groups to a pair of orthogonal methods:

  • react(input) — anything the persona perceives from the outside world.
  • update(patch) — anything an operator writes into persona state.

chat() and tick() are kept as-is.

react() — input

// before
await persona.perceive('hi');
await persona.hear('hi', 'Alice');
await persona.experience('sunset', appraisal);
await persona.event('gift_received', 'got flowers', { appraisal });
await persona.socialize('missed you', 'Bob', relationship);

// after
await persona.react({ kind: 'perceive', message: 'hi' });
await persona.react({ kind: 'hear', message: 'hi', from: 'Alice' });
await persona.react({ kind: 'experience', description: 'sunset', appraisal });
await persona.react({
  kind: 'event',
  type: 'gift_received',
  description: 'got flowers',
  appraisal,
});
await persona.react({
  kind: 'socialize',
  message: 'missed you',
  from: 'Bob',
  relationship,
});

ReactInput is a discriminated union on kind, so TypeScript will refuse mismatched fields (e.g. relationship on hear).

update() — admin patch

// before
await persona.setEmotion({ V: 0.5 });
await persona.annotate('is cheerful today');
await persona.setNextResponse('OK!');
await persona.setStyleProfile(profile);
await persona.patch({ config });
await persona.putSnapshot(snapshot);

// after — any subset, applied in declaration order
await persona.update({
  emotion: { V: 0.5 },
  annotation: 'is cheerful today',
  nextResponse: 'OK!',
  styleProfile: profile,
  config,
  snapshot,
});

Each field is optional. update({}) is a no-op.

Removal timetable

VersionStatus of legacy methods
0.10.xBoth APIs coexist. Legacy methods unchanged.
0.13.xLegacy methods marked @deprecated in JSDoc.
1.0.0Legacy methods removed. Only react() / update().

No console warnings are emitted in 0.10.x — flip your call sites whenever it fits, or wait for v1.0 and migrate in one pass.

On this page