@infersec/conduit 1.5.0 → 1.5.2

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 CHANGED
@@ -5,25 +5,36 @@ Conduit agent for connecting local LLMs to the Infersec cloud.
5
5
  ## Usage
6
6
 
7
7
  ```bash
8
- npx @infersec/conduit --source <source-id> --key <api-key>
8
+ npx @infersec/conduit --engine <type> --key <api-key> --source <source-id>
9
9
  ```
10
10
 
11
- Optional flags:
11
+ ### Flags
12
12
 
13
- ```bash
14
- --api-url <url> API base URL
15
- --engine <type> Engine type
16
- --port <number> Port to listen on
17
- --root <path> Root directory
18
- ```
13
+ | Flag | Required | Default | Notes |
14
+ | ----------- | -------- | ------------------------------ | ------------------------------------------ |
15
+ | `--engine` | Yes | - | Engine type (matches `ENGINE`). |
16
+ | `--key` | Yes | - | API key (matches `API_KEY`). |
17
+ | `--source` | Yes | - | Inference source ID (matches `SOURCE`). |
18
+ | `--api-url` | No | `https://api.infersec.ai` | API base URL (matches `API_URL`). |
19
+ | `--port` | No | `9505` | Port to listen on (matches `PORT`). |
20
+ | `--root` | No | `$HOME/.cache/infersec/iagent` | Root directory (matches `ROOT_DIRECTORY`). |
21
+
22
+ ### Examples
23
+
24
+ | Scenario | Command |
25
+ | ---------------- | ------------------------------------------------------------------------------------------------------------ |
26
+ | Required only | `npx @infersec/conduit --engine vllm --key <api-key> --source <source-id>` |
27
+ | Custom root/port | `npx @infersec/conduit --engine vllm --key <api-key> --source <source-id> --root /data/infersec --port 9506` |
19
28
 
20
29
  ## Environment variables
21
30
 
22
- - AGENT_ENGINE_TYPE
23
- - API_KEY
24
- - API_URL
25
- - INFERENCE_SOURCE_ID
26
- - PORT
27
- - ROOT_DIRECTORY
31
+ | Variable | Required | Default | Notes |
32
+ | ---------------- | -------- | ------------------------------ | ----------------------------------------- |
33
+ | `ENGINE` | Yes | - | Engine type (matches `--engine`). |
34
+ | `API_KEY` | Yes | - | API key (matches `--key`). |
35
+ | `SOURCE` | Yes | - | Inference source ID (matches `--source`). |
36
+ | `API_URL` | No | `https://api.infersec.ai` | API base URL (matches `--api-url`). |
37
+ | `PORT` | No | `9505` | Port to listen on (matches `--port`). |
38
+ | `ROOT_DIRECTORY` | No | `$HOME/.cache/infersec/iagent` | Root directory (matches `--root`). |
28
39
 
29
40
  CLI flags override environment variables when both are provided.
package/dist/cli.js CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { fileURLToPath as __fileURLToPath } from 'url';
3
- import { dirname } from 'path';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
4
  const __filename = __fileURLToPath(import.meta.url);
5
- const __dirname = dirname(__filename);
5
+ const __dirname = __pathDirname(__filename);
6
6
 
7
7
  import { parseArgs } from 'node:util';
8
8
  import 'node:crypto';
9
- import { a as asError, s as startInferenceAgent } from './start-BmI1Iw_1.js';
9
+ import { a as asError, s as startInferenceAgent } from './start-B9UMbDDZ.js';
10
10
  import 'argon2';
11
11
  import 'node:child_process';
12
12
  import 'node:stream';
@@ -61,12 +61,13 @@ import 'systeminformation';
61
61
  const USAGE = `Usage: npx @infersec/conduit --source <id> --key <key> [options]
62
62
 
63
63
  Options:
64
- --api-url <url> API base URL (or API_URL)
65
- --engine <type> Engine type (or AGENT_ENGINE_TYPE)
66
- --key <value> API key (or API_KEY)
67
- --port <number> Port to listen on (or PORT)
68
- --root <path> Root directory (or ROOT_DIRECTORY)
69
- --source <id> Inference source ID (or INFERENCE_SOURCE_ID)
64
+ --api-key <value> API key (or API_KEY)
65
+ --api-url <url> API base URL (or API_URL)
66
+ --engine <type> Engine type (or ENGINE)
67
+ --key <value> API key (or API_KEY)
68
+ --port <number> Port to listen on (or PORT)
69
+ --root <path> Root directory (or ROOT_DIRECTORY)
70
+ --source <id> Inference source ID (or SOURCE)
70
71
  -h, --help Show this help message
71
72
  `;
