@nemesis-oss/ollama-sdk 1.25.2 → 1.25.4
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/{anthropic-DA9flTv_.d.ts → anthropic-AlcVOiYu.d.cts} +4 -2
- package/dist/{anthropic-DnsaK9Ui.d.cts → anthropic-Dc8EQWwl.d.ts} +4 -2
- package/dist/{compose-DxAQ2z26.d.ts → compose-IebOA0uM.d.ts} +3 -2
- package/dist/{compose-Bjpsu3Y1.d.cts → compose-T-RQQtC0.d.cts} +3 -2
- package/dist/generated-api.cjs +3 -0
- package/dist/generated-api.cjs.map +1 -1
- package/dist/generated-api.d.cts +5 -5
- package/dist/generated-api.d.ts +5 -5
- package/dist/generated-api.js +3 -0
- package/dist/generated-api.js.map +1 -1
- package/dist/generated-runtime.cjs +1 -0
- package/dist/generated-runtime.cjs.map +1 -1
- package/dist/generated-runtime.d.cts +2 -2
- package/dist/generated-runtime.d.ts +2 -2
- package/dist/generated-runtime.js +1 -0
- package/dist/generated-runtime.js.map +1 -1
- package/dist/index.cjs +37 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -9
- package/dist/index.d.ts +12 -9
- package/dist/index.js +37 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-generated.cjs +7 -2
- package/dist/mcp-generated.cjs.map +1 -1
- package/dist/mcp-generated.d.cts +3 -3
- package/dist/mcp-generated.d.ts +3 -3
- package/dist/mcp-generated.js +7 -2
- package/dist/mcp-generated.js.map +1 -1
- package/dist/mcp-http.d.cts +3 -2
- package/dist/mcp-http.d.ts +3 -2
- package/dist/mcp-stdio.d.cts +3 -2
- package/dist/mcp-stdio.d.ts +3 -2
- package/dist/{runtime-BoTPAvJH.d.cts → runtime-Bh5QDgZE.d.cts} +3 -2
- package/dist/{runtime-DQRudJFP.d.ts → runtime-dECqtgJT.d.ts} +3 -2
- package/dist/skills.d.cts +5 -4
- package/dist/skills.d.ts +5 -4
- package/dist/testing.d.cts +2 -1
- package/dist/testing.d.ts +2 -1
- package/dist/{types-CH3pdrak.d.cts → types-DMyGZRMW.d.cts} +2 -1
- package/dist/{types-CH3pdrak.d.ts → types-DMyGZRMW.d.ts} +2 -1
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -2639,6 +2639,10 @@ var OllamaStream = class {
|
|
|
2639
2639
|
}
|
|
2640
2640
|
}
|
|
2641
2641
|
}
|
|
2642
|
+
source;
|
|
2643
|
+
mapChunk;
|
|
2644
|
+
aggregate;
|
|
2645
|
+
initial;
|
|
2642
2646
|
mode = "unconsumed";
|
|
2643
2647
|
listeners = /* @__PURE__ */ new Map();
|
|
2644
2648
|
finalResultPromise;
|
|
@@ -3019,6 +3023,7 @@ var ModelsClient = class {
|
|
|
3019
3023
|
constructor(runner) {
|
|
3020
3024
|
this.runner = runner;
|
|
3021
3025
|
}
|
|
3026
|
+
runner;
|
|
3022
3027
|
list() {
|
|
3023
3028
|
return this.runner((http) => listAvailableModels(http), { singleEndpoint: true });
|
|
3024
3029
|
}
|
|
@@ -3504,6 +3509,7 @@ var OpenAIChatCompletionStream = class {
|
|
|
3504
3509
|
}
|
|
3505
3510
|
}
|
|
3506
3511
|
}
|
|
3512
|
+
source;
|
|
3507
3513
|
finalResultPromise;
|
|
3508
3514
|
resolveFinal;
|
|
3509
3515
|
rejectFinal;
|
|
@@ -3658,6 +3664,7 @@ var OpenAICompletionStream = class {
|
|
|
3658
3664
|
}
|
|
3659
3665
|
}
|
|
3660
3666
|
}
|
|
3667
|
+
source;
|
|
3661
3668
|
finalResultPromise;
|
|
3662
3669
|
resolveFinal;
|
|
3663
3670
|
rejectFinal;
|
|
@@ -3747,14 +3754,17 @@ var OpenAIResponsesStream = class {
|
|
|
3747
3754
|
}
|
|
3748
3755
|
}
|
|
3749
3756
|
}
|
|
3757
|
+
source;
|
|
3750
3758
|
finalResultPromise;
|
|
3751
3759
|
resolveFinal;
|
|
3752
3760
|
rejectFinal;
|
|
3753
3761
|
removeAbortListener;
|
|
3762
|
+
abortRequested = false;
|
|
3754
3763
|
get finalResult() {
|
|
3755
3764
|
return this.finalResultPromise;
|
|
3756
3765
|
}
|
|
3757
3766
|
abort() {
|
|
3767
|
+
this.abortRequested = true;
|
|
3758
3768
|
this.removeAbortListener?.();
|
|
3759
3769
|
this.removeAbortListener = void 0;
|
|
3760
3770
|
this.source.abort?.();
|
|
@@ -3768,6 +3778,7 @@ var OpenAIResponsesStream = class {
|
|
|
3768
3778
|
const outputs = /* @__PURE__ */ new Map();
|
|
3769
3779
|
const canonicalOutputItems = /* @__PURE__ */ new Map();
|
|
3770
3780
|
let completed = false;
|
|
3781
|
+
let sawDone = false;
|
|
3771
3782
|
const ensureState = (outputIndex, itemId, kind) => {
|
|
3772
3783
|
const existing = outputs.get(outputIndex);
|
|
3773
3784
|
if (existing) {
|
|
@@ -3843,7 +3854,10 @@ var OpenAIResponsesStream = class {
|
|
|
3843
3854
|
});
|
|
3844
3855
|
try {
|
|
3845
3856
|
for await (const event of this.source) {
|
|
3846
|
-
if (event.data === "[DONE]")
|
|
3857
|
+
if (event.data === "[DONE]") {
|
|
3858
|
+
sawDone = true;
|
|
3859
|
+
break;
|
|
3860
|
+
}
|
|
3847
3861
|
let payload;
|
|
3848
3862
|
try {
|
|
3849
3863
|
payload = JSON.parse(event.data);
|
|
@@ -3973,6 +3987,9 @@ var OpenAIResponsesStream = class {
|
|
|
3973
3987
|
}
|
|
3974
3988
|
yield payload;
|
|
3975
3989
|
}
|
|
3990
|
+
if (this.abortRequested) {
|
|
3991
|
+
throw new OllamaAbortError("OpenAI Responses stream aborted");
|
|
3992
|
+
}
|
|
3976
3993
|
if (terminalFailure || terminalIncomplete) {
|
|
3977
3994
|
const response = terminalFailure ?? terminalIncomplete;
|
|
3978
3995
|
const status = terminalFailure ? "failed" : "incomplete";
|
|
@@ -3992,6 +4009,11 @@ var OpenAIResponsesStream = class {
|
|
|
3992
4009
|
responseMeta
|
|
3993
4010
|
);
|
|
3994
4011
|
}
|
|
4012
|
+
if (!sawDone) {
|
|
4013
|
+
throw new OllamaStreamError(
|
|
4014
|
+
"OpenAI Responses stream ended without response.completed or [DONE]"
|
|
4015
|
+
);
|
|
4016
|
+
}
|
|
3995
4017
|
finalResponse = { ...responseMeta, output: reconstructedOutput(), status: "completed" };
|
|
3996
4018
|
} else if (finalResponse.status === "failed" || finalResponse.status === "incomplete") {
|
|
3997
4019
|
const detail = finalResponse.error?.message ?? finalResponse.incomplete_details?.reason ?? "unknown error";
|
|
@@ -4024,6 +4046,8 @@ var OpenAICompatClient = class {
|
|
|
4024
4046
|
this.http = http;
|
|
4025
4047
|
this.runner = runner;
|
|
4026
4048
|
}
|
|
4049
|
+
http;
|
|
4050
|
+
runner;
|
|
4027
4051
|
request(operation, model, signal, holdUntil) {
|
|
4028
4052
|
if (this.runner) {
|
|
4029
4053
|
return this.runner((http, runnerSignal) => operation(http, runnerSignal), {
|
|
@@ -4236,6 +4260,7 @@ var AnthropicMessagesStream = class {
|
|
|
4236
4260
|
}
|
|
4237
4261
|
}
|
|
4238
4262
|
}
|
|
4263
|
+
source;
|
|
4239
4264
|
finalResultPromise;
|
|
4240
4265
|
resolveFinal;
|
|
4241
4266
|
rejectFinal;
|
|
@@ -4364,6 +4389,8 @@ var AnthropicCompatClient = class {
|
|
|
4364
4389
|
this.http = http;
|
|
4365
4390
|
this.runner = runner;
|
|
4366
4391
|
}
|
|
4392
|
+
http;
|
|
4393
|
+
runner;
|
|
4367
4394
|
request(operation, model, signal, holdUntil) {
|
|
4368
4395
|
if (this.runner) {
|
|
4369
4396
|
return this.runner((http, runnerSignal) => operation(http, runnerSignal), {
|
|
@@ -4887,6 +4914,7 @@ var OllamaRuntime = class {
|
|
|
4887
4914
|
constructor(options) {
|
|
4888
4915
|
this.options = options;
|
|
4889
4916
|
}
|
|
4917
|
+
options;
|
|
4890
4918
|
/**
|
|
4891
4919
|
* Cached promise of the Ollama server version, populated lazily the first
|
|
4892
4920
|
* time a version-gated operation is invoked. `undefined` until then.
|
|
@@ -5222,6 +5250,7 @@ var ResponsesModule = class {
|
|
|
5222
5250
|
constructor(runner) {
|
|
5223
5251
|
this.runner = runner;
|
|
5224
5252
|
}
|
|
5253
|
+
runner;
|
|
5225
5254
|
/** The request body sent to the native endpoint (also reused for streaming). */
|
|
5226
5255
|
nativeBody(req) {
|
|
5227
5256
|
return {
|
|
@@ -5457,6 +5486,8 @@ var ConversationSession = class {
|
|
|
5457
5486
|
this.history.push(Object.freeze({ role: "system", content: config.systemPrompt }));
|
|
5458
5487
|
}
|
|
5459
5488
|
}
|
|
5489
|
+
client;
|
|
5490
|
+
config;
|
|
5460
5491
|
/** Ordered, append-only history. Message objects are frozen on push. */
|
|
5461
5492
|
history = [];
|
|
5462
5493
|
/** Mutable tallies behind the read-only {@link cacheStats} view. */
|
|
@@ -5922,6 +5953,7 @@ var NativeApi = class {
|
|
|
5922
5953
|
constructor(runtime) {
|
|
5923
5954
|
this.runtime = runtime;
|
|
5924
5955
|
}
|
|
5956
|
+
runtime;
|
|
5925
5957
|
blobs(digest, options) {
|
|
5926
5958
|
return this.runtime.invoke({
|
|
5927
5959
|
operation: blobsOp,
|
|
@@ -6024,6 +6056,7 @@ var FailoverHttpClient = class {
|
|
|
6024
6056
|
this.client = client;
|
|
6025
6057
|
this.baseUrl = baseUrl;
|
|
6026
6058
|
}
|
|
6059
|
+
client;
|
|
6027
6060
|
/**
|
|
6028
6061
|
* The first candidate endpoint's base URL. Used for inferRuntimeMode()
|
|
6029
6062
|
* checks (local vs cloud). The actual request routing picks the best
|
|
@@ -8338,6 +8371,8 @@ var McpBridge = class _McpBridge {
|
|
|
8338
8371
|
this.client = client;
|
|
8339
8372
|
this.options = options;
|
|
8340
8373
|
}
|
|
8374
|
+
client;
|
|
8375
|
+
options;
|
|
8341
8376
|
static toOllamaTools(tools, options = {}) {
|
|
8342
8377
|
const prefix = options.namePrefix ?? "";
|
|
8343
8378
|
return tools.map((tool) => ({
|
|
@@ -8790,6 +8825,7 @@ var ModelAffinityScheduler = class {
|
|
|
8790
8825
|
});
|
|
8791
8826
|
}
|
|
8792
8827
|
}
|
|
8828
|
+
client;
|
|
8793
8829
|
queues = /* @__PURE__ */ new Map();
|
|
8794
8830
|
concurrentModels;
|
|
8795
8831
|
perModelConcurrency;
|