@gammatech/aijsx 0.3.0-beta.11 → 0.3.0-beta.12

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/dist/index.js CHANGED
@@ -576,6 +576,8 @@ var StreamRenderContext = class _StreamRenderContext {
576
576
  const self = this;
577
577
  const logImpl = this.getContext(LoggerContext);
578
578
  this.logger = new BoundLogger(logImpl, this);
579
+ this.render = this.render.bind(this);
580
+ this.runChain = this.runChain.bind(this);
579
581
  this.renderStream = async function* (renderable, opts) {
580
582
  const preserveTags = opts.preserveTags ?? false;
581
583
  const renderedProps = opts.renderedProps || {};
@@ -717,7 +719,6 @@ var StreamRenderContext = class _StreamRenderContext {
717
719
  try {
718
720
  parsedVariables = chain.schema.parse(variables);
719
721
  } catch (e) {
720
- console.log(e);
721
722
  const err = e;
722
723
  const errors = JSON.stringify(err.flatten());
723
724
  throw new ChainParseVariablesError("Invalid input variables: " + errors);
@@ -735,12 +736,10 @@ var StreamRenderContext = class _StreamRenderContext {
735
736
  };
736
737
  // @internal
737
738
  enter(element, renderId, newCtx) {
738
- const context = new _StreamRenderContext(this, element, renderId, {
739
+ return new _StreamRenderContext(this, element, renderId, {
739
740
  ...this.contextValues,
740
741
  ...newCtx
741
742
  });
742
- context.render = context.render.bind(context);
743
- return context;
744
743
  }
745
744
  };
746
745
  function ContextValueProvider({ children }) {
@@ -830,9 +829,6 @@ function createPrompt(config) {
830
829
  var import_zod2 = require("zod");
831
830
  function createFunctionChain(chain) {
832
831
  const { key, run, schema, outputSchema = import_zod2.z.any() } = chain;
833
- const asyncRun = async (vars, context) => {
834
- return run(vars, context);
835
- };
836
832
  return {
837
833
  type: "function",
838
834
  key,
@@ -840,7 +836,7 @@ function createFunctionChain(chain) {
840
836
  messageSchema: null,
841
837
  outputSchema,
842
838
  // always make it async so RenderContext doesnt have a to guess
843
- run: asyncRun
839
+ run
844
840
  };
845
841
  }
846
842
  function createStreamChain(chain) {
package/dist/index.mjs CHANGED
@@ -481,6 +481,8 @@ var StreamRenderContext = class _StreamRenderContext {
481
481
  const self = this;
482
482
  const logImpl = this.getContext(LoggerContext);
483
483
  this.logger = new BoundLogger(logImpl, this);
484
+ this.render = this.render.bind(this);
485
+ this.runChain = this.runChain.bind(this);
484
486
  this.renderStream = async function* (renderable, opts) {
485
487
  const preserveTags = opts.preserveTags ?? false;
486
488
  const renderedProps = opts.renderedProps || {};
@@ -622,7 +624,6 @@ var StreamRenderContext = class _StreamRenderContext {
622
624
  try {
623
625
  parsedVariables = chain.schema.parse(variables);
624
626
  } catch (e) {
625
- console.log(e);
626
627
  const err = e;
627
628
  const errors = JSON.stringify(err.flatten());
628
629
  throw new ChainParseVariablesError("Invalid input variables: " + errors);
@@ -640,12 +641,10 @@ var StreamRenderContext = class _StreamRenderContext {
640
641
  };
641
642
  // @internal
642
643
  enter(element, renderId, newCtx) {
643
- const context = new _StreamRenderContext(this, element, renderId, {
644
+ return new _StreamRenderContext(this, element, renderId, {
644
645
  ...this.contextValues,
645
646
  ...newCtx
646
647
  });
647
- context.render = context.render.bind(context);
648
- return context;
649
648
  }
650
649
  };
651
650
  function ContextValueProvider({ children }) {
@@ -735,9 +734,6 @@ function createPrompt(config) {
735
734
  import { z as z2 } from "zod";
736
735
  function createFunctionChain(chain) {
737
736
  const { key, run, schema, outputSchema = z2.any() } = chain;
738
- const asyncRun = async (vars, context) => {
739
- return run(vars, context);
740
- };
741
737
  return {
742
738
  type: "function",
743
739
  key,
@@ -745,7 +741,7 @@ function createFunctionChain(chain) {
745
741
  messageSchema: null,
746
742
  outputSchema,
747
743
  // always make it async so RenderContext doesnt have a to guess
748
- run: asyncRun
744
+ run
749
745
  };
750
746
  }
751
747
  function createStreamChain(chain) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gammatech/aijsx",
3
- "version": "0.3.0-beta.11",
3
+ "version": "0.3.0-beta.12",
4
4
  "description": "Rewrite of aijsx",
5
5
  "author": "Jordan Garcia",
6
6
  "license": "MIT",