@aigne/core 1.40.0 → 1.42.0

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
@@ -12,6 +12,29 @@
12
12
  * dependencies
13
13
  * @aigne/observability bumped to 0.1.0
14
14
 
15
+ ## [1.42.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.41.0...core-v1.42.0) (2025-08-01)
16
+
17
+
18
+ ### Features
19
+
20
+ * **cli:** add `--model` option for aigne applications ([#302](https://github.com/AIGNE-io/aigne-framework/issues/302)) ([5d63743](https://github.com/AIGNE-io/aigne-framework/commit/5d63743b8a47be64fd49245983f4f2f9da3197a0))
21
+ * support google model and skip check mode when connected to Hub ([#300](https://github.com/AIGNE-io/aigne-framework/issues/300)) ([e992c0f](https://github.com/AIGNE-io/aigne-framework/commit/e992c0f3335a7c512fa807d5b8ad10c9c3bf2351))
22
+
23
+
24
+ ### Dependencies
25
+
26
+ * The following workspace dependencies were updated
27
+ * dependencies
28
+ * @aigne/observability-api bumped to 0.9.0
29
+ * @aigne/platform-helpers bumped to 0.5.0
30
+
31
+ ## [1.41.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.40.0...core-v1.41.0) (2025-07-31)
32
+
33
+
34
+ ### Features
35
+
36
+ * **cli:** add alias support for agent ([#297](https://github.com/AIGNE-io/aigne-framework/issues/297)) ([fa166ab](https://github.com/AIGNE-io/aigne-framework/commit/fa166ab66d19e89ddd32c34e1470450eb4fbdbbd))
37
+
15
38
  ## [1.40.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.39.0...core-v1.40.0) (2025-07-31)
16
39
 
17
40
 
@@ -61,6 +61,10 @@ export interface AgentOptions<I extends Message = Message, O extends Message = M
61
61
  * if not specified
62
62
  */
63
63
  name?: string;
64
+ /**
65
+ * Alias for the agent, can be used to refer to the agent by multiple names, especially in AIGNE CLI
66
+ */
67
+ alias?: string[];
64
68
  /**
65
69
  * Description of the agent
66
70
  *
@@ -232,6 +236,10 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
232
236
  * Defaults to the class constructor name if not specified in options
233
237
  */
234
238
  readonly name: string;
239
+ /**
240
+ * Alias for the agent, can be used to refer to the agent by multiple names, especially in AIGNE CLI
241
+ */
242
+ readonly alias?: string[];
235
243
  /**
236
244
  * Default topic this agent subscribes to
237
245
  *
@@ -102,6 +102,7 @@ class Agent {
102
102
  constructor(options = {}) {
103
103
  const { inputSchema, outputSchema } = options;
104
104
  this.name = options.name || this.constructor.name;
105
+ this.alias = options.alias;
105
106
  this.description = options.description;
106
107
  if (inputSchema)
107
108
  checkAgentInputOutputSchema(inputSchema);
@@ -170,6 +171,10 @@ class Agent {
170
171
  * Defaults to the class constructor name if not specified in options
171
172
  */
172
173
  name;
174
+ /**
175
+ * Alias for the agent, can be used to refer to the agent by multiple names, especially in AIGNE CLI
176
+ */
177
+ alias;
173
178
  /**
174
179
  * Default topic this agent subscribes to
175
180
  *
@@ -32,6 +32,7 @@ async function parseAgentFile(path, data) {
32
32
  }));
33
33
  const baseAgentSchema = zod_1.z.object({
34
34
  name: (0, schema_js_1.optionalize)(zod_1.z.string()),
35
+ alias: (0, schema_js_1.optionalize)(zod_1.z.array(zod_1.z.string())),
35
36
  description: (0, schema_js_1.optionalize)(zod_1.z.string()),
36
37
  inputSchema: (0, schema_js_1.optionalize)((0, schema_js_1.inputOutputSchema)({ path })).transform((v) => v ? (0, json_schema_to_zod_1.jsonSchemaToZod)(v) : undefined),
37
38
  defaultInput: (0, schema_js_1.optionalize)(schema_js_1.defaultInputSchema),
@@ -1,27 +1,12 @@
1
1
  import type { Camelize } from "camelize-ts";
2
2
  import { z } from "zod";
3
3
  import { Agent, type AgentOptions } from "../agents/agent.js";
4
- import type { ChatModel, ChatModelOptions } from "../agents/chat-model.js";
4
+ import type { ChatModel } from "../agents/chat-model.js";
5
5
  import type { AIGNEOptions } from "../aigne/aigne.js";
6
6
  import type { MemoryAgent, MemoryAgentOptions } from "../memory/memory.js";
7
- interface LoadableModelClass {
8
- new (parameters: {
9
- model?: string;
10
- modelOptions?: ChatModelOptions;
11
- }): ChatModel;
12
- }
13
- export interface LoadableModel {
14
- name: string;
15
- apiKeyEnvName?: string;
16
- create: (options: {
17
- model?: string;
18
- modelOptions?: ChatModelOptions;
19
- accessKey?: string;
20
- url?: string;
21
- }) => ChatModel;
22
- }
7
+ import { type PromiseOrValue } from "../utils/type-utils.js";
23
8
  export interface LoadOptions {
24
- models: (LoadableModel | LoadableModelClass)[];
9
+ loadModel: (model?: Camelize<z.infer<typeof aigneFileSchema>["model"]>) => PromiseOrValue<ChatModel | undefined>;
25
10
  memories?: {
26
11
  new (parameters?: MemoryAgentOptions): MemoryAgent;
27
12
  }[];
@@ -29,10 +14,6 @@ export interface LoadOptions {
29
14
  }
30
15
  export declare function load(options: LoadOptions): Promise<AIGNEOptions>;
31
16
  export declare function loadAgent(path: string, options?: LoadOptions, agentOptions?: AgentOptions): Promise<Agent>;
32
- export declare function loadModel(models: LoadableModel[], model?: Camelize<z.infer<typeof aigneFileSchema>["model"]>, modelOptions?: ChatModelOptions, accessKeyOptions?: {
33
- accessKey?: string;
34
- url?: string;
35
- }): Promise<ChatModel | undefined>;
36
17
  declare const aigneFileSchema: z.ZodObject<{
37
18
  name: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
38
19
  description: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.load = load;
4
4
  exports.loadAgent = loadAgent;
5
- exports.loadModel = loadModel;
6
5
  exports.loadAIGNEFile = loadAIGNEFile;
7
6
  const index_js_1 = require("@aigne/platform-helpers/nodejs/index.js");
8
7
  const yaml_1 = require("yaml");
@@ -26,12 +25,7 @@ async function load(options) {
26
25
  return {
27
26
  ...aigne,
28
27
  rootDir,
29
- model: await loadModel(options.models.map((i) => typeof i === "function"
30
- ? {
31
- name: i.name,
32
- create: (options) => new i(options),
33
- }
34
- : i), aigne.model),
28
+ model: await options.loadModel(aigne.model),
35
29
  agents: pickAgents(aigne.agents ?? []),
36
30
  skills: pickAgents(aigne.skills ?? []),
37
31
  mcpServer: {
@@ -158,27 +152,6 @@ async function loadMemory(memories, provider, options) {
158
152
  throw new Error(`Unsupported memory: ${provider}`);
159
153
  return new M(options);
160
154
  }
161
- const { MODEL_PROVIDER, MODEL_NAME } = index_js_1.nodejs.env;
162
- const DEFAULT_MODEL_PROVIDER = "openai";
163
- async function loadModel(models, model, modelOptions, accessKeyOptions) {
164
- const params = {
165
- model: MODEL_NAME ?? model?.name ?? undefined,
166
- temperature: model?.temperature ?? undefined,
167
- topP: model?.topP ?? undefined,
168
- frequencyPenalty: model?.frequencyPenalty ?? undefined,
169
- presencePenalty: model?.presencePenalty ?? undefined,
170
- };
171
- const providerName = MODEL_PROVIDER ?? model?.provider ?? DEFAULT_MODEL_PROVIDER;
172
- const provider = providerName.replace(/-/g, "");
173
- const m = models.find((m) => m.name.toLowerCase().includes(provider.toLowerCase()));
174
- if (!m)
175
- throw new Error(`Unsupported model: ${model?.provider} ${model?.name}`);
176
- return m.create({
177
- ...(accessKeyOptions || {}),
178
- model: params.model,
179
- modelOptions: { ...params, ...modelOptions },
180
- });
181
- }
182
155
  const aigneFileSchema = (0, schema_js_1.camelizeSchema)(zod_1.z.object({
183
156
  name: (0, schema_js_1.optionalize)(zod_1.z.string()),
184
157
  description: (0, schema_js_1.optionalize)(zod_1.z.string()),
@@ -61,6 +61,10 @@ export interface AgentOptions<I extends Message = Message, O extends Message = M
61
61
  * if not specified
62
62
  */
63
63
  name?: string;
64
+ /**
65
+ * Alias for the agent, can be used to refer to the agent by multiple names, especially in AIGNE CLI
66
+ */
67
+ alias?: string[];
64
68
  /**
65
69
  * Description of the agent
66
70
  *
@@ -232,6 +236,10 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
232
236
  * Defaults to the class constructor name if not specified in options
233
237
  */
234
238
  readonly name: string;
239
+ /**
240
+ * Alias for the agent, can be used to refer to the agent by multiple names, especially in AIGNE CLI
241
+ */
242
+ readonly alias?: string[];
235
243
  /**
236
244
  * Default topic this agent subscribes to
237
245
  *
@@ -1,27 +1,12 @@
1
1
  import type { Camelize } from "camelize-ts";
2
2
  import { z } from "zod";
3
3
  import { Agent, type AgentOptions } from "../agents/agent.js";
4
- import type { ChatModel, ChatModelOptions } from "../agents/chat-model.js";
4
+ import type { ChatModel } from "../agents/chat-model.js";
5
5
  import type { AIGNEOptions } from "../aigne/aigne.js";
6
6
  import type { MemoryAgent, MemoryAgentOptions } from "../memory/memory.js";
7
- interface LoadableModelClass {
8
- new (parameters: {
9
- model?: string;
10
- modelOptions?: ChatModelOptions;
11
- }): ChatModel;
12
- }
13
- export interface LoadableModel {
14
- name: string;
15
- apiKeyEnvName?: string;
16
- create: (options: {
17
- model?: string;
18
- modelOptions?: ChatModelOptions;
19
- accessKey?: string;
20
- url?: string;
21
- }) => ChatModel;
22
- }
7
+ import { type PromiseOrValue } from "../utils/type-utils.js";
23
8
  export interface LoadOptions {
24
- models: (LoadableModel | LoadableModelClass)[];
9
+ loadModel: (model?: Camelize<z.infer<typeof aigneFileSchema>["model"]>) => PromiseOrValue<ChatModel | undefined>;
25
10
  memories?: {
26
11
  new (parameters?: MemoryAgentOptions): MemoryAgent;
27
12
  }[];
@@ -29,10 +14,6 @@ export interface LoadOptions {
29
14
  }
30
15
  export declare function load(options: LoadOptions): Promise<AIGNEOptions>;
31
16
  export declare function loadAgent(path: string, options?: LoadOptions, agentOptions?: AgentOptions): Promise<Agent>;
32
- export declare function loadModel(models: LoadableModel[], model?: Camelize<z.infer<typeof aigneFileSchema>["model"]>, modelOptions?: ChatModelOptions, accessKeyOptions?: {
33
- accessKey?: string;
34
- url?: string;
35
- }): Promise<ChatModel | undefined>;
36
17
  declare const aigneFileSchema: z.ZodObject<{
37
18
  name: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
38
19
  description: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
@@ -61,6 +61,10 @@ export interface AgentOptions<I extends Message = Message, O extends Message = M
61
61
  * if not specified
62
62
  */
63
63
  name?: string;
64
+ /**
65
+ * Alias for the agent, can be used to refer to the agent by multiple names, especially in AIGNE CLI
66
+ */
67
+ alias?: string[];
64
68
  /**
65
69
  * Description of the agent
66
70
  *
@@ -232,6 +236,10 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
232
236
  * Defaults to the class constructor name if not specified in options
233
237
  */
234
238
  readonly name: string;
239
+ /**
240
+ * Alias for the agent, can be used to refer to the agent by multiple names, especially in AIGNE CLI
241
+ */
242
+ readonly alias?: string[];
235
243
  /**
236
244
  * Default topic this agent subscribes to
237
245
  *
@@ -57,6 +57,7 @@ export class Agent {
57
57
  constructor(options = {}) {
58
58
  const { inputSchema, outputSchema } = options;
59
59
  this.name = options.name || this.constructor.name;
60
+ this.alias = options.alias;
60
61
  this.description = options.description;
61
62
  if (inputSchema)
62
63
  checkAgentInputOutputSchema(inputSchema);
@@ -125,6 +126,10 @@ export class Agent {
125
126
  * Defaults to the class constructor name if not specified in options
126
127
  */
127
128
  name;
129
+ /**
130
+ * Alias for the agent, can be used to refer to the agent by multiple names, especially in AIGNE CLI
131
+ */
132
+ alias;
128
133
  /**
129
134
  * Default topic this agent subscribes to
130
135
  *
@@ -28,6 +28,7 @@ export async function parseAgentFile(path, data) {
28
28
  }));
29
29
  const baseAgentSchema = z.object({
30
30
  name: optionalize(z.string()),
31
+ alias: optionalize(z.array(z.string())),
31
32
  description: optionalize(z.string()),
32
33
  inputSchema: optionalize(inputOutputSchema({ path })).transform((v) => v ? jsonSchemaToZod(v) : undefined),
33
34
  defaultInput: optionalize(defaultInputSchema),
@@ -1,27 +1,12 @@
1
1
  import type { Camelize } from "camelize-ts";
2
2
  import { z } from "zod";
3
3
  import { Agent, type AgentOptions } from "../agents/agent.js";
4
- import type { ChatModel, ChatModelOptions } from "../agents/chat-model.js";
4
+ import type { ChatModel } from "../agents/chat-model.js";
5
5
  import type { AIGNEOptions } from "../aigne/aigne.js";
6
6
  import type { MemoryAgent, MemoryAgentOptions } from "../memory/memory.js";
7
- interface LoadableModelClass {
8
- new (parameters: {
9
- model?: string;
10
- modelOptions?: ChatModelOptions;
11
- }): ChatModel;
12
- }
13
- export interface LoadableModel {
14
- name: string;
15
- apiKeyEnvName?: string;
16
- create: (options: {
17
- model?: string;
18
- modelOptions?: ChatModelOptions;
19
- accessKey?: string;
20
- url?: string;
21
- }) => ChatModel;
22
- }
7
+ import { type PromiseOrValue } from "../utils/type-utils.js";
23
8
  export interface LoadOptions {
24
- models: (LoadableModel | LoadableModelClass)[];
9
+ loadModel: (model?: Camelize<z.infer<typeof aigneFileSchema>["model"]>) => PromiseOrValue<ChatModel | undefined>;
25
10
  memories?: {
26
11
  new (parameters?: MemoryAgentOptions): MemoryAgent;
27
12
  }[];
@@ -29,10 +14,6 @@ export interface LoadOptions {
29
14
  }
30
15
  export declare function load(options: LoadOptions): Promise<AIGNEOptions>;
31
16
  export declare function loadAgent(path: string, options?: LoadOptions, agentOptions?: AgentOptions): Promise<Agent>;
32
- export declare function loadModel(models: LoadableModel[], model?: Camelize<z.infer<typeof aigneFileSchema>["model"]>, modelOptions?: ChatModelOptions, accessKeyOptions?: {
33
- accessKey?: string;
34
- url?: string;
35
- }): Promise<ChatModel | undefined>;
36
17
  declare const aigneFileSchema: z.ZodObject<{
37
18
  name: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
38
19
  description: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
@@ -20,12 +20,7 @@ export async function load(options) {
20
20
  return {
21
21
  ...aigne,
22
22
  rootDir,
23
- model: await loadModel(options.models.map((i) => typeof i === "function"
24
- ? {
25
- name: i.name,
26
- create: (options) => new i(options),
27
- }
28
- : i), aigne.model),
23
+ model: await options.loadModel(aigne.model),
29
24
  agents: pickAgents(aigne.agents ?? []),
30
25
  skills: pickAgents(aigne.skills ?? []),
31
26
  mcpServer: {
@@ -152,27 +147,6 @@ async function loadMemory(memories, provider, options) {
152
147
  throw new Error(`Unsupported memory: ${provider}`);
153
148
  return new M(options);
154
149
  }
155
- const { MODEL_PROVIDER, MODEL_NAME } = nodejs.env;
156
- const DEFAULT_MODEL_PROVIDER = "openai";
157
- export async function loadModel(models, model, modelOptions, accessKeyOptions) {
158
- const params = {
159
- model: MODEL_NAME ?? model?.name ?? undefined,
160
- temperature: model?.temperature ?? undefined,
161
- topP: model?.topP ?? undefined,
162
- frequencyPenalty: model?.frequencyPenalty ?? undefined,
163
- presencePenalty: model?.presencePenalty ?? undefined,
164
- };
165
- const providerName = MODEL_PROVIDER ?? model?.provider ?? DEFAULT_MODEL_PROVIDER;
166
- const provider = providerName.replace(/-/g, "");
167
- const m = models.find((m) => m.name.toLowerCase().includes(provider.toLowerCase()));
168
- if (!m)
169
- throw new Error(`Unsupported model: ${model?.provider} ${model?.name}`);
170
- return m.create({
171
- ...(accessKeyOptions || {}),
172
- model: params.model,
173
- modelOptions: { ...params, ...modelOptions },
174
- });
175
- }
176
150
  const aigneFileSchema = camelizeSchema(z.object({
177
151
  name: optionalize(z.string()),
178
152
  description: optionalize(z.string()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/core",
3
- "version": "1.40.0",
3
+ "version": "1.42.0",
4
4
  "description": "AIGNE core library for building AI-powered applications",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -86,8 +86,8 @@
86
86
  "yaml": "^2.8.0",
87
87
  "zod": "^3.25.67",
88
88
  "zod-to-json-schema": "^3.24.6",
89
- "@aigne/observability-api": "^0.8.2",
90
- "@aigne/platform-helpers": "^0.4.0"
89
+ "@aigne/observability-api": "^0.9.0",
90
+ "@aigne/platform-helpers": "^0.5.0"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@types/bun": "^1.2.18",