@aigne/core 1.65.0-beta.4 → 1.65.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
@@ -1,5 +1,34 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.65.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.65.0-beta.5...core-v1.65.0) (2025-10-31)
4
+
5
+
6
+ ### Dependencies
7
+
8
+ * The following workspace dependencies were updated
9
+ * dependencies
10
+ * @aigne/afs bumped to 1.1.1
11
+ * @aigne/observability-api bumped to 0.11.4
12
+
13
+ ## [1.65.0-beta.5](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.65.0-beta.4...core-v1.65.0-beta.5) (2025-10-31)
14
+
15
+
16
+ ### Features
17
+
18
+ * **core:** add json/yaml stringify filters for prompt template ([#685](https://github.com/AIGNE-io/aigne-framework/issues/685)) ([4e414bf](https://github.com/AIGNE-io/aigne-framework/commit/4e414bf5a43d0677fb16fcdceacaed501542ee85))
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **models:** add image parameters support for video generation ([#684](https://github.com/AIGNE-io/aigne-framework/issues/684)) ([b048b7f](https://github.com/AIGNE-io/aigne-framework/commit/b048b7f92bd7a532dbdbeb6fb5fa5499bae6b953))
24
+
25
+
26
+ ### Dependencies
27
+
28
+ * The following workspace dependencies were updated
29
+ * dependencies
30
+ * @aigne/observability-api bumped to 0.11.4-beta.2
31
+
3
32
  ## [1.65.0-beta.4](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.65.0-beta.3...core-v1.65.0-beta.4) (2025-10-29)
4
33
 
5
34
 
@@ -28,6 +28,7 @@ export interface VideoModelInput extends Message {
28
28
  seconds?: string;
29
29
  outputFileType?: FileType;
30
30
  modelOptions?: VideoModelInputOptions;
31
+ image?: FileUnionContent;
31
32
  }
32
33
  export interface VideoModelInputOptions extends Record<string, unknown> {
33
34
  model?: string;
@@ -39,10 +40,75 @@ export declare const videoModelInputSchema: z.ZodObject<{
39
40
  seconds: z.ZodOptional<z.ZodString>;
40
41
  outputFileType: z.ZodOptional<z.ZodEnum<["local", "file", "url"]>>;
41
42
  modelOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
43
+ image: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
44
+ filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
45
+ mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
46
+ } & {
47
+ type: z.ZodLiteral<"local">;
48
+ path: z.ZodString;
49
+ }, "strip", z.ZodTypeAny, {
50
+ path: string;
51
+ type: "local";
52
+ filename?: string | undefined;
53
+ mimeType?: string | undefined;
54
+ }, {
55
+ path: string;
56
+ type: "local";
57
+ filename?: string | undefined;
58
+ mimeType?: string | undefined;
59
+ }>, z.ZodObject<{
60
+ filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
61
+ mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
62
+ } & {
63
+ type: z.ZodLiteral<"url">;
64
+ url: z.ZodString;
65
+ }, "strip", z.ZodTypeAny, {
66
+ type: "url";
67
+ url: string;
68
+ filename?: string | undefined;
69
+ mimeType?: string | undefined;
70
+ }, {
71
+ type: "url";
72
+ url: string;
73
+ filename?: string | undefined;
74
+ mimeType?: string | undefined;
75
+ }>, z.ZodObject<{
76
+ filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
77
+ mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
78
+ } & {
79
+ type: z.ZodLiteral<"file">;
80
+ data: z.ZodString;
81
+ }, "strip", z.ZodTypeAny, {
82
+ type: "file";
83
+ data: string;
84
+ filename?: string | undefined;
85
+ mimeType?: string | undefined;
86
+ }, {
87
+ type: "file";
88
+ data: string;
89
+ filename?: string | undefined;
90
+ mimeType?: string | undefined;
91
+ }>]>>;
42
92
  }, "strip", z.ZodTypeAny, {
43
93
  prompt: string;
44
94
  model?: string | undefined;
45
95
  modelOptions?: Record<string, unknown> | undefined;
96
+ image?: {
97
+ type: "url";
98
+ url: string;
99
+ filename?: string | undefined;
100
+ mimeType?: string | undefined;
101
+ } | {
102
+ type: "file";
103
+ data: string;
104
+ filename?: string | undefined;
105
+ mimeType?: string | undefined;
106
+ } | {
107
+ path: string;
108
+ type: "local";
109
+ filename?: string | undefined;
110
+ mimeType?: string | undefined;
111
+ } | undefined;
46
112
  outputFileType?: "local" | "file" | "url" | undefined;
47
113
  size?: string | undefined;
48
114
  seconds?: string | undefined;
@@ -50,6 +116,22 @@ export declare const videoModelInputSchema: z.ZodObject<{
50
116
  prompt: string;
51
117
  model?: string | undefined;
52
118
  modelOptions?: Record<string, unknown> | undefined;
119
+ image?: {
120
+ type: "url";
121
+ url: string;
122
+ filename?: string | undefined;
123
+ mimeType?: string | undefined;
124
+ } | {
125
+ type: "file";
126
+ data: string;
127
+ filename?: string | undefined;
128
+ mimeType?: string | undefined;
129
+ } | {
130
+ path: string;
131
+ type: "local";
132
+ filename?: string | undefined;
133
+ mimeType?: string | undefined;
134
+ } | undefined;
53
135
  outputFileType?: "local" | "file" | "url" | undefined;
54
136
  size?: string | undefined;
55
137
  seconds?: string | undefined;
@@ -56,6 +56,7 @@ exports.videoModelInputSchema = zod_1.z.object({
56
56
  seconds: zod_1.z.string().optional().describe("Duration of the video in seconds"),
57
57
  outputFileType: model_js_1.fileTypeSchema.optional(),
58
58
  modelOptions: zod_1.z.record(zod_1.z.unknown()).optional(),
59
+ image: model_js_1.fileUnionContentSchema.optional(),
59
60
  });
60
61
  exports.videoModelOutputSchema = zod_1.z.object({
61
62
  videos: zod_1.z.array(model_js_1.fileUnionContentSchema),
@@ -0,0 +1,2 @@
1
+ import type { Environment } from "nunjucks";
2
+ export declare function setupFilters(env: Environment): void;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setupFilters = setupFilters;
4
+ const yaml_1 = require("yaml");
5
+ function setupFilters(env) {
6
+ env.addFilter("yaml.stringify", (obj) => {
7
+ return (0, yaml_1.stringify)(obj);
8
+ });
9
+ env.addFilter("json.stringify", (obj, ...args) => {
10
+ return JSON.stringify(obj, ...args);
11
+ });
12
+ }
@@ -10,6 +10,7 @@ const index_js_1 = require("@aigne/platform-helpers/nodejs/index.js");
10
10
  const nunjucks_1 = __importDefault(require("nunjucks"));
11
11
  const zod_1 = require("zod");
12
12
  const type_utils_js_1 = require("../utils/type-utils.js");
13
+ const index_js_2 = require("./filters/index.js");
13
14
  nunjucks_1.default.runtime.suppressValue = (v) => {
14
15
  if ((0, type_utils_js_1.isNil)(v))
15
16
  return "";
@@ -28,6 +29,7 @@ class PromptTemplate {
28
29
  if (options?.workingDir) {
29
30
  env = new nunjucks_1.default.Environment(new CustomLoader({ workingDir: options.workingDir }));
30
31
  }
32
+ (0, index_js_2.setupFilters)(env);
31
33
  return new Promise((resolve, reject) => env.renderString(this.template, variables, (err, res) => {
32
34
  if (err || !res) {
33
35
  reject(err || new Error(`Failed to render template: ${this.template}`));
@@ -28,6 +28,7 @@ export interface VideoModelInput extends Message {
28
28
  seconds?: string;
29
29
  outputFileType?: FileType;
30
30
  modelOptions?: VideoModelInputOptions;
31
+ image?: FileUnionContent;
31
32
  }
32
33
  export interface VideoModelInputOptions extends Record<string, unknown> {
33
34
  model?: string;
@@ -39,10 +40,75 @@ export declare const videoModelInputSchema: z.ZodObject<{
39
40
  seconds: z.ZodOptional<z.ZodString>;
40
41
  outputFileType: z.ZodOptional<z.ZodEnum<["local", "file", "url"]>>;
41
42
  modelOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
43
+ image: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
44
+ filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
45
+ mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
46
+ } & {
47
+ type: z.ZodLiteral<"local">;
48
+ path: z.ZodString;
49
+ }, "strip", z.ZodTypeAny, {
50
+ path: string;
51
+ type: "local";
52
+ filename?: string | undefined;
53
+ mimeType?: string | undefined;
54
+ }, {
55
+ path: string;
56
+ type: "local";
57
+ filename?: string | undefined;
58
+ mimeType?: string | undefined;
59
+ }>, z.ZodObject<{
60
+ filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
61
+ mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
62
+ } & {
63
+ type: z.ZodLiteral<"url">;
64
+ url: z.ZodString;
65
+ }, "strip", z.ZodTypeAny, {
66
+ type: "url";
67
+ url: string;
68
+ filename?: string | undefined;
69
+ mimeType?: string | undefined;
70
+ }, {
71
+ type: "url";
72
+ url: string;
73
+ filename?: string | undefined;
74
+ mimeType?: string | undefined;
75
+ }>, z.ZodObject<{
76
+ filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
77
+ mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
78
+ } & {
79
+ type: z.ZodLiteral<"file">;
80
+ data: z.ZodString;
81
+ }, "strip", z.ZodTypeAny, {
82
+ type: "file";
83
+ data: string;
84
+ filename?: string | undefined;
85
+ mimeType?: string | undefined;
86
+ }, {
87
+ type: "file";
88
+ data: string;
89
+ filename?: string | undefined;
90
+ mimeType?: string | undefined;
91
+ }>]>>;
42
92
  }, "strip", z.ZodTypeAny, {
43
93
  prompt: string;
44
94
  model?: string | undefined;
45
95
  modelOptions?: Record<string, unknown> | undefined;
96
+ image?: {
97
+ type: "url";
98
+ url: string;
99
+ filename?: string | undefined;
100
+ mimeType?: string | undefined;
101
+ } | {
102
+ type: "file";
103
+ data: string;
104
+ filename?: string | undefined;
105
+ mimeType?: string | undefined;
106
+ } | {
107
+ path: string;
108
+ type: "local";
109
+ filename?: string | undefined;
110
+ mimeType?: string | undefined;
111
+ } | undefined;
46
112
  outputFileType?: "local" | "file" | "url" | undefined;
47
113
  size?: string | undefined;
48
114
  seconds?: string | undefined;
@@ -50,6 +116,22 @@ export declare const videoModelInputSchema: z.ZodObject<{
50
116
  prompt: string;
51
117
  model?: string | undefined;
52
118
  modelOptions?: Record<string, unknown> | undefined;
119
+ image?: {
120
+ type: "url";
121
+ url: string;
122
+ filename?: string | undefined;
123
+ mimeType?: string | undefined;
124
+ } | {
125
+ type: "file";
126
+ data: string;
127
+ filename?: string | undefined;
128
+ mimeType?: string | undefined;
129
+ } | {
130
+ path: string;
131
+ type: "local";
132
+ filename?: string | undefined;
133
+ mimeType?: string | undefined;
134
+ } | undefined;
53
135
  outputFileType?: "local" | "file" | "url" | undefined;
54
136
  size?: string | undefined;
55
137
  seconds?: string | undefined;
@@ -0,0 +1,2 @@
1
+ import type { Environment } from "nunjucks";
2
+ export declare function setupFilters(env: Environment): void;
@@ -28,6 +28,7 @@ export interface VideoModelInput extends Message {
28
28
  seconds?: string;
29
29
  outputFileType?: FileType;
30
30
  modelOptions?: VideoModelInputOptions;
31
+ image?: FileUnionContent;
31
32
  }
32
33
  export interface VideoModelInputOptions extends Record<string, unknown> {
33
34
  model?: string;
@@ -39,10 +40,75 @@ export declare const videoModelInputSchema: z.ZodObject<{
39
40
  seconds: z.ZodOptional<z.ZodString>;
40
41
  outputFileType: z.ZodOptional<z.ZodEnum<["local", "file", "url"]>>;
41
42
  modelOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
43
+ image: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
44
+ filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
45
+ mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
46
+ } & {
47
+ type: z.ZodLiteral<"local">;
48
+ path: z.ZodString;
49
+ }, "strip", z.ZodTypeAny, {
50
+ path: string;
51
+ type: "local";
52
+ filename?: string | undefined;
53
+ mimeType?: string | undefined;
54
+ }, {
55
+ path: string;
56
+ type: "local";
57
+ filename?: string | undefined;
58
+ mimeType?: string | undefined;
59
+ }>, z.ZodObject<{
60
+ filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
61
+ mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
62
+ } & {
63
+ type: z.ZodLiteral<"url">;
64
+ url: z.ZodString;
65
+ }, "strip", z.ZodTypeAny, {
66
+ type: "url";
67
+ url: string;
68
+ filename?: string | undefined;
69
+ mimeType?: string | undefined;
70
+ }, {
71
+ type: "url";
72
+ url: string;
73
+ filename?: string | undefined;
74
+ mimeType?: string | undefined;
75
+ }>, z.ZodObject<{
76
+ filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
77
+ mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
78
+ } & {
79
+ type: z.ZodLiteral<"file">;
80
+ data: z.ZodString;
81
+ }, "strip", z.ZodTypeAny, {
82
+ type: "file";
83
+ data: string;
84
+ filename?: string | undefined;
85
+ mimeType?: string | undefined;
86
+ }, {
87
+ type: "file";
88
+ data: string;
89
+ filename?: string | undefined;
90
+ mimeType?: string | undefined;
91
+ }>]>>;
42
92
  }, "strip", z.ZodTypeAny, {
43
93
  prompt: string;
44
94
  model?: string | undefined;
45
95
  modelOptions?: Record<string, unknown> | undefined;
96
+ image?: {
97
+ type: "url";
98
+ url: string;
99
+ filename?: string | undefined;
100
+ mimeType?: string | undefined;
101
+ } | {
102
+ type: "file";
103
+ data: string;
104
+ filename?: string | undefined;
105
+ mimeType?: string | undefined;
106
+ } | {
107
+ path: string;
108
+ type: "local";
109
+ filename?: string | undefined;
110
+ mimeType?: string | undefined;
111
+ } | undefined;
46
112
  outputFileType?: "local" | "file" | "url" | undefined;
47
113
  size?: string | undefined;
48
114
  seconds?: string | undefined;
@@ -50,6 +116,22 @@ export declare const videoModelInputSchema: z.ZodObject<{
50
116
  prompt: string;
51
117
  model?: string | undefined;
52
118
  modelOptions?: Record<string, unknown> | undefined;
119
+ image?: {
120
+ type: "url";
121
+ url: string;
122
+ filename?: string | undefined;
123
+ mimeType?: string | undefined;
124
+ } | {
125
+ type: "file";
126
+ data: string;
127
+ filename?: string | undefined;
128
+ mimeType?: string | undefined;
129
+ } | {
130
+ path: string;
131
+ type: "local";
132
+ filename?: string | undefined;
133
+ mimeType?: string | undefined;
134
+ } | undefined;
53
135
  outputFileType?: "local" | "file" | "url" | undefined;
54
136
  size?: string | undefined;
55
137
  seconds?: string | undefined;
@@ -52,6 +52,7 @@ export const videoModelInputSchema = z.object({
52
52
  seconds: z.string().optional().describe("Duration of the video in seconds"),
53
53
  outputFileType: fileTypeSchema.optional(),
54
54
  modelOptions: z.record(z.unknown()).optional(),
55
+ image: fileUnionContentSchema.optional(),
55
56
  });
56
57
  export const videoModelOutputSchema = z.object({
57
58
  videos: z.array(fileUnionContentSchema),
@@ -0,0 +1,2 @@
1
+ import type { Environment } from "nunjucks";
2
+ export declare function setupFilters(env: Environment): void;
@@ -0,0 +1,9 @@
1
+ import { stringify } from "yaml";
2
+ export function setupFilters(env) {
3
+ env.addFilter("yaml.stringify", (obj) => {
4
+ return stringify(obj);
5
+ });
6
+ env.addFilter("json.stringify", (obj, ...args) => {
7
+ return JSON.stringify(obj, ...args);
8
+ });
9
+ }
@@ -2,6 +2,7 @@ import { nodejs } from "@aigne/platform-helpers/nodejs/index.js";
2
2
  import nunjucks from "nunjucks";
3
3
  import { z } from "zod";
4
4
  import { isNil, omitBy } from "../utils/type-utils.js";
5
+ import { setupFilters } from "./filters/index.js";
5
6
  nunjucks.runtime.suppressValue = (v) => {
6
7
  if (isNil(v))
7
8
  return "";
@@ -20,6 +21,7 @@ export class PromptTemplate {
20
21
  if (options?.workingDir) {
21
22
  env = new nunjucks.Environment(new CustomLoader({ workingDir: options.workingDir }));
22
23
  }
24
+ setupFilters(env);
23
25
  return new Promise((resolve, reject) => env.renderString(this.template, variables, (err, res) => {
24
26
  if (err || !res) {
25
27
  reject(err || new Error(`Failed to render template: ${this.template}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/core",
3
- "version": "1.65.0-beta.4",
3
+ "version": "1.65.0",
4
4
  "description": "The functional core of agentic AI",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -91,9 +91,9 @@
91
91
  "zod": "^3.25.67",
92
92
  "zod-from-json-schema": "^0.0.5",
93
93
  "zod-to-json-schema": "^3.24.6",
94
- "@aigne/afs": "^1.1.1-beta",
94
+ "@aigne/afs": "^1.1.1",
95
95
  "@aigne/platform-helpers": "^0.6.3",
96
- "@aigne/observability-api": "^0.11.4-beta.1"
96
+ "@aigne/observability-api": "^0.11.4"
97
97
  },
98
98
  "devDependencies": {
99
99
  "@types/bun": "^1.2.22",