@redaksjon/protokoll-engine 0.1.1-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -0
- package/dist/agentic/executor.d.ts +21 -0
- package/dist/agentic/executor.d.ts.map +1 -0
- package/dist/agentic/index.d.ts +27 -0
- package/dist/agentic/index.d.ts.map +1 -0
- package/dist/agentic/registry.d.ts +11 -0
- package/dist/agentic/registry.d.ts.map +1 -0
- package/dist/agentic/tools/lookup-person.d.ts +3 -0
- package/dist/agentic/tools/lookup-person.d.ts.map +1 -0
- package/dist/agentic/tools/lookup-project.d.ts +3 -0
- package/dist/agentic/tools/lookup-project.d.ts.map +1 -0
- package/dist/agentic/tools/route-note.d.ts +3 -0
- package/dist/agentic/tools/route-note.d.ts.map +1 -0
- package/dist/agentic/tools/store-context.d.ts +3 -0
- package/dist/agentic/tools/store-context.d.ts.map +1 -0
- package/dist/agentic/tools/verify-spelling.d.ts +3 -0
- package/dist/agentic/tools/verify-spelling.d.ts.map +1 -0
- package/dist/agentic/types.d.ts +110 -0
- package/dist/agentic/types.d.ts.map +1 -0
- package/dist/constants.d.ts +98 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/feedback/analyzer.d.ts +13 -0
- package/dist/feedback/analyzer.d.ts.map +1 -0
- package/dist/feedback/decision-tracker.d.ts +14 -0
- package/dist/feedback/decision-tracker.d.ts.map +1 -0
- package/dist/feedback/handler.d.ts +14 -0
- package/dist/feedback/handler.d.ts.map +1 -0
- package/dist/feedback/index.d.ts +12 -0
- package/dist/feedback/index.d.ts.map +1 -0
- package/dist/feedback/types.d.ts +72 -0
- package/dist/feedback/types.d.ts.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/index10.js +4 -0
- package/dist/index10.js.map +1 -0
- package/dist/index11.js +22 -0
- package/dist/index11.js.map +1 -0
- package/dist/index12.js +125 -0
- package/dist/index12.js.map +1 -0
- package/dist/index13.js +124 -0
- package/dist/index13.js.map +1 -0
- package/dist/index14.js +296 -0
- package/dist/index14.js.map +1 -0
- package/dist/index15.js +100 -0
- package/dist/index15.js.map +1 -0
- package/dist/index16.js +107 -0
- package/dist/index16.js.map +1 -0
- package/dist/index17.js +185 -0
- package/dist/index17.js.map +1 -0
- package/dist/index18.js +53 -0
- package/dist/index18.js.map +1 -0
- package/dist/index19.js +19 -0
- package/dist/index19.js.map +1 -0
- package/dist/index2.js +33 -0
- package/dist/index2.js.map +1 -0
- package/dist/index20.js +105 -0
- package/dist/index20.js.map +1 -0
- package/dist/index21.js +26 -0
- package/dist/index21.js.map +1 -0
- package/dist/index22.js +49 -0
- package/dist/index22.js.map +1 -0
- package/dist/index23.js +119 -0
- package/dist/index23.js.map +1 -0
- package/dist/index24.js +330 -0
- package/dist/index24.js.map +1 -0
- package/dist/index25.js +57 -0
- package/dist/index25.js.map +1 -0
- package/dist/index26.js +38 -0
- package/dist/index26.js.map +1 -0
- package/dist/index27.js +127 -0
- package/dist/index27.js.map +1 -0
- package/dist/index28.js +157 -0
- package/dist/index28.js.map +1 -0
- package/dist/index29.js +163 -0
- package/dist/index29.js.map +1 -0
- package/dist/index3.js +36 -0
- package/dist/index3.js.map +1 -0
- package/dist/index30.js +173 -0
- package/dist/index30.js.map +1 -0
- package/dist/index31.js +423 -0
- package/dist/index31.js.map +1 -0
- package/dist/index32.js +161 -0
- package/dist/index32.js.map +1 -0
- package/dist/index33.js +152 -0
- package/dist/index33.js.map +1 -0
- package/dist/index34.js +56 -0
- package/dist/index34.js.map +1 -0
- package/dist/index35.js +103 -0
- package/dist/index35.js.map +1 -0
- package/dist/index36.js +451 -0
- package/dist/index36.js.map +1 -0
- package/dist/index37.js +431 -0
- package/dist/index37.js.map +1 -0
- package/dist/index38.js +87 -0
- package/dist/index38.js.map +1 -0
- package/dist/index39.js +122 -0
- package/dist/index39.js.map +1 -0
- package/dist/index4.js +3 -0
- package/dist/index4.js.map +1 -0
- package/dist/index40.js +299 -0
- package/dist/index40.js.map +1 -0
- package/dist/index41.js +49 -0
- package/dist/index41.js.map +1 -0
- package/dist/index42.js +151 -0
- package/dist/index42.js.map +1 -0
- package/dist/index43.js +226 -0
- package/dist/index43.js.map +1 -0
- package/dist/index44.js +49 -0
- package/dist/index44.js.map +1 -0
- package/dist/index45.js +45 -0
- package/dist/index45.js.map +1 -0
- package/dist/index46.js +37 -0
- package/dist/index46.js.map +1 -0
- package/dist/index47.js +51 -0
- package/dist/index47.js.map +1 -0
- package/dist/index48.js +39 -0
- package/dist/index48.js.map +1 -0
- package/dist/index49.js +239 -0
- package/dist/index49.js.map +1 -0
- package/dist/index5.js +17 -0
- package/dist/index5.js.map +1 -0
- package/dist/index50.js +163 -0
- package/dist/index50.js.map +1 -0
- package/dist/index51.js +81 -0
- package/dist/index51.js.map +1 -0
- package/dist/index52.js +78 -0
- package/dist/index52.js.map +1 -0
- package/dist/index53.js +22 -0
- package/dist/index53.js.map +1 -0
- package/dist/index54.js +8 -0
- package/dist/index54.js.map +1 -0
- package/dist/index55.js +8 -0
- package/dist/index55.js.map +1 -0
- package/dist/index56.js +17 -0
- package/dist/index56.js.map +1 -0
- package/dist/index57.js +4 -0
- package/dist/index57.js.map +1 -0
- package/dist/index58.js +17 -0
- package/dist/index58.js.map +1 -0
- package/dist/index59.js +4 -0
- package/dist/index59.js.map +1 -0
- package/dist/index6.js +22 -0
- package/dist/index6.js.map +1 -0
- package/dist/index60.js +6 -0
- package/dist/index60.js.map +1 -0
- package/dist/index7.js +27 -0
- package/dist/index7.js.map +1 -0
- package/dist/index8.js +22 -0
- package/dist/index8.js.map +1 -0
- package/dist/index9.js +5 -0
- package/dist/index9.js.map +1 -0
- package/dist/logging.d.ts +7 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/output/index.d.ts +15 -0
- package/dist/output/index.d.ts.map +1 -0
- package/dist/phases/complete.d.ts +17 -0
- package/dist/phases/complete.d.ts.map +1 -0
- package/dist/phases/index.d.ts +5 -0
- package/dist/phases/index.d.ts.map +1 -0
- package/dist/phases/locate.d.ts +15 -0
- package/dist/phases/locate.d.ts.map +1 -0
- package/dist/phases/simple-replace.d.ts +72 -0
- package/dist/phases/simple-replace.d.ts.map +1 -0
- package/dist/phases/transcribe.d.ts +19 -0
- package/dist/phases/transcribe.d.ts.map +1 -0
- package/dist/pipeline/index.d.ts +10 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/orchestrator.d.ts +13 -0
- package/dist/pipeline/orchestrator.d.ts.map +1 -0
- package/dist/pipeline/types.d.ts +58 -0
- package/dist/pipeline/types.d.ts.map +1 -0
- package/dist/prompt/index.d.ts +3 -0
- package/dist/prompt/index.d.ts.map +1 -0
- package/dist/prompt/templates.d.ts +40 -0
- package/dist/prompt/templates.d.ts.map +1 -0
- package/dist/prompt/transcribe.d.ts +42 -0
- package/dist/prompt/transcribe.d.ts.map +1 -0
- package/dist/reasoning/client.d.ts +42 -0
- package/dist/reasoning/client.d.ts.map +1 -0
- package/dist/reasoning/index.d.ts +17 -0
- package/dist/reasoning/index.d.ts.map +1 -0
- package/dist/reasoning/strategy.d.ts +12 -0
- package/dist/reasoning/strategy.d.ts.map +1 -0
- package/dist/reasoning/types.d.ts +58 -0
- package/dist/reasoning/types.d.ts.map +1 -0
- package/dist/reflection/collector.d.ts +18 -0
- package/dist/reflection/collector.d.ts.map +1 -0
- package/dist/reflection/index.d.ts +13 -0
- package/dist/reflection/index.d.ts.map +1 -0
- package/dist/reflection/reporter.d.ts +10 -0
- package/dist/reflection/reporter.d.ts.map +1 -0
- package/dist/reflection/types.d.ts +99 -0
- package/dist/reflection/types.d.ts.map +1 -0
- package/dist/routing/classifier.d.ts +8 -0
- package/dist/routing/classifier.d.ts.map +1 -0
- package/dist/routing/index.d.ts +12 -0
- package/dist/routing/index.d.ts.map +1 -0
- package/dist/routing/router.d.ts +8 -0
- package/dist/routing/router.d.ts.map +1 -0
- package/dist/routing/types.d.ts +68 -0
- package/dist/routing/types.d.ts.map +1 -0
- package/dist/transcript/feedback.d.ts +70 -0
- package/dist/transcript/feedback.d.ts.map +1 -0
- package/dist/transcript/index.d.ts +10 -0
- package/dist/transcript/index.d.ts.map +1 -0
- package/dist/transcript/operations.d.ts +152 -0
- package/dist/transcript/operations.d.ts.map +1 -0
- package/dist/transcript/pkl-utils.d.ts +66 -0
- package/dist/transcript/pkl-utils.d.ts.map +1 -0
- package/dist/transcription/index.d.ts +17 -0
- package/dist/transcription/index.d.ts.map +1 -0
- package/dist/transcription/service.d.ts +10 -0
- package/dist/transcription/service.d.ts.map +1 -0
- package/dist/transcription/types.d.ts +41 -0
- package/dist/transcription/types.d.ts.map +1 -0
- package/dist/types.d.ts +28 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/util/collision-detector.d.ts +77 -0
- package/dist/util/collision-detector.d.ts.map +1 -0
- package/dist/util/dates.d.ts +57 -0
- package/dist/util/dates.d.ts.map +1 -0
- package/dist/util/general.d.ts +3 -0
- package/dist/util/general.d.ts.map +1 -0
- package/dist/util/media.d.ts +9 -0
- package/dist/util/media.d.ts.map +1 -0
- package/dist/util/metadata.d.ts +138 -0
- package/dist/util/metadata.d.ts.map +1 -0
- package/dist/util/openai.d.ts +22 -0
- package/dist/util/openai.d.ts.map +1 -0
- package/dist/util/sounds-like-database.d.ts +98 -0
- package/dist/util/sounds-like-database.d.ts.map +1 -0
- package/dist/util/storage.d.ts +35 -0
- package/dist/util/storage.d.ts.map +1 -0
- package/dist/util/text-replacer.d.ts +56 -0
- package/dist/util/text-replacer.d.ts.map +1 -0
- package/dist/utils/entityFinder.d.ts +29 -0
- package/dist/utils/entityFinder.d.ts.map +1 -0
- package/package.json +84 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Yes, wrapping dayjs is a bit annoying and might seem overly paranoid. However, I feel strongly
|
|
3
|
+
* about not letting Dayjs instances leak into the rest of the codebase. Having Dayjs objects
|
|
4
|
+
* floating around the application leads to inconsistent timezone handling, makes testing more
|
|
5
|
+
* difficult, and creates subtle bugs that are hard to track down.
|
|
6
|
+
*
|
|
7
|
+
* By wrapping dayjs completely and only exposing plain JavaScript Date objects, we get several
|
|
8
|
+
* key benefits:
|
|
9
|
+
* 1. Consistent timezone handling through a single configuration point
|
|
10
|
+
* 2. Simpler testing since we only need to mock this one library
|
|
11
|
+
* 3. Type safety - the rest of the codebase only deals with standard Date objects
|
|
12
|
+
* 4. No risk of dayjs method chains creating unexpected timezone shifts
|
|
13
|
+
*
|
|
14
|
+
* The Library interface gives us full control over all date operations while keeping the messy
|
|
15
|
+
* details of timezone manipulation contained in one place. Yes it's more code, but the peace of
|
|
16
|
+
* mind is worth it.
|
|
17
|
+
*/
|
|
18
|
+
export interface Utility {
|
|
19
|
+
now: () => Date;
|
|
20
|
+
date: (date: string | number | Date | null | undefined) => Date;
|
|
21
|
+
parse: (date: string | number | Date | null | undefined, format: string) => Date;
|
|
22
|
+
addDays: (date: Date, days: number) => Date;
|
|
23
|
+
addMonths: (date: Date, months: number) => Date;
|
|
24
|
+
addYears: (date: Date, years: number) => Date;
|
|
25
|
+
format: (date: Date, format: string) => string;
|
|
26
|
+
subDays: (date: Date, days: number) => Date;
|
|
27
|
+
subMonths: (date: Date, months: number) => Date;
|
|
28
|
+
subYears: (date: Date, years: number) => Date;
|
|
29
|
+
startOfMonth: (date: Date) => Date;
|
|
30
|
+
endOfMonth: (date: Date) => Date;
|
|
31
|
+
startOfYear: (date: Date) => Date;
|
|
32
|
+
endOfYear: (date: Date) => Date;
|
|
33
|
+
isBefore: (date: Date, other: Date) => boolean;
|
|
34
|
+
isAfter: (date: Date, other: Date) => boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare const create: (parameters: {
|
|
37
|
+
timezone: string;
|
|
38
|
+
}) => {
|
|
39
|
+
now: () => Date;
|
|
40
|
+
date: (date: string | number | Date | null | undefined) => Date;
|
|
41
|
+
parse: (date: string | number | Date | null | undefined, format: string) => Date;
|
|
42
|
+
addDays: (date: Date, days: number) => Date;
|
|
43
|
+
addMonths: (date: Date, months: number) => Date;
|
|
44
|
+
addYears: (date: Date, years: number) => Date;
|
|
45
|
+
format: (date: Date, format: string) => string;
|
|
46
|
+
subDays: (date: Date, days: number) => Date;
|
|
47
|
+
subMonths: (date: Date, months: number) => Date;
|
|
48
|
+
subYears: (date: Date, years: number) => Date;
|
|
49
|
+
startOfMonth: (date: Date) => Date;
|
|
50
|
+
endOfMonth: (date: Date) => Date;
|
|
51
|
+
startOfYear: (date: Date) => Date;
|
|
52
|
+
endOfYear: (date: Date) => Date;
|
|
53
|
+
isBefore: (date: Date, other: Date) => boolean;
|
|
54
|
+
isAfter: (date: Date, other: Date) => boolean;
|
|
55
|
+
};
|
|
56
|
+
export declare const validTimezones: () => string[];
|
|
57
|
+
//# sourceMappingURL=dates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dates.d.ts","sourceRoot":"","sources":["../../src/util/dates.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,OAAO;IACpB,GAAG,EAAE,MAAM,IAAI,CAAC;IAChB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;IAChE,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACjF,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,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S,IAAI;oBAIlB,IAAI,SAAS,IAAI;CAK3C,CAAA;AAED,eAAO,MAAM,cAAc,gBAE1B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../src/util/general.ts"],"names":[],"mappings":"AACA,wBAAgB,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,GAAG,CAkBvD;AAGD,eAAO,MAAM,aAAa,GAAa,KAAK,GAAG,KAAG,MA+CjD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Logger } from 'winston';
|
|
2
|
+
export interface Media {
|
|
3
|
+
getAudioCreationTime: (filePath: string) => Promise<Date | null>;
|
|
4
|
+
getFileSize: (filePath: string) => Promise<number>;
|
|
5
|
+
splitAudioFile: (filePath: string, outputDir: string, maxSizeBytes: number) => Promise<string[]>;
|
|
6
|
+
convertToSupportedFormat: (filePath: string, outputDir: string, forceConversion?: boolean) => Promise<string>;
|
|
7
|
+
}
|
|
8
|
+
export declare const create: (logger: Logger) => Media;
|
|
9
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/util/media.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAIjC,MAAM,WAAW,KAAK;IAClB,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACjE,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACnD,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACjG,wBAAwB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACjH;AAYD,eAAO,MAAM,MAAM,GAAI,QAAQ,MAAM,KAAG,KAkKvC,CAAA"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import * as Routing from '@/routing';
|
|
2
|
+
/**
|
|
3
|
+
* Transcript lifecycle status
|
|
4
|
+
* - initial: Whisper transcription complete
|
|
5
|
+
* - enhanced: Context-aware enhancement complete
|
|
6
|
+
* - reviewed: User has reviewed the transcript
|
|
7
|
+
* - in_progress: Has outstanding tasks to complete
|
|
8
|
+
* - closed: All work complete, no pending tasks
|
|
9
|
+
* - archived: Archived for long-term storage
|
|
10
|
+
*/
|
|
11
|
+
export type TranscriptStatus = 'initial' | 'enhanced' | 'reviewed' | 'in_progress' | 'closed' | 'archived';
|
|
12
|
+
/**
|
|
13
|
+
* Record of a status transition with timestamp
|
|
14
|
+
*/
|
|
15
|
+
export interface StatusTransition {
|
|
16
|
+
from: TranscriptStatus;
|
|
17
|
+
to: TranscriptStatus;
|
|
18
|
+
at: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A follow-up task associated with a transcript
|
|
22
|
+
*/
|
|
23
|
+
export interface Task {
|
|
24
|
+
id: string;
|
|
25
|
+
description: string;
|
|
26
|
+
status: 'open' | 'done';
|
|
27
|
+
created: string;
|
|
28
|
+
changed?: string;
|
|
29
|
+
completed?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface EntityReference {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
type: 'person' | 'project' | 'term' | 'company';
|
|
35
|
+
}
|
|
36
|
+
export interface TranscriptMetadata {
|
|
37
|
+
title?: string;
|
|
38
|
+
project?: string;
|
|
39
|
+
projectId?: string;
|
|
40
|
+
routing?: RoutingMetadata;
|
|
41
|
+
tags?: string[];
|
|
42
|
+
date?: Date;
|
|
43
|
+
recordingTime?: string;
|
|
44
|
+
confidence?: number;
|
|
45
|
+
duration?: string;
|
|
46
|
+
status?: TranscriptStatus;
|
|
47
|
+
history?: StatusTransition[];
|
|
48
|
+
tasks?: Task[];
|
|
49
|
+
entities?: {
|
|
50
|
+
people?: EntityReference[];
|
|
51
|
+
projects?: EntityReference[];
|
|
52
|
+
terms?: EntityReference[];
|
|
53
|
+
companies?: EntityReference[];
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export interface RoutingMetadata {
|
|
57
|
+
destination: string;
|
|
58
|
+
confidence: number;
|
|
59
|
+
signals: Routing.ClassificationSignal[];
|
|
60
|
+
reasoning: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Format metadata as Markdown heading section
|
|
64
|
+
*/
|
|
65
|
+
export declare const formatMetadataMarkdown: (metadata: TranscriptMetadata) => string;
|
|
66
|
+
/**
|
|
67
|
+
* Format entity metadata as Markdown footer section
|
|
68
|
+
* This goes at the END of the transcript for machine readability
|
|
69
|
+
*/
|
|
70
|
+
export declare const formatEntityMetadataMarkdown: (metadata: TranscriptMetadata) => string;
|
|
71
|
+
/**
|
|
72
|
+
* Parse entity metadata from a transcript
|
|
73
|
+
* Reads the Entity References section if present
|
|
74
|
+
*/
|
|
75
|
+
export declare const parseEntityMetadata: (content: string) => TranscriptMetadata["entities"] | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Extract routing metadata from a RouteDecision
|
|
78
|
+
*/
|
|
79
|
+
export declare const createRoutingMetadata: (decision: Routing.RouteDecision) => RoutingMetadata;
|
|
80
|
+
/**
|
|
81
|
+
* Format duration in seconds to readable format (e.g., "2m 30s")
|
|
82
|
+
*/
|
|
83
|
+
export declare const formatDuration: (seconds: number) => string;
|
|
84
|
+
/**
|
|
85
|
+
* Format time as HH:MM AM/PM
|
|
86
|
+
*/
|
|
87
|
+
export declare const formatTime: (date: Date) => string;
|
|
88
|
+
/**
|
|
89
|
+
* Extract topic from routing signals
|
|
90
|
+
*/
|
|
91
|
+
export declare const extractTopicFromSignals: (signals: Routing.ClassificationSignal[]) => string | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Extract all tags from routing signals
|
|
94
|
+
* Tags are deduplicated to avoid duplicates from multiple signal sources
|
|
95
|
+
*/
|
|
96
|
+
export declare const extractTagsFromSignals: (signals: Routing.ClassificationSignal[]) => string[];
|
|
97
|
+
/**
|
|
98
|
+
* Valid transcript statuses for validation
|
|
99
|
+
*/
|
|
100
|
+
export declare const VALID_STATUSES: TranscriptStatus[];
|
|
101
|
+
/**
|
|
102
|
+
* Check if a string is a valid TranscriptStatus
|
|
103
|
+
*/
|
|
104
|
+
export declare const isValidStatus: (status: string) => status is TranscriptStatus;
|
|
105
|
+
/**
|
|
106
|
+
* Generate a unique task ID
|
|
107
|
+
*/
|
|
108
|
+
export declare const generateTaskId: () => string;
|
|
109
|
+
/**
|
|
110
|
+
* Create a new task
|
|
111
|
+
*/
|
|
112
|
+
export declare const createTask: (description: string) => Task;
|
|
113
|
+
/**
|
|
114
|
+
* Update transcript status and record the transition in history
|
|
115
|
+
* Returns unchanged metadata if status is the same (no duplicate history)
|
|
116
|
+
*/
|
|
117
|
+
export declare const updateStatus: (metadata: TranscriptMetadata, newStatus: TranscriptStatus) => TranscriptMetadata;
|
|
118
|
+
/**
|
|
119
|
+
* Apply default lifecycle fields to metadata
|
|
120
|
+
* Used during lazy migration of old-format transcripts
|
|
121
|
+
*/
|
|
122
|
+
export declare const applyLifecycleDefaults: (metadata: TranscriptMetadata) => TranscriptMetadata;
|
|
123
|
+
/**
|
|
124
|
+
* Complete a task by ID
|
|
125
|
+
*/
|
|
126
|
+
export declare const completeTask: (metadata: TranscriptMetadata, taskId: string) => TranscriptMetadata;
|
|
127
|
+
/**
|
|
128
|
+
* Delete a task by ID
|
|
129
|
+
*/
|
|
130
|
+
export declare const deleteTask: (metadata: TranscriptMetadata, taskId: string) => TranscriptMetadata;
|
|
131
|
+
/**
|
|
132
|
+
* Add a task to metadata
|
|
133
|
+
*/
|
|
134
|
+
export declare const addTask: (metadata: TranscriptMetadata, description: string) => {
|
|
135
|
+
metadata: TranscriptMetadata;
|
|
136
|
+
task: Task;
|
|
137
|
+
};
|
|
138
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/util/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAMrC;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE3G;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,gBAAgB,CAAC;IACvB,EAAE,EAAE,gBAAgB,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,IAAI;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;CACnD;AAED,MAAM,WAAW,kBAAkB;IAE/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ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AEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAS,OAAO,CAAC,oBAAoB,EAAE,KAAG,MAAM,EAQtF,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,gBAAgB,EAE5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,KAAG,MAAM,IAAI,gBAExD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,QAAO,MAIjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,aAAa,MAAM,KAAG,IAOhD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GACrB,UAAU,kBAAkB,EAC5B,WAAW,gBAAgB,KAC5B,kBAmBF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAAI,UAAU,kBAAkB,KAAG,kBAOrE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,UAAU,kBAAkB,EAAE,QAAQ,MAAM,KAAG,kBAqB3E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,UAAU,kBAAkB,EAAE,QAAQ,MAAM,KAAG,kBAYzE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,UAAU,kBAAkB,EAAE,aAAa,MAAM,KAAG;IAAE,QAAQ,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAUrH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ChatCompletionMessageParam } from 'openai/resources/chat/completions';
|
|
2
|
+
export interface Transcription {
|
|
3
|
+
text: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class OpenAIError extends Error {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
export declare function createCompletion(messages: ChatCompletionMessageParam[], options?: {
|
|
9
|
+
responseFormat?: any;
|
|
10
|
+
model?: string;
|
|
11
|
+
reasoningLevel?: 'none' | 'low' | 'medium' | 'high';
|
|
12
|
+
maxTokens?: number;
|
|
13
|
+
debug?: boolean;
|
|
14
|
+
debugFile?: string;
|
|
15
|
+
reason?: string;
|
|
16
|
+
}): Promise<string | any>;
|
|
17
|
+
export declare function transcribeAudio(filePath: string, options?: {
|
|
18
|
+
model?: string;
|
|
19
|
+
debug?: boolean;
|
|
20
|
+
debugFile?: string;
|
|
21
|
+
}): Promise<Transcription>;
|
|
22
|
+
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/util/openai.ts"],"names":[],"mappings":"AACA,OAAO,EAA0C,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAKvH,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,WAAY,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI9B;AAGD,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,0BAA0B,EAAE,EAAE,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,CA0E3R;AAED,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CA4CrJ"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sounds-Like Database
|
|
3
|
+
*
|
|
4
|
+
* Aggregates sounds_like mappings from multiple sources (projects, people, terms)
|
|
5
|
+
* and provides efficient lookup and collision detection for entity correction.
|
|
6
|
+
*
|
|
7
|
+
* Part of the simple-replace optimization (Phase 1).
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Represents a single sounds_like mapping entry
|
|
11
|
+
*/
|
|
12
|
+
export interface SoundsLikeMapping {
|
|
13
|
+
/** What Whisper typically hears (e.g., "protocol", "observation") */
|
|
14
|
+
soundsLike: string;
|
|
15
|
+
/** Correct text to replace with (e.g., "Protokoll", "Observasjon") */
|
|
16
|
+
correctText: string;
|
|
17
|
+
/** Type of entity (project, person, or term) */
|
|
18
|
+
entityType: 'project' | 'person' | 'term';
|
|
19
|
+
/** Unique identifier for the entity */
|
|
20
|
+
entityId: string;
|
|
21
|
+
/** Only apply replacement in these project contexts (null = apply everywhere) */
|
|
22
|
+
scopedToProjects?: string[] | null;
|
|
23
|
+
/** Collision risk level: none (Tier 1), low/medium (Tier 2), high (Tier 3) */
|
|
24
|
+
collisionRisk: 'none' | 'low' | 'medium' | 'high';
|
|
25
|
+
/** Tier classification (1 = always safe, 2 = project-scoped, 3 = ambiguous) */
|
|
26
|
+
tier: 1 | 2 | 3;
|
|
27
|
+
/** Minimum confidence required for Tier 2 replacements */
|
|
28
|
+
minConfidence?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Collision information for a sounds_like value
|
|
32
|
+
*/
|
|
33
|
+
export interface Collision {
|
|
34
|
+
/** The sounds_like value that has collisions */
|
|
35
|
+
soundsLike: string;
|
|
36
|
+
/** All mappings that share this sounds_like value */
|
|
37
|
+
mappings: SoundsLikeMapping[];
|
|
38
|
+
/** Number of conflicting mappings */
|
|
39
|
+
count: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Database of sounds_like mappings with collision detection
|
|
43
|
+
*/
|
|
44
|
+
export interface SoundsLikeDatabase {
|
|
45
|
+
/** All loaded mappings */
|
|
46
|
+
mappings: SoundsLikeMapping[];
|
|
47
|
+
/** Tier 1 mappings (always safe to apply) */
|
|
48
|
+
tier1: SoundsLikeMapping[];
|
|
49
|
+
/** Tier 2 mappings (require project-scoping) */
|
|
50
|
+
tier2: Map<string, SoundsLikeMapping[]>;
|
|
51
|
+
/** Tier 3 mappings (too ambiguous, skip) */
|
|
52
|
+
tier3: SoundsLikeMapping[];
|
|
53
|
+
/** Detected collisions */
|
|
54
|
+
collisions: Map<string, Collision>;
|
|
55
|
+
/** Common terms that should not be replaced */
|
|
56
|
+
commonTerms: Set<string>;
|
|
57
|
+
/** Generic terms to always skip (Tier 3) */
|
|
58
|
+
genericTerms: Set<string>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Configuration for the sounds-like database
|
|
62
|
+
*/
|
|
63
|
+
export interface DatabaseConfig {
|
|
64
|
+
/** Protokoll context directories to load from */
|
|
65
|
+
protokollContextPaths?: string[];
|
|
66
|
+
/** Confidence threshold for Tier 2 replacements */
|
|
67
|
+
tier2Confidence?: number;
|
|
68
|
+
/** Enable collision detection */
|
|
69
|
+
detectCollisions?: boolean;
|
|
70
|
+
/** Custom common terms list */
|
|
71
|
+
commonTerms?: string[];
|
|
72
|
+
/** Custom generic terms list */
|
|
73
|
+
genericTerms?: string[];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Instance interface for the sounds-like database
|
|
77
|
+
*/
|
|
78
|
+
export interface Instance {
|
|
79
|
+
/** Load all sounds_like mappings from sources */
|
|
80
|
+
load(): Promise<SoundsLikeDatabase>;
|
|
81
|
+
/** Get all Tier 1 (always safe) mappings */
|
|
82
|
+
getTier1Mappings(): SoundsLikeMapping[];
|
|
83
|
+
/** Get Tier 2 (project-scoped) mappings for a specific project */
|
|
84
|
+
getTier2MappingsForProject(projectId: string): SoundsLikeMapping[];
|
|
85
|
+
/** Check if a sounds_like value has collisions */
|
|
86
|
+
hasCollision(soundsLike: string): boolean;
|
|
87
|
+
/** Get collision info for a sounds_like value */
|
|
88
|
+
getCollision(soundsLike: string): Collision | undefined;
|
|
89
|
+
/** Get all collisions */
|
|
90
|
+
getAllCollisions(): Collision[];
|
|
91
|
+
/** Classify a mapping into a tier based on collision risk */
|
|
92
|
+
classifyTier(mapping: Partial<SoundsLikeMapping>): 1 | 2 | 3;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Create a sounds-like database instance
|
|
96
|
+
*/
|
|
97
|
+
export declare const create: (config?: DatabaseConfig) => Instance;
|
|
98
|
+
//# sourceMappingURL=sounds-like-database.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sounds-like-database.d.ts","sourceRoot":"","sources":["../../src/util/sounds-like-database.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IAEnB,sEAAsE;IACtE,WAAW,EAAE,MAAM,CAAC;IAEpB,gDAAgD;IAChD,UAAU,EAAE,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;IAE1C,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;IAEjB,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAEnC,8EAA8E;IAC9E,aAAa,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAElD,+EAA+E;IAC/E,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEhB,0DAA0D;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;IAEnB,qDAAqD;IACrD,QAAQ,EAAE,iBAA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AC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;IAExD,yBAAyB;IACzB,gBAAgB,IAAI,SAAS,EAAE,CAAC;IAEhC,6DAA6D;IAC7D,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CAChE;AAaD;;GAEG;AACH,eAAO,MAAM,MAAM,GAAI,SAAS,cAAc,KAAG,QA6ThD,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
/**
|
|
3
|
+
* This module exists to isolate filesystem operations from the rest of the codebase.
|
|
4
|
+
* This makes testing easier by avoiding direct fs mocking in jest configuration.
|
|
5
|
+
*
|
|
6
|
+
* Additionally, abstracting storage operations allows for future flexibility -
|
|
7
|
+
* this export utility may need to work with storage systems other than the local filesystem
|
|
8
|
+
* (e.g. S3, Google Cloud Storage, etc).
|
|
9
|
+
*/
|
|
10
|
+
export interface Utility {
|
|
11
|
+
exists: (path: string) => Promise<boolean>;
|
|
12
|
+
isDirectory: (path: string) => Promise<boolean>;
|
|
13
|
+
isFile: (path: string) => Promise<boolean>;
|
|
14
|
+
isReadable: (path: string) => Promise<boolean>;
|
|
15
|
+
isWritable: (path: string) => Promise<boolean>;
|
|
16
|
+
isFileReadable: (path: string) => Promise<boolean>;
|
|
17
|
+
isDirectoryWritable: (path: string) => Promise<boolean>;
|
|
18
|
+
isDirectoryReadable: (path: string) => Promise<boolean>;
|
|
19
|
+
createDirectory: (path: string) => Promise<void>;
|
|
20
|
+
readFile: (path: string, encoding: string) => Promise<string>;
|
|
21
|
+
readStream: (path: string) => Promise<fs.ReadStream>;
|
|
22
|
+
writeFile: (path: string, data: string | Buffer, encoding: string) => Promise<void>;
|
|
23
|
+
forEachFileIn: (directory: string, callback: (path: string) => Promise<void>, options?: {
|
|
24
|
+
pattern: string;
|
|
25
|
+
}) => Promise<void>;
|
|
26
|
+
hashFile: (path: string, length: number) => Promise<string>;
|
|
27
|
+
listFiles: (directory: string) => Promise<string[]>;
|
|
28
|
+
deleteFile: (path: string) => Promise<void>;
|
|
29
|
+
deleteDirectory: (path: string) => Promise<void>;
|
|
30
|
+
getFileSize: (path: string) => Promise<number>;
|
|
31
|
+
}
|
|
32
|
+
export declare const create: (params: {
|
|
33
|
+
log?: (message: string, ...args: any[]) => void;
|
|
34
|
+
}) => Utility;
|
|
35
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/util/storage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAI9B;;;;;;;GAOG;AAEH,MAAM,WAAW,OAAO;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,mBAAmB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACxD,mBAAmB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACxD,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,QAAQ,EAAE,CA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urrence
|
|
4
|
+
*/
|
|
5
|
+
export interface ReplacementOccurrence {
|
|
6
|
+
/** Original text that was replaced */
|
|
7
|
+
original: string;
|
|
8
|
+
/** Replacement text */
|
|
9
|
+
replacement: string;
|
|
10
|
+
/** Position in the text where replacement occurred */
|
|
11
|
+
position: number;
|
|
12
|
+
/** The mapping that was used */
|
|
13
|
+
mapping: SoundsLikeMapping;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Result of applying replacements to text
|
|
17
|
+
*/
|
|
18
|
+
export interface ReplacementResult {
|
|
19
|
+
/** The text after replacements */
|
|
20
|
+
text: string;
|
|
21
|
+
/** Number of replacements made */
|
|
22
|
+
count: number;
|
|
23
|
+
/** Detailed information about each replacement */
|
|
24
|
+
occurrences: ReplacementOccurrence[];
|
|
25
|
+
/** Mappings that were applied */
|
|
26
|
+
appliedMappings: SoundsLikeMapping[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Configuration for text replacer
|
|
30
|
+
*/
|
|
31
|
+
export interface TextReplacerConfig {
|
|
32
|
+
/** Preserve case of original text when replacing (default: true) */
|
|
33
|
+
preserveCase?: boolean;
|
|
34
|
+
/** Use word boundaries for matching (default: true) */
|
|
35
|
+
useWordBoundaries?: boolean;
|
|
36
|
+
/** Case-insensitive matching (default: true) */
|
|
37
|
+
caseInsensitive?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Instance interface for text replacer
|
|
41
|
+
*/
|
|
42
|
+
export interface Instance {
|
|
43
|
+
/**
|
|
44
|
+
* Apply a set of replacements to text
|
|
45
|
+
*/
|
|
46
|
+
applyReplacements(text: string, mappings: SoundsLikeMapping[]): ReplacementResult;
|
|
47
|
+
/**
|
|
48
|
+
* Apply a single replacement to text
|
|
49
|
+
*/
|
|
50
|
+
applySingleReplacement(text: string, mapping: SoundsLikeMapping): ReplacementResult;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Create a text replacer instance
|
|
54
|
+
*/
|
|
55
|
+
export declare const create: (config?: TextReplacerConfig) => Instance;
|
|
56
|
+
//# sourceMappingURL=text-replacer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-replacer.d.ts","sourceRoot":"","sources":["../../src/util/text-replacer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IAEjB,uBAAuB;IACvB,WAAW,EAAE,MAAM,CAAC;IAEpB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;IAEjB,gCAAgC;IAChC,OAAO,EAAE,iBAAiB,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IAEb,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IAEd,kDAAkD;IAClD,WAAW,EAAE,qBAAqB,EAAE,CAAC;IAErC,iCAAiC;IACjC,eAAe,EAAE,iBAAiB,EAAE,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,oEAAoE;IACpE,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,uDAAuD;IACvD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,gDAAgD;IAChD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACrB;;OAEG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,iBAAiB,CAAC;IAElF;;OAEG;IACH,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,iBAAiB,CAAC;CACvF;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,GAAI,SAAS,kBAAkB,KAAG,QAsKpD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Person, Project, Company, Term, IgnoredTerm } from '@redaksjon/context';
|
|
2
|
+
/**
|
|
3
|
+
* Resilient Entity Finder
|
|
4
|
+
*
|
|
5
|
+
* Provides case-insensitive and fuzzy matching for all entity types.
|
|
6
|
+
* Handles typos, capitalization differences, and matches by both ID and name.
|
|
7
|
+
*/
|
|
8
|
+
import * as Context from '@redaksjon/context';
|
|
9
|
+
/**
|
|
10
|
+
* Find a project using resilient matching
|
|
11
|
+
*/
|
|
12
|
+
export declare function findProjectResilient(context: Context.ContextInstance, query: string): Project;
|
|
13
|
+
/**
|
|
14
|
+
* Find a person using resilient matching
|
|
15
|
+
*/
|
|
16
|
+
export declare function findPersonResilient(context: Context.ContextInstance, query: string): Person;
|
|
17
|
+
/**
|
|
18
|
+
* Find a company using resilient matching
|
|
19
|
+
*/
|
|
20
|
+
export declare function findCompanyResilient(context: Context.ContextInstance, query: string): Company;
|
|
21
|
+
/**
|
|
22
|
+
* Find a term using resilient matching
|
|
23
|
+
*/
|
|
24
|
+
export declare function findTermResilient(context: Context.ContextInstance, query: string): Term;
|
|
25
|
+
/**
|
|
26
|
+
* Find an ignored term using resilient matching
|
|
27
|
+
*/
|
|
28
|
+
export declare function findIgnoredResilient(context: Context.ContextInstance, query: string): IgnoredTerm;
|
|
29
|
+
//# sourceMappingURL=entityFinder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entityFinder.d.ts","sourceRoot":"","sources":["../../src/utils/entityFinder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAU,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AA4H9F;;GAEG;AACH,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,OAAO,CAAC,eAAe,EAChC,KAAK,EAAE,MAAM,GACd,OAAO,CAGT;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAC/B,OAAO,EAAE,OAAO,CAAC,eAAe,EAChC,KAAK,EAAE,MAAM,GACd,MAAM,CAGR;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,OAAO,CAAC,eAAe,EAChC,KAAK,EAAE,MAAM,GACd,OAAO,CAGT;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC7B,OAAO,EAAE,OAAO,CAAC,eAAe,EAChC,KAAK,EAAE,MAAM,GACd,IAAI,CAGN;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,OAAO,CAAC,eAAe,EAChC,KAAK,EAAE,MAAM,GACd,WAAW,CAGb"}
|
package/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@redaksjon/protokoll-engine",
|
|
3
|
+
"version": "0.1.1-dev.0",
|
|
4
|
+
"description": "Processing engine for Protokoll - transcription pipeline, agentic execution, routing, and LLM integration",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/redaksjon/protokoll.git",
|
|
20
|
+
"directory": "protokoll-engine"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"transcription",
|
|
24
|
+
"pipeline",
|
|
25
|
+
"agentic",
|
|
26
|
+
"llm",
|
|
27
|
+
"routing"
|
|
28
|
+
],
|
|
29
|
+
"author": "Tim O'Brien <tobrien@discursive.com>",
|
|
30
|
+
"license": "Apache-2.0",
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=24.0.0"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "npm run lint && tsc --noEmit && vite build",
|
|
36
|
+
"dev": "vite",
|
|
37
|
+
"watch": "vite build --watch",
|
|
38
|
+
"test": "vitest run",
|
|
39
|
+
"test:coverage": "vitest run --coverage",
|
|
40
|
+
"lint": "eslint . --ext .ts",
|
|
41
|
+
"lint:fix": "eslint . --ext .ts --fix",
|
|
42
|
+
"clean": "rm -rf dist",
|
|
43
|
+
"precommit": "npm run lint && npm run build && npm run test:coverage",
|
|
44
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@anthropic-ai/sdk": "^0.71.2",
|
|
48
|
+
"@google/generative-ai": "^0.24.1",
|
|
49
|
+
"@kjerneverk/riotprompt": "^1.0.6",
|
|
50
|
+
"@redaksjon/context": "file:../redaksjon-context",
|
|
51
|
+
"@redaksjon/protokoll-format": "file:../protokoll-format",
|
|
52
|
+
"@utilarium/cardigantime": "^0.0.26",
|
|
53
|
+
"@utilarium/dreadcabinet": "^0.0.16",
|
|
54
|
+
"dayjs": "^1.11.13",
|
|
55
|
+
"fluent-ffmpeg": "^2.1.3",
|
|
56
|
+
"glob": "^13.0.3",
|
|
57
|
+
"gray-matter": "^4.0.3",
|
|
58
|
+
"js-yaml": "^4.1.0",
|
|
59
|
+
"luxon": "^3.5.0",
|
|
60
|
+
"moment-timezone": "^0.5.46",
|
|
61
|
+
"openai": "^4.77.3",
|
|
62
|
+
"winston": "^3.17.0",
|
|
63
|
+
"zod": "^4.3.6"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
67
|
+
"@eslint/js": "^9.18.0",
|
|
68
|
+
"@types/fluent-ffmpeg": "^2.1.27",
|
|
69
|
+
"@types/js-yaml": "^4.0.9",
|
|
70
|
+
"@types/luxon": "^3.4.2",
|
|
71
|
+
"@types/node": "^22.0.0",
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "^8.20.0",
|
|
73
|
+
"@typescript-eslint/parser": "^8.20.0",
|
|
74
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
75
|
+
"ajv": "^8.18.0",
|
|
76
|
+
"eslint": "^9.18.0",
|
|
77
|
+
"eslint-plugin-import": "^2.31.0",
|
|
78
|
+
"globals": "^15.14.0",
|
|
79
|
+
"typescript": "^5.5.0",
|
|
80
|
+
"vite": "^7.3.1",
|
|
81
|
+
"vite-plugin-dts": "^4.5.4",
|
|
82
|
+
"vitest": "^2.1.8"
|
|
83
|
+
}
|
|
84
|
+
}
|