optimus-tool-call 0.2.11 → 0.2.12
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.
|
@@ -3,12 +3,20 @@ import assert from "node:assert";
|
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import os from "node:os";
|
|
5
5
|
import path from "node:path";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
// Test sibling workspace optimus-tofu directly — the lib re-export may resolve to npm
|
|
7
|
+
// when management optimus_dev.env is not environment=development.
|
|
8
|
+
import { loadEndpointBase } from "../../../optimus-tofu/dist/endpoint-config.js";
|
|
9
|
+
test("loadEndpointBase - uses default when no env and no management file", () => {
|
|
8
10
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), "optimus-tool-call-default-"));
|
|
9
|
-
const
|
|
11
|
+
const fakeHome = fs.mkdtempSync(path.join(os.tmpdir(), "optimus-tool-call-home-empty-"));
|
|
12
|
+
const base = loadEndpointBase({
|
|
13
|
+
cwd: root,
|
|
14
|
+
// Do not spread process.env — developer/Cursor may set OPTIMUS_ENDPOINT.
|
|
15
|
+
env: { HOME: fakeHome },
|
|
16
|
+
});
|
|
10
17
|
assert.strictEqual(base, "https://app.optimuslabs.io/");
|
|
11
18
|
fs.rmSync(root, { recursive: true, force: true });
|
|
19
|
+
fs.rmSync(fakeHome, { recursive: true, force: true });
|
|
12
20
|
});
|
|
13
21
|
test("loadEndpointBase - OPTIMUS_ENDPOINT env overrides file/default", () => {
|
|
14
22
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), "optimus-tool-call-endpoint-env-"));
|
|
@@ -31,13 +39,21 @@ test("loadEndpointBase - OPTIMUS_API_URL env takes precedence", () => {
|
|
|
31
39
|
assert.strictEqual(base, "http://localhost:8080/");
|
|
32
40
|
fs.rmSync(root, { recursive: true, force: true });
|
|
33
41
|
});
|
|
34
|
-
test("loadEndpointBase - reads OPTIMUS_ENDPOINT from optimus_dev.env
|
|
42
|
+
test("loadEndpointBase - reads OPTIMUS_ENDPOINT from management optimus_dev.env (not cwd)", () => {
|
|
35
43
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), "optimus-tool-call-env-file-"));
|
|
44
|
+
const fakeHome = fs.mkdtempSync(path.join(os.tmpdir(), "optimus-tool-call-home-"));
|
|
45
|
+
const mgmt = path.join(fakeHome, "opt-ai-sec", "management");
|
|
46
|
+
fs.mkdirSync(mgmt, { recursive: true });
|
|
47
|
+
fs.writeFileSync(path.join(mgmt, "optimus_dev.env"), "OPTIMUS_ENDPOINT=https://app.optimuslabs.io\n");
|
|
36
48
|
const nested = path.join(root, "a", "b", "c");
|
|
37
49
|
fs.mkdirSync(nested, { recursive: true });
|
|
38
|
-
fs.writeFileSync(path.join(root, "optimus_dev.env"), "OPTIMUS_ENDPOINT=https://
|
|
39
|
-
const base = loadEndpointBase({
|
|
50
|
+
fs.writeFileSync(path.join(root, "optimus_dev.env"), "OPTIMUS_ENDPOINT=https://wrong-from-cwd.example/\n");
|
|
51
|
+
const base = loadEndpointBase({
|
|
52
|
+
cwd: nested,
|
|
53
|
+
env: { HOME: fakeHome },
|
|
54
|
+
});
|
|
40
55
|
assert.strictEqual(base, "https://app.optimuslabs.io/");
|
|
41
56
|
fs.rmSync(root, { recursive: true, force: true });
|
|
57
|
+
fs.rmSync(fakeHome, { recursive: true, force: true });
|
|
42
58
|
});
|
|
43
59
|
//# sourceMappingURL=endpoint-config.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-config.test.js","sourceRoot":"","sources":["../../src/test/endpoint-config.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|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I,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IAC7D,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACxC,EAAE,CAAC,aAAa,CACd,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,iBAAiB,CAAC,EAClC,+CAA+C,CAChD,CAAC;IACF,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAC9C,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,EAAE,CAAC,aAAa,CACd,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,iBAAiB,CAAC,EAClC,oDAAoD,CACrD,CAAC;IAEF,MAAM,IAAI,GAAG,gBAAgB,CAAC;QAC5B,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACxB,CAAC,CAAC;IACH,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,6BAA6B,CAAC,CAAC;IACxD,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACxD,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "optimus-tool-call",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "Agentic audit sensor — streams raw tool call metadata; the Optimus backend classifies on ingest",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "rm -rf dist && tsc && node ../../scripts/ensure-bin-executable.mjs",
|
|
13
13
|
"dev": "tsx src/index.ts",
|
|
14
|
+
"pretest": "npm run build --prefix ../optimus-tofu && npm run build",
|
|
14
15
|
"test": "node --test dist/test/*.test.js",
|
|
15
16
|
"prepare": "npm run build"
|
|
16
17
|
},
|
|
@@ -45,6 +46,6 @@
|
|
|
45
46
|
"typescript": "^5.0.0"
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|
|
48
|
-
"optimus-tofu": "^0.1.
|
|
49
|
+
"optimus-tofu": "^0.1.14"
|
|
49
50
|
}
|
|
50
51
|
}
|