@aigne/core 1.33.1 → 1.34.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,28 @@
12
12
  * dependencies
13
13
  * @aigne/observability bumped to 0.1.0
14
14
 
15
+ ## [1.34.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.33.2...core-v1.34.0) (2025-07-15)
16
+
17
+
18
+ ### Features
19
+
20
+ * **memory:** support did space memory adapter ([#229](https://github.com/AIGNE-io/aigne-framework/issues/229)) ([6f69b64](https://github.com/AIGNE-io/aigne-framework/commit/6f69b64e98b963db9d6ab5357306b445385eaa68))
21
+
22
+
23
+ ### Dependencies
24
+
25
+ * The following workspace dependencies were updated
26
+ * dependencies
27
+ * @aigne/observability-api bumped to 0.8.0
28
+ * @aigne/platform-helpers bumped to 0.4.0
29
+
30
+ ## [1.33.2](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.33.1...core-v1.33.2) (2025-07-14)
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * **core:** fix error of external schema with array type ([#251](https://github.com/AIGNE-io/aigne-framework/issues/251)) ([bd80921](https://github.com/AIGNE-io/aigne-framework/commit/bd80921bbbe8385645eb7c52fd719ce48d672da9))
36
+
15
37
  ## [1.33.1](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.33.0...core-v1.33.1) (2025-07-14)
16
38
 
17
39
 
@@ -6,6 +6,32 @@ const index_js_1 = require("@aigne/platform-helpers/nodejs/index.js");
6
6
  const yaml_1 = require("yaml");
7
7
  const zod_1 = require("zod");
8
8
  const inputOutputSchema = ({ path }) => {
9
+ const includeExternalSchema = async (schema) => {
10
+ if (schema?.type === "object" && schema.properties) {
11
+ return {
12
+ ...schema,
13
+ properties: Object.fromEntries(await Promise.all(Object.entries(schema.properties).map(async ([key, value]) => [
14
+ key,
15
+ await includeExternalSchema(value),
16
+ ]))),
17
+ };
18
+ }
19
+ if (schema?.type === "array" && schema.items) {
20
+ return { ...schema, items: await includeExternalSchema(schema.items) };
21
+ }
22
+ // Load nested schemas from file
23
+ if (typeof schema === "string") {
24
+ const raw = await index_js_1.nodejs.fs.readFile(index_js_1.nodejs.path.join(index_js_1.nodejs.path.dirname(path), schema), "utf8");
25
+ return nestedJsonSchema.parseAsync((0, yaml_1.parse)(raw));
26
+ }
27
+ return schema;
28
+ };
29
+ const nestedJsonSchema = zod_1.z
30
+ .object({
31
+ type: zod_1.z.string(),
32
+ })
33
+ .passthrough()
34
+ .transform((v) => includeExternalSchema(v));
9
35
  const jsonSchemaSchema = zod_1.z
10
36
  .object({
11
37
  type: zod_1.z.literal("object"),
@@ -13,29 +39,7 @@ const inputOutputSchema = ({ path }) => {
13
39
  required: zod_1.z.array(zod_1.z.string()).optional(),
14
40
  additionalProperties: zod_1.z.boolean().optional(),
15
41
  })
16
- .transform((v) => {
17
- const t = async (schema) => {
18
- if (schema?.type === "object" && schema.properties) {
19
- return {
20
- ...schema,
21
- properties: Object.fromEntries(await Promise.all(Object.entries(schema.properties).map(async ([key, value]) => [
22
- key,
23
- await t(value),
24
- ]))),
25
- };
26
- }
27
- if (schema?.type === "array" && schema.items) {
28
- return { ...schema, items: await t(schema.items) };
29
- }
30
- // Load nested schemas from file
31
- if (typeof schema === "string") {
32
- const raw = await index_js_1.nodejs.fs.readFile(index_js_1.nodejs.path.join(index_js_1.nodejs.path.dirname(path), schema), "utf8");
33
- return jsonSchemaSchema.parseAsync((0, yaml_1.parse)(raw));
34
- }
35
- return schema;
36
- };
37
- return t(v);
38
- });
42
+ .transform((v) => includeExternalSchema(v));
39
43
  return zod_1.z.union([
40
44
  zod_1.z
41
45
  .string()
@@ -1 +1,3 @@
1
- {"type": "commonjs"}
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -2,6 +2,32 @@ import { nodejs } from "@aigne/platform-helpers/nodejs/index.js";
2
2
  import { parse } from "yaml";
3
3
  import { z } from "zod";
4
4
  export const inputOutputSchema = ({ path }) => {
5
+ const includeExternalSchema = async (schema) => {
6
+ if (schema?.type === "object" && schema.properties) {
7
+ return {
8
+ ...schema,
9
+ properties: Object.fromEntries(await Promise.all(Object.entries(schema.properties).map(async ([key, value]) => [
10
+ key,
11
+ await includeExternalSchema(value),
12
+ ]))),
13
+ };
14
+ }
15
+ if (schema?.type === "array" && schema.items) {
16
+ return { ...schema, items: await includeExternalSchema(schema.items) };
17
+ }
18
+ // Load nested schemas from file
19
+ if (typeof schema === "string") {
20
+ const raw = await nodejs.fs.readFile(nodejs.path.join(nodejs.path.dirname(path), schema), "utf8");
21
+ return nestedJsonSchema.parseAsync(parse(raw));
22
+ }
23
+ return schema;
24
+ };
25
+ const nestedJsonSchema = z
26
+ .object({
27
+ type: z.string(),
28
+ })
29
+ .passthrough()
30
+ .transform((v) => includeExternalSchema(v));
5
31
  const jsonSchemaSchema = z
6
32
  .object({
7
33
  type: z.literal("object"),
@@ -9,29 +35,7 @@ export const inputOutputSchema = ({ path }) => {
9
35
  required: z.array(z.string()).optional(),
10
36
  additionalProperties: z.boolean().optional(),
11
37
  })
12
- .transform((v) => {
13
- const t = async (schema) => {
14
- if (schema?.type === "object" && schema.properties) {
15
- return {
16
- ...schema,
17
- properties: Object.fromEntries(await Promise.all(Object.entries(schema.properties).map(async ([key, value]) => [
18
- key,
19
- await t(value),
20
- ]))),
21
- };
22
- }
23
- if (schema?.type === "array" && schema.items) {
24
- return { ...schema, items: await t(schema.items) };
25
- }
26
- // Load nested schemas from file
27
- if (typeof schema === "string") {
28
- const raw = await nodejs.fs.readFile(nodejs.path.join(nodejs.path.dirname(path), schema), "utf8");
29
- return jsonSchemaSchema.parseAsync(parse(raw));
30
- }
31
- return schema;
32
- };
33
- return t(v);
34
- });
38
+ .transform((v) => includeExternalSchema(v));
35
39
  return z.union([
36
40
  z
37
41
  .string()
@@ -1 +1,3 @@
1
- {"type": "module"}
1
+ {
2
+ "type": "module"
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/core",
3
- "version": "1.33.1",
3
+ "version": "1.34.0",
4
4
  "description": "AIGNE core library for building AI-powered applications",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -83,8 +83,8 @@
83
83
  "yaml": "^2.8.0",
84
84
  "zod": "^3.25.67",
85
85
  "zod-to-json-schema": "^3.24.6",
86
- "@aigne/observability-api": "^0.7.2",
87
- "@aigne/platform-helpers": "^0.3.1"
86
+ "@aigne/platform-helpers": "^0.4.0",
87
+ "@aigne/observability-api": "^0.8.0"
88
88
  },
89
89
  "devDependencies": {
90
90
  "@types/bun": "^1.2.18",
@@ -107,6 +107,6 @@
107
107
  "clean": "rimraf lib test/coverage",
108
108
  "test": "bun --cwd test test",
109
109
  "test:coverage": "bun --cwd test test --coverage --coverage-reporter=lcov --coverage-reporter=text",
110
- "postbuild": "echo '{\"type\": \"module\"}' > lib/esm/package.json && echo '{\"type\": \"commonjs\"}' > lib/cjs/package.json"
110
+ "postbuild": "node ../../scripts/post-build-lib.mjs"
111
111
  }
112
112
  }