@myagentroam/agent 0.9.87 → 0.9.88
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/model/openai-responses.js +18 -0
- package/dist/sdk/agent.js +3 -9
- package/package.json +1 -1
|
@@ -897,6 +897,8 @@ function incrementalResponsesInput(state, current) {
|
|
|
897
897
|
const completion = state.lastResponse;
|
|
898
898
|
if (previous === undefined || completion === undefined)
|
|
899
899
|
return undefined;
|
|
900
|
+
if (!responsesContinuationPropertiesMatch(previous, current))
|
|
901
|
+
return undefined;
|
|
900
902
|
const baseline = [...previous.input, ...completion.outputItems];
|
|
901
903
|
if (current.input.length < baseline.length)
|
|
902
904
|
return undefined;
|
|
@@ -905,6 +907,22 @@ function incrementalResponsesInput(state, current) {
|
|
|
905
907
|
return undefined;
|
|
906
908
|
return current.input.slice(baseline.length);
|
|
907
909
|
}
|
|
910
|
+
function responsesContinuationPropertiesMatch(previous, current) {
|
|
911
|
+
const properties = [
|
|
912
|
+
'model',
|
|
913
|
+
'instructions',
|
|
914
|
+
'tools',
|
|
915
|
+
'tool_choice',
|
|
916
|
+
'parallel_tool_calls',
|
|
917
|
+
'reasoning',
|
|
918
|
+
'store',
|
|
919
|
+
'stream',
|
|
920
|
+
'include',
|
|
921
|
+
'prompt_cache_key',
|
|
922
|
+
'text'
|
|
923
|
+
];
|
|
924
|
+
return properties.every((property) => isDeepStrictEqual(previous[property], current[property]));
|
|
925
|
+
}
|
|
908
926
|
function clearResponsesContinuation(state) {
|
|
909
927
|
delete state.lastRequest;
|
|
910
928
|
delete state.lastResponse;
|
package/dist/sdk/agent.js
CHANGED
|
@@ -549,9 +549,7 @@ export async function createMarAgent(options) {
|
|
|
549
549
|
if (mode === 'compact') {
|
|
550
550
|
const compactSystemPrompt = initialSystemPrompt;
|
|
551
551
|
const compactHistory = [...messages];
|
|
552
|
-
const projectedHistory = normalizeMessagesForModel(insertContextualWorldState(compactHistory, contextualWorldState.entries, {
|
|
553
|
-
excludeResources: true
|
|
554
|
-
}), { supportsImages: false });
|
|
552
|
+
const projectedHistory = normalizeMessagesForModel(insertContextualWorldState(compactHistory, contextualWorldState.entries), { supportsImages: false });
|
|
555
553
|
const nativeMessages = buildNativeCompactionMessages(projectedHistory, {
|
|
556
554
|
focus: input.prompt,
|
|
557
555
|
highDensityCompaction: selectedModel.highDensityCompaction
|
|
@@ -607,9 +605,7 @@ export async function createMarAgent(options) {
|
|
|
607
605
|
let compactSummary = '';
|
|
608
606
|
const compactSystemPrompt = buildExecutionSystemPrompt(executionTools, 'run');
|
|
609
607
|
const compactHistory = retainCurrent ? messages.slice(0, -1) : messages;
|
|
610
|
-
const projectedHistory = normalizeMessagesForModel(insertContextualWorldState(compactHistory, contextualWorldState.entries, {
|
|
611
|
-
excludeResources: true
|
|
612
|
-
}), { supportsImages: false });
|
|
608
|
+
const projectedHistory = normalizeMessagesForModel(insertContextualWorldState(compactHistory, contextualWorldState.entries), { supportsImages: false });
|
|
613
609
|
const nativeCompactMessages = buildNativeCompactionMessages(projectedHistory, {
|
|
614
610
|
highDensityCompaction: selectedModel.highDensityCompaction
|
|
615
611
|
});
|
|
@@ -1802,12 +1798,10 @@ function modelIdFromPayload(payload, key = 'modelId') {
|
|
|
1802
1798
|
const value = payload[key];
|
|
1803
1799
|
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
1804
1800
|
}
|
|
1805
|
-
function insertContextualWorldState(messages, entries
|
|
1801
|
+
function insertContextualWorldState(messages, entries) {
|
|
1806
1802
|
const result = [...messages];
|
|
1807
1803
|
let offset = 0;
|
|
1808
1804
|
for (const entry of entries) {
|
|
1809
|
-
if (options.excludeResources && entry.kind === 'resources')
|
|
1810
|
-
continue;
|
|
1811
1805
|
const insertionIndex = Math.max(0, Math.min(entry.index + offset, result.length));
|
|
1812
1806
|
result.splice(insertionIndex, 0, { role: 'user', content: entry.content });
|
|
1813
1807
|
offset++;
|