@aaac/runtime 0.2.6 → 0.2.7

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
@@ -19,8 +19,10 @@ import {
19
19
  jsonSchemaToZod
20
20
  } from "./chunk-ET6TGQRT.js";
21
21
  import {
22
+ AdapterError,
23
+ adapterErrorKind,
22
24
  toolGrantForAgent
23
- } from "./chunk-VJXGCWSZ.js";
25
+ } from "./chunk-MG7WSWJU.js";
24
26
  import {
25
27
  OBSERVABILITY_ENV_VARS,
26
28
  buildObservabilityEnv,
@@ -69,9 +71,9 @@ import {
69
71
  __toESM
70
72
  } from "./chunk-BJ7B4R26.js";
71
73
 
72
- // ../../node_modules/handlebars/dist/cjs/handlebars/utils.js
74
+ // node_modules/handlebars/dist/cjs/handlebars/utils.js
73
75
  var require_utils = __commonJS({
74
- "../../node_modules/handlebars/dist/cjs/handlebars/utils.js"(exports) {
76
+ "node_modules/handlebars/dist/cjs/handlebars/utils.js"(exports) {
75
77
  "use strict";
76
78
  exports.__esModule = true;
77
79
  exports.extend = extend;
@@ -130,7 +132,7 @@ var require_utils = __commonJS({
130
132
  }
131
133
  function escapeExpression(string) {
132
134
  if (typeof string !== "string") {
133
- if (string && string.toHTML) {
135
+ if (string && typeof string.toHTML === "function") {
134
136
  return string.toHTML();
135
137
  } else if (string == null) {
136
138
  return "";
@@ -168,19 +170,21 @@ var require_utils = __commonJS({
168
170
  }
169
171
  });
170
172
 
171
- // ../../node_modules/handlebars/dist/cjs/handlebars/exception.js
173
+ // node_modules/handlebars/dist/cjs/handlebars/exception.js
172
174
  var require_exception = __commonJS({
173
- "../../node_modules/handlebars/dist/cjs/handlebars/exception.js"(exports, module) {
175
+ "node_modules/handlebars/dist/cjs/handlebars/exception.js"(exports, module) {
174
176
  "use strict";
175
177
  exports.__esModule = true;
176
178
  var errorProps = ["description", "fileName", "lineNumber", "endLineNumber", "message", "name", "number", "stack"];
177
179
  function Exception(message, node) {
178
180
  var loc = node && node.loc, line = void 0, endLineNumber = void 0, column = void 0, endColumn = void 0;
179
- if (loc) {
181
+ if (loc && loc.start) {
180
182
  line = loc.start.line;
181
- endLineNumber = loc.end.line;
182
183
  column = loc.start.column;
183
- endColumn = loc.end.column;
184
+ if (loc.end) {
185
+ endLineNumber = loc.end.line;
186
+ endColumn = loc.end.column;
187
+ }
184
188
  message += " - " + line + ":" + column;
185
189
  }
186
190
  var tmp = Error.prototype.constructor.call(this, message);
@@ -217,9 +221,9 @@ var require_exception = __commonJS({
217
221
  }
218
222
  });
219
223
 
220
- // ../../node_modules/handlebars/dist/cjs/handlebars/helpers/block-helper-missing.js
224
+ // node_modules/handlebars/dist/cjs/handlebars/helpers/block-helper-missing.js
221
225
  var require_block_helper_missing = __commonJS({
222
- "../../node_modules/handlebars/dist/cjs/handlebars/helpers/block-helper-missing.js"(exports, module) {
226
+ "node_modules/handlebars/dist/cjs/handlebars/helpers/block-helper-missing.js"(exports, module) {
223
227
  "use strict";
224
228
  exports.__esModule = true;
225
229
  var _utils = require_utils();
@@ -253,9 +257,9 @@ var require_block_helper_missing = __commonJS({
253
257
  }
254
258
  });
255
259
 
256
- // ../../node_modules/handlebars/dist/cjs/handlebars/helpers/each.js
260
+ // node_modules/handlebars/dist/cjs/handlebars/helpers/each.js
257
261
  var require_each = __commonJS({
258
- "../../node_modules/handlebars/dist/cjs/handlebars/helpers/each.js"(exports, module) {
262
+ "node_modules/handlebars/dist/cjs/handlebars/helpers/each.js"(exports, module) {
259
263
  "use strict";
260
264
  exports.__esModule = true;
261
265
  function _interopRequireDefault(obj) {
@@ -264,6 +268,15 @@ var require_each = __commonJS({
264
268
  var _utils = require_utils();
265
269
  var _exception = require_exception();
266
270
  var _exception2 = _interopRequireDefault(_exception);
271
+ function closeIterator(iterator) {
272
+ try {
273
+ var _close = iterator["return"];
274
+ if (_utils.isFunction(_close)) {
275
+ _close.call(iterator);
276
+ }
277
+ } catch (closeError) {
278
+ }
279
+ }
267
280
  exports["default"] = function(instance) {
268
281
  instance.registerHelper("each", function(context, options) {
269
282
  if (!options) {
@@ -279,7 +292,7 @@ var require_each = __commonJS({
279
292
  if (options.data) {
280
293
  data = _utils.createFrame(options.data);
281
294
  }
282
- function execIteration(field, index, last) {
295
+ function execIteration(field, index, last, value) {
283
296
  if (data) {
284
297
  data.key = field;
285
298
  data.index = index;
@@ -289,40 +302,46 @@ var require_each = __commonJS({
289
302
  data.contextPath = contextPath + field;
290
303
  }
291
304
  }
292
- ret = ret + fn(context[field], {
305
+ ret = ret + fn(value, {
293
306
  data,
294
- blockParams: _utils.blockParams([context[field], field], [contextPath + field, null])
307
+ blockParams: _utils.blockParams([value, field], [contextPath + field, null])
295
308
  });
296
309
  }
297
310
  if (context && typeof context === "object") {
298
311
  if (_utils.isArray(context)) {
299
312
  for (var j = context.length; i < j; i++) {
300
313
  if (i in context) {
301
- execIteration(i, i, i === context.length - 1);
314
+ execIteration(i, i, i === context.length - 1, context[i]);
302
315
  }
303
316
  }
304
317
  } else if (typeof Symbol === "function" && context[Symbol.iterator]) {
305
- var newContext = [];
306
318
  var iterator = context[Symbol.iterator]();
307
- for (var it = iterator.next(); !it.done; it = iterator.next()) {
308
- newContext.push(it.value);
309
- }
310
- context = newContext;
311
- for (var j = context.length; i < j; i++) {
312
- execIteration(i, i, i === context.length - 1);
319
+ var current = iterator.next();
320
+ while (!current.done) {
321
+ var next = iterator.next();
322
+ try {
323
+ execIteration(i, i, next.done, current.value);
324
+ } catch (e) {
325
+ if (!next.done) {
326
+ closeIterator(iterator);
327
+ }
328
+ throw e;
329
+ }
330
+ current = next;
331
+ i++;
313
332
  }
314
333
  } else {
315
334
  (function() {
316
335
  var priorKey = void 0;
317
336
  Object.keys(context).forEach(function(key) {
318
337
  if (priorKey !== void 0) {
319
- execIteration(priorKey, i - 1);
338
+ execIteration(priorKey, i - 1, false, context[priorKey]);
320
339
  }
321
340
  priorKey = key;
322
341
  i++;
323
342
  });
324
343
  if (priorKey !== void 0) {
325
- execIteration(priorKey, i - 1, true);
344
+ execIteration(priorKey, i - 1, true, context[priorKey]);
326
345
  }
327
346
  })();
328
347
  }
@@ -337,9 +356,9 @@ var require_each = __commonJS({
337
356
  }
338
357
  });
339
358
 
340
- // ../../node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js
359
+ // node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js
341
360
  var require_helper_missing = __commonJS({
342
- "../../node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js"(exports, module) {
361
+ "node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js"(exports, module) {
343
362
  "use strict";
344
363
  exports.__esModule = true;
345
364
  function _interopRequireDefault(obj) {
@@ -360,9 +379,9 @@ var require_helper_missing = __commonJS({
360
379
  }
361
380
  });
362
381
 
363
- // ../../node_modules/handlebars/dist/cjs/handlebars/helpers/if.js
382
+ // node_modules/handlebars/dist/cjs/handlebars/helpers/if.js
364
383
  var require_if = __commonJS({
365
- "../../node_modules/handlebars/dist/cjs/handlebars/helpers/if.js"(exports, module) {
384
+ "node_modules/handlebars/dist/cjs/handlebars/helpers/if.js"(exports, module) {
366
385
  "use strict";
367
386
  exports.__esModule = true;
368
387
  function _interopRequireDefault(obj) {
@@ -400,9 +419,9 @@ var require_if = __commonJS({
400
419
  }
401
420
  });
402
421
 
403
- // ../../node_modules/handlebars/dist/cjs/handlebars/helpers/log.js
422
+ // node_modules/handlebars/dist/cjs/handlebars/helpers/log.js
404
423
  var require_log = __commonJS({
405
- "../../node_modules/handlebars/dist/cjs/handlebars/helpers/log.js"(exports, module) {
424
+ "node_modules/handlebars/dist/cjs/handlebars/helpers/log.js"(exports, module) {
406
425
  "use strict";
407
426
  exports.__esModule = true;
408
427
  exports["default"] = function(instance) {
@@ -425,9 +444,9 @@ var require_log = __commonJS({
425
444
  }
426
445
  });
427
446
 
428
- // ../../node_modules/handlebars/dist/cjs/handlebars/helpers/lookup.js
447
+ // node_modules/handlebars/dist/cjs/handlebars/helpers/lookup.js
429
448
  var require_lookup = __commonJS({
430
- "../../node_modules/handlebars/dist/cjs/handlebars/helpers/lookup.js"(exports, module) {
449
+ "node_modules/handlebars/dist/cjs/handlebars/helpers/lookup.js"(exports, module) {
431
450
  "use strict";
432
451
  exports.__esModule = true;
433
452
  exports["default"] = function(instance) {
@@ -442,9 +461,9 @@ var require_lookup = __commonJS({
442
461
  }
443
462
  });
444
463
 
445
- // ../../node_modules/handlebars/dist/cjs/handlebars/helpers/with.js
464
+ // node_modules/handlebars/dist/cjs/handlebars/helpers/with.js
446
465
  var require_with = __commonJS({
447
- "../../node_modules/handlebars/dist/cjs/handlebars/helpers/with.js"(exports, module) {
466
+ "node_modules/handlebars/dist/cjs/handlebars/helpers/with.js"(exports, module) {
448
467
  "use strict";
449
468
  exports.__esModule = true;
450
469
  function _interopRequireDefault(obj) {
@@ -481,9 +500,9 @@ var require_with = __commonJS({
481
500
  }
482
501
  });
483
502
 
484
- // ../../node_modules/handlebars/dist/cjs/handlebars/helpers.js
503
+ // node_modules/handlebars/dist/cjs/handlebars/helpers.js
485
504
  var require_helpers = __commonJS({
486
- "../../node_modules/handlebars/dist/cjs/handlebars/helpers.js"(exports) {
505
+ "node_modules/handlebars/dist/cjs/handlebars/helpers.js"(exports) {
487
506
  "use strict";
488
507
  exports.__esModule = true;
489
508
  exports.registerDefaultHelpers = registerDefaultHelpers;
@@ -525,9 +544,9 @@ var require_helpers = __commonJS({
525
544
  }
526
545
  });
527
546
 
528
- // ../../node_modules/handlebars/dist/cjs/handlebars/decorators/inline.js
547
+ // node_modules/handlebars/dist/cjs/handlebars/decorators/inline.js
529
548
  var require_inline = __commonJS({
530
- "../../node_modules/handlebars/dist/cjs/handlebars/decorators/inline.js"(exports, module) {
549
+ "node_modules/handlebars/dist/cjs/handlebars/decorators/inline.js"(exports, module) {
531
550
  "use strict";
532
551
  exports.__esModule = true;
533
552
  var _utils = require_utils();
@@ -552,9 +571,9 @@ var require_inline = __commonJS({
552
571
  }
553
572
  });
554
573
 
555
- // ../../node_modules/handlebars/dist/cjs/handlebars/decorators.js
574
+ // node_modules/handlebars/dist/cjs/handlebars/decorators.js
556
575
  var require_decorators = __commonJS({
557
- "../../node_modules/handlebars/dist/cjs/handlebars/decorators.js"(exports) {
576
+ "node_modules/handlebars/dist/cjs/handlebars/decorators.js"(exports) {
558
577
  "use strict";
559
578
  exports.__esModule = true;
560
579
  exports.registerDefaultDecorators = registerDefaultDecorators;
@@ -569,9 +588,9 @@ var require_decorators = __commonJS({
569
588
  }
570
589
  });
571
590
 
572
- // ../../node_modules/handlebars/dist/cjs/handlebars/logger.js
591
+ // node_modules/handlebars/dist/cjs/handlebars/logger.js
573
592
  var require_logger = __commonJS({
574
- "../../node_modules/handlebars/dist/cjs/handlebars/logger.js"(exports, module) {
593
+ "node_modules/handlebars/dist/cjs/handlebars/logger.js"(exports, module) {
575
594
  "use strict";
576
595
  exports.__esModule = true;
577
596
  var _utils = require_utils();
@@ -610,13 +629,14 @@ var require_logger = __commonJS({
610
629
  }
611
630
  });
612
631
 
613
- // ../../node_modules/handlebars/dist/cjs/handlebars/internal/proto-access.js
632
+ // node_modules/handlebars/dist/cjs/handlebars/internal/proto-access.js
614
633
  var require_proto_access = __commonJS({
615
- "../../node_modules/handlebars/dist/cjs/handlebars/internal/proto-access.js"(exports) {
634
+ "node_modules/handlebars/dist/cjs/handlebars/internal/proto-access.js"(exports) {
616
635
  "use strict";
617
636
  exports.__esModule = true;
618
637
  exports.createProtoAccessControl = createProtoAccessControl;
619
638
  exports.resultIsAllowed = resultIsAllowed;
639
+ exports.isPrototypeConstructor = isPrototypeConstructor;
620
640
  exports.resetLoggedProperties = resetLoggedProperties;
621
641
  function _interopRequireDefault(obj) {
622
642
  return obj && obj.__esModule ? obj : { "default": obj };
@@ -654,6 +674,9 @@ var require_proto_access = __commonJS({
654
674
  return checkWhiteList(protoAccessControl.properties, propertyName);
655
675
  }
656
676
  }
677
+ function isPrototypeConstructor(parent, propertyName, result) {
678
+ return propertyName === "constructor" && typeof result === "function" && parent === result.prototype;
679
+ }
657
680
  function checkWhiteList(protoAccessControlForType, propertyName) {
658
681
  if (protoAccessControlForType.whitelist[propertyName] !== void 0) {
659
682
  return protoAccessControlForType.whitelist[propertyName] === true;
@@ -678,9 +701,9 @@ var require_proto_access = __commonJS({
678
701
  }
679
702
  });
680
703
 
681
- // ../../node_modules/handlebars/dist/cjs/handlebars/base.js
704
+ // node_modules/handlebars/dist/cjs/handlebars/base.js
682
705
  var require_base = __commonJS({
683
- "../../node_modules/handlebars/dist/cjs/handlebars/base.js"(exports) {
706
+ "node_modules/handlebars/dist/cjs/handlebars/base.js"(exports) {
684
707
  "use strict";
685
708
  exports.__esModule = true;
686
709
  exports.HandlebarsEnvironment = HandlebarsEnvironment;
@@ -695,7 +718,7 @@ var require_base = __commonJS({
695
718
  var _logger = require_logger();
696
719
  var _logger2 = _interopRequireDefault(_logger);
697
720
  var _internalProtoAccess = require_proto_access();
698
- var VERSION = "4.7.9";
721
+ var VERSION = "4.7.10";
699
722
  exports.VERSION = VERSION;
700
723
  var COMPILER_REVISION = 8;
701
724
  exports.COMPILER_REVISION = COMPILER_REVISION;
@@ -779,9 +802,9 @@ var require_base = __commonJS({
779
802
  }
780
803
  });
781
804
 
782
- // ../../node_modules/handlebars/dist/cjs/handlebars/safe-string.js
805
+ // node_modules/handlebars/dist/cjs/handlebars/safe-string.js
783
806
  var require_safe_string = __commonJS({
784
- "../../node_modules/handlebars/dist/cjs/handlebars/safe-string.js"(exports, module) {
807
+ "node_modules/handlebars/dist/cjs/handlebars/safe-string.js"(exports, module) {
785
808
  "use strict";
786
809
  exports.__esModule = true;
787
810
  function SafeString(string) {
@@ -795,9 +818,9 @@ var require_safe_string = __commonJS({
795
818
  }
796
819
  });
797
820
 
798
- // ../../node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js
821
+ // node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js
799
822
  var require_wrapHelper = __commonJS({
800
- "../../node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js"(exports) {
823
+ "node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js"(exports) {
801
824
  "use strict";
802
825
  exports.__esModule = true;
803
826
  exports.wrapHelper = wrapHelper;
@@ -815,9 +838,9 @@ var require_wrapHelper = __commonJS({
815
838
  }
816
839
  });
817
840
 
818
- // ../../node_modules/handlebars/dist/cjs/handlebars/runtime.js
841
+ // node_modules/handlebars/dist/cjs/handlebars/runtime.js
819
842
  var require_runtime = __commonJS({
820
- "../../node_modules/handlebars/dist/cjs/handlebars/runtime.js"(exports) {
843
+ "node_modules/handlebars/dist/cjs/handlebars/runtime.js"(exports) {
821
844
  "use strict";
822
845
  exports.__esModule = true;
823
846
  exports.checkRevision = checkRevision;
@@ -884,7 +907,13 @@ var require_runtime = __commonJS({
884
907
  options.hooks = this.hooks;
885
908
  options.protoAccessControl = this.protoAccessControl;
886
909
  var result = env.VM.invokePartial.call(this, partial, context, options);
910
+ if (result == null && Utils.isFunction(partial)) {
911
+ throw new _exception2["default"]("The partial " + options.name + " returned no output: partials must return a string");
912
+ }
887
913
  if (result == null && env.compile) {
914
+ if (typeof partial !== "string") {
915
+ throw new _exception2["default"]("The partial " + options.name + " could not be compiled: partials must be strings or functions returning strings");
916
+ }
888
917
  options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
889
918
  result = options.partials[options.name](context, options);
890
919
  }
@@ -918,7 +947,7 @@ var require_runtime = __commonJS({
918
947
  if (result == null) {
919
948
  return result;
920
949
  }
921
- if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
950
+ if (Object.prototype.hasOwnProperty.call(parent, propertyName) && !_internalProtoAccess.isPrototypeConstructor(parent, propertyName, result)) {
922
951
  return result;
923
952
  }
924
953
  if (_internalProtoAccess.resultIsAllowed(result, container.protoAccessControl, propertyName)) {
@@ -1053,7 +1082,7 @@ var require_runtime = __commonJS({
1053
1082
  } else {
1054
1083
  partial = lookupOwnProperty(options.partials, options.name);
1055
1084
  }
1056
- } else if (!partial.call && !options.name) {
1085
+ } else if (typeof partial !== "function" && !options.name) {
1057
1086
  options.name = partial;
1058
1087
  partial = lookupOwnProperty(options.partials, partial);
1059
1088
  }
@@ -1130,9 +1159,9 @@ var require_runtime = __commonJS({
1130
1159
  }
1131
1160
  });
1132
1161
 
1133
- // ../../node_modules/handlebars/dist/cjs/handlebars/no-conflict.js
1162
+ // node_modules/handlebars/dist/cjs/handlebars/no-conflict.js
1134
1163
  var require_no_conflict = __commonJS({
1135
- "../../node_modules/handlebars/dist/cjs/handlebars/no-conflict.js"(exports, module) {
1164
+ "node_modules/handlebars/dist/cjs/handlebars/no-conflict.js"(exports, module) {
1136
1165
  "use strict";
1137
1166
  exports.__esModule = true;
1138
1167
  exports["default"] = function(Handlebars2) {
@@ -1156,9 +1185,9 @@ var require_no_conflict = __commonJS({
1156
1185
  }
1157
1186
  });
1158
1187
 
1159
- // ../../node_modules/handlebars/dist/cjs/handlebars.runtime.js
1188
+ // node_modules/handlebars/dist/cjs/handlebars.runtime.js
1160
1189
  var require_handlebars_runtime = __commonJS({
1161
- "../../node_modules/handlebars/dist/cjs/handlebars.runtime.js"(exports, module) {
1190
+ "node_modules/handlebars/dist/cjs/handlebars.runtime.js"(exports, module) {
1162
1191
  "use strict";
1163
1192
  exports.__esModule = true;
1164
1193
  function _interopRequireDefault(obj) {
@@ -1212,9 +1241,9 @@ var require_handlebars_runtime = __commonJS({
1212
1241
  }
1213
1242
  });
1214
1243
 
1215
- // ../../node_modules/handlebars/dist/cjs/handlebars/compiler/ast.js
1244
+ // node_modules/handlebars/dist/cjs/handlebars/compiler/ast.js
1216
1245
  var require_ast = __commonJS({
1217
- "../../node_modules/handlebars/dist/cjs/handlebars/compiler/ast.js"(exports, module) {
1246
+ "node_modules/handlebars/dist/cjs/handlebars/compiler/ast.js"(exports, module) {
1218
1247
  "use strict";
1219
1248
  exports.__esModule = true;
1220
1249
  var AST = {
@@ -1241,9 +1270,9 @@ var require_ast = __commonJS({
1241
1270
  }
1242
1271
  });
1243
1272
 
1244
- // ../../node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js
1273
+ // node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js
1245
1274
  var require_parser = __commonJS({
1246
- "../../node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js"(exports, module) {
1275
+ "node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js"(exports, module) {
1247
1276
  "use strict";
1248
1277
  exports.__esModule = true;
1249
1278
  var handlebars = (function() {
@@ -1951,9 +1980,19 @@ var require_parser = __commonJS({
1951
1980
  }
1952
1981
  });
1953
1982
 
1954
- // ../../node_modules/handlebars/dist/cjs/handlebars/compiler/visitor.js
1983
+ // node_modules/handlebars/dist/cjs/handlebars/compiler/node-types.js
1984
+ var require_node_types = __commonJS({
1985
+ "node_modules/handlebars/dist/cjs/handlebars/compiler/node-types.js"(exports) {
1986
+ "use strict";
1987
+ exports.__esModule = true;
1988
+ var NODE_TYPES = ["Program", "BlockStatement", "DecoratorBlock", "PartialStatement", "PartialBlockStatement", "Decorator", "MustacheStatement", "ContentStatement", "CommentStatement", "SubExpression", "PathExpression", "StringLiteral", "NumberLiteral", "BooleanLiteral", "UndefinedLiteral", "NullLiteral", "Hash", "HashPair"];
1989
+ exports.NODE_TYPES = NODE_TYPES;
1990
+ }
1991
+ });
1992
+
1993
+ // node_modules/handlebars/dist/cjs/handlebars/compiler/visitor.js
1955
1994
  var require_visitor = __commonJS({
1956
- "../../node_modules/handlebars/dist/cjs/handlebars/compiler/visitor.js"(exports, module) {
1995
+ "node_modules/handlebars/dist/cjs/handlebars/compiler/visitor.js"(exports, module) {
1957
1996
  "use strict";
1958
1997
  exports.__esModule = true;
1959
1998
  function _interopRequireDefault(obj) {
@@ -1961,9 +2000,14 @@ var require_visitor = __commonJS({
1961
2000
  }
1962
2001
  var _exception = require_exception();
1963
2002
  var _exception2 = _interopRequireDefault(_exception);
2003
+ var _utils = require_utils();
2004
+ var _nodeTypes = require_node_types();
1964
2005
  function Visitor() {
1965
2006
  this.parents = [];
1966
2007
  }
2008
+ function isDispatchable(visitor, type) {
2009
+ return _utils.indexOf(_nodeTypes.NODE_TYPES, type) !== -1 || !(type in Visitor.prototype) && typeof visitor[type] === "function";
2010
+ }
1967
2011
  Visitor.prototype = {
1968
2012
  constructor: Visitor,
1969
2013
  mutating: false,
@@ -1971,7 +2015,7 @@ var require_visitor = __commonJS({
1971
2015
  acceptKey: function acceptKey(node, name) {
1972
2016
  var value = this.accept(node[name]);
1973
2017
  if (this.mutating) {
1974
- if (value && !Visitor.prototype[value.type]) {
2018
+ if (value && !isDispatchable(this, value.type)) {
1975
2019
  throw new _exception2["default"]('Unexpected node type "' + value.type + '" found when accepting ' + name + " on " + node.type);
1976
2020
  }
1977
2021
  node[name] = value;
@@ -2001,7 +2045,7 @@ var require_visitor = __commonJS({
2001
2045
  if (!object) {
2002
2046
  return;
2003
2047
  }
2004
- if (!this[object.type]) {
2048
+ if (!isDispatchable(this, object.type) || !this[object.type]) {
2005
2049
  throw new _exception2["default"]("Unknown type: " + object.type, object);
2006
2050
  }
2007
2051
  if (this.current) {
@@ -2072,9 +2116,9 @@ var require_visitor = __commonJS({
2072
2116
  }
2073
2117
  });
2074
2118
 
2075
- // ../../node_modules/handlebars/dist/cjs/handlebars/compiler/whitespace-control.js
2119
+ // node_modules/handlebars/dist/cjs/handlebars/compiler/whitespace-control.js
2076
2120
  var require_whitespace_control = __commonJS({
2077
- "../../node_modules/handlebars/dist/cjs/handlebars/compiler/whitespace-control.js"(exports, module) {
2121
+ "node_modules/handlebars/dist/cjs/handlebars/compiler/whitespace-control.js"(exports, module) {
2078
2122
  "use strict";
2079
2123
  exports.__esModule = true;
2080
2124
  function _interopRequireDefault(obj) {
@@ -2108,7 +2152,7 @@ var require_whitespace_control = __commonJS({
2108
2152
  omitRight(body, i);
2109
2153
  if (omitLeft(body, i)) {
2110
2154
  if (current.type === "PartialStatement") {
2111
- current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1];
2155
+ current.indent = /(?:^|[^ \t])([ \t]+)$/.exec(body[i - 1].original)[1];
2112
2156
  }
2113
2157
  }
2114
2158
  }
@@ -2184,7 +2228,7 @@ var require_whitespace_control = __commonJS({
2184
2228
  return isRoot;
2185
2229
  }
2186
2230
  if (prev.type === "ContentStatement") {
2187
- return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original);
2231
+ return (sibling || !isRoot ? /(?:^|\S)[^\S\n]*\n\s*$/ : /^\s*$|(?:^|\S)[^\S\n]*\n\s*$/).test(prev.original);
2188
2232
  }
2189
2233
  }
2190
2234
  function isNextWhitespace(body, i, isRoot) {
@@ -2214,7 +2258,7 @@ var require_whitespace_control = __commonJS({
2214
2258
  return;
2215
2259
  }
2216
2260
  var original = current.value;
2217
- current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, "");
2261
+ current.value = current.value.replace(multiple ? /(^|\S)\s+$/ : /(^|[^ \t])[ \t]+$/, "$1");
2218
2262
  current.leftStripped = current.value !== original;
2219
2263
  return current.leftStripped;
2220
2264
  }
@@ -2223,9 +2267,9 @@ var require_whitespace_control = __commonJS({
2223
2267
  }
2224
2268
  });
2225
2269
 
2226
- // ../../node_modules/handlebars/dist/cjs/handlebars/compiler/helpers.js
2270
+ // node_modules/handlebars/dist/cjs/handlebars/compiler/helpers.js
2227
2271
  var require_helpers2 = __commonJS({
2228
- "../../node_modules/handlebars/dist/cjs/handlebars/compiler/helpers.js"(exports) {
2272
+ "node_modules/handlebars/dist/cjs/handlebars/compiler/helpers.js"(exports) {
2229
2273
  "use strict";
2230
2274
  exports.__esModule = true;
2231
2275
  exports.SourceLocation = SourceLocation;
@@ -2411,9 +2455,9 @@ var require_helpers2 = __commonJS({
2411
2455
  }
2412
2456
  });
2413
2457
 
2414
- // ../../node_modules/handlebars/dist/cjs/handlebars/compiler/base.js
2458
+ // node_modules/handlebars/dist/cjs/handlebars/compiler/base.js
2415
2459
  var require_base2 = __commonJS({
2416
- "../../node_modules/handlebars/dist/cjs/handlebars/compiler/base.js"(exports) {
2460
+ "node_modules/handlebars/dist/cjs/handlebars/compiler/base.js"(exports) {
2417
2461
  "use strict";
2418
2462
  exports.__esModule = true;
2419
2463
  exports.parseWithoutProcessing = parseWithoutProcessing;
@@ -2441,15 +2485,12 @@ var require_base2 = __commonJS({
2441
2485
  var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl);
2442
2486
  var _helpers = require_helpers2();
2443
2487
  var Helpers = _interopRequireWildcard(_helpers);
2444
- var _exception = require_exception();
2445
- var _exception2 = _interopRequireDefault(_exception);
2446
2488
  var _utils = require_utils();
2447
2489
  exports.parser = _parser2["default"];
2448
2490
  var yy = {};
2449
2491
  _utils.extend(yy, Helpers);
2450
2492
  function parseWithoutProcessing(input, options) {
2451
2493
  if (input.type === "Program") {
2452
- validateInputAst(input);
2453
2494
  return input;
2454
2495
  }
2455
2496
  _parser2["default"].yy = yy;
@@ -2464,57 +2505,12 @@ var require_base2 = __commonJS({
2464
2505
  var strip = new _whitespaceControl2["default"](options);
2465
2506
  return strip.accept(ast);
2466
2507
  }
2467
- function validateInputAst(ast) {
2468
- validateAstNode(ast);
2469
- }
2470
- function validateAstNode(node) {
2471
- if (node == null) {
2472
- return;
2473
- }
2474
- if (Array.isArray(node)) {
2475
- node.forEach(validateAstNode);
2476
- return;
2477
- }
2478
- if (typeof node !== "object") {
2479
- return;
2480
- }
2481
- if (node.type === "PathExpression") {
2482
- if (!isValidDepth(node.depth)) {
2483
- throw new _exception2["default"]("Invalid AST: PathExpression.depth must be an integer");
2484
- }
2485
- if (!Array.isArray(node.parts)) {
2486
- throw new _exception2["default"]("Invalid AST: PathExpression.parts must be an array");
2487
- }
2488
- for (var i = 0; i < node.parts.length; i++) {
2489
- if (typeof node.parts[i] !== "string") {
2490
- throw new _exception2["default"]("Invalid AST: PathExpression.parts must only contain strings");
2491
- }
2492
- }
2493
- } else if (node.type === "NumberLiteral") {
2494
- if (typeof node.value !== "number" || !isFinite(node.value)) {
2495
- throw new _exception2["default"]("Invalid AST: NumberLiteral.value must be a number");
2496
- }
2497
- } else if (node.type === "BooleanLiteral") {
2498
- if (typeof node.value !== "boolean") {
2499
- throw new _exception2["default"]("Invalid AST: BooleanLiteral.value must be a boolean");
2500
- }
2501
- }
2502
- Object.keys(node).forEach(function(propertyName) {
2503
- if (propertyName === "loc") {
2504
- return;
2505
- }
2506
- validateAstNode(node[propertyName]);
2507
- });
2508
- }
2509
- function isValidDepth(depth) {
2510
- return typeof depth === "number" && isFinite(depth) && Math.floor(depth) === depth && depth >= 0;
2511
- }
2512
2508
  }
2513
2509
  });
2514
2510
 
2515
- // ../../node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js
2511
+ // node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js
2516
2512
  var require_compiler = __commonJS({
2517
- "../../node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js"(exports) {
2513
+ "node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js"(exports) {
2518
2514
  "use strict";
2519
2515
  exports.__esModule = true;
2520
2516
  exports.Compiler = Compiler;
@@ -2528,6 +2524,7 @@ var require_compiler = __commonJS({
2528
2524
  var _utils = require_utils();
2529
2525
  var _ast = require_ast();
2530
2526
  var _ast2 = _interopRequireDefault(_ast);
2527
+ var _nodeTypes = require_node_types();
2531
2528
  var slice = [].slice;
2532
2529
  function Compiler() {
2533
2530
  }
@@ -2581,7 +2578,7 @@ var require_compiler = __commonJS({
2581
2578
  return guid;
2582
2579
  },
2583
2580
  accept: function accept(node) {
2584
- if (!this[node.type]) {
2581
+ if (_utils.indexOf(_nodeTypes.NODE_TYPES, node.type) === -1 || !this[node.type]) {
2585
2582
  throw new _exception2["default"]("Unknown type: " + node.type, node);
2586
2583
  }
2587
2584
  this.sourceNode.unshift(node);
@@ -2590,6 +2587,7 @@ var require_compiler = __commonJS({
2590
2587
  return ret;
2591
2588
  },
2592
2589
  Program: function Program(program) {
2590
+ validateBlockParams(program);
2593
2591
  this.options.blockParams.unshift(program.blockParams);
2594
2592
  var body = program.body, bodyLength = body.length;
2595
2593
  for (var i = 0; i < bodyLength; i++) {
@@ -2673,6 +2671,9 @@ var require_compiler = __commonJS({
2673
2671
  this.DecoratorBlock(decorator);
2674
2672
  },
2675
2673
  ContentStatement: function ContentStatement(content) {
2674
+ if (content.value != null && typeof content.value !== "string") {
2675
+ throw invalidAst(content, "value must be a string");
2676
+ }
2676
2677
  if (content.value) {
2677
2678
  this.opcode("appendContent", content.value);
2678
2679
  }
@@ -2692,7 +2693,7 @@ var require_compiler = __commonJS({
2692
2693
  },
2693
2694
  ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) {
2694
2695
  var path = sexpr.path, name = path.parts[0], isBlock = program != null || inverse != null;
2695
- this.opcode("getContext", path.depth);
2696
+ this.opcode("getContext", validateDepth(path));
2696
2697
  this.opcode("pushProgram", program);
2697
2698
  this.opcode("pushProgram", inverse);
2698
2699
  path.strict = true;
@@ -2719,27 +2720,32 @@ var require_compiler = __commonJS({
2719
2720
  }
2720
2721
  },
2721
2722
  PathExpression: function PathExpression(path) {
2722
- this.addDepth(path.depth);
2723
- this.opcode("getContext", path.depth);
2724
- var name = path.parts[0], scoped = _ast2["default"].helpers.scopedId(path), blockParamId = !path.depth && !scoped && this.blockParamIndex(name);
2723
+ var depth = validateDepth(path);
2724
+ var parts = validateParts(path);
2725
+ this.addDepth(depth);
2726
+ this.opcode("getContext", depth);
2727
+ var name = parts[0], scoped = _ast2["default"].helpers.scopedId(path), blockParamId = !depth && !scoped && this.blockParamIndex(name);
2725
2728
  if (blockParamId) {
2726
- this.opcode("lookupBlockParam", blockParamId, path.parts);
2729
+ this.opcode("lookupBlockParam", blockParamId, parts);
2727
2730
  } else if (!name) {
2728
2731
  this.opcode("pushContext");
2729
2732
  } else if (path.data) {
2730
2733
  this.options.data = true;
2731
- this.opcode("lookupData", path.depth, path.parts, path.strict);
2734
+ this.opcode("lookupData", depth, parts, path.strict);
2732
2735
  } else {
2733
- this.opcode("lookupOnContext", path.parts, path.falsy, path.strict, scoped);
2736
+ this.opcode("lookupOnContext", parts, path.falsy, path.strict, scoped);
2734
2737
  }
2735
2738
  },
2736
2739
  StringLiteral: function StringLiteral(string) {
2740
+ validateLiteral(string);
2737
2741
  this.opcode("pushString", string.value);
2738
2742
  },
2739
2743
  NumberLiteral: function NumberLiteral(number) {
2744
+ validateLiteral(number);
2740
2745
  this.opcode("pushLiteral", number.value);
2741
2746
  },
2742
2747
  BooleanLiteral: function BooleanLiteral(bool) {
2748
+ validateLiteral(bool);
2743
2749
  this.opcode("pushLiteral", bool.value);
2744
2750
  },
2745
2751
  UndefinedLiteral: function UndefinedLiteral() {
@@ -2749,7 +2755,16 @@ var require_compiler = __commonJS({
2749
2755
  this.opcode("pushLiteral", "null");
2750
2756
  },
2751
2757
  Hash: function Hash(hash) {
2752
- var pairs = hash.pairs, i = 0, l = pairs.length;
2758
+ var pairs = hash.pairs, i = 0, l = void 0;
2759
+ if (!_utils.isArray(pairs)) {
2760
+ throw invalidAst(hash, "pairs must be an array");
2761
+ }
2762
+ l = pairs.length;
2763
+ for (var j = 0; j < l; j++) {
2764
+ if (!pairs[j] || typeof pairs[j].key !== "string") {
2765
+ throw invalidAst(hash, "pair keys must be strings");
2766
+ }
2767
+ }
2753
2768
  this.opcode("pushHash");
2754
2769
  for (; i < l; i++) {
2755
2770
  this.pushParam(pairs[i].value);
@@ -2774,6 +2789,7 @@ var require_compiler = __commonJS({
2774
2789
  this.useDepths = true;
2775
2790
  },
2776
2791
  classifySexpr: function classifySexpr(sexpr) {
2792
+ validateParts(sexpr.path);
2777
2793
  var isSimple = _ast2["default"].helpers.simpleId(sexpr.path);
2778
2794
  var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]);
2779
2795
  var isHelper = !isBlockParam && _ast2["default"].helpers.helperExpression(sexpr);
@@ -2800,15 +2816,20 @@ var require_compiler = __commonJS({
2800
2816
  }
2801
2817
  },
2802
2818
  pushParam: function pushParam(val) {
2819
+ validateLiteral(val);
2803
2820
  var value = val.value != null ? val.value : val.original || "";
2821
+ var depth = validateDepth(val);
2804
2822
  if (this.stringParams) {
2823
+ if (typeof value !== "number" && typeof value !== "boolean") {
2824
+ value = String(value);
2825
+ }
2805
2826
  if (value.replace) {
2806
2827
  value = value.replace(/^(\.?\.\/)*/g, "").replace(/\//g, ".");
2807
2828
  }
2808
- if (val.depth) {
2809
- this.addDepth(val.depth);
2829
+ if (depth) {
2830
+ this.addDepth(depth);
2810
2831
  }
2811
- this.opcode("getContext", val.depth || 0);
2832
+ this.opcode("getContext", depth);
2812
2833
  this.opcode("pushStringParam", value, val.type);
2813
2834
  if (val.type === "SubExpression") {
2814
2835
  this.accept(val);
@@ -2816,8 +2837,8 @@ var require_compiler = __commonJS({
2816
2837
  } else {
2817
2838
  if (this.trackIds) {
2818
2839
  var blockParamIndex = void 0;
2819
- if (val.parts && !_ast2["default"].helpers.scopedId(val) && !val.depth) {
2820
- blockParamIndex = this.blockParamIndex(val.parts[0]);
2840
+ if (val.parts && !_ast2["default"].helpers.scopedId(val) && !depth) {
2841
+ blockParamIndex = this.blockParamIndex(validateParts(val)[0]);
2821
2842
  }
2822
2843
  if (blockParamIndex) {
2823
2844
  var blockParamChild = val.parts.slice(1).join(".");
@@ -2905,6 +2926,48 @@ var require_compiler = __commonJS({
2905
2926
  };
2906
2927
  return ret;
2907
2928
  }
2929
+ function invalidAst(node, message) {
2930
+ return new _exception2["default"]("Invalid AST: " + node.type + " " + message, node);
2931
+ }
2932
+ function validateDepth(node) {
2933
+ var depth = node.depth;
2934
+ if (depth == null) {
2935
+ return 0;
2936
+ }
2937
+ if (typeof depth !== "number" || !isFinite(depth) || Math.floor(depth) !== depth || depth < 0) {
2938
+ throw invalidAst(node, "depth must be a non-negative integer");
2939
+ }
2940
+ return depth;
2941
+ }
2942
+ function validateLiteral(node) {
2943
+ var value = node.value;
2944
+ if (node.type === "StringLiteral" && typeof value !== "string") {
2945
+ throw invalidAst(node, "value must be a string");
2946
+ } else if (node.type === "NumberLiteral" && typeof value !== "number") {
2947
+ throw invalidAst(node, "value must be a number");
2948
+ } else if (node.type === "BooleanLiteral" && typeof value !== "boolean") {
2949
+ throw invalidAst(node, "value must be a boolean");
2950
+ }
2951
+ }
2952
+ function validateStringArray(node, value, name) {
2953
+ if (!_utils.isArray(value)) {
2954
+ throw invalidAst(node, name + " must be an array");
2955
+ }
2956
+ for (var i = 0; i < value.length; i++) {
2957
+ if (typeof value[i] !== "string") {
2958
+ throw invalidAst(node, name + " must only contain strings");
2959
+ }
2960
+ }
2961
+ return value;
2962
+ }
2963
+ function validateParts(path) {
2964
+ return validateStringArray(path, path.parts, "parts");
2965
+ }
2966
+ function validateBlockParams(program) {
2967
+ if (program.blockParams != null) {
2968
+ validateStringArray(program, program.blockParams, "blockParams");
2969
+ }
2970
+ }
2908
2971
  function argEquals(a, b) {
2909
2972
  if (a === b) {
2910
2973
  return true;
@@ -2934,9 +2997,9 @@ var require_compiler = __commonJS({
2934
2997
  }
2935
2998
  });
2936
2999
 
2937
- // ../../node_modules/handlebars/node_modules/source-map/lib/base64.js
3000
+ // node_modules/source-map/lib/base64.js
2938
3001
  var require_base64 = __commonJS({
2939
- "../../node_modules/handlebars/node_modules/source-map/lib/base64.js"(exports) {
3002
+ "node_modules/source-map/lib/base64.js"(exports) {
2940
3003
  "use strict";
2941
3004
  var intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
2942
3005
  exports.encode = function(number) {
@@ -2976,9 +3039,9 @@ var require_base64 = __commonJS({
2976
3039
  }
2977
3040
  });
2978
3041
 
2979
- // ../../node_modules/handlebars/node_modules/source-map/lib/base64-vlq.js
3042
+ // node_modules/source-map/lib/base64-vlq.js
2980
3043
  var require_base64_vlq = __commonJS({
2981
- "../../node_modules/handlebars/node_modules/source-map/lib/base64-vlq.js"(exports) {
3044
+ "node_modules/source-map/lib/base64-vlq.js"(exports) {
2982
3045
  "use strict";
2983
3046
  var base64 = require_base64();
2984
3047
  var VLQ_BASE_SHIFT = 5;
@@ -3031,9 +3094,9 @@ var require_base64_vlq = __commonJS({
3031
3094
  }
3032
3095
  });
3033
3096
 
3034
- // ../../node_modules/handlebars/node_modules/source-map/lib/util.js
3097
+ // node_modules/source-map/lib/util.js
3035
3098
  var require_util = __commonJS({
3036
- "../../node_modules/handlebars/node_modules/source-map/lib/util.js"(exports) {
3099
+ "node_modules/source-map/lib/util.js"(exports) {
3037
3100
  "use strict";
3038
3101
  function getArg(aArgs, aName, aDefaultValue) {
3039
3102
  if (aName in aArgs) {
@@ -3333,9 +3396,9 @@ var require_util = __commonJS({
3333
3396
  }
3334
3397
  });
3335
3398
 
3336
- // ../../node_modules/handlebars/node_modules/source-map/lib/array-set.js
3399
+ // node_modules/source-map/lib/array-set.js
3337
3400
  var require_array_set = __commonJS({
3338
- "../../node_modules/handlebars/node_modules/source-map/lib/array-set.js"(exports) {
3401
+ "node_modules/source-map/lib/array-set.js"(exports) {
3339
3402
  "use strict";
3340
3403
  var util = require_util();
3341
3404
  var has = Object.prototype.hasOwnProperty;
@@ -3404,9 +3467,9 @@ var require_array_set = __commonJS({
3404
3467
  }
3405
3468
  });
3406
3469
 
3407
- // ../../node_modules/handlebars/node_modules/source-map/lib/mapping-list.js
3470
+ // node_modules/source-map/lib/mapping-list.js
3408
3471
  var require_mapping_list = __commonJS({
3409
- "../../node_modules/handlebars/node_modules/source-map/lib/mapping-list.js"(exports) {
3472
+ "node_modules/source-map/lib/mapping-list.js"(exports) {
3410
3473
  "use strict";
3411
3474
  var util = require_util();
3412
3475
  function generatedPositionAfter(mappingA, mappingB) {
@@ -3444,9 +3507,9 @@ var require_mapping_list = __commonJS({
3444
3507
  }
3445
3508
  });
3446
3509
 
3447
- // ../../node_modules/handlebars/node_modules/source-map/lib/source-map-generator.js
3510
+ // node_modules/source-map/lib/source-map-generator.js
3448
3511
  var require_source_map_generator = __commonJS({
3449
- "../../node_modules/handlebars/node_modules/source-map/lib/source-map-generator.js"(exports) {
3512
+ "node_modules/source-map/lib/source-map-generator.js"(exports) {
3450
3513
  "use strict";
3451
3514
  var base64VLQ = require_base64_vlq();
3452
3515
  var util = require_util();
@@ -3721,9 +3784,9 @@ var require_source_map_generator = __commonJS({
3721
3784
  }
3722
3785
  });
3723
3786
 
3724
- // ../../node_modules/handlebars/node_modules/source-map/lib/binary-search.js
3787
+ // node_modules/source-map/lib/binary-search.js
3725
3788
  var require_binary_search = __commonJS({
3726
- "../../node_modules/handlebars/node_modules/source-map/lib/binary-search.js"(exports) {
3789
+ "node_modules/source-map/lib/binary-search.js"(exports) {
3727
3790
  "use strict";
3728
3791
  exports.GREATEST_LOWER_BOUND = 1;
3729
3792
  exports.LEAST_UPPER_BOUND = 2;
@@ -3778,9 +3841,9 @@ var require_binary_search = __commonJS({
3778
3841
  }
3779
3842
  });
3780
3843
 
3781
- // ../../node_modules/handlebars/node_modules/source-map/lib/quick-sort.js
3844
+ // node_modules/source-map/lib/quick-sort.js
3782
3845
  var require_quick_sort = __commonJS({
3783
- "../../node_modules/handlebars/node_modules/source-map/lib/quick-sort.js"(exports) {
3846
+ "node_modules/source-map/lib/quick-sort.js"(exports) {
3784
3847
  "use strict";
3785
3848
  function swap(ary, x, y) {
3786
3849
  var temp = ary[x];
@@ -3814,9 +3877,9 @@ var require_quick_sort = __commonJS({
3814
3877
  }
3815
3878
  });
3816
3879
 
3817
- // ../../node_modules/handlebars/node_modules/source-map/lib/source-map-consumer.js
3880
+ // node_modules/source-map/lib/source-map-consumer.js
3818
3881
  var require_source_map_consumer = __commonJS({
3819
- "../../node_modules/handlebars/node_modules/source-map/lib/source-map-consumer.js"(exports) {
3882
+ "node_modules/source-map/lib/source-map-consumer.js"(exports) {
3820
3883
  "use strict";
3821
3884
  var util = require_util();
3822
3885
  var binarySearch = require_binary_search();
@@ -4416,9 +4479,9 @@ var require_source_map_consumer = __commonJS({
4416
4479
  }
4417
4480
  });
4418
4481
 
4419
- // ../../node_modules/handlebars/node_modules/source-map/lib/source-node.js
4482
+ // node_modules/source-map/lib/source-node.js
4420
4483
  var require_source_node = __commonJS({
4421
- "../../node_modules/handlebars/node_modules/source-map/lib/source-node.js"(exports) {
4484
+ "node_modules/source-map/lib/source-node.js"(exports) {
4422
4485
  "use strict";
4423
4486
  var SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
4424
4487
  var util = require_util();
@@ -4682,9 +4745,9 @@ var require_source_node = __commonJS({
4682
4745
  }
4683
4746
  });
4684
4747
 
4685
- // ../../node_modules/handlebars/node_modules/source-map/source-map.js
4748
+ // node_modules/source-map/source-map.js
4686
4749
  var require_source_map = __commonJS({
4687
- "../../node_modules/handlebars/node_modules/source-map/source-map.js"(exports) {
4750
+ "node_modules/source-map/source-map.js"(exports) {
4688
4751
  "use strict";
4689
4752
  exports.SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
4690
4753
  exports.SourceMapConsumer = require_source_map_consumer().SourceMapConsumer;
@@ -4692,12 +4755,24 @@ var require_source_map = __commonJS({
4692
4755
  }
4693
4756
  });
4694
4757
 
4695
- // ../../node_modules/handlebars/dist/cjs/handlebars/compiler/code-gen.js
4758
+ // node_modules/handlebars/dist/cjs/handlebars/compiler/code-gen.js
4696
4759
  var require_code_gen = __commonJS({
4697
- "../../node_modules/handlebars/dist/cjs/handlebars/compiler/code-gen.js"(exports, module) {
4760
+ "node_modules/handlebars/dist/cjs/handlebars/compiler/code-gen.js"(exports) {
4698
4761
  "use strict";
4699
4762
  exports.__esModule = true;
4763
+ exports.safeJsonLiteral = safeJsonLiteral;
4700
4764
  var _utils = require_utils();
4765
+ var NEEDS_ESCAPING = /[\x00-\x1f\\"\u2028\u2029<\ud800-\udfff]/;
4766
+ var SCRIPT_DELIMITERS = /<(?=!--|\/?script)/gi;
4767
+ function escapeScriptDelimiters(code) {
4768
+ return code.replace(SCRIPT_DELIMITERS, "\\u003C");
4769
+ }
4770
+ function escapeSurrogate(surrogate) {
4771
+ return "\\u" + surrogate.charCodeAt(0).toString(16);
4772
+ }
4773
+ function safeJsonLiteral(value) {
4774
+ return escapeScriptDelimiters(JSON.stringify(value).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/[\ud800-\udfff]/g, escapeSurrogate));
4775
+ }
4701
4776
  var SourceNode = void 0;
4702
4777
  try {
4703
4778
  if (typeof define !== "function" || !define.amd) {
@@ -4790,7 +4865,11 @@ var require_code_gen = __commonJS({
4790
4865
  return this.wrap([fn, type ? "." + type + "(" : "(", params, ")"]);
4791
4866
  },
4792
4867
  quotedString: function quotedString(str) {
4793
- return '"' + (str + "").replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029") + '"';
4868
+ str = str + "";
4869
+ if (!NEEDS_ESCAPING.test(str)) {
4870
+ return '"' + str + '"';
4871
+ }
4872
+ return safeJsonLiteral(str);
4794
4873
  },
4795
4874
  objectLiteral: function objectLiteral(obj) {
4796
4875
  var _this = this;
@@ -4824,13 +4903,12 @@ var require_code_gen = __commonJS({
4824
4903
  }
4825
4904
  };
4826
4905
  exports["default"] = CodeGen;
4827
- module.exports = exports["default"];
4828
4906
  }
4829
4907
  });
4830
4908
 
4831
- // ../../node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js
4909
+ // node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js
4832
4910
  var require_javascript_compiler = __commonJS({
4833
- "../../node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js"(exports, module) {
4911
+ "node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js"(exports, module) {
4834
4912
  "use strict";
4835
4913
  exports.__esModule = true;
4836
4914
  function _interopRequireDefault(obj) {
@@ -4854,7 +4932,7 @@ var require_javascript_compiler = __commonJS({
4854
4932
  return this.internalNameLookup(parent, name);
4855
4933
  },
4856
4934
  depthedLookup: function depthedLookup(name) {
4857
- return [this.aliasable("container.lookup"), "(depths, ", JSON.stringify(name), ")"];
4935
+ return [this.aliasable("container.lookup"), "(depths, ", this.quotedString(name), ")"];
4858
4936
  },
4859
4937
  compilerInfo: function compilerInfo() {
4860
4938
  var revision = _base.COMPILER_REVISION, versions = _base.REVISION_CHANGES[revision];
@@ -4880,7 +4958,7 @@ var require_javascript_compiler = __commonJS({
4880
4958
  // END PUBLIC API
4881
4959
  internalNameLookup: function internalNameLookup(parent, name) {
4882
4960
  this.lookupPropertyFunctionIsUsed = true;
4883
- return ["lookupProperty(", parent, ",", JSON.stringify(name), ")"];
4961
+ return ["lookupProperty(", parent, ",", this.quotedString(name), ")"];
4884
4962
  },
4885
4963
  lookupPropertyFunctionIsUsed: false,
4886
4964
  compile: function compile(environment, options, context, asObject) {
@@ -5419,7 +5497,7 @@ var require_javascript_compiler = __commonJS({
5419
5497
  delete options.name;
5420
5498
  }
5421
5499
  if (indent) {
5422
- options.indent = JSON.stringify(indent);
5500
+ options.indent = this.quotedString(indent);
5423
5501
  }
5424
5502
  options.helpers = "helpers";
5425
5503
  options.partials = "partials";
@@ -5465,7 +5543,7 @@ var require_javascript_compiler = __commonJS({
5465
5543
  },
5466
5544
  pushId: function pushId(type, name, child) {
5467
5545
  if (type === "BlockParam") {
5468
- this.pushStackLiteral("blockParams[" + name[0] + "].path[" + name[1] + "]" + (child ? " + " + JSON.stringify("." + child) : ""));
5546
+ this.pushStackLiteral("blockParams[" + name[0] + "].path[" + name[1] + "]" + (child ? " + " + this.quotedString("." + child) : ""));
5469
5547
  } else if (type === "PathExpression") {
5470
5548
  this.pushString(name);
5471
5549
  } else if (type === "SubExpression") {
@@ -5703,7 +5781,7 @@ var require_javascript_compiler = __commonJS({
5703
5781
  },
5704
5782
  setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) {
5705
5783
  var options = this.setupParams(helper, paramSize, params);
5706
- options.loc = JSON.stringify(this.source.currentLocation);
5784
+ options.loc = locationLiteral(this);
5707
5785
  options = this.objectLiteral(options);
5708
5786
  if (useRegister) {
5709
5787
  this.useRegister("options");
@@ -5727,6 +5805,10 @@ var require_javascript_compiler = __commonJS({
5727
5805
  JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
5728
5806
  return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name);
5729
5807
  };
5808
+ function locationLiteral(compiler) {
5809
+ var loc = compiler.source.currentLocation;
5810
+ return loc ? _codeGen.safeJsonLiteral(loc) : "undefined";
5811
+ }
5730
5812
  function strictLookup(requireTerminal, compiler, parts, startPartIndex, type) {
5731
5813
  var stack = compiler.popStack(), len = parts.length;
5732
5814
  if (requireTerminal) {
@@ -5736,7 +5818,7 @@ var require_javascript_compiler = __commonJS({
5736
5818
  stack = compiler.nameLookup(stack, parts[i], type);
5737
5819
  }
5738
5820
  if (requireTerminal) {
5739
- return [compiler.aliasable("container.strict"), "(", stack, ", ", compiler.quotedString(parts[len]), ", ", JSON.stringify(compiler.source.currentLocation), " )"];
5821
+ return [compiler.aliasable("container.strict"), "(", stack, ", ", compiler.quotedString(parts[len]), ", ", locationLiteral(compiler), " )"];
5740
5822
  } else {
5741
5823
  return stack;
5742
5824
  }
@@ -5746,9 +5828,9 @@ var require_javascript_compiler = __commonJS({
5746
5828
  }
5747
5829
  });
5748
5830
 
5749
- // ../../node_modules/handlebars/dist/cjs/handlebars.js
5831
+ // node_modules/handlebars/dist/cjs/handlebars.js
5750
5832
  var require_handlebars = __commonJS({
5751
- "../../node_modules/handlebars/dist/cjs/handlebars.js"(exports, module) {
5833
+ "node_modules/handlebars/dist/cjs/handlebars.js"(exports, module) {
5752
5834
  "use strict";
5753
5835
  exports.__esModule = true;
5754
5836
  function _interopRequireDefault(obj) {
@@ -5793,9 +5875,9 @@ var require_handlebars = __commonJS({
5793
5875
  }
5794
5876
  });
5795
5877
 
5796
- // ../../node_modules/handlebars/dist/cjs/handlebars/compiler/printer.js
5878
+ // node_modules/handlebars/dist/cjs/handlebars/compiler/printer.js
5797
5879
  var require_printer = __commonJS({
5798
- "../../node_modules/handlebars/dist/cjs/handlebars/compiler/printer.js"(exports) {
5880
+ "node_modules/handlebars/dist/cjs/handlebars/compiler/printer.js"(exports) {
5799
5881
  "use strict";
5800
5882
  exports.__esModule = true;
5801
5883
  exports.print = print;
@@ -5939,9 +6021,9 @@ var require_printer = __commonJS({
5939
6021
  }
5940
6022
  });
5941
6023
 
5942
- // ../../node_modules/handlebars/lib/index.js
6024
+ // node_modules/handlebars/lib/index.js
5943
6025
  var require_lib = __commonJS({
5944
- "../../node_modules/handlebars/lib/index.js"(exports, module) {
6026
+ "node_modules/handlebars/lib/index.js"(exports, module) {
5945
6027
  "use strict";
5946
6028
  var handlebars = require_handlebars()["default"];
5947
6029
  var printer = require_printer();
@@ -7037,7 +7119,11 @@ async function runTask(adapter, taskId, context, options) {
7037
7119
  } catch (err) {
7038
7120
  closeStatus = "error";
7039
7121
  closeCause = `SDK error: ${err.message}`;
7040
- return { outcome: { status: "error", message: closeCause }, follow_ups_used: 0, retries_used: 0 };
7122
+ return {
7123
+ outcome: { status: "error", message: closeCause, kind: adapterErrorKind(err) },
7124
+ follow_ups_used: 0,
7125
+ retries_used: 0
7126
+ };
7041
7127
  }
7042
7128
  let outcome = attachMemoryRef(validateOutput(fullOutput, task, schemas), adapter);
7043
7129
  outcome = await pluginRegistry.runAfterTask(taskId, outcome);
@@ -7070,7 +7156,11 @@ ${followUpPrompt}`
7070
7156
  fullOutput = await adapter.send(retryFullPrompt, { readonly: isReadonly, agents });
7071
7157
  }
7072
7158
  } catch (err) {
7073
- outcome = { status: "error", message: `SDK error on followUp ${followUpsUsed}: ${err.message}` };
7159
+ outcome = {
7160
+ status: "error",
7161
+ message: `SDK error on followUp ${followUpsUsed}: ${err.message}`,
7162
+ kind: adapterErrorKind(err)
7163
+ };
7074
7164
  continue;
7075
7165
  }
7076
7166
  } else {
@@ -7088,7 +7178,11 @@ Please re-execute the entire task.`
7088
7178
  try {
7089
7179
  fullOutput = await adapter.send(retryFullPrompt, { readonly: isReadonly, agents });
7090
7180
  } catch (err) {
7091
- outcome = { status: "error", message: `SDK error on retry ${retriesUsed}: ${err.message}` };
7181
+ outcome = {
7182
+ status: "error",
7183
+ message: `SDK error on retry ${retriesUsed}: ${err.message}`,
7184
+ kind: adapterErrorKind(err)
7185
+ };
7092
7186
  continue;
7093
7187
  }
7094
7188
  }
@@ -8437,7 +8531,7 @@ var ADAPTER_PACKAGES = {
8437
8531
  openai: "@openai/agents"
8438
8532
  };
8439
8533
  async function createAdapter(name, options) {
8440
- const { model, cwd, tools, permissionMode, guardrailHooks } = options ?? {};
8534
+ const { model, cwd, tools, permissionMode, guardrailHooks, signal, pathToClaudeCodeExecutable } = options ?? {};
8441
8535
  switch (name) {
8442
8536
  case "mock": {
8443
8537
  const { MockAdapter } = await import("./adapters/mock.js");
@@ -8451,7 +8545,9 @@ async function createAdapter(name, options) {
8451
8545
  ...model ? { model } : {},
8452
8546
  ...cwd ? { cwd } : {},
8453
8547
  ...tools ? { tools } : {},
8454
- ...permissionMode ? { permissionMode } : {}
8548
+ ...permissionMode ? { permissionMode } : {},
8549
+ ...signal ? { signal } : {},
8550
+ ...pathToClaudeCodeExecutable ? { pathToClaudeCodeExecutable } : {}
8455
8551
  });
8456
8552
  } catch (err) {
8457
8553
  throwMissingPackageError("claude", err);
@@ -8473,7 +8569,8 @@ async function createAdapter(name, options) {
8473
8569
  const { OpenAIAgentsSdkAdapter } = await import("./adapters/openai-agents-sdk.js");
8474
8570
  return new OpenAIAgentsSdkAdapter({
8475
8571
  guardrailHooks,
8476
- ...model ? { model } : {}
8572
+ ...model ? { model } : {},
8573
+ ...signal ? { signal } : {}
8477
8574
  });
8478
8575
  } catch (err) {
8479
8576
  throwMissingPackageError("openai", err);
@@ -10843,6 +10940,7 @@ var require2 = createRequire(import.meta.url);
10843
10940
  var pkg = require2("../package.json");
10844
10941
  var version = pkg.version;
10845
10942
  export {
10943
+ AdapterError,
10846
10944
  AgentLogWriter,
10847
10945
  BoundResolver,
10848
10946
  DEFAULT_COMPONENT_ID,
@@ -10857,6 +10955,7 @@ export {
10857
10955
  UnresolvedScopeDeclarationError,
10858
10956
  WORKFLOW_INPUT_STEP_ID,
10859
10957
  WorkflowBuilder,
10958
+ adapterErrorKind,
10860
10959
  buildCandidateAgents,
10861
10960
  buildGateEvaluationPrompt,
10862
10961
  buildNavigationContext,