@flink-app/flink 2.0.0-alpha.85 → 2.0.0-alpha.87

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,13 @@
1
1
  # @flink-app/flink
2
2
 
3
+ ## 2.0.0-alpha.87
4
+
5
+ ### Patch Changes
6
+
7
+ - Register Handlebars raw helper so {{{{raw}}}}...{{{{/raw}}}} blocks in agent instruction files pass content through literally instead of silently dropping it
8
+
9
+ ## 2.0.0-alpha.86
10
+
3
11
  ## 2.0.0-alpha.85
4
12
 
5
13
  ## 2.0.0-alpha.84
@@ -77,6 +77,11 @@ exports.resolveInstructionsReturn = resolveInstructionsReturn;
77
77
  var fs = __importStar(require("fs"));
78
78
  var path = __importStar(require("path"));
79
79
  var handlebars_1 = __importDefault(require("handlebars"));
80
+ // Enable {{{{raw}}}}...{{{{/raw}}}} blocks to pass content through unprocessed.
81
+ // Without this, content inside raw blocks is silently dropped.
82
+ handlebars_1.default.registerHelper("raw", function (options) {
83
+ return options.fn(this);
84
+ });
80
85
  var fileCache = new Map();
81
86
  var IMPORT_REGEX = /\{\{\s*import\s+["']([^"']+)['"]\s*\}\}/g;
82
87
  function resolveImports(content, currentDir, visited) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flink-app/flink",
3
- "version": "2.0.0-alpha.85",
3
+ "version": "2.0.0-alpha.87",
4
4
  "description": "Typescript only framework for creating REST-like APIs on top of Express and mongodb",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "main": "dist/src/index.js",
@@ -147,6 +147,26 @@ Conversation: {{agentContext.conversationId}}`
147
147
  expect(result).toContain("Outside business hours"); // isBusinessHours is false
148
148
  });
149
149
 
150
+ it("should pass through content inside {{{{raw}}}} blocks literally", async () => {
151
+ const testPath = path.join(process.cwd(), "spec/fixtures/agent-instructions/raw-block-test.md");
152
+ fs.writeFileSync(
153
+ testPath,
154
+ `Before raw.\n{{{{raw}}}}\nThis has {{literal}} braces and {{#if things}} blocks.\n{{{{/raw}}}}\nAfter raw.`
155
+ );
156
+
157
+ try {
158
+ const callback = agentInstructions("spec/fixtures/agent-instructions/raw-block-test.md");
159
+ const result = await callback(mockCtx, mockAgentContext);
160
+
161
+ expect(result).toContain("Before raw.");
162
+ expect(result).toContain("After raw.");
163
+ expect(result).toContain("{{literal}}");
164
+ expect(result).toContain("{{#if things}}");
165
+ } finally {
166
+ fs.unlinkSync(testPath);
167
+ }
168
+ });
169
+
150
170
  it("should throw clear error on template rendering failure", async () => {
151
171
  // Create a test file with invalid Handlebars syntax
152
172
  const testPath = path.join(process.cwd(), "spec/fixtures/agent-instructions/invalid-template.md");
@@ -2,6 +2,12 @@ import * as fs from "fs";
2
2
  import * as path from "path";
3
3
  import Handlebars from "handlebars";
4
4
 
5
+ // Enable {{{{raw}}}}...{{{{/raw}}}} blocks to pass content through unprocessed.
6
+ // Without this, content inside raw blocks is silently dropped.
7
+ Handlebars.registerHelper("raw", function (this: any, options: any) {
8
+ return options.fn(this);
9
+ });
10
+
5
11
  /**
6
12
  * Return type for the FlinkAgent.instructions() method.
7
13
  *