@usewhisper/sdk 3.4.0 → 3.6.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/index.d.mts +249 -1
- package/index.d.ts +249 -1
- package/index.js +1304 -541
- package/index.mjs +1304 -541
- package/package.json +1 -1
package/index.d.mts
CHANGED
|
@@ -77,6 +77,7 @@ interface RememberResult {
|
|
|
77
77
|
*/
|
|
78
78
|
declare class Whisper {
|
|
79
79
|
private client;
|
|
80
|
+
private runtimeClient;
|
|
80
81
|
private options;
|
|
81
82
|
private sessionId?;
|
|
82
83
|
private userId?;
|
|
@@ -618,6 +619,217 @@ declare class AnalyticsModule {
|
|
|
618
619
|
queueStatus(): WriteQueueStatus;
|
|
619
620
|
}
|
|
620
621
|
|
|
622
|
+
interface AgentRunContext {
|
|
623
|
+
workspacePath?: string;
|
|
624
|
+
project?: string;
|
|
625
|
+
userId?: string;
|
|
626
|
+
sessionId?: string;
|
|
627
|
+
traceId?: string;
|
|
628
|
+
clientName?: string;
|
|
629
|
+
}
|
|
630
|
+
interface TurnInput {
|
|
631
|
+
userMessage: string;
|
|
632
|
+
taskSummary?: string;
|
|
633
|
+
touchedFiles?: string[];
|
|
634
|
+
toolContext?: string;
|
|
635
|
+
}
|
|
636
|
+
type WorkEventKind = "decision" | "constraint" | "outcome" | "failure" | "task_update" | "file_edit" | "tool_result";
|
|
637
|
+
type WorkEventSalience = "low" | "medium" | "high";
|
|
638
|
+
interface WorkEvent {
|
|
639
|
+
kind: WorkEventKind;
|
|
640
|
+
summary: string;
|
|
641
|
+
details?: string;
|
|
642
|
+
salience?: WorkEventSalience;
|
|
643
|
+
timestamp?: string;
|
|
644
|
+
filePaths?: string[];
|
|
645
|
+
toolName?: string;
|
|
646
|
+
success?: boolean;
|
|
647
|
+
}
|
|
648
|
+
interface PreparedTurn {
|
|
649
|
+
scope: AgentRunContext & {
|
|
650
|
+
project: string;
|
|
651
|
+
userId: string;
|
|
652
|
+
sessionId: string;
|
|
653
|
+
};
|
|
654
|
+
retrieval: {
|
|
655
|
+
primaryQuery: string;
|
|
656
|
+
taskFrameQuery: string | null;
|
|
657
|
+
warnings: string[];
|
|
658
|
+
degraded: boolean;
|
|
659
|
+
degradedReason?: string;
|
|
660
|
+
durationMs: number;
|
|
661
|
+
targetBudgetMs: number;
|
|
662
|
+
hardTimeoutMs: number;
|
|
663
|
+
branchStatus: Record<string, "ok" | "error" | "timeout" | "skipped">;
|
|
664
|
+
};
|
|
665
|
+
context: string;
|
|
666
|
+
items: Array<{
|
|
667
|
+
id: string;
|
|
668
|
+
content: string;
|
|
669
|
+
type: "project" | "memory";
|
|
670
|
+
score: number;
|
|
671
|
+
sourceQuery: "primary" | "task_frame" | "bootstrap";
|
|
672
|
+
metadata?: Record<string, unknown>;
|
|
673
|
+
}>;
|
|
674
|
+
}
|
|
675
|
+
interface TurnCaptureResult {
|
|
676
|
+
success: boolean;
|
|
677
|
+
sessionIngested: boolean;
|
|
678
|
+
memoriesCreated: number;
|
|
679
|
+
relationsCreated: number;
|
|
680
|
+
invalidatedCount: number;
|
|
681
|
+
mergedCount: number;
|
|
682
|
+
droppedCount: number;
|
|
683
|
+
warnings: string[];
|
|
684
|
+
}
|
|
685
|
+
interface AgentRuntimeStatus {
|
|
686
|
+
clientName: string;
|
|
687
|
+
scope: {
|
|
688
|
+
project?: string;
|
|
689
|
+
userId?: string;
|
|
690
|
+
sessionId?: string;
|
|
691
|
+
source?: "explicit" | "workspace" | "config" | "generated";
|
|
692
|
+
warning?: string;
|
|
693
|
+
};
|
|
694
|
+
queue: {
|
|
695
|
+
queued: number;
|
|
696
|
+
flushing: boolean;
|
|
697
|
+
lastFlushAt?: string;
|
|
698
|
+
lastFlushCount: number;
|
|
699
|
+
};
|
|
700
|
+
retrieval: PreparedTurn["retrieval"] | null;
|
|
701
|
+
counters: {
|
|
702
|
+
mergedCount: number;
|
|
703
|
+
droppedCount: number;
|
|
704
|
+
bufferedLowSalience: number;
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
interface AgentRuntimeOptions extends AgentRunContext {
|
|
708
|
+
topK?: number;
|
|
709
|
+
maxTokens?: number;
|
|
710
|
+
targetRetrievalMs?: number;
|
|
711
|
+
hardRetrievalTimeoutMs?: number;
|
|
712
|
+
bindingStorePath?: string;
|
|
713
|
+
recentWorkLimit?: number;
|
|
714
|
+
}
|
|
715
|
+
interface QueueStatus {
|
|
716
|
+
queued: number;
|
|
717
|
+
flushing: boolean;
|
|
718
|
+
lastFlushAt?: string;
|
|
719
|
+
lastFlushCount: number;
|
|
720
|
+
}
|
|
721
|
+
interface RuntimeAdapter {
|
|
722
|
+
resolveProject(project?: string): Promise<Project>;
|
|
723
|
+
query(params: QueryParams): Promise<QueryResult>;
|
|
724
|
+
ingestSession(params: {
|
|
725
|
+
project?: string;
|
|
726
|
+
session_id: string;
|
|
727
|
+
user_id?: string;
|
|
728
|
+
messages: Array<{
|
|
729
|
+
role: string;
|
|
730
|
+
content: string;
|
|
731
|
+
timestamp: string;
|
|
732
|
+
}>;
|
|
733
|
+
async?: boolean;
|
|
734
|
+
write_mode?: "async" | "sync";
|
|
735
|
+
}): Promise<{
|
|
736
|
+
success: boolean;
|
|
737
|
+
memories_created: number;
|
|
738
|
+
relations_created: number;
|
|
739
|
+
memories_invalidated: number;
|
|
740
|
+
errors?: string[];
|
|
741
|
+
} & MemoryWriteAck$1>;
|
|
742
|
+
getSessionMemories(params: {
|
|
743
|
+
project?: string;
|
|
744
|
+
session_id: string;
|
|
745
|
+
include_pending?: boolean;
|
|
746
|
+
limit?: number;
|
|
747
|
+
}): Promise<{
|
|
748
|
+
memories: Array<Record<string, unknown>>;
|
|
749
|
+
count: number;
|
|
750
|
+
}>;
|
|
751
|
+
getUserProfile(params: {
|
|
752
|
+
project?: string;
|
|
753
|
+
user_id: string;
|
|
754
|
+
include_pending?: boolean;
|
|
755
|
+
memory_types?: string;
|
|
756
|
+
}): Promise<{
|
|
757
|
+
user_id: string;
|
|
758
|
+
memories: Array<Record<string, unknown>>;
|
|
759
|
+
count: number;
|
|
760
|
+
}>;
|
|
761
|
+
searchMemories(params: {
|
|
762
|
+
project?: string;
|
|
763
|
+
query: string;
|
|
764
|
+
user_id?: string;
|
|
765
|
+
session_id?: string;
|
|
766
|
+
top_k?: number;
|
|
767
|
+
memory_type?: MemoryKind$1;
|
|
768
|
+
profile?: "fast" | "balanced" | "quality";
|
|
769
|
+
include_pending?: boolean;
|
|
770
|
+
}): Promise<MemorySearchResponse$1>;
|
|
771
|
+
addMemory(params: {
|
|
772
|
+
project?: string;
|
|
773
|
+
content: string;
|
|
774
|
+
memory_type?: MemoryKind$1;
|
|
775
|
+
user_id?: string;
|
|
776
|
+
session_id?: string;
|
|
777
|
+
importance?: number;
|
|
778
|
+
confidence?: number;
|
|
779
|
+
metadata?: Record<string, unknown>;
|
|
780
|
+
event_date?: string;
|
|
781
|
+
write_mode?: "async" | "sync";
|
|
782
|
+
async?: boolean;
|
|
783
|
+
}): Promise<MemoryWriteAck$1>;
|
|
784
|
+
queueStatus(): QueueStatus;
|
|
785
|
+
flushQueue(): Promise<void>;
|
|
786
|
+
}
|
|
787
|
+
declare class WhisperAgentRuntime {
|
|
788
|
+
private readonly args;
|
|
789
|
+
private readonly bindingStore;
|
|
790
|
+
private readonly topK;
|
|
791
|
+
private readonly maxTokens;
|
|
792
|
+
private readonly targetRetrievalMs;
|
|
793
|
+
private readonly hardRetrievalTimeoutMs;
|
|
794
|
+
private readonly recentWorkLimit;
|
|
795
|
+
private readonly baseContext;
|
|
796
|
+
private readonly clientName;
|
|
797
|
+
private bindings;
|
|
798
|
+
private touchedFiles;
|
|
799
|
+
private recentWork;
|
|
800
|
+
private bufferedLowSalience;
|
|
801
|
+
private lastPreparedTurn;
|
|
802
|
+
private mergedCount;
|
|
803
|
+
private droppedCount;
|
|
804
|
+
private lastScope;
|
|
805
|
+
constructor(args: {
|
|
806
|
+
baseContext: AgentRunContext;
|
|
807
|
+
options: AgentRuntimeOptions;
|
|
808
|
+
adapter: RuntimeAdapter;
|
|
809
|
+
});
|
|
810
|
+
private getBindings;
|
|
811
|
+
private pushTouchedFiles;
|
|
812
|
+
private pushWorkEvent;
|
|
813
|
+
private makeTaskFrameQuery;
|
|
814
|
+
private resolveScope;
|
|
815
|
+
private runBranch;
|
|
816
|
+
private contextItems;
|
|
817
|
+
private memoryItems;
|
|
818
|
+
private rerank;
|
|
819
|
+
private buildContext;
|
|
820
|
+
bootstrap(context?: Partial<AgentRunContext>): Promise<PreparedTurn>;
|
|
821
|
+
beforeTurn(input: TurnInput, context?: Partial<AgentRunContext>): Promise<PreparedTurn>;
|
|
822
|
+
recordWork(event: WorkEvent, context?: Partial<AgentRunContext>): Promise<MemoryWriteAck$1 | {
|
|
823
|
+
success: true;
|
|
824
|
+
buffered: true;
|
|
825
|
+
}>;
|
|
826
|
+
afterTurn(input: TurnInput & {
|
|
827
|
+
assistantMessage: string;
|
|
828
|
+
}, context?: Partial<AgentRunContext>): Promise<TurnCaptureResult>;
|
|
829
|
+
flush(reason?: string, context?: Partial<AgentRunContext>): Promise<AgentRuntimeStatus>;
|
|
830
|
+
status(): AgentRuntimeStatus;
|
|
831
|
+
}
|
|
832
|
+
|
|
621
833
|
interface WhisperClientConfig {
|
|
622
834
|
apiKey: string;
|
|
623
835
|
baseUrl?: string;
|
|
@@ -711,8 +923,38 @@ declare class WhisperClient {
|
|
|
711
923
|
private readonly sessionModule;
|
|
712
924
|
private readonly profileModule;
|
|
713
925
|
private readonly analyticsModule;
|
|
926
|
+
private readonly projectRefToId;
|
|
927
|
+
private projectCache;
|
|
928
|
+
private projectCacheExpiresAt;
|
|
714
929
|
constructor(config: WhisperClientConfig);
|
|
715
930
|
static fromEnv(overrides?: Partial<WhisperClientConfig>): WhisperClient;
|
|
931
|
+
private createQueueStore;
|
|
932
|
+
private defaultQueuePersistence;
|
|
933
|
+
private defaultQueueFilePath;
|
|
934
|
+
private getRequiredProject;
|
|
935
|
+
private refreshProjectCache;
|
|
936
|
+
private fetchResolvedProject;
|
|
937
|
+
resolveProject(projectRef?: string): Promise<Project>;
|
|
938
|
+
query(params: QueryParams): Promise<QueryResult>;
|
|
939
|
+
ingestSession(params: {
|
|
940
|
+
project?: string;
|
|
941
|
+
session_id: string;
|
|
942
|
+
user_id?: string;
|
|
943
|
+
messages: Array<{
|
|
944
|
+
role: string;
|
|
945
|
+
content: string;
|
|
946
|
+
timestamp: string;
|
|
947
|
+
}>;
|
|
948
|
+
async?: boolean;
|
|
949
|
+
write_mode?: "async" | "sync";
|
|
950
|
+
}): Promise<{
|
|
951
|
+
success: boolean;
|
|
952
|
+
memories_created: number;
|
|
953
|
+
relations_created: number;
|
|
954
|
+
memories_invalidated: number;
|
|
955
|
+
errors?: string[];
|
|
956
|
+
} & MemoryWriteAck$1>;
|
|
957
|
+
createAgentRuntime(options?: AgentRuntimeOptions): WhisperAgentRuntime;
|
|
716
958
|
withRunContext(context: RunContext): {
|
|
717
959
|
memory: {
|
|
718
960
|
add: (params: Omit<Parameters<MemoryModule["add"]>[0], "project" | "user_id" | "session_id"> & {
|
|
@@ -971,6 +1213,12 @@ interface QueryResult {
|
|
|
971
1213
|
cache_hit: boolean;
|
|
972
1214
|
tokens_used: number;
|
|
973
1215
|
context_hash: string;
|
|
1216
|
+
source_scope?: {
|
|
1217
|
+
mode: "none" | "explicit" | "auto";
|
|
1218
|
+
source_ids: string[];
|
|
1219
|
+
host?: string;
|
|
1220
|
+
matched_sources?: number;
|
|
1221
|
+
};
|
|
974
1222
|
profile?: string;
|
|
975
1223
|
compression?: any;
|
|
976
1224
|
timing?: {
|
|
@@ -1814,4 +2062,4 @@ declare class WhisperContext {
|
|
|
1814
2062
|
};
|
|
1815
2063
|
}
|
|
1816
2064
|
|
|
1817
|
-
export { type CanonicalSourceCreateParams, type CanonicalSourceCreateResult, type CanonicalSourceType, type ExtractedMemory, LangChainMemoryAdapter, LangGraphCheckpointAdapter, type Memory, type MemoryExtractionResult, type MemoryKind, type MemoryLatencyBreakdown, type MemorySearchResponse, type MemoryWriteAck, type MemoryWriteResult, type Project, type QueryParams, type QueryResult, type Source, type VideoIngestionStatus, type VideoSourceMetadata, Whisper, WhisperAgentMiddleware, WhisperClient, type WhisperConfig, WhisperContext, Whisper as WhisperDefault, WhisperError, type WhisperErrorCode, WhisperClient as WhisperRuntimeClient, createAgentMiddleware, createLangChainMemoryAdapter, createLangGraphCheckpointAdapter, WhisperContext as default, memoryGraphToMermaid };
|
|
2065
|
+
export { type AgentRunContext, type AgentRuntimeOptions, type AgentRuntimeStatus, type CanonicalSourceCreateParams, type CanonicalSourceCreateResult, type CanonicalSourceType, type ExtractedMemory, LangChainMemoryAdapter, LangGraphCheckpointAdapter, type Memory, type MemoryExtractionResult, type MemoryKind, type MemoryLatencyBreakdown, type MemorySearchResponse, type MemoryWriteAck, type MemoryWriteResult, type PreparedTurn, type Project, type QueryParams, type QueryResult, type Source, type TurnCaptureResult, type TurnInput, type VideoIngestionStatus, type VideoSourceMetadata, Whisper, WhisperAgentMiddleware, WhisperClient, type WhisperConfig, WhisperContext, Whisper as WhisperDefault, WhisperError, type WhisperErrorCode, WhisperClient as WhisperRuntimeClient, type WorkEvent, type WorkEventKind, type WorkEventSalience, createAgentMiddleware, createLangChainMemoryAdapter, createLangGraphCheckpointAdapter, WhisperContext as default, memoryGraphToMermaid };
|
package/index.d.ts
CHANGED
|
@@ -77,6 +77,7 @@ interface RememberResult {
|
|
|
77
77
|
*/
|
|
78
78
|
declare class Whisper {
|
|
79
79
|
private client;
|
|
80
|
+
private runtimeClient;
|
|
80
81
|
private options;
|
|
81
82
|
private sessionId?;
|
|
82
83
|
private userId?;
|
|
@@ -618,6 +619,217 @@ declare class AnalyticsModule {
|
|
|
618
619
|
queueStatus(): WriteQueueStatus;
|
|
619
620
|
}
|
|
620
621
|
|
|
622
|
+
interface AgentRunContext {
|
|
623
|
+
workspacePath?: string;
|
|
624
|
+
project?: string;
|
|
625
|
+
userId?: string;
|
|
626
|
+
sessionId?: string;
|
|
627
|
+
traceId?: string;
|
|
628
|
+
clientName?: string;
|
|
629
|
+
}
|
|
630
|
+
interface TurnInput {
|
|
631
|
+
userMessage: string;
|
|
632
|
+
taskSummary?: string;
|
|
633
|
+
touchedFiles?: string[];
|
|
634
|
+
toolContext?: string;
|
|
635
|
+
}
|
|
636
|
+
type WorkEventKind = "decision" | "constraint" | "outcome" | "failure" | "task_update" | "file_edit" | "tool_result";
|
|
637
|
+
type WorkEventSalience = "low" | "medium" | "high";
|
|
638
|
+
interface WorkEvent {
|
|
639
|
+
kind: WorkEventKind;
|
|
640
|
+
summary: string;
|
|
641
|
+
details?: string;
|
|
642
|
+
salience?: WorkEventSalience;
|
|
643
|
+
timestamp?: string;
|
|
644
|
+
filePaths?: string[];
|
|
645
|
+
toolName?: string;
|
|
646
|
+
success?: boolean;
|
|
647
|
+
}
|
|
648
|
+
interface PreparedTurn {
|
|
649
|
+
scope: AgentRunContext & {
|
|
650
|
+
project: string;
|
|
651
|
+
userId: string;
|
|
652
|
+
sessionId: string;
|
|
653
|
+
};
|
|
654
|
+
retrieval: {
|
|
655
|
+
primaryQuery: string;
|
|
656
|
+
taskFrameQuery: string | null;
|
|
657
|
+
warnings: string[];
|
|
658
|
+
degraded: boolean;
|
|
659
|
+
degradedReason?: string;
|
|
660
|
+
durationMs: number;
|
|
661
|
+
targetBudgetMs: number;
|
|
662
|
+
hardTimeoutMs: number;
|
|
663
|
+
branchStatus: Record<string, "ok" | "error" | "timeout" | "skipped">;
|
|
664
|
+
};
|
|
665
|
+
context: string;
|
|
666
|
+
items: Array<{
|
|
667
|
+
id: string;
|
|
668
|
+
content: string;
|
|
669
|
+
type: "project" | "memory";
|
|
670
|
+
score: number;
|
|
671
|
+
sourceQuery: "primary" | "task_frame" | "bootstrap";
|
|
672
|
+
metadata?: Record<string, unknown>;
|
|
673
|
+
}>;
|
|
674
|
+
}
|
|
675
|
+
interface TurnCaptureResult {
|
|
676
|
+
success: boolean;
|
|
677
|
+
sessionIngested: boolean;
|
|
678
|
+
memoriesCreated: number;
|
|
679
|
+
relationsCreated: number;
|
|
680
|
+
invalidatedCount: number;
|
|
681
|
+
mergedCount: number;
|
|
682
|
+
droppedCount: number;
|
|
683
|
+
warnings: string[];
|
|
684
|
+
}
|
|
685
|
+
interface AgentRuntimeStatus {
|
|
686
|
+
clientName: string;
|
|
687
|
+
scope: {
|
|
688
|
+
project?: string;
|
|
689
|
+
userId?: string;
|
|
690
|
+
sessionId?: string;
|
|
691
|
+
source?: "explicit" | "workspace" | "config" | "generated";
|
|
692
|
+
warning?: string;
|
|
693
|
+
};
|
|
694
|
+
queue: {
|
|
695
|
+
queued: number;
|
|
696
|
+
flushing: boolean;
|
|
697
|
+
lastFlushAt?: string;
|
|
698
|
+
lastFlushCount: number;
|
|
699
|
+
};
|
|
700
|
+
retrieval: PreparedTurn["retrieval"] | null;
|
|
701
|
+
counters: {
|
|
702
|
+
mergedCount: number;
|
|
703
|
+
droppedCount: number;
|
|
704
|
+
bufferedLowSalience: number;
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
interface AgentRuntimeOptions extends AgentRunContext {
|
|
708
|
+
topK?: number;
|
|
709
|
+
maxTokens?: number;
|
|
710
|
+
targetRetrievalMs?: number;
|
|
711
|
+
hardRetrievalTimeoutMs?: number;
|
|
712
|
+
bindingStorePath?: string;
|
|
713
|
+
recentWorkLimit?: number;
|
|
714
|
+
}
|
|
715
|
+
interface QueueStatus {
|
|
716
|
+
queued: number;
|
|
717
|
+
flushing: boolean;
|
|
718
|
+
lastFlushAt?: string;
|
|
719
|
+
lastFlushCount: number;
|
|
720
|
+
}
|
|
721
|
+
interface RuntimeAdapter {
|
|
722
|
+
resolveProject(project?: string): Promise<Project>;
|
|
723
|
+
query(params: QueryParams): Promise<QueryResult>;
|
|
724
|
+
ingestSession(params: {
|
|
725
|
+
project?: string;
|
|
726
|
+
session_id: string;
|
|
727
|
+
user_id?: string;
|
|
728
|
+
messages: Array<{
|
|
729
|
+
role: string;
|
|
730
|
+
content: string;
|
|
731
|
+
timestamp: string;
|
|
732
|
+
}>;
|
|
733
|
+
async?: boolean;
|
|
734
|
+
write_mode?: "async" | "sync";
|
|
735
|
+
}): Promise<{
|
|
736
|
+
success: boolean;
|
|
737
|
+
memories_created: number;
|
|
738
|
+
relations_created: number;
|
|
739
|
+
memories_invalidated: number;
|
|
740
|
+
errors?: string[];
|
|
741
|
+
} & MemoryWriteAck$1>;
|
|
742
|
+
getSessionMemories(params: {
|
|
743
|
+
project?: string;
|
|
744
|
+
session_id: string;
|
|
745
|
+
include_pending?: boolean;
|
|
746
|
+
limit?: number;
|
|
747
|
+
}): Promise<{
|
|
748
|
+
memories: Array<Record<string, unknown>>;
|
|
749
|
+
count: number;
|
|
750
|
+
}>;
|
|
751
|
+
getUserProfile(params: {
|
|
752
|
+
project?: string;
|
|
753
|
+
user_id: string;
|
|
754
|
+
include_pending?: boolean;
|
|
755
|
+
memory_types?: string;
|
|
756
|
+
}): Promise<{
|
|
757
|
+
user_id: string;
|
|
758
|
+
memories: Array<Record<string, unknown>>;
|
|
759
|
+
count: number;
|
|
760
|
+
}>;
|
|
761
|
+
searchMemories(params: {
|
|
762
|
+
project?: string;
|
|
763
|
+
query: string;
|
|
764
|
+
user_id?: string;
|
|
765
|
+
session_id?: string;
|
|
766
|
+
top_k?: number;
|
|
767
|
+
memory_type?: MemoryKind$1;
|
|
768
|
+
profile?: "fast" | "balanced" | "quality";
|
|
769
|
+
include_pending?: boolean;
|
|
770
|
+
}): Promise<MemorySearchResponse$1>;
|
|
771
|
+
addMemory(params: {
|
|
772
|
+
project?: string;
|
|
773
|
+
content: string;
|
|
774
|
+
memory_type?: MemoryKind$1;
|
|
775
|
+
user_id?: string;
|
|
776
|
+
session_id?: string;
|
|
777
|
+
importance?: number;
|
|
778
|
+
confidence?: number;
|
|
779
|
+
metadata?: Record<string, unknown>;
|
|
780
|
+
event_date?: string;
|
|
781
|
+
write_mode?: "async" | "sync";
|
|
782
|
+
async?: boolean;
|
|
783
|
+
}): Promise<MemoryWriteAck$1>;
|
|
784
|
+
queueStatus(): QueueStatus;
|
|
785
|
+
flushQueue(): Promise<void>;
|
|
786
|
+
}
|
|
787
|
+
declare class WhisperAgentRuntime {
|
|
788
|
+
private readonly args;
|
|
789
|
+
private readonly bindingStore;
|
|
790
|
+
private readonly topK;
|
|
791
|
+
private readonly maxTokens;
|
|
792
|
+
private readonly targetRetrievalMs;
|
|
793
|
+
private readonly hardRetrievalTimeoutMs;
|
|
794
|
+
private readonly recentWorkLimit;
|
|
795
|
+
private readonly baseContext;
|
|
796
|
+
private readonly clientName;
|
|
797
|
+
private bindings;
|
|
798
|
+
private touchedFiles;
|
|
799
|
+
private recentWork;
|
|
800
|
+
private bufferedLowSalience;
|
|
801
|
+
private lastPreparedTurn;
|
|
802
|
+
private mergedCount;
|
|
803
|
+
private droppedCount;
|
|
804
|
+
private lastScope;
|
|
805
|
+
constructor(args: {
|
|
806
|
+
baseContext: AgentRunContext;
|
|
807
|
+
options: AgentRuntimeOptions;
|
|
808
|
+
adapter: RuntimeAdapter;
|
|
809
|
+
});
|
|
810
|
+
private getBindings;
|
|
811
|
+
private pushTouchedFiles;
|
|
812
|
+
private pushWorkEvent;
|
|
813
|
+
private makeTaskFrameQuery;
|
|
814
|
+
private resolveScope;
|
|
815
|
+
private runBranch;
|
|
816
|
+
private contextItems;
|
|
817
|
+
private memoryItems;
|
|
818
|
+
private rerank;
|
|
819
|
+
private buildContext;
|
|
820
|
+
bootstrap(context?: Partial<AgentRunContext>): Promise<PreparedTurn>;
|
|
821
|
+
beforeTurn(input: TurnInput, context?: Partial<AgentRunContext>): Promise<PreparedTurn>;
|
|
822
|
+
recordWork(event: WorkEvent, context?: Partial<AgentRunContext>): Promise<MemoryWriteAck$1 | {
|
|
823
|
+
success: true;
|
|
824
|
+
buffered: true;
|
|
825
|
+
}>;
|
|
826
|
+
afterTurn(input: TurnInput & {
|
|
827
|
+
assistantMessage: string;
|
|
828
|
+
}, context?: Partial<AgentRunContext>): Promise<TurnCaptureResult>;
|
|
829
|
+
flush(reason?: string, context?: Partial<AgentRunContext>): Promise<AgentRuntimeStatus>;
|
|
830
|
+
status(): AgentRuntimeStatus;
|
|
831
|
+
}
|
|
832
|
+
|
|
621
833
|
interface WhisperClientConfig {
|
|
622
834
|
apiKey: string;
|
|
623
835
|
baseUrl?: string;
|
|
@@ -711,8 +923,38 @@ declare class WhisperClient {
|
|
|
711
923
|
private readonly sessionModule;
|
|
712
924
|
private readonly profileModule;
|
|
713
925
|
private readonly analyticsModule;
|
|
926
|
+
private readonly projectRefToId;
|
|
927
|
+
private projectCache;
|
|
928
|
+
private projectCacheExpiresAt;
|
|
714
929
|
constructor(config: WhisperClientConfig);
|
|
715
930
|
static fromEnv(overrides?: Partial<WhisperClientConfig>): WhisperClient;
|
|
931
|
+
private createQueueStore;
|
|
932
|
+
private defaultQueuePersistence;
|
|
933
|
+
private defaultQueueFilePath;
|
|
934
|
+
private getRequiredProject;
|
|
935
|
+
private refreshProjectCache;
|
|
936
|
+
private fetchResolvedProject;
|
|
937
|
+
resolveProject(projectRef?: string): Promise<Project>;
|
|
938
|
+
query(params: QueryParams): Promise<QueryResult>;
|
|
939
|
+
ingestSession(params: {
|
|
940
|
+
project?: string;
|
|
941
|
+
session_id: string;
|
|
942
|
+
user_id?: string;
|
|
943
|
+
messages: Array<{
|
|
944
|
+
role: string;
|
|
945
|
+
content: string;
|
|
946
|
+
timestamp: string;
|
|
947
|
+
}>;
|
|
948
|
+
async?: boolean;
|
|
949
|
+
write_mode?: "async" | "sync";
|
|
950
|
+
}): Promise<{
|
|
951
|
+
success: boolean;
|
|
952
|
+
memories_created: number;
|
|
953
|
+
relations_created: number;
|
|
954
|
+
memories_invalidated: number;
|
|
955
|
+
errors?: string[];
|
|
956
|
+
} & MemoryWriteAck$1>;
|
|
957
|
+
createAgentRuntime(options?: AgentRuntimeOptions): WhisperAgentRuntime;
|
|
716
958
|
withRunContext(context: RunContext): {
|
|
717
959
|
memory: {
|
|
718
960
|
add: (params: Omit<Parameters<MemoryModule["add"]>[0], "project" | "user_id" | "session_id"> & {
|
|
@@ -971,6 +1213,12 @@ interface QueryResult {
|
|
|
971
1213
|
cache_hit: boolean;
|
|
972
1214
|
tokens_used: number;
|
|
973
1215
|
context_hash: string;
|
|
1216
|
+
source_scope?: {
|
|
1217
|
+
mode: "none" | "explicit" | "auto";
|
|
1218
|
+
source_ids: string[];
|
|
1219
|
+
host?: string;
|
|
1220
|
+
matched_sources?: number;
|
|
1221
|
+
};
|
|
974
1222
|
profile?: string;
|
|
975
1223
|
compression?: any;
|
|
976
1224
|
timing?: {
|
|
@@ -1814,4 +2062,4 @@ declare class WhisperContext {
|
|
|
1814
2062
|
};
|
|
1815
2063
|
}
|
|
1816
2064
|
|
|
1817
|
-
export { type CanonicalSourceCreateParams, type CanonicalSourceCreateResult, type CanonicalSourceType, type ExtractedMemory, LangChainMemoryAdapter, LangGraphCheckpointAdapter, type Memory, type MemoryExtractionResult, type MemoryKind, type MemoryLatencyBreakdown, type MemorySearchResponse, type MemoryWriteAck, type MemoryWriteResult, type Project, type QueryParams, type QueryResult, type Source, type VideoIngestionStatus, type VideoSourceMetadata, Whisper, WhisperAgentMiddleware, WhisperClient, type WhisperConfig, WhisperContext, Whisper as WhisperDefault, WhisperError, type WhisperErrorCode, WhisperClient as WhisperRuntimeClient, createAgentMiddleware, createLangChainMemoryAdapter, createLangGraphCheckpointAdapter, WhisperContext as default, memoryGraphToMermaid };
|
|
2065
|
+
export { type AgentRunContext, type AgentRuntimeOptions, type AgentRuntimeStatus, type CanonicalSourceCreateParams, type CanonicalSourceCreateResult, type CanonicalSourceType, type ExtractedMemory, LangChainMemoryAdapter, LangGraphCheckpointAdapter, type Memory, type MemoryExtractionResult, type MemoryKind, type MemoryLatencyBreakdown, type MemorySearchResponse, type MemoryWriteAck, type MemoryWriteResult, type PreparedTurn, type Project, type QueryParams, type QueryResult, type Source, type TurnCaptureResult, type TurnInput, type VideoIngestionStatus, type VideoSourceMetadata, Whisper, WhisperAgentMiddleware, WhisperClient, type WhisperConfig, WhisperContext, Whisper as WhisperDefault, WhisperError, type WhisperErrorCode, WhisperClient as WhisperRuntimeClient, type WorkEvent, type WorkEventKind, type WorkEventSalience, createAgentMiddleware, createLangChainMemoryAdapter, createLangGraphCheckpointAdapter, WhisperContext as default, memoryGraphToMermaid };
|