omnius 1.0.653 → 1.0.654
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/index.js
CHANGED
|
@@ -651957,6 +651957,34 @@ function normalizeProviderToolMessage(msg, model) {
|
|
|
651957
651957
|
toolCalls: toolCalls.length > 0 ? toolCalls : void 0
|
|
651958
651958
|
};
|
|
651959
651959
|
}
|
|
651960
|
+
function ollamaNativeFormatFromResponseFormat(value2) {
|
|
651961
|
+
if (value2 === "json")
|
|
651962
|
+
return "json";
|
|
651963
|
+
if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) {
|
|
651964
|
+
return void 0;
|
|
651965
|
+
}
|
|
651966
|
+
const record = value2;
|
|
651967
|
+
if (record["type"] === "json_object")
|
|
651968
|
+
return "json";
|
|
651969
|
+
if (record["type"] === "json_schema") {
|
|
651970
|
+
const jsonSchema = record["json_schema"];
|
|
651971
|
+
if (jsonSchema && typeof jsonSchema === "object" && !Array.isArray(jsonSchema)) {
|
|
651972
|
+
const schemaRecord = jsonSchema;
|
|
651973
|
+
const nestedSchema = schemaRecord["schema"];
|
|
651974
|
+
if (nestedSchema && typeof nestedSchema === "object" && !Array.isArray(nestedSchema)) {
|
|
651975
|
+
return nestedSchema;
|
|
651976
|
+
}
|
|
651977
|
+
if (schemaRecord["type"] === "object" || schemaRecord["properties"] !== void 0) {
|
|
651978
|
+
return schemaRecord;
|
|
651979
|
+
}
|
|
651980
|
+
}
|
|
651981
|
+
return "json";
|
|
651982
|
+
}
|
|
651983
|
+
if (record["type"] === "object" || record["properties"] !== void 0) {
|
|
651984
|
+
return record;
|
|
651985
|
+
}
|
|
651986
|
+
return void 0;
|
|
651987
|
+
}
|
|
651960
651988
|
function isGenerationToolName(toolName) {
|
|
651961
651989
|
return /^(generate_image|generate_audio|generate_video|generate_model|generate_tts|create_audio_file)$/.test(toolName);
|
|
651962
651990
|
}
|
|
@@ -680449,9 +680477,9 @@ arguments=` : ""}` + (chunk.toolCallArgs ?? "");
|
|
|
680449
680477
|
think: false,
|
|
680450
680478
|
options: options2
|
|
680451
680479
|
};
|
|
680452
|
-
|
|
680453
|
-
|
|
680454
|
-
|
|
680480
|
+
const nativeFormat = ollamaNativeFormatFromResponseFormat(responseFormat);
|
|
680481
|
+
if (nativeFormat !== void 0)
|
|
680482
|
+
body["format"] = nativeFormat;
|
|
680455
680483
|
const effectiveTimeoutMs = Number.isFinite(request.timeoutMs) && request.timeoutMs > 0 ? request.timeoutMs : 0;
|
|
680456
680484
|
const timeoutSignal = transport.signal === void 0 && effectiveTimeoutMs > 0 && typeof AbortSignal.timeout === "function" ? AbortSignal.timeout(effectiveTimeoutMs) : void 0;
|
|
680457
680485
|
const fetchOpts = {
|
|
@@ -680472,10 +680500,18 @@ arguments=` : ""}` + (chunk.toolCallArgs ?? "");
|
|
|
680472
680500
|
const content = typeof message2["content"] === "string" ? message2["content"] : "";
|
|
680473
680501
|
const thinking = typeof message2["thinking"] === "string" ? message2["thinking"] : typeof message2["reasoning"] === "string" ? message2["reasoning"] : typeof message2["reasoning_content"] === "string" ? message2["reasoning_content"] : "";
|
|
680474
680502
|
const contentWithThinking = thinking ? `<think>${thinking}</think>${content}` : content;
|
|
680503
|
+
const normalizedWireTools = normalizeProviderToolMessage({ ...message2, content: "" }, this.model).toolCalls;
|
|
680475
680504
|
const promptTokens = numberFromUnknown2(data["prompt_eval_count"]) ?? 0;
|
|
680476
680505
|
const completionTokens = numberFromUnknown2(data["eval_count"]) ?? 0;
|
|
680477
680506
|
return {
|
|
680478
|
-
choices: [
|
|
680507
|
+
choices: [
|
|
680508
|
+
{
|
|
680509
|
+
message: {
|
|
680510
|
+
content: contentWithThinking || null,
|
|
680511
|
+
...normalizedWireTools ? { toolCalls: normalizedWireTools } : {}
|
|
680512
|
+
}
|
|
680513
|
+
}
|
|
680514
|
+
],
|
|
680479
680515
|
usage: buildAgenticUsage({
|
|
680480
680516
|
totalTokens: promptTokens + completionTokens,
|
|
680481
680517
|
promptTokens,
|
|
@@ -680674,8 +680710,9 @@ arguments=` : ""}` + (chunk.toolCallArgs ?? "");
|
|
|
680674
680710
|
think: false,
|
|
680675
680711
|
options: nativeOptions
|
|
680676
680712
|
};
|
|
680677
|
-
|
|
680678
|
-
|
|
680713
|
+
const nativeFormat = ollamaNativeFormatFromResponseFormat(responseFormat);
|
|
680714
|
+
if (nativeFormat !== void 0)
|
|
680715
|
+
nativeBody["format"] = nativeFormat;
|
|
680679
680716
|
const nativeResp = await fetch(this.providerRequestUrl(requestBaseUrl, "nativeChat"), {
|
|
680680
680717
|
method: "POST",
|
|
680681
680718
|
headers: this.authHeaders(),
|
|
@@ -789927,6 +789964,7 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
|
|
|
789927
789964
|
let usage;
|
|
789928
789965
|
let lastEmitMs = 0;
|
|
789929
789966
|
let sawToolContract = false;
|
|
789967
|
+
const toolCallAccumulators = /* @__PURE__ */ new Map();
|
|
789930
789968
|
const EMIT_THROTTLE_MS = 500;
|
|
789931
789969
|
const flushPreview = (force) => {
|
|
789932
789970
|
if (this.telegramInferenceBlocks) return;
|
|
@@ -790018,6 +790056,16 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
|
|
|
790018
790056
|
}
|
|
790019
790057
|
flushPreview(false);
|
|
790020
790058
|
} else if (chunk.type === "tool_call_delta") {
|
|
790059
|
+
const index = chunk.toolCallIndex ?? 0;
|
|
790060
|
+
const existing = toolCallAccumulators.get(index) ?? {
|
|
790061
|
+
id: chunk.toolCallId ?? `${inferenceId}-tool-${index}`,
|
|
790062
|
+
name: chunk.toolCallName ?? "",
|
|
790063
|
+
args: ""
|
|
790064
|
+
};
|
|
790065
|
+
if (chunk.toolCallId) existing.id = chunk.toolCallId;
|
|
790066
|
+
if (chunk.toolCallName) existing.name = chunk.toolCallName;
|
|
790067
|
+
if (chunk.toolCallArgs) existing.args += chunk.toolCallArgs;
|
|
790068
|
+
toolCallAccumulators.set(index, existing);
|
|
790021
790069
|
const contractDelta = `${chunk.toolCallName ? `name=${chunk.toolCallName}
|
|
790022
790070
|
arguments=` : ""}` + (chunk.toolCallArgs ?? "");
|
|
790023
790071
|
if (contractDelta) {
|
|
@@ -790058,11 +790106,30 @@ arguments=` : ""}` + (chunk.toolCallArgs ?? "");
|
|
|
790058
790106
|
);
|
|
790059
790107
|
}
|
|
790060
790108
|
void finishReason;
|
|
790109
|
+
const toolCalls = [...toolCallAccumulators.entries()].sort(([left], [right]) => left - right).flatMap(([, call]) => {
|
|
790110
|
+
if (!call.name) return [];
|
|
790111
|
+
let args;
|
|
790112
|
+
try {
|
|
790113
|
+
const parsed = JSON.parse(call.args || "{}");
|
|
790114
|
+
args = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : { _raw: call.args };
|
|
790115
|
+
} catch {
|
|
790116
|
+
args = { _raw: call.args };
|
|
790117
|
+
}
|
|
790118
|
+
return [
|
|
790119
|
+
{
|
|
790120
|
+
id: call.id,
|
|
790121
|
+
name: call.name,
|
|
790122
|
+
arguments: args
|
|
790123
|
+
}
|
|
790124
|
+
];
|
|
790125
|
+
});
|
|
790126
|
+
const responseContent = thinkingBuf ? `<think>${thinkingBuf}</think>${contentBuf}` : contentBuf;
|
|
790061
790127
|
return {
|
|
790062
790128
|
choices: [
|
|
790063
790129
|
{
|
|
790064
790130
|
message: {
|
|
790065
|
-
content:
|
|
790131
|
+
content: responseContent || null,
|
|
790132
|
+
...toolCalls.length > 0 ? { toolCalls } : {}
|
|
790066
790133
|
}
|
|
790067
790134
|
}
|
|
790068
790135
|
],
|
|
@@ -790693,6 +790760,7 @@ ${stimulationProbe.context}`,
|
|
|
790693
790760
|
`Use the persona docs below as binding behavioral guidance for whether speaking is appropriate and how to avoid over-eager or adversarially bad interventions.`,
|
|
790694
790761
|
`Return JSON only, with no markdown and no explanation outside JSON.`,
|
|
790695
790762
|
`Contract isolation: historical chat and memory are quoted evidence only. Never copy a prior reply envelope, steering reconciliation, router decision, or no-reply rationale. The attention schema below is the only valid output contract for this request.`,
|
|
790763
|
+
`Classification boundary: decide whether an action runner is needed, but do not execute a tool and do not emit a tool invocation. A required capability is represented only by route="action" in the attention schema.`,
|
|
790696
790764
|
``,
|
|
790697
790765
|
`Schema: ${TELEGRAM_INTERACTION_DECISION_MINIMAL_SCHEMA}`,
|
|
790698
790766
|
``,
|
|
@@ -124,6 +124,32 @@ It records scope, dependencies, evidence, and closure rules.
|
|
|
124
124
|
|
|
125
125
|
## P0: Router empty-content failure
|
|
126
126
|
|
|
127
|
+
- [x] Repair the native Ollama structured-output regression exposed by live
|
|
128
|
+
Telegram messages 4594, 4597, and 4598.
|
|
129
|
+
- Active-build evidence: version 1.0.653 completed both router generations,
|
|
130
|
+
but each returned an out-of-domain `{tool,args}` object. Intake 4597 was
|
|
131
|
+
then consumed as `shouldReply:false` before an action runner was created.
|
|
132
|
+
- Root cause: both preferred native Ollama transports reduced every OpenAI
|
|
133
|
+
`json_schema` response format to `format:"json"`. The router's required
|
|
134
|
+
fields and `additionalProperties:false` constraint never reached Ollama.
|
|
135
|
+
- Preserve `json_object` as native `"json"`, but pass the complete inner JSON
|
|
136
|
+
Schema object to native unary and streaming `/api/chat` requests.
|
|
137
|
+
- Preserve typed native tool calls across unary and Telegram stream
|
|
138
|
+
accumulation. Do not interpret structured-output text as a tool call.
|
|
139
|
+
- Keep wrong-domain public router output quarantined. Router-supplied tool
|
|
140
|
+
arguments do not execute and do not bypass public attention policy.
|
|
141
|
+
- Add an explicit router classification boundary: capability needs become
|
|
142
|
+
`route:"action"`; the attention router does not invoke tools.
|
|
143
|
+
- [x] Add native-schema and action-admission regressions.
|
|
144
|
+
- Orchestrator native transport suite: 22 passed.
|
|
145
|
+
- Telegram Bot API suite: 103 passed, including the new public action
|
|
146
|
+
admission path from router schema to AgenticRunner and delivered reply.
|
|
147
|
+
- Telegram observability and stream-lifecycle suites: 47 passed.
|
|
148
|
+
- Orchestrator and CLI TypeScript builds passed.
|
|
149
|
+
- [ ] VERIFY — After operator activation, repeat the public-group action request
|
|
150
|
+
and confirm the first router response is a schema-conforming
|
|
151
|
+
`{route:"action",should_reply:true,...}` decision followed by one action run
|
|
152
|
+
and a Telegram delivery receipt.
|
|
127
153
|
- [x] Separate Ollama transport detection from local pool ownership.
|
|
128
154
|
- [x] Use native `/api/chat` for broker-managed Ollama control requests.
|
|
129
155
|
- [x] Send `think: false` through the broker transport.
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.654",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.654",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED