clanka 0.12.3 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Acp.d.ts +9 -0
- package/dist/Acp.d.ts.map +1 -1
- package/dist/Acp.js +21 -10
- package/dist/Acp.js.map +1 -1
- package/dist/Acp.test.js +17 -2
- package/dist/Acp.test.js.map +1 -1
- package/dist/Codex.d.ts +12 -2
- package/dist/Codex.d.ts.map +1 -1
- package/dist/Codex.js +7 -5
- package/dist/Codex.js.map +1 -1
- package/dist/Codex.test.d.ts +2 -0
- package/dist/Codex.test.d.ts.map +1 -0
- package/dist/Codex.test.js +37 -0
- package/dist/Codex.test.js.map +1 -0
- package/dist/Copilot.d.ts.map +1 -1
- package/dist/Copilot.js +4 -4
- package/dist/Copilot.js.map +1 -1
- package/dist/Copilot.test.d.ts +2 -0
- package/dist/Copilot.test.d.ts.map +1 -0
- package/dist/Copilot.test.js +32 -0
- package/dist/Copilot.test.js.map +1 -0
- package/dist/ModelLayer.d.ts +64 -0
- package/dist/ModelLayer.d.ts.map +1 -0
- package/dist/ModelLayer.js +96 -0
- package/dist/ModelLayer.js.map +1 -0
- package/dist/ModelLayer.test.d.ts +2 -0
- package/dist/ModelLayer.test.d.ts.map +1 -0
- package/dist/ModelLayer.test.js +83 -0
- package/dist/ModelLayer.test.js.map +1 -0
- package/dist/ModelsRepo.d.ts +80 -0
- package/dist/ModelsRepo.d.ts.map +1 -0
- package/dist/ModelsRepo.js +162 -0
- package/dist/ModelsRepo.js.map +1 -0
- package/dist/ModelsRepo.test.d.ts +2 -0
- package/dist/ModelsRepo.test.d.ts.map +1 -0
- package/dist/ModelsRepo.test.js +168 -0
- package/dist/ModelsRepo.test.js.map +1 -0
- package/dist/Xai.d.ts +12 -2
- package/dist/Xai.d.ts.map +1 -1
- package/dist/Xai.js +8 -2
- package/dist/Xai.js.map +1 -1
- package/dist/Xai.test.js +38 -7
- package/dist/Xai.test.js.map +1 -1
- package/dist/bin/{Effect-DuThyCJ1.mjs → Effect-4B1lzxy4.mjs} +2 -2
- package/dist/bin/{Effect-DuThyCJ1.mjs.map → Effect-4B1lzxy4.mjs.map} +1 -1
- package/dist/bin/{McpClient-CIiPyMDJ.mjs → McpClient-DMfHHEx3.mjs} +3 -3
- package/dist/bin/{McpClient-CIiPyMDJ.mjs.map → McpClient-DMfHHEx3.mjs.map} +1 -1
- package/dist/bin/{OutputFormatter-BvIjvUmT.mjs → OutputFormatter-DRycCEdr.mjs} +3 -3
- package/dist/bin/{OutputFormatter-BvIjvUmT.mjs.map → OutputFormatter-DRycCEdr.mjs.map} +1 -1
- package/dist/bin/{Schema-DcXUXpRg.mjs → Schema-D4fxUgEU.mjs} +3 -3
- package/dist/bin/{Schema-DcXUXpRg.mjs.map → Schema-D4fxUgEU.mjs.map} +1 -1
- package/dist/bin/{SemanticSearch-CdGA4CIC.mjs → SemanticSearch-BcLFv9qz.mjs} +4 -4
- package/dist/bin/{SemanticSearch-CdGA4CIC.mjs.map → SemanticSearch-BcLFv9qz.mjs.map} +1 -1
- package/dist/bin/{Stream-I9SRMlLj.mjs → Stream-i37nF1ep.mjs} +2 -2
- package/dist/bin/{Stream-I9SRMlLj.mjs.map → Stream-i37nF1ep.mjs.map} +1 -1
- package/dist/bin/cli.mjs +757 -420
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/cli.js +59 -46
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Acp.test.ts +32 -1
- package/src/Acp.ts +32 -12
- package/src/Codex.test.ts +60 -0
- package/src/Codex.ts +26 -14
- package/src/Copilot.test.ts +55 -0
- package/src/Copilot.ts +7 -4
- package/src/ModelLayer.test.ts +122 -0
- package/src/ModelLayer.ts +149 -0
- package/src/ModelsRepo.test.ts +206 -0
- package/src/ModelsRepo.ts +260 -0
- package/src/Xai.test.ts +62 -7
- package/src/Xai.ts +27 -8
- package/src/cli.ts +74 -81
- package/src/index.ts +5 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $t as tryPromise, B as fn, X as gen,
|
|
2
|
-
import { J as TaggedError, p as Defect } from "./Schema-
|
|
1
|
+
import { $t as tryPromise, B as fn, X as gen, lo as Service, qt as sync, t as acquireRelease, wr as effect, wt as promise } from "./Effect-4B1lzxy4.mjs";
|
|
2
|
+
import { J as TaggedError, p as Defect } from "./Schema-D4fxUgEU.mjs";
|
|
3
3
|
import { c as StreamableHTTPClientTransport, l as Client } from "./cli.mjs";
|
|
4
4
|
//#region src/McpClient.ts
|
|
5
5
|
var McpClient = class extends Service()("clanka/McpClient") {};
|
|
@@ -33,4 +33,4 @@ const layer = effect(McpClient, gen(function* () {
|
|
|
33
33
|
//#endregion
|
|
34
34
|
export { McpClient, McpClientError, layer };
|
|
35
35
|
|
|
36
|
-
//# sourceMappingURL=McpClient-
|
|
36
|
+
//# sourceMappingURL=McpClient-DMfHHEx3.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpClient-
|
|
1
|
+
{"version":3,"file":"McpClient-DMfHHEx3.mjs","names":["Context.Service","Schema.TaggedError","Schema.Defect","Layer.effect","Effect.gen","Effect.acquireRelease","Effect.sync","Effect.promise","Effect.fn","Effect.tryPromise"],"sources":["../../src/McpClient.ts"],"sourcesContent":["/**\n * @since 1.0.0\n */\nimport * as Effect from \"effect/Effect\"\nimport * as Layer from \"effect/Layer\"\nimport * as Schema from \"effect/Schema\"\nimport * as Context from \"effect/Context\"\nimport { Client } from \"@modelcontextprotocol/sdk/client\"\nimport { StreamableHTTPClientTransport } from \"@modelcontextprotocol/sdk/client/streamableHttp.js\"\nimport type { Transport } from \"@modelcontextprotocol/sdk/shared/transport.js\"\n\n/**\n * @since 1.0.0\n * @category Services\n */\nexport class McpClient extends Context.Service<\n McpClient,\n {\n connect(options: {\n readonly url: string\n }): Effect.Effect<void, McpClientError>\n toolCall(options: {\n readonly name: string\n readonly arguments: Record<string, unknown>\n }): Effect.Effect<unknown, McpClientError>\n }\n>()(\"clanka/McpClient\") {}\n\n/**\n * @since 1.0.0\n * @category Errors\n */\nexport class McpClientError extends Schema.TaggedError<McpClientError>()(\n \"McpClientError\",\n {\n cause: Schema.Defect(),\n },\n) {}\n\n/**\n * @since 1.0.0\n * @category Layers\n */\nexport const layer = Layer.effect(\n McpClient,\n Effect.gen(function* () {\n const client = yield* Effect.acquireRelease(\n Effect.sync(\n () =>\n new Client({\n name: \"clanka\",\n version: \"0.1.0\",\n }),\n ),\n (client) => Effect.promise(() => client.close()),\n )\n\n const connect = Effect.fn(\"McpClient.connect\")(function* (options: {\n readonly url: string\n }) {\n const transport = new StreamableHTTPClientTransport(new URL(options.url))\n return yield* Effect.tryPromise({\n try: (signal) => client.connect(transport as Transport, { signal }),\n catch: (cause) => new McpClientError({ cause }),\n })\n })\n\n return McpClient.of({\n connect,\n toolCall: Effect.fn(\"McpClient.toolCall\")((options) =>\n Effect.tryPromise({\n try: async () => {\n const response = await client.callTool({\n name: options.name,\n arguments: options.arguments,\n })\n return response.structuredContent ?? response.content\n },\n catch: (cause) => new McpClientError({ cause }),\n }),\n ),\n })\n }),\n)\n"],"mappings":";;;;AAeA,IAAa,YAAb,cAA+BA,QAW7B,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAMzB,IAAa,iBAAb,cAAoCC,YAAmC,CAAC,CACtE,kBACA,EACE,OAAOC,OAAc,EACvB,CACF,CAAC,CAAC,CAAC;AAMH,MAAa,QAAQC,OACnB,WACAC,IAAW,aAAa;CACtB,MAAM,SAAS,OAAOC,eACpBC,WAEI,IAAI,OAAO;EACT,MAAM;EACN,SAAS;CACX,CAAC,CACL,IACC,WAAWC,cAAqB,OAAO,MAAM,CAAC,CACjD;CAEA,MAAM,UAAUC,GAAU,mBAAmB,CAAC,CAAC,WAAW,SAEvD;EACD,MAAM,YAAY,IAAI,8BAA8B,IAAI,IAAI,QAAQ,GAAG,CAAC;EACxE,OAAO,OAAOC,WAAkB;GAC9B,MAAM,WAAW,OAAO,QAAQ,WAAwB,EAAE,OAAO,CAAC;GAClE,QAAQ,UAAU,IAAI,eAAe,EAAE,MAAM,CAAC;EAChD,CAAC;CACH,CAAC;CAED,OAAO,UAAU,GAAG;EAClB;EACA,UAAUD,GAAU,oBAAoB,CAAC,EAAE,YACzCC,WAAkB;GAChB,KAAK,YAAY;IACf,MAAM,WAAW,MAAM,OAAO,SAAS;KACrC,MAAM,QAAQ;KACd,WAAW,QAAQ;IACrB,CAAC;IACD,OAAO,SAAS,qBAAqB,SAAS;GAChD;GACA,QAAQ,UAAU,IAAI,eAAe,EAAE,MAAM,CAAC;EAChD,CAAC,CACH;CACF,CAAC;AACH,CAAC,CACH"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { K as forkIn, Lt as scope, V as fnUntraced, X as gen,
|
|
2
|
-
import { Et as unbounded, J as runIntoPubSub, Z as succeed, c as die, k as map, nt as tap, r as catchIf, ut as makeUnsafe, w as fromPubSub } from "./Stream-
|
|
1
|
+
import { K as forkIn, Lt as scope, V as fnUntraced, X as gen, bc as identity, lc as isTagged, lo as Service, nr as fail, sn as void_, u as asVoid, vt as onExit, wr as effect, yr as pretty$1 } from "./Effect-4B1lzxy4.mjs";
|
|
2
|
+
import { Et as unbounded, J as runIntoPubSub, Z as succeed, c as die, k as map, nt as tap, r as catchIf, ut as makeUnsafe, w as fromPubSub } from "./Stream-i37nF1ep.mjs";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import tty from "node:tty";
|
|
@@ -584,4 +584,4 @@ const layerMuxer = (formatter) => effect(Muxer, gen(function* () {
|
|
|
584
584
|
//#endregion
|
|
585
585
|
export { Muxer, layerMuxer, pretty };
|
|
586
586
|
|
|
587
|
-
//# sourceMappingURL=OutputFormatter-
|
|
587
|
+
//# sourceMappingURL=OutputFormatter-DRycCEdr.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OutputFormatter-BvIjvUmT.mjs","names":["styles","Stream.map","Cause.pretty","Cause.fail","Stream.catchIf","Predicate.isTagged","Stream.succeed","Stream.die","Context.Service","Layer.effect","Effect.gen","scope","Effect.scope","PubSub.unbounded","Semaphore.makeUnsafe","Stream.tap","Effect.fnUntraced","Stream.runIntoPubSub","Effect.onExit","Effect.void","Effect.forkIn","Effect.asVoid","Stream.fromPubSub"],"sources":["../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/utilities.js","../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/vendor/ansi-styles/index.js","../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/vendor/supports-color/index.js","../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/index.js","../../src/OutputFormatter.ts"],"sourcesContent":["// Note: Each match is kept and `postfix` is inserted after it. `String#replaceAll(substring, substring + postfix)` does the same, but it has to scan the replacement for `$` patterns and it is several times slower on the no-match path that most calls take.\nexport function stringReplaceAll(string, substring, postfix) {\n\tlet index = string.indexOf(substring);\n\tif (index === -1) {\n\t\treturn string;\n\t}\n\n\tconst substringLength = substring.length;\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\treturnValue += string.slice(endIndex, index) + substring + postfix;\n\t\tendIndex = index + substringLength;\n\t\tindex = string.indexOf(substring, endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.slice(endIndex);\n\treturn returnValue;\n}\n\nexport function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\tconst isGotCR = string[index - 1] === '\\r';\n\t\treturnValue += string.slice(endIndex, (isGotCR ? index - 1 : index)) + prefix + (isGotCR ? '\\r\\n' : '\\n') + postfix;\n\t\tendIndex = index + 1;\n\t\tindex = string.indexOf('\\n', endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.slice(endIndex);\n\treturn returnValue;\n}\n","const ANSI_BACKGROUND_OFFSET = 10;\nconst ANSI_UNDERLINE_OFFSET = 20;\n\nconst wrapAnsi16 = (offset = 0) => code => `\\u{1B}[${code + offset}m`;\n\nconst wrapAnsi256 = (offset = 0) => code => `\\u{1B}[${38 + offset};5;${code}m`;\n\nconst wrapAnsi16m = (offset = 0) => (red, green, blue) => `\\u{1B}[${38 + offset};2;${red};${green};${blue}m`;\n\n// `SGR 58` has no basic 16-color form, so the basic color code is mapped to its palette index instead.\nconst wrapUnderlineAnsi = code => `\\u{1B}[58;5;${code < 90 ? code - 30 : code - 90 + 8}m`;\n\nconst styles = {\n\tmodifier: {\n\t\treset: [0, 0],\n\t\t// 21 isn't widely supported and 22 does the same thing\n\t\tbold: [1, 22],\n\t\tdim: [2, 22],\n\t\titalic: [3, 23],\n\t\tunderline: [4, 24],\n\t\t// Extended underline styles (`SGR 4:x` sub-parameters). Not in upstream `ansi-styles`.\n\t\tunderlineDouble: ['4:2', 24],\n\t\tunderlineCurly: ['4:3', 24],\n\t\tunderlineDotted: ['4:4', 24],\n\t\tunderlineDashed: ['4:5', 24],\n\t\toverline: [53, 55],\n\t\tinverse: [7, 27],\n\t\thidden: [8, 28],\n\t\tstrikethrough: [9, 29],\n\t},\n\tcolor: {\n\t\tblack: [30, 39],\n\t\tred: [31, 39],\n\t\tgreen: [32, 39],\n\t\tyellow: [33, 39],\n\t\tblue: [34, 39],\n\t\tmagenta: [35, 39],\n\t\tcyan: [36, 39],\n\t\twhite: [37, 39],\n\n\t\t// Bright color\n\t\tblackBright: [90, 39],\n\t\tgray: [90, 39], // Alias of `blackBright`\n\t\tgrey: [90, 39], // Alias of `blackBright`\n\t\tredBright: [91, 39],\n\t\tgreenBright: [92, 39],\n\t\tyellowBright: [93, 39],\n\t\tblueBright: [94, 39],\n\t\tmagentaBright: [95, 39],\n\t\tcyanBright: [96, 39],\n\t\twhiteBright: [97, 39],\n\t},\n\tbgColor: {\n\t\tbgBlack: [40, 49],\n\t\tbgRed: [41, 49],\n\t\tbgGreen: [42, 49],\n\t\tbgYellow: [43, 49],\n\t\tbgBlue: [44, 49],\n\t\tbgMagenta: [45, 49],\n\t\tbgCyan: [46, 49],\n\t\tbgWhite: [47, 49],\n\n\t\t// Bright color\n\t\tbgBlackBright: [100, 49],\n\t\tbgGray: [100, 49], // Alias of `bgBlackBright`\n\t\tbgGrey: [100, 49], // Alias of `bgBlackBright`\n\t\tbgRedBright: [101, 49],\n\t\tbgGreenBright: [102, 49],\n\t\tbgYellowBright: [103, 49],\n\t\tbgBlueBright: [104, 49],\n\t\tbgMagentaBright: [105, 49],\n\t\tbgCyanBright: [106, 49],\n\t\tbgWhiteBright: [107, 49],\n\t},\n\t// Underline color (`SGR 58`/`59`). Not in upstream `ansi-styles`.\n\tunderlineColor: {\n\t\tunderlineBlack: ['58;5;0', 59],\n\t\tunderlineRed: ['58;5;1', 59],\n\t\tunderlineGreen: ['58;5;2', 59],\n\t\tunderlineYellow: ['58;5;3', 59],\n\t\tunderlineBlue: ['58;5;4', 59],\n\t\tunderlineMagenta: ['58;5;5', 59],\n\t\tunderlineCyan: ['58;5;6', 59],\n\t\tunderlineWhite: ['58;5;7', 59],\n\n\t\t// Bright color\n\t\tunderlineBlackBright: ['58;5;8', 59],\n\t\tunderlineGray: ['58;5;8', 59], // Alias of `underlineBlackBright`\n\t\tunderlineGrey: ['58;5;8', 59], // Alias of `underlineBlackBright`\n\t\tunderlineRedBright: ['58;5;9', 59],\n\t\tunderlineGreenBright: ['58;5;10', 59],\n\t\tunderlineYellowBright: ['58;5;11', 59],\n\t\tunderlineBlueBright: ['58;5;12', 59],\n\t\tunderlineMagentaBright: ['58;5;13', 59],\n\t\tunderlineCyanBright: ['58;5;14', 59],\n\t\tunderlineWhiteBright: ['58;5;15', 59],\n\t},\n};\n\nexport const modifierNames = Object.keys(styles.modifier);\nexport const foregroundColorNames = Object.keys(styles.color);\nexport const backgroundColorNames = Object.keys(styles.bgColor);\nexport const underlineColorNames = Object.keys(styles.underlineColor);\nexport const colorNames = [...foregroundColorNames, ...backgroundColorNames];\n\nfunction assembleStyles() {\n\tconst codes = new Map();\n\n\tfor (const [groupName, group] of Object.entries(styles)) {\n\t\tfor (const [styleName, style] of Object.entries(group)) {\n\t\t\tstyles[styleName] = {\n\t\t\t\topen: `\\u{1B}[${style[0]}m`,\n\t\t\t\tclose: `\\u{1B}[${style[1]}m`,\n\t\t\t};\n\n\t\t\tgroup[styleName] = styles[styleName];\n\n\t\t\t// Only the leading SGR parameter identifies a style, so `4:3` and `58;5;1` are keyed as `4` and `58`.\n\t\t\tcodes.set(Number.parseInt(style[0], 10), style[1]);\n\t\t}\n\n\t\tObject.defineProperty(styles, groupName, {\n\t\t\tvalue: group,\n\t\t\tenumerable: false,\n\t\t});\n\t}\n\n\tObject.defineProperty(styles, 'codes', {\n\t\tvalue: codes,\n\t\tenumerable: false,\n\t});\n\n\tstyles.color.close = '\\u{1B}[39m';\n\tstyles.bgColor.close = '\\u{1B}[49m';\n\tstyles.underlineColor.close = '\\u{1B}[59m';\n\n\tstyles.color.ansi = wrapAnsi16();\n\tstyles.color.ansi256 = wrapAnsi256();\n\tstyles.color.ansi16m = wrapAnsi16m();\n\tstyles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);\n\tstyles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);\n\tstyles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);\n\tstyles.underlineColor.ansi = wrapUnderlineAnsi;\n\tstyles.underlineColor.ansi256 = wrapAnsi256(ANSI_UNDERLINE_OFFSET);\n\tstyles.underlineColor.ansi16m = wrapAnsi16m(ANSI_UNDERLINE_OFFSET);\n\n\t// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js\n\tObject.defineProperties(styles, {\n\t\trgbToAnsi256: {\n\t\t\tvalue(red, green, blue) {\n\t\t\t\t// We use the extended greyscale palette here, with the exception of\n\t\t\t\t// black and white. normal palette only has 4 greyscale shades.\n\t\t\t\tif (red === green && green === blue) {\n\t\t\t\t\tif (red < 8) {\n\t\t\t\t\t\treturn 16;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (red > 248) {\n\t\t\t\t\t\treturn 231;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn Math.round(((red - 8) / 247) * 24) + 232;\n\t\t\t\t}\n\n\t\t\t\treturn 16\n\t\t\t\t\t+ (36 * Math.round(red / 255 * 5))\n\t\t\t\t\t+ (6 * Math.round(green / 255 * 5))\n\t\t\t\t\t+ Math.round(blue / 255 * 5);\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToRgb: {\n\t\t\tvalue(hex) {\n\t\t\t\tconst matches = /[\\da-f]{6}|[\\da-f]{3}/i.exec(hex.toString(16));\n\t\t\t\tif (!matches) {\n\t\t\t\t\treturn [0, 0, 0];\n\t\t\t\t}\n\n\t\t\t\tlet [colorString] = matches;\n\n\t\t\t\tif (colorString.length === 3) {\n\t\t\t\t\tcolorString = [...colorString].map(character => character + character).join('');\n\t\t\t\t}\n\n\t\t\t\tconst integer = Number.parseInt(colorString, 16);\n\n\t\t\t\treturn [\n\t\t\t\t\t/* eslint-disable no-bitwise -- We need the speed */\n\t\t\t\t\t(integer >> 16) & 0xFF,\n\t\t\t\t\t(integer >> 8) & 0xFF,\n\t\t\t\t\tinteger & 0xFF,\n\t\t\t\t\t/* eslint-enable no-bitwise */\n\t\t\t\t];\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToAnsi256: {\n\t\t\tvalue: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),\n\t\t\tenumerable: false,\n\t\t},\n\t\tansi256ToAnsi: {\n\t\t\tvalue(code) {\n\t\t\t\tif (code < 8) {\n\t\t\t\t\treturn 30 + code;\n\t\t\t\t}\n\n\t\t\t\tif (code < 16) {\n\t\t\t\t\treturn 90 + (code - 8);\n\t\t\t\t}\n\n\t\t\t\tlet red;\n\t\t\t\tlet green;\n\t\t\t\tlet blue;\n\n\t\t\t\tif (code >= 232) {\n\t\t\t\t\tred = (((code - 232) * 10) + 8) / 255;\n\t\t\t\t\tgreen = red;\n\t\t\t\t\tblue = red;\n\t\t\t\t} else {\n\t\t\t\t\tcode -= 16;\n\n\t\t\t\t\tconst remainder = code % 36;\n\n\t\t\t\t\tred = Math.floor(code / 36) / 5;\n\t\t\t\t\tgreen = Math.floor(remainder / 6) / 5;\n\t\t\t\t\tblue = (remainder % 6) / 5;\n\t\t\t\t}\n\n\t\t\t\tconst value = Math.max(red, green, blue) * 2;\n\n\t\t\t\tif (value === 0) {\n\t\t\t\t\treturn 30;\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tlet result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));\n\n\t\t\t\tif (value === 2) {\n\t\t\t\t\tresult += 60;\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\trgbToAnsi: {\n\t\t\tvalue: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToAnsi: {\n\t\t\tvalue: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),\n\t\t\tenumerable: false,\n\t\t},\n\t});\n\n\treturn styles;\n}\n\nconst ansiStyles = assembleStyles();\n\nexport default ansiStyles;\n","import process from 'node:process';\nimport os from 'node:os';\nimport tty from 'node:tty';\n\n// From: https://github.com/sindresorhus/has-flag/blob/main/index.js\n/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {\nfunction hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {\n\tconst prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');\n\tconst position = argv.indexOf(prefix + flag);\n\tconst terminatorPosition = argv.indexOf('--');\n\treturn position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);\n}\n\nconst {env} = process;\n\nlet flagForceColor;\nif (\n\thasFlag('no-color')\n\t|| hasFlag('no-colors')\n\t|| hasFlag('color=false')\n\t|| hasFlag('color=never')\n) {\n\tflagForceColor = 0;\n} else if (\n\thasFlag('color')\n\t|| hasFlag('colors')\n\t|| hasFlag('color=true')\n\t|| hasFlag('color=always')\n) {\n\tflagForceColor = 1;\n}\n\n// Whether `FORCE_COLOR` names a level. Shared with the exact-level check below so that the two cannot disagree on what counts as numeric.\nfunction hasNumericForceColor() {\n\treturn /^\\d+$/.test(env.FORCE_COLOR);\n}\n\nfunction envForceColor() {\n\tif (!('FORCE_COLOR' in env)) {\n\t\treturn;\n\t}\n\n\tif (env.FORCE_COLOR === 'false') {\n\t\treturn 0;\n\t}\n\n\tif (env.FORCE_COLOR === 'true' || env.FORCE_COLOR.length === 0) {\n\t\treturn 1;\n\t}\n\n\tif (!hasNumericForceColor()) {\n\t\treturn;\n\t}\n\n\treturn Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);\n}\n\nfunction translateLevel(level) {\n\tif (level === 0) {\n\t\treturn false;\n\t}\n\n\treturn {\n\t\tlevel,\n\t\thasBasic: true,\n\t\thas256: level >= 2,\n\t\thas16m: level >= 3,\n\t};\n}\n\nfunction _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {\n\tconst noFlagForceColor = envForceColor();\n\tif (noFlagForceColor !== undefined) {\n\t\tflagForceColor = noFlagForceColor;\n\t}\n\n\tconst forceColor = sniffFlags ? flagForceColor : noFlagForceColor;\n\n\tif (forceColor === 0) {\n\t\treturn 0;\n\t}\n\n\tif (sniffFlags) {\n\t\tif (hasFlag('color=16m')\n\t\t\t|| hasFlag('color=full')\n\t\t\t|| hasFlag('color=truecolor')) {\n\t\t\treturn 3;\n\t\t}\n\n\t\tif (hasFlag('color=256')) {\n\t\t\treturn 2;\n\t\t}\n\t}\n\n\t// A numeric `FORCE_COLOR` requests an exact level, while `FORCE_COLOR=true` and `FORCE_COLOR=` only enable color and let the level be detected.\n\tif (forceColor !== undefined && hasNumericForceColor()) {\n\t\treturn forceColor;\n\t}\n\n\t// Check for Azure DevOps pipelines.\n\t// Has to be above the `!streamIsTTY` check.\n\tif ('TF_BUILD' in env && 'AGENT_NAME' in env) {\n\t\treturn 1;\n\t}\n\n\tif (haveStream && !streamIsTTY && forceColor === undefined) {\n\t\treturn 0;\n\t}\n\n\tconst min = forceColor || 0;\n\n\tif (env.TERM === 'dumb') {\n\t\treturn min;\n\t}\n\n\tif (process.platform === 'win32') {\n\t\t// Windows 10 build 10586 is the first Windows release that supports 256 colors.\n\t\t// Windows 10 build 14931 is the first release that supports 16m/TrueColor.\n\t\tconst osRelease = os.release().split('.');\n\t\tif (\n\t\t\tNumber(osRelease[0]) >= 10\n\t\t\t&& Number(osRelease[2]) >= 10_586\n\t\t) {\n\t\t\treturn Number(osRelease[2]) >= 14_931 ? 3 : 2;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\tif ('CI' in env) {\n\t\tif (['GITHUB_ACTIONS', 'GITEA_ACTIONS', 'CIRCLECI'].some(key => key in env)) {\n\t\t\treturn 3;\n\t\t}\n\n\t\tif (['TRAVIS', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn min;\n\t}\n\n\tif ('TEAMCITY_VERSION' in env) {\n\t\treturn /^(?:9\\.0*[1-9]\\d*\\.|\\d{2,}\\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;\n\t}\n\n\tif (env.COLORTERM === 'truecolor') {\n\t\treturn 3;\n\t}\n\n\tif (env.TERM === 'xterm-kitty') {\n\t\treturn 3;\n\t}\n\n\tif (env.TERM === 'xterm-ghostty') {\n\t\treturn 3;\n\t}\n\n\tif (env.TERM === 'wezterm') {\n\t\treturn 3;\n\t}\n\n\tif ('TERM_PROGRAM' in env) {\n\t\tconst version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.', 1)[0], 10);\n\n\t\tswitch (env.TERM_PROGRAM) {\n\t\t\tcase 'iTerm.app': {\n\t\t\t\treturn version >= 3 ? 3 : 2;\n\t\t\t}\n\n\t\t\tcase 'Apple_Terminal': {\n\t\t\t\treturn 2;\n\t\t\t}\n\t\t\t// No default\n\t\t}\n\t}\n\n\tif (/-256(?:color)?$/i.test(env.TERM)) {\n\t\treturn 2;\n\t}\n\n\tif (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {\n\t\treturn 1;\n\t}\n\n\tif ('COLORTERM' in env) {\n\t\treturn 1;\n\t}\n\n\treturn min;\n}\n\nexport function createSupportsColor(stream, options = {}) {\n\tconst level = _supportsColor(stream, {\n\t\tstreamIsTTY: stream && stream.isTTY,\n\t\t...options,\n\t});\n\n\treturn translateLevel(level);\n}\n\nconst supportsColor = {\n\tstdout: createSupportsColor({isTTY: tty.isatty(1)}),\n\tstderr: createSupportsColor({isTTY: tty.isatty(2)}),\n};\n\nexport default supportsColor;\n","import {\n\tstringReplaceAll,\n\tstringEncaseCRLFWithFirstIndex,\n} from './utilities.js';\nimport ansiStyles from '#ansi-styles';\nimport supportsColor from '#supports-color';\n\nconst {stdout: stdoutColor, stderr: stderrColor} = supportsColor;\n\nconst GENERATOR = Symbol('GENERATOR');\nconst STYLER = Symbol('STYLER');\nconst IS_EMPTY = Symbol('IS_EMPTY');\nconst LEVEL = Symbol('LEVEL');\n\nconst styles = Object.create(null);\n\nconst assertValidLevel = level => {\n\tif (!Number.isSafeInteger(level) || level < 0 || level > 3) {\n\t\tthrow new Error('The `level` should be an integer from 0 to 3');\n\t}\n};\n\n// The level is stored under a symbol so the hot path can read it as a plain property, while `level` itself is an accessor that rejects values the rest of the code could not handle.\nconst levelDescriptor = {\n\tenumerable: true,\n\tget() {\n\t\treturn this[LEVEL];\n\t},\n\tset(level) {\n\t\tassertValidLevel(level);\n\t\tthis[LEVEL] = level;\n\t},\n};\n\nconst applyOptions = (object, options = {}) => {\n\tif (options.level !== undefined) {\n\t\tassertValidLevel(options.level);\n\t}\n\n\t// Detect level if not set manually. Written under the symbol rather than through `level`, as the prototype carrying that accessor is not installed until after this runs.\n\tconst colorLevel = stdoutColor ? stdoutColor.level : 0;\n\tobject[LEVEL] = options.level === undefined ? colorLevel : options.level;\n};\n\nexport class Chalk {\n\tconstructor(options) {\n\t\t// eslint-disable-next-line no-constructor-return\n\t\treturn chalkFactory(options);\n\t}\n}\n\nconst chalkFactory = options => {\n\tconst chalk = (...strings) => strings.join(' ');\n\tapplyOptions(chalk, options);\n\n\tObject.setPrototypeOf(chalk, createChalk.prototype);\n\n\treturn chalk;\n};\n\nfunction createChalk(options) {\n\treturn chalkFactory(options);\n}\n\n// eslint-disable-next-line unicorn/no-top-level-side-effects -- The prototype chain must be set up at module load.\nObject.setPrototypeOf(createChalk.prototype, Function.prototype);\n\nfor (const [styleName, style] of Object.entries(ansiStyles)) {\n\tstyles[styleName] = {\n\t\tget() {\n\t\t\tconst builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);\n\t\t\tObject.defineProperty(this, styleName, {value: builder});\n\t\t\treturn builder;\n\t\t},\n\t};\n}\n\nstyles.visible = {\n\tget() {\n\t\tconst builder = createBuilder(this, this[STYLER], true);\n\t\tObject.defineProperty(this, 'visible', {value: builder});\n\t\treturn builder;\n\t},\n};\n\n// Resolve a color model to one converter per `level`, so that a call only has to look up the converter for the current level instead of re-deciding the model and level every time.\nconst createModelConverters = (model, type) => {\n\tconst style = ansiStyles[type];\n\n\tif (model === 'rgb') {\n\t\tconst ansi = (red, green, blue) => style.ansi(ansiStyles.rgbToAnsi(red, green, blue));\n\t\tconst ansi256 = (red, green, blue) => style.ansi256(ansiStyles.rgbToAnsi256(red, green, blue));\n\t\treturn [ansi, ansi, ansi256, style.ansi16m];\n\t}\n\n\tif (model === 'hex') {\n\t\tconst ansi = hex => style.ansi(ansiStyles.hexToAnsi(hex));\n\t\tconst ansi256 = hex => style.ansi256(ansiStyles.hexToAnsi256(hex));\n\t\treturn [ansi, ansi, ansi256, hex => style.ansi16m(...ansiStyles.hexToRgb(hex))];\n\t}\n\n\t// `ansi256` is already the native form, so only the 16-color levels need converting.\n\tconst ansi = code => style.ansi(ansiStyles.ansi256ToAnsi(code));\n\treturn [ansi, ansi, style.ansi256, style.ansi256];\n};\n\nconst usedModels = ['rgb', 'hex', 'ansi256'];\n\nfor (const model of usedModels) {\n\tconst capitalizedModel = model[0].toUpperCase() + model.slice(1);\n\n\tfor (const [styleName, type] of [\n\t\t[model, 'color'],\n\t\t['bg' + capitalizedModel, 'bgColor'],\n\t\t['underline' + capitalizedModel, 'underlineColor'],\n\t]) {\n\t\tconst {close} = ansiStyles[type];\n\t\tconst converters = createModelConverters(model, type);\n\n\t\tstyles[styleName] = {\n\t\t\tget() {\n\t\t\t\t// The level is read on call rather than captured here so the function can be cached on the instance instead of being reallocated on every property access.\n\t\t\t\t// `rgb` is the widest model, so naming the three parameters avoids a rest array.\n\t\t\t\tconst styleFunction = function (first, second, third) {\n\t\t\t\t\tconst open = converters[this.level](first, second, third);\n\t\t\t\t\treturn createBuilder(this, createStyler(open, close, this[STYLER]), this[IS_EMPTY]);\n\t\t\t\t};\n\n\t\t\t\tObject.defineProperty(this, styleName, {value: styleFunction});\n\t\t\t\treturn styleFunction;\n\t\t\t},\n\t\t};\n\t}\n}\n\nconst proto = Object.defineProperties(\n\t() => {},\n\t{\n\t\t...styles,\n\t\tlevel: {\n\t\t\tenumerable: true,\n\t\t\tget() {\n\t\t\t\treturn this[GENERATOR].level;\n\t\t\t},\n\t\t\tset(level) {\n\t\t\t\tthis[GENERATOR].level = level;\n\t\t\t},\n\t\t},\n\t},\n);\n\nconst createStyler = (open, close, parent) => {\n\tlet openAll;\n\tlet closeAll;\n\tif (parent === undefined) {\n\t\topenAll = open;\n\t\tcloseAll = close;\n\t} else {\n\t\topenAll = parent.openAll + open;\n\t\tcloseAll = close + parent.closeAll;\n\t}\n\n\treturn {\n\t\topen,\n\t\tclose,\n\t\topenAll,\n\t\tcloseAll,\n\t\tparent,\n\t};\n};\n\nconst createBuilder = (self, _styler, _isEmpty) => {\n\t// Single argument is hot path, implicit coercion is faster than anything\n\tconst builder = (...arguments_) => {\n\t\tif (arguments_.length === 1) {\n\t\t\t// eslint-disable-next-line no-implicit-coercion\n\t\t\treturn applyStyle(builder, '' + arguments_[0]);\n\t\t}\n\n\t\tif (arguments_.length === 2) {\n\t\t\t// The template literal matches `Array#join` coercion (`null` and `undefined` become empty, objects use `toString`) while being faster.\n\t\t\treturn applyStyle(builder, `${arguments_[0] ?? ''} ${arguments_[1] ?? ''}`);\n\t\t}\n\n\t\treturn applyStyle(builder, arguments_.join(' '));\n\t};\n\n\t// We alter the prototype because we must return a function, but there is\n\t// no way to create a function with a different prototype\n\tObject.setPrototypeOf(builder, proto);\n\n\t// Point every builder at the root generator instead of its immediate parent, so reading the level costs one property load rather than walking a `level` getter per link of the chain.\n\tbuilder[GENERATOR] = self[GENERATOR] ?? self;\n\tbuilder[STYLER] = _styler;\n\tbuilder[IS_EMPTY] = _isEmpty;\n\n\treturn builder;\n};\n\nconst applyStyle = (self, string) => {\n\t// Read the level directly off the generator to skip the `level` getter dispatch on this hot path\n\tif (self[GENERATOR][LEVEL] <= 0 || !string) {\n\t\t// eslint-disable-next-line unicorn/no-computed-property-existence-check -- Reads the boolean value, not a property existence check.\n\t\treturn self[IS_EMPTY] ? '' : string;\n\t}\n\n\tlet styler = self[STYLER];\n\n\tif (styler === undefined) {\n\t\treturn string;\n\t}\n\n\tconst {openAll, closeAll} = styler;\n\tif (string.includes('\\u{1B}')) {\n\t\twhile (styler !== undefined) {\n\t\t\t// Replace any instances already present with a re-opening code\n\t\t\t// otherwise only the part of the string until said closing code\n\t\t\t// will be colored, and the rest will simply be 'plain'.\n\t\t\tstring = stringReplaceAll(string, styler.close, styler.open);\n\n\t\t\tstyler = styler.parent;\n\t\t}\n\t}\n\n\t// We can move both next actions out of loop, because remaining actions in loop won't have\n\t// any/visible effect on parts we add here. Close the styling before a linebreak and reopen\n\t// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92\n\tconst lfIndex = string.indexOf('\\n');\n\tif (lfIndex !== -1) {\n\t\tstring = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);\n\t}\n\n\treturn openAll + string + closeAll;\n};\n\n// `level` lives on the prototype rather than on each instance, so it costs nothing to construct an instance and matches how builders already expose it. It is inherited rather than own, so it does not show up in `Object.keys()`, same as for a builder.\n// eslint-disable-next-line unicorn/no-top-level-side-effects -- The style getters must be installed at module load.\nObject.defineProperties(createChalk.prototype, {...styles, level: levelDescriptor});\n\nconst chalk = createChalk();\nexport const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0});\n\nexport {\n\tmodifierNames,\n\tforegroundColorNames,\n\tbackgroundColorNames,\n\tunderlineColorNames,\n\tcolorNames,\n\n\t// TODO: Remove these aliases in the next major version\n\tmodifierNames as modifiers,\n\tforegroundColorNames as foregroundColors,\n\tbackgroundColorNames as backgroundColors,\n\tcolorNames as colors,\n} from './vendor/ansi-styles/index.js';\n\nexport {\n\tstdoutColor as supportsColor,\n\tstderrColor as supportsColorStderr,\n};\n\nexport default chalk;\n","/**\n * @since 1.0.0\n */\nimport * as Effect from \"effect/Effect\"\nimport * as Layer from \"effect/Layer\"\nimport * as PubSub from \"effect/PubSub\"\nimport * as Semaphore from \"effect/Semaphore\"\nimport * as Context from \"effect/Context\"\nimport * as Stream from \"effect/Stream\"\nimport type { AgentFinished, Output } from \"./AgentOutput.ts\"\nimport chalk from \"chalk\"\nimport type * as Prompt from \"effect/ai/Prompt\"\nimport * as Cause from \"effect/Cause\"\nimport { identity } from \"effect/Function\"\nimport * as Predicate from \"effect/Predicate\"\n\n/**\n * @since 1.0.0\n * @category Models\n */\nexport type OutputFormatter = <E, R>(\n stream: Stream.Stream<Output, AgentFinished | E, R>,\n) => Stream.Stream<string, Exclude<E, AgentFinished>, R>\n\n/**\n * @since 1.0.0\n * @category Pretty\n */\nexport const pretty = (options?: {\n readonly outputTruncation?: number | boolean | undefined\n}): OutputFormatter => {\n const maxLines =\n typeof options?.outputTruncation === \"number\"\n ? options.outputTruncation\n : 20\n const truncate =\n options?.outputTruncation === true ||\n typeof options?.outputTruncation === \"number\"\n ? (text: string): string => {\n const lines = text.split(\"\\n\")\n if (lines.length > maxLines) {\n return (\n lines.slice(0, maxLines).join(\"\\n\") +\n `\\n... (truncated, total ${lines.length} lines)`\n )\n }\n return text\n }\n : identity\n return (stream) =>\n stream.pipe(\n Stream.map((output) => {\n let prefix = \"\"\n if (output._tag === \"SubagentPart\") {\n prefix = chalk.magenta(`Subagent #${output.id}:`) + \" \"\n output = output.part\n }\n switch (output._tag) {\n case \"AgentStart\": {\n return `${chalkAgentHeading(`${subagentIcon} Agent #${output.id} starting (${output.modelAndProvider})`)}\\n\\n${promptToString(output.prompt)}\\n\\n`\n }\n case \"SubagentStart\": {\n const mode = output.background ? \" in the background\" : \"\"\n return `${chalkSubagentHeading(`${subagentIcon} Subagent #${output.id} starting${mode} (${output.modelAndProvider})`)}\n\n${chalk.dim(output.prompt)}\\n\\n`\n }\n case \"SubagentComplete\": {\n switch (output.status) {\n case \"completed\":\n return `${chalkSubagentHeading(`${subagentIcon} Subagent #${output.id} complete`)}\n\n${output.summary}\\n\\n`\n case \"failed\":\n return `${chalk.bold.red(`${subagentIcon} Subagent #${output.id} failed`)}\n\n${chalk.dim(output.summary)}\\n\\n`\n case \"cancelled\":\n return `${chalkSubagentHeading(`${subagentIcon} Subagent #${output.id} cancelled`)}\\n\\n`\n }\n }\n case \"ReasoningStart\": {\n return (\n prefix + chalkReasoningHeading(`${thinkingIcon} Thinking:`) + \" \"\n )\n }\n case \"ReasoningDelta\": {\n return output.delta\n }\n case \"ReasoningEnd\": {\n return \"\\n\\n\"\n }\n case \"ScriptStart\": {\n return `${prefix}${chalkScriptHeading(`${scriptIcon} Executing script`)}\\n\\n`\n }\n case \"ScriptDelta\": {\n return chalk.dim(output.delta)\n }\n case \"ScriptEnd\": {\n return \"\\n\\n\"\n }\n case \"ScriptOutput\": {\n return `${prefix}${chalkScriptHeading(`${scriptIcon} Script output`)}\\n\\n${chalk.dim(truncate(output.output))}\\n\\n`\n }\n case \"ErrorRetry\": {\n return `${prefix}${chalk.red(`Error: ${output.error.reason._tag}. Retrying...`)}\\n\\n${chalk.dim(Cause.pretty(Cause.fail(output.error)))}\\n\\n`\n }\n case \"Usage\": {\n return `${prefix}${chalkInfoHeading(`${infoIcon} Usage:`)} ${numberFormat.format(output.contextTokens)} context / ${numberFormat.format(output.inputTokens)} input / ${numberFormat.format(output.outputTokens)} output\\n\\n`\n }\n case \"ExecuteOutputCapped\": {\n return `${prefix}${chalkInfoHeading(`${infoIcon} Output capped:`)} ${numberFormat.format(output.charsBefore)} chars reduced to ${numberFormat.format(output.charsAfter)}\\n\\n`\n }\n case \"CompactionStarted\": {\n return `${prefix}${chalkInfoHeading(`${infoIcon} Compacting context (${output.reason})...`)}\\n\\n`\n }\n case \"CompactionEnded\": {\n return `${prefix}${chalkInfoHeading(`${infoIcon} Context compacted (${output.reason}):`)} ~${numberFormat.format(output.tokensBefore)} tokens to ~${numberFormat.format(output.tokensAfter)}\\n\\n`\n }\n case \"EnvironmentUpdated\": {\n return `${prefix}${chalkInfoHeading(`${infoIcon} Environment update:`)}\\n\\n${chalk.dim(truncate(output.update))}\\n\\n`\n }\n case \"HistoryAppended\":\n case \"HistoryReplaced\": {\n return \"\"\n }\n }\n }),\n Stream.catchIf(\n (e): e is AgentFinished => Predicate.isTagged(e, \"AgentFinished\"),\n (finished) =>\n Stream.succeed(\n `\\n${chalk.bold.green(`${doneIcon} Task complete:`)}\\n\\n${(finished as AgentFinished).summary}`,\n ),\n (e) => Stream.die(e),\n ),\n )\n}\n\nconst promptToString = (prompt: Prompt.Prompt): string => {\n let textParts: Array<string> = []\n for (const message of prompt.content) {\n if (message.role !== \"user\") continue\n let content = message.content\n for (const part of content) {\n if (part.type !== \"text\") continue\n textParts.push(part.text)\n }\n }\n return textParts.join(\"\\n\")\n}\n\nconst numberFormat = new Intl.NumberFormat()\n\nconst chalkAgentHeading = chalk.bold.green\nconst chalkScriptHeading = chalk.bold.blue\nconst chalkSubagentHeading = chalk.bold.magenta\nconst chalkReasoningHeading = chalk.bold.yellow\nconst chalkInfoHeading = chalk.bold.cyan\n\nconst scriptIcon = \"\\u{f0bc1}\"\nconst subagentIcon = \"\\u{ee0d} \"\nconst thinkingIcon = \"\\u{f07f6}\"\nconst doneIcon = \"\\u{eab2}\"\nconst infoIcon = \"\\u{f05a}\"\n\n/**\n * @since 1.0.0\n * @category Muxer\n */\nexport class Muxer extends Context.Service<\n Muxer,\n {\n add<E, R>(\n agent: Stream.Stream<Output, AgentFinished | E, R>,\n ): Effect.Effect<void, never, R>\n readonly output: Stream.Stream<string>\n }\n>()(\"clanka/OutputFormatter/Muxer\") {}\n\n/**\n * @since 1.0.0\n * @category Muxer\n */\nexport const layerMuxer = (formatter: OutputFormatter) =>\n Layer.effect(\n Muxer,\n Effect.gen(function* () {\n const scope = yield* Effect.scope\n const output = yield* PubSub.unbounded<string>()\n let agentCount = 0\n let currentAgentId: number | null = null\n const semaphore = Semaphore.makeUnsafe(1)\n\n return Muxer.of({\n add(stream) {\n const id = ++agentCount\n return stream.pipe(\n Stream.tap(\n Effect.fnUntraced(function* (part_) {\n if (currentAgentId === null || id !== currentAgentId) {\n yield* semaphore.take(1)\n }\n const part = part_._tag === \"SubagentPart\" ? part_.part : part_\n switch (part._tag) {\n case \"ReasoningStart\":\n case \"ScriptStart\": {\n currentAgentId = id\n break\n }\n case \"ScriptDelta\":\n case \"ReasoningDelta\": {\n break\n }\n default: {\n currentAgentId = null\n break\n }\n }\n if (id !== currentAgentId) {\n yield* semaphore.release(1)\n }\n }),\n ),\n formatter,\n Stream.runIntoPubSub(output),\n Effect.onExit(() => {\n if (currentAgentId !== id) return Effect.void\n currentAgentId = null\n return semaphore.release(1)\n }),\n Effect.forkIn(scope),\n Effect.asVoid,\n )\n },\n output: Stream.fromPubSub(output),\n })\n }),\n )\n"],"ignoreList":[0,1,2,3],"mappings":";;;;;;AACA,SAAgB,iBAAiB,QAAQ,WAAW,SAAS;CAC5D,IAAI,QAAQ,OAAO,QAAQ,SAAS;CACpC,IAAI,UAAU,CAAA,GACb,OAAO;CAGR,MAAM,kBAAkB,UAAU;CAClC,IAAI,WAAW;CACf,IAAI,cAAc;CAClB,GAAG;EACF,eAAe,OAAO,MAAM,UAAU,KAAK,IAAI,YAAY;EAC3D,WAAW,QAAQ;EACnB,QAAQ,OAAO,QAAQ,WAAW,QAAQ;CAC3C,SAAS,UAAU,CAAA;CAEnB,eAAe,OAAO,MAAM,QAAQ;CACpC,OAAO;AACR;AAEA,SAAgB,+BAA+B,QAAQ,QAAQ,SAAS,OAAO;CAC9E,IAAI,WAAW;CACf,IAAI,cAAc;CAClB,GAAG;EACF,MAAM,UAAU,OAAO,QAAQ,OAAO;EACtC,eAAe,OAAO,MAAM,UAAW,UAAU,QAAQ,IAAI,KAAM,IAAI,UAAU,UAAU,SAAS,QAAQ;EAC5G,WAAW,QAAQ;EACnB,QAAQ,OAAO,QAAQ,MAAM,QAAQ;CACtC,SAAS,UAAU,CAAA;CAEnB,eAAe,OAAO,MAAM,QAAQ;CACpC,OAAO;AACR;;;AChCA,MAAM,yBAAyB;AAC/B,MAAM,wBAAwB;AAE9B,MAAM,cAAc,SAAS,OAAM,SAAQ,UAAU,OAAO,OAAO;AAEnE,MAAM,eAAe,SAAS,OAAM,SAAQ,UAAU,KAAK,OAAO,KAAK,KAAK;AAE5E,MAAM,eAAe,SAAS,OAAO,KAAK,OAAO,SAAS,UAAU,KAAK,OAAO,KAAK,IAAI,GAAG,MAAM,GAAG,KAAK;AAG1G,MAAM,qBAAoB,SAAQ,eAAe,OAAO,KAAK,OAAO,KAAK,OAAO,KAAK,EA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;IAClB,IAAI,mBAAmB,IAAI,OAAOC;IAClC,iBAAiB;IACjB,OAAO,UAAU,QAAQ,CAAC;GAC5B,CAAC,GACDC,OAAcT,OAAK,GACnBU,MACF;EACF;EACA,QAAQC,WAAkB,MAAM;CAClC,CAAC;AACH,CAAC,CACH"}
|
|
1
|
+
{"version":3,"file":"OutputFormatter-DRycCEdr.mjs","names":["styles","Stream.map","Cause.pretty","Cause.fail","Stream.catchIf","Predicate.isTagged","Stream.succeed","Stream.die","Context.Service","Layer.effect","Effect.gen","scope","Effect.scope","PubSub.unbounded","Semaphore.makeUnsafe","Stream.tap","Effect.fnUntraced","Stream.runIntoPubSub","Effect.onExit","Effect.void","Effect.forkIn","Effect.asVoid","Stream.fromPubSub"],"sources":["../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/utilities.js","../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/vendor/ansi-styles/index.js","../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/vendor/supports-color/index.js","../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/index.js","../../src/OutputFormatter.ts"],"sourcesContent":["// Note: Each match is kept and `postfix` is inserted after it. `String#replaceAll(substring, substring + postfix)` does the same, but it has to scan the replacement for `$` patterns and it is several times slower on the no-match path that most calls take.\nexport function stringReplaceAll(string, substring, postfix) {\n\tlet index = string.indexOf(substring);\n\tif (index === -1) {\n\t\treturn string;\n\t}\n\n\tconst substringLength = substring.length;\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\treturnValue += string.slice(endIndex, index) + substring + postfix;\n\t\tendIndex = index + substringLength;\n\t\tindex = string.indexOf(substring, endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.slice(endIndex);\n\treturn returnValue;\n}\n\nexport function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\tconst isGotCR = string[index - 1] === '\\r';\n\t\treturnValue += string.slice(endIndex, (isGotCR ? index - 1 : index)) + prefix + (isGotCR ? '\\r\\n' : '\\n') + postfix;\n\t\tendIndex = index + 1;\n\t\tindex = string.indexOf('\\n', endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.slice(endIndex);\n\treturn returnValue;\n}\n","const ANSI_BACKGROUND_OFFSET = 10;\nconst ANSI_UNDERLINE_OFFSET = 20;\n\nconst wrapAnsi16 = (offset = 0) => code => `\\u{1B}[${code + offset}m`;\n\nconst wrapAnsi256 = (offset = 0) => code => `\\u{1B}[${38 + offset};5;${code}m`;\n\nconst wrapAnsi16m = (offset = 0) => (red, green, blue) => `\\u{1B}[${38 + offset};2;${red};${green};${blue}m`;\n\n// `SGR 58` has no basic 16-color form, so the basic color code is mapped to its palette index instead.\nconst wrapUnderlineAnsi = code => `\\u{1B}[58;5;${code < 90 ? code - 30 : code - 90 + 8}m`;\n\nconst styles = {\n\tmodifier: {\n\t\treset: [0, 0],\n\t\t// 21 isn't widely supported and 22 does the same thing\n\t\tbold: [1, 22],\n\t\tdim: [2, 22],\n\t\titalic: [3, 23],\n\t\tunderline: [4, 24],\n\t\t// Extended underline styles (`SGR 4:x` sub-parameters). Not in upstream `ansi-styles`.\n\t\tunderlineDouble: ['4:2', 24],\n\t\tunderlineCurly: ['4:3', 24],\n\t\tunderlineDotted: ['4:4', 24],\n\t\tunderlineDashed: ['4:5', 24],\n\t\toverline: [53, 55],\n\t\tinverse: [7, 27],\n\t\thidden: [8, 28],\n\t\tstrikethrough: [9, 29],\n\t},\n\tcolor: {\n\t\tblack: [30, 39],\n\t\tred: [31, 39],\n\t\tgreen: [32, 39],\n\t\tyellow: [33, 39],\n\t\tblue: [34, 39],\n\t\tmagenta: [35, 39],\n\t\tcyan: [36, 39],\n\t\twhite: [37, 39],\n\n\t\t// Bright color\n\t\tblackBright: [90, 39],\n\t\tgray: [90, 39], // Alias of `blackBright`\n\t\tgrey: [90, 39], // Alias of `blackBright`\n\t\tredBright: [91, 39],\n\t\tgreenBright: [92, 39],\n\t\tyellowBright: [93, 39],\n\t\tblueBright: [94, 39],\n\t\tmagentaBright: [95, 39],\n\t\tcyanBright: [96, 39],\n\t\twhiteBright: [97, 39],\n\t},\n\tbgColor: {\n\t\tbgBlack: [40, 49],\n\t\tbgRed: [41, 49],\n\t\tbgGreen: [42, 49],\n\t\tbgYellow: [43, 49],\n\t\tbgBlue: [44, 49],\n\t\tbgMagenta: [45, 49],\n\t\tbgCyan: [46, 49],\n\t\tbgWhite: [47, 49],\n\n\t\t// Bright color\n\t\tbgBlackBright: [100, 49],\n\t\tbgGray: [100, 49], // Alias of `bgBlackBright`\n\t\tbgGrey: [100, 49], // Alias of `bgBlackBright`\n\t\tbgRedBright: [101, 49],\n\t\tbgGreenBright: [102, 49],\n\t\tbgYellowBright: [103, 49],\n\t\tbgBlueBright: [104, 49],\n\t\tbgMagentaBright: [105, 49],\n\t\tbgCyanBright: [106, 49],\n\t\tbgWhiteBright: [107, 49],\n\t},\n\t// Underline color (`SGR 58`/`59`). Not in upstream `ansi-styles`.\n\tunderlineColor: {\n\t\tunderlineBlack: ['58;5;0', 59],\n\t\tunderlineRed: ['58;5;1', 59],\n\t\tunderlineGreen: ['58;5;2', 59],\n\t\tunderlineYellow: ['58;5;3', 59],\n\t\tunderlineBlue: ['58;5;4', 59],\n\t\tunderlineMagenta: ['58;5;5', 59],\n\t\tunderlineCyan: ['58;5;6', 59],\n\t\tunderlineWhite: ['58;5;7', 59],\n\n\t\t// Bright color\n\t\tunderlineBlackBright: ['58;5;8', 59],\n\t\tunderlineGray: ['58;5;8', 59], // Alias of `underlineBlackBright`\n\t\tunderlineGrey: ['58;5;8', 59], // Alias of `underlineBlackBright`\n\t\tunderlineRedBright: ['58;5;9', 59],\n\t\tunderlineGreenBright: ['58;5;10', 59],\n\t\tunderlineYellowBright: ['58;5;11', 59],\n\t\tunderlineBlueBright: ['58;5;12', 59],\n\t\tunderlineMagentaBright: ['58;5;13', 59],\n\t\tunderlineCyanBright: ['58;5;14', 59],\n\t\tunderlineWhiteBright: ['58;5;15', 59],\n\t},\n};\n\nexport const modifierNames = Object.keys(styles.modifier);\nexport const foregroundColorNames = Object.keys(styles.color);\nexport const backgroundColorNames = Object.keys(styles.bgColor);\nexport const underlineColorNames = Object.keys(styles.underlineColor);\nexport const colorNames = [...foregroundColorNames, ...backgroundColorNames];\n\nfunction assembleStyles() {\n\tconst codes = new Map();\n\n\tfor (const [groupName, group] of Object.entries(styles)) {\n\t\tfor (const [styleName, style] of Object.entries(group)) {\n\t\t\tstyles[styleName] = {\n\t\t\t\topen: `\\u{1B}[${style[0]}m`,\n\t\t\t\tclose: `\\u{1B}[${style[1]}m`,\n\t\t\t};\n\n\t\t\tgroup[styleName] = styles[styleName];\n\n\t\t\t// Only the leading SGR parameter identifies a style, so `4:3` and `58;5;1` are keyed as `4` and `58`.\n\t\t\tcodes.set(Number.parseInt(style[0], 10), style[1]);\n\t\t}\n\n\t\tObject.defineProperty(styles, groupName, {\n\t\t\tvalue: group,\n\t\t\tenumerable: false,\n\t\t});\n\t}\n\n\tObject.defineProperty(styles, 'codes', {\n\t\tvalue: codes,\n\t\tenumerable: false,\n\t});\n\n\tstyles.color.close = '\\u{1B}[39m';\n\tstyles.bgColor.close = '\\u{1B}[49m';\n\tstyles.underlineColor.close = '\\u{1B}[59m';\n\n\tstyles.color.ansi = wrapAnsi16();\n\tstyles.color.ansi256 = wrapAnsi256();\n\tstyles.color.ansi16m = wrapAnsi16m();\n\tstyles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);\n\tstyles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);\n\tstyles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);\n\tstyles.underlineColor.ansi = wrapUnderlineAnsi;\n\tstyles.underlineColor.ansi256 = wrapAnsi256(ANSI_UNDERLINE_OFFSET);\n\tstyles.underlineColor.ansi16m = wrapAnsi16m(ANSI_UNDERLINE_OFFSET);\n\n\t// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js\n\tObject.defineProperties(styles, {\n\t\trgbToAnsi256: {\n\t\t\tvalue(red, green, blue) {\n\t\t\t\t// We use the extended greyscale palette here, with the exception of\n\t\t\t\t// black and white. normal palette only has 4 greyscale shades.\n\t\t\t\tif (red === green && green === blue) {\n\t\t\t\t\tif (red < 8) {\n\t\t\t\t\t\treturn 16;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (red > 248) {\n\t\t\t\t\t\treturn 231;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn Math.round(((red - 8) / 247) * 24) + 232;\n\t\t\t\t}\n\n\t\t\t\treturn 16\n\t\t\t\t\t+ (36 * Math.round(red / 255 * 5))\n\t\t\t\t\t+ (6 * Math.round(green / 255 * 5))\n\t\t\t\t\t+ Math.round(blue / 255 * 5);\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToRgb: {\n\t\t\tvalue(hex) {\n\t\t\t\tconst matches = /[\\da-f]{6}|[\\da-f]{3}/i.exec(hex.toString(16));\n\t\t\t\tif (!matches) {\n\t\t\t\t\treturn [0, 0, 0];\n\t\t\t\t}\n\n\t\t\t\tlet [colorString] = matches;\n\n\t\t\t\tif (colorString.length === 3) {\n\t\t\t\t\tcolorString = [...colorString].map(character => character + character).join('');\n\t\t\t\t}\n\n\t\t\t\tconst integer = Number.parseInt(colorString, 16);\n\n\t\t\t\treturn [\n\t\t\t\t\t/* eslint-disable no-bitwise -- We need the speed */\n\t\t\t\t\t(integer >> 16) & 0xFF,\n\t\t\t\t\t(integer >> 8) & 0xFF,\n\t\t\t\t\tinteger & 0xFF,\n\t\t\t\t\t/* eslint-enable no-bitwise */\n\t\t\t\t];\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToAnsi256: {\n\t\t\tvalue: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),\n\t\t\tenumerable: false,\n\t\t},\n\t\tansi256ToAnsi: {\n\t\t\tvalue(code) {\n\t\t\t\tif (code < 8) {\n\t\t\t\t\treturn 30 + code;\n\t\t\t\t}\n\n\t\t\t\tif (code < 16) {\n\t\t\t\t\treturn 90 + (code - 8);\n\t\t\t\t}\n\n\t\t\t\tlet red;\n\t\t\t\tlet green;\n\t\t\t\tlet blue;\n\n\t\t\t\tif (code >= 232) {\n\t\t\t\t\tred = (((code - 232) * 10) + 8) / 255;\n\t\t\t\t\tgreen = red;\n\t\t\t\t\tblue = red;\n\t\t\t\t} else {\n\t\t\t\t\tcode -= 16;\n\n\t\t\t\t\tconst remainder = code % 36;\n\n\t\t\t\t\tred = Math.floor(code / 36) / 5;\n\t\t\t\t\tgreen = Math.floor(remainder / 6) / 5;\n\t\t\t\t\tblue = (remainder % 6) / 5;\n\t\t\t\t}\n\n\t\t\t\tconst value = Math.max(red, green, blue) * 2;\n\n\t\t\t\tif (value === 0) {\n\t\t\t\t\treturn 30;\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tlet result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));\n\n\t\t\t\tif (value === 2) {\n\t\t\t\t\tresult += 60;\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\trgbToAnsi: {\n\t\t\tvalue: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToAnsi: {\n\t\t\tvalue: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),\n\t\t\tenumerable: false,\n\t\t},\n\t});\n\n\treturn styles;\n}\n\nconst ansiStyles = assembleStyles();\n\nexport default ansiStyles;\n","import process from 'node:process';\nimport os from 'node:os';\nimport tty from 'node:tty';\n\n// From: https://github.com/sindresorhus/has-flag/blob/main/index.js\n/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {\nfunction hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {\n\tconst prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');\n\tconst position = argv.indexOf(prefix + flag);\n\tconst terminatorPosition = argv.indexOf('--');\n\treturn position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);\n}\n\nconst {env} = process;\n\nlet flagForceColor;\nif (\n\thasFlag('no-color')\n\t|| hasFlag('no-colors')\n\t|| hasFlag('color=false')\n\t|| hasFlag('color=never')\n) {\n\tflagForceColor = 0;\n} else if (\n\thasFlag('color')\n\t|| hasFlag('colors')\n\t|| hasFlag('color=true')\n\t|| hasFlag('color=always')\n) {\n\tflagForceColor = 1;\n}\n\n// Whether `FORCE_COLOR` names a level. Shared with the exact-level check below so that the two cannot disagree on what counts as numeric.\nfunction hasNumericForceColor() {\n\treturn /^\\d+$/.test(env.FORCE_COLOR);\n}\n\nfunction envForceColor() {\n\tif (!('FORCE_COLOR' in env)) {\n\t\treturn;\n\t}\n\n\tif (env.FORCE_COLOR === 'false') {\n\t\treturn 0;\n\t}\n\n\tif (env.FORCE_COLOR === 'true' || env.FORCE_COLOR.length === 0) {\n\t\treturn 1;\n\t}\n\n\tif (!hasNumericForceColor()) {\n\t\treturn;\n\t}\n\n\treturn Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);\n}\n\nfunction translateLevel(level) {\n\tif (level === 0) {\n\t\treturn false;\n\t}\n\n\treturn {\n\t\tlevel,\n\t\thasBasic: true,\n\t\thas256: level >= 2,\n\t\thas16m: level >= 3,\n\t};\n}\n\nfunction _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {\n\tconst noFlagForceColor = envForceColor();\n\tif (noFlagForceColor !== undefined) {\n\t\tflagForceColor = noFlagForceColor;\n\t}\n\n\tconst forceColor = sniffFlags ? flagForceColor : noFlagForceColor;\n\n\tif (forceColor === 0) {\n\t\treturn 0;\n\t}\n\n\tif (sniffFlags) {\n\t\tif (hasFlag('color=16m')\n\t\t\t|| hasFlag('color=full')\n\t\t\t|| hasFlag('color=truecolor')) {\n\t\t\treturn 3;\n\t\t}\n\n\t\tif (hasFlag('color=256')) {\n\t\t\treturn 2;\n\t\t}\n\t}\n\n\t// A numeric `FORCE_COLOR` requests an exact level, while `FORCE_COLOR=true` and `FORCE_COLOR=` only enable color and let the level be detected.\n\tif (forceColor !== undefined && hasNumericForceColor()) {\n\t\treturn forceColor;\n\t}\n\n\t// Check for Azure DevOps pipelines.\n\t// Has to be above the `!streamIsTTY` check.\n\tif ('TF_BUILD' in env && 'AGENT_NAME' in env) {\n\t\treturn 1;\n\t}\n\n\tif (haveStream && !streamIsTTY && forceColor === undefined) {\n\t\treturn 0;\n\t}\n\n\tconst min = forceColor || 0;\n\n\tif (env.TERM === 'dumb') {\n\t\treturn min;\n\t}\n\n\tif (process.platform === 'win32') {\n\t\t// Windows 10 build 10586 is the first Windows release that supports 256 colors.\n\t\t// Windows 10 build 14931 is the first release that supports 16m/TrueColor.\n\t\tconst osRelease = os.release().split('.');\n\t\tif (\n\t\t\tNumber(osRelease[0]) >= 10\n\t\t\t&& Number(osRelease[2]) >= 10_586\n\t\t) {\n\t\t\treturn Number(osRelease[2]) >= 14_931 ? 3 : 2;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\tif ('CI' in env) {\n\t\tif (['GITHUB_ACTIONS', 'GITEA_ACTIONS', 'CIRCLECI'].some(key => key in env)) {\n\t\t\treturn 3;\n\t\t}\n\n\t\tif (['TRAVIS', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn min;\n\t}\n\n\tif ('TEAMCITY_VERSION' in env) {\n\t\treturn /^(?:9\\.0*[1-9]\\d*\\.|\\d{2,}\\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;\n\t}\n\n\tif (env.COLORTERM === 'truecolor') {\n\t\treturn 3;\n\t}\n\n\tif (env.TERM === 'xterm-kitty') {\n\t\treturn 3;\n\t}\n\n\tif (env.TERM === 'xterm-ghostty') {\n\t\treturn 3;\n\t}\n\n\tif (env.TERM === 'wezterm') {\n\t\treturn 3;\n\t}\n\n\tif ('TERM_PROGRAM' in env) {\n\t\tconst version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.', 1)[0], 10);\n\n\t\tswitch (env.TERM_PROGRAM) {\n\t\t\tcase 'iTerm.app': {\n\t\t\t\treturn version >= 3 ? 3 : 2;\n\t\t\t}\n\n\t\t\tcase 'Apple_Terminal': {\n\t\t\t\treturn 2;\n\t\t\t}\n\t\t\t// No default\n\t\t}\n\t}\n\n\tif (/-256(?:color)?$/i.test(env.TERM)) {\n\t\treturn 2;\n\t}\n\n\tif (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {\n\t\treturn 1;\n\t}\n\n\tif ('COLORTERM' in env) {\n\t\treturn 1;\n\t}\n\n\treturn min;\n}\n\nexport function createSupportsColor(stream, options = {}) {\n\tconst level = _supportsColor(stream, {\n\t\tstreamIsTTY: stream && stream.isTTY,\n\t\t...options,\n\t});\n\n\treturn translateLevel(level);\n}\n\nconst supportsColor = {\n\tstdout: createSupportsColor({isTTY: tty.isatty(1)}),\n\tstderr: createSupportsColor({isTTY: tty.isatty(2)}),\n};\n\nexport default supportsColor;\n","import {\n\tstringReplaceAll,\n\tstringEncaseCRLFWithFirstIndex,\n} from './utilities.js';\nimport ansiStyles from '#ansi-styles';\nimport supportsColor from '#supports-color';\n\nconst {stdout: stdoutColor, stderr: stderrColor} = supportsColor;\n\nconst GENERATOR = Symbol('GENERATOR');\nconst STYLER = Symbol('STYLER');\nconst IS_EMPTY = Symbol('IS_EMPTY');\nconst LEVEL = Symbol('LEVEL');\n\nconst styles = Object.create(null);\n\nconst assertValidLevel = level => {\n\tif (!Number.isSafeInteger(level) || level < 0 || level > 3) {\n\t\tthrow new Error('The `level` should be an integer from 0 to 3');\n\t}\n};\n\n// The level is stored under a symbol so the hot path can read it as a plain property, while `level` itself is an accessor that rejects values the rest of the code could not handle.\nconst levelDescriptor = {\n\tenumerable: true,\n\tget() {\n\t\treturn this[LEVEL];\n\t},\n\tset(level) {\n\t\tassertValidLevel(level);\n\t\tthis[LEVEL] = level;\n\t},\n};\n\nconst applyOptions = (object, options = {}) => {\n\tif (options.level !== undefined) {\n\t\tassertValidLevel(options.level);\n\t}\n\n\t// Detect level if not set manually. Written under the symbol rather than through `level`, as the prototype carrying that accessor is not installed until after this runs.\n\tconst colorLevel = stdoutColor ? stdoutColor.level : 0;\n\tobject[LEVEL] = options.level === undefined ? colorLevel : options.level;\n};\n\nexport class Chalk {\n\tconstructor(options) {\n\t\t// eslint-disable-next-line no-constructor-return\n\t\treturn chalkFactory(options);\n\t}\n}\n\nconst chalkFactory = options => {\n\tconst chalk = (...strings) => strings.join(' ');\n\tapplyOptions(chalk, options);\n\n\tObject.setPrototypeOf(chalk, createChalk.prototype);\n\n\treturn chalk;\n};\n\nfunction createChalk(options) {\n\treturn chalkFactory(options);\n}\n\n// eslint-disable-next-line unicorn/no-top-level-side-effects -- The prototype chain must be set up at module load.\nObject.setPrototypeOf(createChalk.prototype, Function.prototype);\n\nfor (const [styleName, style] of Object.entries(ansiStyles)) {\n\tstyles[styleName] = {\n\t\tget() {\n\t\t\tconst builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);\n\t\t\tObject.defineProperty(this, styleName, {value: builder});\n\t\t\treturn builder;\n\t\t},\n\t};\n}\n\nstyles.visible = {\n\tget() {\n\t\tconst builder = createBuilder(this, this[STYLER], true);\n\t\tObject.defineProperty(this, 'visible', {value: builder});\n\t\treturn builder;\n\t},\n};\n\n// Resolve a color model to one converter per `level`, so that a call only has to look up the converter for the current level instead of re-deciding the model and level every time.\nconst createModelConverters = (model, type) => {\n\tconst style = ansiStyles[type];\n\n\tif (model === 'rgb') {\n\t\tconst ansi = (red, green, blue) => style.ansi(ansiStyles.rgbToAnsi(red, green, blue));\n\t\tconst ansi256 = (red, green, blue) => style.ansi256(ansiStyles.rgbToAnsi256(red, green, blue));\n\t\treturn [ansi, ansi, ansi256, style.ansi16m];\n\t}\n\n\tif (model === 'hex') {\n\t\tconst ansi = hex => style.ansi(ansiStyles.hexToAnsi(hex));\n\t\tconst ansi256 = hex => style.ansi256(ansiStyles.hexToAnsi256(hex));\n\t\treturn [ansi, ansi, ansi256, hex => style.ansi16m(...ansiStyles.hexToRgb(hex))];\n\t}\n\n\t// `ansi256` is already the native form, so only the 16-color levels need converting.\n\tconst ansi = code => style.ansi(ansiStyles.ansi256ToAnsi(code));\n\treturn [ansi, ansi, style.ansi256, style.ansi256];\n};\n\nconst usedModels = ['rgb', 'hex', 'ansi256'];\n\nfor (const model of usedModels) {\n\tconst capitalizedModel = model[0].toUpperCase() + model.slice(1);\n\n\tfor (const [styleName, type] of [\n\t\t[model, 'color'],\n\t\t['bg' + capitalizedModel, 'bgColor'],\n\t\t['underline' + capitalizedModel, 'underlineColor'],\n\t]) {\n\t\tconst {close} = ansiStyles[type];\n\t\tconst converters = createModelConverters(model, type);\n\n\t\tstyles[styleName] = {\n\t\t\tget() {\n\t\t\t\t// The level is read on call rather than captured here so the function can be cached on the instance instead of being reallocated on every property access.\n\t\t\t\t// `rgb` is the widest model, so naming the three parameters avoids a rest array.\n\t\t\t\tconst styleFunction = function (first, second, third) {\n\t\t\t\t\tconst open = converters[this.level](first, second, third);\n\t\t\t\t\treturn createBuilder(this, createStyler(open, close, this[STYLER]), this[IS_EMPTY]);\n\t\t\t\t};\n\n\t\t\t\tObject.defineProperty(this, styleName, {value: styleFunction});\n\t\t\t\treturn styleFunction;\n\t\t\t},\n\t\t};\n\t}\n}\n\nconst proto = Object.defineProperties(\n\t() => {},\n\t{\n\t\t...styles,\n\t\tlevel: {\n\t\t\tenumerable: true,\n\t\t\tget() {\n\t\t\t\treturn this[GENERATOR].level;\n\t\t\t},\n\t\t\tset(level) {\n\t\t\t\tthis[GENERATOR].level = level;\n\t\t\t},\n\t\t},\n\t},\n);\n\nconst createStyler = (open, close, parent) => {\n\tlet openAll;\n\tlet closeAll;\n\tif (parent === undefined) {\n\t\topenAll = open;\n\t\tcloseAll = close;\n\t} else {\n\t\topenAll = parent.openAll + open;\n\t\tcloseAll = close + parent.closeAll;\n\t}\n\n\treturn {\n\t\topen,\n\t\tclose,\n\t\topenAll,\n\t\tcloseAll,\n\t\tparent,\n\t};\n};\n\nconst createBuilder = (self, _styler, _isEmpty) => {\n\t// Single argument is hot path, implicit coercion is faster than anything\n\tconst builder = (...arguments_) => {\n\t\tif (arguments_.length === 1) {\n\t\t\t// eslint-disable-next-line no-implicit-coercion\n\t\t\treturn applyStyle(builder, '' + arguments_[0]);\n\t\t}\n\n\t\tif (arguments_.length === 2) {\n\t\t\t// The template literal matches `Array#join` coercion (`null` and `undefined` become empty, objects use `toString`) while being faster.\n\t\t\treturn applyStyle(builder, `${arguments_[0] ?? ''} ${arguments_[1] ?? ''}`);\n\t\t}\n\n\t\treturn applyStyle(builder, arguments_.join(' '));\n\t};\n\n\t// We alter the prototype because we must return a function, but there is\n\t// no way to create a function with a different prototype\n\tObject.setPrototypeOf(builder, proto);\n\n\t// Point every builder at the root generator instead of its immediate parent, so reading the level costs one property load rather than walking a `level` getter per link of the chain.\n\tbuilder[GENERATOR] = self[GENERATOR] ?? self;\n\tbuilder[STYLER] = _styler;\n\tbuilder[IS_EMPTY] = _isEmpty;\n\n\treturn builder;\n};\n\nconst applyStyle = (self, string) => {\n\t// Read the level directly off the generator to skip the `level` getter dispatch on this hot path\n\tif (self[GENERATOR][LEVEL] <= 0 || !string) {\n\t\t// eslint-disable-next-line unicorn/no-computed-property-existence-check -- Reads the boolean value, not a property existence check.\n\t\treturn self[IS_EMPTY] ? '' : string;\n\t}\n\n\tlet styler = self[STYLER];\n\n\tif (styler === undefined) {\n\t\treturn string;\n\t}\n\n\tconst {openAll, closeAll} = styler;\n\tif (string.includes('\\u{1B}')) {\n\t\twhile (styler !== undefined) {\n\t\t\t// Replace any instances already present with a re-opening code\n\t\t\t// otherwise only the part of the string until said closing code\n\t\t\t// will be colored, and the rest will simply be 'plain'.\n\t\t\tstring = stringReplaceAll(string, styler.close, styler.open);\n\n\t\t\tstyler = styler.parent;\n\t\t}\n\t}\n\n\t// We can move both next actions out of loop, because remaining actions in loop won't have\n\t// any/visible effect on parts we add here. Close the styling before a linebreak and reopen\n\t// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92\n\tconst lfIndex = string.indexOf('\\n');\n\tif (lfIndex !== -1) {\n\t\tstring = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);\n\t}\n\n\treturn openAll + string + closeAll;\n};\n\n// `level` lives on the prototype rather than on each instance, so it costs nothing to construct an instance and matches how builders already expose it. It is inherited rather than own, so it does not show up in `Object.keys()`, same as for a builder.\n// eslint-disable-next-line unicorn/no-top-level-side-effects -- The style getters must be installed at module load.\nObject.defineProperties(createChalk.prototype, {...styles, level: levelDescriptor});\n\nconst chalk = createChalk();\nexport const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0});\n\nexport {\n\tmodifierNames,\n\tforegroundColorNames,\n\tbackgroundColorNames,\n\tunderlineColorNames,\n\tcolorNames,\n\n\t// TODO: Remove these aliases in the next major version\n\tmodifierNames as modifiers,\n\tforegroundColorNames as foregroundColors,\n\tbackgroundColorNames as backgroundColors,\n\tcolorNames as colors,\n} from './vendor/ansi-styles/index.js';\n\nexport {\n\tstdoutColor as supportsColor,\n\tstderrColor as supportsColorStderr,\n};\n\nexport default chalk;\n","/**\n * @since 1.0.0\n */\nimport * as Effect from \"effect/Effect\"\nimport * as Layer from \"effect/Layer\"\nimport * as PubSub from \"effect/PubSub\"\nimport * as Semaphore from \"effect/Semaphore\"\nimport * as Context from \"effect/Context\"\nimport * as Stream from \"effect/Stream\"\nimport type { AgentFinished, Output } from \"./AgentOutput.ts\"\nimport chalk from \"chalk\"\nimport type * as Prompt from \"effect/ai/Prompt\"\nimport * as Cause from \"effect/Cause\"\nimport { identity } from \"effect/Function\"\nimport * as Predicate from \"effect/Predicate\"\n\n/**\n * @since 1.0.0\n * @category Models\n */\nexport type OutputFormatter = <E, R>(\n stream: Stream.Stream<Output, AgentFinished | E, R>,\n) => Stream.Stream<string, Exclude<E, AgentFinished>, R>\n\n/**\n * @since 1.0.0\n * @category Pretty\n */\nexport const pretty = (options?: {\n readonly outputTruncation?: number | boolean | undefined\n}): OutputFormatter => {\n const maxLines =\n typeof options?.outputTruncation === \"number\"\n ? options.outputTruncation\n : 20\n const truncate =\n options?.outputTruncation === true ||\n typeof options?.outputTruncation === \"number\"\n ? (text: string): string => {\n const lines = text.split(\"\\n\")\n if (lines.length > maxLines) {\n return (\n lines.slice(0, maxLines).join(\"\\n\") +\n `\\n... (truncated, total ${lines.length} lines)`\n )\n }\n return text\n }\n : identity\n return (stream) =>\n stream.pipe(\n Stream.map((output) => {\n let prefix = \"\"\n if (output._tag === \"SubagentPart\") {\n prefix = chalk.magenta(`Subagent #${output.id}:`) + \" \"\n output = output.part\n }\n switch (output._tag) {\n case \"AgentStart\": {\n return `${chalkAgentHeading(`${subagentIcon} Agent #${output.id} starting (${output.modelAndProvider})`)}\\n\\n${promptToString(output.prompt)}\\n\\n`\n }\n case \"SubagentStart\": {\n const mode = output.background ? \" in the background\" : \"\"\n return `${chalkSubagentHeading(`${subagentIcon} Subagent #${output.id} starting${mode} (${output.modelAndProvider})`)}\n\n${chalk.dim(output.prompt)}\\n\\n`\n }\n case \"SubagentComplete\": {\n switch (output.status) {\n case \"completed\":\n return `${chalkSubagentHeading(`${subagentIcon} Subagent #${output.id} complete`)}\n\n${output.summary}\\n\\n`\n case \"failed\":\n return `${chalk.bold.red(`${subagentIcon} Subagent #${output.id} failed`)}\n\n${chalk.dim(output.summary)}\\n\\n`\n case \"cancelled\":\n return `${chalkSubagentHeading(`${subagentIcon} Subagent #${output.id} cancelled`)}\\n\\n`\n }\n }\n case \"ReasoningStart\": {\n return (\n prefix + chalkReasoningHeading(`${thinkingIcon} Thinking:`) + \" \"\n )\n }\n case \"ReasoningDelta\": {\n return output.delta\n }\n case \"ReasoningEnd\": {\n return \"\\n\\n\"\n }\n case \"ScriptStart\": {\n return `${prefix}${chalkScriptHeading(`${scriptIcon} Executing script`)}\\n\\n`\n }\n case \"ScriptDelta\": {\n return chalk.dim(output.delta)\n }\n case \"ScriptEnd\": {\n return \"\\n\\n\"\n }\n case \"ScriptOutput\": {\n return `${prefix}${chalkScriptHeading(`${scriptIcon} Script output`)}\\n\\n${chalk.dim(truncate(output.output))}\\n\\n`\n }\n case \"ErrorRetry\": {\n return `${prefix}${chalk.red(`Error: ${output.error.reason._tag}. Retrying...`)}\\n\\n${chalk.dim(Cause.pretty(Cause.fail(output.error)))}\\n\\n`\n }\n case \"Usage\": {\n return `${prefix}${chalkInfoHeading(`${infoIcon} Usage:`)} ${numberFormat.format(output.contextTokens)} context / ${numberFormat.format(output.inputTokens)} input / ${numberFormat.format(output.outputTokens)} output\\n\\n`\n }\n case \"ExecuteOutputCapped\": {\n return `${prefix}${chalkInfoHeading(`${infoIcon} Output capped:`)} ${numberFormat.format(output.charsBefore)} chars reduced to ${numberFormat.format(output.charsAfter)}\\n\\n`\n }\n case \"CompactionStarted\": {\n return `${prefix}${chalkInfoHeading(`${infoIcon} Compacting context (${output.reason})...`)}\\n\\n`\n }\n case \"CompactionEnded\": {\n return `${prefix}${chalkInfoHeading(`${infoIcon} Context compacted (${output.reason}):`)} ~${numberFormat.format(output.tokensBefore)} tokens to ~${numberFormat.format(output.tokensAfter)}\\n\\n`\n }\n case \"EnvironmentUpdated\": {\n return `${prefix}${chalkInfoHeading(`${infoIcon} Environment update:`)}\\n\\n${chalk.dim(truncate(output.update))}\\n\\n`\n }\n case \"HistoryAppended\":\n case \"HistoryReplaced\": {\n return \"\"\n }\n }\n }),\n Stream.catchIf(\n (e): e is AgentFinished => Predicate.isTagged(e, \"AgentFinished\"),\n (finished) =>\n Stream.succeed(\n `\\n${chalk.bold.green(`${doneIcon} Task complete:`)}\\n\\n${(finished as AgentFinished).summary}`,\n ),\n (e) => Stream.die(e),\n ),\n )\n}\n\nconst promptToString = (prompt: Prompt.Prompt): string => {\n let textParts: Array<string> = []\n for (const message of prompt.content) {\n if (message.role !== \"user\") continue\n let content = message.content\n for (const part of content) {\n if (part.type !== \"text\") continue\n textParts.push(part.text)\n }\n }\n return textParts.join(\"\\n\")\n}\n\nconst numberFormat = new Intl.NumberFormat()\n\nconst chalkAgentHeading = chalk.bold.green\nconst chalkScriptHeading = chalk.bold.blue\nconst chalkSubagentHeading = chalk.bold.magenta\nconst chalkReasoningHeading = chalk.bold.yellow\nconst chalkInfoHeading = chalk.bold.cyan\n\nconst scriptIcon = \"\\u{f0bc1}\"\nconst subagentIcon = \"\\u{ee0d} \"\nconst thinkingIcon = \"\\u{f07f6}\"\nconst doneIcon = \"\\u{eab2}\"\nconst infoIcon = \"\\u{f05a}\"\n\n/**\n * @since 1.0.0\n * @category Muxer\n */\nexport class Muxer extends Context.Service<\n Muxer,\n {\n add<E, R>(\n agent: Stream.Stream<Output, AgentFinished | E, R>,\n ): Effect.Effect<void, never, R>\n readonly output: Stream.Stream<string>\n }\n>()(\"clanka/OutputFormatter/Muxer\") {}\n\n/**\n * @since 1.0.0\n * @category Muxer\n */\nexport const layerMuxer = (formatter: OutputFormatter) =>\n Layer.effect(\n Muxer,\n Effect.gen(function* () {\n const scope = yield* Effect.scope\n const output = yield* PubSub.unbounded<string>()\n let agentCount = 0\n let currentAgentId: number | null = null\n const semaphore = Semaphore.makeUnsafe(1)\n\n return Muxer.of({\n add(stream) {\n const id = ++agentCount\n return stream.pipe(\n Stream.tap(\n Effect.fnUntraced(function* (part_) {\n if (currentAgentId === null || id !== currentAgentId) {\n yield* semaphore.take(1)\n }\n const part = part_._tag === \"SubagentPart\" ? part_.part : part_\n switch (part._tag) {\n case \"ReasoningStart\":\n case \"ScriptStart\": {\n currentAgentId = id\n break\n }\n case \"ScriptDelta\":\n case \"ReasoningDelta\": {\n break\n }\n default: {\n currentAgentId = null\n break\n }\n }\n if (id !== currentAgentId) {\n yield* semaphore.release(1)\n }\n }),\n ),\n formatter,\n Stream.runIntoPubSub(output),\n Effect.onExit(() => {\n if (currentAgentId !== id) return Effect.void\n currentAgentId = null\n return semaphore.release(1)\n }),\n Effect.forkIn(scope),\n Effect.asVoid,\n )\n },\n output: Stream.fromPubSub(output),\n })\n }),\n )\n"],"ignoreList":[0,1,2,3],"mappings":";;;;;;AACA,SAAgB,iBAAiB,QAAQ,WAAW,SAAS;CAC5D,IAAI,QAAQ,OAAO,QAAQ,SAAS;CACpC,IAAI,UAAU,CAAA,GACb,OAAO;CAGR,MAAM,kBAAkB,UAAU;CAClC,IAAI,WAAW;CACf,IAAI,cAAc;CAClB,GAAG;EACF,eAAe,OAAO,MAAM,UAAU,KAAK,IAAI,YAAY;EAC3D,WAAW,QAAQ;EACnB,QAAQ,OAAO,QAAQ,WAAW,QAAQ;CAC3C,SAAS,UAAU,CAAA;CAEnB,eAAe,OAAO,MAAM,QAAQ;CACpC,OAAO;AACR;AAEA,SAAgB,+BAA+B,QAAQ,QAAQ,SAAS,OAAO;CAC9E,IAAI,WAAW;CACf,IAAI,cAAc;CAClB,GAAG;EACF,MAAM,UAAU,OAAO,QAAQ,OAAO;EACtC,eAAe,OAAO,MAAM,UAAW,UAAU,QAAQ,IAAI,KAAM,IAAI,UAAU,UAAU,SAAS,QAAQ;EAC5G,WAAW,QAAQ;EACnB,QAAQ,OAAO,QAAQ,MAAM,QAAQ;CACtC,SAAS,UAAU,CAAA;CAEnB,eAAe,OAAO,MAAM,QAAQ;CACpC,OAAO;AACR;;;AChCA,MAAM,yBAAyB;AAC/B,MAAM,wBAAwB;AAE9B,MAAM,cAAc,SAAS,OAAM,SAAQ,UAAU,OAAO,OAAO;AAEnE,MAAM,eAAe,SAAS,OAAM,SAAQ,UAAU,KAAK,OAAO,KAAK,KAAK;AAE5E,MAAM,eAAe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AEF,KAAK;KACL,KAAK,kBACH;KAEF,SACE,iBAAiB;IAGrB;IACA,IAAI,OAAO,gBACT,OAAO,UAAU,QAAQ,CAAC;GAE9B,CAAC,CACH,GACA,WACAC,cAAqB,MAAM,GAC3BC,aAAoB;IAClB,IAAI,mBAAmB,IAAI,OAAOC;IAClC,iBAAiB;IACjB,OAAO,UAAU,QAAQ,CAAC;GAC5B,CAAC,GACDC,OAAcT,OAAK,GACnBU,MACF;EACF;EACA,QAAQC,WAAkB,MAAM;CAClC,CAAC;AACH,CAAC,CACH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $
|
|
1
|
+
import { $o as Tuple$1, $s as isNotNullish, $t as tryPromise, Ao as getOrNull, As as redact$2, Ba as isFailure, Bi as iterateConcurrent, Bs as optimize, Ci as currentTimeMillis$1, Da as map$3, Ds as formatPath, Ea as makeEquivalence$3, Ec as pipeArguments, Eo as fromNullOr, Es as formatJson, F as failCauseSync, Fa as fail$1, Fo as isSome, Fs as symbol$2, Gi as map$2, Go as Date$3, Gs as hasProperty, H as fnUntracedEager, Ha as map$6, Ho as some, Hs as structure, Io as liftThrowable, Is as array, It as runSyncExit, Jo as isGreaterThan$1, Js as isError, Ki as monotonicTimeNanos$1, Ko as Number$4, Ks as isBigInt, Kt as suspend$1, L as flatMap, La as flatMap$1, Lo as map$4, Ls as combine, M as exit, Ms as asEquivalence, N as fail$2, No as isNone, Os as formatPropertyKey, Po as isOption, Ps as equals, Qo as make$10, R as flatMapEager, Ra as getOrThrow, Ro as match, Rs as hash, Sa as isReadonlyArrayNonEmpty, Sc as memoizeIdempotent, So as filter, Ss as NodeInspectSymbol, Tc as Prototype, To as flatten, Ts as formatDate, Ua as match$1, Us as structureKeys, Ut as succeed$3, Va as isSuccess$1, Vi as iterateEager, Vs as string$1, Wa as succeed$1, Wn as remainder, Wo as BigInt$4, Ws as symbol$1, Wt as succeedNone, Xa as isDuration, Xo as isLessThan$1, Y as fromResult, Ya as infinity, Yi as resolveConcurrency, Yo as isGreaterThanOrEqualTo$1, Ys as isFunction, Za as isFinite$2, Zo as isLessThanOrEqualTo$1, Zs as isNever$1, _r as makeInterruptReason, _s as assignProperty$1, aa as encode$1, ac as isObjectKeyword, ao as toMillis, as as PipeInspectableProto, ba as isArrayNonEmpty, bc as identity, bs as BaseProto, cc as isSymbol, ci as failCause, co as Reference, ct as mapBothEager, dc as isUnknown, di as isExit, do as empty$3, dt as mapErrorEager, ec as isNotUndefined, en as try_, eo as millis, er as die$1, es as make$9, fa as dedupe, fo as get, fr as isFailReason, gi as ClockRef, gr as makeFailReason, gs as assignProperties, hi as void_$1, hr as makeDieReason, ic as isObject, io as seconds, is as Error$3, js as symbolRedactable, k as die, ks as currentFiberTypeId, lc as isTagged, lt as mapEager, m as catchCause, mi as succeed$2, no as nanos, oc as isPropertyKey, oo as toSeconds, or as fromReasons, os as TaggedError$2, pa as empty$4, pi as isSuccess, pr as isReason, qa as fromInputUnsafe, qn as IllegalArgumentError, qo as String$4, qs as isBoolean, rc as isNumber, ro as negativeInfinity, sc as isString$1, si as fail$3, sn as void_$2, ss as args, ts as strictEqual, ua as append, ur as isCause, va as fromIterable$1, vc as dual, vr as map$5, vs as getStackTraceLimit, wc as Class$2, wi as effectIsExit, ws as format$1, xc as memoize, ys as setStackTraceLimit, zo as none, zs as number$1 } from "./Effect-4B1lzxy4.mjs";
|
|
2
2
|
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Tuple.js
|
|
3
3
|
const makeEquivalence$2 = Tuple$1;
|
|
4
4
|
//#endregion
|
|
@@ -7377,6 +7377,6 @@ const MutableJson = make(annotate(MutableJson$1, { toCode: () => ({
|
|
|
7377
7377
|
Type: "Schema.MutableJson"
|
|
7378
7378
|
}) }));
|
|
7379
7379
|
//#endregion
|
|
7380
|
-
export { TupleWithRest as $, null_ as $n,
|
|
7380
|
+
export { TupleWithRest as $, null_ as $n, currentTimeMillis as $r, isMinLength as $t, NonEmptyString as A, toCodecJson$1 as An, CurrentRedactedNames$1 as Ar, isBetweenProperties as At, RedactedFromValue as B, Filter as Bn, fromSetCookie as Br, isIncluding as Bt, JsonObject as C, toType as Cn, CurrentRedactedNames as Cr, instanceOf as Ct, Natural as D, evolve as Dn, setAll as Dr, isBetweenCodePoints as Dt, MutableJson as E, withDecodingDefaultKey as En, redactUrl as Er, isBetweenBigInt as Et, Option as F, decodeEffect$1 as Fn, merge as Fr, isGreaterThanBigInt as Ft, StructWithRest as G, Suspend as Gn, fromDateUnsafe as Gr, isLessThanOrEqualTo as Gt, String$1 as H, Literal$1 as Hn, encode as Hr, isLessThan as Ht, OptionFromNullOr as I, decodeUnknownEffect$1 as In, remove as Ir, isGreaterThanDate as It, TaggedError as J, decodeTo$1 as Jn, isRedacted as Jr, isMaxCodePoints as Jt, Symbol$1 as K, Union$1 as Kn, now as Kr, isLessThanOrEqualToBigInt as Kt, OptionFromOptional as L, decodeUnknownResult as Ln, set as Lr, isGreaterThanOrEqualTo as Lt, NullOr as M, fromSchemaDraft2020_12 as Mn, fromInput$1 as Mr, isEndingWith as Mt, Number$1 as N, getReferenceKey as Nn, fromRecordUnsafe as Nr, isFinite as Nt, Never as O, omit as On, toString as Or, isBetweenDate as Ot, ObjectKeyword as P, _is as Pn, isRedactedName$1 as Pr, isGreaterThan as Pt, Tuple as Q, mapOrSame as Qn, Clock as Qr, isMinCodePoints as Qt, Record as R, encodeEffect$1 as Rn, setAll$1 as Rr, isGreaterThanOrEqualToBigInt as Rt, Json as S, toJsonSchemaDocument as Sn, Pointer as Sr, fromJsonString as St, Literals as T, withDecodingDefault as Tn, fromInput as Tr, isBetween as Tt, StringForLiteralAutocomplete as U, Objects as Un, formatIso as Ur, isLessThanBigInt as Ut, SchemaError as V, FilterGroup as Vn, decode as Vr, isInt as Vt, Struct as W, PropertySignature as Wn, formatIsoDate as Wr, isLessThanDate as Wt, TemplateLiteral as X, isNever as Xn, value as Xr, isMaxProperties as Xt, TaggedUnion as Y, isJson as Yn, make$7 as Yr, isMaxLength as Yt, TrueLiterals as Z, isOptional as Zn, stringOrRedacted as Zr, isMaxSize as Zt, Error$1 as _, suspend as _n, passthroughSubtype as _r, decodeUnknownOption as _t, BooleanFromBit as a, taggedEnum as ai, isSchema as an, string as ar, UndefinedOr as at, Finite as b, toCodecStringTree as bn, transformOptional$1 as br, encodeTo as bt, Date$1 as c, isUUID as cn, unknown as cr, Unknown as ct, DateTimeUtcFromMillis as d, makeFilter as dn, transform as dr, check as dt, monotonicTimeNanos as ei, isMinProperties as en, optionalKey$1 as er, URL$1 as et, DateTimeUtcFromString as f, makeFilterGroup as fn, transformEffect as fr, declare as ft, Enum as g, optionalKey as gn, passthrough$1 as gr, decodeUnknownEffect as gt, DurationFromMillis as h, optional as hn, map as hr, decodeTo as ht, Boolean as i, TaggedError$1 as ii, isPropertyNames as in, resolveIdentifier as ir, Undefined as it, Null as j, fromSchemaDraft07 as jn, empty$1 as jr, isBetweenSize as jt, NonEmptyArray as k, errorWithPath as kn, unwrap as kr, isBetweenLength as kt, DateTimeUtc as l, isUnique as ln, Transformation as lr, Void as lt, Duration as m, mutableKey as mn, dateTimeUtcFromInput$1 as mr, decodeSync as mt, ArraySchema as n, Error$2 as ni, isMultipleOf as nn, resolveAt as nr, Uint8Array$1 as nt, BooleanLiterals as o, assignProperty as oi, isSchemaError as on, toEncoded$1 as or, Union as ot, Defect as p, mutable as pn, transformOptional as pr, decodeEffect as pt, TaggedClass as q, applyToSelfOrLastLinkEncoding as qn, removeTime as qr, isLessThanOrEqualToDate as qt, BigInt$1 as r, TaggedClass$1 as ri, isPattern as rn, resolveDescription as rr, Uint8ArrayFromBase64 as rt, Class as s, map$1 as si, isStartingWith as sn, toType$1 as sr, UniqueSymbol as st, Any as t, EncodingError as ti, isMinSize as tn, replaceChecks as tr, URLFromString as tt, DateTimeUtcFromDate as u, make as un, passthrough as ur, brand as ut, Exit as v, tag as vn, transform$1 as vr, decodeUnknownSync as vt, Literal as w, withConstructorDefault as wn, empty as wr, is as wt, Int as x, toEncoded as xn, InvalidValue as xr, encodeUnknownEffect as xt, FalseLiterals as y, toCodecJson as yn, transformEffect$1 as yr, encodeEffect as yt, Redacted as z, Arrays as zn, empty$2 as zr, isGreaterThanOrEqualToDate as zt };
|
|
7381
7381
|
|
|
7382
|
-
//# sourceMappingURL=Schema-
|
|
7382
|
+
//# sourceMappingURL=Schema-D4fxUgEU.mjs.map
|