@sema-agent/connectors 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +75 -0
- package/INTEGRATION.md +2 -1
- package/dist/cli-kit.d.ts +1 -1
- package/dist/cli-kit.js +18 -10
- package/dist/host-url.d.ts +8 -0
- package/dist/host-url.js +19 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/launcher.js +3 -3
- package/dist/pinned-upstream.d.ts +2 -0
- package/dist/pinned-upstream.js +346 -85
- package/dist/principal.d.ts +1 -1
- package/dist/principal.js +5 -2
- package/dist/release-archive.d.ts +22 -0
- package/dist/release-archive.js +462 -10
- package/dist/secrets.d.ts +9 -0
- package/dist/secrets.js +66 -4
- package/dist/write-all.d.ts +2 -0
- package/dist/write-all.js +36 -6
- package/package.json +1 -1
package/dist/write-all.js
CHANGED
|
@@ -1,17 +1,47 @@
|
|
|
1
1
|
import { fstatSync, fsyncSync, writeSync } from 'node:fs';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { Writable } from 'node:stream';
|
|
3
|
+
function writeAllAt(fd, bytes, position) {
|
|
4
4
|
let written = 0;
|
|
5
5
|
while (written < bytes.length) {
|
|
6
|
-
const n = writeSync(fd, bytes, written, bytes.length - written, written);
|
|
6
|
+
const n = writeSync(fd, bytes, written, bytes.length - written, position + written);
|
|
7
7
|
if (n <= 0)
|
|
8
8
|
throw new Error(`a write stopped after ${written} of ${bytes.length} bytes`);
|
|
9
9
|
written += n;
|
|
10
10
|
}
|
|
11
|
+
return position + written;
|
|
12
|
+
}
|
|
13
|
+
function finished(fd, size) {
|
|
11
14
|
fsyncSync(fd);
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
throw new Error(`the file holds ${
|
|
15
|
+
const held = fstatSync(fd).size;
|
|
16
|
+
if (held !== size)
|
|
17
|
+
throw new Error(`the file holds ${held} bytes after a write of ${size}`);
|
|
18
|
+
}
|
|
19
|
+
export function writeAll(fd, data) {
|
|
20
|
+
const bytes = typeof data === 'string' ? Buffer.from(data, 'utf8') : data;
|
|
21
|
+
finished(fd, writeAllAt(fd, bytes, 0));
|
|
22
|
+
}
|
|
23
|
+
export function writeAllStream(fd) {
|
|
24
|
+
let position = 0;
|
|
25
|
+
return new Writable({
|
|
26
|
+
write(piece, _encoding, done) {
|
|
27
|
+
try {
|
|
28
|
+
position = writeAllAt(fd, piece, position);
|
|
29
|
+
done();
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
done(e);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
final(done) {
|
|
36
|
+
try {
|
|
37
|
+
finished(fd, position);
|
|
38
|
+
done();
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
done(e);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
});
|
|
15
45
|
}
|
|
16
46
|
export function writeFailure(e) {
|
|
17
47
|
const code = e?.code;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/connectors",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Shared connector layer and the sema-connector launcher (MCP stdio proxy with principal, scope, normalize, status and trace stages).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|