@aigne/core 1.72.0-beta.17 → 1.72.0-beta.19

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,42 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.72.0-beta.19](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.72.0-beta.18...core-v1.72.0-beta.19) (2026-01-14)
4
+
5
+
6
+ ### Features
7
+
8
+ * **afs:** add module access control and schema validation support ([#904](https://github.com/AIGNE-io/aigne-framework/issues/904)) ([d0b279a](https://github.com/AIGNE-io/aigne-framework/commit/d0b279aac07ebe2bcc1fd4148498fc3f6bbcd561))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * improve test coverage tracking and reporting ([#903](https://github.com/AIGNE-io/aigne-framework/issues/903)) ([031144e](https://github.com/AIGNE-io/aigne-framework/commit/031144e74f29e882cffe52ffda8f7a18c76ace7f))
14
+
15
+
16
+ ### Dependencies
17
+
18
+ * The following workspace dependencies were updated
19
+ * dependencies
20
+ * @aigne/afs bumped to 1.4.0-beta.9
21
+ * @aigne/afs-history bumped to 1.2.0-beta.10
22
+ * @aigne/observability-api bumped to 0.11.14-beta.4
23
+ * @aigne/platform-helpers bumped to 0.6.7-beta.2
24
+
25
+ ## [1.72.0-beta.18](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.72.0-beta.17...core-v1.72.0-beta.18) (2026-01-13)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * bump deps to latest and fix build error ([#897](https://github.com/AIGNE-io/aigne-framework/issues/897)) ([4059e79](https://github.com/AIGNE-io/aigne-framework/commit/4059e790ae63b9e4ebd66487665014b0cd7ce6ec))
31
+ * **core:** make async memory updates non-blocking ([#900](https://github.com/AIGNE-io/aigne-framework/issues/900)) ([314f2c3](https://github.com/AIGNE-io/aigne-framework/commit/314f2c35d8baa88b600cc4de3f5983fef03a804c))
32
+
33
+
34
+ ### Dependencies
35
+
36
+ * The following workspace dependencies were updated
37
+ * dependencies
38
+ * @aigne/observability-api bumped to 0.11.14-beta.3
39
+
3
40
  ## [1.72.0-beta.17](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.72.0-beta.16...core-v1.72.0-beta.17) (2026-01-12)
4
41
 
5
42
 
@@ -41,6 +41,7 @@ const afs_history_1 = require("@aigne/afs-history");
41
41
  const uuid_1 = require("@aigne/uuid");
42
42
  const ufo_1 = require("ufo");
43
43
  const yaml_1 = require("yaml");
44
+ const logger_js_1 = require("../utils/logger.js");
44
45
  const token_estimator_js_1 = require("../utils/token-estimator.js");
45
46
  const type_utils_js_1 = require("../utils/type-utils.js");
46
47
  const types_js_1 = require("./compact/types.js");
@@ -724,53 +725,46 @@ ${"```"}
724
725
  */
725
726
  async updateSessionMemory(options) {
726
727
  await this.ensureInitialized();
727
- // If session memory update is already in progress, wait for it to complete
728
- if (this.sessionMemoryUpdatePromise) {
729
- return this.sessionMemoryUpdatePromise;
730
- }
731
- // Start new session memory update task
732
- this.sessionMemoryUpdatePromise = this.doUpdateSessionMemory(options).finally(() => {
728
+ this.sessionMemoryUpdatePromise ??= this.doUpdateSessionMemory(options)
729
+ .then(() => {
730
+ // After session memory update succeeds, potentially trigger user memory consolidation
731
+ this.maybeAutoUpdateUserMemory(options).catch((err) => {
732
+ logger_js_1.logger.error("User memory update failed:", err);
733
+ });
734
+ })
735
+ .finally(() => {
733
736
  this.sessionMemoryUpdatePromise = undefined;
734
- // After session memory update completes, potentially trigger user memory consolidation
735
- this.maybeAutoUpdateUserMemory(options);
736
737
  });
737
738
  return this.sessionMemoryUpdatePromise;
738
739
  }
739
740
  async maybeAutoUpdateSessionMemory(options) {
740
- if (this.sessionMemoryUpdatePromise)
741
- await this.sessionMemoryUpdatePromise;
742
741
  // Check if memory extraction is enabled (requires AFS history module)
743
742
  if (!this.isMemoryEnabled)
744
743
  return;
745
- if (!this.sessionMemoryConfig)
746
- return;
747
744
  // Check if mode is disabled
748
745
  const mode = this.sessionMemoryConfig.mode ?? types_js_1.DEFAULT_SESSION_MEMORY_MODE;
749
746
  if (mode === "disabled")
750
747
  return;
751
748
  // Trigger session memory update
752
- this.updateSessionMemory(options);
749
+ this.updateSessionMemory(options).catch((err) => {
750
+ logger_js_1.logger.error("Session memory update failed:", err);
751
+ });
753
752
  const isAsync = this.sessionMemoryConfig.async ?? types_js_1.DEFAULT_SESSION_MEMORY_ASYNC;
754
753
  if (!isAsync)
755
754
  await this.sessionMemoryUpdatePromise;
756
755
  }
757
756
  async maybeAutoUpdateUserMemory(options) {
758
- if (this.userMemoryUpdatePromise)
759
- await this.userMemoryUpdatePromise;
760
757
  // Check if memory extraction is enabled (requires AFS history module)
761
- if (!this.isMemoryEnabled)
762
- return;
763
- if (!this.userMemoryConfig || !this.userId)
758
+ if (!this.isMemoryEnabled || !this.userId)
764
759
  return;
765
760
  // Check if mode is disabled
766
761
  const mode = this.userMemoryConfig.mode ?? types_js_1.DEFAULT_USER_MEMORY_MODE;
767
762
  if (mode === "disabled")
768
763
  return;
769
- // Wait for session memory update to complete first
770
- if (this.sessionMemoryUpdatePromise)
771
- await this.sessionMemoryUpdatePromise;
772
764
  // Trigger user memory consolidation
773
- this.updateUserMemory(options);
765
+ this.updateUserMemory(options).catch((err) => {
766
+ logger_js_1.logger.error("User memory update failed:", err);
767
+ });
774
768
  const isAsync = this.userMemoryConfig.async ?? types_js_1.DEFAULT_USER_MEMORY_ASYNC;
775
769
  if (!isAsync)
776
770
  await this.userMemoryUpdatePromise;
@@ -865,12 +859,8 @@ ${"```"}
865
859
  */
866
860
  async updateUserMemory(options) {
867
861
  await this.ensureInitialized();
868
- // If user memory update is already in progress, wait for it to complete
869
- if (this.userMemoryUpdatePromise) {
870
- return this.userMemoryUpdatePromise;
871
- }
872
862
  // Start new user memory update task
873
- this.userMemoryUpdatePromise = this.doUpdateUserMemory(options).finally(() => {
863
+ this.userMemoryUpdatePromise ??= this.doUpdateUserMemory(options).finally(() => {
874
864
  this.userMemoryUpdatePromise = undefined;
875
865
  });
876
866
  return this.userMemoryUpdatePromise;
@@ -41,6 +41,7 @@ class AISessionCompactor extends ai_agent_js_1.AIAgent {
41
41
  summary: zod_1.z.string().describe("A comprehensive summary of the conversation history"),
42
42
  }),
43
43
  instructions: COMPACTOR_INSTRUCTIONS,
44
+ taskRenderMode: "hide",
44
45
  ...(0, type_utils_js_1.omitBy)(options ?? {}, (v) => (0, type_utils_js_1.isNil)(v)),
45
46
  session: {
46
47
  mode: "disabled",
@@ -132,6 +132,7 @@ class AISessionMemoryExtractor extends ai_agent_js_1.AIAgent {
132
132
  removeFacts: (0, zod_1.optional)(zod_1.z.array(zod_1.z.string()).describe("Labels of facts to remove from memory")),
133
133
  }),
134
134
  instructions: EXTRACTOR_INSTRUCTIONS,
135
+ taskRenderMode: "hide",
135
136
  ...(0, type_utils_js_1.omitBy)(options ?? {}, (v) => (0, type_utils_js_1.isNil)(v)),
136
137
  session: {
137
138
  mode: "disabled",
@@ -113,6 +113,7 @@ class AIUserMemoryExtractor extends ai_agent_js_1.AIAgent {
113
113
  removeFacts: (0, zod_1.optional)(zod_1.z.array(zod_1.z.string()).describe("Labels of facts to remove from user memory")),
114
114
  }),
115
115
  instructions: EXTRACTOR_INSTRUCTIONS,
116
+ taskRenderMode: "hide",
116
117
  ...(0, type_utils_js_1.omitBy)(options ?? {}, (v) => (0, type_utils_js_1.isNil)(v)),
117
118
  session: {
118
119
  mode: "disabled",
@@ -40,10 +40,10 @@ class PromptBuilder {
40
40
  content = i.content.text;
41
41
  else if (i.content.type === "resource") {
42
42
  const { resource } = i.content;
43
- if (typeof resource.text === "string") {
43
+ if ("text" in resource && typeof resource.text === "string") {
44
44
  content = resource.text;
45
45
  }
46
- else if (typeof resource.blob === "string") {
46
+ else if ("blob" in resource && typeof resource.blob === "string") {
47
47
  content = [{ type: "url", url: resource.blob }];
48
48
  }
49
49
  }
@@ -8,6 +8,7 @@ export interface Skill {
8
8
  }
9
9
  export declare function loadSkill(path: string): Promise<Skill>;
10
10
  export declare function loadSkills(paths: string[]): Promise<Skill[]>;
11
+ export declare function discoverSkillsFromAFS(afs: AFS): Promise<Skill[]>;
11
12
  export declare function loadAgentSkillFromAFS({ afs, }: {
12
13
  afs: AFS;
13
14
  }): Promise<AgentSkill | undefined>;
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.loadSkill = loadSkill;
7
7
  exports.loadSkills = loadSkills;
8
+ exports.discoverSkillsFromAFS = discoverSkillsFromAFS;
8
9
  exports.loadAgentSkillFromAFS = loadAgentSkillFromAFS;
9
10
  const index_js_1 = require("@aigne/platform-helpers/nodejs/index.js");
10
11
  const front_matter_1 = __importDefault(require("front-matter"));
@@ -31,15 +32,11 @@ async function loadSkills(paths) {
31
32
  }
32
33
  return skills;
33
34
  }
34
- async function loadAgentSkillFromAFS({ afs, }) {
35
+ async function discoverSkillsFromAFS(afs) {
35
36
  const modules = await afs.listModules();
36
- const filtered = modules.filter(({ module: m }) => "options" in m &&
37
- typeof m.options === "object" &&
38
- m.options &&
39
- "agentSkills" in m.options &&
40
- m.options.agentSkills === true);
37
+ const filtered = modules.filter(({ module: m }) => m.agentSkills === true);
41
38
  if (!filtered.length)
42
- return;
39
+ return [];
43
40
  const skills = [];
44
41
  for (const module of filtered) {
45
42
  const data = (await afs
@@ -56,6 +53,10 @@ async function loadAgentSkillFromAFS({ afs, }) {
56
53
  skills.push(skill);
57
54
  }
58
55
  }
56
+ return skills;
57
+ }
58
+ async function loadAgentSkillFromAFS({ afs, }) {
59
+ const skills = await discoverSkillsFromAFS(afs);
59
60
  if (!skills.length)
60
61
  return;
61
62
  return new agent_skill_js_1.AgentSkill({
@@ -48,5 +48,5 @@ function resourceFromMCPResource(resource, options) {
48
48
  });
49
49
  }
50
50
  function isResourceTemplate(resource) {
51
- return typeof resource.uriTemplate === "string";
51
+ return "uriTemplate" in resource && typeof resource.uriTemplate === "string";
52
52
  }
@@ -8,6 +8,7 @@ export interface Skill {
8
8
  }
9
9
  export declare function loadSkill(path: string): Promise<Skill>;
10
10
  export declare function loadSkills(paths: string[]): Promise<Skill[]>;
11
+ export declare function discoverSkillsFromAFS(afs: AFS): Promise<Skill[]>;
11
12
  export declare function loadAgentSkillFromAFS({ afs, }: {
12
13
  afs: AFS;
13
14
  }): Promise<AgentSkill | undefined>;
@@ -2,6 +2,7 @@ import { AFSHistory } from "@aigne/afs-history";
2
2
  import { v7 } from "@aigne/uuid";
3
3
  import { joinURL } from "ufo";
4
4
  import { stringify } from "yaml";
5
+ import { logger } from "../utils/logger.js";
5
6
  import { estimateTokens } from "../utils/token-estimator.js";
6
7
  import { isNonNullable } from "../utils/type-utils.js";
7
8
  import { DEFAULT_COMPACT_ASYNC, DEFAULT_COMPACT_MODE, DEFAULT_KEEP_RECENT_RATIO, DEFAULT_MAX_TOKENS, DEFAULT_MEMORY_QUERY_LIMIT, DEFAULT_MEMORY_RATIO, DEFAULT_SESSION_MEMORY_ASYNC, DEFAULT_SESSION_MEMORY_MODE, DEFAULT_SESSION_MODE, DEFAULT_USER_MEMORY_ASYNC, DEFAULT_USER_MEMORY_MODE, } from "./compact/types.js";
@@ -685,53 +686,46 @@ ${"```"}
685
686
  */
686
687
  async updateSessionMemory(options) {
687
688
  await this.ensureInitialized();
688
- // If session memory update is already in progress, wait for it to complete
689
- if (this.sessionMemoryUpdatePromise) {
690
- return this.sessionMemoryUpdatePromise;
691
- }
692
- // Start new session memory update task
693
- this.sessionMemoryUpdatePromise = this.doUpdateSessionMemory(options).finally(() => {
689
+ this.sessionMemoryUpdatePromise ??= this.doUpdateSessionMemory(options)
690
+ .then(() => {
691
+ // After session memory update succeeds, potentially trigger user memory consolidation
692
+ this.maybeAutoUpdateUserMemory(options).catch((err) => {
693
+ logger.error("User memory update failed:", err);
694
+ });
695
+ })
696
+ .finally(() => {
694
697
  this.sessionMemoryUpdatePromise = undefined;
695
- // After session memory update completes, potentially trigger user memory consolidation
696
- this.maybeAutoUpdateUserMemory(options);
697
698
  });
698
699
  return this.sessionMemoryUpdatePromise;
699
700
  }
700
701
  async maybeAutoUpdateSessionMemory(options) {
701
- if (this.sessionMemoryUpdatePromise)
702
- await this.sessionMemoryUpdatePromise;
703
702
  // Check if memory extraction is enabled (requires AFS history module)
704
703
  if (!this.isMemoryEnabled)
705
704
  return;
706
- if (!this.sessionMemoryConfig)
707
- return;
708
705
  // Check if mode is disabled
709
706
  const mode = this.sessionMemoryConfig.mode ?? DEFAULT_SESSION_MEMORY_MODE;
710
707
  if (mode === "disabled")
711
708
  return;
712
709
  // Trigger session memory update
713
- this.updateSessionMemory(options);
710
+ this.updateSessionMemory(options).catch((err) => {
711
+ logger.error("Session memory update failed:", err);
712
+ });
714
713
  const isAsync = this.sessionMemoryConfig.async ?? DEFAULT_SESSION_MEMORY_ASYNC;
715
714
  if (!isAsync)
716
715
  await this.sessionMemoryUpdatePromise;
717
716
  }
718
717
  async maybeAutoUpdateUserMemory(options) {
719
- if (this.userMemoryUpdatePromise)
720
- await this.userMemoryUpdatePromise;
721
718
  // Check if memory extraction is enabled (requires AFS history module)
722
- if (!this.isMemoryEnabled)
723
- return;
724
- if (!this.userMemoryConfig || !this.userId)
719
+ if (!this.isMemoryEnabled || !this.userId)
725
720
  return;
726
721
  // Check if mode is disabled
727
722
  const mode = this.userMemoryConfig.mode ?? DEFAULT_USER_MEMORY_MODE;
728
723
  if (mode === "disabled")
729
724
  return;
730
- // Wait for session memory update to complete first
731
- if (this.sessionMemoryUpdatePromise)
732
- await this.sessionMemoryUpdatePromise;
733
725
  // Trigger user memory consolidation
734
- this.updateUserMemory(options);
726
+ this.updateUserMemory(options).catch((err) => {
727
+ logger.error("User memory update failed:", err);
728
+ });
735
729
  const isAsync = this.userMemoryConfig.async ?? DEFAULT_USER_MEMORY_ASYNC;
736
730
  if (!isAsync)
737
731
  await this.userMemoryUpdatePromise;
@@ -826,12 +820,8 @@ ${"```"}
826
820
  */
827
821
  async updateUserMemory(options) {
828
822
  await this.ensureInitialized();
829
- // If user memory update is already in progress, wait for it to complete
830
- if (this.userMemoryUpdatePromise) {
831
- return this.userMemoryUpdatePromise;
832
- }
833
823
  // Start new user memory update task
834
- this.userMemoryUpdatePromise = this.doUpdateUserMemory(options).finally(() => {
824
+ this.userMemoryUpdatePromise ??= this.doUpdateUserMemory(options).finally(() => {
835
825
  this.userMemoryUpdatePromise = undefined;
836
826
  });
837
827
  return this.userMemoryUpdatePromise;
@@ -38,6 +38,7 @@ export class AISessionCompactor extends AIAgent {
38
38
  summary: z.string().describe("A comprehensive summary of the conversation history"),
39
39
  }),
40
40
  instructions: COMPACTOR_INSTRUCTIONS,
41
+ taskRenderMode: "hide",
41
42
  ...omitBy(options ?? {}, (v) => isNil(v)),
42
43
  session: {
43
44
  mode: "disabled",
@@ -129,6 +129,7 @@ export class AISessionMemoryExtractor extends AIAgent {
129
129
  removeFacts: optional(z.array(z.string()).describe("Labels of facts to remove from memory")),
130
130
  }),
131
131
  instructions: EXTRACTOR_INSTRUCTIONS,
132
+ taskRenderMode: "hide",
132
133
  ...omitBy(options ?? {}, (v) => isNil(v)),
133
134
  session: {
134
135
  mode: "disabled",
@@ -110,6 +110,7 @@ export class AIUserMemoryExtractor extends AIAgent {
110
110
  removeFacts: optional(z.array(z.string()).describe("Labels of facts to remove from user memory")),
111
111
  }),
112
112
  instructions: EXTRACTOR_INSTRUCTIONS,
113
+ taskRenderMode: "hide",
113
114
  ...omitBy(options ?? {}, (v) => isNil(v)),
114
115
  session: {
115
116
  mode: "disabled",
@@ -37,10 +37,10 @@ export class PromptBuilder {
37
37
  content = i.content.text;
38
38
  else if (i.content.type === "resource") {
39
39
  const { resource } = i.content;
40
- if (typeof resource.text === "string") {
40
+ if ("text" in resource && typeof resource.text === "string") {
41
41
  content = resource.text;
42
42
  }
43
- else if (typeof resource.blob === "string") {
43
+ else if ("blob" in resource && typeof resource.blob === "string") {
44
44
  content = [{ type: "url", url: resource.blob }];
45
45
  }
46
46
  }
@@ -8,6 +8,7 @@ export interface Skill {
8
8
  }
9
9
  export declare function loadSkill(path: string): Promise<Skill>;
10
10
  export declare function loadSkills(paths: string[]): Promise<Skill[]>;
11
+ export declare function discoverSkillsFromAFS(afs: AFS): Promise<Skill[]>;
11
12
  export declare function loadAgentSkillFromAFS({ afs, }: {
12
13
  afs: AFS;
13
14
  }): Promise<AgentSkill | undefined>;
@@ -23,15 +23,11 @@ export async function loadSkills(paths) {
23
23
  }
24
24
  return skills;
25
25
  }
26
- export async function loadAgentSkillFromAFS({ afs, }) {
26
+ export async function discoverSkillsFromAFS(afs) {
27
27
  const modules = await afs.listModules();
28
- const filtered = modules.filter(({ module: m }) => "options" in m &&
29
- typeof m.options === "object" &&
30
- m.options &&
31
- "agentSkills" in m.options &&
32
- m.options.agentSkills === true);
28
+ const filtered = modules.filter(({ module: m }) => m.agentSkills === true);
33
29
  if (!filtered.length)
34
- return;
30
+ return [];
35
31
  const skills = [];
36
32
  for (const module of filtered) {
37
33
  const data = (await afs
@@ -48,6 +44,10 @@ export async function loadAgentSkillFromAFS({ afs, }) {
48
44
  skills.push(skill);
49
45
  }
50
46
  }
47
+ return skills;
48
+ }
49
+ export async function loadAgentSkillFromAFS({ afs, }) {
50
+ const skills = await discoverSkillsFromAFS(afs);
51
51
  if (!skills.length)
52
52
  return;
53
53
  return new AgentSkill({
@@ -43,5 +43,5 @@ export function resourceFromMCPResource(resource, options) {
43
43
  });
44
44
  }
45
45
  function isResourceTemplate(resource) {
46
- return typeof resource.uriTemplate === "string";
46
+ return "uriTemplate" in resource && typeof resource.uriTemplate === "string";
47
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/core",
3
- "version": "1.72.0-beta.17",
3
+ "version": "1.72.0-beta.19",
4
4
  "description": "The functional core of agentic AI",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -93,10 +93,10 @@
93
93
  "zod": "^3.25.67",
94
94
  "zod-from-json-schema": "^0.0.5",
95
95
  "zod-to-json-schema": "^3.24.6",
96
- "@aigne/afs": "^1.4.0-beta.8",
97
- "@aigne/afs-history": "^1.2.0-beta.9",
98
- "@aigne/platform-helpers": "^0.6.7-beta.1",
99
- "@aigne/observability-api": "^0.11.14-beta.2"
96
+ "@aigne/afs": "^1.4.0-beta.9",
97
+ "@aigne/afs-history": "^1.2.0-beta.10",
98
+ "@aigne/platform-helpers": "^0.6.7-beta.2",
99
+ "@aigne/observability-api": "^0.11.14-beta.4"
100
100
  },
101
101
  "devDependencies": {
102
102
  "@types/bun": "^1.2.22",