context-mode 1.0.135 → 1.0.136
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/hooks.json +65 -0
- package/.codex-plugin/mcp.json +9 -0
- package/.codex-plugin/plugin.json +31 -0
- package/.openclaw-plugin/openclaw.plugin.json +1 -1
- package/.openclaw-plugin/package.json +1 -1
- package/README.md +60 -12
- package/build/adapters/pi/mcp-bridge.d.ts +37 -1
- package/build/adapters/pi/mcp-bridge.js +135 -21
- package/build/lifecycle.d.ts +13 -13
- package/build/lifecycle.js +14 -14
- package/build/session/extract.js +39 -1
- package/cli.bundle.mjs +3 -3
- package/configs/kilo/kilo.json +9 -2
- package/configs/opencode/opencode.json +9 -2
- package/hooks/codex/platform.mjs +1 -0
- package/hooks/codex/posttooluse.mjs +1 -0
- package/hooks/codex/precompact.mjs +1 -0
- package/hooks/codex/pretooluse.mjs +1 -0
- package/hooks/codex/sessionstart.mjs +1 -0
- package/hooks/codex/stop.mjs +1 -0
- package/hooks/codex/userpromptsubmit.mjs +1 -0
- package/hooks/core/routing.mjs +112 -10
- package/hooks/ensure-deps.mjs +14 -3
- package/hooks/session-extract.bundle.mjs +2 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -1
- package/server.bundle.mjs +4 -4
- package/build/openclaw-plugin.d.ts +0 -130
- package/build/openclaw-plugin.js +0 -626
- package/build/opencode-plugin.d.ts +0 -122
- package/build/opencode-plugin.js +0 -372
- package/build/pi-extension.d.ts +0 -14
- package/build/pi-extension.js +0 -451
- package/build/util/db-lock.d.ts +0 -65
- package/build/util/db-lock.js +0 -166
package/build/session/extract.js
CHANGED
|
@@ -613,7 +613,45 @@ function extractDecision(input) {
|
|
|
613
613
|
const questionText = Array.isArray(questions) && questions.length > 0
|
|
614
614
|
? String(questions[0]["question"] ?? "")
|
|
615
615
|
: "";
|
|
616
|
-
|
|
616
|
+
// tool_response is a JSON string that echoes the full request payload
|
|
617
|
+
// alongside the answers map: {"questions":[...],"answers":{"<q>":"<label>"}}.
|
|
618
|
+
// Stringifying the raw blob leaks the echoed questions/options into the
|
|
619
|
+
// event row and surfaces as "Unhandled case: [object Object]" downstream.
|
|
620
|
+
const rawResponse = String(input.tool_response ?? "");
|
|
621
|
+
let answerText = "";
|
|
622
|
+
try {
|
|
623
|
+
const parsed = JSON.parse(rawResponse);
|
|
624
|
+
const answers = parsed?.answers;
|
|
625
|
+
if (answers && typeof answers === "object") {
|
|
626
|
+
// multiSelect: true answers arrive as string[]; single-select arrive as
|
|
627
|
+
// string. Normalize both into a `" | "`-joined string so neither shape
|
|
628
|
+
// silently produces an empty answer.
|
|
629
|
+
const toAnswerText = (value) => {
|
|
630
|
+
if (typeof value === "string")
|
|
631
|
+
return value;
|
|
632
|
+
if (Array.isArray(value)) {
|
|
633
|
+
return value.filter((v) => typeof v === "string").join(" | ");
|
|
634
|
+
}
|
|
635
|
+
return "";
|
|
636
|
+
};
|
|
637
|
+
const matched = questionText ? toAnswerText(answers[questionText]) : "";
|
|
638
|
+
if (matched) {
|
|
639
|
+
answerText = matched;
|
|
640
|
+
}
|
|
641
|
+
else {
|
|
642
|
+
const values = Object.values(answers)
|
|
643
|
+
.map(toAnswerText)
|
|
644
|
+
.filter((v) => v.length > 0);
|
|
645
|
+
answerText = values.join(" | ");
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
catch {
|
|
650
|
+
// Non-JSON tool_response — fail safe with empty answer rather than
|
|
651
|
+
// leaking the raw text (which would re-introduce the original bug
|
|
652
|
+
// for any future caller that sends a non-JSON payload).
|
|
653
|
+
}
|
|
654
|
+
const answer = safeString(answerText);
|
|
617
655
|
const summary = questionText
|
|
618
656
|
? `Q: ${safeString(questionText)} → A: ${answer}`
|
|
619
657
|
: `answer: ${answer}`;
|