@redaksjon/protokoll 0.0.12 → 0.0.13
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/.cursor/rules/definition-of-done.md +1 -0
- package/.cursor/rules/no-emoticons.md +26 -12
- package/README.md +483 -69
- package/dist/agentic/executor.js +473 -41
- package/dist/agentic/executor.js.map +1 -1
- package/dist/agentic/index.js.map +1 -1
- package/dist/agentic/tools/lookup-person.js +123 -4
- package/dist/agentic/tools/lookup-person.js.map +1 -1
- package/dist/agentic/tools/lookup-project.js +139 -22
- package/dist/agentic/tools/lookup-project.js.map +1 -1
- package/dist/agentic/tools/route-note.js +5 -1
- package/dist/agentic/tools/route-note.js.map +1 -1
- package/dist/arguments.js +6 -3
- package/dist/arguments.js.map +1 -1
- package/dist/cli/action.js +704 -0
- package/dist/cli/action.js.map +1 -0
- package/dist/cli/config.js +482 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/context.js +466 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/feedback.js +858 -0
- package/dist/cli/feedback.js.map +1 -0
- package/dist/cli/index.js +103 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/install.js +572 -0
- package/dist/cli/install.js.map +1 -0
- package/dist/cli/transcript.js +199 -0
- package/dist/cli/transcript.js.map +1 -0
- package/dist/constants.js +11 -4
- package/dist/constants.js.map +1 -1
- package/dist/context/index.js +25 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/storage.js +56 -3
- package/dist/context/storage.js.map +1 -1
- package/dist/interactive/handler.js +310 -9
- package/dist/interactive/handler.js.map +1 -1
- package/dist/main.js +11 -1
- package/dist/main.js.map +1 -1
- package/dist/output/index.js.map +1 -1
- package/dist/output/manager.js +46 -1
- package/dist/output/manager.js.map +1 -1
- package/dist/phases/complete.js +37 -2
- package/dist/phases/complete.js.map +1 -1
- package/dist/pipeline/orchestrator.js +104 -31
- package/dist/pipeline/orchestrator.js.map +1 -1
- package/dist/protokoll.js +68 -2
- package/dist/protokoll.js.map +1 -1
- package/dist/reasoning/client.js +83 -0
- package/dist/reasoning/client.js.map +1 -1
- package/dist/reasoning/index.js +1 -0
- package/dist/reasoning/index.js.map +1 -1
- package/dist/util/metadata.js.map +1 -1
- package/dist/util/sound.js +116 -0
- package/dist/util/sound.js.map +1 -0
- package/docs/duplicate-question-prevention.md +117 -0
- package/docs/examples.md +152 -0
- package/docs/interactive-context-example.md +92 -0
- package/docs/package-lock.json +6 -0
- package/docs/package.json +3 -1
- package/guide/action.md +375 -0
- package/guide/config.md +207 -0
- package/guide/configuration.md +82 -67
- package/guide/context-commands.md +574 -0
- package/guide/context-system.md +20 -7
- package/guide/development.md +106 -4
- package/guide/feedback.md +335 -0
- package/guide/index.md +100 -4
- package/guide/interactive.md +15 -14
- package/guide/quickstart.md +21 -7
- package/guide/reasoning.md +18 -4
- package/guide/routing.md +192 -97
- package/package.json +1 -1
- package/scripts/coverage-priority.mjs +323 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/vitest.config.ts +5 -1
|
@@ -20,25 +20,47 @@ const create = async (config)=>{
|
|
|
20
20
|
startingDir: config.contextDirectory || currentWorkingDir
|
|
21
21
|
});
|
|
22
22
|
logger.debug('Context system initialized - ready to query entities via tools');
|
|
23
|
+
// Default routing configuration (used as fallback for projects without custom destination)
|
|
24
|
+
const defaultPath = config.outputDirectory || '~/notes';
|
|
25
|
+
const defaultStructure = config.outputStructure || 'month';
|
|
26
|
+
const defaultFilenameOptions = config.outputFilenameOptions || [
|
|
27
|
+
'date',
|
|
28
|
+
'time',
|
|
29
|
+
'subject'
|
|
30
|
+
];
|
|
31
|
+
// Convert context projects to routing format
|
|
32
|
+
// Projects without a destination inherit from the global default
|
|
33
|
+
const contextProjects = context.getAllProjects();
|
|
34
|
+
const routingProjects = contextProjects.filter((project)=>project.active !== false).map((project)=>({
|
|
35
|
+
projectId: project.id,
|
|
36
|
+
destination: {
|
|
37
|
+
path: project.routing.destination || defaultPath,
|
|
38
|
+
structure: project.routing.structure,
|
|
39
|
+
filename_options: project.routing.filename_options,
|
|
40
|
+
createDirectories: true
|
|
41
|
+
},
|
|
42
|
+
classification: project.classification,
|
|
43
|
+
active: project.active,
|
|
44
|
+
auto_tags: project.routing.auto_tags
|
|
45
|
+
}));
|
|
46
|
+
logger.debug('Loaded %d projects from context for routing', routingProjects.length);
|
|
23
47
|
// Initialize routing with config-based defaults
|
|
24
48
|
const routingConfig = {
|
|
25
49
|
default: {
|
|
26
|
-
path:
|
|
27
|
-
structure:
|
|
28
|
-
filename_options:
|
|
29
|
-
'date',
|
|
30
|
-
'time',
|
|
31
|
-
'subject'
|
|
32
|
-
],
|
|
50
|
+
path: defaultPath,
|
|
51
|
+
structure: defaultStructure,
|
|
52
|
+
filename_options: defaultFilenameOptions,
|
|
33
53
|
createDirectories: true
|
|
34
54
|
},
|
|
35
|
-
projects:
|
|
55
|
+
projects: routingProjects,
|
|
36
56
|
conflict_resolution: 'primary'
|
|
37
57
|
};
|
|
38
58
|
const routing = create$2(routingConfig, context);
|
|
39
59
|
logger.debug('Routing system initialized');
|
|
40
60
|
const interactive = create$6({
|
|
41
|
-
enabled: config.interactive
|
|
61
|
+
enabled: config.interactive,
|
|
62
|
+
silent: config.silent
|
|
63
|
+
}, context);
|
|
42
64
|
const output = create$7({
|
|
43
65
|
intermediateDir: config.intermediateDir || './output/protokoll',
|
|
44
66
|
keepIntermediates: (_config_keepIntermediates = config.keepIntermediates) !== null && _config_keepIntermediates !== void 0 ? _config_keepIntermediates : true});
|
|
@@ -54,9 +76,10 @@ const create = async (config)=>{
|
|
|
54
76
|
logger.debug('Transcription service initialized with model: %s', config.transcriptionModel);
|
|
55
77
|
// Initialize reasoning for agentic processing
|
|
56
78
|
const reasoning = create$9({
|
|
57
|
-
model: config.model
|
|
79
|
+
model: config.model,
|
|
80
|
+
reasoningLevel: config.reasoningLevel
|
|
58
81
|
});
|
|
59
|
-
logger.debug('Reasoning system initialized with model: %s', config.model);
|
|
82
|
+
logger.debug('Reasoning system initialized with model: %s, reasoning level: %s', config.model, config.reasoningLevel || 'medium');
|
|
60
83
|
// Initialize complete phase for moving files to processed directory
|
|
61
84
|
// Pass outputStructure so processed files use the same directory structure as output
|
|
62
85
|
const complete = config.processedDirectory ? create$4({
|
|
@@ -80,7 +103,17 @@ const create = async (config)=>{
|
|
|
80
103
|
};
|
|
81
104
|
const processInput = async (input)=>{
|
|
82
105
|
const startTime = Date.now();
|
|
83
|
-
|
|
106
|
+
// Format progress prefix for log messages
|
|
107
|
+
const progressPrefix = input.progress ? `[${input.progress.current}/${input.progress.total}]` : '';
|
|
108
|
+
const log = (level, message, ...args)=>{
|
|
109
|
+
const prefixedMessage = progressPrefix ? `${progressPrefix} ${message}` : message;
|
|
110
|
+
if (level === 'info') {
|
|
111
|
+
logger.info(prefixedMessage, ...args);
|
|
112
|
+
} else {
|
|
113
|
+
logger.debug(prefixedMessage, ...args);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
log('info', 'Processing: %s (hash: %s)', input.audioFile, input.hash);
|
|
84
117
|
// Initialize state
|
|
85
118
|
const state = {
|
|
86
119
|
input,
|
|
@@ -93,29 +126,30 @@ const create = async (config)=>{
|
|
|
93
126
|
// Start interactive session if enabled
|
|
94
127
|
if (config.interactive) {
|
|
95
128
|
interactive.startSession();
|
|
96
|
-
|
|
129
|
+
log('debug', 'Interactive session started');
|
|
97
130
|
}
|
|
98
131
|
try {
|
|
132
|
+
var _agenticResult_state_routeDecision_destination, _agenticResult_state_routeDecision;
|
|
99
133
|
// Step 1: Check onboarding needs
|
|
100
|
-
|
|
134
|
+
log('debug', 'Checking onboarding state...');
|
|
101
135
|
const onboardingState = interactive.checkNeedsOnboarding();
|
|
102
136
|
if (onboardingState.needsOnboarding) {
|
|
103
|
-
|
|
137
|
+
log('debug', 'First-run detected - onboarding may be triggered');
|
|
104
138
|
}
|
|
105
139
|
// Step 2: Raw transcription using Transcription module
|
|
106
|
-
|
|
140
|
+
log('info', 'Transcribing audio...');
|
|
107
141
|
const whisperStart = Date.now();
|
|
108
142
|
const transcriptionResult = await transcription.transcribe(input.audioFile, {
|
|
109
143
|
model: config.transcriptionModel
|
|
110
144
|
});
|
|
111
145
|
state.rawTranscript = transcriptionResult.text;
|
|
112
146
|
const whisperDuration = Date.now() - whisperStart;
|
|
113
|
-
|
|
147
|
+
log('info', 'Transcription: %d chars in %.1fs', state.rawTranscript.length, whisperDuration / 1000);
|
|
114
148
|
if (reflection) {
|
|
115
149
|
reflection.collector.recordWhisper(whisperDuration);
|
|
116
150
|
}
|
|
117
151
|
// Step 3: Route detection
|
|
118
|
-
|
|
152
|
+
log('debug', 'Determining routing destination...');
|
|
119
153
|
const routingContext = {
|
|
120
154
|
transcriptText: state.rawTranscript || '',
|
|
121
155
|
audioDate: input.creation,
|
|
@@ -123,7 +157,7 @@ const create = async (config)=>{
|
|
|
123
157
|
hash: input.hash
|
|
124
158
|
};
|
|
125
159
|
const routeResult = routing.route(routingContext);
|
|
126
|
-
|
|
160
|
+
log('debug', 'Routing decision: project=%s, confidence=%.2f', routeResult.projectId || 'default', routeResult.confidence);
|
|
127
161
|
// Record routing decision in reflection
|
|
128
162
|
if (reflection) {
|
|
129
163
|
var _routeResult_alternateMatches;
|
|
@@ -146,19 +180,19 @@ const create = async (config)=>{
|
|
|
146
180
|
}
|
|
147
181
|
// Build output path
|
|
148
182
|
const outputPath = routing.buildOutputPath(routeResult, routingContext);
|
|
149
|
-
|
|
183
|
+
log('debug', 'Output path: %s', outputPath);
|
|
150
184
|
// Step 4: Create output paths using Output module
|
|
151
|
-
|
|
185
|
+
log('debug', 'Setting up output directories...');
|
|
152
186
|
const paths = output.createOutputPaths(input.audioFile, outputPath, input.hash, input.creation);
|
|
153
187
|
await output.ensureDirectories(paths);
|
|
154
|
-
// Write raw transcript to intermediate
|
|
188
|
+
// Write raw transcript to intermediate (for debugging)
|
|
155
189
|
await output.writeIntermediate(paths, 'transcript', {
|
|
156
190
|
text: state.rawTranscript,
|
|
157
191
|
model: config.transcriptionModel,
|
|
158
192
|
duration: whisperDuration
|
|
159
193
|
});
|
|
160
194
|
// Step 5: Agentic enhancement using real executor
|
|
161
|
-
|
|
195
|
+
log('info', 'Enhancing with %s...', config.model);
|
|
162
196
|
const agenticStart = Date.now();
|
|
163
197
|
const toolContext = {
|
|
164
198
|
transcriptText: state.rawTranscript || '',
|
|
@@ -167,7 +201,8 @@ const create = async (config)=>{
|
|
|
167
201
|
contextInstance: context,
|
|
168
202
|
routingInstance: routing,
|
|
169
203
|
interactiveMode: config.interactive,
|
|
170
|
-
|
|
204
|
+
// Always pass interactive handler - it will handle enabled/disabled internally
|
|
205
|
+
interactiveInstance: interactive
|
|
171
206
|
};
|
|
172
207
|
const executor = create$8(reasoning, toolContext);
|
|
173
208
|
const agenticResult = await executor.process(state.rawTranscript || '');
|
|
@@ -197,8 +232,46 @@ const create = async (config)=>{
|
|
|
197
232
|
toolsUsed: agenticResult.toolsUsed,
|
|
198
233
|
state: agenticResult.state
|
|
199
234
|
});
|
|
235
|
+
// Step 5b: Check if agentic processing found a different route
|
|
236
|
+
// (e.g., via lookup_project tool finding a project with custom destination)
|
|
237
|
+
if ((_agenticResult_state_routeDecision = agenticResult.state.routeDecision) === null || _agenticResult_state_routeDecision === void 0 ? void 0 : (_agenticResult_state_routeDecision_destination = _agenticResult_state_routeDecision.destination) === null || _agenticResult_state_routeDecision_destination === void 0 ? void 0 : _agenticResult_state_routeDecision_destination.path) {
|
|
238
|
+
const agenticRoute = agenticResult.state.routeDecision;
|
|
239
|
+
log('debug', 'Agentic processing found route: %s -> %s', agenticRoute.projectId || 'unknown', agenticRoute.destination.path);
|
|
240
|
+
// Update routeResult with the agentic decision
|
|
241
|
+
routeResult.projectId = agenticRoute.projectId || routeResult.projectId;
|
|
242
|
+
routeResult.destination = {
|
|
243
|
+
...routeResult.destination,
|
|
244
|
+
path: agenticRoute.destination.path,
|
|
245
|
+
structure: agenticRoute.destination.structure || routeResult.destination.structure
|
|
246
|
+
};
|
|
247
|
+
routeResult.confidence = agenticRoute.confidence || routeResult.confidence;
|
|
248
|
+
routeResult.reasoning = agenticRoute.reasoning || routeResult.reasoning;
|
|
249
|
+
if (agenticRoute.signals) {
|
|
250
|
+
routeResult.signals = agenticRoute.signals;
|
|
251
|
+
}
|
|
252
|
+
// Rebuild output path with the new destination
|
|
253
|
+
const newOutputPath = routing.buildOutputPath(routeResult, routingContext);
|
|
254
|
+
log('debug', 'Updated output path: %s -> %s', outputPath, newOutputPath);
|
|
255
|
+
// Recreate output paths with new destination
|
|
256
|
+
const newPaths = output.createOutputPaths(input.audioFile, newOutputPath, input.hash, input.creation);
|
|
257
|
+
await output.ensureDirectories(newPaths);
|
|
258
|
+
// Update paths reference (reassign properties since paths is const)
|
|
259
|
+
Object.assign(paths, newPaths);
|
|
260
|
+
}
|
|
261
|
+
// Step 5c: Write raw transcript to .transcript/ directory alongside final output
|
|
262
|
+
// This is done AFTER the route is finalized so it goes to the correct location
|
|
263
|
+
// Enables compare and reanalyze workflows
|
|
264
|
+
log('debug', 'Writing raw transcript to .transcript/ directory...');
|
|
265
|
+
await output.writeRawTranscript(paths, {
|
|
266
|
+
text: state.rawTranscript,
|
|
267
|
+
model: config.transcriptionModel,
|
|
268
|
+
duration: whisperDuration,
|
|
269
|
+
audioFile: input.audioFile,
|
|
270
|
+
audioHash: input.hash,
|
|
271
|
+
transcribedAt: new Date().toISOString()
|
|
272
|
+
});
|
|
200
273
|
// Step 6: Write final output using Output module with metadata
|
|
201
|
-
|
|
274
|
+
log('debug', 'Writing final transcript...');
|
|
202
275
|
if (state.enhancedText) {
|
|
203
276
|
// Build metadata from routing decision and input
|
|
204
277
|
const transcriptMetadata = {
|
|
@@ -213,7 +286,7 @@ const create = async (config)=>{
|
|
|
213
286
|
await output.writeTranscript(paths, state.enhancedText, transcriptMetadata);
|
|
214
287
|
}
|
|
215
288
|
// Step 7: Generate reflection report
|
|
216
|
-
|
|
289
|
+
log('debug', 'Generating reflection report...');
|
|
217
290
|
let reflectionReport;
|
|
218
291
|
if (reflection) {
|
|
219
292
|
reflectionReport = reflection.generate(input.audioFile, paths.final, undefined, state.enhancedText);
|
|
@@ -222,11 +295,11 @@ const create = async (config)=>{
|
|
|
222
295
|
}
|
|
223
296
|
}
|
|
224
297
|
// Step 8: End interactive session
|
|
225
|
-
|
|
298
|
+
log('debug', 'Finalizing session...');
|
|
226
299
|
let session;
|
|
227
300
|
if (config.interactive) {
|
|
228
301
|
session = interactive.endSession();
|
|
229
|
-
|
|
302
|
+
log('debug', 'Interactive session ended: %d clarifications', session.responses.length);
|
|
230
303
|
// Save session if path available
|
|
231
304
|
if (paths.intermediate.session) {
|
|
232
305
|
await output.writeIntermediate(paths, 'session', session);
|
|
@@ -246,11 +319,11 @@ const create = async (config)=>{
|
|
|
246
319
|
}
|
|
247
320
|
const processingTime = Date.now() - startTime;
|
|
248
321
|
// Compact summary output
|
|
249
|
-
|
|
322
|
+
log('info', 'Enhancement: %d iterations, %d tools, %.1fs', agenticResult.iterations, toolsUsed.length, agenticDuration / 1000);
|
|
250
323
|
if (agenticResult.totalTokens) {
|
|
251
|
-
|
|
324
|
+
log('info', 'Tokens: %d total', agenticResult.totalTokens);
|
|
252
325
|
}
|
|
253
|
-
|
|
326
|
+
log('info', 'Output: %s (%.1fs total)', paths.final, processingTime / 1000);
|
|
254
327
|
return {
|
|
255
328
|
outputPath: paths.final,
|
|
256
329
|
enhancedText: state.enhancedText || '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.js","sources":["../../src/pipeline/orchestrator.ts"],"sourcesContent":["/**\n * Pipeline Orchestrator\n *\n * Orchestrates the intelligent transcription pipeline, coordinating\n * all the modules: context, routing, transcription, reasoning,\n * agentic tools, interactive mode, output management, and reflection.\n * \n * THIS IS THE MAIN PROCESSING FLOW - NOT DEAD CODE!\n */\n\nimport { PipelineConfig, PipelineInput, PipelineResult, PipelineState } from './types';\nimport * as Context from '../context';\nimport * as Routing from '../routing';\nimport * as Interactive from '../interactive';\nimport * as Output from '../output';\nimport * as Reflection from '../reflection';\nimport * as Transcription from '../transcription';\nimport * as Reasoning from '../reasoning';\nimport * as Agentic from '../agentic';\nimport * as CompletePhase from '../phases/complete';\nimport * as Logging from '../logging';\nimport * as Metadata from '../util/metadata';\n\nexport interface OrchestratorInstance {\n process(input: PipelineInput): Promise<PipelineResult>;\n}\n\nexport interface OrchestratorConfig extends PipelineConfig {\n outputDirectory: string;\n outputStructure: string;\n outputFilenameOptions: string[];\n maxAudioSize: number;\n tempDirectory: string;\n}\n\nexport const create = async (config: OrchestratorConfig): Promise<OrchestratorInstance> => {\n const logger = Logging.getLogger();\n const currentWorkingDir = globalThis.process.cwd();\n \n logger.debug('Initializing intelligent transcription pipeline...');\n \n // Initialize context system (async)\n const context = await Context.create({\n startingDir: config.contextDirectory || currentWorkingDir,\n });\n logger.debug('Context system initialized - ready to query entities via tools');\n \n // Initialize routing with config-based defaults\n const routingConfig: Routing.RoutingConfig = {\n default: {\n path: config.outputDirectory || '~/notes',\n structure: (config.outputStructure || 'month') as Routing.FilesystemStructure,\n filename_options: (config.outputFilenameOptions || ['date', 'time', 'subject']) as Routing.FilenameOption[],\n createDirectories: true,\n },\n projects: [],\n conflict_resolution: 'primary',\n };\n \n const routing = Routing.create(routingConfig, context);\n logger.debug('Routing system initialized');\n \n const interactive = Interactive.create(\n { enabled: config.interactive, defaultToSuggestion: true },\n context\n );\n \n const output = Output.create({\n intermediateDir: config.intermediateDir || './output/protokoll',\n keepIntermediates: config.keepIntermediates ?? true,\n timestampFormat: 'YYMMDD-HHmm',\n });\n logger.debug('Output manager initialized');\n \n const reflection = config.selfReflection \n ? Reflection.create({\n enabled: true,\n format: 'markdown',\n includeConversation: false,\n includeOutput: true,\n })\n : null;\n if (reflection) {\n logger.debug('Self-reflection system enabled');\n }\n \n // Initialize transcription service\n const transcription = Transcription.create({\n defaultModel: config.transcriptionModel as Transcription.TranscriptionModel,\n });\n logger.debug('Transcription service initialized with model: %s', config.transcriptionModel);\n \n // Initialize reasoning for agentic processing\n const reasoning = Reasoning.create({ model: config.model });\n logger.debug('Reasoning system initialized with model: %s', config.model);\n\n // Initialize complete phase for moving files to processed directory\n // Pass outputStructure so processed files use the same directory structure as output\n const complete = config.processedDirectory \n ? CompletePhase.create({\n processedDirectory: config.processedDirectory,\n outputStructure: config.outputStructure as CompletePhase.FilesystemStructure,\n dryRun: config.dryRun,\n })\n : null;\n if (complete) {\n logger.debug('Complete phase initialized with processed directory: %s', config.processedDirectory);\n }\n \n // Helper to extract a human-readable title from the output path\n const extractTitleFromPath = (outputPath: string): string | undefined => {\n const filename = outputPath.split('/').pop()?.replace('.md', '');\n if (!filename) return undefined;\n \n // Remove date prefix (e.g., \"27-0716-\" from \"27-0716-meeting-notes\")\n const withoutDate = filename.replace(/^\\d{2}-\\d{4}-/, '');\n if (!withoutDate) return undefined;\n \n // Convert kebab-case to Title Case\n return withoutDate\n .split('-')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n };\n\n const processInput = async (input: PipelineInput): Promise<PipelineResult> => {\n const startTime = Date.now();\n \n logger.info('Processing: %s (hash: %s)', input.audioFile, input.hash);\n \n // Initialize state\n const state: PipelineState = {\n input,\n startTime: new Date(),\n };\n \n // Start reflection collection if enabled\n if (reflection) {\n reflection.collector.start();\n }\n \n // Start interactive session if enabled\n if (config.interactive) {\n interactive.startSession();\n logger.debug('Interactive session started');\n }\n \n try {\n // Step 1: Check onboarding needs\n logger.debug('Checking onboarding state...');\n const onboardingState = interactive.checkNeedsOnboarding();\n if (onboardingState.needsOnboarding) {\n logger.debug('First-run detected - onboarding may be triggered');\n }\n \n // Step 2: Raw transcription using Transcription module\n logger.info('Transcribing audio...');\n const whisperStart = Date.now();\n \n const transcriptionResult = await transcription.transcribe(input.audioFile, {\n model: config.transcriptionModel as Transcription.TranscriptionModel,\n });\n state.rawTranscript = transcriptionResult.text;\n \n const whisperDuration = Date.now() - whisperStart;\n logger.info('Transcription: %d chars in %.1fs', \n state.rawTranscript.length, whisperDuration / 1000);\n \n if (reflection) {\n reflection.collector.recordWhisper(whisperDuration);\n }\n \n // Step 3: Route detection\n logger.debug('Determining routing destination...');\n const routingContext: Routing.RoutingContext = {\n transcriptText: state.rawTranscript || '',\n audioDate: input.creation,\n sourceFile: input.audioFile,\n hash: input.hash,\n };\n \n const routeResult = routing.route(routingContext);\n \n logger.debug('Routing decision: project=%s, confidence=%.2f', \n routeResult.projectId || 'default', routeResult.confidence);\n \n // Record routing decision in reflection\n if (reflection) {\n reflection.collector.recordRoutingDecision({\n projectId: routeResult.projectId,\n destination: routeResult.destination.path,\n confidence: routeResult.confidence,\n reasoning: routeResult.reasoning,\n signals: routeResult.signals.map(s => ({\n type: s.type,\n value: s.value,\n weight: s.weight,\n })),\n alternativesConsidered: routeResult.alternateMatches?.map(alt => ({\n projectId: alt.projectId,\n confidence: alt.confidence,\n whyNotChosen: `Lower confidence (${(alt.confidence * 100).toFixed(1)}%)`,\n })),\n });\n }\n \n // Build output path\n const outputPath = routing.buildOutputPath(routeResult, routingContext);\n logger.debug('Output path: %s', outputPath);\n \n // Step 4: Create output paths using Output module\n logger.debug('Setting up output directories...');\n const paths = output.createOutputPaths(\n input.audioFile,\n outputPath,\n input.hash,\n input.creation\n );\n \n await output.ensureDirectories(paths);\n \n // Write raw transcript to intermediate\n await output.writeIntermediate(paths, 'transcript', {\n text: state.rawTranscript,\n model: config.transcriptionModel,\n duration: whisperDuration,\n });\n \n // Step 5: Agentic enhancement using real executor\n logger.info('Enhancing with %s...', config.model);\n \n const agenticStart = Date.now();\n const toolContext: Agentic.ToolContext = {\n transcriptText: state.rawTranscript || '',\n audioDate: input.creation,\n sourceFile: input.audioFile,\n contextInstance: context,\n routingInstance: routing,\n interactiveMode: config.interactive,\n interactiveInstance: config.interactive ? interactive : undefined,\n };\n \n const executor = Agentic.create(reasoning, toolContext);\n const agenticResult = await executor.process(state.rawTranscript || '');\n \n state.enhancedText = agenticResult.enhancedText;\n const toolsUsed = agenticResult.toolsUsed;\n const agenticDuration = Date.now() - agenticStart;\n \n // Record tool calls in reflection\n if (reflection) {\n for (const tool of toolsUsed) {\n reflection.collector.recordToolCall(tool, agenticDuration / toolsUsed.length, true);\n }\n reflection.collector.recordCorrection(state.rawTranscript || '', state.enhancedText);\n // Record token usage from agentic result\n if (agenticResult.totalTokens) {\n reflection.collector.recordModelResponse(config.model, agenticResult.totalTokens);\n }\n // Record context changes (new projects, entities created)\n if (agenticResult.contextChanges) {\n for (const change of agenticResult.contextChanges) {\n reflection.collector.recordContextChange(change);\n }\n }\n }\n \n // Write agentic session to intermediate\n await output.writeIntermediate(paths, 'session', {\n iterations: agenticResult.iterations,\n toolsUsed: agenticResult.toolsUsed,\n state: agenticResult.state,\n });\n \n // Step 6: Write final output using Output module with metadata\n logger.debug('Writing final transcript...');\n if (state.enhancedText) {\n // Build metadata from routing decision and input\n const transcriptMetadata: Metadata.TranscriptMetadata = {\n title: extractTitleFromPath(paths.final),\n projectId: routeResult.projectId || undefined,\n project: routeResult.projectId || undefined,\n date: input.creation,\n routing: Metadata.createRoutingMetadata(routeResult),\n tags: Metadata.extractTagsFromSignals(routeResult.signals),\n confidence: routeResult.confidence,\n };\n \n await output.writeTranscript(paths, state.enhancedText, transcriptMetadata);\n }\n \n // Step 7: Generate reflection report\n logger.debug('Generating reflection report...');\n let reflectionReport: Reflection.ReflectionReport | undefined;\n if (reflection) {\n reflectionReport = reflection.generate(\n input.audioFile,\n paths.final,\n undefined,\n state.enhancedText\n );\n \n if (paths.intermediate.reflection) {\n await reflection.save(reflectionReport, paths.intermediate.reflection);\n }\n }\n \n // Step 8: End interactive session\n logger.debug('Finalizing session...');\n let session: Interactive.InteractiveSession | undefined;\n if (config.interactive) {\n session = interactive.endSession();\n logger.debug('Interactive session ended: %d clarifications', session.responses.length);\n \n // Save session if path available\n if (paths.intermediate.session) {\n await output.writeIntermediate(paths, 'session', session);\n }\n }\n \n // Step 9: Cleanup if needed\n if (!config.keepIntermediates && !config.debug) {\n await output.cleanIntermediates(paths);\n }\n\n // Step 10: Move audio file to processed directory\n let processedAudioPath: string | undefined;\n if (complete) {\n // Extract subject from output path for naming\n const subject = paths.final.split('/').pop()?.replace('.md', '') || undefined;\n processedAudioPath = await complete.complete(\n input.audioFile, \n input.hash, \n input.creation,\n subject\n );\n }\n \n const processingTime = Date.now() - startTime;\n \n // Compact summary output\n logger.info('Enhancement: %d iterations, %d tools, %.1fs', \n agenticResult.iterations, toolsUsed.length, agenticDuration / 1000);\n if (agenticResult.totalTokens) {\n logger.info('Tokens: %d total', agenticResult.totalTokens);\n }\n logger.info('Output: %s (%.1fs total)', paths.final, processingTime / 1000);\n \n return {\n outputPath: paths.final,\n enhancedText: state.enhancedText || '',\n rawTranscript: state.rawTranscript || '',\n routedProject: routeResult.projectId,\n routingConfidence: routeResult.confidence,\n processingTime,\n toolsUsed,\n correctionsApplied: agenticResult.state.resolvedEntities.size,\n processedAudioPath,\n reflection: reflectionReport,\n session,\n intermediatePaths: paths,\n };\n \n } catch (error) {\n logger.error('Pipeline error', { error });\n throw error;\n }\n };\n \n return { process: processInput };\n};\n"],"names":["create","config","logger","Logging","currentWorkingDir","globalThis","process","cwd","debug","context","Context","startingDir","contextDirectory","routingConfig","default","path","outputDirectory","structure","outputStructure","filename_options","outputFilenameOptions","createDirectories","projects","conflict_resolution","routing","Routing","interactive","Interactive","enabled","output","Output","intermediateDir","keepIntermediates","reflection","selfReflection","Reflection","transcription","Transcription","defaultModel","transcriptionModel","reasoning","Reasoning","model","complete","processedDirectory","CompletePhase","dryRun","extractTitleFromPath","outputPath","filename","split","pop","replace","undefined","withoutDate","map","word","charAt","toUpperCase","slice","join","processInput","input","startTime","Date","now","info","audioFile","hash","state","collector","start","startSession","onboardingState","checkNeedsOnboarding","needsOnboarding","whisperStart","transcriptionResult","transcribe","rawTranscript","text","whisperDuration","length","recordWhisper","routingContext","transcriptText","audioDate","creation","sourceFile","routeResult","route","projectId","confidence","recordRoutingDecision","destination","signals","s","type","value","weight","alternativesConsidered","alternateMatches","alt","whyNotChosen","toFixed","buildOutputPath","paths","createOutputPaths","ensureDirectories","writeIntermediate","duration","agenticStart","toolContext","contextInstance","routingInstance","interactiveMode","interactiveInstance","executor","Agentic","agenticResult","enhancedText","toolsUsed","agenticDuration","tool","recordToolCall","recordCorrection","totalTokens","recordModelResponse","contextChanges","change","recordContextChange","iterations","transcriptMetadata","title","final","project","date","Metadata","tags","writeTranscript","reflectionReport","generate","intermediate","save","session","endSession","responses","cleanIntermediates","processedAudioPath","subject","processingTime","routedProject","routingConfidence","correctionsApplied","resolvedEntities","size","intermediatePaths","error"],"mappings":";;;;;;;;;;;;AAmCO,MAAMA,SAAS,OAAOC,MAAAA,GAAAA;AAkCFA,IAAAA,IAAAA,yBAAAA;IAjCvB,MAAMC,MAAAA,GAASC,SAAiB,EAAA;AAChC,IAAA,MAAMC,iBAAAA,GAAoBC,UAAAA,CAAWC,OAAO,CAACC,GAAG,EAAA;AAEhDL,IAAAA,MAAAA,CAAOM,KAAK,CAAC,oDAAA,CAAA;;AAGb,IAAA,MAAMC,OAAAA,GAAU,MAAMC,QAAc,CAAC;QACjCC,WAAAA,EAAaV,MAAAA,CAAOW,gBAAgB,IAAIR;AAC5C,KAAA,CAAA;AACAF,IAAAA,MAAAA,CAAOM,KAAK,CAAC,gEAAA,CAAA;;AAGb,IAAA,MAAMK,aAAAA,GAAuC;QACzCC,OAAAA,EAAS;YACLC,IAAAA,EAAMd,MAAAA,CAAOe,eAAe,IAAI,SAAA;YAChCC,SAAAA,EAAYhB,MAAAA,CAAOiB,eAAe,IAAI,OAAA;YACtCC,gBAAAA,EAAmBlB,MAAAA,CAAOmB,qBAAqB,IAAI;AAAC,gBAAA,MAAA;AAAQ,gBAAA,MAAA;AAAQ,gBAAA;AAAU,aAAA;YAC9EC,iBAAAA,EAAmB;AACvB,SAAA;AACAC,QAAAA,QAAAA,EAAU,EAAE;QACZC,mBAAAA,EAAqB;A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\n *\n * Orchestrates the intelligent transcription pipeline, coordinating\n * all the modules: context, routing, transcription, reasoning,\n * agentic tools, interactive mode, output management, and reflection.\n * \n * THIS IS THE MAIN PROCESSING FLOW - NOT DEAD CODE!\n */\n\nimport { PipelineConfig, PipelineInput, PipelineResult, PipelineState } from './types';\nimport * as Context from '../context';\nimport * as Routing from '../routing';\nimport * as Interactive from '../interactive';\nimport * as Output from '../output';\nimport * as Reflection from '../reflection';\nimport * as Transcription from '../transcription';\nimport * as Reasoning from '../reasoning';\nimport * as Agentic from '../agentic';\nimport * as CompletePhase from '../phases/complete';\nimport * as Logging from '../logging';\nimport * as Metadata from '../util/metadata';\n\nexport interface OrchestratorInstance {\n process(input: PipelineInput): Promise<PipelineResult>;\n}\n\nexport interface OrchestratorConfig extends PipelineConfig {\n outputDirectory: string;\n outputStructure: string;\n outputFilenameOptions: string[];\n maxAudioSize: number;\n tempDirectory: string;\n}\n\nexport const create = async (config: OrchestratorConfig): Promise<OrchestratorInstance> => {\n const logger = Logging.getLogger();\n const currentWorkingDir = globalThis.process.cwd();\n \n logger.debug('Initializing intelligent transcription pipeline...');\n \n // Initialize context system (async)\n const context = await Context.create({\n startingDir: config.contextDirectory || currentWorkingDir,\n });\n logger.debug('Context system initialized - ready to query entities via tools');\n \n // Default routing configuration (used as fallback for projects without custom destination)\n const defaultPath = config.outputDirectory || '~/notes';\n const defaultStructure = (config.outputStructure || 'month') as Routing.FilesystemStructure;\n const defaultFilenameOptions = (config.outputFilenameOptions || ['date', 'time', 'subject']) as Routing.FilenameOption[];\n\n // Convert context projects to routing format\n // Projects without a destination inherit from the global default\n const contextProjects = context.getAllProjects();\n const routingProjects: Routing.ProjectRoute[] = contextProjects\n .filter(project => project.active !== false)\n .map(project => ({\n projectId: project.id,\n destination: {\n path: project.routing.destination || defaultPath,\n structure: project.routing.structure,\n filename_options: project.routing.filename_options,\n createDirectories: true,\n },\n classification: project.classification,\n active: project.active,\n auto_tags: project.routing.auto_tags,\n }));\n \n logger.debug('Loaded %d projects from context for routing', routingProjects.length);\n \n // Initialize routing with config-based defaults\n const routingConfig: Routing.RoutingConfig = {\n default: {\n path: defaultPath,\n structure: defaultStructure,\n filename_options: defaultFilenameOptions,\n createDirectories: true,\n },\n projects: routingProjects,\n conflict_resolution: 'primary',\n };\n \n const routing = Routing.create(routingConfig, context);\n logger.debug('Routing system initialized');\n \n const interactive = Interactive.create(\n { enabled: config.interactive, defaultToSuggestion: true, silent: config.silent },\n context\n );\n \n const output = Output.create({\n intermediateDir: config.intermediateDir || './output/protokoll',\n keepIntermediates: config.keepIntermediates ?? true,\n timestampFormat: 'YYMMDD-HHmm',\n });\n logger.debug('Output manager initialized');\n \n const reflection = config.selfReflection \n ? Reflection.create({\n enabled: true,\n format: 'markdown',\n includeConversation: false,\n includeOutput: true,\n })\n : null;\n if (reflection) {\n logger.debug('Self-reflection system enabled');\n }\n \n // Initialize transcription service\n const transcription = Transcription.create({\n defaultModel: config.transcriptionModel as Transcription.TranscriptionModel,\n });\n logger.debug('Transcription service initialized with model: %s', config.transcriptionModel);\n \n // Initialize reasoning for agentic processing\n const reasoning = Reasoning.create({ \n model: config.model,\n reasoningLevel: config.reasoningLevel,\n });\n logger.debug('Reasoning system initialized with model: %s, reasoning level: %s', config.model, config.reasoningLevel || 'medium');\n\n // Initialize complete phase for moving files to processed directory\n // Pass outputStructure so processed files use the same directory structure as output\n const complete = config.processedDirectory \n ? CompletePhase.create({\n processedDirectory: config.processedDirectory,\n outputStructure: config.outputStructure as CompletePhase.FilesystemStructure,\n dryRun: config.dryRun,\n })\n : null;\n if (complete) {\n logger.debug('Complete phase initialized with processed directory: %s', config.processedDirectory);\n }\n \n // Helper to extract a human-readable title from the output path\n const extractTitleFromPath = (outputPath: string): string | undefined => {\n const filename = outputPath.split('/').pop()?.replace('.md', '');\n if (!filename) return undefined;\n \n // Remove date prefix (e.g., \"27-0716-\" from \"27-0716-meeting-notes\")\n const withoutDate = filename.replace(/^\\d{2}-\\d{4}-/, '');\n if (!withoutDate) return undefined;\n \n // Convert kebab-case to Title Case\n return withoutDate\n .split('-')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n };\n\n const processInput = async (input: PipelineInput): Promise<PipelineResult> => {\n const startTime = Date.now();\n \n // Format progress prefix for log messages\n const progressPrefix = input.progress \n ? `[${input.progress.current}/${input.progress.total}]` \n : '';\n const log = (level: 'info' | 'debug', message: string, ...args: unknown[]) => {\n const prefixedMessage = progressPrefix ? `${progressPrefix} ${message}` : message;\n if (level === 'info') {\n logger.info(prefixedMessage, ...args);\n } else {\n logger.debug(prefixedMessage, ...args);\n }\n };\n \n log('info', 'Processing: %s (hash: %s)', input.audioFile, input.hash);\n \n // Initialize state\n const state: PipelineState = {\n input,\n startTime: new Date(),\n };\n \n // Start reflection collection if enabled\n if (reflection) {\n reflection.collector.start();\n }\n \n // Start interactive session if enabled\n if (config.interactive) {\n interactive.startSession();\n log('debug', 'Interactive session started');\n }\n \n try {\n // Step 1: Check onboarding needs\n log('debug', 'Checking onboarding state...');\n const onboardingState = interactive.checkNeedsOnboarding();\n if (onboardingState.needsOnboarding) {\n log('debug', 'First-run detected - onboarding may be triggered');\n }\n \n // Step 2: Raw transcription using Transcription module\n log('info', 'Transcribing audio...');\n const whisperStart = Date.now();\n \n const transcriptionResult = await transcription.transcribe(input.audioFile, {\n model: config.transcriptionModel as Transcription.TranscriptionModel,\n });\n state.rawTranscript = transcriptionResult.text;\n \n const whisperDuration = Date.now() - whisperStart;\n log('info', 'Transcription: %d chars in %.1fs', \n state.rawTranscript.length, whisperDuration / 1000);\n \n if (reflection) {\n reflection.collector.recordWhisper(whisperDuration);\n }\n \n // Step 3: Route detection\n log('debug', 'Determining routing destination...');\n const routingContext: Routing.RoutingContext = {\n transcriptText: state.rawTranscript || '',\n audioDate: input.creation,\n sourceFile: input.audioFile,\n hash: input.hash,\n };\n \n const routeResult = routing.route(routingContext);\n \n log('debug', 'Routing decision: project=%s, confidence=%.2f', \n routeResult.projectId || 'default', routeResult.confidence);\n \n // Record routing decision in reflection\n if (reflection) {\n reflection.collector.recordRoutingDecision({\n projectId: routeResult.projectId,\n destination: routeResult.destination.path,\n confidence: routeResult.confidence,\n reasoning: routeResult.reasoning,\n signals: routeResult.signals.map(s => ({\n type: s.type,\n value: s.value,\n weight: s.weight,\n })),\n alternativesConsidered: routeResult.alternateMatches?.map(alt => ({\n projectId: alt.projectId,\n confidence: alt.confidence,\n whyNotChosen: `Lower confidence (${(alt.confidence * 100).toFixed(1)}%)`,\n })),\n });\n }\n \n // Build output path\n const outputPath = routing.buildOutputPath(routeResult, routingContext);\n log('debug', 'Output path: %s', outputPath);\n \n // Step 4: Create output paths using Output module\n log('debug', 'Setting up output directories...');\n const paths = output.createOutputPaths(\n input.audioFile,\n outputPath,\n input.hash,\n input.creation\n );\n \n await output.ensureDirectories(paths);\n \n // Write raw transcript to intermediate (for debugging)\n await output.writeIntermediate(paths, 'transcript', {\n text: state.rawTranscript,\n model: config.transcriptionModel,\n duration: whisperDuration,\n });\n \n // Step 5: Agentic enhancement using real executor\n log('info', 'Enhancing with %s...', config.model);\n \n const agenticStart = Date.now();\n const toolContext: Agentic.ToolContext = {\n transcriptText: state.rawTranscript || '',\n audioDate: input.creation,\n sourceFile: input.audioFile,\n contextInstance: context,\n routingInstance: routing,\n interactiveMode: config.interactive,\n // Always pass interactive handler - it will handle enabled/disabled internally\n interactiveInstance: interactive,\n };\n \n const executor = Agentic.create(reasoning, toolContext);\n const agenticResult = await executor.process(state.rawTranscript || '');\n \n state.enhancedText = agenticResult.enhancedText;\n const toolsUsed = agenticResult.toolsUsed;\n const agenticDuration = Date.now() - agenticStart;\n \n // Record tool calls in reflection\n if (reflection) {\n for (const tool of toolsUsed) {\n reflection.collector.recordToolCall(tool, agenticDuration / toolsUsed.length, true);\n }\n reflection.collector.recordCorrection(state.rawTranscript || '', state.enhancedText);\n // Record token usage from agentic result\n if (agenticResult.totalTokens) {\n reflection.collector.recordModelResponse(config.model, agenticResult.totalTokens);\n }\n // Record context changes (new projects, entities created)\n if (agenticResult.contextChanges) {\n for (const change of agenticResult.contextChanges) {\n reflection.collector.recordContextChange(change);\n }\n }\n }\n \n // Write agentic session to intermediate\n await output.writeIntermediate(paths, 'session', {\n iterations: agenticResult.iterations,\n toolsUsed: agenticResult.toolsUsed,\n state: agenticResult.state,\n });\n \n // Step 5b: Check if agentic processing found a different route\n // (e.g., via lookup_project tool finding a project with custom destination)\n if (agenticResult.state.routeDecision?.destination?.path) {\n const agenticRoute = agenticResult.state.routeDecision;\n log('debug', 'Agentic processing found route: %s -> %s', \n agenticRoute.projectId || 'unknown', \n agenticRoute.destination.path\n );\n \n // Update routeResult with the agentic decision\n routeResult.projectId = agenticRoute.projectId || routeResult.projectId;\n routeResult.destination = {\n ...routeResult.destination,\n path: agenticRoute.destination.path,\n structure: agenticRoute.destination.structure || routeResult.destination.structure,\n };\n routeResult.confidence = agenticRoute.confidence || routeResult.confidence;\n routeResult.reasoning = agenticRoute.reasoning || routeResult.reasoning;\n if (agenticRoute.signals) {\n routeResult.signals = agenticRoute.signals;\n }\n \n // Rebuild output path with the new destination\n const newOutputPath = routing.buildOutputPath(routeResult, routingContext);\n log('debug', 'Updated output path: %s -> %s', outputPath, newOutputPath);\n \n // Recreate output paths with new destination\n const newPaths = output.createOutputPaths(\n input.audioFile,\n newOutputPath,\n input.hash,\n input.creation\n );\n await output.ensureDirectories(newPaths);\n \n // Update paths reference (reassign properties since paths is const)\n Object.assign(paths, newPaths);\n }\n\n // Step 5c: Write raw transcript to .transcript/ directory alongside final output\n // This is done AFTER the route is finalized so it goes to the correct location\n // Enables compare and reanalyze workflows\n log('debug', 'Writing raw transcript to .transcript/ directory...');\n await output.writeRawTranscript(paths, {\n text: state.rawTranscript,\n model: config.transcriptionModel,\n duration: whisperDuration,\n audioFile: input.audioFile,\n audioHash: input.hash,\n transcribedAt: new Date().toISOString(),\n });\n\n // Step 6: Write final output using Output module with metadata\n log('debug', 'Writing final transcript...');\n if (state.enhancedText) {\n // Build metadata from routing decision and input\n const transcriptMetadata: Metadata.TranscriptMetadata = {\n title: extractTitleFromPath(paths.final),\n projectId: routeResult.projectId || undefined,\n project: routeResult.projectId || undefined,\n date: input.creation,\n routing: Metadata.createRoutingMetadata(routeResult),\n tags: Metadata.extractTagsFromSignals(routeResult.signals),\n confidence: routeResult.confidence,\n };\n \n await output.writeTranscript(paths, state.enhancedText, transcriptMetadata);\n }\n \n // Step 7: Generate reflection report\n log('debug', 'Generating reflection report...');\n let reflectionReport: Reflection.ReflectionReport | undefined;\n if (reflection) {\n reflectionReport = reflection.generate(\n input.audioFile,\n paths.final,\n undefined,\n state.enhancedText\n );\n \n if (paths.intermediate.reflection) {\n await reflection.save(reflectionReport, paths.intermediate.reflection);\n }\n }\n \n // Step 8: End interactive session\n log('debug', 'Finalizing session...');\n let session: Interactive.InteractiveSession | undefined;\n if (config.interactive) {\n session = interactive.endSession();\n log('debug', 'Interactive session ended: %d clarifications', session.responses.length);\n \n // Save session if path available\n if (paths.intermediate.session) {\n await output.writeIntermediate(paths, 'session', session);\n }\n }\n \n // Step 9: Cleanup if needed\n if (!config.keepIntermediates && !config.debug) {\n await output.cleanIntermediates(paths);\n }\n\n // Step 10: Move audio file to processed directory\n let processedAudioPath: string | undefined;\n if (complete) {\n // Extract subject from output path for naming\n const subject = paths.final.split('/').pop()?.replace('.md', '') || undefined;\n processedAudioPath = await complete.complete(\n input.audioFile, \n input.hash, \n input.creation,\n subject\n );\n }\n \n const processingTime = Date.now() - startTime;\n \n // Compact summary output\n log('info', 'Enhancement: %d iterations, %d tools, %.1fs', \n agenticResult.iterations, toolsUsed.length, agenticDuration / 1000);\n if (agenticResult.totalTokens) {\n log('info', 'Tokens: %d total', agenticResult.totalTokens);\n }\n log('info', 'Output: %s (%.1fs total)', paths.final, processingTime / 1000);\n \n return {\n outputPath: paths.final,\n enhancedText: state.enhancedText || '',\n rawTranscript: state.rawTranscript || '',\n routedProject: routeResult.projectId,\n routingConfidence: routeResult.confidence,\n processingTime,\n toolsUsed,\n correctionsApplied: agenticResult.state.resolvedEntities.size,\n processedAudioPath,\n reflection: reflectionReport,\n session,\n intermediatePaths: paths,\n };\n \n } catch (error) {\n logger.error('Pipeline error', { error });\n throw error;\n }\n };\n \n return { process: processInput };\n};\n"],"names":["create","config","logger","Logging","currentWorkingDir","globalThis","process","cwd","debug","context","Context","startingDir","contextDirectory","defaultPath","outputDirectory","defaultStructure","outputStructure","defaultFilenameOptions","outputFilenameOptions","contextProjects","getAllProjects","routingProjects","filter","project","active","map","projectId","id","destination","path","routing","structure","filename_options","createDirectories","classification","auto_tags","length","routingConfig","default","projects","conflict_resolution","Routing","interactive","Interactive","enabled","silent","output","Output","intermediateDir","keepIntermediates","reflection","selfReflection","Reflection","transcription","Transcription","defaultModel","transcriptionModel","reasoning","Reasoning","model","reasoningLevel","complete","processedDirectory","CompletePhase","dryRun","extractTitleFromPath","outputPath","filename","split","pop","replace","undefined","withoutDate","word","charAt","toUpperCase","slice","join","processInput","input","startTime","Date","now","progressPrefix","progress","current","total","log","level","message","args","prefixedMessage","info","audioFile","hash","state","collector","start","startSession","agenticResult","onboardingState","checkNeedsOnboarding","needsOnboarding","whisperStart","transcriptionResult","transcribe","rawTranscript","text","whisperDuration","recordWhisper","routingContext","transcriptText","audioDate","creation","sourceFile","routeResult","route","confidence","recordRoutingDecision","signals","s","type","value","weight","alternativesConsidered","alternateMatches","alt","whyNotChosen","toFixed","buildOutputPath","paths","createOutputPaths","ensureDirectories","writeIntermediate","duration","agenticStart","toolContext","contextInstance","routingInstance","interactiveMode","interactiveInstance","executor","Agentic","enhancedText","toolsUsed","agenticDuration","tool","recordToolCall","recordCorrection","totalTokens","recordModelResponse","contextChanges","change","recordContextChange","iterations","routeDecision","agenticRoute","newOutputPath","newPaths","Object","assign","writeRawTranscript","audioHash","transcribedAt","toISOString","transcriptMetadata","title","final","date","Metadata","tags","writeTranscript","reflectionReport","generate","intermediate","save","session","endSession","responses","cleanIntermediates","processedAudioPath","subject","processingTime","routedProject","routingConfidence","correctionsApplied","resolvedEntities","size","intermediatePaths","error"],"mappings":";;;;;;;;;;;;AAmCO,MAAMA,SAAS,OAAOC,MAAAA,GAAAA;AA2DFA,IAAAA,IAAAA,yBAAAA;IA1DvB,MAAMC,MAAAA,GAASC,SAAiB,EAAA;AAChC,IAAA,MAAMC,iBAAAA,GAAoBC,UAAAA,CAAWC,OAAO,CAACC,GAAG,EAAA;AAEhDL,IAAAA,MAAAA,CAAOM,KAAK,CAAC,oDAAA,CAAA;;AAGb,IAAA,MAAMC,OAAAA,GAAU,MAAMC,QAAc,CAAC;QACjCC,WAAAA,EAAaV,MAAAA,CAAOW,gBAAgB,IAAIR;AAC5C,KAAA,CAAA;AACAF,IAAAA,MAAAA,CAAOM,KAAK,CAAC,gEAAA,CAAA;;IAGb,MAAMK,WAAAA,GAAcZ,MAAAA,CAAOa,eAAe,IAAI,SAAA;IAC9C,MAAMC,gBAAAA,GAAoBd,MAAAA,CAAOe,eAAe,IAAI,OAAA;IACpD,MAAMC,sBAAAA,GAA0BhB,MAAAA,CAAOiB,qBAAqB,IAAI;AAAC,QAAA,MAAA;AAAQ,QAAA,MAAA;AAAQ,QAAA;AAAU,KAAA;;;IAI3F,MAAMC,eAAAA,GAAkBV,QAAQW,cAAc,EAAA;AAC9C,IAAA,MAAMC,eAAAA,GAA0CF,eAAAA,CAC3CG,MAAM,CAACC,CAAAA,OAAAA,GAAWA,OAAAA,CAAQC,MAAM,KAAK,KAAA,CAAA,CACrCC,GAAG,CAACF,CAAAA,WAAY;AACbG,YAAAA,SAAAA,EAAWH,QAAQI,EAAE;YACrBC,WAAAA,EAAa;AACTC,gBAAAA,IAAAA,EAAMN,OAAAA,CAAQO,OAAO,CAACF,WAAW,IAAIf,WAAAA;gBACrCkB,SAAAA,EAAWR,OAAAA,CAAQO,OAAO,CAACC,SAAS;gBACpCC,gBAAAA,EAAkBT,OAAAA,CAAQO,OAAO,CAACE,gBAAgB;gBAClDC,iB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A,CAAMgD,YAAY,IAAI,EAAA;gBACpCrC,aAAAA,EAAeX,KAAAA,CAAMW,aAAa,IAAI,EAAA;AACtC6E,gBAAAA,aAAAA,EAAepE,YAAYzF,SAAS;AACpC8J,gBAAAA,iBAAAA,EAAmBrE,YAAYE,UAAU;AACzCiE,gBAAAA,cAAAA;AACAtC,gBAAAA,SAAAA;AACAyC,gBAAAA,kBAAAA,EAAoBtF,aAAAA,CAAcJ,KAAK,CAAC2F,gBAAgB,CAACC,IAAI;AAC7DP,gBAAAA,kBAAAA;gBACAlI,UAAAA,EAAY0H,gBAAAA;AACZI,gBAAAA,OAAAA;gBACAY,iBAAAA,EAAmB1D;AACvB,aAAA;AAEJ,QAAA,CAAA,CAAE,OAAO2D,KAAAA,EAAO;YACZ3L,MAAAA,CAAO2L,KAAK,CAAC,gBAAA,EAAkB;AAAEA,gBAAAA;AAAM,aAAA,CAAA;YACvC,MAAMA,KAAAA;AACV,QAAA;AACJ,IAAA,CAAA;IAEA,OAAO;QAAEvL,OAAAA,EAASwE;AAAa,KAAA;AACnC;;;;"}
|
package/dist/protokoll.js
CHANGED
|
@@ -8,6 +8,7 @@ import { create } from './phases/locate.js';
|
|
|
8
8
|
import * as Dreadcabinet from '@theunwalked/dreadcabinet';
|
|
9
9
|
import * as Cardigantime from '@theunwalked/cardigantime';
|
|
10
10
|
import { z } from 'zod';
|
|
11
|
+
import { glob } from 'glob';
|
|
11
12
|
|
|
12
13
|
const ConfigSchema = z.object({
|
|
13
14
|
dryRun: z.boolean(),
|
|
@@ -17,6 +18,11 @@ const ConfigSchema = z.object({
|
|
|
17
18
|
log: z.boolean(),
|
|
18
19
|
model: z.string(),
|
|
19
20
|
transcriptionModel: z.string(),
|
|
21
|
+
reasoningLevel: z.enum([
|
|
22
|
+
'low',
|
|
23
|
+
'medium',
|
|
24
|
+
'high'
|
|
25
|
+
]),
|
|
20
26
|
contentTypes: z.array(z.string()),
|
|
21
27
|
overrides: z.boolean(),
|
|
22
28
|
contextDirectories: z.array(z.string()).optional(),
|
|
@@ -24,6 +30,7 @@ const ConfigSchema = z.object({
|
|
|
24
30
|
tempDirectory: z.string(),
|
|
25
31
|
interactive: z.boolean(),
|
|
26
32
|
selfReflection: z.boolean(),
|
|
33
|
+
silent: z.boolean(),
|
|
27
34
|
processedDirectory: z.string().optional()
|
|
28
35
|
});
|
|
29
36
|
z.object({
|
|
@@ -79,8 +86,10 @@ async function main() {
|
|
|
79
86
|
const pipeline = await create$1({
|
|
80
87
|
model: config.model,
|
|
81
88
|
transcriptionModel: config.transcriptionModel,
|
|
89
|
+
reasoningLevel: config.reasoningLevel,
|
|
82
90
|
interactive: config.interactive,
|
|
83
91
|
selfReflection: config.selfReflection,
|
|
92
|
+
silent: config.silent,
|
|
84
93
|
debug: config.debug,
|
|
85
94
|
dryRun: config.dryRun,
|
|
86
95
|
contextDirectory: config.configDirectory,
|
|
@@ -93,17 +102,74 @@ async function main() {
|
|
|
93
102
|
tempDirectory: config.tempDirectory,
|
|
94
103
|
processedDirectory: config.processedDirectory
|
|
95
104
|
});
|
|
105
|
+
// Get list of files to process for progress tracking
|
|
106
|
+
// Build glob patterns from configured audio extensions
|
|
107
|
+
const inputDir = config.inputDirectory || DEFAULT_INPUT_DIRECTORY;
|
|
108
|
+
const extensions = config.extensions || DEFAULT_AUDIO_EXTENSIONS;
|
|
109
|
+
const patterns = extensions.map((ext)=>`**/*${ext}`);
|
|
110
|
+
// Count files before processing
|
|
111
|
+
const matchedFiles = await glob(patterns, {
|
|
112
|
+
cwd: inputDir,
|
|
113
|
+
nodir: true,
|
|
114
|
+
absolute: true
|
|
115
|
+
});
|
|
116
|
+
const totalFiles = matchedFiles.length;
|
|
117
|
+
if (totalFiles === 0) {
|
|
118
|
+
logger.info('No files to process in %s', inputDir);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
logger.info('Found %d file(s) to process in %s', totalFiles, inputDir);
|
|
122
|
+
let currentFileIndex = 0;
|
|
123
|
+
// Track processed files for summary
|
|
124
|
+
const processedFiles = [];
|
|
96
125
|
await operator.process(async (file)=>{
|
|
126
|
+
currentFileIndex++;
|
|
127
|
+
const progress = `[${currentFileIndex}/${totalFiles}]`;
|
|
128
|
+
logger.info('%s Starting: %s', progress, file);
|
|
97
129
|
// Use locate phase for file metadata
|
|
98
130
|
const { creationTime, hash } = await locatePhase.locate(file);
|
|
99
131
|
// Run through the full intelligent pipeline
|
|
100
132
|
const result = await pipeline.process({
|
|
101
133
|
audioFile: file,
|
|
102
134
|
creation: creationTime,
|
|
103
|
-
hash
|
|
135
|
+
hash,
|
|
136
|
+
progress: {
|
|
137
|
+
current: currentFileIndex,
|
|
138
|
+
total: totalFiles
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
logger.info('%s Completed: %s -> %s', progress, file, result.outputPath);
|
|
142
|
+
// Track for summary
|
|
143
|
+
processedFiles.push({
|
|
144
|
+
input: file,
|
|
145
|
+
output: result.outputPath
|
|
104
146
|
});
|
|
105
|
-
logger.info('Processed: %s -> %s', file, result.outputPath);
|
|
106
147
|
});
|
|
148
|
+
// Print summary of processed files
|
|
149
|
+
if (processedFiles.length > 0) {
|
|
150
|
+
// eslint-disable-next-line no-console
|
|
151
|
+
console.info('\n' + '='.repeat(60));
|
|
152
|
+
// eslint-disable-next-line no-console
|
|
153
|
+
console.info('TRANSCRIPTION SUMMARY');
|
|
154
|
+
// eslint-disable-next-line no-console
|
|
155
|
+
console.info('='.repeat(60));
|
|
156
|
+
// eslint-disable-next-line no-console
|
|
157
|
+
console.info(`Processed ${processedFiles.length} file(s)\n`);
|
|
158
|
+
// eslint-disable-next-line no-console
|
|
159
|
+
console.info('Input Files:');
|
|
160
|
+
for (const { input } of processedFiles){
|
|
161
|
+
// eslint-disable-next-line no-console
|
|
162
|
+
console.info(input);
|
|
163
|
+
}
|
|
164
|
+
// eslint-disable-next-line no-console
|
|
165
|
+
console.info('\nOutput Files:');
|
|
166
|
+
for (const { output } of processedFiles){
|
|
167
|
+
// eslint-disable-next-line no-console
|
|
168
|
+
console.info(output);
|
|
169
|
+
}
|
|
170
|
+
// eslint-disable-next-line no-console
|
|
171
|
+
console.info('\n' + '='.repeat(60));
|
|
172
|
+
}
|
|
107
173
|
} catch (error) {
|
|
108
174
|
logger.error('Exiting due to Error: %s, %s', error.message, error.stack);
|
|
109
175
|
process.exit(1);
|