@rei-standard/amsg-server 2.4.0 → 2.4.1
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.cjs +16 -6
- package/dist/index.d.cts +17 -4
- package/dist/index.d.ts +17 -4
- package/dist/index.mjs +14 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -515,13 +515,23 @@ function readReasoningContent(llmResponse) {
|
|
|
515
515
|
);
|
|
516
516
|
if (!Array.isArray(choices) || choices.length === 0) return null;
|
|
517
517
|
const message = (
|
|
518
|
-
/** @type {{ message?: { reasoning_content?: unknown } }} */
|
|
518
|
+
/** @type {{ message?: { reasoning_content?: unknown, content?: unknown } }} */
|
|
519
519
|
_optionalChain([choices, 'access', _2 => _2[0], 'optionalAccess', _3 => _3.message])
|
|
520
520
|
);
|
|
521
521
|
const raw = _optionalChain([message, 'optionalAccess', _4 => _4.reasoning_content]);
|
|
522
|
-
if (typeof raw
|
|
523
|
-
|
|
524
|
-
|
|
522
|
+
if (typeof raw === "string") {
|
|
523
|
+
const trimmed = raw.trim();
|
|
524
|
+
if (trimmed.length > 0) return trimmed;
|
|
525
|
+
}
|
|
526
|
+
const content = _optionalChain([message, 'optionalAccess', _5 => _5.content]);
|
|
527
|
+
if (typeof content === "string") {
|
|
528
|
+
const match = content.match(/<(think|thinking|thought)>([\s\S]*?)<\/\1>/i);
|
|
529
|
+
if (match) {
|
|
530
|
+
const trimmed = match[2].trim();
|
|
531
|
+
if (trimmed.length > 0) return trimmed;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
return null;
|
|
525
535
|
}
|
|
526
536
|
async function processSingleMessage(task, ctx, providedMasterKey) {
|
|
527
537
|
try {
|
|
@@ -694,7 +704,7 @@ async function _callAI(payload) {
|
|
|
694
704
|
);
|
|
695
705
|
}
|
|
696
706
|
const aiData = await aiResponse.json();
|
|
697
|
-
const content = _optionalChain([aiData, 'optionalAccess',
|
|
707
|
+
const content = _optionalChain([aiData, 'optionalAccess', _6 => _6.choices, 'optionalAccess', _7 => _7[0], 'optionalAccess', _8 => _8.message, 'optionalAccess', _9 => _9.content]);
|
|
698
708
|
if (typeof content !== "string" || !content.trim()) {
|
|
699
709
|
throw new Error("AI API error: response missing choices[0].message.content");
|
|
700
710
|
}
|
|
@@ -1378,7 +1388,7 @@ async function resolveBlobStore(namespace) {
|
|
|
1378
1388
|
}
|
|
1379
1389
|
try {
|
|
1380
1390
|
const blobModule = await Promise.resolve().then(() => _interopRequireWildcard(require("@netlify/blobs")));
|
|
1381
|
-
const getStore = blobModule.getStore || _optionalChain([blobModule, 'access',
|
|
1391
|
+
const getStore = blobModule.getStore || _optionalChain([blobModule, 'access', _10 => _10.default, 'optionalAccess', _11 => _11.getStore]);
|
|
1382
1392
|
if (typeof getStore === "function") {
|
|
1383
1393
|
return getStore({ name: namespace });
|
|
1384
1394
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -879,11 +879,24 @@ function readReasoningContent(llmResponse) {
|
|
|
879
879
|
if (!llmResponse || typeof llmResponse !== 'object') return null;
|
|
880
880
|
const choices = /** @type {{ choices?: unknown }} */ (llmResponse).choices;
|
|
881
881
|
if (!Array.isArray(choices) || choices.length === 0) return null;
|
|
882
|
-
const message = /** @type {{ message?: { reasoning_content?: unknown } }} */ (choices[0])?.message;
|
|
882
|
+
const message = /** @type {{ message?: { reasoning_content?: unknown, content?: unknown } }} */ (choices[0])?.message;
|
|
883
|
+
|
|
883
884
|
const raw = message?.reasoning_content;
|
|
884
|
-
if (typeof raw
|
|
885
|
-
|
|
886
|
-
|
|
885
|
+
if (typeof raw === 'string') {
|
|
886
|
+
const trimmed = raw.trim();
|
|
887
|
+
if (trimmed.length > 0) return trimmed;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
const content = message?.content;
|
|
891
|
+
if (typeof content === 'string') {
|
|
892
|
+
const match = content.match(/<(think|thinking|thought)>([\s\S]*?)<\/\1>/i);
|
|
893
|
+
if (match) {
|
|
894
|
+
const trimmed = match[2].trim();
|
|
895
|
+
if (trimmed.length > 0) return trimmed;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
return null;
|
|
887
900
|
}
|
|
888
901
|
|
|
889
902
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -879,11 +879,24 @@ function readReasoningContent(llmResponse) {
|
|
|
879
879
|
if (!llmResponse || typeof llmResponse !== 'object') return null;
|
|
880
880
|
const choices = /** @type {{ choices?: unknown }} */ (llmResponse).choices;
|
|
881
881
|
if (!Array.isArray(choices) || choices.length === 0) return null;
|
|
882
|
-
const message = /** @type {{ message?: { reasoning_content?: unknown } }} */ (choices[0])?.message;
|
|
882
|
+
const message = /** @type {{ message?: { reasoning_content?: unknown, content?: unknown } }} */ (choices[0])?.message;
|
|
883
|
+
|
|
883
884
|
const raw = message?.reasoning_content;
|
|
884
|
-
if (typeof raw
|
|
885
|
-
|
|
886
|
-
|
|
885
|
+
if (typeof raw === 'string') {
|
|
886
|
+
const trimmed = raw.trim();
|
|
887
|
+
if (trimmed.length > 0) return trimmed;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
const content = message?.content;
|
|
891
|
+
if (typeof content === 'string') {
|
|
892
|
+
const match = content.match(/<(think|thinking|thought)>([\s\S]*?)<\/\1>/i);
|
|
893
|
+
if (match) {
|
|
894
|
+
const trimmed = match[2].trim();
|
|
895
|
+
if (trimmed.length > 0) return trimmed;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
return null;
|
|
887
900
|
}
|
|
888
901
|
|
|
889
902
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -515,13 +515,23 @@ function readReasoningContent(llmResponse) {
|
|
|
515
515
|
);
|
|
516
516
|
if (!Array.isArray(choices) || choices.length === 0) return null;
|
|
517
517
|
const message = (
|
|
518
|
-
/** @type {{ message?: { reasoning_content?: unknown } }} */
|
|
518
|
+
/** @type {{ message?: { reasoning_content?: unknown, content?: unknown } }} */
|
|
519
519
|
choices[0]?.message
|
|
520
520
|
);
|
|
521
521
|
const raw = message?.reasoning_content;
|
|
522
|
-
if (typeof raw
|
|
523
|
-
|
|
524
|
-
|
|
522
|
+
if (typeof raw === "string") {
|
|
523
|
+
const trimmed = raw.trim();
|
|
524
|
+
if (trimmed.length > 0) return trimmed;
|
|
525
|
+
}
|
|
526
|
+
const content = message?.content;
|
|
527
|
+
if (typeof content === "string") {
|
|
528
|
+
const match = content.match(/<(think|thinking|thought)>([\s\S]*?)<\/\1>/i);
|
|
529
|
+
if (match) {
|
|
530
|
+
const trimmed = match[2].trim();
|
|
531
|
+
if (trimmed.length > 0) return trimmed;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
return null;
|
|
525
535
|
}
|
|
526
536
|
async function processSingleMessage(task, ctx, providedMasterKey) {
|
|
527
537
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rei-standard/amsg-server",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "ReiStandard Active Messaging server SDK with pluggable database adapters. Three-axis push schema (messageKind / messageType / messageSubtype) from @rei-standard/amsg-shared. Auto-emits ReasoningPush when the LLM response carries reasoning_content.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|