scream-code 0.11.8 → 0.11.9

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.
@@ -7,7 +7,7 @@ import { i as __require, o as __toESM, r as __exportAll, t as __commonJSMin } fr
7
7
  import "./suppress-sqlite-warning-C2VB0doZ.mjs";
8
8
  import { C as join$1, D as resolve$1, E as relative$1, S as isAbsolute$1, T as parse$7, a as isSupportedFile, b as basename$1, i as ingestFile, r as ingestDirectory, t as multiSearch, w as normalize, x as dirname$2, y as KnowledgeStore } from "./src-BH9W5k24.mjs";
9
9
  import { t as require_base64_js } from "./base64-js-DzVmk6Nb.mjs";
10
- import { a as setLocale, i as getLocale, n as assertScreamHostIdentity, o as t, r as createScreamDefaultHeaders, t as TextInputDialogComponent } from "./text-input-dialog-DYHGTG6m.mjs";
10
+ import { a as setLocale, i as getLocale, n as assertScreamHostIdentity, o as t, r as createScreamDefaultHeaders, t as TextInputDialogComponent } from "./text-input-dialog-COl6Uu7m.mjs";
11
11
  import { createRequire } from "node:module";
12
12
  import { createHash, randomBytes, randomInt, randomUUID } from "node:crypto";
13
13
  import * as fs$1 from "node:fs/promises";
