@aigne/aigne-hub 0.5.2 → 0.6.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.2](https://github.com/AIGNE-io/aigne-framework/compare/aigne-hub-v0.6.1...aigne-hub-v0.6.2) (2025-08-15)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **cli:** display only the origin URL when linking to hub ([#369](https://github.com/AIGNE-io/aigne-framework/issues/369)) ([b3baf3f](https://github.com/AIGNE-io/aigne-framework/commit/b3baf3f2c98f965d5279dd0dfb282be9f5ffb6c2))
9
+ * **model:** add x-aigne-hub-client-did header for hub model requests ([#371](https://github.com/AIGNE-io/aigne-framework/issues/371)) ([8c29f37](https://github.com/AIGNE-io/aigne-framework/commit/8c29f377d6ef3833723c8ec721a252171026d84d))
10
+
11
+ ## [0.6.1](https://github.com/AIGNE-io/aigne-framework/compare/aigne-hub-v0.6.0...aigne-hub-v0.6.1) (2025-08-15)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * **model:** ensure Chat Model client is initialized before use ([#367](https://github.com/AIGNE-io/aigne-framework/issues/367)) ([7543ccb](https://github.com/AIGNE-io/aigne-framework/commit/7543ccb7e1cf5395c4f4e1f51659982b58f5daa1))
17
+
18
+ ## [0.6.0](https://github.com/AIGNE-io/aigne-framework/compare/aigne-hub-v0.5.2...aigne-hub-v0.6.0) (2025-08-14)
19
+
20
+
21
+ ### Features
22
+
23
+ * **model:** add poe chat model support ([#365](https://github.com/AIGNE-io/aigne-framework/issues/365)) ([b2cce67](https://github.com/AIGNE-io/aigne-framework/commit/b2cce67bdab1c6dec273929bcdd79e1d15410119))
24
+
25
+
26
+ ### Dependencies
27
+
28
+ * The following workspace dependencies were updated
29
+ * dependencies
30
+ * @aigne/poe bumped to 1.0.0
31
+
3
32
  ## [0.5.2](https://github.com/AIGNE-io/aigne-framework/compare/aigne-hub-v0.5.1...aigne-hub-v0.5.2) (2025-08-14)
4
33
 
5
34
 
@@ -14,7 +14,7 @@ export declare class AIGNEHubChatModel extends ChatModel {
14
14
  baseURL?: string;
15
15
  url?: string;
16
16
  });
17
- get client(): ChatModel | undefined;
17
+ get client(): ChatModel;
18
18
  getCredential(): {
19
19
  url: string;
20
20
  apiKey: any;
@@ -38,7 +38,7 @@ class AIGNEHubChatModel extends core_1.ChatModel {
38
38
  url,
39
39
  apiKey,
40
40
  };
41
- this._client ?? modelEntry.create(options);
41
+ this._client ??= modelEntry.create(options);
42
42
  return this._client;
43
43
  }
44
44
  getCredential() {
@@ -62,7 +62,9 @@ class AIGNEHubChatModel extends core_1.ChatModel {
62
62
  throw new Error("Client not initialized");
63
63
  }
64
64
  options.fetchOptions = {
65
- headers: { "x-aigne-hub-client-did": process.env.BLOCKLET_APP_PID || "" },
65
+ headers: {
66
+ "x-aigne-hub-client-did": process.env.BLOCKLET_APP_PID || process.env.ABT_NODE_DID || "",
67
+ },
66
68
  ...options.fetchOptions,
67
69
  };
68
70
  return this.client.invoke(input, options);
@@ -48,8 +48,10 @@ class AIGNEHubChatModel extends core_1.ChatModel {
48
48
  };
49
49
  }
50
50
  process(input, options) {
51
+ const { BLOCKLET_APP_PID, ABT_NODE_DID } = process.env;
52
+ const clientId = BLOCKLET_APP_PID || ABT_NODE_DID || `@aigne/aigne-hub:${index_js_1.nodejs.os.hostname()}`;
51
53
  options.fetchOptions = {
52
- headers: { "x-aigne-hub-client-did": `@aigne/aigne-hub:${index_js_1.nodejs.os.hostname()}` },
54
+ headers: { "x-aigne-hub-client-did": clientId },
53
55
  ...options.fetchOptions,
54
56
  };
55
57
  return this.client.__invoke(undefined, input, options);
@@ -16,7 +16,7 @@ export declare function connectToAIGNEHub(url: string): Promise<{
16
16
  }>;
17
17
  export declare const checkConnectionStatus: (host: string) => Promise<{
18
18
  apiKey: any;
19
- url: string;
19
+ url: any;
20
20
  }>;
21
21
  export declare function loadCredential(options?: LoadCredentialOptions): Promise<{
22
22
  apiKey?: string;
@@ -84,7 +84,7 @@ async function getAIGNEHubMountPoint(url) {
84
84
  async function connectToAIGNEHub(url) {
85
85
  const { origin, host } = new URL(url);
86
86
  const connectUrl = (0, ufo_1.joinURL)(origin, constants_js_1.WELLKNOWN_SERVICE_PATH_PREFIX);
87
- const urlWithAIGNEHubMountPoint = await getAIGNEHubMountPoint(url);
87
+ const apiUrl = await getAIGNEHubMountPoint(url);
88
88
  try {
89
89
  const openFn = constants_js_1.isTest ? () => { } : open_1.default;
90
90
  const result = await createConnect({
@@ -96,7 +96,7 @@ async function connectToAIGNEHub(url) {
96
96
  });
97
97
  const accessKeyOptions = {
98
98
  apiKey: result.accessKeySecret,
99
- url: urlWithAIGNEHubMountPoint,
99
+ url: apiUrl,
100
100
  };
101
101
  // After redirection, write the AIGNE Hub access token
102
102
  const aigneDir = index_js_1.nodejs.path.join(index_js_1.nodejs.os.homedir(), ".aigne");
@@ -140,7 +140,7 @@ const checkConnectionStatus = async (host) => {
140
140
  }
141
141
  return {
142
142
  apiKey: env.AIGNE_HUB_API_KEY,
143
- url: (0, ufo_1.joinURL)(env.AIGNE_HUB_API_URL),
143
+ url: env.AIGNE_HUB_API_URL,
144
144
  };
145
145
  };
146
146
  exports.checkConnectionStatus = checkConnectionStatus;
@@ -217,6 +217,9 @@ async function loadCredential(options) {
217
217
  }
218
218
  credential = await connectToAIGNEHub(aigneHubUrl);
219
219
  }
220
+ else {
221
+ throw error;
222
+ }
220
223
  }
221
224
  }
222
225
  return credential;
@@ -11,11 +11,13 @@ exports.loadModel = loadModel;
11
11
  const anthropic_1 = require("@aigne/anthropic");
12
12
  const bedrock_1 = require("@aigne/bedrock");
13
13
  const deepseek_1 = require("@aigne/deepseek");
14
+ const doubao_1 = require("@aigne/doubao");
14
15
  const gemini_1 = require("@aigne/gemini");
15
16
  const ollama_1 = require("@aigne/ollama");
16
17
  const open_router_1 = require("@aigne/open-router");
17
18
  const openai_1 = require("@aigne/openai");
18
19
  const index_js_1 = require("@aigne/platform-helpers/nodejs/index.js");
20
+ const poe_1 = require("@aigne/poe");
19
21
  const xai_1 = require("@aigne/xai");
20
22
  const node_http_handler_1 = require("@smithy/node-http-handler");
21
23
  const chalk_1 = __importDefault(require("chalk"));
@@ -82,6 +84,16 @@ function availableModels() {
82
84
  apiKeyEnvName: "XAI_API_KEY",
83
85
  create: (params) => new xai_1.XAIChatModel({ ...params, clientOptions }),
84
86
  },
87
+ {
88
+ name: doubao_1.DoubaoChatModel.name,
89
+ apiKeyEnvName: "DOUBAO_API_KEY",
90
+ create: (params) => new doubao_1.DoubaoChatModel({ ...params, clientOptions }),
91
+ },
92
+ {
93
+ name: poe_1.PoeChatModel.name,
94
+ apiKeyEnvName: "POE_API_KEY",
95
+ create: (params) => new poe_1.PoeChatModel({ ...params, clientOptions }),
96
+ },
85
97
  {
86
98
  name: cli_aigne_hub_model_js_1.AIGNEHubChatModel.name,
87
99
  apiKeyEnvName: "AIGNE_HUB_API_KEY",
@@ -14,7 +14,7 @@ export declare class AIGNEHubChatModel extends ChatModel {
14
14
  baseURL?: string;
15
15
  url?: string;
16
16
  });
17
- get client(): ChatModel | undefined;
17
+ get client(): ChatModel;
18
18
  getCredential(): {
19
19
  url: string;
20
20
  apiKey: any;
@@ -16,7 +16,7 @@ export declare function connectToAIGNEHub(url: string): Promise<{
16
16
  }>;
17
17
  export declare const checkConnectionStatus: (host: string) => Promise<{
18
18
  apiKey: any;
19
- url: string;
19
+ url: any;
20
20
  }>;
21
21
  export declare function loadCredential(options?: LoadCredentialOptions): Promise<{
22
22
  apiKey?: string;
@@ -14,7 +14,7 @@ export declare class AIGNEHubChatModel extends ChatModel {
14
14
  baseURL?: string;
15
15
  url?: string;
16
16
  });
17
- get client(): ChatModel | undefined;
17
+ get client(): ChatModel;
18
18
  getCredential(): {
19
19
  url: string;
20
20
  apiKey: any;
@@ -35,7 +35,7 @@ export class AIGNEHubChatModel extends ChatModel {
35
35
  url,
36
36
  apiKey,
37
37
  };
38
- this._client ?? modelEntry.create(options);
38
+ this._client ??= modelEntry.create(options);
39
39
  return this._client;
40
40
  }
41
41
  getCredential() {
@@ -59,7 +59,9 @@ export class AIGNEHubChatModel extends ChatModel {
59
59
  throw new Error("Client not initialized");
60
60
  }
61
61
  options.fetchOptions = {
62
- headers: { "x-aigne-hub-client-did": process.env.BLOCKLET_APP_PID || "" },
62
+ headers: {
63
+ "x-aigne-hub-client-did": process.env.BLOCKLET_APP_PID || process.env.ABT_NODE_DID || "",
64
+ },
63
65
  ...options.fetchOptions,
64
66
  };
65
67
  return this.client.invoke(input, options);
@@ -45,8 +45,10 @@ export class AIGNEHubChatModel extends ChatModel {
45
45
  };
46
46
  }
47
47
  process(input, options) {
48
+ const { BLOCKLET_APP_PID, ABT_NODE_DID } = process.env;
49
+ const clientId = BLOCKLET_APP_PID || ABT_NODE_DID || `@aigne/aigne-hub:${nodejs.os.hostname()}`;
48
50
  options.fetchOptions = {
49
- headers: { "x-aigne-hub-client-did": `@aigne/aigne-hub:${nodejs.os.hostname()}` },
51
+ headers: { "x-aigne-hub-client-did": clientId },
50
52
  ...options.fetchOptions,
51
53
  };
52
54
  return this.client.__invoke(undefined, input, options);
@@ -16,7 +16,7 @@ export declare function connectToAIGNEHub(url: string): Promise<{
16
16
  }>;
17
17
  export declare const checkConnectionStatus: (host: string) => Promise<{
18
18
  apiKey: any;
19
- url: string;
19
+ url: any;
20
20
  }>;
21
21
  export declare function loadCredential(options?: LoadCredentialOptions): Promise<{
22
22
  apiKey?: string;
@@ -73,7 +73,7 @@ export async function getAIGNEHubMountPoint(url) {
73
73
  export async function connectToAIGNEHub(url) {
74
74
  const { origin, host } = new URL(url);
75
75
  const connectUrl = joinURL(origin, WELLKNOWN_SERVICE_PATH_PREFIX);
76
- const urlWithAIGNEHubMountPoint = await getAIGNEHubMountPoint(url);
76
+ const apiUrl = await getAIGNEHubMountPoint(url);
77
77
  try {
78
78
  const openFn = isTest ? () => { } : open;
79
79
  const result = await createConnect({
@@ -85,7 +85,7 @@ export async function connectToAIGNEHub(url) {
85
85
  });
86
86
  const accessKeyOptions = {
87
87
  apiKey: result.accessKeySecret,
88
- url: urlWithAIGNEHubMountPoint,
88
+ url: apiUrl,
89
89
  };
90
90
  // After redirection, write the AIGNE Hub access token
91
91
  const aigneDir = nodejs.path.join(nodejs.os.homedir(), ".aigne");
@@ -129,7 +129,7 @@ export const checkConnectionStatus = async (host) => {
129
129
  }
130
130
  return {
131
131
  apiKey: env.AIGNE_HUB_API_KEY,
132
- url: joinURL(env.AIGNE_HUB_API_URL),
132
+ url: env.AIGNE_HUB_API_URL,
133
133
  };
134
134
  };
135
135
  export async function loadCredential(options) {
@@ -205,6 +205,9 @@ export async function loadCredential(options) {
205
205
  }
206
206
  credential = await connectToAIGNEHub(aigneHubUrl);
207
207
  }
208
+ else {
209
+ throw error;
210
+ }
208
211
  }
209
212
  }
210
213
  return credential;
@@ -1,11 +1,13 @@
1
1
  import { AnthropicChatModel } from "@aigne/anthropic";
2
2
  import { BedrockChatModel } from "@aigne/bedrock";
3
3
  import { DeepSeekChatModel } from "@aigne/deepseek";
4
+ import { DoubaoChatModel } from "@aigne/doubao";
4
5
  import { GeminiChatModel } from "@aigne/gemini";
5
6
  import { OllamaChatModel } from "@aigne/ollama";
6
7
  import { OpenRouterChatModel } from "@aigne/open-router";
7
8
  import { OpenAIChatModel } from "@aigne/openai";
8
9
  import { nodejs } from "@aigne/platform-helpers/nodejs/index.js";
10
+ import { PoeChatModel } from "@aigne/poe";
9
11
  import { XAIChatModel } from "@aigne/xai";
10
12
  import { NodeHttpHandler, streamCollector } from "@smithy/node-http-handler";
11
13
  import chalk from "chalk";
@@ -72,6 +74,16 @@ export function availableModels() {
72
74
  apiKeyEnvName: "XAI_API_KEY",
73
75
  create: (params) => new XAIChatModel({ ...params, clientOptions }),
74
76
  },
77
+ {
78
+ name: DoubaoChatModel.name,
79
+ apiKeyEnvName: "DOUBAO_API_KEY",
80
+ create: (params) => new DoubaoChatModel({ ...params, clientOptions }),
81
+ },
82
+ {
83
+ name: PoeChatModel.name,
84
+ apiKeyEnvName: "POE_API_KEY",
85
+ create: (params) => new PoeChatModel({ ...params, clientOptions }),
86
+ },
75
87
  {
76
88
  name: AIGNEHubChatModel.name,
77
89
  apiKeyEnvName: "AIGNE_HUB_API_KEY",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/aigne-hub",
3
- "version": "0.5.2",
3
+ "version": "0.6.2",
4
4
  "description": "AIGNE Hub SDK for integrating with Hub AI models",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -52,17 +52,19 @@
52
52
  "yaml": "^2.8.0",
53
53
  "zod": "^3.25.67",
54
54
  "@aigne/anthropic": "^0.11.2",
55
- "@aigne/bedrock": "^0.9.2",
56
55
  "@aigne/core": "^1.50.0",
57
- "@aigne/default-memory": "^1.1.2",
58
56
  "@aigne/deepseek": "^0.7.20",
57
+ "@aigne/default-memory": "^1.1.2",
59
58
  "@aigne/gemini": "^0.9.2",
59
+ "@aigne/bedrock": "^0.9.2",
60
+ "@aigne/doubao": "^1.0.14",
60
61
  "@aigne/ollama": "^0.7.20",
61
- "@aigne/open-router": "^0.7.20",
62
62
  "@aigne/openai": "^0.11.2",
63
+ "@aigne/open-router": "^0.7.20",
63
64
  "@aigne/platform-helpers": "^0.6.2",
64
- "@aigne/transport": "^0.14.0",
65
- "@aigne/xai": "^0.7.20"
65
+ "@aigne/poe": "^1.0.0",
66
+ "@aigne/xai": "^0.7.20",
67
+ "@aigne/transport": "^0.14.0"
66
68
  },
67
69
  "devDependencies": {
68
70
  "@types/bun": "^1.2.18",
@@ -71,8 +73,8 @@
71
73
  "npm-run-all": "^4.1.5",
72
74
  "rimraf": "^6.0.1",
73
75
  "typescript": "^5.8.3",
74
- "@aigne/openai": "^0.11.2",
75
- "@aigne/test-utils": "^0.5.28"
76
+ "@aigne/test-utils": "^0.5.28",
77
+ "@aigne/openai": "^0.11.2"
76
78
  },
77
79
  "scripts": {
78
80
  "lint": "tsc --noEmit",