@alfe.ai/claude-code-host 0.1.7 → 0.1.9

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/dist/index.d.cts CHANGED
@@ -786,6 +786,7 @@ declare class ChatApi extends ApiBase {
786
786
  attachments: {
787
787
  id: string;
788
788
  uploadUrl: string;
789
+ uploadHeaders: Record<string, string>;
789
790
  downloadUrl: string;
790
791
  s3Key: string;
791
792
  expiresAt: string;
@@ -1274,10 +1275,41 @@ declare class ConnectCredentialsApi extends ApiBase {
1274
1275
  brokerName?: string;
1275
1276
  accountNumber?: string;
1276
1277
  accessToken: string;
1278
+ /**
1279
+ * The stable per-grant Connection key (`ctid:<userId>`) this account
1280
+ * belongs to. Every trading account under one cTrader login shares one
1281
+ * grant (one OAuth token), so this is the identifier the MCP server
1282
+ * passes to `refreshCTraderAccount()` to rotate the token for the whole
1283
+ * grant on a `CH_ACCESS_TOKEN_INVALID` expiry. Empty string when the
1284
+ * server did not supply one (legacy rows) — such an account can still
1285
+ * trade with its current token but cannot self-refresh.
1286
+ */
1287
+ accountIdentifier: string;
1277
1288
  }[];
1278
1289
  clientId: string;
1279
1290
  clientSecret: string;
1280
1291
  }>;
1292
+ /**
1293
+ * Pattern A: refresh a specific cTrader grant by its stable
1294
+ * `accountIdentifier` (`ctid:<userId>` from `getCTraderAccounts()`).
1295
+ *
1296
+ * cTrader access tokens live ~30 days; the `getCTraderAccounts()` /
1297
+ * credentials reads serve the STORED token without refreshing, so refresh is
1298
+ * the consumer's job. `@alfe.ai/ctrader-mcp` calls this when the cTrader Open
1299
+ * API rejects an account-auth with `CH_ACCESS_TOKEN_INVALID`, then re-runs
1300
+ * the socket handshake with the returned `accessToken`.
1301
+ *
1302
+ * Refreshing one grant rotates the single OAuth token that covers EVERY
1303
+ * trading account under that login. cTrader's refresh token itself does not
1304
+ * expire but may rotate on refresh (`rotatesRefreshToken: true`); connect
1305
+ * persists the rotated refresh token server-side, so the caller only needs
1306
+ * the new `accessToken`. Mirrors `refreshXeroAccountToken`.
1307
+ */
1308
+ refreshCTraderAccount(accountIdentifier: string): Promise<{
1309
+ accessToken: string;
1310
+ accessTokenExpiresAt: string;
1311
+ expiresAt: string;
1312
+ }>;
1281
1313
  /**
1282
1314
  * @deprecated Returns a single primary credential blob. Use
1283
1315
  * `getShopifyAccounts()` for the multi-account shape required by Pattern A
@@ -1576,7 +1608,9 @@ declare class IntegrationsApi extends ApiBase {
1576
1608
  config?: Record<string, unknown>;
1577
1609
  }): Promise<IntegrationInstall>;
1578
1610
  removeIntegration(integrationId: string): Promise<IntegrationInstall>;
1579
- getOAuthUrl(provider: string, scopes?: string[]): Promise<{
1611
+ getOAuthUrl(provider: string, scopes?: string[], options?: {
1612
+ shop?: string;
1613
+ }): Promise<{
1580
1614
  url: string;
1581
1615
  provider: string;
1582
1616
  expiresIn: number;
package/dist/index.d.ts CHANGED
@@ -786,6 +786,7 @@ declare class ChatApi extends ApiBase {
786
786
  attachments: {
787
787
  id: string;
788
788
  uploadUrl: string;
789
+ uploadHeaders: Record<string, string>;
789
790
  downloadUrl: string;
790
791
  s3Key: string;
791
792
  expiresAt: string;
@@ -1274,10 +1275,41 @@ declare class ConnectCredentialsApi extends ApiBase {
1274
1275
  brokerName?: string;
1275
1276
  accountNumber?: string;
1276
1277
  accessToken: string;
1278
+ /**
1279
+ * The stable per-grant Connection key (`ctid:<userId>`) this account
1280
+ * belongs to. Every trading account under one cTrader login shares one
1281
+ * grant (one OAuth token), so this is the identifier the MCP server
1282
+ * passes to `refreshCTraderAccount()` to rotate the token for the whole
1283
+ * grant on a `CH_ACCESS_TOKEN_INVALID` expiry. Empty string when the
1284
+ * server did not supply one (legacy rows) — such an account can still
1285
+ * trade with its current token but cannot self-refresh.
1286
+ */
1287
+ accountIdentifier: string;
1277
1288
  }[];
1278
1289
  clientId: string;
1279
1290
  clientSecret: string;
1280
1291
  }>;
1292
+ /**
1293
+ * Pattern A: refresh a specific cTrader grant by its stable
1294
+ * `accountIdentifier` (`ctid:<userId>` from `getCTraderAccounts()`).
1295
+ *
1296
+ * cTrader access tokens live ~30 days; the `getCTraderAccounts()` /
1297
+ * credentials reads serve the STORED token without refreshing, so refresh is
1298
+ * the consumer's job. `@alfe.ai/ctrader-mcp` calls this when the cTrader Open
1299
+ * API rejects an account-auth with `CH_ACCESS_TOKEN_INVALID`, then re-runs
1300
+ * the socket handshake with the returned `accessToken`.
1301
+ *
1302
+ * Refreshing one grant rotates the single OAuth token that covers EVERY
1303
+ * trading account under that login. cTrader's refresh token itself does not
1304
+ * expire but may rotate on refresh (`rotatesRefreshToken: true`); connect
1305
+ * persists the rotated refresh token server-side, so the caller only needs
1306
+ * the new `accessToken`. Mirrors `refreshXeroAccountToken`.
1307
+ */
1308
+ refreshCTraderAccount(accountIdentifier: string): Promise<{
1309
+ accessToken: string;
1310
+ accessTokenExpiresAt: string;
1311
+ expiresAt: string;
1312
+ }>;
1281
1313
  /**
1282
1314
  * @deprecated Returns a single primary credential blob. Use
1283
1315
  * `getShopifyAccounts()` for the multi-account shape required by Pattern A
@@ -1576,7 +1608,9 @@ declare class IntegrationsApi extends ApiBase {
1576
1608
  config?: Record<string, unknown>;
1577
1609
  }): Promise<IntegrationInstall>;
1578
1610
  removeIntegration(integrationId: string): Promise<IntegrationInstall>;
1579
- getOAuthUrl(provider: string, scopes?: string[]): Promise<{
1611
+ getOAuthUrl(provider: string, scopes?: string[], options?: {
1612
+ shop?: string;
1613
+ }): Promise<{
1580
1614
  url: string;
1581
1615
  provider: string;
1582
1616
  expiresIn: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/claude-code-host",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Chat bridge that makes a self-hosted Claude Code agent reachable from Alfe chat on the user's Claude subscription",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "dist"
20
20
  ],
21
21
  "dependencies": {
22
- "@alfe.ai/agent-api-client": "^0.15.0",
22
+ "@alfe.ai/agent-api-client": "^0.17.0",
23
23
  "@alfe.ai/chat": "^0.0.18",
24
24
  "@alfe.ai/config": "^0.4.1"
25
25
  },