@@ -59888,7 +59888,6 @@ function formatFullSkill(skill) {
59888
59888
  function formatModelSkill(skill) {
59889
59889
  const lines = [`- ${skill.name}: ${truncate$2(skill.description, LISTING_DESC_MAX)}`];
59890
59890
  if (typeof skill.metadata.whenToUse === "string" && skill.metadata.whenToUse.length > 0) lines.push(` When to use: ${skill.metadata.whenToUse}`);
59891
- lines.push(` Path: ${skill.path}`);
59892
59891
  return lines;
59893
59892
  }
59894
59893
  function truncate$2(value, max) {
@@ -119303,6 +119302,14 @@ async function fetchProviderBalance(baseUrl, apiKey) {
119303
119302
  if (!fetcher) return null;
119304
119303
  return fetcher.fetch(baseUrl, apiKey);
119305
119304
  }
119305
+ /**
119306
+ * True when the given base URL belongs to a vendor we can query balances
119307
+ * for. Pure local check (no network) — used to skip polling for
119308
+ * unsupported providers.
119309
+ */
119310
+ function isSupportedBalanceProvider(baseUrl) {
119311
+ return fetchers.some((f) => f.matches(baseUrl));
119312
+ }
119306
119313
  //#endregion
119307
119314
  //#region ../../packages/node-sdk/src/auth.ts
119308
119315
  var ScreamAuthFacade = class {
@@ -120724,7 +120731,7 @@ function optionalBuildString(value) {
120724
120731
  return typeof value === "string" && value.length > 0 ? value : void 0;
120725
120732
  }
120726
120733
  const SCREAM_BUILD_INFO = {
120727
- version: optionalBuildString("0.11.8"),
120734
+ version: optionalBuildString("0.11.9"),
120728
120735
  channel: optionalBuildString(""),
120729
120736
  commit: optionalBuildString(""),
120730
120737
  buildTarget: optionalBuildString("darwin-arm64")
@@ -122055,14 +122062,16 @@ function buildSkillSlashCommands(skills, builtinCommandNames) {
122055
122062
  commands.push({
122056
122063
  name: commandName,
122057
122064
  aliases: [],
122058
- description: skill.description ?? ""
122065
+ description: skill.description ?? "",
122066
+ source: skill.source
122059
122067
  });
122060
122068
  if (skill.source === "builtin" && !reservedNames.has(skill.name)) {
122061
122069
  commandMap.set(skill.name, skill.name);
122062
122070
  commands.push({
122063
122071
  name: skill.name,
122064
122072
  aliases: [],
122065
- description: skill.description ?? ""
122073
+ description: skill.description ?? "",
122074
+ source: skill.source
122066
122075
  });
122067
122076
  }
122068
122077
  }
@@ -125084,6 +125093,21 @@ async function getProviderBalanceForModel(model) {
125084
125093
  return balance;
125085
125094
  }
125086
125095
  /**
125096
+ * True when the given model is served by a provider whose balance we can
125097
+ * query. Pure local check (config lookup + hostname match, no network) —
125098
+ * the poller uses it to skip unsupported providers entirely.
125099
+ */
125100
+ function supportsBalance(model) {
125101
+ const providerName = model.split("/")[0] ?? "";
125102
+ if (providerName.length === 0) return false;
125103
+ try {
125104
+ const baseUrl = readConfigFile(join(getDataDir(), "config.toml")).providers?.[providerName]?.baseUrl;
125105
+ return baseUrl !== void 0 && isSupportedBalanceProvider(baseUrl);
125106
+ } catch {
125107
+ return false;
125108
+ }
125109
+ }
125110
+ /**
125087
125111
  * Fetch the balance for a model and push it into app state. Fire-and-forget:
125088
125112
  * failures resolve to null inside getProviderBalanceForModel, so callers
125089
125113
  * (startup sync and model switches) never await it. A request id guards
@@ -126362,7 +126386,7 @@ async function guidedGoalSetup(host) {
126362
126386
  host.showNotice(t("goal.storm_breaker"), t("goal.conflict_loop"));
126363
126387
  return;
126364
126388
  }
126365
- const { TextInputDialogComponent } = await import("./text-input-dialog-DX3hKoBF.mjs");
126389
+ const { TextInputDialogComponent } = await import("./text-input-dialog-xqTCBHZF.mjs");
126366
126390
  const initialDesc = await promptText(host, TextInputDialogComponent, {
126367
126391
  title: t("goal.setup_title_initial"),
126368
126392
  subtitle: t("goal.setup_desc_hint"),
@@ -126383,7 +126407,7 @@ async function guidedGoalSetup(host) {
126383
126407
  await showGoalConfigWizard(host, session, confirmed.trim() || objective, false);
126384
126408
  }
126385
126409
  async function showGoalConfigWizard(host, session, objective, replace) {
126386
- const { TextInputDialogComponent } = await import("./text-input-dialog-DX3hKoBF.mjs");
126410
+ const { TextInputDialogComponent } = await import("./text-input-dialog-xqTCBHZF.mjs");
126387
126411
  const turnInput = await promptNumber(host, TextInputDialogComponent, {
126388
126412
  title: t("goal.wizard_title", { objective }),
126389
126413
  subtitle: t("goal.budget_turns_hint"),
@@ -134873,8 +134897,8 @@ async function handleKnowledgeCommand(host, _args) {
134873
134897
  switch (status) {
134874
134898
  case "ready": return "";
134875
134899
  case "downloading": return " · " + t("kw.embedding_downloading");
134876
- case "failed": return " · " + t("kw.embedding_failed");
134877
- case "idle": return " · " + t("kw.embedding_not_downloaded");
134900
+ case "failed": return " · " + t("kw.embedding_failed") + t("kw.embedding_data_intact");
134901
+ case "idle": return " · " + t("kw.embedding_not_downloaded") + t("kw.embedding_data_intact");
134878
134902
  }
134879
134903
  };
134880
134904
  const showMenu = () => {
@@ -141251,7 +141275,7 @@ var InputController = class InputController {
141251
141275
  this.host = host;
141252
141276
  }
141253
141277
  setupAutocomplete() {
141254
- const visible = this.host.getSlashCommands().filter((cmd) => !cmd.name.startsWith("skill:"));
141278
+ const visible = this.host.getSlashCommands().filter((cmd) => !(cmd.name.startsWith("skill:") && cmd.source === "builtin"));
141255
141279
  const slashCommands = visible.map((cmd) => cmd);
141256
141280
  const { state } = this.host;
141257
141281
  const provider = new FileMentionProvider(slashCommands, state.appState.workDir, state.fdPath, state.gitLsFilesCache);
@@ -145510,6 +145534,8 @@ var ScreamTUI = class {
145510
145534
  tightModeHandler = null;
145511
145535
  reverseRpcDisposers = [];
145512
145536
  startupNotice;
145537
+ /** Interval handle for the periodic provider-balance refresh. */
145538
+ balancePollTimer;
145513
145539
  updatePrefetched;
145514
145540
  sessionManager;
145515
145541
  dialogManager;
@@ -145616,6 +145642,7 @@ var ScreamTUI = class {
145616
145642
  try {
145617
145643
  await this.finishStartup(shouldReplayHistory);
145618
145644
  this.lifecycleController.startCcConnectPolling();
145645
+ this.startBalancePolling();
145619
145646
  } catch (error) {
145620
145647
  this.lifecycleController.disposeTerminalTracking();
145621
145648
  this.state.footer.dispose();
@@ -145650,6 +145677,18 @@ var ScreamTUI = class {
145650
145677
  this.state.ui.setFocus(this.state.editor);
145651
145678
  return shouldReplayHistory;
145652
145679
  }
145680
+ /**
145681
+ * Refresh the provider balance badge every 60s, but only for providers
145682
+ * whose balance we can actually query (local hostname check, no network
145683
+ * for unsupported ones). The api-balance layer caches per provider for
145684
+ * 60s, so each tick either serves the cache or performs one real lookup.
145685
+ */
145686
+ startBalancePolling() {
145687
+ this.balancePollTimer ??= setInterval(() => {
145688
+ const model = this.state.appState.model;
145689
+ if (supportsBalance(model)) refreshProviderBalance(model, (patch) => this.setAppState(patch));
145690
+ }, 6e4);
145691
+ }
145653
145692
  async finishStartup(shouldReplayHistory) {
145654
145693
  if (this.startupNotice !== void 0) {
145655
145694
  this.showStatus(this.startupNotice);
@@ -145692,6 +145731,10 @@ var ScreamTUI = class {
145692
145731
  }
145693
145732
  setTightMode(false);
145694
145733
  this.lifecycleController.stopCcConnectPolling();
145734
+ if (this.balancePollTimer !== void 0) {
145735
+ clearInterval(this.balancePollTimer);
145736
+ this.balancePollTimer = void 0;
145737
+ }
145695
145738
  this.lifecycleController.uninstallSignalHandlers();
145696
145739
  this.aborted = true;
145697
145740
  this.cancelInFlight?.();
package/dist/main.mjs CHANGED
@@ -6,7 +6,7 @@ const __dirname = __cjsShimDirname(__filename);
6
6
  import "./suppress-sqlite-warning-C2VB0doZ.mjs";
7
7
  //#region src/main.ts
8
8
  try {
9
- (await import("./app-zSNn5qdo.mjs")).main();
9
+ (await import("./app-CTeIrRAX.mjs")).main();
10
10
  } catch (error) {
11
11
  process.stderr.write(`${error instanceof Error ? error.stack ?? error.message : String(error)}\n`);
12
12
  process.exit(1);
@@ -1145,6 +1145,7 @@ const dictionaries = {
1145
1145
  "kw.embedding_failed": "向量模型加载失败,请返回菜单选择重新下载(建议科学上网)",
1146
1146
  "kw.embedding_ready": "向量模型已就绪",
1147
1147
  "kw.embedding_not_downloaded": "向量模型未下载(选择「下载向量模型」手动下载)",
1148
+ "kw.embedding_data_intact": " —— 你的知识数据仍然存在,下载模型后即可正常使用",
1148
1149
  "kw.embedding_already_installed": "向量模型已安装,无需重新下载"
1149
1150
  },
1150
1151
  en: {
@@ -2193,6 +2194,7 @@ const dictionaries = {
2193
2194
  "kw.embedding_failed": "Vector model load failed. Return to the menu and select Download to retry.",
2194
2195
  "kw.embedding_ready": "Vector model ready",
2195
2196
  "kw.embedding_not_downloaded": "Vector model not downloaded (select Download vector model)",
2197
+ "kw.embedding_data_intact": " — your knowledge data is still there; download the model to use it again",
2196
2198
  "kw.embedding_already_installed": "Vector model already installed, no need to re-download"
2197
2199
  }
2198
2200
  };
@@ -3,5 +3,5 @@ import { fileURLToPath as __cjsShimFileURLToPath } from 'node:url';
3
3
  import { dirname as __cjsShimDirname } from 'node:path';
4
4
  const __filename = __cjsShimFileURLToPath(import.meta.url);
5
5
  const __dirname = __cjsShimDirname(__filename);
6
- import { t as TextInputDialogComponent } from "./text-input-dialog-DYHGTG6m.mjs";
6
+ import { t as TextInputDialogComponent } from "./text-input-dialog-COl6Uu7m.mjs";
7
7
  export { TextInputDialogComponent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scream-code",
3
- "version": "0.11.8",
3
+ "version": "0.11.9",
4
4
  "description": "A terminal-native AI agent for builders",
5
5
  "license": "MIT",
6
6
  "author": "ScreamCli",