@octocodeai/freellama-mcp-server 0.1.0 → 0.6.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/native/index.d.ts CHANGED
@@ -1,158 +1,194 @@
1
- // Hand-written type declarations for the native module (see index.js for why these are
2
- // hand-written rather than tool-generated). Mirrors packages/rust-core/src/napi.rs's public function signatures
3
- // exactly — keep the two in sync if you change one. `npm run build` no longer overwrites this
4
- // file (it previously did, silently emptying it — see package.json's build script comment).
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+ /**
4
+ * Cancels one deferred task and waits for its local admission permits to be released.
5
+ *
6
+ * # Errors
7
+ * Returns an error for an invalid ID, an expired job, or an unavailable server.
8
+ */
9
+ export declare function cancelTaskJob(endpoint: string | undefined | null, jobId: string): Promise<string>
10
+
11
+ /**
12
+ * Creates opt-in, bounded process-local conversation history.
13
+ * # Errors
14
+ * Returns an error if the server is unavailable or rejects the scope limits or messages.
15
+ */
16
+ export declare function createScope(endpoint: string | undefined | null, request: unknown): Promise<string>
17
+
18
+ /**
19
+ * Create a bounded, expiring model-affinity handle. It stores no prompt history or Ollama KV.
20
+ *
21
+ * # Errors
22
+ *
23
+ * Returns an error if `freellama serve` is unreachable or its session limit is full.
24
+ */
25
+ export declare function createSession(endpoint?: string | undefined | null): Promise<string>
26
+
27
+ /**
28
+ * Deletes history and invalidates in-flight commits for this scope.
29
+ * # Errors
30
+ * Returns an error for an invalid ID or unavailable server.
31
+ */
32
+ export declare function deleteScope(endpoint: string | undefined | null, scopeId: string): Promise<void>
33
+
34
+ /**
35
+ * Release a model-affinity handle when an agent has finished related work.
36
+ *
37
+ * # Errors
38
+ *
39
+ * Returns an error if `freellama serve` is unreachable or the handle has expired or was deleted.
40
+ */
41
+ export declare function deleteSession(endpoint: string | undefined | null, sessionId: string): Promise<void>
5
42
 
6
43
  /**
7
44
  * Runs `freellama doctor` against Ollama directly — no running `freellama serve` required.
8
45
  * Cross-checks the Ollama CLI and server versions and confirms the endpoint is reachable.
9
- * @param endpoint Ollama endpoint, defaults to http://127.0.0.1:11434
10
- * @returns Pretty-printed JSON string
46
+ *
47
+ * # Errors
48
+ *
49
+ * Returns an error if Ollama is unreachable at `endpoint`.
50
+ */
51
+ export declare function doctor(endpoint?: string | undefined | null): Promise<string>
52
+
53
+ /**
54
+ * Copies a specified revision into an independent scope.
55
+ * # Errors
56
+ * Returns an error for an invalid ID, stale revision, or rejected limits.
57
+ */
58
+ export declare function forkScope(endpoint: string | undefined | null, scopeId: string, request: unknown): Promise<string>
59
+
60
+ /**
61
+ * Reads scope metadata; history is returned only when explicitly requested.
62
+ * # Errors
63
+ * Returns an error for an invalid ID or missing/expired scope.
64
+ */
65
+ export declare function getScope(endpoint: string | undefined | null, scopeId: string, includeMessages?: boolean | undefined | null): Promise<string>
66
+
67
+ /**
68
+ * Reads a deferred task receipt and its retained result, if completed.
69
+ *
70
+ * # Errors
71
+ * Returns an error for an invalid ID, an expired job, or an unavailable server.
72
+ */
73
+ export declare function getTaskJob(endpoint: string | undefined | null, jobId: string): Promise<string>
74
+
75
+ /**
76
+ * Current managed-platform health, including admission and session bounds.
77
+ *
78
+ * # Errors
79
+ *
80
+ * Returns an error if `freellama serve` is unreachable or returns a non-2xx response.
81
+ */
82
+ export declare function health(endpoint?: string | undefined | null): Promise<string>
83
+
84
+ /**
85
+ * Cancel managed requests for one session and invalidate its affinity handle.
86
+ *
87
+ * # Errors
88
+ * Returns an error if the server is unreachable or the session does not exist.
89
+ */
90
+ export declare function killSession(endpoint: string | undefined | null, sessionId: string): Promise<string>
91
+
92
+ /**
93
+ * Installed-model inventory with capabilities, residency, and advertised context, as discovered
94
+ * by a running `freellama serve`.
95
+ *
96
+ * # Errors
97
+ *
98
+ * Returns an error if `freellama serve` isn't reachable at `endpoint`, or returns a non-2xx
99
+ * response.
100
+ */
101
+ export declare function listModels(endpoint?: string | undefined | null): Promise<string>
102
+
103
+ /**
104
+ * Lists bounded process-local deferred task receipts, without prompts or retained results.
105
+ *
106
+ * # Errors
107
+ * Returns an error if the managed server is unreachable or refuses the request.
11
108
  */
