iivo-sub 0.1.5 → 0.1.6
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/bin/iivo-sub.js +13 -5
- package/package.json +1 -1
package/bin/iivo-sub.js
CHANGED
|
@@ -6,7 +6,7 @@ import path from 'node:path'
|
|
|
6
6
|
import readline from 'node:readline'
|
|
7
7
|
import { spawnSync } from 'node:child_process'
|
|
8
8
|
|
|
9
|
-
const VERSION = '0.1.
|
|
9
|
+
const VERSION = '0.1.6'
|
|
10
10
|
const APP_DIR = path.join(os.homedir(), '.iivo-sub')
|
|
11
11
|
const CACHE_FILE = path.join(APP_DIR, 'cache.json')
|
|
12
12
|
const SCRIPTED_INPUT = !process.stdin.isTTY ? fs.readFileSync(0, 'utf8').split(/\r?\n/) : null
|
|
@@ -518,14 +518,18 @@ function titleFromCodexSession(filePath) {
|
|
|
518
518
|
}
|
|
519
519
|
const payload = item?.payload
|
|
520
520
|
if (payload?.type === 'user_message' && payload.message) {
|
|
521
|
-
|
|
521
|
+
const title = truncateTitle(payload.message)
|
|
522
|
+
if (title) return title
|
|
522
523
|
}
|
|
523
524
|
if (payload?.type === 'message' && payload.role === 'user' && Array.isArray(payload.content)) {
|
|
524
525
|
const text = payload.content
|
|
525
526
|
.map((part) => part?.text || part?.input_text || '')
|
|
526
527
|
.filter(Boolean)
|
|
527
528
|
.join(' ')
|
|
528
|
-
if (text)
|
|
529
|
+
if (text) {
|
|
530
|
+
const title = truncateTitle(text)
|
|
531
|
+
if (title) return title
|
|
532
|
+
}
|
|
529
533
|
}
|
|
530
534
|
}
|
|
531
535
|
} catch {
|
|
@@ -592,14 +596,18 @@ function codexSessionSummary(filePath) {
|
|
|
592
596
|
if (payload.approval_policy) summary.approval_mode = String(payload.approval_policy)
|
|
593
597
|
}
|
|
594
598
|
if (!summary.first_user_message && payload?.type === 'user_message' && payload.message) {
|
|
595
|
-
|
|
599
|
+
const title = truncateTitle(payload.message)
|
|
600
|
+
if (title) summary.first_user_message = title
|
|
596
601
|
}
|
|
597
602
|
if (!summary.first_user_message && payload?.type === 'message' && payload.role === 'user' && Array.isArray(payload.content)) {
|
|
598
603
|
const text = payload.content
|
|
599
604
|
.map((part) => part?.text || part?.input_text || '')
|
|
600
605
|
.filter(Boolean)
|
|
601
606
|
.join(' ')
|
|
602
|
-
if (text)
|
|
607
|
+
if (text) {
|
|
608
|
+
const title = truncateTitle(text)
|
|
609
|
+
if (title) summary.first_user_message = title
|
|
610
|
+
}
|
|
603
611
|
}
|
|
604
612
|
}
|
|
605
613
|
if (firstEventAt && (!summary.created_at || firstEventAt < summary.created_at)) {
|