sharkbait 1.0.21 → 1.0.22

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/dist/cli.js +84 -60
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -6505,14 +6505,15 @@ Duration: ${(result.totalDurationMs / 1000).toFixed(1)}s`
6505
6505
  }
6506
6506
  }
6507
6507
  // src/agent/start-chat.ts
6508
- import React3 from "react";
6508
+ import React6 from "react";
6509
6509
  import { render } from "ink";
6510
6510
 
6511
6511
  // src/ui/app.tsx
6512
- import React2, { useState as useState2, useEffect as useEffect2, useCallback, useRef } from "react";
6512
+ import React5, { useState as useState2, useEffect as useEffect2, useCallback, useRef } from "react";
6513
6513
  import { Box as Box12, Text as Text12, useInput, useApp } from "ink";
6514
6514
 
6515
6515
  // src/ui/message.tsx
6516
+ import { memo } from "react";
6516
6517
  import { Box as Box2, Text as Text2 } from "ink";
6517
6518
 
6518
6519
  // src/ui/theme.ts
@@ -6700,7 +6701,7 @@ function HighlightedContent({ content }) {
6700
6701
 
6701
6702
  // src/ui/message.tsx
6702
6703
  import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
6703
- function MessageView({
6704
+ var MessageView = memo(function MessageView2({
6704
6705
  role,
6705
6706
  content,
6706
6707
  timestamp,
@@ -6769,7 +6770,7 @@ function MessageView({
6769
6770
  }, undefined, false, undefined, this)
6770
6771
  ]
6771
6772
  }, undefined, true, undefined, this);
6772
- }
6773
+ });
6773
6774
 
6774
6775
  // src/ui/spinner.tsx
6775
6776
  import { useState, useEffect } from "react";
@@ -6965,9 +6966,10 @@ function WelcomeScreen({ version, workingDir }) {
6965
6966
  }
6966
6967
 
6967
6968
  // src/ui/status-bar.tsx
6969
+ import { memo as memo2 } from "react";
6968
6970
  import { Box as Box6, Text as Text6 } from "ink";
6969
6971
  import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
6970
- function StatusBar({
6972
+ var StatusBar = memo2(function StatusBar2({
6971
6973
  model,
6972
6974
  tokens = 0,
6973
6975
  cost = 0,
@@ -7057,7 +7059,7 @@ function StatusBar({
7057
7059
  }, undefined, false, undefined, this)
7058
7060
  ]
7059
7061
  }, undefined, true, undefined, this);
7060
- }
7062
+ });
7061
7063
 
7062
7064
  // src/ui/input-prompt.tsx
7063
7065
  import { Box as Box7, Text as Text7 } from "ink";
@@ -7091,9 +7093,10 @@ function InputPrompt({
7091
7093
  }
7092
7094
 
7093
7095
  // src/ui/tool-call.tsx
7096
+ import { memo as memo3 } from "react";
7094
7097
  import { Box as Box8, Text as Text8 } from "ink";
7095
- import { jsxDEV as jsxDEV8, Fragment } from "react/jsx-dev-runtime";
7096
- function ToolCallView({
7098
+ import { jsxDEV as jsxDEV8 } from "react/jsx-dev-runtime";
7099
+ var ToolCallView = memo3(function ToolCallView2({
7097
7100
  name,
7098
7101
  status,
7099
7102
  result,
@@ -7101,7 +7104,7 @@ function ToolCallView({
7101
7104
  duration
7102
7105
  }) {
7103
7106
  const statusConfig = {
7104
- running: { icon: icons.tool, color: colors.primary },
7107
+ running: { icon: "⟳", color: colors.primary },
7105
7108
  success: { icon: icons.success, color: colors.success },
7106
7109
  error: { icon: icons.error, color: colors.error }
7107
7110
  };
@@ -7116,34 +7119,33 @@ function ToolCallView({
7116
7119
  paddingX: 1,
7117
7120
  children: [
7118
7121
  /* @__PURE__ */ jsxDEV8(Box8, {
7119
- children: status === "running" ? /* @__PURE__ */ jsxDEV8(Spinner, {
7120
- text: name,
7121
- variant: "dots"
7122
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV8(Fragment, {
7123
- children: [
7124
- /* @__PURE__ */ jsxDEV8(Text8, {
7125
- color: config.color,
7126
- children: [
7127
- config.icon,
7128
- " "
7129
- ]
7130
- }, undefined, true, undefined, this),
7131
- /* @__PURE__ */ jsxDEV8(Text8, {
7132
- bold: true,
7133
- color: colors.text,
7134
- children: name
7135
- }, undefined, false, undefined, this),
7136
- durationText && /* @__PURE__ */ jsxDEV8(Text8, {
7137
- color: colors.textDim,
7138
- children: [
7139
- " (",
7140
- durationText,
7141
- ")"
7142
- ]
7143
- }, undefined, true, undefined, this)
7144
- ]
7145
- }, undefined, true, undefined, this)
7146
- }, undefined, false, undefined, this),
7122
+ children: [
7123
+ /* @__PURE__ */ jsxDEV8(Text8, {
7124
+ color: config.color,
7125
+ children: [
7126
+ config.icon,
7127
+ " "
7128
+ ]
7129
+ }, undefined, true, undefined, this),
7130
+ /* @__PURE__ */ jsxDEV8(Text8, {
7131
+ bold: true,
7132
+ color: colors.text,
7133
+ children: name
7134
+ }, undefined, false, undefined, this),
7135
+ status === "running" && /* @__PURE__ */ jsxDEV8(Text8, {
7136
+ color: colors.textDim,
7137
+ children: " ..."
7138
+ }, undefined, false, undefined, this),
7139
+ durationText && /* @__PURE__ */ jsxDEV8(Text8, {
7140
+ color: colors.textDim,
7141
+ children: [
7142
+ " (",
7143
+ durationText,
7144
+ ")"
7145
+ ]
7146
+ }, undefined, true, undefined, this)
7147
+ ]
7148
+ }, undefined, true, undefined, this),
7147
7149
  result && status === "success" && /* @__PURE__ */ jsxDEV8(Box8, {
7148
7150
  marginLeft: 2,
7149
7151
  marginTop: 0,
@@ -7171,7 +7173,7 @@ function ToolCallView({
7171
7173
  }, undefined, false, undefined, this)
7172
7174
  ]
7173
7175
  }, undefined, true, undefined, this);
7174
- }
7176
+ });
7175
7177
 
7176
7178
  // src/ui/parallel-progress.tsx
7177
7179
  import { Box as Box9, Text as Text9 } from "ink";
@@ -8304,7 +8306,7 @@ Type /help for available commands.`,
8304
8306
  }
