@maximem/synap-js-sdk 0.2.1 → 0.2.3

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/.env.example CHANGED
@@ -1,16 +1,15 @@
1
1
  # ==============================
2
- # REQUIRED FOR LIVE SDK CALLS
2
+ # REQUIRED
3
3
  # ==============================
4
- # Synap instance id (from dashboard/login flow)
5
- SYNAP_INSTANCE_ID=
4
+ # API key from the Synap dashboard
5
+ SYNAP_API_KEY=
6
6
 
7
- # One-time bootstrap key/token from dashboard.
8
- # Required on first initialization for a new instance/cert bootstrap.
9
- # Usually not required after credentials are already stored at ~/.synap/instances/<instance_id>.
10
- SYNAP_BOOTSTRAP_TOKEN=
11
- # Alias accepted by JS bridge (same value as SYNAP_BOOTSTRAP_TOKEN)
12
- SYNAP_BOOTSTRAP_KEY=
7
+ # Instance ID (from the dashboard)
8
+ SYNAP_INSTANCE_ID=
13
9
 
10
+ # ==============================
11
+ # SERVER ENDPOINTS
12
+ # ==============================
14
13
  # Synap HTTP endpoint
15
14
  SYNAP_BASE_URL=http://<synap-api-host>:8000
16
15
 
@@ -23,7 +22,7 @@ SYNAP_GRPC_TLS=false
23
22
  # OPTIONAL
24
23
  # ==============================
25
24
  # Managed runtime home used by `synap-js-sdk setup`
26
- SYNAP_JS_SDK_HOME=/Users/anish/.synap-js-sdk
25
+ SYNAP_JS_SDK_HOME=/Users/<you>/.synap-js-sdk
27
26
 
28
27
  # Optional: override Python binary used by bridge/runtime
29
28
  SYNAP_PYTHON_BIN=python3
@@ -38,10 +37,3 @@ SYNAP_PYTHON_BOOTSTRAP=python3
38
37
  # ==============================
39
38
  # Enable verbose telemetry event tracing in Python SDK
40
39
  SYNAP_TELEMETRY_TRACE_EVENTS=
41
-
42
- # Optional env-credential mode keys (only if Python SDK credentials_source=\"env\")
43
- SYNAP_API_KEY=
44
- SYNAP_REFRESH_TOKEN=
45
- SYNAP_MTLS_CERT_PATH=
46
- SYNAP_MTLS_KEY_PATH=
47
- SYNAP_CLIENT_ID=
package/README.md CHANGED
@@ -39,8 +39,8 @@ $env:USERPROFILE\.synap-js-sdk\.venv\Scripts\python.exe -c "import maximem_synap
39
39
 
40
40
  ## Required Environment Variables
41
41
 
42
+ - `SYNAP_API_KEY` (from the Synap dashboard — Instances → Generate API Key)
42
43
  - `SYNAP_INSTANCE_ID`
43
- - `SYNAP_BOOTSTRAP_TOKEN` (required for first-time initialization/new instance)
44
44
  - `SYNAP_BASE_URL`
45
45
  - `SYNAP_GRPC_HOST`
46
46
  - `SYNAP_GRPC_PORT`
@@ -53,7 +53,7 @@ const { createClient } = require('@maximem/synap-js-sdk');
53
53
 
