@octocodeai/freellama-mcp-server 0.5.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,189 +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>
5
26
 
6
- /** Crate version this native addon was compiled from. */
7
- export function version(): string;
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>
8
42
 
9
43
  /**
10
44
  * Runs `freellama doctor` against Ollama directly — no running `freellama serve` required.
11
45
  * Cross-checks the Ollama CLI and server versions and confirms the endpoint is reachable.
12
- * @param endpoint Ollama endpoint, defaults to http://127.0.0.1:11434
13
- * @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.
14
108
  */
15
- export function doctor(endpoint?: string | undefined | null): Promise<string>;
109
+ export declare function listTaskJobs(endpoint?: string | undefined | null): Promise<string>
16
110
 
17
111
  /**
18
112
  * Machine profile (chip, host memory, memory kind, CPU count, and disk) from `freellama serve`.
19
- * @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
113
+ *
114
+ * # Errors
115
+ *
116
+ * Returns an error if `freellama serve` isn't reachable at `endpoint`, or returns a non-2xx
117
+ * response.
20
118
  */
21
- export function machine(endpoint?: string | undefined | null): Promise<string>;
119
+ export declare function machine(endpoint?: string | undefined | null): Promise<string>
22
120
 
23
- /** Current managed-platform health, including admission and session bounds. */
24
- export function health(endpoint?: string | undefined | null): Promise<string>;
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>
25
128
 
26
129
  /**
27
- * Live platform view: admission, queues, adaptive limits and circuit breakers per backend,
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,
28
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.
29
193
  */
