farming-code 2.2.6 → 2.2.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/index.html CHANGED
@@ -15,7 +15,7 @@
15
15
  <link rel="apple-touch-icon" sizes="180x180" href="/farming/farming-2/app-icon-v2-180.png" />
16
16
  <link rel="manifest" href="/farming/farming-2/site.webmanifest" />
17
17
  <title>Farming 2</title>
18
- <script type="module" crossorigin src="/farming/assets/index-BpHPeJf0.js"></script>
18
+ <script type="module" crossorigin src="/farming/assets/index-B8SHldPE.js"></script>
19
19
  <link rel="modulepreload" crossorigin href="/farming/assets/chunk-DECur_0Z.js">
20
20
  <link rel="modulepreload" crossorigin href="/farming/assets/preload-helper-mJowh_hw.js">
21
21
  <link rel="modulepreload" crossorigin href="/farming/assets/jsx-runtime-BthL93pI.js">
@@ -3063,6 +3063,21 @@ function formatCrtExactUsageValue(value) {
3063
3063
  return Math.round(numberValue).toLocaleString('en-US');
3064
3064
  }
3065
3065
 
3066
+ function formatCrtCompactTotalValue(value) {
3067
+ const numberValue = Number(value);
3068
+ if (!Number.isFinite(numberValue) || numberValue < 0) return '--';
3069
+ const units = [
3070
+ [1_000_000_000, 'B'],
3071
+ [1_000_000, 'M'],
3072
+ [1_000, 'K'],
3073
+ ];
3074
+ const unit = units.find(([threshold]) => numberValue >= threshold);
3075
+ if (!unit) return String(Math.round(numberValue));
3076
+ const compact = numberValue / unit[0];
3077
+ const precision = compact >= 100 ? 0 : compact >= 10 ? 1 : 2;
3078
+ return `${Number(compact.toFixed(precision))}${unit[1]}`;
3079
+ }
3080
+
3066
3081
  function parseCrtBillingDate(dateValue) {
3067
3082
  const parts = String(dateValue || '').split('-').map(Number);
3068
3083
  if (parts.length !== 3 || parts.some(part => !Number.isFinite(part))) return null;
@@ -3200,6 +3215,7 @@ function renderCrtBillingSelectedDay() {
3200
3215
  const date = document.getElementById('billing-day-date');
3201
3216
  const stateLabel = document.getElementById('billing-day-state');
3202
3217
  const total = document.getElementById('billing-day-total');
3218
+ const compactTotal = document.getElementById('billing-day-total-compact');
3203
3219
  const input = document.getElementById('billing-day-input');
3204
3220
  const output = document.getElementById('billing-day-output');
3205
3221
  const cacheRead = document.getElementById('billing-day-cache-read');
@@ -3207,6 +3223,7 @@ function renderCrtBillingSelectedDay() {
3207
3223
  const providers = document.getElementById('billing-day-providers');
3208
3224
  if (date) date.textContent = crtBillingDayLabel(point && point.date);
3209
3225
  if (total) total.textContent = formatCrtExactUsageValue(point && point.totalTokens);
3226
+ if (compactTotal) compactTotal.textContent = formatCrtCompactTotalValue(point && point.totalTokens);
3210
3227
  if (input) input.textContent = formatCrtExactUsageValue(point && point.inputTokens);
3211
3228
  if (output) output.textContent = formatCrtExactUsageValue(point && point.outputTokens);
3212
3229
  if (cacheRead) cacheRead.textContent = formatCrtExactUsageValue(point && point.cacheReadTokens);
@@ -4992,10 +5009,15 @@ function crtRuntimeView(agent) {
4992
5009
  }
4993
5010
 
4994
5011
  function canSwitchCrtAgentRuntime(agent) {
5012
+ const freshCodexTerminal = agent
5013
+ && agent.providerSessionProvider === 'codex'
5014
+ && agent.agentRuntimeMode === 'terminal'
5015
+ && agent.providerSessionTemporary === true
5016
+ && agent.terminalInputReceived !== true;
4995
5017
  return Boolean(
4996
5018
  agent
4997
5019
  && ['codex', 'claude', 'opencode', 'qoder'].includes(agent.providerSessionProvider || '')
4998
- && agent.providerSessionTemporary !== true
5020
+ && (agent.providerSessionTemporary !== true || freshCodexTerminal)
4999
5021
  && String(agent.providerSessionId || '').trim()
5000
5022
  );
5001
5023
  }
@@ -5738,6 +5760,38 @@ async function respondToStructuredPermission(requestId, optionId, cancelled) {
5738
5760
  }
5739
5761
  }
5740
5762
 
5763
+ function structuredTranscriptContentText(content) {
5764
+ return (Array.isArray(content) ? content : [])
5765
+ .filter((block) => block && block.type === 'text' && typeof block.text === 'string')
5766
+ .map((block) => block.text)
5767
+ .join('')
5768
+ .trim();
5769
+ }
5770
+
5771
+ function structuredTranscriptTurns(transcript) {
5772
+ if (transcript && Array.isArray(transcript.turns)) return transcript.turns;
5773
+ const entries = transcript && Array.isArray(transcript.entries) ? transcript.entries : [];
5774
+ const turns = [];
5775
+ let current = null;
5776
+ entries.forEach((entry) => {
5777
+ if (!entry || entry.internal === true || entry.type !== 'message') return;
5778
+ const text = structuredTranscriptContentText(entry.content);
5779
+ if (!text) return;
5780
+ if (entry.role === 'user') {
5781
+ current = { userMessage: text, finalMessage: '' };
5782
+ turns.push(current);
5783
+ return;
5784
+ }
5785
+ if (entry.role !== 'assistant') return;
5786
+ if (!current) {
5787
+ current = { userMessage: '', finalMessage: '' };
5788
+ turns.push(current);
5789
+ }
5790
+ current.finalMessage = text;
5791
+ });
5792
+ return turns;
5793
+ }
5794
+
5741
5795
  function renderStructuredTranscript(transcript, force = false) {
5742
5796
  const container = document.getElementById('terminal-output');
5743
5797
  if (!container) return;
@@ -5746,7 +5800,7 @@ function renderStructuredTranscript(transcript, force = false) {
5746
5800
  const nearBottom = container.scrollHeight - container.scrollTop - container.clientHeight < 80;
5747
5801
  const transcriptNode = document.createElement('div');
5748
5802
  transcriptNode.className = 'crt-structured-transcript';
5749
- const turns = transcript && Array.isArray(transcript.turns) ? transcript.turns : [];
5803
+ const turns = structuredTranscriptTurns(transcript);
5750
5804
 
5751
5805
  if (!turns.length) {
5752
5806
  const empty = document.createElement('div');
@@ -6898,6 +6952,7 @@ if (typeof module !== 'undefined' && module.exports) {
6898
6952
  formatSystemClock,
6899
6953
  formatCrtTokenRate,
6900
6954
  formatCrtHistoryAge,
6955
+ formatCrtCompactTotalValue,
6901
6956
  getCrtHistoryPage,
6902
6957
  getCrtAgentPage,
6903
6958
  getCrtAgentVerticalPageTarget,
@@ -6913,6 +6968,7 @@ if (typeof module !== 'undefined' && module.exports) {
6913
6968
  canSwitchCrtAgentRuntime,
6914
6969
  isCrtRuntimeSwitchShortcut,
6915
6970
  structuredComposerAction,
6971
+ structuredTranscriptTurns,
6916
6972
  getCrtBrandPaneKey,
6917
6973
  extractSessionLinks,
6918
6974
  formatSelectionStatus,
@@ -1334,7 +1334,7 @@
1334
1334
  <span id="billing-day-state">LOCAL HISTORY</span>
1335
1335
  </div>
1336
1336
  <div class="billing-day-details">
1337
- <div class="billing-day-total"><small>TOTAL</small><strong id="billing-day-total">--</strong><span>TOKENS</span></div>
1337
+ <div class="billing-day-total"><small>TOTAL</small><strong id="billing-day-total">--</strong><span><span class="billing-day-total-compact" id="billing-day-total-compact">--</span> TOKENS</span></div>
1338
1338
  <div class="billing-day-breakdown"><small>INPUT</small><strong id="billing-day-input">--</strong></div>
1339
1339
  <div class="billing-day-breakdown"><small>OUTPUT</small><strong id="billing-day-output">--</strong></div>
1340
1340
  <div class="billing-day-breakdown"><small>CACHE READ</small><strong id="billing-day-cache-read">--</strong></div>
@@ -490,6 +490,12 @@
490
490
  letter-spacing: 0.07em;
491
491
  }
492
492
 
493
+ #farming-crt .billing-day-total .billing-day-total-compact {
494
+ color: var(--crt-phosphor-bright);
495
+ font-size: inherit;
496
+ letter-spacing: inherit;
497
+ }
498
+
493
499
  #farming-crt .billing-day-details strong {
494
500
  overflow: hidden;
495
501
  color: var(--crt-phosphor-bright);
@@ -82,7 +82,7 @@
82
82
  rgba(12, 204, 104, 0.036) 80%,
83
83
  rgba(12, 204, 104, 0.04) 100%
84
84
  );
85
- animation: crt-scan-beam-cycle 6.8s linear infinite;
85
+ animation: crt-scan-beam-cycle 8.6s linear infinite;
86
86
  }
87
87
 
88
88
  #farming-crt.no-crt .crt-phosphor-noise,
@@ -96,12 +96,20 @@
96
96
  }
97
97
 
98
98
  @keyframes crt-scan-beam-cycle {
99
- from {
99
+ 0% {
100
100
  transform: translate3d(0, -100%, 0);
101
101
  }
102
- to {
102
+
103
+ /* Preserve the existing visible sweep speed. */
104
+ 79% {
103
105
  transform: translate3d(0, calc(100vh - 100%), 0);
104
106
  }
107
+
108
+ /* Let the full phosphor tail drain below the viewport before wrapping. */
109
+ 95%,
110
+ 100% {
111
+ transform: translate3d(0, 100vh, 0);
112
+ }
105
113
  }
106
114
 
107
115
  #farming-crt .agent-output-afterimage {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "farming-code",
3
- "version": "2.2.6",
3
+ "version": "2.2.7",
4
4
  "description": "Remote browser workspace for supervising AI coding agents",
5
5
  "main": "backend/server.js",
6
6
  "bin": {