@cryer/star-cli 0.3.11 → 0.3.13

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.
@@ -15,6 +15,7 @@ import {
15
15
  formatSessionEntries,
16
16
  formatStreamError,
17
17
  formatTokens,
18
+ formatTokensCompact,
18
19
  listSessionEntries,
19
20
  loadSessionSnapshots,
20
21
  previewLines,
@@ -30,7 +31,7 @@ import {
30
31
  thinkingIcon,
31
32
  toTerminalSafe,
32
33
  toolIcon
33
- } from "./chunk-GYXF6NPC.js";
34
+ } from "./chunk-NMB3TNQU.js";
34
35
  import {
35
36
  AgentLoop,
36
37
  WORKING_DIFF_MAX_LINES,
@@ -47,14 +48,14 @@ import {
47
48
  isDangerousCommand,
48
49
  isGitRepo,
49
50
  summarizeMessages
50
- } from "./chunk-63CGUF3F.js";
51
+ } from "./chunk-QELCMXQX.js";
51
52
  import {
52
53
  contextWindowTokens,
53
54
  coreMessageText,
54
55
  diffTreeNames,
55
56
  reconcileStarMessages,
56
57
  toCoreMessages
57
- } from "./chunk-N4MIQSNZ.js";
58
+ } from "./chunk-RD4S5LKM.js";
58
59
  import {
59
60
  createModel,
60
61
  reasoningEffortMetadata
@@ -68,7 +69,7 @@ import {
68
69
  formatTaskFinished,
69
70
  formatTaskList,
70
71
  formatTaskStarted
71
- } from "./chunk-Q5FJN4LN.js";
72
+ } from "./chunk-OF42OVM4.js";
72
73
  import {
73
74
  MAX_IMAGE_DIMENSION,
74
75
  SKIP_DIRS,
@@ -97,7 +98,7 @@ import {
97
98
  starHome,
98
99
  upsertEnvContent,
99
100
  userMemoryPath
100
- } from "./chunk-LSYGHLRU.js";
101
+ } from "./chunk-6PLZ3FLG.js";
101
102
 
102
103
  // src/cli/repl.tsx
103
104
  import { Box as Box13, Text as Text14, render, useApp } from "ink";
@@ -1588,13 +1589,30 @@ var PROVIDER_PRESETS = [
1588
1589
  modelHint: "deepseek-chat"
1589
1590
  }
1590
1591
  ];
1591
- var PROTOCOLS = ["openai-compatible", "anthropic", "openai-responses"];
1592
+ var PROTOCOLS = ["openai-responses", "openai-compatible", "anthropic"];
1593
+ var DEFAULT_CUSTOM_PROTOCOL = "openai-responses";
1592
1594
  var PROTOCOL_DESCRIPTIONS = {
1593
1595
  "openai-compatible": "POST /chat/completions \u2014 most providers",
1594
1596
  anthropic: "Anthropic Messages API",
1595
1597
  "openai-responses": "OpenAI Responses API (endpoints exposing only /responses)"
1596
1598
  };
1597
1599
  var CONNECT_DEFAULT_CONTEXT_TOKENS = 128e3;
