@digipair/skill-dsp 0.72.8 → 0.72.14

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/index.cjs.js CHANGED
@@ -114935,10 +114935,10 @@ var apiCall = function() {
114935
114935
  timeoutMs = (_api_timeout = api.timeout) !== null && _api_timeout !== void 0 ? _api_timeout : defaultTimeoutMs;
114936
114936
  metrics = createRequestMetrics();
114937
114937
  baseUrl = new URL((_process_env_PROXY = process.env["PROXY"]) !== null && _process_env_PROXY !== void 0 ? _process_env_PROXY : api.url);
114938
- apiPath = [
114938
+ apiPath = "".concat([
114939
114939
  baseUrl.pathname,
114940
114940
  api.name
114941
- ].filter(Boolean).join("/").replace(/\/+/g, "/");
114941
+ ].filter(Boolean).join("/").replace(/\/+/g, "/")).concat(baseUrl.search);
114942
114942
  apiUrl = new URL(apiPath, baseUrl);
114943
114943
  requestId = crypto.randomUUID();
114944
114944
  if (!api.validateRequest) return [
@@ -120415,16 +120415,36 @@ var validateValue = function(field, value) {
120415
120415
  };
120416
120416
  function mergeProgramUsage(usages) {
120417
120417
  var usageMap = {};
120418
- usages.forEach(function(usage) {
120419
- var key = "".concat(usage.ai, ":").concat(usage.model);
120420
- if (!usageMap[key]) {
120421
- usageMap[key] = _object_spread({}, usage);
120422
- return;
120418
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
120419
+ try {
120420
+ for(var _iterator = usages[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
120421
+ var usage = _step.value;
120422
+ var key = "".concat(usage.ai, ":").concat(usage.model);
120423
+ if (!usageMap[key]) {
120424
+ usageMap[key] = _object_spread({}, usage);
120425
+ continue;
120426
+ }
120427
+ var currentUsage = usageMap[key];
120428
+ if (currentUsage) {
120429
+ currentUsage.promptTokens += usage.promptTokens;
120430
+ currentUsage.completionTokens += usage.completionTokens;
120431
+ currentUsage.totalTokens += usage.totalTokens;
120432
+ }
120423
120433
  }
120424
- usageMap[key].promptTokens += usage.promptTokens;
120425
- usageMap[key].completionTokens += usage.completionTokens;
120426
- usageMap[key].totalTokens += usage.totalTokens;
120427
- });
120434
+ } catch (err) {
120435
+ _didIteratorError = true;
120436
+ _iteratorError = err;
120437
+ } finally{
120438
+ try {
120439
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
120440
+ _iterator.return();
120441
+ }
120442
+ } finally{
120443
+ if (_didIteratorError) {
120444
+ throw _iteratorError;
120445
+ }
120446
+ }
120447
+ }
120428
120448
  return Object.values(usageMap);
120429
120449
  }
120430
120450
  var parseMarkdownList = function(input) {
@@ -120451,9 +120471,7 @@ var parseMarkdownList = function(input) {
120451
120471
  list.push(trimmedLine.slice(1).trim());
120452
120472
  } else if (numberedListRegex.test(trimmedLine)) {
120453
120473
  list.push(trimmedLine.replace(numberedListRegex, "").trim());
120454
- } else if (list.length === 0) {
120455
- continue;
120456
- } else {
120474
+ } else if (list.length === 0) {} else {
120457
120475
  throw new Error("Could not parse markdown list: mixed content detected");
120458
120476
  }
120459
120477
  }
@@ -120570,7 +120588,7 @@ function matchesContent(content, prefix) {
120570
120588
  var contentEnd = content.slice(Math.max(startIndex, content.length - prefix.length));
120571
120589
  for(var i = 0; i < prefixes.length - 1; i++){
120572
120590
  var partialPrefix = prefixes[i];
120573
- if (contentEnd.endsWith(partialPrefix)) {
120591
+ if (partialPrefix && contentEnd.endsWith(partialPrefix)) {
120574
120592
  return -2;
120575
120593
  }
120576
120594
  }
@@ -120887,7 +120905,7 @@ var AxPromptTemplate = function AxPromptTemplate(sig, functions, fieldTemplates)
120887
120905
  var renderedExamples = examples ? [
120888
120906
  {
120889
120907
  type: "text",
120890
- text: "## Examples:\n"
120908
+ text: "\n\n## Examples\n"
120891
120909
  }
120892
120910
  ].concat(_to_consumable_array(_this.renderExamples(examples))) : [];
120893
120911
  var renderedDemos = demos ? _this.renderDemos(demos) : [];
@@ -120982,6 +121000,7 @@ var AxPromptTemplate = function AxPromptTemplate(sig, functions, fieldTemplates)
120982
121000
  try {
120983
121001
  var _loop = function() {
120984
121002
  var _step_value = _sliced_to_array(_step.value, 2), index = _step_value[0], item = _step_value[1];
121003
+ var _renderedItem_;
120985
121004
  var renderedInputItem = _this.sig.getInputFields().map(function(field) {
120986
121005
  return _this.renderInField(field, item, true);
120987
121006
  }).filter(function(v) {
@@ -120996,6 +121015,12 @@ var AxPromptTemplate = function AxPromptTemplate(sig, functions, fieldTemplates)
120996
121015
  throw new Error("Output fields are required in examples: index: ".concat(index, ", data: ").concat(JSON.stringify(item)));
120997
121016
  }
120998
121017
  var renderedItem = _to_consumable_array(renderedInputItem).concat(_to_consumable_array(renderedOutputItem));
121018
+ if (index > 0 && renderedItem.length > 0 && ((_renderedItem_ = renderedItem[0]) === null || _renderedItem_ === void 0 ? void 0 : _renderedItem_.type) === "text") {
121019
+ list.push({
121020
+ type: "text",
121021
+ text: "---\n\n"
121022
+ });
121023
+ }
120999
121024
  renderedItem.forEach(function(v) {
121000
121025
  if ("text" in v) {
121001
121026
  v.text = v.text + "\n";
@@ -121278,10 +121303,7 @@ var processValue = function(field, value) {
121278
121303
  if (typeof value === "string") {
121279
121304
  return value;
121280
121305
  }
121281
- if (Array.isArray(value)) {
121282
- return value;
121283
- }
121284
- return JSON.stringify(value);
121306
+ return JSON.stringify(value, null, 2);
121285
121307
  };
121286
121308
  var toFieldType = function(type) {
121287
121309
  var baseType = function() {
@@ -122775,6 +122797,12 @@ var AxGen = /*#__PURE__*/ function(AxProgramWithSignature) {
122775
122797
  delta: result.content
122776
122798
  }, sessionId);
122777
122799
  skip = streamingExtractValues(_this.signature, values, xstate, content, streamingValidation);
122800
+ if (skip) {
122801
+ return [
122802
+ 3,
122803
+ 12
122804
+ ];
122805
+ }
122778
122806
  if (!(_this.streamingAsserts.length !== 0)) return [
122779
122807
  3,
122780
122808
  6
@@ -122805,12 +122833,6 @@ var AxGen = /*#__PURE__*/ function(AxProgramWithSignature) {
122805
122833
  ];
122806
122834
  case 9:
122807
122835
  _state.sent();
122808
- if (skip) {
122809
- return [
122810
- 3,
122811
- 12
122812
- ];
122813
- }
122814
122836
  return [
122815
122837
  4,
122816
122838
  _await_async_generator(assertAssertions(_this.asserts, values))
package/index.esm.js CHANGED
@@ -23951,14 +23951,14 @@ function indent(str, spaces) {
23951
23951
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23952
23952
  // match is required
23953
23953
  if (!match) {
23954
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23954
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23955
23955
  v: nextMatch1
23956
23956
  };
23957
23957
  }
23958
23958
  var token = match.token, offset = match.offset;
23959
23959
  i1 += offset;
23960
23960
  if (token === " ") {
23961
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23961
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23962
23962
  }
23963
23963
  tokens1 = _to_consumable_array$5(tokens1).concat([
23964
23964
  token
@@ -23977,7 +23977,7 @@ function indent(str, spaces) {
23977
23977
  if (contextKeys.some(function(el) {
23978
23978
  return el.startsWith(name);
23979
23979
  })) {
23980
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23980
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23981
23981
  }
23982
23982
  if (dateTimeIdentifiers.some(function(el) {
23983
23983
  return el === name;
@@ -23996,9 +23996,9 @@ function indent(str, spaces) {
23996
23996
  if (dateTimeIdentifiers.some(function(el) {
23997
23997
  return el.startsWith(name);
23998
23998
  })) {
23999
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23999
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
24000
24000
  }
24001
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
24001
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
24002
24002
  v: nextMatch1
24003
24003
  };
24004
24004
  };
@@ -142874,10 +142874,10 @@ var apiCall = function() {
142874
142874
  timeoutMs = (_api_timeout = api.timeout) !== null && _api_timeout !== void 0 ? _api_timeout : defaultTimeoutMs;
142875
142875
  metrics = createRequestMetrics();
142876
142876
  baseUrl = new URL((_process_env_PROXY = process.env["PROXY"]) !== null && _process_env_PROXY !== void 0 ? _process_env_PROXY : api.url);
142877
- apiPath = [
142877
+ apiPath = "".concat([
142878
142878
  baseUrl.pathname,
142879
142879
  api.name
142880
- ].filter(Boolean).join("/").replace(/\/+/g, "/");
142880
+ ].filter(Boolean).join("/").replace(/\/+/g, "/")).concat(baseUrl.search);
142881
142881
  apiUrl = new URL(apiPath, baseUrl);
142882
142882
  requestId = crypto.randomUUID();
142883
142883
  if (!api.validateRequest) return [
@@ -148354,16 +148354,36 @@ var validateValue = function(field, value) {
148354
148354
  };
148355
148355
  function mergeProgramUsage(usages) {
148356
148356
  var usageMap = {};
148357
- usages.forEach(function(usage) {
148358
- var key = "".concat(usage.ai, ":").concat(usage.model);
148359
- if (!usageMap[key]) {
148360
- usageMap[key] = _object_spread({}, usage);
148361
- return;
148357
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
148358
+ try {
148359
+ for(var _iterator = usages[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
148360
+ var usage = _step.value;
148361
+ var key = "".concat(usage.ai, ":").concat(usage.model);
148362
+ if (!usageMap[key]) {
148363
+ usageMap[key] = _object_spread({}, usage);
148364
+ continue;
148365
+ }
148366
+ var currentUsage = usageMap[key];
148367
+ if (currentUsage) {
148368
+ currentUsage.promptTokens += usage.promptTokens;
148369
+ currentUsage.completionTokens += usage.completionTokens;
148370
+ currentUsage.totalTokens += usage.totalTokens;
148371
+ }
148362
148372
  }
148363
- usageMap[key].promptTokens += usage.promptTokens;
148364
- usageMap[key].completionTokens += usage.completionTokens;
148365
- usageMap[key].totalTokens += usage.totalTokens;
148366
- });
148373
+ } catch (err) {
148374
+ _didIteratorError = true;
148375
+ _iteratorError = err;
148376
+ } finally{
148377
+ try {
148378
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
148379
+ _iterator.return();
148380
+ }
148381
+ } finally{
148382
+ if (_didIteratorError) {
148383
+ throw _iteratorError;
148384
+ }
148385
+ }
148386
+ }
148367
148387
  return Object.values(usageMap);
148368
148388
  }
148369
148389
  var parseMarkdownList = function(input) {
@@ -148390,9 +148410,7 @@ var parseMarkdownList = function(input) {
148390
148410
  list.push(trimmedLine.slice(1).trim());
148391
148411
  } else if (numberedListRegex.test(trimmedLine)) {
148392
148412
  list.push(trimmedLine.replace(numberedListRegex, "").trim());
148393
- } else if (list.length === 0) {
148394
- continue;
148395
- } else {
148413
+ } else if (list.length === 0) {} else {
148396
148414
  throw new Error("Could not parse markdown list: mixed content detected");
148397
148415
  }
148398
148416
  }
@@ -148509,7 +148527,7 @@ function matchesContent(content, prefix) {
148509
148527
  var contentEnd = content.slice(Math.max(startIndex, content.length - prefix.length));
148510
148528
  for(var i = 0; i < prefixes.length - 1; i++){
148511
148529
  var partialPrefix = prefixes[i];
148512
- if (contentEnd.endsWith(partialPrefix)) {
148530
+ if (partialPrefix && contentEnd.endsWith(partialPrefix)) {
148513
148531
  return -2;
148514
148532
  }
148515
148533
  }
@@ -148826,7 +148844,7 @@ var AxPromptTemplate = function AxPromptTemplate(sig, functions, fieldTemplates)
148826
148844
  var renderedExamples = examples ? [
148827
148845
  {
148828
148846
  type: "text",
148829
- text: "## Examples:\n"
148847
+ text: "\n\n## Examples\n"
148830
148848
  }
148831
148849
  ].concat(_to_consumable_array(_this.renderExamples(examples))) : [];
148832
148850
  var renderedDemos = demos ? _this.renderDemos(demos) : [];
@@ -148921,6 +148939,7 @@ var AxPromptTemplate = function AxPromptTemplate(sig, functions, fieldTemplates)
148921
148939
  try {
148922
148940
  var _loop = function() {
148923
148941
  var _step_value = _sliced_to_array(_step.value, 2), index = _step_value[0], item = _step_value[1];
148942
+ var _renderedItem_;
148924
148943
  var renderedInputItem = _this.sig.getInputFields().map(function(field) {
148925
148944
  return _this.renderInField(field, item, true);
148926
148945
  }).filter(function(v) {
@@ -148935,6 +148954,12 @@ var AxPromptTemplate = function AxPromptTemplate(sig, functions, fieldTemplates)
148935
148954
  throw new Error("Output fields are required in examples: index: ".concat(index, ", data: ").concat(JSON.stringify(item)));
148936
148955
  }
148937
148956
  var renderedItem = _to_consumable_array(renderedInputItem).concat(_to_consumable_array(renderedOutputItem));
148957
+ if (index > 0 && renderedItem.length > 0 && ((_renderedItem_ = renderedItem[0]) === null || _renderedItem_ === void 0 ? void 0 : _renderedItem_.type) === "text") {
148958
+ list.push({
148959
+ type: "text",
148960
+ text: "---\n\n"
148961
+ });
148962
+ }
148938
148963
  renderedItem.forEach(function(v) {
148939
148964
  if ("text" in v) {
148940
148965
  v.text = v.text + "\n";
@@ -149217,10 +149242,7 @@ var processValue = function(field, value) {
149217
149242
  if (typeof value === "string") {
149218
149243
  return value;
149219
149244
  }
149220
- if (Array.isArray(value)) {
149221
- return value;
149222
- }
149223
- return JSON.stringify(value);
149245
+ return JSON.stringify(value, null, 2);
149224
149246
  };
149225
149247
  var toFieldType = function(type) {
149226
149248
  var baseType = function() {
@@ -150714,6 +150736,12 @@ var AxGen = /*#__PURE__*/ function(AxProgramWithSignature) {
150714
150736
  delta: result.content
150715
150737
  }, sessionId);
150716
150738
  skip = streamingExtractValues(_this.signature, values, xstate, content, streamingValidation);
150739
+ if (skip) {
150740
+ return [
150741
+ 3,
150742
+ 12
150743
+ ];
150744
+ }
150717
150745
  if (!(_this.streamingAsserts.length !== 0)) return [
150718
150746
  3,
150719
150747
  6
@@ -150744,12 +150772,6 @@ var AxGen = /*#__PURE__*/ function(AxProgramWithSignature) {
150744
150772
  ];
150745
150773
  case 9:
150746
150774
  _state.sent();
150747
- if (skip) {
150748
- return [
150749
- 3,
150750
- 12
150751
- ];
150752
- }
150753
150775
  return [
150754
150776
  4,
150755
150777
  _await_async_generator(assertAssertions(_this.asserts, values))
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@digipair/skill-dsp",
3
- "version": "0.72.8",
3
+ "version": "0.72.14",
4
4
  "dependencies": {
5
- "@ax-llm/ax": "^9.0.28"
5
+ "@ax-llm/ax": "^11.0.29"
6
6
  },
7
7
  "main": "./index.cjs.js",
8
8
  "module": "./index.esm.js"
File without changes
File without changes