@synkro-sh/cli 1.7.5 → 1.7.7

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/dist/bootstrap.js CHANGED
@@ -1492,6 +1492,23 @@ export async function cweChannelUp(): Promise<boolean> {
1492
1492
  return channelUp(18930);
1493
1493
  }
1494
1494
 
1495
+ // \u2500\u2500\u2500 Rule-mining status (user-facing) \u2500\u2500\u2500
1496
+ // Asks the local server for the current rule-mining status line. The server returns
1497
+ // a non-empty systemMessage only while a job is active or just completed (once per
1498
+ // session); empty when idle. Best-effort + tightly timed so it never delays a hook.
1499
+ export async function fetchMiningStatusMessage(sessionId: string): Promise<string> {
1500
+ try {
1501
+ const port = process.env.SYNKRO_MCP_PORT || '18931';
1502
+ const u = 'http://127.0.0.1:' + port + '/api/local/rule-mining/status?session_id=' + encodeURIComponent(sessionId || '');
1503
+ const r = await fetch(u, { signal: AbortSignal.timeout(1500) });
1504
+ if (!r.ok) return '';
1505
+ const j = await r.json() as { systemMessage?: unknown };
1506
+ return typeof j.systemMessage === 'string' ? j.systemMessage : '';
1507
+ } catch {
1508
+ return '';
1509
+ }
1510
+ }
1511
+
1495
1512
  // \u2500\u2500\u2500 Mode Normalization \u2500\u2500\u2500
1496
1513
 
1497
1514
  export function normalizeMode(m?: string): 'ask' | 'fix' {
@@ -6844,7 +6861,7 @@ main();
6844
6861
  import {
6845
6862
  loadJwt, detectRepo, channelUp, tag, readStdin, writeCachedRepo,
6846
6863
  outputJson, outputEmpty, setupCursorHookSignals, hookSessionId, resolveTranscriptPath, GATEWAY_URL,
6847
- isLocalStorageMode, loadSynkroFile, log, synkroFilePresent, type HookConfig,
6864
+ isLocalStorageMode, loadSynkroFile, log, synkroFilePresent, fetchMiningStatusMessage, type HookConfig,
6848
6865
  } from './_synkro-common.ts';
6849
6866
 
6850
6867
  async function main() {
@@ -6921,13 +6938,13 @@ async function main() {
6921
6938
  signal: AbortSignal.timeout(3000),
6922
6939
  }).catch(() => {});
6923
6940
 
6924
- if (!openFindings) {
6925
- outputJson({ systemMessage: routeLine });
6926
- } else if (openFindings === 1) {
6927
- outputJson({ systemMessage: routeLine + '\\n' + tagStr + ' session start \u2192 1 open finding in this repo from a prior session.' });
6928
- } else {
6929
- outputJson({ systemMessage: routeLine + '\\n' + tagStr + ' session start \u2192 ' + openFindings + ' open findings in this repo from prior sessions.' });
6930
- }
6941
+ let sys = routeLine;
6942
+ if (openFindings === 1) sys += '\\n' + tagStr + ' session start \u2192 1 open finding in this repo from a prior session.';
6943
+ else if (openFindings) sys += '\\n' + tagStr + ' session start \u2192 ' + openFindings + ' open findings in this repo from prior sessions.';
6944
+ // Rule-mining status (initial sync). Empty unless a job is active / just finished.
6945
+ const miningMsg = await fetchMiningStatusMessage(sessionId);
6946
+ if (miningMsg) sys += '\\n' + miningMsg;
6947
+ outputJson({ systemMessage: sys });
6931
6948
  } catch (err) {
6932
6949
  log('sessionStart error: ' + String(err));
6933
6950
  outputEmpty();
@@ -7005,8 +7022,9 @@ main();
7005
7022
  TRANSCRIPT_SYNC_TS = `#!/usr/bin/env bun
7006
7023
  import {
7007
7024
  loadJwt, detectRepo, readStdin, aggregateUsage, appendLocalTelemetry,
7008
- outputEmpty, setupCursorHookSignals, hookSessionId, GATEWAY_URL, readSessionLog, shipCloud,
7025
+ outputEmpty, outputJson, setupCursorHookSignals, hookSessionId, GATEWAY_URL, readSessionLog, shipCloud,
7009
7026
  resolveTranscriptPath, syncConversationTranscript, emitUsageTick, cursorModelFromPayload, synkroFilePresent,
7027
+ fetchMiningStatusMessage,
7010
7028
  } from './_synkro-common.ts';
7011
7029
  import { readFileSync } from 'node:fs';
7012
7030
 
@@ -7057,6 +7075,11 @@ async function main() {
7057
7075
  }).catch(() => {});
7058
7076
  }
7059
7077
 
7078
+ // Rule-mining status \u2014 the ~50-msg sync cadence runs through this hook, so this is
7079
+ // where a "following run" surfaces. Empty unless a job is active / just finished,
7080
+ // so an idle pool prints nothing.
7081
+ const miningMsg = await fetchMiningStatusMessage(sessionId);
7082
+ if (miningMsg) { outputJson({ systemMessage: miningMsg }); return; }
7060
7083
  outputEmpty();
7061
7084
  } catch {
7062
7085
  outputEmpty();
@@ -11611,7 +11634,7 @@ function writeConfigEnv(opts) {
11611
11634
  `SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
11612
11635
  `SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
11613
11636
  `SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
11614
- `SYNKRO_VERSION=${shellQuoteSingle("1.7.5")}`
11637
+ `SYNKRO_VERSION=${shellQuoteSingle("1.7.7")}`
11615
11638
  ];