1600
+ var CONFIG_DOCS_URL = "https://github.com/cryer/star-cli";
1601
+ function buildNewConfigHeader() {
1602
+ return [
1603
+ `# star-cli configuration \u2014 more config details on ${CONFIG_DOCS_URL}`,
1604
+ "",
1605
+ "# progress checkpoint: max model round-trips per turn; 0 = unlimited",
1606
+ "maxSteps = 0",
1607
+ "# context window in tokens; a [[models]] contextMaxTokens overrides it per model",
1608
+ "contextMaxTokens = 200000",
1609
+ "# auto-compact the history once the estimated usage crosses this threshold",
1610
+ "compactThresholdTokens = 100000",
1611
+ '# how compaction shrinks the history: "summary" (LLM summary) or "truncate"',
1612
+ 'contextCompaction = "summary"',
1613
+ ""
1614
+ ].join("\n");
1615
+ }
1598
1616
  function deriveProviderName(baseURL) {
1599
1617
  let host = baseURL;
1600
1618
  try {
@@ -1714,6 +1732,7 @@ function saveConnection(answers, configPath = globalConfigPath(), envPath = envF
1714
1732
  } catch {
1715
1733
  existing = "";
1716
1734
  }
1735
+ if (existing === "") existing = buildNewConfigHeader();
1717
1736
  const separator = existing === "" ? "" : existing.endsWith("\n") ? "\n" : "\n\n";
1718
1737
  fs4.writeFileSync(
1719
1738
  configPath,
@@ -3398,7 +3417,7 @@ function ConnectWizard({
3398
3417
  }) {
3399
3418
  const [step, setStep] = useState4("provider");
3400
3419
  const [preset, setPreset] = useState4(null);
3401
- const [protocol, setProtocol] = useState4("openai-compatible");
3420
+ const [protocol, setProtocol] = useState4(DEFAULT_CUSTOM_PROTOCOL);
3402
3421
  const [baseURL, setBaseURL] = useState4("");
3403
3422
  const [apiKey, setApiKey] = useState4("");
3404
3423
  const [modelId, setModelId] = useState4("");
@@ -3535,6 +3554,7 @@ function ConnectWizard({
3535
3554
  options: PROTOCOLS.map((p) => ({
3536
3555
  value: p,
3537
3556
  label: p,
3557
+ hint: p === DEFAULT_CUSTOM_PROTOCOL ? "default" : void 0,
3538
3558
  description: PROTOCOL_DESCRIPTIONS[p]
3539
3559
  })),
3540
3560
  onSelect: handleProtocolSelect,
@@ -3795,6 +3815,7 @@ var StatusBar = memo3(function StatusBar2({
3795
3815
  tokens: tokens2,
3796
3816
  gitBranch,
3797
3817
  contextPercent,
3818
+ contextTokens,
3798
3819
  cachePercent,
3799
3820
  sessionCostUsd,
3800
3821
  backgroundTasks = []
@@ -3823,7 +3844,8 @@ var StatusBar = memo3(function StatusBar2({
3823
3844
  contextPercent != null && /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3824
3845
  "ctx: ",
3825
3846
  contextPercent,
3826
- "%"
3847
+ "%",
3848
+ contextTokens ? ` (${formatTokensCompact(contextTokens.used)}/${formatTokensCompact(contextTokens.window)})` : ""
3827
3849
  ] }),
3828
3850
  /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3829
3851
  "cache: ",
@@ -4344,7 +4366,7 @@ function Repl({
4344
4366
  const refillSeqRef = useRef6(0);
4345
4367
  const lastEscRef = useRef6(null);
4346
4368
  const [gitBranch, setGitBranch] = useState7(null);
4347
- const [contextPercent, setContextPercent] = useState7(null);
4369
+ const [contextUsage, setContextUsage] = useState7(null);
4348
4370
  const [initialHistory] = useState7(() => loadHistory());
4349
4371
  const budgetWarnedRef = useRef6(false);
4350
4372
  const budgetExceededRef = useRef6(false);
@@ -4474,7 +4496,8 @@ function Repl({
4474
4496
  const result = saveConnection(answers);
4475
4497
  config.providers.push(result.provider);
4476
4498
  config.models.push(result.model);
4477
- return `Saved provider "${result.provider.name}" and model "${result.model.name}" to ${result.configPath}; the key is stored as ${result.provider.apiKeyEnv} in ${result.envPath}.`;
4499
+ return `Saved provider "${result.provider.name}" and model "${result.model.name}" to ${result.configPath}; the key is stored as ${result.provider.apiKeyEnv} in ${result.envPath}.
4500
+ Full configuration details: ${CONFIG_DOCS_URL}`;
4478
4501
  },
4479
4502
  [config]
4480
4503
  );
@@ -5731,10 +5754,15 @@ ${plan.affected.length} file change(s) will be reverted, ${messageCount} message
5731
5754
  const current = backendRef.current;
5732
5755
  if (current instanceof AgentLoop) {
5733
5756
  const window_ = contextWindowTokens(config, modelNameRef.current);
5734
- const pct = current.estimateContextTokens() / window_ * 100;
5735
- setContextPercent(pct < 10 ? Math.round(pct * 10) / 10 : Math.round(pct));
5757
+ const used = current.estimateContextTokens();
5758
+ const pct = used / window_ * 100;
5759
+ setContextUsage({
5760
+ percent: pct < 10 ? Math.round(pct * 10) / 10 : Math.round(pct),
5761
+ used,
5762
+ window: window_
5763
+ });
5736
5764
  } else {
5737
- setContextPercent(null);
5765
+ setContextUsage(null);
5738
5766
  }
5739
5767
  };
5740
5768
  refresh();
@@ -5834,7 +5862,8 @@ ${plan.affected.length} file change(s) will be reverted, ${messageCount} message
5834
5862
  permissionMode: permissionModeState,
5835
5863
  tokens: usageRef.current.totalTokens,
5836
5864
  gitBranch,
5837
- contextPercent,
5865
+ contextPercent: contextUsage?.percent ?? null,
5866
+ contextTokens: contextUsage ? { used: contextUsage.used, window: contextUsage.window } : null,
5838
5867
  cachePercent: usageRef.current.cache ? cacheHitPercent(usageRef.current.cache) : null,
5839
5868
  sessionCostUsd: sessionCost,
5840
5869
  backgroundTasks: bgLabels
@@ -5870,4 +5899,4 @@ export {
5870
5899
  Repl,
5871
5900
  renderRepl
5872
5901
  };
5873
- //# sourceMappingURL=repl-YBNTJOSB.js.map
5902
+ //# sourceMappingURL=repl-ZABBT33D.js.map