opencode-devin 0.2.1 → 0.2.3
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/README.md +28 -0
- package/dist/catalog.d.ts +11 -0
- package/dist/catalog.js +72 -8
- package/dist/index.js +2 -2
- package/dist/protocol/model.d.ts +15 -7
- package/dist/protocol/model.js +166 -65
- package/package.json +5 -4
- package/dist/auth/browser.d.ts +0 -7
- package/dist/auth/browser.js +0 -18
- package/dist/auth/exchange.d.ts +0 -15
- package/dist/auth/exchange.js +0 -43
- package/dist/auth/login.d.ts +0 -15
- package/dist/auth/login.js +0 -51
- package/dist/auth/loopback.d.ts +0 -15
- package/dist/auth/loopback.js +0 -93
- package/dist/auth/pkce.d.ts +0 -11
- package/dist/auth/pkce.js +0 -27
- package/dist/auth/url.d.ts +0 -12
- package/dist/auth/url.js +0 -17
- package/dist/protocol/auth.d.ts +0 -26
- package/dist/protocol/auth.js +0 -119
- package/dist/protocol/catalog.d.ts +0 -62
- package/dist/protocol/catalog.js +0 -205
- package/dist/protocol/chat.d.ts +0 -92
- package/dist/protocol/chat.js +0 -496
- package/dist/protocol/effort.d.ts +0 -20
- package/dist/protocol/effort.js +0 -31
- package/dist/protocol/metadata.d.ts +0 -17
- package/dist/protocol/metadata.js +0 -42
- package/dist/protocol/wire.d.ts +0 -30
- package/dist/protocol/wire.js +0 -114
package/dist/protocol/wire.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Protobuf wire-format encoding and Connect-RPC streaming envelope.
|
|
3
|
-
*
|
|
4
|
-
* Connect-RPC streaming frame layout (HTTPS POST body):
|
|
5
|
-
*
|
|
6
|
-
* flags 1 byte | length 4 bytes BE | payload
|
|
7
|
-
*
|
|
8
|
-
* - flags bit 0x01: payload is gzip-compressed
|
|
9
|
-
* - flags bit 0x02: end-of-stream trailer frame (JSON `{error}` or empty)
|
|
10
|
-
*
|
|
11
|
-
* Protocol reverse-engineered from the Windsurf language_server and the Devin
|
|
12
|
-
* CLI; originally ported from pi-devin-auth (MIT, Copyright (c) 2026 nmzpy).
|
|
13
|
-
*/
|
|
14
|
-
import * as zlib from "node:zlib";
|
|
15
|
-
export function encodeVarint(value) {
|
|
16
|
-
let v = BigInt(value);
|
|
17
|
-
if (v < 0n)
|
|
18
|
-
throw new RangeError(`encodeVarint: negative input not supported (got ${value})`);
|
|
19
|
-
const bytes = [];
|
|
20
|
-
while (v > 0x7fn) {
|
|
21
|
-
bytes.push(Number(v & 0x7fn) | 0x80);
|
|
22
|
-
v >>= 7n;
|
|
23
|
-
}
|
|
24
|
-
bytes.push(Number(v));
|
|
25
|
-
return Buffer.from(bytes);
|
|
26
|
-
}
|
|
27
|
-
export function encodeTag(fieldNum, wire) {
|
|
28
|
-
return encodeVarint((fieldNum << 3) | wire);
|
|
29
|
-
}
|
|
30
|
-
export function encodeString(fieldNum, value) {
|
|
31
|
-
const buf = Buffer.from(value, "utf8");
|
|
32
|
-
return Buffer.concat([encodeTag(fieldNum, 2), encodeVarint(buf.length), buf]);
|
|
33
|
-
}
|
|
34
|
-
export function encodeMessage(fieldNum, body) {
|
|
35
|
-
return Buffer.concat([encodeTag(fieldNum, 2), encodeVarint(body.length), body]);
|
|
36
|
-
}
|
|
37
|
-
export function encodeVarintField(fieldNum, value) {
|
|
38
|
-
return Buffer.concat([encodeTag(fieldNum, 0), encodeVarint(value)]);
|
|
39
|
-
}
|
|
40
|
-
export function encodeTimestampBody() {
|
|
41
|
-
const now = Date.now();
|
|
42
|
-
const seconds = Math.floor(now / 1000);
|
|
43
|
-
const nanos = (now % 1000) * 1_000_000;
|
|
44
|
-
return Buffer.concat([
|
|
45
|
-
encodeVarintField(1, seconds),
|
|
46
|
-
nanos > 0 ? encodeVarintField(2, nanos) : Buffer.alloc(0),
|
|
47
|
-
]);
|
|
48
|
-
}
|
|
49
|
-
export function decodeVarint(buf, offset) {
|
|
50
|
-
let result = 0n;
|
|
51
|
-
let shift = 0n;
|
|
52
|
-
let i = offset;
|
|
53
|
-
while (i < buf.length) {
|
|
54
|
-
const byte = buf[i++];
|
|
55
|
-
result |= BigInt(byte & 0x7f) << shift;
|
|
56
|
-
if (!(byte & 0x80))
|
|
57
|
-
return [result, i];
|
|
58
|
-
shift += 7n;
|
|
59
|
-
}
|
|
60
|
-
throw new Error("truncated varint");
|
|
61
|
-
}
|
|
62
|
-
/** Iterate the protobuf fields of a message in wire order. */
|
|
63
|
-
export function* iterFields(buf) {
|
|
64
|
-
let i = 0;
|
|
65
|
-
while (i < buf.length) {
|
|
66
|
-
const [tagBig, afterTag] = decodeVarint(buf, i);
|
|
67
|
-
i = afterTag;
|
|
68
|
-
const tag = Number(tagBig);
|
|
69
|
-
const num = tag >> 3;
|
|
70
|
-
const wire = (tag & 0x7);
|
|
71
|
-
if (wire === 0) {
|
|
72
|
-
const [value, afterValue] = decodeVarint(buf, i);
|
|
73
|
-
i = afterValue;
|
|
74
|
-
yield { num, wire, value };
|
|
75
|
-
}
|
|
76
|
-
else if (wire === 1) {
|
|
77
|
-
if (i + 8 > buf.length)
|
|
78
|
-
return;
|
|
79
|
-
yield { num, wire, value: buf.slice(i, i + 8) };
|
|
80
|
-
i += 8;
|
|
81
|
-
}
|
|
82
|
-
else if (wire === 2) {
|
|
83
|
-
const [lengthBig, afterLength] = decodeVarint(buf, i);
|
|
84
|
-
i = afterLength;
|
|
85
|
-
const length = Number(lengthBig);
|
|
86
|
-
if (length < 0 || i + length > buf.length)
|
|
87
|
-
return;
|
|
88
|
-
yield { num, wire, value: buf.slice(i, i + length) };
|
|
89
|
-
i += length;
|
|
90
|
-
}
|
|
91
|
-
else if (wire === 5) {
|
|
92
|
-
if (i + 4 > buf.length)
|
|
93
|
-
return;
|
|
94
|
-
yield { num, wire, value: buf.slice(i, i + 4) };
|
|
95
|
-
i += 4;
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
/** Wrap a protobuf message into a Connect-RPC streaming request frame. */
|
|
103
|
-
export function frameConnectStream(body, compress = true) {
|
|
104
|
-
let payload = body;
|
|
105
|
-
let flags = 0;
|
|
106
|
-
if (compress) {
|
|
107
|
-
payload = zlib.gzipSync(body);
|
|
108
|
-
flags |= 0x01;
|
|
109
|
-
}
|
|
110
|
-
const header = Buffer.alloc(5);
|
|
111
|
-
header[0] = flags;
|
|
112
|
-
header.writeUInt32BE(payload.length, 1);
|
|
113
|
-
return Buffer.concat([header, payload]);
|
|
114
|
-
}
|