@promus/cli 0.24.21 → 0.24.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promus/cli",
3
- "version": "0.24.21",
3
+ "version": "0.24.22",
4
4
  "type": "module",
5
5
  "description": "Promus CLI: sovereign agent gateway on Arbitrum. Runs `promus init` to mint an iNFT and bring up your agent",
6
6
  "license": "MIT",
@@ -791,6 +791,19 @@ export async function runChat(opts?: { cwd?: string; yolo?: boolean; resume?: st
791
791
  currency: NETWORK_CURRENCY[config.network],
792
792
  })
793
793
 
794
+ // Resume: load saved chat rows from the session file into the TUI
795
+ if (opts?.resume) {
796
+ try {
797
+ const { readFileSync, existsSync } = require('node:fs')
798
+ if (existsSync(sessionFile)) {
799
+ const saved = JSON.parse(readFileSync(sessionFile, 'utf8'))
800
+ if (Array.isArray(saved.rows) && saved.rows.length > 0) {
801
+ state.loadRows(saved.rows)
802
+ }
803
+ }
804
+ } catch {}
805
+ }
806
+
794
807
  // Phase 12: now that state exists, point the telegram row sinks at it. The
795
808
  // dispatch slot stays null until brain.init resolves below.
796
809
  if (telegram) {
@@ -1621,6 +1634,7 @@ export async function runChat(opts?: { cwd?: string; yolo?: boolean; resume?: st
1621
1634
  brainProvider: config.brain?.provider,
1622
1635
  brainModel: config.brain?.model,
1623
1636
  startedAt: new Date().toISOString(),
1637
+ rows: state.rows(),
1624
1638
  }, null, 2))
1625
1639
  } catch {}
1626
1640
  try {
package/src/ui/state.ts CHANGED
@@ -148,6 +148,10 @@ export function createChatState(opts: CreateChatStateOpts) {
148
148
  let idCounter = 1
149
149
  const nextId = () => `row-${idCounter++}`
150
150
 
151
+ const loadRows = (saved: TurnRow[]) => {
152
+ setRows(saved)
153
+ }
154
+
151
155
  const pushRow = (row: Omit<TurnRow, 'id' | 'firstOfBlock'>) => {
152
156
  setRows(prev => {
153
157
  const last = prev[prev.length - 1] ?? null
@@ -188,6 +192,7 @@ export function createChatState(opts: CreateChatStateOpts) {
188
192
  setSlashIndex,
189
193
  bumpActiveJobs,
190
194
  pushRow,
195
+ loadRows,
191
196
  onStatusChange,
192
197
  identityLabel: opts.identityLabel,
193
198
  isLocalGateway: opts.isLocalGateway ?? false,