optimus-tool-call 0.2.19 → 0.2.20
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/dist/lib/tofu.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Tofu shim — centralises all imports from optimus-tofu.
|
|
3
3
|
*
|
|
4
4
|
* Reads ~/opt-ai-sec/management/optimus_dev.env at startup:
|
|
5
|
-
* - No file / unreadable →
|
|
6
|
-
* - File present → environment= line in file, then OPTIMUS_ENVIRONMENT, then
|
|
5
|
+
* - No file / unreadable → production (ignores OPTIMUS_ENVIRONMENT).
|
|
6
|
+
* - File present → environment= line in file, then OPTIMUS_ENVIRONMENT, then production.
|
|
7
7
|
* - environment=development → loads local dist (file-relative path)
|
|
8
8
|
* - anything else → loads the published npm package
|
|
9
9
|
*
|
package/dist/lib/tofu.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Tofu shim — centralises all imports from optimus-tofu.
|
|
3
3
|
*
|
|
4
4
|
* Reads ~/opt-ai-sec/management/optimus_dev.env at startup:
|
|
5
|
-
* - No file / unreadable →
|
|
6
|
-
* - File present → environment= line in file, then OPTIMUS_ENVIRONMENT, then
|
|
5
|
+
* - No file / unreadable → production (ignores OPTIMUS_ENVIRONMENT).
|
|
6
|
+
* - File present → environment= line in file, then OPTIMUS_ENVIRONMENT, then production.
|
|
7
7
|
* - environment=development → loads local dist (file-relative path)
|
|
8
8
|
* - anything else → loads the published npm package
|
|
9
9
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup-sync.test.d.ts","sourceRoot":"","sources":["../../src/test/startup-sync.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { test, beforeEach, after } from "node:test";
|
|
2
|
+
import assert from "node:assert";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import os from "os";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import { ensureStartupMetadataSynced } from "../lib/startup-sync.js";
|
|
7
|
+
const tmpDir = path.join(os.tmpdir(), `optimus-startup-sync-${process.pid}`);
|
|
8
|
+
const orgUuid = "55555555-5555-5555-5555-555555555555";
|
|
9
|
+
const originalFetch = globalThis.fetch;
|
|
10
|
+
let capturedBody = null;
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
13
|
+
fs.mkdirSync(path.join(tmpDir, "opt-ai-sec", "management"), { recursive: true });
|
|
14
|
+
fs.writeFileSync(path.join(tmpDir, "opt-ai-sec", "management", "organization-uuid.txt"), `${orgUuid}\n`);
|
|
15
|
+
process.env.HOME = tmpDir;
|
|
16
|
+
process.env.OPTIMUS_ENDPOINT = "https://optimus.test/";
|
|
17
|
+
process.env.OPTIMUS_STARTUP_SYNC_INTERVAL_MS = "0";
|
|
18
|
+
process.env.OPTIMUS_USER_PROFILE_JSON = JSON.stringify({
|
|
19
|
+
generateduuid: "profile-id",
|
|
20
|
+
machineuuid: "hw-startup-sync",
|
|
21
|
+
mac_username: "alice",
|
|
22
|
+
github_username: "",
|
|
23
|
+
claude_email: "",
|
|
24
|
+
cursor_email: "",
|
|
25
|
+
});
|
|
26
|
+
delete process.env.OPTIMUS_ORGANIZATION_UUID;
|
|
27
|
+
capturedBody = null;
|
|
28
|
+
globalThis.fetch = (async (_url, init) => {
|
|
29
|
+
capturedBody = JSON.parse(String(init?.body || "{}"));
|
|
30
|
+
return new Response(JSON.stringify({ status: "accepted" }), {
|
|
31
|
+
status: 200,
|
|
32
|
+
headers: { "Content-Type": "application/json" },
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
after(() => {
|
|
37
|
+
globalThis.fetch = originalFetch;
|
|
38
|
+
delete process.env.OPTIMUS_ENDPOINT;
|
|
39
|
+
delete process.env.OPTIMUS_STARTUP_SYNC_INTERVAL_MS;
|
|
40
|
+
delete process.env.OPTIMUS_USER_PROFILE_JSON;
|
|
41
|
+
delete process.env.OPTIMUS_ORGANIZATION_UUID;
|
|
42
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
43
|
+
});
|
|
44
|
+
test("startup metadata sync sends organization_uuid from management file", async () => {
|
|
45
|
+
await ensureStartupMetadataSynced("hw-startup-sync");
|
|
46
|
+
assert.ok(capturedBody, "startup request should be posted");
|
|
47
|
+
const metadata = capturedBody.metadata;
|
|
48
|
+
assert.strictEqual(metadata.organization_uuid, orgUuid);
|
|
49
|
+
});
|
|
50
|
+
test("OPTIMUS_ORGANIZATION_UUID overrides management file", async () => {
|
|
51
|
+
process.env.OPTIMUS_ORGANIZATION_UUID = "66666666-6666-6666-6666-666666666666";
|
|
52
|
+
await ensureStartupMetadataSynced("hw-startup-sync");
|
|
53
|
+
assert.ok(capturedBody, "startup request should be posted");
|
|
54
|
+
const metadata = capturedBody.metadata;
|
|
55
|
+
assert.strictEqual(metadata.organization_uuid, "66666666-6666-6666-6666-666666666666");
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=startup-sync.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup-sync.test.js","sourceRoot":"","sources":["../../src/test/startup-sync.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,wBAAwB,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAC7E,MAAM,OAAO,GAAG,sCAAsC,CAAC;AACvD,MAAM,aAAa,GAAG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zF,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.20",
|
|
4
4
|
"description": "Agentic audit sensor — streams raw tool call metadata; the Optimus backend classifies on ingest",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -46,6 +46,6 @@
|
|
|
46
46
|
"typescript": "^5.0.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"optimus-tofu": "^0.1.
|
|
49
|
+
"optimus-tofu": "^0.1.17"
|
|
50
50
|
}
|
|
51
51
|
}
|