@celljs/ta-host 4.15.0 → 4.15.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 (45) hide show
  1. package/esm/node/extension-data.js +7 -3
  2. package/esm/node/index.d.ts +2 -0
  3. package/esm/node/index.js +2 -0
  4. package/esm/node/jpeg-encoder.d.ts +7 -0
  5. package/esm/node/jpeg-encoder.js +268 -0
  6. package/esm/node/png-thumbnail.d.ts +40 -0
  7. package/esm/node/png-thumbnail.js +384 -0
  8. package/esm/node/serve-updates.d.ts +38 -0
  9. package/esm/node/serve-updates.js +89 -0
  10. package/esm/node/ta-server-impl.d.ts +3 -0
  11. package/esm/node/ta-server-impl.js +33 -9
  12. package/esm/node/team/team-calls.js +6 -0
  13. package/esm/node/usage/agent-activity.d.ts +13 -0
  14. package/esm/node/usage/agent-activity.js +84 -0
  15. package/esm/node/usage/index.d.ts +3 -0
  16. package/esm/node/usage/index.js +4 -0
  17. package/esm/node/usage/usage-reader.d.ts +28 -0
  18. package/esm/node/usage/usage-reader.js +159 -0
  19. package/esm/node/usage/usage-server-impl.d.ts +12 -0
  20. package/esm/node/usage/usage-server-impl.js +46 -0
  21. package/esm/node/workspace-files.d.ts +23 -0
  22. package/esm/node/workspace-files.js +86 -0
  23. package/lib/node/extension-data.js +6 -2
  24. package/lib/node/index.d.ts +2 -0
  25. package/lib/node/index.js +2 -0
  26. package/lib/node/jpeg-encoder.d.ts +8 -0
  27. package/lib/node/jpeg-encoder.js +271 -0
  28. package/lib/node/png-thumbnail.d.ts +41 -0
  29. package/lib/node/png-thumbnail.js +387 -0
  30. package/lib/node/serve-updates.d.ts +39 -0
  31. package/lib/node/serve-updates.js +92 -0
  32. package/lib/node/ta-server-impl.d.ts +3 -0
  33. package/lib/node/ta-server-impl.js +33 -9
  34. package/lib/node/team/team-calls.js +6 -0
  35. package/lib/node/usage/agent-activity.d.ts +14 -0
  36. package/lib/node/usage/agent-activity.js +87 -0
  37. package/lib/node/usage/index.d.ts +4 -0
  38. package/lib/node/usage/index.js +20 -0
  39. package/lib/node/usage/usage-reader.d.ts +29 -0
  40. package/lib/node/usage/usage-reader.js +163 -0
  41. package/lib/node/usage/usage-server-impl.d.ts +13 -0
  42. package/lib/node/usage/usage-server-impl.js +49 -0
  43. package/lib/node/workspace-files.d.ts +23 -0
  44. package/lib/node/workspace-files.js +86 -0
  45. package/package.json +14 -10
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { createHash } from 'node:crypto';
10
+ import { createHash, randomUUID } from 'node:crypto';
11
11
  import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
12
12
  import { dirname, join } from 'node:path';
13
13
  import { CODING_AGENT_OPTIONS } from '@celljs/ai-coding-agent';
