@redaksjon/protokoll-engine 0.1.1-dev.0 → 0.1.3
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/index25.js +5 -5
- package/dist/index31.js +1 -1
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +2 -2
- package/dist/index33.js +4 -4
- package/dist/index34.js +1 -1
- package/dist/index36.js +0 -2
- package/dist/index36.js.map +1 -1
- package/dist/index42.js +43 -143
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +34 -221
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +233 -43
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +156 -38
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +75 -31
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +73 -46
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +5 -36
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +134 -222
- package/dist/index49.js.map +1 -1
- package/dist/index50.js +201 -138
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +42 -74
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +40 -73
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +33 -18
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +2 -2
- package/dist/index55.js +2 -2
- package/dist/index56.js +147 -14
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +15 -2
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +2 -15
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +15 -2
- package/dist/index59.js.map +1 -1
- package/dist/index60.js +2 -4
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +6 -0
- package/dist/index61.js.map +1 -0
- package/dist/out/index.d.ts +23 -0
- package/dist/out/index.d.ts.map +1 -0
- package/dist/out/manager.d.ts +21 -0
- package/dist/out/manager.d.ts.map +1 -0
- package/dist/out/types.d.ts +35 -0
- package/dist/out/types.d.ts.map +1 -0
- package/dist/pipeline/types.d.ts +2 -10
- package/dist/pipeline/types.d.ts.map +1 -1
- package/dist/transcript/operations.d.ts.map +1 -1
- package/package.json +5 -6
- package/dist/output/index.d.ts +0 -15
- package/dist/output/index.d.ts.map +0 -1
package/dist/index25.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ToolRegistry } from '@kjerneverk/riotprompt';
|
|
2
|
-
import { create as create$1 } from './
|
|
3
|
-
import { create as create$2 } from './
|
|
4
|
-
import { create as create$3 } from './
|
|
5
|
-
import { create as create$4 } from './
|
|
6
|
-
import { create as create$5 } from './
|
|
2
|
+
import { create as create$1 } from './index49.js';
|
|
3
|
+
import { create as create$2 } from './index50.js';
|
|
4
|
+
import { create as create$3 } from './index51.js';
|
|
5
|
+
import { create as create$4 } from './index52.js';
|
|
6
|
+
import { create as create$5 } from './index53.js';
|
|
7
7
|
|
|
8
8
|
const toRiotTool = (tool, category) => ({
|
|
9
9
|
name: tool.name,
|
package/dist/index31.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Context from '@redaksjon/context';
|
|
2
2
|
import { create as create$1 } from './index6.js';
|
|
3
|
-
import { create as create$2 } from './
|
|
3
|
+
import { create as create$2 } from './index48.js';
|
|
4
4
|
import { create as create$3 } from './index11.js';
|
|
5
5
|
import { create as create$4 } from './index3.js';
|
|
6
6
|
import { create as create$5 } from './index2.js';
|
package/dist/index31.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index31.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 '@redaksjon/context';\nimport * as Routing from '../routing';\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 // Use explicit contextDirectories from config if provided (from protokoll-config.yaml)\n const context = await Context.create({\n startingDir: config.contextDirectory || currentWorkingDir,\n contextDirectories: config.contextDirectories,\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 || defaultStructure,\n filename_options: project.routing?.filename_options || defaultFilenameOptions,\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 // Interactive moved to protokoll-cli\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 // Helper to check if a title is meaningful (not just numbers/timestamps)\n const isMeaningfulTitle = (title: string | undefined): boolean => {\n if (!title) return false;\n // Check if title is mostly numbers (timestamp-like) or very short fragments\n const stripped = title.replace(/\\s+/g, '');\n const numberRatio = (stripped.match(/\\d/g) || []).length / stripped.length;\n // Reject if: mostly numbers, too short, or common bad patterns\n if (numberRatio > 0.5) return false;\n if (stripped.length < 3) return false;\n // Reject titles that are just common words without context\n const badPatterns = /^(i|i have|i am|the|a|an|um|uh|so|well|okay|oh|hey|hi)$/i;\n if (badPatterns.test(title.trim())) return false;\n return true;\n };\n \n // Generate a meaningful title from transcript content using LLM\n const generateTitleFromContent = async (transcriptText: string, fallbackTitle?: string): Promise<string> => {\n try {\n // Use first ~2000 chars for title generation (enough context, not too expensive)\n const textSample = transcriptText.slice(0, 2000);\n \n const response = await reasoning.complete({\n systemPrompt: `You are a title generator. Given a transcript, generate a concise, descriptive title (3-8 words) that captures the main topic or theme.\n\nRules:\n- Output ONLY the title, nothing else\n- No quotes around the title\n- Use Title Case\n- Be specific - avoid generic titles like \"Meeting Notes\" or \"Discussion\"\n- Focus on the main subject matter\n- If there are multiple topics, pick the most prominent one`,\n prompt: `Generate a title for this transcript:\\n\\n${textSample}`,\n });\n \n // Clean up the response - remove quotes, trim whitespace\n const title = response.content\n .trim()\n .replace(/^[\"']|[\"']$/g, '') // Remove surrounding quotes\n .replace(/^#\\s*/, '') // Remove markdown heading prefix\n .trim();\n \n // Validate the generated title\n if (title && title.length > 0 && title.length < 100) {\n logger.debug('Generated title from content: %s', title);\n return title;\n }\n \n logger.debug('Generated title was invalid, using fallback');\n return fallbackTitle || 'Untitled';\n } catch (error) {\n logger.warn('Title generation failed, using fallback', { error });\n return fallbackTitle || 'Untitled';\n }\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 // Interactive moved to protokoll-cli\n // if (config.interactive) {\n // interactive.startSession();\n // log('debug', 'Interactive session started');\n // }\n \n try {\n // Step 1: Check onboarding needs (moved to protokoll-cli)\n log('debug', 'Checking onboarding state...');\n // const onboardingState = interactive.checkNeedsOnboarding();\n const onboardingState = { needsOnboarding: false }; // Stub\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 // Interactive moved to protokoll-cli\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 entity metadata from referenced entities\n const buildEntityReferences = (): Metadata.TranscriptMetadata['entities'] => {\n const refs = agenticResult.state.referencedEntities;\n if (!refs) return undefined;\n \n const entities: NonNullable<Metadata.TranscriptMetadata['entities']> = {\n people: [],\n projects: [],\n terms: [],\n companies: [],\n };\n \n // Convert sets of IDs to EntityReference arrays\n for (const personId of refs.people) {\n const person = context.getPerson(personId);\n if (person) {\n entities.people!.push({ id: person.id, name: person.name, type: 'person' });\n }\n }\n \n for (const projectId of refs.projects) {\n const project = context.getProject(projectId);\n if (project) {\n entities.projects!.push({ id: project.id, name: project.name, type: 'project' });\n }\n }\n \n for (const termId of refs.terms) {\n const term = context.getTerm(termId);\n if (term) {\n entities.terms!.push({ id: term.id, name: term.name, type: 'term' });\n }\n }\n \n for (const companyId of refs.companies) {\n const company = context.getCompany(companyId);\n if (company) {\n entities.companies!.push({ id: company.id, name: company.name, type: 'company' });\n }\n }\n \n // Only return if we found any entities\n const hasEntities = \n entities.people!.length > 0 ||\n entities.projects!.length > 0 ||\n entities.terms!.length > 0 ||\n entities.companies!.length > 0;\n \n return hasEntities ? entities : undefined;\n };\n \n // Generate title - prefer path-derived title if meaningful, otherwise use LLM\n const pathTitle = extractTitleFromPath(paths.final);\n let title: string;\n if (isMeaningfulTitle(pathTitle)) {\n title = pathTitle!;\n } else {\n log('debug', 'Path-derived title not meaningful (%s), generating from content...', pathTitle || 'empty');\n title = await generateTitleFromContent(state.enhancedText, pathTitle);\n log('info', 'Generated title: %s', title);\n \n // Rebuild output path with the generated title as the subject\n // This ensures the filename matches the title\n const contextWithTitle: Routing.RoutingContext = {\n ...routingContext,\n subjectOverride: title,\n };\n const newOutputPath = routing.buildOutputPath(routeResult, contextWithTitle);\n \n if (newOutputPath !== paths.final) {\n log('debug', 'Updating output path with generated title: %s -> %s', paths.final, newOutputPath);\n \n // Recreate output paths with the new filename\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\n Object.assign(paths, newPaths);\n }\n }\n \n // Build metadata from routing decision and input\n const transcriptMetadata: Metadata.TranscriptMetadata = {\n title,\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 entities: buildEntityReferences(),\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 (moved to protokoll-cli)\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 // // 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, // Interactive moved to protokoll-cli\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":["Logging.getLogger","Routing.create","Output.create","Reflection.create","Transcription.create","Reasoning.create","CompletePhase.create","Agentic.create","Metadata.createRoutingMetadata","Metadata.extractTagsFromSignals"],"mappings":";;;;;;;;;;;AAkCO,MAAM,MAAA,GAAS,OAAO,MAAA,KAA8D;AACvF,EAAA,MAAM,MAAA,GAASA,SAAQ,EAAU;AACjC,EAAA,MAAM,iBAAA,GAAoB,UAAA,CAAW,OAAA,CAAQ,GAAA,EAAI;AAEjD,EAAA,MAAA,CAAO,MAAM,oDAAoD,CAAA;AAIjE,EAAA,MAAM,OAAA,GAAU,MAAM,OAAA,CAAQ,MAAA,CAAO;AAAA,IACjC,WAAA,EAAa,OAAO,gBAAA,IAAoB,iBAAA;AAAA,IACxC,oBAAoB,MAAA,CAAO;AAAA,GAC9B,CAAA;AACD,EAAA,MAAA,CAAO,MAAM,gEAAgE,CAAA;AAG7E,EAAA,MAAM,WAAA,GAAc,OAAO,eAAA,IAAmB,SAAA;AAC9C,EAAA,MAAM,gBAAA,GAAoB,OAAO,eAAA,IAAmB,OAAA;AACpD,EAAA,MAAM,yBAA0B,MAAA,CAAO,qBAAA,IAAyB,CAAC,MAAA,EAAQ,QAAQ,SAAS,CAAA;AAI1F,EAAA,MAAM,eAAA,GAAkB,QAAQ,cAAA,EAAe;AAC/C,EAAA,MAAM,eAAA,GAA0C,gBAC3C,MAAA,CAAO,CAAA,OAAA,KAAW,QAAQ,MAAA,KAAW,KAAK,CAAA,CAC1C,GAAA,CAAI,CAAA,OAAA,MAAY;AAAA,IACb,WAAW,OAAA,CAAQ,EAAA;AAAA,IACnB,WAAA,EAAa;AAAA,MACT,IAAA,EAAM,OAAA,CAAQ,OAAA,EAAS,WAAA,IAAe,WAAA;AAAA,MACtC,SAAA,EAAW,OAAA,CAAQ,OAAA,EAAS,SAAA,IAAa,gBAAA;AAAA,MACzC,gBAAA,EAAkB,OAAA,CAAQ,OAAA,EA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AO,EAAE,SAAS,YAAA,EAAa;AACnC;;;;"}
|
|
1
|
+
{"version":3,"file":"index31.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 '@redaksjon/context';\nimport * as Routing from '../routing';\nimport * as Output from '../out';\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 // Use explicit contextDirectories from config if provided (from protokoll-config.yaml)\n const context = await Context.create({\n startingDir: config.contextDirectory || currentWorkingDir,\n contextDirectories: config.contextDirectories,\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 || defaultStructure,\n filename_options: project.routing?.filename_options || defaultFilenameOptions,\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 // Interactive moved to protokoll-cli\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 // Helper to check if a title is meaningful (not just numbers/timestamps)\n const isMeaningfulTitle = (title: string | undefined): boolean => {\n if (!title) return false;\n // Check if title is mostly numbers (timestamp-like) or very short fragments\n const stripped = title.replace(/\\s+/g, '');\n const numberRatio = (stripped.match(/\\d/g) || []).length / stripped.length;\n // Reject if: mostly numbers, too short, or common bad patterns\n if (numberRatio > 0.5) return false;\n if (stripped.length < 3) return false;\n // Reject titles that are just common words without context\n const badPatterns = /^(i|i have|i am|the|a|an|um|uh|so|well|okay|oh|hey|hi)$/i;\n if (badPatterns.test(title.trim())) return false;\n return true;\n };\n \n // Generate a meaningful title from transcript content using LLM\n const generateTitleFromContent = async (transcriptText: string, fallbackTitle?: string): Promise<string> => {\n try {\n // Use first ~2000 chars for title generation (enough context, not too expensive)\n const textSample = transcriptText.slice(0, 2000);\n \n const response = await reasoning.complete({\n systemPrompt: `You are a title generator. Given a transcript, generate a concise, descriptive title (3-8 words) that captures the main topic or theme.\n\nRules:\n- Output ONLY the title, nothing else\n- No quotes around the title\n- Use Title Case\n- Be specific - avoid generic titles like \"Meeting Notes\" or \"Discussion\"\n- Focus on the main subject matter\n- If there are multiple topics, pick the most prominent one`,\n prompt: `Generate a title for this transcript:\\n\\n${textSample}`,\n });\n \n // Clean up the response - remove quotes, trim whitespace\n const title = response.content\n .trim()\n .replace(/^[\"']|[\"']$/g, '') // Remove surrounding quotes\n .replace(/^#\\s*/, '') // Remove markdown heading prefix\n .trim();\n \n // Validate the generated title\n if (title && title.length > 0 && title.length < 100) {\n logger.debug('Generated title from content: %s', title);\n return title;\n }\n \n logger.debug('Generated title was invalid, using fallback');\n return fallbackTitle || 'Untitled';\n } catch (error) {\n logger.warn('Title generation failed, using fallback', { error });\n return fallbackTitle || 'Untitled';\n }\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 // Interactive moved to protokoll-cli\n // if (config.interactive) {\n // interactive.startSession();\n // log('debug', 'Interactive session started');\n // }\n \n try {\n // Step 1: Check onboarding needs (moved to protokoll-cli)\n log('debug', 'Checking onboarding state...');\n // const onboardingState = interactive.checkNeedsOnboarding();\n const onboardingState = { needsOnboarding: false }; // Stub\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 // Interactive moved to protokoll-cli\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 entity metadata from referenced entities\n const buildEntityReferences = (): Metadata.TranscriptMetadata['entities'] => {\n const refs = agenticResult.state.referencedEntities;\n if (!refs) return undefined;\n \n const entities: NonNullable<Metadata.TranscriptMetadata['entities']> = {\n people: [],\n projects: [],\n terms: [],\n companies: [],\n };\n \n // Convert sets of IDs to EntityReference arrays\n for (const personId of refs.people) {\n const person = context.getPerson(personId);\n if (person) {\n entities.people!.push({ id: person.id, name: person.name, type: 'person' });\n }\n }\n \n for (const projectId of refs.projects) {\n const project = context.getProject(projectId);\n if (project) {\n entities.projects!.push({ id: project.id, name: project.name, type: 'project' });\n }\n }\n \n for (const termId of refs.terms) {\n const term = context.getTerm(termId);\n if (term) {\n entities.terms!.push({ id: term.id, name: term.name, type: 'term' });\n }\n }\n \n for (const companyId of refs.companies) {\n const company = context.getCompany(companyId);\n if (company) {\n entities.companies!.push({ id: company.id, name: company.name, type: 'company' });\n }\n }\n \n // Only return if we found any entities\n const hasEntities = \n entities.people!.length > 0 ||\n entities.projects!.length > 0 ||\n entities.terms!.length > 0 ||\n entities.companies!.length > 0;\n \n return hasEntities ? entities : undefined;\n };\n \n // Generate title - prefer path-derived title if meaningful, otherwise use LLM\n const pathTitle = extractTitleFromPath(paths.final);\n let title: string;\n if (isMeaningfulTitle(pathTitle)) {\n title = pathTitle!;\n } else {\n log('debug', 'Path-derived title not meaningful (%s), generating from content...', pathTitle || 'empty');\n title = await generateTitleFromContent(state.enhancedText, pathTitle);\n log('info', 'Generated title: %s', title);\n \n // Rebuild output path with the generated title as the subject\n // This ensures the filename matches the title\n const contextWithTitle: Routing.RoutingContext = {\n ...routingContext,\n subjectOverride: title,\n };\n const newOutputPath = routing.buildOutputPath(routeResult, contextWithTitle);\n \n if (newOutputPath !== paths.final) {\n log('debug', 'Updating output path with generated title: %s -> %s', paths.final, newOutputPath);\n \n // Recreate output paths with the new filename\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\n Object.assign(paths, newPaths);\n }\n }\n \n // Build metadata from routing decision and input\n const transcriptMetadata: Metadata.TranscriptMetadata = {\n title,\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 entities: buildEntityReferences(),\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 (moved to protokoll-cli)\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 // // 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, // Interactive moved to protokoll-cli\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":["Logging.getLogger","Routing.create","Output.create","Reflection.create","Transcription.create","Reasoning.create","CompletePhase.create","Agentic.create","Metadata.createRoutingMetadata","Metadata.extractTagsFromSignals"],"mappings":";;;;;;;;;;;AAkCO,MAAM,MAAA,GAAS,OAAO,MAAA,KAA8D;AACvF,EAAA,MAAM,MAAA,GAASA,SAAQ,EAAU;AACjC,EAAA,MAAM,iBAAA,GAAoB,UAAA,CAAW,OAAA,CAAQ,GAAA,EAAI;AAEjD,EAAA,MAAA,CAAO,MAAM,oDAAoD,CAAA;AAIjE,EAAA,MAAM,OAAA,GAAU,MAAM,OAAA,CAAQ,MAAA,CAAO;AAAA,IACjC,WAAA,EAAa,OAAO,gBAAA,IAAoB,iBAAA;AAAA,IACxC,oBAAoB,MAAA,CAAO;AAAA,GAC9B,CAAA;AACD,EAAA,MAAA,CAAO,MAAM,gEAAgE,CAAA;AAG7E,EAAA,MAAM,WAAA,GAAc,OAAO,eAAA,IAAmB,SAAA;AAC9C,EAAA,MAAM,gBAAA,GAAoB,OAAO,eAAA,IAAmB,OAAA;AACpD,EAAA,MAAM,yBAA0B,MAAA,CAAO,qBAAA,IAAyB,CAAC,MAAA,EAAQ,QAAQ,SAAS,CAAA;AAI1F,EAAA,MAAM,eAAA,GAAkB,QAAQ,cAAA,EAAe;AA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UAAA;AAAA,QAC/B,cAAA;AAAA,QACA,SAAA;AAAA,QACA,kBAAA,EAAoB,aAAA,CAAc,KAAA,CAAM,gBAAA,CAAiB,IAAA;AAAA,QACzD,kBAAA;AAAA,QACA,UAAA,EAAY,gBAAA;AAAA;AAAA,QAEZ,iBAAA,EAAmB;AAAA,OACvB;AAAA,IAEJ,SAAS,KAAA,EAAO;AACZ,MAAA,MAAA,CAAO,KAAA,CAAM,gBAAA,EAAkB,EAAE,KAAA,EAAO,CAAA;AACxC,MAAA,MAAM,KAAA;AAAA,IACV;AAAA,EACJ,CAAA;AAEA,EAAA,OAAO,EAAE,SAAS,YAAA,EAAa;AACnC;;;;"}
|
package/dist/index32.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getLogger } from './index41.js';
|
|
2
2
|
import { create as create$1 } from './index12.js';
|
|
3
3
|
import { create as create$2 } from './index13.js';
|
|
4
|
-
import { transcribeAudio } from './
|
|
5
|
-
import { stringifyJSON } from './
|
|
4
|
+
import { transcribeAudio } from './index42.js';
|
|
5
|
+
import { stringifyJSON } from './index43.js';
|
|
6
6
|
import path__default from 'node:path';
|
|
7
7
|
import { create as create$4 } from './index5.js';
|
|
8
8
|
import { create as create$3 } from './index2.js';
|
package/dist/index33.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getLogger } from './index41.js';
|
|
2
2
|
import { create as create$1 } from './index12.js';
|
|
3
|
-
import { create as create$2 } from './
|
|
4
|
-
import { create as create$3 } from './
|
|
5
|
-
import { create as create$4 } from './
|
|
6
|
-
import { stringifyJSON } from './
|
|
3
|
+
import { create as create$2 } from './index44.js';
|
|
4
|
+
import { create as create$3 } from './index45.js';
|
|
5
|
+
import { create as create$4 } from './index46.js';
|
|
6
|
+
import { stringifyJSON } from './index43.js';
|
|
7
7
|
import path from 'path';
|
|
8
8
|
|
|
9
9
|
const create = (config, _operator) => {
|
package/dist/index34.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getLogger } from './index41.js';
|
|
2
2
|
import { create as create$3 } from './index13.js';
|
|
3
3
|
import { create as create$1 } from './index12.js';
|
|
4
|
-
import { create as create$2 } from './
|
|
4
|
+
import { create as create$2 } from './index47.js';
|
|
5
5
|
import { DEFAULT_INTERMEDIATE_DIRECTORY } from './index16.js';
|
|
6
6
|
import path__default from 'node:path';
|
|
7
7
|
|
package/dist/index36.js
CHANGED
|
@@ -323,8 +323,6 @@ const editTranscript = async (filePath, options) => {
|
|
|
323
323
|
}
|
|
324
324
|
let outputPath = pklPath;
|
|
325
325
|
if (targetProject?.routing?.destination || options.title) {
|
|
326
|
-
const config = context.getConfig();
|
|
327
|
-
const defaultPath = expandPath(config.outputDirectory || "~/notes");
|
|
328
326
|
if (targetProject?.routing?.destination) {
|
|
329
327
|
const routingConfig = buildRoutingConfig(context, targetProject);
|
|
330
328
|
const routing = create(routingConfig, context);
|
package/dist/index36.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index36.js","sources":["../src/transcript/operations.ts"],"sourcesContent":["/**\n * Transcript Operations\n * \n * Core business logic for transcript parsing, listing, editing, and combining.\n * PKL-only implementation - all transcripts are stored in PKL format.\n */\n\nimport * as fs from 'fs/promises';\nimport * as path from 'node:path';\nimport { glob } from 'glob';\nimport * as Context from '@redaksjon/context';\nimport * as Routing from '../routing';\nimport { Project } from '@redaksjon/context';\nimport { findProjectResilient } from '../utils/entityFinder';\nimport { \n PklTranscript, \n listTranscripts as listTranscriptsFromStorage,\n type TranscriptMetadata as PklMetadata,\n type ListTranscriptsOptions as StorageListOptions,\n} from '@redaksjon/protokoll-format';\nimport { ensurePklExtension } from './pkl-utils';\n\n/**\n * Parsed transcript structure\n */\nexport interface ParsedTranscript {\n filePath: string;\n title?: string;\n metadata: TranscriptMetadata;\n content: string;\n rawText: string;\n}\n\nexport interface TranscriptMetadata {\n date?: string;\n time?: string;\n project?: string;\n projectId?: string;\n destination?: string;\n confidence?: string;\n signals?: string[];\n reasoning?: string;\n tags?: string[];\n duration?: string;\n}\n\n/**\n * Check if input looks like a UUID (8+ hex chars)\n */\nexport function isUuidInput(input: string): boolean {\n return /^[a-f0-9]{8}/.test(input);\n}\n\n/**\n * Find transcript by UUID using glob scan\n * TODO: Replace with index-based lookup for better performance with large collections\n * \n * @param uuid - Full UUID or 8-character prefix\n * @param searchDirectories - Directories to search in\n * @returns Absolute path to transcript file, or null if not found\n */\nexport async function findTranscriptByUuid(\n uuid: string,\n searchDirectories: string[]\n): Promise<string | null> {\n const prefix = uuid.substring(0, 8); // Support both full UUID and prefix\n const pattern = `${prefix}-*.pkl`;\n \n for (const dir of searchDirectories) {\n const matches = await glob(pattern, { cwd: dir, absolute: true });\n if (matches.length > 0) {\n // Return first match - UUIDs should be unique\n return matches[0];\n }\n }\n \n return null;\n}\n\n/**\n * Parse a transcript file into its components\n * PKL-only implementation\n * \n * @param filePathOrUuid - File path or UUID to parse\n * @param searchDirectories - Optional directories to search if UUID is provided\n */\nexport const parseTranscript = async (\n filePathOrUuid: string,\n searchDirectories?: string[]\n): Promise<ParsedTranscript> => {\n let resolvedPath: string;\n \n // Check if input is a UUID\n if (isUuidInput(filePathOrUuid)) {\n if (!searchDirectories || searchDirectories.length === 0) {\n throw new Error('Search directories required for UUID lookup');\n }\n const foundPath = await findTranscriptByUuid(filePathOrUuid, searchDirectories);\n if (!foundPath) {\n throw new Error(`Transcript not found for UUID: ${filePathOrUuid}`);\n }\n resolvedPath = foundPath;\n } else {\n // Existing path-based logic\n resolvedPath = ensurePklExtension(filePathOrUuid);\n }\n \n const transcript = PklTranscript.open(resolvedPath, { readOnly: true });\n \n try {\n const pklMetadata = transcript.metadata;\n const content = transcript.content;\n \n const result: ParsedTranscript = {\n filePath: resolvedPath,\n title: pklMetadata.title,\n metadata: {\n date: pklMetadata.date instanceof Date \n ? pklMetadata.date.toISOString().split('T')[0] \n : undefined,\n time: pklMetadata.recordingTime,\n project: pklMetadata.project,\n projectId: pklMetadata.projectId,\n destination: pklMetadata.routing?.destination,\n confidence: pklMetadata.routing?.confidence?.toString(),\n signals: pklMetadata.routing?.signals,\n reasoning: pklMetadata.routing?.reasoning,\n tags: pklMetadata.tags,\n duration: pklMetadata.duration,\n },\n content,\n rawText: content, // For PKL files, content is the enhanced text\n };\n \n return result;\n } finally {\n transcript.close();\n }\n};\n\n/**\n * Extract the timestamp from a transcript filename\n */\nexport const extractTimestampFromFilename = (filePath: string): { day: number; hour: number; minute: number } | null => {\n const ext = path.extname(filePath);\n const basename = path.basename(filePath, ext);\n const match = basename.match(/^(\\d{1,2})-(\\d{2})(\\d{2})/);\n \n if (match) {\n return {\n day: parseInt(match[1], 10),\n hour: parseInt(match[2], 10),\n minute: parseInt(match[3], 10),\n };\n }\n \n return null;\n};\n\n/**\n * Slugify a title for use in filenames\n */\nexport const slugifyTitle = (title: string): string => {\n return title\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/--+/g, '-')\n .replace(/^-|-$/g, '')\n .slice(0, 50);\n};\n\n/**\n * Parse duration string to seconds\n */\nconst parseDuration = (duration: string): number => {\n const match = duration.match(/(\\d+):(\\d+)/);\n if (match) {\n const [, minutes, seconds] = match;\n return parseInt(minutes, 10) * 60 + parseInt(seconds, 10);\n }\n return 0;\n};\n\n/**\n * Format seconds as duration string\n */\nconst formatDuration = (seconds: number): string => {\n const minutes = Math.floor(seconds / 60);\n const secs = seconds % 60;\n return `${minutes}:${secs.toString().padStart(2, '0')}`;\n};\n\n/**\n * Expand ~ in paths\n */\nconst expandPath = (p: string): string => {\n if (p.startsWith('~')) {\n return path.join(process.env.HOME || '', p.slice(1));\n }\n return p;\n};\n\n/**\n * Extract date from metadata\n */\nconst extractDateFromMetadata = (metadata: TranscriptMetadata, filePath: string): Date => {\n if (metadata.date) {\n return new Date(metadata.date);\n }\n const timestamp = extractTimestampFromFilename(filePath);\n if (timestamp) {\n const now = new Date();\n return new Date(now.getFullYear(), now.getMonth(), timestamp.day, timestamp.hour, timestamp.minute);\n }\n return new Date();\n};\n\n/**\n * Build routing config from context and project\n */\nconst buildRoutingConfig = (\n context: Context.ContextInstance,\n _targetProject: Project\n): Routing.RoutingConfig => {\n const config = context.getConfig();\n const defaultPath = expandPath((config.outputDirectory as string) || '~/notes');\n \n const resolveRoutingPath = (routingPath: string | undefined): string => {\n if (!routingPath) {\n return defaultPath;\n }\n const expanded = expandPath(routingPath);\n if (!expanded.startsWith('/') && !expanded.match(/^[A-Za-z]:/)) {\n return path.resolve(defaultPath, expanded);\n }\n return expanded;\n };\n\n return {\n default: {\n path: resolveRoutingPath(undefined),\n structure: 'month',\n filename_options: ['date', 'time', 'subject'],\n },\n projects: context.getAllProjects()\n .filter(p => p.active !== false)\n .map(p => ({\n projectId: p.id,\n destination: {\n path: resolveRoutingPath(p.routing?.destination),\n structure: p.routing?.structure || 'month',\n filename_options: p.routing?.filename_options || ['date', 'time', 'subject'],\n },\n classification: p.classification,\n active: p.active,\n })),\n conflict_resolution: 'primary' as const,\n };\n};\n\n/**\n * Combine multiple transcripts into a single document\n * PKL-only implementation\n */\nexport const combineTranscripts = async (\n filePaths: string[],\n options: {\n projectId?: string;\n title?: string;\n dryRun?: boolean;\n verbose?: boolean;\n contextDirectory?: string;\n /** Explicit context directories (from protokoll-config.yaml) */\n contextDirectories?: string[];\n } = {}\n): Promise<{ outputPath: string; content: string }> => {\n if (filePaths.length === 0) {\n throw new Error('No transcript files provided');\n }\n \n const transcripts: ParsedTranscript[] = [];\n for (const filePath of filePaths) {\n try {\n const parsed = await parseTranscript(filePath);\n transcripts.push(parsed);\n } catch (error) {\n throw new Error(`Failed to parse transcript: ${filePath} - ${error}`);\n }\n }\n \n transcripts.sort((a, b) => {\n const aName = path.basename(a.filePath);\n const bName = path.basename(b.filePath);\n return aName.localeCompare(bName);\n });\n \n const firstTranscript = transcripts[0];\n const baseMetadata = { ...firstTranscript.metadata };\n \n // Use explicit contextDirectories from options if provided (from protokoll-config.yaml)\n const context = await Context.create({\n startingDir: options.contextDirectory || path.dirname(firstTranscript.filePath),\n contextDirectories: options.contextDirectories,\n });\n let targetProject: Project | undefined;\n \n if (options.projectId) {\n targetProject = findProjectResilient(context, options.projectId);\n baseMetadata.project = targetProject.name;\n baseMetadata.projectId = targetProject.id;\n \n if (targetProject.routing?.destination) {\n const config = context.getConfig();\n const defaultPath = expandPath((config.outputDirectory as string) || '~/notes');\n const routingPath = expandPath(targetProject.routing.destination);\n const resolvedPath = !routingPath.startsWith('/') && !routingPath.match(/^[A-Za-z]:/)\n ? path.resolve(defaultPath, routingPath)\n : routingPath;\n baseMetadata.destination = resolvedPath;\n }\n }\n \n let totalSeconds = 0;\n let hasDuration = false;\n for (const t of transcripts) {\n if (t.metadata.duration) {\n hasDuration = true;\n totalSeconds += parseDuration(t.metadata.duration);\n }\n }\n if (hasDuration && totalSeconds > 0) {\n baseMetadata.duration = formatDuration(totalSeconds);\n }\n \n const allTags = new Set<string>();\n for (const t of transcripts) {\n if (t.metadata.tags) {\n for (const tag of t.metadata.tags) {\n allTags.add(tag);\n }\n }\n }\n if (allTags.size > 0) {\n baseMetadata.tags = Array.from(allTags).sort();\n }\n \n const combinedTitle = options.title \n ? options.title\n : (firstTranscript.title \n ? `${firstTranscript.title} (Combined)`\n : 'Combined Transcript');\n \n // Build combined content\n const contentParts: string[] = [];\n for (let i = 0; i < transcripts.length; i++) {\n const t = transcripts[i];\n const sectionTitle = t.title || `Part ${i + 1}`;\n const sourceFile = path.basename(t.filePath);\n \n contentParts.push(`## ${sectionTitle}`);\n contentParts.push(`*Source: ${sourceFile}*`);\n contentParts.push('');\n contentParts.push(t.content);\n contentParts.push('');\n }\n \n const combinedContent = contentParts.join('\\n');\n \n // Determine output path\n let outputPath: string;\n \n if (targetProject?.routing?.destination) {\n const routingConfig = buildRoutingConfig(context, targetProject);\n const routing = Routing.create(routingConfig, context);\n \n const audioDate = extractDateFromMetadata(baseMetadata, firstTranscript.filePath);\n \n const routingContext: Routing.RoutingContext = {\n transcriptText: combinedContent,\n audioDate,\n sourceFile: firstTranscript.filePath,\n };\n \n const decision = routing.route(routingContext);\n outputPath = routing.buildOutputPath(decision, routingContext);\n // Ensure .pkl extension\n outputPath = outputPath.replace(/\\.md$/, '.pkl');\n } else {\n const firstDir = path.dirname(firstTranscript.filePath);\n const timestamp = extractTimestampFromFilename(firstTranscript.filePath);\n \n const filenameSuffix = options.title \n ? slugifyTitle(options.title)\n : 'combined';\n \n if (timestamp) {\n const day = timestamp.day.toString().padStart(2, '0');\n const hour = timestamp.hour.toString().padStart(2, '0');\n const minute = timestamp.minute.toString().padStart(2, '0');\n outputPath = path.join(firstDir, `${day}-${hour}${minute}-${filenameSuffix}.pkl`);\n } else {\n outputPath = path.join(firstDir, `${filenameSuffix}.pkl`);\n }\n }\n \n // Create the combined PKL transcript\n if (!options.dryRun) {\n const initialMetadata: PklMetadata = {\n id: '', // Will be auto-generated by PklTranscript.create()\n title: combinedTitle,\n date: baseMetadata.date ? new Date(baseMetadata.date) : undefined,\n recordingTime: baseMetadata.time,\n project: targetProject?.name || baseMetadata.project,\n projectId: targetProject?.id || baseMetadata.projectId,\n tags: baseMetadata.tags || [],\n duration: baseMetadata.duration,\n status: 'reviewed',\n };\n \n if (targetProject) {\n initialMetadata.entities = {\n people: [],\n projects: [{\n id: targetProject.id,\n name: targetProject.name,\n type: 'project',\n }],\n terms: [],\n companies: [],\n };\n }\n \n const newTranscript = PklTranscript.create(outputPath, initialMetadata);\n try {\n newTranscript.updateContent(combinedContent);\n } finally {\n newTranscript.close();\n }\n }\n \n return { outputPath, content: combinedContent };\n};\n\n/**\n * Edit transcript metadata and content\n * PKL-only implementation\n */\nexport const editTranscript = async (\n filePath: string,\n options: {\n title?: string;\n projectId?: string;\n tagsToAdd?: string[];\n tagsToRemove?: string[];\n dryRun?: boolean;\n verbose?: boolean;\n contextDirectory?: string;\n /** Explicit context directories (from protokoll-config.yaml) */\n contextDirectories?: string[];\n }\n): Promise<{ outputPath: string; content: string }> => {\n const pklPath = ensurePklExtension(filePath);\n const transcript = PklTranscript.open(pklPath, { readOnly: false });\n \n try {\n const pklMetadata = transcript.metadata;\n const content = transcript.content;\n \n // Use explicit contextDirectories from options if provided (from protokoll-config.yaml)\n const context = await Context.create({\n startingDir: options.contextDirectory || path.dirname(pklPath),\n contextDirectories: options.contextDirectories,\n });\n let targetProject: Project | undefined;\n \n if (options.projectId) {\n targetProject = findProjectResilient(context, options.projectId);\n }\n \n const newTitle = options.title || pklMetadata.title || 'Untitled';\n \n // Build updated metadata\n const updatedMetadata: Partial<PklMetadata> = {};\n \n if (options.title) {\n updatedMetadata.title = newTitle;\n }\n \n if (targetProject) {\n updatedMetadata.project = targetProject.name;\n updatedMetadata.projectId = targetProject.id;\n \n // Update entities with the project\n const existingEntities = pklMetadata.entities || { people: [], projects: [], terms: [], companies: [] };\n updatedMetadata.entities = {\n people: existingEntities.people || [],\n projects: [{\n id: targetProject.id,\n name: targetProject.name,\n type: 'project',\n }],\n terms: existingEntities.terms || [],\n companies: existingEntities.companies || [],\n };\n }\n \n // Handle tag updates\n if (options.tagsToAdd || options.tagsToRemove) {\n const currentTags = new Set(pklMetadata.tags || []);\n \n if (options.tagsToRemove) {\n for (const tag of options.tagsToRemove) {\n currentTags.delete(tag);\n }\n }\n \n if (options.tagsToAdd) {\n for (const tag of options.tagsToAdd) {\n currentTags.add(tag);\n }\n }\n \n updatedMetadata.tags = Array.from(currentTags).sort();\n }\n \n // Determine output path\n let outputPath = pklPath;\n \n if (targetProject?.routing?.destination || options.title) {\n const config = context.getConfig();\n const defaultPath = expandPath((config.outputDirectory as string) || '~/notes');\n \n if (targetProject?.routing?.destination) {\n const routingConfig = buildRoutingConfig(context, targetProject);\n const routing = Routing.create(routingConfig, context);\n \n const audioDate = pklMetadata.date instanceof Date ? pklMetadata.date : new Date();\n \n const routingContext: Routing.RoutingContext = {\n transcriptText: content,\n audioDate,\n sourceFile: pklPath,\n };\n \n const decision = routing.route(routingContext);\n \n if (options.title) {\n const basePath = path.dirname(routing.buildOutputPath(decision, routingContext));\n const timestamp = extractTimestampFromFilename(pklPath);\n const sluggedTitle = slugifyTitle(options.title);\n \n if (timestamp) {\n const day = timestamp.day.toString().padStart(2, '0');\n const hour = timestamp.hour.toString().padStart(2, '0');\n const minute = timestamp.minute.toString().padStart(2, '0');\n outputPath = path.join(basePath, `${day}-${hour}${minute}-${sluggedTitle}.pkl`);\n } else {\n outputPath = path.join(basePath, `${sluggedTitle}.pkl`);\n }\n } else {\n outputPath = routing.buildOutputPath(decision, routingContext);\n outputPath = outputPath.replace(/\\.md$/, '.pkl');\n }\n } else if (options.title) {\n const dir = path.dirname(pklPath);\n const timestamp = extractTimestampFromFilename(pklPath);\n const sluggedTitle = slugifyTitle(options.title);\n \n if (timestamp) {\n const day = timestamp.day.toString().padStart(2, '0');\n const hour = timestamp.hour.toString().padStart(2, '0');\n const minute = timestamp.minute.toString().padStart(2, '0');\n outputPath = path.join(dir, `${day}-${hour}${minute}-${sluggedTitle}.pkl`);\n } else {\n outputPath = path.join(dir, `${sluggedTitle}.pkl`);\n }\n }\n }\n \n // Apply updates\n if (!options.dryRun) {\n if (Object.keys(updatedMetadata).length > 0) {\n transcript.updateMetadata(updatedMetadata);\n }\n \n // If output path changed, we need to move the file\n if (outputPath !== pklPath) {\n // Close current transcript\n transcript.close();\n \n // Create directory if needed\n await fs.mkdir(path.dirname(outputPath), { recursive: true });\n \n // Copy to new location\n await fs.copyFile(pklPath, outputPath);\n \n // Delete old file\n await fs.unlink(pklPath);\n }\n }\n \n return { outputPath, content };\n } finally {\n // Only close if not already closed (due to move operation)\n try {\n transcript.close();\n } catch {\n // Already closed\n }\n }\n};\n\n/**\n * Transcript list item\n */\nexport interface TranscriptListItem {\n path: string;\n filename: string;\n uuid: string; // UUID identifier for this transcript\n date: string;\n time?: string;\n title: string;\n hasRawTranscript: boolean;\n createdAt: Date;\n status?: 'initial' | 'enhanced' | 'reviewed' | 'in_progress' | 'closed' | 'archived';\n openTasksCount?: number;\n contentSize?: number;\n entities?: {\n people?: Array<{ id: string; name: string }>;\n projects?: Array<{ id: string; name: string }>;\n terms?: Array<{ id: string; name: string }>;\n companies?: Array<{ id: string; name: string }>;\n };\n}\n\nexport interface ListTranscriptsOptions {\n directory: string;\n limit?: number;\n offset?: number;\n sortBy?: 'date' | 'filename' | 'title';\n startDate?: string;\n endDate?: string;\n search?: string;\n projectId?: string;\n}\n\nexport interface ListTranscriptsResult {\n transcripts: TranscriptListItem[];\n total: number;\n hasMore: boolean;\n limit: number;\n offset: number;\n}\n\n/**\n * List transcripts with filtering and pagination\n * Uses the protokoll-format storage API\n */\nexport const listTranscripts = async (options: ListTranscriptsOptions): Promise<ListTranscriptsResult> => {\n const {\n directory,\n limit = 50,\n offset = 0,\n sortBy = 'date',\n startDate,\n endDate,\n search,\n projectId,\n } = options;\n \n // Use the storage API from protokoll-format\n const storageOptions: StorageListOptions = {\n directory,\n limit,\n offset,\n sortBy,\n search,\n project: projectId,\n startDate,\n endDate,\n };\n \n const result = await listTranscriptsFromStorage(storageOptions);\n \n // Convert storage result to operations result format\n const transcripts: TranscriptListItem[] = result.transcripts.map(item => {\n // Extract UUID from the transcript file\n let uuid = '';\n try {\n const transcript = PklTranscript.open(item.filePath, { readOnly: true });\n uuid = transcript.metadata.id;\n transcript.close();\n } catch {\n // If we can't open the file, leave uuid empty\n uuid = '';\n }\n \n return {\n path: item.filePath,\n filename: path.basename(item.filePath),\n uuid,\n date: item.date instanceof Date ? item.date.toISOString().split('T')[0] : '',\n time: undefined, // Not in storage result\n title: item.title,\n hasRawTranscript: false, // Not in storage result, would need to open file to check\n createdAt: item.date || new Date(),\n status: item.status,\n openTasksCount: undefined, // Not in storage result\n contentSize: item.contentPreview?.length,\n entities: item.project ? {\n projects: [{\n id: item.project,\n name: item.project,\n }],\n } : undefined,\n };\n });\n \n return {\n transcripts,\n total: result.total,\n hasMore: result.hasMore,\n limit,\n offset,\n };\n};\n"],"names":["Routing.create","listTranscriptsFromStorage"],"mappings":";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AAS,IAAA,CAAK,QAAQ,CAAA;AAAA,MACrC,IAAA;AAAA,MACA,IAAA,EAAM,IAAA,CAAK,IAAA,YAAgB,IAAA,GAAO,IAAA,CAAK,IAAA,CAAK,WAAA,EAAY,CAAE,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,GAAI,EAAA;AAAA,MAC1E,IAAA,EAAM,MAAA;AAAA;AAAA,MACN,OAAO,IAAA,CAAK,KAAA;AAAA,MACZ,gBAAA,EAAkB,KAAA;AAAA;AAAA,MAClB,SAAA,EAAW,IAAA,CAAK,IAAA,oBAAQ,IAAI,IAAA,EAAK;AAAA,MACjC,QAAQ,IAAA,CAAK,MAAA;AAAA,MACb,cAAA,EAAgB,MAAA;AAAA;AAAA,MAChB,WAAA,EAAa,KAAK,cAAA,EAAgB,MAAA;AAAA,MAClC,QAAA,EAAU,KAAK,OAAA,GAAU;AAAA,QACrB,UAAU,CAAC;AAAA,UACP,IAAI,IAAA,CAAK,OAAA;AAAA,UACT,MAAM,IAAA,CAAK;AAAA,SACd;AAAA,OACL,GAAI;AAAA,KACR;AAAA,EACJ,CAAC,CAAA;AAED,EAAA,OAAO;AAAA,IACH,WAAA;AAAA,IACA,OAAO,MAAA,CAAO,KAAA;AAAA,IACd,SAAS,MAAA,CAAO,OAAA;AAAA,IAChB,KAAA;AAAA,IACA;AAAA,GACJ;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"index36.js","sources":["../src/transcript/operations.ts"],"sourcesContent":["/**\n * Transcript Operations\n * \n * Core business logic for transcript parsing, listing, editing, and combining.\n * PKL-only implementation - all transcripts are stored in PKL format.\n */\n\nimport * as fs from 'fs/promises';\nimport * as path from 'node:path';\nimport { glob } from 'glob';\nimport * as Context from '@redaksjon/context';\nimport * as Routing from '../routing';\nimport { Project } from '@redaksjon/context';\nimport { findProjectResilient } from '../utils/entityFinder';\nimport { \n PklTranscript, \n listTranscripts as listTranscriptsFromStorage,\n type TranscriptMetadata as PklMetadata,\n type ListTranscriptsOptions as StorageListOptions,\n} from '@redaksjon/protokoll-format';\nimport { ensurePklExtension } from './pkl-utils';\n\n/**\n * Parsed transcript structure\n */\nexport interface ParsedTranscript {\n filePath: string;\n title?: string;\n metadata: TranscriptMetadata;\n content: string;\n rawText: string;\n}\n\nexport interface TranscriptMetadata {\n date?: string;\n time?: string;\n project?: string;\n projectId?: string;\n destination?: string;\n confidence?: string;\n signals?: string[];\n reasoning?: string;\n tags?: string[];\n duration?: string;\n}\n\n/**\n * Check if input looks like a UUID (8+ hex chars)\n */\nexport function isUuidInput(input: string): boolean {\n return /^[a-f0-9]{8}/.test(input);\n}\n\n/**\n * Find transcript by UUID using glob scan\n * TODO: Replace with index-based lookup for better performance with large collections\n * \n * @param uuid - Full UUID or 8-character prefix\n * @param searchDirectories - Directories to search in\n * @returns Absolute path to transcript file, or null if not found\n */\nexport async function findTranscriptByUuid(\n uuid: string,\n searchDirectories: string[]\n): Promise<string | null> {\n const prefix = uuid.substring(0, 8); // Support both full UUID and prefix\n const pattern = `${prefix}-*.pkl`;\n \n for (const dir of searchDirectories) {\n const matches = await glob(pattern, { cwd: dir, absolute: true });\n if (matches.length > 0) {\n // Return first match - UUIDs should be unique\n return matches[0];\n }\n }\n \n return null;\n}\n\n/**\n * Parse a transcript file into its components\n * PKL-only implementation\n * \n * @param filePathOrUuid - File path or UUID to parse\n * @param searchDirectories - Optional directories to search if UUID is provided\n */\nexport const parseTranscript = async (\n filePathOrUuid: string,\n searchDirectories?: string[]\n): Promise<ParsedTranscript> => {\n let resolvedPath: string;\n \n // Check if input is a UUID\n if (isUuidInput(filePathOrUuid)) {\n if (!searchDirectories || searchDirectories.length === 0) {\n throw new Error('Search directories required for UUID lookup');\n }\n const foundPath = await findTranscriptByUuid(filePathOrUuid, searchDirectories);\n if (!foundPath) {\n throw new Error(`Transcript not found for UUID: ${filePathOrUuid}`);\n }\n resolvedPath = foundPath;\n } else {\n // Existing path-based logic\n resolvedPath = ensurePklExtension(filePathOrUuid);\n }\n \n const transcript = PklTranscript.open(resolvedPath, { readOnly: true });\n \n try {\n const pklMetadata = transcript.metadata;\n const content = transcript.content;\n \n const result: ParsedTranscript = {\n filePath: resolvedPath,\n title: pklMetadata.title,\n metadata: {\n date: pklMetadata.date instanceof Date \n ? pklMetadata.date.toISOString().split('T')[0] \n : undefined,\n time: pklMetadata.recordingTime,\n project: pklMetadata.project,\n projectId: pklMetadata.projectId,\n destination: pklMetadata.routing?.destination,\n confidence: pklMetadata.routing?.confidence?.toString(),\n signals: pklMetadata.routing?.signals,\n reasoning: pklMetadata.routing?.reasoning,\n tags: pklMetadata.tags,\n duration: pklMetadata.duration,\n },\n content,\n rawText: content, // For PKL files, content is the enhanced text\n };\n \n return result;\n } finally {\n transcript.close();\n }\n};\n\n/**\n * Extract the timestamp from a transcript filename\n */\nexport const extractTimestampFromFilename = (filePath: string): { day: number; hour: number; minute: number } | null => {\n const ext = path.extname(filePath);\n const basename = path.basename(filePath, ext);\n const match = basename.match(/^(\\d{1,2})-(\\d{2})(\\d{2})/);\n \n if (match) {\n return {\n day: parseInt(match[1], 10),\n hour: parseInt(match[2], 10),\n minute: parseInt(match[3], 10),\n };\n }\n \n return null;\n};\n\n/**\n * Slugify a title for use in filenames\n */\nexport const slugifyTitle = (title: string): string => {\n return title\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/--+/g, '-')\n .replace(/^-|-$/g, '')\n .slice(0, 50);\n};\n\n/**\n * Parse duration string to seconds\n */\nconst parseDuration = (duration: string): number => {\n const match = duration.match(/(\\d+):(\\d+)/);\n if (match) {\n const [, minutes, seconds] = match;\n return parseInt(minutes, 10) * 60 + parseInt(seconds, 10);\n }\n return 0;\n};\n\n/**\n * Format seconds as duration string\n */\nconst formatDuration = (seconds: number): string => {\n const minutes = Math.floor(seconds / 60);\n const secs = seconds % 60;\n return `${minutes}:${secs.toString().padStart(2, '0')}`;\n};\n\n/**\n * Expand ~ in paths\n */\nconst expandPath = (p: string): string => {\n if (p.startsWith('~')) {\n return path.join(process.env.HOME || '', p.slice(1));\n }\n return p;\n};\n\n/**\n * Extract date from metadata\n */\nconst extractDateFromMetadata = (metadata: TranscriptMetadata, filePath: string): Date => {\n if (metadata.date) {\n return new Date(metadata.date);\n }\n const timestamp = extractTimestampFromFilename(filePath);\n if (timestamp) {\n const now = new Date();\n return new Date(now.getFullYear(), now.getMonth(), timestamp.day, timestamp.hour, timestamp.minute);\n }\n return new Date();\n};\n\n/**\n * Build routing config from context and project\n */\nconst buildRoutingConfig = (\n context: Context.ContextInstance,\n _targetProject: Project\n): Routing.RoutingConfig => {\n const config = context.getConfig();\n const defaultPath = expandPath((config.outputDirectory as string) || '~/notes');\n \n const resolveRoutingPath = (routingPath: string | undefined): string => {\n if (!routingPath) {\n return defaultPath;\n }\n const expanded = expandPath(routingPath);\n if (!expanded.startsWith('/') && !expanded.match(/^[A-Za-z]:/)) {\n return path.resolve(defaultPath, expanded);\n }\n return expanded;\n };\n\n return {\n default: {\n path: resolveRoutingPath(undefined),\n structure: 'month',\n filename_options: ['date', 'time', 'subject'],\n },\n projects: context.getAllProjects()\n .filter(p => p.active !== false)\n .map(p => ({\n projectId: p.id,\n destination: {\n path: resolveRoutingPath(p.routing?.destination),\n structure: p.routing?.structure || 'month',\n filename_options: p.routing?.filename_options || ['date', 'time', 'subject'],\n },\n classification: p.classification,\n active: p.active,\n })),\n conflict_resolution: 'primary' as const,\n };\n};\n\n/**\n * Combine multiple transcripts into a single document\n * PKL-only implementation\n */\nexport const combineTranscripts = async (\n filePaths: string[],\n options: {\n projectId?: string;\n title?: string;\n dryRun?: boolean;\n verbose?: boolean;\n contextDirectory?: string;\n /** Explicit context directories (from protokoll-config.yaml) */\n contextDirectories?: string[];\n } = {}\n): Promise<{ outputPath: string; content: string }> => {\n if (filePaths.length === 0) {\n throw new Error('No transcript files provided');\n }\n \n const transcripts: ParsedTranscript[] = [];\n for (const filePath of filePaths) {\n try {\n const parsed = await parseTranscript(filePath);\n transcripts.push(parsed);\n } catch (error) {\n throw new Error(`Failed to parse transcript: ${filePath} - ${error}`);\n }\n }\n \n transcripts.sort((a, b) => {\n const aName = path.basename(a.filePath);\n const bName = path.basename(b.filePath);\n return aName.localeCompare(bName);\n });\n \n const firstTranscript = transcripts[0];\n const baseMetadata = { ...firstTranscript.metadata };\n \n // Use explicit contextDirectories from options if provided (from protokoll-config.yaml)\n const context = await Context.create({\n startingDir: options.contextDirectory || path.dirname(firstTranscript.filePath),\n contextDirectories: options.contextDirectories,\n });\n let targetProject: Project | undefined;\n \n if (options.projectId) {\n targetProject = findProjectResilient(context, options.projectId);\n baseMetadata.project = targetProject.name;\n baseMetadata.projectId = targetProject.id;\n \n if (targetProject.routing?.destination) {\n const config = context.getConfig();\n const defaultPath = expandPath((config.outputDirectory as string) || '~/notes');\n const routingPath = expandPath(targetProject.routing.destination);\n const resolvedPath = !routingPath.startsWith('/') && !routingPath.match(/^[A-Za-z]:/)\n ? path.resolve(defaultPath, routingPath)\n : routingPath;\n baseMetadata.destination = resolvedPath;\n }\n }\n \n let totalSeconds = 0;\n let hasDuration = false;\n for (const t of transcripts) {\n if (t.metadata.duration) {\n hasDuration = true;\n totalSeconds += parseDuration(t.metadata.duration);\n }\n }\n if (hasDuration && totalSeconds > 0) {\n baseMetadata.duration = formatDuration(totalSeconds);\n }\n \n const allTags = new Set<string>();\n for (const t of transcripts) {\n if (t.metadata.tags) {\n for (const tag of t.metadata.tags) {\n allTags.add(tag);\n }\n }\n }\n if (allTags.size > 0) {\n baseMetadata.tags = Array.from(allTags).sort();\n }\n \n const combinedTitle = options.title \n ? options.title\n : (firstTranscript.title \n ? `${firstTranscript.title} (Combined)`\n : 'Combined Transcript');\n \n // Build combined content\n const contentParts: string[] = [];\n for (let i = 0; i < transcripts.length; i++) {\n const t = transcripts[i];\n const sectionTitle = t.title || `Part ${i + 1}`;\n const sourceFile = path.basename(t.filePath);\n \n contentParts.push(`## ${sectionTitle}`);\n contentParts.push(`*Source: ${sourceFile}*`);\n contentParts.push('');\n contentParts.push(t.content);\n contentParts.push('');\n }\n \n const combinedContent = contentParts.join('\\n');\n \n // Determine output path\n let outputPath: string;\n \n if (targetProject?.routing?.destination) {\n const routingConfig = buildRoutingConfig(context, targetProject);\n const routing = Routing.create(routingConfig, context);\n \n const audioDate = extractDateFromMetadata(baseMetadata, firstTranscript.filePath);\n \n const routingContext: Routing.RoutingContext = {\n transcriptText: combinedContent,\n audioDate,\n sourceFile: firstTranscript.filePath,\n };\n \n const decision = routing.route(routingContext);\n outputPath = routing.buildOutputPath(decision, routingContext);\n // Ensure .pkl extension\n outputPath = outputPath.replace(/\\.md$/, '.pkl');\n } else {\n const firstDir = path.dirname(firstTranscript.filePath);\n const timestamp = extractTimestampFromFilename(firstTranscript.filePath);\n \n const filenameSuffix = options.title \n ? slugifyTitle(options.title)\n : 'combined';\n \n if (timestamp) {\n const day = timestamp.day.toString().padStart(2, '0');\n const hour = timestamp.hour.toString().padStart(2, '0');\n const minute = timestamp.minute.toString().padStart(2, '0');\n outputPath = path.join(firstDir, `${day}-${hour}${minute}-${filenameSuffix}.pkl`);\n } else {\n outputPath = path.join(firstDir, `${filenameSuffix}.pkl`);\n }\n }\n \n // Create the combined PKL transcript\n if (!options.dryRun) {\n const initialMetadata: PklMetadata = {\n id: '', // Will be auto-generated by PklTranscript.create()\n title: combinedTitle,\n date: baseMetadata.date ? new Date(baseMetadata.date) : undefined,\n recordingTime: baseMetadata.time,\n project: targetProject?.name || baseMetadata.project,\n projectId: targetProject?.id || baseMetadata.projectId,\n tags: baseMetadata.tags || [],\n duration: baseMetadata.duration,\n status: 'reviewed',\n };\n \n if (targetProject) {\n initialMetadata.entities = {\n people: [],\n projects: [{\n id: targetProject.id,\n name: targetProject.name,\n type: 'project',\n }],\n terms: [],\n companies: [],\n };\n }\n \n const newTranscript = PklTranscript.create(outputPath, initialMetadata);\n try {\n newTranscript.updateContent(combinedContent);\n } finally {\n newTranscript.close();\n }\n }\n \n return { outputPath, content: combinedContent };\n};\n\n/**\n * Edit transcript metadata and content\n * PKL-only implementation\n */\nexport const editTranscript = async (\n filePath: string,\n options: {\n title?: string;\n projectId?: string;\n tagsToAdd?: string[];\n tagsToRemove?: string[];\n dryRun?: boolean;\n verbose?: boolean;\n contextDirectory?: string;\n /** Explicit context directories (from protokoll-config.yaml) */\n contextDirectories?: string[];\n }\n): Promise<{ outputPath: string; content: string }> => {\n const pklPath = ensurePklExtension(filePath);\n const transcript = PklTranscript.open(pklPath, { readOnly: false });\n \n try {\n const pklMetadata = transcript.metadata;\n const content = transcript.content;\n \n // Use explicit contextDirectories from options if provided (from protokoll-config.yaml)\n const context = await Context.create({\n startingDir: options.contextDirectory || path.dirname(pklPath),\n contextDirectories: options.contextDirectories,\n });\n let targetProject: Project | undefined;\n \n if (options.projectId) {\n targetProject = findProjectResilient(context, options.projectId);\n }\n \n const newTitle = options.title || pklMetadata.title || 'Untitled';\n \n // Build updated metadata\n const updatedMetadata: Partial<PklMetadata> = {};\n \n if (options.title) {\n updatedMetadata.title = newTitle;\n }\n \n if (targetProject) {\n updatedMetadata.project = targetProject.name;\n updatedMetadata.projectId = targetProject.id;\n \n // Update entities with the project\n const existingEntities = pklMetadata.entities || { people: [], projects: [], terms: [], companies: [] };\n updatedMetadata.entities = {\n people: existingEntities.people || [],\n projects: [{\n id: targetProject.id,\n name: targetProject.name,\n type: 'project',\n }],\n terms: existingEntities.terms || [],\n companies: existingEntities.companies || [],\n };\n }\n \n // Handle tag updates\n if (options.tagsToAdd || options.tagsToRemove) {\n const currentTags = new Set(pklMetadata.tags || []);\n \n if (options.tagsToRemove) {\n for (const tag of options.tagsToRemove) {\n currentTags.delete(tag);\n }\n }\n \n if (options.tagsToAdd) {\n for (const tag of options.tagsToAdd) {\n currentTags.add(tag);\n }\n }\n \n updatedMetadata.tags = Array.from(currentTags).sort();\n }\n \n // Determine output path\n let outputPath = pklPath;\n \n if (targetProject?.routing?.destination || options.title) {\n if (targetProject?.routing?.destination) {\n const routingConfig = buildRoutingConfig(context, targetProject);\n const routing = Routing.create(routingConfig, context);\n \n const audioDate = pklMetadata.date instanceof Date ? pklMetadata.date : new Date();\n \n const routingContext: Routing.RoutingContext = {\n transcriptText: content,\n audioDate,\n sourceFile: pklPath,\n };\n \n const decision = routing.route(routingContext);\n \n if (options.title) {\n const basePath = path.dirname(routing.buildOutputPath(decision, routingContext));\n const timestamp = extractTimestampFromFilename(pklPath);\n const sluggedTitle = slugifyTitle(options.title);\n \n if (timestamp) {\n const day = timestamp.day.toString().padStart(2, '0');\n const hour = timestamp.hour.toString().padStart(2, '0');\n const minute = timestamp.minute.toString().padStart(2, '0');\n outputPath = path.join(basePath, `${day}-${hour}${minute}-${sluggedTitle}.pkl`);\n } else {\n outputPath = path.join(basePath, `${sluggedTitle}.pkl`);\n }\n } else {\n outputPath = routing.buildOutputPath(decision, routingContext);\n outputPath = outputPath.replace(/\\.md$/, '.pkl');\n }\n } else if (options.title) {\n const dir = path.dirname(pklPath);\n const timestamp = extractTimestampFromFilename(pklPath);\n const sluggedTitle = slugifyTitle(options.title);\n \n if (timestamp) {\n const day = timestamp.day.toString().padStart(2, '0');\n const hour = timestamp.hour.toString().padStart(2, '0');\n const minute = timestamp.minute.toString().padStart(2, '0');\n outputPath = path.join(dir, `${day}-${hour}${minute}-${sluggedTitle}.pkl`);\n } else {\n outputPath = path.join(dir, `${sluggedTitle}.pkl`);\n }\n }\n }\n \n // Apply updates\n if (!options.dryRun) {\n if (Object.keys(updatedMetadata).length > 0) {\n transcript.updateMetadata(updatedMetadata);\n }\n \n // If output path changed, we need to move the file\n if (outputPath !== pklPath) {\n // Close current transcript\n transcript.close();\n \n // Create directory if needed\n await fs.mkdir(path.dirname(outputPath), { recursive: true });\n \n // Copy to new location\n await fs.copyFile(pklPath, outputPath);\n \n // Delete old file\n await fs.unlink(pklPath);\n }\n }\n \n return { outputPath, content };\n } finally {\n // Only close if not already closed (due to move operation)\n try {\n transcript.close();\n } catch {\n // Already closed\n }\n }\n};\n\n/**\n * Transcript list item\n */\nexport interface TranscriptListItem {\n path: string;\n filename: string;\n uuid: string; // UUID identifier for this transcript\n date: string;\n time?: string;\n title: string;\n hasRawTranscript: boolean;\n createdAt: Date;\n status?: 'initial' | 'enhanced' | 'reviewed' | 'in_progress' | 'closed' | 'archived';\n openTasksCount?: number;\n contentSize?: number;\n entities?: {\n people?: Array<{ id: string; name: string }>;\n projects?: Array<{ id: string; name: string }>;\n terms?: Array<{ id: string; name: string }>;\n companies?: Array<{ id: string; name: string }>;\n };\n}\n\nexport interface ListTranscriptsOptions {\n directory: string;\n limit?: number;\n offset?: number;\n sortBy?: 'date' | 'filename' | 'title';\n startDate?: string;\n endDate?: string;\n search?: string;\n projectId?: string;\n}\n\nexport interface ListTranscriptsResult {\n transcripts: TranscriptListItem[];\n total: number;\n hasMore: boolean;\n limit: number;\n offset: number;\n}\n\n/**\n * List transcripts with filtering and pagination\n * Uses the protokoll-format storage API\n */\nexport const listTranscripts = async (options: ListTranscriptsOptions): Promise<ListTranscriptsResult> => {\n const {\n directory,\n limit = 50,\n offset = 0,\n sortBy = 'date',\n startDate,\n endDate,\n search,\n projectId,\n } = options;\n \n // Use the storage API from protokoll-format\n const storageOptions: StorageListOptions = {\n directory,\n limit,\n offset,\n sortBy,\n search,\n project: projectId,\n startDate,\n endDate,\n };\n \n const result = await listTranscriptsFromStorage(storageOptions);\n \n // Convert storage result to operations result format\n const transcripts: TranscriptListItem[] = result.transcripts.map(item => {\n // Extract UUID from the transcript file\n let uuid = '';\n try {\n const transcript = PklTranscript.open(item.filePath, { readOnly: true });\n uuid = transcript.metadata.id;\n transcript.close();\n } catch {\n // If we can't open the file, leave uuid empty\n uuid = '';\n }\n \n return {\n path: item.filePath,\n filename: path.basename(item.filePath),\n uuid,\n date: item.date instanceof Date ? item.date.toISOString().split('T')[0] : '',\n time: undefined, // Not in storage result\n title: item.title,\n hasRawTranscript: false, // Not in storage result, would need to open file to check\n createdAt: item.date || new Date(),\n status: item.status,\n openTasksCount: undefined, // Not in storage result\n contentSize: item.contentPreview?.length,\n entities: item.project ? {\n projects: [{\n id: item.project,\n name: item.project,\n }],\n } : undefined,\n };\n });\n \n return {\n transcripts,\n total: result.total,\n hasMore: result.hasMore,\n limit,\n offset,\n };\n};\n"],"names":["Routing.create","listTranscriptsFromStorage"],"mappings":";;;;;;;;;AAiDO,SAAS,YAAY,KAAA,EAAwB;AAChD,EAAA,OAAO,cAAA,CAAe,KAAK,KAAK,CAAA;AACpC;AAUA,eAAsB,oBAAA,CAClB,MACA,iBAAA,EACsB;AACtB,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,SAAA,CAAU,CAAA,EAAG,CAAC,CAAA;AAClC,EAAA,MAAM,OAAA,GAAU,GAAG,MAAM,CAAA,MAAA,CAAA;AAEzB,EAAA,KAAA,MAAW,OAAO,iBAAA,EAAmB;AACjC,IAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,OAAA,EAAS,EAAE,GAAA,EAAK,GAAA,EAAK,QAAA,EAAU,IAAA,EAAM,CAAA;AAChE,IAAA,IAAI,OAAA,CAAQ,SAAS,CAAA,EAAG;AAEpB,MAAA,OAAO,QAAQ,CAAC,CAAA;AAAA,IACpB;AAAA,EACJ;AAEA,EAAA,OAAO,IAAA;AACX;AASO,MAAM,eAAA,GAAkB,OAC3B,cAAA,EACA,iBAAA,KAC4B;AAC5B,EAAA,IAAI,YAAA;AAGJ,EAAA,IAAI,WAAA,CAAY,cAAc,CAAA,EAAG;AAC7B,IAAA,IAAI,CAAC,iBAAA,IAAqB,iBAAA,CAAkB,MAAA,KAAW,CAAA,EAAG;AACtD,MAAA,MAAM,IAAI,MAAM,6CAA6C,CAAA;AAAA,IACjE;AACA,IAAA,MAAM,SAAA,GAAY,MAAM,oBAAA,CAAqB,cAAA,EAAgB,iBAAiB,CAAA;AAC9E,IAAA,IAAI,CAAC,SAAA,EAAW;AACZ,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,+BAAA,EAAkC,cAAc,CAAA,CAAE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