@redaksjon/protokoll-engine 0.1.19 → 0.2.0-dev.20260521201150.7ae20f9

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/index56.js CHANGED
@@ -1,163 +1,49 @@
1
- import { getLogger } from './index47.js';
2
-
3
- const create = (config) => {
4
- const logger = getLogger();
5
- const tier2MinConfidence = config?.tier2MinConfidence;
6
- const useCapitalizationHints = config?.useCapitalizationHints ?? true;
7
- const shouldApplyTier2 = (mapping, classification) => {
8
- if (mapping.tier !== 2) {
9
- return false;
10
- }
11
- const confidence = classification.confidence ?? 0;
12
- const minConfidence = mapping.minConfidence ?? tier2MinConfidence;
13
- if (confidence < minConfidence) {
14
- logger.debug(
15
- `Skipping Tier 2 replacement for "${mapping.soundsLike}": confidence ${confidence} < ${minConfidence}`
16
- );
17
- return false;
18
- }
19
- if (mapping.scopedToProjects && mapping.scopedToProjects.length > 0) {
20
- const classifiedProject = classification.project;
21
- if (!classifiedProject) {
22
- logger.debug(
23
- `Skipping Tier 2 replacement for "${mapping.soundsLike}": no project in classification`
24
- );
25
- return false;
1
+ const create = (ctx) => ({
2
+ name: "verify_spelling",
3
+ description: "Request user verification for an unknown name or term. Use when you encounter something that needs human confirmation.",
4
+ parameters: {
5
+ type: "object",
6
+ properties: {
7
+ term: {
8
+ type: "string",
9
+ description: "The term that needs verification"
10
+ },
11
+ context: {
12
+ type: "string",
13
+ description: "Context around where this term appears"
14
+ },
15
+ suggestedSpelling: {
16
+ type: "string",
17
+ description: "Your best guess at the correct spelling"
26
18
  }
27
- if (!mapping.scopedToProjects.includes(classifiedProject)) {
28
- logger.debug(
29
- `Skipping Tier 2 replacement for "${mapping.soundsLike}": project "${classifiedProject}" not in scope [${mapping.scopedToProjects.join(", ")}]`
30
- );
31
- return false;
32
- }
33
- }
34
- logger.debug(
35
- `Applying Tier 2 replacement for "${mapping.soundsLike}" → "${mapping.correctText}" (project: ${classification.project}, confidence: ${confidence})`
36
- );
37
- return true;
38
- };
39
- const resolveCollision = (collision, classification) => {
40
- const { soundsLike, mappings } = collision;
41
- logger.debug(`Resolving collision for "${soundsLike}" (${mappings.length} candidates)`);
42
- const tier1Mappings = mappings.filter((m) => m.tier === 1);
43
- const tier2Mappings = mappings.filter((m) => m.tier === 2 && shouldApplyTier2(m, classification));
44
- if (tier1Mappings.length === 1) {
45
- logger.debug(`Resolved collision: using Tier 1 mapping "${tier1Mappings[0].correctText}"`);
46
- return tier1Mappings[0];
47
- }
48
- if (tier1Mappings.length > 1) {
49
- logger.warn(`Multiple Tier 1 mappings for "${soundsLike}", skipping replacement`);
50
- return null;
51
- }
52
- if (tier2Mappings.length === 1) {
53
- logger.debug(`Resolved collision: using Tier 2 mapping "${tier2Mappings[0].correctText}"`);
54
- return tier2Mappings[0];
55
- }
56
- if (tier2Mappings.length > 1) {
57
- logger.debug(`Multiple Tier 2 mappings match for "${soundsLike}", skipping replacement`);
58
- return null;
59
- }
60
- logger.debug(`No applicable mappings for collision "${soundsLike}"`);
61
- return null;
62
- };
63
- const detectCapitalizationHint = (soundsLike, surroundingText) => {
64
- if (!useCapitalizationHints || !surroundingText) {
65
- return "unknown";
66
- }
67
- const regex = new RegExp(`\\b${soundsLike}\\b`, "i");
68
- const match = surroundingText.match(regex);
69
- if (!match) {
70
- return "unknown";
71
- }
72
- const matchedText = match[0];
73
- const isCapitalized = matchedText[0] === matchedText[0].toUpperCase();
74
- if (!isCapitalized) {
75
- return "common-term";
76
- }
77
- const indexInText = surroundingText.indexOf(matchedText);
78
- const beforeText = surroundingText.substring(0, indexInText).trimEnd();
79
- const isAtSentenceStart = beforeText.length === 0 || /[.!?]\s*$/.test(beforeText);
80
- if (isAtSentenceStart) {
81
- return "unknown";
82
- }
83
- return "proper-noun";
84
- };
85
- const decideReplacement = (context) => {
86
- const { classification, soundsLike, availableMappings, surroundingText } = context;
87
- if (availableMappings.length === 0) {
19
+ },
20
+ required: ["term"]
21
+ },
22
+ execute: async (args) => {
23
+ if (!ctx.interactiveMode) {
88
24
  return {
89
- shouldReplace: false,
90
- reason: "No mappings available",
91
- confidence: 1
92
- };
93
- }
94
- if (availableMappings.length === 1) {
95
- const mapping = availableMappings[0];
96
- if (mapping.tier === 1) {
97
- return {
98
- shouldReplace: true,
99
- mapping,
100
- reason: "Tier 1 mapping (always safe)",
101
- confidence: 1
102
- };
103
- }
104
- if (mapping.tier === 2) {
105
- if (shouldApplyTier2(mapping, classification)) {
106
- return {
107
- shouldReplace: true,
108
- mapping,
109
- reason: `Tier 2 mapping (project: ${classification.project}, confidence: ${classification.confidence})`,
110
- confidence: classification.confidence ?? 0.5
111
- };
112
- } else {
113
- return {
114
- shouldReplace: false,
115
- reason: "Tier 2 conditions not met",
116
- confidence: 0.5
117
- };
25
+ success: true,
26
+ data: {
27
+ verified: false,
28
+ useSuggestion: true,
29
+ spelling: args.suggestedSpelling || args.term,
30
+ message: "Non-interactive mode: using best guess"
118
31
  }
119
- }
120
- return {
121
- shouldReplace: false,
122
- reason: "Tier 3 mapping (too ambiguous)",
123
- confidence: 1
124
32
  };
125
33
  }
126
- const resolvedMapping = resolveCollision(
127
- { soundsLike, mappings: availableMappings, count: availableMappings.length },
128
- classification
129
- );
130
- if (resolvedMapping) {
131
- return {
132
- shouldReplace: true,
133
- mapping: resolvedMapping,
134
- reason: `Collision resolved (${availableMappings.length} candidates)`,
135
- confidence: classification.confidence ?? 0.5
136
- };
137
- }
138
- if (surroundingText && useCapitalizationHints) {
139
- const hint = detectCapitalizationHint(soundsLike, surroundingText);
140
- if (hint === "common-term") {
141
- return {
142
- shouldReplace: false,
143
- reason: "Capitalization hint suggests common term",
144
- confidence: 0.7
145
- };
146
- }
147
- }
148
34
  return {
149
- shouldReplace: false,
150
- reason: "Collision could not be resolved",
151
- confidence: 0.5
35
+ success: true,
36
+ needsUserInput: true,
37
+ userPrompt: `Unknown term: "${args.term}"${args.context ? ` (context: "${args.context}")` : ""}
38
+ ${args.suggestedSpelling ? `Suggested spelling: "${args.suggestedSpelling}"` : ""}
39
+ Please provide the correct spelling:`,
40
+ data: {
41
+ term: args.term,
42
+ suggestedSpelling: args.suggestedSpelling
43
+ }
152
44
  };
153
- };
154
- return {
155
- decideReplacement,
156
- shouldApplyTier2,
157
- resolveCollision,
158
- detectCapitalizationHint
159
- };
160
- };
45
+ }
46
+ });
161
47
 
162
48
  export { create };
163
49
  //# sourceMappingURL=index56.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index56.js","sources":["../src/util/collision-detector.ts"],"sourcesContent":["/**\n * Collision Detector\n *\n * Provides utilities for detecting and resolving collisions in sounds_like mappings.\n * Helps determine when it's safe to apply a replacement and when context is needed.\n *\n * Part of the simple-replace optimization (Phase 1).\n */\n\nimport * as Logging from '@/logging';\nimport { SoundsLikeMapping, Collision } from './sounds-like-database';\n\n/**\n * Classification result for an entity\n */\nexport interface Classification {\n /** Identified project ID */\n project?: string;\n\n /** Classification confidence (0-1) */\n confidence?: number;\n\n /** Additional classification metadata */\n [key: string]: any;\n}\n\n/**\n * Replacement decision\n */\nexport interface ReplacementDecision {\n /** Whether to apply the replacement */\n shouldReplace: boolean;\n\n /** The mapping to use (if shouldReplace is true) */\n mapping?: SoundsLikeMapping;\n\n /** Reason for the decision */\n reason: string;\n\n /** Confidence in this decision (0-1) */\n confidence: number;\n}\n\n/**\n * Context for collision resolution\n */\nexport interface CollisionContext {\n /** Classification of the transcription */\n classification: Classification;\n\n /** The sounds_like value being considered */\n soundsLike: string;\n\n /** Available mappings for this sounds_like */\n availableMappings: SoundsLikeMapping[];\n\n /** Surrounding text context (optional) */\n surroundingText?: string;\n}\n\n/**\n * Instance interface for collision detector\n */\nexport interface Instance {\n /**\n * Decide whether to apply a replacement given a collision context\n */\n decideReplacement(context: CollisionContext): ReplacementDecision;\n\n /**\n * Check if a Tier 2 mapping should be applied given classification\n */\n shouldApplyTier2(mapping: SoundsLikeMapping, classification: Classification): boolean;\n\n /**\n * Resolve a collision by selecting the best mapping\n */\n resolveCollision(collision: Collision, classification: Classification): SoundsLikeMapping | null;\n\n /**\n * Detect capitalization hints in context\n */\n detectCapitalizationHint(soundsLike: string, surroundingText: string): 'proper-noun' | 'common-term' | 'unknown';\n}\n\n/**\n * Configuration for collision detector\n */\nexport interface CollisionDetectorConfig {\n /** Minimum confidence for Tier 2 replacements (default: 0.6) */\n tier2MinConfidence?: number;\n\n /** High confidence threshold for aggressive replacement (default: 0.8) */\n tier2HighConfidence?: number;\n\n /** Enable capitalization hints (default: true) */\n useCapitalizationHints?: boolean;\n\n /** Enable surrounding text analysis (default: false, future feature) */\n useSurroundingText?: boolean;\n}\n\n/**\n * Create a collision detector instance\n */\nexport const create = (config?: CollisionDetectorConfig): Instance => {\n const logger = Logging.getLogger();\n\n const tier2MinConfidence = config?.tier2MinConfidence ?? 0.6;\n // const tier2HighConfidence = config?.tier2HighConfidence ?? 0.8; // Reserved for future use\n const useCapitalizationHints = config?.useCapitalizationHints ?? true;\n\n /**\n * Check if a Tier 2 mapping should be applied\n */\n const shouldApplyTier2 = (\n mapping: SoundsLikeMapping,\n classification: Classification\n ): boolean => {\n // Must be Tier 2\n if (mapping.tier !== 2) {\n return false;\n }\n\n // Check confidence threshold\n const confidence = classification.confidence ?? 0;\n const minConfidence = mapping.minConfidence ?? tier2MinConfidence;\n\n if (confidence < minConfidence) {\n logger.debug(\n `Skipping Tier 2 replacement for \"${mapping.soundsLike}\": ` +\n `confidence ${confidence} < ${minConfidence}`\n );\n return false;\n }\n\n // For project-scoped mappings, check if project matches\n if (mapping.scopedToProjects && mapping.scopedToProjects.length > 0) {\n const classifiedProject = classification.project;\n\n if (!classifiedProject) {\n logger.debug(\n `Skipping Tier 2 replacement for \"${mapping.soundsLike}\": ` +\n `no project in classification`\n );\n return false;\n }\n\n if (!mapping.scopedToProjects.includes(classifiedProject)) {\n logger.debug(\n `Skipping Tier 2 replacement for \"${mapping.soundsLike}\": ` +\n `project \"${classifiedProject}\" not in scope [${mapping.scopedToProjects.join(', ')}]`\n );\n return false;\n }\n }\n\n logger.debug(\n `Applying Tier 2 replacement for \"${mapping.soundsLike}\" → \"${mapping.correctText}\" ` +\n `(project: ${classification.project}, confidence: ${confidence})`\n );\n return true;\n };\n\n /**\n * Resolve a collision by selecting the best mapping\n */\n const resolveCollision = (\n collision: Collision,\n classification: Classification\n ): SoundsLikeMapping | null => {\n const { soundsLike, mappings } = collision;\n\n logger.debug(`Resolving collision for \"${soundsLike}\" (${mappings.length} candidates)`);\n\n // Filter to Tier 1 and applicable Tier 2 mappings\n const tier1Mappings = mappings.filter(m => m.tier === 1);\n const tier2Mappings = mappings.filter(m => m.tier === 2 && shouldApplyTier2(m, classification));\n\n // Prefer Tier 1 if available (always safe)\n if (tier1Mappings.length === 1) {\n logger.debug(`Resolved collision: using Tier 1 mapping \"${tier1Mappings[0].correctText}\"`);\n return tier1Mappings[0];\n }\n\n // If multiple Tier 1 mappings, this is ambiguous (shouldn't happen in practice)\n if (tier1Mappings.length > 1) {\n logger.warn(`Multiple Tier 1 mappings for \"${soundsLike}\", skipping replacement`);\n return null;\n }\n\n // Try Tier 2 mappings that match classification\n if (tier2Mappings.length === 1) {\n logger.debug(`Resolved collision: using Tier 2 mapping \"${tier2Mappings[0].correctText}\"`);\n return tier2Mappings[0];\n }\n\n // If multiple Tier 2 mappings match, this is ambiguous\n if (tier2Mappings.length > 1) {\n logger.debug(`Multiple Tier 2 mappings match for \"${soundsLike}\", skipping replacement`);\n return null;\n }\n\n // No applicable mappings\n logger.debug(`No applicable mappings for collision \"${soundsLike}\"`);\n return null;\n };\n\n /**\n * Detect capitalization hints in surrounding text\n */\n const detectCapitalizationHint = (\n soundsLike: string,\n surroundingText: string\n ): 'proper-noun' | 'common-term' | 'unknown' => {\n if (!useCapitalizationHints || !surroundingText) {\n return 'unknown';\n }\n\n // Find the sounds_like in the surrounding text\n const regex = new RegExp(`\\\\b${soundsLike}\\\\b`, 'i');\n const match = surroundingText.match(regex);\n\n if (!match) {\n return 'unknown';\n }\n\n const matchedText = match[0];\n\n // Check if it's capitalized\n const isCapitalized = matchedText[0] === matchedText[0].toUpperCase();\n\n if (!isCapitalized) {\n // Lowercase in text → likely common term\n return 'common-term';\n }\n\n // Capitalized - check if it's at sentence start\n const indexInText = surroundingText.indexOf(matchedText);\n\n // Look back for sentence boundaries\n const beforeText = surroundingText.substring(0, indexInText).trimEnd();\n const isAtSentenceStart = beforeText.length === 0 || /[.!?]\\s*$/.test(beforeText);\n\n if (isAtSentenceStart) {\n // Capitalized at sentence start → ambiguous\n return 'unknown';\n }\n\n // Capitalized mid-sentence → likely proper noun\n return 'proper-noun';\n };\n\n /**\n * Decide whether to apply a replacement\n */\n const decideReplacement = (context: CollisionContext): ReplacementDecision => {\n const { classification, soundsLike, availableMappings, surroundingText } = context;\n\n // No mappings available\n if (availableMappings.length === 0) {\n return {\n shouldReplace: false,\n reason: 'No mappings available',\n confidence: 1.0,\n };\n }\n\n // Single mapping - straightforward\n if (availableMappings.length === 1) {\n const mapping = availableMappings[0];\n\n // Tier 1: Always apply\n if (mapping.tier === 1) {\n return {\n shouldReplace: true,\n mapping,\n reason: 'Tier 1 mapping (always safe)',\n confidence: 1.0,\n };\n }\n\n // Tier 2: Check conditions\n if (mapping.tier === 2) {\n if (shouldApplyTier2(mapping, classification)) {\n return {\n shouldReplace: true,\n mapping,\n reason: `Tier 2 mapping (project: ${classification.project}, confidence: ${classification.confidence})`,\n confidence: classification.confidence ?? 0.5,\n };\n } else {\n return {\n shouldReplace: false,\n reason: 'Tier 2 conditions not met',\n confidence: 0.5,\n };\n }\n }\n\n // Tier 3: Skip\n return {\n shouldReplace: false,\n reason: 'Tier 3 mapping (too ambiguous)',\n confidence: 1.0,\n };\n }\n\n // Multiple mappings - collision scenario\n const resolvedMapping = resolveCollision(\n { soundsLike, mappings: availableMappings, count: availableMappings.length },\n classification\n );\n\n if (resolvedMapping) {\n return {\n shouldReplace: true,\n mapping: resolvedMapping,\n reason: `Collision resolved (${availableMappings.length} candidates)`,\n confidence: classification.confidence ?? 0.5,\n };\n }\n\n // Use capitalization hint as fallback (future enhancement)\n if (surroundingText && useCapitalizationHints) {\n const hint = detectCapitalizationHint(soundsLike, surroundingText);\n\n if (hint === 'common-term') {\n return {\n shouldReplace: false,\n reason: 'Capitalization hint suggests common term',\n confidence: 0.7,\n };\n }\n }\n\n // Could not resolve collision\n return {\n shouldReplace: false,\n reason: 'Collision could not be resolved',\n confidence: 0.5,\n };\n };\n\n return {\n decideReplacement,\n shouldApplyTier2,\n resolveCollision,\n detectCapitalizationHint,\n };\n};\n"],"names":["Logging.getLogger"],"mappings":";;AAyGO,MAAM,MAAA,GAAS,CAAC,MAAA,KAA+C;AAClE,EAAA,MAAM,MAAA,GAASA,SAAQ,EAAU;AAEjC,EAAA,MAAM,kBAAA,GAAqB,QAAQ,kBAAsB;AAEzD,EAAA,MAAM,sBAAA,GAAyB,QAAQ,sBAAA,IAA0B,IAAA;AAKjE,EAAA,MAAM,gBAAA,GAAmB,CACrB,OAAA,EACA,cAAA,KACU;AAEV,IAAA,IAAI,OAAA,CAAQ,SAAS,CAAA,EAAG;AACpB,MAAA,OAAO,KAAA;AAAA,IACX;AAGA,IAAA,MAAM,UAAA,GAAa,eAAe,UAAA,IAAc,CAAA;AAChD,IAAA,MAAM,aAAA,GAAgB,QAAQ,aAAA,IAAiB,kBAAA;AAE/C,IAAA,IAAI,aAAa,aAAA,EAAe;AAC5B,MAAA,MAAA,CAAO,KAAA;AAAA,QACH,oCAAoC,OAAA,CAAQ,UAAU,CAAA,cAAA,EACxC,UAAU,MAAM,aAAa,CAAA;AAAA,OAC/C;AACA,MAAA,OAAO,KAAA;AAAA,IACX;AAGA,IAAA,IAAI,OAAA,CAAQ,gBAAA,IAAoB,OAAA,CAAQ,gBAAA,CAAiB,SAAS,CAAA,EAAG;AACjE,MAAA,MAAM,oBAAoB,cAAA,CAAe,OAAA;AAEzC,MAAA,IAAI,CAAC,iBAAA,EAAmB;AACpB,QAAA,MAAA,CAAO,KAAA;AAAA,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AAGA,IAAA,OAAO;AAAA,MACH,aAAA,EAAe,KAAA;AAAA,MACf,MAAA,EAAQ,iCAAA;AAAA,MACR,UAAA,EAAY;AAAA,KAChB;AAAA,EACJ,CAAA;AAEA,EAAA,OAAO;AAAA,IACH,iBAAA;AAAA,IACA,gBAAA;AAAA,IACA,gBAAA;AAAA,IACA;AAAA,GACJ;AACJ;;;;"}
1
+ {"version":3,"file":"index56.js","sources":["../src/agentic/tools/verify-spelling.ts"],"sourcesContent":["/**\n * Verify Spelling Tool\n * \n * Requests user verification for an unknown name or term.\n */\n\nimport { TranscriptionTool, ToolContext, ToolResult } from '../types';\n\nexport const create = (ctx: ToolContext): TranscriptionTool => ({\n name: 'verify_spelling',\n description: 'Request user verification for an unknown name or term. Use when you encounter something that needs human confirmation.',\n parameters: {\n type: 'object',\n properties: {\n term: {\n type: 'string',\n description: 'The term that needs verification',\n },\n context: {\n type: 'string',\n description: 'Context around where this term appears',\n },\n suggestedSpelling: {\n type: 'string',\n description: 'Your best guess at the correct spelling',\n },\n },\n required: ['term'],\n },\n execute: async (args: { term: string; context?: string; suggestedSpelling?: string }): Promise<ToolResult> => {\n if (!ctx.interactiveMode) {\n // In batch mode, return best guess\n return {\n success: true,\n data: {\n verified: false,\n useSuggestion: true,\n spelling: args.suggestedSpelling || args.term,\n message: 'Non-interactive mode: using best guess',\n },\n };\n }\n \n // In interactive mode, mark for user input\n return {\n success: true,\n needsUserInput: true,\n userPrompt: `Unknown term: \"${args.term}\"${args.context ? ` (context: \"${args.context}\")` : ''}\n${args.suggestedSpelling ? `Suggested spelling: \"${args.suggestedSpelling}\"` : ''}\nPlease provide the correct spelling:`,\n data: {\n term: args.term,\n suggestedSpelling: args.suggestedSpelling,\n },\n };\n },\n});\n\n"],"names":[],"mappings":"AAQO,MAAM,MAAA,GAAS,CAAC,GAAA,MAAyC;AAAA,EAC5D,IAAA,EAAM,iBAAA;AAAA,EACN,WAAA,EAAa,wHAAA;AAAA,EACb,UAAA,EAAY;AAA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import { getLogger } from './index47.js';
2
-
3
- const create = (config) => {
4
- const logger = getLogger();
5
- const createPattern = (soundsLike) => {
6
- const escaped = soundsLike.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
7
- const pattern = `\\b${escaped}\\b` ;
8
- const flags = "gi" ;
9
- return new RegExp(pattern, flags);
10
- };
11
- const applySingleReplacement = (text, mapping) => {
12
- const pattern = createPattern(mapping.soundsLike);
13
- const occurrences = [];
14
- let count = 0;
15
- const replacements = [];
16
- let match;
17
- while ((match = pattern.exec(text)) !== null) {
18
- const original = match[0];
19
- let replacement = mapping.correctText;
20
- replacements.push({
21
- index: match.index,
22
- length: original.length,
23
- replacement
24
- });
25
- occurrences.push({
26
- original,
27
- replacement,
28
- position: match.index,
29
- mapping
30
- });
31
- count++;
32
- }
33
- let resultText = text;
34
- for (let i = replacements.length - 1; i >= 0; i--) {
35
- const { index, length, replacement } = replacements[i];
36
- resultText = resultText.slice(0, index) + replacement + resultText.slice(index + length);
37
- }
38
- if (count > 0) {
39
- logger.debug(
40
- `Replaced "${mapping.soundsLike}" → "${mapping.correctText}" (${count} occurrence${count === 1 ? "" : "s"})`
41
- );
42
- }
43
- return {
44
- text: resultText,
45
- count,
46
- occurrences,
47
- appliedMappings: count > 0 ? [mapping] : []
48
- };
49
- };
50
- const applyReplacements = (text, mappings) => {
51
- let resultText = text;
52
- let totalCount = 0;
53
- const allOccurrences = [];
54
- const appliedMappings = [];
55
- for (const mapping of mappings) {
56
- const result = applySingleReplacement(resultText, mapping);
57
- if (result.count > 0) {
58
- resultText = result.text;
59
- totalCount += result.count;
60
- allOccurrences.push(...result.occurrences);
61
- appliedMappings.push(mapping);
1
+ const create = (ctx) => ({
2
+ name: "route_note",
3
+ description: "Determine the destination for this note based on content analysis.",
4
+ parameters: {
5
+ type: "object",
6
+ properties: {
7
+ projectHint: {
8
+ type: "string",
9
+ description: "The detected project name or hint"
10
+ },
11
+ contentSummary: {
12
+ type: "string",
13
+ description: "Brief summary of what the note is about"
62
14
  }
63
15
  }
64
- logger.debug(
65
- `Applied ${mappings.length} mappings, made ${totalCount} replacements (${appliedMappings.length} mappings had matches)`
66
- );
16
+ },
17
+ execute: async (args) => {
18
+ const routing = ctx.routingInstance;
19
+ const routingContext = {
20
+ transcriptText: ctx.transcriptText,
21
+ audioDate: ctx.audioDate,
22
+ sourceFile: ctx.sourceFile
23
+ };
24
+ const decision = routing.route(routingContext);
25
+ const outputPath = routing.buildOutputPath(decision, routingContext);
67
26
  return {
68
- text: resultText,
69
- count: totalCount,
70
- occurrences: allOccurrences,
71
- appliedMappings
27
+ success: true,
28
+ data: {
29
+ projectId: decision.projectId,
30
+ // Return the routing decision (base path + structure), NOT the built output path
31
+ // The orchestrator will call buildOutputPath() later
32
+ routingDecision: decision,
33
+ // Also include the built path for informational purposes
34
+ outputPath,
35
+ confidence: decision.confidence,
36
+ reasoning: decision.reasoning,
37
+ projectHint: args.projectHint,
38
+ contentSummary: args.contentSummary
39
+ }
72
40
  };
73
- };
74
- return {
75
- applyReplacements,
76
- applySingleReplacement
77
- };
78
- };
41
+ }
42
+ });
79
43
 
80
44
  export { create };
81
45
  //# sourceMappingURL=index57.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index57.js","sources":["../src/util/text-replacer.ts"],"sourcesContent":["/**\n * Text Replacer\n *\n * Performs intelligent text replacements with case preservation and word boundary matching.\n * Core utility for the simple-replace phase.\n *\n * Part of the simple-replace optimization (Phase 2).\n */\n\nimport * as Logging from '@/logging';\nimport { SoundsLikeMapping } from './sounds-like-database';\n\n/**\n * Replacement result for a single occurrence\n */\nexport interface ReplacementOccurrence {\n /** Original text that was replaced */\n original: string;\n\n /** Replacement text */\n replacement: string;\n\n /** Position in the text where replacement occurred */\n position: number;\n\n /** The mapping that was used */\n mapping: SoundsLikeMapping;\n}\n\n/**\n * Result of applying replacements to text\n */\nexport interface ReplacementResult {\n /** The text after replacements */\n text: string;\n\n /** Number of replacements made */\n count: number;\n\n /** Detailed information about each replacement */\n occurrences: ReplacementOccurrence[];\n\n /** Mappings that were applied */\n appliedMappings: SoundsLikeMapping[];\n}\n\n/**\n * Configuration for text replacer\n */\nexport interface TextReplacerConfig {\n /** Preserve case of original text when replacing (default: true) */\n preserveCase?: boolean;\n\n /** Use word boundaries for matching (default: true) */\n useWordBoundaries?: boolean;\n\n /** Case-insensitive matching (default: true) */\n caseInsensitive?: boolean;\n}\n\n/**\n * Instance interface for text replacer\n */\nexport interface Instance {\n /**\n * Apply a set of replacements to text\n */\n applyReplacements(text: string, mappings: SoundsLikeMapping[]): ReplacementResult;\n\n /**\n * Apply a single replacement to text\n */\n applySingleReplacement(text: string, mapping: SoundsLikeMapping): ReplacementResult;\n}\n\n/**\n * Create a text replacer instance\n */\nexport const create = (config?: TextReplacerConfig): Instance => {\n const logger = Logging.getLogger();\n\n const preserveCase = config?.preserveCase ?? true;\n const useWordBoundaries = config?.useWordBoundaries ?? true;\n const caseInsensitive = config?.caseInsensitive ?? true;\n\n /**\n * Determine the case style of a string\n */\n const getCaseStyle = (text: string): 'upper' | 'lower' | 'title' | 'mixed' => {\n // Check for all uppercase first (includes single chars)\n if (text.length > 0 && text === text.toUpperCase() && text.toUpperCase() !== text.toLowerCase()) {\n return 'upper';\n }\n // Check for all lowercase\n if (text === text.toLowerCase()) {\n return 'lower';\n }\n // Check for title case (first char upper, or mixed case starting with upper)\n if (text[0] === text[0].toUpperCase()) {\n return 'title';\n }\n return 'mixed';\n };\n\n /**\n * Apply case style from original to replacement\n *\n * Case preservation means: make the replacement match the case pattern of the original\n * - \"protocol\" (lowercase) → \"protokoll\" (lowercase)\n * - \"Protocol\" (title) → \"Protokoll\" (title)\n * - \"PROTOCOL\" (upper) → \"PROTOKOLL\" (upper)\n */\n const applyCaseStyle = (replacement: string, originalCase: 'upper' | 'lower' | 'title' | 'mixed'): string => {\n switch (originalCase) {\n case 'upper':\n // ALL CAPS in original → ALL CAPS in replacement\n return replacement.toUpperCase();\n case 'lower':\n // all lowercase in original → all lowercase in replacement\n return replacement.toLowerCase();\n case 'title':\n // Title Case in original → Title Case in replacement (first char upper, rest as-is)\n return replacement.charAt(0).toUpperCase() + replacement.slice(1);\n case 'mixed':\n default:\n // Mixed case → preserve replacement's original case\n return replacement;\n }\n };\n\n /**\n * Create a regex pattern for matching\n */\n const createPattern = (soundsLike: string): RegExp => {\n // Escape special regex characters\n const escaped = soundsLike.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n // Add word boundaries if enabled\n const pattern = useWordBoundaries ? `\\\\b${escaped}\\\\b` : escaped;\n\n // Create regex with appropriate flags\n const flags = caseInsensitive ? 'gi' : 'g';\n return new RegExp(pattern, flags);\n };\n\n /**\n * Apply a single replacement to text\n */\n const applySingleReplacement = (text: string, mapping: SoundsLikeMapping): ReplacementResult => {\n const pattern = createPattern(mapping.soundsLike);\n const occurrences: ReplacementOccurrence[] = [];\n let count = 0;\n\n // Track positions to avoid double-replacement issues\n const replacements: { index: number; length: number; replacement: string }[] = [];\n\n // Find all matches\n let match: RegExpExecArray | null;\n while ((match = pattern.exec(text)) !== null) {\n const original = match[0];\n let replacement = mapping.correctText;\n\n // Preserve case if enabled\n if (preserveCase) {\n const caseStyle = getCaseStyle(original);\n replacement = applyCaseStyle(replacement, caseStyle);\n }\n\n replacements.push({\n index: match.index,\n length: original.length,\n replacement,\n });\n\n occurrences.push({\n original,\n replacement,\n position: match.index,\n mapping,\n });\n\n count++;\n }\n\n // Apply replacements in reverse order to preserve positions\n let resultText = text;\n for (let i = replacements.length - 1; i >= 0; i--) {\n const { index, length, replacement } = replacements[i];\n resultText = resultText.slice(0, index) + replacement + resultText.slice(index + length);\n }\n\n if (count > 0) {\n logger.debug(\n `Replaced \"${mapping.soundsLike}\" → \"${mapping.correctText}\" ` +\n `(${count} occurrence${count === 1 ? '' : 's'})`\n );\n }\n\n return {\n text: resultText,\n count,\n occurrences,\n appliedMappings: count > 0 ? [mapping] : [],\n };\n };\n\n /**\n * Apply multiple replacements to text\n */\n const applyReplacements = (text: string, mappings: SoundsLikeMapping[]): ReplacementResult => {\n let resultText = text;\n let totalCount = 0;\n const allOccurrences: ReplacementOccurrence[] = [];\n const appliedMappings: SoundsLikeMapping[] = [];\n\n // Apply each mapping sequentially\n for (const mapping of mappings) {\n const result = applySingleReplacement(resultText, mapping);\n\n if (result.count > 0) {\n resultText = result.text;\n totalCount += result.count;\n allOccurrences.push(...result.occurrences);\n appliedMappings.push(mapping);\n }\n }\n\n logger.debug(\n `Applied ${mappings.length} mappings, made ${totalCount} replacements ` +\n `(${appliedMappings.length} mappings had matches)`\n );\n\n return {\n text: resultText,\n count: totalCount,\n occurrences: allOccurrences,\n appliedMappings,\n };\n };\n\n return {\n applyReplacements,\n applySingleReplacement,\n };\n};\n"],"names":["Logging.getLogger"],"mappings":";;AA8EO,MAAM,MAAA,GAAS,CAAC,MAAA,KAA0C;AAC7D,EAAA,MAAM,MAAA,GAASA,SAAQ,EAAU;AAsDjC,EAAA,MAAM,aAAA,GAAgB,CAAC,UAAA,KAA+B;AAElD,IAAA,MAAM,OAAA,GAAU,UAAA,CAAW,OAAA,CAAQ,qBAAA,EAAuB,MAAM,CAAA;AAGhE,IAAA,MAAM,OAAA,GAA8B,CAAA,GAAA,EAAM,OAAO,CAAA,GAAA,CAAA,CAAQ;AAGzD,IAAA,MAAM,KAAA,GAA0B,IAAA,CAAO;AACvC,IAAA,OAAO,IAAI,MAAA,CAAO,OAAA,EAAS,KAAK,CAAA;AAAA,EACpC,CAAA;AAKA,EAAA,MAAM,sBAAA,GAAyB,CAAC,IAAA,EAAc,OAAA,KAAkD;AAC5F,IAAA,MAAM,OAAA,GAAU,aAAA,CAAc,OAAA,CAAQ,UAAU,CAAA;AAChD,IAAA,MAAM,cAAuC,EAAC;AAC9C,IAAA,IAAI,KAAA,GAAQ,CAAA;AAGZ,IAAA,MAAM,eAAyE,EAAC;AAGhF,IAAA,IAAI,KAAA;AACJ,IAAA,OAAA,CAAQ,KAAA,GAAQ,OAAA,CAAQ,IAAA,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J,CAAA;AAKA,EAAA,MAAM,iBAAA,GAAoB,CAAC,IAAA,EAAc,QAAA,KAAqD;AAC1F,IAAA,IAAI,UAAA,GAAa,IAAA;AACjB,IAAA,IAAI,UAAA,GAAa,CAAA;AACjB,IAAA,MAAM,iBAA0C,EAAC;AACjD,IAAA,MAAM,kBAAuC,EAAC;AAG9C,IAAA,KAAA,MAAW,WAAW,QAAA,EAAU;AAC5B,MAAA,MAAM,MAAA,GAAS,sBAAA,CAAuB,UAAA,EAAY,OAAO,CAAA;AAEzD,MAAA,IAAI,MAAA,CAAO,QAAQ,CAAA,EAAG;AAClB,QAAA,UAAA,GAAa,MAAA,CAAO,IAAA;AACpB,QAAA,UAAA,IAAc,MAAA,CAAO,KAAA;AACrB,QAAA,cAAA,CAAe,IAAA,CAAK,GAAG,MAAA,CAAO,WAAW,CAAA;AACzC,QAAA,eAAA,CAAgB,KAAK,OAAO,CAAA;AAAA,MAChC;AAAA,IACJ;AAEA,IAAA,MAAA,CAAO,KAAA;AAAA,MACH,WAAW,QAAA,CAAS,MAAM,mBAAmB,UAAU,CAAA,eAAA,EACnD,gBAAgB,MAAM,CAAA,sBAAA;AAAA,KAC9B;AAEA,IAAA,OAAO;AAAA,MACH,IAAA,EAAM,UAAA;AAAA,MACN,KAAA,EAAO,UAAA;AAAA,MACP,WAAA,EAAa,cAAA;AAAA,MACb;AAAA,KACJ;AAAA,EACJ,CAAA;AAEA,EAAA,OAAO;AAAA,IACH,iBAAA;AAAA,IACA;AAAA,GACJ;AACJ;;;;"}
1
+ {"version":3,"file":"index57.js","sources":["../src/agentic/tools/route-note.ts"],"sourcesContent":["/**\n * Route Note Tool\n * \n * Determines the destination for a note based on content analysis.\n */\n\nimport { TranscriptionTool, ToolContext, ToolResult } from '../types';\n\nexport const create = (ctx: ToolContext): TranscriptionTool => ({\n name: 'route_note',\n description: 'Determine the destination for this note based on content analysis.',\n parameters: {\n type: 'object',\n properties: {\n projectHint: {\n type: 'string',\n description: 'The detected project name or hint',\n },\n contentSummary: {\n type: 'string',\n description: 'Brief summary of what the note is about',\n },\n },\n },\n execute: async (args: { projectHint?: string; contentSummary?: string }): Promise<ToolResult> => {\n const routing = ctx.routingInstance;\n \n const routingContext = {\n transcriptText: ctx.transcriptText,\n audioDate: ctx.audioDate,\n sourceFile: ctx.sourceFile,\n };\n \n const decision = routing.route(routingContext);\n const outputPath = routing.buildOutputPath(decision, routingContext);\n \n return {\n success: true,\n data: {\n projectId: decision.projectId,\n // Return the routing decision (base path + structure), NOT the built output path\n // The orchestrator will call buildOutputPath() later\n routingDecision: decision,\n // Also include the built path for informational purposes\n outputPath: outputPath,\n confidence: decision.confidence,\n reasoning: decision.reasoning,\n projectHint: args.projectHint,\n contentSummary: args.contentSummary,\n },\n };\n },\n});\n\n"],"names":[],"mappings":"AAQO,MAAM,MAAA,GAAS,CAAC,GAAA,MAAyC;AAAA,EAC5D,IAAA,EAAM,YAAA;AAAA,EACN,WAAA,EAAa,oEAAA;AAAA,EACb,UAAA,EAAY;AAAA,IACR,IAAA,EAAM,QAAA;AAAA,IACN,UAAA,EAAY;AAAA,MACR,WAAA,EAAa;AAAA,QACT,IAAA,EAAM,QAAA;AAAA,QACN,WAAA,EAAa;AAAA,OACjB;AAAA,MACA,cAAA,EAAgB;AAAA,QACZ,IAAA,EAAM,QAAA;AAAA,QACN,WAAA,EAAa;AAAA;AACjB;AACJ,GACJ;AAAA,EACA,OAAA,EAAS,OAAO,IAAA,KAAiF;AAC7F,IAAA,MAAM,UAAU,GAAA,CAAI,eAAA;AAEpB,IAAA,MAAM,cAAA,GAAiB;AAAA,MACnB,gBAAgB,GAAA,CAAI,cAAA;AAAA,MACpB,WAAW,GAAA,CAAI,SAAA;AAAA,MACf,YAAY,GAAA,CAAI;AAAA,KACpB;AAEA,IAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,KAAA,CAAM,cAAc,CAAA;AAC7C,IAAA,MAAM,UAAA,GAAa,OAAA,CAAQ,eAAA,CAAgB,QAAA,EAAU,cAAc,CAAA;AAEnE,IAAA,OAAO;AAAA,MACH,OAAA,EAAS,IAAA;AAAA,MACT,IAAA,EAAM;AAAA,QACF,WAAW,QAAA,CAAS,SAAA;AAAA;AAAA;AAAA,QAGpB,eAAA,EAAiB,QAAA;AAAA;AAAA,QAEjB,UAAA;AAAA,QACA,YAAY,QAAA,CAAS,UAAA;AAAA,QACrB,WAAW,QAAA,CAAS,SAAA;AAAA,QACpB,aAAa,IAAA,CAAK,WAAA;AAAA,QAClB,gBAAgB,IAAA,CAAK;AAAA;AACzB,KACJ;AAAA,EACJ;AACJ,CAAA;;;;"}
package/dist/index58.js CHANGED
@@ -1,78 +1,37 @@
1
- import dayjs from 'dayjs';
2
- import timezone from './index60.js';
3
- import utc from './index61.js';
4
- import 'moment-timezone';
5
-
6
- dayjs.extend(utc);
7
- dayjs.extend(timezone);
8
- const create = (parameters) => {
9
- const { timezone: timezone2 } = parameters;
10
- const now = () => {
11
- return date(void 0);
12
- };
13
- const date = (date2) => {
14
- let value;
15
- try {
16
- if (date2) {
17
- value = dayjs.tz(date2, timezone2);
18
- } else {
19
- value = dayjs().tz(timezone2);
1
+ const create = (_ctx) => ({
2
+ name: "store_context",
3
+ description: "Store new context information for future use. Use when you learn something new that should be remembered.",
4
+ parameters: {
5
+ type: "object",
6
+ properties: {
7
+ entityType: {
8
+ type: "string",
9
+ enum: ["person", "project", "company", "term"],
10
+ description: "Type of entity to store"
11
+ },
12
+ name: {
13
+ type: "string",
14
+ description: "Name of the entity"
15
+ },
16
+ details: {
17
+ type: "object",
18
+ description: "Additional details about the entity"
19
+ }
20
+ },
21
+ required: ["entityType", "name"]
22
+ },
23
+ execute: async (args) => {
24
+ return {
25
+ success: true,
26
+ data: {
27
+ stored: false,
28
+ message: "Context storage requires --self-update flag. Information noted but not persisted.",
29
+ entityType: args.entityType,
30
+ name: args.name
20
31
  }
21
- } catch (error) {
22
- throw new Error(`Invalid date: ${date2}, error: ${error.message}`);
23
- }
24
- return value.toDate();
25
- };
26
- const parse = (date2, format2) => {
27
- let value;
28
- try {
29
- value = dayjs.tz(date2, format2, timezone2);
30
- } catch (error) {
31
- throw new Error(`Invalid date: ${date2}, expected format: ${format2}, error: ${error.message}`);
32
- }
33
- return value.toDate();
34
- };
35
- const addDays = (date2, days) => {
36
- return dayjs.tz(date2, timezone2).add(days, "day").toDate();
37
- };
38
- const addMonths = (date2, months) => {
39
- return dayjs.tz(date2, timezone2).add(months, "month").toDate();
40
- };
41
- const addYears = (date2, years) => {
42
- return dayjs.tz(date2, timezone2).add(years, "year").toDate();
43
- };
44
- const format = (date2, format2) => {
45
- return dayjs.tz(date2, timezone2).format(format2);
46
- };
47
- const subDays = (date2, days) => {
48
- return dayjs.tz(date2, timezone2).subtract(days, "day").toDate();
49
- };
50
- const subMonths = (date2, months) => {
51
- return dayjs.tz(date2, timezone2).subtract(months, "month").toDate();
52
- };
53
- const subYears = (date2, years) => {
54
- return dayjs.tz(date2, timezone2).subtract(years, "year").toDate();
55
- };
56
- const startOfMonth = (date2) => {
57
- return dayjs.tz(date2, timezone2).startOf("month").toDate();
58
- };
59
- const endOfMonth = (date2) => {
60
- return dayjs.tz(date2, timezone2).endOf("month").toDate();
61
- };
62
- const startOfYear = (date2) => {
63
- return dayjs.tz(date2, timezone2).startOf("year").toDate();
64
- };
65
- const endOfYear = (date2) => {
66
- return dayjs.tz(date2, timezone2).endOf("year").toDate();
67
- };
68
- const isBefore = (date2, other) => {
69
- return dayjs.tz(date2, timezone2).isBefore(dayjs.tz(other, timezone2));
70
- };
71
- const isAfter = (date2, other) => {
72
- return dayjs.tz(date2, timezone2).isAfter(dayjs.tz(other, timezone2));
73
- };
74
- return { now, date, parse, addDays, addMonths, addYears, format, subDays, subMonths, subYears, startOfMonth, endOfMonth, startOfYear, endOfYear, isBefore, isAfter };
75
- };
32
+ };
33
+ }
34
+ });
76
35
 
77
36
  export { create };
78
37
  //# sourceMappingURL=index58.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index58.js","sources":["../src/util/dates.ts"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport dayjs from 'dayjs';\nimport timezone from 'dayjs/plugin/timezone';\nimport utc from 'dayjs/plugin/utc';\n// eslint-disable-next-line no-restricted-imports\nimport moment from 'moment-timezone';\n\ndayjs.extend(utc);\ndayjs.extend(timezone);\n\n/**\n * Yes, wrapping dayjs is a bit annoying and might seem overly paranoid. However, I feel strongly\n * about not letting Dayjs instances leak into the rest of the codebase. Having Dayjs objects\n * floating around the application leads to inconsistent timezone handling, makes testing more\n * difficult, and creates subtle bugs that are hard to track down.\n * \n * By wrapping dayjs completely and only exposing plain JavaScript Date objects, we get several\n * key benefits:\n * 1. Consistent timezone handling through a single configuration point\n * 2. Simpler testing since we only need to mock this one library\n * 3. Type safety - the rest of the codebase only deals with standard Date objects\n * 4. No risk of dayjs method chains creating unexpected timezone shifts\n * \n * The Library interface gives us full control over all date operations while keeping the messy\n * details of timezone manipulation contained in one place. Yes it's more code, but the peace of\n * mind is worth it.\n */\nexport interface Utility {\n now: () => Date;\n date: (date: string | number | Date | null | undefined) => Date;\n parse: (date: string | number | Date | null | undefined, format: string) => Date;\n addDays: (date: Date, days: number) => Date;\n addMonths: (date: Date, months: number) => Date;\n addYears: (date: Date, years: number) => Date;\n format: (date: Date, format: string) => string;\n subDays: (date: Date, days: number) => Date;\n subMonths: (date: Date, months: number) => Date;\n subYears: (date: Date, years: number) => Date;\n startOfMonth: (date: Date) => Date;\n endOfMonth: (date: Date) => Date;\n startOfYear: (date: Date) => Date;\n endOfYear: (date: Date) => Date;\n isBefore: (date: Date, other: Date) => boolean;\n isAfter: (date: Date, other: Date) => boolean;\n}\n\nexport const create = (parameters: { timezone: string }) => {\n const { timezone } = parameters;\n const now = () => {\n return date(undefined);\n }\n\n const date = (date: string | number | Date | null | undefined) => {\n let value: dayjs.Dayjs;\n try {\n if (date) {\n value = dayjs.tz(date, timezone);\n } else {\n value = dayjs().tz(timezone);\n }\n } catch (error: any) {\n throw new Error(`Invalid date: ${date}, error: ${error.message}`);\n }\n\n return value.toDate();\n }\n\n const parse = (date: string | number | Date | null | undefined, format: string) => {\n let value: dayjs.Dayjs;\n try {\n value = dayjs.tz(date, format, timezone);\n } catch (error: any) {\n throw new Error(`Invalid date: ${date}, expected format: ${format}, error: ${error.message}`);\n }\n\n return value.toDate();\n }\n\n const addDays = (date: Date, days: number) => {\n return dayjs.tz(date, timezone).add(days, 'day').toDate();\n }\n\n const addMonths = (date: Date, months: number) => {\n return dayjs.tz(date, timezone).add(months, 'month').toDate();\n }\n\n const addYears = (date: Date, years: number) => {\n return dayjs.tz(date, timezone).add(years, 'year').toDate();\n }\n\n const format = (date: Date, format: string) => {\n return dayjs.tz(date, timezone).format(format);\n }\n\n const subDays = (date: Date, days: number) => {\n return dayjs.tz(date, timezone).subtract(days, 'day').toDate();\n }\n\n const subMonths = (date: Date, months: number) => {\n return dayjs.tz(date, timezone).subtract(months, 'month').toDate();\n }\n\n const subYears = (date: Date, years: number) => {\n return dayjs.tz(date, timezone).subtract(years, 'year').toDate();\n }\n\n const startOfMonth = (date: Date) => {\n return dayjs.tz(date, timezone).startOf('month').toDate();\n }\n\n const endOfMonth = (date: Date) => {\n return dayjs.tz(date, timezone).endOf('month').toDate();\n }\n\n const startOfYear = (date: Date) => {\n return dayjs.tz(date, timezone).startOf('year').toDate();\n }\n\n const endOfYear = (date: Date) => {\n return dayjs.tz(date, timezone).endOf('year').toDate();\n }\n\n const isBefore = (date: Date, other: Date) => {\n return dayjs.tz(date, timezone).isBefore(dayjs.tz(other, timezone));\n }\n\n const isAfter = (date: Date, other: Date) => {\n return dayjs.tz(date, timezone).isAfter(dayjs.tz(other, timezone));\n }\n\n return { now, date, parse, addDays, addMonths, addYears, format, subDays, subMonths, subYears, startOfMonth, endOfMonth, startOfYear, endOfYear, isBefore, isAfter };\n}\n\nexport const validTimezones = () => {\n return moment.tz.names();\n}\n"],"names":["timezone","date","format"],"mappings":";;;;;AAOA,KAAA,CAAM,OAA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A;AAEA,EAAA,OAAO,EAAE,GAAA,EAAK,IAAA,EAAM,KAAA,EAAO,OAAA,EAAS,WAAW,QAAA,EAAU,MAAA,EAAQ,OAAA,EAAS,SAAA,EAAW,UAAU,YAAA,EAAc,UAAA,EAAY,WAAA,EAAa,SAAA,EAAW,UAAU,OAAA,EAAQ;AACvK;;;;"}
1
+ {"version":3,"file":"index58.js","sources":["../src/agentic/tools/store-context.ts"],"sourcesContent":["/**\n * Store Context Tool\n * \n * Stores new context information for future use.\n */\n\nimport { TranscriptionTool, ToolContext, ToolResult } from '../types';\n\nexport const create = (_ctx: ToolContext): TranscriptionTool => ({\n name: 'store_context',\n description: 'Store new context information for future use. Use when you learn something new that should be remembered.',\n parameters: {\n type: 'object',\n properties: {\n entityType: {\n type: 'string',\n enum: ['person', 'project', 'company', 'term'],\n description: 'Type of entity to store',\n },\n name: {\n type: 'string',\n description: 'Name of the entity',\n },\n details: {\n type: 'object',\n description: 'Additional details about the entity',\n },\n },\n required: ['entityType', 'name'],\n },\n \n execute: async (args: { entityType: string; name: string; details?: any }): Promise<ToolResult> => {\n // This tool requires --self-update flag to actually persist\n // Otherwise it just acknowledges without saving\n \n return {\n success: true,\n data: {\n stored: false,\n message: 'Context storage requires --self-update flag. Information noted but not persisted.',\n entityType: args.entityType,\n name: args.name,\n },\n };\n },\n});\n\n"],"names":[],"mappings":"AAQO,MAAM,MAAA,GAAS,CAAC,IAAA,MAA0C;AAAA,EAC7D,IAAA,EAAM,eAAA;AAAA,EACN,WAAA,EAAa,2GAAA;AAAA,EACb,UAAA,EAAY;AAAA,IACR,IAAA,EAAM,QAAA;AAAA,IACN,UAAA,EAAY;AAAA,MACR,UAAA,EAAY;AAAA,QACR,IAAA,EAAM,QAAA;AAAA,QACN,IAAA,EAAM,CAAC,QAAA,EAAU,SAAA,EAAW,WAAW,MAAM,CAAA;AAAA,QAC7C,WAAA,EAAa;AAAA,OACjB;AAAA,MACA,IAAA,EAAM;AAAA,QACF,IAAA,EAAM,QAAA;AAAA,QACN,WAAA,EAAa;AAAA,OACjB;AAAA,MACA,OAAA,EAAS;AAAA,QACL,IAAA,EAAM,QAAA;AAAA,QACN,WAAA,EAAa;AAAA;AACjB,KACJ;AAAA,IACA,QAAA,EAAU,CAAC,YAAA,EAAc,MAAM;AAAA,GACnC;AAAA,EAEA,OAAA,EAAS,OAAO,IAAA,KAAmF;AAI/F,IAAA,OAAO;AAAA,MACH,OAAA,EAAS,IAAA;AAAA,MACT,IAAA,EAAM;AAAA,QACF,MAAA,EAAQ,KAAA;AAAA,QACR,OAAA,EAAS,mFAAA;AAAA,QACT,YAAY,IAAA,CAAK,UAAA;AAAA,QACjB,MAAM,IAAA,CAAK;AAAA;AACf,KACJ;AAAA,EACJ;AACJ,CAAA;;;;"}
package/dist/index63.js CHANGED
@@ -7,7 +7,7 @@ var hasRequiredTimezone;
7
7
  function requireTimezone () {
8
8
  if (hasRequiredTimezone) return timezone$1.exports;
9
9
  hasRequiredTimezone = 1;
10
- (function (module, exports$1) {
10
+ (function (module, exports) {
11
11
  !function(t,e){module.exports=e();}(timezone,(function(){var t={year:0,month:1,day:2,hour:3,minute:4,second:5},e={};return function(n,i,o){var r,a=function(t,n,i){ void 0===i&&(i={});var o=new Date(t),r=function(t,n){ void 0===n&&(n={});var i=n.timeZoneName||"short",o=t+"|"+i,r=e[o];return r||(r=new Intl.DateTimeFormat("en-US",{hour12:false,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:i}),e[o]=r),r}(n,i);return r.formatToParts(o)},u=function(e,n){for(var i=a(e,n),r=[],u=0;u<i.length;u+=1){var f=i[u],s=f.type,m=f.value,c=t[s];c>=0&&(r[c]=parseInt(m,10));}var d=r[3],l=24===d?0:d,h=r[0]+"-"+r[1]+"-"+r[2]+" "+l+":"+r[4]+":"+r[5]+":000",v=+e;return (o.utc(h).valueOf()-(v-=v%1e3))/6e4},f=i.prototype;f.tz=function(t,e){ void 0===t&&(t=r);var n,i=this.utcOffset(),a=this.toDate(),u=a.toLocaleString("en-US",{timeZone:t}),f=Math.round((a-new Date(u))/1e3/60),s=15*-Math.round(a.getTimezoneOffset()/15)-f;if(!Number(s))n=this.utcOffset(0,e);else if(n=o(u,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(s,true),e){var m=n.utcOffset();n=n.add(i-m,"minute");}return n.$x.$timezone=t,n},f.offsetName=function(t){var e=this.$x.$timezone||o.tz.guess(),n=a(this.valueOf(),e,{timeZoneName:t}).find((function(t){return "timezonename"===t.type.toLowerCase()}));return n&&n.value};var s=f.startOf;f.startOf=function(t,e){if(!this.$x||!this.$x.$timezone)return s.call(this,t,e);var n=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return s.call(n,t,e).tz(this.$x.$timezone,true)},o.tz=function(t,e,n){var i=n&&e,a=n||e||r,f=u(+o(),a);if("string"!=typeof t)return o(t).tz(a);var s=function(t,e,n){var i=t-60*e*1e3,o=u(i,n);if(e===o)return [i,e];var r=u(i-=60*(o-e)*1e3,n);return o===r?[i,o]:[t-60*Math.min(o,r)*1e3,Math.max(o,r)]}(o.utc(t,i).valueOf(),f,a),m=s[0],c=s[1],d=o(m).utcOffset(c);return d.$x.$timezone=a,d},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(t){r=t;};}}));
12
12
  } (timezone$1));
13
13
  return timezone$1.exports;
package/dist/index65.js CHANGED
@@ -7,7 +7,7 @@ var hasRequiredUtc;
7
7
  function requireUtc () {
8
8
  if (hasRequiredUtc) return utc$1.exports;
9
9
  hasRequiredUtc = 1;
10
- (function (module, exports$1) {
10
+ (function (module, exports) {
11
11
  !function(t,i){module.exports=i();}(utc,(function(){var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:true,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:true});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:false})};var r=u.parse;u.parse=function(t){t.utc&&(this.$u=true),this.$utils().u(t.$offset)||(this.$offset=t.$offset),r.call(this,t);};var o=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds();}else o.call(this);};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){ void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s;if(0===u)return this.utc(f);var r=this.clone();if(f)return r.$offset=u,r.$u=false,r;var o=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return (r=this.local().add(u+o,t)).$offset=u,r.$x.$localOffset=o,r};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i)},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},u.isUTC=function(){return !!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(t){return "s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e)};}}));
12
12
  } (utc$1));
13
13
  return utc$1.exports;
@@ -9,6 +9,7 @@ type TranscriptMetadata = {
9
9
  status: 'uploaded' | 'transcribing' | 'error' | 'initial' | 'enhanced' | 'reviewed' | 'in_progress' | 'closed' | 'archived' | 'deleted';
10
10
  audioFile?: string;
11
11
  originalFilename?: string;
12
+ audioSizeBytes?: number;
12
13
  audioHash?: string;
13
14
  date?: Date;
14
15
  title?: string;
@@ -21,6 +22,7 @@ type TranscriptMetadata = {
21
22
  export interface CreateUploadTranscriptParams {
22
23
  audioFile: string;
23
24
  originalFilename: string;
25
+ audioSizeBytes?: number;
24
26
  audioHash: string;
25
27
  outputDirectory: string;
26
28
  title?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"upload-utils.d.ts","sourceRoot":"","sources":["../../src/transcript/upload-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,KAAK,kBAAkB,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,UAAU,GAAG,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IACxI,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,wBA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AAM,EAAE,GAC5B,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CA0BpC;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CACzC,iBAAiB,EAAE,MAAM,EAAE,GAC5B,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAmC/B;AAED;;;;;;;;GAQG;AACH,wBAAsB,2BAA2B,CAC7C,iBAAiB,EAAE,MAAM,EAAE,GAC5B,OAAO,CAAC,kBAAkB,EAAE,CAAC,CA4B/B;AAED;;;;;;GAMG;AACH,wBAAsB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAa/E;AAED;;;;GAIG;AACH,wBAAsB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIlF;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CACxC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC,CAOf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redaksjon/protokoll-engine",
3
- "version": "0.1.19",
3
+ "version": "0.2.0-dev.20260521201150.7ae20f9",
4
4
  "description": "Processing engine for Protokoll - transcription pipeline, agentic execution, routing, and LLM integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -46,8 +46,8 @@
46
46
  "@anthropic-ai/sdk": "^0.71.2",
47
47
  "@google/generative-ai": "^0.24.1",
48
48
  "@kjerneverk/riotprompt": "^1.0.6",
49
- "@redaksjon/context": "^0.0.16",
50
- "@redaksjon/protokoll-format": "^0.1.11",
49
+ "@redaksjon/context": "^0.1.0",
50
+ "@redaksjon/protokoll-format": "^0.2.0",
51
51
  "@utilarium/cardigantime": "^0.0.27",
52
52
  "@utilarium/dreadcabinet": "^0.0.18",
53
53
  "dayjs": "^1.11.13",