picosh 0.2.5 → 0.2.6

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 (2) hide show
  1. package/index.js +9 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -54,12 +54,17 @@ let activeUid = null;
54
54
  function setWaiting(uid, waiting) {
55
55
  if (!uid) return;
56
56
  waitingState[uid] = waiting;
57
+ console.log('[picosh] setWaiting uid:', uid.slice(0, 8), 'waiting:', waiting);
57
58
  if (typeof window !== 'undefined') {
58
59
  window.dispatchEvent(new CustomEvent('picosh-ai-waiting', {detail: {uid, waiting}}));
59
60
  }
60
61
  }
61
62
 
62
63
  exports.middleware = () => (next) => (action) => {
64
+ if (action.type && action.type.startsWith('SESSION_')) {
65
+ console.log('[picosh] action:', action.type, 'uid:', action.uid ? action.uid.slice(0, 8) : 'none', 'activeUid:', activeUid ? activeUid.slice(0, 8) : 'none');
66
+ }
67
+
63
68
  if (action.type === 'SESSION_ADD' || action.type === 'SESSION_SET_ACTIVE') {
64
69
  if (action.uid) activeUid = action.uid;
65
70
  }
@@ -68,12 +73,15 @@ exports.middleware = () => (next) => (action) => {
68
73
  const uid = action.uid || activeUid;
69
74
  const {data} = action;
70
75
  const clean = data.replace(ANSI_RE, '');
76
+ console.log('[picosh] SESSION_ADD_DATA uid:', uid ? uid.slice(0, 8) : 'NONE', 'data tail:', JSON.stringify(clean.slice(-40)));
71
77
 
72
78
  clearTimeout(timers[uid]);
73
79
  setWaiting(uid, false);
74
80
 
75
81
  timers[uid] = setTimeout(() => {
76
- if (PROMPT_RE.test(clean)) setWaiting(uid, true);
82
+ const matched = PROMPT_RE.test(clean);
83
+ console.log('[picosh] timer fired, PROMPT_RE match:', matched, 'on:', JSON.stringify(clean.slice(-40)));
84
+ if (matched) setWaiting(uid, true);
77
85
  }, 500);
78
86
  }
79
87
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "picosh",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Hyper plugin: paste clipboard images as file paths",
5
5
  "main": "index.js",
6
6
  "license": "MIT",