@constructive-io/llm-env 0.16.0 → 0.17.0

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
@@ -99,9 +99,10 @@ Install skills for AI coding agents:
99
99
  # All platform skills (security, blueprints, codegen, billing, etc.)
100
100
  npx skills add constructive-io/constructive-skills
101
101
 
102
- # Individual repo skills (pgpm, testing, CLI, search, etc.)
103
- npx skills add https://github.com/constructive-io/constructive --skill pgpm
104
- npx skills add https://github.com/constructive-io/constructive --skill constructive-testing
102
+ # Individual repo skills (pgpm, safegres, testing, CLI, search, etc.)
103
+ npx skills add constructive-io/constructive --skill pgpm
104
+ npx skills add constructive-io/constructive --skill safegres
105
+ npx skills add constructive-io/constructive --skill constructive-testing
105
106
  ```
106
107
 
107
108
  ## Credits
package/esm/index.js CHANGED
@@ -17,6 +17,10 @@
17
17
  * CHAT_PROVIDER - Chat provider name (default: 'ollama')
18
18
  * CHAT_MODEL - Chat model (default: 'llama3')
19
19
  * CHAT_BASE_URL - Chat provider URL (default: 'http://localhost:11434')
20
+ * AGENTIC_SERVER_URL - Metered LLM gateway root (no default). When set, the
21
+ * server embeds and chats through the gateway, which
22
+ * resolves the upstream provider and records every call;
23
+ * EMBEDDER_BASE_URL / CHAT_BASE_URL are not consulted.
20
24
  */
21
25
  // ─── Defaults ───────────────────────────────────────────────────────────────
22
26
  export const llmDefaults = {
@@ -29,7 +33,8 @@ export const llmDefaults = {
29
33
  provider: 'ollama',
30
34
  model: 'llama3',
31
35
  baseUrl: 'http://localhost:11434'
32
- }
36
+ },
37
+ gateway: {}
33
38
  };
34
39
  // ─── Env Parsing ────────────────────────────────────────────────────────────
35
40
  /**
@@ -41,7 +46,7 @@ export const llmDefaults = {
41
46
  * @param env - Environment object to read from (defaults to process.env)
42
47
  */
43
48
  export const getEnvVars = (env = process.env) => {
44
- const { EMBEDDER_PROVIDER, EMBEDDER_MODEL, EMBEDDER_BASE_URL, CHAT_PROVIDER, CHAT_MODEL, CHAT_BASE_URL, } = env;
49
+ const { EMBEDDER_PROVIDER, EMBEDDER_MODEL, EMBEDDER_BASE_URL, CHAT_PROVIDER, CHAT_MODEL, CHAT_BASE_URL, AGENTIC_SERVER_URL, } = env;
45
50
  return {
46
51
  ...((EMBEDDER_PROVIDER || EMBEDDER_MODEL || EMBEDDER_BASE_URL) && {
47
52
  embedding: {
@@ -57,6 +62,9 @@ export const getEnvVars = (env = process.env) => {
57
62
  ...(CHAT_BASE_URL && { baseUrl: CHAT_BASE_URL }),
58
63
  },
59
64
  }),
65
+ ...(AGENTIC_SERVER_URL && {
66
+ gateway: { url: AGENTIC_SERVER_URL },
67
+ }),
60
68
  };
61
69
  };
62
70
  // ─── Merged Resolution ──────────────────────────────────────────────────────
@@ -82,6 +90,11 @@ export const getEnvOptions = (overrides = {}, env = process.env) => {
82
90
  ...envOptions.chat,
83
91
  ...overrides.chat,
84
92
  },
93
+ gateway: {
94
+ ...llmDefaults.gateway,
95
+ ...envOptions.gateway,
96
+ ...overrides.gateway,
97
+ },
85
98
  };
86
99
  };
87
100
  /**
package/index.d.ts CHANGED
@@ -17,20 +17,30 @@
17
17
  * CHAT_PROVIDER - Chat provider name (default: 'ollama')
18
18
  * CHAT_MODEL - Chat model (default: 'llama3')
19
19
  * CHAT_BASE_URL - Chat provider URL (default: 'http://localhost:11434')
20
+ * AGENTIC_SERVER_URL - Metered LLM gateway root (no default). When set, the
21
+ * server embeds and chats through the gateway, which
22
+ * resolves the upstream provider and records every call;
23
+ * EMBEDDER_BASE_URL / CHAT_BASE_URL are not consulted.
20
24
  */
21
25
  export interface LlmProviderConfig {
22
26
  provider?: string;
23
27
  model?: string;
24
28
  baseUrl?: string;
25
29
  }
30
+ /** The metered gateway model calls leave through, when one is configured. */
31
+ export interface LlmGatewayConfig {
32
+ url?: string;
33
+ }
26
34
  export interface LlmEnvOptions {
27
35
  embedding?: LlmProviderConfig;
28
36
  chat?: LlmProviderConfig;
37
+ gateway?: LlmGatewayConfig;
29
38
  }
30
- /** Fully resolved LLM config — every field guaranteed present after merge. */
39
+ /** Fully resolved LLM config — every provider field present after merge; the gateway stays optional. */
31
40
  export interface ResolvedLlmEnvOptions {
32
41
  embedding: Required<LlmProviderConfig>;
33
42
  chat: Required<LlmProviderConfig>;
43
+ gateway: LlmGatewayConfig;
34
44
  }
35
45
  export declare const llmDefaults: ResolvedLlmEnvOptions;
36
46
  /**
package/index.js CHANGED
@@ -18,6 +18,10 @@
18
18
  * CHAT_PROVIDER - Chat provider name (default: 'ollama')
19
19
  * CHAT_MODEL - Chat model (default: 'llama3')
20
20
  * CHAT_BASE_URL - Chat provider URL (default: 'http://localhost:11434')
21
+ * AGENTIC_SERVER_URL - Metered LLM gateway root (no default). When set, the
22
+ * server embeds and chats through the gateway, which
23
+ * resolves the upstream provider and records every call;
24
+ * EMBEDDER_BASE_URL / CHAT_BASE_URL are not consulted.
21
25
  */
22
26
  Object.defineProperty(exports, "__esModule", { value: true });
23
27
  exports.getLlmEnvOptions = exports.getEnvOptions = exports.getEnvVars = exports.llmDefaults = void 0;
@@ -32,7 +36,8 @@ exports.llmDefaults = {
32
36
  provider: 'ollama',
33
37
  model: 'llama3',
34
38
  baseUrl: 'http://localhost:11434'
35
- }
39
+ },
40
+ gateway: {}
36
41
  };
37
42
  // ─── Env Parsing ────────────────────────────────────────────────────────────
38
43
  /**
@@ -44,7 +49,7 @@ exports.llmDefaults = {
44
49
  * @param env - Environment object to read from (defaults to process.env)
45
50
  */
46
51
  const getEnvVars = (env = process.env) => {
47
- const { EMBEDDER_PROVIDER, EMBEDDER_MODEL, EMBEDDER_BASE_URL, CHAT_PROVIDER, CHAT_MODEL, CHAT_BASE_URL, } = env;
52
+ const { EMBEDDER_PROVIDER, EMBEDDER_MODEL, EMBEDDER_BASE_URL, CHAT_PROVIDER, CHAT_MODEL, CHAT_BASE_URL, AGENTIC_SERVER_URL, } = env;
48
53
  return {
49
54
  ...((EMBEDDER_PROVIDER || EMBEDDER_MODEL || EMBEDDER_BASE_URL) && {
50
55
  embedding: {
@@ -60,6 +65,9 @@ const getEnvVars = (env = process.env) => {
60
65
  ...(CHAT_BASE_URL && { baseUrl: CHAT_BASE_URL }),
61
66
  },
62
67
  }),
68
+ ...(AGENTIC_SERVER_URL && {
69
+ gateway: { url: AGENTIC_SERVER_URL },
70
+ }),
63
71
  };
64
72
  };
65
73
  exports.getEnvVars = getEnvVars;
@@ -86,6 +94,11 @@ const getEnvOptions = (overrides = {}, env = process.env) => {
86
94
  ...envOptions.chat,
87
95
  ...overrides.chat,
88
96
  },
97
+ gateway: {
98
+ ...exports.llmDefaults.gateway,
99
+ ...envOptions.gateway,
100
+ ...overrides.gateway,
101
+ },
89
102
  };
90
103
  };
91
104
  exports.getEnvOptions = getEnvOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/llm-env",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "LLM environment configuration — single source of truth for all LLM-related env vars and defaults",
6
6
  "main": "index.js",
@@ -41,5 +41,5 @@
41
41
  "openai",
42
42
  "embedding"
43
43
  ],
44
- "gitHead": "487c4ec9ee997d7da80584a3d41d7120d4354c54"
44
+ "gitHead": "bee9337d5df205c1339a542b9ee749272e9f34f2"
45
45
  }