72
73
  async function run() {
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { fileURLToPath as __fileURLToPath } from 'url';
3
- import { dirname } from 'path';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
4
  const __filename = __fileURLToPath(import.meta.url);
5
- const __dirname = dirname(__filename);
5
+ const __dirname = __pathDirname(__filename);
6
6
 
7
7
  import 'node:crypto';
8
- import { s as startInferenceAgent, a as asError } from './start-BmI1Iw_1.js';
8
+ import { s as startInferenceAgent, a as asError } from './start-B9UMbDDZ.js';
9
9
  import 'argon2';
10
10
  import 'node:child_process';
11
11
  import 'node:stream';
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { fileURLToPath as __fileURLToPath } from 'url';
3
- import { dirname } from 'path';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
4
  const __filename = __fileURLToPath(import.meta.url);
5
- const __dirname = dirname(__filename);
5
+ const __dirname = __pathDirname(__filename);
6
6
 
7
7
  import require$$0$5 from 'os';
8
8
  import require$$1$2, { realpathSync as realpathSync$1, readlinkSync, readdirSync, readdir as readdir$1, lstatSync } from 'fs';
@@ -31,7 +31,7 @@ import require$$1$5, { fileURLToPath } from 'node:url';
31
31
  import require$$1$6 from 'node:async_hooks';
32
32
  import require$$1$7 from 'node:console';
33
33
  import require$$0$b, { realpath, readlink, readdir, lstat, mkdir, readFile, writeFile } from 'node:fs/promises';
34
- import path$1, { win32, posix, join } from 'node:path';
34
+ import path$1, { win32, posix, dirname, join } from 'node:path';
35
35
  import require$$1$8 from 'node:dns';
36
36
  import require$$2$4 from 'node:sqlite';
37
37
  import require$$0$c from 'path';
@@ -5676,19 +5676,18 @@ object({
5676
5676
 
5677
5677
  _enum(["inf-end", "inf-src", "storage"]);
5678
5678
 
5679
- function readEnvInteger(name) {
5680
- const str = readEnvString(name).trim();
5681
- if (!/^\d+$/.test(str)) {
5682
- throw new Error(`Invalid integer value for environment variable '${name}': ${str}`);
5683
- }
5684
- return parseInt(str, 10);
5685
- }
5686
5679
  function readEnvString(name) {
5687
5680
  if (typeof process.env[name] !== "string") {
5688
5681
  throw new Error(`Expected environment variable was not present: ${name}`);
5689
5682
  }
5690
5683
  return process.env[name];
5691
5684
  }
5685
+ function readEnvStringOptional(name, defaultValue) {
5686
+ if (typeof process.env[name] !== "string") {
5687
+ return defaultValue;
5688
+ }
5689
+ return process.env[name];
5690
+ }
5692
5691
 
5693
5692
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
5694
5693
 
@@ -94912,9 +94911,13 @@ async function downloadModelViaHuggingFace({ format, huggingFaceToken, modelSlug
94912
94911
  // Get all files in model
94913
94912
  for await (const file of listFiles({
94914
94913
  accessToken,
94914
+ recursive: true,
94915
94915
  repo: modelSlug
94916
94916
  })) {
94917
94917
  const filePath = file.path.toLowerCase();
94918
+ if (format === "gguf" && filePath.endsWith(".gguf") === false) {
94919
+ continue;
94920
+ }
94918
94921
  if (variant &&
94919
94922
  filePath.endsWith(".gguf") &&
94920
94923
  filePath.includes(variant.toLowerCase()) === false) {
@@ -94926,6 +94929,7 @@ async function downloadModelViaHuggingFace({ format, huggingFaceToken, modelSlug
94926
94929
  continue;
94927
94930
  }
94928
94931
  console.log("Downloading:", file.path, file.size);
94932
+ await mkdir(dirname(join(targetDirectory, file.path)), { recursive: true });
94929
94933
  const response = await downloadFile({
94930
94934
  accessToken,
94931
94935
  repo: modelSlug,
@@ -104876,13 +104880,18 @@ async function createApplication({ abortController, apiClient, configuration, lo
104876
104880
  }
104877
104881
 
104878
104882
  function getConfiguration({ overrides } = {}) {
104879
- const agentEngineTypeValue = overrides?.agentEngineType ?? readEnvString("AGENT_ENGINE_TYPE");
104883
+ const agentEngineTypeValue = overrides?.agentEngineType ?? readEnvString("ENGINE");
104880
104884
  const agentEngineType = LLMEngineSchema.parse(agentEngineTypeValue);
104881
104885
  const apiKey = overrides?.apiKey ?? readEnvString("API_KEY");
104882
- const apiURL = overrides?.apiURL ?? readEnvString("API_URL");
104883
- const inferenceSourceID = overrides?.inferenceSourceID ?? readEnvString("INFERENCE_SOURCE_ID");
104884
- const port = overrides?.port ?? readEnvInteger("PORT");
104885
- const rootDirectory = overrides?.rootDirectory ?? readEnvString("ROOT_DIRECTORY");
104886
+ const apiURL = overrides?.apiURL ?? readEnvStringOptional("API_URL", "https://api.infersec.ai");
104887
+ const inferenceSourceID = overrides?.inferenceSourceID ?? readEnvString("SOURCE");
104888
+ const portValue = overrides?.port ?? readEnvStringOptional("PORT", "9505");
104889
+ const port = Number.parseInt(String(portValue), 10);
104890
+ if (Number.isNaN(port)) {
104891
+ throw new Error(`Invalid port: ${portValue}`);
104892
+ }
104893
+ const defaultRootDirectory = join(process.env.HOME ?? "/tmp", ".cache", "infersec", "iagent");
104894
+ const rootDirectory = overrides?.rootDirectory ?? readEnvStringOptional("ROOT_DIRECTORY", defaultRootDirectory);
104886
104895
  return {
104887
104896
  agentEngineType,
104888
104897
  apiKey,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@infersec/conduit",
3
3
  "description": "End user conduit agent for connecting local LLMs to the cloud.",
4
- "version": "1.5.0",
4
+ "version": "1.5.2",
5
5
  "bin": {
6
6
  "infersec-conduit": "./dist/cli.js"
7
7
  },