@synkro-sh/cli 1.4.36 → 1.4.37

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
@@ -198,20 +198,18 @@ function installCCHooks(settingsPath, config) {
198
198
  ],
199
199
  [SYNKRO_MARKER]: true
200
200
  });
201
- if (!config.skipTranscriptSync) {
202
- settings.hooks.Stop = settings.hooks.Stop ?? [];
203
- removeSynkroEntries(settings.hooks, "Stop");
204
- settings.hooks.Stop.push({
205
- hooks: [
206
- {
207
- type: "command",
208
- command: config.transcriptSyncScriptPath,
209
- timeout: 3
210
- }
211
- ],
212
- [SYNKRO_MARKER]: true
213
- });
214
- }
201
+ settings.hooks.Stop = settings.hooks.Stop ?? [];
202
+ removeSynkroEntries(settings.hooks, "Stop");
203
+ settings.hooks.Stop.push({
204
+ hooks: [
205
+ {
206
+ type: "command",
207
+ command: config.transcriptSyncScriptPath,
208
+ timeout: 3
209
+ }
210
+ ],
211
+ [SYNKRO_MARKER]: true
212
+ });
215
213
  writeSettingsAtomic(settingsPath, settings);
216
214
  }
217
215
  function uninstallCCHooks(settingsPath) {
@@ -1460,18 +1458,14 @@ if [ -z "$SESSION_ID" ] || [ -z "$TRANSCRIPT_PATH" ] || [ ! -f "$TRANSCRIPT_PATH
1460
1458
  echo '{}'; exit 0
1461
1459
  fi
1462
1460
 
1463
- # Usage telemetry \u2014 always fires (metadata only, ungated by privacy/consent)
1464
- _LAST_ASST=$(grep '"type":"assistant"' "$TRANSCRIPT_PATH" 2>/dev/null | tail -1)
1461
+ # Usage telemetry \u2014 last turn only (metadata, ungated by privacy/consent)
1462
+ _LAST_ASST=$(tail -20 "$TRANSCRIPT_PATH" 2>/dev/null | grep '"type":"assistant"' | tail -1)
1465
1463
  if [ -n "$_LAST_ASST" ]; then
1466
1464
  _CC_MODEL=$(echo "$_LAST_ASST" | jq -r '.message.model // empty' 2>/dev/null)
1467
- _TOTALS=$(grep '"type":"assistant"' "$TRANSCRIPT_PATH" 2>/dev/null \\
1468
- | jq -c '.message.usage' 2>/dev/null \\
1469
- | jq -s '{in:(map(.input_tokens//0)|add//0),out:(map(.output_tokens//0)|add//0),cw:(map(.cache_creation_input_tokens//0)|add//0),cr:(map(.cache_read_input_tokens//0)|add//0)}' 2>/dev/null \\
1470
- || echo '{"in":0,"out":0,"cw":0,"cr":0}')
1471
- _TI=$(echo "$_TOTALS" | jq -r '.in // 0')
1472
- _TO=$(echo "$_TOTALS" | jq -r '.out // 0')
1473
- _TCW=$(echo "$_TOTALS" | jq -r '.cw // 0')
1474
- _TCR=$(echo "$_TOTALS" | jq -r '.cr // 0')
1465
+ _TI=$(echo "$_LAST_ASST" | jq -r '.message.usage.input_tokens // 0' 2>/dev/null)
1466
+ _TO=$(echo "$_LAST_ASST" | jq -r '.message.usage.output_tokens // 0' 2>/dev/null)
1467
+ _TCW=$(echo "$_LAST_ASST" | jq -r '.message.usage.cache_creation_input_tokens // 0' 2>/dev/null)
1468
+ _TCR=$(echo "$_LAST_ASST" | jq -r '.message.usage.cache_read_input_tokens // 0' 2>/dev/null)
1475
1469
  if [ "\${_TI:-0}" != "0" ] || [ "\${_TO:-0}" != "0" ]; then
1476
1470
  (
1477
1471
  _USAGE="{\\"input_tokens\\":$_TI,\\"output_tokens\\":$_TO,\\"cache_creation_input_tokens\\":$_TCW,\\"cache_read_input_tokens\\":$_TCR}"
@@ -3946,7 +3940,7 @@ function writeConfigEnv(opts) {
3946
3940
  `SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
3947
3941
  `SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
3948
3942
  `SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
3949
- `SYNKRO_VERSION=${shellQuoteSingle("1.4.36")}`
3943
+ `SYNKRO_VERSION=${shellQuoteSingle("1.4.37")}`
3950
3944
  ];
3951
3945
  if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
3952
3946
  if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);