@ouro.bot/cli 0.1.0-alpha.360 → 0.1.0-alpha.361

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.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.361",
6
+ "changes": [
7
+ "All senses (inner-dialog, BlueBubbles, Teams, shared-turn) now use deferred session persist (postTurnTrim + deferPostTurnPersist), matching the CLI pattern. Unblocks the event loop during session I/O for all channels."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.360",
6
12
  "changes": [
@@ -127,7 +127,8 @@ const defaultDeps = {
127
127
  buildSystem: prompt_1.buildSystem,
128
128
  runAgent: core_1.runAgent,
129
129
  loadSession: context_1.loadSession,
130
- postTurn: context_1.postTurn,
130
+ postTurnTrim: context_1.postTurnTrim,
131
+ deferPostTurnPersist: context_1.deferPostTurnPersist,
131
132
  sessionPath: config_1.sessionPath,
132
133
  accumulateFriendTokens: tokens_1.accumulateFriendTokens,
133
134
  createClient: () => (0, client_1.createBlueBubblesClient)(),
@@ -792,7 +793,10 @@ async function handleBlueBubblesNormalizedEvent(event, resolvedDeps, source) {
792
793
  },
793
794
  },
794
795
  }),
795
- postTurn: resolvedDeps.postTurn,
796
+ postTurn: (turnMessages, sessionPathArg, usage, hooks, state) => {
797
+ const prepared = resolvedDeps.postTurnTrim(turnMessages, usage, hooks);
798
+ resolvedDeps.deferPostTurnPersist(sessionPathArg, prepared, usage, state);
799
+ },
796
800
  accumulateFriendTokens: resolvedDeps.accumulateFriendTokens,
797
801
  signal: controller.signal,
798
802
  runAgentOptions: { mcpManager, ...(isReaction ? { isReactionSignal: true } : {}) },
@@ -696,7 +696,10 @@ async function runInnerDialogTurn(options) {
696
696
  enforceTrustGate: trust_gate_1.enforceTrustGate,
697
697
  drainPending: pending_1.drainPending,
698
698
  runAgent: core_1.runAgent,
699
- postTurn: context_1.postTurn,
699
+ postTurn: (turnMessages, sessionPathArg, usage, hooks, state) => {
700
+ const prepared = (0, context_1.postTurnTrim)(turnMessages, usage, hooks);
701
+ (0, context_1.deferPostTurnPersist)(sessionPathArg, prepared, usage, state);
702
+ },
700
703
  accumulateFriendTokens: tokens_1.accumulateFriendTokens,
701
704
  signal: options?.signal,
702
705
  /* v8 ignore start -- attention queue: callback invoked by pipeline during pending drain; tested via attention-queue unit tests @preserve */
@@ -109,6 +109,7 @@ async function runSenseTurn(options) {
109
109
  const sessPath = (0, config_1.sessionPath)(friendId, channel, sessionKey);
110
110
  const existing = (0, context_1.loadSession)(sessPath);
111
111
  let sessionState = existing?.state;
112
+ let persistPromise;
112
113
  const sessionMessages = existing?.messages && existing.messages.length > 0
113
114
  ? existing.messages
114
115
  : [{ role: "system", content: await (0, prompt_1.buildSystem)(channel, {}, undefined) }];
@@ -157,8 +158,9 @@ async function runSenseTurn(options) {
157
158
  /* v8 ignore start — delegation wrappers; these just forward to the real functions */
158
159
  runAgent: (msgs, cb, ch, sig, opts) => (0, core_1.runAgent)(msgs, cb, ch, sig, opts),
159
160
  postTurn: (turnMessages, sessionPathArg, usage, hooks, state) => {
160
- (0, context_2.postTurn)(turnMessages, sessionPathArg, usage, hooks, state);
161
+ const prepared = (0, context_2.postTurnTrim)(turnMessages, usage, hooks);
161
162
  sessionState = state;
163
+ persistPromise = (0, context_2.deferPostTurnPersist)(sessionPathArg, prepared, usage, state);
162
164
  },
163
165
  /* v8 ignore stop */
164
166
  accumulateFriendTokens: tokens_1.accumulateFriendTokens,
@@ -168,6 +170,10 @@ async function runSenseTurn(options) {
168
170
  let finalResponse;
169
171
  if (responseText.length === 0) {
170
172
  // Agent settled but no text came through callbacks — check session transcript for the settle answer
173
+ // Await deferred persist so the session file is up-to-date before readback
174
+ /* v8 ignore next -- persistPromise set inside v8-ignored postTurn callback; tested via pipeline integration @preserve */
175
+ if (persistPromise)
176
+ await persistPromise;
171
177
  const postTurnSession = (0, context_1.loadSession)(sessPath);
172
178
  if (postTurnSession?.messages) {
173
179
  const lastAssistant = [...postTurnSession.messages].reverse().find(m => m.role === "assistant");
@@ -685,7 +685,10 @@ async function handleTeamsMessage(text, stream, conversationId, teamsContext, se
685
685
  summarize: teamsToolContext.summarize,
686
686
  },
687
687
  }),
688
- postTurn: context_1.postTurn,
688
+ postTurn: (turnMessages, sessionPathArg, usage, hooks, state) => {
689
+ const prepared = (0, context_1.postTurnTrim)(turnMessages, usage, hooks);
690
+ (0, context_1.deferPostTurnPersist)(sessionPathArg, prepared, usage, state);
691
+ },
689
692
  accumulateFriendTokens: tokens_1.accumulateFriendTokens,
690
693
  signal: controller.signal,
691
694
  runAgentOptions: agentOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.360",
3
+ "version": "0.1.0-alpha.361",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",