@aj-archipelago/cortex 1.3.21 → 1.3.23
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/README.md +64 -0
- package/config.js +26 -1
- package/helper-apps/cortex-realtime-voice-server/src/cortex/memory.ts +2 -2
- package/helper-apps/cortex-realtime-voice-server/src/realtime/client.ts +9 -4
- package/helper-apps/cortex-realtime-voice-server/src/realtime/realtimeTypes.ts +1 -0
- package/lib/util.js +5 -25
- package/package.json +5 -2
- package/pathways/system/entity/memory/shared/sys_memory_helpers.js +228 -0
- package/pathways/system/entity/memory/sys_memory_format.js +30 -0
- package/pathways/system/entity/memory/sys_memory_manager.js +85 -27
- package/pathways/system/entity/memory/sys_memory_process.js +154 -0
- package/pathways/system/entity/memory/sys_memory_required.js +4 -2
- package/pathways/system/entity/memory/sys_memory_topic.js +22 -0
- package/pathways/system/entity/memory/sys_memory_update.js +50 -150
- package/pathways/system/entity/memory/sys_read_memory.js +67 -69
- package/pathways/system/entity/memory/sys_save_memory.js +1 -1
- package/pathways/system/entity/memory/sys_search_memory.js +1 -1
- package/pathways/system/entity/sys_entity_start.js +9 -6
- package/pathways/system/entity/sys_generator_image.js +5 -41
- package/pathways/system/entity/sys_generator_memory.js +3 -1
- package/pathways/system/entity/sys_generator_reasoning.js +1 -1
- package/pathways/system/entity/sys_router_tool.js +3 -4
- package/pathways/system/rest_streaming/sys_claude_35_sonnet.js +1 -1
- package/pathways/system/rest_streaming/sys_claude_3_haiku.js +1 -1
- package/pathways/system/rest_streaming/sys_google_gemini_chat.js +1 -1
- package/pathways/system/rest_streaming/sys_ollama_chat.js +21 -0
- package/pathways/system/rest_streaming/sys_ollama_completion.js +14 -0
- package/pathways/system/rest_streaming/sys_openai_chat_o1.js +1 -1
- package/pathways/system/rest_streaming/sys_openai_chat_o3_mini.js +1 -1
- package/pathways/transcribe_gemini.js +525 -0
- package/server/modelExecutor.js +8 -0
- package/server/pathwayResolver.js +13 -8
- package/server/plugins/claude3VertexPlugin.js +150 -18
- package/server/plugins/gemini15ChatPlugin.js +90 -1
- package/server/plugins/gemini15VisionPlugin.js +16 -3
- package/server/plugins/modelPlugin.js +12 -9
- package/server/plugins/ollamaChatPlugin.js +158 -0
- package/server/plugins/ollamaCompletionPlugin.js +147 -0
- package/server/rest.js +70 -8
- package/tests/claude3VertexToolConversion.test.js +411 -0
- package/tests/memoryfunction.test.js +560 -46
- package/tests/multimodal_conversion.test.js +169 -0
- package/tests/openai_api.test.js +332 -0
- package/tests/transcribe_gemini.test.js +217 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import { convertSrtToVtt } from '../pathways/transcribe_gemini.js';
|
|
3
|
+
|
|
4
|
+
test('should return empty WebVTT for null or empty input', t => {
|
|
5
|
+
t.is(convertSrtToVtt(null), "WEBVTT\n\n");
|
|
6
|
+
t.is(convertSrtToVtt(''), "WEBVTT\n\n");
|
|
7
|
+
t.is(convertSrtToVtt(' '), "WEBVTT\n\n");
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
test('should convert basic SRT to WebVTT format', t => {
|
|
11
|
+
const srtInput =
|
|
12
|
+
`1
|
|
13
|
+
00:00:01,000 --> 00:00:04,000
|
|
14
|
+
Hello world`;
|
|
15
|
+
|
|
16
|
+
const expectedOutput =
|
|
17
|
+
`WEBVTT
|
|
18
|
+
|
|
19
|
+
1
|
|
20
|
+
00:00:01.000 --> 00:00:04.000
|
|
21
|
+
Hello world
|
|
22
|
+
|
|
23
|
+
`;
|
|
24
|
+
t.is(convertSrtToVtt(srtInput), expectedOutput);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('should convert multiple subtitle entries', t => {
|
|
28
|
+
const srtInput =
|
|
29
|
+
`1
|
|
30
|
+
00:00:01,000 --> 00:00:04,000
|
|
31
|
+
First subtitle
|
|
32
|
+
|
|
33
|
+
2
|
|
34
|
+
00:00:05,000 --> 00:00:08,000
|
|
35
|
+
Second subtitle`;
|
|
36
|
+
|
|
37
|
+
const expectedOutput =
|
|
38
|
+
`WEBVTT
|
|
39
|
+
|
|
40
|
+
1
|
|
41
|
+
00:00:01.000 --> 00:00:04.000
|
|
42
|
+
First subtitle
|
|
43
|
+
|
|
44
|
+
2
|
|
45
|
+
00:00:05.000 --> 00:00:08.000
|
|
46
|
+
Second subtitle
|
|
47
|
+
|
|
48
|
+
`;
|
|
49
|
+
t.is(convertSrtToVtt(srtInput), expectedOutput);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('should handle DOS line endings', t => {
|
|
53
|
+
const srtInput = "1\r\n00:00:01,000 --> 00:00:04,000\r\nHello world\r\n";
|
|
54
|
+
const expectedOutput = "WEBVTT\n\n1\n00:00:01.000 --> 00:00:04.000\nHello world\n\n";
|
|
55
|
+
t.is(convertSrtToVtt(srtInput), expectedOutput);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('should handle multi-line subtitles', t => {
|
|
59
|
+
const srtInput =
|
|
60
|
+
`1
|
|
61
|
+
00:00:01,000 --> 00:00:04,000
|
|
62
|
+
First line
|
|
63
|
+
Second line
|
|
64
|
+
Third line
|
|
65
|
+
|
|
66
|
+
2
|
|
67
|
+
00:00:05,000 --> 00:00:08,000
|
|
68
|
+
Another subtitle`;
|
|
69
|
+
|
|
70
|
+
const expectedOutput =
|
|
71
|
+
`WEBVTT
|
|
72
|
+
|
|
73
|
+
1
|
|
74
|
+
00:00:01.000 --> 00:00:04.000
|
|
75
|
+
First line
|
|
76
|
+
Second line
|
|
77
|
+
Third line
|
|
78
|
+
|
|
79
|
+
2
|
|
80
|
+
00:00:05.000 --> 00:00:08.000
|
|
81
|
+
Another subtitle
|
|
82
|
+
|
|
83
|
+
`;
|
|
84
|
+
t.is(convertSrtToVtt(srtInput), expectedOutput);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('should handle invalid timestamp formats', t => {
|
|
88
|
+
const srtInput =
|
|
89
|
+
`1
|
|
90
|
+
invalid timestamp
|
|
91
|
+
Hello world
|
|
92
|
+
|
|
93
|
+
2
|
|
94
|
+
00:00:05,000 --> 00:00:08,000
|
|
95
|
+
Valid subtitle`;
|
|
96
|
+
|
|
97
|
+
const expectedOutput =
|
|
98
|
+
`WEBVTT
|
|
99
|
+
|
|
100
|
+
2
|
|
101
|
+
00:00:05.000 --> 00:00:08.000
|
|
102
|
+
Valid subtitle
|
|
103
|
+
|
|
104
|
+
`;
|
|
105
|
+
t.is(convertSrtToVtt(srtInput), expectedOutput);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test('should convert comma to dot in timestamps', t => {
|
|
109
|
+
const srtInput =
|
|
110
|
+
`1
|
|
111
|
+
00:00:01,500 --> 00:00:04,750
|
|
112
|
+
Test subtitle`;
|
|
113
|
+
|
|
114
|
+
const expectedOutput =
|
|
115
|
+
`WEBVTT
|
|
116
|
+
|
|
117
|
+
1
|
|
118
|
+
00:00:01.500 --> 00:00:04.750
|
|
119
|
+
Test subtitle
|
|
120
|
+
|
|
121
|
+
`;
|
|
122
|
+
t.is(convertSrtToVtt(srtInput), expectedOutput);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test('should handle extra whitespace in input', t => {
|
|
126
|
+
const srtInput = `
|
|
127
|
+
|
|
128
|
+
1
|
|
129
|
+
00:00:01,000 --> 00:00:04,000
|
|
130
|
+
Hello world
|
|
131
|
+
|
|
132
|
+
`;
|
|
133
|
+
const expectedOutput =
|
|
134
|
+
`WEBVTT
|
|
135
|
+
|
|
136
|
+
1
|
|
137
|
+
00:00:01.000 --> 00:00:04.000
|
|
138
|
+
Hello world
|
|
139
|
+
|
|
140
|
+
`;
|
|
141
|
+
t.is(convertSrtToVtt(srtInput), expectedOutput);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test('should handle timestamps with only minutes and seconds', t => {
|
|
145
|
+
const srtInput =
|
|
146
|
+
`1
|
|
147
|
+
01:30,000 --> 02:45,500
|
|
148
|
+
Short timestamp format`;
|
|
149
|
+
|
|
150
|
+
const expectedOutput =
|
|
151
|
+
`WEBVTT
|
|
152
|
+
|
|
153
|
+
1
|
|
154
|
+
00:01:30.000 --> 00:02:45.500
|
|
155
|
+
Short timestamp format
|
|
156
|
+
|
|
157
|
+
`;
|
|
158
|
+
t.is(convertSrtToVtt(srtInput), expectedOutput);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test('should handle ultra-short timestamps (SS.mmm)', t => {
|
|
162
|
+
const srtInput =
|
|
163
|
+
`1
|
|
164
|
+
03.298 --> 04.578
|
|
165
|
+
First line
|
|
166
|
+
|
|
167
|
+
2
|
|
168
|
+
04.578 --> 06.178
|
|
169
|
+
Second line`;
|
|
170
|
+
|
|
171
|
+
const expectedOutput =
|
|
172
|
+
`WEBVTT
|
|
173
|
+
|
|
174
|
+
1
|
|
175
|
+
00:00:03.298 --> 00:00:04.578
|
|
176
|
+
First line
|
|
177
|
+
|
|
178
|
+
2
|
|
179
|
+
00:00:04.578 --> 00:00:06.178
|
|
180
|
+
Second line
|
|
181
|
+
|
|
182
|
+
`;
|
|
183
|
+
t.is(convertSrtToVtt(srtInput), expectedOutput);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
test('should handle mixed timestamp formats', t => {
|
|
187
|
+
const srtInput =
|
|
188
|
+
`1
|
|
189
|
+
03.298 --> 04.578
|
|
190
|
+
First line
|
|
191
|
+
|
|
192
|
+
2
|
|
193
|
+
00:04.578 --> 00:06.178
|
|
194
|
+
Second line
|
|
195
|
+
|
|
196
|
+
3
|
|
197
|
+
00:00:06.178 --> 00:00:07.518
|
|
198
|
+
Third line`;
|
|
199
|
+
|
|
200
|
+
const expectedOutput =
|
|
201
|
+
`WEBVTT
|
|
202
|
+
|
|
203
|
+
1
|
|
204
|
+
00:00:03.298 --> 00:00:04.578
|
|
205
|
+
First line
|
|
206
|
+
|
|
207
|
+
2
|
|
208
|
+
00:00:04.578 --> 00:00:06.178
|
|
209
|
+
Second line
|
|
210
|
+
|
|
211
|
+
3
|
|
212
|
+
00:00:06.178 --> 00:00:07.518
|
|
213
|
+
Third line
|
|
214
|
+
|
|
215
|
+
`;
|
|
216
|
+
t.is(convertSrtToVtt(srtInput), expectedOutput);
|
|
217
|
+
});
|