@agentdocumentformat/cli 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +45 -0
  3. package/dist/adf.mjs +162 -0
  4. package/dist/chunks/APEv2Parser-2CNNHMXV.mjs +22 -0
  5. package/dist/chunks/AiffParser-7BR4RL6G.mjs +162 -0
  6. package/dist/chunks/App-L5L37JI5.mjs +16747 -0
  7. package/dist/chunks/AsfParser-VVRSLFOM.mjs +538 -0
  8. package/dist/chunks/DsdiffParser-CMD4AX7A.mjs +156 -0
  9. package/dist/chunks/DsfParser-UOGZDS2M.mjs +94 -0
  10. package/dist/chunks/FlacParser-HB3T3CD4.mjs +23 -0
  11. package/dist/chunks/MP4Parser-66HBRUSX.mjs +973 -0
  12. package/dist/chunks/MatroskaParser-J3HUIMEW.mjs +579 -0
  13. package/dist/chunks/MpegParser-YW6LIUEW.mjs +442 -0
  14. package/dist/chunks/MusepackParser-PAUSXP7D.mjs +252 -0
  15. package/dist/chunks/OggParser-NUBV3GWC.mjs +359 -0
  16. package/dist/chunks/WavPackParser-WQAGT7TC.mjs +171 -0
  17. package/dist/chunks/WaveParser-EWLQVDX4.mjs +238 -0
  18. package/dist/chunks/adf-schema-JRU2BTOG.mjs +62 -0
  19. package/dist/chunks/build-QF5W473T.mjs +60 -0
  20. package/dist/chunks/chatgpt-subscription-BQGWYZXE.mjs +23 -0
  21. package/dist/chunks/chunk-2DIECGFL.mjs +6 -0
  22. package/dist/chunks/chunk-2NAP2ZF7.mjs +60 -0
  23. package/dist/chunks/chunk-3AT7IIP7.mjs +25696 -0
  24. package/dist/chunks/chunk-3GNIDM53.mjs +35 -0
  25. package/dist/chunks/chunk-3M4ZPOA3.mjs +1477 -0
  26. package/dist/chunks/chunk-4MQPTCXY.mjs +510 -0
  27. package/dist/chunks/chunk-5PO5PKRV.mjs +366 -0
  28. package/dist/chunks/chunk-5QU5VY7N.mjs +52 -0
  29. package/dist/chunks/chunk-5W7KES6P.mjs +436 -0
  30. package/dist/chunks/chunk-62NE4LG4.mjs +61 -0
  31. package/dist/chunks/chunk-64OKE4X3.mjs +45 -0
  32. package/dist/chunks/chunk-6GJ4QHRI.mjs +1278 -0
  33. package/dist/chunks/chunk-6VQEXLE2.mjs +144 -0
  34. package/dist/chunks/chunk-6XUV6EK6.mjs +41 -0
  35. package/dist/chunks/chunk-776TSXEP.mjs +43 -0
  36. package/dist/chunks/chunk-7CV2SA3H.mjs +285 -0
  37. package/dist/chunks/chunk-7MTRVW2U.mjs +3103 -0
  38. package/dist/chunks/chunk-7N2R2VCG.mjs +1434 -0
  39. package/dist/chunks/chunk-7T2YMTWL.mjs +374 -0
  40. package/dist/chunks/chunk-7XYNI52E.mjs +149 -0
  41. package/dist/chunks/chunk-APHX6HSV.mjs +7731 -0
  42. package/dist/chunks/chunk-APRU6PHC.mjs +40 -0
  43. package/dist/chunks/chunk-AUYKRQPJ.mjs +499 -0
  44. package/dist/chunks/chunk-DXWDD5XJ.mjs +136 -0
  45. package/dist/chunks/chunk-EWL5FG4I.mjs +39 -0
  46. package/dist/chunks/chunk-EYX2YLJW.mjs +117 -0
  47. package/dist/chunks/chunk-F5ELW46V.mjs +27 -0
  48. package/dist/chunks/chunk-G426FACA.mjs +49 -0
  49. package/dist/chunks/chunk-GEKSJHIV.mjs +2472 -0
  50. package/dist/chunks/chunk-HBUENVQL.mjs +570 -0
  51. package/dist/chunks/chunk-HPVFJYXR.mjs +112 -0
  52. package/dist/chunks/chunk-HWLWPXQ7.mjs +721 -0
  53. package/dist/chunks/chunk-I2HJYHFT.mjs +665 -0
  54. package/dist/chunks/chunk-I3UYSITV.mjs +68 -0
  55. package/dist/chunks/chunk-IC4JDZCI.mjs +3864 -0
  56. package/dist/chunks/chunk-IHDDCZBS.mjs +112 -0
  57. package/dist/chunks/chunk-IIGMZHQQ.mjs +10416 -0
  58. package/dist/chunks/chunk-KWFOS5WC.mjs +41 -0
  59. package/dist/chunks/chunk-LAZIXV2F.mjs +5290 -0
  60. package/dist/chunks/chunk-LFMB4PAA.mjs +10814 -0
  61. package/dist/chunks/chunk-M2RX3S2T.mjs +49 -0
  62. package/dist/chunks/chunk-M3WPIJYM.mjs +65 -0
  63. package/dist/chunks/chunk-NBTUWMGP.mjs +263 -0
  64. package/dist/chunks/chunk-NGK6PVSF.mjs +2676 -0
  65. package/dist/chunks/chunk-NZ7JTHEO.mjs +85 -0
  66. package/dist/chunks/chunk-OQN33RGQ.mjs +52 -0
  67. package/dist/chunks/chunk-RIX34QHC.mjs +2935 -0
  68. package/dist/chunks/chunk-SGUTYISF.mjs +16 -0
  69. package/dist/chunks/chunk-SLJ5L7PY.mjs +1473 -0
  70. package/dist/chunks/chunk-SLUKGXKH.mjs +68 -0
  71. package/dist/chunks/chunk-TMT32MXT.mjs +419 -0
  72. package/dist/chunks/chunk-UYY5M2PB.mjs +151 -0
  73. package/dist/chunks/chunk-VAUOM3IN.mjs +298 -0
  74. package/dist/chunks/chunk-VMHTYDH4.mjs +172 -0
  75. package/dist/chunks/chunk-VZS54AA5.mjs +200 -0
  76. package/dist/chunks/chunk-WFQUVXML.mjs +295 -0
  77. package/dist/chunks/chunk-X34PDRUH.mjs +809 -0
  78. package/dist/chunks/chunk-XNPZBLYL.mjs +33 -0
  79. package/dist/chunks/chunk-XX7OSWTO.mjs +157 -0
  80. package/dist/chunks/chunk-XYTWGHFS.mjs +600 -0
  81. package/dist/chunks/chunk-XYV3VCIX.mjs +336 -0
  82. package/dist/chunks/chunk-Y5ZLKFLE.mjs +1469 -0
  83. package/dist/chunks/chunk-ZJKXHM4Q.mjs +230 -0
  84. package/dist/chunks/cli-TCMBNZF6.mjs +1030 -0
  85. package/dist/chunks/commands-DTEKM4ZL.mjs +20 -0
  86. package/dist/chunks/daemon-ZC3FZ2P4.mjs +112449 -0
  87. package/dist/chunks/daemon-control-WDX7PMTC.mjs +300 -0
  88. package/dist/chunks/daemon-token-WRSULP7G.mjs +23 -0
  89. package/dist/chunks/devtools-H7CI2ZVG.mjs +85 -0
  90. package/dist/chunks/discord-IWDQJA7A.mjs +70588 -0
  91. package/dist/chunks/dist-C57KYFS2.mjs +4952 -0
  92. package/dist/chunks/dist-I3XBAGDL.mjs +11 -0
  93. package/dist/chunks/email-V4Q4VJON.mjs +58679 -0
  94. package/dist/chunks/environment-NX277MQG.mjs +15 -0
  95. package/dist/chunks/grok-subscription-4PYX7TBF.mjs +19 -0
  96. package/dist/chunks/layout-EPJQNFAI.mjs +22 -0
  97. package/dist/chunks/lib-N7FCZWKH.mjs +4038 -0
  98. package/dist/chunks/open-OTQDGDH5.mjs +36 -0
  99. package/dist/chunks/parser-JVY2PWSM.mjs +19 -0
  100. package/dist/chunks/pipeline-executor-BHBSJX2K.mjs +19 -0
  101. package/dist/chunks/react-IUIDQ5LX.mjs +11 -0
  102. package/dist/chunks/screen-54BUTYCW.mjs +27 -0
  103. package/dist/chunks/slack-3L5QTDZX.mjs +8113 -0
  104. package/dist/chunks/store-WR7TZJZS.mjs +32 -0
  105. package/dist/chunks/telegram-5ISVFBV3.mjs +14918 -0
  106. package/dist/chunks/terminal-O5WO7C5U.mjs +48 -0
  107. package/dist/chunks/theme-NORU4J74.mjs +20 -0
  108. package/dist/chunks/themes-F2FKU7CP.mjs +23 -0
  109. package/dist/chunks/token-6G3HCMNX.mjs +54 -0
  110. package/dist/chunks/token-util-UXYSDQIW.mjs +12 -0
  111. package/dist/chunks/tui-ODVYUIMT.mjs +197 -0
  112. package/dist/chunks/welcome-XHXFV7SH.mjs +32 -0
  113. package/dist/chunks/whatsapp-XSAMNGPJ.mjs +85412 -0
  114. package/dist/chunks/xterm-headless-YF53XWXE.mjs +3353 -0
  115. package/package.json +53 -0
  116. package/resources/wasm/coreutils.LICENSE +18 -0
  117. package/resources/wasm/coreutils.wasm +0 -0