12
- export function doctor(endpoint?: string | undefined | null): Promise<string>;
109
+ export declare function listTaskJobs(endpoint?: string | undefined | null): Promise<string>
13
110
 
14
111
  /**
15
112
  * Machine profile (chip, host memory, memory kind, CPU count, and disk) from `freellama serve`.
16
- * @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
17
- */
18
- export function machine(endpoint?: string | undefined | null): Promise<string>;
19
-
20
- /** Current managed-platform health, including admission and session bounds. */
21
- export function health(endpoint?: string | undefined | null): Promise<string>;
22
-
23
- /** Create a bounded, idle-expiring model-affinity handle; it stores no prompt history or KV. */
24
- export function createSession(endpoint?: string | undefined | null): Promise<string>;
25
-
26
- /** Release a model-affinity handle after related work has completed. */
27
- export function deleteSession(
28
- endpoint: string | undefined | null,
29
- sessionId: string,
30
- ): Promise<void>;
31
-
32
- /**
33
- * Installed-model inventory with capabilities, residency, and advertised context.
34
- * @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
35
- */
36
- export function listModels(endpoint?: string | undefined | null): Promise<string>;
37
-
38
- /**
39
- * Deterministic model selection for a task.
40
- * @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
41
- * @param task e.g. "completion" | "code_repair" | "vision" | "embedding"
42
- * @param objective "fastest" | "balanced" | "quality", defaults to "balanced"
43
- * @param model Optional explicit model name to force
44
- * @param sessionId Optional session id for model affinity
45
- * @param contextTokens Optional minimum context window required
46
- * @param requiredCapabilities Optional list of capabilities the model must advertise (e.g. ["vision"])
47
- * @param minConfidence Optional floor ("low" | "medium"); the core gate refuses below it
48
- * @param executionPreference Guarded backend hint: "auto" | "prefer_cpu" | "prefer_gpu"
49
- * @param minPlacementEvidence "configured" (default) or fail-closed physical "observed"
50
- * @param minPlacementEvidence "configured" (default) or fail-closed physical "observed"
51
- */
52
- export function route(
53
- endpoint: string | undefined | null,
54
- task: string,
55
- objective?: string | undefined | null,
56
- model?: string | undefined | null,
57
- sessionId?: string | undefined | null,
58
- contextTokens?: number | undefined | null,
59
- requiredCapabilities?: Array<string> | undefined | null,
60
- minConfidence?: string | undefined | null,
61
- executionPreference?: string | undefined | null,
62
- minPlacementEvidence?: string | undefined | null,
63
- ): Promise<string>;
64
-
65
- /**
66
- * Side-effect-free install recommendation for a task. Never runs `ollama pull` itself.
67
- * @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
68
- * @param task e.g. "completion" | "code_repair" | "vision" | "embedding"
69
- * @param objective "fastest" | "balanced" | "quality", defaults to "balanced"
70
- * @param model Optional explicit model name to filter to
71
- * @param contextTokens Optional minimum context window required
72
- * @param requiredCapabilities Optional list of capabilities the model must advertise (e.g. ["vision"])
73
- * @param executionPreference Guarded backend hint: "auto" | "prefer_cpu" | "prefer_gpu"
74
- * @param minPlacementEvidence "configured" (default) or fail-closed physical "observed"
75
- */
76
- export function recommend(
77
- endpoint: string | undefined | null,
78
- task: string,
79
- objective?: string | undefined | null,
80
- model?: string | undefined | null,
81
- contextTokens?: number | undefined | null,
82
- requiredCapabilities?: Array<string> | undefined | null,
83
- executionPreference?: string | undefined | null,
84
- minPlacementEvidence?: string | undefined | null,
85
- ): Promise<string>;
86
-
87
- /**
88
- * Routes AND executes a chat/generate/embed call in one shot — unlike `route`/`recommend`, this
89
- * actually does work. Provide `prompt` for a single message, or `messages` (an array of
90
- * `{role, content}` objects) for multi-turn history. For task "embedding", set `input` instead.
91
- * @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
92
- * @param task e.g. "completion" | "code_repair" | "vision" | "embedding"
93
- * @param objective "fastest" | "balanced" | "quality", defaults to "balanced"
94
- * @param model Optional explicit model name to force
95
- * @param sessionId Optional session id for model affinity
96
- * @param contextTokens Optional minimum context window required
97
- * @param requiredCapabilities Optional list of capabilities the model must advertise
98
- * @param prompt Single-turn user message
99
- * @param images Base64-encoded images (no data-URI prefix) attached to the `prompt` message — pair with requiredCapabilities: ["vision"]
100
- * @param messages Multi-turn message history, wins over `prompt` if both are set
101
- * @param input Embedding input (string or array of strings), for task "embedding"
102
- * @param tools Optional tool/function definitions for function-calling tasks
103
- * @param keepAlive Overrides Ollama's model residency window, e.g. "0" or "-1"
104
- * @param minConfidence Optional floor ("low" | "medium"); the core gate refuses before generation
105
- * @param executionPreference Guarded backend hint: "auto" | "prefer_cpu" | "prefer_gpu"
106
- */
107
- export function runTask(
108
- endpoint: string | undefined | null,
109
- task: string,
110
- objective?: string | undefined | null,
111
- model?: string | undefined | null,
112
- sessionId?: string | undefined | null,
113
- contextTokens?: number | undefined | null,
114
- requiredCapabilities?: Array<string> | undefined | null,
115
- prompt?: string | undefined | null,
116
- images?: Array<string> | undefined | null,
117
- messages?: unknown | undefined | null,
118
- input?: unknown | undefined | null,
119
- tools?: unknown | undefined | null,
120
- keepAlive?: string | undefined | null,
121
- minConfidence?: string | undefined | null,
122
- executionPreference?: string | undefined | null,
123
- minPlacementEvidence?: string | undefined | null,
124
- ): Promise<string>;
125
-
126
- /**
127
- * Object-based managed task API. Supports the full typed task request including lossless message
128
- * history and request_options (format, think, runtime options, logprobs).
129
- * @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
130
- * @param request Complete `/_freellama/v1/tasks` request object
131
- */
132
- export function runTaskRequest(
133
- endpoint: string | undefined | null,
134
- request: unknown,
135
- ): Promise<string>;
136
-
137
- /**
138
- * Executes explicitly independent tasks with a bounded, priority-fair dispatcher. Individual
139
- * task failures are returned as result entries so unaffected sibling work is preserved.
140
- * @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
141
- * @param request Complete `/_freellama/v1/task-batches` request object
142
- */
143
- export function runTaskBatchRequest(
144
- endpoint: string | undefined | null,
145
- request: unknown,
146
- ): Promise<string>;
147
-
148
- /**
149
- * Converts a free-text natural-language intent into a route.
150
- * @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
151
- * @param text Free-text description of what's needed
152
- * @param sessionId Optional session id for model affinity
153
- */
154
- export function naturalRoute(
155
- endpoint: string | undefined | null,
156
- text: string,
157
- sessionId?: string | undefined | null,
158
- ): Promise<string>;
113
+ *
114
+ * # Errors
115
+ *
116
+ * Returns an error if `freellama serve` isn't reachable at `endpoint`, or returns a non-2xx
117
+ * response.
118
+ */
119
+ export declare function machine(endpoint?: string | undefined | null): Promise<string>
120
+
121
+ /**
122
+ * Stops one deferred task, waits for local permits, and removes its retained record.
123
+ *
124
+ * # Errors
125
+ * Returns an error for an invalid ID, a missing job, or an unavailable server.
126
+ */
127
+ export declare function removeTaskJob(endpoint: string | undefined | null, jobId: string): Promise<string>
128
+
129
+ /**
130
+ * Deterministic model selection for a task, via `POST /_freellama/v1/routes` on a running
131
+ * `freellama serve`. `task` and `objective` are passed through as strings and validated
132
+ * server-side (e.g. task: `completion` | `code_repair` | `vision` | `embedding` | ...;
133
+ * objective: `fastest` | `balanced` | `quality`).
134
+ *
135
+ * # Errors
136
+ *
137
+ * Returns an error if `freellama serve` isn't reachable at `endpoint`, or rejects the request
138
+ * (e.g. an unknown task/objective, or no eligible model).
139
+ */
140
+ export declare function route(endpoint: string | undefined | null, task: string, objective?: string | undefined | null, model?: string | undefined | null, sessionId?: string | undefined | null, contextTokens?: number | undefined | null, requiredCapabilities?: Array<string> | undefined | null, minConfidence?: string | undefined | null, executionPreference?: string | undefined | null, minPlacementEvidence?: string | undefined | null): Promise<string>
141
+
142
+ /**
143
+ * Executes caller-declared independent managed tasks with bounded, priority-fair dispatch.
144
+ *
145
+ * # Errors
146
+ *
147
+ * Returns an error if `freellama serve` is unreachable or rejects the batch envelope. Individual
148
+ * task failures remain explicit entries in the successful batch response so sibling work is not
149
+ * discarded.
150
+ */
151
+ export declare function runTaskBatchRequest(endpoint: string | undefined | null, request: unknown): Promise<string>
152
+
153
+ /**
154
+ * Object-based managed task API for callers that need the complete task contract without a long,
155
+ * ABI-fragile positional argument list. The request is forwarded to `/_freellama/v1/tasks`, where
156
+ * the typed Rust server validates routing fields, message history, and advanced Ollama controls.
157
+ *
158
+ * # Errors
159
+ *
160
+ * Returns an error if `freellama serve` is unreachable or rejects the request.
161
+ */
162
+ export declare function runTaskRequest(endpoint: string | undefined | null, request: unknown): Promise<string>
163
+
164
+ /**
165
+ * Live platform view: per-backend admission, queues, adaptive limits and circuit breakers,
166
+ * loaded models, host memory, Ollama's effective settings, and today's usage.
167
+ *
168
+ * # Errors
169
+ *
170
+ * Returns an error if `freellama serve` is unreachable.
171
+ */
172
+ export declare function status(endpoint?: string | undefined | null): Promise<string>
173
+
174
+ /**
175
+ * Usage totals for the last `days` days (default 7), per day and per model.
176
+ *
177
+ * # Errors
178
+ *
179
+ * Returns an error if `freellama serve` is unreachable.
180
+ */
181
+ export declare function usage(endpoint?: string | undefined | null, days?: number | undefined | null): Promise<string>
182
+
183
+ /**
184
+ * Crate version this addon was compiled from; release verification requires it to match the
185
+ * npm package version.
186
+ */
187
+ export declare function version(): string
188
+
189
+ /**
190
+ * Preloads an exact installed model through managed admission and deadlines.
191
+ * # Errors
192
+ * Returns an error if the server refuses placement, capacity, or the request.
193
+ */
194
+ export declare function warmModelRequest(endpoint: string | undefined | null, request: unknown): Promise<string>
package/native/index.js CHANGED
@@ -1,6 +1,6 @@
1
- // Hand-written glue: napi-rs CLI did not emit JS bindings for this crate/cli pair, so this
2
- // file re-exports the compiled `.node`. Rebuild with `npm run build` from the repo root.
3
- // See packages/mcp/README.md.
1
+ // Loads the local development addon first, then the matching optional platform package. Kept
2
+ // as a small loader instead of napi-rs's generated one; index.d.ts is generated by
3
+ // `yarn build:native` (scripts/build-native.mjs). See packages/mcp/DEVELOPING.md.
4
4
  const { existsSync } = require("node:fs");
