@gajae-code/agent-core 0.2.1 → 0.2.2
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/CHANGELOG.md +6 -0
- package/package.json +4 -4
- package/src/agent-loop.ts +21 -23
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@gajae-code/agent-core",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
6
6
|
"homepage": "https://gaebal-gajae.dev",
|
|
7
7
|
"author": "Yeachan-Heo",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"fmt": "biome format --write ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@gajae-code/ai": "0.2.
|
|
39
|
-
"@gajae-code/natives": "0.2.
|
|
40
|
-
"@gajae-code/utils": "0.2.
|
|
38
|
+
"@gajae-code/ai": "0.2.2",
|
|
39
|
+
"@gajae-code/natives": "0.2.2",
|
|
40
|
+
"@gajae-code/utils": "0.2.2",
|
|
41
41
|
"@opentelemetry/api": "^1.9.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
package/src/agent-loop.ts
CHANGED
|
@@ -857,37 +857,35 @@ async function streamAssistantResponse(
|
|
|
857
857
|
}
|
|
858
858
|
|
|
859
859
|
function emitAbortedAssistantMessage(
|
|
860
|
-
|
|
860
|
+
_partialMessage: AssistantMessage | null,
|
|
861
861
|
addedPartial: boolean,
|
|
862
862
|
context: AgentContext,
|
|
863
863
|
config: AgentLoopConfig,
|
|
864
864
|
stream: EventStream<AgentEvent, AgentMessage[]>,
|
|
865
865
|
): AssistantMessage {
|
|
866
866
|
const errorMessage = "Request was aborted";
|
|
867
|
-
const
|
|
868
|
-
|
|
869
|
-
:
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
};
|
|
867
|
+
const now = Date.now();
|
|
868
|
+
const abortedMessage: AssistantMessage = {
|
|
869
|
+
role: "assistant",
|
|
870
|
+
content: [],
|
|
871
|
+
api: config.model.api,
|
|
872
|
+
provider: config.model.provider,
|
|
873
|
+
model: config.model.id,
|
|
874
|
+
usage: {
|
|
875
|
+
input: 0,
|
|
876
|
+
output: 0,
|
|
877
|
+
cacheRead: 0,
|
|
878
|
+
cacheWrite: 0,
|
|
879
|
+
totalTokens: 0,
|
|
880
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
|
|
881
|
+
},
|
|
882
|
+
stopReason: "aborted",
|
|
883
|
+
errorMessage,
|
|
884
|
+
timestamp: now,
|
|
885
|
+
};
|
|
887
886
|
if (addedPartial) {
|
|
888
|
-
context.messages
|
|
887
|
+
context.messages.pop();
|
|
889
888
|
} else {
|
|
890
|
-
context.messages.push(abortedMessage);
|
|
891
889
|
stream.push({ type: "message_start", message: { ...abortedMessage } });
|
|
892
890
|
}
|
|
893
891
|
stream.push({ type: "message_end", message: abortedMessage });
|