@oh-my-pi/pi-agent-core 14.9.9 → 15.0.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/CHANGELOG.md +5 -0
- package/package.json +6 -6
- package/src/agent-loop.ts +0 -22
- package/src/harmony-leak.ts +0 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-agent-core",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "15.0.1",
|
|
5
5
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
6
6
|
"homepage": "https://github.com/can1357/oh-my-pi",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -35,16 +35,16 @@
|
|
|
35
35
|
"fmt": "biome format --write ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@oh-my-pi/pi-ai": "
|
|
39
|
-
"@oh-my-pi/pi-natives": "
|
|
40
|
-
"@oh-my-pi/pi-utils": "
|
|
38
|
+
"@oh-my-pi/pi-ai": "15.0.1",
|
|
39
|
+
"@oh-my-pi/pi-natives": "15.0.1",
|
|
40
|
+
"@oh-my-pi/pi-utils": "15.0.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@sinclair/typebox": "^0.34.49",
|
|
44
|
-
"@types/bun": "^1.3.
|
|
44
|
+
"@types/bun": "^1.3.14"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
|
-
"bun": ">=1.3.
|
|
47
|
+
"bun": ">=1.3.14"
|
|
48
48
|
},
|
|
49
49
|
"files": [
|
|
50
50
|
"src",
|
package/src/agent-loop.ts
CHANGED
|
@@ -14,11 +14,9 @@ import {
|
|
|
14
14
|
import { sanitizeText } from "@oh-my-pi/pi-natives";
|
|
15
15
|
import {
|
|
16
16
|
createHarmonyAuditEvent,
|
|
17
|
-
extractHarmonyRemoved,
|
|
18
17
|
type HarmonyDetection,
|
|
19
18
|
type HarmonyRecoveredToolCall,
|
|
20
19
|
isHarmonyLeakMitigationTarget,
|
|
21
|
-
recoverHarmonyToolCall,
|
|
22
20
|
signalListLabel,
|
|
23
21
|
} from "./harmony-leak";
|
|
24
22
|
import type {
|
|
@@ -502,26 +500,6 @@ async function streamAssistantResponse(
|
|
|
502
500
|
|
|
503
501
|
const responseIterator = response[Symbol.asyncIterator]();
|
|
504
502
|
|
|
505
|
-
const _interruptForHarmonyLeak = (message: AssistantMessage, detection: HarmonyDetection): never => {
|
|
506
|
-
const recovered = recoverHarmonyToolCall(message, detection);
|
|
507
|
-
const removed = recovered?.removed ?? extractHarmonyRemoved(message, detection);
|
|
508
|
-
harmonyAbortController?.abort();
|
|
509
|
-
responseIterator.return?.()?.catch(() => {});
|
|
510
|
-
if (recovered) {
|
|
511
|
-
if (addedPartial) {
|
|
512
|
-
context.messages[context.messages.length - 1] = recovered.message;
|
|
513
|
-
} else {
|
|
514
|
-
context.messages.push(recovered.message);
|
|
515
|
-
stream.push({ type: "message_start", message: { ...recovered.message } });
|
|
516
|
-
}
|
|
517
|
-
stream.push({ type: "message_end", message: recovered.message });
|
|
518
|
-
throw new HarmonyLeakInterruption(detection, removed, recovered);
|
|
519
|
-
}
|
|
520
|
-
if (addedPartial) {
|
|
521
|
-
context.messages.pop();
|
|
522
|
-
}
|
|
523
|
-
throw new HarmonyLeakInterruption(detection, removed);
|
|
524
|
-
};
|
|
525
503
|
// Set up a single abort race: register the abort listener once for the whole
|
|
526
504
|
// stream and reuse the same race promise for every iterator.next() instead of
|
|
527
505
|
// allocating Promise.withResolvers and add/removeEventListener per event.
|
package/src/harmony-leak.ts
CHANGED
|
@@ -36,7 +36,6 @@ const FENCE_RE = /^\s*(?:```+|~~~+)/;
|
|
|
36
36
|
const SCRIPT_CLASS =
|
|
37
37
|
"\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\u0400-\u04FF\u0E00-\u0E7F\u10A0-\u10FF\u0530-\u058F\u0C80-\u0CFF\u0C00-\u0C7F\u0900-\u097F\u0600-\u06FF\u0D00-\u0D7F";
|
|
38
38
|
const SCRIPT_RUN_RE = new RegExp(`[${SCRIPT_CLASS}]{2,}`, "u");
|
|
39
|
-
const _SCRIPT_CHAR_RE = new RegExp(`[${SCRIPT_CLASS}]`, "u");
|
|
40
39
|
|
|
41
40
|
// Recovery registry. Each entry's parser must recognize the configured
|
|
42
41
|
// sentinel (per-tool, see eval/parse.ts and hashline/parser.ts) and surface
|