5
5
  const path = require("node:path");
6
6
  const { createRequire } = require("node:module");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octocodeai/freellama-mcp-server",
3
- "version": "0.1.0",
3
+ "version": "0.6.0",
4
4
  "description": "MCP server exposing FreeLlama core as tools, via native NAPI bindings into packages/rust-core.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,9 +26,13 @@
26
26
  "native/index.js",
27
27
  "native/index.d.ts",
28
28
  "native/package.json",
29
- "adapters/*.py",
30
29
  "docs",
31
- "README.md"
30
+ "README.md",
31
+ "CONFIGURATION.md",
32
+ "DEVELOPING.md",
33
+ "LICENSE-APACHE",
34
+ "LICENSE-MIT",
35
+ "assets/logo.jpg"
32
36
  ],
33
37
  "scripts": {
34
38
  "build": "node scripts/build.mjs",
@@ -46,14 +50,14 @@
46
50
  "zod": "^3.24.1"
47
51
  },
48
52
  "optionalDependencies": {
49
- "@octocodeai/freellama-native-darwin-arm64": "0.1.0",
50
- "@octocodeai/freellama-native-darwin-x64": "0.1.0",
51
- "@octocodeai/freellama-native-linux-arm64-gnu": "0.1.0",
52
- "@octocodeai/freellama-native-linux-arm64-musl": "0.1.0",
53
- "@octocodeai/freellama-native-linux-x64-gnu": "0.1.0",
54
- "@octocodeai/freellama-native-linux-x64-musl": "0.1.0",
55
- "@octocodeai/freellama-native-win32-arm64-msvc": "0.1.0",
56
- "@octocodeai/freellama-native-win32-x64-msvc": "0.1.0"
53
+ "@octocodeai/freellama-native-darwin-arm64": "0.6.0",
54
+ "@octocodeai/freellama-native-darwin-x64": "0.6.0",
55
+ "@octocodeai/freellama-native-linux-arm64-gnu": "0.6.0",
56
+ "@octocodeai/freellama-native-linux-arm64-musl": "0.6.0",
57
+ "@octocodeai/freellama-native-linux-x64-gnu": "0.6.0",
58
+ "@octocodeai/freellama-native-linux-x64-musl": "0.6.0",
59
+ "@octocodeai/freellama-native-win32-arm64-msvc": "0.6.0",
60
+ "@octocodeai/freellama-native-win32-x64-msvc": "0.6.0"
57
61
  },
58
62
  "license": "Apache-2.0 OR MIT",
59
63
  "publishConfig": {