@excalibur-oss/extension-sdk 1.2.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/identity.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/visit.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/doc/directives.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/doc/anchors.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/doc/applyReviver.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/toJS.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/Node.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/Alias.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/Scalar.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/doc/createNode.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/Collection.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyComment.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/stringify/foldFlowLines.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyString.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/stringify/stringify.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyPair.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/log.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/merge.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/addPairToJSMap.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/Pair.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyCollection.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/YAMLMap.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/common/map.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/YAMLSeq.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/common/seq.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/common/string.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/common/null.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/core/bool.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyNumber.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/core/float.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/core/int.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/core/schema.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/json/schema.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/binary.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/pairs.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/omap.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/bool.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/float.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/int.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/set.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/schema.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/tags.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/Schema.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyDocument.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/doc/Document.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/errors.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-props.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/util-contains-newline.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/util-flow-indent-check.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/util-map-includes.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-block-map.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-block-seq.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-end.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-flow-collection.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/compose-collection.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-block-scalar.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-flow-scalar.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/compose-scalar.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/util-empty-scalar-position.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/compose-node.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/compose-doc.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/composer.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/parse/cst-scalar.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/parse/cst-stringify.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/parse/cst-visit.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/parse/cst.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/parse/lexer.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/parse/line-counter.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/parse/parser.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/public-api.js","../../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/index.js","../../shared/src/autonomy.ts","../../shared/src/enums.ts","../../shared/src/events.ts","../../shared/src/discovery.ts","../../shared/src/errors.ts","../../shared/src/artifacts.ts","../../shared/src/config.ts","../../shared/src/instructions.ts","../../shared/src/dashboard.ts","../../shared/src/ids.ts","../../shared/src/i18n.ts","../../shared/src/redaction.ts","../src/errors.ts","../../workflow-schema/src/schema.ts","../../workflow-schema/src/parse.ts","../../workflow-schema/src/default-workflows.ts","../../workflow-schema/src/default-methodologies.ts","../../workflow-schema/src/question-packs.ts","../src/logger.ts","../src/context.ts","../src/define-extension.ts","../../extension-runtime/src/manifest.ts","../../extension-runtime/src/extensions-file.ts","../../extension-runtime/src/contributions.ts","../../extension-runtime/src/hooks.ts","../../extension-runtime/src/registry.ts","../../extension-runtime/src/loader.ts","../../extension-runtime/src/permissions.ts","../../declarative-schemas/src/types.ts","../../declarative-schemas/src/schemas.ts","../../declarative-schemas/src/union.ts","../../declarative-schemas/src/parse.ts","../../declarative-schemas/src/markdown.ts","../../declarative-schemas/src/index.ts","../src/interfaces/tools.ts","../src/host/activate.ts","../src/interfaces/policy.ts"],"sourcesContent":["'use strict';\n\nconst ALIAS = Symbol.for('yaml.alias');\nconst DOC = Symbol.for('yaml.document');\nconst MAP = Symbol.for('yaml.map');\nconst PAIR = Symbol.for('yaml.pair');\nconst SCALAR = Symbol.for('yaml.scalar');\nconst SEQ = Symbol.for('yaml.seq');\nconst NODE_TYPE = Symbol.for('yaml.node.type');\nconst isAlias = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === ALIAS;\nconst isDocument = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === DOC;\nconst isMap = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === MAP;\nconst isPair = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === PAIR;\nconst isScalar = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SCALAR;\nconst isSeq = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SEQ;\nfunction isCollection(node) {\n if (node && typeof node === 'object')\n switch (node[NODE_TYPE]) {\n case MAP:\n case SEQ:\n return true;\n }\n return false;\n}\nfunction isNode(node) {\n if (node && typeof node === 'object')\n switch (node[NODE_TYPE]) {\n case ALIAS:\n case MAP:\n case SCALAR:\n case SEQ:\n return true;\n }\n return false;\n}\nconst hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor;\n\nexports.ALIAS = ALIAS;\nexports.DOC = DOC;\nexports.MAP = MAP;\nexports.NODE_TYPE = NODE_TYPE;\nexports.PAIR = PAIR;\nexports.SCALAR = SCALAR;\nexports.SEQ = SEQ;\nexports.hasAnchor = hasAnchor;\nexports.isAlias = isAlias;\nexports.isCollection = isCollection;\nexports.isDocument = isDocument;\nexports.isMap = isMap;\nexports.isNode = isNode;\nexports.isPair = isPair;\nexports.isScalar = isScalar;\nexports.isSeq = isSeq;\n","'use strict';\n\nvar identity = require('./nodes/identity.js');\n\nconst BREAK = Symbol('break visit');\nconst SKIP = Symbol('skip children');\nconst REMOVE = Symbol('remove node');\n/**\n * Apply a visitor to an AST node or document.\n *\n * Walks through the tree (depth-first) starting from `node`, calling a\n * `visitor` function with three arguments:\n * - `key`: For sequence values and map `Pair`, the node's index in the\n * collection. Within a `Pair`, `'key'` or `'value'`, correspondingly.\n * `null` for the root node.\n * - `node`: The current node.\n * - `path`: The ancestry of the current node.\n *\n * The return value of the visitor may be used to control the traversal:\n * - `undefined` (default): Do nothing and continue\n * - `visit.SKIP`: Do not visit the children of this node, continue with next\n * sibling\n * - `visit.BREAK`: Terminate traversal completely\n * - `visit.REMOVE`: Remove the current node, then continue with the next one\n * - `Node`: Replace the current node, then continue by visiting it\n * - `number`: While iterating the items of a sequence or map, set the index\n * of the next step. This is useful especially if the index of the current\n * node has changed.\n *\n * If `visitor` is a single function, it will be called with all values\n * encountered in the tree, including e.g. `null` values. Alternatively,\n * separate visitor functions may be defined for each `Map`, `Pair`, `Seq`,\n * `Alias` and `Scalar` node. To define the same visitor function for more than\n * one node type, use the `Collection` (map and seq), `Value` (map, seq & scalar)\n * and `Node` (alias, map, seq & scalar) targets. Of all these, only the most\n * specific defined one will be used for each node.\n */\nfunction visit(node, visitor) {\n const visitor_ = initVisitor(visitor);\n if (identity.isDocument(node)) {\n const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));\n if (cd === REMOVE)\n node.contents = null;\n }\n else\n visit_(null, node, visitor_, Object.freeze([]));\n}\n// Without the `as symbol` casts, TS declares these in the `visit`\n// namespace using `var`, but then complains about that because\n// `unique symbol` must be `const`.\n/** Terminate visit traversal completely */\nvisit.BREAK = BREAK;\n/** Do not visit the children of the current node */\nvisit.SKIP = SKIP;\n/** Remove the current node */\nvisit.REMOVE = REMOVE;\nfunction visit_(key, node, visitor, path) {\n const ctrl = callVisitor(key, node, visitor, path);\n if (identity.isNode(ctrl) || identity.isPair(ctrl)) {\n replaceNode(key, path, ctrl);\n return visit_(key, ctrl, visitor, path);\n }\n if (typeof ctrl !== 'symbol') {\n if (identity.isCollection(node)) {\n path = Object.freeze(path.concat(node));\n for (let i = 0; i < node.items.length; ++i) {\n const ci = visit_(i, node.items[i], visitor, path);\n if (typeof ci === 'number')\n i = ci - 1;\n else if (ci === BREAK)\n return BREAK;\n else if (ci === REMOVE) {\n node.items.splice(i, 1);\n i -= 1;\n }\n }\n }\n else if (identity.isPair(node)) {\n path = Object.freeze(path.concat(node));\n const ck = visit_('key', node.key, visitor, path);\n if (ck === BREAK)\n return BREAK;\n else if (ck === REMOVE)\n node.key = null;\n const cv = visit_('value', node.value, visitor, path);\n if (cv === BREAK)\n return BREAK;\n else if (cv === REMOVE)\n node.value = null;\n }\n }\n return ctrl;\n}\n/**\n * Apply an async visitor to an AST node or document.\n *\n * Walks through the tree (depth-first) starting from `node`, calling a\n * `visitor` function with three arguments:\n * - `key`: For sequence values and map `Pair`, the node's index in the\n * collection. Within a `Pair`, `'key'` or `'value'`, correspondingly.\n * `null` for the root node.\n * - `node`: The current node.\n * - `path`: The ancestry of the current node.\n *\n * The return value of the visitor may be used to control the traversal:\n * - `Promise`: Must resolve to one of the following values\n * - `undefined` (default): Do nothing and continue\n * - `visit.SKIP`: Do not visit the children of this node, continue with next\n * sibling\n * - `visit.BREAK`: Terminate traversal completely\n * - `visit.REMOVE`: Remove the current node, then continue with the next one\n * - `Node`: Replace the current node, then continue by visiting it\n * - `number`: While iterating the items of a sequence or map, set the index\n * of the next step. This is useful especially if the index of the current\n * node has changed.\n *\n * If `visitor` is a single function, it will be called with all values\n * encountered in the tree, including e.g. `null` values. Alternatively,\n * separate visitor functions may be defined for each `Map`, `Pair`, `Seq`,\n * `Alias` and `Scalar` node. To define the same visitor function for more than\n * one node type, use the `Collection` (map and seq), `Value` (map, seq & scalar)\n * and `Node` (alias, map, seq & scalar) targets. Of all these, only the most\n * specific defined one will be used for each node.\n */\nasync function visitAsync(node, visitor) {\n const visitor_ = initVisitor(visitor);\n if (identity.isDocument(node)) {\n const cd = await visitAsync_(null, node.contents, visitor_, Object.freeze([node]));\n if (cd === REMOVE)\n node.contents = null;\n }\n else\n await visitAsync_(null, node, visitor_, Object.freeze([]));\n}\n// Without the `as symbol` casts, TS declares these in the `visit`\n// namespace using `var`, but then complains about that because\n// `unique symbol` must be `const`.\n/** Terminate visit traversal completely */\nvisitAsync.BREAK = BREAK;\n/** Do not visit the children of the current node */\nvisitAsync.SKIP = SKIP;\n/** Remove the current node */\nvisitAsync.REMOVE = REMOVE;\nasync function visitAsync_(key, node, visitor, path) {\n const ctrl = await callVisitor(key, node, visitor, path);\n if (identity.isNode(ctrl) || identity.isPair(ctrl)) {\n replaceNode(key, path, ctrl);\n return visitAsync_(key, ctrl, visitor, path);\n }\n if (typeof ctrl !== 'symbol') {\n if (identity.isCollection(node)) {\n path = Object.freeze(path.concat(node));\n for (let i = 0; i < node.items.length; ++i) {\n const ci = await visitAsync_(i, node.items[i], visitor, path);\n if (typeof ci === 'number')\n i = ci - 1;\n else if (ci === BREAK)\n return BREAK;\n else if (ci === REMOVE) {\n node.items.splice(i, 1);\n i -= 1;\n }\n }\n }\n else if (identity.isPair(node)) {\n path = Object.freeze(path.concat(node));\n const ck = await visitAsync_('key', node.key, visitor, path);\n if (ck === BREAK)\n return BREAK;\n else if (ck === REMOVE)\n node.key = null;\n const cv = await visitAsync_('value', node.value, visitor, path);\n if (cv === BREAK)\n return BREAK;\n else if (cv === REMOVE)\n node.value = null;\n }\n }\n return ctrl;\n}\nfunction initVisitor(visitor) {\n if (typeof visitor === 'object' &&\n (visitor.Collection || visitor.Node || visitor.Value)) {\n return Object.assign({\n Alias: visitor.Node,\n Map: visitor.Node,\n Scalar: visitor.Node,\n Seq: visitor.Node\n }, visitor.Value && {\n Map: visitor.Value,\n Scalar: visitor.Value,\n Seq: visitor.Value\n }, visitor.Collection && {\n Map: visitor.Collection,\n Seq: visitor.Collection\n }, visitor);\n }\n return visitor;\n}\nfunction callVisitor(key, node, visitor, path) {\n if (typeof visitor === 'function')\n return visitor(key, node, path);\n if (identity.isMap(node))\n return visitor.Map?.(key, node, path);\n if (identity.isSeq(node))\n return visitor.Seq?.(key, node, path);\n if (identity.isPair(node))\n return visitor.Pair?.(key, node, path);\n if (identity.isScalar(node))\n return visitor.Scalar?.(key, node, path);\n if (identity.isAlias(node))\n return visitor.Alias?.(key, node, path);\n return undefined;\n}\nfunction replaceNode(key, path, node) {\n const parent = path[path.length - 1];\n if (identity.isCollection(parent)) {\n parent.items[key] = node;\n }\n else if (identity.isPair(parent)) {\n if (key === 'key')\n parent.key = node;\n else\n parent.value = node;\n }\n else if (identity.isDocument(parent)) {\n parent.contents = node;\n }\n else {\n const pt = identity.isAlias(parent) ? 'alias' : 'scalar';\n throw new Error(`Cannot replace node with ${pt} parent`);\n }\n}\n\nexports.visit = visit;\nexports.visitAsync = visitAsync;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar visit = require('../visit.js');\n\nconst escapeChars = {\n '!': '%21',\n ',': '%2C',\n '[': '%5B',\n ']': '%5D',\n '{': '%7B',\n '}': '%7D'\n};\nconst escapeTagName = (tn) => tn.replace(/[!,[\\]{}]/g, ch => escapeChars[ch]);\nclass Directives {\n constructor(yaml, tags) {\n /**\n * The directives-end/doc-start marker `---`. If `null`, a marker may still be\n * included in the document's stringified representation.\n */\n this.docStart = null;\n /** The doc-end marker `...`. */\n this.docEnd = false;\n this.yaml = Object.assign({}, Directives.defaultYaml, yaml);\n this.tags = Object.assign({}, Directives.defaultTags, tags);\n }\n clone() {\n const copy = new Directives(this.yaml, this.tags);\n copy.docStart = this.docStart;\n return copy;\n }\n /**\n * During parsing, get a Directives instance for the current document and\n * update the stream state according to the current version's spec.\n */\n atDocument() {\n const res = new Directives(this.yaml, this.tags);\n switch (this.yaml.version) {\n case '1.1':\n this.atNextDocument = true;\n break;\n case '1.2':\n this.atNextDocument = false;\n this.yaml = {\n explicit: Directives.defaultYaml.explicit,\n version: '1.2'\n };\n this.tags = Object.assign({}, Directives.defaultTags);\n break;\n }\n return res;\n }\n /**\n * @param onError - May be called even if the action was successful\n * @returns `true` on success\n */\n add(line, onError) {\n if (this.atNextDocument) {\n this.yaml = { explicit: Directives.defaultYaml.explicit, version: '1.1' };\n this.tags = Object.assign({}, Directives.defaultTags);\n this.atNextDocument = false;\n }\n const parts = line.trim().split(/[ \\t]+/);\n const name = parts.shift();\n switch (name) {\n case '%TAG': {\n if (parts.length !== 2) {\n onError(0, '%TAG directive should contain exactly two parts');\n if (parts.length < 2)\n return false;\n }\n const [handle, prefix] = parts;\n this.tags[handle] = prefix;\n return true;\n }\n case '%YAML': {\n this.yaml.explicit = true;\n if (parts.length !== 1) {\n onError(0, '%YAML directive should contain exactly one part');\n return false;\n }\n const [version] = parts;\n if (version === '1.1' || version === '1.2') {\n this.yaml.version = version;\n return true;\n }\n else {\n const isValid = /^\\d+\\.\\d+$/.test(version);\n onError(6, `Unsupported YAML version ${version}`, isValid);\n return false;\n }\n }\n default:\n onError(0, `Unknown directive ${name}`, true);\n return false;\n }\n }\n /**\n * Resolves a tag, matching handles to those defined in %TAG directives.\n *\n * @returns Resolved tag, which may also be the non-specific tag `'!'` or a\n * `'!local'` tag, or `null` if unresolvable.\n */\n tagName(source, onError) {\n if (source === '!')\n return '!'; // non-specific tag\n if (source[0] !== '!') {\n onError(`Not a valid tag: ${source}`);\n return null;\n }\n if (source[1] === '<') {\n const verbatim = source.slice(2, -1);\n if (verbatim === '!' || verbatim === '!!') {\n onError(`Verbatim tags aren't resolved, so ${source} is invalid.`);\n return null;\n }\n if (source[source.length - 1] !== '>')\n onError('Verbatim tags must end with a >');\n return verbatim;\n }\n const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s);\n if (!suffix)\n onError(`The ${source} tag has no suffix`);\n const prefix = this.tags[handle];\n if (prefix) {\n try {\n return prefix + decodeURIComponent(suffix);\n }\n catch (error) {\n onError(String(error));\n return null;\n }\n }\n if (handle === '!')\n return source; // local tag\n onError(`Could not resolve tag: ${source}`);\n return null;\n }\n /**\n * Given a fully resolved tag, returns its printable string form,\n * taking into account current tag prefixes and defaults.\n */\n tagString(tag) {\n for (const [handle, prefix] of Object.entries(this.tags)) {\n if (tag.startsWith(prefix))\n return handle + escapeTagName(tag.substring(prefix.length));\n }\n return tag[0] === '!' ? tag : `!<${tag}>`;\n }\n toString(doc) {\n const lines = this.yaml.explicit\n ? [`%YAML ${this.yaml.version || '1.2'}`]\n : [];\n const tagEntries = Object.entries(this.tags);\n let tagNames;\n if (doc && tagEntries.length > 0 && identity.isNode(doc.contents)) {\n const tags = {};\n visit.visit(doc.contents, (_key, node) => {\n if (identity.isNode(node) && node.tag)\n tags[node.tag] = true;\n });\n tagNames = Object.keys(tags);\n }\n else\n tagNames = [];\n for (const [handle, prefix] of tagEntries) {\n if (handle === '!!' && prefix === 'tag:yaml.org,2002:')\n continue;\n if (!doc || tagNames.some(tn => tn.startsWith(prefix)))\n lines.push(`%TAG ${handle} ${prefix}`);\n }\n return lines.join('\\n');\n }\n}\nDirectives.defaultYaml = { explicit: false, version: '1.2' };\nDirectives.defaultTags = { '!!': 'tag:yaml.org,2002:' };\n\nexports.Directives = Directives;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar visit = require('../visit.js');\n\n/**\n * Verify that the input string is a valid anchor.\n *\n * Will throw on errors.\n */\nfunction anchorIsValid(anchor) {\n if (/[\\x00-\\x19\\s,[\\]{}]/.test(anchor)) {\n const sa = JSON.stringify(anchor);\n const msg = `Anchor must not contain whitespace or control characters: ${sa}`;\n throw new Error(msg);\n }\n return true;\n}\nfunction anchorNames(root) {\n const anchors = new Set();\n visit.visit(root, {\n Value(_key, node) {\n if (node.anchor)\n anchors.add(node.anchor);\n }\n });\n return anchors;\n}\n/** Find a new anchor name with the given `prefix` and a one-indexed suffix. */\nfunction findNewAnchor(prefix, exclude) {\n for (let i = 1; true; ++i) {\n const name = `${prefix}${i}`;\n if (!exclude.has(name))\n return name;\n }\n}\nfunction createNodeAnchors(doc, prefix) {\n const aliasObjects = [];\n const sourceObjects = new Map();\n let prevAnchors = null;\n return {\n onAnchor: (source) => {\n aliasObjects.push(source);\n prevAnchors ?? (prevAnchors = anchorNames(doc));\n const anchor = findNewAnchor(prefix, prevAnchors);\n prevAnchors.add(anchor);\n return anchor;\n },\n /**\n * With circular references, the source node is only resolved after all\n * of its child nodes are. This is why anchors are set only after all of\n * the nodes have been created.\n */\n setAnchors: () => {\n for (const source of aliasObjects) {\n const ref = sourceObjects.get(source);\n if (typeof ref === 'object' &&\n ref.anchor &&\n (identity.isScalar(ref.node) || identity.isCollection(ref.node))) {\n ref.node.anchor = ref.anchor;\n }\n else {\n const error = new Error('Failed to resolve repeated object (this should not happen)');\n error.source = source;\n throw error;\n }\n }\n },\n sourceObjects\n };\n}\n\nexports.anchorIsValid = anchorIsValid;\nexports.anchorNames = anchorNames;\nexports.createNodeAnchors = createNodeAnchors;\nexports.findNewAnchor = findNewAnchor;\n","'use strict';\n\n/**\n * Applies the JSON.parse reviver algorithm as defined in the ECMA-262 spec,\n * in section 24.5.1.1 \"Runtime Semantics: InternalizeJSONProperty\" of the\n * 2021 edition: https://tc39.es/ecma262/#sec-json.parse\n *\n * Includes extensions for handling Map and Set objects.\n */\nfunction applyReviver(reviver, obj, key, val) {\n if (val && typeof val === 'object') {\n if (Array.isArray(val)) {\n for (let i = 0, len = val.length; i < len; ++i) {\n const v0 = val[i];\n const v1 = applyReviver(reviver, val, String(i), v0);\n // eslint-disable-next-line @typescript-eslint/no-array-delete\n if (v1 === undefined)\n delete val[i];\n else if (v1 !== v0)\n val[i] = v1;\n }\n }\n else if (val instanceof Map) {\n for (const k of Array.from(val.keys())) {\n const v0 = val.get(k);\n const v1 = applyReviver(reviver, val, k, v0);\n if (v1 === undefined)\n val.delete(k);\n else if (v1 !== v0)\n val.set(k, v1);\n }\n }\n else if (val instanceof Set) {\n for (const v0 of Array.from(val)) {\n const v1 = applyReviver(reviver, val, v0, v0);\n if (v1 === undefined)\n val.delete(v0);\n else if (v1 !== v0) {\n val.delete(v0);\n val.add(v1);\n }\n }\n }\n else {\n for (const [k, v0] of Object.entries(val)) {\n const v1 = applyReviver(reviver, val, k, v0);\n if (v1 === undefined)\n delete val[k];\n else if (v1 !== v0)\n val[k] = v1;\n }\n }\n }\n return reviver.call(obj, key, val);\n}\n\nexports.applyReviver = applyReviver;\n","'use strict';\n\nvar identity = require('./identity.js');\n\n/**\n * Recursively convert any node or its contents to native JavaScript\n *\n * @param value - The input value\n * @param arg - If `value` defines a `toJSON()` method, use this\n * as its first argument\n * @param ctx - Conversion context, originally set in Document#toJS(). If\n * `{ keep: true }` is not set, output should be suitable for JSON\n * stringification.\n */\nfunction toJS(value, arg, ctx) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n if (Array.isArray(value))\n return value.map((v, i) => toJS(v, String(i), ctx));\n if (value && typeof value.toJSON === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n if (!ctx || !identity.hasAnchor(value))\n return value.toJSON(arg, ctx);\n const data = { aliasCount: 0, count: 1, res: undefined };\n ctx.anchors.set(value, data);\n ctx.onCreate = res => {\n data.res = res;\n delete ctx.onCreate;\n };\n const res = value.toJSON(arg, ctx);\n if (ctx.onCreate)\n ctx.onCreate(res);\n return res;\n }\n if (typeof value === 'bigint' && !ctx?.keep)\n return Number(value);\n return value;\n}\n\nexports.toJS = toJS;\n","'use strict';\n\nvar applyReviver = require('../doc/applyReviver.js');\nvar identity = require('./identity.js');\nvar toJS = require('./toJS.js');\n\nclass NodeBase {\n constructor(type) {\n Object.defineProperty(this, identity.NODE_TYPE, { value: type });\n }\n /** Create a copy of this node. */\n clone() {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }\n /** A plain JavaScript representation of this node. */\n toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {\n if (!identity.isDocument(doc))\n throw new TypeError('A document argument is required');\n const ctx = {\n anchors: new Map(),\n doc,\n keep: true,\n mapAsMap: mapAsMap === true,\n mapKeyWarned: false,\n maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100\n };\n const res = toJS.toJS(this, '', ctx);\n if (typeof onAnchor === 'function')\n for (const { count, res } of ctx.anchors.values())\n onAnchor(res, count);\n return typeof reviver === 'function'\n ? applyReviver.applyReviver(reviver, { '': res }, '', res)\n : res;\n }\n}\n\nexports.NodeBase = NodeBase;\n","'use strict';\n\nvar anchors = require('../doc/anchors.js');\nvar visit = require('../visit.js');\nvar identity = require('./identity.js');\nvar Node = require('./Node.js');\nvar toJS = require('./toJS.js');\n\nclass Alias extends Node.NodeBase {\n constructor(source) {\n super(identity.ALIAS);\n this.source = source;\n Object.defineProperty(this, 'tag', {\n set() {\n throw new Error('Alias nodes cannot have tags');\n }\n });\n }\n /**\n * Resolve the value of this alias within `doc`, finding the last\n * instance of the `source` anchor before this node.\n */\n resolve(doc, ctx) {\n if (ctx?.maxAliasCount === 0)\n throw new ReferenceError('Alias resolution is disabled');\n let nodes;\n if (ctx?.aliasResolveCache) {\n nodes = ctx.aliasResolveCache;\n }\n else {\n nodes = [];\n visit.visit(doc, {\n Node: (_key, node) => {\n if (identity.isAlias(node) || identity.hasAnchor(node))\n nodes.push(node);\n }\n });\n if (ctx)\n ctx.aliasResolveCache = nodes;\n }\n let found = undefined;\n for (const node of nodes) {\n if (node === this)\n break;\n if (node.anchor === this.source)\n found = node;\n }\n return found;\n }\n toJSON(_arg, ctx) {\n if (!ctx)\n return { source: this.source };\n const { anchors, doc, maxAliasCount } = ctx;\n const source = this.resolve(doc, ctx);\n if (!source) {\n const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;\n throw new ReferenceError(msg);\n }\n let data = anchors.get(source);\n if (!data) {\n // Resolve anchors for Node.prototype.toJS()\n toJS.toJS(source, null, ctx);\n data = anchors.get(source);\n }\n /* istanbul ignore if */\n if (data?.res === undefined) {\n const msg = 'This should not happen: Alias anchor was not resolved?';\n throw new ReferenceError(msg);\n }\n if (maxAliasCount >= 0) {\n data.count += 1;\n if (data.aliasCount === 0)\n data.aliasCount = getAliasCount(doc, source, anchors);\n if (data.count * data.aliasCount > maxAliasCount) {\n const msg = 'Excessive alias count indicates a resource exhaustion attack';\n throw new ReferenceError(msg);\n }\n }\n return data.res;\n }\n toString(ctx, _onComment, _onChompKeep) {\n const src = `*${this.source}`;\n if (ctx) {\n anchors.anchorIsValid(this.source);\n if (ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) {\n const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;\n throw new Error(msg);\n }\n if (ctx.implicitKey)\n return `${src} `;\n }\n return src;\n }\n}\nfunction getAliasCount(doc, node, anchors) {\n if (identity.isAlias(node)) {\n const source = node.resolve(doc);\n const anchor = anchors && source && anchors.get(source);\n return anchor ? anchor.count * anchor.aliasCount : 0;\n }\n else if (identity.isCollection(node)) {\n let count = 0;\n for (const item of node.items) {\n const c = getAliasCount(doc, item, anchors);\n if (c > count)\n count = c;\n }\n return count;\n }\n else if (identity.isPair(node)) {\n const kc = getAliasCount(doc, node.key, anchors);\n const vc = getAliasCount(doc, node.value, anchors);\n return Math.max(kc, vc);\n }\n return 1;\n}\n\nexports.Alias = Alias;\n","'use strict';\n\nvar identity = require('./identity.js');\nvar Node = require('./Node.js');\nvar toJS = require('./toJS.js');\n\nconst isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');\nclass Scalar extends Node.NodeBase {\n constructor(value) {\n super(identity.SCALAR);\n this.value = value;\n }\n toJSON(arg, ctx) {\n return ctx?.keep ? this.value : toJS.toJS(this.value, arg, ctx);\n }\n toString() {\n return String(this.value);\n }\n}\nScalar.BLOCK_FOLDED = 'BLOCK_FOLDED';\nScalar.BLOCK_LITERAL = 'BLOCK_LITERAL';\nScalar.PLAIN = 'PLAIN';\nScalar.QUOTE_DOUBLE = 'QUOTE_DOUBLE';\nScalar.QUOTE_SINGLE = 'QUOTE_SINGLE';\n\nexports.Scalar = Scalar;\nexports.isScalarValue = isScalarValue;\n","'use strict';\n\nvar Alias = require('../nodes/Alias.js');\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\n\nconst defaultTagPrefix = 'tag:yaml.org,2002:';\nfunction findTagObject(value, tagName, tags) {\n if (tagName) {\n const match = tags.filter(t => t.tag === tagName);\n const tagObj = match.find(t => !t.format) ?? match[0];\n if (!tagObj)\n throw new Error(`Tag ${tagName} not found`);\n return tagObj;\n }\n return tags.find(t => t.identify?.(value) && !t.format);\n}\nfunction createNode(value, tagName, ctx) {\n if (identity.isDocument(value))\n value = value.contents;\n if (identity.isNode(value))\n return value;\n if (identity.isPair(value)) {\n const map = ctx.schema[identity.MAP].createNode?.(ctx.schema, null, ctx);\n map.items.push(value);\n return map;\n }\n if (value instanceof String ||\n value instanceof Number ||\n value instanceof Boolean ||\n (typeof BigInt !== 'undefined' && value instanceof BigInt) // not supported everywhere\n ) {\n // https://tc39.es/ecma262/#sec-serializejsonproperty\n value = value.valueOf();\n }\n const { aliasDuplicateObjects, onAnchor, onTagObj, schema, sourceObjects } = ctx;\n // Detect duplicate references to the same object & use Alias nodes for all\n // after first. The `ref` wrapper allows for circular references to resolve.\n let ref = undefined;\n if (aliasDuplicateObjects && value && typeof value === 'object') {\n ref = sourceObjects.get(value);\n if (ref) {\n ref.anchor ?? (ref.anchor = onAnchor(value));\n return new Alias.Alias(ref.anchor);\n }\n else {\n ref = { anchor: null, node: null };\n sourceObjects.set(value, ref);\n }\n }\n if (tagName?.startsWith('!!'))\n tagName = defaultTagPrefix + tagName.slice(2);\n let tagObj = findTagObject(value, tagName, schema.tags);\n if (!tagObj) {\n if (value && typeof value.toJSON === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n value = value.toJSON();\n }\n if (!value || typeof value !== 'object') {\n const node = new Scalar.Scalar(value);\n if (ref)\n ref.node = node;\n return node;\n }\n tagObj =\n value instanceof Map\n ? schema[identity.MAP]\n : Symbol.iterator in Object(value)\n ? schema[identity.SEQ]\n : schema[identity.MAP];\n }\n if (onTagObj) {\n onTagObj(tagObj);\n delete ctx.onTagObj;\n }\n const node = tagObj?.createNode\n ? tagObj.createNode(ctx.schema, value, ctx)\n : typeof tagObj?.nodeClass?.from === 'function'\n ? tagObj.nodeClass.from(ctx.schema, value, ctx)\n : new Scalar.Scalar(value);\n if (tagName)\n node.tag = tagName;\n else if (!tagObj.default)\n node.tag = tagObj.tag;\n if (ref)\n ref.node = node;\n return node;\n}\n\nexports.createNode = createNode;\n","'use strict';\n\nvar createNode = require('../doc/createNode.js');\nvar identity = require('./identity.js');\nvar Node = require('./Node.js');\n\nfunction collectionFromPath(schema, path, value) {\n let v = value;\n for (let i = path.length - 1; i >= 0; --i) {\n const k = path[i];\n if (typeof k === 'number' && Number.isInteger(k) && k >= 0) {\n const a = [];\n a[k] = v;\n v = a;\n }\n else {\n v = new Map([[k, v]]);\n }\n }\n return createNode.createNode(v, undefined, {\n aliasDuplicateObjects: false,\n keepUndefined: false,\n onAnchor: () => {\n throw new Error('This should not happen, please report a bug.');\n },\n schema,\n sourceObjects: new Map()\n });\n}\n// Type guard is intentionally a little wrong so as to be more useful,\n// as it does not cover untypable empty non-string iterables (e.g. []).\nconst isEmptyPath = (path) => path == null ||\n (typeof path === 'object' && !!path[Symbol.iterator]().next().done);\nclass Collection extends Node.NodeBase {\n constructor(type, schema) {\n super(type);\n Object.defineProperty(this, 'schema', {\n value: schema,\n configurable: true,\n enumerable: false,\n writable: true\n });\n }\n /**\n * Create a copy of this collection.\n *\n * @param schema - If defined, overwrites the original's schema\n */\n clone(schema) {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n if (schema)\n copy.schema = schema;\n copy.items = copy.items.map(it => identity.isNode(it) || identity.isPair(it) ? it.clone(schema) : it);\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }\n /**\n * Adds a value to the collection. For `!!map` and `!!omap` the value must\n * be a Pair instance or a `{ key, value }` object, which may not have a key\n * that already exists in the map.\n */\n addIn(path, value) {\n if (isEmptyPath(path))\n this.add(value);\n else {\n const [key, ...rest] = path;\n const node = this.get(key, true);\n if (identity.isCollection(node))\n node.addIn(rest, value);\n else if (node === undefined && this.schema)\n this.set(key, collectionFromPath(this.schema, rest, value));\n else\n throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);\n }\n }\n /**\n * Removes a value from the collection.\n * @returns `true` if the item was found and removed.\n */\n deleteIn(path) {\n const [key, ...rest] = path;\n if (rest.length === 0)\n return this.delete(key);\n const node = this.get(key, true);\n if (identity.isCollection(node))\n return node.deleteIn(rest);\n else\n throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);\n }\n /**\n * Returns item at `key`, or `undefined` if not found. By default unwraps\n * scalar values from their surrounding node; to disable set `keepScalar` to\n * `true` (collections are always returned intact).\n */\n getIn(path, keepScalar) {\n const [key, ...rest] = path;\n const node = this.get(key, true);\n if (rest.length === 0)\n return !keepScalar && identity.isScalar(node) ? node.value : node;\n else\n return identity.isCollection(node) ? node.getIn(rest, keepScalar) : undefined;\n }\n hasAllNullValues(allowScalar) {\n return this.items.every(node => {\n if (!identity.isPair(node))\n return false;\n const n = node.value;\n return (n == null ||\n (allowScalar &&\n identity.isScalar(n) &&\n n.value == null &&\n !n.commentBefore &&\n !n.comment &&\n !n.tag));\n });\n }\n /**\n * Checks if the collection includes a value with the key `key`.\n */\n hasIn(path) {\n const [key, ...rest] = path;\n if (rest.length === 0)\n return this.has(key);\n const node = this.get(key, true);\n return identity.isCollection(node) ? node.hasIn(rest) : false;\n }\n /**\n * Sets a value in this collection. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n */\n setIn(path, value) {\n const [key, ...rest] = path;\n if (rest.length === 0) {\n this.set(key, value);\n }\n else {\n const node = this.get(key, true);\n if (identity.isCollection(node))\n node.setIn(rest, value);\n else if (node === undefined && this.schema)\n this.set(key, collectionFromPath(this.schema, rest, value));\n else\n throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);\n }\n }\n}\n\nexports.Collection = Collection;\nexports.collectionFromPath = collectionFromPath;\nexports.isEmptyPath = isEmptyPath;\n","'use strict';\n\n/**\n * Stringifies a comment.\n *\n * Empty comment lines are left empty,\n * lines consisting of a single space are replaced by `#`,\n * and all other lines are prefixed with a `#`.\n */\nconst stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, '#');\nfunction indentComment(comment, indent) {\n if (/^\\n+$/.test(comment))\n return comment.substring(1);\n return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;\n}\nconst lineComment = (str, indent, comment) => str.endsWith('\\n')\n ? indentComment(comment, indent)\n : comment.includes('\\n')\n ? '\\n' + indentComment(comment, indent)\n : (str.endsWith(' ') ? '' : ' ') + comment;\n\nexports.indentComment = indentComment;\nexports.lineComment = lineComment;\nexports.stringifyComment = stringifyComment;\n","'use strict';\n\nconst FOLD_FLOW = 'flow';\nconst FOLD_BLOCK = 'block';\nconst FOLD_QUOTED = 'quoted';\n/**\n * Tries to keep input at up to `lineWidth` characters, splitting only on spaces\n * not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are\n * terminated with `\\n` and started with `indent`.\n */\nfunction foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {\n if (!lineWidth || lineWidth < 0)\n return text;\n if (lineWidth < minContentWidth)\n minContentWidth = 0;\n const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);\n if (text.length <= endStep)\n return text;\n const folds = [];\n const escapedFolds = {};\n let end = lineWidth - indent.length;\n if (typeof indentAtStart === 'number') {\n if (indentAtStart > lineWidth - Math.max(2, minContentWidth))\n folds.push(0);\n else\n end = lineWidth - indentAtStart;\n }\n let split = undefined;\n let prev = undefined;\n let overflow = false;\n let i = -1;\n let escStart = -1;\n let escEnd = -1;\n if (mode === FOLD_BLOCK) {\n i = consumeMoreIndentedLines(text, i, indent.length);\n if (i !== -1)\n end = i + endStep;\n }\n for (let ch; (ch = text[(i += 1)]);) {\n if (mode === FOLD_QUOTED && ch === '\\\\') {\n escStart = i;\n switch (text[i + 1]) {\n case 'x':\n i += 3;\n break;\n case 'u':\n i += 5;\n break;\n case 'U':\n i += 9;\n break;\n default:\n i += 1;\n }\n escEnd = i;\n }\n if (ch === '\\n') {\n if (mode === FOLD_BLOCK)\n i = consumeMoreIndentedLines(text, i, indent.length);\n end = i + indent.length + endStep;\n split = undefined;\n }\n else {\n if (ch === ' ' &&\n prev &&\n prev !== ' ' &&\n prev !== '\\n' &&\n prev !== '\\t') {\n // space surrounded by non-space can be replaced with newline + indent\n const next = text[i + 1];\n if (next && next !== ' ' && next !== '\\n' && next !== '\\t')\n split = i;\n }\n if (i >= end) {\n if (split) {\n folds.push(split);\n end = split + endStep;\n split = undefined;\n }\n else if (mode === FOLD_QUOTED) {\n // white-space collected at end may stretch past lineWidth\n while (prev === ' ' || prev === '\\t') {\n prev = ch;\n ch = text[(i += 1)];\n overflow = true;\n }\n // Account for newline escape, but don't break preceding escape\n const j = i > escEnd + 1 ? i - 2 : escStart - 1;\n // Bail out if lineWidth & minContentWidth are shorter than an escape string\n if (escapedFolds[j])\n return text;\n folds.push(j);\n escapedFolds[j] = true;\n end = j + endStep;\n split = undefined;\n }\n else {\n overflow = true;\n }\n }\n }\n prev = ch;\n }\n if (overflow && onOverflow)\n onOverflow();\n if (folds.length === 0)\n return text;\n if (onFold)\n onFold();\n let res = text.slice(0, folds[0]);\n for (let i = 0; i < folds.length; ++i) {\n const fold = folds[i];\n const end = folds[i + 1] || text.length;\n if (fold === 0)\n res = `\\n${indent}${text.slice(0, end)}`;\n else {\n if (mode === FOLD_QUOTED && escapedFolds[fold])\n res += `${text[fold]}\\\\`;\n res += `\\n${indent}${text.slice(fold + 1, end)}`;\n }\n }\n return res;\n}\n/**\n * Presumes `i + 1` is at the start of a line\n * @returns index of last newline in more-indented block\n */\nfunction consumeMoreIndentedLines(text, i, indent) {\n let end = i;\n let start = i + 1;\n let ch = text[start];\n while (ch === ' ' || ch === '\\t') {\n if (i < start + indent) {\n ch = text[++i];\n }\n else {\n do {\n ch = text[++i];\n } while (ch && ch !== '\\n');\n end = i;\n start = i + 1;\n ch = text[start];\n }\n }\n return end;\n}\n\nexports.FOLD_BLOCK = FOLD_BLOCK;\nexports.FOLD_FLOW = FOLD_FLOW;\nexports.FOLD_QUOTED = FOLD_QUOTED;\nexports.foldFlowLines = foldFlowLines;\n","'use strict';\n\nvar Scalar = require('../nodes/Scalar.js');\nvar foldFlowLines = require('./foldFlowLines.js');\n\nconst getFoldOptions = (ctx, isBlock) => ({\n indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,\n lineWidth: ctx.options.lineWidth,\n minContentWidth: ctx.options.minContentWidth\n});\n// Also checks for lines starting with %, as parsing the output as YAML 1.1 will\n// presume that's starting a new document.\nconst containsDocumentMarker = (str) => /^(%|---|\\.\\.\\.)/m.test(str);\nfunction lineLengthOverLimit(str, lineWidth, indentLength) {\n if (!lineWidth || lineWidth < 0)\n return false;\n const limit = lineWidth - indentLength;\n const strLen = str.length;\n if (strLen <= limit)\n return false;\n for (let i = 0, start = 0; i < strLen; ++i) {\n if (str[i] === '\\n') {\n if (i - start > limit)\n return true;\n start = i + 1;\n if (strLen - start <= limit)\n return false;\n }\n }\n return true;\n}\nfunction doubleQuotedString(value, ctx) {\n const json = JSON.stringify(value);\n if (ctx.options.doubleQuotedAsJSON)\n return json;\n const { implicitKey } = ctx;\n const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;\n const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');\n let str = '';\n let start = 0;\n for (let i = 0, ch = json[i]; ch; ch = json[++i]) {\n if (ch === ' ' && json[i + 1] === '\\\\' && json[i + 2] === 'n') {\n // space before newline needs to be escaped to not be folded\n str += json.slice(start, i) + '\\\\ ';\n i += 1;\n start = i;\n ch = '\\\\';\n }\n if (ch === '\\\\')\n switch (json[i + 1]) {\n case 'u':\n {\n str += json.slice(start, i);\n const code = json.substr(i + 2, 4);\n switch (code) {\n case '0000':\n str += '\\\\0';\n break;\n case '0007':\n str += '\\\\a';\n break;\n case '000b':\n str += '\\\\v';\n break;\n case '001b':\n str += '\\\\e';\n break;\n case '0085':\n str += '\\\\N';\n break;\n case '00a0':\n str += '\\\\_';\n break;\n case '2028':\n str += '\\\\L';\n break;\n case '2029':\n str += '\\\\P';\n break;\n default:\n if (code.substr(0, 2) === '00')\n str += '\\\\x' + code.substr(2);\n else\n str += json.substr(i, 6);\n }\n i += 5;\n start = i + 1;\n }\n break;\n case 'n':\n if (implicitKey ||\n json[i + 2] === '\"' ||\n json.length < minMultiLineLength) {\n i += 1;\n }\n else {\n // folding will eat first newline\n str += json.slice(start, i) + '\\n\\n';\n while (json[i + 2] === '\\\\' &&\n json[i + 3] === 'n' &&\n json[i + 4] !== '\"') {\n str += '\\n';\n i += 2;\n }\n str += indent;\n // space after newline needs to be escaped to not be folded\n if (json[i + 2] === ' ')\n str += '\\\\';\n i += 1;\n start = i + 1;\n }\n break;\n default:\n i += 1;\n }\n }\n str = start ? str + json.slice(start) : json;\n return implicitKey\n ? str\n : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx, false));\n}\nfunction singleQuotedString(value, ctx) {\n if (ctx.options.singleQuote === false ||\n (ctx.implicitKey && value.includes('\\n')) ||\n /[ \\t]\\n|\\n[ \\t]/.test(value) // single quoted string can't have leading or trailing whitespace around newline\n )\n return doubleQuotedString(value, ctx);\n const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');\n const res = \"'\" + value.replace(/'/g, \"''\").replace(/\\n+/g, `$&\\n${indent}`) + \"'\";\n return ctx.implicitKey\n ? res\n : foldFlowLines.foldFlowLines(res, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));\n}\nfunction quotedString(value, ctx) {\n const { singleQuote } = ctx.options;\n let qs;\n if (singleQuote === false)\n qs = doubleQuotedString;\n else {\n const hasDouble = value.includes('\"');\n const hasSingle = value.includes(\"'\");\n if (hasDouble && !hasSingle)\n qs = singleQuotedString;\n else if (hasSingle && !hasDouble)\n qs = doubleQuotedString;\n else\n qs = singleQuote ? singleQuotedString : doubleQuotedString;\n }\n return qs(value, ctx);\n}\n// The negative lookbehind avoids a polynomial search,\n// but isn't supported yet on Safari: https://caniuse.com/js-regexp-lookbehind\nlet blockEndNewlines;\ntry {\n blockEndNewlines = new RegExp('(^|(?<!\\n))\\n+(?!\\n|$)', 'g');\n}\ncatch {\n blockEndNewlines = /\\n+(?!\\n|$)/g;\n}\nfunction blockString({ comment, type, value }, ctx, onComment, onChompKeep) {\n const { blockQuote, commentString, lineWidth } = ctx.options;\n // 1. Block can't end in whitespace unless the last line is non-empty.\n // 2. Strings consisting of only whitespace are best rendered explicitly.\n if (!blockQuote || /\\n[\\t ]+$/.test(value)) {\n return quotedString(value, ctx);\n }\n const indent = ctx.indent ||\n (ctx.forceBlockIndent || containsDocumentMarker(value) ? ' ' : '');\n const literal = blockQuote === 'literal'\n ? true\n : blockQuote === 'folded' || type === Scalar.Scalar.BLOCK_FOLDED\n ? false\n : type === Scalar.Scalar.BLOCK_LITERAL\n ? true\n : !lineLengthOverLimit(value, lineWidth, indent.length);\n if (!value)\n return literal ? '|\\n' : '>\\n';\n // determine chomping from whitespace at value end\n let chomp;\n let endStart;\n for (endStart = value.length; endStart > 0; --endStart) {\n const ch = value[endStart - 1];\n if (ch !== '\\n' && ch !== '\\t' && ch !== ' ')\n break;\n }\n let end = value.substring(endStart);\n const endNlPos = end.indexOf('\\n');\n if (endNlPos === -1) {\n chomp = '-'; // strip\n }\n else if (value === end || endNlPos !== end.length - 1) {\n chomp = '+'; // keep\n if (onChompKeep)\n onChompKeep();\n }\n else {\n chomp = ''; // clip\n }\n if (end) {\n value = value.slice(0, -end.length);\n if (end[end.length - 1] === '\\n')\n end = end.slice(0, -1);\n end = end.replace(blockEndNewlines, `$&${indent}`);\n }\n // determine indent indicator from whitespace at value start\n let startWithSpace = false;\n let startEnd;\n let startNlPos = -1;\n for (startEnd = 0; startEnd < value.length; ++startEnd) {\n const ch = value[startEnd];\n if (ch === ' ')\n startWithSpace = true;\n else if (ch === '\\n')\n startNlPos = startEnd;\n else\n break;\n }\n let start = value.substring(0, startNlPos < startEnd ? startNlPos + 1 : startEnd);\n if (start) {\n value = value.substring(start.length);\n start = start.replace(/\\n+/g, `$&${indent}`);\n }\n const indentSize = indent ? '2' : '1'; // root is at -1\n // Leading | or > is added later\n let header = (startWithSpace ? indentSize : '') + chomp;\n if (comment) {\n header += ' ' + commentString(comment.replace(/ ?[\\r\\n]+/g, ' '));\n if (onComment)\n onComment();\n }\n if (!literal) {\n const foldedValue = value\n .replace(/\\n+/g, '\\n$&')\n .replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g, '$1$2') // more-indented lines aren't folded\n // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent\n .replace(/\\n+/g, `$&${indent}`);\n let literalFallback = false;\n const foldOptions = getFoldOptions(ctx, true);\n if (blockQuote !== 'folded' && type !== Scalar.Scalar.BLOCK_FOLDED) {\n foldOptions.onOverflow = () => {\n literalFallback = true;\n };\n }\n const body = foldFlowLines.foldFlowLines(`${start}${foldedValue}${end}`, indent, foldFlowLines.FOLD_BLOCK, foldOptions);\n if (!literalFallback)\n return `>${header}\\n${indent}${body}`;\n }\n value = value.replace(/\\n+/g, `$&${indent}`);\n return `|${header}\\n${indent}${start}${value}${end}`;\n}\nfunction plainString(item, ctx, onComment, onChompKeep) {\n const { type, value } = item;\n const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;\n if ((implicitKey && value.includes('\\n')) ||\n (inFlow && /[[\\]{},]/.test(value))) {\n return quotedString(value, ctx);\n }\n if (/^[\\n\\t ,[\\]{}#&*!|>'\"%@`]|^[?-]$|^[?-][ \\t]|[\\n:][ \\t]|[ \\t]\\n|[\\n\\t ]#|[\\n\\t :]$/.test(value)) {\n // not allowed:\n // - '-' or '?'\n // - start with an indicator character (except [?:-]) or /[?-] /\n // - '\\n ', ': ' or ' \\n' anywhere\n // - '#' not preceded by a non-space char\n // - end with ' ' or ':'\n return implicitKey || inFlow || !value.includes('\\n')\n ? quotedString(value, ctx)\n : blockString(item, ctx, onComment, onChompKeep);\n }\n if (!implicitKey &&\n !inFlow &&\n type !== Scalar.Scalar.PLAIN &&\n value.includes('\\n')) {\n // Where allowed & type not set explicitly, prefer block style for multiline strings\n return blockString(item, ctx, onComment, onChompKeep);\n }\n if (containsDocumentMarker(value)) {\n if (indent === '') {\n ctx.forceBlockIndent = true;\n return blockString(item, ctx, onComment, onChompKeep);\n }\n else if (implicitKey && indent === indentStep) {\n return quotedString(value, ctx);\n }\n }\n const str = value.replace(/\\n+/g, `$&\\n${indent}`);\n // Verify that output will be parsed as a string, as e.g. plain numbers and\n // booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'),\n // and others in v1.1.\n if (actualString) {\n const test = (tag) => tag.default && tag.tag !== 'tag:yaml.org,2002:str' && tag.test?.test(str);\n const { compat, tags } = ctx.doc.schema;\n if (tags.some(test) || compat?.some(test))\n return quotedString(value, ctx);\n }\n return implicitKey\n ? str\n : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));\n}\nfunction stringifyString(item, ctx, onComment, onChompKeep) {\n const { implicitKey, inFlow } = ctx;\n const ss = typeof item.value === 'string'\n ? item\n : Object.assign({}, item, { value: String(item.value) });\n let { type } = item;\n if (type !== Scalar.Scalar.QUOTE_DOUBLE) {\n // force double quotes on control characters & unpaired surrogates\n if (/[\\x00-\\x08\\x0b-\\x1f\\x7f-\\x9f\\u{D800}-\\u{DFFF}]/u.test(ss.value))\n type = Scalar.Scalar.QUOTE_DOUBLE;\n }\n const _stringify = (_type) => {\n switch (_type) {\n case Scalar.Scalar.BLOCK_FOLDED:\n case Scalar.Scalar.BLOCK_LITERAL:\n return implicitKey || inFlow\n ? quotedString(ss.value, ctx) // blocks are not valid inside flow containers\n : blockString(ss, ctx, onComment, onChompKeep);\n case Scalar.Scalar.QUOTE_DOUBLE:\n return doubleQuotedString(ss.value, ctx);\n case Scalar.Scalar.QUOTE_SINGLE:\n return singleQuotedString(ss.value, ctx);\n case Scalar.Scalar.PLAIN:\n return plainString(ss, ctx, onComment, onChompKeep);\n default:\n return null;\n }\n };\n let res = _stringify(type);\n if (res === null) {\n const { defaultKeyType, defaultStringType } = ctx.options;\n const t = (implicitKey && defaultKeyType) || defaultStringType;\n res = _stringify(t);\n if (res === null)\n throw new Error(`Unsupported default string type ${t}`);\n }\n return res;\n}\n\nexports.stringifyString = stringifyString;\n","'use strict';\n\nvar anchors = require('../doc/anchors.js');\nvar identity = require('../nodes/identity.js');\nvar stringifyComment = require('./stringifyComment.js');\nvar stringifyString = require('./stringifyString.js');\n\nfunction createStringifyContext(doc, options) {\n const opt = Object.assign({\n blockQuote: true,\n commentString: stringifyComment.stringifyComment,\n defaultKeyType: null,\n defaultStringType: 'PLAIN',\n directives: null,\n doubleQuotedAsJSON: false,\n doubleQuotedMinMultiLineLength: 40,\n falseStr: 'false',\n flowCollectionPadding: true,\n indentSeq: true,\n lineWidth: 80,\n minContentWidth: 20,\n nullStr: 'null',\n simpleKeys: false,\n singleQuote: null,\n trailingComma: false,\n trueStr: 'true',\n verifyAliasOrder: true\n }, doc.schema.toStringOptions, options);\n let inFlow;\n switch (opt.collectionStyle) {\n case 'block':\n inFlow = false;\n break;\n case 'flow':\n inFlow = true;\n break;\n default:\n inFlow = null;\n }\n return {\n anchors: new Set(),\n doc,\n flowCollectionPadding: opt.flowCollectionPadding ? ' ' : '',\n indent: '',\n indentStep: typeof opt.indent === 'number' ? ' '.repeat(opt.indent) : ' ',\n inFlow,\n options: opt\n };\n}\nfunction getTagObject(tags, item) {\n if (item.tag) {\n const match = tags.filter(t => t.tag === item.tag);\n if (match.length > 0)\n return match.find(t => t.format === item.format) ?? match[0];\n }\n let tagObj = undefined;\n let obj;\n if (identity.isScalar(item)) {\n obj = item.value;\n let match = tags.filter(t => t.identify?.(obj));\n if (match.length > 1) {\n const testMatch = match.filter(t => t.test);\n if (testMatch.length > 0)\n match = testMatch;\n }\n tagObj =\n match.find(t => t.format === item.format) ?? match.find(t => !t.format);\n }\n else {\n obj = item;\n tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);\n }\n if (!tagObj) {\n const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);\n throw new Error(`Tag not resolved for ${name} value`);\n }\n return tagObj;\n}\n// needs to be called before value stringifier to allow for circular anchor refs\nfunction stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {\n if (!doc.directives)\n return '';\n const props = [];\n const anchor = (identity.isScalar(node) || identity.isCollection(node)) && node.anchor;\n if (anchor && anchors.anchorIsValid(anchor)) {\n anchors$1.add(anchor);\n props.push(`&${anchor}`);\n }\n const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);\n if (tag)\n props.push(doc.directives.tagString(tag));\n return props.join(' ');\n}\nfunction stringify(item, ctx, onComment, onChompKeep) {\n if (identity.isPair(item))\n return item.toString(ctx, onComment, onChompKeep);\n if (identity.isAlias(item)) {\n if (ctx.doc.directives)\n return item.toString(ctx);\n if (ctx.resolvedAliases?.has(item)) {\n throw new TypeError(`Cannot stringify circular structure without alias nodes`);\n }\n else {\n if (ctx.resolvedAliases)\n ctx.resolvedAliases.add(item);\n else\n ctx.resolvedAliases = new Set([item]);\n item = item.resolve(ctx.doc);\n }\n }\n let tagObj = undefined;\n const node = identity.isNode(item)\n ? item\n : ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });\n tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));\n const props = stringifyProps(node, tagObj, ctx);\n if (props.length > 0)\n ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;\n const str = typeof tagObj.stringify === 'function'\n ? tagObj.stringify(node, ctx, onComment, onChompKeep)\n : identity.isScalar(node)\n ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep)\n : node.toString(ctx, onComment, onChompKeep);\n if (!props)\n return str;\n return identity.isScalar(node) || str[0] === '{' || str[0] === '['\n ? `${props} ${str}`\n : `${props}\\n${ctx.indent}${str}`;\n}\n\nexports.createStringifyContext = createStringifyContext;\nexports.stringify = stringify;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\nvar stringify = require('./stringify.js');\nvar stringifyComment = require('./stringifyComment.js');\n\nfunction stringifyPair({ key, value }, ctx, onComment, onChompKeep) {\n const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;\n let keyComment = (identity.isNode(key) && key.comment) || null;\n if (simpleKeys) {\n if (keyComment) {\n throw new Error('With simple keys, key nodes cannot have comments');\n }\n if (identity.isCollection(key) || (!identity.isNode(key) && typeof key === 'object')) {\n const msg = 'With simple keys, collection cannot be used as a key value';\n throw new Error(msg);\n }\n }\n let explicitKey = !simpleKeys &&\n (!key ||\n (keyComment && value == null && !ctx.inFlow) ||\n identity.isCollection(key) ||\n (identity.isScalar(key)\n ? key.type === Scalar.Scalar.BLOCK_FOLDED || key.type === Scalar.Scalar.BLOCK_LITERAL\n : typeof key === 'object'));\n ctx = Object.assign({}, ctx, {\n allNullValues: false,\n implicitKey: !explicitKey && (simpleKeys || !allNullValues),\n indent: indent + indentStep\n });\n let keyCommentDone = false;\n let chompKeep = false;\n let str = stringify.stringify(key, ctx, () => (keyCommentDone = true), () => (chompKeep = true));\n if (!explicitKey && !ctx.inFlow && str.length > 1024) {\n if (simpleKeys)\n throw new Error('With simple keys, single line scalar must not span more than 1024 characters');\n explicitKey = true;\n }\n if (ctx.inFlow) {\n if (allNullValues || value == null) {\n if (keyCommentDone && onComment)\n onComment();\n return str === '' ? '?' : explicitKey ? `? ${str}` : str;\n }\n }\n else if ((allNullValues && !simpleKeys) || (value == null && explicitKey)) {\n str = `? ${str}`;\n if (keyComment && !keyCommentDone) {\n str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));\n }\n else if (chompKeep && onChompKeep)\n onChompKeep();\n return str;\n }\n if (keyCommentDone)\n keyComment = null;\n if (explicitKey) {\n if (keyComment)\n str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));\n str = `? ${str}\\n${indent}:`;\n }\n else {\n str = `${str}:`;\n if (keyComment)\n str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));\n }\n let vsb, vcb, valueComment;\n if (identity.isNode(value)) {\n vsb = !!value.spaceBefore;\n vcb = value.commentBefore;\n valueComment = value.comment;\n }\n else {\n vsb = false;\n vcb = null;\n valueComment = null;\n if (value && typeof value === 'object')\n value = doc.createNode(value);\n }\n ctx.implicitKey = false;\n if (!explicitKey && !keyComment && identity.isScalar(value))\n ctx.indentAtStart = str.length + 1;\n chompKeep = false;\n if (!indentSeq &&\n indentStep.length >= 2 &&\n !ctx.inFlow &&\n !explicitKey &&\n identity.isSeq(value) &&\n !value.flow &&\n !value.tag &&\n !value.anchor) {\n // If indentSeq === false, consider '- ' as part of indentation where possible\n ctx.indent = ctx.indent.substring(2);\n }\n let valueCommentDone = false;\n const valueStr = stringify.stringify(value, ctx, () => (valueCommentDone = true), () => (chompKeep = true));\n let ws = ' ';\n if (keyComment || vsb || vcb) {\n ws = vsb ? '\\n' : '';\n if (vcb) {\n const cs = commentString(vcb);\n ws += `\\n${stringifyComment.indentComment(cs, ctx.indent)}`;\n }\n if (valueStr === '' && !ctx.inFlow) {\n if (ws === '\\n' && valueComment)\n ws = '\\n\\n';\n }\n else {\n ws += `\\n${ctx.indent}`;\n }\n }\n else if (!explicitKey && identity.isCollection(value)) {\n const vs0 = valueStr[0];\n const nl0 = valueStr.indexOf('\\n');\n const hasNewline = nl0 !== -1;\n const flow = ctx.inFlow ?? value.flow ?? value.items.length === 0;\n if (hasNewline || !flow) {\n let hasPropsLine = false;\n if (hasNewline && (vs0 === '&' || vs0 === '!')) {\n let sp0 = valueStr.indexOf(' ');\n if (vs0 === '&' &&\n sp0 !== -1 &&\n sp0 < nl0 &&\n valueStr[sp0 + 1] === '!') {\n sp0 = valueStr.indexOf(' ', sp0 + 1);\n }\n if (sp0 === -1 || nl0 < sp0)\n hasPropsLine = true;\n }\n if (!hasPropsLine)\n ws = `\\n${ctx.indent}`;\n }\n }\n else if (valueStr === '' || valueStr[0] === '\\n') {\n ws = '';\n }\n str += ws + valueStr;\n if (ctx.inFlow) {\n if (valueCommentDone && onComment)\n onComment();\n }\n else if (valueComment && !valueCommentDone) {\n str += stringifyComment.lineComment(str, ctx.indent, commentString(valueComment));\n }\n else if (chompKeep && onChompKeep) {\n onChompKeep();\n }\n return str;\n}\n\nexports.stringifyPair = stringifyPair;\n","'use strict';\n\nvar node_process = require('process');\n\nfunction debug(logLevel, ...messages) {\n if (logLevel === 'debug')\n console.log(...messages);\n}\nfunction warn(logLevel, warning) {\n if (logLevel === 'debug' || logLevel === 'warn') {\n if (typeof node_process.emitWarning === 'function')\n node_process.emitWarning(warning);\n else\n console.warn(warning);\n }\n}\n\nexports.debug = debug;\nexports.warn = warn;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar Scalar = require('../../nodes/Scalar.js');\n\n// If the value associated with a merge key is a single mapping node, each of\n// its key/value pairs is inserted into the current mapping, unless the key\n// already exists in it. If the value associated with the merge key is a\n// sequence, then this sequence is expected to contain mapping nodes and each\n// of these nodes is merged in turn according to its order in the sequence.\n// Keys in mapping nodes earlier in the sequence override keys specified in\n// later mapping nodes. -- http://yaml.org/type/merge.html\nconst MERGE_KEY = '<<';\nconst merge = {\n identify: value => value === MERGE_KEY ||\n (typeof value === 'symbol' && value.description === MERGE_KEY),\n default: 'key',\n tag: 'tag:yaml.org,2002:merge',\n test: /^<<$/,\n resolve: () => Object.assign(new Scalar.Scalar(Symbol(MERGE_KEY)), {\n addToJSMap: addMergeToJSMap\n }),\n stringify: () => MERGE_KEY\n};\nconst isMergeKey = (ctx, key) => (merge.identify(key) ||\n (identity.isScalar(key) &&\n (!key.type || key.type === Scalar.Scalar.PLAIN) &&\n merge.identify(key.value))) &&\n ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);\nfunction addMergeToJSMap(ctx, map, value) {\n const source = resolveAliasValue(ctx, value);\n if (identity.isSeq(source))\n for (const it of source.items)\n mergeValue(ctx, map, it);\n else if (Array.isArray(source))\n for (const it of source)\n mergeValue(ctx, map, it);\n else\n mergeValue(ctx, map, source);\n}\nfunction mergeValue(ctx, map, value) {\n const source = resolveAliasValue(ctx, value);\n if (!identity.isMap(source))\n throw new Error('Merge sources must be maps or map aliases');\n const srcMap = source.toJSON(null, ctx, Map);\n for (const [key, value] of srcMap) {\n if (map instanceof Map) {\n if (!map.has(key))\n map.set(key, value);\n }\n else if (map instanceof Set) {\n map.add(key);\n }\n else if (!Object.prototype.hasOwnProperty.call(map, key)) {\n Object.defineProperty(map, key, {\n value,\n writable: true,\n enumerable: true,\n configurable: true\n });\n }\n }\n return map;\n}\nfunction resolveAliasValue(ctx, value) {\n return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;\n}\n\nexports.addMergeToJSMap = addMergeToJSMap;\nexports.isMergeKey = isMergeKey;\nexports.merge = merge;\n","'use strict';\n\nvar log = require('../log.js');\nvar merge = require('../schema/yaml-1.1/merge.js');\nvar stringify = require('../stringify/stringify.js');\nvar identity = require('./identity.js');\nvar toJS = require('./toJS.js');\n\nfunction addPairToJSMap(ctx, map, { key, value }) {\n if (identity.isNode(key) && key.addToJSMap)\n key.addToJSMap(ctx, map, value);\n // TODO: Should drop this special case for bare << handling\n else if (merge.isMergeKey(ctx, key))\n merge.addMergeToJSMap(ctx, map, value);\n else {\n const jsKey = toJS.toJS(key, '', ctx);\n if (map instanceof Map) {\n map.set(jsKey, toJS.toJS(value, jsKey, ctx));\n }\n else if (map instanceof Set) {\n map.add(jsKey);\n }\n else {\n const stringKey = stringifyKey(key, jsKey, ctx);\n const jsValue = toJS.toJS(value, stringKey, ctx);\n if (stringKey in map)\n Object.defineProperty(map, stringKey, {\n value: jsValue,\n writable: true,\n enumerable: true,\n configurable: true\n });\n else\n map[stringKey] = jsValue;\n }\n }\n return map;\n}\nfunction stringifyKey(key, jsKey, ctx) {\n if (jsKey === null)\n return '';\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n if (typeof jsKey !== 'object')\n return String(jsKey);\n if (identity.isNode(key) && ctx?.doc) {\n const strCtx = stringify.createStringifyContext(ctx.doc, {});\n strCtx.anchors = new Set();\n for (const node of ctx.anchors.keys())\n strCtx.anchors.add(node.anchor);\n strCtx.inFlow = true;\n strCtx.inStringifyKey = true;\n const strKey = key.toString(strCtx);\n if (!ctx.mapKeyWarned) {\n let jsonStr = JSON.stringify(strKey);\n if (jsonStr.length > 40)\n jsonStr = jsonStr.substring(0, 36) + '...\"';\n log.warn(ctx.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${jsonStr}. Set mapAsMap: true to use object keys.`);\n ctx.mapKeyWarned = true;\n }\n return strKey;\n }\n return JSON.stringify(jsKey);\n}\n\nexports.addPairToJSMap = addPairToJSMap;\n","'use strict';\n\nvar createNode = require('../doc/createNode.js');\nvar stringifyPair = require('../stringify/stringifyPair.js');\nvar addPairToJSMap = require('./addPairToJSMap.js');\nvar identity = require('./identity.js');\n\nfunction createPair(key, value, ctx) {\n const k = createNode.createNode(key, undefined, ctx);\n const v = createNode.createNode(value, undefined, ctx);\n return new Pair(k, v);\n}\nclass Pair {\n constructor(key, value = null) {\n Object.defineProperty(this, identity.NODE_TYPE, { value: identity.PAIR });\n this.key = key;\n this.value = value;\n }\n clone(schema) {\n let { key, value } = this;\n if (identity.isNode(key))\n key = key.clone(schema);\n if (identity.isNode(value))\n value = value.clone(schema);\n return new Pair(key, value);\n }\n toJSON(_, ctx) {\n const pair = ctx?.mapAsMap ? new Map() : {};\n return addPairToJSMap.addPairToJSMap(ctx, pair, this);\n }\n toString(ctx, onComment, onChompKeep) {\n return ctx?.doc\n ? stringifyPair.stringifyPair(this, ctx, onComment, onChompKeep)\n : JSON.stringify(this);\n }\n}\n\nexports.Pair = Pair;\nexports.createPair = createPair;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar stringify = require('./stringify.js');\nvar stringifyComment = require('./stringifyComment.js');\n\nfunction stringifyCollection(collection, ctx, options) {\n const flow = ctx.inFlow ?? collection.flow;\n const stringify = flow ? stringifyFlowCollection : stringifyBlockCollection;\n return stringify(collection, ctx, options);\n}\nfunction stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {\n const { indent, options: { commentString } } = ctx;\n const itemCtx = Object.assign({}, ctx, { indent: itemIndent, type: null });\n let chompKeep = false; // flag for the preceding node's status\n const lines = [];\n for (let i = 0; i < items.length; ++i) {\n const item = items[i];\n let comment = null;\n if (identity.isNode(item)) {\n if (!chompKeep && item.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, item.commentBefore, chompKeep);\n if (item.comment)\n comment = item.comment;\n }\n else if (identity.isPair(item)) {\n const ik = identity.isNode(item.key) ? item.key : null;\n if (ik) {\n if (!chompKeep && ik.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, ik.commentBefore, chompKeep);\n }\n }\n chompKeep = false;\n let str = stringify.stringify(item, itemCtx, () => (comment = null), () => (chompKeep = true));\n if (comment)\n str += stringifyComment.lineComment(str, itemIndent, commentString(comment));\n if (chompKeep && comment)\n chompKeep = false;\n lines.push(blockItemPrefix + str);\n }\n let str;\n if (lines.length === 0) {\n str = flowChars.start + flowChars.end;\n }\n else {\n str = lines[0];\n for (let i = 1; i < lines.length; ++i) {\n const line = lines[i];\n str += line ? `\\n${indent}${line}` : '\\n';\n }\n }\n if (comment) {\n str += '\\n' + stringifyComment.indentComment(commentString(comment), indent);\n if (onComment)\n onComment();\n }\n else if (chompKeep && onChompKeep)\n onChompKeep();\n return str;\n}\nfunction stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {\n const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;\n itemIndent += indentStep;\n const itemCtx = Object.assign({}, ctx, {\n indent: itemIndent,\n inFlow: true,\n type: null\n });\n let reqNewline = false;\n let linesAtValue = 0;\n const lines = [];\n for (let i = 0; i < items.length; ++i) {\n const item = items[i];\n let comment = null;\n if (identity.isNode(item)) {\n if (item.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, item.commentBefore, false);\n if (item.comment)\n comment = item.comment;\n }\n else if (identity.isPair(item)) {\n const ik = identity.isNode(item.key) ? item.key : null;\n if (ik) {\n if (ik.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, ik.commentBefore, false);\n if (ik.comment)\n reqNewline = true;\n }\n const iv = identity.isNode(item.value) ? item.value : null;\n if (iv) {\n if (iv.comment)\n comment = iv.comment;\n if (iv.commentBefore)\n reqNewline = true;\n }\n else if (item.value == null && ik?.comment) {\n comment = ik.comment;\n }\n }\n if (comment)\n reqNewline = true;\n let str = stringify.stringify(item, itemCtx, () => (comment = null));\n reqNewline || (reqNewline = lines.length > linesAtValue || str.includes('\\n'));\n if (i < items.length - 1) {\n str += ',';\n }\n else if (ctx.options.trailingComma) {\n if (ctx.options.lineWidth > 0) {\n reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) +\n (str.length + 2) >\n ctx.options.lineWidth);\n }\n if (reqNewline) {\n str += ',';\n }\n }\n if (comment)\n str += stringifyComment.lineComment(str, itemIndent, commentString(comment));\n lines.push(str);\n linesAtValue = lines.length;\n }\n const { start, end } = flowChars;\n if (lines.length === 0) {\n return start + end;\n }\n else {\n if (!reqNewline) {\n const len = lines.reduce((sum, line) => sum + line.length + 2, 2);\n reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;\n }\n if (reqNewline) {\n let str = start;\n for (const line of lines)\n str += line ? `\\n${indentStep}${indent}${line}` : '\\n';\n return `${str}\\n${indent}${end}`;\n }\n else {\n return `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;\n }\n }\n}\nfunction addCommentBefore({ indent, options: { commentString } }, lines, comment, chompKeep) {\n if (comment && chompKeep)\n comment = comment.replace(/^\\n+/, '');\n if (comment) {\n const ic = stringifyComment.indentComment(commentString(comment), indent);\n lines.push(ic.trimStart()); // Avoid double indent on first line\n }\n}\n\nexports.stringifyCollection = stringifyCollection;\n","'use strict';\n\nvar stringifyCollection = require('../stringify/stringifyCollection.js');\nvar addPairToJSMap = require('./addPairToJSMap.js');\nvar Collection = require('./Collection.js');\nvar identity = require('./identity.js');\nvar Pair = require('./Pair.js');\nvar Scalar = require('./Scalar.js');\n\nfunction findPair(items, key) {\n const k = identity.isScalar(key) ? key.value : key;\n for (const it of items) {\n if (identity.isPair(it)) {\n if (it.key === key || it.key === k)\n return it;\n if (identity.isScalar(it.key) && it.key.value === k)\n return it;\n }\n }\n return undefined;\n}\nclass YAMLMap extends Collection.Collection {\n static get tagName() {\n return 'tag:yaml.org,2002:map';\n }\n constructor(schema) {\n super(identity.MAP, schema);\n this.items = [];\n }\n /**\n * A generic collection parsing method that can be extended\n * to other node classes that inherit from YAMLMap\n */\n static from(schema, obj, ctx) {\n const { keepUndefined, replacer } = ctx;\n const map = new this(schema);\n const add = (key, value) => {\n if (typeof replacer === 'function')\n value = replacer.call(obj, key, value);\n else if (Array.isArray(replacer) && !replacer.includes(key))\n return;\n if (value !== undefined || keepUndefined)\n map.items.push(Pair.createPair(key, value, ctx));\n };\n if (obj instanceof Map) {\n for (const [key, value] of obj)\n add(key, value);\n }\n else if (obj && typeof obj === 'object') {\n for (const key of Object.keys(obj))\n add(key, obj[key]);\n }\n if (typeof schema.sortMapEntries === 'function') {\n map.items.sort(schema.sortMapEntries);\n }\n return map;\n }\n /**\n * Adds a value to the collection.\n *\n * @param overwrite - If not set `true`, using a key that is already in the\n * collection will throw. Otherwise, overwrites the previous value.\n */\n add(pair, overwrite) {\n let _pair;\n if (identity.isPair(pair))\n _pair = pair;\n else if (!pair || typeof pair !== 'object' || !('key' in pair)) {\n // In TypeScript, this never happens.\n _pair = new Pair.Pair(pair, pair?.value);\n }\n else\n _pair = new Pair.Pair(pair.key, pair.value);\n const prev = findPair(this.items, _pair.key);\n const sortEntries = this.schema?.sortMapEntries;\n if (prev) {\n if (!overwrite)\n throw new Error(`Key ${_pair.key} already set`);\n // For scalars, keep the old node & its comments and anchors\n if (identity.isScalar(prev.value) && Scalar.isScalarValue(_pair.value))\n prev.value.value = _pair.value;\n else\n prev.value = _pair.value;\n }\n else if (sortEntries) {\n const i = this.items.findIndex(item => sortEntries(_pair, item) < 0);\n if (i === -1)\n this.items.push(_pair);\n else\n this.items.splice(i, 0, _pair);\n }\n else {\n this.items.push(_pair);\n }\n }\n delete(key) {\n const it = findPair(this.items, key);\n if (!it)\n return false;\n const del = this.items.splice(this.items.indexOf(it), 1);\n return del.length > 0;\n }\n get(key, keepScalar) {\n const it = findPair(this.items, key);\n const node = it?.value;\n return (!keepScalar && identity.isScalar(node) ? node.value : node) ?? undefined;\n }\n has(key) {\n return !!findPair(this.items, key);\n }\n set(key, value) {\n this.add(new Pair.Pair(key, value), true);\n }\n /**\n * @param ctx - Conversion context, originally set in Document#toJS()\n * @param {Class} Type - If set, forces the returned collection type\n * @returns Instance of Type, Map, or Object\n */\n toJSON(_, ctx, Type) {\n const map = Type ? new Type() : ctx?.mapAsMap ? new Map() : {};\n if (ctx?.onCreate)\n ctx.onCreate(map);\n for (const item of this.items)\n addPairToJSMap.addPairToJSMap(ctx, map, item);\n return map;\n }\n toString(ctx, onComment, onChompKeep) {\n if (!ctx)\n return JSON.stringify(this);\n for (const item of this.items) {\n if (!identity.isPair(item))\n throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);\n }\n if (!ctx.allNullValues && this.hasAllNullValues(false))\n ctx = Object.assign({}, ctx, { allNullValues: true });\n return stringifyCollection.stringifyCollection(this, ctx, {\n blockItemPrefix: '',\n flowChars: { start: '{', end: '}' },\n itemIndent: ctx.indent || '',\n onChompKeep,\n onComment\n });\n }\n}\n\nexports.YAMLMap = YAMLMap;\nexports.findPair = findPair;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar YAMLMap = require('../../nodes/YAMLMap.js');\n\nconst map = {\n collection: 'map',\n default: true,\n nodeClass: YAMLMap.YAMLMap,\n tag: 'tag:yaml.org,2002:map',\n resolve(map, onError) {\n if (!identity.isMap(map))\n onError('Expected a mapping for this tag');\n return map;\n },\n createNode: (schema, obj, ctx) => YAMLMap.YAMLMap.from(schema, obj, ctx)\n};\n\nexports.map = map;\n","'use strict';\n\nvar createNode = require('../doc/createNode.js');\nvar stringifyCollection = require('../stringify/stringifyCollection.js');\nvar Collection = require('./Collection.js');\nvar identity = require('./identity.js');\nvar Scalar = require('./Scalar.js');\nvar toJS = require('./toJS.js');\n\nclass YAMLSeq extends Collection.Collection {\n static get tagName() {\n return 'tag:yaml.org,2002:seq';\n }\n constructor(schema) {\n super(identity.SEQ, schema);\n this.items = [];\n }\n add(value) {\n this.items.push(value);\n }\n /**\n * Removes a value from the collection.\n *\n * `key` must contain a representation of an integer for this to succeed.\n * It may be wrapped in a `Scalar`.\n *\n * @returns `true` if the item was found and removed.\n */\n delete(key) {\n const idx = asItemIndex(key);\n if (typeof idx !== 'number')\n return false;\n const del = this.items.splice(idx, 1);\n return del.length > 0;\n }\n get(key, keepScalar) {\n const idx = asItemIndex(key);\n if (typeof idx !== 'number')\n return undefined;\n const it = this.items[idx];\n return !keepScalar && identity.isScalar(it) ? it.value : it;\n }\n /**\n * Checks if the collection includes a value with the key `key`.\n *\n * `key` must contain a representation of an integer for this to succeed.\n * It may be wrapped in a `Scalar`.\n */\n has(key) {\n const idx = asItemIndex(key);\n return typeof idx === 'number' && idx < this.items.length;\n }\n /**\n * Sets a value in this collection. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n *\n * If `key` does not contain a representation of an integer, this will throw.\n * It may be wrapped in a `Scalar`.\n */\n set(key, value) {\n const idx = asItemIndex(key);\n if (typeof idx !== 'number')\n throw new Error(`Expected a valid index, not ${key}.`);\n const prev = this.items[idx];\n if (identity.isScalar(prev) && Scalar.isScalarValue(value))\n prev.value = value;\n else\n this.items[idx] = value;\n }\n toJSON(_, ctx) {\n const seq = [];\n if (ctx?.onCreate)\n ctx.onCreate(seq);\n let i = 0;\n for (const item of this.items)\n seq.push(toJS.toJS(item, String(i++), ctx));\n return seq;\n }\n toString(ctx, onComment, onChompKeep) {\n if (!ctx)\n return JSON.stringify(this);\n return stringifyCollection.stringifyCollection(this, ctx, {\n blockItemPrefix: '- ',\n flowChars: { start: '[', end: ']' },\n itemIndent: (ctx.indent || '') + ' ',\n onChompKeep,\n onComment\n });\n }\n static from(schema, obj, ctx) {\n const { replacer } = ctx;\n const seq = new this(schema);\n if (obj && Symbol.iterator in Object(obj)) {\n let i = 0;\n for (let it of obj) {\n if (typeof replacer === 'function') {\n const key = obj instanceof Set ? it : String(i++);\n it = replacer.call(obj, key, it);\n }\n seq.items.push(createNode.createNode(it, undefined, ctx));\n }\n }\n return seq;\n }\n}\nfunction asItemIndex(key) {\n let idx = identity.isScalar(key) ? key.value : key;\n if (idx && typeof idx === 'string')\n idx = Number(idx);\n return typeof idx === 'number' && Number.isInteger(idx) && idx >= 0\n ? idx\n : null;\n}\n\nexports.YAMLSeq = YAMLSeq;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar YAMLSeq = require('../../nodes/YAMLSeq.js');\n\nconst seq = {\n collection: 'seq',\n default: true,\n nodeClass: YAMLSeq.YAMLSeq,\n tag: 'tag:yaml.org,2002:seq',\n resolve(seq, onError) {\n if (!identity.isSeq(seq))\n onError('Expected a sequence for this tag');\n return seq;\n },\n createNode: (schema, obj, ctx) => YAMLSeq.YAMLSeq.from(schema, obj, ctx)\n};\n\nexports.seq = seq;\n","'use strict';\n\nvar stringifyString = require('../../stringify/stringifyString.js');\n\nconst string = {\n identify: value => typeof value === 'string',\n default: true,\n tag: 'tag:yaml.org,2002:str',\n resolve: str => str,\n stringify(item, ctx, onComment, onChompKeep) {\n ctx = Object.assign({ actualString: true }, ctx);\n return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);\n }\n};\n\nexports.string = string;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\n\nconst nullTag = {\n identify: value => value == null,\n createNode: () => new Scalar.Scalar(null),\n default: true,\n tag: 'tag:yaml.org,2002:null',\n test: /^(?:~|[Nn]ull|NULL)?$/,\n resolve: () => new Scalar.Scalar(null),\n stringify: ({ source }, ctx) => typeof source === 'string' && nullTag.test.test(source)\n ? source\n : ctx.options.nullStr\n};\n\nexports.nullTag = nullTag;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\n\nconst boolTag = {\n identify: value => typeof value === 'boolean',\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,\n resolve: str => new Scalar.Scalar(str[0] === 't' || str[0] === 'T'),\n stringify({ source, value }, ctx) {\n if (source && boolTag.test.test(source)) {\n const sv = source[0] === 't' || source[0] === 'T';\n if (value === sv)\n return source;\n }\n return value ? ctx.options.trueStr : ctx.options.falseStr;\n }\n};\n\nexports.boolTag = boolTag;\n","'use strict';\n\nfunction stringifyNumber({ format, minFractionDigits, tag, value }) {\n if (typeof value === 'bigint')\n return String(value);\n const num = typeof value === 'number' ? value : Number(value);\n if (!isFinite(num))\n return isNaN(num) ? '.nan' : num < 0 ? '-.inf' : '.inf';\n let n = Object.is(value, -0) ? '-0' : JSON.stringify(value);\n if (!format &&\n minFractionDigits &&\n (!tag || tag === 'tag:yaml.org,2002:float') &&\n /^-?\\d/.test(n) &&\n !n.includes('e')) {\n let i = n.indexOf('.');\n if (i < 0) {\n i = n.length;\n n += '.';\n }\n let d = minFractionDigits - (n.length - i - 1);\n while (d-- > 0)\n n += '0';\n }\n return n;\n}\n\nexports.stringifyNumber = stringifyNumber;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst floatNaN = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^(?:[-+]?\\.(?:inf|Inf|INF)|\\.nan|\\.NaN|\\.NAN)$/,\n resolve: str => str.slice(-3).toLowerCase() === 'nan'\n ? NaN\n : str[0] === '-'\n ? Number.NEGATIVE_INFINITY\n : Number.POSITIVE_INFINITY,\n stringify: stringifyNumber.stringifyNumber\n};\nconst floatExp = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n format: 'EXP',\n test: /^[-+]?(?:\\.[0-9]+|[0-9]+(?:\\.[0-9]*)?)[eE][-+]?[0-9]+$/,\n resolve: str => parseFloat(str),\n stringify(node) {\n const num = Number(node.value);\n return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);\n }\n};\nconst float = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^[-+]?(?:\\.[0-9]+|[0-9]+\\.[0-9]*)$/,\n resolve(str) {\n const node = new Scalar.Scalar(parseFloat(str));\n const dot = str.indexOf('.');\n if (dot !== -1 && str[str.length - 1] === '0')\n node.minFractionDigits = str.length - dot - 1;\n return node;\n },\n stringify: stringifyNumber.stringifyNumber\n};\n\nexports.float = float;\nexports.floatExp = floatExp;\nexports.floatNaN = floatNaN;\n","'use strict';\n\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);\nconst intResolve = (str, offset, radix, { intAsBigInt }) => (intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix));\nfunction intStringify(node, radix, prefix) {\n const { value } = node;\n if (intIdentify(value) && value >= 0)\n return prefix + value.toString(radix);\n return stringifyNumber.stringifyNumber(node);\n}\nconst intOct = {\n identify: value => intIdentify(value) && value >= 0,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'OCT',\n test: /^0o[0-7]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 8, opt),\n stringify: node => intStringify(node, 8, '0o')\n};\nconst int = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n test: /^[-+]?[0-9]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),\n stringify: stringifyNumber.stringifyNumber\n};\nconst intHex = {\n identify: value => intIdentify(value) && value >= 0,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'HEX',\n test: /^0x[0-9a-fA-F]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),\n stringify: node => intStringify(node, 16, '0x')\n};\n\nexports.int = int;\nexports.intHex = intHex;\nexports.intOct = intOct;\n","'use strict';\n\nvar map = require('../common/map.js');\nvar _null = require('../common/null.js');\nvar seq = require('../common/seq.js');\nvar string = require('../common/string.js');\nvar bool = require('./bool.js');\nvar float = require('./float.js');\nvar int = require('./int.js');\n\nconst schema = [\n map.map,\n seq.seq,\n string.string,\n _null.nullTag,\n bool.boolTag,\n int.intOct,\n int.int,\n int.intHex,\n float.floatNaN,\n float.floatExp,\n float.float\n];\n\nexports.schema = schema;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\nvar map = require('../common/map.js');\nvar seq = require('../common/seq.js');\n\nfunction intIdentify(value) {\n return typeof value === 'bigint' || Number.isInteger(value);\n}\nconst stringifyJSON = ({ value }) => JSON.stringify(value);\nconst jsonScalars = [\n {\n identify: value => typeof value === 'string',\n default: true,\n tag: 'tag:yaml.org,2002:str',\n resolve: str => str,\n stringify: stringifyJSON\n },\n {\n identify: value => value == null,\n createNode: () => new Scalar.Scalar(null),\n default: true,\n tag: 'tag:yaml.org,2002:null',\n test: /^null$/,\n resolve: () => null,\n stringify: stringifyJSON\n },\n {\n identify: value => typeof value === 'boolean',\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^true$|^false$/,\n resolve: str => str === 'true',\n stringify: stringifyJSON\n },\n {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n test: /^-?(?:0|[1-9][0-9]*)$/,\n resolve: (str, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str, 10),\n stringify: ({ value }) => intIdentify(value) ? value.toString() : JSON.stringify(value)\n },\n {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,\n resolve: str => parseFloat(str),\n stringify: stringifyJSON\n }\n];\nconst jsonError = {\n default: true,\n tag: '',\n test: /^/,\n resolve(str, onError) {\n onError(`Unresolved plain scalar ${JSON.stringify(str)}`);\n return str;\n }\n};\nconst schema = [map.map, seq.seq].concat(jsonScalars, jsonError);\n\nexports.schema = schema;\n","'use strict';\n\nvar node_buffer = require('buffer');\nvar Scalar = require('../../nodes/Scalar.js');\nvar stringifyString = require('../../stringify/stringifyString.js');\n\nconst binary = {\n identify: value => value instanceof Uint8Array, // Buffer inherits from Uint8Array\n default: false,\n tag: 'tag:yaml.org,2002:binary',\n /**\n * Returns a Buffer in node and an Uint8Array in browsers\n *\n * To use the resulting buffer as an image, you'll want to do something like:\n *\n * const blob = new Blob([buffer], { type: 'image/jpeg' })\n * document.querySelector('#photo').src = URL.createObjectURL(blob)\n */\n resolve(src, onError) {\n if (typeof node_buffer.Buffer === 'function') {\n return node_buffer.Buffer.from(src, 'base64');\n }\n else if (typeof atob === 'function') {\n // On IE 11, atob() can't handle newlines\n const str = atob(src.replace(/[\\n\\r]/g, ''));\n const buffer = new Uint8Array(str.length);\n for (let i = 0; i < str.length; ++i)\n buffer[i] = str.charCodeAt(i);\n return buffer;\n }\n else {\n onError('This environment does not support reading binary tags; either Buffer or atob is required');\n return src;\n }\n },\n stringify({ comment, type, value }, ctx, onComment, onChompKeep) {\n if (!value)\n return '';\n const buf = value; // checked earlier by binary.identify()\n let str;\n if (typeof node_buffer.Buffer === 'function') {\n str =\n buf instanceof node_buffer.Buffer\n ? buf.toString('base64')\n : node_buffer.Buffer.from(buf.buffer).toString('base64');\n }\n else if (typeof btoa === 'function') {\n let s = '';\n for (let i = 0; i < buf.length; ++i)\n s += String.fromCharCode(buf[i]);\n str = btoa(s);\n }\n else {\n throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');\n }\n type ?? (type = Scalar.Scalar.BLOCK_LITERAL);\n if (type !== Scalar.Scalar.QUOTE_DOUBLE) {\n const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);\n const n = Math.ceil(str.length / lineWidth);\n const lines = new Array(n);\n for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {\n lines[i] = str.substr(o, lineWidth);\n }\n str = lines.join(type === Scalar.Scalar.BLOCK_LITERAL ? '\\n' : ' ');\n }\n return stringifyString.stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep);\n }\n};\n\nexports.binary = binary;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar Pair = require('../../nodes/Pair.js');\nvar Scalar = require('../../nodes/Scalar.js');\nvar YAMLSeq = require('../../nodes/YAMLSeq.js');\n\nfunction resolvePairs(seq, onError) {\n if (identity.isSeq(seq)) {\n for (let i = 0; i < seq.items.length; ++i) {\n let item = seq.items[i];\n if (identity.isPair(item))\n continue;\n else if (identity.isMap(item)) {\n if (item.items.length > 1)\n onError('Each pair must have its own sequence indicator');\n const pair = item.items[0] || new Pair.Pair(new Scalar.Scalar(null));\n if (item.commentBefore)\n pair.key.commentBefore = pair.key.commentBefore\n ? `${item.commentBefore}\\n${pair.key.commentBefore}`\n : item.commentBefore;\n if (item.comment) {\n const cn = pair.value ?? pair.key;\n cn.comment = cn.comment\n ? `${item.comment}\\n${cn.comment}`\n : item.comment;\n }\n item = pair;\n }\n seq.items[i] = identity.isPair(item) ? item : new Pair.Pair(item);\n }\n }\n else\n onError('Expected a sequence for this tag');\n return seq;\n}\nfunction createPairs(schema, iterable, ctx) {\n const { replacer } = ctx;\n const pairs = new YAMLSeq.YAMLSeq(schema);\n pairs.tag = 'tag:yaml.org,2002:pairs';\n let i = 0;\n if (iterable && Symbol.iterator in Object(iterable))\n for (let it of iterable) {\n if (typeof replacer === 'function')\n it = replacer.call(iterable, String(i++), it);\n let key, value;\n if (Array.isArray(it)) {\n if (it.length === 2) {\n key = it[0];\n value = it[1];\n }\n else\n throw new TypeError(`Expected [key, value] tuple: ${it}`);\n }\n else if (it && it instanceof Object) {\n const keys = Object.keys(it);\n if (keys.length === 1) {\n key = keys[0];\n value = it[key];\n }\n else {\n throw new TypeError(`Expected tuple with one key, not ${keys.length} keys`);\n }\n }\n else {\n key = it;\n }\n pairs.items.push(Pair.createPair(key, value, ctx));\n }\n return pairs;\n}\nconst pairs = {\n collection: 'seq',\n default: false,\n tag: 'tag:yaml.org,2002:pairs',\n resolve: resolvePairs,\n createNode: createPairs\n};\n\nexports.createPairs = createPairs;\nexports.pairs = pairs;\nexports.resolvePairs = resolvePairs;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar toJS = require('../../nodes/toJS.js');\nvar YAMLMap = require('../../nodes/YAMLMap.js');\nvar YAMLSeq = require('../../nodes/YAMLSeq.js');\nvar pairs = require('./pairs.js');\n\nclass YAMLOMap extends YAMLSeq.YAMLSeq {\n constructor() {\n super();\n this.add = YAMLMap.YAMLMap.prototype.add.bind(this);\n this.delete = YAMLMap.YAMLMap.prototype.delete.bind(this);\n this.get = YAMLMap.YAMLMap.prototype.get.bind(this);\n this.has = YAMLMap.YAMLMap.prototype.has.bind(this);\n this.set = YAMLMap.YAMLMap.prototype.set.bind(this);\n this.tag = YAMLOMap.tag;\n }\n /**\n * If `ctx` is given, the return type is actually `Map<unknown, unknown>`,\n * but TypeScript won't allow widening the signature of a child method.\n */\n toJSON(_, ctx) {\n if (!ctx)\n return super.toJSON(_);\n const map = new Map();\n if (ctx?.onCreate)\n ctx.onCreate(map);\n for (const pair of this.items) {\n let key, value;\n if (identity.isPair(pair)) {\n key = toJS.toJS(pair.key, '', ctx);\n value = toJS.toJS(pair.value, key, ctx);\n }\n else {\n key = toJS.toJS(pair, '', ctx);\n }\n if (map.has(key))\n throw new Error('Ordered maps must not include duplicate keys');\n map.set(key, value);\n }\n return map;\n }\n static from(schema, iterable, ctx) {\n const pairs$1 = pairs.createPairs(schema, iterable, ctx);\n const omap = new this();\n omap.items = pairs$1.items;\n return omap;\n }\n}\nYAMLOMap.tag = 'tag:yaml.org,2002:omap';\nconst omap = {\n collection: 'seq',\n identify: value => value instanceof Map,\n nodeClass: YAMLOMap,\n default: false,\n tag: 'tag:yaml.org,2002:omap',\n resolve(seq, onError) {\n const pairs$1 = pairs.resolvePairs(seq, onError);\n const seenKeys = [];\n for (const { key } of pairs$1.items) {\n if (identity.isScalar(key)) {\n if (seenKeys.includes(key.value)) {\n onError(`Ordered maps must not include duplicate keys: ${key.value}`);\n }\n else {\n seenKeys.push(key.value);\n }\n }\n }\n return Object.assign(new YAMLOMap(), pairs$1);\n },\n createNode: (schema, iterable, ctx) => YAMLOMap.from(schema, iterable, ctx)\n};\n\nexports.YAMLOMap = YAMLOMap;\nexports.omap = omap;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\n\nfunction boolStringify({ value, source }, ctx) {\n const boolObj = value ? trueTag : falseTag;\n if (source && boolObj.test.test(source))\n return source;\n return value ? ctx.options.trueStr : ctx.options.falseStr;\n}\nconst trueTag = {\n identify: value => value === true,\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,\n resolve: () => new Scalar.Scalar(true),\n stringify: boolStringify\n};\nconst falseTag = {\n identify: value => value === false,\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,\n resolve: () => new Scalar.Scalar(false),\n stringify: boolStringify\n};\n\nexports.falseTag = falseTag;\nexports.trueTag = trueTag;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst floatNaN = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^(?:[-+]?\\.(?:inf|Inf|INF)|\\.nan|\\.NaN|\\.NAN)$/,\n resolve: (str) => str.slice(-3).toLowerCase() === 'nan'\n ? NaN\n : str[0] === '-'\n ? Number.NEGATIVE_INFINITY\n : Number.POSITIVE_INFINITY,\n stringify: stringifyNumber.stringifyNumber\n};\nconst floatExp = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n format: 'EXP',\n test: /^[-+]?(?:[0-9][0-9_]*)?(?:\\.[0-9_]*)?[eE][-+]?[0-9]+$/,\n resolve: (str) => parseFloat(str.replace(/_/g, '')),\n stringify(node) {\n const num = Number(node.value);\n return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);\n }\n};\nconst float = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^[-+]?(?:[0-9][0-9_]*)?\\.[0-9_]*$/,\n resolve(str) {\n const node = new Scalar.Scalar(parseFloat(str.replace(/_/g, '')));\n const dot = str.indexOf('.');\n if (dot !== -1) {\n const f = str.substring(dot + 1).replace(/_/g, '');\n if (f[f.length - 1] === '0')\n node.minFractionDigits = f.length;\n }\n return node;\n },\n stringify: stringifyNumber.stringifyNumber\n};\n\nexports.float = float;\nexports.floatExp = floatExp;\nexports.floatNaN = floatNaN;\n","'use strict';\n\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);\nfunction intResolve(str, offset, radix, { intAsBigInt }) {\n const sign = str[0];\n if (sign === '-' || sign === '+')\n offset += 1;\n str = str.substring(offset).replace(/_/g, '');\n if (intAsBigInt) {\n switch (radix) {\n case 2:\n str = `0b${str}`;\n break;\n case 8:\n str = `0o${str}`;\n break;\n case 16:\n str = `0x${str}`;\n break;\n }\n const n = BigInt(str);\n return sign === '-' ? BigInt(-1) * n : n;\n }\n const n = parseInt(str, radix);\n return sign === '-' ? -1 * n : n;\n}\nfunction intStringify(node, radix, prefix) {\n const { value } = node;\n if (intIdentify(value)) {\n const str = value.toString(radix);\n return value < 0 ? '-' + prefix + str.substr(1) : prefix + str;\n }\n return stringifyNumber.stringifyNumber(node);\n}\nconst intBin = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'BIN',\n test: /^[-+]?0b[0-1_]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 2, opt),\n stringify: node => intStringify(node, 2, '0b')\n};\nconst intOct = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'OCT',\n test: /^[-+]?0[0-7_]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 1, 8, opt),\n stringify: node => intStringify(node, 8, '0')\n};\nconst int = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n test: /^[-+]?[0-9][0-9_]*$/,\n resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),\n stringify: stringifyNumber.stringifyNumber\n};\nconst intHex = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'HEX',\n test: /^[-+]?0x[0-9a-fA-F_]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),\n stringify: node => intStringify(node, 16, '0x')\n};\n\nexports.int = int;\nexports.intBin = intBin;\nexports.intHex = intHex;\nexports.intOct = intOct;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar Pair = require('../../nodes/Pair.js');\nvar YAMLMap = require('../../nodes/YAMLMap.js');\n\nclass YAMLSet extends YAMLMap.YAMLMap {\n constructor(schema) {\n super(schema);\n this.tag = YAMLSet.tag;\n }\n add(key) {\n let pair;\n if (identity.isPair(key))\n pair = key;\n else if (key &&\n typeof key === 'object' &&\n 'key' in key &&\n 'value' in key &&\n key.value === null)\n pair = new Pair.Pair(key.key, null);\n else\n pair = new Pair.Pair(key, null);\n const prev = YAMLMap.findPair(this.items, pair.key);\n if (!prev)\n this.items.push(pair);\n }\n /**\n * If `keepPair` is `true`, returns the Pair matching `key`.\n * Otherwise, returns the value of that Pair's key.\n */\n get(key, keepPair) {\n const pair = YAMLMap.findPair(this.items, key);\n return !keepPair && identity.isPair(pair)\n ? identity.isScalar(pair.key)\n ? pair.key.value\n : pair.key\n : pair;\n }\n set(key, value) {\n if (typeof value !== 'boolean')\n throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);\n const prev = YAMLMap.findPair(this.items, key);\n if (prev && !value) {\n this.items.splice(this.items.indexOf(prev), 1);\n }\n else if (!prev && value) {\n this.items.push(new Pair.Pair(key));\n }\n }\n toJSON(_, ctx) {\n return super.toJSON(_, ctx, Set);\n }\n toString(ctx, onComment, onChompKeep) {\n if (!ctx)\n return JSON.stringify(this);\n if (this.hasAllNullValues(true))\n return super.toString(Object.assign({}, ctx, { allNullValues: true }), onComment, onChompKeep);\n else\n throw new Error('Set items must all have null values');\n }\n static from(schema, iterable, ctx) {\n const { replacer } = ctx;\n const set = new this(schema);\n if (iterable && Symbol.iterator in Object(iterable))\n for (let value of iterable) {\n if (typeof replacer === 'function')\n value = replacer.call(iterable, value, value);\n set.items.push(Pair.createPair(value, null, ctx));\n }\n return set;\n }\n}\nYAMLSet.tag = 'tag:yaml.org,2002:set';\nconst set = {\n collection: 'map',\n identify: value => value instanceof Set,\n nodeClass: YAMLSet,\n default: false,\n tag: 'tag:yaml.org,2002:set',\n createNode: (schema, iterable, ctx) => YAMLSet.from(schema, iterable, ctx),\n resolve(map, onError) {\n if (identity.isMap(map)) {\n if (map.hasAllNullValues(true))\n return Object.assign(new YAMLSet(), map);\n else\n onError('Set items must all have null values');\n }\n else\n onError('Expected a mapping for this tag');\n return map;\n }\n};\n\nexports.YAMLSet = YAMLSet;\nexports.set = set;\n","'use strict';\n\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\n/** Internal types handle bigint as number, because TS can't figure it out. */\nfunction parseSexagesimal(str, asBigInt) {\n const sign = str[0];\n const parts = sign === '-' || sign === '+' ? str.substring(1) : str;\n const num = (n) => asBigInt ? BigInt(n) : Number(n);\n const res = parts\n .replace(/_/g, '')\n .split(':')\n .reduce((res, p) => res * num(60) + num(p), num(0));\n return (sign === '-' ? num(-1) * res : res);\n}\n/**\n * hhhh:mm:ss.sss\n *\n * Internal types handle bigint as number, because TS can't figure it out.\n */\nfunction stringifySexagesimal(node) {\n let { value } = node;\n let num = (n) => n;\n if (typeof value === 'bigint')\n num = n => BigInt(n);\n else if (isNaN(value) || !isFinite(value))\n return stringifyNumber.stringifyNumber(node);\n let sign = '';\n if (value < 0) {\n sign = '-';\n value *= num(-1);\n }\n const _60 = num(60);\n const parts = [value % _60]; // seconds, including ms\n if (value < 60) {\n parts.unshift(0); // at least one : is required\n }\n else {\n value = (value - parts[0]) / _60;\n parts.unshift(value % _60); // minutes\n if (value >= 60) {\n value = (value - parts[0]) / _60;\n parts.unshift(value); // hours\n }\n }\n return (sign +\n parts\n .map(n => String(n).padStart(2, '0'))\n .join(':')\n .replace(/000000\\d*$/, '') // % 60 may introduce error\n );\n}\nconst intTime = {\n identify: value => typeof value === 'bigint' || Number.isInteger(value),\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'TIME',\n test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,\n resolve: (str, _onError, { intAsBigInt }) => parseSexagesimal(str, intAsBigInt),\n stringify: stringifySexagesimal\n};\nconst floatTime = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n format: 'TIME',\n test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*$/,\n resolve: str => parseSexagesimal(str, false),\n stringify: stringifySexagesimal\n};\nconst timestamp = {\n identify: value => value instanceof Date,\n default: true,\n tag: 'tag:yaml.org,2002:timestamp',\n // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part\n // may be omitted altogether, resulting in a date format. In such a case, the time part is\n // assumed to be 00:00:00Z (start of day, UTC).\n test: RegExp('^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})' + // YYYY-Mm-Dd\n '(?:' + // time is optional\n '(?:t|T|[ \\\\t]+)' + // t | T | whitespace\n '([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\\\.[0-9]+)?)' + // Hh:Mm:Ss(.ss)?\n '(?:[ \\\\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?' + // Z | +5 | -03:30\n ')?$'),\n resolve(str) {\n const match = str.match(timestamp.test);\n if (!match)\n throw new Error('!!timestamp expects a date, starting with yyyy-mm-dd');\n const [, year, month, day, hour, minute, second] = match.map(Number);\n const millisec = match[7] ? Number((match[7] + '00').substr(1, 3)) : 0;\n let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);\n const tz = match[8];\n if (tz && tz !== 'Z') {\n let d = parseSexagesimal(tz, false);\n if (Math.abs(d) < 30)\n d *= 60;\n date -= 60000 * d;\n }\n return new Date(date);\n },\n stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\\.000Z$/, '') ?? ''\n};\n\nexports.floatTime = floatTime;\nexports.intTime = intTime;\nexports.timestamp = timestamp;\n","'use strict';\n\nvar map = require('../common/map.js');\nvar _null = require('../common/null.js');\nvar seq = require('../common/seq.js');\nvar string = require('../common/string.js');\nvar binary = require('./binary.js');\nvar bool = require('./bool.js');\nvar float = require('./float.js');\nvar int = require('./int.js');\nvar merge = require('./merge.js');\nvar omap = require('./omap.js');\nvar pairs = require('./pairs.js');\nvar set = require('./set.js');\nvar timestamp = require('./timestamp.js');\n\nconst schema = [\n map.map,\n seq.seq,\n string.string,\n _null.nullTag,\n bool.trueTag,\n bool.falseTag,\n int.intBin,\n int.intOct,\n int.int,\n int.intHex,\n float.floatNaN,\n float.floatExp,\n float.float,\n binary.binary,\n merge.merge,\n omap.omap,\n pairs.pairs,\n set.set,\n timestamp.intTime,\n timestamp.floatTime,\n timestamp.timestamp\n];\n\nexports.schema = schema;\n","'use strict';\n\nvar map = require('./common/map.js');\nvar _null = require('./common/null.js');\nvar seq = require('./common/seq.js');\nvar string = require('./common/string.js');\nvar bool = require('./core/bool.js');\nvar float = require('./core/float.js');\nvar int = require('./core/int.js');\nvar schema = require('./core/schema.js');\nvar schema$1 = require('./json/schema.js');\nvar binary = require('./yaml-1.1/binary.js');\nvar merge = require('./yaml-1.1/merge.js');\nvar omap = require('./yaml-1.1/omap.js');\nvar pairs = require('./yaml-1.1/pairs.js');\nvar schema$2 = require('./yaml-1.1/schema.js');\nvar set = require('./yaml-1.1/set.js');\nvar timestamp = require('./yaml-1.1/timestamp.js');\n\nconst schemas = new Map([\n ['core', schema.schema],\n ['failsafe', [map.map, seq.seq, string.string]],\n ['json', schema$1.schema],\n ['yaml11', schema$2.schema],\n ['yaml-1.1', schema$2.schema]\n]);\nconst tagsByName = {\n binary: binary.binary,\n bool: bool.boolTag,\n float: float.float,\n floatExp: float.floatExp,\n floatNaN: float.floatNaN,\n floatTime: timestamp.floatTime,\n int: int.int,\n intHex: int.intHex,\n intOct: int.intOct,\n intTime: timestamp.intTime,\n map: map.map,\n merge: merge.merge,\n null: _null.nullTag,\n omap: omap.omap,\n pairs: pairs.pairs,\n seq: seq.seq,\n set: set.set,\n timestamp: timestamp.timestamp\n};\nconst coreKnownTags = {\n 'tag:yaml.org,2002:binary': binary.binary,\n 'tag:yaml.org,2002:merge': merge.merge,\n 'tag:yaml.org,2002:omap': omap.omap,\n 'tag:yaml.org,2002:pairs': pairs.pairs,\n 'tag:yaml.org,2002:set': set.set,\n 'tag:yaml.org,2002:timestamp': timestamp.timestamp\n};\nfunction getTags(customTags, schemaName, addMergeTag) {\n const schemaTags = schemas.get(schemaName);\n if (schemaTags && !customTags) {\n return addMergeTag && !schemaTags.includes(merge.merge)\n ? schemaTags.concat(merge.merge)\n : schemaTags.slice();\n }\n let tags = schemaTags;\n if (!tags) {\n if (Array.isArray(customTags))\n tags = [];\n else {\n const keys = Array.from(schemas.keys())\n .filter(key => key !== 'yaml11')\n .map(key => JSON.stringify(key))\n .join(', ');\n throw new Error(`Unknown schema \"${schemaName}\"; use one of ${keys} or define customTags array`);\n }\n }\n if (Array.isArray(customTags)) {\n for (const tag of customTags)\n tags = tags.concat(tag);\n }\n else if (typeof customTags === 'function') {\n tags = customTags(tags.slice());\n }\n if (addMergeTag)\n tags = tags.concat(merge.merge);\n return tags.reduce((tags, tag) => {\n const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;\n if (!tagObj) {\n const tagName = JSON.stringify(tag);\n const keys = Object.keys(tagsByName)\n .map(key => JSON.stringify(key))\n .join(', ');\n throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);\n }\n if (!tags.includes(tagObj))\n tags.push(tagObj);\n return tags;\n }, []);\n}\n\nexports.coreKnownTags = coreKnownTags;\nexports.getTags = getTags;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar map = require('./common/map.js');\nvar seq = require('./common/seq.js');\nvar string = require('./common/string.js');\nvar tags = require('./tags.js');\n\nconst sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;\nclass Schema {\n constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {\n this.compat = Array.isArray(compat)\n ? tags.getTags(compat, 'compat')\n : compat\n ? tags.getTags(null, compat)\n : null;\n this.name = (typeof schema === 'string' && schema) || 'core';\n this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};\n this.tags = tags.getTags(customTags, this.name, merge);\n this.toStringOptions = toStringDefaults ?? null;\n Object.defineProperty(this, identity.MAP, { value: map.map });\n Object.defineProperty(this, identity.SCALAR, { value: string.string });\n Object.defineProperty(this, identity.SEQ, { value: seq.seq });\n // Used by createMap()\n this.sortMapEntries =\n typeof sortMapEntries === 'function'\n ? sortMapEntries\n : sortMapEntries === true\n ? sortMapEntriesByKey\n : null;\n }\n clone() {\n const copy = Object.create(Schema.prototype, Object.getOwnPropertyDescriptors(this));\n copy.tags = this.tags.slice();\n return copy;\n }\n}\n\nexports.Schema = Schema;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar stringify = require('./stringify.js');\nvar stringifyComment = require('./stringifyComment.js');\n\nfunction stringifyDocument(doc, options) {\n const lines = [];\n let hasDirectives = options.directives === true;\n if (options.directives !== false && doc.directives) {\n const dir = doc.directives.toString(doc);\n if (dir) {\n lines.push(dir);\n hasDirectives = true;\n }\n else if (doc.directives.docStart)\n hasDirectives = true;\n }\n if (hasDirectives)\n lines.push('---');\n const ctx = stringify.createStringifyContext(doc, options);\n const { commentString } = ctx.options;\n if (doc.commentBefore) {\n if (lines.length !== 1)\n lines.unshift('');\n const cs = commentString(doc.commentBefore);\n lines.unshift(stringifyComment.indentComment(cs, ''));\n }\n let chompKeep = false;\n let contentComment = null;\n if (doc.contents) {\n if (identity.isNode(doc.contents)) {\n if (doc.contents.spaceBefore && hasDirectives)\n lines.push('');\n if (doc.contents.commentBefore) {\n const cs = commentString(doc.contents.commentBefore);\n lines.push(stringifyComment.indentComment(cs, ''));\n }\n // top-level block scalars need to be indented if followed by a comment\n ctx.forceBlockIndent = !!doc.comment;\n contentComment = doc.contents.comment;\n }\n const onChompKeep = contentComment ? undefined : () => (chompKeep = true);\n let body = stringify.stringify(doc.contents, ctx, () => (contentComment = null), onChompKeep);\n if (contentComment)\n body += stringifyComment.lineComment(body, '', commentString(contentComment));\n if ((body[0] === '|' || body[0] === '>') &&\n lines[lines.length - 1] === '---') {\n // Top-level block scalars with a preceding doc marker ought to use the\n // same line for their header.\n lines[lines.length - 1] = `--- ${body}`;\n }\n else\n lines.push(body);\n }\n else {\n lines.push(stringify.stringify(doc.contents, ctx));\n }\n if (doc.directives?.docEnd) {\n if (doc.comment) {\n const cs = commentString(doc.comment);\n if (cs.includes('\\n')) {\n lines.push('...');\n lines.push(stringifyComment.indentComment(cs, ''));\n }\n else {\n lines.push(`... ${cs}`);\n }\n }\n else {\n lines.push('...');\n }\n }\n else {\n let dc = doc.comment;\n if (dc && chompKeep)\n dc = dc.replace(/^\\n+/, '');\n if (dc) {\n if ((!chompKeep || contentComment) && lines[lines.length - 1] !== '')\n lines.push('');\n lines.push(stringifyComment.indentComment(commentString(dc), ''));\n }\n }\n return lines.join('\\n') + '\\n';\n}\n\nexports.stringifyDocument = stringifyDocument;\n","'use strict';\n\nvar Alias = require('../nodes/Alias.js');\nvar Collection = require('../nodes/Collection.js');\nvar identity = require('../nodes/identity.js');\nvar Pair = require('../nodes/Pair.js');\nvar toJS = require('../nodes/toJS.js');\nvar Schema = require('../schema/Schema.js');\nvar stringifyDocument = require('../stringify/stringifyDocument.js');\nvar anchors = require('./anchors.js');\nvar applyReviver = require('./applyReviver.js');\nvar createNode = require('./createNode.js');\nvar directives = require('./directives.js');\n\nclass Document {\n constructor(value, replacer, options) {\n /** A comment before this Document */\n this.commentBefore = null;\n /** A comment immediately after this Document */\n this.comment = null;\n /** Errors encountered during parsing. */\n this.errors = [];\n /** Warnings encountered during parsing. */\n this.warnings = [];\n Object.defineProperty(this, identity.NODE_TYPE, { value: identity.DOC });\n let _replacer = null;\n if (typeof replacer === 'function' || Array.isArray(replacer)) {\n _replacer = replacer;\n }\n else if (options === undefined && replacer) {\n options = replacer;\n replacer = undefined;\n }\n const opt = Object.assign({\n intAsBigInt: false,\n keepSourceTokens: false,\n logLevel: 'warn',\n prettyErrors: true,\n strict: true,\n stringKeys: false,\n uniqueKeys: true,\n version: '1.2'\n }, options);\n this.options = opt;\n let { version } = opt;\n if (options?._directives) {\n this.directives = options._directives.atDocument();\n if (this.directives.yaml.explicit)\n version = this.directives.yaml.version;\n }\n else\n this.directives = new directives.Directives({ version });\n this.setSchema(version, options);\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents =\n value === undefined ? null : this.createNode(value, _replacer, options);\n }\n /**\n * Create a deep copy of this Document and its contents.\n *\n * Custom Node values that inherit from `Object` still refer to their original instances.\n */\n clone() {\n const copy = Object.create(Document.prototype, {\n [identity.NODE_TYPE]: { value: identity.DOC }\n });\n copy.commentBefore = this.commentBefore;\n copy.comment = this.comment;\n copy.errors = this.errors.slice();\n copy.warnings = this.warnings.slice();\n copy.options = Object.assign({}, this.options);\n if (this.directives)\n copy.directives = this.directives.clone();\n copy.schema = this.schema.clone();\n // @ts-expect-error We can't really know that this matches Contents.\n copy.contents = identity.isNode(this.contents)\n ? this.contents.clone(copy.schema)\n : this.contents;\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }\n /** Adds a value to the document. */\n add(value) {\n if (assertCollection(this.contents))\n this.contents.add(value);\n }\n /** Adds a value to the document. */\n addIn(path, value) {\n if (assertCollection(this.contents))\n this.contents.addIn(path, value);\n }\n /**\n * Create a new `Alias` node, ensuring that the target `node` has the required anchor.\n *\n * If `node` already has an anchor, `name` is ignored.\n * Otherwise, the `node.anchor` value will be set to `name`,\n * or if an anchor with that name is already present in the document,\n * `name` will be used as a prefix for a new unique anchor.\n * If `name` is undefined, the generated anchor will use 'a' as a prefix.\n */\n createAlias(node, name) {\n if (!node.anchor) {\n const prev = anchors.anchorNames(this);\n node.anchor =\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n !name || prev.has(name) ? anchors.findNewAnchor(name || 'a', prev) : name;\n }\n return new Alias.Alias(node.anchor);\n }\n createNode(value, replacer, options) {\n let _replacer = undefined;\n if (typeof replacer === 'function') {\n value = replacer.call({ '': value }, '', value);\n _replacer = replacer;\n }\n else if (Array.isArray(replacer)) {\n const keyToStr = (v) => typeof v === 'number' || v instanceof String || v instanceof Number;\n const asStr = replacer.filter(keyToStr).map(String);\n if (asStr.length > 0)\n replacer = replacer.concat(asStr);\n _replacer = replacer;\n }\n else if (options === undefined && replacer) {\n options = replacer;\n replacer = undefined;\n }\n const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options ?? {};\n const { onAnchor, setAnchors, sourceObjects } = anchors.createNodeAnchors(this, \n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n anchorPrefix || 'a');\n const ctx = {\n aliasDuplicateObjects: aliasDuplicateObjects ?? true,\n keepUndefined: keepUndefined ?? false,\n onAnchor,\n onTagObj,\n replacer: _replacer,\n schema: this.schema,\n sourceObjects\n };\n const node = createNode.createNode(value, tag, ctx);\n if (flow && identity.isCollection(node))\n node.flow = true;\n setAnchors();\n return node;\n }\n /**\n * Convert a key and a value into a `Pair` using the current schema,\n * recursively wrapping all values as `Scalar` or `Collection` nodes.\n */\n createPair(key, value, options = {}) {\n const k = this.createNode(key, null, options);\n const v = this.createNode(value, null, options);\n return new Pair.Pair(k, v);\n }\n /**\n * Removes a value from the document.\n * @returns `true` if the item was found and removed.\n */\n delete(key) {\n return assertCollection(this.contents) ? this.contents.delete(key) : false;\n }\n /**\n * Removes a value from the document.\n * @returns `true` if the item was found and removed.\n */\n deleteIn(path) {\n if (Collection.isEmptyPath(path)) {\n if (this.contents == null)\n return false;\n // @ts-expect-error Presumed impossible if Strict extends false\n this.contents = null;\n return true;\n }\n return assertCollection(this.contents)\n ? this.contents.deleteIn(path)\n : false;\n }\n /**\n * Returns item at `key`, or `undefined` if not found. By default unwraps\n * scalar values from their surrounding node; to disable set `keepScalar` to\n * `true` (collections are always returned intact).\n */\n get(key, keepScalar) {\n return identity.isCollection(this.contents)\n ? this.contents.get(key, keepScalar)\n : undefined;\n }\n /**\n * Returns item at `path`, or `undefined` if not found. By default unwraps\n * scalar values from their surrounding node; to disable set `keepScalar` to\n * `true` (collections are always returned intact).\n */\n getIn(path, keepScalar) {\n if (Collection.isEmptyPath(path))\n return !keepScalar && identity.isScalar(this.contents)\n ? this.contents.value\n : this.contents;\n return identity.isCollection(this.contents)\n ? this.contents.getIn(path, keepScalar)\n : undefined;\n }\n /**\n * Checks if the document includes a value with the key `key`.\n */\n has(key) {\n return identity.isCollection(this.contents) ? this.contents.has(key) : false;\n }\n /**\n * Checks if the document includes a value at `path`.\n */\n hasIn(path) {\n if (Collection.isEmptyPath(path))\n return this.contents !== undefined;\n return identity.isCollection(this.contents) ? this.contents.hasIn(path) : false;\n }\n /**\n * Sets a value in this document. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n */\n set(key, value) {\n if (this.contents == null) {\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents = Collection.collectionFromPath(this.schema, [key], value);\n }\n else if (assertCollection(this.contents)) {\n this.contents.set(key, value);\n }\n }\n /**\n * Sets a value in this document. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n */\n setIn(path, value) {\n if (Collection.isEmptyPath(path)) {\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents = value;\n }\n else if (this.contents == null) {\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents = Collection.collectionFromPath(this.schema, Array.from(path), value);\n }\n else if (assertCollection(this.contents)) {\n this.contents.setIn(path, value);\n }\n }\n /**\n * Change the YAML version and schema used by the document.\n * A `null` version disables support for directives, explicit tags, anchors, and aliases.\n * It also requires the `schema` option to be given as a `Schema` instance value.\n *\n * Overrides all previously set schema options.\n */\n setSchema(version, options = {}) {\n if (typeof version === 'number')\n version = String(version);\n let opt;\n switch (version) {\n case '1.1':\n if (this.directives)\n this.directives.yaml.version = '1.1';\n else\n this.directives = new directives.Directives({ version: '1.1' });\n opt = { resolveKnownTags: false, schema: 'yaml-1.1' };\n break;\n case '1.2':\n case 'next':\n if (this.directives)\n this.directives.yaml.version = version;\n else\n this.directives = new directives.Directives({ version });\n opt = { resolveKnownTags: true, schema: 'core' };\n break;\n case null:\n if (this.directives)\n delete this.directives;\n opt = null;\n break;\n default: {\n const sv = JSON.stringify(version);\n throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${sv}`);\n }\n }\n // Not using `instanceof Schema` to allow for duck typing\n if (options.schema instanceof Object)\n this.schema = options.schema;\n else if (opt)\n this.schema = new Schema.Schema(Object.assign(opt, options));\n else\n throw new Error(`With a null YAML version, the { schema: Schema } option is required`);\n }\n // json & jsonArg are only used from toJSON()\n toJS({ json, jsonArg, mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {\n const ctx = {\n anchors: new Map(),\n doc: this,\n keep: !json,\n mapAsMap: mapAsMap === true,\n mapKeyWarned: false,\n maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100\n };\n const res = toJS.toJS(this.contents, jsonArg ?? '', ctx);\n if (typeof onAnchor === 'function')\n for (const { count, res } of ctx.anchors.values())\n onAnchor(res, count);\n return typeof reviver === 'function'\n ? applyReviver.applyReviver(reviver, { '': res }, '', res)\n : res;\n }\n /**\n * A JSON representation of the document `contents`.\n *\n * @param jsonArg Used by `JSON.stringify` to indicate the array index or\n * property name.\n */\n toJSON(jsonArg, onAnchor) {\n return this.toJS({ json: true, jsonArg, mapAsMap: false, onAnchor });\n }\n /** A YAML representation of the document. */\n toString(options = {}) {\n if (this.errors.length > 0)\n throw new Error('Document with errors cannot be stringified');\n if ('indent' in options &&\n (!Number.isInteger(options.indent) || Number(options.indent) <= 0)) {\n const s = JSON.stringify(options.indent);\n throw new Error(`\"indent\" option must be a positive integer, not ${s}`);\n }\n return stringifyDocument.stringifyDocument(this, options);\n }\n}\nfunction assertCollection(contents) {\n if (identity.isCollection(contents))\n return true;\n throw new Error('Expected a YAML collection as document contents');\n}\n\nexports.Document = Document;\n","'use strict';\n\nclass YAMLError extends Error {\n constructor(name, pos, code, message) {\n super();\n this.name = name;\n this.code = code;\n this.message = message;\n this.pos = pos;\n }\n}\nclass YAMLParseError extends YAMLError {\n constructor(pos, code, message) {\n super('YAMLParseError', pos, code, message);\n }\n}\nclass YAMLWarning extends YAMLError {\n constructor(pos, code, message) {\n super('YAMLWarning', pos, code, message);\n }\n}\nconst prettifyError = (src, lc) => (error) => {\n if (error.pos[0] === -1)\n return;\n error.linePos = error.pos.map(pos => lc.linePos(pos));\n const { line, col } = error.linePos[0];\n error.message += ` at line ${line}, column ${col}`;\n let ci = col - 1;\n let lineStr = src\n .substring(lc.lineStarts[line - 1], lc.lineStarts[line])\n .replace(/[\\n\\r]+$/, '');\n // Trim to max 80 chars, keeping col position near the middle\n if (ci >= 60 && lineStr.length > 80) {\n const trimStart = Math.min(ci - 39, lineStr.length - 79);\n lineStr = '…' + lineStr.substring(trimStart);\n ci -= trimStart - 1;\n }\n if (lineStr.length > 80)\n lineStr = lineStr.substring(0, 79) + '…';\n // Include previous line in context if pointing at line start\n if (line > 1 && /^ *$/.test(lineStr.substring(0, ci))) {\n // Regexp won't match if start is trimmed\n let prev = src.substring(lc.lineStarts[line - 2], lc.lineStarts[line - 1]);\n if (prev.length > 80)\n prev = prev.substring(0, 79) + '…\\n';\n lineStr = prev + lineStr;\n }\n if (/[^ ]/.test(lineStr)) {\n let count = 1;\n const end = error.linePos[1];\n if (end?.line === line && end.col > col) {\n count = Math.max(1, Math.min(end.col - col, 80 - ci));\n }\n const pointer = ' '.repeat(ci) + '^'.repeat(count);\n error.message += `:\\n\\n${lineStr}\\n${pointer}\\n`;\n }\n};\n\nexports.YAMLError = YAMLError;\nexports.YAMLParseError = YAMLParseError;\nexports.YAMLWarning = YAMLWarning;\nexports.prettifyError = prettifyError;\n","'use strict';\n\nfunction resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {\n let spaceBefore = false;\n let atNewline = startOnNewline;\n let hasSpace = startOnNewline;\n let comment = '';\n let commentSep = '';\n let hasNewline = false;\n let reqSpace = false;\n let tab = null;\n let anchor = null;\n let tag = null;\n let newlineAfterProp = null;\n let comma = null;\n let found = null;\n let start = null;\n for (const token of tokens) {\n if (reqSpace) {\n if (token.type !== 'space' &&\n token.type !== 'newline' &&\n token.type !== 'comma')\n onError(token.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');\n reqSpace = false;\n }\n if (tab) {\n if (atNewline && token.type !== 'comment' && token.type !== 'newline') {\n onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');\n }\n tab = null;\n }\n switch (token.type) {\n case 'space':\n // At the doc level, tabs at line start may be parsed\n // as leading white space rather than indentation.\n // In a flow collection, only the parser handles indent.\n if (!flow &&\n (indicator !== 'doc-start' || next?.type !== 'flow-collection') &&\n token.source.includes('\\t')) {\n tab = token;\n }\n hasSpace = true;\n break;\n case 'comment': {\n if (!hasSpace)\n onError(token, 'MISSING_CHAR', 'Comments must be separated from other tokens by white space characters');\n const cb = token.source.substring(1) || ' ';\n if (!comment)\n comment = cb;\n else\n comment += commentSep + cb;\n commentSep = '';\n atNewline = false;\n break;\n }\n case 'newline':\n if (atNewline) {\n if (comment)\n comment += token.source;\n else if (!found || indicator !== 'seq-item-ind')\n spaceBefore = true;\n }\n else\n commentSep += token.source;\n atNewline = true;\n hasNewline = true;\n if (anchor || tag)\n newlineAfterProp = token;\n hasSpace = true;\n break;\n case 'anchor':\n if (anchor)\n onError(token, 'MULTIPLE_ANCHORS', 'A node can have at most one anchor');\n if (token.source.endsWith(':'))\n onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);\n anchor = token;\n start ?? (start = token.offset);\n atNewline = false;\n hasSpace = false;\n reqSpace = true;\n break;\n case 'tag': {\n if (tag)\n onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');\n tag = token;\n start ?? (start = token.offset);\n atNewline = false;\n hasSpace = false;\n reqSpace = true;\n break;\n }\n case indicator:\n // Could here handle preceding comments differently\n if (anchor || tag)\n onError(token, 'BAD_PROP_ORDER', `Anchors and tags must be after the ${token.source} indicator`);\n if (found)\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.source} in ${flow ?? 'collection'}`);\n found = token;\n atNewline =\n indicator === 'seq-item-ind' || indicator === 'explicit-key-ind';\n hasSpace = false;\n break;\n case 'comma':\n if (flow) {\n if (comma)\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected , in ${flow}`);\n comma = token;\n atNewline = false;\n hasSpace = false;\n break;\n }\n // else fallthrough\n default:\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.type} token`);\n atNewline = false;\n hasSpace = false;\n }\n }\n const last = tokens[tokens.length - 1];\n const end = last ? last.offset + last.source.length : offset;\n if (reqSpace &&\n next &&\n next.type !== 'space' &&\n next.type !== 'newline' &&\n next.type !== 'comma' &&\n (next.type !== 'scalar' || next.source !== '')) {\n onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');\n }\n if (tab &&\n ((atNewline && tab.indent <= parentIndent) ||\n next?.type === 'block-map' ||\n next?.type === 'block-seq'))\n onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');\n return {\n comma,\n found,\n spaceBefore,\n comment,\n hasNewline,\n anchor,\n tag,\n newlineAfterProp,\n end,\n start: start ?? end\n };\n}\n\nexports.resolveProps = resolveProps;\n","'use strict';\n\nfunction containsNewline(key) {\n if (!key)\n return null;\n switch (key.type) {\n case 'alias':\n case 'scalar':\n case 'double-quoted-scalar':\n case 'single-quoted-scalar':\n if (key.source.includes('\\n'))\n return true;\n if (key.end)\n for (const st of key.end)\n if (st.type === 'newline')\n return true;\n return false;\n case 'flow-collection':\n for (const it of key.items) {\n for (const st of it.start)\n if (st.type === 'newline')\n return true;\n if (it.sep)\n for (const st of it.sep)\n if (st.type === 'newline')\n return true;\n if (containsNewline(it.key) || containsNewline(it.value))\n return true;\n }\n return false;\n default:\n return true;\n }\n}\n\nexports.containsNewline = containsNewline;\n","'use strict';\n\nvar utilContainsNewline = require('./util-contains-newline.js');\n\nfunction flowIndentCheck(indent, fc, onError) {\n if (fc?.type === 'flow-collection') {\n const end = fc.end[0];\n if (end.indent === indent &&\n (end.source === ']' || end.source === '}') &&\n utilContainsNewline.containsNewline(fc)) {\n const msg = 'Flow end indicator should be more indented than parent';\n onError(end, 'BAD_INDENT', msg, true);\n }\n }\n}\n\nexports.flowIndentCheck = flowIndentCheck;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\n\nfunction mapIncludes(ctx, items, search) {\n const { uniqueKeys } = ctx.options;\n if (uniqueKeys === false)\n return false;\n const isEqual = typeof uniqueKeys === 'function'\n ? uniqueKeys\n : (a, b) => a === b || (identity.isScalar(a) && identity.isScalar(b) && a.value === b.value);\n return items.some(pair => isEqual(pair.key, search));\n}\n\nexports.mapIncludes = mapIncludes;\n","'use strict';\n\nvar Pair = require('../nodes/Pair.js');\nvar YAMLMap = require('../nodes/YAMLMap.js');\nvar resolveProps = require('./resolve-props.js');\nvar utilContainsNewline = require('./util-contains-newline.js');\nvar utilFlowIndentCheck = require('./util-flow-indent-check.js');\nvar utilMapIncludes = require('./util-map-includes.js');\n\nconst startColMsg = 'All mapping items must start at the same column';\nfunction resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, tag) {\n const NodeClass = tag?.nodeClass ?? YAMLMap.YAMLMap;\n const map = new NodeClass(ctx.schema);\n if (ctx.atRoot)\n ctx.atRoot = false;\n let offset = bm.offset;\n let commentEnd = null;\n for (const collItem of bm.items) {\n const { start, key, sep, value } = collItem;\n // key properties\n const keyProps = resolveProps.resolveProps(start, {\n indicator: 'explicit-key-ind',\n next: key ?? sep?.[0],\n offset,\n onError,\n parentIndent: bm.indent,\n startOnNewline: true\n });\n const implicitKey = !keyProps.found;\n if (implicitKey) {\n if (key) {\n if (key.type === 'block-seq')\n onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'A block sequence may not be used as an implicit map key');\n else if ('indent' in key && key.indent !== bm.indent)\n onError(offset, 'BAD_INDENT', startColMsg);\n }\n if (!keyProps.anchor && !keyProps.tag && !sep) {\n commentEnd = keyProps.end;\n if (keyProps.comment) {\n if (map.comment)\n map.comment += '\\n' + keyProps.comment;\n else\n map.comment = keyProps.comment;\n }\n continue;\n }\n if (keyProps.newlineAfterProp || utilContainsNewline.containsNewline(key)) {\n onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line');\n }\n }\n else if (keyProps.found?.indent !== bm.indent) {\n onError(offset, 'BAD_INDENT', startColMsg);\n }\n // key value\n ctx.atKey = true;\n const keyStart = keyProps.end;\n const keyNode = key\n ? composeNode(ctx, key, keyProps, onError)\n : composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);\n if (ctx.schema.compat)\n utilFlowIndentCheck.flowIndentCheck(bm.indent, key, onError);\n ctx.atKey = false;\n if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))\n onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');\n // value properties\n const valueProps = resolveProps.resolveProps(sep ?? [], {\n indicator: 'map-value-ind',\n next: value,\n offset: keyNode.range[2],\n onError,\n parentIndent: bm.indent,\n startOnNewline: !key || key.type === 'block-scalar'\n });\n offset = valueProps.end;\n if (valueProps.found) {\n if (implicitKey) {\n if (value?.type === 'block-map' && !valueProps.hasNewline)\n onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'Nested mappings are not allowed in compact mappings');\n if (ctx.options.strict &&\n keyProps.start < valueProps.found.offset - 1024)\n onError(keyNode.range, 'KEY_OVER_1024_CHARS', 'The : indicator must be at most 1024 chars after the start of an implicit block mapping key');\n }\n // value value\n const valueNode = value\n ? composeNode(ctx, value, valueProps, onError)\n : composeEmptyNode(ctx, offset, sep, null, valueProps, onError);\n if (ctx.schema.compat)\n utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);\n offset = valueNode.range[2];\n const pair = new Pair.Pair(keyNode, valueNode);\n if (ctx.options.keepSourceTokens)\n pair.srcToken = collItem;\n map.items.push(pair);\n }\n else {\n // key with no value\n if (implicitKey)\n onError(keyNode.range, 'MISSING_CHAR', 'Implicit map keys need to be followed by map values');\n if (valueProps.comment) {\n if (keyNode.comment)\n keyNode.comment += '\\n' + valueProps.comment;\n else\n keyNode.comment = valueProps.comment;\n }\n const pair = new Pair.Pair(keyNode);\n if (ctx.options.keepSourceTokens)\n pair.srcToken = collItem;\n map.items.push(pair);\n }\n }\n if (commentEnd && commentEnd < offset)\n onError(commentEnd, 'IMPOSSIBLE', 'Map comment with trailing content');\n map.range = [bm.offset, offset, commentEnd ?? offset];\n return map;\n}\n\nexports.resolveBlockMap = resolveBlockMap;\n","'use strict';\n\nvar YAMLSeq = require('../nodes/YAMLSeq.js');\nvar resolveProps = require('./resolve-props.js');\nvar utilFlowIndentCheck = require('./util-flow-indent-check.js');\n\nfunction resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, tag) {\n const NodeClass = tag?.nodeClass ?? YAMLSeq.YAMLSeq;\n const seq = new NodeClass(ctx.schema);\n if (ctx.atRoot)\n ctx.atRoot = false;\n if (ctx.atKey)\n ctx.atKey = false;\n let offset = bs.offset;\n let commentEnd = null;\n for (const { start, value } of bs.items) {\n const props = resolveProps.resolveProps(start, {\n indicator: 'seq-item-ind',\n next: value,\n offset,\n onError,\n parentIndent: bs.indent,\n startOnNewline: true\n });\n if (!props.found) {\n if (props.anchor || props.tag || value) {\n if (value?.type === 'block-seq')\n onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column');\n else\n onError(offset, 'MISSING_CHAR', 'Sequence item without - indicator');\n }\n else {\n commentEnd = props.end;\n if (props.comment)\n seq.comment = props.comment;\n continue;\n }\n }\n const node = value\n ? composeNode(ctx, value, props, onError)\n : composeEmptyNode(ctx, props.end, start, null, props, onError);\n if (ctx.schema.compat)\n utilFlowIndentCheck.flowIndentCheck(bs.indent, value, onError);\n offset = node.range[2];\n seq.items.push(node);\n }\n seq.range = [bs.offset, offset, commentEnd ?? offset];\n return seq;\n}\n\nexports.resolveBlockSeq = resolveBlockSeq;\n","'use strict';\n\nfunction resolveEnd(end, offset, reqSpace, onError) {\n let comment = '';\n if (end) {\n let hasSpace = false;\n let sep = '';\n for (const token of end) {\n const { source, type } = token;\n switch (type) {\n case 'space':\n hasSpace = true;\n break;\n case 'comment': {\n if (reqSpace && !hasSpace)\n onError(token, 'MISSING_CHAR', 'Comments must be separated from other tokens by white space characters');\n const cb = source.substring(1) || ' ';\n if (!comment)\n comment = cb;\n else\n comment += sep + cb;\n sep = '';\n break;\n }\n case 'newline':\n if (comment)\n sep += source;\n hasSpace = true;\n break;\n default:\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${type} at node end`);\n }\n offset += source.length;\n }\n }\n return { comment, offset };\n}\n\nexports.resolveEnd = resolveEnd;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Pair = require('../nodes/Pair.js');\nvar YAMLMap = require('../nodes/YAMLMap.js');\nvar YAMLSeq = require('../nodes/YAMLSeq.js');\nvar resolveEnd = require('./resolve-end.js');\nvar resolveProps = require('./resolve-props.js');\nvar utilContainsNewline = require('./util-contains-newline.js');\nvar utilMapIncludes = require('./util-map-includes.js');\n\nconst blockMsg = 'Block collections are not allowed within flow collections';\nconst isBlock = (token) => token && (token.type === 'block-map' || token.type === 'block-seq');\nfunction resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) {\n const isMap = fc.start.source === '{';\n const fcName = isMap ? 'flow map' : 'flow sequence';\n const NodeClass = (tag?.nodeClass ?? (isMap ? YAMLMap.YAMLMap : YAMLSeq.YAMLSeq));\n const coll = new NodeClass(ctx.schema);\n coll.flow = true;\n const atRoot = ctx.atRoot;\n if (atRoot)\n ctx.atRoot = false;\n if (ctx.atKey)\n ctx.atKey = false;\n let offset = fc.offset + fc.start.source.length;\n for (let i = 0; i < fc.items.length; ++i) {\n const collItem = fc.items[i];\n const { start, key, sep, value } = collItem;\n const props = resolveProps.resolveProps(start, {\n flow: fcName,\n indicator: 'explicit-key-ind',\n next: key ?? sep?.[0],\n offset,\n onError,\n parentIndent: fc.indent,\n startOnNewline: false\n });\n if (!props.found) {\n if (!props.anchor && !props.tag && !sep && !value) {\n if (i === 0 && props.comma)\n onError(props.comma, 'UNEXPECTED_TOKEN', `Unexpected , in ${fcName}`);\n else if (i < fc.items.length - 1)\n onError(props.start, 'UNEXPECTED_TOKEN', `Unexpected empty item in ${fcName}`);\n if (props.comment) {\n if (coll.comment)\n coll.comment += '\\n' + props.comment;\n else\n coll.comment = props.comment;\n }\n offset = props.end;\n continue;\n }\n if (!isMap && ctx.options.strict && utilContainsNewline.containsNewline(key))\n onError(key, // checked by containsNewline()\n 'MULTILINE_IMPLICIT_KEY', 'Implicit keys of flow sequence pairs need to be on a single line');\n }\n if (i === 0) {\n if (props.comma)\n onError(props.comma, 'UNEXPECTED_TOKEN', `Unexpected , in ${fcName}`);\n }\n else {\n if (!props.comma)\n onError(props.start, 'MISSING_CHAR', `Missing , between ${fcName} items`);\n if (props.comment) {\n let prevItemComment = '';\n loop: for (const st of start) {\n switch (st.type) {\n case 'comma':\n case 'space':\n break;\n case 'comment':\n prevItemComment = st.source.substring(1);\n break loop;\n default:\n break loop;\n }\n }\n if (prevItemComment) {\n let prev = coll.items[coll.items.length - 1];\n if (identity.isPair(prev))\n prev = prev.value ?? prev.key;\n if (prev.comment)\n prev.comment += '\\n' + prevItemComment;\n else\n prev.comment = prevItemComment;\n props.comment = props.comment.substring(prevItemComment.length + 1);\n }\n }\n }\n if (!isMap && !sep && !props.found) {\n // item is a value in a seq\n // → key & sep are empty, start does not include ? or :\n const valueNode = value\n ? composeNode(ctx, value, props, onError)\n : composeEmptyNode(ctx, props.end, sep, null, props, onError);\n coll.items.push(valueNode);\n offset = valueNode.range[2];\n if (isBlock(value))\n onError(valueNode.range, 'BLOCK_IN_FLOW', blockMsg);\n }\n else {\n // item is a key+value pair\n // key value\n ctx.atKey = true;\n const keyStart = props.end;\n const keyNode = key\n ? composeNode(ctx, key, props, onError)\n : composeEmptyNode(ctx, keyStart, start, null, props, onError);\n if (isBlock(key))\n onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);\n ctx.atKey = false;\n // value properties\n const valueProps = resolveProps.resolveProps(sep ?? [], {\n flow: fcName,\n indicator: 'map-value-ind',\n next: value,\n offset: keyNode.range[2],\n onError,\n parentIndent: fc.indent,\n startOnNewline: false\n });\n if (valueProps.found) {\n if (!isMap && !props.found && ctx.options.strict) {\n if (sep)\n for (const st of sep) {\n if (st === valueProps.found)\n break;\n if (st.type === 'newline') {\n onError(st, 'MULTILINE_IMPLICIT_KEY', 'Implicit keys of flow sequence pairs need to be on a single line');\n break;\n }\n }\n if (props.start < valueProps.found.offset - 1024)\n onError(valueProps.found, 'KEY_OVER_1024_CHARS', 'The : indicator must be at most 1024 chars after the start of an implicit flow sequence key');\n }\n }\n else if (value) {\n if ('source' in value && value.source?.[0] === ':')\n onError(value, 'MISSING_CHAR', `Missing space after : in ${fcName}`);\n else\n onError(valueProps.start, 'MISSING_CHAR', `Missing , or : between ${fcName} items`);\n }\n // value value\n const valueNode = value\n ? composeNode(ctx, value, valueProps, onError)\n : valueProps.found\n ? composeEmptyNode(ctx, valueProps.end, sep, null, valueProps, onError)\n : null;\n if (valueNode) {\n if (isBlock(value))\n onError(valueNode.range, 'BLOCK_IN_FLOW', blockMsg);\n }\n else if (valueProps.comment) {\n if (keyNode.comment)\n keyNode.comment += '\\n' + valueProps.comment;\n else\n keyNode.comment = valueProps.comment;\n }\n const pair = new Pair.Pair(keyNode, valueNode);\n if (ctx.options.keepSourceTokens)\n pair.srcToken = collItem;\n if (isMap) {\n const map = coll;\n if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))\n onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');\n map.items.push(pair);\n }\n else {\n const map = new YAMLMap.YAMLMap(ctx.schema);\n map.flow = true;\n map.items.push(pair);\n const endRange = (valueNode ?? keyNode).range;\n map.range = [keyNode.range[0], endRange[1], endRange[2]];\n coll.items.push(map);\n }\n offset = valueNode ? valueNode.range[2] : valueProps.end;\n }\n }\n const expectedEnd = isMap ? '}' : ']';\n const [ce, ...ee] = fc.end;\n let cePos = offset;\n if (ce?.source === expectedEnd)\n cePos = ce.offset + ce.source.length;\n else {\n const name = fcName[0].toUpperCase() + fcName.substring(1);\n const msg = atRoot\n ? `${name} must end with a ${expectedEnd}`\n : `${name} in block collection must be sufficiently indented and end with a ${expectedEnd}`;\n onError(offset, atRoot ? 'MISSING_CHAR' : 'BAD_INDENT', msg);\n if (ce && ce.source.length !== 1)\n ee.unshift(ce);\n }\n if (ee.length > 0) {\n const end = resolveEnd.resolveEnd(ee, cePos, ctx.options.strict, onError);\n if (end.comment) {\n if (coll.comment)\n coll.comment += '\\n' + end.comment;\n else\n coll.comment = end.comment;\n }\n coll.range = [fc.offset, cePos, end.offset];\n }\n else {\n coll.range = [fc.offset, cePos, cePos];\n }\n return coll;\n}\n\nexports.resolveFlowCollection = resolveFlowCollection;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\nvar YAMLMap = require('../nodes/YAMLMap.js');\nvar YAMLSeq = require('../nodes/YAMLSeq.js');\nvar resolveBlockMap = require('./resolve-block-map.js');\nvar resolveBlockSeq = require('./resolve-block-seq.js');\nvar resolveFlowCollection = require('./resolve-flow-collection.js');\n\nfunction resolveCollection(CN, ctx, token, onError, tagName, tag) {\n const coll = token.type === 'block-map'\n ? resolveBlockMap.resolveBlockMap(CN, ctx, token, onError, tag)\n : token.type === 'block-seq'\n ? resolveBlockSeq.resolveBlockSeq(CN, ctx, token, onError, tag)\n : resolveFlowCollection.resolveFlowCollection(CN, ctx, token, onError, tag);\n const Coll = coll.constructor;\n // If we got a tagName matching the class, or the tag name is '!',\n // then use the tagName from the node class used to create it.\n if (tagName === '!' || tagName === Coll.tagName) {\n coll.tag = Coll.tagName;\n return coll;\n }\n if (tagName)\n coll.tag = tagName;\n return coll;\n}\nfunction composeCollection(CN, ctx, token, props, onError) {\n const tagToken = props.tag;\n const tagName = !tagToken\n ? null\n : ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));\n if (token.type === 'block-seq') {\n const { anchor, newlineAfterProp: nl } = props;\n const lastProp = anchor && tagToken\n ? anchor.offset > tagToken.offset\n ? anchor\n : tagToken\n : (anchor ?? tagToken);\n if (lastProp && (!nl || nl.offset < lastProp.offset)) {\n const message = 'Missing newline after block sequence props';\n onError(lastProp, 'MISSING_CHAR', message);\n }\n }\n const expType = token.type === 'block-map'\n ? 'map'\n : token.type === 'block-seq'\n ? 'seq'\n : token.start.source === '{'\n ? 'map'\n : 'seq';\n // shortcut: check if it's a generic YAMLMap or YAMLSeq\n // before jumping into the custom tag logic.\n if (!tagToken ||\n !tagName ||\n tagName === '!' ||\n (tagName === YAMLMap.YAMLMap.tagName && expType === 'map') ||\n (tagName === YAMLSeq.YAMLSeq.tagName && expType === 'seq')) {\n return resolveCollection(CN, ctx, token, onError, tagName);\n }\n let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);\n if (!tag) {\n const kt = ctx.schema.knownTags[tagName];\n if (kt?.collection === expType) {\n ctx.schema.tags.push(Object.assign({}, kt, { default: false }));\n tag = kt;\n }\n else {\n if (kt) {\n onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);\n }\n else {\n onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);\n }\n return resolveCollection(CN, ctx, token, onError, tagName);\n }\n }\n const coll = resolveCollection(CN, ctx, token, onError, tagName, tag);\n const res = tag.resolve?.(coll, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg), ctx.options) ?? coll;\n const node = identity.isNode(res)\n ? res\n : new Scalar.Scalar(res);\n node.range = coll.range;\n node.tag = tagName;\n if (tag?.format)\n node.format = tag.format;\n return node;\n}\n\nexports.composeCollection = composeCollection;\n","'use strict';\n\nvar Scalar = require('../nodes/Scalar.js');\n\nfunction resolveBlockScalar(ctx, scalar, onError) {\n const start = scalar.offset;\n const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError);\n if (!header)\n return { value: '', type: null, comment: '', range: [start, start, start] };\n const type = header.mode === '>' ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL;\n const lines = scalar.source ? splitLines(scalar.source) : [];\n // determine the end of content & start of chomping\n let chompStart = lines.length;\n for (let i = lines.length - 1; i >= 0; --i) {\n const content = lines[i][1];\n if (content === '' || content === '\\r')\n chompStart = i;\n else\n break;\n }\n // shortcut for empty contents\n if (chompStart === 0) {\n const value = header.chomp === '+' && lines.length > 0\n ? '\\n'.repeat(Math.max(1, lines.length - 1))\n : '';\n let end = start + header.length;\n if (scalar.source)\n end += scalar.source.length;\n return { value, type, comment: header.comment, range: [start, end, end] };\n }\n // find the indentation level to trim from start\n let trimIndent = scalar.indent + header.indent;\n let offset = scalar.offset + header.length;\n let contentStart = 0;\n for (let i = 0; i < chompStart; ++i) {\n const [indent, content] = lines[i];\n if (content === '' || content === '\\r') {\n if (header.indent === 0 && indent.length > trimIndent)\n trimIndent = indent.length;\n }\n else {\n if (indent.length < trimIndent) {\n const message = 'Block scalars with more-indented leading empty lines must use an explicit indentation indicator';\n onError(offset + indent.length, 'MISSING_CHAR', message);\n }\n if (header.indent === 0)\n trimIndent = indent.length;\n contentStart = i;\n if (trimIndent === 0 && !ctx.atRoot) {\n const message = 'Block scalar values in collections must be indented';\n onError(offset, 'BAD_INDENT', message);\n }\n break;\n }\n offset += indent.length + content.length + 1;\n }\n // include trailing more-indented empty lines in content\n for (let i = lines.length - 1; i >= chompStart; --i) {\n if (lines[i][0].length > trimIndent)\n chompStart = i + 1;\n }\n let value = '';\n let sep = '';\n let prevMoreIndented = false;\n // leading whitespace is kept intact\n for (let i = 0; i < contentStart; ++i)\n value += lines[i][0].slice(trimIndent) + '\\n';\n for (let i = contentStart; i < chompStart; ++i) {\n let [indent, content] = lines[i];\n offset += indent.length + content.length + 1;\n const crlf = content[content.length - 1] === '\\r';\n if (crlf)\n content = content.slice(0, -1);\n /* istanbul ignore if already caught in lexer */\n if (content && indent.length < trimIndent) {\n const src = header.indent\n ? 'explicit indentation indicator'\n : 'first line';\n const message = `Block scalar lines must not be less indented than their ${src}`;\n onError(offset - content.length - (crlf ? 2 : 1), 'BAD_INDENT', message);\n indent = '';\n }\n if (type === Scalar.Scalar.BLOCK_LITERAL) {\n value += sep + indent.slice(trimIndent) + content;\n sep = '\\n';\n }\n else if (indent.length > trimIndent || content[0] === '\\t') {\n // more-indented content within a folded block\n if (sep === ' ')\n sep = '\\n';\n else if (!prevMoreIndented && sep === '\\n')\n sep = '\\n\\n';\n value += sep + indent.slice(trimIndent) + content;\n sep = '\\n';\n prevMoreIndented = true;\n }\n else if (content === '') {\n // empty line\n if (sep === '\\n')\n value += '\\n';\n else\n sep = '\\n';\n }\n else {\n value += sep + content;\n sep = ' ';\n prevMoreIndented = false;\n }\n }\n switch (header.chomp) {\n case '-':\n break;\n case '+':\n for (let i = chompStart; i < lines.length; ++i)\n value += '\\n' + lines[i][0].slice(trimIndent);\n if (value[value.length - 1] !== '\\n')\n value += '\\n';\n break;\n default:\n value += '\\n';\n }\n const end = start + header.length + scalar.source.length;\n return { value, type, comment: header.comment, range: [start, end, end] };\n}\nfunction parseBlockScalarHeader({ offset, props }, strict, onError) {\n /* istanbul ignore if should not happen */\n if (props[0].type !== 'block-scalar-header') {\n onError(props[0], 'IMPOSSIBLE', 'Block scalar header not found');\n return null;\n }\n const { source } = props[0];\n const mode = source[0];\n let indent = 0;\n let chomp = '';\n let error = -1;\n for (let i = 1; i < source.length; ++i) {\n const ch = source[i];\n if (!chomp && (ch === '-' || ch === '+'))\n chomp = ch;\n else {\n const n = Number(ch);\n if (!indent && n)\n indent = n;\n else if (error === -1)\n error = offset + i;\n }\n }\n if (error !== -1)\n onError(error, 'UNEXPECTED_TOKEN', `Block scalar header includes extra characters: ${source}`);\n let hasSpace = false;\n let comment = '';\n let length = source.length;\n for (let i = 1; i < props.length; ++i) {\n const token = props[i];\n switch (token.type) {\n case 'space':\n hasSpace = true;\n // fallthrough\n case 'newline':\n length += token.source.length;\n break;\n case 'comment':\n if (strict && !hasSpace) {\n const message = 'Comments must be separated from other tokens by white space characters';\n onError(token, 'MISSING_CHAR', message);\n }\n length += token.source.length;\n comment = token.source.substring(1);\n break;\n case 'error':\n onError(token, 'UNEXPECTED_TOKEN', token.message);\n length += token.source.length;\n break;\n /* istanbul ignore next should not happen */\n default: {\n const message = `Unexpected token in block scalar header: ${token.type}`;\n onError(token, 'UNEXPECTED_TOKEN', message);\n const ts = token.source;\n if (ts && typeof ts === 'string')\n length += ts.length;\n }\n }\n }\n return { mode, indent, chomp, comment, length };\n}\n/** @returns Array of lines split up as `[indent, content]` */\nfunction splitLines(source) {\n const split = source.split(/\\n( *)/);\n const first = split[0];\n const m = first.match(/^( *)/);\n const line0 = m?.[1]\n ? [m[1], first.slice(m[1].length)]\n : ['', first];\n const lines = [line0];\n for (let i = 1; i < split.length; i += 2)\n lines.push([split[i], split[i + 1]]);\n return lines;\n}\n\nexports.resolveBlockScalar = resolveBlockScalar;\n","'use strict';\n\nvar Scalar = require('../nodes/Scalar.js');\nvar resolveEnd = require('./resolve-end.js');\n\nfunction resolveFlowScalar(scalar, strict, onError) {\n const { offset, type, source, end } = scalar;\n let _type;\n let value;\n const _onError = (rel, code, msg) => onError(offset + rel, code, msg);\n switch (type) {\n case 'scalar':\n _type = Scalar.Scalar.PLAIN;\n value = plainValue(source, _onError);\n break;\n case 'single-quoted-scalar':\n _type = Scalar.Scalar.QUOTE_SINGLE;\n value = singleQuotedValue(source, _onError);\n break;\n case 'double-quoted-scalar':\n _type = Scalar.Scalar.QUOTE_DOUBLE;\n value = doubleQuotedValue(source, _onError);\n break;\n /* istanbul ignore next should not happen */\n default:\n onError(scalar, 'UNEXPECTED_TOKEN', `Expected a flow scalar value, but found: ${type}`);\n return {\n value: '',\n type: null,\n comment: '',\n range: [offset, offset + source.length, offset + source.length]\n };\n }\n const valueEnd = offset + source.length;\n const re = resolveEnd.resolveEnd(end, valueEnd, strict, onError);\n return {\n value,\n type: _type,\n comment: re.comment,\n range: [offset, valueEnd, re.offset]\n };\n}\nfunction plainValue(source, onError) {\n let badChar = '';\n switch (source[0]) {\n /* istanbul ignore next should not happen */\n case '\\t':\n badChar = 'a tab character';\n break;\n case ',':\n badChar = 'flow indicator character ,';\n break;\n case '%':\n badChar = 'directive indicator character %';\n break;\n case '|':\n case '>': {\n badChar = `block scalar indicator ${source[0]}`;\n break;\n }\n case '@':\n case '`': {\n badChar = `reserved character ${source[0]}`;\n break;\n }\n }\n if (badChar)\n onError(0, 'BAD_SCALAR_START', `Plain value cannot start with ${badChar}`);\n return foldLines(source);\n}\nfunction singleQuotedValue(source, onError) {\n if (source[source.length - 1] !== \"'\" || source.length === 1)\n onError(source.length, 'MISSING_CHAR', \"Missing closing 'quote\");\n return foldLines(source.slice(1, -1)).replace(/''/g, \"'\");\n}\nfunction foldLines(source) {\n /**\n * The negative lookbehind here and in the `re` RegExp is to\n * prevent causing a polynomial search time in certain cases.\n *\n * The try-catch is for Safari, which doesn't support this yet:\n * https://caniuse.com/js-regexp-lookbehind\n */\n let first, line;\n try {\n first = new RegExp('(.*?)(?<![ \\t])[ \\t]*\\r?\\n', 'sy');\n line = new RegExp('[ \\t]*(.*?)(?:(?<![ \\t])[ \\t]*)?\\r?\\n', 'sy');\n }\n catch {\n first = /(.*?)[ \\t]*\\r?\\n/sy;\n line = /[ \\t]*(.*?)[ \\t]*\\r?\\n/sy;\n }\n let match = first.exec(source);\n if (!match)\n return source;\n let res = match[1];\n let sep = ' ';\n let pos = first.lastIndex;\n line.lastIndex = pos;\n while ((match = line.exec(source))) {\n if (match[1] === '') {\n if (sep === '\\n')\n res += sep;\n else\n sep = '\\n';\n }\n else {\n res += sep + match[1];\n sep = ' ';\n }\n pos = line.lastIndex;\n }\n const last = /[ \\t]*(.*)/sy;\n last.lastIndex = pos;\n match = last.exec(source);\n return res + sep + (match?.[1] ?? '');\n}\nfunction doubleQuotedValue(source, onError) {\n let res = '';\n for (let i = 1; i < source.length - 1; ++i) {\n const ch = source[i];\n if (ch === '\\r' && source[i + 1] === '\\n')\n continue;\n if (ch === '\\n') {\n const { fold, offset } = foldNewline(source, i);\n res += fold;\n i = offset;\n }\n else if (ch === '\\\\') {\n let next = source[++i];\n const cc = escapeCodes[next];\n if (cc)\n res += cc;\n else if (next === '\\n') {\n // skip escaped newlines, but still trim the following line\n next = source[i + 1];\n while (next === ' ' || next === '\\t')\n next = source[++i + 1];\n }\n else if (next === '\\r' && source[i + 1] === '\\n') {\n // skip escaped CRLF newlines, but still trim the following line\n next = source[++i + 1];\n while (next === ' ' || next === '\\t')\n next = source[++i + 1];\n }\n else if (next === 'x' || next === 'u' || next === 'U') {\n const length = next === 'x' ? 2 : next === 'u' ? 4 : 8;\n res += parseCharCode(source, i + 1, length, onError);\n i += length;\n }\n else {\n const raw = source.substr(i - 1, 2);\n onError(i - 1, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);\n res += raw;\n }\n }\n else if (ch === ' ' || ch === '\\t') {\n // trim trailing whitespace\n const wsStart = i;\n let next = source[i + 1];\n while (next === ' ' || next === '\\t')\n next = source[++i + 1];\n if (next !== '\\n' && !(next === '\\r' && source[i + 2] === '\\n'))\n res += i > wsStart ? source.slice(wsStart, i + 1) : ch;\n }\n else {\n res += ch;\n }\n }\n if (source[source.length - 1] !== '\"' || source.length === 1)\n onError(source.length, 'MISSING_CHAR', 'Missing closing \"quote');\n return res;\n}\n/**\n * Fold a single newline into a space, multiple newlines to N - 1 newlines.\n * Presumes `source[offset] === '\\n'`\n */\nfunction foldNewline(source, offset) {\n let fold = '';\n let ch = source[offset + 1];\n while (ch === ' ' || ch === '\\t' || ch === '\\n' || ch === '\\r') {\n if (ch === '\\r' && source[offset + 2] !== '\\n')\n break;\n if (ch === '\\n')\n fold += '\\n';\n offset += 1;\n ch = source[offset + 1];\n }\n if (!fold)\n fold = ' ';\n return { fold, offset };\n}\nconst escapeCodes = {\n '0': '\\0', // null character\n a: '\\x07', // bell character\n b: '\\b', // backspace\n e: '\\x1b', // escape character\n f: '\\f', // form feed\n n: '\\n', // line feed\n r: '\\r', // carriage return\n t: '\\t', // horizontal tab\n v: '\\v', // vertical tab\n N: '\\u0085', // Unicode next line\n _: '\\u00a0', // Unicode non-breaking space\n L: '\\u2028', // Unicode line separator\n P: '\\u2029', // Unicode paragraph separator\n ' ': ' ',\n '\"': '\"',\n '/': '/',\n '\\\\': '\\\\',\n '\\t': '\\t'\n};\nfunction parseCharCode(source, offset, length, onError) {\n const cc = source.substr(offset, length);\n const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);\n const code = ok ? parseInt(cc, 16) : NaN;\n try {\n return String.fromCodePoint(code);\n }\n catch {\n const raw = source.substr(offset - 2, length + 2);\n onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);\n return raw;\n }\n}\n\nexports.resolveFlowScalar = resolveFlowScalar;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\nvar resolveBlockScalar = require('./resolve-block-scalar.js');\nvar resolveFlowScalar = require('./resolve-flow-scalar.js');\n\nfunction composeScalar(ctx, token, tagToken, onError) {\n const { value, type, comment, range } = token.type === 'block-scalar'\n ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError)\n : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);\n const tagName = tagToken\n ? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))\n : null;\n let tag;\n if (ctx.options.stringKeys && ctx.atKey) {\n tag = ctx.schema[identity.SCALAR];\n }\n else if (tagName)\n tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);\n else if (token.type === 'scalar')\n tag = findScalarTagByTest(ctx, value, token, onError);\n else\n tag = ctx.schema[identity.SCALAR];\n let scalar;\n try {\n const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);\n scalar = identity.isScalar(res) ? res : new Scalar.Scalar(res);\n }\n catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg);\n scalar = new Scalar.Scalar(value);\n }\n scalar.range = range;\n scalar.source = value;\n if (type)\n scalar.type = type;\n if (tagName)\n scalar.tag = tagName;\n if (tag.format)\n scalar.format = tag.format;\n if (comment)\n scalar.comment = comment;\n return scalar;\n}\nfunction findScalarTagByName(schema, value, tagName, tagToken, onError) {\n if (tagName === '!')\n return schema[identity.SCALAR]; // non-specific tag\n const matchWithTest = [];\n for (const tag of schema.tags) {\n if (!tag.collection && tag.tag === tagName) {\n if (tag.default && tag.test)\n matchWithTest.push(tag);\n else\n return tag;\n }\n }\n for (const tag of matchWithTest)\n if (tag.test?.test(value))\n return tag;\n const kt = schema.knownTags[tagName];\n if (kt && !kt.collection) {\n // Ensure that the known tag is available for stringifying,\n // but does not get used by default.\n schema.tags.push(Object.assign({}, kt, { default: false, test: undefined }));\n return kt;\n }\n onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');\n return schema[identity.SCALAR];\n}\nfunction findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {\n const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&\n tag.test?.test(value)) || schema[identity.SCALAR];\n if (schema.compat) {\n const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??\n schema[identity.SCALAR];\n if (tag.tag !== compat.tag) {\n const ts = directives.tagString(tag.tag);\n const cs = directives.tagString(compat.tag);\n const msg = `Value may be parsed as either ${ts} or ${cs}`;\n onError(token, 'TAG_RESOLVE_FAILED', msg, true);\n }\n }\n return tag;\n}\n\nexports.composeScalar = composeScalar;\n","'use strict';\n\nfunction emptyScalarPosition(offset, before, pos) {\n if (before) {\n pos ?? (pos = before.length);\n for (let i = pos - 1; i >= 0; --i) {\n let st = before[i];\n switch (st.type) {\n case 'space':\n case 'comment':\n case 'newline':\n offset -= st.source.length;\n continue;\n }\n // Technically, an empty scalar is immediately after the last non-empty\n // node, but it's more useful to place it after any whitespace.\n st = before[++i];\n while (st?.type === 'space') {\n offset += st.source.length;\n st = before[++i];\n }\n break;\n }\n }\n return offset;\n}\n\nexports.emptyScalarPosition = emptyScalarPosition;\n","'use strict';\n\nvar Alias = require('../nodes/Alias.js');\nvar identity = require('../nodes/identity.js');\nvar composeCollection = require('./compose-collection.js');\nvar composeScalar = require('./compose-scalar.js');\nvar resolveEnd = require('./resolve-end.js');\nvar utilEmptyScalarPosition = require('./util-empty-scalar-position.js');\n\nconst CN = { composeNode, composeEmptyNode };\nfunction composeNode(ctx, token, props, onError) {\n const atKey = ctx.atKey;\n const { spaceBefore, comment, anchor, tag } = props;\n let node;\n let isSrcToken = true;\n switch (token.type) {\n case 'alias':\n node = composeAlias(ctx, token, onError);\n if (anchor || tag)\n onError(token, 'ALIAS_PROPS', 'An alias node must not specify any properties');\n break;\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n case 'block-scalar':\n node = composeScalar.composeScalar(ctx, token, tag, onError);\n if (anchor)\n node.anchor = anchor.source.substring(1);\n break;\n case 'block-map':\n case 'block-seq':\n case 'flow-collection':\n try {\n node = composeCollection.composeCollection(CN, ctx, token, props, onError);\n if (anchor)\n node.anchor = anchor.source.substring(1);\n }\n catch (error) {\n // Almost certainly here due to a stack overflow\n const message = error instanceof Error ? error.message : String(error);\n onError(token, 'RESOURCE_EXHAUSTION', message);\n }\n break;\n default: {\n const message = token.type === 'error'\n ? token.message\n : `Unsupported token (type: ${token.type})`;\n onError(token, 'UNEXPECTED_TOKEN', message);\n isSrcToken = false;\n }\n }\n node ?? (node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError));\n if (anchor && node.anchor === '')\n onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');\n if (atKey &&\n ctx.options.stringKeys &&\n (!identity.isScalar(node) ||\n typeof node.value !== 'string' ||\n (node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {\n const msg = 'With stringKeys, all keys must be strings';\n onError(tag ?? token, 'NON_STRING_KEY', msg);\n }\n if (spaceBefore)\n node.spaceBefore = true;\n if (comment) {\n if (token.type === 'scalar' && token.source === '')\n node.comment = comment;\n else\n node.commentBefore = comment;\n }\n // @ts-expect-error Type checking misses meaning of isSrcToken\n if (ctx.options.keepSourceTokens && isSrcToken)\n node.srcToken = token;\n return node;\n}\nfunction composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag, end }, onError) {\n const token = {\n type: 'scalar',\n offset: utilEmptyScalarPosition.emptyScalarPosition(offset, before, pos),\n indent: -1,\n source: ''\n };\n const node = composeScalar.composeScalar(ctx, token, tag, onError);\n if (anchor) {\n node.anchor = anchor.source.substring(1);\n if (node.anchor === '')\n onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');\n }\n if (spaceBefore)\n node.spaceBefore = true;\n if (comment) {\n node.comment = comment;\n node.range[2] = end;\n }\n return node;\n}\nfunction composeAlias({ options }, { offset, source, end }, onError) {\n const alias = new Alias.Alias(source.substring(1));\n if (alias.source === '')\n onError(offset, 'BAD_ALIAS', 'Alias cannot be an empty string');\n if (alias.source.endsWith(':'))\n onError(offset + source.length - 1, 'BAD_ALIAS', 'Alias ending in : is ambiguous', true);\n const valueEnd = offset + source.length;\n const re = resolveEnd.resolveEnd(end, valueEnd, options.strict, onError);\n alias.range = [offset, valueEnd, re.offset];\n if (re.comment)\n alias.comment = re.comment;\n return alias;\n}\n\nexports.composeEmptyNode = composeEmptyNode;\nexports.composeNode = composeNode;\n","'use strict';\n\nvar Document = require('../doc/Document.js');\nvar composeNode = require('./compose-node.js');\nvar resolveEnd = require('./resolve-end.js');\nvar resolveProps = require('./resolve-props.js');\n\nfunction composeDoc(options, directives, { offset, start, value, end }, onError) {\n const opts = Object.assign({ _directives: directives }, options);\n const doc = new Document.Document(undefined, opts);\n const ctx = {\n atKey: false,\n atRoot: true,\n directives: doc.directives,\n options: doc.options,\n schema: doc.schema\n };\n const props = resolveProps.resolveProps(start, {\n indicator: 'doc-start',\n next: value ?? end?.[0],\n offset,\n onError,\n parentIndent: 0,\n startOnNewline: true\n });\n if (props.found) {\n doc.directives.docStart = true;\n if (value &&\n (value.type === 'block-map' || value.type === 'block-seq') &&\n !props.hasNewline)\n onError(props.end, 'MISSING_CHAR', 'Block collection cannot start on same line with directives-end marker');\n }\n // @ts-expect-error If Contents is set, let's trust the user\n doc.contents = value\n ? composeNode.composeNode(ctx, value, props, onError)\n : composeNode.composeEmptyNode(ctx, props.end, start, null, props, onError);\n const contentEnd = doc.contents.range[2];\n const re = resolveEnd.resolveEnd(end, contentEnd, false, onError);\n if (re.comment)\n doc.comment = re.comment;\n doc.range = [offset, contentEnd, re.offset];\n return doc;\n}\n\nexports.composeDoc = composeDoc;\n","'use strict';\n\nvar node_process = require('process');\nvar directives = require('../doc/directives.js');\nvar Document = require('../doc/Document.js');\nvar errors = require('../errors.js');\nvar identity = require('../nodes/identity.js');\nvar composeDoc = require('./compose-doc.js');\nvar resolveEnd = require('./resolve-end.js');\n\nfunction getErrorPos(src) {\n if (typeof src === 'number')\n return [src, src + 1];\n if (Array.isArray(src))\n return src.length === 2 ? src : [src[0], src[1]];\n const { offset, source } = src;\n return [offset, offset + (typeof source === 'string' ? source.length : 1)];\n}\nfunction parsePrelude(prelude) {\n let comment = '';\n let atComment = false;\n let afterEmptyLine = false;\n for (let i = 0; i < prelude.length; ++i) {\n const source = prelude[i];\n switch (source[0]) {\n case '#':\n comment +=\n (comment === '' ? '' : afterEmptyLine ? '\\n\\n' : '\\n') +\n (source.substring(1) || ' ');\n atComment = true;\n afterEmptyLine = false;\n break;\n case '%':\n if (prelude[i + 1]?.[0] !== '#')\n i += 1;\n atComment = false;\n break;\n default:\n // This may be wrong after doc-end, but in that case it doesn't matter\n if (!atComment)\n afterEmptyLine = true;\n atComment = false;\n }\n }\n return { comment, afterEmptyLine };\n}\n/**\n * Compose a stream of CST nodes into a stream of YAML Documents.\n *\n * ```ts\n * import { Composer, Parser } from 'yaml'\n *\n * const src: string = ...\n * const tokens = new Parser().parse(src)\n * const docs = new Composer().compose(tokens)\n * ```\n */\nclass Composer {\n constructor(options = {}) {\n this.doc = null;\n this.atDirectives = false;\n this.prelude = [];\n this.errors = [];\n this.warnings = [];\n this.onError = (source, code, message, warning) => {\n const pos = getErrorPos(source);\n if (warning)\n this.warnings.push(new errors.YAMLWarning(pos, code, message));\n else\n this.errors.push(new errors.YAMLParseError(pos, code, message));\n };\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n this.directives = new directives.Directives({ version: options.version || '1.2' });\n this.options = options;\n }\n decorate(doc, afterDoc) {\n const { comment, afterEmptyLine } = parsePrelude(this.prelude);\n //console.log({ dc: doc.comment, prelude, comment })\n if (comment) {\n const dc = doc.contents;\n if (afterDoc) {\n doc.comment = doc.comment ? `${doc.comment}\\n${comment}` : comment;\n }\n else if (afterEmptyLine || doc.directives.docStart || !dc) {\n doc.commentBefore = comment;\n }\n else if (identity.isCollection(dc) && !dc.flow && dc.items.length > 0) {\n let it = dc.items[0];\n if (identity.isPair(it))\n it = it.key;\n const cb = it.commentBefore;\n it.commentBefore = cb ? `${comment}\\n${cb}` : comment;\n }\n else {\n const cb = dc.commentBefore;\n dc.commentBefore = cb ? `${comment}\\n${cb}` : comment;\n }\n }\n if (afterDoc) {\n for (let i = 0; i < this.errors.length; ++i)\n doc.errors.push(this.errors[i]);\n for (let i = 0; i < this.warnings.length; ++i)\n doc.warnings.push(this.warnings[i]);\n }\n else {\n doc.errors = this.errors;\n doc.warnings = this.warnings;\n }\n this.prelude = [];\n this.errors = [];\n this.warnings = [];\n }\n /**\n * Current stream status information.\n *\n * Mostly useful at the end of input for an empty stream.\n */\n streamInfo() {\n return {\n comment: parsePrelude(this.prelude).comment,\n directives: this.directives,\n errors: this.errors,\n warnings: this.warnings\n };\n }\n /**\n * Compose tokens into documents.\n *\n * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.\n * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.\n */\n *compose(tokens, forceDoc = false, endOffset = -1) {\n for (const token of tokens)\n yield* this.next(token);\n yield* this.end(forceDoc, endOffset);\n }\n /** Advance the composer by one CST token. */\n *next(token) {\n if (node_process.env.LOG_STREAM)\n console.dir(token, { depth: null });\n switch (token.type) {\n case 'directive':\n this.directives.add(token.source, (offset, message, warning) => {\n const pos = getErrorPos(token);\n pos[0] += offset;\n this.onError(pos, 'BAD_DIRECTIVE', message, warning);\n });\n this.prelude.push(token.source);\n this.atDirectives = true;\n break;\n case 'document': {\n const doc = composeDoc.composeDoc(this.options, this.directives, token, this.onError);\n if (this.atDirectives && !doc.directives.docStart)\n this.onError(token, 'MISSING_CHAR', 'Missing directives-end/doc-start indicator line');\n this.decorate(doc, false);\n if (this.doc)\n yield this.doc;\n this.doc = doc;\n this.atDirectives = false;\n break;\n }\n case 'byte-order-mark':\n case 'space':\n break;\n case 'comment':\n case 'newline':\n this.prelude.push(token.source);\n break;\n case 'error': {\n const msg = token.source\n ? `${token.message}: ${JSON.stringify(token.source)}`\n : token.message;\n const error = new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg);\n if (this.atDirectives || !this.doc)\n this.errors.push(error);\n else\n this.doc.errors.push(error);\n break;\n }\n case 'doc-end': {\n if (!this.doc) {\n const msg = 'Unexpected doc-end without preceding document';\n this.errors.push(new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg));\n break;\n }\n this.doc.directives.docEnd = true;\n const end = resolveEnd.resolveEnd(token.end, token.offset + token.source.length, this.doc.options.strict, this.onError);\n this.decorate(this.doc, true);\n if (end.comment) {\n const dc = this.doc.comment;\n this.doc.comment = dc ? `${dc}\\n${end.comment}` : end.comment;\n }\n this.doc.range[2] = end.offset;\n break;\n }\n default:\n this.errors.push(new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', `Unsupported token ${token.type}`));\n }\n }\n /**\n * Call at end of input to yield any remaining document.\n *\n * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.\n * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.\n */\n *end(forceDoc = false, endOffset = -1) {\n if (this.doc) {\n this.decorate(this.doc, true);\n yield this.doc;\n this.doc = null;\n }\n else if (forceDoc) {\n const opts = Object.assign({ _directives: this.directives }, this.options);\n const doc = new Document.Document(undefined, opts);\n if (this.atDirectives)\n this.onError(endOffset, 'MISSING_CHAR', 'Missing directives-end indicator line');\n doc.range = [0, endOffset, endOffset];\n this.decorate(doc, false);\n yield doc;\n }\n }\n}\n\nexports.Composer = Composer;\n","'use strict';\n\nvar resolveBlockScalar = require('../compose/resolve-block-scalar.js');\nvar resolveFlowScalar = require('../compose/resolve-flow-scalar.js');\nvar errors = require('../errors.js');\nvar stringifyString = require('../stringify/stringifyString.js');\n\nfunction resolveAsScalar(token, strict = true, onError) {\n if (token) {\n const _onError = (pos, code, message) => {\n const offset = typeof pos === 'number' ? pos : Array.isArray(pos) ? pos[0] : pos.offset;\n if (onError)\n onError(offset, code, message);\n else\n throw new errors.YAMLParseError([offset, offset + 1], code, message);\n };\n switch (token.type) {\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n return resolveFlowScalar.resolveFlowScalar(token, strict, _onError);\n case 'block-scalar':\n return resolveBlockScalar.resolveBlockScalar({ options: { strict } }, token, _onError);\n }\n }\n return null;\n}\n/**\n * Create a new scalar token with `value`\n *\n * Values that represent an actual string but may be parsed as a different type should use a `type` other than `'PLAIN'`,\n * as this function does not support any schema operations and won't check for such conflicts.\n *\n * @param value The string representation of the value, which will have its content properly indented.\n * @param context.end Comments and whitespace after the end of the value, or after the block scalar header. If undefined, a newline will be added.\n * @param context.implicitKey Being within an implicit key may affect the resolved type of the token's value.\n * @param context.indent The indent level of the token.\n * @param context.inFlow Is this scalar within a flow collection? This may affect the resolved type of the token's value.\n * @param context.offset The offset position of the token.\n * @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`.\n */\nfunction createScalarToken(value, context) {\n const { implicitKey = false, indent, inFlow = false, offset = -1, type = 'PLAIN' } = context;\n const source = stringifyString.stringifyString({ type, value }, {\n implicitKey,\n indent: indent > 0 ? ' '.repeat(indent) : '',\n inFlow,\n options: { blockQuote: true, lineWidth: -1 }\n });\n const end = context.end ?? [\n { type: 'newline', offset: -1, indent, source: '\\n' }\n ];\n switch (source[0]) {\n case '|':\n case '>': {\n const he = source.indexOf('\\n');\n const head = source.substring(0, he);\n const body = source.substring(he + 1) + '\\n';\n const props = [\n { type: 'block-scalar-header', offset, indent, source: head }\n ];\n if (!addEndtoBlockProps(props, end))\n props.push({ type: 'newline', offset: -1, indent, source: '\\n' });\n return { type: 'block-scalar', offset, indent, props, source: body };\n }\n case '\"':\n return { type: 'double-quoted-scalar', offset, indent, source, end };\n case \"'\":\n return { type: 'single-quoted-scalar', offset, indent, source, end };\n default:\n return { type: 'scalar', offset, indent, source, end };\n }\n}\n/**\n * Set the value of `token` to the given string `value`, overwriting any previous contents and type that it may have.\n *\n * Best efforts are made to retain any comments previously associated with the `token`,\n * though all contents within a collection's `items` will be overwritten.\n *\n * Values that represent an actual string but may be parsed as a different type should use a `type` other than `'PLAIN'`,\n * as this function does not support any schema operations and won't check for such conflicts.\n *\n * @param token Any token. If it does not include an `indent` value, the value will be stringified as if it were an implicit key.\n * @param value The string representation of the value, which will have its content properly indented.\n * @param context.afterKey In most cases, values after a key should have an additional level of indentation.\n * @param context.implicitKey Being within an implicit key may affect the resolved type of the token's value.\n * @param context.inFlow Being within a flow collection may affect the resolved type of the token's value.\n * @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`.\n */\nfunction setScalarValue(token, value, context = {}) {\n let { afterKey = false, implicitKey = false, inFlow = false, type } = context;\n let indent = 'indent' in token ? token.indent : null;\n if (afterKey && typeof indent === 'number')\n indent += 2;\n if (!type)\n switch (token.type) {\n case 'single-quoted-scalar':\n type = 'QUOTE_SINGLE';\n break;\n case 'double-quoted-scalar':\n type = 'QUOTE_DOUBLE';\n break;\n case 'block-scalar': {\n const header = token.props[0];\n if (header.type !== 'block-scalar-header')\n throw new Error('Invalid block scalar header');\n type = header.source[0] === '>' ? 'BLOCK_FOLDED' : 'BLOCK_LITERAL';\n break;\n }\n default:\n type = 'PLAIN';\n }\n const source = stringifyString.stringifyString({ type, value }, {\n implicitKey: implicitKey || indent === null,\n indent: indent !== null && indent > 0 ? ' '.repeat(indent) : '',\n inFlow,\n options: { blockQuote: true, lineWidth: -1 }\n });\n switch (source[0]) {\n case '|':\n case '>':\n setBlockScalarValue(token, source);\n break;\n case '\"':\n setFlowScalarValue(token, source, 'double-quoted-scalar');\n break;\n case \"'\":\n setFlowScalarValue(token, source, 'single-quoted-scalar');\n break;\n default:\n setFlowScalarValue(token, source, 'scalar');\n }\n}\nfunction setBlockScalarValue(token, source) {\n const he = source.indexOf('\\n');\n const head = source.substring(0, he);\n const body = source.substring(he + 1) + '\\n';\n if (token.type === 'block-scalar') {\n const header = token.props[0];\n if (header.type !== 'block-scalar-header')\n throw new Error('Invalid block scalar header');\n header.source = head;\n token.source = body;\n }\n else {\n const { offset } = token;\n const indent = 'indent' in token ? token.indent : -1;\n const props = [\n { type: 'block-scalar-header', offset, indent, source: head }\n ];\n if (!addEndtoBlockProps(props, 'end' in token ? token.end : undefined))\n props.push({ type: 'newline', offset: -1, indent, source: '\\n' });\n for (const key of Object.keys(token))\n if (key !== 'type' && key !== 'offset')\n delete token[key];\n Object.assign(token, { type: 'block-scalar', indent, props, source: body });\n }\n}\n/** @returns `true` if last token is a newline */\nfunction addEndtoBlockProps(props, end) {\n if (end)\n for (const st of end)\n switch (st.type) {\n case 'space':\n case 'comment':\n props.push(st);\n break;\n case 'newline':\n props.push(st);\n return true;\n }\n return false;\n}\nfunction setFlowScalarValue(token, source, type) {\n switch (token.type) {\n case 'scalar':\n case 'double-quoted-scalar':\n case 'single-quoted-scalar':\n token.type = type;\n token.source = source;\n break;\n case 'block-scalar': {\n const end = token.props.slice(1);\n let oa = source.length;\n if (token.props[0].type === 'block-scalar-header')\n oa -= token.props[0].source.length;\n for (const tok of end)\n tok.offset += oa;\n delete token.props;\n Object.assign(token, { type, source, end });\n break;\n }\n case 'block-map':\n case 'block-seq': {\n const offset = token.offset + source.length;\n const nl = { type: 'newline', offset, indent: token.indent, source: '\\n' };\n delete token.items;\n Object.assign(token, { type, source, end: [nl] });\n break;\n }\n default: {\n const indent = 'indent' in token ? token.indent : -1;\n const end = 'end' in token && Array.isArray(token.end)\n ? token.end.filter(st => st.type === 'space' ||\n st.type === 'comment' ||\n st.type === 'newline')\n : [];\n for (const key of Object.keys(token))\n if (key !== 'type' && key !== 'offset')\n delete token[key];\n Object.assign(token, { type, indent, source, end });\n }\n }\n}\n\nexports.createScalarToken = createScalarToken;\nexports.resolveAsScalar = resolveAsScalar;\nexports.setScalarValue = setScalarValue;\n","'use strict';\n\n/**\n * Stringify a CST document, token, or collection item\n *\n * Fair warning: This applies no validation whatsoever, and\n * simply concatenates the sources in their logical order.\n */\nconst stringify = (cst) => 'type' in cst ? stringifyToken(cst) : stringifyItem(cst);\nfunction stringifyToken(token) {\n switch (token.type) {\n case 'block-scalar': {\n let res = '';\n for (const tok of token.props)\n res += stringifyToken(tok);\n return res + token.source;\n }\n case 'block-map':\n case 'block-seq': {\n let res = '';\n for (const item of token.items)\n res += stringifyItem(item);\n return res;\n }\n case 'flow-collection': {\n let res = token.start.source;\n for (const item of token.items)\n res += stringifyItem(item);\n for (const st of token.end)\n res += st.source;\n return res;\n }\n case 'document': {\n let res = stringifyItem(token);\n if (token.end)\n for (const st of token.end)\n res += st.source;\n return res;\n }\n default: {\n let res = token.source;\n if ('end' in token && token.end)\n for (const st of token.end)\n res += st.source;\n return res;\n }\n }\n}\nfunction stringifyItem({ start, key, sep, value }) {\n let res = '';\n for (const st of start)\n res += st.source;\n if (key)\n res += stringifyToken(key);\n if (sep)\n for (const st of sep)\n res += st.source;\n if (value)\n res += stringifyToken(value);\n return res;\n}\n\nexports.stringify = stringify;\n","'use strict';\n\nconst BREAK = Symbol('break visit');\nconst SKIP = Symbol('skip children');\nconst REMOVE = Symbol('remove item');\n/**\n * Apply a visitor to a CST document or item.\n *\n * Walks through the tree (depth-first) starting from the root, calling a\n * `visitor` function with two arguments when entering each item:\n * - `item`: The current item, which included the following members:\n * - `start: SourceToken[]` – Source tokens before the key or value,\n * possibly including its anchor or tag.\n * - `key?: Token | null` – Set for pair values. May then be `null`, if\n * the key before the `:` separator is empty.\n * - `sep?: SourceToken[]` – Source tokens between the key and the value,\n * which should include the `:` map value indicator if `value` is set.\n * - `value?: Token` – The value of a sequence item, or of a map pair.\n * - `path`: The steps from the root to the current node, as an array of\n * `['key' | 'value', number]` tuples.\n *\n * The return value of the visitor may be used to control the traversal:\n * - `undefined` (default): Do nothing and continue\n * - `visit.SKIP`: Do not visit the children of this token, continue with\n * next sibling\n * - `visit.BREAK`: Terminate traversal completely\n * - `visit.REMOVE`: Remove the current item, then continue with the next one\n * - `number`: Set the index of the next step. This is useful especially if\n * the index of the current token has changed.\n * - `function`: Define the next visitor for this item. After the original\n * visitor is called on item entry, next visitors are called after handling\n * a non-empty `key` and when exiting the item.\n */\nfunction visit(cst, visitor) {\n if ('type' in cst && cst.type === 'document')\n cst = { start: cst.start, value: cst.value };\n _visit(Object.freeze([]), cst, visitor);\n}\n// Without the `as symbol` casts, TS declares these in the `visit`\n// namespace using `var`, but then complains about that because\n// `unique symbol` must be `const`.\n/** Terminate visit traversal completely */\nvisit.BREAK = BREAK;\n/** Do not visit the children of the current item */\nvisit.SKIP = SKIP;\n/** Remove the current item */\nvisit.REMOVE = REMOVE;\n/** Find the item at `path` from `cst` as the root */\nvisit.itemAtPath = (cst, path) => {\n let item = cst;\n for (const [field, index] of path) {\n const tok = item?.[field];\n if (tok && 'items' in tok) {\n item = tok.items[index];\n }\n else\n return undefined;\n }\n return item;\n};\n/**\n * Get the immediate parent collection of the item at `path` from `cst` as the root.\n *\n * Throws an error if the collection is not found, which should never happen if the item itself exists.\n */\nvisit.parentCollection = (cst, path) => {\n const parent = visit.itemAtPath(cst, path.slice(0, -1));\n const field = path[path.length - 1][0];\n const coll = parent?.[field];\n if (coll && 'items' in coll)\n return coll;\n throw new Error('Parent collection not found');\n};\nfunction _visit(path, item, visitor) {\n let ctrl = visitor(item, path);\n if (typeof ctrl === 'symbol')\n return ctrl;\n for (const field of ['key', 'value']) {\n const token = item[field];\n if (token && 'items' in token) {\n for (let i = 0; i < token.items.length; ++i) {\n const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);\n if (typeof ci === 'number')\n i = ci - 1;\n else if (ci === BREAK)\n return BREAK;\n else if (ci === REMOVE) {\n token.items.splice(i, 1);\n i -= 1;\n }\n }\n if (typeof ctrl === 'function' && field === 'key')\n ctrl = ctrl(item, path);\n }\n }\n return typeof ctrl === 'function' ? ctrl(item, path) : ctrl;\n}\n\nexports.visit = visit;\n","'use strict';\n\nvar cstScalar = require('./cst-scalar.js');\nvar cstStringify = require('./cst-stringify.js');\nvar cstVisit = require('./cst-visit.js');\n\n/** The byte order mark */\nconst BOM = '\\u{FEFF}';\n/** Start of doc-mode */\nconst DOCUMENT = '\\x02'; // C0: Start of Text\n/** Unexpected end of flow-mode */\nconst FLOW_END = '\\x18'; // C0: Cancel\n/** Next token is a scalar value */\nconst SCALAR = '\\x1f'; // C0: Unit Separator\n/** @returns `true` if `token` is a flow or block collection */\nconst isCollection = (token) => !!token && 'items' in token;\n/** @returns `true` if `token` is a flow or block scalar; not an alias */\nconst isScalar = (token) => !!token &&\n (token.type === 'scalar' ||\n token.type === 'single-quoted-scalar' ||\n token.type === 'double-quoted-scalar' ||\n token.type === 'block-scalar');\n/* istanbul ignore next */\n/** Get a printable representation of a lexer token */\nfunction prettyToken(token) {\n switch (token) {\n case BOM:\n return '<BOM>';\n case DOCUMENT:\n return '<DOC>';\n case FLOW_END:\n return '<FLOW_END>';\n case SCALAR:\n return '<SCALAR>';\n default:\n return JSON.stringify(token);\n }\n}\n/** Identify the type of a lexer token. May return `null` for unknown tokens. */\nfunction tokenType(source) {\n switch (source) {\n case BOM:\n return 'byte-order-mark';\n case DOCUMENT:\n return 'doc-mode';\n case FLOW_END:\n return 'flow-error-end';\n case SCALAR:\n return 'scalar';\n case '---':\n return 'doc-start';\n case '...':\n return 'doc-end';\n case '':\n case '\\n':\n case '\\r\\n':\n return 'newline';\n case '-':\n return 'seq-item-ind';\n case '?':\n return 'explicit-key-ind';\n case ':':\n return 'map-value-ind';\n case '{':\n return 'flow-map-start';\n case '}':\n return 'flow-map-end';\n case '[':\n return 'flow-seq-start';\n case ']':\n return 'flow-seq-end';\n case ',':\n return 'comma';\n }\n switch (source[0]) {\n case ' ':\n case '\\t':\n return 'space';\n case '#':\n return 'comment';\n case '%':\n return 'directive-line';\n case '*':\n return 'alias';\n case '&':\n return 'anchor';\n case '!':\n return 'tag';\n case \"'\":\n return 'single-quoted-scalar';\n case '\"':\n return 'double-quoted-scalar';\n case '|':\n case '>':\n return 'block-scalar-header';\n }\n return null;\n}\n\nexports.createScalarToken = cstScalar.createScalarToken;\nexports.resolveAsScalar = cstScalar.resolveAsScalar;\nexports.setScalarValue = cstScalar.setScalarValue;\nexports.stringify = cstStringify.stringify;\nexports.visit = cstVisit.visit;\nexports.BOM = BOM;\nexports.DOCUMENT = DOCUMENT;\nexports.FLOW_END = FLOW_END;\nexports.SCALAR = SCALAR;\nexports.isCollection = isCollection;\nexports.isScalar = isScalar;\nexports.prettyToken = prettyToken;\nexports.tokenType = tokenType;\n","'use strict';\n\nvar cst = require('./cst.js');\n\n/*\nSTART -> stream\n\nstream\n directive -> line-end -> stream\n indent + line-end -> stream\n [else] -> line-start\n\nline-end\n comment -> line-end\n newline -> .\n input-end -> END\n\nline-start\n doc-start -> doc\n doc-end -> stream\n [else] -> indent -> block-start\n\nblock-start\n seq-item-start -> block-start\n explicit-key-start -> block-start\n map-value-start -> block-start\n [else] -> doc\n\ndoc\n line-end -> line-start\n spaces -> doc\n anchor -> doc\n tag -> doc\n flow-start -> flow -> doc\n flow-end -> error -> doc\n seq-item-start -> error -> doc\n explicit-key-start -> error -> doc\n map-value-start -> doc\n alias -> doc\n quote-start -> quoted-scalar -> doc\n block-scalar-header -> line-end -> block-scalar(min) -> line-start\n [else] -> plain-scalar(false, min) -> doc\n\nflow\n line-end -> flow\n spaces -> flow\n anchor -> flow\n tag -> flow\n flow-start -> flow -> flow\n flow-end -> .\n seq-item-start -> error -> flow\n explicit-key-start -> flow\n map-value-start -> flow\n alias -> flow\n quote-start -> quoted-scalar -> flow\n comma -> flow\n [else] -> plain-scalar(true, 0) -> flow\n\nquoted-scalar\n quote-end -> .\n [else] -> quoted-scalar\n\nblock-scalar(min)\n newline + peek(indent < min) -> .\n [else] -> block-scalar(min)\n\nplain-scalar(is-flow, min)\n scalar-end(is-flow) -> .\n peek(newline + (indent < min)) -> .\n [else] -> plain-scalar(min)\n*/\nfunction isEmpty(ch) {\n switch (ch) {\n case undefined:\n case ' ':\n case '\\n':\n case '\\r':\n case '\\t':\n return true;\n default:\n return false;\n }\n}\nconst hexDigits = new Set('0123456789ABCDEFabcdef');\nconst tagChars = new Set(\"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()\");\nconst flowIndicatorChars = new Set(',[]{}');\nconst invalidAnchorChars = new Set(' ,[]{}\\n\\r\\t');\nconst isNotAnchorChar = (ch) => !ch || invalidAnchorChars.has(ch);\n/**\n * Splits an input string into lexical tokens, i.e. smaller strings that are\n * easily identifiable by `tokens.tokenType()`.\n *\n * Lexing starts always in a \"stream\" context. Incomplete input may be buffered\n * until a complete token can be emitted.\n *\n * In addition to slices of the original input, the following control characters\n * may also be emitted:\n *\n * - `\\x02` (Start of Text): A document starts with the next token\n * - `\\x18` (Cancel): Unexpected end of flow-mode (indicates an error)\n * - `\\x1f` (Unit Separator): Next token is a scalar value\n * - `\\u{FEFF}` (Byte order mark): Emitted separately outside documents\n */\nclass Lexer {\n constructor() {\n /**\n * Flag indicating whether the end of the current buffer marks the end of\n * all input\n */\n this.atEnd = false;\n /**\n * Explicit indent set in block scalar header, as an offset from the current\n * minimum indent, so e.g. set to 1 from a header `|2+`. Set to -1 if not\n * explicitly set.\n */\n this.blockScalarIndent = -1;\n /**\n * Block scalars that include a + (keep) chomping indicator in their header\n * include trailing empty lines, which are otherwise excluded from the\n * scalar's contents.\n */\n this.blockScalarKeep = false;\n /** Current input */\n this.buffer = '';\n /**\n * Flag noting whether the map value indicator : can immediately follow this\n * node within a flow context.\n */\n this.flowKey = false;\n /** Count of surrounding flow collection levels. */\n this.flowLevel = 0;\n /**\n * Minimum level of indentation required for next lines to be parsed as a\n * part of the current scalar value.\n */\n this.indentNext = 0;\n /** Indentation level of the current line. */\n this.indentValue = 0;\n /** Position of the next \\n character. */\n this.lineEndPos = null;\n /** Stores the state of the lexer if reaching the end of incpomplete input */\n this.next = null;\n /** A pointer to `buffer`; the current position of the lexer. */\n this.pos = 0;\n }\n /**\n * Generate YAML tokens from the `source` string. If `incomplete`,\n * a part of the last line may be left as a buffer for the next call.\n *\n * @returns A generator of lexical tokens\n */\n *lex(source, incomplete = false) {\n if (source) {\n if (typeof source !== 'string')\n throw TypeError('source is not a string');\n this.buffer = this.buffer ? this.buffer + source : source;\n this.lineEndPos = null;\n }\n this.atEnd = !incomplete;\n let next = this.next ?? 'stream';\n while (next && (incomplete || this.hasChars(1)))\n next = yield* this.parseNext(next);\n }\n atLineEnd() {\n let i = this.pos;\n let ch = this.buffer[i];\n while (ch === ' ' || ch === '\\t')\n ch = this.buffer[++i];\n if (!ch || ch === '#' || ch === '\\n')\n return true;\n if (ch === '\\r')\n return this.buffer[i + 1] === '\\n';\n return false;\n }\n charAt(n) {\n return this.buffer[this.pos + n];\n }\n continueScalar(offset) {\n let ch = this.buffer[offset];\n if (this.indentNext > 0) {\n let indent = 0;\n while (ch === ' ')\n ch = this.buffer[++indent + offset];\n if (ch === '\\r') {\n const next = this.buffer[indent + offset + 1];\n if (next === '\\n' || (!next && !this.atEnd))\n return offset + indent + 1;\n }\n return ch === '\\n' || indent >= this.indentNext || (!ch && !this.atEnd)\n ? offset + indent\n : -1;\n }\n if (ch === '-' || ch === '.') {\n const dt = this.buffer.substr(offset, 3);\n if ((dt === '---' || dt === '...') && isEmpty(this.buffer[offset + 3]))\n return -1;\n }\n return offset;\n }\n getLine() {\n let end = this.lineEndPos;\n if (typeof end !== 'number' || (end !== -1 && end < this.pos)) {\n end = this.buffer.indexOf('\\n', this.pos);\n this.lineEndPos = end;\n }\n if (end === -1)\n return this.atEnd ? this.buffer.substring(this.pos) : null;\n if (this.buffer[end - 1] === '\\r')\n end -= 1;\n return this.buffer.substring(this.pos, end);\n }\n hasChars(n) {\n return this.pos + n <= this.buffer.length;\n }\n setNext(state) {\n this.buffer = this.buffer.substring(this.pos);\n this.pos = 0;\n this.lineEndPos = null;\n this.next = state;\n return null;\n }\n peek(n) {\n return this.buffer.substr(this.pos, n);\n }\n *parseNext(next) {\n switch (next) {\n case 'stream':\n return yield* this.parseStream();\n case 'line-start':\n return yield* this.parseLineStart();\n case 'block-start':\n return yield* this.parseBlockStart();\n case 'doc':\n return yield* this.parseDocument();\n case 'flow':\n return yield* this.parseFlowCollection();\n case 'quoted-scalar':\n return yield* this.parseQuotedScalar();\n case 'block-scalar':\n return yield* this.parseBlockScalar();\n case 'plain-scalar':\n return yield* this.parsePlainScalar();\n }\n }\n *parseStream() {\n let line = this.getLine();\n if (line === null)\n return this.setNext('stream');\n if (line[0] === cst.BOM) {\n yield* this.pushCount(1);\n line = line.substring(1);\n }\n if (line[0] === '%') {\n let dirEnd = line.length;\n let cs = line.indexOf('#');\n while (cs !== -1) {\n const ch = line[cs - 1];\n if (ch === ' ' || ch === '\\t') {\n dirEnd = cs - 1;\n break;\n }\n else {\n cs = line.indexOf('#', cs + 1);\n }\n }\n while (true) {\n const ch = line[dirEnd - 1];\n if (ch === ' ' || ch === '\\t')\n dirEnd -= 1;\n else\n break;\n }\n const n = (yield* this.pushCount(dirEnd)) + (yield* this.pushSpaces(true));\n yield* this.pushCount(line.length - n); // possible comment\n this.pushNewline();\n return 'stream';\n }\n if (this.atLineEnd()) {\n const sp = yield* this.pushSpaces(true);\n yield* this.pushCount(line.length - sp);\n yield* this.pushNewline();\n return 'stream';\n }\n yield cst.DOCUMENT;\n return yield* this.parseLineStart();\n }\n *parseLineStart() {\n const ch = this.charAt(0);\n if (!ch && !this.atEnd)\n return this.setNext('line-start');\n if (ch === '-' || ch === '.') {\n if (!this.atEnd && !this.hasChars(4))\n return this.setNext('line-start');\n const s = this.peek(3);\n if ((s === '---' || s === '...') && isEmpty(this.charAt(3))) {\n yield* this.pushCount(3);\n this.indentValue = 0;\n this.indentNext = 0;\n return s === '---' ? 'doc' : 'stream';\n }\n }\n this.indentValue = yield* this.pushSpaces(false);\n if (this.indentNext > this.indentValue && !isEmpty(this.charAt(1)))\n this.indentNext = this.indentValue;\n return yield* this.parseBlockStart();\n }\n *parseBlockStart() {\n const [ch0, ch1] = this.peek(2);\n if (!ch1 && !this.atEnd)\n return this.setNext('block-start');\n if ((ch0 === '-' || ch0 === '?' || ch0 === ':') && isEmpty(ch1)) {\n const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));\n this.indentNext = this.indentValue + 1;\n this.indentValue += n;\n return 'block-start';\n }\n return 'doc';\n }\n *parseDocument() {\n yield* this.pushSpaces(true);\n const line = this.getLine();\n if (line === null)\n return this.setNext('doc');\n let n = yield* this.pushIndicators();\n switch (line[n]) {\n case '#':\n yield* this.pushCount(line.length - n);\n // fallthrough\n case undefined:\n yield* this.pushNewline();\n return yield* this.parseLineStart();\n case '{':\n case '[':\n yield* this.pushCount(1);\n this.flowKey = false;\n this.flowLevel = 1;\n return 'flow';\n case '}':\n case ']':\n // this is an error\n yield* this.pushCount(1);\n return 'doc';\n case '*':\n yield* this.pushUntil(isNotAnchorChar);\n return 'doc';\n case '\"':\n case \"'\":\n return yield* this.parseQuotedScalar();\n case '|':\n case '>':\n n += yield* this.parseBlockScalarHeader();\n n += yield* this.pushSpaces(true);\n yield* this.pushCount(line.length - n);\n yield* this.pushNewline();\n return yield* this.parseBlockScalar();\n default:\n return yield* this.parsePlainScalar();\n }\n }\n *parseFlowCollection() {\n let nl, sp;\n let indent = -1;\n do {\n nl = yield* this.pushNewline();\n if (nl > 0) {\n sp = yield* this.pushSpaces(false);\n this.indentValue = indent = sp;\n }\n else {\n sp = 0;\n }\n sp += yield* this.pushSpaces(true);\n } while (nl + sp > 0);\n const line = this.getLine();\n if (line === null)\n return this.setNext('flow');\n if ((indent !== -1 && indent < this.indentNext && line[0] !== '#') ||\n (indent === 0 &&\n (line.startsWith('---') || line.startsWith('...')) &&\n isEmpty(line[3]))) {\n // Allowing for the terminal ] or } at the same (rather than greater)\n // indent level as the initial [ or { is technically invalid, but\n // failing here would be surprising to users.\n const atFlowEndMarker = indent === this.indentNext - 1 &&\n this.flowLevel === 1 &&\n (line[0] === ']' || line[0] === '}');\n if (!atFlowEndMarker) {\n // this is an error\n this.flowLevel = 0;\n yield cst.FLOW_END;\n return yield* this.parseLineStart();\n }\n }\n let n = 0;\n while (line[n] === ',') {\n n += yield* this.pushCount(1);\n n += yield* this.pushSpaces(true);\n this.flowKey = false;\n }\n n += yield* this.pushIndicators();\n switch (line[n]) {\n case undefined:\n return 'flow';\n case '#':\n yield* this.pushCount(line.length - n);\n return 'flow';\n case '{':\n case '[':\n yield* this.pushCount(1);\n this.flowKey = false;\n this.flowLevel += 1;\n return 'flow';\n case '}':\n case ']':\n yield* this.pushCount(1);\n this.flowKey = true;\n this.flowLevel -= 1;\n return this.flowLevel ? 'flow' : 'doc';\n case '*':\n yield* this.pushUntil(isNotAnchorChar);\n return 'flow';\n case '\"':\n case \"'\":\n this.flowKey = true;\n return yield* this.parseQuotedScalar();\n case ':': {\n const next = this.charAt(1);\n if (this.flowKey || isEmpty(next) || next === ',') {\n this.flowKey = false;\n yield* this.pushCount(1);\n yield* this.pushSpaces(true);\n return 'flow';\n }\n }\n // fallthrough\n default:\n this.flowKey = false;\n return yield* this.parsePlainScalar();\n }\n }\n *parseQuotedScalar() {\n const quote = this.charAt(0);\n let end = this.buffer.indexOf(quote, this.pos + 1);\n if (quote === \"'\") {\n while (end !== -1 && this.buffer[end + 1] === \"'\")\n end = this.buffer.indexOf(\"'\", end + 2);\n }\n else {\n // double-quote\n while (end !== -1) {\n let n = 0;\n while (this.buffer[end - 1 - n] === '\\\\')\n n += 1;\n if (n % 2 === 0)\n break;\n end = this.buffer.indexOf('\"', end + 1);\n }\n }\n // Only looking for newlines within the quotes\n const qb = this.buffer.substring(0, end);\n let nl = qb.indexOf('\\n', this.pos);\n if (nl !== -1) {\n while (nl !== -1) {\n const cs = this.continueScalar(nl + 1);\n if (cs === -1)\n break;\n nl = qb.indexOf('\\n', cs);\n }\n if (nl !== -1) {\n // this is an error caused by an unexpected unindent\n end = nl - (qb[nl - 1] === '\\r' ? 2 : 1);\n }\n }\n if (end === -1) {\n if (!this.atEnd)\n return this.setNext('quoted-scalar');\n end = this.buffer.length;\n }\n yield* this.pushToIndex(end + 1, false);\n return this.flowLevel ? 'flow' : 'doc';\n }\n *parseBlockScalarHeader() {\n this.blockScalarIndent = -1;\n this.blockScalarKeep = false;\n let i = this.pos;\n while (true) {\n const ch = this.buffer[++i];\n if (ch === '+')\n this.blockScalarKeep = true;\n else if (ch > '0' && ch <= '9')\n this.blockScalarIndent = Number(ch) - 1;\n else if (ch !== '-')\n break;\n }\n return yield* this.pushUntil(ch => isEmpty(ch) || ch === '#');\n }\n *parseBlockScalar() {\n let nl = this.pos - 1; // may be -1 if this.pos === 0\n let indent = 0;\n let ch;\n loop: for (let i = this.pos; (ch = this.buffer[i]); ++i) {\n switch (ch) {\n case ' ':\n indent += 1;\n break;\n case '\\n':\n nl = i;\n indent = 0;\n break;\n case '\\r': {\n const next = this.buffer[i + 1];\n if (!next && !this.atEnd)\n return this.setNext('block-scalar');\n if (next === '\\n')\n break;\n } // fallthrough\n default:\n break loop;\n }\n }\n if (!ch && !this.atEnd)\n return this.setNext('block-scalar');\n if (indent >= this.indentNext) {\n if (this.blockScalarIndent === -1)\n this.indentNext = indent;\n else {\n this.indentNext =\n this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);\n }\n do {\n const cs = this.continueScalar(nl + 1);\n if (cs === -1)\n break;\n nl = this.buffer.indexOf('\\n', cs);\n } while (nl !== -1);\n if (nl === -1) {\n if (!this.atEnd)\n return this.setNext('block-scalar');\n nl = this.buffer.length;\n }\n }\n // Trailing insufficiently indented tabs are invalid.\n // To catch that during parsing, we include them in the block scalar value.\n let i = nl + 1;\n ch = this.buffer[i];\n while (ch === ' ')\n ch = this.buffer[++i];\n if (ch === '\\t') {\n while (ch === '\\t' || ch === ' ' || ch === '\\r' || ch === '\\n')\n ch = this.buffer[++i];\n nl = i - 1;\n }\n else if (!this.blockScalarKeep) {\n do {\n let i = nl - 1;\n let ch = this.buffer[i];\n if (ch === '\\r')\n ch = this.buffer[--i];\n const lastChar = i; // Drop the line if last char not more indented\n while (ch === ' ')\n ch = this.buffer[--i];\n if (ch === '\\n' && i >= this.pos && i + 1 + indent > lastChar)\n nl = i;\n else\n break;\n } while (true);\n }\n yield cst.SCALAR;\n yield* this.pushToIndex(nl + 1, true);\n return yield* this.parseLineStart();\n }\n *parsePlainScalar() {\n const inFlow = this.flowLevel > 0;\n let end = this.pos - 1;\n let i = this.pos - 1;\n let ch;\n while ((ch = this.buffer[++i])) {\n if (ch === ':') {\n const next = this.buffer[i + 1];\n if (isEmpty(next) || (inFlow && flowIndicatorChars.has(next)))\n break;\n end = i;\n }\n else if (isEmpty(ch)) {\n let next = this.buffer[i + 1];\n if (ch === '\\r') {\n if (next === '\\n') {\n i += 1;\n ch = '\\n';\n next = this.buffer[i + 1];\n }\n else\n end = i;\n }\n if (next === '#' || (inFlow && flowIndicatorChars.has(next)))\n break;\n if (ch === '\\n') {\n const cs = this.continueScalar(i + 1);\n if (cs === -1)\n break;\n i = Math.max(i, cs - 2); // to advance, but still account for ' #'\n }\n }\n else {\n if (inFlow && flowIndicatorChars.has(ch))\n break;\n end = i;\n }\n }\n if (!ch && !this.atEnd)\n return this.setNext('plain-scalar');\n yield cst.SCALAR;\n yield* this.pushToIndex(end + 1, true);\n return inFlow ? 'flow' : 'doc';\n }\n *pushCount(n) {\n if (n > 0) {\n yield this.buffer.substr(this.pos, n);\n this.pos += n;\n return n;\n }\n return 0;\n }\n *pushToIndex(i, allowEmpty) {\n const s = this.buffer.slice(this.pos, i);\n if (s) {\n yield s;\n this.pos += s.length;\n return s.length;\n }\n else if (allowEmpty)\n yield '';\n return 0;\n }\n *pushIndicators() {\n let n = 0;\n loop: while (true) {\n switch (this.charAt(0)) {\n case '!':\n n += yield* this.pushTag();\n n += yield* this.pushSpaces(true);\n continue loop;\n case '&':\n n += yield* this.pushUntil(isNotAnchorChar);\n n += yield* this.pushSpaces(true);\n continue loop;\n case '-': // this is an error\n case '?': // this is an error outside flow collections\n case ':': {\n const inFlow = this.flowLevel > 0;\n const ch1 = this.charAt(1);\n if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {\n if (!inFlow)\n this.indentNext = this.indentValue + 1;\n else if (this.flowKey)\n this.flowKey = false;\n n += yield* this.pushCount(1);\n n += yield* this.pushSpaces(true);\n continue loop;\n }\n }\n }\n break loop;\n }\n return n;\n }\n *pushTag() {\n if (this.charAt(1) === '<') {\n let i = this.pos + 2;\n let ch = this.buffer[i];\n while (!isEmpty(ch) && ch !== '>')\n ch = this.buffer[++i];\n return yield* this.pushToIndex(ch === '>' ? i + 1 : i, false);\n }\n else {\n let i = this.pos + 1;\n let ch = this.buffer[i];\n while (ch) {\n if (tagChars.has(ch))\n ch = this.buffer[++i];\n else if (ch === '%' &&\n hexDigits.has(this.buffer[i + 1]) &&\n hexDigits.has(this.buffer[i + 2])) {\n ch = this.buffer[(i += 3)];\n }\n else\n break;\n }\n return yield* this.pushToIndex(i, false);\n }\n }\n *pushNewline() {\n const ch = this.buffer[this.pos];\n if (ch === '\\n')\n return yield* this.pushCount(1);\n else if (ch === '\\r' && this.charAt(1) === '\\n')\n return yield* this.pushCount(2);\n else\n return 0;\n }\n *pushSpaces(allowTabs) {\n let i = this.pos - 1;\n let ch;\n do {\n ch = this.buffer[++i];\n } while (ch === ' ' || (allowTabs && ch === '\\t'));\n const n = i - this.pos;\n if (n > 0) {\n yield this.buffer.substr(this.pos, n);\n this.pos = i;\n }\n return n;\n }\n *pushUntil(test) {\n let i = this.pos;\n let ch = this.buffer[i];\n while (!test(ch))\n ch = this.buffer[++i];\n return yield* this.pushToIndex(i, false);\n }\n}\n\nexports.Lexer = Lexer;\n","'use strict';\n\n/**\n * Tracks newlines during parsing in order to provide an efficient API for\n * determining the one-indexed `{ line, col }` position for any offset\n * within the input.\n */\nclass LineCounter {\n constructor() {\n this.lineStarts = [];\n /**\n * Should be called in ascending order. Otherwise, call\n * `lineCounter.lineStarts.sort()` before calling `linePos()`.\n */\n this.addNewLine = (offset) => this.lineStarts.push(offset);\n /**\n * Performs a binary search and returns the 1-indexed { line, col }\n * position of `offset`. If `line === 0`, `addNewLine` has never been\n * called or `offset` is before the first known newline.\n */\n this.linePos = (offset) => {\n let low = 0;\n let high = this.lineStarts.length;\n while (low < high) {\n const mid = (low + high) >> 1; // Math.floor((low + high) / 2)\n if (this.lineStarts[mid] < offset)\n low = mid + 1;\n else\n high = mid;\n }\n if (this.lineStarts[low] === offset)\n return { line: low + 1, col: 1 };\n if (low === 0)\n return { line: 0, col: offset };\n const start = this.lineStarts[low - 1];\n return { line: low, col: offset - start + 1 };\n };\n }\n}\n\nexports.LineCounter = LineCounter;\n","'use strict';\n\nvar node_process = require('process');\nvar cst = require('./cst.js');\nvar lexer = require('./lexer.js');\n\nfunction includesToken(list, type) {\n for (let i = 0; i < list.length; ++i)\n if (list[i].type === type)\n return true;\n return false;\n}\nfunction findNonEmptyIndex(list) {\n for (let i = 0; i < list.length; ++i) {\n switch (list[i].type) {\n case 'space':\n case 'comment':\n case 'newline':\n break;\n default:\n return i;\n }\n }\n return -1;\n}\nfunction isFlowToken(token) {\n switch (token?.type) {\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n case 'flow-collection':\n return true;\n default:\n return false;\n }\n}\nfunction getPrevProps(parent) {\n switch (parent.type) {\n case 'document':\n return parent.start;\n case 'block-map': {\n const it = parent.items[parent.items.length - 1];\n return it.sep ?? it.start;\n }\n case 'block-seq':\n return parent.items[parent.items.length - 1].start;\n /* istanbul ignore next should not happen */\n default:\n return [];\n }\n}\n/** Note: May modify input array */\nfunction getFirstKeyStartProps(prev) {\n if (prev.length === 0)\n return [];\n let i = prev.length;\n loop: while (--i >= 0) {\n switch (prev[i].type) {\n case 'doc-start':\n case 'explicit-key-ind':\n case 'map-value-ind':\n case 'seq-item-ind':\n case 'newline':\n break loop;\n }\n }\n while (prev[++i]?.type === 'space') {\n /* loop */\n }\n return prev.splice(i, prev.length);\n}\nfunction arrayPushArray(target, source) {\n // May exhaust call stack with large `source` array\n if (source.length < 1e5)\n Array.prototype.push.apply(target, source);\n else\n for (let i = 0; i < source.length; ++i)\n target.push(source[i]);\n}\nfunction fixFlowSeqItems(fc) {\n if (fc.start.type === 'flow-seq-start') {\n for (const it of fc.items) {\n if (it.sep &&\n !it.value &&\n !includesToken(it.start, 'explicit-key-ind') &&\n !includesToken(it.sep, 'map-value-ind')) {\n if (it.key)\n it.value = it.key;\n delete it.key;\n if (isFlowToken(it.value)) {\n if (it.value.end)\n arrayPushArray(it.value.end, it.sep);\n else\n it.value.end = it.sep;\n }\n else\n arrayPushArray(it.start, it.sep);\n delete it.sep;\n }\n }\n }\n}\n/**\n * A YAML concrete syntax tree (CST) parser\n *\n * ```ts\n * const src: string = ...\n * for (const token of new Parser().parse(src)) {\n * // token: Token\n * }\n * ```\n *\n * To use the parser with a user-provided lexer:\n *\n * ```ts\n * function* parse(source: string, lexer: Lexer) {\n * const parser = new Parser()\n * for (const lexeme of lexer.lex(source))\n * yield* parser.next(lexeme)\n * yield* parser.end()\n * }\n *\n * const src: string = ...\n * const lexer = new Lexer()\n * for (const token of parse(src, lexer)) {\n * // token: Token\n * }\n * ```\n */\nclass Parser {\n /**\n * @param onNewLine - If defined, called separately with the start position of\n * each new line (in `parse()`, including the start of input).\n */\n constructor(onNewLine) {\n /** If true, space and sequence indicators count as indentation */\n this.atNewLine = true;\n /** If true, next token is a scalar value */\n this.atScalar = false;\n /** Current indentation level */\n this.indent = 0;\n /** Current offset since the start of parsing */\n this.offset = 0;\n /** On the same line with a block map key */\n this.onKeyLine = false;\n /** Top indicates the node that's currently being built */\n this.stack = [];\n /** The source of the current token, set in parse() */\n this.source = '';\n /** The type of the current token, set in parse() */\n this.type = '';\n // Must be defined after `next()`\n this.lexer = new lexer.Lexer();\n this.onNewLine = onNewLine;\n }\n /**\n * Parse `source` as a YAML stream.\n * If `incomplete`, a part of the last line may be left as a buffer for the next call.\n *\n * Errors are not thrown, but yielded as `{ type: 'error', message }` tokens.\n *\n * @returns A generator of tokens representing each directive, document, and other structure.\n */\n *parse(source, incomplete = false) {\n if (this.onNewLine && this.offset === 0)\n this.onNewLine(0);\n for (const lexeme of this.lexer.lex(source, incomplete))\n yield* this.next(lexeme);\n if (!incomplete)\n yield* this.end();\n }\n /**\n * Advance the parser by the `source` of one lexical token.\n */\n *next(source) {\n this.source = source;\n if (node_process.env.LOG_TOKENS)\n console.log('|', cst.prettyToken(source));\n if (this.atScalar) {\n this.atScalar = false;\n yield* this.step();\n this.offset += source.length;\n return;\n }\n const type = cst.tokenType(source);\n if (!type) {\n const message = `Not a YAML token: ${source}`;\n yield* this.pop({ type: 'error', offset: this.offset, message, source });\n this.offset += source.length;\n }\n else if (type === 'scalar') {\n this.atNewLine = false;\n this.atScalar = true;\n this.type = 'scalar';\n }\n else {\n this.type = type;\n yield* this.step();\n switch (type) {\n case 'newline':\n this.atNewLine = true;\n this.indent = 0;\n if (this.onNewLine)\n this.onNewLine(this.offset + source.length);\n break;\n case 'space':\n if (this.atNewLine && source[0] === ' ')\n this.indent += source.length;\n break;\n case 'explicit-key-ind':\n case 'map-value-ind':\n case 'seq-item-ind':\n if (this.atNewLine)\n this.indent += source.length;\n break;\n case 'doc-mode':\n case 'flow-error-end':\n return;\n default:\n this.atNewLine = false;\n }\n this.offset += source.length;\n }\n }\n /** Call at end of input to push out any remaining constructions */\n *end() {\n while (this.stack.length > 0)\n yield* this.pop();\n }\n get sourceToken() {\n const st = {\n type: this.type,\n offset: this.offset,\n indent: this.indent,\n source: this.source\n };\n return st;\n }\n *step() {\n const top = this.peek(1);\n if (this.type === 'doc-end' && top?.type !== 'doc-end') {\n while (this.stack.length > 0)\n yield* this.pop();\n this.stack.push({\n type: 'doc-end',\n offset: this.offset,\n source: this.source\n });\n return;\n }\n if (!top)\n return yield* this.stream();\n switch (top.type) {\n case 'document':\n return yield* this.document(top);\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n return yield* this.scalar(top);\n case 'block-scalar':\n return yield* this.blockScalar(top);\n case 'block-map':\n return yield* this.blockMap(top);\n case 'block-seq':\n return yield* this.blockSequence(top);\n case 'flow-collection':\n return yield* this.flowCollection(top);\n case 'doc-end':\n return yield* this.documentEnd(top);\n }\n /* istanbul ignore next should not happen */\n yield* this.pop();\n }\n peek(n) {\n return this.stack[this.stack.length - n];\n }\n *pop(error) {\n const token = error ?? this.stack.pop();\n /* istanbul ignore if should not happen */\n if (!token) {\n const message = 'Tried to pop an empty stack';\n yield { type: 'error', offset: this.offset, source: '', message };\n }\n else if (this.stack.length === 0) {\n yield token;\n }\n else {\n const top = this.peek(1);\n if (token.type === 'block-scalar') {\n // Block scalars use their parent rather than header indent\n token.indent = 'indent' in top ? top.indent : 0;\n }\n else if (token.type === 'flow-collection' && top.type === 'document') {\n // Ignore all indent for top-level flow collections\n token.indent = 0;\n }\n if (token.type === 'flow-collection')\n fixFlowSeqItems(token);\n switch (top.type) {\n case 'document':\n top.value = token;\n break;\n case 'block-scalar':\n top.props.push(token); // error\n break;\n case 'block-map': {\n const it = top.items[top.items.length - 1];\n if (it.value) {\n top.items.push({ start: [], key: token, sep: [] });\n this.onKeyLine = true;\n return;\n }\n else if (it.sep) {\n it.value = token;\n }\n else {\n Object.assign(it, { key: token, sep: [] });\n this.onKeyLine = !it.explicitKey;\n return;\n }\n break;\n }\n case 'block-seq': {\n const it = top.items[top.items.length - 1];\n if (it.value)\n top.items.push({ start: [], value: token });\n else\n it.value = token;\n break;\n }\n case 'flow-collection': {\n const it = top.items[top.items.length - 1];\n if (!it || it.value)\n top.items.push({ start: [], key: token, sep: [] });\n else if (it.sep)\n it.value = token;\n else\n Object.assign(it, { key: token, sep: [] });\n return;\n }\n /* istanbul ignore next should not happen */\n default:\n yield* this.pop();\n yield* this.pop(token);\n }\n if ((top.type === 'document' ||\n top.type === 'block-map' ||\n top.type === 'block-seq') &&\n (token.type === 'block-map' || token.type === 'block-seq')) {\n const last = token.items[token.items.length - 1];\n if (last &&\n !last.sep &&\n !last.value &&\n last.start.length > 0 &&\n findNonEmptyIndex(last.start) === -1 &&\n (token.indent === 0 ||\n last.start.every(st => st.type !== 'comment' || st.indent < token.indent))) {\n if (top.type === 'document')\n top.end = last.start;\n else\n top.items.push({ start: last.start });\n token.items.splice(-1, 1);\n }\n }\n }\n }\n *stream() {\n switch (this.type) {\n case 'directive-line':\n yield { type: 'directive', offset: this.offset, source: this.source };\n return;\n case 'byte-order-mark':\n case 'space':\n case 'comment':\n case 'newline':\n yield this.sourceToken;\n return;\n case 'doc-mode':\n case 'doc-start': {\n const doc = {\n type: 'document',\n offset: this.offset,\n start: []\n };\n if (this.type === 'doc-start')\n doc.start.push(this.sourceToken);\n this.stack.push(doc);\n return;\n }\n }\n yield {\n type: 'error',\n offset: this.offset,\n message: `Unexpected ${this.type} token in YAML stream`,\n source: this.source\n };\n }\n *document(doc) {\n if (doc.value)\n return yield* this.lineEnd(doc);\n switch (this.type) {\n case 'doc-start': {\n if (findNonEmptyIndex(doc.start) !== -1) {\n yield* this.pop();\n yield* this.step();\n }\n else\n doc.start.push(this.sourceToken);\n return;\n }\n case 'anchor':\n case 'tag':\n case 'space':\n case 'comment':\n case 'newline':\n doc.start.push(this.sourceToken);\n return;\n }\n const bv = this.startBlockValue(doc);\n if (bv)\n this.stack.push(bv);\n else {\n yield {\n type: 'error',\n offset: this.offset,\n message: `Unexpected ${this.type} token in YAML document`,\n source: this.source\n };\n }\n }\n *scalar(scalar) {\n if (this.type === 'map-value-ind') {\n const prev = getPrevProps(this.peek(2));\n const start = getFirstKeyStartProps(prev);\n let sep;\n if (scalar.end) {\n sep = scalar.end;\n sep.push(this.sourceToken);\n delete scalar.end;\n }\n else\n sep = [this.sourceToken];\n const map = {\n type: 'block-map',\n offset: scalar.offset,\n indent: scalar.indent,\n items: [{ start, key: scalar, sep }]\n };\n this.onKeyLine = true;\n this.stack[this.stack.length - 1] = map;\n }\n else\n yield* this.lineEnd(scalar);\n }\n *blockScalar(scalar) {\n switch (this.type) {\n case 'space':\n case 'comment':\n case 'newline':\n scalar.props.push(this.sourceToken);\n return;\n case 'scalar':\n scalar.source = this.source;\n // block-scalar source includes trailing newline\n this.atNewLine = true;\n this.indent = 0;\n if (this.onNewLine) {\n let nl = this.source.indexOf('\\n') + 1;\n while (nl !== 0) {\n this.onNewLine(this.offset + nl);\n nl = this.source.indexOf('\\n', nl) + 1;\n }\n }\n yield* this.pop();\n break;\n /* istanbul ignore next should not happen */\n default:\n yield* this.pop();\n yield* this.step();\n }\n }\n *blockMap(map) {\n const it = map.items[map.items.length - 1];\n // it.sep is true-ish if pair already has key or : separator\n switch (this.type) {\n case 'newline':\n this.onKeyLine = false;\n if (it.value) {\n const end = 'end' in it.value ? it.value.end : undefined;\n const last = Array.isArray(end) ? end[end.length - 1] : undefined;\n if (last?.type === 'comment')\n end?.push(this.sourceToken);\n else\n map.items.push({ start: [this.sourceToken] });\n }\n else if (it.sep) {\n it.sep.push(this.sourceToken);\n }\n else {\n it.start.push(this.sourceToken);\n }\n return;\n case 'space':\n case 'comment':\n if (it.value) {\n map.items.push({ start: [this.sourceToken] });\n }\n else if (it.sep) {\n it.sep.push(this.sourceToken);\n }\n else {\n if (this.atIndentedComment(it.start, map.indent)) {\n const prev = map.items[map.items.length - 2];\n const end = prev?.value?.end;\n if (Array.isArray(end)) {\n arrayPushArray(end, it.start);\n end.push(this.sourceToken);\n map.items.pop();\n return;\n }\n }\n it.start.push(this.sourceToken);\n }\n return;\n }\n if (this.indent >= map.indent) {\n const atMapIndent = !this.onKeyLine && this.indent === map.indent;\n const atNextItem = atMapIndent &&\n (it.sep || it.explicitKey) &&\n this.type !== 'seq-item-ind';\n // For empty nodes, assign newline-separated not indented empty tokens to following node\n let start = [];\n if (atNextItem && it.sep && !it.value) {\n const nl = [];\n for (let i = 0; i < it.sep.length; ++i) {\n const st = it.sep[i];\n switch (st.type) {\n case 'newline':\n nl.push(i);\n break;\n case 'space':\n break;\n case 'comment':\n if (st.indent > map.indent)\n nl.length = 0;\n break;\n default:\n nl.length = 0;\n }\n }\n if (nl.length >= 2)\n start = it.sep.splice(nl[1]);\n }\n switch (this.type) {\n case 'anchor':\n case 'tag':\n if (atNextItem || it.value) {\n start.push(this.sourceToken);\n map.items.push({ start });\n this.onKeyLine = true;\n }\n else if (it.sep) {\n it.sep.push(this.sourceToken);\n }\n else {\n it.start.push(this.sourceToken);\n }\n return;\n case 'explicit-key-ind':\n if (!it.sep && !it.explicitKey) {\n it.start.push(this.sourceToken);\n it.explicitKey = true;\n }\n else if (atNextItem || it.value) {\n start.push(this.sourceToken);\n map.items.push({ start, explicitKey: true });\n }\n else {\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start: [this.sourceToken], explicitKey: true }]\n });\n }\n this.onKeyLine = true;\n return;\n case 'map-value-ind':\n if (it.explicitKey) {\n if (!it.sep) {\n if (includesToken(it.start, 'newline')) {\n Object.assign(it, { key: null, sep: [this.sourceToken] });\n }\n else {\n const start = getFirstKeyStartProps(it.start);\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key: null, sep: [this.sourceToken] }]\n });\n }\n }\n else if (it.value) {\n map.items.push({ start: [], key: null, sep: [this.sourceToken] });\n }\n else if (includesToken(it.sep, 'map-value-ind')) {\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key: null, sep: [this.sourceToken] }]\n });\n }\n else if (isFlowToken(it.key) &&\n !includesToken(it.sep, 'newline')) {\n const start = getFirstKeyStartProps(it.start);\n const key = it.key;\n const sep = it.sep;\n sep.push(this.sourceToken);\n // @ts-expect-error type guard is wrong here\n delete it.key;\n // @ts-expect-error type guard is wrong here\n delete it.sep;\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key, sep }]\n });\n }\n else if (start.length > 0) {\n // Not actually at next item\n it.sep = it.sep.concat(start, this.sourceToken);\n }\n else {\n it.sep.push(this.sourceToken);\n }\n }\n else {\n if (!it.sep) {\n Object.assign(it, { key: null, sep: [this.sourceToken] });\n }\n else if (it.value || atNextItem) {\n map.items.push({ start, key: null, sep: [this.sourceToken] });\n }\n else if (includesToken(it.sep, 'map-value-ind')) {\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start: [], key: null, sep: [this.sourceToken] }]\n });\n }\n else {\n it.sep.push(this.sourceToken);\n }\n }\n this.onKeyLine = true;\n return;\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar': {\n const fs = this.flowScalar(this.type);\n if (atNextItem || it.value) {\n map.items.push({ start, key: fs, sep: [] });\n this.onKeyLine = true;\n }\n else if (it.sep) {\n this.stack.push(fs);\n }\n else {\n Object.assign(it, { key: fs, sep: [] });\n this.onKeyLine = true;\n }\n return;\n }\n default: {\n const bv = this.startBlockValue(map);\n if (bv) {\n if (bv.type === 'block-seq') {\n if (!it.explicitKey &&\n it.sep &&\n !includesToken(it.sep, 'newline')) {\n yield* this.pop({\n type: 'error',\n offset: this.offset,\n message: 'Unexpected block-seq-ind on same line with key',\n source: this.source\n });\n return;\n }\n }\n else if (atMapIndent) {\n map.items.push({ start });\n }\n this.stack.push(bv);\n return;\n }\n }\n }\n }\n yield* this.pop();\n yield* this.step();\n }\n *blockSequence(seq) {\n const it = seq.items[seq.items.length - 1];\n switch (this.type) {\n case 'newline':\n if (it.value) {\n const end = 'end' in it.value ? it.value.end : undefined;\n const last = Array.isArray(end) ? end[end.length - 1] : undefined;\n if (last?.type === 'comment')\n end?.push(this.sourceToken);\n else\n seq.items.push({ start: [this.sourceToken] });\n }\n else\n it.start.push(this.sourceToken);\n return;\n case 'space':\n case 'comment':\n if (it.value)\n seq.items.push({ start: [this.sourceToken] });\n else {\n if (this.atIndentedComment(it.start, seq.indent)) {\n const prev = seq.items[seq.items.length - 2];\n const end = prev?.value?.end;\n if (Array.isArray(end)) {\n arrayPushArray(end, it.start);\n end.push(this.sourceToken);\n seq.items.pop();\n return;\n }\n }\n it.start.push(this.sourceToken);\n }\n return;\n case 'anchor':\n case 'tag':\n if (it.value || this.indent <= seq.indent)\n break;\n it.start.push(this.sourceToken);\n return;\n case 'seq-item-ind':\n if (this.indent !== seq.indent)\n break;\n if (it.value || includesToken(it.start, 'seq-item-ind'))\n seq.items.push({ start: [this.sourceToken] });\n else\n it.start.push(this.sourceToken);\n return;\n }\n if (this.indent > seq.indent) {\n const bv = this.startBlockValue(seq);\n if (bv) {\n this.stack.push(bv);\n return;\n }\n }\n yield* this.pop();\n yield* this.step();\n }\n *flowCollection(fc) {\n const it = fc.items[fc.items.length - 1];\n if (this.type === 'flow-error-end') {\n let top;\n do {\n yield* this.pop();\n top = this.peek(1);\n } while (top?.type === 'flow-collection');\n }\n else if (fc.end.length === 0) {\n switch (this.type) {\n case 'comma':\n case 'explicit-key-ind':\n if (!it || it.sep)\n fc.items.push({ start: [this.sourceToken] });\n else\n it.start.push(this.sourceToken);\n return;\n case 'map-value-ind':\n if (!it || it.value)\n fc.items.push({ start: [], key: null, sep: [this.sourceToken] });\n else if (it.sep)\n it.sep.push(this.sourceToken);\n else\n Object.assign(it, { key: null, sep: [this.sourceToken] });\n return;\n case 'space':\n case 'comment':\n case 'newline':\n case 'anchor':\n case 'tag':\n if (!it || it.value)\n fc.items.push({ start: [this.sourceToken] });\n else if (it.sep)\n it.sep.push(this.sourceToken);\n else\n it.start.push(this.sourceToken);\n return;\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar': {\n const fs = this.flowScalar(this.type);\n if (!it || it.value)\n fc.items.push({ start: [], key: fs, sep: [] });\n else if (it.sep)\n this.stack.push(fs);\n else\n Object.assign(it, { key: fs, sep: [] });\n return;\n }\n case 'flow-map-end':\n case 'flow-seq-end':\n fc.end.push(this.sourceToken);\n return;\n }\n const bv = this.startBlockValue(fc);\n /* istanbul ignore else should not happen */\n if (bv)\n this.stack.push(bv);\n else {\n yield* this.pop();\n yield* this.step();\n }\n }\n else {\n const parent = this.peek(2);\n if (parent.type === 'block-map' &&\n ((this.type === 'map-value-ind' && parent.indent === fc.indent) ||\n (this.type === 'newline' &&\n !parent.items[parent.items.length - 1].sep))) {\n yield* this.pop();\n yield* this.step();\n }\n else if (this.type === 'map-value-ind' &&\n parent.type !== 'flow-collection') {\n const prev = getPrevProps(parent);\n const start = getFirstKeyStartProps(prev);\n fixFlowSeqItems(fc);\n const sep = fc.end.splice(1, fc.end.length);\n sep.push(this.sourceToken);\n const map = {\n type: 'block-map',\n offset: fc.offset,\n indent: fc.indent,\n items: [{ start, key: fc, sep }]\n };\n this.onKeyLine = true;\n this.stack[this.stack.length - 1] = map;\n }\n else {\n yield* this.lineEnd(fc);\n }\n }\n }\n flowScalar(type) {\n if (this.onNewLine) {\n let nl = this.source.indexOf('\\n') + 1;\n while (nl !== 0) {\n this.onNewLine(this.offset + nl);\n nl = this.source.indexOf('\\n', nl) + 1;\n }\n }\n return {\n type,\n offset: this.offset,\n indent: this.indent,\n source: this.source\n };\n }\n startBlockValue(parent) {\n switch (this.type) {\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n return this.flowScalar(this.type);\n case 'block-scalar-header':\n return {\n type: 'block-scalar',\n offset: this.offset,\n indent: this.indent,\n props: [this.sourceToken],\n source: ''\n };\n case 'flow-map-start':\n case 'flow-seq-start':\n return {\n type: 'flow-collection',\n offset: this.offset,\n indent: this.indent,\n start: this.sourceToken,\n items: [],\n end: []\n };\n case 'seq-item-ind':\n return {\n type: 'block-seq',\n offset: this.offset,\n indent: this.indent,\n items: [{ start: [this.sourceToken] }]\n };\n case 'explicit-key-ind': {\n this.onKeyLine = true;\n const prev = getPrevProps(parent);\n const start = getFirstKeyStartProps(prev);\n start.push(this.sourceToken);\n return {\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, explicitKey: true }]\n };\n }\n case 'map-value-ind': {\n this.onKeyLine = true;\n const prev = getPrevProps(parent);\n const start = getFirstKeyStartProps(prev);\n return {\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key: null, sep: [this.sourceToken] }]\n };\n }\n }\n return null;\n }\n atIndentedComment(start, indent) {\n if (this.type !== 'comment')\n return false;\n if (this.indent <= indent)\n return false;\n return start.every(st => st.type === 'newline' || st.type === 'space');\n }\n *documentEnd(docEnd) {\n if (this.type !== 'doc-mode') {\n if (docEnd.end)\n docEnd.end.push(this.sourceToken);\n else\n docEnd.end = [this.sourceToken];\n if (this.type === 'newline')\n yield* this.pop();\n }\n }\n *lineEnd(token) {\n switch (this.type) {\n case 'comma':\n case 'doc-start':\n case 'doc-end':\n case 'flow-seq-end':\n case 'flow-map-end':\n case 'map-value-ind':\n yield* this.pop();\n yield* this.step();\n break;\n case 'newline':\n this.onKeyLine = false;\n // fallthrough\n case 'space':\n case 'comment':\n default:\n // all other values are errors\n if (token.end)\n token.end.push(this.sourceToken);\n else\n token.end = [this.sourceToken];\n if (this.type === 'newline')\n yield* this.pop();\n }\n }\n}\n\nexports.Parser = Parser;\n","'use strict';\n\nvar composer = require('./compose/composer.js');\nvar Document = require('./doc/Document.js');\nvar errors = require('./errors.js');\nvar log = require('./log.js');\nvar identity = require('./nodes/identity.js');\nvar lineCounter = require('./parse/line-counter.js');\nvar parser = require('./parse/parser.js');\n\nfunction parseOptions(options) {\n const prettyErrors = options.prettyErrors !== false;\n const lineCounter$1 = options.lineCounter || (prettyErrors && new lineCounter.LineCounter()) || null;\n return { lineCounter: lineCounter$1, prettyErrors };\n}\n/**\n * Parse the input as a stream of YAML documents.\n *\n * Documents should be separated from each other by `...` or `---` marker lines.\n *\n * @returns If an empty `docs` array is returned, it will be of type\n * EmptyStream and contain additional stream information. In\n * TypeScript, you should use `'empty' in docs` as a type guard for it.\n */\nfunction parseAllDocuments(source, options = {}) {\n const { lineCounter, prettyErrors } = parseOptions(options);\n const parser$1 = new parser.Parser(lineCounter?.addNewLine);\n const composer$1 = new composer.Composer(options);\n const docs = Array.from(composer$1.compose(parser$1.parse(source)));\n if (prettyErrors && lineCounter)\n for (const doc of docs) {\n doc.errors.forEach(errors.prettifyError(source, lineCounter));\n doc.warnings.forEach(errors.prettifyError(source, lineCounter));\n }\n if (docs.length > 0)\n return docs;\n return Object.assign([], { empty: true }, composer$1.streamInfo());\n}\n/** Parse an input string into a single YAML.Document */\nfunction parseDocument(source, options = {}) {\n const { lineCounter, prettyErrors } = parseOptions(options);\n const parser$1 = new parser.Parser(lineCounter?.addNewLine);\n const composer$1 = new composer.Composer(options);\n // `doc` is always set by compose.end(true) at the very latest\n let doc = null;\n for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) {\n if (!doc)\n doc = _doc;\n else if (doc.options.logLevel !== 'silent') {\n doc.errors.push(new errors.YAMLParseError(_doc.range.slice(0, 2), 'MULTIPLE_DOCS', 'Source contains multiple documents; please use YAML.parseAllDocuments()'));\n break;\n }\n }\n if (prettyErrors && lineCounter) {\n doc.errors.forEach(errors.prettifyError(source, lineCounter));\n doc.warnings.forEach(errors.prettifyError(source, lineCounter));\n }\n return doc;\n}\nfunction parse(src, reviver, options) {\n let _reviver = undefined;\n if (typeof reviver === 'function') {\n _reviver = reviver;\n }\n else if (options === undefined && reviver && typeof reviver === 'object') {\n options = reviver;\n }\n const doc = parseDocument(src, options);\n if (!doc)\n return null;\n doc.warnings.forEach(warning => log.warn(doc.options.logLevel, warning));\n if (doc.errors.length > 0) {\n if (doc.options.logLevel !== 'silent')\n throw doc.errors[0];\n else\n doc.errors = [];\n }\n return doc.toJS(Object.assign({ reviver: _reviver }, options));\n}\nfunction stringify(value, replacer, options) {\n let _replacer = null;\n if (typeof replacer === 'function' || Array.isArray(replacer)) {\n _replacer = replacer;\n }\n else if (options === undefined && replacer) {\n options = replacer;\n }\n if (typeof options === 'string')\n options = options.length;\n if (typeof options === 'number') {\n const indent = Math.round(options);\n options = indent < 1 ? undefined : indent > 8 ? { indent: 8 } : { indent };\n }\n if (value === undefined) {\n const { keepUndefined } = options ?? replacer ?? {};\n if (!keepUndefined)\n return undefined;\n }\n if (identity.isDocument(value) && !_replacer)\n return value.toString(options);\n return new Document.Document(value, _replacer, options).toString(options);\n}\n\nexports.parse = parse;\nexports.parseAllDocuments = parseAllDocuments;\nexports.parseDocument = parseDocument;\nexports.stringify = stringify;\n","'use strict';\n\nvar composer = require('./compose/composer.js');\nvar Document = require('./doc/Document.js');\nvar Schema = require('./schema/Schema.js');\nvar errors = require('./errors.js');\nvar Alias = require('./nodes/Alias.js');\nvar identity = require('./nodes/identity.js');\nvar Pair = require('./nodes/Pair.js');\nvar Scalar = require('./nodes/Scalar.js');\nvar YAMLMap = require('./nodes/YAMLMap.js');\nvar YAMLSeq = require('./nodes/YAMLSeq.js');\nvar cst = require('./parse/cst.js');\nvar lexer = require('./parse/lexer.js');\nvar lineCounter = require('./parse/line-counter.js');\nvar parser = require('./parse/parser.js');\nvar publicApi = require('./public-api.js');\nvar visit = require('./visit.js');\n\n\n\nexports.Composer = composer.Composer;\nexports.Document = Document.Document;\nexports.Schema = Schema.Schema;\nexports.YAMLError = errors.YAMLError;\nexports.YAMLParseError = errors.YAMLParseError;\nexports.YAMLWarning = errors.YAMLWarning;\nexports.Alias = Alias.Alias;\nexports.isAlias = identity.isAlias;\nexports.isCollection = identity.isCollection;\nexports.isDocument = identity.isDocument;\nexports.isMap = identity.isMap;\nexports.isNode = identity.isNode;\nexports.isPair = identity.isPair;\nexports.isScalar = identity.isScalar;\nexports.isSeq = identity.isSeq;\nexports.Pair = Pair.Pair;\nexports.Scalar = Scalar.Scalar;\nexports.YAMLMap = YAMLMap.YAMLMap;\nexports.YAMLSeq = YAMLSeq.YAMLSeq;\nexports.CST = cst;\nexports.Lexer = lexer.Lexer;\nexports.LineCounter = lineCounter.LineCounter;\nexports.Parser = parser.Parser;\nexports.parse = publicApi.parse;\nexports.parseAllDocuments = publicApi.parseAllDocuments;\nexports.parseDocument = publicApi.parseDocument;\nexports.stringify = publicApi.stringify;\nexports.visit = visit.visit;\nexports.visitAsync = visit.visitAsync;\n","import { z } from 'zod';\n\n/**\n * Excalibur autonomy levels. Identical in Excalibur Core and Excalibur Enterprise.\n *\n * Level 0 — Review: AI does not modify code.\n * Level 1 — Assist: AI explains, suggests and helps, but does not produce automatic diffs\n * unless requested.\n * Level 2 — Propose Patch: AI generates a patch/diff, but does not apply it automatically.\n * Level 3 — Implement in Branch: AI creates or uses a local branch/worktree and modifies\n * code in isolation.\n * Level 4 — Full Agentic Workflow: AI executes a full workflow with phases, tools, tests\n * and outputs.\n */\nexport const AUTONOMY_LEVELS = {\n REVIEW: 0,\n ASSIST: 1,\n PROPOSE_PATCH: 2,\n IMPLEMENT_IN_BRANCH: 3,\n FULL_AGENTIC: 4,\n} as const;\n\nexport const autonomyLevelSchema = z.union([\n z.literal(0),\n z.literal(1),\n z.literal(2),\n z.literal(3),\n z.literal(4),\n]);\n\nexport type AutonomyLevel = z.infer<typeof autonomyLevelSchema>;\n\nexport const AUTONOMY_LEVEL_LABELS: Record<AutonomyLevel, string> = {\n 0: 'Level 0 — Review',\n 1: 'Level 1 — Assist',\n 2: 'Level 2 — Propose Patch',\n 3: 'Level 3 — Implement in Branch',\n 4: 'Level 4 — Full Agentic Workflow',\n};\n\nexport const AUTONOMY_LEVEL_DESCRIPTIONS: Record<AutonomyLevel, string> = {\n 0: 'AI does not modify code.',\n 1: 'AI explains, suggests and helps, but does not produce automatic diffs unless requested.',\n 2: 'AI generates a patch/diff, but does not apply it automatically.',\n 3: 'AI creates or uses a local branch/worktree and modifies code in isolation.',\n 4: 'AI executes a full workflow with phases, tools, tests and outputs.',\n};\n\nexport function isAutonomyLevel(value: unknown): value is AutonomyLevel {\n return autonomyLevelSchema.safeParse(value).success;\n}\n","import { z } from 'zod';\n\n/**\n * Domain enums shared across Excalibur Core packages and reused by Excalibur Enterprise.\n * These are contract values: renaming or removing a member is a breaking change for\n * Enterprise ingestion, the CLI and stored artifacts.\n */\n\nexport const executionStyleSchema = z.enum([\n 'fast',\n 'team_default',\n 'careful',\n 'structured',\n 'explore',\n 'custom',\n]);\nexport type ExecutionStyle = z.infer<typeof executionStyleSchema>;\n\nexport const outputTypeSchema = z.enum([\n 'branch',\n 'pull_request',\n 'patch',\n 'review',\n 'plan',\n 'alternatives',\n]);\nexport type OutputType = z.infer<typeof outputTypeSchema>;\n\nexport const runStatusSchema = z.enum([\n 'queued',\n 'running',\n 'waiting_approval',\n 'completed',\n 'failed',\n 'cancelled',\n]);\nexport type RunStatus = z.infer<typeof runStatusSchema>;\n\nexport const phaseStatusSchema = z.enum([\n 'queued',\n 'running',\n 'waiting_approval',\n 'completed',\n 'failed',\n 'skipped',\n]);\nexport type PhaseStatus = z.infer<typeof phaseStatusSchema>;\n\nexport const agentRoleSchema = z.enum([\n 'planner',\n 'architect',\n 'implementer',\n 'reviewer',\n 'tester',\n 'security',\n 'release',\n 'product_strategist',\n 'customer_researcher',\n 'discovery_reviewer',\n 'ux_reviewer',\n 'growth_reviewer',\n 'scope_guardian',\n 'custom',\n]);\nexport type AgentRole = z.infer<typeof agentRoleSchema>;\n\nexport const workflowModeSchema = z.enum([\n 'fast',\n 'standard',\n 'structured',\n 'explore',\n 'review',\n 'discovery',\n 'custom',\n]);\nexport type WorkflowMode = z.infer<typeof workflowModeSchema>;\n\n/**\n * Workflow phase types. Superset of the Enterprise workflow spec (§8) plus the\n * `apply_patch` phase type introduced by the OSS workflow catalog and the\n * `discovery_questions` phase type introduced by the Discovery methodology.\n */\nexport const phaseTypeSchema = z.enum([\n 'assistant_interaction',\n 'patch_generation',\n 'agent_output',\n 'agent_work',\n 'agent_review',\n 'command_group',\n 'human_approval',\n 'pull_request',\n 'apply_patch',\n 'discovery_questions',\n 'custom',\n]);\nexport type PhaseType = z.infer<typeof phaseTypeSchema>;\n\nexport const testStatusSchema = z.enum(['not_run', 'passed', 'failed', 'partial']);\nexport type TestStatus = z.infer<typeof testStatusSchema>;\n\nexport const riskLevelSchema = z.enum(['low', 'medium', 'high', 'unknown']);\nexport type RiskLevel = z.infer<typeof riskLevelSchema>;\n\nexport const policyDecisionSchema = z.enum(['allow', 'deny', 'redact', 'require_approval']);\nexport type PolicyDecisionValue = z.infer<typeof policyDecisionSchema>;\n","import { randomUUID } from 'node:crypto';\nimport { z } from 'zod';\n\n/**\n * Canonical Excalibur event format (OSS spec §12).\n *\n * This is THE shared contract between Excalibur Core and Excalibur Enterprise:\n * local runs write these events to `.excalibur/runs/<run-id>/events.jsonl` and\n * Enterprise ingests the exact same shape (mapping `type` onto its AgentEvent\n * enum while preserving the original value in `payload.sourceType`).\n *\n * Changing or removing an event type is a breaking change for Enterprise ingestion.\n */\nexport const excaliburEventTypeSchema = z.enum([\n 'run_started',\n 'run_completed',\n 'workflow_selected',\n 'methodology_selected',\n 'phase_started',\n 'phase_completed',\n 'assistant_message',\n 'model_call',\n 'tool_call',\n 'file_read',\n 'file_write',\n 'command_started',\n 'command_completed',\n 'test_result',\n 'patch_generated',\n 'patch_applied',\n 'branch_created',\n 'approval_requested',\n 'approval_approved',\n 'approval_rejected',\n 'policy_decision',\n 'error',\n 'artifact_created',\n 'compaction',\n 'task_update',\n 'verification',\n 'claim',\n 'diagnostics',\n 'provenance',\n 'network_egress',\n]);\nexport type ExcaliburEventType = z.infer<typeof excaliburEventTypeSchema>;\n\nexport const excaliburEventSchema = z.object({\n id: z.string().min(1),\n runId: z.string().min(1).nullable(),\n type: excaliburEventTypeSchema,\n timestamp: z.string().datetime({ offset: true }),\n /** Optional attribution, used by multi-phase / multi-session runs. */\n phaseId: z.string().min(1).nullish(),\n sessionId: z.string().min(1).nullish(),\n payload: z.record(z.unknown()),\n});\nexport type ExcaliburEvent = z.infer<typeof excaliburEventSchema>;\n\n/** A single item in the agent's in-session checklist (the `task_update` event). */\nexport const taskItemSchema = z.object({\n id: z.string().min(1),\n text: z.string(),\n status: z.enum(['pending', 'in_progress', 'completed']),\n});\nexport type TaskItem = z.infer<typeof taskItemSchema>;\n\n/**\n * Payload of a `task_update` event (event #25): a full SNAPSHOT of the agent's\n * live checklist for the current request — last snapshot wins. Modeled as an\n * event (not ephemeral UI state) so the checklist is replayable, forkable and\n * auditable, which Claude Code's TodoWrite is not.\n */\nexport const taskUpdatePayloadSchema = z.object({ tasks: z.array(taskItemSchema) });\nexport type TaskUpdatePayload = z.infer<typeof taskUpdatePayloadSchema>;\n\n/** A single adversarial finding within a `verification` event. */\nexport const verificationIssueSchema = z.object({\n lens: z.string(),\n severity: z.enum(['high', 'medium', 'low']),\n file: z.string().optional(),\n problem: z.string(),\n fix: z.string().optional(),\n});\nexport type VerificationIssue = z.infer<typeof verificationIssueSchema>;\n\n/**\n * Payload of a `verification` event (event #26): the verdict of the adversarial\n * Verification Mesh over a run's diff. A first-class event (not overloaded onto\n * `error`/`test_result`) so the verdict is replayable, forkable and auditable,\n * and Enterprise can map it to its own audit type. `blocked: true` means a\n * surviving HIGH-severity issue gated the run from `completed` (→ needs-fix).\n */\nexport const verificationPayloadSchema = z.object({\n blocked: z.boolean(),\n lenses: z.array(z.string()),\n issues: z.array(verificationIssueSchema),\n summary: z.string(),\n});\nexport type VerificationPayload = z.infer<typeof verificationPayloadSchema>;\n\n/**\n * Payload of a `claim` event (event #27): one entry of the CLAIM LEDGER. A claim\n * the model made (or the run implies) about its work — `tests_pass`,\n * `no_type_errors`, `no_secrets`, `builds`, `requirement_met` — AUTO-VERIFIED\n * against real tool evidence (test exit codes, typecheck, a secret scan of the\n * diff) and stamped verified|refuted|unverified. `asserted` = the model actually\n * claimed it; a `refuted` + `asserted` claim is the model LYING — that blocks the\n * run. Evidence-linked + replayable → leapfrogs an LLM-judge grader.\n */\nexport const claimPayloadSchema = z.object({\n kind: z.string(),\n statement: z.string(),\n status: z.enum(['verified', 'refuted', 'unverified']),\n /** Did the model itself assert this (vs. an implied run-level claim)? */\n asserted: z.boolean(),\n /** What was checked + the result (e.g. \"test command exit 1\"). */\n evidence: z.string().optional(),\n});\nexport type ClaimPayload = z.infer<typeof claimPayloadSchema>;\n\n/**\n * Payload of a `diagnostics` event (event #28): real compiler diagnostics from a\n * Language Server for a file the agent JUST edited (P1.10 / M3). Emitted after a\n * `write_file`/`apply_patch`; the same errors are fed back to the model so it\n * self-corrects on the next turn. Lines/columns are 1-based (human/editor\n * convention; converted from LSP's 0-based positions).\n */\nexport const diagnosticItemSchema = z.object({\n line: z.number().int().nonnegative(),\n column: z.number().int().nonnegative(),\n severity: z.enum(['error', 'warning', 'info', 'hint']),\n message: z.string(),\n code: z.string().optional(),\n});\nexport type DiagnosticItem = z.infer<typeof diagnosticItemSchema>;\n\nexport const diagnosticsPayloadSchema = z.object({\n /** Repo-relative path of the edited file. */\n file: z.string(),\n diagnostics: z.array(diagnosticItemSchema),\n errorCount: z.number().int().nonnegative(),\n warningCount: z.number().int().nonnegative(),\n});\nexport type DiagnosticsPayload = z.infer<typeof diagnosticsPayloadSchema>;\n\n/**\n * Payload of a `provenance` event (event #29, F8): the audited record of one\n * piece of UNTRUSTED inbound content (a fetched page / MCP output) the model saw\n * — its source, URL, content hash, and prompt-injection verdict. Gives a run a\n * verifiable trail of every external source and whether it was flagged/quarantined.\n */\nexport const provenancePayloadSchema = z.object({\n source: z.enum(['web_fetch', 'web_search', 'web_extract', 'web_crawl', 'research', 'mcp']),\n url: z.string().optional(),\n /** sha256 of the original fetched content. */\n contentHash: z.string(),\n fetchedAt: z.string(),\n verdict: z.enum(['clean', 'suspicious', 'malicious']),\n signals: z.array(z.string()),\n /** True when the content was quarantined out of the model context. */\n blocked: z.boolean(),\n});\nexport type ProvenancePayload = z.infer<typeof provenancePayloadSchema>;\n\n/**\n * Payload of a `network_egress` event (event #30, F8): the audit trail of an\n * agent-initiated outbound network call — which tool, the target, and the policy\n * decision. Complements `provenance` (which audits the CONTENT) by auditing the\n * EGRESS itself (including searches and denied attempts that fetch no content).\n */\nexport const networkEgressPayloadSchema = z.object({\n tool: z.string(),\n /** The target URL or, for search/research, the query. */\n target: z.string(),\n decision: z.enum(['allow', 'deny']),\n});\nexport type NetworkEgressPayload = z.infer<typeof networkEgressPayloadSchema>;\n\nexport interface CreateEventInput {\n runId: string | null;\n type: ExcaliburEventType;\n payload: Record<string, unknown>;\n phaseId?: string | null;\n sessionId?: string | null;\n}\n\nexport function createEvent(input: CreateEventInput): ExcaliburEvent {\n return {\n id: `evt_${randomUUID()}`,\n runId: input.runId,\n type: input.type,\n timestamp: new Date().toISOString(),\n phaseId: input.phaseId ?? null,\n sessionId: input.sessionId ?? null,\n payload: input.payload,\n };\n}\n\n/** Serializes an event as a single JSONL line (no trailing newline). */\nexport function serializeEventLine(event: ExcaliburEvent): string {\n return JSON.stringify(event);\n}\n\n/**\n * Parses an `events.jsonl` document. Throws a ZodError (with the offending line\n * number attached to the message) when a line does not match the contract.\n */\nexport function parseEventsJsonl(content: string): ExcaliburEvent[] {\n const events: ExcaliburEvent[] = [];\n const lines = content.split('\\n');\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]?.trim();\n if (!line) continue;\n let parsed: unknown;\n try {\n parsed = JSON.parse(line);\n } catch (error) {\n throw new Error(`events.jsonl line ${i + 1} is not valid JSON: ${(error as Error).message}`);\n }\n const result = excaliburEventSchema.safeParse(parsed);\n if (!result.success) {\n throw new Error(\n `events.jsonl line ${i + 1} does not match the Excalibur event contract: ${result.error.message}`,\n );\n }\n events.push(result.data);\n }\n return events;\n}\n","import { z } from 'zod';\nimport { AUTONOMY_LEVELS, autonomyLevelSchema, type AutonomyLevel } from './autonomy';\n\n/**\n * Discovery contract (Discovery spec §9, §20, §21).\n *\n * Discovery is the lightweight pre-work methodology that clarifies ideas, tickets,\n * feedback or technical initiatives before implementation. The scoring and\n * recommendation logic is DETERMINISTIC and lives here so that Excalibur Core\n * (local CLI sessions) and Excalibur Enterprise (DiscoverySession services) apply\n * exactly the same explainable rules. AI may phrase summaries; it never decides.\n */\n\nexport const discoveryInputTypeSchema = z.enum([\n 'idea',\n 'work_item',\n 'customer_feedback',\n 'technical_initiative',\n 'incident',\n 'agent_readiness',\n 'mvp_scope',\n 'other',\n]);\nexport type DiscoveryInputType = z.infer<typeof discoveryInputTypeSchema>;\n\nexport const discoverySourceSchema = z.enum([\n 'web',\n 'cli',\n 'slack',\n 'teams',\n 'linear',\n 'jira',\n 'github',\n 'gitlab',\n]);\nexport type DiscoverySource = z.infer<typeof discoverySourceSchema>;\n\nexport const discoveryRecommendationSchema = z.enum([\n 'build_now',\n 'refine_first',\n 'split_scope',\n 'customer_validation',\n 'prototype',\n 'technical_spike',\n 'plan_only',\n 'patch_ready',\n 'agent_run_ready',\n 'do_not_build',\n]);\nexport type DiscoveryRecommendation = z.infer<typeof discoveryRecommendationSchema>;\n\nexport const discoveryScoreSchema = z.enum(['low', 'medium', 'high']);\nexport type DiscoveryScore = z.infer<typeof discoveryScoreSchema>;\n\nexport const agentReadinessSchema = z.enum([\n 'not_ready',\n 'plan_only',\n 'patch_ready',\n 'implementation_ready',\n]);\nexport type AgentReadiness = z.infer<typeof agentReadinessSchema>;\n\n/** Readiness → allowed autonomy levels (Discovery spec §9). */\nexport const AGENT_READINESS_TO_AUTONOMY: Record<AgentReadiness, readonly AutonomyLevel[]> = {\n not_ready: [AUTONOMY_LEVELS.REVIEW],\n plan_only: [AUTONOMY_LEVELS.REVIEW, AUTONOMY_LEVELS.ASSIST],\n patch_ready: [AUTONOMY_LEVELS.PROPOSE_PATCH],\n implementation_ready: [AUTONOMY_LEVELS.IMPLEMENT_IN_BRANCH, AUTONOMY_LEVELS.FULL_AGENTIC],\n};\n\nexport interface DiscoveryScores {\n problemClarity: DiscoveryScore;\n userEvidence: DiscoveryScore;\n scopeClarity: DiscoveryScore;\n technicalRisk: DiscoveryScore;\n}\n\nexport interface DiscoveryAnswerEntry {\n key: string;\n question: string;\n answer: string | null;\n}\n\n/** Local discovery.json record (Discovery spec §18). */\nexport const discoveryRecordSchema = z.object({\n id: z.string().min(1),\n title: z.string().min(1),\n inputType: discoveryInputTypeSchema,\n source: discoverySourceSchema,\n status: z.enum(['open', 'completed', 'cancelled']),\n recommendation: discoveryRecommendationSchema.nullable(),\n problemClarity: discoveryScoreSchema.nullable(),\n userEvidence: discoveryScoreSchema.nullable(),\n scopeClarity: discoveryScoreSchema.nullable(),\n technicalRisk: discoveryScoreSchema.nullable(),\n agentReadiness: agentReadinessSchema.nullable(),\n recommendedAutonomyLevel: autonomyLevelSchema.nullable(),\n createdAt: z.string().datetime({ offset: true }),\n completedAt: z.string().datetime({ offset: true }).nullable(),\n});\nexport type DiscoveryRecord = z.infer<typeof discoveryRecordSchema>;\n\nexport const DISCOVERY_ARTIFACT_FILES = [\n 'input.md',\n 'transcript.md',\n 'discovery-summary.md',\n 'refined-ticket.md',\n 'acceptance-criteria.md',\n 'mvp-scope.md',\n 'readiness-assessment.md',\n 'recommendation.md',\n 'discovery.json',\n] as const;\n\nconst SENSITIVE_HINTS = [\n 'auth',\n 'billing',\n 'payment',\n 'migration',\n 'security',\n 'secret',\n 'pii',\n 'compliance',\n 'legal',\n 'escrow',\n];\n\nconst SUBSTANTIAL_ANSWER = 30;\n\nfunction answerFor(answers: DiscoveryAnswerEntry[], ...keys: string[]): string {\n for (const key of keys) {\n const found = answers.find((a) => a.key === key);\n if (found?.answer && found.answer.trim().length > 0) return found.answer.trim();\n }\n return '';\n}\n\nfunction mentionsSensitive(text: string): boolean {\n const lower = text.toLowerCase();\n return SENSITIVE_HINTS.some((hint) => lower.includes(hint));\n}\n\n/**\n * Deterministic transcript scoring (Discovery spec §9). Question keys follow the\n * default question packs: problem, user, current_workaround, urgency, mvp,\n * out_of_scope, success, evidence, risks, readiness (packs may add more; scoring\n * only inspects these well-known keys plus the raw input).\n */\nexport function scoreDiscoveryTranscript(input: {\n inputType: DiscoveryInputType;\n inputMarkdown: string;\n answers: DiscoveryAnswerEntry[];\n}): DiscoveryScores & { agentReadiness: AgentReadiness; touchesSensitivePaths: boolean } {\n const { answers } = input;\n\n const problem = answerFor(answers, 'problem');\n const user = answerFor(answers, 'user', 'target_user');\n const problemSubstantial = problem.length >= SUBSTANTIAL_ANSWER;\n const userSubstantial = user.length >= SUBSTANTIAL_ANSWER;\n const problemClarity: DiscoveryScore =\n problemSubstantial && userSubstantial\n ? 'high'\n : problem.length > 0 || user.length > 0\n ? 'medium'\n : 'low';\n\n const evidence = answerFor(answers, 'evidence');\n const hasQuantifiedEvidence =\n /\\d/.test(evidence) || /customer|user|client|ticket/i.test(evidence);\n const userEvidence: DiscoveryScore =\n evidence.length >= SUBSTANTIAL_ANSWER && hasQuantifiedEvidence\n ? 'high'\n : evidence.length > 0\n ? 'medium'\n : 'low';\n\n const mvp = answerFor(answers, 'mvp');\n const outOfScope = answerFor(answers, 'out_of_scope');\n const scopeClarity: DiscoveryScore =\n mvp.length > 0 && outOfScope.length > 0 ? 'high' : mvp.length > 0 ? 'medium' : 'low';\n\n const allText = [input.inputMarkdown, ...answers.map((a) => a.answer ?? '')].join('\\n');\n const risks = answerFor(answers, 'risks', 'readiness');\n const touchesSensitivePaths = mentionsSensitive(allText);\n const technicalRisk: DiscoveryScore = touchesSensitivePaths\n ? 'high'\n : /unknown|unsure|not sure|no idea|risky/i.test(risks)\n ? 'medium'\n : risks.length > 0 || scopeClarity === 'high'\n ? 'low'\n : 'medium';\n\n let agentReadiness: AgentReadiness;\n if (scopeClarity === 'high' && problemClarity !== 'low' && technicalRisk === 'low') {\n agentReadiness = 'implementation_ready';\n } else if (scopeClarity !== 'low' && technicalRisk !== 'high') {\n agentReadiness = 'patch_ready';\n } else if (problemClarity !== 'low') {\n agentReadiness = 'plan_only';\n } else {\n agentReadiness = 'not_ready';\n }\n\n return {\n problemClarity,\n userEvidence,\n scopeClarity,\n technicalRisk,\n agentReadiness,\n touchesSensitivePaths,\n };\n}\n\nexport interface DiscoveryRecommendationInput extends DiscoveryScores {\n inputType: DiscoveryInputType;\n agentReadiness: AgentReadiness;\n touchesSensitivePaths?: boolean;\n}\n\nexport interface DiscoveryRecommendationResult {\n recommendation: DiscoveryRecommendation;\n recommendedAutonomyLevel: AutonomyLevel;\n reasons: string[];\n}\n\n/**\n * Deterministic recommendation rules, evaluated in priority order (Discovery spec §21).\n */\nexport function recommendFromScores(\n input: DiscoveryRecommendationInput,\n): DiscoveryRecommendationResult {\n const reasons: string[] = [];\n let recommendation: DiscoveryRecommendation;\n\n if (input.problemClarity === 'low') {\n recommendation = 'refine_first';\n reasons.push('Problem clarity is low — the target user or problem is not yet clear.');\n } else if (input.inputType === 'customer_feedback' && input.userEvidence === 'low') {\n recommendation = 'customer_validation';\n reasons.push('Customer feedback with low evidence — validate with customers before building.');\n } else if (input.inputType === 'idea' && input.userEvidence === 'low') {\n recommendation = 'prototype';\n reasons.push(\n 'Product idea with low user evidence — a lightweight prototype is cheaper than a full build.',\n );\n } else if (input.scopeClarity === 'low') {\n recommendation = 'split_scope';\n reasons.push('Scope clarity is low — split or refine the scope before implementation.');\n } else if (input.technicalRisk === 'high') {\n recommendation = input.touchesSensitivePaths ? 'plan_only' : 'technical_spike';\n reasons.push(\n input.touchesSensitivePaths\n ? 'High technical risk touching sensitive areas — plan first, with human approval gates.'\n : 'High technical risk — run a technical spike before committing to delivery.',\n );\n } else if (input.agentReadiness === 'not_ready') {\n recommendation = 'refine_first';\n reasons.push('The task is not ready for AI execution — refine it first.');\n } else if (input.agentReadiness === 'plan_only') {\n recommendation = 'plan_only';\n reasons.push('AI can plan this safely, but should not modify code yet.');\n } else if (input.agentReadiness === 'patch_ready') {\n recommendation = 'patch_ready';\n reasons.push('AI can safely propose a patch; a human should review and apply it.');\n } else if (\n input.problemClarity === 'high' &&\n input.scopeClarity === 'high' &&\n input.technicalRisk === 'low'\n ) {\n recommendation = 'agent_run_ready';\n reasons.push('Clear problem, clear scope and low risk — ready for an agentic run.');\n } else {\n recommendation = 'build_now';\n reasons.push('The work is clear and valuable enough to proceed.');\n }\n\n let recommendedAutonomyLevel: AutonomyLevel;\n switch (input.agentReadiness) {\n case 'not_ready':\n recommendedAutonomyLevel = AUTONOMY_LEVELS.REVIEW;\n break;\n case 'plan_only':\n recommendedAutonomyLevel = AUTONOMY_LEVELS.ASSIST;\n break;\n case 'patch_ready':\n recommendedAutonomyLevel = AUTONOMY_LEVELS.PROPOSE_PATCH;\n break;\n case 'implementation_ready':\n if (input.touchesSensitivePaths) {\n recommendedAutonomyLevel = AUTONOMY_LEVELS.FULL_AGENTIC;\n reasons.push('Sensitive areas involved — use Level 4 with human approval gates.');\n } else {\n recommendedAutonomyLevel = AUTONOMY_LEVELS.IMPLEMENT_IN_BRANCH;\n }\n break;\n }\n\n return { recommendation, recommendedAutonomyLevel, reasons };\n}\n","/**\n * Excalibur error hierarchy (Build Contract §4.1).\n *\n * Every error thrown by an Excalibur package must be an `ExcaliburError`\n * subclass so that the CLI and Enterprise ingestion can rely on a stable,\n * machine-readable `code` plus optional structured `details`.\n */\nexport class ExcaliburError extends Error {\n /** Stable machine-readable error code (snake_case). */\n readonly code: string;\n /** Optional structured context for diagnostics; never include secrets. */\n readonly details?: Record<string, unknown>;\n\n constructor(message: string, code: string, details?: Record<string, unknown>) {\n super(message);\n this.name = new.target.name;\n this.code = code;\n if (details !== undefined) {\n this.details = details;\n }\n // Restore the prototype chain for ES5/CJS interop targets.\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Thrown when `.excalibur/config.yaml` (or a providers file) fails validation. */\nexport class ConfigValidationError extends ExcaliburError {\n constructor(message: string, details?: Record<string, unknown>) {\n super(message, 'config_validation', details);\n }\n}\n\n/** Thrown when a workflow or methodology definition fails validation. */\nexport class WorkflowValidationError extends ExcaliburError {\n constructor(message: string, details?: Record<string, unknown>) {\n super(message, 'workflow_validation', details);\n }\n}\n\n/** Thrown when a path, command or tool operation is denied by permissions. */\nexport class PermissionDeniedError extends ExcaliburError {\n constructor(message: string, details?: Record<string, unknown>) {\n super(message, 'permission_denied', details);\n }\n}\n\n/**\n * Thrown by model providers and sync clients. The default code is\n * `provider_error`; callers may narrow it (e.g. `provider_not_implemented`,\n * `sync_failed`) through `options.code`.\n */\nexport class ProviderError extends ExcaliburError {\n constructor(message: string, options?: { code?: string; details?: Record<string, unknown> }) {\n super(message, options?.code ?? 'provider_error', options?.details);\n }\n}\n\n/** Thrown when a run id does not resolve to a local run directory. */\nexport class RunNotFoundError extends ExcaliburError {\n constructor(message: string, details?: Record<string, unknown>) {\n super(message, 'run_not_found', details);\n }\n}\n\n/** Thrown when an `@excalibur` command mention cannot be parsed. */\nexport class CommandParseError extends ExcaliburError {\n constructor(message: string, details?: Record<string, unknown>) {\n super(message, 'command_parse', details);\n }\n}\n\n/** Narrowing helper for `catch (error: unknown)` blocks. */\nexport function isExcaliburError(value: unknown): value is ExcaliburError {\n return value instanceof ExcaliburError;\n}\n","import { z } from 'zod';\nimport { autonomyLevelSchema } from './autonomy';\nimport { executionStyleSchema, runStatusSchema } from './enums';\n\n/**\n * Provenance of a run created by forking another run from the time-machine: the\n * source run id and the step index the fork branched from (the cached prefix is\n * steps `0..atStep`). Present only on forked runs.\n */\nexport const forkOriginSchema = z.object({\n runId: z.string().min(1),\n /** Zero-based step index of the source run the fork branched from. */\n atStep: z.number().int().nonnegative(),\n});\nexport type ForkOrigin = z.infer<typeof forkOriginSchema>;\n\n/**\n * Local run artifact contract (OSS spec §11, Build Contract §4.1/§6).\n *\n * `run.json` inside `.excalibur/runs/<run-id>/` is a `RunRecord`. The record is\n * a superset of the OSS spec §11 example: the extra fields (`model`,\n * `executionStyle`, `methodology`, `completedAt`, `forkedFrom`) are nullable/\n * optional so older or minimal producers stay compatible.\n */\nexport const runRecordSchema = z.object({\n id: z.string().min(1),\n title: z.string().min(1),\n autonomyLevel: autonomyLevelSchema,\n workflow: z.string().min(1),\n methodology: z.string().nullable(),\n status: runStatusSchema,\n model: z.string().nullable(),\n executionStyle: executionStyleSchema.nullable(),\n /** ISO-8601 timestamp (UTC offset or `Z`). */\n startedAt: z.string().datetime({ offset: true }),\n completedAt: z.string().datetime({ offset: true }).nullable(),\n /**\n * Set when this run was created by forking another run from the time-machine.\n * Optional + nullable: ordinary runs omit it entirely (back-compatible).\n */\n forkedFrom: forkOriginSchema.nullable().optional(),\n /**\n * The work item this run executes against (work-item-centric cycle): runs and\n * agents are LINKED to a work item, so a work item can show its runs/patches.\n * Optional + nullable — ad-hoc runs omit it (back-compatible).\n */\n workItemId: z.string().nullable().optional(),\n});\nexport type RunRecord = z.infer<typeof runRecordSchema>;\n\n/** A run as stored on disk: its id, directory and parsed `run.json`. */\nexport interface LocalRun {\n id: string;\n dir: string;\n record: RunRecord;\n}\n\n/** Zod schema companion for `LocalRun` (useful for sync payload validation). */\nexport const localRunSchema = z.object({\n id: z.string().min(1),\n dir: z.string().min(1),\n record: runRecordSchema,\n});\n\n/**\n * Canonical artifact file names a local run may produce inside its run\n * directory (OSS spec §11). Not every workflow writes every file.\n */\nexport const RUN_ARTIFACT_FILES = [\n 'run.json',\n 'workflow.yaml',\n 'methodology.yaml',\n 'events.jsonl',\n 'model-calls.jsonl',\n 'input.md',\n 'context.md',\n 'diff.patch',\n 'summary.md',\n 'review.md',\n 'test-results.json',\n 'tests.log',\n 'pr-summary.md',\n] as const;\nexport type RunArtifactFile = (typeof RUN_ARTIFACT_FILES)[number];\n","import { z } from 'zod';\nimport { autonomyLevelSchema } from './autonomy';\nimport {\n instructionSourceFormatSchema,\n instructionSourceScopeSchema,\n trustLevelSchema,\n} from './instructions';\n\n/**\n * `.excalibur/config.yaml` schema (OSS spec §10 + §14, work-items spec §6,\n * onboarding spec §2, ISD spec §6). Every section is optional: a repository\n * without `.excalibur/` must still work on defaults.\n */\n\n/** Canonical detected commands (test/lint/typecheck/build). */\nexport const commandsConfigSchema = z.object({\n test: z.string().optional(),\n lint: z.string().optional(),\n typecheck: z.string().optional(),\n build: z.string().optional(),\n});\nexport type CommandsConfig = z.infer<typeof commandsConfigSchema>;\n\nconst projectSectionSchema = z.object({\n name: z.string().optional(),\n packageManager: z.string().optional(),\n languages: z.array(z.string()).optional(),\n frameworks: z.array(z.string()).optional(),\n /** Accepted alias; normalized into the top-level `commands` section. */\n commands: commandsConfigSchema.optional(),\n});\n\nconst safetySectionSchema = z.object({\n /** Safety preset id; `standard-safe` when unset (see DEFAULT_CONFIG). */\n preset: z.string().optional(),\n});\n\nconst autonomySectionSchema = z.object({\n default: autonomyLevelSchema.optional(),\n paths: z.record(autonomyLevelSchema).optional(),\n allowFullAgentic: z.array(z.string()).optional(),\n});\n\nconst workflowsSectionSchema = z.object({\n default: z.string().optional(),\n byTaskType: z.record(z.string()).optional(),\n byPath: z.record(z.string()).optional(),\n});\n\nconst modelsSectionSchema = z.object({\n default: z.string().optional(),\n byRole: z.record(z.string()).optional(),\n byPath: z.record(z.string()).optional(),\n});\n\n/**\n * Network egress policy (real, enforced — closes the old decorative\n * `tools.network` flag). Governs BOTH the web tools (`web_fetch`/`web_search`/…)\n * and network-capable shell commands (curl/wget/…). SSRF protection (loopback /\n * RFC1918 / link-local / cloud-metadata) is ALWAYS enforced regardless of mode —\n * it never blocks the public web, only dangerous internal targets.\n *\n * - `on` (default): any PUBLIC host (still SSRF-guarded) — the agent can research\n * the web out of the box; `approval: ask` adds a soft gate (skipped under the\n * session auto-accept), and the SSRF floor is the hard safety boundary.\n * - `allowlist`: only hosts matching `allowedDomains` (minimatch globs).\n * - `off`: no agent-initiated egress at all (lockdown).\n */\nexport const networkPolicySchema = z.object({\n mode: z.enum(['off', 'allowlist', 'on']).default('on'),\n /** Host globs permitted when `mode='allowlist'`, e.g. \"*.github.com\". */\n allowedDomains: z.array(z.string()).optional(),\n /** Hosts explicitly allowed to be private/loopback (e.g. a local SearXNG). */\n allowPrivateHosts: z.array(z.string()).optional(),\n /** Approval posture when a URL is permitted by mode: ask each time, or auto. */\n approval: z.enum(['ask', 'auto']).default('ask'),\n});\nexport type NetworkPolicy = z.infer<typeof networkPolicySchema>;\n\n/**\n * Network TRANSPORT config (distinct from `permissions.network`, which is the\n * egress POLICY). Corporate proxy + custom CA support: every outbound request\n * (web fetch, model gateway, MCP, enterprise-sync) funnels through Node's global\n * `fetch`, so the CLI installs one global undici dispatcher from this config +\n * the standard env vars at startup. Env vars (`HTTP(S)_PROXY`/`NO_PROXY`/\n * `NODE_EXTRA_CA_CERTS`) always WIN over config; config fills the gaps.\n */\nexport const networkTransportSchema = z.object({\n proxy: z\n .object({\n /** Proxy URL for http:// targets (fallback when HTTP_PROXY is unset). */\n http: z.string().optional(),\n /** Proxy URL for https:// targets (fallback when HTTPS_PROXY is unset). */\n https: z.string().optional(),\n /** Comma-separated no-proxy host list (fallback when NO_PROXY is unset). */\n noProxy: z.string().optional(),\n })\n .optional(),\n tls: z\n .object({\n /** Path to a PEM bundle of extra CA certs (corporate root CA / MITM proxy). */\n caFile: z.string().optional(),\n /** Set false ONLY to accept self-signed certs (insecure; warned loudly). */\n rejectUnauthorized: z.boolean().optional(),\n })\n .optional(),\n});\nexport type NetworkTransportConfig = z.infer<typeof networkTransportSchema>;\n\nexport const permissionsSectionSchema = z.object({\n tools: z.record(z.union([z.boolean(), z.literal('ask')])).optional(),\n blockedPaths: z.array(z.string()).optional(),\n allowedCommands: z.array(z.string()).optional(),\n /**\n * Command globs that are HARD-DENIED even if allowlisted (deny beats allow) —\n * a safety net for dangerous commands (e.g. `rm -rf *`, `git push --force`).\n * Matched (minimatch) against the normalized command.\n */\n deniedCommands: z.array(z.string()).optional(),\n network: networkPolicySchema.optional(),\n});\n\nconst approvalsSectionSchema = z.object({\n requiredFor: z\n .object({\n paths: z.array(z.string()).optional(),\n commands: z.array(z.string()).optional(),\n phases: z.array(z.string()).optional(),\n })\n .optional(),\n /**\n * Session auto-accept preference (minimum-friction mode). When `true`, the\n * interactive shell never prompts for edit/command approval (blocked paths\n * stay hard-denied). `undefined` = not chosen yet → the shell asks ONCE at\n * session start and persists the answer here, so it never asks again.\n */\n auto: z.boolean().optional(),\n});\n\nconst contextSectionSchema = z.object({\n include: z.array(z.string()).optional(),\n exclude: z.array(z.string()).optional(),\n});\n\nconst agentsSectionSchema = z.object({ default: z.string().optional() }).catchall(z.unknown());\n\n/**\n * `compaction:` — context compaction knobs (plan §\"Compactación de contexto\").\n * Automatic + config-only (no plugin SDK). Field-tested defaults; each field\n * defaults independently so a partial block is valid. The core compaction engine\n * (`@excalibur/core`) consumes this exact shape.\n */\nexport const compactionConfigSchema = z.object({\n /** Master switch (default true; disable with one flag). */\n enabled: z.boolean().default(true),\n /** Tokens held back from the window for the reply + headroom. */\n reserveTokens: z.number().int().positive().default(16384),\n /** Tokens of the recent tail preserved verbatim (cut only at turn limits). */\n keepRecentTokens: z.number().int().positive().default(20000),\n /**\n * Which model summarizes: `active` (the main session model — the DEFAULT,\n * since the summary becomes durable context so quality matters most), `cheap`\n * (opt-in: the fast pairing model for lower cost/latency), or a concrete id.\n */\n summarizerModel: z.string().min(1).default('active'),\n /** Prune stale tool outputs before summarizing. */\n pruneToolOutputs: z.boolean().default(true),\n});\nexport type CompactionConfig = z.infer<typeof compactionConfigSchema>;\n\n/** Default compaction config when `.excalibur/config.yaml` has no `compaction:` block. */\nexport const DEFAULT_COMPACTION_CONFIG: CompactionConfig = {\n enabled: true,\n reserveTokens: 16384,\n keepRecentTokens: 20000,\n summarizerModel: 'active',\n pruneToolOutputs: true,\n};\n\n/**\n * `mcp:` — Model Context Protocol servers whose tools the agent may call. Each\n * is EITHER a local subprocess (`command` + args, NO shell) OR a remote server\n * (`url`, Streamable HTTP, with optional auth `headers`). Absent → MCP off.\n * API keys/secrets belong in the process environment (inherited by a local\n * server), NOT in this file; `env` is for non-secret overrides only. For a\n * remote server, prefer an env-var reference in `headers` over a literal secret.\n */\n/** Per-MCP-server network sandbox (F6): an egress allowlist ON TOP of the SSRF floor. */\nconst mcpServerEgressSchema = z.object({\n /** Host globs this server's REMOTE endpoint may match (beyond the SSRF floor). */\n allowedDomains: z.array(z.string()).optional(),\n /** Hosts this server may reach even if private/loopback (e.g. a local gateway). */\n allowPrivateHosts: z.array(z.string()).optional(),\n});\n\n/** Auth for a REMOTE MCP server (F6). `oauth` is reserved for the DCR/PKCE flow. */\nconst mcpServerAuthSchema = z\n .object({\n /** none · bearerEnv (static token from an env var NAME) · oauth (reserved: DCR/PKCE). */\n type: z.enum(['none', 'bearerEnv', 'oauth']).default('none'),\n /** Env var NAME holding a static bearer token (BYOK; never the token itself). */\n bearerEnv: z.string().min(1).optional(),\n /** OAuth overrides (normally discovered via RFC 8414/9728); reserved. */\n authorizationUrl: z.string().url().optional(),\n tokenUrl: z.string().url().optional(),\n scopes: z.array(z.string()).optional(),\n })\n .refine((a) => a.type !== 'bearerEnv' || a.bearerEnv !== undefined, {\n message: 'auth.type \"bearerEnv\" requires auth.bearerEnv (the env var NAME holding the token)',\n });\n\nconst mcpServerConfigSchema = z\n .object({\n command: z.string().min(1).optional(),\n args: z.array(z.string()).optional(),\n cwd: z.string().optional(),\n env: z.record(z.string()).optional(),\n /** Remote MCP endpoint (Streamable HTTP). Set this OR `command`. */\n url: z.string().url().optional(),\n /** Headers sent on every remote request, e.g. `{ Authorization: \"Bearer …\" }`. */\n headers: z.record(z.string()).optional(),\n /**\n * Trust posture (F6): `trusted` = no per-call confirm (output still\n * injection-scanned); `untrusted`/`prompt` = confirm each call. Defaults to\n * `prompt` (applied by the consumer) — external tools are confirmed unless\n * you vouch for the server.\n */\n trust: z.enum(['trusted', 'untrusted', 'prompt']).optional(),\n /** Explicit read-only tool names (else the server's `readOnlyHint` decides). */\n readOnlyTools: z.array(z.string()).optional(),\n /** Explicit mutating tool names (else the server's `destructiveHint` decides). */\n mutatingTools: z.array(z.string()).optional(),\n /** Expose this server's READ-ONLY tools to read-only/research roles (default true). */\n allowReadOnlyRoles: z.boolean().optional(),\n /** Per-server network sandbox (reuses checkUrl / the SSRF floor). */\n egress: mcpServerEgressSchema.optional(),\n /** Auth for a remote server. */\n auth: mcpServerAuthSchema.optional(),\n })\n .refine((s) => (s.command !== undefined) !== (s.url !== undefined), {\n message: 'an MCP server needs EXACTLY ONE of `command` (local stdio) or `url` (remote http)',\n });\nexport type McpServerConfig = z.infer<typeof mcpServerConfigSchema>;\n\nexport const mcpSectionSchema = z.object({\n servers: z.record(mcpServerConfigSchema).optional(),\n /**\n * Scan every MCP tool result for prompt-injection BEFORE it enters the model\n * context (F6): `off` · `warn` (annotate + event, the consumer default) ·\n * `strict` (replace a flagged result with a safe summary). Structural,\n * language-agnostic.\n */\n injectionScan: z.enum(['off', 'warn', 'strict']).optional(),\n});\n\n/**\n * `sandbox:` — run agent shell commands inside an ephemeral Docker container\n * (OSS spec §18, M3). Off by default. When `enabled`, `run_command` executes in\n * an isolated container (only the repo mounted, no host secrets/network) instead\n * of on the host. `image` must carry the repo's toolchain (default Alpine has no\n * node/pnpm), so this is an advanced opt-in.\n */\nexport const sandboxConfigSchema = z.object({\n enabled: z.boolean().default(false),\n /** Container image (must have `sh` + the repo's toolchain). */\n image: z.string().min(1).optional(),\n memoryMb: z.number().int().positive().optional(),\n cpus: z.number().positive().optional(),\n /** Allow network inside the sandbox (default false). */\n network: z.boolean().optional(),\n});\nexport type SandboxConfig = z.infer<typeof sandboxConfigSchema>;\n\n/**\n * `lsp:` — feed REAL compiler diagnostics from a Language Server to the agent\n * after each edit, so it self-corrects on the next turn (P1.10 / M3). On by\n * default but INERT unless a server binary for the edited language is on PATH\n * (graceful: no server installed → behaves exactly as before, no spawn). v1\n * verifies TypeScript/JavaScript (`typescript-language-server --stdio`); other\n * languages work if their server is installed. `servers` overrides the default\n * command per language id (`typescript`/`python`/`go`/`rust`).\n */\nexport const lspConfigSchema = z.object({\n enabled: z.boolean().default(true),\n servers: z\n .record(z.object({ command: z.string().min(1), args: z.array(z.string()).optional() }))\n .optional(),\n /** Per-edit wait for the language server to publish diagnostics (ms). */\n diagnosticsTimeoutMs: z.number().int().positive().default(1500),\n /**\n * After the first diagnostics arrive, how long to wait for a LATER wave —\n * tsserver emits a syntactic (often empty) pass, then the semantic errors.\n * Higher = more reliable on a loaded machine; lower = snappier per-edit.\n */\n diagnosticsSettleMs: z.number().int().positive().default(400),\n /** One-time cold-start budget for the server's initialize + project load (ms). */\n serverStartTimeoutMs: z.number().int().positive().default(8000),\n /**\n * Auto-install a missing language server on first use (P1.10b). OFF by default\n * — installing software hits the network + mutates the global toolchain, so it\n * is strictly opt-in. When on, Excalibur runs the server's known install\n * command (npm i -g / go install / rustup component add / gem / pip) ONCE per\n * server per session, bounded by `autoInstallTimeoutMs`, and only when the\n * package manager is on PATH. Servers without a scriptable command (brew/manual)\n * still just surface the install hint.\n */\n autoInstall: z.boolean().default(false),\n /** Hard timeout for one auto-install attempt (ms). */\n autoInstallTimeoutMs: z.number().int().positive().default(180000),\n});\nexport type LspConfig = z.infer<typeof lspConfigSchema>;\n\n/** Default LSP config when `.excalibur/config.yaml` has no `lsp:` block. */\nexport const DEFAULT_LSP_CONFIG: LspConfig = {\n enabled: true,\n diagnosticsTimeoutMs: 1500,\n diagnosticsSettleMs: 400,\n serverStartTimeoutMs: 8000,\n autoInstall: false,\n autoInstallTimeoutMs: 180000,\n};\n\n/**\n * `search:` — the web-search backend for the `web_search` tool (F3). FREE and\n * UNLIMITED by default. `type: 'auto'` (the default) resolves the best free\n * backend at search time: a local SearXNG instance when one is reachable\n * (unlimited + private), otherwise keyless DuckDuckGo (works on any machine,\n * best-effort). Paid backends (`exa`/`tavily`/`brave`) are 100% opt-in BYOK —\n * used ONLY when `type` is set to them explicitly, NEVER by `auto`.\n *\n * - `apiKeyEnv`: the NAME of the environment variable holding the key (BYOK;\n * never the key itself, never committed) — required for the paid backends.\n * - `baseUrl`: endpoint override (e.g. a remote/self-hosted SearXNG).\n * - `manageSearxng`: let Excalibur auto-provision/start a local SearXNG\n * container via Docker (the unlimited+private upgrade); off → probe-only.\n */\nexport const searchProviderSchema = z.object({\n type: z.enum(['auto', 'searxng', 'duckduckgo', 'exa', 'tavily', 'brave']).default('auto'),\n /** Env var NAME holding the API key for a paid backend (BYOK, not the key). */\n apiKeyEnv: z.string().min(1).optional(),\n /** Endpoint override (e.g. a remote SearXNG instance). */\n baseUrl: z.string().url().optional(),\n /** Maximum results returned per search. */\n maxResults: z.number().int().positive().max(25).default(8),\n /** Auto-provision/start a local SearXNG container via Docker when available. */\n manageSearxng: z.boolean().default(true),\n});\nexport type SearchProviderConfig = z.infer<typeof searchProviderSchema>;\n\n/** Default search config: free + unlimited, zero-config (auto → SearXNG | DuckDuckGo). */\nexport const DEFAULT_SEARCH_PROVIDER: SearchProviderConfig = {\n type: 'auto',\n maxResults: 8,\n manageSearxng: true,\n};\n\n/**\n * `browser:` — Tier-2 LOCAL headless browser (F4). FREE but 100% OPT-IN: nothing\n * is downloaded until `excalibur browser enable` runs `playwright install\n * chromium`. When `enabled`, `web_fetch` AUTO-ESCALATES to the local browser on a\n * 403/429/JS-only/thin-content Tier-1 result, and `web_extract` prefers the\n * rendered page. Runs via Playwright MCP (`npx @playwright/mcp`) over the existing\n * MCP client. Chromium is NEVER auto-installed and NEVER bundled.\n */\nexport const browserConfigSchema = z.object({\n /** Master opt-in switch. False/absent → escalation never fires (Tier-1 only). */\n enabled: z.boolean().default(false),\n /** Command for the Playwright MCP server (advanced override). */\n command: z.string().min(1).default('npx'),\n args: z.array(z.string()).default(['-y', '@playwright/mcp@latest', '--headless', '--isolated']),\n /** Per-render wall-clock budget (ms) before falling back to the Tier-1 result. */\n timeoutMs: z.number().int().positive().default(30_000),\n /** Markdown shorter than this from Tier-1 counts as \"thin\" → escalate. */\n thinContentChars: z.number().int().positive().default(200),\n});\nexport type BrowserConfig = z.infer<typeof browserConfigSchema>;\n\n/** Default browser config: present but OFF (Tier-1 only until the user opts in). */\nexport const DEFAULT_BROWSER_CONFIG: BrowserConfig = {\n enabled: false,\n command: 'npx',\n args: ['-y', '@playwright/mcp@latest', '--headless', '--isolated'],\n timeoutMs: 30_000,\n thinContentChars: 200,\n};\n\n/**\n * `crawl:` — knobs for `web_crawl`'s transversal polite-fetch layer (F4). All\n * free, on by default; the SSRF floor + network policy still apply per page.\n */\nexport const crawlConfigSchema = z.object({\n /** Honor robots.txt allow/deny + Crawl-delay (default true; never silently off). */\n respectRobots: z.boolean().default(true),\n /** Min delay between requests to the SAME host, ms (token-bucket spacing). */\n perHostDelayMs: z.number().int().nonnegative().default(1000),\n /** TTL for the on-disk ETag/markdown cache, ms (default 24h). */\n cacheTtlMs: z.number().int().positive().default(86_400_000),\n /** Max cached entries before LRU prune. */\n cacheMaxEntries: z.number().int().positive().default(2000),\n /** Hard upper bound on pages a single crawl may fetch (anti-runaway). */\n maxPages: z.number().int().positive().max(200).default(10),\n});\nexport type CrawlConfig = z.infer<typeof crawlConfigSchema>;\n\n/** Default crawl config: polite + bounded. */\nexport const DEFAULT_CRAWL_CONFIG: CrawlConfig = {\n respectRobots: true,\n perHostDelayMs: 1000,\n cacheTtlMs: 86_400_000,\n cacheMaxEntries: 2000,\n maxPages: 10,\n};\n\n/**\n * `scrape:` — OPTIONAL hosted page readers for `web_fetch` (F5). 100% opt-in,\n * BYOK, PAID. ABSENT BY DEFAULT → `web_fetch` stays fully free on the in-bundle\n * Tier-1 fetch (F2) + the local-browser Tier-2 (F4). When set, the hosted reader\n * is a PREFERRED escalation tier: `prefer` tries it FIRST (zero-setup, JS-rendered\n * / stealth) and falls back to the free tiers on failure; `fallback` uses it ONLY\n * after the free fetch fails. The key is read from the env var NAMED by\n * `apiKeyEnv` (never the key, never committed). Jina has a key-less best-effort\n * mode (`jinaKeyless`).\n */\nexport const scrapeProviderSchema = z.object({\n provider: z.enum(['firecrawl', 'jina', 'browserbase']),\n /** Env var NAME holding the BYOK API key (not the key itself). */\n apiKeyEnv: z.string().min(1).optional(),\n /** Endpoint override (e.g. a self-hosted Firecrawl, or a regional base). */\n baseUrl: z.string().url().optional(),\n /** `prefer` = hosted first then free fallback; `fallback` = only if free fails. */\n mode: z.enum(['prefer', 'fallback']).default('prefer'),\n /** Per hosted-call timeout (ms) — hosted renderers are slower than a raw GET. */\n timeoutMs: z.number().int().positive().max(120_000).default(30_000),\n /** Allow Jina's key-less best-effort endpoint when no key is set (default true). */\n jinaKeyless: z.boolean().default(true),\n});\nexport type ScrapeProviderConfig = z.infer<typeof scrapeProviderSchema>;\n\n/**\n * `research:` — the native deep-research pipeline (F7). FREE + UNLIMITED (uses the\n * same `search` backend: SearXNG → DuckDuckGo). All bounds are cheap, governable\n * caps; the pipeline is always SSRF/network-policy governed.\n */\nexport const researchSectionSchema = z.object({\n /** Max distinct sources fetched per research pass. */\n maxSources: z.number().int().positive().max(12).default(5),\n /** Sub-queries the planner may fan out. */\n maxSubQueries: z.number().int().positive().max(6).default(3),\n /** Blind adversarial verifier sub-agents voting per claim (odd → no ties). */\n votes: z.number().int().min(1).max(5).default(3),\n /** When true, an unverified/uncited research claim can feed the Claim Ledger. */\n ledger: z.boolean().default(true),\n});\nexport type ResearchConfig = z.infer<typeof researchSectionSchema>;\n\n/** Default research config: free, bounded, 3-vote verification. */\nexport const DEFAULT_RESEARCH: ResearchConfig = {\n maxSources: 5,\n maxSubQueries: 3,\n votes: 3,\n ledger: true,\n};\n\n/**\n * `web.injection:` — governance for UNTRUSTED inbound web/MCP content (F8). The\n * scanner + data-fence are ON by default and free (pure heuristics, no deps, no\n * network). `blockOnMalicious` is OFF by default (annotate + quarantine the model\n * context, but don't fail the run) — opt-in for hardened setups.\n */\nexport const webInjectionConfigSchema = z.object({\n /** Master switch for the scanner + data-fence (default true). */\n enabled: z.boolean().default(true),\n /** Quarantine malicious content out of context AND (future) gate the run. Default false. */\n blockOnMalicious: z.boolean().default(false),\n /** Score (0–100) at/above which a source is `malicious` (quarantined). */\n maliciousThreshold: z.number().int().min(0).max(100).default(70),\n /** Score (0–100) at/above which a source is `suspicious` (fenced, content kept). */\n suspiciousThreshold: z.number().int().min(0).max(100).default(30),\n /** Strip zero-width / bidi / hidden text before it reaches the model (default true). */\n stripHiddenText: z.boolean().default(true),\n});\nexport type WebInjectionConfig = z.infer<typeof webInjectionConfigSchema>;\n\nexport const webConfigSchema = z.object({\n injection: webInjectionConfigSchema.optional(),\n});\nexport type WebConfig = z.infer<typeof webConfigSchema>;\n\n/** Default web-governance config: scanner on, non-blocking. */\nexport const DEFAULT_WEB_CONFIG: WebConfig = {\n injection: {\n enabled: true,\n blockOnMalicious: false,\n maliciousThreshold: 70,\n suspiciousThreshold: 30,\n stripHiddenText: true,\n },\n};\n\nconst instructionSourceRefSchema = z.object({\n path: z.string().min(1),\n format: instructionSourceFormatSchema.optional(),\n scope: instructionSourceScopeSchema.optional(),\n enabled: z.boolean().optional(),\n /** User-global sources are referenced locally only, never synced/copied. */\n localOnly: z.boolean().optional(),\n});\n\nconst skillSourceRefSchema = z.object({\n path: z.string().min(1),\n scope: z.enum(['project', 'user_global']).optional(),\n enabled: z.boolean().optional(),\n trustLevel: trustLevelSchema.optional(),\n});\n\n/** Presentation settings for the TUI (theme preset, arthurian flavour). */\n/** A 6-digit hex color (e.g. `#5BC8FF`) — the format every palette color uses. */\nconst hexColorSchema = z\n .string()\n .regex(/^#[0-9a-fA-F]{6}$/, 'must be a 6-digit hex color like \"#5BC8FF\"');\n\n/**\n * Custom theme overrides (P1.13): any subset of the palette's 14 colors, merged\n * OVER the resolved base theme (`ui.theme`). Lets a user tweak one accent or\n * author a full palette without forking — `mode` still comes from the base.\n */\nconst customThemeSchema = z\n .object({\n accent: hexColorSchema.optional(),\n accentDim: hexColorSchema.optional(),\n success: hexColorSchema.optional(),\n warn: hexColorSchema.optional(),\n danger: hexColorSchema.optional(),\n text: hexColorSchema.optional(),\n muted: hexColorSchema.optional(),\n rail: hexColorSchema.optional(),\n diffAddFg: hexColorSchema.optional(),\n diffDelFg: hexColorSchema.optional(),\n diffAddBg: hexColorSchema.optional(),\n diffDelBg: hexColorSchema.optional(),\n diffAddWordBg: hexColorSchema.optional(),\n diffDelWordBg: hexColorSchema.optional(),\n })\n .strict();\n\nconst uiSectionSchema = z\n .object({\n /** Named theme: `auto` (follow terminal) | `dark` | `light` | `daltonized` | `high-contrast`. */\n theme: z.enum(['auto', 'dark', 'light', 'daltonized', 'high-contrast']).optional(),\n /** Custom color overrides merged over the named theme (P1.13). */\n customTheme: customThemeSchema.optional(),\n /** Caption flavour for phase spinners: `plain` (default) | `arthurian`. */\n flavor: z.enum(['plain', 'arthurian']).optional(),\n /** Auto-start the read-only web dashboard with the interactive shell (default true). */\n dashboard: z.boolean().optional(),\n })\n .optional();\n\n/**\n * Rebindable keybindings (P1.13b). A single key (a key name like `up`/`tab`/\n * `escape` or a single character) or a list of keys, per picker action. Modifier\n * combos are rejected by the resolver (FIRM single-key rule). Only the list\n * picker (`/models`, onboarding) is rebindable today — the REPL line editor keeps\n * its standard, context-sensitive editing keys.\n */\nconst keyBindingSchema = z.union([z.string(), z.array(z.string())]);\nconst keybindingsSectionSchema = z\n .object({\n select: z\n .object({\n up: keyBindingSchema.optional(),\n down: keyBindingSchema.optional(),\n top: keyBindingSchema.optional(),\n bottom: keyBindingSchema.optional(),\n accept: keyBindingSchema.optional(),\n cancel: keyBindingSchema.optional(),\n })\n .optional(),\n })\n .optional();\n\n/** Adversarial Verification Mesh policy (proportional by default; governable here). */\nconst verificationSectionSchema = z\n .object({\n /** off = never · auto = proportional to risk (default) · always = ≥1 lens on any change. */\n mesh: z.enum(['off', 'auto', 'always']).optional(),\n })\n .optional();\n\n/** Hard budget cap (plan P2.3) — autonomy you can cap by dollars. */\nconst budgetSectionSchema = z\n .object({\n /**\n * Maximum model spend for a SINGLE run, in US dollars. When the run's\n * accumulated cost reaches this ceiling, the next model call is DENIED and\n * the run ends `failed` (needs-raise) — Excalibur does not just track spend,\n * it stops at the cap. Omit/`null` for no cap (the default).\n */\n maxRunUsd: z.number().positive().nullable().optional(),\n })\n .optional();\n\nconst baseExcaliburConfigSchema = z.object({\n version: z.number().int().optional(),\n /** Spoken UI locale for generated chrome/prose (`en`|`es`); auto-detected when absent. */\n language: z.string().optional(),\n /** TUI presentation (theme preset, flavour). */\n ui: uiSectionSchema,\n /** Rebindable picker keybindings (P1.13b). */\n keybindings: keybindingsSectionSchema,\n /** Adversarial Verification Mesh policy. */\n verification: verificationSectionSchema,\n /** Hard per-run budget cap (deny-by-dollars). */\n budget: budgetSectionSchema,\n project: projectSectionSchema.optional(),\n /** Top-level canonical commands; `project.commands` is normalized into it. */\n commands: commandsConfigSchema.optional(),\n safety: safetySectionSchema.optional(),\n workflowDefaults: z.record(z.string()).optional(),\n autonomyDefaults: z.record(autonomyLevelSchema).optional(),\n autonomy: autonomySectionSchema.optional(),\n workflows: workflowsSectionSchema.optional(),\n models: modelsSectionSchema.optional(),\n permissions: permissionsSectionSchema.optional(),\n /** Network transport (corporate proxy + custom CA); see networkTransportSchema. */\n network: networkTransportSchema.optional(),\n approvals: approvalsSectionSchema.optional(),\n context: contextSectionSchema.optional(),\n integrations: z.record(z.record(z.string())).optional(),\n agents: agentsSectionSchema.optional(),\n compaction: compactionConfigSchema.optional(),\n mcp: mcpSectionSchema.optional(),\n sandbox: sandboxConfigSchema.optional(),\n lsp: lspConfigSchema.optional(),\n /** Per-edit formatters (P1.9): auto-format a file after the agent writes it. */\n format: z.object({ enabled: z.boolean().optional() }).optional(),\n search: searchProviderSchema.optional(),\n browser: browserConfigSchema.optional(),\n crawl: crawlConfigSchema.optional(),\n scrape: scrapeProviderSchema.optional(),\n research: researchSectionSchema.optional(),\n web: webConfigSchema.optional(),\n instructions: z.object({ sources: z.array(instructionSourceRefSchema).optional() }).optional(),\n skills: z.object({ sources: z.array(skillSourceRefSchema).optional() }).optional(),\n});\n\n/**\n * Parsing normalizes the `project.commands` alias into the canonical\n * top-level `commands` section. On per-key conflicts the top-level value wins.\n */\nexport const excaliburConfigSchema = baseExcaliburConfigSchema.transform((config) => {\n const projectCommands = config.project?.commands;\n if (!projectCommands) {\n return config;\n }\n return { ...config, commands: { ...projectCommands, ...config.commands } };\n});\nexport type ExcaliburConfig = z.infer<typeof excaliburConfigSchema>;\n\n/** OSS spec §17 default blocked paths (minimatch patterns, `dot: true`). */\nexport const DEFAULT_BLOCKED_PATHS: ReadonlyArray<string> = [\n '.env',\n '.env.*',\n '**/*.pem',\n '**/*.key',\n '**/secrets/**',\n '**/.ssh/**',\n 'node_modules/**',\n 'dist/**',\n 'build/**',\n];\n\n/**\n * Default network policy: the agent CAN reach the public web out of the box\n * (`mode: 'on'`), gated by a soft confirmation (`approval: 'ask'`, skipped under\n * session auto-accept) and the always-on SSRF floor (private/loopback/metadata\n * hard-denied). Set `mode: 'off'` for a network lockdown.\n */\nexport const DEFAULT_NETWORK_POLICY: NetworkPolicy = { mode: 'on', approval: 'ask' };\n\n/** OSS spec §17 default allowed commands (common package-script invocations). */\nexport const DEFAULT_ALLOWED_COMMANDS: ReadonlyArray<string> = [\n 'npm test',\n 'npm run test',\n 'npm run typecheck',\n 'npm run lint',\n 'pnpm test',\n 'pnpm typecheck',\n 'pnpm lint',\n 'yarn test',\n];\n\n/**\n * Baseline configuration used when `.excalibur/config.yaml` is missing and as\n * the merge base in `loadExcaliburConfig`. Mirrors onboarding spec §2:\n * `standard-safe` preset, command→workflow/autonomy defaults, conservative\n * tool permissions (read-only tools allowed, mutating tools ask, network off).\n */\nexport const DEFAULT_CONFIG: ExcaliburConfig = {\n version: 1,\n commands: {},\n safety: { preset: 'standard-safe' },\n workflowDefaults: {\n ask: 'ask-repo',\n review: 'review-only',\n patch: 'propose-patch',\n run: 'standard-feature',\n careful: 'structured-feature',\n discovery: 'discovery',\n },\n autonomyDefaults: {\n ask: 1,\n review: 0,\n patch: 2,\n run: 3,\n careful: 4,\n discovery: 0,\n },\n workflows: {\n default: 'standard-feature',\n byTaskType: {\n bugfix: 'fast-fix',\n feature: 'standard-feature',\n refactor: 'safe-refactor',\n migration: 'migration',\n security: 'security-review',\n },\n },\n models: { default: 'mock' },\n agents: { default: 'native' },\n compaction: DEFAULT_COMPACTION_CONFIG,\n lsp: DEFAULT_LSP_CONFIG,\n search: DEFAULT_SEARCH_PROVIDER,\n research: DEFAULT_RESEARCH,\n web: DEFAULT_WEB_CONFIG,\n permissions: {\n tools: {\n read_file: true,\n list_files: true,\n search_code: true,\n git_diff: true,\n write_file: 'ask',\n apply_patch: 'ask',\n run_command: 'ask',\n create_branch: 'ask',\n run_tests: 'ask',\n web_fetch: 'ask',\n web_search: 'ask',\n web_extract: 'ask',\n web_crawl: 'ask',\n },\n blockedPaths: [...DEFAULT_BLOCKED_PATHS],\n allowedCommands: [...DEFAULT_ALLOWED_COMMANDS],\n network: DEFAULT_NETWORK_POLICY,\n },\n instructions: { sources: [] },\n skills: { sources: [] },\n};\n","import { z } from 'zod';\n\n/**\n * Instruction and Skill Discovery (ISD) shared types\n * (docs/spec/instructions-skills-core.md §2–§3).\n *\n * Excalibur detects the AI instruction files and skill definitions teams\n * already maintain (CLAUDE.md, AGENTS.md, Cursor rules, SKILL.md, …),\n * classifies them and assigns conservative trust defaults. The scanner lives\n * in `@excalibur/context-engine`; the types and the trust-default table live\n * here so Core and Enterprise share the exact same classification contract.\n */\n\nexport const instructionSourceScopeSchema = z.enum([\n 'project',\n 'workspace',\n 'user_global',\n 'enterprise',\n]);\nexport type InstructionSourceScope = z.infer<typeof instructionSourceScopeSchema>;\n\nexport const instructionSourceFormatSchema = z.enum([\n 'claude_md',\n 'skill_md',\n 'agents_md',\n 'cursor_rules',\n 'copilot_instructions',\n 'gemini_md',\n 'codex',\n 'aider',\n 'docs',\n 'adr',\n 'custom',\n]);\nexport type InstructionSourceFormat = z.infer<typeof instructionSourceFormatSchema>;\n\nexport const instructionSourceKindSchema = z.enum([\n 'instruction',\n 'skill',\n 'context',\n 'policy_hint',\n 'workflow_hint',\n]);\nexport type InstructionSourceKind = z.infer<typeof instructionSourceKindSchema>;\n\nexport const trustLevelSchema = z.enum(['trusted', 'review_required', 'untrusted']);\nexport type TrustLevel = z.infer<typeof trustLevelSchema>;\n\nexport const instructionSourceSchema = z.object({\n id: z.string().min(1),\n scope: instructionSourceScopeSchema,\n format: instructionSourceFormatSchema,\n kind: instructionSourceKindSchema,\n path: z.string().min(1),\n title: z.string().nullable(),\n /** sha256 hex digest of the source content. */\n contentHash: z.string().min(1),\n trustLevel: trustLevelSchema,\n enabled: z.boolean(),\n importedAs: instructionSourceKindSchema,\n metadata: z.record(z.unknown()),\n});\nexport type InstructionSource = z.infer<typeof instructionSourceSchema>;\n\nexport const detectedSkillSchema = z.object({\n id: z.string().min(1),\n name: z.string(),\n path: z.string().min(1),\n scope: z.enum(['project', 'user_global']),\n description: z.string().nullable(),\n triggers: z.array(z.string()),\n dependencies: z.array(z.string()),\n toolsRequired: z.array(z.string()),\n trustLevel: trustLevelSchema,\n enabled: z.boolean(),\n source: instructionSourceSchema,\n});\nexport type DetectedSkill = z.infer<typeof detectedSkillSchema>;\n\nexport interface DefaultTrustRule {\n format: InstructionSourceFormat;\n scope: InstructionSourceScope;\n trustLevel: TrustLevel;\n kind: InstructionSourceKind;\n}\n\n/**\n * Trust-default table (ISD spec §3) as data.\n *\n * - Project instruction files maintained in the repo are `trusted`.\n * - Project docs/ADRs are `trusted` but classified as `context`.\n * - The user-global CLAUDE.md is `trusted` for local user context only\n * (it is never copied into the repo without explicit confirmation).\n * - SKILL.md files are capability definitions: always `review_required`\n * and never auto-enabled, regardless of scope.\n * - Unknown/custom formats default to `review_required`.\n */\nexport const DEFAULT_TRUST_RULES: DefaultTrustRule[] = [\n { format: 'claude_md', scope: 'project', trustLevel: 'trusted', kind: 'instruction' },\n { format: 'agents_md', scope: 'project', trustLevel: 'trusted', kind: 'instruction' },\n { format: 'cursor_rules', scope: 'project', trustLevel: 'trusted', kind: 'instruction' },\n { format: 'copilot_instructions', scope: 'project', trustLevel: 'trusted', kind: 'instruction' },\n { format: 'gemini_md', scope: 'project', trustLevel: 'trusted', kind: 'instruction' },\n { format: 'codex', scope: 'project', trustLevel: 'trusted', kind: 'instruction' },\n { format: 'aider', scope: 'project', trustLevel: 'trusted', kind: 'instruction' },\n { format: 'docs', scope: 'project', trustLevel: 'trusted', kind: 'context' },\n { format: 'adr', scope: 'project', trustLevel: 'trusted', kind: 'context' },\n { format: 'claude_md', scope: 'user_global', trustLevel: 'trusted', kind: 'instruction' },\n { format: 'skill_md', scope: 'project', trustLevel: 'review_required', kind: 'skill' },\n { format: 'skill_md', scope: 'user_global', trustLevel: 'review_required', kind: 'skill' },\n { format: 'custom', scope: 'project', trustLevel: 'review_required', kind: 'instruction' },\n];\n\n/**\n * Looks up the default trust classification for a format/scope pair.\n * Falls back to the conservative default when no explicit rule exists:\n * `review_required`, kind `skill` for skill_md and `instruction` otherwise.\n */\nexport function resolveDefaultTrust(\n format: InstructionSourceFormat,\n scope: InstructionSourceScope,\n): { trustLevel: TrustLevel; kind: InstructionSourceKind } {\n const rule = DEFAULT_TRUST_RULES.find((r) => r.format === format && r.scope === scope);\n if (rule) {\n return { trustLevel: rule.trustLevel, kind: rule.kind };\n }\n return {\n trustLevel: 'review_required',\n kind: format === 'skill_md' ? 'skill' : 'instruction',\n };\n}\n","/**\n * Dashboard data contracts (D0 — task-first information architecture).\n *\n * These are the wire shapes the OSS web dashboard consumes from `excalibur\n * serve`. They are DTOs — deliberately decoupled from the in-process domain\n * models (`@excalibur/work-items` `NormalizedWorkItem`, `RunRecord`, …) so the\n * web contract can stay stable while internals evolve, and so this leaf package\n * carries no dependency on the stores. The serve layer maps domain → DTO; the\n * Svelte client imports these types for its typed API client.\n *\n * The whole dashboard is WORK-ITEM-CENTRIC: the home is the kanban board, and\n * everything (runs, patches, PRs, plans, discovery) hangs off a work item. The\n * routes below mirror that information architecture.\n */\n\n/**\n * Canonical kanban lanes. MUST stay in sync with `WORK_ITEM_LANES` in\n * `@excalibur/work-items` (this leaf package can't import it without a cycle);\n * `apps/cli` imports both and a type-level assertion there guards the match.\n */\nexport const DASHBOARD_LANES = ['backlog', 'todo', 'in_progress', 'review', 'done'] as const;\nexport type DashboardLane = (typeof DASHBOARD_LANES)[number];\n\n/** Human label per lane (board column headers). */\nexport const DASHBOARD_LANE_LABELS: Readonly<Record<DashboardLane, string>> = {\n backlog: 'Backlog',\n todo: 'To do',\n in_progress: 'In progress',\n review: 'Review',\n done: 'Done',\n};\n\n/** A single item of the agent's live checklist (the `task_update` snapshot). */\nexport interface ChecklistItemDto {\n id: string;\n text: string;\n status: 'pending' | 'in_progress' | 'completed';\n}\n\n/** A work item as it appears on a board card (compact). */\nexport interface WorkItemSummary {\n /** Stable key, e.g. `WI-12`. */\n key: string;\n title: string;\n /** Raw provider status (free string); `lane` is the canonical projection. */\n status: string | null;\n lane: DashboardLane;\n priority: string | null;\n labels: string[];\n assignee: string | null;\n /** Number of runs linked to this work item (the activity badge). */\n runCount: number;\n /** Kanban rank within the lane (lower = higher). */\n order: number;\n updatedAt: string | null;\n /**\n * The id of an in-flight run advancing this item (`running` /\n * `waiting_approval`), or null. When set, the card shows a live indicator.\n */\n activeRunId: string | null;\n /**\n * The active run's latest `update_tasks` checklist snapshot (D1). Empty when\n * there is no active run or it hasn't emitted a checklist yet. Lets the\n * in-progress card surface the agent's live plan without opening the run.\n */\n checklist: ChecklistItemDto[];\n}\n\n/** One board column: a lane plus its cards in board order. */\nexport interface DashboardBoardLane {\n lane: DashboardLane;\n label: string;\n items: WorkItemSummary[];\n}\n\n/** `GET /api/board` — the kanban home (D1). */\nexport interface BoardResponse {\n lanes: DashboardBoardLane[];\n /** ISO timestamp the board was assembled (for the \"updated x ago\" hint). */\n generatedAt: string;\n}\n\n/** A run as it appears in a work item's activity list / the runs explorer (D4). */\nexport interface RunSummary {\n id: string;\n title: string;\n status: string;\n workflow: string;\n model: string | null;\n startedAt: string;\n completedAt: string | null;\n /** Rolled-up cost/usage from the run's model-call ledger (null until known). */\n costCents: number | null;\n inputTokens: number | null;\n outputTokens: number | null;\n /** The work item this run advanced, if any. */\n workItemId: string | null;\n}\n\n/** An external link off a work item (PR / commit / doc). */\nexport interface WorkItemLinkDto {\n type: 'pull_request' | 'commit' | 'document' | 'url' | 'issue' | 'other';\n url: string;\n title: string | null;\n}\n\n/** A comment / interaction on a work item. */\nexport interface WorkItemCommentDto {\n author: string | null;\n body: string;\n createdAt: string | null;\n}\n\n/** A plan associated with a work item (D3). */\nexport interface PlanRefDto {\n /** Plan file slug/id. */\n id: string;\n status: 'proposed' | 'approved' | 'executed' | 'cancelled';\n createdAt: string | null;\n planRun: string | null;\n execRun: string | null;\n}\n\n/** `GET /api/work-items/:key` — the work-item drill-down (D1/D2/D3). */\nexport interface WorkItemDetail {\n key: string;\n title: string;\n description: string | null;\n status: string | null;\n lane: DashboardLane;\n priority: string | null;\n labels: string[];\n assignee: string | null;\n reporter: string | null;\n url: string | null;\n createdAt: string | null;\n updatedAt: string | null;\n parentKey: string | null;\n /** Runs that advanced this item (newest first). */\n runs: RunSummary[];\n links: WorkItemLinkDto[];\n comments: WorkItemCommentDto[];\n /** Plans linked to this item (D3 fills the link; D0 ships the shape). */\n plans: PlanRefDto[];\n}\n\n/** A saved plan as it appears in the Plans list (D3). */\nexport interface PlanSummary {\n /** Filename-without-`.md` id (e.g. `20260622-101500-ship-d3`). */\n id: string;\n task: string;\n status: 'proposed' | 'approved' | 'executed' | 'cancelled';\n created: string | null;\n planRun: string | null;\n execRun: string | null;\n}\n\n/** A plan with its markdown body (D3 drill-in). */\nexport interface PlanDetail extends PlanSummary {\n body: string;\n}\n\n/** A discovery session summary (D3). */\nexport interface DiscoverySummary {\n id: string;\n title: string;\n status: 'open' | 'completed' | 'cancelled';\n recommendation: string | null;\n recommendedAutonomyLevel: number | null;\n createdAt: string;\n completedAt: string | null;\n}\n\n/** A per-key cost/usage bucket (by model or by workflow) — mirrors core insights. */\nexport interface CountCostDto {\n key: string;\n runs: number;\n costCents: number;\n inputTokens: number;\n outputTokens: number;\n}\n\n/** A per-day cost/run bucket for the time-series chart. */\nexport interface DayBucketDto {\n day: string;\n runs: number;\n costCents: number;\n}\n\n/**\n * Aggregate insights for the analytics view (D4). Structurally mirrors core's\n * `InsightsReport` (what `GET /api/insights` returns) so the client can type it\n * without importing the server package.\n */\nexport interface InsightsReportDto {\n totalRuns: number;\n byStatus: Record<string, number>;\n completionRate: number;\n totalCostCents: number;\n totalInputTokens: number;\n totalOutputTokens: number;\n totalModelCalls: number;\n totalFilesChanged: number;\n totalApprovals: number;\n totalVerificationsBlocked: number;\n avgCostCentsPerRun: number;\n byModel: CountCostDto[];\n byWorkflow: CountCostDto[];\n byDay: DayBucketDto[];\n}\n\n/**\n * The dashboard's route map — task-first. The client is a hash-routed SPA, so\n * these are the canonical in-app paths; the API paths they read are alongside.\n */\nexport const DASHBOARD_ROUTES = {\n /** Kanban home (D1/D2). */\n board: '/',\n /** Work-item drill-down (D1/D2/D3). `:key` = e.g. WI-12. */\n workItem: '/work-items/:key',\n /** Runs explorer + cost/token charts (D4). */\n runs: '/runs',\n /** A single run's live rail (D4/D5). */\n run: '/runs/:id',\n /** Insights / analytics (D4). */\n insights: '/insights',\n /** Plans & discovery (D3). */\n plans: '/plans',\n} as const;\n\n/** The JSON API surface the dashboard reads (kept beside the routes for clarity). */\nexport const DASHBOARD_API = {\n health: '/health',\n board: '/api/board',\n workItem: (key: string) => `/api/work-items/${encodeURIComponent(key)}`,\n runs: '/api/runs',\n run: (id: string) => `/api/runs/${encodeURIComponent(id)}`,\n runEvents: (id: string) => `/api/runs/${encodeURIComponent(id)}/events`,\n runStream: (id: string) => `/api/runs/${encodeURIComponent(id)}/stream`,\n insights: '/api/insights',\n plans: '/api/plans',\n plan: (id: string) => `/api/plans/${encodeURIComponent(id)}`,\n discovery: '/api/discovery',\n} as const;\n","import { randomUUID } from 'node:crypto';\n\nfunction pad(value: number, width = 2): string {\n return String(value).padStart(width, '0');\n}\n\n/**\n * Generates a local run id in the form `run_YYYYMMDD_HHMMSS` using LOCAL time\n * (run directories should sort naturally next to the developer's clock).\n */\nexport function generateRunId(date: Date = new Date()): string {\n const yyyy = date.getFullYear();\n const mm = pad(date.getMonth() + 1);\n const dd = pad(date.getDate());\n const hh = pad(date.getHours());\n const mi = pad(date.getMinutes());\n const ss = pad(date.getSeconds());\n return `run_${yyyy}${mm}${dd}_${hh}${mi}${ss}`;\n}\n\n/** Generates a collision-resistant id in the form `<prefix>_<uuid>`. */\nexport function generateId(prefix: string): string {\n return `${prefix}_${randomUUID()}`;\n}\n","/**\n * i18n engine (plan §\"Idioma\"): Excalibur's chrome works in at least `en` and\n * `es`, with locale auto-detection. This module owns the LOCALE-AGNOSTIC engine\n * — the `Locale` type, detection, and a catalog-backed `t(key, vars)` — while\n * each package co-locates its OWN message catalogs (the CLI owns CLI copy, core\n * owns report/AGENTS.md copy, …). Keys, not hardcoded strings, are the contract.\n */\n\n/** Supported chrome locales. The architecture is ready for more; en+es is baseline. */\nexport const LOCALES = ['en', 'es'] as const;\nexport type Locale = (typeof LOCALES)[number];\n\n/** True when `value` is a supported {@link Locale}. */\nexport function isLocale(value: unknown): value is Locale {\n return value === 'en' || value === 'es';\n}\n\n/**\n * Resolves the active locale by precedence (plan §\"Idioma\"):\n * `EXCALIBUR_LANG` > explicit config `language` > `LC_ALL`/`LC_MESSAGES`/`LANG`\n * > `en`. Only `en`/`es` are recognized; anything else is skipped (an unknown\n * `es_AR.UTF-8` still maps to `es`, `C`/`POSIX` fall through to `en`).\n */\nexport function detectLocale(\n options: {\n env?: NodeJS.ProcessEnv;\n configLanguage?: string | undefined;\n } = {},\n): Locale {\n const env = options.env ?? {};\n const candidates = [\n env['EXCALIBUR_LANG'],\n options.configLanguage,\n env['LC_ALL'],\n env['LC_MESSAGES'],\n env['LANG'],\n ];\n for (const candidate of candidates) {\n if (typeof candidate !== 'string' || candidate.length === 0) {\n continue;\n }\n const lower = candidate.toLowerCase();\n if (lower.startsWith('es')) {\n return 'es';\n }\n if (lower.startsWith('en')) {\n return 'en';\n }\n // A recognized-but-unsupported locale (e.g. `fr`) keeps scanning lower-\n // precedence sources rather than forcing `en` immediately.\n }\n return 'en';\n}\n\n/** A message catalog: key → template with `{var}` placeholders. */\nexport type Catalog = Record<string, string>;\n\n/** `t(key, vars)` — the interpolated message for the active locale. */\nexport type Translator = (key: string, vars?: Record<string, string | number>) => string;\n\n/** Interpolates `{var}` placeholders; a missing var is left visible as `{var}`. */\nfunction interpolate(template: string, vars?: Record<string, string | number>): string {\n return template.replace(/\\{(\\w+)\\}/g, (_match, name: string) => {\n const value = vars?.[name];\n return value === undefined ? `{${name}}` : String(value);\n });\n}\n\n/**\n * Builds a {@link Translator} over per-locale catalogs for a fixed `locale`.\n * Resolution: active locale → `en` fallback → the key itself (so a missing key\n * is visible in dev rather than rendering blank). Placeholders are interpolated.\n */\nexport function makeTranslator(\n catalogs: Partial<Record<Locale, Catalog>>,\n locale: Locale,\n): Translator {\n const active = catalogs[locale] ?? {};\n const fallback = catalogs.en ?? {};\n return (key, vars) => {\n const template = active[key] ?? fallback[key] ?? key;\n return interpolate(template, vars);\n };\n}\n","/**\n * Secret redaction (Build Contract §4.3, OSS spec §17).\n *\n * Masks well-known credential formats with `[REDACTED]` before prompts or\n * logs leave the process. Patterns are intentionally a little aggressive:\n * for a redactor, a false positive is far cheaper than a leaked secret.\n *\n * Lives in `@excalibur/shared` so every package — model-gateway, agent-runtime,\n * context-engine (skill/instruction scanning), core — applies the SAME\n * redaction at the point data is captured, not just before a model call.\n */\n\nconst REDACTED = '[REDACTED]';\n\n/**\n * `-----BEGIN … PRIVATE KEY-----` blocks (RSA/EC/OPENSSH/ENCRYPTED/plain).\n * The body is length-bounded so an unterminated header can't trigger\n * catastrophic backtracking on a large file (a PEM body never approaches 64k).\n */\nconst PRIVATE_KEY_BLOCK =\n /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\\s\\S]{1,65536}?-----END [A-Z0-9 ]*PRIVATE KEY-----/g;\n\n/** OpenAI-style keys: `sk-…` incl. `sk-proj-…` and Anthropic `sk-ant-…`. */\nconst OPENAI_STYLE_KEY = /\\bsk-[A-Za-z0-9_-]{20,}\\b/g;\n\n/**\n * Stripe secret/restricted keys: `sk_live_`/`sk_test_`/`rk_live_`/`rk_test_`\n * (underscore form — NOT caught by the hyphenated `sk-` pattern above).\n * Publishable `pk_…` keys are intentionally not redacted (they are public).\n */\nconst STRIPE_SECRET_KEY = /\\b[sr]k_(?:live|test)_[A-Za-z0-9]{10,}\\b/g;\n\n/**\n * JSON Web Tokens: three base64url segments where the header and payload both\n * begin `eyJ` (the base64url of `{\"`). Very low false-positive — `eyJ.eyJ.…`\n * essentially never occurs outside a JWT. The signature segment may be empty\n * (`alg:none`), hence `*` on the third group.\n */\nconst JWT = /\\beyJ[A-Za-z0-9_-]+\\.eyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]*/g;\n\n/**\n * Credentials embedded in a connection string / URL userinfo\n * (`scheme://user:password@host`). Keeps the scheme and username, masks the\n * password. Covers postgres/mysql/redis/mongodb/amqp/https URLs.\n */\nconst CONNECTION_STRING_CREDS = /\\b([a-z][a-z0-9+.-]*:\\/\\/[^:@/\\s]+):([^@/\\s]+)@/gi;\n\n/** AWS access key ids: `AKIA` + 16 uppercase alphanumerics. */\nconst AWS_ACCESS_KEY = /\\bAKIA[0-9A-Z]{16}\\b/g;\n\n/** GitHub tokens: classic `ghp_`/`gho_`/`ghs_` plus fine-grained `github_pat_`. */\nconst GITHUB_TOKEN = /\\b(?:gh[pos]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\\b/g;\n\n/** npm automation/publish tokens: `npm_` + 36+ base62. */\nconst NPM_TOKEN = /\\bnpm_[A-Za-z0-9]{36,}\\b/g;\n\n/** Google OAuth access tokens: `ya29.<token>`. */\nconst GOOGLE_OAUTH_TOKEN = /\\bya29\\.[A-Za-z0-9_-]{10,}/g;\n\n/** Slack tokens: `xoxb-`, `xoxp-`, `xoxa-`, `xoxr-`, `xoxs-`, … */\nconst SLACK_TOKEN = /\\bxox[a-z]-[A-Za-z0-9-]{8,}\\b/g;\n\n/**\n * Registry/credential-file auth assignments — npm `.npmrc` (`_auth`,\n * `_authToken`, `_password`) and similar, whose values are often base64 and\n * therefore not caught by the prefix-based patterns above. Keeps the key and\n * delimiter, masks the value.\n */\nconst REGISTRY_AUTH_SECRET = /\\b(_auth(?:[Tt]oken)?|_password)(\\s*=\\s*)([^\\s\"';]+)/g;\n\n/** `Authorization: Bearer <token>` headers — keeps the header name, masks the token. */\nconst AUTHORIZATION_BEARER = /(\\bauthorization\\s*:\\s*bearer\\s+)[^\\s\"']+/gi;\n\n/**\n * `password=…` / `apiKey: …` style assignments in env lines, YAML, JSON and\n * URLs. Keeps the key and delimiter, masks only the value.\n */\nconst KEY_VALUE_SECRET =\n /\\b(password|passwd|pwd|secret|client[_-]?secret|secret[_-]?key|api[_-]?key|access[_-]?token|auth[_-]?token|refresh[_-]?token)\\b([\"']?\\s*[:=]\\s*)([\"']?)([^\\s\"',;&]+)/gi;\n\n/**\n * Long opaque tokens with no keyword context (e.g. a credential pasted on its\n * own line). Candidates are base64/base64url/hex runs of ≥40 chars; we redact\n * only those with high Shannon entropy that ALSO mix upper- and lower-case\n * letters. That last condition is what spares the common high-length tokens\n * that are NOT secrets: git SHAs (lowercase hex), decimal ids, and lowercase\n * UUIDs — while still catching random API tokens. A false positive here only\n * costs a masked string in a prompt/log; a miss leaks a credential.\n */\nconst HIGH_ENTROPY_CANDIDATE = /[A-Za-z0-9+/=_-]{40,}/g;\nconst ENTROPY_BITS_THRESHOLD = 4.0;\n\nfunction shannonBitsPerChar(s: string): number {\n const counts = new Map<string, number>();\n for (const ch of s) {\n counts.set(ch, (counts.get(ch) ?? 0) + 1);\n }\n let bits = 0;\n for (const count of counts.values()) {\n const p = count / s.length;\n bits -= p * Math.log2(p);\n }\n return bits;\n}\n\nfunction looksLikeHighEntropySecret(token: string): boolean {\n // Must mix cases — excludes lowercase-hex SHAs / all-digit ids / lowercase UUIDs.\n if (!(/[a-z]/.test(token) && /[A-Z]/.test(token) && /[0-9]/.test(token))) {\n return false;\n }\n return shannonBitsPerChar(token) >= ENTROPY_BITS_THRESHOLD;\n}\n\n/** Masks all known secret patterns in `text` with `[REDACTED]`. */\nexport function redactSecrets(text: string): string {\n let result = text;\n result = result.replace(PRIVATE_KEY_BLOCK, REDACTED);\n result = result.replace(JWT, REDACTED);\n result = result.replace(OPENAI_STYLE_KEY, REDACTED);\n result = result.replace(STRIPE_SECRET_KEY, REDACTED);\n result = result.replace(AWS_ACCESS_KEY, REDACTED);\n result = result.replace(GITHUB_TOKEN, REDACTED);\n result = result.replace(NPM_TOKEN, REDACTED);\n result = result.replace(GOOGLE_OAUTH_TOKEN, REDACTED);\n result = result.replace(SLACK_TOKEN, REDACTED);\n result = result.replace(AUTHORIZATION_BEARER, `$1${REDACTED}`);\n result = result.replace(\n CONNECTION_STRING_CREDS,\n (_match, prefix: string) => `${prefix}:${REDACTED}@`,\n );\n result = result.replace(REGISTRY_AUTH_SECRET, `$1$2${REDACTED}`);\n result = result.replace(\n KEY_VALUE_SECRET,\n (_match, key: string, delimiter: string, quote: string) =>\n `${key}${delimiter}${quote}${REDACTED}`,\n );\n result = result.replace(HIGH_ENTROPY_CANDIDATE, (token) =>\n looksLikeHighEntropySecret(token) ? REDACTED : token,\n );\n return result;\n}\n","import { ExcaliburError } from '@excalibur/shared';\n\n/**\n * Thrown when an extension definition or a contribution passed to one of the\n * `ExtensionContext` registries is structurally invalid (Build Contract §2.6:\n * every thrown error is an `ExcaliburError` subclass).\n */\nexport class ExtensionDefinitionError extends ExcaliburError {\n constructor(message: string, details?: Record<string, unknown>) {\n super(message, 'extension_definition', details);\n }\n}\n","import { z } from 'zod';\nimport {\n agentRoleSchema,\n autonomyLevelSchema,\n phaseTypeSchema,\n workflowModeSchema,\n type AgentRole,\n type AutonomyLevel,\n type PhaseType,\n type WorkflowMode,\n} from '@excalibur/shared';\n\n/**\n * Workflow and methodology definition schemas (Build Contract §4.2).\n *\n * A workflow is executable (ordered phases with types the engine understands);\n * a methodology is conceptual/prescriptive (philosophy, guidance, artifacts).\n * Both are plain YAML files: Git-versionable, editable by teams and shared\n * verbatim between Excalibur Core and Excalibur Enterprise.\n */\n\n/** Approval requirement attached to a single workflow phase. */\nexport const phaseApprovalSchema = z.enum(['required', 'optional', 'none']);\nexport type PhaseApproval = z.infer<typeof phaseApprovalSchema>;\n\n/** Failure handling policy for a workflow phase. */\nexport const phaseOnFailureSchema = z.enum(['abort', 'continue', 'retry']);\nexport type PhaseOnFailure = z.infer<typeof phaseOnFailureSchema>;\n\nexport interface WorkflowPhase {\n id: string;\n name: string;\n type: PhaseType;\n role?: AgentRole;\n /** Defaults to true; normalized to false when `optional: true` is declared. */\n required?: boolean;\n /** Declarative sugar: `optional: true` is normalized to `required: false`. */\n optional?: boolean;\n /**\n * Swarm sizing for the phase: `'auto'` (default when absent) lets\n * `planAgentAllocation` size it; a number is an explicit override/cap. The\n * developer never has to fix the count.\n */\n agents?: 'auto' | number;\n /** Fan-out/fan-in for agent_work phases (`'sequential'` default). */\n parallelism?: 'sequential' | 'parallel';\n /** Whether the phase should run in an isolated branch/worktree. */\n worktree?: boolean;\n modifiesFiles?: boolean;\n commands?: string[];\n /** Resolve commands from `.excalibur/config.yaml` detected commands. */\n commandsFromConfig?: boolean;\n /** Artifact file name produced by the phase (e.g. `summary.md`). */\n output?: string;\n approval?: PhaseApproval;\n requiresHumanConfirmation?: boolean;\n /** Defaults to 'abort'. */\n onFailure?: PhaseOnFailure;\n maxRetries?: number;\n}\n\nconst workflowPhaseObjectSchema = z.object({\n id: z.string().min(1, 'phase id must be a non-empty string'),\n name: z.string().min(1, 'phase name must be a non-empty string'),\n type: phaseTypeSchema,\n role: agentRoleSchema.optional(),\n required: z.boolean().optional(),\n optional: z.boolean().optional(),\n // Swarm sizing: the developer never fixes the count — `'auto'` (the default\n // when absent) lets `planAgentAllocation` size the swarm; a number is an\n // explicit override/cap (plan §\"Asignación automática de agentes\").\n agents: z.union([z.literal('auto'), z.number().int().min(1)]).optional(),\n // Fan-out/fan-in for agent_work phases: `parallel` runs the sized swarm in\n // isolated worktrees and merges; `sequential` (default) runs one at a time.\n parallelism: z.enum(['sequential', 'parallel']).optional(),\n worktree: z.boolean().optional(),\n modifiesFiles: z.boolean().optional(),\n commands: z.array(z.string().min(1)).optional(),\n commandsFromConfig: z.boolean().optional(),\n output: z.string().min(1).optional(),\n approval: phaseApprovalSchema.optional(),\n requiresHumanConfirmation: z.boolean().optional(),\n onFailure: phaseOnFailureSchema.optional(),\n maxRetries: z.number().int().min(0).optional(),\n});\n\nfunction normalizePhase(phase: z.infer<typeof workflowPhaseObjectSchema>): WorkflowPhase {\n return {\n ...phase,\n // `optional: true` is declarative sugar for `required: false` (Build Contract §4.2).\n required: phase.optional === true ? false : (phase.required ?? true),\n onFailure: phase.onFailure ?? 'abort',\n };\n}\n\n/**\n * Schema for one workflow phase. Parsing normalizes `optional: true` to\n * `required: false` and fills the documented defaults (`required: true`,\n * `onFailure: 'abort'`).\n */\nexport const workflowPhaseSchema = workflowPhaseObjectSchema\n .superRefine((phase, ctx) => {\n // `required:true` + `optional:true` is a contradiction — silently letting\n // `optional` win would mask an authoring mistake. Reject it explicitly.\n if (phase.required === true && phase.optional === true) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'a phase cannot be both required:true and optional:true',\n path: ['optional'],\n });\n }\n })\n .transform(normalizePhase);\n\nexport interface WorkflowDefaults {\n model?: string;\n commands?: string[];\n}\n\nexport interface WorkflowDefinition {\n id: string;\n /** Optional discriminator used by declarative extension files. */\n type?: 'workflow';\n name: string;\n description?: string;\n mode: WorkflowMode;\n /** Defaults to all levels: [0, 1, 2, 3, 4]. */\n supportedAutonomyLevels?: AutonomyLevel[];\n inputs?: string[];\n defaults?: WorkflowDefaults;\n phases: WorkflowPhase[];\n}\n\nexport const ALL_AUTONOMY_LEVELS: readonly AutonomyLevel[] = [0, 1, 2, 3, 4];\n\nconst workflowDefinitionObjectSchema = z.object({\n id: z.string().min(1, 'workflow id must be a non-empty string'),\n type: z.literal('workflow').optional(),\n name: z.string().min(1, 'workflow name must be a non-empty string'),\n description: z.string().optional(),\n mode: workflowModeSchema,\n supportedAutonomyLevels: z.array(autonomyLevelSchema).optional(),\n inputs: z.array(z.string().min(1)).optional(),\n defaults: z\n .object({\n model: z.string().min(1).optional(),\n commands: z.array(z.string().min(1)).optional(),\n })\n .optional(),\n phases: z.array(workflowPhaseSchema).min(1, 'a workflow must declare at least one phase'),\n});\n\n/**\n * Schema for a full workflow definition. `supportedAutonomyLevels` defaults\n * to all levels when omitted.\n */\nexport const workflowDefinitionSchema = workflowDefinitionObjectSchema\n .superRefine((definition, ctx) => {\n // Phase ids must be unique: events are attributed to a phase by id, so a\n // duplicate would merge two phases in the rail / reduceRail and corrupt\n // progress tracking.\n const seen = new Set<string>();\n definition.phases.forEach((phase, index) => {\n if (seen.has(phase.id)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `duplicate phase id \"${phase.id}\" — phase ids must be unique`,\n path: ['phases', index, 'id'],\n });\n }\n seen.add(phase.id);\n });\n })\n .transform(\n (definition): WorkflowDefinition => ({\n ...definition,\n supportedAutonomyLevels: definition.supportedAutonomyLevels ?? [...ALL_AUTONOMY_LEVELS],\n }),\n );\n\n/** Approval guidance values used by methodology approval maps. */\nexport const methodologyApprovalValueSchema = z.enum([\n 'required',\n 'optional',\n 'recommended',\n 'none',\n]);\nexport type MethodologyApprovalValue = z.infer<typeof methodologyApprovalValueSchema>;\n\nexport const methodologyRiskProfileSchema = z.enum(['low', 'medium', 'high']);\nexport type MethodologyRiskProfile = z.infer<typeof methodologyRiskProfileSchema>;\n\nexport interface MethodologyQuestion {\n id: string;\n text: string;\n}\n\nexport interface Methodology {\n id: string;\n /** Optional discriminator used by declarative extension files. */\n type?: 'methodology';\n name: string;\n description: string;\n /** Defaults to 'delivery'. Discovery uses 'pre_work'. */\n category?: string;\n recommendedAutonomyLevels?: AutonomyLevel[];\n useWhen?: string[];\n avoidWhen?: string[];\n defaultWorkflow?: string;\n workflows?: string[];\n /** Conceptual phase names (not executable phases). */\n phases?: string[];\n artifacts?: string[];\n outputs?: string[];\n modes?: string[];\n questions?: MethodologyQuestion[];\n agentRoles?: AgentRole[];\n roles?: string[];\n approval?: Record<string, MethodologyApprovalValue>;\n /** Defaults to 'medium'. */\n riskProfile?: MethodologyRiskProfile;\n scoring?: unknown;\n}\n\nconst methodologyObjectSchema = z.object({\n id: z.string().min(1, 'methodology id must be a non-empty string'),\n type: z.literal('methodology').optional(),\n name: z.string().min(1, 'methodology name must be a non-empty string'),\n description: z.string().min(1, 'methodology description must be a non-empty string'),\n category: z.string().min(1).optional(),\n recommendedAutonomyLevels: z.array(autonomyLevelSchema).optional(),\n useWhen: z.array(z.string().min(1)).optional(),\n avoidWhen: z.array(z.string().min(1)).optional(),\n defaultWorkflow: z.string().min(1).optional(),\n workflows: z.array(z.string().min(1)).optional(),\n phases: z.array(z.string().min(1)).optional(),\n artifacts: z.array(z.string().min(1)).optional(),\n outputs: z.array(z.string().min(1)).optional(),\n modes: z.array(z.string().min(1)).optional(),\n questions: z\n .array(\n z.object({\n id: z.string().min(1, 'question id must be a non-empty string'),\n text: z.string().min(1, 'question text must be a non-empty string'),\n }),\n )\n .optional(),\n agentRoles: z.array(agentRoleSchema).optional(),\n roles: z.array(z.string().min(1)).optional(),\n approval: z.record(methodologyApprovalValueSchema).optional(),\n riskProfile: methodologyRiskProfileSchema.optional(),\n scoring: z.unknown().optional(),\n});\n\n/**\n * Schema for a methodology definition. Relaxed per the Build Contract:\n * `type`, `category`, `defaultWorkflow` and `riskProfile` are optional, with\n * `category` defaulting to 'delivery' and `riskProfile` to 'medium'.\n */\nexport const methodologySchema = methodologyObjectSchema.transform(\n (methodology): Methodology => ({\n ...methodology,\n category: methodology.category ?? 'delivery',\n riskProfile: methodology.riskProfile ?? 'medium',\n }),\n);\n","import { parse as parseYamlText } from 'yaml';\nimport { WorkflowValidationError } from '@excalibur/shared';\nimport type { z } from 'zod';\nimport {\n methodologySchema,\n workflowDefinitionSchema,\n type Methodology,\n type WorkflowDefinition,\n} from './schema';\n\n/**\n * YAML parsing and validation for workflow/methodology definitions.\n * All failures throw `WorkflowValidationError` with a human-readable message\n * naming the offending path and the problem.\n */\n\nfunction formatIssuePath(path: ReadonlyArray<string | number | symbol>): string {\n if (path.length === 0) return '(root)';\n let formatted = '';\n for (const segment of path) {\n if (typeof segment === 'number') {\n formatted += `[${String(segment)}]`;\n } else {\n formatted += formatted.length === 0 ? String(segment) : `.${String(segment)}`;\n }\n }\n return formatted;\n}\n\n/** Render zod issues as `path: problem` lines. */\nexport function formatValidationIssues(error: z.ZodError): string[] {\n return error.issues.map((issue) => `${formatIssuePath(issue.path)}: ${issue.message}`);\n}\n\nfunction describeValue(value: unknown): string {\n if (value === null) return 'null';\n if (value === undefined) return 'nothing';\n if (Array.isArray(value)) return 'a list';\n return `a ${typeof value}`;\n}\n\nfunction parseYamlDocument(yamlText: string, what: string): Record<string, unknown> {\n let value: unknown;\n try {\n value = parseYamlText(yamlText);\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new WorkflowValidationError(`Invalid ${what} YAML: ${reason}`, { reason });\n }\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new WorkflowValidationError(\n `Invalid ${what}: expected a YAML mapping with the ${what} fields, got ${describeValue(value)}.`,\n );\n }\n return value as Record<string, unknown>;\n}\n\nfunction definitionLabel(value: unknown, what: string): string {\n if (value !== null && typeof value === 'object' && !Array.isArray(value)) {\n const id = (value as Record<string, unknown>).id;\n if (typeof id === 'string' && id.length > 0) return `${what} \"${id}\"`;\n }\n return what;\n}\n\nfunction throwValidationError(value: unknown, what: string, error: z.ZodError): never {\n const issues = formatValidationIssues(error);\n const lines = issues.map((issue) => ` - ${issue}`).join('\\n');\n throw new WorkflowValidationError(`Invalid ${definitionLabel(value, what)}:\\n${lines}`, {\n issues,\n });\n}\n\n/**\n * Parse and validate a workflow definition from YAML text.\n * Throws `WorkflowValidationError` on YAML syntax errors or schema violations.\n */\nexport function parseWorkflowYaml(yamlText: string): WorkflowDefinition {\n const value = parseYamlDocument(yamlText, 'workflow definition');\n const result = workflowDefinitionSchema.safeParse(value);\n if (!result.success) {\n throwValidationError(value, 'workflow definition', result.error);\n }\n return result.data;\n}\n\n/**\n * Parse and validate a methodology definition from YAML text.\n * Throws `WorkflowValidationError` on YAML syntax errors or schema violations.\n */\nexport function parseMethodologyYaml(yamlText: string): Methodology {\n const value = parseYamlDocument(yamlText, 'methodology definition');\n const result = methodologySchema.safeParse(value);\n if (!result.success) {\n throwValidationError(value, 'methodology definition', result.error);\n }\n return result.data;\n}\n\nexport interface ValidationResult<T> {\n success: boolean;\n data?: T;\n errors?: string[];\n}\n\n/** Non-throwing validation of an already-parsed workflow definition value. */\nexport function validateWorkflowDefinition(value: unknown): ValidationResult<WorkflowDefinition> {\n const result = workflowDefinitionSchema.safeParse(value);\n if (result.success) return { success: true, data: result.data };\n return { success: false, errors: formatValidationIssues(result.error) };\n}\n\n/** Non-throwing validation of an already-parsed methodology value. */\nexport function validateMethodology(value: unknown): ValidationResult<Methodology> {\n const result = methodologySchema.safeParse(value);\n if (result.success) return { success: true, data: result.data };\n return { success: false, errors: formatValidationIssues(result.error) };\n}\n","/**\n * Built-in workflow catalog: the 14 default workflows (Build Contract §4.2).\n *\n * `fast-fix`, `structured-feature` and `explore-alternatives` are\n * verbatim-normative from the OSS spec §9, `discovery` from the Discovery\n * spec §5 and `ask-repo` follows the Onboarding spec §6.\n */\n// GENERATED FILE — do not edit the YAML constants by hand.\n// Source of truth: the YAML files at the package root. Regenerate with:\n// node scripts/generate-embedded-catalogs.mjs\nimport { parseWorkflowYaml } from './parse';\nimport type { WorkflowDefinition } from './schema';\n\n/** YAML source of the built-in `ask-repo` workflow (mirrored at `default-workflows/ask-repo.yaml`). */\nexport const ASK_REPO_WORKFLOW_YAML = `id: ask-repo\nname: Ask Repo\nmode: fast\nsupportedAutonomyLevels: [1]\ndescription: >\n Answer a question about the repository. Read-only: never modifies files.\nphases:\n - id: answer\n name: Answer\n type: assistant_interaction\n role: planner\n modifiesFiles: false\n output: answer.md\n`;\n\n/** YAML source of the built-in `review-only` workflow (mirrored at `default-workflows/review-only.yaml`). */\nexport const REVIEW_ONLY_WORKFLOW_YAML = `id: review-only\nname: Review Only\nmode: review\nsupportedAutonomyLevels: [0]\ndescription: >\n Review code or a diff and report findings. Read-only: never modifies files.\nphases:\n - id: review\n name: Review\n type: agent_review\n role: reviewer\n modifiesFiles: false\n output: review.md\n`;\n\n/** YAML source of the built-in `assist` workflow (mirrored at `default-workflows/assist.yaml`). */\nexport const ASSIST_WORKFLOW_YAML = `id: assist\nname: Assist\nmode: fast\nsupportedAutonomyLevels: [1]\ndescription: >\n Explain code, answer questions and suggest improvements without producing\n automatic diffs.\nphases:\n - id: assist\n name: Assist\n type: assistant_interaction\n role: planner\n modifiesFiles: false\n output: answer.md\n`;\n\n/** YAML source of the built-in `propose-patch` workflow (mirrored at `default-workflows/propose-patch.yaml`). */\nexport const PROPOSE_PATCH_WORKFLOW_YAML = `id: propose-patch\nname: Propose Patch\nmode: standard\nsupportedAutonomyLevels: [2]\ndescription: >\n Generate a reviewable patch for a task. The patch is never applied\n automatically; the developer decides to apply, branch or reject it.\nphases:\n - id: analyze\n name: Analyze\n type: assistant_interaction\n role: reviewer\n modifiesFiles: false\n - id: patch\n name: Patch\n type: patch_generation\n role: implementer\n modifiesFiles: false\n output: diff.patch\n - id: summarize\n name: Summarize\n type: agent_output\n output: summary.md\n`;\n\n/** YAML source of the built-in `fast-fix` workflow (mirrored at `default-workflows/fast-fix.yaml`). */\nexport const FAST_FIX_WORKFLOW_YAML = `id: fast-fix\nname: Fast Fix\nmode: fast\nsupportedAutonomyLevels: [2, 3]\nphases:\n - id: analyze\n name: Analyze\n type: assistant_interaction\n role: reviewer\n modifiesFiles: false\n - id: patch\n name: Patch\n type: patch_generation\n role: implementer\n modifiesFiles: false\n output: diff.patch\n - id: optional_apply\n name: Optional Apply\n type: apply_patch\n requiresHumanConfirmation: true\n - id: verify\n name: Verify\n type: command_group\n optional: true\n commandsFromConfig: true\n - id: summarize\n name: Summarize\n type: agent_output\n output: summary.md\n`;\n\n/** YAML source of the built-in `standard-feature` workflow (mirrored at `default-workflows/standard-feature.yaml`). */\nexport const STANDARD_FEATURE_WORKFLOW_YAML = `id: standard-feature\nname: Standard Feature\nmode: standard\nsupportedAutonomyLevels: [3, 4]\ndescription: >\n Plan, implement and verify a feature in an isolated branch or worktree,\n then document the change, review it and end with a PR summary.\nphases:\n - id: plan\n name: Plan\n type: agent_output\n role: planner\n output: plan.md\n - id: implement\n name: Implement\n type: agent_work\n role: implementer\n worktree: true\n agents: 1\n - id: verify\n name: Verify\n type: command_group\n commandsFromConfig: true\n - id: document\n name: Document\n type: agent_work\n role: architect\n output: documentation.md\n - id: review\n name: Review\n type: agent_review\n role: reviewer\n output: review.md\n - id: pr_summary\n name: PR Summary\n type: agent_output\n role: release\n output: pr-summary.md\n`;\n\n/** YAML source of the built-in `structured-feature` workflow (mirrored at `default-workflows/structured-feature.yaml`). */\nexport const STRUCTURED_FEATURE_WORKFLOW_YAML = `id: structured-feature\nname: Structured Feature\nmode: structured\nsupportedAutonomyLevels: [3, 4]\nphases:\n - id: context\n name: Context Discovery\n type: agent_output\n role: planner\n output: context.md\n - id: spec\n name: Spec\n type: agent_output\n role: planner\n output: spec.md\n approval: optional\n - id: plan\n name: Plan\n type: agent_output\n role: planner\n output: plan.md\n approval: optional\n - id: implement\n name: Implement\n type: agent_work\n role: implementer\n worktree: true\n agents: 1\n - id: verify\n name: Verify\n type: command_group\n commandsFromConfig: true\n - id: review\n name: Review\n type: agent_review\n role: reviewer\n output: review.md\n - id: pr_summary\n name: PR Summary\n type: agent_output\n role: release\n output: pr-summary.md\n`;\n\n/** YAML source of the built-in `safe-refactor` workflow (mirrored at `default-workflows/safe-refactor.yaml`). */\nexport const SAFE_REFACTOR_WORKFLOW_YAML = `id: safe-refactor\nname: Safe Refactor\nmode: structured\nsupportedAutonomyLevels: [2, 3, 4]\ndescription: >\n Refactor with no intended behavior change: capture scope and invariants,\n establish a test baseline, refactor in isolation and review the diff.\nphases:\n - id: scope\n name: Scope\n type: agent_output\n role: planner\n output: scope.md\n - id: invariants\n name: Invariants\n type: agent_output\n role: architect\n output: invariants.md\n - id: baseline\n name: Baseline Tests\n type: command_group\n commandsFromConfig: true\n - id: refactor\n name: Refactor\n type: agent_work\n role: implementer\n worktree: true\n - id: verify\n name: Verify\n type: command_group\n commandsFromConfig: true\n - id: document\n name: Document\n type: agent_work\n role: architect\n optional: true\n output: documentation.md\n - id: diff_review\n name: Diff Review\n type: agent_review\n role: reviewer\n output: review.md\n`;\n\n/** YAML source of the built-in `pr-review` workflow (mirrored at `default-workflows/pr-review.yaml`). */\nexport const PR_REVIEW_WORKFLOW_YAML = `id: pr-review\nname: PR Review\nmode: review\nsupportedAutonomyLevels: [0, 1]\ndescription: >\n Review a pull request or local diff and produce structured findings.\n Read-only: never modifies files.\nphases:\n - id: context\n name: Context\n type: agent_output\n role: planner\n modifiesFiles: false\n output: context.md\n - id: review\n name: Review Diff\n type: agent_review\n role: reviewer\n modifiesFiles: false\n output: review.md\n`;\n\n/** YAML source of the built-in `security-review` workflow (mirrored at `default-workflows/security-review.yaml`). */\nexport const SECURITY_REVIEW_WORKFLOW_YAML = `id: security-review\nname: Security Review\nmode: structured\nsupportedAutonomyLevels: [0, 1, 2, 3, 4]\ndescription: >\n Security-first flow for sensitive changes: risk analysis and plan first,\n optional isolated implementation, then a dedicated security review, tests\n and a mandatory human approval.\nphases:\n - id: risk_analysis\n name: Risk Analysis\n type: agent_output\n role: security\n output: risk-analysis.md\n - id: plan\n name: Plan\n type: agent_output\n role: planner\n output: plan.md\n approval: optional\n - id: implement\n name: Implement\n type: agent_work\n role: implementer\n worktree: true\n optional: true\n - id: security_review\n name: Security Review\n type: agent_review\n role: security\n output: review.md\n - id: verify\n name: Verify\n type: command_group\n optional: true\n commandsFromConfig: true\n - id: document\n name: Document\n type: agent_work\n role: architect\n output: documentation.md\n - id: approve\n name: Human Approval\n type: human_approval\n approval: required\n`;\n\n/** YAML source of the built-in `migration` workflow (mirrored at `default-workflows/migration.yaml`). */\nexport const MIGRATION_WORKFLOW_YAML = `id: migration\nname: Migration\nmode: structured\nsupportedAutonomyLevels: [3, 4]\ndescription: >\n Plan and execute a migration with a backward-compatibility check,\n rollback notes, tests, documentation and review.\nphases:\n - id: migration_plan\n name: Migration Plan\n type: agent_output\n role: planner\n output: migration-plan.md\n approval: optional\n - id: compatibility\n name: Backward Compatibility Check\n type: agent_output\n role: architect\n output: compatibility.md\n - id: implement\n name: Implement\n type: agent_work\n role: implementer\n worktree: true\n - id: rollback_notes\n name: Rollback Notes\n type: agent_output\n role: implementer\n output: rollback-notes.md\n - id: verify\n name: Verify\n type: command_group\n commandsFromConfig: true\n - id: document\n name: Document\n type: agent_work\n role: architect\n output: documentation.md\n - id: review\n name: Review\n type: agent_review\n role: reviewer\n output: review.md\n`;\n\n/** YAML source of the built-in `explore-alternatives` workflow (mirrored at `default-workflows/explore-alternatives.yaml`). */\nexport const EXPLORE_ALTERNATIVES_WORKFLOW_YAML = `id: explore-alternatives\nname: Explore Alternatives\nmode: explore\nsupportedAutonomyLevels: [3, 4]\nphases:\n - id: understand\n name: Understand Task\n type: agent_output\n role: planner\n output: context.md\n - id: alternatives\n name: Generate Alternatives\n type: agent_output\n role: architect\n output: alternatives.md\n - id: choose\n name: Choose Approach\n type: human_approval\n optional: true\n - id: implement\n name: Implement Selected Approach\n type: agent_work\n role: implementer\n worktree: true\n - id: verify\n name: Verify\n type: command_group\n commandsFromConfig: true\n - id: summarize\n name: Summarize\n type: agent_output\n output: summary.md\n`;\n\n/** YAML source of the built-in `human-gated` workflow (mirrored at `default-workflows/human-gated.yaml`). */\nexport const HUMAN_GATED_WORKFLOW_YAML = `id: human-gated\nname: Human-Gated Agentic Workflow\nmode: structured\nsupportedAutonomyLevels: [3, 4]\ndescription: >\n Full agentic workflow with mandatory human approval gates before\n implementation and before the pull request.\nphases:\n - id: plan\n name: Plan\n type: agent_output\n role: planner\n output: plan.md\n - id: approve_plan\n name: Approve Plan\n type: human_approval\n approval: required\n - id: implement\n name: Implement\n type: agent_work\n role: implementer\n worktree: true\n - id: verify\n name: Verify\n type: command_group\n commandsFromConfig: true\n - id: approve_changes\n name: Approve Changes\n type: human_approval\n approval: required\n - id: pull_request\n name: Pull Request\n type: pull_request\n role: release\n output: pr-summary.md\n`;\n\n/** YAML source of the built-in `discovery` workflow (mirrored at `default-workflows/discovery.yaml`). */\nexport const DISCOVERY_WORKFLOW_YAML = `id: discovery\nname: Discovery\nmode: discovery\nsupportedAutonomyLevels: [0, 1]\ndescription: >\n Lightweight conversational pre-work flow to clarify ideas, tickets, feedback or technical initiatives before implementation.\nphases:\n - id: intake\n name: Intake\n type: assistant_interaction\n role: product_strategist\n modifiesFiles: false\n output: intake.md\n - id: questions\n name: Guided Questions\n type: discovery_questions\n role: product_strategist\n modifiesFiles: false\n output: transcript.md\n - id: synthesis\n name: Synthesis\n type: agent_output\n role: discovery_reviewer\n modifiesFiles: false\n output: discovery-summary.md\n - id: readiness\n name: Readiness Assessment\n type: agent_output\n role: scope_guardian\n modifiesFiles: false\n output: readiness-assessment.md\n - id: recommendation\n name: Recommendation\n type: agent_output\n role: scope_guardian\n modifiesFiles: false\n output: recommendation.md\n`;\n\nexport const DEFAULT_WORKFLOWS: ReadonlyArray<{\n id: string;\n yaml: string;\n definition: WorkflowDefinition;\n}> = [\n {\n id: 'ask-repo',\n yaml: ASK_REPO_WORKFLOW_YAML,\n definition: parseWorkflowYaml(ASK_REPO_WORKFLOW_YAML),\n },\n {\n id: 'review-only',\n yaml: REVIEW_ONLY_WORKFLOW_YAML,\n definition: parseWorkflowYaml(REVIEW_ONLY_WORKFLOW_YAML),\n },\n { id: 'assist', yaml: ASSIST_WORKFLOW_YAML, definition: parseWorkflowYaml(ASSIST_WORKFLOW_YAML) },\n {\n id: 'propose-patch',\n yaml: PROPOSE_PATCH_WORKFLOW_YAML,\n definition: parseWorkflowYaml(PROPOSE_PATCH_WORKFLOW_YAML),\n },\n {\n id: 'fast-fix',\n yaml: FAST_FIX_WORKFLOW_YAML,\n definition: parseWorkflowYaml(FAST_FIX_WORKFLOW_YAML),\n },\n {\n id: 'standard-feature',\n yaml: STANDARD_FEATURE_WORKFLOW_YAML,\n definition: parseWorkflowYaml(STANDARD_FEATURE_WORKFLOW_YAML),\n },\n {\n id: 'structured-feature',\n yaml: STRUCTURED_FEATURE_WORKFLOW_YAML,\n definition: parseWorkflowYaml(STRUCTURED_FEATURE_WORKFLOW_YAML),\n },\n {\n id: 'safe-refactor',\n yaml: SAFE_REFACTOR_WORKFLOW_YAML,\n definition: parseWorkflowYaml(SAFE_REFACTOR_WORKFLOW_YAML),\n },\n {\n id: 'pr-review',\n yaml: PR_REVIEW_WORKFLOW_YAML,\n definition: parseWorkflowYaml(PR_REVIEW_WORKFLOW_YAML),\n },\n {\n id: 'security-review',\n yaml: SECURITY_REVIEW_WORKFLOW_YAML,\n definition: parseWorkflowYaml(SECURITY_REVIEW_WORKFLOW_YAML),\n },\n {\n id: 'migration',\n yaml: MIGRATION_WORKFLOW_YAML,\n definition: parseWorkflowYaml(MIGRATION_WORKFLOW_YAML),\n },\n {\n id: 'explore-alternatives',\n yaml: EXPLORE_ALTERNATIVES_WORKFLOW_YAML,\n definition: parseWorkflowYaml(EXPLORE_ALTERNATIVES_WORKFLOW_YAML),\n },\n {\n id: 'human-gated',\n yaml: HUMAN_GATED_WORKFLOW_YAML,\n definition: parseWorkflowYaml(HUMAN_GATED_WORKFLOW_YAML),\n },\n {\n id: 'discovery',\n yaml: DISCOVERY_WORKFLOW_YAML,\n definition: parseWorkflowYaml(DISCOVERY_WORKFLOW_YAML),\n },\n];\n\nconst workflowsById = new Map(DEFAULT_WORKFLOWS.map((entry) => [entry.id, entry.definition]));\n\n/** Look up a built-in workflow definition by id. */\nexport function getDefaultWorkflow(id: string): WorkflowDefinition | undefined {\n return workflowsById.get(id);\n}\n","/**\n * Built-in methodology catalog: the 14 default methodologies — the 12 of the\n * OSS spec §7 plus `discovery` (Discovery spec §4, verbatim-normative) and\n * `agentic-agile-light` (Onboarding spec §6). `spec-driven` is\n * verbatim-normative from the OSS spec §8.\n */\n// GENERATED FILE — do not edit the YAML constants by hand.\n// Source of truth: the YAML files at the package root. Regenerate with:\n// node scripts/generate-embedded-catalogs.mjs\nimport { parseMethodologyYaml } from './parse';\nimport type { Methodology } from './schema';\n\n/** YAML source of the built-in `lightweight` methodology (mirrored at `default-methodologies/lightweight.yaml`). */\nexport const LIGHTWEIGHT_METHODOLOGY_YAML = `id: lightweight\nname: Lightweight Assistant\ncategory: delivery\ndescription: >\n Ask questions, get explanations and review suggestions. The AI responds;\n the developer decides what to do with it.\nrecommendedAutonomyLevels: [0, 1]\nuseWhen:\n - You need a quick answer about the codebase\n - You want unfamiliar code explained\n - You want suggestions without any code changes\navoidWhen:\n - You already know the change and want a patch\n - The task needs a structured multi-phase workflow\ndefaultWorkflow: assist\nphases:\n - question\n - response\n - decide\nartifacts:\n - answer.md\nagentRoles:\n - planner\napproval:\n beforePr: none\nriskProfile: low\n`;\n\n/** YAML source of the built-in `review-first` methodology (mirrored at `default-methodologies/review-first.yaml`). */\nexport const REVIEW_FIRST_METHODOLOGY_YAML = `id: review-first\nname: Review-First Development\ncategory: delivery\ndescription: >\n The developer writes the code; the AI reviews diffs and files and the\n developer applies fixes before opening a PR.\nrecommendedAutonomyLevels: [0, 1, 2]\nuseWhen:\n - You want a second pair of eyes on your changes\n - Code review capacity is limited\n - You are changing unfamiliar or critical code\navoidWhen:\n - You want the AI to implement the change itself\n - The change is trivial and already covered by tests\ndefaultWorkflow: review-only\nphases:\n - write\n - review\n - fix\n - pr\nartifacts:\n - review.md\nagentRoles:\n - reviewer\napproval:\n beforePr: recommended\nriskProfile: low\n`;\n\n/** YAML source of the built-in `patch-proposal` methodology (mirrored at `default-methodologies/patch-proposal.yaml`). */\nexport const PATCH_PROPOSAL_METHODOLOGY_YAML = `id: patch-proposal\nname: Patch-Proposal Workflow\ncategory: delivery\ndescription: >\n The AI generates a reviewable patch for a task; a human reviews it and\n decides whether to apply it.\nrecommendedAutonomyLevels: [2]\nuseWhen:\n - The change is well understood and narrow\n - You want full control over what lands in the working tree\n - You are evaluating how the AI handles your codebase\navoidWhen:\n - The task needs multi-step implementation with tests\n - The change spans many modules\ndefaultWorkflow: propose-patch\nphases:\n - task\n - patch\n - review\n - apply\nartifacts:\n - diff.patch\n - summary.md\nagentRoles:\n - reviewer\n - implementer\napproval:\n apply: required\nriskProfile: low\n`;\n\n/** YAML source of the built-in `fast-fix` methodology (mirrored at `default-methodologies/fast-fix.yaml`). */\nexport const FAST_FIX_METHODOLOGY_YAML = `id: fast-fix\nname: Fast Fix\ncategory: delivery\ndescription: >\n Small, well-scoped fixes: analyze, generate a patch in an isolated branch\n or worktree, verify with tests and summarize.\nrecommendedAutonomyLevels: [2, 3]\nuseWhen:\n - The bug is small and well scoped\n - The fix is unlikely to affect other modules\n - You want a fast loop with a verifiable diff\navoidWhen:\n - Requirements are ambiguous\n - The change touches sensitive paths\n - The fix requires design decisions\ndefaultWorkflow: fast-fix\nphases:\n - analyze\n - patch\n - verify\n - summarize\nartifacts:\n - diff.patch\n - summary.md\n - test-results.json\nagentRoles:\n - reviewer\n - implementer\n - tester\napproval:\n apply: required\nriskProfile: low\n`;\n\n/** YAML source of the built-in `plan-then-execute` methodology (mirrored at `default-methodologies/plan-then-execute.yaml`). */\nexport const PLAN_THEN_EXECUTE_METHODOLOGY_YAML = `id: plan-then-execute\nname: Plan-Then-Execute\ncategory: delivery\ndescription: >\n Produce a short plan before implementation, then implement, run tests and\n review the result.\nrecommendedAutonomyLevels: [3, 4]\nuseWhen:\n - The task benefits from a brief upfront plan\n - You want a checkpoint before code changes\n - The implementation has a few coordinated steps\navoidWhen:\n - The change is trivial\n - The task needs a full spec and traceability\ndefaultWorkflow: standard-feature\nphases:\n - plan\n - implement\n - verify\n - review\nartifacts:\n - plan.md\n - review.md\nagentRoles:\n - planner\n - implementer\n - reviewer\n - tester\napproval:\n plan: optional\n beforePr: recommended\nriskProfile: medium\n`;\n\n/** YAML source of the built-in `spec-driven` methodology (mirrored at `default-methodologies/spec-driven.yaml`). */\nexport const SPEC_DRIVEN_METHODOLOGY_YAML = `id: spec-driven\nname: Spec-Driven Development\ndescription: >\n A structured workflow for turning ambiguous tasks into specs, plans, tasks and\n verified implementation.\nrecommendedAutonomyLevels: [3, 4]\nuseWhen:\n - Requirements are ambiguous\n - Multiple modules are involved\n - Customer-facing behavior changes\n - The team wants traceability\navoidWhen:\n - Tiny bugfixes\n - Mechanical edits\n - Urgent hotfixes\ndefaultWorkflow: structured-feature\nphases:\n - understand\n - specify\n - plan\n - implement\n - verify\n - review\nartifacts:\n - spec.md\n - plan.md\n - tasks.md\n - verification.md\nagentRoles:\n - planner\n - implementer\n - reviewer\n - tester\napproval:\n spec: optional\n plan: optional\n beforePr: recommended\nriskProfile: medium\n`;\n\n/** YAML source of the built-in `tdd-agentic` methodology (mirrored at `default-methodologies/tdd-agentic.yaml`). */\nexport const TDD_AGENTIC_METHODOLOGY_YAML = `id: tdd-agentic\nname: Test-Driven Agentic Development\ncategory: delivery\ndescription: >\n Reproduce the problem with a failing test first, implement until tests\n pass, then review. Strong regression protection for critical logic.\nrecommendedAutonomyLevels: [2, 3, 4]\nuseWhen:\n - You are fixing a bug and want regression protection\n - The change touches critical business logic\n - The expected behavior can be captured in a test\navoidWhen:\n - The behavior is hard to test automatically\n - The change is purely cosmetic or documentation\ndefaultWorkflow: standard-feature\nphases:\n - reproduce\n - failing_test\n - implement\n - verify\n - review\nartifacts:\n - diff.patch\n - test-results.json\n - tests.log\n - review.md\nagentRoles:\n - tester\n - implementer\n - reviewer\napproval:\n beforePr: recommended\nriskProfile: medium\n`;\n\n/** YAML source of the built-in `safe-refactor` methodology (mirrored at `default-methodologies/safe-refactor.yaml`). */\nexport const SAFE_REFACTOR_METHODOLOGY_YAML = `id: safe-refactor\nname: Safe Refactor\ncategory: delivery\ndescription: >\n Refactor with no intended behavior change: define scope and invariants,\n capture a baseline with tests, refactor and review the diff against the\n invariants.\nrecommendedAutonomyLevels: [2, 3, 4]\nuseWhen:\n - No behavior change is intended\n - The code needs structural cleanup before new work\n - Test coverage exists or can be established first\navoidWhen:\n - Behavior changes are expected\n - There is no way to verify invariants\ndefaultWorkflow: safe-refactor\nphases:\n - scope\n - invariants\n - baseline_tests\n - refactor\n - verify\n - diff_review\nartifacts:\n - scope.md\n - invariants.md\n - review.md\n - test-results.json\nagentRoles:\n - planner\n - architect\n - implementer\n - reviewer\n - tester\napproval:\n beforePr: recommended\nriskProfile: medium\n`;\n\n/** YAML source of the built-in `security-first` methodology (mirrored at `default-methodologies/security-first.yaml`). */\nexport const SECURITY_FIRST_METHODOLOGY_YAML = `id: security-first\nname: Security-First Workflow\ncategory: delivery\ndescription: >\n For security-sensitive changes: analyze risk, plan, implement carefully,\n run a dedicated security review and tests, and require human approval.\nrecommendedAutonomyLevels: [0, 1, 2, 3, 4]\nuseWhen:\n - The change touches auth, payments, contracts or permissions\n - PII or secrets are involved\n - A vulnerability or hardening task is being addressed\navoidWhen:\n - The change has no security surface\n - Speed matters more than depth and the area is not sensitive\ndefaultWorkflow: security-review\nphases:\n - risk_analysis\n - plan\n - implement\n - security_review\n - verify\n - approval\nartifacts:\n - risk-analysis.md\n - plan.md\n - review.md\nagentRoles:\n - security\n - planner\n - implementer\n - reviewer\napproval:\n plan: optional\n beforePr: required\nriskProfile: high\n`;\n\n/** YAML source of the built-in `migration` methodology (mirrored at `default-methodologies/migration.yaml`). */\nexport const MIGRATION_METHODOLOGY_YAML = `id: migration\nname: Migration Workflow\ncategory: delivery\ndescription: >\n Plan and execute schema or infrastructure migrations with a backward\n compatibility check, rollback notes and verification.\nrecommendedAutonomyLevels: [3, 4]\nuseWhen:\n - A database schema or data migration is required\n - Infrastructure or dependency migrations need care\n - Backward compatibility must be preserved\navoidWhen:\n - The change does not alter persisted state or infrastructure\n - A simple code-only fix is enough\ndefaultWorkflow: migration\nphases:\n - migration_plan\n - compatibility_check\n - implement\n - rollback_notes\n - verify\nartifacts:\n - migration-plan.md\n - compatibility.md\n - rollback-notes.md\n - test-results.json\nagentRoles:\n - planner\n - architect\n - implementer\n - tester\n - reviewer\napproval:\n migrationPlan: recommended\n beforePr: required\nriskProfile: high\n`;\n\n/** YAML source of the built-in `explore-then-choose` methodology (mirrored at `default-methodologies/explore-then-choose.yaml`). */\nexport const EXPLORE_THEN_CHOOSE_METHODOLOGY_YAML = `id: explore-then-choose\nname: Explore Alternatives\ncategory: delivery\ndescription: >\n Generate and compare engineering approaches before committing: understand\n the task, present alternatives with trade-offs, choose one and implement\n it. Present results as approach exploration, never as model comparison.\nrecommendedAutonomyLevels: [3, 4]\nuseWhen:\n - The decision is complex with several viable designs\n - Trade-offs need to be explicit before implementation\n - The team disagrees on the approach\navoidWhen:\n - One approach is clearly correct\n - The change is small or mechanical\ndefaultWorkflow: explore-alternatives\nphases:\n - understand\n - alternatives\n - compare\n - choose\n - implement\n - verify\nartifacts:\n - context.md\n - alternatives.md\n - summary.md\nagentRoles:\n - planner\n - architect\n - implementer\n - reviewer\napproval:\n choose: recommended\nriskProfile: medium\n`;\n\n/** YAML source of the built-in `human-gated` methodology (mirrored at `default-methodologies/human-gated.yaml`). */\nexport const HUMAN_GATED_METHODOLOGY_YAML = `id: human-gated\nname: Human-Gated Agentic Workflow\ncategory: delivery\ndescription: >\n Full agentic implementation with mandatory human approvals: the plan is\n approved before implementation and the result is approved before the PR.\nrecommendedAutonomyLevels: [3, 4]\nuseWhen:\n - High-stakes changes need explicit human checkpoints\n - Compliance or team policy requires approvals\n - You are building trust in agentic execution\navoidWhen:\n - The change is small and low risk\n - Approval latency would block urgent work\ndefaultWorkflow: human-gated\nphases:\n - plan\n - approve_plan\n - implement\n - verify\n - approve_changes\n - pr\nartifacts:\n - plan.md\n - review.md\n - pr-summary.md\nagentRoles:\n - planner\n - implementer\n - reviewer\n - release\napproval:\n plan: required\n beforePr: required\nriskProfile: high\n`;\n\n/** YAML source of the built-in `discovery` methodology (mirrored at `default-methodologies/discovery.yaml`). */\nexport const DISCOVERY_METHODOLOGY_YAML = `id: discovery\nname: Discovery\ncategory: pre_work\ndescription: >\n A lightweight methodology to clarify ideas, tickets, feedback or technical initiatives before implementation.\nrecommendedAutonomyLevels: [0, 1]\nuseWhen:\n - The idea is ambiguous\n - The target user or problem is unclear\n - A ticket lacks acceptance criteria\n - Customer feedback needs synthesis\n - A technical initiative needs framing\n - The team is unsure whether an agent should implement it\n - The work may need validation before build\navoidWhen:\n - The task is a clear bugfix\n - The change is mechanical\n - The ticket is already implementation-ready\n - The work is urgent and well scoped\ndefaultWorkflow: discovery\nphases:\n - intake\n - questions\n - synthesis\n - readiness\n - recommendation\noutputs:\n - discovery-summary.md\n - refined-ticket.md\n - acceptance-criteria.md\n - mvp-scope.md\n - readiness-assessment.md\n - recommendation.md\nmodes:\n - product_idea\n - existing_work_item\n - customer_feedback\n - technical_initiative\n - incident\n - agent_readiness\n - mvp_scope\nquestions:\n - id: problem\n text: What problem are we trying to solve?\n - id: user\n text: Who has this problem?\n - id: current_workaround\n text: What do they do today?\n - id: urgency\n text: Why does it matter now?\n - id: mvp\n text: What is the smallest useful version?\n - id: out_of_scope\n text: What is explicitly out of scope?\n - id: success\n text: How will we know it worked?\n - id: evidence\n text: What evidence do we have?\n - id: readiness\n text: Is this ready for implementation by a human or an agent?\nriskProfile: low\n`;\n\n/** YAML source of the built-in `agentic-agile-light` methodology (mirrored at `default-methodologies/agentic-agile-light.yaml`). */\nexport const AGENTIC_AGILE_LIGHT_METHODOLOGY_YAML = `id: agentic-agile-light\nname: Agentic Agile (Light)\ncategory: delivery\ndescription: >\n Lightweight async agile rituals for agentic development: local daily\n summaries and weekly plans generated from runs, patches and git activity.\n A facilitation layer — it never imposes a specific agile process.\nrecommendedAutonomyLevels: [0, 1]\nuseWhen:\n - The team wants async visibility without extra meetings\n - You want daily summaries of local AI-assisted work\n - You want a lightweight weekly plan from recent activity\navoidWhen:\n - You need enterprise planning, scheduling or governance\n - The team is happy with its existing agile tooling\ndefaultWorkflow: ask-repo\nphases:\n - daily_summary\n - weekly_planning\noutputs:\n - reports/daily-YYYY-MM-DD.md\n - reports/weekly-plan-YYYY-Www.md\nagentRoles:\n - planner\napproval:\n beforePr: none\nriskProfile: low\n`;\n\nexport const DEFAULT_METHODOLOGIES: ReadonlyArray<{\n id: string;\n yaml: string;\n definition: Methodology;\n}> = [\n {\n id: 'lightweight',\n yaml: LIGHTWEIGHT_METHODOLOGY_YAML,\n definition: parseMethodologyYaml(LIGHTWEIGHT_METHODOLOGY_YAML),\n },\n {\n id: 'review-first',\n yaml: REVIEW_FIRST_METHODOLOGY_YAML,\n definition: parseMethodologyYaml(REVIEW_FIRST_METHODOLOGY_YAML),\n },\n {\n id: 'patch-proposal',\n yaml: PATCH_PROPOSAL_METHODOLOGY_YAML,\n definition: parseMethodologyYaml(PATCH_PROPOSAL_METHODOLOGY_YAML),\n },\n {\n id: 'fast-fix',\n yaml: FAST_FIX_METHODOLOGY_YAML,\n definition: parseMethodologyYaml(FAST_FIX_METHODOLOGY_YAML),\n },\n {\n id: 'plan-then-execute',\n yaml: PLAN_THEN_EXECUTE_METHODOLOGY_YAML,\n definition: parseMethodologyYaml(PLAN_THEN_EXECUTE_METHODOLOGY_YAML),\n },\n {\n id: 'spec-driven',\n yaml: SPEC_DRIVEN_METHODOLOGY_YAML,\n definition: parseMethodologyYaml(SPEC_DRIVEN_METHODOLOGY_YAML),\n },\n {\n id: 'tdd-agentic',\n yaml: TDD_AGENTIC_METHODOLOGY_YAML,\n definition: parseMethodologyYaml(TDD_AGENTIC_METHODOLOGY_YAML),\n },\n {\n id: 'safe-refactor',\n yaml: SAFE_REFACTOR_METHODOLOGY_YAML,\n definition: parseMethodologyYaml(SAFE_REFACTOR_METHODOLOGY_YAML),\n },\n {\n id: 'security-first',\n yaml: SECURITY_FIRST_METHODOLOGY_YAML,\n definition: parseMethodologyYaml(SECURITY_FIRST_METHODOLOGY_YAML),\n },\n {\n id: 'migration',\n yaml: MIGRATION_METHODOLOGY_YAML,\n definition: parseMethodologyYaml(MIGRATION_METHODOLOGY_YAML),\n },\n {\n id: 'explore-then-choose',\n yaml: EXPLORE_THEN_CHOOSE_METHODOLOGY_YAML,\n definition: parseMethodologyYaml(EXPLORE_THEN_CHOOSE_METHODOLOGY_YAML),\n },\n {\n id: 'human-gated',\n yaml: HUMAN_GATED_METHODOLOGY_YAML,\n definition: parseMethodologyYaml(HUMAN_GATED_METHODOLOGY_YAML),\n },\n {\n id: 'discovery',\n yaml: DISCOVERY_METHODOLOGY_YAML,\n definition: parseMethodologyYaml(DISCOVERY_METHODOLOGY_YAML),\n },\n {\n id: 'agentic-agile-light',\n yaml: AGENTIC_AGILE_LIGHT_METHODOLOGY_YAML,\n definition: parseMethodologyYaml(AGENTIC_AGILE_LIGHT_METHODOLOGY_YAML),\n },\n];\n\nconst methodologiesById = new Map(\n DEFAULT_METHODOLOGIES.map((entry) => [entry.id, entry.definition]),\n);\n\n/** Look up a built-in methodology definition by id. */\nexport function getDefaultMethodology(id: string): Methodology | undefined {\n return methodologiesById.get(id);\n}\n","import type { DiscoveryInputType } from '@excalibur/shared';\n\n/**\n * Discovery question packs (Discovery spec §2), keyed by `DiscoveryInputType`.\n *\n * Scoring in `@excalibur/shared` inspects the well-known question ids:\n * problem, user, current_workaround, urgency, mvp, out_of_scope, success,\n * evidence, risks, readiness. Packs may add more ids; scoring ignores them.\n */\n\nexport interface DiscoveryQuestion {\n id: string;\n text: string;\n}\n\n/** Base pack, reused by `incident`, `mvp_scope` and `other`. */\nexport const BASE_QUESTION_PACK: ReadonlyArray<DiscoveryQuestion> = [\n { id: 'problem', text: 'What problem are we trying to solve?' },\n { id: 'user', text: 'Who has this problem?' },\n { id: 'current_workaround', text: 'What do they do today?' },\n { id: 'urgency', text: 'Why does it matter now?' },\n { id: 'mvp', text: 'What is the smallest useful version?' },\n { id: 'out_of_scope', text: 'What is explicitly out of scope?' },\n { id: 'success', text: 'How will we know it worked?' },\n { id: 'evidence', text: 'What evidence do we have?' },\n { id: 'risks', text: 'What risks or unknowns remain?' },\n { id: 'readiness', text: 'Is this ready for implementation?' },\n];\n\n/** Product idea pack (`idea`). */\nexport const IDEA_QUESTION_PACK: ReadonlyArray<DiscoveryQuestion> = [\n { id: 'user', text: 'Who specifically has this problem?' },\n { id: 'problem', text: 'What painful workflow are they experiencing?' },\n { id: 'current_workaround', text: 'What workaround do they use today?' },\n { id: 'frequency', text: 'How often does this happen?' },\n { id: 'urgency', text: 'What happens if they do nothing?' },\n { id: 'impact', text: 'What is the buying, retention or activation impact?' },\n { id: 'mvp', text: 'What is the smallest useful version?' },\n { id: 'kill_criteria', text: 'What would make this not worth building?' },\n];\n\n/** Existing ticket pack (`work_item`). */\nexport const WORK_ITEM_QUESTION_PACK: ReadonlyArray<DiscoveryQuestion> = [\n { id: 'problem', text: 'Is the user/problem clear from this ticket?' },\n { id: 'acceptance', text: 'Are acceptance criteria present?' },\n { id: 'expected', text: 'Is the expected behavior clear?' },\n { id: 'repo', text: 'Is the target repository known?' },\n { id: 'dependencies', text: 'Are there dependencies or linked tickets?' },\n { id: 'out_of_scope', text: 'What is explicitly out of scope?' },\n { id: 'tests', text: 'What tests should pass?' },\n { id: 'readiness', text: 'Is this ready for implementation?' },\n];\n\nexport const CUSTOMER_FEEDBACK_QUESTION_PACK: ReadonlyArray<DiscoveryQuestion> = [\n { id: 'verbatim', text: 'What did the customer actually say?' },\n { id: 'problem', text: 'Is this a request, a symptom or a real problem?' },\n { id: 'segment', text: 'What segment does this customer belong to?' },\n { id: 'evidence', text: 'How many customers have mentioned this?' },\n { id: 'current_workaround', text: 'What workaround do they use today?' },\n { id: 'impact', text: 'Is this blocking purchase, activation or retention?' },\n { id: 'validation', text: 'What cheap validation could we run?' },\n];\n\nexport const TECHNICAL_INITIATIVE_QUESTION_PACK: ReadonlyArray<DiscoveryQuestion> = [\n { id: 'problem', text: 'What technical problem are we solving?' },\n { id: 'urgency', text: 'What happens if we do nothing?' },\n { id: 'driver', text: 'Is this reliability-, cost-, security- or productivity-driven?' },\n { id: 'systems', text: 'What systems are affected?' },\n { id: 'mvp', text: 'What is the smallest safe change?' },\n { id: 'success', text: 'What tests or metrics would prove success?' },\n { id: 'risks', text: 'Does this require migration, rollback or feature flags?' },\n { id: 'reviewer', text: 'Who should review this?' },\n];\n\nexport const AGENT_READINESS_QUESTION_PACK: ReadonlyArray<DiscoveryQuestion> = [\n { id: 'problem', text: 'Is the goal clear enough for an agent?' },\n { id: 'acceptance', text: 'Are acceptance criteria present?' },\n { id: 'repo', text: 'Is the target repo known?' },\n { id: 'modules', text: 'Are affected modules known?' },\n { id: 'tests', text: 'Is there enough test coverage?' },\n { id: 'risks', text: 'Does it touch sensitive areas?' },\n { id: 'mode', text: 'Should AI only plan, propose a patch, or implement?' },\n { id: 'approval', text: 'Is human approval required before implementation?' },\n];\n\n/**\n * Question packs per Discovery input type. `incident`, `mvp_scope` and\n * `other` reuse the base pack; `work_item` uses the existing-ticket pack;\n * `idea` the product-idea pack.\n */\nexport const DISCOVERY_QUESTION_PACKS: Record<\n DiscoveryInputType,\n ReadonlyArray<DiscoveryQuestion>\n> = {\n idea: IDEA_QUESTION_PACK,\n work_item: WORK_ITEM_QUESTION_PACK,\n customer_feedback: CUSTOMER_FEEDBACK_QUESTION_PACK,\n technical_initiative: TECHNICAL_INITIATIVE_QUESTION_PACK,\n incident: BASE_QUESTION_PACK,\n agent_readiness: AGENT_READINESS_QUESTION_PACK,\n mvp_scope: BASE_QUESTION_PACK,\n other: BASE_QUESTION_PACK,\n};\n","/**\n * Minimal logger surface handed to extensions (Build Contract §4.6d).\n *\n * The SDK never prints by itself — packages must not use `console.log`\n * (Contract §2.5) — so the default logger is a silent no-op. The host (CLI or\n * Enterprise runtime) injects a real logger when it creates the context.\n */\nexport interface ExtensionLogger {\n info(msg: string): void;\n warn(msg: string): void;\n error(msg: string): void;\n}\n\n/** Configuration values resolved for an extension by the host. */\nexport type ExtensionConfig = Record<string, unknown>;\n\n/** Silent logger used when the host does not provide one. */\nexport function createNoopLogger(): ExtensionLogger {\n return {\n info: () => undefined,\n warn: () => undefined,\n error: () => undefined,\n };\n}\n","import type {\n Contribution,\n ContributionRegistry,\n HookRegistry,\n} from '@excalibur/extension-runtime';\nimport type { ModelProviderAdapter } from '@excalibur/model-gateway';\nimport type { AgentAdapter } from '@excalibur/agent-runtime';\nimport type { WorkItemProvider } from '@excalibur/work-items';\nimport type { z } from 'zod';\nimport {\n methodologySchema,\n validateMethodology,\n validateWorkflowDefinition,\n workflowDefinitionSchema,\n} from '@excalibur/workflow-schema';\nimport { WorkflowValidationError } from '@excalibur/shared';\nimport { ExtensionDefinitionError } from './errors';\nimport { createNoopLogger, type ExtensionConfig, type ExtensionLogger } from './logger';\nimport type { CommunicationProvider } from './interfaces/communication';\nimport type { AgentTool } from './interfaces/tools';\nimport type { ContextSource } from './interfaces/context-source';\nimport type { PolicyEvaluator } from './interfaces/policy';\nimport type { ReportGenerator } from './interfaces/reports';\nimport type { Exporter } from './interfaces/exporters';\n\n/**\n * `ExtensionContext` and the typed registries handed to programmatic\n * extensions (Build Contract §4.6d, extensions-spec.md §5).\n *\n * Every registry is a thin typed wrapper over\n * `ContributionRegistry.register`: it validates the contribution's identity,\n * stamps the owning extension id and source, and delegates. Conflict and\n * override rules stay in `@excalibur/extension-runtime`.\n */\n\n/** Where a contribution comes from; mirrors `Contribution['source']`. */\nexport type ExtensionSource = Contribution['source'];\n\n/** Methodology definition as authored (before schema normalization). */\nexport type MethodologyInput = z.input<typeof methodologySchema>;\n\n/** Workflow definition as authored (before schema normalization). */\nexport type WorkflowDefinitionInput = z.input<typeof workflowDefinitionSchema>;\n\n/** Shared binding the registry wrappers delegate through. */\ninterface RegistryBinding {\n readonly extensionId: string;\n readonly source: ExtensionSource;\n readonly contributions: ContributionRegistry;\n}\n\nfunction requireNonEmptyString(value: unknown, what: string, field: string): string {\n if (typeof value !== 'string' || value.trim().length === 0) {\n throw new ExtensionDefinitionError(`${what} requires a non-empty string \"${field}\"`, {\n field,\n received: typeof value,\n });\n }\n return value;\n}\n\nfunction requireFunctions(value: object, what: string, methods: readonly string[]): void {\n const record = value as Record<string, unknown>;\n for (const method of methods) {\n if (typeof record[method] !== 'function') {\n throw new ExtensionDefinitionError(`${what} must implement ${method}()`, {\n method,\n });\n }\n }\n}\n\nfunction requireObject(value: unknown, what: string): object {\n if (typeof value !== 'object' || value === null) {\n throw new ExtensionDefinitionError(`${what} must be an object`, {\n received: value === null ? 'null' : typeof value,\n });\n }\n return value;\n}\n\nfunction register(\n binding: RegistryBinding,\n kind: Contribution['kind'],\n id: string,\n payload: { definition?: unknown; value?: unknown },\n): void {\n const contribution: Contribution = {\n kind,\n id,\n extensionId: binding.extensionId,\n source: binding.source,\n ...payload,\n };\n binding.contributions.register(contribution);\n}\n\n/** Registers declarative methodology definitions (kind `methodology`). */\nexport class MethodologyRegistry {\n constructor(private readonly binding: RegistryBinding) {}\n\n register(definition: MethodologyInput): void {\n const result = validateMethodology(definition);\n if (!result.success || result.data === undefined) {\n throw new WorkflowValidationError(\n `Invalid methodology contributed by extension \"${this.binding.extensionId}\": ${(result.errors ?? ['unknown error']).join('; ')}`,\n { extensionId: this.binding.extensionId, errors: result.errors },\n );\n }\n register(this.binding, 'methodology', result.data.id, { definition: result.data });\n }\n}\n\n/** Registers declarative workflow definitions (kind `workflow`). */\nexport class WorkflowRegistry {\n constructor(private readonly binding: RegistryBinding) {}\n\n register(definition: WorkflowDefinitionInput): void {\n const result = validateWorkflowDefinition(definition);\n if (!result.success || result.data === undefined) {\n throw new WorkflowValidationError(\n `Invalid workflow contributed by extension \"${this.binding.extensionId}\": ${(result.errors ?? ['unknown error']).join('; ')}`,\n { extensionId: this.binding.extensionId, errors: result.errors },\n );\n }\n register(this.binding, 'workflow', result.data.id, { definition: result.data });\n }\n}\n\n/** Registers work item providers (kind `work_item_provider`). */\nexport class WorkItemProviderRegistry {\n constructor(private readonly binding: RegistryBinding) {}\n\n registerProvider(provider: WorkItemProvider): void {\n const obj = requireObject(provider, 'WorkItemProvider');\n const type = requireNonEmptyString(provider.type, 'WorkItemProvider', 'type');\n requireFunctions(obj, `WorkItemProvider \"${type}\"`, [\n 'getWorkItem',\n 'listWorkItems',\n 'addComment',\n 'updateStatus',\n 'linkPullRequest',\n 'validateCredentials',\n ]);\n register(this.binding, 'work_item_provider', type, { value: provider });\n }\n}\n\n/** Registers communication providers (kind `communication_provider`). */\nexport class CommunicationProviderRegistry {\n constructor(private readonly binding: RegistryBinding) {}\n\n registerProvider(provider: CommunicationProvider): void {\n const obj = requireObject(provider, 'CommunicationProvider');\n const type = requireNonEmptyString(provider.type, 'CommunicationProvider', 'type');\n requireFunctions(obj, `CommunicationProvider \"${type}\"`, [\n 'postMessage',\n 'postThreadReply',\n 'getThreadReplies',\n 'validateCredentials',\n ]);\n register(this.binding, 'communication_provider', type, { value: provider });\n }\n}\n\n/** Registers model provider adapters (kind `model_provider`). */\nexport class ModelProviderRegistry {\n constructor(private readonly binding: RegistryBinding) {}\n\n registerProvider(provider: ModelProviderAdapter): void {\n const obj = requireObject(provider, 'ModelProviderAdapter');\n const name = requireNonEmptyString(provider.name, 'ModelProviderAdapter', 'name');\n requireFunctions(obj, `ModelProviderAdapter \"${name}\"`, ['chat', 'stream']);\n register(this.binding, 'model_provider', name, { value: provider });\n }\n}\n\n/** Registers agent adapters (kind `agent_adapter`). */\nexport class AgentAdapterRegistry {\n constructor(private readonly binding: RegistryBinding) {}\n\n registerAdapter(adapter: AgentAdapter): void {\n const obj = requireObject(adapter, 'AgentAdapter');\n const id = requireNonEmptyString(adapter.id, 'AgentAdapter', 'id');\n requireFunctions(obj, `AgentAdapter \"${id}\"`, ['detect', 'run']);\n register(this.binding, 'agent_adapter', id, { value: adapter });\n }\n}\n\n/** Registers agent tools (kind `tool`). */\nexport class ToolRegistry {\n constructor(private readonly binding: RegistryBinding) {}\n\n registerTool(tool: AgentTool): void {\n const obj = requireObject(tool, 'AgentTool');\n const name = requireNonEmptyString(tool.name, 'AgentTool', 'name');\n requireNonEmptyString(tool.description, `AgentTool \"${name}\"`, 'description');\n requireFunctions(obj, `AgentTool \"${name}\"`, ['execute']);\n register(this.binding, 'tool', name, { value: tool });\n }\n}\n\n/** Registers context sources (kind `context_source`). */\nexport class ContextSourceRegistry {\n constructor(private readonly binding: RegistryBinding) {}\n\n registerSource(source: ContextSource): void {\n const obj = requireObject(source, 'ContextSource');\n const id = requireNonEmptyString(source.id, 'ContextSource', 'id');\n requireFunctions(obj, `ContextSource \"${id}\"`, ['search', 'load']);\n register(this.binding, 'context_source', id, { value: source });\n }\n}\n\n/** Registers policy evaluators (kind `policy_evaluator`). */\nexport class PolicyRegistry {\n constructor(private readonly binding: RegistryBinding) {}\n\n registerEvaluator(evaluator: PolicyEvaluator): void {\n const obj = requireObject(evaluator, 'PolicyEvaluator');\n const id = requireNonEmptyString(evaluator.id, 'PolicyEvaluator', 'id');\n requireFunctions(obj, `PolicyEvaluator \"${id}\"`, ['evaluate']);\n register(this.binding, 'policy_evaluator', id, { value: evaluator });\n }\n}\n\n/**\n * Registers report generators. The contribution kind catalog has no separate\n * programmatic report kind, so generators are registered under\n * `report_template` with the generator in `value` (declarative templates use\n * `definition`), keeping both addressable through one registry namespace.\n */\nexport class ReportRegistry {\n constructor(private readonly binding: RegistryBinding) {}\n\n registerGenerator(generator: ReportGenerator): void {\n const obj = requireObject(generator, 'ReportGenerator');\n const id = requireNonEmptyString(generator.id, 'ReportGenerator', 'id');\n requireFunctions(obj, `ReportGenerator \"${id}\"`, ['generate']);\n register(this.binding, 'report_template', id, { value: generator });\n }\n}\n\n/** Registers exporters (kind `exporter`). */\nexport class ExporterRegistry {\n constructor(private readonly binding: RegistryBinding) {}\n\n registerExporter(exporter: Exporter): void {\n const obj = requireObject(exporter, 'Exporter');\n const id = requireNonEmptyString(exporter.id, 'Exporter', 'id');\n requireFunctions(obj, `Exporter \"${id}\"`, ['export']);\n register(this.binding, 'exporter', id, { value: exporter });\n }\n}\n\n/** The context handed to an extension's `register()` (extensions-spec.md §5). */\nexport interface ExtensionContext {\n methodologies: MethodologyRegistry;\n workflows: WorkflowRegistry;\n workItems: WorkItemProviderRegistry;\n communication: CommunicationProviderRegistry;\n models: ModelProviderRegistry;\n agents: AgentAdapterRegistry;\n tools: ToolRegistry;\n contextSources: ContextSourceRegistry;\n policies: PolicyRegistry;\n reports: ReportRegistry;\n exporters: ExporterRegistry;\n hooks: HookRegistry;\n logger: ExtensionLogger;\n config: ExtensionConfig;\n}\n\n/** Host-side input to build an `ExtensionContext`. */\nexport interface CreateExtensionContextInput {\n /** Id of the extension the context is created for. */\n extensionId: string;\n /** The runtime's contribution registry all registrations delegate to. */\n contributions: ContributionRegistry;\n /** The runtime's hook registry, shared across extensions. */\n hooks: HookRegistry;\n /** Source attributed to every contribution; defaults to `local`. */\n source?: ExtensionSource;\n /** Host logger; defaults to a silent no-op (packages never print). */\n logger?: ExtensionLogger;\n /** Configuration values resolved for the extension; defaults to `{}`. */\n config?: ExtensionConfig;\n}\n\n/**\n * Builds the `ExtensionContext` a host passes to `extension.register()`.\n * Exposed so hosts (extension loader, tests) and extension authors share one\n * implementation of the registry wiring.\n */\nexport function createExtensionContext(input: CreateExtensionContextInput): ExtensionContext {\n const extensionId = requireNonEmptyString(\n input.extensionId,\n 'createExtensionContext',\n 'extensionId',\n );\n const binding: RegistryBinding = {\n extensionId,\n source: input.source ?? 'local',\n contributions: input.contributions,\n };\n return {\n methodologies: new MethodologyRegistry(binding),\n workflows: new WorkflowRegistry(binding),\n workItems: new WorkItemProviderRegistry(binding),\n communication: new CommunicationProviderRegistry(binding),\n models: new ModelProviderRegistry(binding),\n agents: new AgentAdapterRegistry(binding),\n tools: new ToolRegistry(binding),\n contextSources: new ContextSourceRegistry(binding),\n policies: new PolicyRegistry(binding),\n reports: new ReportRegistry(binding),\n exporters: new ExporterRegistry(binding),\n hooks: input.hooks,\n logger: input.logger ?? createNoopLogger(),\n config: input.config ?? {},\n };\n}\n","import { ExtensionDefinitionError } from './errors';\nimport {\n createExtensionContext,\n type CreateExtensionContextInput,\n type ExtensionContext,\n} from './context';\n\n/**\n * `defineExtension` — the entrypoint of every programmatic extension\n * (Build Contract §4.6d, extensions-spec.md §5).\n *\n * ```ts\n * export default defineExtension({\n * id: 'linear',\n * name: 'Linear',\n * version: '0.1.0',\n * register(ctx) {\n * ctx.workItems.registerProvider(new LinearWorkItemProvider());\n * },\n * });\n * ```\n */\n\n/** Author-side extension definition. */\nexport interface ExtensionDefinition {\n /** Stable extension id; must match the manifest id (e.g. `linear`). */\n id: string;\n /** Human-readable extension name. */\n name: string;\n /** Extension version (semver recommended). */\n version: string;\n description?: string;\n /** Called once at load time to register the extension's contributions. */\n register(ctx: ExtensionContext): void | Promise<void>;\n}\n\n/** A validated, frozen extension as returned by `defineExtension`. */\nexport type ExcaliburExtension = Readonly<ExtensionDefinition>;\n\nfunction assertNonEmpty(def: Record<string, unknown>, field: 'id' | 'name' | 'version'): string {\n const value = def[field];\n if (typeof value !== 'string' || value.trim().length === 0) {\n throw new ExtensionDefinitionError(`defineExtension requires a non-empty string \"${field}\"`, {\n field,\n received: typeof value,\n });\n }\n return value;\n}\n\n/**\n * Validates and freezes an extension definition. Throws\n * `ExtensionDefinitionError` (an `ExcaliburError`, code `extension_definition`)\n * when the definition is structurally invalid.\n */\nexport function defineExtension(def: ExtensionDefinition): ExcaliburExtension {\n if (typeof def !== 'object' || def === null) {\n throw new ExtensionDefinitionError('defineExtension requires a definition object', {\n received: def === null ? 'null' : typeof def,\n });\n }\n const record = def as unknown as Record<string, unknown>;\n const id = assertNonEmpty(record, 'id');\n if (/\\s/.test(id)) {\n throw new ExtensionDefinitionError(`Extension id \"${id}\" must not contain whitespace`, {\n field: 'id',\n value: id,\n });\n }\n const name = assertNonEmpty(record, 'name');\n const version = assertNonEmpty(record, 'version');\n if (record['description'] !== undefined && typeof record['description'] !== 'string') {\n throw new ExtensionDefinitionError('Extension \"description\" must be a string when present', {\n field: 'description',\n received: typeof record['description'],\n });\n }\n if (typeof record['register'] !== 'function') {\n throw new ExtensionDefinitionError(`Extension \"${id}\" must provide a register(ctx) function`, {\n field: 'register',\n received: typeof record['register'],\n });\n }\n const extension: ExtensionDefinition = {\n id,\n name,\n version,\n register: def.register,\n };\n if (def.description !== undefined) {\n extension.description = def.description;\n }\n return Object.freeze(extension);\n}\n\n/** Narrowing guard for values loaded from a compiled extension entrypoint. */\nexport function isExcaliburExtension(value: unknown): value is ExcaliburExtension {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n const record = value as Record<string, unknown>;\n return (\n typeof record['id'] === 'string' &&\n record['id'].trim().length > 0 &&\n typeof record['name'] === 'string' &&\n typeof record['version'] === 'string' &&\n typeof record['register'] === 'function'\n );\n}\n\n/** Host-side input for `registerExtension`; the id comes from the extension. */\nexport type RegisterExtensionInput = Omit<CreateExtensionContextInput, 'extensionId'>;\n\n/**\n * Convenience host helper: builds the context for `extension` and awaits its\n * `register()`. Returns the context so the host can keep logger/config refs.\n */\nexport async function registerExtension(\n extension: ExcaliburExtension,\n input: RegisterExtensionInput,\n): Promise<ExtensionContext> {\n if (!isExcaliburExtension(extension)) {\n throw new ExtensionDefinitionError(\n 'registerExtension requires an extension created with defineExtension',\n );\n }\n const ctx = createExtensionContext({ ...input, extensionId: extension.id });\n await extension.register(ctx);\n return ctx;\n}\n","import { readFileSync } from 'node:fs';\nimport { parse as parseYaml } from 'yaml';\nimport { z } from 'zod';\nimport { ConfigValidationError } from '@excalibur/shared';\nimport { formatValidationIssues } from '@excalibur/workflow-schema';\n\n/**\n * Extension manifest (`excalibur.extension.yaml`) — extensions spec §3.\n *\n * Every extension (declarative pack, programmatic, or mixed) is described by\n * a manifest. Declarative contributions reference YAML/Markdown files\n * relative to the extension directory; programmatic contributions name the\n * runtime values the compiled entrypoint provides via the Extension SDK.\n */\n\n/** The three extension kinds (spec §3). */\nexport const EXTENSION_KINDS = ['declarative', 'programmatic', 'mixed'] as const;\nexport type ExtensionKind = (typeof EXTENSION_KINDS)[number];\n\nconst fileList = z.array(z.string().min(1));\nconst nameList = z.array(z.string().min(1));\n\n/**\n * An MCP server an extension brings (EXT-6). Inline (not a file path / runtime\n * name) because a server spec is small declarative config — a spawned process\n * governed by the extension's own `permissions.process` / `secrets`. `env` is\n * for NON-secret overrides only; real auth comes from the process environment.\n */\nexport const mcpServerContributionSchema = z.object({\n name: z.string().min(1),\n command: z.string().min(1),\n args: z.array(z.string()).optional(),\n cwd: z.string().optional(),\n env: z.record(z.string()).optional(),\n});\nexport type McpServerContribution = z.infer<typeof mcpServerContributionSchema>;\n\n/**\n * `contributes` keys (spec §3). Declarative keys hold file paths relative to\n * the extension directory; programmatic keys hold contribution names that the\n * entrypoint registers at runtime. `vcsProviders` / `enterpriseSyncProviders`\n * are accepted for forward compatibility with the two remaining programmatic\n * contribution kinds (activated in later milestones).\n */\nexport const extensionContributionsSchema = z.object({\n methodologies: fileList.optional(),\n workflows: fileList.optional(),\n questionPacks: fileList.optional(),\n promptTemplates: fileList.optional(),\n artifactTemplates: fileList.optional(),\n policyPresets: fileList.optional(),\n modelRouting: fileList.optional(),\n reportTemplates: fileList.optional(),\n roleDefinitions: fileList.optional(),\n commandMappings: fileList.optional(),\n /** MCP servers this extension brings (EXT-6) — merged into the agent's MCP config. */\n mcpServers: z.array(mcpServerContributionSchema).optional(),\n workItemProviders: nameList.optional(),\n communicationProviders: nameList.optional(),\n modelProviders: nameList.optional(),\n agentAdapters: nameList.optional(),\n tools: nameList.optional(),\n contextSources: nameList.optional(),\n exporters: nameList.optional(),\n policyEvaluators: nameList.optional(),\n communicationHandlers: nameList.optional(),\n vcsProviders: nameList.optional(),\n enterpriseSyncProviders: nameList.optional(),\n});\nexport type ExtensionContributions = z.infer<typeof extensionContributionsSchema>;\n\n/** The 10 permission categories (spec §8). */\nexport const PERMISSION_CATEGORIES = [\n 'network',\n 'filesystem',\n 'process',\n 'secrets',\n 'git',\n 'work_items',\n 'communication',\n 'models',\n 'tools',\n 'context',\n] as const;\nexport type PermissionCategory = (typeof PERMISSION_CATEGORIES)[number];\n\n/**\n * Permission declarations (spec §8). Categories with a pinned shape get a\n * typed schema; the others are open records (their shapes land with\n * enforcement in M5). The object passes unknown categories through so that\n * `validatePermissions` can warn about them instead of silently dropping.\n */\nexport const extensionPermissionsSchema = z\n .object({\n network: z.object({ allowedHosts: z.array(z.string()).optional() }).optional(),\n filesystem: z\n .object({\n read: z.array(z.string()).optional(),\n write: z.array(z.string()).optional(),\n })\n .optional(),\n process: z.object({ allowedCommands: z.array(z.string()).optional() }).optional(),\n secrets: z.object({ env: z.array(z.string()).optional() }).optional(),\n git: z.record(z.unknown()).optional(),\n work_items: z.record(z.unknown()).optional(),\n communication: z.record(z.unknown()).optional(),\n models: z.record(z.unknown()).optional(),\n tools: z.record(z.unknown()).optional(),\n context: z.record(z.unknown()).optional(),\n })\n .passthrough();\nexport type ExtensionPermissions = z.infer<typeof extensionPermissionsSchema>;\n\n/** One `configSchema` entry: `{ type: string; required?: boolean }`. */\nexport const extensionConfigFieldSchema = z.object({\n type: z.string().min(1),\n required: z.boolean().optional(),\n});\nexport type ExtensionConfigField = z.infer<typeof extensionConfigFieldSchema>;\n\nconst EXTENSION_ID_PATTERN = /^[a-z0-9@][a-z0-9@/._-]*$/i;\n\n/** Manifest schema for `excalibur.extension.yaml` (spec §3). */\nexport const extensionManifestSchema = z\n .object({\n id: z\n .string()\n .min(1)\n .regex(\n EXTENSION_ID_PATTERN,\n 'id must start with a letter, digit or \"@\" and contain only letters, digits and \"@/._-\"',\n ),\n name: z.string().min(1),\n version: z.string().min(1),\n kind: z.enum(EXTENSION_KINDS),\n description: z.string().optional(),\n entrypoint: z.string().min(1).optional(),\n contributes: extensionContributionsSchema.optional(),\n capabilities: z.array(z.string().min(1)).optional(),\n configSchema: z.record(extensionConfigFieldSchema).optional(),\n permissions: extensionPermissionsSchema.optional(),\n })\n .superRefine((manifest, ctx) => {\n const needsEntrypoint = manifest.kind === 'programmatic' || manifest.kind === 'mixed';\n if (needsEntrypoint && manifest.entrypoint === undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['entrypoint'],\n message: `${manifest.kind} extensions must declare an entrypoint (compiled JS, e.g. dist/index.js)`,\n });\n }\n if (manifest.kind === 'declarative' && manifest.entrypoint !== undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['entrypoint'],\n message:\n 'declarative extensions must not declare an entrypoint — use kind \"programmatic\" or \"mixed\" for code',\n });\n }\n });\nexport type ExtensionManifest = z.infer<typeof extensionManifestSchema>;\n\n/** Result shape of `validateManifest`. */\nexport interface ManifestValidationResult {\n success: boolean;\n data?: ExtensionManifest;\n errors?: string[];\n}\n\n/** Validate an unknown value as an extension manifest with readable errors. */\nexport function validateManifest(value: unknown): ManifestValidationResult {\n const result = extensionManifestSchema.safeParse(value);\n if (result.success) {\n return { success: true, data: result.data };\n }\n return { success: false, errors: formatValidationIssues(result.error) };\n}\n\n/**\n * Load and validate an `excalibur.extension.yaml` manifest from disk.\n * Throws `ConfigValidationError` when the file is missing, is not valid YAML,\n * or fails manifest validation.\n */\nexport function loadManifest(filePath: string): ExtensionManifest {\n let text: string;\n try {\n text = readFileSync(filePath, 'utf8');\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new ConfigValidationError(`Cannot read extension manifest ${filePath}: ${reason}`, {\n filePath,\n });\n }\n let value: unknown;\n try {\n value = parseYaml(text);\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new ConfigValidationError(`Extension manifest ${filePath} is not valid YAML: ${reason}`, {\n filePath,\n });\n }\n const result = validateManifest(value);\n if (!result.success || result.data === undefined) {\n const errors = result.errors ?? ['unknown validation error'];\n throw new ConfigValidationError(\n `Invalid extension manifest ${filePath}:\\n- ${errors.join('\\n- ')}`,\n { filePath, errors },\n );\n }\n return result.data;\n}\n","import { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { parse as parseYaml } from 'yaml';\nimport { z } from 'zod';\nimport { ConfigValidationError } from '@excalibur/shared';\nimport { formatValidationIssues } from '@excalibur/workflow-schema';\n\n/**\n * `.excalibur/extensions.yaml` (extensions spec §2):\n *\n * - `enabled`: extension ids explicitly enabled (advisory in M1 — every\n * discovered extension is enabled unless listed in `disabled`).\n * - `disabled`: extension ids that must not be loaded.\n * - `local`: local programmatic extension directories (relative to\n * `.excalibur/`, e.g. `./extensions/internal-tool`).\n * - `declarative`: extra declarative files to load (relative to\n * `.excalibur/`, e.g. `./methodologies/discovery.yaml`).\n */\nexport const extensionsFileSchema = z.object({\n enabled: z.array(z.string().min(1)).optional(),\n disabled: z.array(z.string().min(1)).optional(),\n local: z.array(z.string().min(1)).optional(),\n declarative: z.array(z.string().min(1)).optional(),\n});\nexport type ExtensionsFileConfig = z.infer<typeof extensionsFileSchema>;\n\n/** Relative location of the extensions file inside a repository. */\nexport const EXTENSIONS_FILE_RELATIVE_PATH = '.excalibur/extensions.yaml';\n\n/**\n * Load `.excalibur/extensions.yaml` for a repository. A missing (or empty)\n * file is not an error — extensions are optional — and yields `{}`. Invalid\n * YAML or schema violations throw `ConfigValidationError`.\n */\nexport function loadExtensionsFile(repoRoot: string): ExtensionsFileConfig {\n const filePath = join(repoRoot, '.excalibur', 'extensions.yaml');\n let text: string;\n try {\n text = readFileSync(filePath, 'utf8');\n } catch (error) {\n if (isFileMissingError(error)) {\n return {};\n }\n const reason = error instanceof Error ? error.message : String(error);\n throw new ConfigValidationError(`Cannot read ${filePath}: ${reason}`, { filePath });\n }\n let value: unknown;\n try {\n value = parseYaml(text);\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new ConfigValidationError(`${filePath} is not valid YAML: ${reason}`, { filePath });\n }\n if (value === null || value === undefined) {\n return {};\n }\n const result = extensionsFileSchema.safeParse(value);\n if (!result.success) {\n const errors = formatValidationIssues(result.error);\n throw new ConfigValidationError(\n `Invalid extensions file ${filePath}:\\n- ${errors.join('\\n- ')}`,\n { filePath, errors },\n );\n }\n return result.data;\n}\n\nfunction isFileMissingError(error: unknown): boolean {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n ((error as { code?: unknown }).code === 'ENOENT' ||\n (error as { code?: unknown }).code === 'ENOTDIR')\n );\n}\n","import {\n DECLARATIVE_TYPES,\n declarativeSchemasByType,\n isDeclarativeType,\n type DeclarativeType,\n} from '@excalibur/declarative-schemas';\nimport type { Methodology, WorkflowDefinition } from '@excalibur/workflow-schema';\n\n/**\n * Contributions are the unit of extensibility: each loaded extension\n * contributes named definitions (declarative) or runtime values\n * (programmatic) into one shared `ContributionRegistry`.\n */\n\n/** The 10 declarative contribution kinds (extensions spec §4). */\nexport const DECLARATIVE_CONTRIBUTION_KINDS = DECLARATIVE_TYPES;\n\n/** The 10 programmatic contribution kinds (extensions spec, intro). */\nexport const PROGRAMMATIC_CONTRIBUTION_KINDS = [\n 'work_item_provider',\n 'communication_provider',\n 'model_provider',\n 'agent_adapter',\n 'tool',\n 'context_source',\n 'exporter',\n 'policy_evaluator',\n 'vcs_provider',\n 'enterprise_sync_provider',\n] as const;\nexport type ProgrammaticContributionKind = (typeof PROGRAMMATIC_CONTRIBUTION_KINDS)[number];\n\n/** All 20 contribution kinds. */\nexport const CONTRIBUTION_KINDS = [\n ...DECLARATIVE_CONTRIBUTION_KINDS,\n ...PROGRAMMATIC_CONTRIBUTION_KINDS,\n] as const;\nexport type ContributionKind = DeclarativeType | ProgrammaticContributionKind;\n\n/** Where a contribution came from, in load order (extensions spec §7). */\nexport const CONTRIBUTION_SOURCES = ['built_in', 'project', 'local', 'npm', 'enterprise'] as const;\nexport type ContributionSource = (typeof CONTRIBUTION_SOURCES)[number];\n\n/**\n * Sources loaded later in the pipeline override earlier ones for the same\n * contribution id (spec §7: project-level overrides built-in).\n */\nconst SOURCE_RANK: Readonly<Record<ContributionSource, number>> = {\n built_in: 0,\n project: 1,\n local: 2,\n npm: 3,\n enterprise: 4,\n};\n\n/** One contributed definition or runtime value. */\nexport type Contribution = {\n kind: ContributionKind;\n id: string;\n extensionId: string;\n source: ContributionSource;\n /** Parsed declarative definition (for the 10 declarative kinds). */\n definition?: unknown;\n /** Runtime value provided by a programmatic extension. */\n value?: unknown;\n};\n\n/**\n * Registry of all contributions from all loaded extensions.\n *\n * Conflict rules (extensions spec §7):\n * - duplicate contribution id from the same source → ignored, warning recorded;\n * - same contribution id from a later source overrides an earlier source\n * (project overrides built_in, local overrides project, …);\n * - an earlier source registered after a later one is ignored with a warning.\n *\n * Declarative definitions are validated against their schema on `register`;\n * invalid definitions are rejected with a recorded warning so that the typed\n * `workflows()` / `methodologies()` accessors are always safe.\n */\nexport class ContributionRegistry {\n private readonly byKind = new Map<ContributionKind, Map<string, Contribution>>();\n private readonly warningList: string[] = [];\n\n register(contribution: Contribution): void {\n const normalized = this.normalize(contribution);\n if (normalized === undefined) {\n return;\n }\n const { kind, id } = normalized;\n let forKind = this.byKind.get(kind);\n if (forKind === undefined) {\n forKind = new Map<string, Contribution>();\n this.byKind.set(kind, forKind);\n }\n const existing = forKind.get(id);\n if (existing === undefined) {\n forKind.set(id, normalized);\n return;\n }\n if (existing.source === normalized.source) {\n this.addWarning(\n `Duplicate contribution '${kind}/${id}' from extension '${normalized.extensionId}' ` +\n `(source: ${normalized.source}) ignored — already registered by extension '${existing.extensionId}'.`,\n );\n return;\n }\n if (SOURCE_RANK[normalized.source] > SOURCE_RANK[existing.source]) {\n // Later sources win: e.g. a project-level workflow overrides the built-in one.\n forKind.set(id, normalized);\n return;\n }\n this.addWarning(\n `Contribution '${kind}/${id}' from source '${normalized.source}' ignored — ` +\n `it is overridden by the existing '${existing.source}' registration.`,\n );\n }\n\n get(kind: ContributionKind, id: string): Contribution | undefined {\n return this.byKind.get(kind)?.get(id);\n }\n\n list(kind?: ContributionKind): Contribution[] {\n if (kind !== undefined) {\n const forKind = this.byKind.get(kind);\n return forKind === undefined ? [] : Array.from(forKind.values());\n }\n const all: Contribution[] = [];\n for (const forKind of this.byKind.values()) {\n for (const contribution of forKind.values()) {\n all.push(contribution);\n }\n }\n return all;\n }\n\n /** All registered workflow definitions (project overrides applied). */\n workflows(): WorkflowDefinition[] {\n // Safe: declarative definitions are schema-validated in `register`.\n return this.list('workflow')\n .filter((c) => c.definition !== undefined)\n .map((c) => c.definition as WorkflowDefinition);\n }\n\n /** All registered methodology definitions (project overrides applied). */\n methodologies(): Methodology[] {\n // Safe: declarative definitions are schema-validated in `register`.\n return this.list('methodology')\n .filter((c) => c.definition !== undefined)\n .map((c) => c.definition as Methodology);\n }\n\n /** Warnings recorded while registering contributions (conflicts, invalid definitions). */\n warnings(): string[] {\n return [...this.warningList];\n }\n\n /** Record a registry-level warning (used by the extension loader too). */\n addWarning(message: string): void {\n this.warningList.push(message);\n }\n\n /**\n * Validate declarative definitions on entry; returns the contribution with\n * the parsed (normalized) definition, or `undefined` when rejected.\n */\n private normalize(contribution: Contribution): Contribution | undefined {\n if (!isDeclarativeType(contribution.kind) || contribution.definition === undefined) {\n return contribution;\n }\n const schema = declarativeSchemasByType[contribution.kind];\n const result = schema.safeParse(contribution.definition);\n if (!result.success) {\n const reasons = result.error.issues\n .map((issue) => `${issue.path.join('.') || '(root)'}: ${issue.message}`)\n .join('; ');\n this.addWarning(\n `Contribution '${contribution.kind}/${contribution.id}' from extension ` +\n `'${contribution.extensionId}' has an invalid definition and was ignored — ${reasons}`,\n );\n return undefined;\n }\n return { ...contribution, definition: result.data as unknown };\n }\n}\n","/**\n * Hook registry (extensions spec §6). Extensions subscribe to lifecycle\n * hooks; the core emits them at well-known points. Handlers run sequentially\n * (awaited one by one, in registration order) and a failing handler never\n * breaks the emit — errors are collected and exposed via `errors()`.\n */\n\n/** The well-known lifecycle hook names (spec §6). */\nexport const EXCALIBUR_HOOKS = [\n 'workItem.received',\n 'workItem.commandDetected',\n 'discovery.started',\n 'discovery.completed',\n 'interaction.created',\n 'patch.created',\n 'run.created',\n 'run.phaseStarted',\n 'run.phaseCompleted',\n 'run.completed',\n 'run.failed',\n 'pr.opened',\n 'dailySummary.generating',\n 'weeklyPlanning.started',\n] as const;\nexport type ExcaliburHook = (typeof EXCALIBUR_HOOKS)[number];\n\n/** A hook handler: sync or async, receives the emitted event. */\nexport type HookHandler<TEvent = unknown> = (event: TEvent) => Promise<void> | void;\n\n/** One isolated handler failure collected during `emit`. */\nexport interface HookHandlerError {\n hookName: string;\n message: string;\n error: unknown;\n}\n\nexport class HookRegistry {\n private readonly handlers = new Map<string, Array<HookHandler>>();\n private readonly errorList: HookHandlerError[] = [];\n\n /** Subscribe a handler to a hook. Handlers run in registration order. */\n on<TEvent>(hookName: string, handler: (event: TEvent) => Promise<void> | void): void {\n let list = this.handlers.get(hookName);\n if (list === undefined) {\n list = [];\n this.handlers.set(hookName, list);\n }\n // The registry stores handlers untyped; each `on<TEvent>` call site owns\n // the pairing between hook name and event type.\n list.push(handler as HookHandler);\n }\n\n /**\n * Emit an event to all handlers of a hook, awaiting each handler in turn.\n * Handler errors are isolated: they are collected into `errors()` and never\n * propagate to the emitter.\n */\n async emit<TEvent>(hookName: string, event: TEvent): Promise<void> {\n const list = this.handlers.get(hookName);\n if (list === undefined) {\n return;\n }\n // Iterate over a snapshot so handlers registered mid-emit do not run.\n for (const handler of [...list]) {\n try {\n await handler(event);\n } catch (error) {\n this.errorList.push({\n hookName,\n message: error instanceof Error ? error.message : String(error),\n error,\n });\n }\n }\n }\n\n /** Handler errors collected across all emits, in occurrence order. */\n errors(): ReadonlyArray<HookHandlerError> {\n return [...this.errorList];\n }\n\n /** Number of handlers currently registered for a hook. */\n handlerCount(hookName: string): number {\n return this.handlers.get(hookName)?.length ?? 0;\n }\n}\n","import { ContributionRegistry, type Contribution, type ContributionSource } from './contributions';\nimport { HookRegistry } from './hooks';\nimport type { ExtensionManifest } from './manifest';\n\n/**\n * One extension as seen by the runtime after loading. Built-ins have no\n * directory (`dir: null`); project/local extensions point at the directory\n * their files live in. Load failures are recorded per-extension (`status:\n * 'error'` + `error` message) instead of crashing the whole load.\n */\nexport type LoadedExtension = {\n manifest: ExtensionManifest;\n source: ContributionSource;\n dir: string | null;\n status: 'loaded' | 'error';\n error?: string;\n /**\n * For local programmatic extensions: the value exported by the compiled\n * entrypoint (the `defineExtension(...)` result). Its `register(ctx)` is\n * invoked by the Extension SDK host, not by the runtime loader (M1 loads\n * and validates the entrypoint only).\n */\n instance?: unknown;\n};\n\n/**\n * A built-in extension pack: a manifest plus pre-parsed contributions.\n * `@excalibur/built-in-extensions` exports the default packs; `loadExtensions`\n * registers them first so project files can override them.\n */\nexport type BuiltInExtensionPack = {\n manifest: ExtensionManifest;\n contributions: Contribution[];\n};\n\n/** The root object produced by `loadExtensions`. */\nexport class ExtensionRegistry {\n readonly contributions: ContributionRegistry;\n readonly hooks: HookRegistry;\n private readonly loadedExtensions: LoadedExtension[] = [];\n\n constructor() {\n this.contributions = new ContributionRegistry();\n this.hooks = new HookRegistry();\n }\n\n /** All extensions in load order (built-ins, project, local). */\n extensions(): LoadedExtension[] {\n return [...this.loadedExtensions];\n }\n\n /** Record a loaded (or failed) extension. */\n addExtension(extension: LoadedExtension): void {\n this.loadedExtensions.push(extension);\n }\n\n /** Find a loaded extension by manifest id. */\n getExtension(id: string): LoadedExtension | undefined {\n return this.loadedExtensions.find((extension) => extension.manifest.id === id);\n }\n}\n","import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { basename, join, relative, resolve } from 'node:path';\nimport {\n parseDeclarativeMarkdown,\n parseDeclarativeYaml,\n type DeclarativeDefinition,\n type DeclarativeType,\n} from '@excalibur/declarative-schemas';\nimport { isExcaliburError, WorkflowValidationError } from '@excalibur/shared';\nimport { type ProgrammaticContributionKind } from './contributions';\nimport { loadExtensionsFile, type ExtensionsFileConfig } from './extensions-file';\nimport { loadManifest, type ExtensionContributions, type ExtensionManifest } from './manifest';\nimport { validatePermissions } from './permissions';\nimport { ExtensionRegistry, type BuiltInExtensionPack, type LoadedExtension } from './registry';\n\n/**\n * Extension loader (extensions spec §7). Load order:\n *\n * 1. built-in extension packs;\n * 2. project declarative files (scan of the 10 `.excalibur/` declarative\n * directories plus the `extensions.yaml` `declarative:` list);\n * 3. local programmatic extensions (`extensions.yaml` `local:` directories and\n * `.excalibur/extensions/*` directories carrying a manifest) — compiled\n * entrypoints are `require`d; failures are recorded per-extension, never\n * thrown. Manifests with `kind: declarative` carry no code: they are\n * project-level declarative content (spec §7 bucket 2) and register with\n * source `project`, so the project-overrides-built-in conflict rule\n * applies to them;\n * 4. installed npm extensions (later milestone);\n * 5. enterprise-managed extensions (later milestone).\n *\n * `enabled`/`disabled` from `.excalibur/extensions.yaml` are respected: a\n * disabled extension is skipped entirely (M1 treats every discovered\n * extension as enabled unless disabled).\n */\nexport interface LoadExtensionsInput {\n repoRoot: string;\n builtIns: ReadonlyArray<BuiltInExtensionPack>;\n}\n\n/** Synthetic extension id grouping loose project declarative files. */\nexport const PROJECT_EXTENSION_ID = 'project';\n\nconst MANIFEST_FILE_NAME = 'excalibur.extension.yaml';\n\n/** The 10 project declarative directories and the type each one implies (spec §2). */\nconst PROJECT_DECLARATIVE_DIRS: ReadonlyArray<{ dirName: string; type: DeclarativeType }> = [\n { dirName: 'methodologies', type: 'methodology' },\n { dirName: 'workflows', type: 'workflow' },\n { dirName: 'question-packs', type: 'question_pack' },\n { dirName: 'prompts', type: 'prompt_template' },\n { dirName: 'artifacts', type: 'artifact_template' },\n { dirName: 'policies', type: 'policy_preset' },\n { dirName: 'models', type: 'model_routing' },\n { dirName: 'reports', type: 'report_template' },\n { dirName: 'roles', type: 'role_definition' },\n { dirName: 'command-mappings', type: 'command_mapping' },\n];\n\nconst DIR_NAME_TO_TYPE: ReadonlyMap<string, DeclarativeType> = new Map(\n PROJECT_DECLARATIVE_DIRS.map(({ dirName, type }) => [dirName, type]),\n);\n\n/**\n * `contributes` keys whose value is a string list (file paths or names). Excludes\n * `mcpServers`, whose value is an object list collected directly from manifests\n * (see `collectExtensionMcpServers`), not registered as a string-keyed contribution.\n */\ntype StringListContributesKey = Exclude<keyof ExtensionContributions, 'mcpServers'>;\n\n/** Manifest `contributes` keys that reference declarative files. */\nconst DECLARATIVE_CONTRIBUTES_KEYS: ReadonlyArray<{\n key: StringListContributesKey;\n type: DeclarativeType;\n}> = [\n { key: 'methodologies', type: 'methodology' },\n { key: 'workflows', type: 'workflow' },\n { key: 'questionPacks', type: 'question_pack' },\n { key: 'promptTemplates', type: 'prompt_template' },\n { key: 'artifactTemplates', type: 'artifact_template' },\n { key: 'policyPresets', type: 'policy_preset' },\n { key: 'modelRouting', type: 'model_routing' },\n { key: 'reportTemplates', type: 'report_template' },\n { key: 'roleDefinitions', type: 'role_definition' },\n { key: 'commandMappings', type: 'command_mapping' },\n];\n\n/**\n * Manifest `contributes` keys that name programmatic contributions.\n * `communicationHandlers` is accepted by the manifest schema but has no\n * contribution kind in M1, so it is not auto-registered.\n */\nconst PROGRAMMATIC_CONTRIBUTES_KEYS: ReadonlyArray<{\n key: StringListContributesKey;\n kind: ProgrammaticContributionKind;\n}> = [\n { key: 'workItemProviders', kind: 'work_item_provider' },\n { key: 'communicationProviders', kind: 'communication_provider' },\n { key: 'modelProviders', kind: 'model_provider' },\n { key: 'agentAdapters', kind: 'agent_adapter' },\n { key: 'tools', kind: 'tool' },\n { key: 'contextSources', kind: 'context_source' },\n { key: 'exporters', kind: 'exporter' },\n { key: 'policyEvaluators', kind: 'policy_evaluator' },\n { key: 'vcsProviders', kind: 'vcs_provider' },\n { key: 'enterpriseSyncProviders', kind: 'enterprise_sync_provider' },\n];\n\nconst YAML_EXTENSION_PATTERN = /\\.ya?ml$/i;\nconst MARKDOWN_EXTENSION_PATTERN = /\\.(md|markdown)$/i;\n\n/** Load every extension source for a repository into one registry. */\nexport async function loadExtensions(input: LoadExtensionsInput): Promise<ExtensionRegistry> {\n const registry = new ExtensionRegistry();\n const excaliburDir = join(input.repoRoot, '.excalibur');\n\n // A broken extensions.yaml must not take the whole runtime down: record a\n // warning and continue with defaults (everything enabled).\n let extensionsFile: ExtensionsFileConfig = {};\n try {\n extensionsFile = loadExtensionsFile(input.repoRoot);\n } catch (error) {\n registry.contributions.addWarning(errorMessage(error));\n }\n\n const disabled = new Set(extensionsFile.disabled ?? []);\n for (const id of extensionsFile.enabled ?? []) {\n if (disabled.has(id)) {\n registry.contributions.addWarning(\n `Extension '${id}' is listed in both 'enabled' and 'disabled' in .excalibur/extensions.yaml — 'disabled' wins.`,\n );\n }\n }\n\n loadBuiltIns(registry, input.builtIns, disabled);\n loadProjectDeclaratives(registry, input.repoRoot, excaliburDir, extensionsFile, disabled);\n loadLocalExtensions(registry, input.repoRoot, excaliburDir, extensionsFile, disabled);\n\n return registry;\n}\n\n// --- 1. built-ins -----------------------------------------------------------\n\nfunction loadBuiltIns(\n registry: ExtensionRegistry,\n builtIns: ReadonlyArray<BuiltInExtensionPack>,\n disabled: ReadonlySet<string>,\n): void {\n for (const pack of builtIns) {\n if (disabled.has(pack.manifest.id)) {\n continue;\n }\n registry.addExtension({\n manifest: pack.manifest,\n source: 'built_in',\n dir: null,\n status: 'loaded',\n });\n for (const warning of validatePermissions(pack.manifest)) {\n registry.contributions.addWarning(warning);\n }\n for (const contribution of pack.contributions) {\n // Force the source/extensionId invariants so override rules always hold.\n registry.contributions.register({\n ...contribution,\n source: 'built_in',\n extensionId: pack.manifest.id,\n });\n }\n }\n}\n\n// --- 2. project declarative files -------------------------------------------\n\nfunction loadProjectDeclaratives(\n registry: ExtensionRegistry,\n repoRoot: string,\n excaliburDir: string,\n extensionsFile: ExtensionsFileConfig,\n disabled: ReadonlySet<string>,\n): void {\n if (disabled.has(PROJECT_EXTENSION_ID)) {\n return;\n }\n\n const candidates: Array<{ absPath: string; expectedType?: DeclarativeType }> = [];\n const seen = new Set<string>();\n const pushCandidate = (absPath: string, expectedType?: DeclarativeType): void => {\n const key = resolve(absPath);\n if (seen.has(key)) {\n return;\n }\n seen.add(key);\n candidates.push({ absPath: key, ...(expectedType !== undefined ? { expectedType } : {}) });\n };\n\n for (const { dirName, type } of PROJECT_DECLARATIVE_DIRS) {\n const dir = join(excaliburDir, dirName);\n for (const fileName of listFiles(dir)) {\n // `.excalibur/models/providers.yaml` is the model provider config\n // (oss-spec §14), not a declarative model_routing definition.\n if (dirName === 'models' && fileName === 'providers.yaml') {\n continue;\n }\n const isYaml = YAML_EXTENSION_PATTERN.test(fileName);\n const isMarkdown = MARKDOWN_EXTENSION_PATTERN.test(fileName);\n const markdownAllowed = type === 'prompt_template' || type === 'artifact_template';\n if (!isYaml && !(isMarkdown && markdownAllowed)) {\n continue;\n }\n pushCandidate(join(dir, fileName), type);\n }\n }\n\n for (const declared of extensionsFile.declarative ?? []) {\n const absPath = resolve(excaliburDir, declared);\n if (seen.has(absPath)) {\n continue;\n }\n if (!existsSync(absPath)) {\n registry.contributions.addWarning(\n `Declarative file '${declared}' listed in .excalibur/extensions.yaml was not found at ${absPath}.`,\n );\n continue;\n }\n pushCandidate(absPath, inferTypeFromPath(absPath));\n }\n\n if (candidates.length === 0) {\n return;\n }\n\n registry.addExtension({\n manifest: {\n id: PROJECT_EXTENSION_ID,\n name: 'Project declarative files (.excalibur/)',\n version: '0.0.0',\n kind: 'declarative',\n },\n source: 'project',\n dir: excaliburDir,\n status: 'loaded',\n });\n\n for (const candidate of candidates) {\n try {\n const definition = parseDeclarativeFile(candidate.absPath, candidate.expectedType);\n // `type` is an optional discriminator on workflow/methodology files;\n // fall back to the directory-implied type when it is omitted.\n const kind = definition.type ?? candidate.expectedType;\n if (kind === undefined) {\n throw new WorkflowValidationError('the file does not declare a \"type\" field');\n }\n registry.contributions.register({\n kind,\n id: definition.id,\n extensionId: PROJECT_EXTENSION_ID,\n source: 'project',\n definition,\n });\n } catch (error) {\n registry.contributions.addWarning(\n `Failed to load ${relative(repoRoot, candidate.absPath)}: ${errorMessage(error)}`,\n );\n }\n }\n}\n\n// --- 3. local programmatic extensions ----------------------------------------\n\nfunction loadLocalExtensions(\n registry: ExtensionRegistry,\n repoRoot: string,\n excaliburDir: string,\n extensionsFile: ExtensionsFileConfig,\n disabled: ReadonlySet<string>,\n): void {\n const dirs: string[] = [];\n const seen = new Set<string>();\n const pushDir = (dir: string): void => {\n const key = resolve(dir);\n if (!seen.has(key)) {\n seen.add(key);\n dirs.push(key);\n }\n };\n\n for (const entry of extensionsFile.local ?? []) {\n // Paths are relative to `.excalibur/` (where extensions.yaml lives);\n // fall back to repo-root-relative for convenience.\n const primary = resolve(excaliburDir, entry);\n const fallback = resolve(repoRoot, entry);\n if (existsSync(join(primary, MANIFEST_FILE_NAME))) {\n pushDir(primary);\n } else if (existsSync(join(fallback, MANIFEST_FILE_NAME))) {\n pushDir(fallback);\n } else {\n pushDir(primary); // report the error against the canonical location\n }\n }\n\n const extensionsDir = join(excaliburDir, 'extensions');\n for (const entry of listDirectories(extensionsDir)) {\n const dir = join(extensionsDir, entry);\n if (existsSync(join(dir, MANIFEST_FILE_NAME))) {\n pushDir(dir);\n }\n }\n\n for (const dir of dirs) {\n loadLocalExtension(registry, dir, disabled);\n }\n}\n\nfunction loadLocalExtension(\n registry: ExtensionRegistry,\n dir: string,\n disabled: ReadonlySet<string>,\n): void {\n const manifestPath = join(dir, MANIFEST_FILE_NAME);\n let manifest: ExtensionManifest;\n try {\n manifest = loadManifest(manifestPath);\n } catch (error) {\n registry.addExtension({\n manifest: fallbackManifest(dir),\n source: 'local',\n dir,\n status: 'error',\n error: errorMessage(error),\n });\n return;\n }\n\n if (disabled.has(manifest.id)) {\n return;\n }\n\n // A `kind: declarative` manifest ships no code — it is project-level\n // declarative content (extensions spec §7 bucket 2), so its contributions\n // take the `project` source and the project-overrides-built-in rule applies.\n // Programmatic and mixed extensions stay `local`.\n const source = manifest.kind === 'declarative' ? ('project' as const) : ('local' as const);\n\n const errors: string[] = [];\n\n for (const { key, type } of DECLARATIVE_CONTRIBUTES_KEYS) {\n for (const relPath of manifest.contributes?.[key] ?? []) {\n const absPath = resolve(dir, relPath);\n try {\n const definition = parseDeclarativeFile(absPath, type);\n if (definition.type !== undefined && definition.type !== type) {\n throw new WorkflowValidationError(\n `expected a ${type} definition (referenced from contributes.${String(key)}) but the file defines a ${definition.type}`,\n );\n }\n registry.contributions.register({\n kind: type,\n id: definition.id,\n extensionId: manifest.id,\n source,\n definition,\n });\n } catch (error) {\n errors.push(`${relPath}: ${errorMessage(error)}`);\n }\n }\n }\n\n let instance: unknown;\n if (manifest.kind === 'programmatic' || manifest.kind === 'mixed') {\n // The manifest schema guarantees an entrypoint for these kinds.\n const entrypoint = manifest.entrypoint ?? 'dist/index.js';\n const entrypointPath = resolve(dir, entrypoint);\n if (!existsSync(entrypointPath)) {\n errors.push(\n `entrypoint not found: ${entrypoint} — build the extension first (compiled JS is required in M1)`,\n );\n } else {\n try {\n const exported = unwrapModuleDefault(requireEntrypoint(entrypointPath));\n if (!isExtensionInstance(exported)) {\n errors.push(\n `entrypoint ${entrypoint} did not export an Excalibur extension — export the result of defineExtension(...) as the default export`,\n );\n } else {\n instance = exported;\n if (exported.id !== manifest.id) {\n registry.contributions.addWarning(\n `Extension '${manifest.id}' entrypoint exports id '${exported.id}' — the manifest id wins.`,\n );\n }\n for (const { key, kind } of PROGRAMMATIC_CONTRIBUTES_KEYS) {\n for (const name of manifest.contributes?.[key] ?? []) {\n registry.contributions.register({\n kind,\n id: name,\n extensionId: manifest.id,\n source: 'local',\n value: exported,\n });\n }\n }\n }\n } catch (error) {\n errors.push(`failed to load entrypoint ${entrypoint}: ${errorMessage(error)}`);\n }\n }\n }\n\n for (const warning of validatePermissions(manifest)) {\n registry.contributions.addWarning(warning);\n }\n\n const loaded: LoadedExtension = {\n manifest,\n source,\n dir,\n status: errors.length > 0 ? 'error' : 'loaded',\n ...(errors.length > 0 ? { error: errors.join('; ') } : {}),\n ...(instance !== undefined ? { instance } : {}),\n };\n registry.addExtension(loaded);\n}\n\n// --- helpers -----------------------------------------------------------------\n\nfunction parseDeclarativeFile(\n absPath: string,\n expectedType?: DeclarativeType,\n): DeclarativeDefinition {\n const content = readFileSync(absPath, 'utf8');\n if (MARKDOWN_EXTENSION_PATTERN.test(absPath)) {\n return parseDeclarativeMarkdown(absPath, content);\n }\n return expectedType === undefined\n ? parseDeclarativeYaml(content)\n : parseDeclarativeYaml(content, expectedType);\n}\n\nfunction inferTypeFromPath(absPath: string): DeclarativeType | undefined {\n const segments = absPath.split(/[\\\\/]+/).filter((segment) => segment.length > 0);\n for (let index = segments.length - 2; index >= 0; index -= 1) {\n const segment = segments[index];\n if (segment === undefined) {\n continue;\n }\n const type = DIR_NAME_TO_TYPE.get(segment);\n if (type !== undefined) {\n return type;\n }\n }\n return undefined;\n}\n\nfunction listFiles(dir: string): string[] {\n if (!existsSync(dir) || !statSync(dir).isDirectory()) {\n return [];\n }\n return readdirSync(dir, { withFileTypes: true })\n .filter((entry) => entry.isFile())\n .map((entry) => entry.name)\n .sort();\n}\n\nfunction listDirectories(dir: string): string[] {\n if (!existsSync(dir) || !statSync(dir).isDirectory()) {\n return [];\n }\n return readdirSync(dir, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry) => entry.name)\n .sort();\n}\n\nfunction fallbackManifest(dir: string): ExtensionManifest {\n return {\n id: basename(dir),\n name: basename(dir),\n version: '0.0.0',\n kind: 'declarative',\n };\n}\n\n/** Load a compiled entrypoint in a way that works from both CJS and ESM builds. */\nfunction requireEntrypoint(absPath: string): unknown {\n const requireFromEntrypoint = createRequire(absPath);\n return requireFromEntrypoint(absPath) as unknown;\n}\n\nfunction unwrapModuleDefault(moduleExports: unknown): unknown {\n if (\n typeof moduleExports === 'object' &&\n moduleExports !== null &&\n 'default' in moduleExports &&\n (moduleExports as { default?: unknown }).default !== undefined\n ) {\n return (moduleExports as { default: unknown }).default;\n }\n return moduleExports;\n}\n\nfunction isExtensionInstance(value: unknown): value is {\n id: string;\n register: (...args: unknown[]) => unknown;\n} {\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as { id?: unknown }).id === 'string' &&\n typeof (value as { register?: unknown }).register === 'function'\n );\n}\n\nfunction errorMessage(error: unknown): string {\n if (isExcaliburError(error)) {\n return error.message;\n }\n return error instanceof Error ? error.message : String(error);\n}\n","import { PERMISSION_CATEGORIES, type ExtensionManifest } from './manifest';\n\n/**\n * Permission validation (extensions spec §8). M1 validates manifests and\n * returns human-readable warnings; strict enforcement arrives with the\n * Enterprise permission engine in M5.\n */\n\nconst KNOWN_CATEGORIES = new Set<string>(PERMISSION_CATEGORIES);\nconst ENV_VAR_NAME_PATTERN = /^[A-Z_][A-Z0-9_]*$/;\n\n/**\n * Validate the permission declarations of a manifest. Returns warnings (never\n * throws): suspicious or overly broad declarations, unknown categories,\n * declarative extensions declaring permissions, and programmatic extensions\n * declaring capabilities without backing permissions.\n */\nexport function validatePermissions(manifest: ExtensionManifest): string[] {\n const warnings: string[] = [];\n const permissions = manifest.permissions;\n\n if (manifest.kind === 'declarative' && permissions !== undefined) {\n warnings.push(\n `Extension '${manifest.id}' is declarative but declares permissions — ` +\n 'declarative extensions run no code, so permissions have no effect.',\n );\n }\n\n if (\n manifest.kind !== 'declarative' &&\n permissions === undefined &&\n (manifest.capabilities?.length ?? 0) > 0\n ) {\n warnings.push(\n `Extension '${manifest.id}' declares capabilities (${(manifest.capabilities ?? []).join(', ')}) ` +\n 'but no permissions — declare the network/filesystem/secrets access it needs; ' +\n 'undeclared access will be denied when enforcement lands (M5).',\n );\n }\n\n if (permissions === undefined) {\n return warnings;\n }\n\n for (const category of Object.keys(permissions)) {\n if (!KNOWN_CATEGORIES.has(category)) {\n warnings.push(\n `Extension '${manifest.id}' declares unknown permission category '${category}' — ` +\n `expected one of: ${PERMISSION_CATEGORIES.join(', ')}.`,\n );\n }\n }\n\n for (const host of permissions.network?.allowedHosts ?? []) {\n if (host === '*' || host.includes('*')) {\n warnings.push(\n `Extension '${manifest.id}' requests wildcard network access ('${host}') — ` +\n 'prefer listing explicit hosts.',\n );\n }\n }\n\n for (const pattern of permissions.filesystem?.write ?? []) {\n if (!isScopedToExcaliburDir(pattern)) {\n warnings.push(\n `Extension '${manifest.id}' requests filesystem write access outside .excalibur/ ` +\n `('${pattern}') — broad write access is high-risk and will require approval (M5).`,\n );\n }\n }\n\n // READ scopes are validated too: an extension may legitimately read repo\n // files, but absolute paths, home-dir (`~`), parent-escapes (`..`) and\n // root-level wildcards can exfiltrate credentials (e.g. ~/.ssh, ~/.aws,\n // /etc) and must be flagged.\n for (const pattern of permissions.filesystem?.read ?? []) {\n if (isHighRiskReadPattern(pattern)) {\n warnings.push(\n `Extension '${manifest.id}' requests high-risk filesystem read access ('${pattern}') — ` +\n 'reads outside the workspace (absolute, ~, .. or root-level wildcards) can exfiltrate ' +\n 'credentials and will require approval (M5); scope reads to repo-relative paths.',\n );\n }\n }\n\n for (const envName of permissions.secrets?.env ?? []) {\n if (!ENV_VAR_NAME_PATTERN.test(envName)) {\n warnings.push(\n `Extension '${manifest.id}' declares secrets.env entry '${envName}' which does not look ` +\n 'like an environment variable name (expected UPPER_SNAKE_CASE) — never put secret values in manifests.',\n );\n }\n }\n\n for (const command of permissions.process?.allowedCommands ?? []) {\n if (command === '*' || command.includes('*')) {\n warnings.push(\n `Extension '${manifest.id}' requests wildcard process execution ('${command}') — ` +\n 'prefer listing explicit commands.',\n );\n }\n }\n\n return warnings;\n}\n\nfunction isScopedToExcaliburDir(pattern: string): boolean {\n const normalized = pattern.replace(/^\\.\\//, '');\n return normalized === '.excalibur' || normalized.startsWith('.excalibur/');\n}\n\n/**\n * A read pattern is high-risk if it can reach outside the repository working\n * directory: absolute (`/etc/...`), home-relative (`~/.ssh`), a parent escape\n * (`../`), or a root-level wildcard that would match the whole filesystem\n * (`*`, `**`, `/**`).\n */\nfunction isHighRiskReadPattern(pattern: string): boolean {\n const trimmed = pattern.trim();\n if (trimmed.length === 0) {\n return false;\n }\n if (trimmed.startsWith('/') || trimmed.startsWith('~')) {\n return true; // absolute or home-dir\n }\n // A `..` segment anywhere lets the glob climb out of the workspace.\n if (/(^|\\/)\\.\\.(\\/|$)/.test(trimmed)) {\n return true;\n }\n // Bare top-level wildcards match everything under the cwd.\n if (trimmed === '*' || trimmed === '**' || trimmed === '**/*') {\n return true;\n }\n return false;\n}\n","/**\n * The 10 declarative extension types (extensions spec §1 and §4).\n *\n * Declarative extensions are YAML/Markdown files with no code: safe,\n * portable, Git-versionable and editable by tech leads. `methodology` and\n * `workflow` remain owned by `@excalibur/workflow-schema`; this package owns\n * the schemas for the other eight and the discriminated union over all ten.\n */\nexport const DECLARATIVE_TYPES = [\n 'methodology',\n 'workflow',\n 'question_pack',\n 'prompt_template',\n 'artifact_template',\n 'policy_preset',\n 'model_routing',\n 'report_template',\n 'role_definition',\n 'command_mapping',\n] as const;\n\n/** One of the 10 declarative extension type names. */\nexport type DeclarativeType = (typeof DECLARATIVE_TYPES)[number];\n\n/** Narrowing helper for unknown `type` values read from YAML/front matter. */\nexport function isDeclarativeType(value: unknown): value is DeclarativeType {\n return typeof value === 'string' && (DECLARATIVE_TYPES as readonly string[]).includes(value);\n}\n","import { z } from 'zod';\nimport { policyDecisionSchema } from '@excalibur/shared';\n\n/**\n * Zod schemas for the eight declarative extension types owned by this\n * package (extensions spec §4). `methodology` and `workflow` stay in\n * `@excalibur/workflow-schema` and are re-exported from the package index.\n *\n * Unknown keys are stripped (zod default), matching the tolerant parsing of\n * workflow/methodology files: teams may annotate their YAML freely.\n */\n\nconst definitionIdSchema = z.string().min(1, 'id must be a non-empty string');\nconst definitionNameSchema = z.string().min(1, 'name must be a non-empty string');\n\n/** `{{variable}}` placeholders: word characters, dots and dashes, optional inner padding. */\nconst TEMPLATE_VARIABLE_PATTERN = /\\{\\{\\s*([A-Za-z0-9_][A-Za-z0-9_.-]*)\\s*\\}\\}/g;\n\n/**\n * Extract the unique `{{...}}` placeholder names from a template body,\n * in order of first appearance. `{{ user }}` and `{{user}}` both yield `user`.\n */\nexport function extractTemplateVariables(template: string): string[] {\n const variables: string[] = [];\n for (const match of template.matchAll(TEMPLATE_VARIABLE_PATTERN)) {\n const name = match[1];\n if (name !== undefined && !variables.includes(name)) {\n variables.push(name);\n }\n }\n return variables;\n}\n\n/** question_pack: `{ id, type: 'question_pack', name, questions: [{ id, text }] }`. */\nexport const questionPackQuestionSchema = z.object({\n id: z.string().min(1, 'question id must be a non-empty string'),\n text: z.string().min(1, 'question text must be a non-empty string'),\n});\nexport type QuestionPackQuestion = z.infer<typeof questionPackQuestionSchema>;\n\nexport const questionPackSchema = z.object({\n id: definitionIdSchema,\n type: z.literal('question_pack'),\n name: definitionNameSchema,\n description: z.string().optional(),\n questions: z\n .array(questionPackQuestionSchema)\n .min(1, 'a question pack must declare at least one question'),\n});\nexport type QuestionPackDefinition = z.infer<typeof questionPackSchema>;\n\n/**\n * prompt_template: YAML `{ id, type: 'prompt_template', name, template }`,\n * or a Markdown file (id from filename) via `parseDeclarativeMarkdown`.\n */\nexport const promptTemplateSchema = z.object({\n id: definitionIdSchema,\n type: z.literal('prompt_template'),\n name: definitionNameSchema,\n description: z.string().optional(),\n template: z.string().min(1, 'prompt template body must not be empty'),\n});\nexport type PromptTemplateDefinition = z.infer<typeof promptTemplateSchema>;\n\n/**\n * artifact_template: Markdown with `{{variable}}` placeholders (id from\n * filename or YAML wrapper). `variables` is always auto-extracted from the\n * template body; explicitly declared variables not present in the body are\n * preserved after the extracted ones.\n */\nexport interface ArtifactTemplateDefinition {\n id: string;\n type: 'artifact_template';\n name?: string;\n description?: string;\n template: string;\n /** Auto-extracted from `{{...}}` placeholders, in order of first appearance. */\n variables: string[];\n}\n\nconst artifactTemplateObjectSchema = z.object({\n id: definitionIdSchema,\n type: z.literal('artifact_template'),\n name: definitionNameSchema.optional(),\n description: z.string().optional(),\n template: z.string().min(1, 'artifact template body must not be empty'),\n variables: z.array(z.string().min(1)).optional(),\n});\n\nexport const artifactTemplateSchema = artifactTemplateObjectSchema.transform(\n (definition): ArtifactTemplateDefinition => {\n const extracted = extractTemplateVariables(definition.template);\n const declared = definition.variables ?? [];\n return {\n ...definition,\n variables: [...extracted, ...declared.filter((name) => !extracted.includes(name))],\n };\n },\n);\n\n/** Condition block of one policy rule; an empty `when` matches everything. */\nexport const policyRuleConditionSchema = z.object({\n filePathMatches: z.array(z.string().min(1)).optional(),\n action: z.string().min(1).optional(),\n command: z.string().min(1).optional(),\n});\nexport type PolicyRuleCondition = z.infer<typeof policyRuleConditionSchema>;\n\n/** Decision values reuse `policyDecisionSchema` from `@excalibur/shared`. */\nexport const policyRuleSchema = z.object({\n id: z.string().min(1, 'policy rule id must be a non-empty string'),\n when: policyRuleConditionSchema,\n decision: policyDecisionSchema,\n});\nexport type PolicyRule = z.infer<typeof policyRuleSchema>;\n\n/** policy_preset: `{ id, type: 'policy_preset', rules: [{ id, when, decision }] }`. */\nexport const policyPresetSchema = z.object({\n id: definitionIdSchema,\n type: z.literal('policy_preset'),\n name: definitionNameSchema.optional(),\n description: z.string().optional(),\n rules: z.array(policyRuleSchema).min(1, 'a policy preset must declare at least one rule'),\n});\nexport type PolicyPresetDefinition = z.infer<typeof policyPresetSchema>;\n\n/** model_routing: `{ id, type: 'model_routing', default?, byRole?, byPath?, byWorkflow? }`. */\nexport const modelRoutingSchema = z.object({\n id: definitionIdSchema,\n type: z.literal('model_routing'),\n name: definitionNameSchema.optional(),\n description: z.string().optional(),\n default: z.string().min(1).optional(),\n byRole: z.record(z.string().min(1)).optional(),\n byPath: z.record(z.string().min(1)).optional(),\n byWorkflow: z.record(z.string().min(1)).optional(),\n});\nexport type ModelRoutingDefinition = z.infer<typeof modelRoutingSchema>;\n\n/** report_template: `{ id, type: 'report_template', name, sections: string[] }`. */\nexport const reportTemplateSchema = z.object({\n id: definitionIdSchema,\n type: z.literal('report_template'),\n name: definitionNameSchema,\n description: z.string().optional(),\n sections: z\n .array(z.string().min(1, 'section names must be non-empty strings'))\n .min(1, 'a report template must declare at least one section'),\n});\nexport type ReportTemplateDefinition = z.infer<typeof reportTemplateSchema>;\n\n/** role_definition: `{ id, type: 'role_definition', name, description }`. */\nexport const roleDefinitionSchema = z.object({\n id: definitionIdSchema,\n type: z.literal('role_definition'),\n name: definitionNameSchema,\n description: z.string().min(1, 'role description must be a non-empty string'),\n});\nexport type RoleDefinition = z.infer<typeof roleDefinitionSchema>;\n\n/** One command mapping entry: `{ trigger, action, defaults? }`. */\nexport const commandMappingEntrySchema = z.object({\n trigger: z.string().min(1, 'command trigger must be a non-empty string'),\n action: z.string().min(1, 'command action must be a non-empty string'),\n defaults: z.record(z.unknown()).optional(),\n});\nexport type CommandMappingEntry = z.infer<typeof commandMappingEntrySchema>;\n\n/** command_mapping: `{ id, type: 'command_mapping', commands: [{ trigger, action, defaults? }] }`. */\nexport const commandMappingSchema = z.object({\n id: definitionIdSchema,\n type: z.literal('command_mapping'),\n name: definitionNameSchema.optional(),\n description: z.string().optional(),\n commands: z\n .array(commandMappingEntrySchema)\n .min(1, 'a command mapping must declare at least one command'),\n});\nexport type CommandMappingDefinition = z.infer<typeof commandMappingSchema>;\n","import { z } from 'zod';\nimport {\n methodologySchema,\n workflowDefinitionSchema,\n type Methodology,\n type WorkflowDefinition,\n} from '@excalibur/workflow-schema';\nimport { DECLARATIVE_TYPES, isDeclarativeType, type DeclarativeType } from './types';\nimport {\n artifactTemplateSchema,\n commandMappingSchema,\n modelRoutingSchema,\n policyPresetSchema,\n promptTemplateSchema,\n questionPackSchema,\n reportTemplateSchema,\n roleDefinitionSchema,\n type ArtifactTemplateDefinition,\n type CommandMappingDefinition,\n type ModelRoutingDefinition,\n type PolicyPresetDefinition,\n type PromptTemplateDefinition,\n type QuestionPackDefinition,\n type ReportTemplateDefinition,\n type RoleDefinition,\n} from './schemas';\n\n/** Map from declarative type name to its parsed definition type. */\nexport interface DeclarativeDefinitionByType {\n methodology: Methodology;\n workflow: WorkflowDefinition;\n question_pack: QuestionPackDefinition;\n prompt_template: PromptTemplateDefinition;\n artifact_template: ArtifactTemplateDefinition;\n policy_preset: PolicyPresetDefinition;\n model_routing: ModelRoutingDefinition;\n report_template: ReportTemplateDefinition;\n role_definition: RoleDefinition;\n command_mapping: CommandMappingDefinition;\n}\n\n/** Any parsed declarative definition (union of all 10 types). */\nexport type DeclarativeDefinition = DeclarativeDefinitionByType[DeclarativeType];\n\n/** Per-type schema lookup used by the union and by `parseDeclarativeYaml`. */\nexport const declarativeSchemasByType: Readonly<Record<DeclarativeType, z.ZodTypeAny>> = {\n methodology: methodologySchema,\n workflow: workflowDefinitionSchema,\n question_pack: questionPackSchema,\n prompt_template: promptTemplateSchema,\n artifact_template: artifactTemplateSchema,\n policy_preset: policyPresetSchema,\n model_routing: modelRoutingSchema,\n report_template: reportTemplateSchema,\n role_definition: roleDefinitionSchema,\n command_mapping: commandMappingSchema,\n};\n\nfunction describeValue(value: unknown): string {\n if (value === null) return 'null';\n if (value === undefined) return 'nothing';\n if (Array.isArray(value)) return 'a list';\n return `a ${typeof value}`;\n}\n\n/**\n * Discriminated union over the 10 declarative types, keyed on `type`.\n *\n * Implemented as a manual dispatch (rather than `z.discriminatedUnion`)\n * because several member schemas use transforms (`workflow`, `methodology`,\n * `artifact_template`), which zod 3 discriminated unions cannot host. The\n * behavior is identical: the `type` field selects exactly one member schema\n * and only that member's issues are reported.\n */\nexport const declarativeDefinitionSchema: z.ZodType<DeclarativeDefinition, z.ZodTypeDef, unknown> =\n z.unknown().transform((value, ctx): DeclarativeDefinition => {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `expected a declarative definition object, got ${describeValue(value)}`,\n });\n return z.NEVER;\n }\n const declaredType = (value as Record<string, unknown>).type;\n if (declaredType === undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['type'],\n message: `missing \"type\" — declarative definitions must declare one of: ${DECLARATIVE_TYPES.join(', ')}`,\n });\n return z.NEVER;\n }\n if (!isDeclarativeType(declaredType)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['type'],\n message: `unknown declarative type ${JSON.stringify(declaredType)} — expected one of: ${DECLARATIVE_TYPES.join(', ')}`,\n });\n return z.NEVER;\n }\n const result = declarativeSchemasByType[declaredType].safeParse(value);\n if (!result.success) {\n for (const issue of result.error.issues) {\n ctx.addIssue(issue);\n }\n return z.NEVER;\n }\n return result.data as DeclarativeDefinition;\n });\n","import { parse as parseYamlText } from 'yaml';\nimport { WorkflowValidationError } from '@excalibur/shared';\nimport { formatValidationIssues } from '@excalibur/workflow-schema';\nimport type { z } from 'zod';\nimport { isDeclarativeType, type DeclarativeType } from './types';\nimport {\n declarativeDefinitionSchema,\n declarativeSchemasByType,\n type DeclarativeDefinition,\n type DeclarativeDefinitionByType,\n} from './union';\n\n/**\n * YAML parsing for declarative extension files. All failures throw\n * `WorkflowValidationError` (the definition-validation error of the\n * Excalibur hierarchy) with human-readable messages naming the offending\n * path and the problem — consistent with `parseWorkflowYaml`.\n */\n\nfunction describeValue(value: unknown): string {\n if (value === null) return 'null';\n if (value === undefined) return 'nothing';\n if (Array.isArray(value)) return 'a list';\n return `a ${typeof value}`;\n}\n\nfunction typeLabel(declarativeType: DeclarativeType | undefined): string {\n return declarativeType === undefined ? 'declarative definition' : `${declarativeType} definition`;\n}\n\nfunction definitionLabel(\n value: Record<string, unknown>,\n declarativeType: DeclarativeType | undefined,\n): string {\n const label = typeLabel(declarativeType);\n const id = value.id;\n if (typeof id === 'string' && id.length > 0) return `${label} \"${id}\"`;\n return label;\n}\n\nfunction parseYamlMapping(\n yamlText: string,\n declarativeType: DeclarativeType | undefined,\n): Record<string, unknown> {\n const label = typeLabel(declarativeType);\n let value: unknown;\n try {\n value = parseYamlText(yamlText);\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new WorkflowValidationError(`Invalid ${label} YAML: ${reason}`, { reason });\n }\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new WorkflowValidationError(\n `Invalid ${label}: expected a YAML mapping with the definition fields, got ${describeValue(value)}.`,\n );\n }\n return value as Record<string, unknown>;\n}\n\nfunction throwValidationError(\n value: Record<string, unknown>,\n declarativeType: DeclarativeType | undefined,\n error: z.ZodError,\n): never {\n const issues = formatValidationIssues(error);\n const lines = issues.map((issue) => ` - ${issue}`).join('\\n');\n throw new WorkflowValidationError(\n `Invalid ${definitionLabel(value, declarativeType)}:\\n${lines}`,\n { issues },\n );\n}\n\n/**\n * Parse and validate a declarative definition from YAML text.\n *\n * Without `expectedType`, the document must carry a `type` field naming one\n * of the 10 declarative types (the discriminated union decides). With\n * `expectedType` (e.g. derived from the `.excalibur/question-packs/`\n * directory the file lives in), a missing `type` field is filled in from the\n * hint, and a conflicting `type` field is a readable error.\n *\n * Throws `WorkflowValidationError` on YAML syntax errors, type mismatches\n * and schema violations.\n */\nexport function parseDeclarativeYaml<T extends DeclarativeType>(\n yamlText: string,\n expectedType: T,\n): DeclarativeDefinitionByType[T];\nexport function parseDeclarativeYaml(yamlText: string): DeclarativeDefinition;\nexport function parseDeclarativeYaml(\n yamlText: string,\n expectedType?: DeclarativeType,\n): DeclarativeDefinition {\n const value = parseYamlMapping(yamlText, expectedType);\n\n if (expectedType === undefined) {\n const result = declarativeDefinitionSchema.safeParse(value);\n if (!result.success) {\n const declared = value.type;\n throwValidationError(value, isDeclarativeType(declared) ? declared : undefined, result.error);\n }\n return result.data;\n }\n\n const declaredType = value.type;\n if (declaredType !== undefined && declaredType !== expectedType) {\n throw new WorkflowValidationError(\n `Invalid ${definitionLabel(value, expectedType)}: declares type ${JSON.stringify(declaredType)} but ${JSON.stringify(expectedType)} was expected here.`,\n { declaredType, expectedType },\n );\n }\n\n // Directory-style hints let files omit the discriminator.\n const candidate = { ...value, type: expectedType };\n const result = declarativeSchemasByType[expectedType].safeParse(candidate);\n if (!result.success) {\n throwValidationError(value, expectedType, result.error);\n }\n return result.data as DeclarativeDefinition;\n}\n","import { parse as parseYamlText } from 'yaml';\nimport { WorkflowValidationError } from '@excalibur/shared';\nimport { formatValidationIssues } from '@excalibur/workflow-schema';\nimport {\n artifactTemplateSchema,\n promptTemplateSchema,\n type ArtifactTemplateDefinition,\n type PromptTemplateDefinition,\n} from './schemas';\n\n/**\n * Markdown declarative files (extensions spec §4): a Markdown file becomes a\n * `prompt_template` or an `artifact_template`. The target type comes from\n * front-matter `type` (explicit author intent wins) or from the directory\n * the file lives in (`prompts/` vs `artifacts/`); the id from front-matter\n * `id` or the filename.\n */\n\n/** The two declarative types a Markdown file can define. */\nexport type MarkdownDeclarativeType = 'prompt_template' | 'artifact_template';\n\n/** Result of `parseDeclarativeMarkdown`. */\nexport type MarkdownDeclarativeDefinition = PromptTemplateDefinition | ArtifactTemplateDefinition;\n\nconst MARKDOWN_TYPES: readonly MarkdownDeclarativeType[] = ['prompt_template', 'artifact_template'];\n\n/** Directory names that imply a Markdown declarative type (`.excalibur/` layout). */\nconst DIRECTORY_HINTS: Readonly<Record<string, MarkdownDeclarativeType>> = {\n prompts: 'prompt_template',\n 'prompt-templates': 'prompt_template',\n artifacts: 'artifact_template',\n 'artifact-templates': 'artifact_template',\n};\n\n// `m` flag so the closing delimiter anchors at a line start, which also\n// matches a completely empty front-matter block (`---\\n---`).\nconst FRONT_MATTER_PATTERN = /^---[ \\t]*\\r?\\n([\\s\\S]*?)^---[ \\t]*(?:\\r?\\n|$)/m;\nconst MARKDOWN_EXTENSION_PATTERN = /\\.(md|markdown)$/i;\n\ninterface SplitContent {\n frontMatter: Record<string, unknown>;\n body: string;\n}\n\nfunction splitFrontMatter(filePath: string, content: string): SplitContent {\n const match = FRONT_MATTER_PATTERN.exec(content);\n if (match === null) {\n return { frontMatter: {}, body: content };\n }\n const body = content.slice(match[0].length);\n let value: unknown;\n try {\n value = parseYamlText(match[1] ?? '');\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new WorkflowValidationError(`Invalid front matter in ${filePath}: ${reason}`, {\n filePath,\n reason,\n });\n }\n if (value === null || value === undefined) {\n return { frontMatter: {}, body };\n }\n if (typeof value !== 'object' || Array.isArray(value)) {\n throw new WorkflowValidationError(\n `Invalid front matter in ${filePath}: expected a YAML mapping.`,\n { filePath },\n );\n }\n return { frontMatter: value as Record<string, unknown>, body };\n}\n\n/** Platform-independent path segmentation (handles both `/` and `\\`). */\nfunction pathSegments(filePath: string): string[] {\n return filePath.split(/[\\\\/]+/).filter((segment) => segment.length > 0);\n}\n\n/** The directory closest to the file wins when multiple hints are present. */\nfunction directoryHint(segments: string[]): MarkdownDeclarativeType | undefined {\n for (let index = segments.length - 2; index >= 0; index -= 1) {\n const segment = segments[index];\n if (segment === undefined) continue;\n const hint = DIRECTORY_HINTS[segment.toLowerCase()];\n if (hint !== undefined) return hint;\n }\n return undefined;\n}\n\nfunction resolveTargetType(\n filePath: string,\n frontMatter: Record<string, unknown>,\n segments: string[],\n): MarkdownDeclarativeType {\n const declaredType = frontMatter.type;\n if (declaredType !== undefined) {\n if (\n typeof declaredType === 'string' &&\n (MARKDOWN_TYPES as readonly string[]).includes(declaredType)\n ) {\n return declaredType as MarkdownDeclarativeType;\n }\n throw new WorkflowValidationError(\n `Invalid declarative Markdown file ${filePath}: front-matter type ${JSON.stringify(declaredType)} is not supported — Markdown files can only define ${MARKDOWN_TYPES.join(' or ')}; use a YAML file for other declarative types.`,\n { filePath, declaredType },\n );\n }\n const hint = directoryHint(segments);\n if (hint === undefined) {\n throw new WorkflowValidationError(\n `Cannot determine the declarative type of ${filePath}: place the file under a prompts/ or artifacts/ directory, or add front matter declaring \"type: prompt_template\" or \"type: artifact_template\".`,\n { filePath },\n );\n }\n return hint;\n}\n\n/** `refined-ticket` → `Refined Ticket`. */\nfunction humanizeIdentifier(stem: string): string {\n const words = stem.split(/[-_\\s]+/).filter((word) => word.length > 0);\n if (words.length === 0) return stem;\n return words.map((word) => (word[0]?.toUpperCase() ?? '') + word.slice(1)).join(' ');\n}\n\n/**\n * Parse a Markdown declarative file into a `prompt_template` or\n * `artifact_template` definition.\n *\n * Resolution rules:\n * - type: front-matter `type` (must be one of the two Markdown types),\n * else directory hint (`prompts/` → prompt_template, `artifacts/` →\n * artifact_template; closest directory wins), else a readable error.\n * - id: front-matter `id`, else the filename without its extension.\n * - name: front-matter `name`, else humanized from the id stem.\n * - template: the Markdown body below the front matter (trimmed); for\n * artifact templates, `variables` are auto-extracted from `{{...}}`.\n *\n * Throws `WorkflowValidationError` with the file path in the message on any\n * failure (bad front matter, unsupported type, empty body, schema issues).\n */\nexport function parseDeclarativeMarkdown(\n filePath: string,\n content: string,\n): MarkdownDeclarativeDefinition {\n const segments = pathSegments(filePath);\n const { frontMatter, body } = splitFrontMatter(filePath, content);\n const targetType = resolveTargetType(filePath, frontMatter, segments);\n\n const fileName = segments[segments.length - 1] ?? '';\n const stem = fileName.replace(MARKDOWN_EXTENSION_PATTERN, '');\n\n const candidate: Record<string, unknown> = {\n ...frontMatter,\n id: frontMatter.id ?? stem,\n name: frontMatter.name ?? humanizeIdentifier(stem),\n type: targetType,\n template: body.trim(),\n };\n\n const schema = targetType === 'prompt_template' ? promptTemplateSchema : artifactTemplateSchema;\n const result = schema.safeParse(candidate);\n if (!result.success) {\n const issues = formatValidationIssues(result.error);\n const lines = issues.map((issue) => ` - ${issue}`).join('\\n');\n throw new WorkflowValidationError(`Invalid ${targetType} ${filePath}:\\n${lines}`, {\n filePath,\n issues,\n });\n }\n return result.data;\n}\n","/**\n * @excalibur/declarative-schemas — zod schemas for the 10 declarative\n * extension types (extensions spec §4), the discriminated union over them,\n * and the YAML/Markdown parsers used by the extension runtime.\n *\n * `workflow` and `methodology` remain owned by `@excalibur/workflow-schema`;\n * their schemas and types are re-exported here so consumers of this package\n * see the full declarative surface.\n */\nexport * from './types';\nexport * from './schemas';\nexport * from './union';\nexport * from './parse';\nexport * from './markdown';\n\nexport {\n methodologySchema,\n workflowDefinitionSchema,\n workflowPhaseSchema,\n type Methodology,\n type WorkflowDefinition,\n type WorkflowPhase,\n} from '@excalibur/workflow-schema';\n","import type { AgentRole, ExcaliburConfig } from '@excalibur/shared';\nimport type { ExtensionLogger } from '../logger';\n\n/**\n * Agent tool contract (extensions-spec.md §5).\n *\n * Tools registered through `ctx.tools.registerTool` become available to agent\n * adapters alongside the native tools of `@excalibur/agent-runtime`. The host\n * activates extensions (`activateExtensions`) to harvest these tools and the\n * native agent loop advertises and EXECUTES them inside runs — gated by the\n * PermissionEngine and offered to read-only roles only when `readOnly` is set.\n */\n\n/** Execution context handed to a tool by the agent runtime. */\nexport interface ToolContext {\n /** Absolute path of the working directory the agent operates in. */\n workdir: string;\n /** Local run id when the tool runs inside a run (`run_YYYYMMDD_HHMMSS`). */\n runId?: string;\n /** Agent session id, for event attribution. */\n sessionId?: string;\n /** Role of the agent invoking the tool. */\n role?: AgentRole;\n /** Effective repository configuration. */\n config: ExcaliburConfig;\n logger: ExtensionLogger;\n}\n\n/** Result returned by a tool execution. */\nexport interface ToolResult {\n /** `true` when the tool ran successfully. */\n success: boolean;\n /** Human/agent-readable output (shown to the model). */\n output: string;\n /** Optional structured payload for programmatic consumers. */\n data?: unknown;\n /** Failure description when `success` is `false`. */\n error?: string;\n}\n\nexport interface AgentTool {\n /** Unique tool name (e.g. `query_database`, `fetch_ticket`). */\n name: string;\n /** Description shown to the model when the tool is offered. */\n description: string;\n /** JSON-schema-like description of the tool input. */\n inputSchema: unknown;\n execute(input: unknown, context: ToolContext): Promise<ToolResult>;\n /**\n * When `true`, the tool is non-mutating and is offered to read-only/planning\n * roles too (reviewer, architect, …). Default (absent/false): treated as\n * mutating and hidden from read-only roles — third-party code is gated\n * conservatively. Additive; pre-existing tools omit it.\n */\n readOnly?: boolean;\n}\n\n/** Narrows an arbitrary value to an executable {@link AgentTool}. */\nexport function isAgentTool(value: unknown): value is AgentTool {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n const tool = value as Partial<AgentTool>;\n return (\n typeof tool.name === 'string' &&\n tool.name.length > 0 &&\n typeof tool.description === 'string' &&\n typeof tool.execute === 'function'\n );\n}\n","import { ContributionRegistry, type ExtensionRegistry } from '@excalibur/extension-runtime';\nimport { createNoopLogger, type ExtensionConfig, type ExtensionLogger } from '../logger';\nimport { isExcaliburExtension } from '../define-extension';\nimport { createExtensionContext } from '../context';\nimport { isAgentTool, type AgentTool } from '../interfaces/tools';\n\n/**\n * Extension activation host (extensions-spec.md §5).\n *\n * The runtime loader (`@excalibur/extension-runtime`) only LOADS and validates a\n * compiled extension entrypoint — it never runs the extension's `register(ctx)`.\n * This helper performs that activation: it invokes each loaded programmatic\n * extension's `register(ctx)` and harvests the contributions it produces. The\n * first consumer is the native agent loop, which executes the harvested tools.\n *\n * Each extension activates into its OWN scratch `ContributionRegistry`, NOT the\n * shared one, on purpose: the loader pre-registers manifest-declared programmatic\n * contributions into the shared registry keyed by their declared name with the\n * extension instance as the value, and a same-source duplicate would silently\n * drop the real tool the extension registers here. Activating into a scratch\n * registry sidesteps that collision; hooks still target the SHARED hook registry\n * so an extension's event handlers reach live runs.\n */\nexport interface ActivateExtensionsOptions {\n /** Host logger handed to each extension's context (defaults to a no-op). */\n logger?: ExtensionLogger;\n /** Resolves per-extension configuration by id (defaults to `{}`). */\n config?: (extensionId: string) => ExtensionConfig;\n}\n\n/** The result of activating every loaded extension. */\nexport interface ActivationResult {\n /** Executable tools contributed across all activated extensions. */\n tools: AgentTool[];\n /** Activation warnings (a failed/duplicate activation never throws). */\n warnings: string[];\n}\n\n/**\n * Activates every loaded programmatic extension and returns the agent tools they\n * contribute. A faulty extension is recorded as a warning and skipped — one bad\n * extension never breaks activation. Tool names are global: the first extension\n * to register a name wins, later duplicates are dropped with a warning.\n */\nexport async function activateExtensions(\n registry: ExtensionRegistry,\n options: ActivateExtensionsOptions = {},\n): Promise<ActivationResult> {\n const tools: AgentTool[] = [];\n const warnings: string[] = [];\n const seen = new Set<string>();\n\n for (const extension of registry.extensions()) {\n if (extension.status !== 'loaded' || extension.instance === undefined) {\n continue;\n }\n if (!isExcaliburExtension(extension.instance)) {\n continue;\n }\n const id = extension.manifest.id;\n const scratch = new ContributionRegistry();\n const ctx = createExtensionContext({\n extensionId: id,\n contributions: scratch,\n hooks: registry.hooks,\n source: extension.source,\n logger: options.logger ?? createNoopLogger(),\n config: options.config?.(id) ?? {},\n });\n try {\n await extension.instance.register(ctx);\n } catch (error) {\n warnings.push(`Extension '${id}' failed to activate: ${errorMessage(error)}`);\n continue;\n }\n for (const contribution of scratch.list('tool')) {\n if (!isAgentTool(contribution.value)) {\n continue;\n }\n const tool = contribution.value;\n if (seen.has(tool.name)) {\n warnings.push(\n `Tool '${tool.name}' from extension '${id}' was ignored — a tool with that name is already contributed.`,\n );\n continue;\n }\n seen.add(tool.name);\n tools.push(tool);\n }\n for (const warning of scratch.warnings()) {\n warnings.push(`[${id}] ${warning}`);\n }\n }\n\n return { tools, warnings };\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n","import { z } from 'zod';\nimport { policyDecisionSchema } from '@excalibur/shared';\nimport type { AutonomyLevel, PolicyDecisionValue } from '@excalibur/shared';\n\n/**\n * Programmatic policy evaluator contract (extensions-spec.md §5).\n *\n * Evaluators complement declarative `policy_preset` rules when a decision\n * needs runtime logic (call an internal service, inspect file contents, …).\n * The decision value reuses the frozen `policyDecisionSchema` from\n * `@excalibur/shared`: `allow | deny | redact | require_approval`.\n */\n\n/** The action under evaluation, mirroring declarative `policy_preset` rules. */\nexport interface PolicyContext {\n /** Action identifier (e.g. `file_write`, `command_run`, `tool_call`). */\n action: string;\n /** Repo-relative path when the action targets a file. */\n filePath?: string;\n /** Full command line when the action runs a command. */\n command?: string;\n /** Tool name when the action is a tool invocation. */\n toolName?: string;\n /** Autonomy level of the surrounding run/interaction. */\n autonomyLevel?: AutonomyLevel;\n /** Local run id when the action happens inside a run. */\n runId?: string;\n metadata?: Record<string, unknown>;\n}\n\n/** Zod schema for a full policy decision (value + optional reason). */\nexport const policyDecisionResultSchema = z.object({\n decision: policyDecisionSchema,\n reason: z.string().optional(),\n});\n\n/** Decision returned by an evaluator. */\nexport interface PolicyDecision {\n decision: PolicyDecisionValue;\n /** Human-readable explanation, surfaced in approvals and audit trails. */\n reason?: string;\n}\n\nexport interface PolicyEvaluator {\n /** Stable evaluator id (e.g. `pii-guard`). */\n id: string;\n evaluate(context: PolicyContext): Promise<PolicyDecision>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAEA,QAAM,QAAQ,uBAAO,IAAI,YAAY;AACrC,QAAM,MAAM,uBAAO,IAAI,eAAe;AACtC,QAAM,MAAM,uBAAO,IAAI,UAAU;AACjC,QAAM,OAAO,uBAAO,IAAI,WAAW;AACnC,QAAM,SAAS,uBAAO,IAAI,aAAa;AACvC,QAAM,MAAM,uBAAO,IAAI,UAAU;AACjC,QAAM,YAAY,uBAAO,IAAI,gBAAgB;AAC7C,QAAM,UAAU,CAAC,SAAS,CAAC,CAAC,QAAQ,OAAO,SAAS,YAAY,KAAK,SAAS,MAAM;AACpF,QAAM,aAAa,CAAC,SAAS,CAAC,CAAC,QAAQ,OAAO,SAAS,YAAY,KAAK,SAAS,MAAM;AACvF,QAAM,QAAQ,CAAC,SAAS,CAAC,CAAC,QAAQ,OAAO,SAAS,YAAY,KAAK,SAAS,MAAM;AAClF,QAAM,SAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,OAAO,SAAS,YAAY,KAAK,SAAS,MAAM;AACnF,QAAM,WAAW,CAAC,SAAS,CAAC,C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AAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;;;ACnGA,SAAS,KAAAC,WAAS;AA+BX,IAAM,6BAA6BC,IAAE,OAAO;AAAA,EACjD,UAAU;AAAA,EACV,QAAQA,IAAE,OAAO,EAAE,SAAS;AAC9B,CAAC;","names":["res","res","anchors","node","i","end","value","stringify","comment","str","map","seq","require_schema","pairs","omap","require_bool","require_float","require_int","n","set","res","require_schema","tags","res","value","end","tag","i","ch","start","lineCounter","z","z","z","z","z","z","z","z","z","z","z","parseYamlText","import_yaml","z","import_yaml","z","z","z","import_yaml","import_yaml","z","describeValue","z","z","z","z"]}