54
54
  const synap = createClient({
55
55
  instanceId: process.env.SYNAP_INSTANCE_ID,
56
- bootstrapToken: process.env.SYNAP_BOOTSTRAP_TOKEN,
56
+ apiKey: process.env.SYNAP_API_KEY,
57
57
  baseUrl: process.env.SYNAP_BASE_URL,
58
58
  grpcHost: process.env.SYNAP_GRPC_HOST,
59
59
  grpcPort: Number(process.env.SYNAP_GRPC_PORT || 50051),
@@ -164,18 +164,14 @@ async def handle_init(params: dict) -> dict:
164
164
  timings: List[dict] = []
165
165
 
166
166
  instance_id = params.get("instance_id", "")
167
- bootstrap_token = params.get("bootstrap_token") or params.get("bootstrap_key")
167
+ api_key = params.get("api_key")
168
168
 
169
169
  step = time.perf_counter()
170
- try:
171
- sdk = MaximemSynapSDK(
172
- instance_id=instance_id,
173
- bootstrap_token=bootstrap_token,
174
- _force_new=True,
175
- )
176
- except TypeError:
177
- # Backward compatibility with older SDK constructors.
178
- sdk = MaximemSynapSDK(instance_id=instance_id, _force_new=True)
170
+ sdk = MaximemSynapSDK(
171
+ instance_id=instance_id,
172
+ api_key=api_key,
173
+ _force_new=True,
174
+ )
179
175
  append_step(timings, "construct_sdk", step)
180
176
 
181
177
  config_kwargs = {"log_level": "DEBUG", "cache_backend": "sqlite"}
@@ -194,10 +190,7 @@ async def handle_init(params: dict) -> dict:
194
190
  append_step(timings, "configure_sdk", step)
195
191
 
196
192
  step = time.perf_counter()
197
- if bootstrap_token:
198
- await sdk.initialize(bootstrap_token=bootstrap_token)
199
- else:
200
- await sdk.initialize()
193
+ await sdk.initialize()
201
194
  append_step(timings, "initialize_sdk", step)
202
195
 
203
196
  grpc_listening = False
@@ -221,7 +214,6 @@ async def handle_init(params: dict) -> dict:
221
214
  return {
222
215
  "success": True,
223
216
  "instance_id": instance_id,
224
- "bootstrap_token_used": bool(bootstrap_token),
225
217
  "grpc_listening": grpc_listening,
226
218
  "bridgeTiming": {
227
219
  "python_total_ms": ms_since(handler_start),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maximem/synap-js-sdk",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "JavaScript wrapper around the Synap Python SDK",
5
5
  "main": "src/index.js",
6
6
  "types": "types/index.d.ts",
@@ -59,9 +59,8 @@ class BridgeManager {
59
59
  'init',
60
60
  {
61
61
  instance_id: instanceId,
62
- bootstrap_token: this.options.bootstrapToken
63
- || process.env.SYNAP_BOOTSTRAP_TOKEN
64
- || process.env.SYNAP_BOOTSTRAP_KEY,
62
+ api_key: this.options.apiKey
63
+ || process.env.SYNAP_API_KEY,
65
64
  base_url: this.options.baseUrl || process.env.SYNAP_BASE_URL,
66
65
  grpc_host: this.options.grpcHost || process.env.SYNAP_GRPC_HOST,
67
66
  grpc_port: Number(this.options.grpcPort || process.env.SYNAP_GRPC_PORT || 50051),
package/src/errors.js CHANGED
@@ -79,34 +79,6 @@ class AuthenticationError extends SynapPermanentError {
79
79
  }
80
80
  }
81
81
 
82
- class CertificateExpiredError extends AuthenticationError {
83
- constructor(message, correlationId) {
84
- super(message, correlationId);
85
- this.name = 'CertificateExpiredError';
86
- }
87
- }
88
-
89
- class CertificateRenewalError extends AuthenticationError {
90
- constructor(message, correlationId) {
91
- super(message, correlationId);
92
- this.name = 'CertificateRenewalError';
93
- }
94
- }
95
-
96
- class BootstrapKeyInvalidError extends AuthenticationError {
97
- constructor(message, correlationId) {
98
- super(message, correlationId);
99
- this.name = 'BootstrapKeyInvalidError';
100
- }
101
- }
102
-
103
- class BootstrapError extends SynapPermanentError {
104
- constructor(message, correlationId) {
105
- super(message, correlationId);
106
- this.name = 'BootstrapError';
107
- }
108
- }
109
-
110
82
  class ContextNotFoundError extends SynapPermanentError {
111
83
  constructor(message, correlationId) {
112
84
  super(message, correlationId);
@@ -147,10 +119,6 @@ const ERROR_MAP = {
147
119
  InvalidInstanceIdError,
148
120
  InvalidConversationIdError,
149
121
  AuthenticationError,
150
- CertificateExpiredError,
151
- CertificateRenewalError,
152
- BootstrapKeyInvalidError,
153
- BootstrapError,
154
122
  ContextNotFoundError,
155
123
  SessionExpiredError,
156
124
  ListeningAlreadyActiveError,
@@ -175,10 +143,6 @@ module.exports = {
175
143
  InvalidInstanceIdError,
176
144
  InvalidConversationIdError,
177
145
  AuthenticationError,
178
- CertificateExpiredError,
179
- CertificateRenewalError,
180
- BootstrapKeyInvalidError,
181
- BootstrapError,
182
146
  ContextNotFoundError,
183
147
  SessionExpiredError,
184
148
  ListeningAlreadyActiveError,
package/types/index.d.ts CHANGED
@@ -30,7 +30,7 @@ export interface BridgeLogHandler {
30
30
 
31
31
  export interface SynapClientOptions {
32
32
  instanceId?: string;
33
- bootstrapToken?: string;
33
+ apiKey?: string;
34
34
  baseUrl?: string;
35
35
  grpcHost?: string;
36
36
  grpcPort?: number;
@@ -370,10 +370,6 @@ export class InvalidInputError extends SynapPermanentError {}
370
370
  export class InvalidInstanceIdError extends InvalidInputError {}
371
371
  export class InvalidConversationIdError extends InvalidInputError {}
372
372
  export class AuthenticationError extends SynapPermanentError {}
373
- export class CertificateExpiredError extends AuthenticationError {}
374
- export class CertificateRenewalError extends AuthenticationError {}
375
- export class BootstrapKeyInvalidError extends AuthenticationError {}
376
- export class BootstrapError extends SynapPermanentError {}
377
373
  export class ContextNotFoundError extends SynapPermanentError {}
378
374
  export class SessionExpiredError extends SynapPermanentError {}
379
375
  export class ListeningAlreadyActiveError extends SynapPermanentError {}