@@ -126,8 +126,12 @@ let ExtensionDataStoreImpl = class ExtensionDataStoreImpl {
126
126
  .then(async () => {
127
127
  const text = ExtensionDataUtil.update(await this.read(file), key, value);
128
128
  await mkdir(dirname(file), { recursive: true });
129
- await writeFile(`${file}.tmp`, text, { mode: 0o600 });
130
- await rename(`${file}.tmp`, file);
129
+ // A file of its own: another Ta of this agent directory (one starting as one stops) writing
130
+ // the same name at once would have one rename a file the other is halfway through, and the
131
+ // next read of it, unparsed, would leave every other key out.
132
+ const temporary = `${file}.${randomUUID()}.tmp`;
133
+ await writeFile(temporary, text, { mode: 0o600 });
134
+ await rename(temporary, file);
131
135
  for (const listener of this.listeners) {
132
136
  try {
133
137
  listener(name, key, directory);
@@ -18,6 +18,7 @@ export * from './relay-bridge.js';
18
18
  export * from './remote/index.js';
19
19
  export * from './remote-ui-context.js';
20
20
  export * from './rooms-bridge.js';
21
+ export * from './serve-updates.js';
21
22
  export * from './session-catalog.js';
22
23
  export * from './session-files.js';
23
24
  export * from './session-handles.js';
@@ -40,6 +41,7 @@ export * from './temporary-purge.js';
40
41
  export * from './terminal-protocol.js';
41
42
  export * from './terminal-service.js';
42
43
  export * from './terminal-util.js';
44
+ export * from './usage/index.js';
43
45
  export * from './web-extension-catalog.js';
44
46
  export * from './web-extension-util.js';
45
47
  export * from './working-directory.js';
package/esm/node/index.js CHANGED
@@ -18,6 +18,7 @@ export * from './relay-bridge.js';
18
18
  export * from './remote/index.js';
19
19
  export * from './remote-ui-context.js';
20
20
  export * from './rooms-bridge.js';
21
+ export * from './serve-updates.js';
21
22
  export * from './session-catalog.js';
22
23
  export * from './session-files.js';
23
24
  export * from './session-handles.js';
@@ -40,6 +41,7 @@ export * from './temporary-purge.js';
40
41
  export * from './terminal-protocol.js';
41
42
  export * from './terminal-service.js';
42
43
  export * from './terminal-util.js';
44
+ export * from './usage/index.js';
43
45
  export * from './web-extension-catalog.js';
44
46
  export * from './web-extension-util.js';
45
47
  export * from './working-directory.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * A baseline JPEG of opaque RGBA, without a library: YCbCr without subsampling (the letters of a screenshot keep
3
+ * their colour), the tables of the standard scaled to `quality` (1–100, as libjpeg reads it).
4
+ */
5
+ export declare namespace JpegEncoder {
6
+ function encode(rgba: Uint8Array, width: number, height: number, quality?: number): Uint8Array;
7
+ }
@@ -0,0 +1,268 @@
1
+ /** The order of the 64 coefficients of a block as a JPEG writes them, as indices of its rows one after another. */
2
+ const ZIGZAG = [
3
+ 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29,
4
+ 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63,
5
+ ];
6
+ /** The quantization tables of the JPEG standard (Annex K), by rows. */
7
+ const LUMA_QUANT = [
8
+ 16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55, 14, 13, 16, 24, 40, 57, 69, 56, 14, 17, 22, 29, 51, 87, 80, 62, 18, 22, 37, 56, 68, 109,
9
+ 103, 77, 24, 35, 55, 64, 81, 104, 113, 92, 49, 64, 78, 87, 103, 121, 120, 101, 72, 92, 95, 98, 112, 100, 103, 99,
10
+ ];
11
+ const CHROMA_QUANT = [
12
+ 17,
13
+ 18,
14
+ 24,
15
+ 47,
16
+ 99,
17
+ 99,
18
+ 99,
19
+ 99,
20
+ 18,
21
+ 21,
22
+ 26,
23
+ 66,
24
+ 99,
25
+ 99,
26
+ 99,
27
+ 99,
28
+ 24,
29
+ 26,
30
+ 56,
31
+ 99,
32
+ 99,
33
+ 99,
34
+ 99,
35
+ 99,
36
+ 47,
37
+ 66,
38
+ 99,
39
+ 99,
40
+ 99,
41
+ 99,
42
+ 99,
43
+ 99,
44
+ ...new Array(32).fill(99),
45
+ ];
46
+ /** The Huffman tables of the standard: how many codes of each length 1 to 16, then their values. */
47
+ const DC_LUMA = { bits: [0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], values: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] };
48
+ const DC_CHROMA = { bits: [0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0], values: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] };
49
+ const AC_LUMA = {
50
+ bits: [0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d],
51
+ values: [
52
+ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, 0x23,
53
+ 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
54
+ 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x63, 0x64,
55
+ 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94,
56
+ 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2,
57
+ 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8,
58
+ 0xe9, 0xea, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa,
59
+ ],
60
+ };
61
+ const AC_CHROMA = {
62
+ bits: [0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77],
63
+ values: [
64
+ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, 0xa1,
65
+ 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26, 0x27, 0x28,
66
+ 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x63,
67
+ 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92,
68
+ 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
69
+ 0xba, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
70
+ 0xe8, 0xe9, 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa,
71
+ ],
72
+ };
73
+ /** For each value of a table, its code and the length of the code. */
74
+ function codes(table) {
75
+ const code = new Uint16Array(256);
76
+ const length = new Uint8Array(256);
77
+ let next = 0;
78
+ let at = 0;
79
+ for (let size = 1; size <= 16; size++) {
80
+ for (let n = 0; n < table.bits[size - 1]; n++) {
81
+ code[table.values[at]] = next;
82
+ length[table.values[at]] = size;
83
+ next++;
84
+ at++;
85
+ }
86
+ next <<= 1;
87
+ }
88
+ return { code, length };
89
+ }
90
+ /** cos((2x + 1) u π / 16), with the factor of u = 0, for the forward DCT. */
91
+ const COS = (() => {
92
+ const table = new Float64Array(64);
93
+ for (let u = 0; u < 8; u++) {
94
+ for (let x = 0; x < 8; x++) {
95
+ table[u * 8 + x] = Math.cos(((2 * x + 1) * u * Math.PI) / 16) * (u === 0 ? Math.SQRT1_2 : 1);
96
+ }
97
+ }
98
+ return table;
99
+ })();
100
+ class BitWriter {
101
+ constructor() {
102
+ this.bytes = new Uint8Array(64 * 1024);
103
+ this.length = 0;
104
+ this.value = 0;
105
+ this.count = 0;
106
+ }
107
+ byte(byte) {
108
+ if (this.length === this.bytes.length) {
109
+ const larger = new Uint8Array(this.bytes.length * 2);
110
+ larger.set(this.bytes);
111
+ this.bytes = larger;
112
+ }
113
+ this.bytes[this.length++] = byte;
114
+ }
115
+ raw(bytes) {
116
+ for (const byte of bytes) {
117
+ this.byte(byte);
118
+ }
119
+ }
120
+ bits(value, count) {
121
+ for (let i = count - 1; i >= 0; i--) {
122
+ this.value = (this.value << 1) | ((value >> i) & 1);
123
+ if (++this.count === 8) {
124
+ this.byte(this.value);
125
+ // A 0xFF of the data is followed by a 0, so that it is not taken for a marker.
126
+ if (this.value === 0xff) {
127
+ this.byte(0);
128
+ }
129
+ this.value = 0;
130
+ this.count = 0;
131
+ }
132
+ }
133
+ }
134
+ /** The last bits, padded with ones. */
135
+ flush() {
136
+ if (this.count > 0) {
137
+ this.bits((1 << (8 - this.count)) - 1, 8 - this.count);
138
+ }
139
+ }
140
+ done() {
141
+ return this.bytes.slice(0, this.length);
142
+ }
143
+ }
144
+ /**
145
+ * A baseline JPEG of opaque RGBA, without a library: YCbCr without subsampling (the letters of a screenshot keep
146
+ * their colour), the tables of the standard scaled to `quality` (1–100, as libjpeg reads it).
147
+ */
148
+ export var JpegEncoder;
149
+ (function (JpegEncoder) {
150
+ function encode(rgba, width, height, quality = 80) {
151
+ const scale = quality < 50 ? 5000 / quality : 200 - quality * 2;
152
+ const quant = (base) => base.map(value => Math.min(255, Math.max(1, Math.floor((value * scale + 50) / 100))));
153
+ const luma = quant(LUMA_QUANT);
154
+ const chroma = quant(CHROMA_QUANT);
155
+ const out = new BitWriter();
156
+ out.raw([0xff, 0xd8]);
157
+ // JFIF, version 1.1, no density.
158
+ out.raw([0xff, 0xe0, 0, 16, 0x4a, 0x46, 0x49, 0x46, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0]);
159
+ for (const [id, table] of [luma, chroma].entries()) {
160
+ out.raw([0xff, 0xdb, 0, 67, id, ...ZIGZAG.map(index => table[index])]);
161
+ }
162
+ out.raw([0xff, 0xc0, 0, 17, 8, height >> 8, height & 255, width >> 8, width & 255, 3, 1, 0x11, 0, 2, 0x11, 1, 3, 0x11, 1]);
163
+ for (const [klass, table] of [
164
+ [0x00, DC_LUMA],
165
+ [0x10, AC_LUMA],
166
+ [0x01, DC_CHROMA],
167
+ [0x11, AC_CHROMA],
168
+ ]) {
169
+ out.raw([0xff, 0xc4, (19 + table.values.length) >> 8, (19 + table.values.length) & 255, klass, ...table.bits, ...table.values]);
170
+ }
171
+ out.raw([0xff, 0xda, 0, 12, 3, 1, 0x00, 2, 0x11, 3, 0x11, 0, 63, 0]);
172
+ const tables = [
173
+ { quant: luma, dc: codes(DC_LUMA), ac: codes(AC_LUMA) },
174
+ { quant: chroma, dc: codes(DC_CHROMA), ac: codes(AC_CHROMA) },
175
+ { quant: chroma, dc: codes(DC_CHROMA), ac: codes(AC_CHROMA) },
176
+ ];
177
+ const previous = [0, 0, 0];
178
+ const planes = [new Float64Array(64), new Float64Array(64), new Float64Array(64)];
179
+ const coefficients = new Int32Array(64);
180
+ const rows = new Float64Array(64);
181
+ for (let top = 0; top < height; top += 8) {
182
+ for (let left = 0; left < width; left += 8) {
183
+ for (let y = 0; y < 8; y++) {
184
+ const row = Math.min(height - 1, top + y) * width;
185
+ for (let x = 0; x < 8; x++) {
186
+ const at = (row + Math.min(width - 1, left + x)) * 4;
187
+ const r = rgba[at];
188
+ const g = rgba[at + 1];
189
+ const b = rgba[at + 2];
190
+ planes[0][y * 8 + x] = 0.299 * r + 0.587 * g + 0.114 * b - 128;
191
+ planes[1][y * 8 + x] = -0.168736 * r - 0.331264 * g + 0.5 * b;
192
+ planes[2][y * 8 + x] = 0.5 * r - 0.418688 * g - 0.081312 * b;
193
+ }
194
+ }
195
+ for (let component = 0; component < 3; component++) {
196
+ const table = tables[component];
197
+ dct(planes[component], rows, coefficients, table.quant);
198
+ previous[component] = block(out, coefficients, previous[component], table.dc, table.ac);
199
+ }
200
+ }
201
+ }
202
+ out.flush();
203
+ out.raw([0xff, 0xd9]);
204
+ return out.done();
205
+ }
206
+ JpegEncoder.encode = encode;
207
+ /** The coefficients of a block of 8 × 8, quantized, in the order of the zigzag. */
208
+ function dct(block, rows, out, quant) {
209
+ for (let y = 0; y < 8; y++) {
210
+ for (let u = 0; u < 8; u++) {
211
+ let sum = 0;
212
+ for (let x = 0; x < 8; x++) {
213
+ sum += block[y * 8 + x] * COS[u * 8 + x];
214
+ }
215
+ rows[y * 8 + u] = sum;
216
+ }
217
+ }
218
+ for (let k = 0; k < 64; k++) {
219
+ const index = ZIGZAG[k];
220
+ const v = index >> 3;
221
+ const u = index & 7;
222
+ let sum = 0;
223
+ for (let y = 0; y < 8; y++) {
224
+ sum += rows[y * 8 + u] * COS[v * 8 + y];
225
+ }
226
+ out[k] = Math.round(sum / 4 / quant[index]);
227
+ }
228
+ }
229
+ /** One block written with its tables; the DC of it, which the next of its component is written from. */
230
+ function block(out, coefficients, previous, dc, ac) {
231
+ const diff = coefficients[0] - previous;
232
+ const size = category(diff);
233
+ out.bits(dc.code[size], dc.length[size]);
234
+ out.bits(magnitude(diff, size), size);
235
+ let run = 0;
236
+ for (let k = 1; k < 64; k++) {
237
+ const value = coefficients[k];
238
+ if (value === 0) {
239
+ run++;
240
+ continue;
241
+ }
242
+ while (run > 15) {
243
+ out.bits(ac.code[0xf0], ac.length[0xf0]);
244
+ run -= 16;
245
+ }
246
+ const bits = category(value);
247
+ const symbol = (run << 4) | bits;
248
+ out.bits(ac.code[symbol], ac.length[symbol]);
249
+ out.bits(magnitude(value, bits), bits);
250
+ run = 0;
251
+ }
252
+ if (run > 0) {
253
+ out.bits(ac.code[0], ac.length[0]);
254
+ }
255
+ return coefficients[0];
256
+ }
257
+ function category(value) {
258
+ let size = 0;
259
+ for (let magnitude = Math.abs(value); magnitude > 0; magnitude >>= 1) {
260
+ size++;
261
+ }
262
+ return size;
263
+ }
264
+ function magnitude(value, size) {
265
+ return value < 0 ? value + (1 << size) - 1 : value;
266
+ }
267
+ })(JpegEncoder || (JpegEncoder = {}));
268
+ //# sourceMappingURL=jpeg-encoder.js.map
@@ -0,0 +1,40 @@
1
+ /** How a picture fits the box it is made for: all of it in the box, or the box filled (the page cuts what is over). */
2
+ export type ThumbnailFit = 'contain' | 'cover';
3
+ /** The box a smaller picture is asked for, in pixels of the device. */
4
+ export interface ThumbnailBox {
5
+ width: number;
6
+ height: number;
7
+ fit: ThumbnailFit;
8
+ }
9
+ /**
10
+ * A smaller picture of a PNG, made without a library: the image read (any color type, 8 or 16 bits, a palette of 1 to 8,
11
+ * not interlaced), averaged down to the box (alpha weighted, so edges keep their colour) and written again, RGB when
12
+ * it is opaque. It yields to the event loop as it reads. Undefined for what it does not read, and for a picture already
13
+ * near the size of the box: then the picture itself is sent.
14
+ */
15
+ export declare namespace PngThumbnail {
16
+ function isPng(bytes: Uint8Array): boolean;
17
+ /** The size a picture of `width` × `height` takes for `box`, never larger than it is. */
18
+ function size(width: number, height: number, box: ThumbnailBox): {
19
+ width: number;
20
+ height: number;
21
+ };
22
+ /**
23
+ * The smaller picture: a PNG, or a JPEG when the picture is opaque and of a photo (its PNG large for its pixels)
24
+ * and the JPEG is smaller.
25
+ */
26
+ function make(bytes: Uint8Array, box: ThumbnailBox): Promise<{
27
+ bytes: Uint8Array;
28
+ type: 'image/png' | 'image/jpeg';
29
+ } | undefined>;
30
+ /** The pixels of a PNG as RGBA, as `make` reads them; undefined for one it does not read. */
31
+ function read(bytes: Uint8Array): Promise<{
32
+ width: number;
33
+ height: number;
34
+ rgba: Uint8Array;
35
+ } | undefined>;
36
+ /** RGBA written as a PNG: RGB when every pixel is opaque, each row with the filter that leaves the smallest sums. */
37
+ function encode(rgba: Uint8Array, width: number, height: number): Uint8Array;
38
+ /** A PNG of these chunks, each with its length and CRC. */
39
+ function chunked(parts: readonly [string, Uint8Array][]): Uint8Array;
40
+ }