kontexted 0.1.15 → 0.1.16

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.
@@ -113,6 +113,10 @@ export class ApiClient {
113
113
  return false;
114
114
  }
115
115
  const tokens = (await response.json());
116
+ // Calculate absolute expiry time if not provided by server
117
+ if (tokens.expires_in && !tokens.expires_at) {
118
+ tokens.expires_at = Math.floor(Date.now() / 1000) + tokens.expires_in;
119
+ }
116
120
  this.oauth.tokens = tokens;
117
121
  await this.persist();
118
122
  logDebug("[API CLIENT] Token refresh successful");
@@ -34,12 +34,14 @@ export async function createAuthenticatedClient(profileAlias) {
34
34
  }
35
35
  };
36
36
  };
37
+ // Create a single persist callback to be reused
38
+ const persistCallback = createPersistCallback();
37
39
  // Proactively validate/refresh tokens before creating the client
38
- const tokensValid = await ensureValidTokens(profile.oauth, createPersistCallback(), profile.serverUrl);
40
+ const tokensValid = await ensureValidTokens(profile.oauth, persistCallback, profile.serverUrl);
39
41
  if (!tokensValid) {
40
42
  throw new Error(`Authentication expired for ${profileAlias}. Run 'kontexted login --alias ${profileAlias}' to re-authenticate.`);
41
43
  }
42
- // Create the ApiClient with the same deep-copy persist callback
43
- const client = new ApiClient(profile.serverUrl, profile.oauth, createPersistCallback());
44
+ // Create the ApiClient with the same persist callback
45
+ const client = new ApiClient(profile.serverUrl, profile.oauth, persistCallback);
44
46
  return { client, config, profile };
45
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kontexted",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "CLI tool for Kontexted - MCP proxy, workspaces management, and local server",
5
5
  "type": "module",
6
6
  "bin": {
@@ -48,8 +48,8 @@
48
48
  "typescript": "^5.6.0"
49
49
  },
50
50
  "optionalDependencies": {
51
- "@kontexted/darwin-arm64": "0.1.15",
52
- "@kontexted/linux-x64": "0.1.15",
53
- "@kontexted/windows-x64": "0.1.15"
51
+ "@kontexted/darwin-arm64": "0.1.16",
52
+ "@kontexted/linux-x64": "0.1.16",
53
+ "@kontexted/windows-x64": "0.1.16"
54
54
  }
55
55
  }