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.
Files changed (37) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codex-plugin/hooks.json +65 -0
  4. package/.codex-plugin/mcp.json +9 -0
  5. package/.codex-plugin/plugin.json +31 -0
  6. package/.openclaw-plugin/openclaw.plugin.json +1 -1
  7. package/.openclaw-plugin/package.json +1 -1
  8. package/README.md +60 -12
  9. package/build/adapters/pi/mcp-bridge.d.ts +37 -1
  10. package/build/adapters/pi/mcp-bridge.js +135 -21
  11. package/build/lifecycle.d.ts +13 -13
  12. package/build/lifecycle.js +14 -14
  13. package/build/session/extract.js +39 -1
  14. package/cli.bundle.mjs +3 -3
  15. package/configs/kilo/kilo.json +9 -2
  16. package/configs/opencode/opencode.json +9 -2
  17. package/hooks/codex/platform.mjs +1 -0
  18. package/hooks/codex/posttooluse.mjs +1 -0
  19. package/hooks/codex/precompact.mjs +1 -0
  20. package/hooks/codex/pretooluse.mjs +1 -0
  21. package/hooks/codex/sessionstart.mjs +1 -0
  22. package/hooks/codex/stop.mjs +1 -0
  23. package/hooks/codex/userpromptsubmit.mjs +1 -0
  24. package/hooks/core/routing.mjs +112 -10
  25. package/hooks/ensure-deps.mjs +14 -3
  26. package/hooks/session-extract.bundle.mjs +2 -2
  27. package/openclaw.plugin.json +1 -1
  28. package/package.json +2 -1
  29. package/server.bundle.mjs +4 -4
  30. package/build/openclaw-plugin.d.ts +0 -130
  31. package/build/openclaw-plugin.js +0 -626
  32. package/build/opencode-plugin.d.ts +0 -122
  33. package/build/opencode-plugin.js +0 -372
  34. package/build/pi-extension.d.ts +0 -14
  35. package/build/pi-extension.js +0 -451
  36. package/build/util/db-lock.d.ts +0 -65
  37. package/build/util/db-lock.js +0 -166
@@ -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
- const answer = safeString(String(input.tool_response ?? ""));
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}`;