@jigging/jig 0.1.0-alpha.2 → 0.1.0-alpha.6
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 +59 -14
- package/THIRD_PARTY_NOTICES +50 -0
- package/dist/index.js +22 -2
- package/dist/project/author.d.ts +2 -0
- package/libexec/agent/claude-agent-acp.LICENSE +191 -0
- package/libexec/agent/claude-agent-acp.js +71361 -0
- package/libexec/agent/claude-agent-launcher.js +53 -0
- package/libexec/agent/claude-agent-sdk.LICENSE +1 -0
- package/libexec/agent/codex-acp.LICENSE +190 -0
- package/libexec/agent/codex-acp.js +34238 -0
- package/libexec/agent/codex-agent-launcher.js +54 -0
- package/libexec/agent/codex-requirements.toml +5 -0
- package/libexec/agent/openai-responses-worker.js +14382 -0
- package/libexec/agent/openai.LICENSE +201 -0
- package/libexec/agent/pi-acp.LICENSE +21 -0
- package/libexec/agent/pi-acp.js +16468 -0
- package/libexec/agent/pi-agent-launcher.js +196 -0
- package/libexec/evaluator/project-authoring-1.schema.json +9 -1
- package/libexec/evaluator/project-evaluator-sdk.bundle.js +22 -2
- package/libexec/installed-cli.js +46312 -11310
- package/libexec/linux-rootless-supervisor.js +4 -5
- package/package.json +22 -3
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/internal/codex-agent-launcher.ts
|
|
3
|
+
import { closeSync, mkdirSync, openSync, readSync, writeSync } from "fs";
|
|
4
|
+
var STARTUP_INPUT_BYTES = 64 * 1024;
|
|
5
|
+
var CODEX_HOME = "/tmp/codex-home";
|
|
6
|
+
var CREDENTIAL_PATH = `${CODEX_HOME}/auth.json`;
|
|
7
|
+
var ADAPTER_SPECIFIER = "./codex-acp.js";
|
|
8
|
+
if (import.meta.main)
|
|
9
|
+
await main();
|
|
10
|
+
async function main() {
|
|
11
|
+
mkdirSync(CODEX_HOME, { mode: 448 });
|
|
12
|
+
const startup = process.env.JIG_CODEX_STARTUP_INPUT;
|
|
13
|
+
if (startup !== undefined && startup !== "subscription") {
|
|
14
|
+
throw new Error("Codex startup input mode is invalid");
|
|
15
|
+
}
|
|
16
|
+
if (startup === "subscription")
|
|
17
|
+
materializeCredential();
|
|
18
|
+
delete process.env.JIG_CODEX_STARTUP_INPUT;
|
|
19
|
+
await import(ADAPTER_SPECIFIER);
|
|
20
|
+
}
|
|
21
|
+
function materializeCredential() {
|
|
22
|
+
const header = readExactly(4);
|
|
23
|
+
const size = new DataView(header.buffer, header.byteOffset, header.byteLength).getUint32(0, false);
|
|
24
|
+
if (size === 0 || size > STARTUP_INPUT_BYTES - 4) {
|
|
25
|
+
throw new Error("Codex startup input is invalid");
|
|
26
|
+
}
|
|
27
|
+
const credential = readExactly(size);
|
|
28
|
+
let descriptor;
|
|
29
|
+
try {
|
|
30
|
+
descriptor = openSync(CREDENTIAL_PATH, "wx", 384);
|
|
31
|
+
writeExactly(descriptor, credential);
|
|
32
|
+
} finally {
|
|
33
|
+
credential.fill(0);
|
|
34
|
+
if (descriptor !== undefined)
|
|
35
|
+
closeSync(descriptor);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function readExactly(size) {
|
|
39
|
+
const result = new Uint8Array(size);
|
|
40
|
+
let offset = 0;
|
|
41
|
+
while (offset < result.byteLength) {
|
|
42
|
+
const count = readSync(0, result, offset, result.byteLength - offset, null);
|
|
43
|
+
if (count === 0)
|
|
44
|
+
throw new Error("Codex startup input ended early");
|
|
45
|
+
offset += count;
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
function writeExactly(descriptor, value) {
|
|
50
|
+
let offset = 0;
|
|
51
|
+
while (offset < value.byteLength) {
|
|
52
|
+
offset += writeSync(descriptor, value, offset, value.byteLength - offset, null);
|
|
53
|
+
}
|
|
54
|
+
}
|