@searls/turbocommit 0.13.0 → 0.13.1
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/lib/transcript.js +16 -1
- package/package.json +1 -1
package/lib/transcript.js
CHANGED
|
@@ -61,7 +61,7 @@ function parseCodexTranscript (filePath) {
|
|
|
61
61
|
if (entry.type !== 'response_item' || payload?.type !== 'message') continue
|
|
62
62
|
|
|
63
63
|
if (payload.role === 'user') {
|
|
64
|
-
const prompt = visibleText(payload.content)
|
|
64
|
+
const prompt = stripCodexInjectedContext(visibleText(payload.content))
|
|
65
65
|
if (isCodexSystemStatus(prompt)) continue
|
|
66
66
|
if (state.prompt !== null) {
|
|
67
67
|
state.pairs.push({ prompt: state.prompt, response: state.response })
|
|
@@ -94,6 +94,21 @@ function isCodexSystemStatus (text) {
|
|
|
94
94
|
return text.startsWith('== System Status ==\n') && text.includes('[automatic message added by system]')
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
function stripCodexInjectedContext (text) {
|
|
98
|
+
if (!isCodexInjectedContext(text)) return text
|
|
99
|
+
|
|
100
|
+
const end = '</environment_context>'
|
|
101
|
+
const endIndex = text.indexOf(end)
|
|
102
|
+
if (endIndex === -1) return text
|
|
103
|
+
return text.slice(endIndex + end.length).trim()
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function isCodexInjectedContext (text) {
|
|
107
|
+
return text.startsWith('# AGENTS.md instructions for ') &&
|
|
108
|
+
text.includes('<INSTRUCTIONS>') &&
|
|
109
|
+
text.includes('<environment_context>')
|
|
110
|
+
}
|
|
111
|
+
|
|
97
112
|
/**
|
|
98
113
|
* Format a single prompt/response pair.
|
|
99
114
|
*/
|