@ouro.bot/cli 0.1.0-alpha.666 → 0.1.0-alpha.668

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.
@@ -692,24 +692,35 @@ async function runInnerDialogTurn(options) {
692
692
  const agentRoot = (0, identity_1.getAgentRoot)();
693
693
  const habitName = options.habitName;
694
694
  const habitFilePath = path.join(agentRoot, "habits", `${habitName}.md`);
695
+ const preparedHabit = options.preparedHabit?.habit.name === habitName ? options.preparedHabit.habit : null;
695
696
  // Read and parse the habit file
696
697
  let habitBody;
697
698
  let habitTitle = habitName;
698
699
  let habitLastRun = null;
699
700
  let habitOrigin = null;
700
701
  let habitSurface = { family: true, originator: true, extra: [] };
701
- try {
702
- const habitContent = fs.readFileSync(habitFilePath, "utf-8");
703
- const parsed = (0, habit_runtime_state_1.applyHabitRuntimeState)(agentRoot, (0, habit_parser_1.parseHabitFile)(habitContent, habitFilePath));
704
- habitBody = parsed.body || undefined;
705
- habitTitle = parsed.title || habitName;
706
- habitLastRun = parsed.lastRun;
707
- habitTools = parsed.tools;
708
- habitOrigin = parsed.origin;
709
- habitSurface = parsed.surface;
702
+ if (preparedHabit) {
703
+ habitBody = preparedHabit.body || undefined;
704
+ habitTitle = preparedHabit.title || habitName;
705
+ habitLastRun = preparedHabit.lastRun;
706
+ habitTools = preparedHabit.tools;
707
+ habitOrigin = preparedHabit.origin;
708
+ habitSurface = preparedHabit.surface;
710
709
  }
711
- catch {
712
- // Habit file missing or unreadable
710
+ else {
711
+ try {
712
+ const habitContent = fs.readFileSync(habitFilePath, "utf-8");
713
+ const parsed = (0, habit_runtime_state_1.applyHabitRuntimeState)(agentRoot, (0, habit_parser_1.parseHabitFile)(habitContent, habitFilePath));
714
+ habitBody = parsed.body || undefined;
715
+ habitTitle = parsed.title || habitName;
716
+ habitLastRun = parsed.lastRun;
717
+ habitTools = parsed.tools;
718
+ habitOrigin = parsed.origin;
719
+ habitSurface = parsed.surface;
720
+ }
721
+ catch {
722
+ // Habit file missing or unreadable
723
+ }
713
724
  }
714
725
  // If the habit file couldn't be read at all (no body, no title parsed), error message
715
726
  if (habitBody === undefined && habitTitle === habitName) {
@@ -753,6 +764,7 @@ async function runInnerDialogTurn(options) {
753
764
  arcResume,
754
765
  deskOrientation,
755
766
  surfacePolicy,
767
+ priorSessionSummary: options.preparedHabit?.habit.name === habitName ? options.preparedHabit.priorSessionSummary : undefined,
756
768
  now,
757
769
  });
758
770
  }
@@ -875,7 +887,7 @@ async function runInnerDialogTurn(options) {
875
887
  runAgent: core_1.runAgent,
876
888
  postTurn: (turnMessages, sessionPathArg, usage, hooks, state) => {
877
889
  const prepared = (0, context_1.postTurnTrim)(turnMessages, usage, hooks);
878
- (0, context_1.deferPostTurnPersist)(sessionPathArg, prepared, usage, state);
890
+ return (0, context_1.deferPostTurnPersist)(sessionPathArg, prepared, usage, state);
879
891
  },
880
892
  accumulateFriendTokens: tokens_1.accumulateFriendTokens,
881
893
  signal: options?.signal,
@@ -827,7 +827,7 @@ async function handleInboundTurn(input) {
827
827
  /* v8 ignore next -- defensive: error always set when errored @preserve */
828
828
  result.error?.message ?? "unknown error", classification, currentProvider, currentBinding.model, agentName, inventory, {}, { currentLane });
829
829
  input.failoverState.pending = failoverContext;
830
- input.postTurn(sessionMessages, session.sessionPath, result.usage);
830
+ await input.postTurn(sessionMessages, session.sessionPath, result.usage);
831
831
  try {
832
832
  const agentRoot = (0, identity_1.getAgentRoot)();
833
833
  const postTurnArc = readPostTurnFlightRecorderArcSnapshot(agentRoot);
@@ -902,7 +902,7 @@ async function handleInboundTurn(input) {
902
902
  ? { lastFriendActivityAt }
903
903
  : undefined)
904
904
  : (Object.keys(continuingState).length > 0 ? continuingState : undefined);
905
- input.postTurn(sessionMessages, session.sessionPath, result.usage, undefined, nextState);
905
+ await input.postTurn(sessionMessages, session.sessionPath, result.usage, undefined, nextState);
906
906
  try {
907
907
  const agentRoot = (0, identity_1.getAgentRoot)();
908
908
  const postTurnArc = readPostTurnFlightRecorderArcSnapshot(agentRoot);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.666",
3
+ "version": "0.1.0-alpha.668",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",