@polka-codes/cli 0.9.78 → 0.9.80

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.
Files changed (2) hide show
  1. package/dist/index.js +1433 -264
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -13849,13 +13849,13 @@ var require_identity = __commonJS((exports) => {
13849
13849
 
13850
13850
  // ../../node_modules/yaml/dist/visit.js
13851
13851
  var require_visit = __commonJS((exports) => {
13852
- var identity2 = require_identity();
13852
+ var identity = require_identity();
13853
13853
  var BREAK = Symbol("break visit");
13854
13854
  var SKIP = Symbol("skip children");
13855
13855
  var REMOVE = Symbol("remove node");
13856
13856
  function visit(node, visitor) {
13857
13857
  const visitor_ = initVisitor(visitor);
13858
- if (identity2.isDocument(node)) {
13858
+ if (identity.isDocument(node)) {
13859
13859
  const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));
13860
13860
  if (cd === REMOVE)
13861
13861
  node.contents = null;
@@ -13867,12 +13867,12 @@ var require_visit = __commonJS((exports) => {
13867
13867
  visit.REMOVE = REMOVE;
13868
13868
  function visit_(key, node, visitor, path) {
13869
13869
  const ctrl = callVisitor(key, node, visitor, path);
13870
- if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
13870
+ if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
13871
13871
  replaceNode(key, path, ctrl);
13872
13872
  return visit_(key, ctrl, visitor, path);
13873
13873
  }
13874
13874
  if (typeof ctrl !== "symbol") {
13875
- if (identity2.isCollection(node)) {
13875
+ if (identity.isCollection(node)) {
13876
13876
  path = Object.freeze(path.concat(node));
13877
13877
  for (let i = 0;i < node.items.length; ++i) {
13878
13878
  const ci = visit_(i, node.items[i], visitor, path);
@@ -13885,7 +13885,7 @@ var require_visit = __commonJS((exports) => {
13885
13885
  i -= 1;
13886
13886
  }
13887
13887
  }
13888
- } else if (identity2.isPair(node)) {
13888
+ } else if (identity.isPair(node)) {
13889
13889
  path = Object.freeze(path.concat(node));
13890
13890
  const ck = visit_("key", node.key, visitor, path);
13891
13891
  if (ck === BREAK)
@@ -13903,7 +13903,7 @@ var require_visit = __commonJS((exports) => {
13903
13903
  }
13904
13904
  async function visitAsync(node, visitor) {
13905
13905
  const visitor_ = initVisitor(visitor);
13906
- if (identity2.isDocument(node)) {
13906
+ if (identity.isDocument(node)) {
13907
13907
  const cd = await visitAsync_(null, node.contents, visitor_, Object.freeze([node]));
13908
13908
  if (cd === REMOVE)
13909
13909
  node.contents = null;
@@ -13915,12 +13915,12 @@ var require_visit = __commonJS((exports) => {
13915
13915
  visitAsync.REMOVE = REMOVE;
13916
13916
  async function visitAsync_(key, node, visitor, path) {
13917
13917
  const ctrl = await callVisitor(key, node, visitor, path);
13918
- if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
13918
+ if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
13919
13919
  replaceNode(key, path, ctrl);
13920
13920
  return visitAsync_(key, ctrl, visitor, path);
13921
13921
  }
13922
13922
  if (typeof ctrl !== "symbol") {
13923
- if (identity2.isCollection(node)) {
13923
+ if (identity.isCollection(node)) {
13924
13924
  path = Object.freeze(path.concat(node));
13925
13925
  for (let i = 0;i < node.items.length; ++i) {
13926
13926
  const ci = await visitAsync_(i, node.items[i], visitor, path);
@@ -13933,7 +13933,7 @@ var require_visit = __commonJS((exports) => {
13933
13933
  i -= 1;
13934
13934
  }
13935
13935
  }
13936
- } else if (identity2.isPair(node)) {
13936
+ } else if (identity.isPair(node)) {
13937
13937
  path = Object.freeze(path.concat(node));
13938
13938
  const ck = await visitAsync_("key", node.key, visitor, path);
13939
13939
  if (ck === BREAK)
@@ -13970,31 +13970,31 @@ var require_visit = __commonJS((exports) => {
13970
13970
  function callVisitor(key, node, visitor, path) {
13971
13971
  if (typeof visitor === "function")
13972
13972
  return visitor(key, node, path);
13973
- if (identity2.isMap(node))
13973
+ if (identity.isMap(node))
13974
13974
  return visitor.Map?.(key, node, path);
13975
- if (identity2.isSeq(node))
13975
+ if (identity.isSeq(node))
13976
13976
  return visitor.Seq?.(key, node, path);
13977
- if (identity2.isPair(node))
13977
+ if (identity.isPair(node))
13978
13978
  return visitor.Pair?.(key, node, path);
13979
- if (identity2.isScalar(node))
13979
+ if (identity.isScalar(node))
13980
13980
  return visitor.Scalar?.(key, node, path);
13981
- if (identity2.isAlias(node))
13981
+ if (identity.isAlias(node))
13982
13982
  return visitor.Alias?.(key, node, path);
13983
13983
  return;
13984
13984
  }
13985
13985
  function replaceNode(key, path, node) {
13986
13986
  const parent = path[path.length - 1];
13987
- if (identity2.isCollection(parent)) {
13987
+ if (identity.isCollection(parent)) {
13988
13988
  parent.items[key] = node;
13989
- } else if (identity2.isPair(parent)) {
13989
+ } else if (identity.isPair(parent)) {
13990
13990
  if (key === "key")
13991
13991
  parent.key = node;
13992
13992
  else
13993
13993
  parent.value = node;
13994
- } else if (identity2.isDocument(parent)) {
13994
+ } else if (identity.isDocument(parent)) {
13995
13995
  parent.contents = node;
13996
13996
  } else {
13997
- const pt = identity2.isAlias(parent) ? "alias" : "scalar";
13997
+ const pt = identity.isAlias(parent) ? "alias" : "scalar";
13998
13998
  throw new Error(`Cannot replace node with ${pt} parent`);
13999
13999
  }
14000
14000
  }
@@ -14004,7 +14004,7 @@ var require_visit = __commonJS((exports) => {
14004
14004
 
14005
14005
  // ../../node_modules/yaml/dist/doc/directives.js
14006
14006
  var require_directives = __commonJS((exports) => {
14007
- var identity2 = require_identity();
14007
+ var identity = require_identity();
14008
14008
  var visit = require_visit();
14009
14009
  var escapeChars = {
14010
14010
  "!": "%21",
@@ -14130,10 +14130,10 @@ var require_directives = __commonJS((exports) => {
14130
14130
  const lines = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [];
14131
14131
  const tagEntries = Object.entries(this.tags);
14132
14132
  let tagNames;
14133
- if (doc2 && tagEntries.length > 0 && identity2.isNode(doc2.contents)) {
14133
+ if (doc2 && tagEntries.length > 0 && identity.isNode(doc2.contents)) {
14134
14134
  const tags = {};
14135
14135
  visit.visit(doc2.contents, (_key, node) => {
14136
- if (identity2.isNode(node) && node.tag)
14136
+ if (identity.isNode(node) && node.tag)
14137
14137
  tags[node.tag] = true;
14138
14138
  });
14139
14139
  tagNames = Object.keys(tags);
@@ -14156,7 +14156,7 @@ var require_directives = __commonJS((exports) => {
14156
14156
 
14157
14157
  // ../../node_modules/yaml/dist/doc/anchors.js
14158
14158
  var require_anchors = __commonJS((exports) => {
14159
- var identity2 = require_identity();
14159
+ var identity = require_identity();
14160
14160
  var visit = require_visit();
14161
14161
  function anchorIsValid(anchor) {
14162
14162
  if (/[\x00-\x19\s,[\]{}]/.test(anchor)) {
@@ -14166,9 +14166,9 @@ var require_anchors = __commonJS((exports) => {
14166
14166
  }
14167
14167
  return true;
14168
14168
  }
14169
- function anchorNames(root2) {
14169
+ function anchorNames(root) {
14170
14170
  const anchors = new Set;
14171
- visit.visit(root2, {
14171
+ visit.visit(root, {
14172
14172
  Value(_key, node) {
14173
14173
  if (node.anchor)
14174
14174
  anchors.add(node.anchor);
@@ -14198,7 +14198,7 @@ var require_anchors = __commonJS((exports) => {
14198
14198
  setAnchors: () => {
14199
14199
  for (const source of aliasObjects) {
14200
14200
  const ref = sourceObjects.get(source);
14201
- if (typeof ref === "object" && ref.anchor && (identity2.isScalar(ref.node) || identity2.isCollection(ref.node))) {
14201
+ if (typeof ref === "object" && ref.anchor && (identity.isScalar(ref.node) || identity.isCollection(ref.node))) {
14202
14202
  ref.node.anchor = ref.anchor;
14203
14203
  } else {
14204
14204
  const error46 = new Error("Failed to resolve repeated object (this should not happen)");
@@ -14265,12 +14265,12 @@ var require_applyReviver = __commonJS((exports) => {
14265
14265
 
14266
14266
  // ../../node_modules/yaml/dist/nodes/toJS.js
14267
14267
  var require_toJS = __commonJS((exports) => {
14268
- var identity2 = require_identity();
14268
+ var identity = require_identity();
14269
14269
  function toJS(value, arg, ctx) {
14270
14270
  if (Array.isArray(value))
14271
14271
  return value.map((v, i) => toJS(v, String(i), ctx));
14272
14272
  if (value && typeof value.toJSON === "function") {
14273
- if (!ctx || !identity2.hasAnchor(value))
14273
+ if (!ctx || !identity.hasAnchor(value))
14274
14274
  return value.toJSON(arg, ctx);
14275
14275
  const data = { aliasCount: 0, count: 1, res: undefined };
14276
14276
  ctx.anchors.set(value, data);
@@ -14293,12 +14293,12 @@ var require_toJS = __commonJS((exports) => {
14293
14293
  // ../../node_modules/yaml/dist/nodes/Node.js
14294
14294
  var require_Node = __commonJS((exports) => {
14295
14295
  var applyReviver = require_applyReviver();
14296
- var identity2 = require_identity();
14296
+ var identity = require_identity();
14297
14297
  var toJS = require_toJS();
14298
14298
 
14299
14299
  class NodeBase {
14300
14300
  constructor(type) {
14301
- Object.defineProperty(this, identity2.NODE_TYPE, { value: type });
14301
+ Object.defineProperty(this, identity.NODE_TYPE, { value: type });
14302
14302
  }
14303
14303
  clone() {
14304
14304
  const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
@@ -14307,7 +14307,7 @@ var require_Node = __commonJS((exports) => {
14307
14307
  return copy;
14308
14308
  }
14309
14309
  toJS(doc2, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
14310
- if (!identity2.isDocument(doc2))
14310
+ if (!identity.isDocument(doc2))
14311
14311
  throw new TypeError("A document argument is required");
14312
14312
  const ctx = {
14313
14313
  anchors: new Map,
@@ -14331,13 +14331,13 @@ var require_Node = __commonJS((exports) => {
14331
14331
  var require_Alias = __commonJS((exports) => {
14332
14332
  var anchors = require_anchors();
14333
14333
  var visit = require_visit();
14334
- var identity2 = require_identity();
14334
+ var identity = require_identity();
14335
14335
  var Node = require_Node();
14336
14336
  var toJS = require_toJS();
14337
14337
 
14338
14338
  class Alias extends Node.NodeBase {
14339
14339
  constructor(source) {
14340
- super(identity2.ALIAS);
14340
+ super(identity.ALIAS);
14341
14341
  this.source = source;
14342
14342
  Object.defineProperty(this, "tag", {
14343
14343
  set() {
@@ -14353,7 +14353,7 @@ var require_Alias = __commonJS((exports) => {
14353
14353
  nodes = [];
14354
14354
  visit.visit(doc2, {
14355
14355
  Node: (_key, node) => {
14356
- if (identity2.isAlias(node) || identity2.hasAnchor(node))
14356
+ if (identity.isAlias(node) || identity.hasAnchor(node))
14357
14357
  nodes.push(node);
14358
14358
  }
14359
14359
  });
@@ -14413,11 +14413,11 @@ var require_Alias = __commonJS((exports) => {
14413
14413
  }
14414
14414
  }
14415
14415
  function getAliasCount(doc2, node, anchors2) {
14416
- if (identity2.isAlias(node)) {
14416
+ if (identity.isAlias(node)) {
14417
14417
  const source = node.resolve(doc2);
14418
14418
  const anchor = anchors2 && source && anchors2.get(source);
14419
14419
  return anchor ? anchor.count * anchor.aliasCount : 0;
14420
- } else if (identity2.isCollection(node)) {
14420
+ } else if (identity.isCollection(node)) {
14421
14421
  let count = 0;
14422
14422
  for (const item of node.items) {
14423
14423
  const c = getAliasCount(doc2, item, anchors2);
@@ -14425,7 +14425,7 @@ var require_Alias = __commonJS((exports) => {
14425
14425
  count = c;
14426
14426
  }
14427
14427
  return count;
14428
- } else if (identity2.isPair(node)) {
14428
+ } else if (identity.isPair(node)) {
14429
14429
  const kc = getAliasCount(doc2, node.key, anchors2);
14430
14430
  const vc = getAliasCount(doc2, node.value, anchors2);
14431
14431
  return Math.max(kc, vc);
@@ -14437,14 +14437,14 @@ var require_Alias = __commonJS((exports) => {
14437
14437
 
14438
14438
  // ../../node_modules/yaml/dist/nodes/Scalar.js
14439
14439
  var require_Scalar = __commonJS((exports) => {
14440
- var identity2 = require_identity();
14440
+ var identity = require_identity();
14441
14441
  var Node = require_Node();
14442
14442
  var toJS = require_toJS();
14443
14443
  var isScalarValue = (value) => !value || typeof value !== "function" && typeof value !== "object";
14444
14444
 
14445
14445
  class Scalar extends Node.NodeBase {
14446
14446
  constructor(value) {
14447
- super(identity2.SCALAR);
14447
+ super(identity.SCALAR);
14448
14448
  this.value = value;
14449
14449
  }
14450
14450
  toJSON(arg, ctx) {
@@ -14466,7 +14466,7 @@ var require_Scalar = __commonJS((exports) => {
14466
14466
  // ../../node_modules/yaml/dist/doc/createNode.js
14467
14467
  var require_createNode = __commonJS((exports) => {
14468
14468
  var Alias = require_Alias();
14469
- var identity2 = require_identity();
14469
+ var identity = require_identity();
14470
14470
  var Scalar = require_Scalar();
14471
14471
  var defaultTagPrefix = "tag:yaml.org,2002:";
14472
14472
  function findTagObject(value, tagName, tags) {
@@ -14480,12 +14480,12 @@ var require_createNode = __commonJS((exports) => {
14480
14480
  return tags.find((t) => t.identify?.(value) && !t.format);
14481
14481
  }
14482
14482
  function createNode(value, tagName, ctx) {
14483
- if (identity2.isDocument(value))
14483
+ if (identity.isDocument(value))
14484
14484
  value = value.contents;
14485
- if (identity2.isNode(value))
14485
+ if (identity.isNode(value))
14486
14486
  return value;
14487
- if (identity2.isPair(value)) {
14488
- const map2 = ctx.schema[identity2.MAP].createNode?.(ctx.schema, null, ctx);
14487
+ if (identity.isPair(value)) {
14488
+ const map2 = ctx.schema[identity.MAP].createNode?.(ctx.schema, null, ctx);
14489
14489
  map2.items.push(value);
14490
14490
  return map2;
14491
14491
  }
@@ -14517,7 +14517,7 @@ var require_createNode = __commonJS((exports) => {
14517
14517
  ref.node = node2;
14518
14518
  return node2;
14519
14519
  }
14520
- tagObj = value instanceof Map ? schema[identity2.MAP] : (Symbol.iterator in Object(value)) ? schema[identity2.SEQ] : schema[identity2.MAP];
14520
+ tagObj = value instanceof Map ? schema[identity.MAP] : (Symbol.iterator in Object(value)) ? schema[identity.SEQ] : schema[identity.MAP];
14521
14521
  }
14522
14522
  if (onTagObj) {
14523
14523
  onTagObj(tagObj);
@@ -14538,7 +14538,7 @@ var require_createNode = __commonJS((exports) => {
14538
14538
  // ../../node_modules/yaml/dist/nodes/Collection.js
14539
14539
  var require_Collection = __commonJS((exports) => {
14540
14540
  var createNode = require_createNode();
14541
- var identity2 = require_identity();
14541
+ var identity = require_identity();
14542
14542
  var Node = require_Node();
14543
14543
  function collectionFromPath(schema, path, value) {
14544
14544
  let v = value;
@@ -14578,7 +14578,7 @@ var require_Collection = __commonJS((exports) => {
14578
14578
  const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
14579
14579
  if (schema)
14580
14580
  copy.schema = schema;
14581
- copy.items = copy.items.map((it) => identity2.isNode(it) || identity2.isPair(it) ? it.clone(schema) : it);
14581
+ copy.items = copy.items.map((it) => identity.isNode(it) || identity.isPair(it) ? it.clone(schema) : it);
14582
14582
  if (this.range)
14583
14583
  copy.range = this.range.slice();
14584
14584
  return copy;
@@ -14589,7 +14589,7 @@ var require_Collection = __commonJS((exports) => {
14589
14589
  else {
14590
14590
  const [key, ...rest] = path;
14591
14591
  const node = this.get(key, true);
14592
- if (identity2.isCollection(node))
14592
+ if (identity.isCollection(node))
14593
14593
  node.addIn(rest, value);
14594
14594
  else if (node === undefined && this.schema)
14595
14595
  this.set(key, collectionFromPath(this.schema, rest, value));
@@ -14602,7 +14602,7 @@ var require_Collection = __commonJS((exports) => {
14602
14602
  if (rest.length === 0)
14603
14603
  return this.delete(key);
14604
14604
  const node = this.get(key, true);
14605
- if (identity2.isCollection(node))
14605
+ if (identity.isCollection(node))
14606
14606
  return node.deleteIn(rest);
14607
14607
  else
14608
14608
  throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
@@ -14611,16 +14611,16 @@ var require_Collection = __commonJS((exports) => {
14611
14611
  const [key, ...rest] = path;
14612
14612
  const node = this.get(key, true);
14613
14613
  if (rest.length === 0)
14614
- return !keepScalar && identity2.isScalar(node) ? node.value : node;
14614
+ return !keepScalar && identity.isScalar(node) ? node.value : node;
14615
14615
  else
14616
- return identity2.isCollection(node) ? node.getIn(rest, keepScalar) : undefined;
14616
+ return identity.isCollection(node) ? node.getIn(rest, keepScalar) : undefined;
14617
14617
  }
14618
14618
  hasAllNullValues(allowScalar) {
14619
14619
  return this.items.every((node) => {
14620
- if (!identity2.isPair(node))
14620
+ if (!identity.isPair(node))
14621
14621
  return false;
14622
14622
  const n = node.value;
14623
- return n == null || allowScalar && identity2.isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
14623
+ return n == null || allowScalar && identity.isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
14624
14624
  });
14625
14625
  }
14626
14626
  hasIn(path) {
@@ -14628,7 +14628,7 @@ var require_Collection = __commonJS((exports) => {
14628
14628
  if (rest.length === 0)
14629
14629
  return this.has(key);
14630
14630
  const node = this.get(key, true);
14631
- return identity2.isCollection(node) ? node.hasIn(rest) : false;
14631
+ return identity.isCollection(node) ? node.hasIn(rest) : false;
14632
14632
  }
14633
14633
  setIn(path, value) {
14634
14634
  const [key, ...rest] = path;
@@ -14636,7 +14636,7 @@ var require_Collection = __commonJS((exports) => {
14636
14636
  this.set(key, value);
14637
14637
  } else {
14638
14638
  const node = this.get(key, true);
14639
- if (identity2.isCollection(node))
14639
+ if (identity.isCollection(node))
14640
14640
  node.setIn(rest, value);
14641
14641
  else if (node === undefined && this.schema)
14642
14642
  this.set(key, collectionFromPath(this.schema, rest, value));
@@ -15105,7 +15105,7 @@ ${indent}`);
15105
15105
  // ../../node_modules/yaml/dist/stringify/stringify.js
15106
15106
  var require_stringify = __commonJS((exports) => {
15107
15107
  var anchors = require_anchors();
15108
- var identity2 = require_identity();
15108
+ var identity = require_identity();
15109
15109
  var stringifyComment = require_stringifyComment();
15110
15110
  var stringifyString = require_stringifyString();
15111
15111
  function createStringifyContext(doc2, options) {
@@ -15157,7 +15157,7 @@ var require_stringify = __commonJS((exports) => {
15157
15157
  }
15158
15158
  let tagObj = undefined;
15159
15159
  let obj;
15160
- if (identity2.isScalar(item)) {
15160
+ if (identity.isScalar(item)) {
15161
15161
  obj = item.value;
15162
15162
  let match = tags.filter((t) => t.identify?.(obj));
15163
15163
  if (match.length > 1) {
@@ -15180,7 +15180,7 @@ var require_stringify = __commonJS((exports) => {
15180
15180
  if (!doc2.directives)
15181
15181
  return "";
15182
15182
  const props = [];
15183
- const anchor = (identity2.isScalar(node) || identity2.isCollection(node)) && node.anchor;
15183
+ const anchor = (identity.isScalar(node) || identity.isCollection(node)) && node.anchor;
15184
15184
  if (anchor && anchors.anchorIsValid(anchor)) {
15185
15185
  anchors$1.add(anchor);
15186
15186
  props.push(`&${anchor}`);
@@ -15191,9 +15191,9 @@ var require_stringify = __commonJS((exports) => {
15191
15191
  return props.join(" ");
15192
15192
  }
15193
15193
  function stringify(item, ctx, onComment, onChompKeep) {
15194
- if (identity2.isPair(item))
15194
+ if (identity.isPair(item))
15195
15195
  return item.toString(ctx, onComment, onChompKeep);
15196
- if (identity2.isAlias(item)) {
15196
+ if (identity.isAlias(item)) {
15197
15197
  if (ctx.doc.directives)
15198
15198
  return item.toString(ctx);
15199
15199
  if (ctx.resolvedAliases?.has(item)) {
@@ -15207,15 +15207,15 @@ var require_stringify = __commonJS((exports) => {
15207
15207
  }
15208
15208
  }
15209
15209
  let tagObj = undefined;
15210
- const node = identity2.isNode(item) ? item : ctx.doc.createNode(item, { onTagObj: (o) => tagObj = o });
15210
+ const node = identity.isNode(item) ? item : ctx.doc.createNode(item, { onTagObj: (o) => tagObj = o });
15211
15211
  tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
15212
15212
  const props = stringifyProps(node, tagObj, ctx);
15213
15213
  if (props.length > 0)
15214
15214
  ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
15215
- const str = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) : identity2.isScalar(node) ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep) : node.toString(ctx, onComment, onChompKeep);
15215
+ const str = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) : identity.isScalar(node) ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep) : node.toString(ctx, onComment, onChompKeep);
15216
15216
  if (!props)
15217
15217
  return str;
15218
- return identity2.isScalar(node) || str[0] === "{" || str[0] === "[" ? `${props} ${str}` : `${props}
15218
+ return identity.isScalar(node) || str[0] === "{" || str[0] === "[" ? `${props} ${str}` : `${props}
15219
15219
  ${ctx.indent}${str}`;
15220
15220
  }
15221
15221
  exports.createStringifyContext = createStringifyContext;
@@ -15224,23 +15224,23 @@ ${ctx.indent}${str}`;
15224
15224
 
15225
15225
  // ../../node_modules/yaml/dist/stringify/stringifyPair.js
15226
15226
  var require_stringifyPair = __commonJS((exports) => {
15227
- var identity2 = require_identity();
15227
+ var identity = require_identity();
15228
15228
  var Scalar = require_Scalar();
15229
15229
  var stringify = require_stringify();
15230
15230
  var stringifyComment = require_stringifyComment();
15231
15231
  function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
15232
15232
  const { allNullValues, doc: doc2, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
15233
- let keyComment = identity2.isNode(key) && key.comment || null;
15233
+ let keyComment = identity.isNode(key) && key.comment || null;
15234
15234
  if (simpleKeys) {
15235
15235
  if (keyComment) {
15236
15236
  throw new Error("With simple keys, key nodes cannot have comments");
15237
15237
  }
15238
- if (identity2.isCollection(key) || !identity2.isNode(key) && typeof key === "object") {
15238
+ if (identity.isCollection(key) || !identity.isNode(key) && typeof key === "object") {
15239
15239
  const msg = "With simple keys, collection cannot be used as a key value";
15240
15240
  throw new Error(msg);
15241
15241
  }
15242
15242
  }
15243
- let explicitKey = !simpleKeys && (!key || keyComment && value == null && !ctx.inFlow || identity2.isCollection(key) || (identity2.isScalar(key) ? key.type === Scalar.Scalar.BLOCK_FOLDED || key.type === Scalar.Scalar.BLOCK_LITERAL : typeof key === "object"));
15243
+ let explicitKey = !simpleKeys && (!key || keyComment && value == null && !ctx.inFlow || identity.isCollection(key) || (identity.isScalar(key) ? key.type === Scalar.Scalar.BLOCK_FOLDED || key.type === Scalar.Scalar.BLOCK_LITERAL : typeof key === "object"));
15244
15244
  ctx = Object.assign({}, ctx, {
15245
15245
  allNullValues: false,
15246
15246
  implicitKey: !explicitKey && (simpleKeys || !allNullValues),
@@ -15281,7 +15281,7 @@ ${indent}:`;
15281
15281
  str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));
15282
15282
  }
15283
15283
  let vsb, vcb, valueComment;
15284
- if (identity2.isNode(value)) {
15284
+ if (identity.isNode(value)) {
15285
15285
  vsb = !!value.spaceBefore;
15286
15286
  vcb = value.commentBefore;
15287
15287
  valueComment = value.comment;
@@ -15293,10 +15293,10 @@ ${indent}:`;
15293
15293
  value = doc2.createNode(value);
15294
15294
  }
15295
15295
  ctx.implicitKey = false;
15296
- if (!explicitKey && !keyComment && identity2.isScalar(value))
15296
+ if (!explicitKey && !keyComment && identity.isScalar(value))
15297
15297
  ctx.indentAtStart = str.length + 1;
15298
15298
  chompKeep = false;
15299
- if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey && identity2.isSeq(value) && !value.flow && !value.tag && !value.anchor) {
15299
+ if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey && identity.isSeq(value) && !value.flow && !value.tag && !value.anchor) {
15300
15300
  ctx.indent = ctx.indent.substring(2);
15301
15301
  }
15302
15302
  let valueCommentDone = false;
@@ -15320,7 +15320,7 @@ ${stringifyComment.indentComment(cs, ctx.indent)}`;
15320
15320
  ws += `
15321
15321
  ${ctx.indent}`;
15322
15322
  }
15323
- } else if (!explicitKey && identity2.isCollection(value)) {
15323
+ } else if (!explicitKey && identity.isCollection(value)) {
15324
15324
  const vs0 = valueStr[0];
15325
15325
  const nl0 = valueStr.indexOf(`
15326
15326
  `);
@@ -15379,10 +15379,10 @@ var require_log = __commonJS((exports) => {
15379
15379
 
15380
15380
  // ../../node_modules/yaml/dist/schema/yaml-1.1/merge.js
15381
15381
  var require_merge = __commonJS((exports) => {
15382
- var identity2 = require_identity();
15382
+ var identity = require_identity();
15383
15383
  var Scalar = require_Scalar();
15384
15384
  var MERGE_KEY = "<<";
15385
- var merge3 = {
15385
+ var merge2 = {
15386
15386
  identify: (value) => value === MERGE_KEY || typeof value === "symbol" && value.description === MERGE_KEY,
15387
15387
  default: "key",
15388
15388
  tag: "tag:yaml.org,2002:merge",
@@ -15392,10 +15392,10 @@ var require_merge = __commonJS((exports) => {
15392
15392
  }),
15393
15393
  stringify: () => MERGE_KEY
15394
15394
  };
15395
- var isMergeKey = (ctx, key) => (merge3.identify(key) || identity2.isScalar(key) && (!key.type || key.type === Scalar.Scalar.PLAIN) && merge3.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge3.tag && tag.default);
15395
+ var isMergeKey = (ctx, key) => (merge2.identify(key) || identity.isScalar(key) && (!key.type || key.type === Scalar.Scalar.PLAIN) && merge2.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge2.tag && tag.default);
15396
15396
  function addMergeToJSMap(ctx, map2, value) {
15397
- value = ctx && identity2.isAlias(value) ? value.resolve(ctx.doc) : value;
15398
- if (identity2.isSeq(value))
15397
+ value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
15398
+ if (identity.isSeq(value))
15399
15399
  for (const it of value.items)
15400
15400
  mergeValue(ctx, map2, it);
15401
15401
  else if (Array.isArray(value))
@@ -15405,8 +15405,8 @@ var require_merge = __commonJS((exports) => {
15405
15405
  mergeValue(ctx, map2, value);
15406
15406
  }
15407
15407
  function mergeValue(ctx, map2, value) {
15408
- const source = ctx && identity2.isAlias(value) ? value.resolve(ctx.doc) : value;
15409
- if (!identity2.isMap(source))
15408
+ const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
15409
+ if (!identity.isMap(source))
15410
15410
  throw new Error("Merge sources must be maps or map aliases");
15411
15411
  const srcMap = source.toJSON(null, ctx, Map);
15412
15412
  for (const [key, value2] of srcMap) {
@@ -15428,21 +15428,21 @@ var require_merge = __commonJS((exports) => {
15428
15428
  }
15429
15429
  exports.addMergeToJSMap = addMergeToJSMap;
15430
15430
  exports.isMergeKey = isMergeKey;
15431
- exports.merge = merge3;
15431
+ exports.merge = merge2;
15432
15432
  });
15433
15433
 
15434
15434
  // ../../node_modules/yaml/dist/nodes/addPairToJSMap.js
15435
15435
  var require_addPairToJSMap = __commonJS((exports) => {
15436
15436
  var log = require_log();
15437
- var merge3 = require_merge();
15437
+ var merge2 = require_merge();
15438
15438
  var stringify = require_stringify();
15439
- var identity2 = require_identity();
15439
+ var identity = require_identity();
15440
15440
  var toJS = require_toJS();
15441
15441
  function addPairToJSMap(ctx, map2, { key, value }) {
15442
- if (identity2.isNode(key) && key.addToJSMap)
15442
+ if (identity.isNode(key) && key.addToJSMap)
15443
15443
  key.addToJSMap(ctx, map2, value);
15444
- else if (merge3.isMergeKey(ctx, key))
15445
- merge3.addMergeToJSMap(ctx, map2, value);
15444
+ else if (merge2.isMergeKey(ctx, key))
15445
+ merge2.addMergeToJSMap(ctx, map2, value);
15446
15446
  else {
15447
15447
  const jsKey = toJS.toJS(key, "", ctx);
15448
15448
  if (map2 instanceof Map) {
@@ -15470,7 +15470,7 @@ var require_addPairToJSMap = __commonJS((exports) => {
15470
15470
  return "";
15471
15471
  if (typeof jsKey !== "object")
15472
15472
  return String(jsKey);
15473
- if (identity2.isNode(key) && ctx?.doc) {
15473
+ if (identity.isNode(key) && ctx?.doc) {
15474
15474
  const strCtx = stringify.createStringifyContext(ctx.doc, {});
15475
15475
  strCtx.anchors = new Set;
15476
15476
  for (const node of ctx.anchors.keys())
@@ -15497,7 +15497,7 @@ var require_Pair = __commonJS((exports) => {
15497
15497
  var createNode = require_createNode();
15498
15498
  var stringifyPair = require_stringifyPair();
15499
15499
  var addPairToJSMap = require_addPairToJSMap();
15500
- var identity2 = require_identity();
15500
+ var identity = require_identity();
15501
15501
  function createPair(key, value, ctx) {
15502
15502
  const k = createNode.createNode(key, undefined, ctx);
15503
15503
  const v = createNode.createNode(value, undefined, ctx);
@@ -15506,15 +15506,15 @@ var require_Pair = __commonJS((exports) => {
15506
15506
 
15507
15507
  class Pair {
15508
15508
  constructor(key, value = null) {
15509
- Object.defineProperty(this, identity2.NODE_TYPE, { value: identity2.PAIR });
15509
+ Object.defineProperty(this, identity.NODE_TYPE, { value: identity.PAIR });
15510
15510
  this.key = key;
15511
15511
  this.value = value;
15512
15512
  }
15513
15513
  clone(schema) {
15514
15514
  let { key, value } = this;
15515
- if (identity2.isNode(key))
15515
+ if (identity.isNode(key))
15516
15516
  key = key.clone(schema);
15517
- if (identity2.isNode(value))
15517
+ if (identity.isNode(value))
15518
15518
  value = value.clone(schema);
15519
15519
  return new Pair(key, value);
15520
15520
  }
@@ -15532,7 +15532,7 @@ var require_Pair = __commonJS((exports) => {
15532
15532
 
15533
15533
  // ../../node_modules/yaml/dist/stringify/stringifyCollection.js
15534
15534
  var require_stringifyCollection = __commonJS((exports) => {
15535
- var identity2 = require_identity();
15535
+ var identity = require_identity();
15536
15536
  var stringify = require_stringify();
15537
15537
  var stringifyComment = require_stringifyComment();
15538
15538
  function stringifyCollection(collection, ctx, options) {
@@ -15548,14 +15548,14 @@ var require_stringifyCollection = __commonJS((exports) => {
15548
15548
  for (let i = 0;i < items.length; ++i) {
15549
15549
  const item = items[i];
15550
15550
  let comment2 = null;
15551
- if (identity2.isNode(item)) {
15551
+ if (identity.isNode(item)) {
15552
15552
  if (!chompKeep && item.spaceBefore)
15553
15553
  lines.push("");
15554
15554
  addCommentBefore(ctx, lines, item.commentBefore, chompKeep);
15555
15555
  if (item.comment)
15556
15556
  comment2 = item.comment;
15557
- } else if (identity2.isPair(item)) {
15558
- const ik = identity2.isNode(item.key) ? item.key : null;
15557
+ } else if (identity.isPair(item)) {
15558
+ const ik = identity.isNode(item.key) ? item.key : null;
15559
15559
  if (ik) {
15560
15560
  if (!chompKeep && ik.spaceBefore)
15561
15561
  lines.push("");
@@ -15605,14 +15605,14 @@ ${indent}${line}` : `
15605
15605
  for (let i = 0;i < items.length; ++i) {
15606
15606
  const item = items[i];
15607
15607
  let comment = null;
15608
- if (identity2.isNode(item)) {
15608
+ if (identity.isNode(item)) {
15609
15609
  if (item.spaceBefore)
15610
15610
  lines.push("");
15611
15611
  addCommentBefore(ctx, lines, item.commentBefore, false);
15612
15612
  if (item.comment)
15613
15613
  comment = item.comment;
15614
- } else if (identity2.isPair(item)) {
15615
- const ik = identity2.isNode(item.key) ? item.key : null;
15614
+ } else if (identity.isPair(item)) {
15615
+ const ik = identity.isNode(item.key) ? item.key : null;
15616
15616
  if (ik) {
15617
15617
  if (ik.spaceBefore)
15618
15618
  lines.push("");
@@ -15620,7 +15620,7 @@ ${indent}${line}` : `
15620
15620
  if (ik.comment)
15621
15621
  reqNewline = true;
15622
15622
  }
15623
- const iv = identity2.isNode(item.value) ? item.value : null;
15623
+ const iv = identity.isNode(item.value) ? item.value : null;
15624
15624
  if (iv) {
15625
15625
  if (iv.comment)
15626
15626
  comment = iv.comment;
@@ -15680,16 +15680,16 @@ var require_YAMLMap = __commonJS((exports) => {
15680
15680
  var stringifyCollection = require_stringifyCollection();
15681
15681
  var addPairToJSMap = require_addPairToJSMap();
15682
15682
  var Collection = require_Collection();
15683
- var identity2 = require_identity();
15683
+ var identity = require_identity();
15684
15684
  var Pair = require_Pair();
15685
15685
  var Scalar = require_Scalar();
15686
15686
  function findPair(items, key) {
15687
- const k = identity2.isScalar(key) ? key.value : key;
15687
+ const k = identity.isScalar(key) ? key.value : key;
15688
15688
  for (const it of items) {
15689
- if (identity2.isPair(it)) {
15689
+ if (identity.isPair(it)) {
15690
15690
  if (it.key === key || it.key === k)
15691
15691
  return it;
15692
- if (identity2.isScalar(it.key) && it.key.value === k)
15692
+ if (identity.isScalar(it.key) && it.key.value === k)
15693
15693
  return it;
15694
15694
  }
15695
15695
  }
@@ -15701,7 +15701,7 @@ var require_YAMLMap = __commonJS((exports) => {
15701
15701
  return "tag:yaml.org,2002:map";
15702
15702
  }
15703
15703
  constructor(schema) {
15704
- super(identity2.MAP, schema);
15704
+ super(identity.MAP, schema);
15705
15705
  this.items = [];
15706
15706
  }
15707
15707
  static from(schema, obj, ctx) {
@@ -15729,7 +15729,7 @@ var require_YAMLMap = __commonJS((exports) => {
15729
15729
  }
15730
15730
  add(pair, overwrite) {
15731
15731
  let _pair;
15732
- if (identity2.isPair(pair))
15732
+ if (identity.isPair(pair))
15733
15733
  _pair = pair;
15734
15734
  else if (!pair || typeof pair !== "object" || !("key" in pair)) {
15735
15735
  _pair = new Pair.Pair(pair, pair?.value);
@@ -15740,7 +15740,7 @@ var require_YAMLMap = __commonJS((exports) => {
15740
15740
  if (prev) {
15741
15741
  if (!overwrite)
15742
15742
  throw new Error(`Key ${_pair.key} already set`);
15743
- if (identity2.isScalar(prev.value) && Scalar.isScalarValue(_pair.value))
15743
+ if (identity.isScalar(prev.value) && Scalar.isScalarValue(_pair.value))
15744
15744
  prev.value.value = _pair.value;
15745
15745
  else
15746
15746
  prev.value = _pair.value;
@@ -15764,7 +15764,7 @@ var require_YAMLMap = __commonJS((exports) => {
15764
15764
  get(key, keepScalar) {
15765
15765
  const it = findPair(this.items, key);
15766
15766
  const node = it?.value;
15767
- return (!keepScalar && identity2.isScalar(node) ? node.value : node) ?? undefined;
15767
+ return (!keepScalar && identity.isScalar(node) ? node.value : node) ?? undefined;
15768
15768
  }
15769
15769
  has(key) {
15770
15770
  return !!findPair(this.items, key);
@@ -15784,7 +15784,7 @@ var require_YAMLMap = __commonJS((exports) => {
15784
15784
  if (!ctx)
15785
15785
  return JSON.stringify(this);
15786
15786
  for (const item of this.items) {
15787
- if (!identity2.isPair(item))
15787
+ if (!identity.isPair(item))
15788
15788
  throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
15789
15789
  }
15790
15790
  if (!ctx.allNullValues && this.hasAllNullValues(false))
@@ -15804,7 +15804,7 @@ var require_YAMLMap = __commonJS((exports) => {
15804
15804
 
15805
15805
  // ../../node_modules/yaml/dist/schema/common/map.js
15806
15806
  var require_map = __commonJS((exports) => {
15807
- var identity2 = require_identity();
15807
+ var identity = require_identity();
15808
15808
  var YAMLMap = require_YAMLMap();
15809
15809
  var map2 = {
15810
15810
  collection: "map",
@@ -15812,7 +15812,7 @@ var require_map = __commonJS((exports) => {
15812
15812
  nodeClass: YAMLMap.YAMLMap,
15813
15813
  tag: "tag:yaml.org,2002:map",
15814
15814
  resolve(map3, onError) {
15815
- if (!identity2.isMap(map3))
15815
+ if (!identity.isMap(map3))
15816
15816
  onError("Expected a mapping for this tag");
15817
15817
  return map3;
15818
15818
  },
@@ -15826,7 +15826,7 @@ var require_YAMLSeq = __commonJS((exports) => {
15826
15826
  var createNode = require_createNode();
15827
15827
  var stringifyCollection = require_stringifyCollection();
15828
15828
  var Collection = require_Collection();
15829
- var identity2 = require_identity();
15829
+ var identity = require_identity();
15830
15830
  var Scalar = require_Scalar();
15831
15831
  var toJS = require_toJS();
15832
15832
 
@@ -15835,7 +15835,7 @@ var require_YAMLSeq = __commonJS((exports) => {
15835
15835
  return "tag:yaml.org,2002:seq";
15836
15836
  }
15837
15837
  constructor(schema) {
15838
- super(identity2.SEQ, schema);
15838
+ super(identity.SEQ, schema);
15839
15839
  this.items = [];
15840
15840
  }
15841
15841
  add(value) {
@@ -15853,7 +15853,7 @@ var require_YAMLSeq = __commonJS((exports) => {
15853
15853
  if (typeof idx !== "number")
15854
15854
  return;
15855
15855
  const it = this.items[idx];
15856
- return !keepScalar && identity2.isScalar(it) ? it.value : it;
15856
+ return !keepScalar && identity.isScalar(it) ? it.value : it;
15857
15857
  }
15858
15858
  has(key) {
15859
15859
  const idx = asItemIndex(key);
@@ -15864,7 +15864,7 @@ var require_YAMLSeq = __commonJS((exports) => {
15864
15864
  if (typeof idx !== "number")
15865
15865
  throw new Error(`Expected a valid index, not ${key}.`);
15866
15866
  const prev = this.items[idx];
15867
- if (identity2.isScalar(prev) && Scalar.isScalarValue(value))
15867
+ if (identity.isScalar(prev) && Scalar.isScalarValue(value))
15868
15868
  prev.value = value;
15869
15869
  else
15870
15870
  this.items[idx] = value;
@@ -15906,7 +15906,7 @@ var require_YAMLSeq = __commonJS((exports) => {
15906
15906
  }
15907
15907
  }
15908
15908
  function asItemIndex(key) {
15909
- let idx = identity2.isScalar(key) ? key.value : key;
15909
+ let idx = identity.isScalar(key) ? key.value : key;
15910
15910
  if (idx && typeof idx === "string")
15911
15911
  idx = Number(idx);
15912
15912
  return typeof idx === "number" && Number.isInteger(idx) && idx >= 0 ? idx : null;
@@ -15916,7 +15916,7 @@ var require_YAMLSeq = __commonJS((exports) => {
15916
15916
 
15917
15917
  // ../../node_modules/yaml/dist/schema/common/seq.js
15918
15918
  var require_seq = __commonJS((exports) => {
15919
- var identity2 = require_identity();
15919
+ var identity = require_identity();
15920
15920
  var YAMLSeq = require_YAMLSeq();
15921
15921
  var seq = {
15922
15922
  collection: "seq",
@@ -15924,7 +15924,7 @@ var require_seq = __commonJS((exports) => {
15924
15924
  nodeClass: YAMLSeq.YAMLSeq,
15925
15925
  tag: "tag:yaml.org,2002:seq",
15926
15926
  resolve(seq2, onError) {
15927
- if (!identity2.isSeq(seq2))
15927
+ if (!identity.isSeq(seq2))
15928
15928
  onError("Expected a sequence for this tag");
15929
15929
  return seq2;
15930
15930
  },
@@ -15952,29 +15952,29 @@ var require_string = __commonJS((exports) => {
15952
15952
  // ../../node_modules/yaml/dist/schema/common/null.js
15953
15953
  var require_null = __commonJS((exports) => {
15954
15954
  var Scalar = require_Scalar();
15955
- var nullTag2 = {
15955
+ var nullTag = {
15956
15956
  identify: (value) => value == null,
15957
15957
  createNode: () => new Scalar.Scalar(null),
15958
15958
  default: true,
15959
15959
  tag: "tag:yaml.org,2002:null",
15960
15960
  test: /^(?:~|[Nn]ull|NULL)?$/,
15961
15961
  resolve: () => new Scalar.Scalar(null),
15962
- stringify: ({ source }, ctx) => typeof source === "string" && nullTag2.test.test(source) ? source : ctx.options.nullStr
15962
+ stringify: ({ source }, ctx) => typeof source === "string" && nullTag.test.test(source) ? source : ctx.options.nullStr
15963
15963
  };
15964
- exports.nullTag = nullTag2;
15964
+ exports.nullTag = nullTag;
15965
15965
  });
15966
15966
 
15967
15967
  // ../../node_modules/yaml/dist/schema/core/bool.js
15968
15968
  var require_bool = __commonJS((exports) => {
15969
15969
  var Scalar = require_Scalar();
15970
- var boolTag2 = {
15970
+ var boolTag = {
15971
15971
  identify: (value) => typeof value === "boolean",
15972
15972
  default: true,
15973
15973
  tag: "tag:yaml.org,2002:bool",
15974
15974
  test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
15975
15975
  resolve: (str) => new Scalar.Scalar(str[0] === "t" || str[0] === "T"),
15976
15976
  stringify({ source, value }, ctx) {
15977
- if (source && boolTag2.test.test(source)) {
15977
+ if (source && boolTag.test.test(source)) {
15978
15978
  const sv = source[0] === "t" || source[0] === "T";
15979
15979
  if (value === sv)
15980
15980
  return source;
@@ -15982,7 +15982,7 @@ var require_bool = __commonJS((exports) => {
15982
15982
  return value ? ctx.options.trueStr : ctx.options.falseStr;
15983
15983
  }
15984
15984
  };
15985
- exports.boolTag = boolTag2;
15985
+ exports.boolTag = boolTag;
15986
15986
  });
15987
15987
 
15988
15988
  // ../../node_modules/yaml/dist/stringify/stringifyNumber.js
@@ -16240,17 +16240,17 @@ var require_binary = __commonJS((exports) => {
16240
16240
 
16241
16241
  // ../../node_modules/yaml/dist/schema/yaml-1.1/pairs.js
16242
16242
  var require_pairs = __commonJS((exports) => {
16243
- var identity2 = require_identity();
16243
+ var identity = require_identity();
16244
16244
  var Pair = require_Pair();
16245
16245
  var Scalar = require_Scalar();
16246
16246
  var YAMLSeq = require_YAMLSeq();
16247
16247
  function resolvePairs(seq, onError) {
16248
- if (identity2.isSeq(seq)) {
16248
+ if (identity.isSeq(seq)) {
16249
16249
  for (let i = 0;i < seq.items.length; ++i) {
16250
16250
  let item = seq.items[i];
16251
- if (identity2.isPair(item))
16251
+ if (identity.isPair(item))
16252
16252
  continue;
16253
- else if (identity2.isMap(item)) {
16253
+ else if (identity.isMap(item)) {
16254
16254
  if (item.items.length > 1)
16255
16255
  onError("Each pair must have its own sequence indicator");
16256
16256
  const pair = item.items[0] || new Pair.Pair(new Scalar.Scalar(null));
@@ -16264,7 +16264,7 @@ ${cn.comment}` : item.comment;
16264
16264
  }
16265
16265
  item = pair;
16266
16266
  }
16267
- seq.items[i] = identity2.isPair(item) ? item : new Pair.Pair(item);
16267
+ seq.items[i] = identity.isPair(item) ? item : new Pair.Pair(item);
16268
16268
  }
16269
16269
  } else
16270
16270
  onError("Expected a sequence for this tag");
@@ -16315,7 +16315,7 @@ ${cn.comment}` : item.comment;
16315
16315
 
16316
16316
  // ../../node_modules/yaml/dist/schema/yaml-1.1/omap.js
16317
16317
  var require_omap = __commonJS((exports) => {
16318
- var identity2 = require_identity();
16318
+ var identity = require_identity();
16319
16319
  var toJS = require_toJS();
16320
16320
  var YAMLMap = require_YAMLMap();
16321
16321
  var YAMLSeq = require_YAMLSeq();
@@ -16339,7 +16339,7 @@ var require_omap = __commonJS((exports) => {
16339
16339
  ctx.onCreate(map2);
16340
16340
  for (const pair of this.items) {
16341
16341
  let key, value;
16342
- if (identity2.isPair(pair)) {
16342
+ if (identity.isPair(pair)) {
16343
16343
  key = toJS.toJS(pair.key, "", ctx);
16344
16344
  value = toJS.toJS(pair.value, key, ctx);
16345
16345
  } else {
@@ -16369,7 +16369,7 @@ var require_omap = __commonJS((exports) => {
16369
16369
  const pairs$1 = pairs.resolvePairs(seq, onError);
16370
16370
  const seenKeys = [];
16371
16371
  for (const { key } of pairs$1.items) {
16372
- if (identity2.isScalar(key)) {
16372
+ if (identity.isScalar(key)) {
16373
16373
  if (seenKeys.includes(key.value)) {
16374
16374
  onError(`Ordered maps must not include duplicate keys: ${key.value}`);
16375
16375
  } else {
@@ -16538,7 +16538,7 @@ var require_int2 = __commonJS((exports) => {
16538
16538
 
16539
16539
  // ../../node_modules/yaml/dist/schema/yaml-1.1/set.js
16540
16540
  var require_set = __commonJS((exports) => {
16541
- var identity2 = require_identity();
16541
+ var identity = require_identity();
16542
16542
  var Pair = require_Pair();
16543
16543
  var YAMLMap = require_YAMLMap();
16544
16544
 
@@ -16549,7 +16549,7 @@ var require_set = __commonJS((exports) => {
16549
16549
  }
16550
16550
  add(key) {
16551
16551
  let pair;
16552
- if (identity2.isPair(key))
16552
+ if (identity.isPair(key))
16553
16553
  pair = key;
16554
16554
  else if (key && typeof key === "object" && "key" in key && "value" in key && key.value === null)
16555
16555
  pair = new Pair.Pair(key.key, null);
@@ -16561,7 +16561,7 @@ var require_set = __commonJS((exports) => {
16561
16561
  }
16562
16562
  get(key, keepPair) {
16563
16563
  const pair = YAMLMap.findPair(this.items, key);
16564
- return !keepPair && identity2.isPair(pair) ? identity2.isScalar(pair.key) ? pair.key.value : pair.key : pair;
16564
+ return !keepPair && identity.isPair(pair) ? identity.isScalar(pair.key) ? pair.key.value : pair.key : pair;
16565
16565
  }
16566
16566
  set(key, value) {
16567
16567
  if (typeof value !== "boolean")
@@ -16586,18 +16586,18 @@ var require_set = __commonJS((exports) => {
16586
16586
  }
16587
16587
  static from(schema, iterable, ctx) {
16588
16588
  const { replacer } = ctx;
16589
- const set4 = new this(schema);
16589
+ const set3 = new this(schema);
16590
16590
  if (iterable && Symbol.iterator in Object(iterable))
16591
16591
  for (let value of iterable) {
16592
16592
  if (typeof replacer === "function")
16593
16593
  value = replacer.call(iterable, value, value);
16594
- set4.items.push(Pair.createPair(value, null, ctx));
16594
+ set3.items.push(Pair.createPair(value, null, ctx));
16595
16595
  }
16596
- return set4;
16596
+ return set3;
16597
16597
  }
16598
16598
  }
16599
16599
  YAMLSet.tag = "tag:yaml.org,2002:set";
16600
- var set3 = {
16600
+ var set2 = {
16601
16601
  collection: "map",
16602
16602
  identify: (value) => value instanceof Set,
16603
16603
  nodeClass: YAMLSet,
@@ -16605,7 +16605,7 @@ var require_set = __commonJS((exports) => {
16605
16605
  tag: "tag:yaml.org,2002:set",
16606
16606
  createNode: (schema, iterable, ctx) => YAMLSet.from(schema, iterable, ctx),
16607
16607
  resolve(map2, onError) {
16608
- if (identity2.isMap(map2)) {
16608
+ if (identity.isMap(map2)) {
16609
16609
  if (map2.hasAllNullValues(true))
16610
16610
  return Object.assign(new YAMLSet, map2);
16611
16611
  else
@@ -16616,7 +16616,7 @@ var require_set = __commonJS((exports) => {
16616
16616
  }
16617
16617
  };
16618
16618
  exports.YAMLSet = YAMLSet;
16619
- exports.set = set3;
16619
+ exports.set = set2;
16620
16620
  });
16621
16621
 
16622
16622
  // ../../node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
@@ -16711,10 +16711,10 @@ var require_schema3 = __commonJS((exports) => {
16711
16711
  var bool = require_bool2();
16712
16712
  var float = require_float2();
16713
16713
  var int2 = require_int2();
16714
- var merge3 = require_merge();
16714
+ var merge2 = require_merge();
16715
16715
  var omap = require_omap();
16716
16716
  var pairs = require_pairs();
16717
- var set3 = require_set();
16717
+ var set2 = require_set();
16718
16718
  var timestamp = require_timestamp();
16719
16719
  var schema = [
16720
16720
  map2.map,
@@ -16731,10 +16731,10 @@ var require_schema3 = __commonJS((exports) => {
16731
16731
  float.floatExp,
16732
16732
  float.float,
16733
16733
  binary.binary,
16734
- merge3.merge,
16734
+ merge2.merge,
16735
16735
  omap.omap,
16736
16736
  pairs.pairs,
16737
- set3.set,
16737
+ set2.set,
16738
16738
  timestamp.intTime,
16739
16739
  timestamp.floatTime,
16740
16740
  timestamp.timestamp
@@ -16754,11 +16754,11 @@ var require_tags = __commonJS((exports) => {
16754
16754
  var schema = require_schema();
16755
16755
  var schema$1 = require_schema2();
16756
16756
  var binary = require_binary();
16757
- var merge3 = require_merge();
16757
+ var merge2 = require_merge();
16758
16758
  var omap = require_omap();
16759
16759
  var pairs = require_pairs();
16760
16760
  var schema$2 = require_schema3();
16761
- var set3 = require_set();
16761
+ var set2 = require_set();
16762
16762
  var timestamp = require_timestamp();
16763
16763
  var schemas3 = new Map([
16764
16764
  ["core", schema.schema],
@@ -16779,26 +16779,26 @@ var require_tags = __commonJS((exports) => {
16779
16779
  intOct: int2.intOct,
16780
16780
  intTime: timestamp.intTime,
16781
16781
  map: map2.map,
16782
- merge: merge3.merge,
16782
+ merge: merge2.merge,
16783
16783
  null: _null4.nullTag,
16784
16784
  omap: omap.omap,
16785
16785
  pairs: pairs.pairs,
16786
16786
  seq: seq.seq,
16787
- set: set3.set,
16787
+ set: set2.set,
16788
16788
  timestamp: timestamp.timestamp
16789
16789
  };
16790
16790
  var coreKnownTags = {
16791
16791
  "tag:yaml.org,2002:binary": binary.binary,
16792
- "tag:yaml.org,2002:merge": merge3.merge,
16792
+ "tag:yaml.org,2002:merge": merge2.merge,
16793
16793
  "tag:yaml.org,2002:omap": omap.omap,
16794
16794
  "tag:yaml.org,2002:pairs": pairs.pairs,
16795
- "tag:yaml.org,2002:set": set3.set,
16795
+ "tag:yaml.org,2002:set": set2.set,
16796
16796
  "tag:yaml.org,2002:timestamp": timestamp.timestamp
16797
16797
  };
16798
16798
  function getTags(customTags, schemaName, addMergeTag) {
16799
16799
  const schemaTags = schemas3.get(schemaName);
16800
16800
  if (schemaTags && !customTags) {
16801
- return addMergeTag && !schemaTags.includes(merge3.merge) ? schemaTags.concat(merge3.merge) : schemaTags.slice();
16801
+ return addMergeTag && !schemaTags.includes(merge2.merge) ? schemaTags.concat(merge2.merge) : schemaTags.slice();
16802
16802
  }
16803
16803
  let tags = schemaTags;
16804
16804
  if (!tags) {
@@ -16816,7 +16816,7 @@ var require_tags = __commonJS((exports) => {
16816
16816
  tags = customTags(tags.slice());
16817
16817
  }
16818
16818
  if (addMergeTag)
16819
- tags = tags.concat(merge3.merge);
16819
+ tags = tags.concat(merge2.merge);
16820
16820
  return tags.reduce((tags2, tag) => {
16821
16821
  const tagObj = typeof tag === "string" ? tagsByName[tag] : tag;
16822
16822
  if (!tagObj) {
@@ -16835,7 +16835,7 @@ var require_tags = __commonJS((exports) => {
16835
16835
 
16836
16836
  // ../../node_modules/yaml/dist/schema/Schema.js
16837
16837
  var require_Schema = __commonJS((exports) => {
16838
- var identity2 = require_identity();
16838
+ var identity = require_identity();
16839
16839
  var map2 = require_map();
16840
16840
  var seq = require_seq();
16841
16841
  var string4 = require_string();
@@ -16843,15 +16843,15 @@ var require_Schema = __commonJS((exports) => {
16843
16843
  var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
16844
16844
 
16845
16845
  class Schema {
16846
- constructor({ compat: compat2, customTags, merge: merge3, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
16846
+ constructor({ compat: compat2, customTags, merge: merge2, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
16847
16847
  this.compat = Array.isArray(compat2) ? tags.getTags(compat2, "compat") : compat2 ? tags.getTags(null, compat2) : null;
16848
16848
  this.name = typeof schema === "string" && schema || "core";
16849
16849
  this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
16850
- this.tags = tags.getTags(customTags, this.name, merge3);
16850
+ this.tags = tags.getTags(customTags, this.name, merge2);
16851
16851
  this.toStringOptions = toStringDefaults ?? null;
16852
- Object.defineProperty(this, identity2.MAP, { value: map2.map });
16853
- Object.defineProperty(this, identity2.SCALAR, { value: string4.string });
16854
- Object.defineProperty(this, identity2.SEQ, { value: seq.seq });
16852
+ Object.defineProperty(this, identity.MAP, { value: map2.map });
16853
+ Object.defineProperty(this, identity.SCALAR, { value: string4.string });
16854
+ Object.defineProperty(this, identity.SEQ, { value: seq.seq });
16855
16855
  this.sortMapEntries = typeof sortMapEntries === "function" ? sortMapEntries : sortMapEntries === true ? sortMapEntriesByKey : null;
16856
16856
  }
16857
16857
  clone() {
@@ -16865,7 +16865,7 @@ var require_Schema = __commonJS((exports) => {
16865
16865
 
16866
16866
  // ../../node_modules/yaml/dist/stringify/stringifyDocument.js
16867
16867
  var require_stringifyDocument = __commonJS((exports) => {
16868
- var identity2 = require_identity();
16868
+ var identity = require_identity();
16869
16869
  var stringify = require_stringify();
16870
16870
  var stringifyComment = require_stringifyComment();
16871
16871
  function stringifyDocument(doc2, options) {
@@ -16892,7 +16892,7 @@ var require_stringifyDocument = __commonJS((exports) => {
16892
16892
  let chompKeep = false;
16893
16893
  let contentComment = null;
16894
16894
  if (doc2.contents) {
16895
- if (identity2.isNode(doc2.contents)) {
16895
+ if (identity.isNode(doc2.contents)) {
16896
16896
  if (doc2.contents.spaceBefore && hasDirectives)
16897
16897
  lines.push("");
16898
16898
  if (doc2.contents.commentBefore) {
@@ -16947,7 +16947,7 @@ var require_stringifyDocument = __commonJS((exports) => {
16947
16947
  var require_Document = __commonJS((exports) => {
16948
16948
  var Alias = require_Alias();
16949
16949
  var Collection = require_Collection();
16950
- var identity2 = require_identity();
16950
+ var identity = require_identity();
16951
16951
  var Pair = require_Pair();
16952
16952
  var toJS = require_toJS();
16953
16953
  var Schema = require_Schema();
@@ -16963,7 +16963,7 @@ var require_Document = __commonJS((exports) => {
16963
16963
  this.comment = null;
16964
16964
  this.errors = [];
16965
16965
  this.warnings = [];
16966
- Object.defineProperty(this, identity2.NODE_TYPE, { value: identity2.DOC });
16966
+ Object.defineProperty(this, identity.NODE_TYPE, { value: identity.DOC });
16967
16967
  let _replacer = null;
16968
16968
  if (typeof replacer === "function" || Array.isArray(replacer)) {
16969
16969
  _replacer = replacer;
@@ -16994,7 +16994,7 @@ var require_Document = __commonJS((exports) => {
16994
16994
  }
16995
16995
  clone() {
16996
16996
  const copy = Object.create(Document.prototype, {
16997
- [identity2.NODE_TYPE]: { value: identity2.DOC }
16997
+ [identity.NODE_TYPE]: { value: identity.DOC }
16998
16998
  });
16999
16999
  copy.commentBefore = this.commentBefore;
17000
17000
  copy.comment = this.comment;
@@ -17004,7 +17004,7 @@ var require_Document = __commonJS((exports) => {
17004
17004
  if (this.directives)
17005
17005
  copy.directives = this.directives.clone();
17006
17006
  copy.schema = this.schema.clone();
17007
- copy.contents = identity2.isNode(this.contents) ? this.contents.clone(copy.schema) : this.contents;
17007
+ copy.contents = identity.isNode(this.contents) ? this.contents.clone(copy.schema) : this.contents;
17008
17008
  if (this.range)
17009
17009
  copy.range = this.range.slice();
17010
17010
  return copy;
@@ -17051,7 +17051,7 @@ var require_Document = __commonJS((exports) => {
17051
17051
  sourceObjects
17052
17052
  };
17053
17053
  const node = createNode.createNode(value, tag, ctx);
17054
- if (flow && identity2.isCollection(node))
17054
+ if (flow && identity.isCollection(node))
17055
17055
  node.flow = true;
17056
17056
  setAnchors();
17057
17057
  return node;
@@ -17074,20 +17074,20 @@ var require_Document = __commonJS((exports) => {
17074
17074
  return assertCollection(this.contents) ? this.contents.deleteIn(path) : false;
17075
17075
  }
17076
17076
  get(key, keepScalar) {
17077
- return identity2.isCollection(this.contents) ? this.contents.get(key, keepScalar) : undefined;
17077
+ return identity.isCollection(this.contents) ? this.contents.get(key, keepScalar) : undefined;
17078
17078
  }
17079
17079
  getIn(path, keepScalar) {
17080
17080
  if (Collection.isEmptyPath(path))
17081
- return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
17082
- return identity2.isCollection(this.contents) ? this.contents.getIn(path, keepScalar) : undefined;
17081
+ return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
17082
+ return identity.isCollection(this.contents) ? this.contents.getIn(path, keepScalar) : undefined;
17083
17083
  }
17084
17084
  has(key) {
17085
- return identity2.isCollection(this.contents) ? this.contents.has(key) : false;
17085
+ return identity.isCollection(this.contents) ? this.contents.has(key) : false;
17086
17086
  }
17087
17087
  hasIn(path) {
17088
17088
  if (Collection.isEmptyPath(path))
17089
17089
  return this.contents !== undefined;
17090
- return identity2.isCollection(this.contents) ? this.contents.hasIn(path) : false;
17090
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path) : false;
17091
17091
  }
17092
17092
  set(key, value) {
17093
17093
  if (this.contents == null) {
@@ -17171,7 +17171,7 @@ var require_Document = __commonJS((exports) => {
17171
17171
  }
17172
17172
  }
17173
17173
  function assertCollection(contents) {
17174
- if (identity2.isCollection(contents))
17174
+ if (identity.isCollection(contents))
17175
17175
  return true;
17176
17176
  throw new Error("Expected a YAML collection as document contents");
17177
17177
  }
@@ -17430,12 +17430,12 @@ var require_util_flow_indent_check = __commonJS((exports) => {
17430
17430
 
17431
17431
  // ../../node_modules/yaml/dist/compose/util-map-includes.js
17432
17432
  var require_util_map_includes = __commonJS((exports) => {
17433
- var identity2 = require_identity();
17433
+ var identity = require_identity();
17434
17434
  function mapIncludes(ctx, items, search) {
17435
17435
  const { uniqueKeys } = ctx.options;
17436
17436
  if (uniqueKeys === false)
17437
17437
  return false;
17438
- const isEqual = typeof uniqueKeys === "function" ? uniqueKeys : (a, b) => a === b || identity2.isScalar(a) && identity2.isScalar(b) && a.value === b.value;
17438
+ const isEqual = typeof uniqueKeys === "function" ? uniqueKeys : (a, b) => a === b || identity.isScalar(a) && identity.isScalar(b) && a.value === b.value;
17439
17439
  return items.some((pair) => isEqual(pair.key, search));
17440
17440
  }
17441
17441
  exports.mapIncludes = mapIncludes;
@@ -17638,7 +17638,7 @@ var require_resolve_end = __commonJS((exports) => {
17638
17638
 
17639
17639
  // ../../node_modules/yaml/dist/compose/resolve-flow-collection.js
17640
17640
  var require_resolve_flow_collection = __commonJS((exports) => {
17641
- var identity2 = require_identity();
17641
+ var identity = require_identity();
17642
17642
  var Pair = require_Pair();
17643
17643
  var YAMLMap = require_YAMLMap();
17644
17644
  var YAMLSeq = require_YAMLSeq();
@@ -17714,7 +17714,7 @@ var require_resolve_flow_collection = __commonJS((exports) => {
17714
17714
  }
17715
17715
  if (prevItemComment) {
17716
17716
  let prev = coll.items[coll.items.length - 1];
17717
- if (identity2.isPair(prev))
17717
+ if (identity.isPair(prev))
17718
17718
  prev = prev.value ?? prev.key;
17719
17719
  if (prev.comment)
17720
17720
  prev.comment += `
@@ -17829,7 +17829,7 @@ var require_resolve_flow_collection = __commonJS((exports) => {
17829
17829
 
17830
17830
  // ../../node_modules/yaml/dist/compose/compose-collection.js
17831
17831
  var require_compose_collection = __commonJS((exports) => {
17832
- var identity2 = require_identity();
17832
+ var identity = require_identity();
17833
17833
  var Scalar = require_Scalar();
17834
17834
  var YAMLMap = require_YAMLMap();
17835
17835
  var YAMLSeq = require_YAMLSeq();
@@ -17879,7 +17879,7 @@ var require_compose_collection = __commonJS((exports) => {
17879
17879
  }
17880
17880
  const coll = resolveCollection(CN, ctx, token, onError, tagName, tag);
17881
17881
  const res = tag.resolve?.(coll, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg), ctx.options) ?? coll;
17882
- const node = identity2.isNode(res) ? res : new Scalar.Scalar(res);
17882
+ const node = identity.isNode(res) ? res : new Scalar.Scalar(res);
17883
17883
  node.range = coll.range;
17884
17884
  node.tag = tagName;
17885
17885
  if (tag?.format)
@@ -18300,7 +18300,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
18300
18300
 
18301
18301
  // ../../node_modules/yaml/dist/compose/compose-scalar.js
18302
18302
  var require_compose_scalar = __commonJS((exports) => {
18303
- var identity2 = require_identity();
18303
+ var identity = require_identity();
18304
18304
  var Scalar = require_Scalar();
18305
18305
  var resolveBlockScalar = require_resolve_block_scalar();
18306
18306
  var resolveFlowScalar = require_resolve_flow_scalar();
@@ -18309,17 +18309,17 @@ var require_compose_scalar = __commonJS((exports) => {
18309
18309
  const tagName = tagToken ? ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg)) : null;
18310
18310
  let tag;
18311
18311
  if (ctx.options.stringKeys && ctx.atKey) {
18312
- tag = ctx.schema[identity2.SCALAR];
18312
+ tag = ctx.schema[identity.SCALAR];
18313
18313
  } else if (tagName)
18314
18314
  tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
18315
18315
  else if (token.type === "scalar")
18316
18316
  tag = findScalarTagByTest(ctx, value, token, onError);
18317
18317
  else
18318
- tag = ctx.schema[identity2.SCALAR];
18318
+ tag = ctx.schema[identity.SCALAR];
18319
18319
  let scalar;
18320
18320
  try {
18321
18321
  const res = tag.resolve(value, (msg) => onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg), ctx.options);
18322
- scalar = identity2.isScalar(res) ? res : new Scalar.Scalar(res);
18322
+ scalar = identity.isScalar(res) ? res : new Scalar.Scalar(res);
18323
18323
  } catch (error46) {
18324
18324
  const msg = error46 instanceof Error ? error46.message : String(error46);
18325
18325
  onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg);
@@ -18339,7 +18339,7 @@ var require_compose_scalar = __commonJS((exports) => {
18339
18339
  }
18340
18340
  function findScalarTagByName(schema, value, tagName, tagToken, onError) {
18341
18341
  if (tagName === "!")
18342
- return schema[identity2.SCALAR];
18342
+ return schema[identity.SCALAR];
18343
18343
  const matchWithTest = [];
18344
18344
  for (const tag of schema.tags) {
18345
18345
  if (!tag.collection && tag.tag === tagName) {
@@ -18358,12 +18358,12 @@ var require_compose_scalar = __commonJS((exports) => {
18358
18358
  return kt;
18359
18359
  }
18360
18360
  onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, tagName !== "tag:yaml.org,2002:str");
18361
- return schema[identity2.SCALAR];
18361
+ return schema[identity.SCALAR];
18362
18362
  }
18363
18363
  function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
18364
- const tag = schema.tags.find((tag2) => (tag2.default === true || atKey && tag2.default === "key") && tag2.test?.test(value)) || schema[identity2.SCALAR];
18364
+ const tag = schema.tags.find((tag2) => (tag2.default === true || atKey && tag2.default === "key") && tag2.test?.test(value)) || schema[identity.SCALAR];
18365
18365
  if (schema.compat) {
18366
- const compat2 = schema.compat.find((tag2) => tag2.default && tag2.test?.test(value)) ?? schema[identity2.SCALAR];
18366
+ const compat2 = schema.compat.find((tag2) => tag2.default && tag2.test?.test(value)) ?? schema[identity.SCALAR];
18367
18367
  if (tag.tag !== compat2.tag) {
18368
18368
  const ts = directives.tagString(tag.tag);
18369
18369
  const cs = directives.tagString(compat2.tag);
@@ -18406,7 +18406,7 @@ var require_util_empty_scalar_position = __commonJS((exports) => {
18406
18406
  // ../../node_modules/yaml/dist/compose/compose-node.js
18407
18407
  var require_compose_node = __commonJS((exports) => {
18408
18408
  var Alias = require_Alias();
18409
- var identity2 = require_identity();
18409
+ var identity = require_identity();
18410
18410
  var composeCollection = require_compose_collection();
18411
18411
  var composeScalar = require_compose_scalar();
18412
18412
  var resolveEnd = require_resolve_end();
@@ -18447,7 +18447,7 @@ var require_compose_node = __commonJS((exports) => {
18447
18447
  }
18448
18448
  if (anchor && node.anchor === "")
18449
18449
  onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string");
18450
- if (atKey && ctx.options.stringKeys && (!identity2.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) {
18450
+ if (atKey && ctx.options.stringKeys && (!identity.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) {
18451
18451
  const msg = "With stringKeys, all keys must be strings";
18452
18452
  onError(tag ?? token, "NON_STRING_KEY", msg);
18453
18453
  }
@@ -18547,7 +18547,7 @@ var require_composer = __commonJS((exports) => {
18547
18547
  var directives = require_directives();
18548
18548
  var Document = require_Document();
18549
18549
  var errors3 = require_errors();
18550
- var identity2 = require_identity();
18550
+ var identity = require_identity();
18551
18551
  var composeDoc = require_compose_doc();
18552
18552
  var resolveEnd = require_resolve_end();
18553
18553
  function getErrorPos(src) {
@@ -18613,9 +18613,9 @@ var require_composer = __commonJS((exports) => {
18613
18613
  ${comment}` : comment;
18614
18614
  } else if (afterEmptyLine || doc2.directives.docStart || !dc) {
18615
18615
  doc2.commentBefore = comment;
18616
- } else if (identity2.isCollection(dc) && !dc.flow && dc.items.length > 0) {
18616
+ } else if (identity.isCollection(dc) && !dc.flow && dc.items.length > 0) {
18617
18617
  let it = dc.items[0];
18618
- if (identity2.isPair(it))
18618
+ if (identity.isPair(it))
18619
18619
  it = it.key;
18620
18620
  const cb = it.commentBefore;
18621
18621
  it.commentBefore = cb ? `${comment}
@@ -20607,7 +20607,7 @@ var require_public_api = __commonJS((exports) => {
20607
20607
  var Document = require_Document();
20608
20608
  var errors3 = require_errors();
20609
20609
  var log = require_log();
20610
- var identity2 = require_identity();
20610
+ var identity = require_identity();
20611
20611
  var lineCounter = require_line_counter();
20612
20612
  var parser = require_parser();
20613
20613
  function parseOptions(options) {
@@ -20685,7 +20685,7 @@ var require_public_api = __commonJS((exports) => {
20685
20685
  if (!keepUndefined)
20686
20686
  return;
20687
20687
  }
20688
- if (identity2.isDocument(value) && !_replacer)
20688
+ if (identity.isDocument(value) && !_replacer)
20689
20689
  return value.toString(options);
20690
20690
  return new Document.Document(value, _replacer, options).toString(options);
20691
20691
  }
@@ -37660,7 +37660,7 @@ var {
37660
37660
  Help
37661
37661
  } = import__.default;
37662
37662
  // package.json
37663
- var version = "0.9.78";
37663
+ var version = "0.9.80";
37664
37664
 
37665
37665
  // src/commands/code.ts
37666
37666
  import { readFile as readFile4 } from "node:fs/promises";
@@ -64146,7 +64146,1026 @@ var agentWorkflow = async (input, { step, tools, logger }) => {
64146
64146
  await event("end-task", { kind: "EndTask" /* EndTask */, exitReason: { type: "UsageExceeded", messages } });
64147
64147
  throw new Error("Maximum number of tool round trips reached.");
64148
64148
  };
64149
+ // ../../node_modules/yaml/dist/index.js
64150
+ var composer = require_composer();
64151
+ var Document = require_Document();
64152
+ var Schema = require_Schema();
64153
+ var errors3 = require_errors();
64154
+ var Alias = require_Alias();
64155
+ var identity = require_identity();
64156
+ var Pair = require_Pair();
64157
+ var Scalar = require_Scalar();
64158
+ var YAMLMap = require_YAMLMap();
64159
+ var YAMLSeq = require_YAMLSeq();
64160
+ var cst = require_cst();
64161
+ var lexer = require_lexer();
64162
+ var lineCounter = require_line_counter();
64163
+ var parser = require_parser();
64164
+ var publicApi = require_public_api();
64165
+ var visit = require_visit();
64166
+ var $Composer = composer.Composer;
64167
+ var $Document = Document.Document;
64168
+ var $Schema = Schema.Schema;
64169
+ var $YAMLError = errors3.YAMLError;
64170
+ var $YAMLParseError = errors3.YAMLParseError;
64171
+ var $YAMLWarning = errors3.YAMLWarning;
64172
+ var $Alias = Alias.Alias;
64173
+ var $isAlias = identity.isAlias;
64174
+ var $isCollection = identity.isCollection;
64175
+ var $isDocument = identity.isDocument;
64176
+ var $isMap = identity.isMap;
64177
+ var $isNode = identity.isNode;
64178
+ var $isPair = identity.isPair;
64179
+ var $isScalar = identity.isScalar;
64180
+ var $isSeq = identity.isSeq;
64181
+ var $Pair = Pair.Pair;
64182
+ var $Scalar = Scalar.Scalar;
64183
+ var $YAMLMap = YAMLMap.YAMLMap;
64184
+ var $YAMLSeq = YAMLSeq.YAMLSeq;
64185
+ var $Lexer = lexer.Lexer;
64186
+ var $LineCounter = lineCounter.LineCounter;
64187
+ var $Parser = parser.Parser;
64188
+ var $parse = publicApi.parse;
64189
+ var $parseAllDocuments = publicApi.parseAllDocuments;
64190
+ var $parseDocument = publicApi.parseDocument;
64191
+ var $stringify = publicApi.stringify;
64192
+ var $visit = visit.visit;
64193
+ var $visitAsync = visit.visitAsync;
64194
+
64195
+ // ../core/src/workflow/dynamic-types.ts
64196
+ var WorkflowInputDefinitionSchema = exports_external.object({
64197
+ id: exports_external.string(),
64198
+ description: exports_external.string().nullish(),
64199
+ default: exports_external.any().nullish()
64200
+ });
64201
+ var WorkflowStepDefinitionSchema = exports_external.object({
64202
+ id: exports_external.string(),
64203
+ tools: exports_external.array(exports_external.string()).nullish(),
64204
+ task: exports_external.string(),
64205
+ output: exports_external.string().nullish(),
64206
+ expected_outcome: exports_external.string().nullish(),
64207
+ code: exports_external.string().nullish(),
64208
+ outputSchema: exports_external.any().nullish(),
64209
+ timeout: exports_external.number().positive().nullish()
64210
+ });
64211
+ var WorkflowDefinitionSchema = exports_external.object({
64212
+ task: exports_external.string(),
64213
+ inputs: exports_external.array(WorkflowInputDefinitionSchema).nullish(),
64214
+ steps: exports_external.array(WorkflowStepDefinitionSchema),
64215
+ output: exports_external.string().nullish()
64216
+ });
64217
+ var WorkflowFileSchema = exports_external.object({
64218
+ workflows: exports_external.record(exports_external.string(), WorkflowDefinitionSchema)
64219
+ });
64220
+
64221
+ // ../core/src/workflow/dynamic.ts
64222
+ function parseDynamicWorkflowDefinition(source) {
64223
+ try {
64224
+ const raw = $parse(source);
64225
+ const validated = WorkflowFileSchema.safeParse(raw);
64226
+ if (!validated.success) {
64227
+ return { success: false, error: exports_external.prettifyError(validated.error) };
64228
+ }
64229
+ return { success: true, definition: validated.data };
64230
+ } catch (error46) {
64231
+ return { success: false, error: error46 instanceof Error ? error46.message : String(error46) };
64232
+ }
64233
+ }
64234
+ var AsyncFunction = Object.getPrototypeOf(async () => {}).constructor;
64235
+ function validateAndApplyDefaults(workflowId, workflow, input) {
64236
+ if (!workflow.inputs || workflow.inputs.length === 0) {
64237
+ return input;
64238
+ }
64239
+ const validatedInput = {};
64240
+ const errors4 = [];
64241
+ for (const inputDef of workflow.inputs) {
64242
+ const providedValue = input[inputDef.id];
64243
+ if (providedValue !== undefined && providedValue !== null) {
64244
+ validatedInput[inputDef.id] = providedValue;
64245
+ } else if (inputDef.default !== undefined && inputDef.default !== null) {
64246
+ validatedInput[inputDef.id] = inputDef.default;
64247
+ } else {
64248
+ errors4.push(`Missing required input '${inputDef.id}'${inputDef.description ? `: ${inputDef.description}` : ""}`);
64249
+ }
64250
+ }
64251
+ if (errors4.length > 0) {
64252
+ throw new Error(`Workflow '${workflowId}' input validation failed:
64253
+ ${errors4.map((e) => ` - ${e}`).join(`
64254
+ `)}`);
64255
+ }
64256
+ return validatedInput;
64257
+ }
64258
+ function createRunWorkflowFn(args) {
64259
+ return async (subWorkflowId, subInput) => {
64260
+ const mergedInput = { ...args.input, ...args.state, ...subInput ?? {} };
64261
+ return await args.runInternal(subWorkflowId, mergedInput, args.context, args.state);
64262
+ };
64263
+ }
64264
+ function compileStep(stepDef, workflowId, compiledSteps) {
64265
+ const key = `${workflowId}.${stepDef.id}`;
64266
+ const existing = compiledSteps.get(key);
64267
+ if (existing) {
64268
+ return existing;
64269
+ }
64270
+ if (!stepDef.code) {
64271
+ throw new Error(`Step '${stepDef.id}' in workflow '${workflowId}' has no code`);
64272
+ }
64273
+ try {
64274
+ const fn = new AsyncFunction("ctx", stepDef.code);
64275
+ compiledSteps.set(key, fn);
64276
+ return fn;
64277
+ } catch (error46) {
64278
+ const errorMsg = error46 instanceof Error ? error46.message : String(error46);
64279
+ const codePreview = stepDef.code.length > 200 ? `${stepDef.code.substring(0, 200)}...` : stepDef.code;
64280
+ throw new Error(`Failed to compile code for step '${stepDef.id}' in workflow '${workflowId}':
64281
+ ` + ` Error: ${errorMsg}
64282
+ ` + ` Code:
64283
+ ${codePreview.split(`
64284
+ `).map((line) => ` ${line}`).join(`
64285
+ `)}`);
64286
+ }
64287
+ }
64288
+ async function executeStepWithAgent(stepDef, workflowId, input, state, context, options, runInternal) {
64289
+ const tools = context.tools;
64290
+ if (typeof tools.generateText !== "function" || typeof tools.invokeTool !== "function" || typeof tools.taskEvent !== "function") {
64291
+ throw new Error(`Step '${stepDef.id}' in workflow '${workflowId}' requires agent execution, but AgentToolRegistry tools are not available.`);
64292
+ }
64293
+ if (!options.toolInfo) {
64294
+ throw new Error(`Step '${stepDef.id}' in workflow '${workflowId}' requires agent execution, but no toolInfo was provided to DynamicWorkflowRunner.`);
64295
+ }
64296
+ const allowedToolNames = stepDef.tools;
64297
+ const toolsForAgent = allowedToolNames ? options.toolInfo.filter((t) => allowedToolNames.includes(t.name)) : [...options.toolInfo];
64298
+ if (!allowedToolNames || allowedToolNames.includes("runWorkflow")) {
64299
+ toolsForAgent.push({
64300
+ name: "runWorkflow",
64301
+ description: "Run a named sub-workflow defined in the current workflow file.",
64302
+ parameters: exports_external.object({
64303
+ workflowId: exports_external.string().describe("Sub-workflow id to run"),
64304
+ input: exports_external.any().nullish().describe("Optional input object for the sub-workflow")
64305
+ }),
64306
+ handler: async () => {
64307
+ return { type: "Error" /* Error */, message: { type: "error-text", value: "runWorkflow is virtual." } };
64308
+ }
64309
+ });
64310
+ }
64311
+ const allowedToolNameSet = new Set(toolsForAgent.map((t) => t.name));
64312
+ context.logger.debug(`[Agent] Available tools for step '${stepDef.id}': ${toolsForAgent.map((t) => t.name).join(", ")}`);
64313
+ const systemPrompt = options.stepSystemPrompt?.({ workflowId, step: stepDef, input, state }) ?? [
64314
+ `You are an AI assistant executing a workflow step.`,
64315
+ "",
64316
+ "# Instructions",
64317
+ "- Execute the task defined in the user message.",
64318
+ "- Use the provided tools to accomplish the task.",
64319
+ "- Return the step output as valid JSON in markdown.",
64320
+ "- Do not ask for user input. If information is missing, make a reasonable assumption or fail."
64321
+ ].filter(Boolean).join(`
64322
+ `);
64323
+ const userContent = [
64324
+ `Workflow: ${workflowId}`,
64325
+ `Step: ${stepDef.id}`,
64326
+ `Task: ${stepDef.task}`,
64327
+ stepDef.expected_outcome ? `Expected outcome: ${stepDef.expected_outcome}` : "",
64328
+ `Workflow Input: ${JSON.stringify(input)}`,
64329
+ `Current State: ${JSON.stringify(state)}`
64330
+ ].filter(Boolean).join(`
64331
+ `);
64332
+ const runWorkflow = createRunWorkflowFn({ input, state, context, runInternal });
64333
+ const agentTools = {
64334
+ generateText: tools.generateText.bind(tools),
64335
+ taskEvent: tools.taskEvent.bind(tools),
64336
+ invokeTool: async ({ toolName, input: toolInput }) => {
64337
+ if (!allowedToolNameSet.has(toolName)) {
64338
+ return {
64339
+ type: "Error" /* Error */,
64340
+ message: { type: "error-text", value: `Tool '${toolName}' is not allowed in this step.` }
64341
+ };
64342
+ }
64343
+ if (toolName === "runWorkflow") {
64344
+ const subWorkflowId = toolInput?.workflowId;
64345
+ const subInput = toolInput?.input;
64346
+ if (typeof subWorkflowId !== "string") {
64347
+ return {
64348
+ type: "Error" /* Error */,
64349
+ message: { type: "error-text", value: "runWorkflow.workflowId must be a string." }
64350
+ };
64351
+ }
64352
+ try {
64353
+ const output = await runWorkflow(subWorkflowId, subInput);
64354
+ const jsonResult = { type: "json", value: output };
64355
+ return { type: "Reply" /* Reply */, message: jsonResult };
64356
+ } catch (error46) {
64357
+ return {
64358
+ type: "Error" /* Error */,
64359
+ message: { type: "error-text", value: error46 instanceof Error ? error46.message : String(error46) }
64360
+ };
64361
+ }
64362
+ }
64363
+ return await tools.invokeTool({ toolName, input: toolInput });
64364
+ }
64365
+ };
64366
+ const result = await agentWorkflow({
64367
+ tools: toolsForAgent,
64368
+ systemPrompt,
64369
+ userMessage: [{ role: "user", content: userContent }],
64370
+ maxToolRoundTrips: options.maxToolRoundTrips,
64371
+ model: options.model
64372
+ }, { ...context, tools: agentTools });
64373
+ if (result.type === "Exit") {
64374
+ if (result.object !== undefined) {
64375
+ return result.object;
64376
+ }
64377
+ const parsed = parseJsonFromMarkdown(result.message);
64378
+ if (parsed.success) {
64379
+ return parsed.data;
64380
+ }
64381
+ if (options.wrapAgentResultInObject) {
64382
+ context.logger.warn(`[Agent] Step '${stepDef.id}' returned plain text instead of JSON. Wrapping in {result: ...}`);
64383
+ return { result: result.message };
64384
+ }
64385
+ return result.message;
64386
+ }
64387
+ if (result.type === "Error") {
64388
+ throw new Error(`Agent step '${stepDef.id}' in workflow '${workflowId}' failed: ${result.error?.message || "Unknown error"}`);
64389
+ }
64390
+ if (result.type === "UsageExceeded") {
64391
+ throw new Error(`Agent step '${stepDef.id}' in workflow '${workflowId}' exceeded usage limits (tokens or rounds)`);
64392
+ }
64393
+ throw new Error(`Agent step '${stepDef.id}' in workflow '${workflowId}' exited unexpectedly with type: ${result.type}`);
64394
+ }
64395
+ async function executeStepWithTimeout(stepDef, workflowId, input, state, context, options, compiledSteps, runInternal) {
64396
+ const executeStepLogic = async () => {
64397
+ if (stepDef.code && options.allowUnsafeCodeExecution) {
64398
+ context.logger.debug(`[Step] Executing step '${stepDef.id}' with compiled code`);
64399
+ const fn = compileStep(stepDef, workflowId, compiledSteps);
64400
+ const runWorkflow = createRunWorkflowFn({ input, state, context, runInternal });
64401
+ const runtimeCtx = {
64402
+ workflowId,
64403
+ stepId: stepDef.id,
64404
+ input,
64405
+ state,
64406
+ tools: context.tools,
64407
+ logger: context.logger,
64408
+ step: context.step,
64409
+ runWorkflow,
64410
+ toolInfo: options.toolInfo
64411
+ };
64412
+ const result2 = await fn(runtimeCtx);
64413
+ context.logger.debug(`[Step] Compiled code execution completed for step '${stepDef.id}'`);
64414
+ return result2;
64415
+ }
64416
+ context.logger.debug(`[Step] Executing step '${stepDef.id}' with agent`);
64417
+ const result = await executeStepWithAgent(stepDef, workflowId, input, state, context, options, runInternal);
64418
+ context.logger.debug(`[Step] Agent execution completed for step '${stepDef.id}'`);
64419
+ return result;
64420
+ };
64421
+ if (stepDef.timeout && stepDef.timeout > 0) {
64422
+ context.logger.debug(`[Step] Step '${stepDef.id}' has timeout of ${stepDef.timeout}ms`);
64423
+ let timeoutId;
64424
+ const timeoutPromise = new Promise((_, reject) => {
64425
+ timeoutId = setTimeout(() => reject(new Error(`Step '${stepDef.id}' in workflow '${workflowId}' timed out after ${stepDef.timeout}ms`)), stepDef.timeout);
64426
+ });
64427
+ try {
64428
+ return await Promise.race([executeStepLogic(), timeoutPromise]);
64429
+ } finally {
64430
+ if (timeoutId)
64431
+ clearTimeout(timeoutId);
64432
+ }
64433
+ }
64434
+ return await executeStepLogic();
64435
+ }
64436
+ async function executeStep(stepDef, workflowId, input, state, context, options, compiledSteps, runInternal) {
64437
+ const result = await executeStepWithTimeout(stepDef, workflowId, input, state, context, options, compiledSteps, runInternal);
64438
+ if (stepDef.outputSchema) {
64439
+ try {
64440
+ const _schema = exports_external.any();
64441
+ if (typeof stepDef.outputSchema === "object") {
64442
+ context.logger.debug(`[Step] Validating output for step '${stepDef.id}' against schema`);
64443
+ if (stepDef.outputSchema.type === "object") {
64444
+ if (typeof result !== "object" || result === null || Array.isArray(result)) {
64445
+ throw new Error(`Expected object output, got ${Array.isArray(result) ? "array" : result === null ? "null" : typeof result}`);
64446
+ }
64447
+ }
64448
+ if (stepDef.outputSchema.type === "array" && !Array.isArray(result)) {
64449
+ throw new Error(`Expected array output, got ${typeof result}`);
64450
+ }
64451
+ }
64452
+ } catch (error46) {
64453
+ throw new Error(`Step '${stepDef.id}' in workflow '${workflowId}' output validation failed: ${error46 instanceof Error ? error46.message : String(error46)}`);
64454
+ }
64455
+ }
64456
+ return result;
64457
+ }
64458
+ function createDynamicWorkflow(definition, options = {}) {
64459
+ if (typeof definition === "string") {
64460
+ const res = parseDynamicWorkflowDefinition(definition);
64461
+ if (!res.success) {
64462
+ throw new Error(res.error);
64463
+ }
64464
+ definition = res.definition;
64465
+ }
64466
+ const compiledSteps = new Map;
64467
+ const runInternal = async (workflowId, input, context, inheritedState) => {
64468
+ const workflow = definition.workflows[workflowId];
64469
+ if (!workflow) {
64470
+ throw new Error(`Workflow '${workflowId}' not found`);
64471
+ }
64472
+ const validatedInput = validateAndApplyDefaults(workflowId, workflow, input);
64473
+ context.logger.info(`[Workflow] Starting workflow '${workflowId}'`);
64474
+ context.logger.debug(`[Workflow] Input: ${JSON.stringify(validatedInput)}`);
64475
+ context.logger.debug(`[Workflow] Inherited state: ${JSON.stringify(inheritedState)}`);
64476
+ context.logger.debug(`[Workflow] Steps: ${workflow.steps.map((s) => s.id).join(", ")}`);
64477
+ const state = { ...inheritedState };
64478
+ let lastOutput;
64479
+ for (let i = 0;i < workflow.steps.length; i++) {
64480
+ const stepDef = workflow.steps[i];
64481
+ const stepName = `${workflowId}.${stepDef.id}`;
64482
+ context.logger.info(`[Workflow] Step ${i + 1}/${workflow.steps.length}: ${stepDef.id}`);
64483
+ context.logger.debug(`[Workflow] Step task: ${stepDef.task}`);
64484
+ if (stepDef.expected_outcome) {
64485
+ context.logger.debug(`[Workflow] Expected outcome: ${stepDef.expected_outcome}`);
64486
+ }
64487
+ context.logger.debug(`[Workflow] Current state keys: ${Object.keys(state).join(", ")}`);
64488
+ lastOutput = await context.step(stepName, async () => {
64489
+ return await executeStep(stepDef, workflowId, validatedInput, state, context, options, compiledSteps, runInternal);
64490
+ });
64491
+ const outputKey = stepDef.output ?? stepDef.id;
64492
+ state[outputKey] = lastOutput;
64493
+ context.logger.debug(`[Workflow] Step output stored as '${outputKey}': ${typeof lastOutput === "object" ? JSON.stringify(lastOutput).substring(0, 200) : lastOutput}`);
64494
+ }
64495
+ context.logger.info(`[Workflow] Completed workflow '${workflowId}'`);
64496
+ if (workflow.output) {
64497
+ context.logger.debug(`[Workflow] Returning output field: ${workflow.output}`);
64498
+ return state[workflow.output];
64499
+ }
64500
+ context.logger.debug(`[Workflow] Returning full state with keys: ${Object.keys(state).join(", ")}`);
64501
+ return state;
64502
+ };
64503
+ return async (workflowId, input, context) => {
64504
+ return await runInternal(workflowId, input, context, {});
64505
+ };
64506
+ }
64507
+ // ../core/src/workflow/dynamic-generator.workflow.ts
64508
+ var GenerateWorkflowDefinitionInputSchema = exports_external.object({
64509
+ prompt: exports_external.string(),
64510
+ availableTools: exports_external.array(exports_external.object({
64511
+ name: exports_external.string(),
64512
+ description: exports_external.string()
64513
+ })).optional()
64514
+ });
64515
+ var GenerateWorkflowCodeInputSchema = exports_external.object({
64516
+ workflow: WorkflowFileSchema
64517
+ });
64518
+ var WORKFLOW_DEFINITION_SYSTEM_PROMPT = `You are an expert workflow architect.
64519
+ Your task is to create a JSON workflow definition based on the user's request.
64520
+
64521
+ The workflow definition must follow this structure:
64522
+ {
64523
+ "workflows": {
64524
+ "workflowName": {
64525
+ "task": "Description of the workflow",
64526
+ "inputs": [
64527
+ { "id": "inputName", "description": "Description", "default": "optionalDefault" }
64528
+ ],
64529
+ "steps": [
64530
+ {
64531
+ "id": "stepId",
64532
+ "task": "Description of the step",
64533
+ "tools": ["toolName1", "toolName2"], // Optional: restrict which tools can be used
64534
+ "output": "outputVariableName", // Optional: defaults to step id
64535
+ "timeout": 30000, // Optional: timeout in milliseconds
64536
+ "expected_outcome": "What this step produces", // Optional: documentation
64537
+ "outputSchema": { "type": "object" } // Optional: validation schema
64538
+ }
64539
+ ],
64540
+ "output": "outputVariableName" // Optional
64541
+ }
64542
+ }
64543
+ }
64544
+
64545
+ Constraints:
64546
+ - You MUST always include a workflow named 'main'. This is the entry point.
64547
+ - The 'main' workflow input must be either empty (no input) or a single string input.
64548
+ - Break down complex tasks into logical steps.
64549
+ - Define clear inputs and outputs.
64550
+
64551
+ Quality Guidelines:
64552
+ - Add "timeout" field (in milliseconds) for steps that might take long (file I/O, API calls, searches)
64553
+ - Use "expected_outcome" field to document what each step should produce
64554
+ - Use descriptive step IDs (e.g., "validateInput", "fetchUserData", not "step1", "step2")
64555
+ - Design steps to be focused - one responsibility per step
64556
+ - For steps that process multiple items, consider creating a sub-workflow
64557
+ - Add "outputSchema" with type information for validation-critical steps
64558
+ - Order steps logically with clear data flow
64559
+
64560
+ Example 1:
64561
+ User: "Research a topic and summarize it."
64562
+ Output:
64563
+ \`\`\`json
64564
+ {
64565
+ "workflows": {
64566
+ "main": {
64567
+ "task": "Research a topic and provide a summary",
64568
+ "inputs": [
64569
+ { "id": "topic", "description": "The topic to research" }
64570
+ ],
64571
+ "steps": [
64572
+ {
64573
+ "id": "search",
64574
+ "task": "Search for information about the topic",
64575
+ "tools": ["search"],
64576
+ "output": "searchResults"
64577
+ },
64578
+ {
64579
+ "id": "summarize",
64580
+ "task": "Summarize the search results",
64581
+ "tools": ["generateText"],
64582
+ "output": "summary"
64583
+ }
64584
+ ],
64585
+ "output": "summary"
64586
+ }
64587
+ }
64588
+ }
64589
+ \`\`\`
64590
+
64591
+ Example 2:
64592
+ User: "Review urgent PRs. For each PR, run the review workflow."
64593
+ Output:
64594
+ \`\`\`json
64595
+ {
64596
+ "workflows": {
64597
+ "main": {
64598
+ "task": "Fetch urgent PRs and review them",
64599
+ "inputs": [],
64600
+ "steps": [
64601
+ {
64602
+ "id": "fetchPRs",
64603
+ "task": "Fetch list of urgent PRs",
64604
+ "tools": ["github_list_prs"],
64605
+ "output": "prs"
64606
+ },
64607
+ {
64608
+ "id": "reviewEachPR",
64609
+ "task": "Run review workflow for each PR",
64610
+ "tools": [],
64611
+ "output": "reviews"
64612
+ }
64613
+ ],
64614
+ "output": "reviews"
64615
+ },
64616
+ "reviewPR": {
64617
+ "task": "Review a single PR",
64618
+ "inputs": [
64619
+ { "id": "prId", "description": "ID of the PR to review" }
64620
+ ],
64621
+ "steps": [
64622
+ {
64623
+ "id": "getDiff",
64624
+ "task": "Get PR diff",
64625
+ "tools": ["github_get_diff"],
64626
+ "output": "diff"
64627
+ },
64628
+ {
64629
+ "id": "analyze",
64630
+ "task": "Analyze the diff",
64631
+ "tools": ["generateText"],
64632
+ "output": "analysis"
64633
+ }
64634
+ ],
64635
+ "output": "analysis"
64636
+ }
64637
+ }
64638
+ }
64639
+ \`\`\`
64640
+ `;
64641
+ var WORKFLOW_CODE_SYSTEM_PROMPT = `You are an expert TypeScript developer.
64642
+ Your task is to implement the TypeScript code for the steps in the provided workflow definition.
64643
+
64644
+ You will receive a JSON workflow definition where the "code" field is null.
64645
+ You must fill in the "code" field for each step with valid TypeScript code.
64646
+
64647
+ CRITICAL: Each step "code" field must contain ONLY the function body statements (the code inside the curly braces).
64648
+ DO NOT include function declaration, arrow function syntax, async keyword, parameter list, or outer curly braces.
64649
+
64650
+ The code will be wrapped automatically in: \`async (ctx) => { YOUR_CODE_HERE }\`
64651
+
64652
+ Example of CORRECT code field:
64653
+ \`\`\`ts
64654
+ const result = await ctx.tools.readFile({ path: 'README.md' })
64655
+ if (!result) throw new Error('File not found')
64656
+ return result
64657
+ \`\`\`
64658
+
64659
+ Example of INCORRECT code field (DO NOT DO THIS):
64660
+ \`\`\`ts
64661
+ async (ctx) => {
64662
+ const result = await ctx.tools.readFile({ path: 'README.md' })
64663
+ return result
64664
+ }
64665
+ \`\`\`
64666
+
64667
+ Example of INCORRECT code field (DO NOT DO THIS):
64668
+ \`\`\`ts
64669
+ (ctx) => {
64670
+ return 'hello'
64671
+ }
64672
+ \`\`\`
64673
+
64674
+ ## Runtime context (ctx)
64675
+ \`\`\`ts
64676
+ // Runtime types (for reference)
64677
+ type Logger = {
64678
+ debug: (...args: any[]) => void
64679
+ info: (...args: any[]) => void
64680
+ warn: (...args: any[]) => void
64681
+ error: (...args: any[]) => void
64682
+ }
64683
+
64684
+ type StepFn = {
64685
+ <T>(name: string, fn: () => Promise<T>): Promise<T>
64686
+ <T>(name: string, options: { retry?: number }, fn: () => Promise<T>): Promise<T>
64687
+ }
64688
+
64689
+ type JsonModelMessage = { role: 'system' | 'user' | 'assistant' | 'tool'; content: any }
64690
+ type JsonResponseMessage = { role: 'assistant' | 'tool'; content: any }
64691
+ type ToolSet = Record<string, any>
64692
+
64693
+ type ToolResponseResult =
64694
+ | { type: 'text'; value: string }
64695
+ | { type: 'json'; value: any }
64696
+ | { type: 'error-text'; value: string }
64697
+ | { type: 'error-json'; value: any }
64698
+ | { type: 'content'; value: any[] }
64699
+
64700
+ type AgentToolResponse =
64701
+ | { type: 'Reply'; message: ToolResponseResult }
64702
+ | { type: 'Exit'; message: string; object?: any }
64703
+ | { type: 'Error'; message: ToolResponseResult }
64704
+
64705
+ type ExitReason =
64706
+ | { type: 'UsageExceeded' }
64707
+ | { type: 'Exit'; message: string; object?: any }
64708
+ | { type: 'Error'; error: { message: string; stack?: string } }
64709
+
64710
+ type FullAgentToolInfo = { name: string; description: string; parameters: any; handler: any }
64711
+
64712
+ // Tools available on ctx.tools in dynamic steps
64713
+ type DynamicWorkflowTools = {
64714
+ // LLM + agent helpers
64715
+ generateText: (input: { messages: JsonModelMessage[]; tools: ToolSet }) => Promise<JsonResponseMessage[]>
64716
+ runAgent: (input: {
64717
+ tools: Readonly<FullAgentToolInfo[]>
64718
+ maxToolRoundTrips?: number
64719
+ userMessage: readonly JsonModelMessage[]
64720
+ } & ({ messages: JsonModelMessage[] } | { systemPrompt: string })) => Promise<ExitReason>
64721
+
64722
+ // Generic bridge to "agent tools" by name
64723
+ invokeTool: (input: { toolName: string; input: any }) => Promise<AgentToolResponse>
64724
+
64725
+ // File + command helpers (direct)
64726
+ readFile: (input: { path: string }) => Promise<string | null>
64727
+ writeToFile: (input: { path: string; content: string }) => Promise<void>
64728
+ executeCommand: (input: { command: string; pipe?: boolean } & ({ args: string[]; shell?: false } | { shell: true })) => Promise<{
64729
+ exitCode: number
64730
+ stdout: string
64731
+ stderr: string
64732
+ }>
64733
+
64734
+ // CLI UX helpers
64735
+ confirm: (input: { message: string }) => Promise<boolean>
64736
+ input: (input: { message: string; default?: string }) => Promise<string>
64737
+ select: (input: { message: string; choices: { name: string; value: string }[] }) => Promise<string>
64738
+ }
64739
+
64740
+ type DynamicStepRuntimeContext = {
64741
+ workflowId: string
64742
+ stepId: string
64743
+ input: Record<string, any>
64744
+ state: Record<string, any>
64745
+ tools: DynamicWorkflowTools
64746
+ logger: Logger
64747
+ step: StepFn
64748
+ runWorkflow: (workflowId: string, input?: Record<string, any>) => Promise<any>
64749
+ toolInfo?: ReadonlyArray<FullAgentToolInfo>
64750
+ }
64751
+ \`\`\`
64752
+
64753
+ - \`ctx.input\`: workflow inputs (read-only).
64754
+ - \`ctx.state\`: shared state between steps (previous step outputs are stored here).
64755
+ - \`ctx.tools\`: async tool functions. Call tools as \`await ctx.tools.someTool({ ... })\`.
64756
+ - \`ctx.runWorkflow\`: run a sub-workflow by id.
64757
+
64758
+ ## Guidelines
64759
+ - Use \`await\` for all async operations.
64760
+ - Return the output value for the step (this becomes the step output).
64761
+ - Access inputs via \`ctx.input.<inputId>\`.
64762
+ - Access previous step outputs via \`ctx.state.<stepOutputKey>\` (defaults to the step \`output\` or \`id\`).
64763
+
64764
+ ## Quality Guidelines for Code Implementation
64765
+
64766
+ ### Error Handling
64767
+ - ALWAYS validate inputs at the start of steps
64768
+ - Use try-catch for operations that might fail (file I/O, parsing, API calls)
64769
+ - Preserve stack traces: re-throw original errors rather than creating new ones
64770
+ - Use error type guards: \`const err = error instanceof Error ? error : new Error(String(error))\`
64771
+ - Check for null/undefined before using values
64772
+ - Handle edge cases (empty arrays, missing files, invalid data)
64773
+
64774
+ ### Logging
64775
+ - Use \`ctx.logger.info()\` for important progress updates
64776
+ - Use \`ctx.logger.debug()\` for detailed information
64777
+ - Use \`ctx.logger.warn()\` for recoverable issues
64778
+ - Use \`ctx.logger.error()\` before throwing errors
64779
+ - Log when starting and completing significant operations
64780
+ - Use template literals for readability: \`ctx.logger.info(\\\`Processing \${items.length} items...\\\`)\`
64781
+
64782
+ ### User Experience
64783
+ - Provide progress feedback for long operations
64784
+ - Return structured data (objects/arrays), not strings when possible
64785
+ - Include helpful metadata in results (counts, timestamps, status)
64786
+ - For batch operations, report progress: \`Processed 5/10 items\`
64787
+
64788
+ ### Data Validation
64789
+ - Validate required fields exist before accessing
64790
+ - Check data types match expectations
64791
+ - Validate array lengths before iteration
64792
+ - Example: \`if (!data?.users || !Array.isArray(data.users)) throw new Error('Invalid data format')\`
64793
+
64794
+ ### Best Practices
64795
+ - Use meaningful variable names
64796
+ - Avoid nested callbacks - use async/await
64797
+ - Clean up resources (close files, clear timeouts)
64798
+ - Return consistent data structures across similar steps
64799
+ - For iteration, consider batching or rate limiting
64800
+
64801
+ ### When to Simplify
64802
+ - Simple transformation steps (e.g., formatting strings) need only basic error handling
64803
+ - Internal sub-workflow steps with validated inputs from parent can skip redundant validation
64804
+ - Minimal logging is fine for fast steps (<100ms) that don't perform I/O or external calls
64805
+ - Use judgment: match error handling complexity to the step's failure risk and impact
64806
+
64807
+ ## Tool calling examples (every tool)
64808
+
64809
+ ### Direct ctx.tools methods
64810
+ \`\`\`ts
64811
+ // readFile
64812
+ const readme = await ctx.tools.readFile({ path: 'README.md' })
64813
+ if (readme == null) throw new Error('README.md not found')
64814
+
64815
+ // writeToFile
64816
+ await ctx.tools.writeToFile({ path: 'notes.txt', content: 'hello\\n' })
64817
+
64818
+ // executeCommand (args form)
64819
+ const rg = await ctx.tools.executeCommand({ command: 'rg', args: ['-n', 'TODO', '.'] })
64820
+ if (rg.exitCode !== 0) throw new Error(rg.stderr)
64821
+
64822
+ // executeCommand (shell form)
64823
+ await ctx.tools.executeCommand({ command: 'ls -la', shell: true, pipe: true })
64824
+
64825
+ // generateText (LLM call; pass tools: {})
64826
+ const msgs = await ctx.tools.generateText({
64827
+ messages: [
64828
+ { role: 'system', content: 'Summarize the following text.' },
64829
+ { role: 'user', content: readme },
64830
+ ],
64831
+ tools: {},
64832
+ })
64833
+ const last = msgs[msgs.length - 1]
64834
+ const lastText = typeof last?.content === 'string' ? last.content : JSON.stringify(last?.content)
64835
+
64836
+ // runAgent (nested agent; use ctx.toolInfo as the tool list)
64837
+ const agentRes = await ctx.tools.runAgent({
64838
+ systemPrompt: 'You are a helpful assistant.',
64839
+ userMessage: [{ role: 'user', content: 'Summarize README.md in 3 bullets.' }],
64840
+ tools: (ctx.toolInfo ?? []) as any,
64841
+ })
64842
+ if (agentRes.type !== 'Exit') throw new Error('runAgent failed')
64843
+
64844
+ // confirm / input / select (interactive)
64845
+ const ok = await ctx.tools.confirm({ message: 'Proceed?' })
64846
+ const name = await ctx.tools.input({ message: 'Name?', default: 'main' })
64847
+ const flavor = await ctx.tools.select({
64848
+ message: 'Pick one',
64849
+ choices: [
64850
+ { name: 'A', value: 'a' },
64851
+ { name: 'B', value: 'b' },
64852
+ ],
64853
+ })
64854
+
64855
+ \`\`\`
64856
+
64857
+ ### Agent tools via ctx.tools.invokeTool (toolName examples)
64858
+ \`\`\`ts
64859
+ // Helper to unwrap a successful tool reply
64860
+ function unwrapToolValue(resp: any) {
64861
+ if (!resp || resp.type !== 'Reply') {
64862
+ const msg = resp?.message?.value
64863
+ throw new Error(typeof msg === 'string' ? msg : JSON.stringify(resp))
64864
+ }
64865
+ return resp.message.value
64866
+ }
64867
+
64868
+ // askFollowupQuestion
64869
+ const answersText = unwrapToolValue(
64870
+ await ctx.tools.invokeTool({
64871
+ toolName: 'askFollowupQuestion',
64872
+ input: { questions: [{ prompt: 'Which directory?', options: ['src', 'packages'] }] },
64873
+ }),
64874
+ )
64875
+
64876
+ // listFiles
64877
+ const filesText = unwrapToolValue(
64878
+ await ctx.tools.invokeTool({
64879
+ toolName: 'listFiles',
64880
+ input: { path: 'src', recursive: true, maxCount: 2000, includeIgnored: false },
64881
+ }),
64882
+ )
64883
+
64884
+ // searchFiles
64885
+ const hitsText = unwrapToolValue(
64886
+ await ctx.tools.invokeTool({
64887
+ toolName: 'searchFiles',
64888
+ input: { path: '.', regex: 'generateWorkflowCodeWorkflow', filePattern: '*.ts' },
64889
+ }),
64890
+ )
64891
+
64892
+ // fetchUrl
64893
+ const pageText = unwrapToolValue(await ctx.tools.invokeTool({ toolName: 'fetchUrl', input: { url: 'https://example.com' } }))
64894
+
64895
+ // search (web search)
64896
+ const webResults = unwrapToolValue(
64897
+ await ctx.tools.invokeTool({ toolName: 'search', input: { query: 'TypeScript zod schema examples' } }),
64898
+ )
64899
+
64900
+ // executeCommand (provider-backed; may require approval in some environments)
64901
+ const cmdText = unwrapToolValue(
64902
+ await ctx.tools.invokeTool({ toolName: 'executeCommand', input: { command: 'bun test', requiresApproval: false } }),
64903
+ )
64904
+
64905
+ // readFile / writeToFile (provider-backed)
64906
+ const fileText = unwrapToolValue(
64907
+ await ctx.tools.invokeTool({ toolName: 'readFile', input: { path: 'README.md', includeIgnored: false } }),
64908
+ )
64909
+ const writeText = unwrapToolValue(await ctx.tools.invokeTool({ toolName: 'writeToFile', input: { path: 'out.txt', content: 'hi' } }))
64910
+
64911
+ // replaceInFile
64912
+ const diff = ['<<<<<<< SEARCH', 'old', '=======', 'new', '>>>>>>> REPLACE'].join('\\n')
64913
+ const replaceText = unwrapToolValue(await ctx.tools.invokeTool({ toolName: 'replaceInFile', input: { path: 'out.txt', diff } }))
64914
+
64915
+ // removeFile / renameFile
64916
+ const rmText = unwrapToolValue(await ctx.tools.invokeTool({ toolName: 'removeFile', input: { path: 'out.txt' } }))
64917
+ const mvText = unwrapToolValue(
64918
+ await ctx.tools.invokeTool({ toolName: 'renameFile', input: { source_path: 'a.txt', target_path: 'b.txt' } }),
64919
+ )
64920
+
64921
+ // readBinaryFile (returns { type: 'content', value: [...] } in resp.message)
64922
+ const binResp = await ctx.tools.invokeTool({ toolName: 'readBinaryFile', input: { url: 'file://path/to/image.png' } })
64923
+ \`\`\`
64924
+
64925
+ ### Sub-workflow example (ctx.runWorkflow)
64926
+ \`\`\`ts
64927
+ const results: any[] = []
64928
+ for (const pr of ctx.state.prs ?? []) {
64929
+ results.push(await ctx.runWorkflow('reviewPR', { prId: pr.id }))
64930
+ }
64931
+ return results
64932
+ \`\`\`
64933
+
64934
+ ## Complete Example: High-Quality Step Implementation
64935
+
64936
+ This example demonstrates all quality guidelines in a single step:
64937
+
64938
+ \`\`\`ts
64939
+ // Step: processUserData
64940
+ // Task: Read, validate, and process user data from a file
64941
+
64942
+ // Input validation
64943
+ if (!ctx.input.dataFile) {
64944
+ throw new Error('Missing required input: dataFile')
64945
+ }
64946
+
64947
+ ctx.logger.info(\`Starting user data processing for: \${ctx.input.dataFile}\`)
64948
+
64949
+ // Read file with error handling
64950
+ let rawData
64951
+ try {
64952
+ ctx.logger.debug(\`Reading file: \${ctx.input.dataFile}\`)
64953
+ rawData = await ctx.tools.readFile({ path: ctx.input.dataFile })
64954
+
64955
+ if (!rawData) {
64956
+ throw new Error(\`File not found or empty: \${ctx.input.dataFile}\`)
64957
+ }
64958
+ } catch (error) {
64959
+ const err = error instanceof Error ? error : new Error(String(error))
64960
+ ctx.logger.error(\`Failed to read file: \${err.message}\`)
64961
+ throw err // Preserve original stack trace
64962
+ }
64963
+
64964
+ // Parse and validate data
64965
+ let users
64966
+ try {
64967
+ ctx.logger.debug('Parsing JSON data')
64968
+ const parsed = JSON.parse(rawData)
64969
+
64970
+ if (!parsed?.users || !Array.isArray(parsed.users)) {
64971
+ throw new Error('Invalid data format: expected {users: [...]}')
64972
+ }
64973
+
64974
+ users = parsed.users
64975
+ ctx.logger.info(\`Found \${users.length} users to process\`)
64976
+ } catch (error) {
64977
+ const err = error instanceof Error ? error : new Error(String(error))
64978
+ ctx.logger.error(\`Data parsing failed: \${err.message}\`)
64979
+ throw err // Preserve original stack trace
64980
+ }
64981
+
64982
+ // Process each user with progress reporting
64983
+ const results = []
64984
+ for (let i = 0; i < users.length; i++) {
64985
+ const user = users[i]
64986
+
64987
+ // Validate each user object
64988
+ if (!user?.id || !user?.email) {
64989
+ ctx.logger.warn(\`Skipping invalid user at index \${i}: missing id or email\`)
64990
+ continue
64991
+ }
64992
+
64993
+ // Process user
64994
+ const processed = {
64995
+ id: user.id,
64996
+ email: user.email.toLowerCase().trim(),
64997
+ name: user.name?.trim() || 'Unknown',
64998
+ processedAt: new Date().toISOString(),
64999
+ status: 'active'
65000
+ }
65001
+
65002
+ results.push(processed)
65003
+
65004
+ // Progress feedback every 10 items
65005
+ if ((i + 1) % 10 === 0) {
65006
+ ctx.logger.info(\`Processed \${i + 1}/\${users.length} users\`)
65007
+ }
65008
+ }
65009
+
65010
+ ctx.logger.info(\`Successfully processed \${results.length}/\${users.length} users\`)
65011
+
65012
+ // Return structured result with metadata
65013
+ return {
65014
+ users: results,
65015
+ metadata: {
65016
+ totalInput: users.length,
65017
+ totalProcessed: results.length,
65018
+ skipped: users.length - results.length,
65019
+ processedAt: new Date().toISOString()
65020
+ }
65021
+ }
65022
+ \`\`\`
65023
+
65024
+ Key features demonstrated:
65025
+ - Input validation at start
65026
+ - Comprehensive error handling with try-catch that preserves stack traces
65027
+ - Logging at info, debug, warn, and error levels
65028
+ - Progress reporting for long operations (every 10 items)
65029
+ - Data validation throughout (null checks, type checks, array validation)
65030
+ - Structured return value with metadata for observability
65031
+ - Descriptive error messages with context
65032
+ - Meaningful variable names (rawData, users, processed)
65033
+ - Clean async/await usage
65034
+ - Template literals for readable string interpolation
65035
+ - Proper error type guards (error instanceof Error)
65036
+
65037
+ ## Final Instructions
65038
+
65039
+ REMEMBER: The "code" field must be ONLY the function body statements.
65040
+ - DO NOT wrap code in arrow functions: \`(ctx) => { ... }\`
65041
+ - DO NOT wrap code in async functions: \`async (ctx) => { ... }\`
65042
+ - DO NOT include outer curly braces
65043
+ - DO include a return statement if the step should produce output
65044
+ - Each "code" field should be a string containing multiple statements separated by newlines
65045
+
65046
+ Return the complete workflow JSON with the "code" fields populated.
65047
+ `;
65048
+ var generateWorkflowDefinitionWorkflow = async (input, ctx) => {
65049
+ let systemPrompt = WORKFLOW_DEFINITION_SYSTEM_PROMPT;
65050
+ if (input.availableTools && input.availableTools.length > 0) {
65051
+ const toolsList = input.availableTools.map((t) => `- ${t.name}: ${t.description}`).join(`
65052
+ `);
65053
+ systemPrompt += `
65054
+
65055
+ Available Tools:
65056
+ ${toolsList}
65057
+
65058
+ Use these tools when appropriate.`;
65059
+ }
65060
+ const result = await ctx.step("generate-workflow-definition", async () => {
65061
+ return agentWorkflow({
65062
+ systemPrompt,
65063
+ userMessage: [{ role: "user", content: input.prompt }],
65064
+ tools: [],
65065
+ outputSchema: WorkflowFileSchema
65066
+ }, ctx);
65067
+ });
65068
+ if (result.type === "Exit" && result.object) {
65069
+ return result.object;
65070
+ }
65071
+ throw new Error("Failed to generate workflow definition");
65072
+ };
65073
+ var generateWorkflowCodeWorkflow = async (input, ctx) => {
65074
+ const result = await ctx.step("generate-workflow-code", async () => {
65075
+ return agentWorkflow({
65076
+ systemPrompt: WORKFLOW_CODE_SYSTEM_PROMPT,
65077
+ userMessage: [{ role: "user", content: JSON.stringify(input.workflow, null, 2) }],
65078
+ tools: [],
65079
+ outputSchema: WorkflowFileSchema
65080
+ }, ctx);
65081
+ });
65082
+ if (result.type === "Exit" && result.object) {
65083
+ return result.object;
65084
+ }
65085
+ throw new Error("Failed to generate workflow code");
65086
+ };
64149
65087
  // ../core/src/workflow/json-ai-types.ts
65088
+ var toJsonDataContent = (data) => {
65089
+ if (data instanceof URL) {
65090
+ return {
65091
+ type: "url",
65092
+ value: data.toString()
65093
+ };
65094
+ }
65095
+ if (typeof data === "string") {
65096
+ return {
65097
+ type: "base64",
65098
+ value: data
65099
+ };
65100
+ }
65101
+ let buffer;
65102
+ if (data instanceof Uint8Array) {
65103
+ buffer = Buffer.from(data);
65104
+ } else if (data instanceof Buffer) {
65105
+ buffer = data;
65106
+ } else {
65107
+ buffer = Buffer.from(data);
65108
+ }
65109
+ return {
65110
+ type: "base64",
65111
+ value: buffer.toString("base64")
65112
+ };
65113
+ };
65114
+ var toJsonUserContent = (content) => {
65115
+ if (typeof content === "string") {
65116
+ return content;
65117
+ }
65118
+ return content.map((part) => {
65119
+ switch (part.type) {
65120
+ case "image":
65121
+ return {
65122
+ ...part,
65123
+ image: toJsonDataContent(part.image)
65124
+ };
65125
+ case "file":
65126
+ return {
65127
+ ...part,
65128
+ data: toJsonDataContent(part.data)
65129
+ };
65130
+ }
65131
+ return part;
65132
+ });
65133
+ };
65134
+ var toJsonAssistantContent = (content) => {
65135
+ if (typeof content === "string") {
65136
+ return content;
65137
+ }
65138
+ return content.map((part) => {
65139
+ switch (part.type) {
65140
+ case "file":
65141
+ return {
65142
+ ...part,
65143
+ data: toJsonDataContent(part.data)
65144
+ };
65145
+ case "tool-call":
65146
+ return {
65147
+ ...part,
65148
+ input: part.input
65149
+ };
65150
+ }
65151
+ return part;
65152
+ });
65153
+ };
65154
+ var toJsonModelMessage = (msg) => {
65155
+ switch (msg.role) {
65156
+ case "user":
65157
+ return {
65158
+ ...msg,
65159
+ content: toJsonUserContent(msg.content)
65160
+ };
65161
+ case "assistant":
65162
+ return {
65163
+ ...msg,
65164
+ content: toJsonAssistantContent(msg.content)
65165
+ };
65166
+ }
65167
+ return msg;
65168
+ };
64150
65169
  var fromJsonDataContent = (data) => {
64151
65170
  if (data.type === "url") {
64152
65171
  return new URL(data.value);
@@ -64352,10 +65371,10 @@ function isObject2(value) {
64352
65371
  var isObject_default = isObject2;
64353
65372
 
64354
65373
  // ../../node_modules/lodash-es/identity.js
64355
- function identity(value) {
65374
+ function identity2(value) {
64356
65375
  return value;
64357
65376
  }
64358
- var identity_default = identity;
65377
+ var identity_default = identity2;
64359
65378
 
64360
65379
  // ../../node_modules/lodash-es/isFunction.js
64361
65380
  var asyncTag = "[object AsyncFunction]";
@@ -65440,52 +66459,6 @@ function set2(object3, path, value) {
65440
66459
  return object3 == null ? object3 : _baseSet_default(object3, path, value);
65441
66460
  }
65442
66461
  var set_default = set2;
65443
- // ../../node_modules/yaml/dist/index.js
65444
- var composer = require_composer();
65445
- var Document = require_Document();
65446
- var Schema = require_Schema();
65447
- var errors3 = require_errors();
65448
- var Alias = require_Alias();
65449
- var identity2 = require_identity();
65450
- var Pair = require_Pair();
65451
- var Scalar = require_Scalar();
65452
- var YAMLMap = require_YAMLMap();
65453
- var YAMLSeq = require_YAMLSeq();
65454
- var cst = require_cst();
65455
- var lexer = require_lexer();
65456
- var lineCounter = require_line_counter();
65457
- var parser = require_parser();
65458
- var publicApi = require_public_api();
65459
- var visit = require_visit();
65460
- var $Composer = composer.Composer;
65461
- var $Document = Document.Document;
65462
- var $Schema = Schema.Schema;
65463
- var $YAMLError = errors3.YAMLError;
65464
- var $YAMLParseError = errors3.YAMLParseError;
65465
- var $YAMLWarning = errors3.YAMLWarning;
65466
- var $Alias = Alias.Alias;
65467
- var $isAlias = identity2.isAlias;
65468
- var $isCollection = identity2.isCollection;
65469
- var $isDocument = identity2.isDocument;
65470
- var $isMap = identity2.isMap;
65471
- var $isNode = identity2.isNode;
65472
- var $isPair = identity2.isPair;
65473
- var $isScalar = identity2.isScalar;
65474
- var $isSeq = identity2.isSeq;
65475
- var $Pair = Pair.Pair;
65476
- var $Scalar = Scalar.Scalar;
65477
- var $YAMLMap = YAMLMap.YAMLMap;
65478
- var $YAMLSeq = YAMLSeq.YAMLSeq;
65479
- var $Lexer = lexer.Lexer;
65480
- var $LineCounter = lineCounter.LineCounter;
65481
- var $Parser = parser.Parser;
65482
- var $parse = publicApi.parse;
65483
- var $parseAllDocuments = publicApi.parseAllDocuments;
65484
- var $parseDocument = publicApi.parseDocument;
65485
- var $stringify = publicApi.stringify;
65486
- var $visit = visit.visit;
65487
- var $visitAsync = visit.visitAsync;
65488
-
65489
66462
  // ../cli-shared/src/config.ts
65490
66463
  function getGlobalConfigPath(home = homedir()) {
65491
66464
  return join(home, ".config", "polkacodes", "config.yml");
@@ -70391,7 +71364,7 @@ function readMultiline(prompt = "Enter text (Ctrl+D to finish):") {
70391
71364
  const rl = readline3.createInterface({
70392
71365
  input: process.stdin,
70393
71366
  output: process.stdout,
70394
- terminal: true
71367
+ prompt: ""
70395
71368
  });
70396
71369
  const lines = [];
70397
71370
  rl.on("line", (line) => {
@@ -84062,7 +85035,7 @@ function getProviderOptions(options) {
84062
85035
 
84063
85036
  // src/tool-implementations.ts
84064
85037
  import { spawn as spawn3, spawnSync as spawnSync2 } from "node:child_process";
84065
- import fs3, { mkdir as mkdir2 } from "node:fs/promises";
85038
+ import fs4, { mkdir as mkdir2 } from "node:fs/promises";
84066
85039
  import { dirname as dirname2 } from "node:path";
84067
85040
 
84068
85041
  // src/tools/utils/diffLineNumbers.ts
@@ -84295,12 +85268,14 @@ async function getUserInput(message, options = {}) {
84295
85268
 
84296
85269
  // src/workflows/workflow.utils.ts
84297
85270
  import { execSync } from "node:child_process";
85271
+ import { promises as fs3 } from "node:fs";
85272
+ import path from "node:path";
84298
85273
  function parseGitDiffNameStatus(diffOutput) {
84299
85274
  const lines = diffOutput.split(`
84300
85275
  `).filter((line) => line.trim());
84301
85276
  return lines.map((line) => {
84302
85277
  const [status, ...pathParts] = line.split("\t");
84303
- const path = pathParts.join("\t");
85278
+ const path2 = pathParts.join("\t");
84304
85279
  let statusDescription;
84305
85280
  switch (status[0]) {
84306
85281
  case "A":
@@ -84324,7 +85299,7 @@ function parseGitDiffNameStatus(diffOutput) {
84324
85299
  default:
84325
85300
  statusDescription = "Unknown";
84326
85301
  }
84327
- return { path, status: statusDescription };
85302
+ return { path: path2, status: statusDescription };
84328
85303
  });
84329
85304
  }
84330
85305
  function printChangedFiles(logger, changedFiles) {
@@ -84351,21 +85326,21 @@ function parseGitDiffNumStat(output) {
84351
85326
  if (parts.length >= 3) {
84352
85327
  const insertions = parts[0] === "-" ? 0 : Number.parseInt(parts[0], 10);
84353
85328
  const deletions = parts[1] === "-" ? 0 : Number.parseInt(parts[1], 10);
84354
- const path = unquotePath(parts.slice(2).join("\t"));
84355
- stats[path] = { insertions, deletions };
85329
+ const path2 = unquotePath(parts.slice(2).join("\t"));
85330
+ stats[path2] = { insertions, deletions };
84356
85331
  }
84357
85332
  }
84358
85333
  return stats;
84359
85334
  }
84360
- var unquotePath = (path) => {
84361
- if (path.startsWith('"') && path.endsWith('"')) {
85335
+ var unquotePath = (path2) => {
85336
+ if (path2.startsWith('"') && path2.endsWith('"')) {
84362
85337
  try {
84363
- return JSON.parse(path);
85338
+ return JSON.parse(path2);
84364
85339
  } catch {
84365
- return path;
85340
+ return path2;
84366
85341
  }
84367
85342
  }
84368
- return path;
85343
+ return path2;
84369
85344
  };
84370
85345
  function parseGitStatus(statusOutput) {
84371
85346
  const statusLines = statusOutput.split(`
@@ -84374,7 +85349,7 @@ function parseGitStatus(statusOutput) {
84374
85349
  for (const line of statusLines) {
84375
85350
  const indexStatus = line[0];
84376
85351
  const workingTreeStatus = line[1];
84377
- const path = line.length > 3 ? unquotePath(line.slice(3)) : line;
85352
+ const path2 = line.length > 3 ? unquotePath(line.slice(3)) : line;
84378
85353
  const statuses = [];
84379
85354
  if (indexStatus !== " " && indexStatus !== "?") {
84380
85355
  switch (indexStatus) {
@@ -84413,7 +85388,7 @@ function parseGitStatus(statusOutput) {
84413
85388
  }
84414
85389
  }
84415
85390
  if (statuses.length > 0) {
84416
- files.push({ path, status: statuses.join(", ") });
85391
+ files.push({ path: path2, status: statuses.join(", ") });
84417
85392
  }
84418
85393
  }
84419
85394
  return files;
@@ -84559,6 +85534,12 @@ ${fileList}
84559
85534
  </file_list>`,
84560
85535
  `<now_date>${new Date().toISOString()}</now_date>`
84561
85536
  ];
85537
+ try {
85538
+ const agentsMdContent = await fs3.readFile(path.join(cwd, "AGENTS.md"), "utf-8");
85539
+ contextParts.push(`<agents_instructions>
85540
+ ${agentsMdContent}
85541
+ </agents_instructions>`);
85542
+ } catch {}
84562
85543
  if (config4?.rules) {
84563
85544
  contextParts.push(`<rules>
84564
85545
  ${config4.rules}
@@ -84683,12 +85664,12 @@ async function select(input2, context) {
84683
85664
  }
84684
85665
  async function writeToFile(input2) {
84685
85666
  await mkdir2(dirname2(input2.path), { recursive: true });
84686
- await fs3.writeFile(input2.path, input2.content);
85667
+ await fs4.writeFile(input2.path, input2.content);
84687
85668
  return {};
84688
85669
  }
84689
85670
  async function readFile3(input2) {
84690
85671
  try {
84691
- const content = await fs3.readFile(input2.path, "utf8");
85672
+ const content = await fs4.readFile(input2.path, "utf8");
84692
85673
  return content;
84693
85674
  } catch {}
84694
85675
  return null;
@@ -84815,7 +85796,7 @@ async function generateText2(input2, context) {
84815
85796
  }
84816
85797
  });
84817
85798
  const resp = await stream.response;
84818
- return resp.messages;
85799
+ return resp.messages.map(toJsonModelMessage);
84819
85800
  } catch (error46) {
84820
85801
  if (error46.name === "AbortError") {
84821
85802
  if (repetitionDetected) {
@@ -84913,7 +85894,11 @@ async function updateTodoItem(input2, context) {
84913
85894
  const provider3 = context.toolProvider;
84914
85895
  return provider3.updateTodoItem(input2);
84915
85896
  }
85897
+ async function runAgent(input2, context) {
85898
+ return await agentWorkflow(input2, context.workflowContext);
85899
+ }
84916
85900
  var localToolHandlers = {
85901
+ runAgent,
84917
85902
  createPullRequest,
84918
85903
  createCommit,
84919
85904
  printChangeFile,
@@ -85008,6 +85993,7 @@ async function runWorkflow(workflow2, workflowInput, options) {
85008
85993
  requestTimeoutSeconds: config4.requestTimeoutSeconds,
85009
85994
  usageMeter: usage
85010
85995
  };
85996
+ let context;
85011
85997
  const tools2 = new Proxy({}, {
85012
85998
  get: (_target, tool3) => {
85013
85999
  return async (input2) => {
@@ -85018,12 +86004,13 @@ async function runWorkflow(workflow2, workflowInput, options) {
85018
86004
  agentCallback: onEvent,
85019
86005
  toolProvider,
85020
86006
  command,
85021
- yes
86007
+ yes,
86008
+ workflowContext: context
85022
86009
  });
85023
86010
  };
85024
86011
  }
85025
86012
  });
85026
- const context = {
86013
+ context = {
85027
86014
  step: makeStepFn(),
85028
86015
  logger,
85029
86016
  tools: tools2
@@ -85092,6 +86079,9 @@ Memory is organized using topics, which are like named containers for different
85092
86079
  - Use the default topic for simple, single-context scenarios
85093
86080
  - Memory persists across all tool calls within the current workflow
85094
86081
  `;
86082
+ var AGENTS_INSTRUCTION = `## AGENTS.md Instructions
86083
+
86084
+ If you are working in a subdirectory, check if there is an AGENTS.md file in that directory or parent directories for specific instructions. These files contain project-specific guidelines and conventions that you must follow.`;
85095
86085
 
85096
86086
  // src/workflows/prompts/coder.ts
85097
86087
  var CODER_SYSTEM_PROMPT = `Role: AI developer.
@@ -85103,6 +86093,8 @@ ${MEMORY_USAGE_SECTION}
85103
86093
 
85104
86094
  ${TOOL_USAGE_INSTRUCTION}
85105
86095
 
86096
+ ${AGENTS_INSTRUCTION}
86097
+
85106
86098
  ## Implementation Guidelines
85107
86099
 
85108
86100
  ### 1. Plan Analysis
@@ -85149,6 +86141,8 @@ Please implement all the necessary code changes according to this plan.
85149
86141
 
85150
86142
  After making changes, you MUST return a JSON object in a markdown block with either a summary of the changes OR a bailReason if you cannot complete the task.
85151
86143
 
86144
+ DO NOT save this JSON object to a file. Output it directly in your response.
86145
+
85152
86146
  Example for successful implementation:
85153
86147
  ${createJsonResponseInstruction({
85154
86148
  summary: "Implemented user authentication with JWT tokens and password hashing.",
@@ -85529,6 +86523,8 @@ ${TOOL_USAGE_INSTRUCTION}
85529
86523
 
85530
86524
  After making changes, you MUST return a JSON object in a markdown block with either a summary of the changes OR a bailReason if you cannot complete the task.
85531
86525
 
86526
+ DO NOT save this JSON object to a file. Output it directly in your response.
86527
+
85532
86528
  Example for successful fix:
85533
86529
  ${createJsonResponseInstruction({
85534
86530
  summary: "Fixed the 'add' function in 'math.ts' to correctly handle negative numbers.",
@@ -85655,6 +86651,8 @@ ${MEMORY_USAGE_SECTION}
85655
86651
 
85656
86652
  ${TOOL_USAGE_INSTRUCTION}
85657
86653
 
86654
+ ${AGENTS_INSTRUCTION}
86655
+
85658
86656
  ## Your Role
85659
86657
 
85660
86658
  As a planner, your expertise lies in:
@@ -86177,10 +87175,10 @@ ${defaultContext}`;
86177
87175
  }
86178
87176
  const outputFiles = [];
86179
87177
  if (filePaths) {
86180
- for (const path of filePaths) {
86181
- const content = await tools2.readFile({ path });
87178
+ for (const path2 of filePaths) {
87179
+ const content = await tools2.readFile({ path: path2 });
86182
87180
  if (content) {
86183
- outputFiles.push({ path, content });
87181
+ outputFiles.push({ path: path2, content });
86184
87182
  }
86185
87183
  }
86186
87184
  }
@@ -86941,7 +87939,7 @@ async function performReviewAndFixCycle(iterationCount, taskItem, highLevelPlan,
86941
87939
  const commitMessages = [];
86942
87940
  for (let i2 = 0;i2 < MAX_REVIEW_RETRIES; i2++) {
86943
87941
  const diffResult = await tools2.executeCommand({ command: "git", args: ["diff", "--name-status", "HEAD~1", "HEAD"] });
86944
- const changedFiles = parseGitDiffNameStatus(diffResult.stdout).filter(({ path }) => path !== ".epic.yml");
87942
+ const changedFiles = parseGitDiffNameStatus(diffResult.stdout).filter(({ path: path2 }) => path2 !== ".epic.yml");
86945
87943
  if (changedFiles.length === 0) {
86946
87944
  logger.info(`No files were changed. Skipping review.
86947
87945
  `);
@@ -87150,7 +88148,7 @@ Phase 6: Final Review and Fixup...
87150
88148
  const commitRange = `${baseBranch}...${currentBranch}`;
87151
88149
  for (let i2 = 0;i2 < MAX_REVIEW_RETRIES; i2++) {
87152
88150
  const diffResult = await tools2.executeCommand({ command: "git", args: ["diff", "--name-status", commitRange] });
87153
- const changedFiles = parseGitDiffNameStatus(diffResult.stdout).filter(({ path }) => path !== ".epic.yml");
88151
+ const changedFiles = parseGitDiffNameStatus(diffResult.stdout).filter(({ path: path2 }) => path2 !== ".epic.yml");
87154
88152
  if (changedFiles.length === 0) {
87155
88153
  logger.info(`No files have been changed in this branch. Skipping final review.
87156
88154
  `);
@@ -87696,7 +88694,7 @@ var commitCommand = new Command("commit").description("Create a commit with AI-g
87696
88694
  });
87697
88695
 
87698
88696
  // src/workflows/epic-context.ts
87699
- import { promises as fs4 } from "node:fs";
88697
+ import { promises as fs5 } from "node:fs";
87700
88698
  var EPIC_CONTEXT_FILE = ".epic.yml";
87701
88699
  var EpicUsageSchema = exports_external.object({
87702
88700
  timestamp: exports_external.number(),
@@ -87725,12 +88723,12 @@ var saveEpicContext = async (context) => {
87725
88723
  memory: context.memory,
87726
88724
  usages: context.usages
87727
88725
  });
87728
- await fs4.writeFile(EPIC_CONTEXT_FILE, yamlString, "utf-8");
88726
+ await fs5.writeFile(EPIC_CONTEXT_FILE, yamlString, "utf-8");
87729
88727
  };
87730
88728
  var loadEpicContext = async () => {
87731
88729
  let fileContent;
87732
88730
  try {
87733
- fileContent = await fs4.readFile(EPIC_CONTEXT_FILE, "utf-8");
88731
+ fileContent = await fs5.readFile(EPIC_CONTEXT_FILE, "utf-8");
87734
88732
  } catch {
87735
88733
  return {};
87736
88734
  }
@@ -88257,6 +89255,176 @@ ${formattedReview}`;
88257
89255
  }
88258
89256
  });
88259
89257
 
89258
+ // src/commands/workflow.ts
89259
+ import { mkdir as mkdir3, readFile as readFile5, writeFile as writeFile2 } from "node:fs/promises";
89260
+ import { dirname as dirname3 } from "node:path";
89261
+ async function saveWorkflowFile(path2, workflow3) {
89262
+ await mkdir3(dirname3(path2), { recursive: true });
89263
+ await writeFile2(path2, $stringify(workflow3));
89264
+ }
89265
+ function clearWorkflowCode(workflowDef) {
89266
+ for (const wf of Object.values(workflowDef.workflows)) {
89267
+ for (const step of wf.steps) {
89268
+ step.code = undefined;
89269
+ }
89270
+ }
89271
+ }
89272
+ async function runWorkflowCommand(task2, _options, command) {
89273
+ const globalOpts = (command.parent ?? command).opts();
89274
+ const { verbose, yes } = globalOpts;
89275
+ const logger = createLogger({ verbose });
89276
+ const { file: file2, regenerate, create, workflow: workflowName } = command.opts();
89277
+ if (!file2) {
89278
+ logger.error("Error: Workflow file is required. Use -f or --file.");
89279
+ return;
89280
+ }
89281
+ const tools2 = [
89282
+ readFile_default,
89283
+ writeToFile_default,
89284
+ replaceInFile_default,
89285
+ searchFiles_default,
89286
+ listFiles_default,
89287
+ executeCommand_default,
89288
+ fetchUrl_default,
89289
+ readBinaryFile_default,
89290
+ removeFile_default,
89291
+ renameFile_default,
89292
+ askFollowupQuestion_default
89293
+ ];
89294
+ const availableTools = tools2.map((t2) => ({ name: t2.name, description: t2.description }));
89295
+ const isCreate = !!create;
89296
+ const isUpdate = !!regenerate;
89297
+ if (isCreate) {
89298
+ if (!task2) {
89299
+ logger.error("Error: Task is required for creating a workflow.");
89300
+ return;
89301
+ }
89302
+ logger.info("Generating workflow definition...");
89303
+ const defResult = await runWorkflow(generateWorkflowDefinitionWorkflow, { prompt: task2, availableTools }, { commandName: "workflow", command, logger, yes });
89304
+ if (!defResult) {
89305
+ logger.error("Failed to generate workflow definition.");
89306
+ return;
89307
+ }
89308
+ logger.info("Generating workflow code...");
89309
+ const codeResult = await runWorkflow(generateWorkflowCodeWorkflow, { workflow: defResult }, { commandName: "workflow", command, logger, yes });
89310
+ if (!codeResult) {
89311
+ logger.error("Failed to generate workflow code.");
89312
+ return;
89313
+ }
89314
+ await saveWorkflowFile(file2, codeResult);
89315
+ logger.info(`Workflow saved to '${file2}'.`);
89316
+ return;
89317
+ }
89318
+ if (isUpdate) {
89319
+ let workflowDef2;
89320
+ try {
89321
+ const content2 = await readFile5(file2, "utf-8");
89322
+ const res = parseDynamicWorkflowDefinition(content2);
89323
+ if (!res.success) {
89324
+ throw new Error(res.error);
89325
+ }
89326
+ workflowDef2 = res.definition;
89327
+ } catch (e2) {
89328
+ logger.error(`Error reading or parsing file '${file2}': ${e2}`);
89329
+ return;
89330
+ }
89331
+ if (task2) {
89332
+ logger.info("Updating workflow definition...");
89333
+ const updatePrompt = `Current workflow definition:
89334
+ ${JSON.stringify(workflowDef2, null, 2)}
89335
+
89336
+ Update request: ${task2}
89337
+
89338
+ Return the updated workflow definition.`;
89339
+ const defResult = await runWorkflow(generateWorkflowDefinitionWorkflow, { prompt: updatePrompt, availableTools }, { commandName: "workflow", command, logger, yes });
89340
+ if (!defResult) {
89341
+ logger.error("Failed to update workflow definition.");
89342
+ return;
89343
+ }
89344
+ workflowDef2 = defResult;
89345
+ } else {
89346
+ logger.info("Clearing existing code for regeneration...");
89347
+ clearWorkflowCode(workflowDef2);
89348
+ }
89349
+ logger.info("Generating workflow code...");
89350
+ const codeResult = await runWorkflow(generateWorkflowCodeWorkflow, { workflow: workflowDef2 }, { commandName: "workflow", command, logger, yes });
89351
+ if (!codeResult) {
89352
+ logger.error("Failed to generate workflow code.");
89353
+ return;
89354
+ }
89355
+ await saveWorkflowFile(file2, codeResult);
89356
+ logger.info(`Workflow saved to '${file2}'.`);
89357
+ return;
89358
+ }
89359
+ logger.info(`Executing workflow from '${file2}'...`);
89360
+ let content;
89361
+ try {
89362
+ content = await readFile5(file2, "utf-8");
89363
+ } catch (e2) {
89364
+ logger.error(`Error reading file '${file2}': ${e2}`);
89365
+ return;
89366
+ }
89367
+ logger.warn("Warning: allowUnsafeCodeExecution is enabled. This workflow has full access to your system.");
89368
+ const parsedResult = parseDynamicWorkflowDefinition(content);
89369
+ if (!parsedResult.success) {
89370
+ logger.error(`Failed to parse workflow: ${parsedResult.error}`);
89371
+ return;
89372
+ }
89373
+ const workflowDef = parsedResult.definition;
89374
+ const workflowNames = Object.keys(workflowDef.workflows);
89375
+ logger.info(`Available workflows: ${workflowNames.join(", ")}`);
89376
+ let workflowId = workflowName;
89377
+ if (!workflowId) {
89378
+ if (workflowNames.includes("main")) {
89379
+ workflowId = "main";
89380
+ logger.info(`Using 'main' workflow`);
89381
+ } else if (workflowNames.length === 1) {
89382
+ workflowId = workflowNames[0];
89383
+ logger.info(`Using workflow '${workflowId}'`);
89384
+ } else if (workflowNames.length > 1) {
89385
+ logger.error(`Multiple workflows found in file and no 'main' workflow. Please specify one using --workflow <name>. Available workflows: ${workflowNames.join(", ")}`);
89386
+ return;
89387
+ } else {
89388
+ logger.error("No workflows found in file.");
89389
+ return;
89390
+ }
89391
+ } else {
89392
+ if (!workflowNames.includes(workflowId)) {
89393
+ logger.error(`Workflow '${workflowId}' not found in file. Available workflows: ${workflowNames.join(", ")}`);
89394
+ return;
89395
+ }
89396
+ logger.info(`Using workflow '${workflowId}'`);
89397
+ }
89398
+ let dynamicRunner;
89399
+ try {
89400
+ dynamicRunner = createDynamicWorkflow(workflowDef, {
89401
+ allowUnsafeCodeExecution: true,
89402
+ toolInfo: tools2
89403
+ });
89404
+ } catch (error46) {
89405
+ logger.error(`Failed to parse workflow: ${error46.message}`);
89406
+ return;
89407
+ }
89408
+ const workflowFn = async (input2, context) => {
89409
+ return dynamicRunner(workflowId, input2, context);
89410
+ };
89411
+ const selectedWorkflow = workflowDef.workflows[workflowId];
89412
+ const workflowInput = {};
89413
+ if (selectedWorkflow.inputs && selectedWorkflow.inputs.length > 0 && task2) {
89414
+ const firstInput = selectedWorkflow.inputs[0];
89415
+ workflowInput[firstInput.id] = task2;
89416
+ logger.info(`Workflow input '${firstInput.id}': ${task2}`);
89417
+ } else if (selectedWorkflow.inputs && selectedWorkflow.inputs.length > 0) {
89418
+ logger.info(`Workflow expects inputs: ${selectedWorkflow.inputs.map((i2) => i2.id).join(", ")}`);
89419
+ } else {
89420
+ logger.info("Workflow has no inputs");
89421
+ }
89422
+ logger.info(`Workflow has ${selectedWorkflow.steps.length} step(s)`);
89423
+ logger.debug(`Steps: ${selectedWorkflow.steps.map((s2) => `${s2.id} (${s2.task})`).join(", ")}`);
89424
+ await runWorkflow(workflowFn, workflowInput, { commandName: "workflow", command, logger, yes });
89425
+ }
89426
+ var workflowCommand = new Command("workflow").description("Generate, manage, and run custom workflows.").argument("[task]", "The task description for generating the workflow.").option("-f, --file <path>", "Path to the workflow file").option("-w, --workflow <name>", "The name of the workflow to run").option("--create", "Create a new workflow").option("--regenerate", "Regenerate the code for the workflow").action(runWorkflowCommand);
89427
+
88260
89428
  // src/index.ts
88261
89429
  globalThis.AI_SDK_LOG_WARNINGS = false;
88262
89430
  var program2 = new Command;
@@ -88270,6 +89438,7 @@ program2.addCommand(planCommand);
88270
89438
  program2.addCommand(codeCommand);
88271
89439
  program2.addCommand(epicCommand);
88272
89440
  program2.addCommand(fixCommand);
89441
+ program2.addCommand(workflowCommand);
88273
89442
  addSharedOptions(program2);
88274
89443
  program2.parse();
88275
89444
  process.on("uncaughtException", (error46) => {