30
- export function status(endpoint?: string | undefined | null): Promise<string>;
31
-
32
- /** Usage totals per day and per model over the last `days` days (default 7). */
33
- export function usage(endpoint?: string | undefined | null, days?: number | undefined | null): Promise<string>;
34
-
35
- /** Create a bounded, idle-expiring model-affinity handle; it stores no prompt history or KV. */
36
- export function createSession(endpoint?: string | undefined | null): Promise<string>;
37
-
38
- export function killSession(endpoint: string | undefined | null, sessionId: string): Promise<string>;
39
-
40
- /** Release a model-affinity handle after related work has completed. */
41
- export function deleteSession(
42
- endpoint: string | undefined | null,
43
- sessionId: string,
44
- ): Promise<void>;
45
-
46
- /**
47
- * Installed-model inventory with capabilities, residency, and advertised context.
48
- * @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
49
- */
50
- export function listModels(endpoint?: string | undefined | null): Promise<string>;
51
-
52
- /**
53
- * Deterministic model selection for a task.
54
- * @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
55
- * @param task e.g. "completion" | "code_repair" | "vision" | "embedding"
56
- * @param objective "fastest" | "balanced" | "quality", defaults to "balanced"
57
- * @param model Optional explicit model name to force
58
- * @param sessionId Optional session id for model affinity
59
- * @param contextTokens Optional minimum context window required
60
- * @param requiredCapabilities Optional list of capabilities the model must advertise (e.g. ["vision"])
61
- * @param minConfidence Optional floor ("low" | "medium"); the core gate refuses below it
62
- * @param executionPreference Guarded backend hint: "auto" | "prefer_cpu" | "prefer_gpu"
63
- * @param minPlacementEvidence "configured" (default) or fail-closed physical "observed"
64
- * @param minPlacementEvidence "configured" (default) or fail-closed physical "observed"
65
- */
66
- export function route(
67
- endpoint: string | undefined | null,
68
- task: string,
69
- objective?: string | undefined | null,
70
- model?: string | undefined | null,
71
- sessionId?: string | undefined | null,
72
- contextTokens?: number | undefined | null,
73
- requiredCapabilities?: Array<string> | undefined | null,
74
- minConfidence?: string | undefined | null,
75
- executionPreference?: string | undefined | null,
76
- minPlacementEvidence?: string | undefined | null,
77
- ): Promise<string>;
78
-
79
- /**
80
- * Side-effect-free install recommendation for a task. Never runs `ollama pull` itself.
81
- * @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
82
- * @param task e.g. "completion" | "code_repair" | "vision" | "embedding"
83
- * @param objective "fastest" | "balanced" | "quality", defaults to "balanced"
84
- * @param model Optional explicit model name to filter to
85
- * @param contextTokens Optional minimum context window required
86
- * @param requiredCapabilities Optional list of capabilities the model must advertise (e.g. ["vision"])
87
- * @param executionPreference Guarded backend hint: "auto" | "prefer_cpu" | "prefer_gpu"
88
- * @param minPlacementEvidence "configured" (default) or fail-closed physical "observed"
89
- */
90
- export function recommend(
91
- endpoint: string | undefined | null,
92
- task: string,
93
- objective?: string | undefined | null,
94
- model?: string | undefined | null,
95
- contextTokens?: number | undefined | null,
96
- requiredCapabilities?: Array<string> | undefined | null,
97
- executionPreference?: string | undefined | null,
98
- minPlacementEvidence?: string | undefined | null,
99
- ): Promise<string>;
100
-
101
- /**
102
- * Routes AND executes a chat/generate/embed call in one shot — unlike `route`/`recommend`, this
103
- * actually does work. Provide `prompt` for a single message, or `messages` (an array of
104
- * `{role, content}` objects) for multi-turn history. For task "embedding", set `input` instead.
105
- * @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
106
- * @param task e.g. "completion" | "code_repair" | "vision" | "embedding"
107
- * @param objective "fastest" | "balanced" | "quality", defaults to "balanced"
108
- * @param model Optional explicit model name to force
109
- * @param sessionId Optional session id for model affinity
110
- * @param contextTokens Optional minimum context window required
111
- * @param requiredCapabilities Optional list of capabilities the model must advertise
112
- * @param prompt Single-turn user message
113
- * @param images Base64-encoded images (no data-URI prefix) attached to the `prompt` message — pair with requiredCapabilities: ["vision"]
114
- * @param messages Multi-turn message history, wins over `prompt` if both are set
115
- * @param input Embedding input (string or array of strings), for task "embedding"
116
- * @param tools Optional tool/function definitions for function-calling tasks
117
- * @param keepAlive Overrides Ollama's model residency window, e.g. "0" or "-1"
118
- * @param minConfidence Optional floor ("low" | "medium"); the core gate refuses before generation
119
- * @param executionPreference Guarded backend hint: "auto" | "prefer_cpu" | "prefer_gpu"
120
- */
121
- export function runTask(
122
- endpoint: string | undefined | null,
123
- task: string,
124
- objective?: string | undefined | null,
125
- model?: string | undefined | null,
126
- sessionId?: string | undefined | null,
127
- contextTokens?: number | undefined | null,
128
- requiredCapabilities?: Array<string> | undefined | null,
129
- prompt?: string | undefined | null,
130
- images?: Array<string> | undefined | null,
131
- messages?: unknown | undefined | null,
132
- input?: unknown | undefined | null,
133
- tools?: unknown | undefined | null,
134
- keepAlive?: string | undefined | null,
135
- minConfidence?: string | undefined | null,
136
- executionPreference?: string | undefined | null,
137
- minPlacementEvidence?: string | undefined | null,
138
- ): Promise<string>;
139
-
140
- /**
141
- * Object-based managed task API. Supports the full typed task request including lossless message
142
- * history and request_options (format, think, runtime options, logprobs).
143
- * @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
144
- * @param request Complete `/_freellama/v1/tasks` request object
145
- */
146
- export function runTaskRequest(
147
- endpoint: string | undefined | null,
148
- request: unknown,
149
- ): Promise<string>;
150
-
151
- /**
152
- * Executes explicitly independent tasks with a bounded, priority-fair dispatcher. Individual
153
- * task failures are returned as result entries so unaffected sibling work is preserved.
154
- * @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
155
- * @param request Complete `/_freellama/v1/task-batches` request object
156
- */
157
- export function runTaskBatchRequest(
158
- endpoint: string | undefined | null,
159
- request: unknown,
160
- ): Promise<string>;
161
-
162
- /** Lists process-local job metadata without prompts or results. */
163
- export function listTaskJobs(endpoint?: string | undefined | null): Promise<string>;
164
- /** Reads one deferred job and its retained result. */
165
- export function getTaskJob(endpoint: string | undefined | null, jobId: string): Promise<string>;
166
- /** Cancels one deferred job and waits for its local permits to be released. */
167
- export function cancelTaskJob(endpoint: string | undefined | null, jobId: string): Promise<string>;
168
- /** Stop one deferred task, release local permits, then discard its retained record. */
169
- export function removeTaskJob(endpoint: string | undefined | null, jobId: string): Promise<string>;
170
-
171
- /**
172
- * Converts a free-text natural-language intent into a route.
173
- * @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
174
- * @param text Free-text description of what's needed
175
- * @param sessionId Optional session id for model affinity
176
- */
177
- export function naturalRoute(
178
- endpoint: string | undefined | null,
179
- text: string,
180
- sessionId?: string | undefined | null,
181
- ): Promise<string>;
182
-
183
- /** Opt-in bounded process-local history. Metadata by default. */
184
- export function createScope(endpoint: string | undefined | null, request: unknown): Promise<string>;
185
- export function getScope(endpoint: string | undefined | null, scopeId: string, includeMessages?: boolean | null): Promise<string>;
186
- export function forkScope(endpoint: string | undefined | null, scopeId: string, request: unknown): Promise<string>;
187
- export function deleteScope(endpoint: string | undefined | null, scopeId: string): Promise<void>;
188
- /** Empty-payload preload through managed admission and deadlines. */
189
- export function warmModelRequest(endpoint: string | undefined | null, request: unknown): Promise<string>;
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.5.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,10 @@
26
26
  "native/index.js",
27
27
  "native/index.d.ts",
28
28
  "native/package.json",
29
- "adapters/*.py",
30
29
  "docs",
31
30
  "README.md",
31
+ "CONFIGURATION.md",
32
+ "DEVELOPING.md",
32
33
  "LICENSE-APACHE",
33
34
  "LICENSE-MIT",
34
35
  "assets/logo.jpg"
@@ -49,14 +50,14 @@
49
50
  "zod": "^3.24.1"
50
51
  },
51
52
  "optionalDependencies": {
52
- "@octocodeai/freellama-native-darwin-arm64": "0.5.0",
53
- "@octocodeai/freellama-native-darwin-x64": "0.5.0",
54
- "@octocodeai/freellama-native-linux-arm64-gnu": "0.5.0",
55
- "@octocodeai/freellama-native-linux-arm64-musl": "0.5.0",
56
- "@octocodeai/freellama-native-linux-x64-gnu": "0.5.0",
57
- "@octocodeai/freellama-native-linux-x64-musl": "0.5.0",
58
- "@octocodeai/freellama-native-win32-arm64-msvc": "0.5.0",
59
- "@octocodeai/freellama-native-win32-x64-msvc": "0.5.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"
60
61
  },
61
62
  "license": "Apache-2.0 OR MIT",
62
63
  "publishConfig": {