open-agents-ai 0.164.0 → 0.165.0
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/dist/index.js +51 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11781,23 +11781,69 @@ var init_transcribe_tool = __esm({
|
|
|
11781
11781
|
model,
|
|
11782
11782
|
format: "json",
|
|
11783
11783
|
diarize,
|
|
11784
|
-
wordTimestamps:
|
|
11784
|
+
wordTimestamps: true
|
|
11785
|
+
// Always get timestamps for structured output
|
|
11785
11786
|
});
|
|
11786
11787
|
const transcriptDir = join19(this.workingDir, ".oa", "transcripts");
|
|
11787
11788
|
mkdirSync7(transcriptDir, { recursive: true });
|
|
11788
|
-
const
|
|
11789
|
-
|
|
11789
|
+
const fileBase = basename4(filePath).replace(/\.[^.]+$/, "");
|
|
11790
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
11791
|
+
const txtFile = join19(transcriptDir, `${fileBase}-${timestamp}.txt`);
|
|
11792
|
+
writeFileSync7(txtFile, result.text, "utf-8");
|
|
11793
|
+
const jsonFile = join19(transcriptDir, `${fileBase}-${timestamp}.json`);
|
|
11794
|
+
const structured = {
|
|
11795
|
+
source: filePath,
|
|
11796
|
+
model,
|
|
11797
|
+
language: result.language,
|
|
11798
|
+
duration: result.duration,
|
|
11799
|
+
wordCount: result.wordCount,
|
|
11800
|
+
speakers: result.speakers,
|
|
11801
|
+
transcribedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11802
|
+
segments: result.segments.map((seg) => ({
|
|
11803
|
+
start: seg.start,
|
|
11804
|
+
end: seg.end,
|
|
11805
|
+
text: seg.text,
|
|
11806
|
+
speaker: seg.speaker || void 0
|
|
11807
|
+
})),
|
|
11808
|
+
fullText: result.text
|
|
11809
|
+
};
|
|
11810
|
+
writeFileSync7(jsonFile, JSON.stringify(structured, null, 2), "utf-8");
|
|
11811
|
+
try {
|
|
11812
|
+
const memDir = join19(this.workingDir, ".oa", "memory");
|
|
11813
|
+
mkdirSync7(memDir, { recursive: true });
|
|
11814
|
+
const memFile = join19(memDir, "transcripts.json");
|
|
11815
|
+
let memEntries = [];
|
|
11816
|
+
try {
|
|
11817
|
+
memEntries = JSON.parse(readFileSync13(memFile, "utf-8"));
|
|
11818
|
+
} catch {
|
|
11819
|
+
}
|
|
11820
|
+
memEntries.push({
|
|
11821
|
+
source: basename4(filePath),
|
|
11822
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11823
|
+
duration: result.duration,
|
|
11824
|
+
wordCount: result.wordCount,
|
|
11825
|
+
language: result.language,
|
|
11826
|
+
summary: result.text.slice(0, 200),
|
|
11827
|
+
jsonPath: jsonFile,
|
|
11828
|
+
txtPath: txtFile
|
|
11829
|
+
});
|
|
11830
|
+
if (memEntries.length > 50)
|
|
11831
|
+
memEntries = memEntries.slice(-50);
|
|
11832
|
+
writeFileSync7(memFile, JSON.stringify(memEntries, null, 2), "utf-8");
|
|
11833
|
+
} catch {
|
|
11834
|
+
}
|
|
11790
11835
|
const lines = [
|
|
11791
11836
|
`Transcription of: ${basename4(filePath)}`,
|
|
11792
11837
|
`Model: ${model} | Language: ${result.language} | Duration: ${result.duration ? `${result.duration.toFixed(1)}s` : "unknown"}`,
|
|
11793
|
-
`Words: ${result.wordCount} |
|
|
11838
|
+
`Words: ${result.wordCount} | Segments: ${result.segments.length}`,
|
|
11839
|
+
`Saved: ${txtFile} (text) + ${jsonFile} (structured with timestamps)`,
|
|
11794
11840
|
""
|
|
11795
11841
|
];
|
|
11796
11842
|
if (result.speakers.length > 1) {
|
|
11797
11843
|
lines.push(`Speakers: ${result.speakers.join(", ")}`);
|
|
11798
11844
|
lines.push("");
|
|
11799
11845
|
}
|
|
11800
|
-
if (
|
|
11846
|
+
if (result.segments.length > 0) {
|
|
11801
11847
|
for (const seg of result.segments) {
|
|
11802
11848
|
const ts = `[${formatTime(seg.start)} \u2192 ${formatTime(seg.end)}]`;
|
|
11803
11849
|
const speaker = seg.speaker ? `${seg.speaker}: ` : "";
|
package/package.json
CHANGED