8305
8307
  // src/ui/app.tsx
8306
8308
  import { basename as basename3 } from "path";
8307
- import { jsxDEV as jsxDEV12, Fragment as Fragment2 } from "react/jsx-dev-runtime";
8309
+ import { jsxDEV as jsxDEV12, Fragment } from "react/jsx-dev-runtime";
8308
8310
  function estimateTokens(text) {
8309
8311
  return Math.ceil(text.length / 4);
8310
8312
  }
@@ -8349,19 +8351,35 @@ function App({ contextFiles: initialContextFiles, enableBeads: initialBeadsEnabl
8349
8351
  });
8350
8352
  const abortControllerRef = useRef(null);
8351
8353
  const pendingOutputRef = useRef("");
8354
+ const pendingTokensRef = useRef(0);
8355
+ const pendingCostRef = useRef(0);
8352
8356
  const outputTimerRef = useRef(null);
8353
8357
  const { exit } = useApp();
8354
8358
  const workingDir = currentDir;
8355
8359
  const flushOutput = useCallback(() => {
8356
- if (pendingOutputRef.current) {
8357
- setCurrentOutput(pendingOutputRef.current);
8360
+ const output = pendingOutputRef.current;
8361
+ const tokens = pendingTokensRef.current;
8362
+ const cost = pendingCostRef.current;
8363
+ if (output)
8364
+ setCurrentOutput(output);
8365
+ if (tokens > 0) {
8366
+ setTokenCount((prev) => prev + tokens);
8367
+ pendingTokensRef.current = 0;
8368
+ }
8369
+ if (cost > 0) {
8370
+ setSessionCost((prev) => prev + cost);
8371
+ pendingCostRef.current = 0;
8358
8372
  }
8359
8373
  outputTimerRef.current = null;
8360
8374
  }, []);
8361
- const throttledSetOutput = useCallback((content) => {
8375
+ const throttledSetOutput = useCallback((content, chunkTokens) => {
8362
8376
  pendingOutputRef.current = content;
8377
+ if (chunkTokens && chunkTokens > 0) {
8378
+ pendingTokensRef.current += chunkTokens;
8379
+ pendingCostRef.current += chunkTokens * 0.00003;
8380
+ }
8363
8381
  if (!outputTimerRef.current) {
8364
- outputTimerRef.current = setTimeout(flushOutput, 50);
8382
+ outputTimerRef.current = setTimeout(flushOutput, 80);
8365
8383
  }
8366
8384
  }, [flushOutput]);
8367
8385
  useEffect2(() => {
@@ -8370,11 +8388,11 @@ function App({ contextFiles: initialContextFiles, enableBeads: initialBeadsEnabl
8370
8388
  clearTimeout(outputTimerRef.current);
8371
8389
  };
8372
8390
  }, []);
8373
- const agent = React2.useMemo(() => new Agent({
8391
+ const agent = React5.useMemo(() => new Agent({
8374
8392
  contextFiles,
8375
8393
  enableBeads: beadsEnabled
8376
8394
  }), [contextFiles, beadsEnabled]);
8377
- const commandContext = React2.useMemo(() => ({
8395
+ const commandContext = React5.useMemo(() => ({
8378
8396
  currentDir,
8379
8397
  setCurrentDir,
8380
8398
  addMessage: (role, content) => {
@@ -8533,10 +8551,8 @@ function App({ contextFiles: initialContextFiles, enableBeads: initialBeadsEnabl
8533
8551
  switch (event.type) {
8534
8552
  case "text":
8535
8553
  assistantContent += event.content;
8536
- throttledSetOutput(assistantContent);
8537
8554
  const chunkTokens = estimateTokens(event.content);
8538
- setTokenCount((prev) => prev + chunkTokens);
8539
- setSessionCost((prev) => prev + chunkTokens * 0.00003);
8555
+ throttledSetOutput(assistantContent, chunkTokens);
8540
8556
  break;
8541
8557
  case "agent_start":
8542
8558
  setCurrentAgent(event.agent);
@@ -8636,6 +8652,14 @@ ${event.consolidated}`,
8636
8652
  clearTimeout(outputTimerRef.current);
8637
8653
  outputTimerRef.current = null;
8638
8654
  }
8655
+ if (pendingTokensRef.current > 0) {
8656
+ setTokenCount((prev) => prev + pendingTokensRef.current);
8657
+ pendingTokensRef.current = 0;
8658
+ }
8659
+ if (pendingCostRef.current > 0) {
8660
+ setSessionCost((prev) => prev + pendingCostRef.current);
8661
+ pendingCostRef.current = 0;
8662
+ }
8639
8663
  pendingOutputRef.current = "";
8640
8664
  if (assistantContent.trim()) {
8641
8665
  setMessages((prev) => [...prev, {
@@ -8780,7 +8804,7 @@ ${event.consolidated}`,
8780
8804
  justifyContent: "center",
8781
8805
  children: /* @__PURE__ */ jsxDEV12(Text12, {
8782
8806
  color: colors.textDim,
8783
- children: isExecuting ? /* @__PURE__ */ jsxDEV12(Fragment2, {
8807
+ children: isExecuting ? /* @__PURE__ */ jsxDEV12(Fragment, {
8784
8808
  children: [
8785
8809
  "Press ",
8786
8810
  /* @__PURE__ */ jsxDEV12(Text12, {
@@ -8789,7 +8813,7 @@ ${event.consolidated}`,
8789
8813
  }, undefined, false, undefined, this),
8790
8814
  " to cancel"
8791
8815
  ]
8792
- }, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV12(Fragment2, {
8816
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV12(Fragment, {
8793
8817
  children: [
8794
8818
  "Press ",
8795
8819
  /* @__PURE__ */ jsxDEV12(Text12, {
@@ -8811,7 +8835,7 @@ ${event.consolidated}`,
8811
8835
  }
8812
8836
 
8813
8837
  // src/version.ts
8814
- var VERSION = "1.0.21";
8838
+ var VERSION = "1.0.22";
8815
8839
 
8816
8840
  // src/agent/start-chat.ts
8817
8841
  async function startChat(options = {}) {
@@ -8821,7 +8845,7 @@ async function startChat(options = {}) {
8821
8845
  process.chdir(workingDir);
8822
8846
  }
8823
8847
  } catch {}
8824
- const { waitUntilExit } = render(React3.createElement(App, {
8848
+ const { waitUntilExit } = render(React6.createElement(App, {
8825
8849
  contextFiles: options.context,
8826
8850
  enableBeads: options.beads ?? true,
8827
8851
  version: VERSION,
@@ -8995,7 +9019,7 @@ Task completed.`);
8995
9019
  }
8996
9020
 
8997
9021
  // src/commands/setup.tsx
8998
- import React4, { useState as useState3, useEffect as useEffect3 } from "react";
9022
+ import React7, { useState as useState3, useEffect as useEffect3 } from "react";
8999
9023
  import { render as render2, Box as Box13, Text as Text13, useInput as useInput2, useApp as useApp2 } from "ink";
9000
9024
  import TextInput from "ink-text-input";
9001
9025
  import { writeFile as writeFile4, readFile as readFile3, mkdir as mkdir4, stat as stat3 } from "fs/promises";
@@ -9003,7 +9027,7 @@ import { join as join8, resolve as resolve4 } from "path";
9003
9027
  import { homedir as homedir4 } from "os";
9004
9028
  import { existsSync as existsSync6 } from "fs";
9005
9029
  import { execSync as execSync2 } from "child_process";
9006
- import { jsxDEV as jsxDEV13, Fragment as Fragment3 } from "react/jsx-dev-runtime";
9030
+ import { jsxDEV as jsxDEV13, Fragment as Fragment2 } from "react/jsx-dev-runtime";
9007
9031
  function SetupWizardWithCallback({ onComplete }) {
9008
9032
  const { exit } = useApp2();
9009
9033
  const [step, setStep] = useState3("welcome");
@@ -9858,7 +9882,7 @@ function SetupWizardWithCallback({ onComplete }) {
9858
9882
  beadsVersion ? ` — ${beadsVersion}` : ""
9859
9883
  ]
9860
9884
  }, undefined, true, undefined, this),
9861
- beadsInstallStatus === "failed" && /* @__PURE__ */ jsxDEV13(Fragment3, {
9885
+ beadsInstallStatus === "failed" && /* @__PURE__ */ jsxDEV13(Fragment2, {
9862
9886
  children: [
9863
9887
  /* @__PURE__ */ jsxDEV13(Text13, {
9864
9888
  color: colors.warning,
@@ -9890,7 +9914,7 @@ function SetupWizardWithCallback({ onComplete }) {
9890
9914
  /* @__PURE__ */ jsxDEV13(Box13, {
9891
9915
  marginTop: 1,
9892
9916
  flexDirection: "column",
9893
- children: state.authMethod === "azure-identity" ? /* @__PURE__ */ jsxDEV13(Fragment3, {
9917
+ children: state.authMethod === "azure-identity" ? /* @__PURE__ */ jsxDEV13(Fragment2, {
9894
9918
  children: [
9895
9919
  /* @__PURE__ */ jsxDEV13(Text13, {
9896
9920
  color: colors.textMuted,
@@ -9907,7 +9931,7 @@ function SetupWizardWithCallback({ onComplete }) {
9907
9931
  ]
9908
9932
  }, undefined, true, undefined, this)
9909
9933
  ]
9910
- }, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV13(Fragment3, {
9934
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV13(Fragment2, {
9911
9935
  children: [
9912
9936
  /* @__PURE__ */ jsxDEV13(Text13, {
9913
9937
  color: colors.textMuted,
@@ -9958,13 +9982,13 @@ function SetupWizardWithCallback({ onComplete }) {
9958
9982
  async function runSetup() {
9959
9983
  let setupCompleted = false;
9960
9984
  function SetupWizardWrapper() {
9961
- return React4.createElement(SetupWizardWithCallback, {
9985
+ return React7.createElement(SetupWizardWithCallback, {
9962
9986
  onComplete: () => {
9963
9987
  setupCompleted = true;
9964
9988
  }
9965
9989
  });
9966
9990
  }
9967
- const { waitUntilExit } = render2(React4.createElement(SetupWizardWrapper));
9991
+ const { waitUntilExit } = render2(React7.createElement(SetupWizardWrapper));
9968
9992
  await waitUntilExit();
9969
9993
  return setupCompleted;
9970
9994
  }
@@ -10095,7 +10119,7 @@ ${"━".repeat(60)}`);
10095
10119
  }
10096
10120
 
10097
10121
  // src/version.ts
10098
- var VERSION2 = "1.0.21";
10122
+ var VERSION2 = "1.0.22";
10099
10123
 
10100
10124
  // src/ui/logo.tsx
10101
10125
  import { Box as Box14, Text as Text14 } from "ink";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sharkbait",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "AI-powered coding assistant for the command line. Uses OpenAI Responses API (not Chat). Autonomous agents, parallel code reviews, 36 tools.",
5
5
  "type": "module",
6
6
  "main": "./dist/cli.js",