@maximem/synap-js-sdk 0.1.1

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.
@@ -0,0 +1,170 @@
1
+ export type LogLevel = 'debug' | 'error';
2
+
3
+ export interface BridgeLogHandler {
4
+ (level: LogLevel, message: string): void;
5
+ }
6
+
7
+ export interface SynapClientOptions {
8
+ instanceId?: string;
9
+ bootstrapToken?: string;
10
+ baseUrl?: string;
11
+ grpcHost?: string;
12
+ grpcPort?: number;
13
+ grpcUseTls?: boolean;
14
+ pythonBin?: string;
15
+ bridgeScriptPath?: string;
16
+ sdkHome?: string;
17
+ venvPath?: string;
18
+ pythonBootstrap?: string;
19
+ pythonPackage?: string;
20
+ pythonSdkVersion?: string;
21
+ noDeps?: boolean;
22
+ noBuildIsolation?: boolean;
23
+ upgrade?: boolean;
24
+ forceRecreateVenv?: boolean;
25
+ autoSetup?: boolean;
26
+ requestTimeoutMs?: number;
27
+ initTimeoutMs?: number;
28
+ ingestTimeoutMs?: number;
29
+ pythonEnv?: NodeJS.ProcessEnv;
30
+ onLog?: BridgeLogHandler;
31
+ }
32
+
33
+ export interface ChatMessage {
34
+ role?: string;
35
+ content: string;
36
+ }
37
+
38
+ export interface AddMemoryInput {
39
+ userId: string;
40
+ messages: ChatMessage[];
41
+ }
42
+
43
+ export interface SearchMemoryInput {
44
+ userId: string;
45
+ query: string;
46
+ maxResults?: number;
47
+ }
48
+
49
+ export interface GetMemoriesInput {
50
+ userId: string;
51
+ }
52
+
53
+ export interface DeleteMemoryInput {
54
+ userId: string;
55
+ memoryId?: string | null;
56
+ }
57
+
58
+ export interface BridgeStepTiming {
59
+ step: string;
60
+ ms: number;
61
+ }
62
+
63
+ export interface BridgeTiming {
64
+ python_total_ms: number;
65
+ steps: BridgeStepTiming[];
66
+ }
67
+
68
+ export interface AddMemoryResult {
69
+ success: boolean;
70
+ latencyMs: number;
71
+ rawResponse: Record<string, unknown>;
72
+ note?: string;
73
+ bridgeTiming?: BridgeTiming;
74
+ }
75
+
76
+ export interface SearchMemoryItem {
77
+ id: string;
78
+ memory: string;
79
+ score?: number;
80
+ }
81
+
82
+ export interface SearchMemoryResult {
83
+ success: boolean;
84
+ latencyMs: number;
85
+ results: SearchMemoryItem[];
86
+ resultsCount: number;
87
+ rawResponse: Record<string, unknown>;
88
+ source?: string;
89
+ bridgeTiming?: BridgeTiming;
90
+ }
91
+
92
+ export interface MemoryItem {
93
+ id: string;
94
+ memory: string;
95
+ }
96
+
97
+ export interface GetMemoriesResult {
98
+ success: boolean;
99
+ latencyMs: number;
100
+ memories: MemoryItem[];
101
+ totalCount: number;
102
+ bridgeTiming?: BridgeTiming;
103
+ }
104
+
105
+ export interface DeleteMemoryResult {
106
+ success: boolean;
107
+ deletedCount: number;
108
+ note?: string;
109
+ bridgeTiming?: BridgeTiming;
110
+ }
111
+
112
+ export class SynapClient {
113
+ constructor(options?: SynapClientOptions);
114
+ init(): Promise<void>;
115
+ addMemory(input: AddMemoryInput): Promise<AddMemoryResult>;
116
+ searchMemory(input: SearchMemoryInput): Promise<SearchMemoryResult>;
117
+ getMemories(input: GetMemoriesInput): Promise<GetMemoriesResult>;
118
+ deleteMemory(input: DeleteMemoryInput): Promise<DeleteMemoryResult>;
119
+ shutdown(): Promise<void>;
120
+ }
121
+
122
+ export interface SetupPythonRuntimeOptions {
123
+ sdkHome?: string;
124
+ venvPath?: string;
125
+ pythonBootstrap?: string;
126
+ pythonPackage?: string;
127
+ pythonSdkVersion?: string;
128
+ noDeps?: boolean;
129
+ noBuildIsolation?: boolean;
130
+ upgrade?: boolean;
131
+ forceRecreateVenv?: boolean;
132
+ }
133
+
134
+ export interface SetupPythonRuntimeResult {
135
+ sdkHome: string;
136
+ venvPath: string;
137
+ pythonBin: string;
138
+ pythonPackage: string;
139
+ pythonSdkVersion: string | null;
140
+ installTarget: string;
141
+ }
142
+
143
+ export interface SetupTypeScriptExtensionOptions {
144
+ projectDir?: string;
145
+ packageManager?: 'npm' | 'pnpm' | 'yarn' | 'bun';
146
+ skipInstall?: boolean;
147
+ tsconfigPath?: string;
148
+ wrapperPath?: string;
149
+ force?: boolean;
150
+ noWrapper?: boolean;
151
+ }
152
+
153
+ export interface SetupTypeScriptExtensionResult {
154
+ projectDir: string;
155
+ packageManager: 'npm' | 'pnpm' | 'yarn' | 'bun';
156
+ installedDevDependencies: boolean;
157
+ tsconfigPath: string;
158
+ tsconfigCreated: boolean;
159
+ wrapperPath: string | null;
160
+ wrapperCreated: boolean;
161
+ }
162
+
163
+ export function createClient(options?: SynapClientOptions): SynapClient;
164
+ export function resolveInstanceId(explicitInstanceId?: string): string;
165
+ export function setupPythonRuntime(
166
+ options?: SetupPythonRuntimeOptions
167
+ ): Promise<SetupPythonRuntimeResult>;
168
+ export function setupTypeScriptExtension(
169
+ options?: SetupTypeScriptExtensionOptions
170
+ ): Promise<SetupTypeScriptExtensionResult>;