@alfe.ai/claude-code-host 0.1.3 → 0.1.4

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
@@ -542,8 +542,11 @@ declare class AgentApiClient {
542
542
  * else the driver needs for routing (handle, pdsHost, did, …) is on
543
543
  * `providerMetadata`.
544
544
  *
545
- * Token refresh is delegated to connect (never done in-plugin) via
546
- * `POST /agent/connect/{provider}/refresh` — not exposed here.
545
+ * Token refresh is delegated to connect (never done in-plugin) via the
546
+ * per-account route `POST /agent/connect/{provider}/accounts/{accountIdentifier}/refresh`
547
+ * — call `refreshSocialAccount(provider, accountIdentifier)`. (The non-account
548
+ * `POST /agent/connect/{provider}/refresh` route refreshes the provider's
549
+ * PRIMARY connection, which is wrong under multi-account Pattern A.)
547
550
  */
548
551
  getSocialAccounts(provider: string): Promise<{
549
552
  provider: string;
@@ -556,6 +559,29 @@ declare class AgentApiClient {
556
559
  connectedAt: string;
557
560
  }[];
558
561
  }>;
562
+ /**
563
+ * Pattern A: refresh a specific social Connection by its stable
564
+ * `accountIdentifier` (for Bluesky: the account DID) via the
565
+ * provider-generic per-account refresh route. The counterpart to
566
+ * `getSocialAccounts(provider)`; `@alfe.ai/social-mcp` calls this on a
567
+ * 401/ExpiredToken from the platform PDS/API, then re-fetches accounts to
568
+ * pick up the rotated bundle.
569
+ *
570
+ * Refresh itself is ALWAYS delegated to connect — the plugin never calls
571
+ * the platform's own refresh XRPC (e.g. `com.atproto.server.refreshSession`)
572
+ * because connect owns the encrypted refresh token + rotation persistence
573
+ * (Bluesky rotates the refreshJwt; a missed rotation kills the connection
574
+ * after one refresh). The returned `accessToken` is whatever the provider's
575
+ * `refreshToken` hook re-bundled (for Bluesky: the JSON session bundle with
576
+ * the fresh `accessJwt`) — callers typically ignore it and re-fetch via
577
+ * `getSocialAccounts` for a consistent shape.
578
+ */
579
+ refreshSocialAccount(provider: string, accountIdentifier: string): Promise<{
580
+ accountIdentifier: string;
581
+ accessToken: string;
582
+ accessTokenExpiresAt: string;
583
+ expiresAt: string;
584
+ }>;
559
585
  /**
560
586
  * @deprecated Returns a single primary credential blob (legacy "pick-the-
561
587
  * default-connection" shape). Use `getXeroAccounts()` for the multi-
@@ -791,6 +817,45 @@ declare class AgentApiClient {
791
817
  accessTokenExpiresAt: string;
792
818
  expiresAt: string;
793
819
  }>;
820
+ /**
821
+ * @deprecated Returns a single primary credential blob. Use
822
+ * `getShopifyAccounts()` for the multi-account shape required by Pattern A
823
+ * (`@alfe.ai/shopify-mcp` keys per-shop on the myshopify domain).
824
+ */
825
+ getShopifyCredentials(): Promise<{
826
+ accessToken: string;
827
+ shopDomain: string;
828
+ shopGid: string;
829
+ shopName: string;
830
+ apiVersion: string;
831
+ }>;
832
+ /**
833
+ * Pattern A: multi-account credential fetch for Shopify. Returns every
834
+ * agent-scoped Shopify Connection. One OAuth grant maps to one store, so the
835
+ * stable per-call selector is the store's myshopify domain (`shopDomain`),
836
+ * NOT `accountIdentifier` — the connect provider keys `accountIdentifier` on
837
+ * the immutable shop GID (falling back to the domain), so `shopDomain` is the
838
+ * value the LLM passes and the plugin routes on.
839
+ *
840
+ * Each entry is shaped by the connect provider's `buildCredentialsResponse`:
841
+ * `{ accessToken, shopDomain, shopGid, shopName, apiVersion }` — offline
842
+ * Shopify tokens never expire, so there is NO token / expiry field and no
843
+ * refresh method (unlike Salesforce). The GraphQL Admin API authenticates
844
+ * purely on `X-Shopify-Access-Token`; no client credentials are on the wire.
845
+ */
846
+ getShopifyAccounts(): Promise<{
847
+ accounts: {
848
+ connectionId: string;
849
+ accountIdentifier: string;
850
+ displayName: string | null;
851
+ connectedAt: string;
852
+ accessToken: string;
853
+ shopDomain: string;
854
+ shopGid: string;
855
+ shopName: string;
856
+ apiVersion: string;
857
+ }[];
858
+ }>;
794
859
  /**
795
860
  * Disconnects one connected Microsoft 365 account for the agent, by its
796
861
  * `accountIdentifier`. Hits the generic per-account disconnect route
package/dist/index.d.ts CHANGED
@@ -542,8 +542,11 @@ declare class AgentApiClient {
542
542
  * else the driver needs for routing (handle, pdsHost, did, …) is on
543
543
  * `providerMetadata`.
544
544
  *
545
- * Token refresh is delegated to connect (never done in-plugin) via
546
- * `POST /agent/connect/{provider}/refresh` — not exposed here.
545
+ * Token refresh is delegated to connect (never done in-plugin) via the
546
+ * per-account route `POST /agent/connect/{provider}/accounts/{accountIdentifier}/refresh`
547
+ * — call `refreshSocialAccount(provider, accountIdentifier)`. (The non-account
548
+ * `POST /agent/connect/{provider}/refresh` route refreshes the provider's
549
+ * PRIMARY connection, which is wrong under multi-account Pattern A.)
547
550
  */
548
551
  getSocialAccounts(provider: string): Promise<{
549
552
  provider: string;
@@ -556,6 +559,29 @@ declare class AgentApiClient {
556
559
  connectedAt: string;
557
560
  }[];
558
561
  }>;
562
+ /**
563
+ * Pattern A: refresh a specific social Connection by its stable
564
+ * `accountIdentifier` (for Bluesky: the account DID) via the
565
+ * provider-generic per-account refresh route. The counterpart to
566
+ * `getSocialAccounts(provider)`; `@alfe.ai/social-mcp` calls this on a
567
+ * 401/ExpiredToken from the platform PDS/API, then re-fetches accounts to
568
+ * pick up the rotated bundle.
569
+ *
570
+ * Refresh itself is ALWAYS delegated to connect — the plugin never calls
571
+ * the platform's own refresh XRPC (e.g. `com.atproto.server.refreshSession`)
572
+ * because connect owns the encrypted refresh token + rotation persistence
573
+ * (Bluesky rotates the refreshJwt; a missed rotation kills the connection
574
+ * after one refresh). The returned `accessToken` is whatever the provider's
575
+ * `refreshToken` hook re-bundled (for Bluesky: the JSON session bundle with
576
+ * the fresh `accessJwt`) — callers typically ignore it and re-fetch via
577
+ * `getSocialAccounts` for a consistent shape.
578
+ */
579
+ refreshSocialAccount(provider: string, accountIdentifier: string): Promise<{
580
+ accountIdentifier: string;
581
+ accessToken: string;
582
+ accessTokenExpiresAt: string;
583
+ expiresAt: string;
584
+ }>;
559
585
  /**
560
586
  * @deprecated Returns a single primary credential blob (legacy "pick-the-
561
587
  * default-connection" shape). Use `getXeroAccounts()` for the multi-
@@ -791,6 +817,45 @@ declare class AgentApiClient {
791
817
  accessTokenExpiresAt: string;
792
818
  expiresAt: string;
793
819
  }>;
820
+ /**
821
+ * @deprecated Returns a single primary credential blob. Use
822
+ * `getShopifyAccounts()` for the multi-account shape required by Pattern A
823
+ * (`@alfe.ai/shopify-mcp` keys per-shop on the myshopify domain).
824
+ */
825
+ getShopifyCredentials(): Promise<{
826
+ accessToken: string;
827
+ shopDomain: string;
828
+ shopGid: string;
829
+ shopName: string;
830
+ apiVersion: string;
831
+ }>;
832
+ /**
833
+ * Pattern A: multi-account credential fetch for Shopify. Returns every
834
+ * agent-scoped Shopify Connection. One OAuth grant maps to one store, so the
835
+ * stable per-call selector is the store's myshopify domain (`shopDomain`),
836
+ * NOT `accountIdentifier` — the connect provider keys `accountIdentifier` on
837
+ * the immutable shop GID (falling back to the domain), so `shopDomain` is the
838
+ * value the LLM passes and the plugin routes on.
839
+ *
840
+ * Each entry is shaped by the connect provider's `buildCredentialsResponse`:
841
+ * `{ accessToken, shopDomain, shopGid, shopName, apiVersion }` — offline
842
+ * Shopify tokens never expire, so there is NO token / expiry field and no
843
+ * refresh method (unlike Salesforce). The GraphQL Admin API authenticates
844
+ * purely on `X-Shopify-Access-Token`; no client credentials are on the wire.
845
+ */
846
+ getShopifyAccounts(): Promise<{
847
+ accounts: {
848
+ connectionId: string;
849
+ accountIdentifier: string;
850
+ displayName: string | null;
851
+ connectedAt: string;
852
+ accessToken: string;
853
+ shopDomain: string;
854
+ shopGid: string;
855
+ shopName: string;
856
+ apiVersion: string;
857
+ }[];
858
+ }>;
794
859
  /**
795
860
  * Disconnects one connected Microsoft 365 account for the agent, by its
796
861
  * `accountIdentifier`. Hits the generic per-account disconnect route
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/claude-code-host",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
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.11.1",
22
+ "@alfe.ai/agent-api-client": "^0.12.0",
23
23
  "@alfe.ai/chat": "^0.0.16",
24
24
  "@alfe.ai/config": "^0.3.0"
25
25
  },