Add Seal approval run Langfuse bridge tools
This commit is contained in:
1 parent
d6a33de3d7
commit
0cc1f591dc
8 files changed
+392
-2
No files matched your search
@@ -2,13 +2,25 @@ import { CorpConfig } from "./types.js";
|
||||
|
||||
export class CorpContext {
|
||||
private current: CorpConfig | null = null;
|
||||
private readonly corps = new Map<string, CorpConfig>();
|
||||
private corps = new Map<string, CorpConfig>();
|
||||
|
||||
constructor(corps: CorpConfig[]) {
|
||||
this.replaceCorps(corps);
|
||||
this.current = corps[0] ?? null;
|
||||
}
|
||||
|
||||
refresh(corps: CorpConfig[]): void {
|
||||
const currentId = this.current?.id ?? null;
|
||||
this.replaceCorps(corps);
|
||||
this.current = currentId ? this.corps.get(currentId) ?? null : null;
|
||||
this.current ??= corps[0] ?? null;
|
||||
}
|
||||
|
||||
private replaceCorps(corps: CorpConfig[]): void {
|
||||
this.corps = new Map();
|
||||
for (const corp of corps) {
|
||||
this.corps.set(corp.id, corp);
|
||||
}
|
||||
this.current = corps[0] ?? null;
|
||||
}
|
||||
|
||||
getCurrent(): CorpConfig | null {
|
||||
|
||||
Reference in new issue
Block a user