11616
11639
  if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
11617
11640
  if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
@@ -13573,7 +13596,7 @@ tmux kill-session -t "=$SESSION" 2>/dev/null || true
13573
13596
  # Start claude inside a detached tmux session so it has a real pty.
13574
13597
  # Redirect stderr to the log so we can see why it dies.
13575
13598
  tmux new-session -d -s "$SESSION" \\
13576
- "SYNKRO_CHANNEL_PORT=${CHANNEL_1_PORT} CLAUDE_CODE_DISABLE_THINKING=1 claude --dangerously-load-development-channels server:synkro-local --dangerously-skip-permissions --setting-sources project,local --model claude-sonnet-4-6 2>>$LOG; echo 'claude exited with code '$'?' >> $LOG"
13599
+ "SYNKRO_CHANNEL_PORT=${CHANNEL_1_PORT} CLAUDE_CODE_DISABLE_THINKING=1 claude --dangerously-load-development-channels server:synkro-local --dangerously-skip-permissions --setting-sources project,local --model claude-sonnet-5 2>>$LOG; echo 'claude exited with code '$'?' >> $LOG"
13577
13600
 
13578
13601
  # Claude's --dangerously-load-development-channels shows a confirmation
13579
13602
  # prompt: option 1 = "I am using this for local development" (accept),
@@ -13635,7 +13658,7 @@ log "claude version: $(claude --version 2>&1 | head -1)"
13635
13658
  tmux kill-session -t "=$SESSION" 2>/dev/null || true
13636
13659
 
13637
13660
  tmux new-session -d -s "$SESSION" \\
13638
- "SYNKRO_CHANNEL_PORT=${CHANNEL_2_PORT} CLAUDE_CODE_DISABLE_THINKING=1 claude --dangerously-load-development-channels server:synkro-local --dangerously-skip-permissions --setting-sources project,local --model claude-sonnet-4-6 2>>$LOG; echo 'claude exited with code '$'?' >> $LOG"
13661
+ "SYNKRO_CHANNEL_PORT=${CHANNEL_2_PORT} CLAUDE_CODE_DISABLE_THINKING=1 claude --dangerously-load-development-channels server:synkro-local --dangerously-skip-permissions --setting-sources project,local --model claude-sonnet-5 2>>$LOG; echo 'claude exited with code '$'?' >> $LOG"
13639
13662
 
13640
13663
  sleep 3
13641
13664
  if tmux has-session -t "=$SESSION" 2>/dev/null; then
@@ -13691,7 +13714,7 @@ log "claude version: $(claude --version 2>&1 | head -1)"
13691
13714
  tmux kill-session -t "=$SESSION" 2>/dev/null || true
13692
13715
 
13693
13716
  tmux new-session -d -s "$SESSION" \\
13694
- "SYNKRO_CHANNEL_PORT=${CHANNEL_3_PORT} CLAUDE_CODE_DISABLE_THINKING=1 claude --dangerously-load-development-channels server:synkro-local --dangerously-skip-permissions --setting-sources project,local --model claude-sonnet-4-6 2>>$LOG; echo 'claude exited with code '$'?' >> $LOG"
13717
+ "SYNKRO_CHANNEL_PORT=${CHANNEL_3_PORT} CLAUDE_CODE_DISABLE_THINKING=1 claude --dangerously-load-development-channels server:synkro-local --dangerously-skip-permissions --setting-sources project,local --model claude-sonnet-5 2>>$LOG; echo 'claude exited with code '$'?' >> $LOG"
13695
13718
 
13696
13719
  sleep 3
13697
13720
  if tmux has-session -t "=$SESSION" 2>/dev/null; then
@@ -13747,7 +13770,7 @@ log "claude version: $(claude --version 2>&1 | head -1)"
13747
13770
  tmux kill-session -t "=$SESSION" 2>/dev/null || true
13748
13771
 
13749
13772
  tmux new-session -d -s "$SESSION" \\
13750
- "SYNKRO_CHANNEL_PORT=${CHANNEL_4_PORT} CLAUDE_CODE_DISABLE_THINKING=1 claude --dangerously-load-development-channels server:synkro-local --dangerously-skip-permissions --setting-sources project,local --model claude-sonnet-4-6 2>>$LOG; echo 'claude exited with code '$'?' >> $LOG"
13773
+ "SYNKRO_CHANNEL_PORT=${CHANNEL_4_PORT} CLAUDE_CODE_DISABLE_THINKING=1 claude --dangerously-load-development-channels server:synkro-local --dangerously-skip-permissions --setting-sources project,local --model claude-sonnet-5 2>>$LOG; echo 'claude exited with code '$'?' >> $LOG"
13751
13774
 
13752
13775
  sleep 3
13753
13776
  if tmux has-session -t "=$SESSION" 2>/dev/null; then
@@ -15674,7 +15697,7 @@ var args = process.argv.slice(2);
15674
15697
  var cmd = args[0] || "";
15675
15698
  var subArgs = args.slice(1);
15676
15699
  function printVersion() {
15677
- console.log("1.7.5");
15700
+ console.log("1.7.7");
15678
15701
  }
15679
15702
  function printHelp2() {
15680
15703
  console.log(`Synkro CLI \u2014 runtime safety for AI coding agents