@geravant/sinain 1.7.1 → 1.7.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geravant/sinain",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "Ambient intelligence that sees what you see, hears what you hear, and acts on your behalf",
5
5
  "type": "module",
6
6
  "bin": {
@@ -24,7 +24,7 @@ fi
24
24
 
25
25
  MCP_CONFIG="${MCP_CONFIG:-$SCRIPT_DIR/mcp-config.json}"
26
26
  CORE_URL="${SINAIN_CORE_URL:-http://localhost:9500}"
27
- POLL_INTERVAL="${SINAIN_POLL_INTERVAL:-5}"
27
+ POLL_INTERVAL="${SINAIN_POLL_INTERVAL:-2}"
28
28
  HEARTBEAT_INTERVAL="${SINAIN_HEARTBEAT_INTERVAL:-900}" # 15 minutes
29
29
  AGENT="${SINAIN_AGENT:-claude}"
30
30
  WORKSPACE="${SINAIN_WORKSPACE:-$HOME/.openclaw/workspace}"
@@ -72,14 +72,10 @@ invoke_agent() {
72
72
  ;;
73
73
  codex)
74
74
  codex exec -s danger-full-access \
75
- --dangerously-bypass-approvals-and-sandbox \
76
75
  "$prompt"
77
76
  ;;
78
77
  junie)
79
78
  if $JUNIE_HAS_MCP; then
80
- if [ ! -f "$HOME/.junie/allowlist.json" ]; then
81
- echo " ⚠ Junie: no allowlist.json — MCP tools may prompt. Run junie --brave once to create it." >&2
82
- fi
83
79
  junie --output-format text \
84
80
  --mcp-location "$JUNIE_MCP_DIR" \
85
81
  --task "$prompt"
@@ -88,7 +84,7 @@ invoke_agent() {
88
84
  fi
89
85
  ;;
90
86
  goose)
91
- GOOSE_MODE=auto goose run --text "$prompt" \
87
+ goose run --text "$prompt" \
92
88
  --output-format text \
93
89
  --max-turns 10
94
90
  ;;
@@ -75,6 +75,7 @@ export class AgentLoop extends EventEmitter {
75
75
  private running = false;
76
76
  private started = false;
77
77
  private firstTick = true;
78
+ private urgentPending = false;
78
79
 
79
80
  private lastPushedHud = "";
80
81
  private agentNextId = 1;
@@ -137,11 +138,12 @@ export class AgentLoop extends EventEmitter {
137
138
  * Called by sense POST handler and transcription callback.
138
139
  * Triggers debounced analysis.
139
140
  */
140
- onNewContext(): void {
141
+ onNewContext(urgent = false): void {
141
142
  if (!this.started) return;
142
143
 
143
- // Fast first tick: 500ms debounce on startup, normal debounce after
144
- const delay = this.firstTick ? 500 : this.deps.agentConfig.debounceMs;
144
+ // Urgent: user command minimal debounce, bypass cooldown
145
+ const delay = urgent ? 200 : this.firstTick ? 500 : this.deps.agentConfig.debounceMs;
146
+ if (urgent) this.urgentPending = true;
145
147
  if (this.debounceTimer) clearTimeout(this.debounceTimer);
146
148
  this.debounceTimer = setTimeout(() => {
147
149
  this.debounceTimer = null;
@@ -235,8 +237,10 @@ export class AgentLoop extends EventEmitter {
235
237
  if (this.running) return;
236
238
  if (!this.deps.agentConfig.openrouterApiKey) return;
237
239
 
238
- // Cooldown: don't re-analyze within cooldownMs of last run
239
- if (Date.now() - this.lastRunTs < this.deps.agentConfig.cooldownMs) return;
240
+ // Cooldown: don't re-analyze within cooldownMs of last run (unless urgent)
241
+ const isUrgent = this.urgentPending;
242
+ this.urgentPending = false;
243
+ if (!isUrgent && Date.now() - this.lastRunTs < this.deps.agentConfig.cooldownMs) return;
240
244
 
241
245
  // Idle suppression: skip if no new events since last tick
242
246
  const { feedBuffer, senseBuffer } = this.deps;
@@ -457,6 +457,8 @@ async function main() {
457
457
  },
458
458
  onUserCommand: (text) => {
459
459
  escalator.setUserCommand(text);
460
+ // Trigger agent loop immediately for user commands (bypass debounce + cooldown)
461
+ agentLoop.onNewContext(true);
460
462
  },
461
463
  onSpawnCommand: (text) => {
462
464
  escalator.dispatchSpawnTask(text, "user-command").catch((err) => {