picosh 0.2.1 → 0.2.3
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/index.js +11 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -44,8 +44,9 @@ function downloadImage(url) {
|
|
|
44
44
|
|
|
45
45
|
// ─── AI waiting indicator ───────────────────────────────────────────────────
|
|
46
46
|
|
|
47
|
-
const ANSI_RE = /\x1b\[[0-9;]*[
|
|
48
|
-
|
|
47
|
+
const ANSI_RE = /\x1b\[[0-9;]*[A-Za-z]|\x1b\][^\x07]*\x07|\x07/g;
|
|
48
|
+
// Claude Codeの待機プロンプト: "❯ ? for shortcuts"
|
|
49
|
+
const PROMPT_RE = /❯\s*\?/;
|
|
49
50
|
const timers = {};
|
|
50
51
|
const waitingState = {};
|
|
51
52
|
|
|
@@ -57,15 +58,22 @@ function setWaiting(uid, waiting) {
|
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
exports.middleware = () => (next) => (action) => {
|
|
61
|
+
if (action.type && action.type.startsWith('SESSION_')) {
|
|
62
|
+
console.log('[picosh] action:', action.type, action.uid ? action.uid.slice(0, 8) : '');
|
|
63
|
+
}
|
|
64
|
+
|
|
60
65
|
if (action.type === 'SESSION_ADD_DATA') {
|
|
61
66
|
const {uid, data} = action;
|
|
62
67
|
const clean = data.replace(ANSI_RE, '');
|
|
68
|
+
console.log('[picosh] data:', JSON.stringify(clean.slice(-50)));
|
|
63
69
|
|
|
64
70
|
clearTimeout(timers[uid]);
|
|
65
71
|
setWaiting(uid, false);
|
|
66
72
|
|
|
67
73
|
timers[uid] = setTimeout(() => {
|
|
68
|
-
|
|
74
|
+
const matched = PROMPT_RE.test(clean);
|
|
75
|
+
console.log('[picosh] prompt match:', matched);
|
|
76
|
+
if (matched) setWaiting(uid, true);
|
|
69
77
|
}, 500);
|
|
70
78
|
}
|
|
71
79
|
|