@@ -0,0 +1,171 @@
1
+ import { createRequire as __adfCreateRequire } from 'node:module';
2
+ import { fileURLToPath as __adfFileURLToPath } from 'node:url';
3
+ import { dirname as __adfDirname } from 'node:path';
4
+ const require = __adfCreateRequire(import.meta.url);
5
+ const __filename = __adfFileURLToPath(import.meta.url);
6
+ const __dirname = __adfDirname(__filename);
7
+ import {
8
+ FourCcToken,
9
+ tryParseApeHeader
10
+ } from "./chunk-NBTUWMGP.mjs";
11
+ import {
12
+ uint8ArrayToHex
13
+ } from "./chunk-XX7OSWTO.mjs";
14
+ import "./chunk-HBUENVQL.mjs";
15
+ import {
16
+ BasicParser,
17
+ UINT16_LE,
18
+ UINT24_LE,
19
+ UINT32_LE,
20
+ UINT8,
21
+ Uint8ArrayType,
22
+ makeUnexpectedFileContentError
23
+ } from "./chunk-I2HJYHFT.mjs";
24
+ import {
25
+ require_src
26
+ } from "./chunk-AUYKRQPJ.mjs";
27
+ import "./chunk-NZ7JTHEO.mjs";
28
+ import {
29
+ __toESM
30
+ } from "./chunk-M2RX3S2T.mjs";
31
+
32
+ // node_modules/music-metadata/lib/wavpack/WavPackToken.js
33
+ var SampleRates = [
34
+ 6e3,
35
+ 8e3,
36
+ 9600,
37
+ 11025,
38
+ 12e3,
39
+ 16e3,
40
+ 22050,
41
+ 24e3,
42
+ 32e3,
43
+ 44100,
44
+ 48e3,
45
+ 64e3,
46
+ 88200,
47
+ 96e3,
48
+ 192e3,
49
+ -1
50
+ ], BlockHeaderToken = {
51
+ len: 32,
52
+ get: (buf, off) => {
53
+ let flags = UINT32_LE.get(buf, off + 24), res = {
54
+ // should equal 'wvpk'
55
+ BlockID: FourCcToken.get(buf, off),
56
+ // 0x402 to 0x410 are valid for decode
57
+ blockSize: UINT32_LE.get(buf, off + 4),
58
+ // 0x402 (1026) to 0x410 are valid for decode
59
+ version: UINT16_LE.get(buf, off + 8),
60
+ // 40-bit total samples for entire file (if block_index == 0 and a value of -1 indicates an unknown length)
61
+ totalSamples: (
62
+ /* replace with bigint? (Token.UINT8.get(buf, off + 11) << 32) + */
63
+ UINT32_LE.get(buf, off + 12)
64
+ ),
65
+ // 40-bit block_index
66
+ blockIndex: (
67
+ /* replace with bigint? (Token.UINT8.get(buf, off + 10) << 32) + */
68
+ UINT32_LE.get(buf, off + 16)
69
+ ),
70
+ // 40-bit total samples for entire file (if block_index == 0 and a value of -1 indicates an unknown length)
71
+ blockSamples: UINT32_LE.get(buf, off + 20),
72
+ // various flags for id and decoding
73
+ flags: {
74
+ bitsPerSample: (1 + getBitAllignedNumber(flags, 0, 2)) * 8,
75
+ isMono: isBitSet(flags, 2),
76
+ isHybrid: isBitSet(flags, 3),
77
+ isJointStereo: isBitSet(flags, 4),
78
+ crossChannel: isBitSet(flags, 5),
79
+ hybridNoiseShaping: isBitSet(flags, 6),
80
+ floatingPoint: isBitSet(flags, 7),
81
+ samplingRate: SampleRates[getBitAllignedNumber(flags, 23, 4)],
82
+ isDSD: isBitSet(flags, 31)
83
+ },
84
+ // crc for actual decoded data
85
+ crc: new Uint8ArrayType(4).get(buf, off + 28)
86
+ };
87
+ return res.flags.isDSD && (res.totalSamples *= 8), res;
88
+ }
89
+ }, MetadataIdToken = {
90
+ len: 1,
91
+ get: (buf, off) => ({
92
+ functionId: getBitAllignedNumber(buf[off], 0, 6),
93
+ // functionId overlaps with isOptional flag
94
+ isOptional: isBitSet(buf[off], 5),
95
+ isOddSize: isBitSet(buf[off], 6),
96
+ largeBlock: isBitSet(buf[off], 7)
97
+ })
98
+ };
99
+ function isBitSet(flags, bitOffset) {
100
+ return getBitAllignedNumber(flags, bitOffset, 1) === 1;
101
+ }
102
+ function getBitAllignedNumber(flags, bitOffset, len) {
103
+ return flags >>> bitOffset & 4294967295 >>> 32 - len;
104
+ }
105
+
106
+ // node_modules/music-metadata/lib/wavpack/WavPackParser.js
107
+ var import_debug = __toESM(require_src(), 1);
108
+ var debug = (0, import_debug.default)("music-metadata:parser:WavPack"), WavPackContentError = class extends makeUnexpectedFileContentError("WavPack") {
109
+ }, WavPackParser = class extends BasicParser {
110
+ constructor() {
111
+ super(...arguments), this.audioDataSize = 0;
112
+ }
113
+ async parse() {
114
+ return this.metadata.setAudioOnly(), this.audioDataSize = 0, await this.parseWavPackBlocks(), tryParseApeHeader(this.metadata, this.tokenizer, this.options);
115
+ }
116
+ async parseWavPackBlocks() {
117
+ do {
118
+ if (await this.tokenizer.peekToken(FourCcToken) !== "wvpk")
119
+ break;
120
+ let header = await this.tokenizer.readToken(BlockHeaderToken);
121
+ if (header.BlockID !== "wvpk")
122
+ throw new WavPackContentError("Invalid WavPack Block-ID");
123
+ debug(`WavPack header blockIndex=${header.blockIndex}, len=${BlockHeaderToken.len}`), header.blockIndex === 0 && !this.metadata.format.container && (this.metadata.setFormat("container", "WavPack"), this.metadata.setFormat("lossless", !header.flags.isHybrid), this.metadata.setFormat("bitsPerSample", header.flags.bitsPerSample), header.flags.isDSD || (this.metadata.setFormat("sampleRate", header.flags.samplingRate), this.metadata.setFormat("duration", header.totalSamples / header.flags.samplingRate)), this.metadata.setFormat("numberOfChannels", header.flags.isMono ? 1 : 2), this.metadata.setFormat("numberOfSamples", header.totalSamples), this.metadata.setFormat("codec", header.flags.isDSD ? "DSD" : "PCM"));
124
+ let ignoreBytes = header.blockSize - (BlockHeaderToken.len - 8);
125
+ await (header.blockIndex === 0 ? this.parseMetadataSubBlock(header, ignoreBytes) : this.tokenizer.ignore(ignoreBytes)), header.blockSamples > 0 && (this.audioDataSize += header.blockSize);
126
+ } while (!this.tokenizer.fileInfo.size || this.tokenizer.fileInfo.size - this.tokenizer.position >= BlockHeaderToken.len);
127
+ this.metadata.format.duration && this.metadata.setFormat("bitrate", this.audioDataSize * 8 / this.metadata.format.duration);
128
+ }
129
+ /**
130
+ * Ref: http://www.wavpack.com/WavPack5FileFormat.pdf, 3.0 Metadata Sub-blocks
131
+ * @param header Header
132
+ * @param remainingLength Remaining length
133
+ */
134
+ async parseMetadataSubBlock(header, remainingLength) {
135
+ let remaining = remainingLength;
136
+ for (; remaining > MetadataIdToken.len; ) {
137
+ let id = await this.tokenizer.readToken(MetadataIdToken), dataSizeInWords = await this.tokenizer.readNumber(id.largeBlock ? UINT24_LE : UINT8), data = new Uint8Array(dataSizeInWords * 2 - (id.isOddSize ? 1 : 0));
138
+ switch (await this.tokenizer.readBuffer(data), debug(`Metadata Sub-Blocks functionId=0x${id.functionId.toString(16)}, id.largeBlock=${id.largeBlock},data-size=${data.length}`), id.functionId) {
139
+ case 0:
140
+ break;
141
+ case 14: {
142
+ debug("ID_DSD_BLOCK");
143
+ let mp = 1 << UINT8.get(data, 0), samplingRate = header.flags.samplingRate * mp * 8;
144
+ if (!header.flags.isDSD)
145
+ throw new WavPackContentError("Only expect DSD block if DSD-flag is set");
146
+ this.metadata.setFormat("sampleRate", samplingRate), this.metadata.setFormat("duration", header.totalSamples / samplingRate);
147
+ break;
148
+ }
149
+ case 36:
150
+ debug("ID_ALT_TRAILER: trailer for non-wav files");
151
+ break;
152
+ case 38:
153
+ this.metadata.setFormat("audioMD5", data);
154
+ break;
155
+ case 47:
156
+ debug(`ID_BLOCK_CHECKSUM: checksum=${uint8ArrayToHex(data)}`);
157
+ break;
158
+ default:
159
+ debug(`Ignore unsupported meta-sub-block-id functionId=0x${id.functionId.toString(16)}`);
160
+ break;
161
+ }
162
+ remaining -= MetadataIdToken.len + (id.largeBlock ? UINT24_LE.len : UINT8.len) + dataSizeInWords * 2, debug(`remainingLength=${remaining}`), id.isOddSize && this.tokenizer.ignore(1);
163
+ }
164
+ if (remaining !== 0)
165
+ throw new WavPackContentError("metadata-sub-block should fit it remaining length");
166
+ }
167
+ };
168
+ export {
169
+ WavPackContentError,
170
+ WavPackParser
171
+ };
@@ -0,0 +1,238 @@
1
+ import { createRequire as __adfCreateRequire } from 'node:module';
2
+ import { fileURLToPath as __adfFileURLToPath } from 'node:url';
3
+ import { dirname as __adfDirname } from 'node:path';
4
+ const require = __adfCreateRequire(import.meta.url);
5
+ const __filename = __adfFileURLToPath(import.meta.url);
6
+ const __dirname = __adfDirname(__filename);
7
+ import {
8
+ ID3v2Parser
9
+ } from "./chunk-XYTWGHFS.mjs";
10
+ import "./chunk-VAUOM3IN.mjs";
11
+ import "./chunk-DXWDD5XJ.mjs";
12
+ import {
13
+ FourCcToken
14
+ } from "./chunk-NBTUWMGP.mjs";
15
+ import {
16
+ stripNulls
17
+ } from "./chunk-XX7OSWTO.mjs";
18
+ import {
19
+ EndOfStreamError,
20
+ fromBuffer
21
+ } from "./chunk-HBUENVQL.mjs";
22
+ import {
23
+ BasicParser,
24
+ StringType,
25
+ UINT16_LE,
26
+ UINT32_LE,
27
+ Uint8ArrayType,
28
+ makeUnexpectedFileContentError
29
+ } from "./chunk-I2HJYHFT.mjs";
30
+ import {
31
+ require_src
32
+ } from "./chunk-AUYKRQPJ.mjs";
33
+ import "./chunk-NZ7JTHEO.mjs";
34
+ import {
35
+ __toESM
36
+ } from "./chunk-M2RX3S2T.mjs";
37
+
38
+ // node_modules/music-metadata/lib/wav/WaveParser.js
39
+ var import_debug = __toESM(require_src(), 1);
40
+
41
+ // node_modules/music-metadata/lib/riff/RiffChunk.js
42
+ var Header = {
43
+ len: 8,
44
+ get: (buf, off) => ({
45
+ // Group-ID
46
+ chunkID: new StringType(4, "latin1").get(buf, off),
47
+ // Size
48
+ chunkSize: UINT32_LE.get(buf, off + 4)
49
+ })
50
+ }, ListInfoTagValue = class {
51
+ constructor(tagHeader) {
52
+ this.tagHeader = tagHeader, this.len = tagHeader.chunkSize, this.len += this.len & 1;
53
+ }
54
+ get(buf, off) {
55
+ return new StringType(this.tagHeader.chunkSize, "ascii").get(buf, off);
56
+ }
57
+ };
58
+
59
+ // node_modules/music-metadata/lib/wav/WaveChunk.js
60
+ var WaveContentError = class extends makeUnexpectedFileContentError("Wave") {
61
+ }, WaveFormat = {
62
+ PCM: 1,
63
+ ADPCM: 2,
64
+ IEEE_FLOAT: 3,
65
+ ALAW: 6,
66
+ MULAW: 7,
67
+ DVI_ADPCM: 17,
68
+ GSM610: 49,
69
+ // MPEG-4 and AAC Audio Types
70
+ MPEG_ADTS_AAC: 5632,
71
+ MPEG_LOAS: 5634,
72
+ RAW_AAC1: 255,
73
+ // Dolby Audio Types
74
+ DOLBY_AC3_SPDIF: 146,
75
+ DVM: 8192,
76
+ RAW_SPORT: 576,
77
+ ESST_AC3: 577,
78
+ DRM: 9,
79
+ DTS2: 8193,
80
+ MPEG: 80,
81
+ MPEGLAYER3: 85
82
+ }, WaveFormatNameMap = {
83
+ [WaveFormat.PCM]: "PCM",
84
+ [WaveFormat.ADPCM]: "ADPCM",
85
+ [WaveFormat.IEEE_FLOAT]: "IEEE_FLOAT",
86
+ [WaveFormat.ALAW]: "ALAW",
87
+ [WaveFormat.MULAW]: "MULAW",
88
+ [WaveFormat.DVI_ADPCM]: "DVI_ADPCM",
89
+ [WaveFormat.GSM610]: "GSM610",
90
+ [WaveFormat.MPEG_ADTS_AAC]: "MPEG_ADTS_AAC",
91
+ [WaveFormat.MPEG_LOAS]: "MPEG_LOAS",
92
+ [WaveFormat.RAW_AAC1]: "RAW_AAC1",
93
+ [WaveFormat.DOLBY_AC3_SPDIF]: "DOLBY_AC3_SPDIF",
94
+ [WaveFormat.DVM]: "DVM",
95
+ [WaveFormat.RAW_SPORT]: "RAW_SPORT",
96
+ [WaveFormat.ESST_AC3]: "ESST_AC3",
97
+ [WaveFormat.DRM]: "DRM",
98
+ [WaveFormat.DTS2]: "DTS2",
99
+ [WaveFormat.MPEG]: "MPEG",
100
+ [WaveFormat.MPEGLAYER3]: "MPEGLAYER3"
101
+ }, Format = class {
102
+ constructor(header) {
103
+ if (header.chunkSize < 16)
104
+ throw new WaveContentError("Invalid chunk size");
105
+ this.len = header.chunkSize;
106
+ }
107
+ get(buf, off) {
108
+ return {
109
+ wFormatTag: UINT16_LE.get(buf, off),
110
+ nChannels: UINT16_LE.get(buf, off + 2),
111
+ nSamplesPerSec: UINT32_LE.get(buf, off + 4),
112
+ nAvgBytesPerSec: UINT32_LE.get(buf, off + 8),
113
+ nBlockAlign: UINT16_LE.get(buf, off + 12),
114
+ wBitsPerSample: UINT16_LE.get(buf, off + 14)
115
+ };
116
+ }
117
+ }, FactChunk = class {
118
+ constructor(header) {
119
+ if (header.chunkSize < 4)
120
+ throw new WaveContentError("Invalid fact chunk size.");
121
+ this.len = header.chunkSize;
122
+ }
123
+ get(buf, off) {
124
+ return {
125
+ dwSampleLength: UINT32_LE.get(buf, off)
126
+ };
127
+ }
128
+ };
129
+
130
+ // node_modules/music-metadata/lib/wav/BwfChunk.js
131
+ var BroadcastAudioExtensionChunk = {
132
+ len: 420,
133
+ get: (uint8array, off) => ({
134
+ description: stripNulls(new StringType(256, "ascii").get(uint8array, off)).trim(),
135
+ originator: stripNulls(new StringType(32, "ascii").get(uint8array, off + 256)).trim(),
136
+ originatorReference: stripNulls(new StringType(32, "ascii").get(uint8array, off + 288)).trim(),
137
+ originationDate: stripNulls(new StringType(10, "ascii").get(uint8array, off + 320)).trim(),
138
+ originationTime: stripNulls(new StringType(8, "ascii").get(uint8array, off + 330)).trim(),
139
+ timeReferenceLow: UINT32_LE.get(uint8array, off + 338),
140
+ timeReferenceHigh: UINT32_LE.get(uint8array, off + 342),
141
+ version: UINT16_LE.get(uint8array, off + 346),
142
+ umid: new Uint8ArrayType(64).get(uint8array, off + 348),
143
+ loudnessValue: UINT16_LE.get(uint8array, off + 412),
144
+ maxTruePeakLevel: UINT16_LE.get(uint8array, off + 414),
145
+ maxMomentaryLoudness: UINT16_LE.get(uint8array, off + 416),
146
+ maxShortTermLoudness: UINT16_LE.get(uint8array, off + 418)
147
+ })
148
+ };
149
+
150
+ // node_modules/music-metadata/lib/wav/WaveParser.js
151
+ var debug = (0, import_debug.default)("music-metadata:parser:RIFF"), WaveParser = class extends BasicParser {
152
+ constructor() {
153
+ super(...arguments), this.blockAlign = 0, this.avgBytesPerSec = 0;
154
+ }
155
+ async parse() {
156
+ let riffHeader = await this.tokenizer.readToken(Header);
157
+ if (debug(`pos=${this.tokenizer.position}, parse: chunkID=${riffHeader.chunkID}`), riffHeader.chunkID === "RIFF")
158
+ return this.metadata.setAudioOnly(), this.parseRiffChunk(riffHeader.chunkSize).catch((err) => {
159
+ if (!(err instanceof EndOfStreamError))
160
+ throw err;
161
+ });
162
+ }
163
+ async parseRiffChunk(chunkSize) {
164
+ let type = await this.tokenizer.readToken(FourCcToken);
165
+ if (this.metadata.setFormat("container", type), type === "WAVE")
166
+ return this.readWaveChunk(chunkSize - FourCcToken.len);
167
+ throw new WaveContentError(`Unsupported RIFF format: RIFF/${type}`);
168
+ }
169
+ async readWaveChunk(remaining) {
170
+ for (; remaining >= Header.len; ) {
171
+ let header = await this.tokenizer.readToken(Header);
172
+ switch (remaining -= Header.len + header.chunkSize, header.chunkSize > remaining && this.metadata.addWarning("Data chunk size exceeds file size"), this.header = header, debug(`pos=${this.tokenizer.position}, readChunk: chunkID=RIFF/WAVE/${header.chunkID}`), header.chunkID) {
173
+ case "LIST":
174
+ await this.parseListTag(header);
175
+ break;
176
+ case "fact":
177
+ this.metadata.setFormat("lossless", !1), this.fact = await this.tokenizer.readToken(new FactChunk(header));
178
+ break;
179
+ case "fmt ": {
180
+ let fmt = await this.tokenizer.readToken(new Format(header)), subFormat = WaveFormatNameMap[fmt.wFormatTag];
181
+ subFormat || (debug(`WAVE/non-PCM format=${fmt.wFormatTag}`), subFormat = `non-PCM (${fmt.wFormatTag})`), this.metadata.setFormat("codec", subFormat), this.metadata.setFormat("bitsPerSample", fmt.wBitsPerSample), this.metadata.setFormat("sampleRate", fmt.nSamplesPerSec), this.metadata.setFormat("numberOfChannels", fmt.nChannels), this.blockAlign = fmt.nBlockAlign, this.avgBytesPerSec = fmt.nAvgBytesPerSec;
182
+ break;
183
+ }
184
+ case "id3 ":
185
+ // The way Picard, FooBar currently stores, ID3 meta-data
186
+ case "ID3 ": {
187
+ let id3_data = await this.tokenizer.readToken(new Uint8ArrayType(header.chunkSize)), rst = fromBuffer(id3_data);
188
+ await new ID3v2Parser().parse(this.metadata, rst, this.options);
189
+ break;
190
+ }
191
+ case "data": {
192
+ this.metadata.format.lossless !== !1 && this.metadata.setFormat("lossless", !0);
193
+ let chunkSize = header.chunkSize;
194
+ if (this.tokenizer.fileInfo.size) {
195
+ let calcRemaining = this.tokenizer.fileInfo.size - this.tokenizer.position;
196
+ calcRemaining < chunkSize && (this.metadata.addWarning("data chunk length exceeding file length"), chunkSize = calcRemaining);
197
+ }
198
+ let numberOfSamples = this.fact ? this.fact.dwSampleLength : chunkSize === 4294967295 ? void 0 : chunkSize / this.blockAlign;
199
+ numberOfSamples && (this.metadata.setFormat("numberOfSamples", numberOfSamples), this.metadata.format.sampleRate && this.metadata.setFormat("duration", numberOfSamples / this.metadata.format.sampleRate)), this.avgBytesPerSec > 0 ? this.metadata.setFormat("bitrate", this.avgBytesPerSec * 8) : this.metadata.format.duration && this.metadata.setFormat("bitrate", chunkSize * 8 / this.metadata.format.duration), await this.tokenizer.ignore(header.chunkSize);
200
+ break;
201
+ }
202
+ case "bext": {
203
+ let bext = await this.tokenizer.readToken(BroadcastAudioExtensionChunk);
204
+ Object.keys(bext).forEach((key) => {
205
+ this.metadata.addTag("exif", `bext.${key}`, bext[key]);
206
+ });
207
+ let bextRemaining = header.chunkSize - BroadcastAudioExtensionChunk.len;
208
+ await this.tokenizer.ignore(bextRemaining);
209
+ break;
210
+ }
211
+ case "\0\0\0\0":
212
+ debug(`Ignore padding chunk: RIFF/${header.chunkID} of ${header.chunkSize} bytes`), this.metadata.addWarning(`Ignore chunk: RIFF/${header.chunkID}`), await this.tokenizer.ignore(header.chunkSize);
213
+ break;
214
+ default:
215
+ debug(`Ignore chunk: RIFF/${header.chunkID} of ${header.chunkSize} bytes`), this.metadata.addWarning(`Ignore chunk: RIFF/${header.chunkID}`), await this.tokenizer.ignore(header.chunkSize);
216
+ }
217
+ this.header.chunkSize % 2 === 1 && (debug("Read odd padding byte"), await this.tokenizer.ignore(1));
218
+ }
219
+ }
220
+ async parseListTag(listHeader) {
221
+ let listType = await this.tokenizer.readToken(new StringType(4, "latin1"));
222
+ return debug("pos=%s, parseListTag: chunkID=RIFF/WAVE/LIST/%s", this.tokenizer.position, listType), listType === "INFO" ? this.parseRiffInfoTags(listHeader.chunkSize - 4) : (this.metadata.addWarning(`Ignore chunk: RIFF/WAVE/LIST/${listType}`), debug(`Ignoring chunkID=RIFF/WAVE/LIST/${listType}`), this.tokenizer.ignore(listHeader.chunkSize - 4).then());
223
+ }
224
+ async parseRiffInfoTags(chunkSize) {
225
+ for (; chunkSize >= 8; ) {
226
+ let header = await this.tokenizer.readToken(Header), valueToken = new ListInfoTagValue(header), value = await this.tokenizer.readToken(valueToken);
227
+ this.addTag(header.chunkID, stripNulls(value)), chunkSize -= 8 + valueToken.len;
228
+ }
229
+ if (chunkSize !== 0)
230
+ throw new WaveContentError(`Illegal remaining size: ${chunkSize}`);
231
+ }
232
+ addTag(id, value) {
233
+ this.metadata.addTag("exif", id, value);
234
+ }
235
+ };
236
+ export {
237
+ WaveParser
238
+ };
@@ -0,0 +1,62 @@
1
+ import { createRequire as __adfCreateRequire } from 'node:module';
2
+ import { fileURLToPath as __adfFileURLToPath } from 'node:url';
3
+ import { dirname as __adfDirname } from 'node:path';
4
+ const require = __adfCreateRequire(import.meta.url);
5
+ const __filename = __adfFileURLToPath(import.meta.url);
6
+ const __dirname = __adfDirname(__filename);
7
+ import {
8
+ AdapterInstanceConfigSchema,
9
+ AgentConfigSchema,
10
+ BindOptionsSchema,
11
+ LOOP_GOAL_MAX_CHARS,
12
+ LOOP_NAME_PATTERN,
13
+ LOOP_NAME_RULE,
14
+ LOOP_TOOLS_MAX,
15
+ LoopConfigSchema,
16
+ LoopsConfigSchema,
17
+ MAX_SIDE_LOOPS,
18
+ ModelConfigSchema,
19
+ PreLlmHookConfigSchema,
20
+ ServingApiRouteSchema,
21
+ ServingConfigSchema,
22
+ ServingPublicConfigSchema,
23
+ ServingSharedConfigSchema,
24
+ StreamBindConfigSchema,
25
+ StreamBindEndpointSchema,
26
+ StreamBindingDeclarationSchema,
27
+ TimerScheduleSchema,
28
+ ToolDeclarationSchema,
29
+ TriggersConfigV3Schema,
30
+ UmbilicalFilterSchema,
31
+ WsConnectionConfigSchema
32
+ } from "./chunk-HWLWPXQ7.mjs";
33
+ import "./chunk-ZJKXHM4Q.mjs";
34
+ import "./chunk-RIX34QHC.mjs";
35
+ import "./chunk-WFQUVXML.mjs";
36
+ import "./chunk-M2RX3S2T.mjs";
37
+ export {
38
+ AdapterInstanceConfigSchema,
39
+ AgentConfigSchema,
40
+ BindOptionsSchema,
41
+ LOOP_GOAL_MAX_CHARS,
42
+ LOOP_NAME_PATTERN,
43
+ LOOP_NAME_RULE,
44
+ LOOP_TOOLS_MAX,
45
+ LoopConfigSchema,
46
+ LoopsConfigSchema,
47
+ MAX_SIDE_LOOPS,
48
+ ModelConfigSchema,
49
+ PreLlmHookConfigSchema,
50
+ ServingApiRouteSchema,
51
+ ServingConfigSchema,
52
+ ServingPublicConfigSchema,
53
+ ServingSharedConfigSchema,
54
+ StreamBindConfigSchema,
55
+ StreamBindEndpointSchema,
56
+ StreamBindingDeclarationSchema,
57
+ TimerScheduleSchema,
58
+ ToolDeclarationSchema,
59
+ TriggersConfigV3Schema,
60
+ UmbilicalFilterSchema,
61
+ WsConnectionConfigSchema
62
+ };
@@ -0,0 +1,60 @@
1
+ import { createRequire as __adfCreateRequire } from 'node:module';
2
+ import { fileURLToPath as __adfFileURLToPath } from 'node:url';
3
+ import { dirname as __adfDirname } from 'node:path';
4
+ const require = __adfCreateRequire(import.meta.url);
5
+ const __filename = __adfFileURLToPath(import.meta.url);
6
+ const __dirname = __adfDirname(__filename);
7
+ import {
8
+ Box_default,
9
+ Newline,
10
+ Spacer,
11
+ Static,
12
+ Text,
13
+ Transform,
14
+ kittyFlags,
15
+ kittyModifiers,
16
+ measure_element_default,
17
+ render_default,
18
+ render_to_string_default,
19
+ useAnimation,
20
+ use_app_default,
21
+ use_box_metrics_default,
22
+ use_cursor_default,
23
+ use_focus_default,
24
+ use_focus_manager_default,
25
+ use_input_default,
26
+ use_is_screen_reader_enabled_default,
27
+ use_paste_default,
28
+ use_stderr_default,
29
+ use_stdin_default,
30
+ use_stdout_default,
31
+ use_window_size_default
32
+ } from "./chunk-3AT7IIP7.mjs";
33
+ import "./chunk-6GJ4QHRI.mjs";
34
+ import "./chunk-M2RX3S2T.mjs";
35
+ export {
36
+ Box_default as Box,
37
+ Newline,
38
+ Spacer,
39
+ Static,
40
+ Text,
41
+ Transform,
42
+ kittyFlags,
43
+ kittyModifiers,
44
+ measure_element_default as measureElement,
45
+ render_default as render,
46
+ render_to_string_default as renderToString,
47
+ useAnimation,
48
+ use_app_default as useApp,
49
+ use_box_metrics_default as useBoxMetrics,
50
+ use_cursor_default as useCursor,
51
+ use_focus_default as useFocus,
52
+ use_focus_manager_default as useFocusManager,
53
+ use_input_default as useInput,
54
+ use_is_screen_reader_enabled_default as useIsScreenReaderEnabled,
55
+ use_paste_default as usePaste,
56
+ use_stderr_default as useStderr,
57
+ use_stdin_default as useStdin,
58
+ use_stdout_default as useStdout,
59
+ use_window_size_default as useWindowSize
60
+ };
@@ -0,0 +1,23 @@
1
+ import { createRequire as __adfCreateRequire } from 'node:module';
2
+ import { fileURLToPath as __adfFileURLToPath } from 'node:url';
3
+ import { dirname as __adfDirname } from 'node:path';
4
+ const require = __adfCreateRequire(import.meta.url);
5
+ const __filename = __adfFileURLToPath(import.meta.url);
6
+ const __dirname = __adfDirname(__filename);
7
+ import {
8
+ CHATGPT_SUBSCRIPTION_MODELS,
9
+ INSTRUCTIONS_ID_HEADER,
10
+ createChatGPTSubscriptionProvider,
11
+ describeCodexRequest,
12
+ patchCodexRequestBody
13
+ } from "./chunk-LAZIXV2F.mjs";
14
+ import "./chunk-LFMB4PAA.mjs";
15
+ import "./chunk-RIX34QHC.mjs";
16
+ import "./chunk-M2RX3S2T.mjs";
17
+ export {
18
+ CHATGPT_SUBSCRIPTION_MODELS,
19
+ INSTRUCTIONS_ID_HEADER,
20
+ createChatGPTSubscriptionProvider,
21
+ describeCodexRequest,
22
+ patchCodexRequestBody
23
+ };
@@ -0,0 +1,6 @@
1
+ import { createRequire as __adfCreateRequire } from 'node:module';
2
+ import { fileURLToPath as __adfFileURLToPath } from 'node:url';
3
+ import { dirname as __adfDirname } from 'node:path';
4
+ const require = __adfCreateRequire(import.meta.url);
5
+ const __filename = __adfFileURLToPath(import.meta.url);
6
+ const __dirname = __adfDirname(__filename);
@@ -0,0 +1,60 @@
1
+ import { createRequire as __adfCreateRequire } from 'node:module';
2
+ import { fileURLToPath as __adfFileURLToPath } from 'node:url';
3
+ import { dirname as __adfDirname } from 'node:path';
4
+ const require = __adfCreateRequire(import.meta.url);
5
+ const __filename = __adfFileURLToPath(import.meta.url);
6
+ const __dirname = __adfDirname(__filename);
7
+
8
+ // src/main/providers/chatgpt-subscription/callback-server.ts
9
+ import http from "http";
10
+ import { URL } from "url";
11
+ var PREFERRED_PORT = 1455, DEFAULT_TIMEOUT_MS = 12e4, SUCCESS_HTML = `<!DOCTYPE html>
12
+ <html><head><title>Authentication Complete</title></head>
13
+ <body style="font-family:system-ui;display:flex;align-items:center;justify-content:center;height:100vh;margin:0;background:#f5f5f5">
14
+ <div style="text-align:center"><h2>Authentication complete.</h2><p>You can close this tab.</p></div>
15
+ </body></html>`;
16
+ function startCallbackServer(timeoutMs = DEFAULT_TIMEOUT_MS) {
17
+ return new Promise((resolveServer, rejectServer) => {
18
+ let callbackResolve = null, callbackReject = null, timeout = null, server = http.createServer((req, res) => {
19
+ if (!req.url) {
20
+ res.writeHead(404), res.end();
21
+ return;
22
+ }
23
+ let parsed = new URL(req.url, "http://127.0.0.1");
24
+ if (parsed.pathname !== "/auth/callback") {
25
+ res.writeHead(404), res.end();
26
+ return;
27
+ }
28
+ let code = parsed.searchParams.get("code"), state = parsed.searchParams.get("state");
29
+ res.writeHead(200, { "Content-Type": "text/html" }), res.end(SUCCESS_HTML), code && state && callbackResolve && (callbackResolve({ code, state }), callbackResolve = null, callbackReject = null);
30
+ }), cleanup = () => {
31
+ timeout && (clearTimeout(timeout), timeout = null);
32
+ try {
33
+ server.close();
34
+ } catch {
35
+ }
36
+ }, callbackPromise = new Promise((resolve, reject) => {
37
+ callbackResolve = resolve, callbackReject = reject;
38
+ });
39
+ server.on("error", (err) => {
40
+ err.code === "EADDRINUSE" ? server.listen(0, "127.0.0.1") : rejectServer(err);
41
+ }), server.on("listening", () => {
42
+ let addr = server.address();
43
+ if (!addr || typeof addr == "string") {
44
+ cleanup(), rejectServer(new Error("Failed to get server address"));
45
+ return;
46
+ }
47
+ timeout = setTimeout(() => {
48
+ callbackReject && (callbackReject(new Error(`OAuth callback timed out after ${Math.round(timeoutMs / 1e3)}s`)), callbackResolve = null, callbackReject = null), cleanup();
49
+ }, timeoutMs), resolveServer({
50
+ port: addr.port,
51
+ waitForCallback: () => callbackPromise,
52
+ close: cleanup
53
+ });
54
+ }), server.listen(PREFERRED_PORT, "127.0.0.1");
55
+ });
56
+ }
57
+
58
+ export {
59
+ startCallbackServer
60
+ };