@narumitw/pi-starship 0.65.2 → 0.66.0

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 (25) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +5 -0
  3. package/dist/chunks/{chunk-PZWT7OTP.ts → chunk-BOMYDCT7.ts} +3 -3
  4. package/dist/chunks/{chunk-5YA3XF7S.ts → chunk-CUXPMKBQ.ts} +16 -1
  5. package/dist/chunks/chunk-CUXPMKBQ.ts.map +7 -0
  6. package/dist/chunks/{chunk-RQY2AYI2.ts → chunk-UZJIMIWL.ts} +2 -2
  7. package/dist/chunks/{command-configuration-menu-JHKQ5SDW.ts → command-configuration-menu-N3SP6R3I.ts} +3 -3
  8. package/dist/chunks/{command-settings-chat-RN2GDMF5.ts → command-settings-chat-4NLO3RDC.ts} +4 -4
  9. package/dist/chunks/{commands-XIRYGV7S.ts → commands-MSJ67CTR.ts} +6 -6
  10. package/dist/index.ts +20 -6
  11. package/dist/index.ts.map +2 -2
  12. package/package.json +1 -1
  13. package/skills/configure-pi-starship/references/module-catalog.md +17 -1
  14. package/skills/configure-pi-starship/references/modules.md +27 -0
  15. package/src/modules/catalog.ts +4 -0
  16. package/src/modules/tokens-per-second.ts +14 -0
  17. package/src/modules/types.ts +1 -0
  18. package/src/pi-starship.ts +4 -7
  19. package/src/usage.ts +25 -0
  20. package/dist/chunks/chunk-5YA3XF7S.ts.map +0 -7
  21. /package/dist/chunks/{chunk-PZWT7OTP.ts.map → chunk-BOMYDCT7.ts.map} +0 -0
  22. /package/dist/chunks/{chunk-RQY2AYI2.ts.map → chunk-UZJIMIWL.ts.map} +0 -0
  23. /package/dist/chunks/{command-configuration-menu-JHKQ5SDW.ts.map → command-configuration-menu-N3SP6R3I.ts.map} +0 -0
  24. /package/dist/chunks/{command-settings-chat-RN2GDMF5.ts.map → command-settings-chat-4NLO3RDC.ts.map} +0 -0
  25. /package/dist/chunks/{commands-XIRYGV7S.ts.map → commands-MSJ67CTR.ts.map} +0 -0
@@ -7,7 +7,7 @@ import {
7
7
  saveAsProfile,
8
8
  showHistory,
9
9
  showProfiles
10
- } from "./chunk-PZWT7OTP.ts";
10
+ } from "./chunk-BOMYDCT7.ts";
11
11
  import {
12
12
  STARSHIP_PRESETS,
13
13
  configurationPresentation,
@@ -15,7 +15,7 @@ import {
15
15
  presetForDocument,
16
16
  reloadConfiguration,
17
17
  showPreviewActionMenu
18
- } from "./chunk-RQY2AYI2.ts";
18
+ } from "./chunk-UZJIMIWL.ts";
19
19
  import {
20
20
  STARSHIP_SUBCOMMANDS,
21
21
  completeStarshipArguments
@@ -27,7 +27,7 @@ import {
27
27
  nativeFooterConfig,
28
28
  readConfigDocumentSnapshot,
29
29
  validateConfigDocument
30
- } from "./chunk-5YA3XF7S.ts";
30
+ } from "./chunk-CUXPMKBQ.ts";
31
31
  import "./chunk-IYDZ3R2T.ts";
32
32
  import "./chunk-KP33I6BR.ts";
33
33
 
@@ -515,13 +515,13 @@ async function showMainMenu(ctx, options) {
515
515
  },
516
516
  actions: {
517
517
  "settings-chat": async () => {
518
- const { showSettingsAgentChat } = await import("./command-settings-chat-RN2GDMF5.ts");
518
+ const { showSettingsAgentChat } = await import("./command-settings-chat-4NLO3RDC.ts");
519
519
  if (!isCurrentOwner(owner)) return { kind: "close" };
520
520
  await showSettingsAgentChat(ctx, options, owner);
521
521
  return { kind: "close" };
522
522
  },
523
523
  configuration: async () => {
524
- const { showConfigurationMenu } = await import("./command-configuration-menu-JHKQ5SDW.ts");
524
+ const { showConfigurationMenu } = await import("./command-configuration-menu-N3SP6R3I.ts");
525
525
  if (!isCurrentOwner(owner)) return { kind: "close" };
526
526
  let selected;
527
527
  while (isCurrentOwner(owner)) {
@@ -1024,4 +1024,4 @@ export {
1024
1024
  registerStarshipCommand,
1025
1025
  reviewAndApply
1026
1026
  };
1027
- //# sourceMappingURL=commands-XIRYGV7S.ts.map
1027
+ //# sourceMappingURL=commands-MSJ67CTR.ts.map
package/dist/index.ts CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  directoryAlternateFormat,
11
11
  loadStarshipConfig,
12
12
  settingsFilePath
13
- } from "./chunks/chunk-5YA3XF7S.ts";
13
+ } from "./chunks/chunk-CUXPMKBQ.ts";
14
14
  import "./chunks/chunk-IYDZ3R2T.ts";
15
15
  import {
16
16
  PRIVATE_STYLE_SELECTOR
@@ -1181,6 +1181,21 @@ function freezeSnapshot(modules) {
1181
1181
  }
1182
1182
 
1183
1183
  // src/usage.ts
1184
+ function latestTokensPerSecond(branch) {
1185
+ for (let index = branch.length - 1; index >= 0; index -= 1) {
1186
+ const entry = branch[index];
1187
+ if (entry?.type !== "message" || entry.message.role !== "assistant") continue;
1188
+ const { stopReason, durationMs, usage } = entry.message;
1189
+ if (stopReason !== "stop" && stopReason !== "length" && stopReason !== "toolUse") return void 0;
1190
+ const output = usage?.output;
1191
+ if (typeof durationMs !== "number" || !Number.isFinite(durationMs) || durationMs <= 0 || typeof output !== "number" || !Number.isFinite(output) || output < 0) {
1192
+ return void 0;
1193
+ }
1194
+ const rate = output / (durationMs / 1e3);
1195
+ return Number.isFinite(rate) ? rate : void 0;
1196
+ }
1197
+ return void 0;
1198
+ }
1184
1199
  function summarizeFooterUsage(entries) {
1185
1200
  const totals = {
1186
1201
  input: 0,
@@ -1228,7 +1243,7 @@ var MAX_TIMER_DELAY_MS = 2147483647;
1228
1243
  var starshipCommandsPromise;
1229
1244
  function loadStarshipCommands() {
1230
1245
  if (!starshipCommandsPromise) {
1231
- starshipCommandsPromise = import("./chunks/commands-XIRYGV7S.ts").catch((error) => {
1246
+ starshipCommandsPromise = import("./chunks/commands-MSJ67CTR.ts").catch((error) => {
1232
1247
  starshipCommandsPromise = void 0;
1233
1248
  throw error;
1234
1249
  });
@@ -1793,19 +1808,21 @@ function safeUsername() {
1793
1808
  }
1794
1809
  }
1795
1810
  function runtimeSnapshot(ctx, footerData, runtime) {
1811
+ const branch = ctx.sessionManager.getBranch();
1796
1812
  return {
1797
1813
  cwd: ctx.cwd,
1798
1814
  homeDir: homedir(),
1799
1815
  gitRoot: runtime.git?.root,
1800
1816
  model: ctx.model ? { provider: ctx.model.provider, id: ctx.model.id } : void 0,
1801
1817
  thinkingLevel: runtime.thinkingLevel,
1802
- turnCount: userTurnCount(ctx),
1818
+ turnCount: branch.filter((entry) => entry.type === "message" && entry.message.role === "user").length,
1803
1819
  activeTools: runtime.activeTools,
1804
1820
  isStreaming: runtime.isStreaming,
1805
1821
  uiPrompt: runtime.uiPrompt,
1806
1822
  lastCompletedTool: runtime.lastCompletedTool,
1807
1823
  contextUsage: ctx.getContextUsage() ?? void 0,
1808
1824
  tokenTotals: summarizeFooterUsage(ctx.sessionManager.getEntries()),
1825
+ tokensPerSecond: latestTokensPerSecond(branch),
1809
1826
  usingSubscription: isSubscriptionBacked(ctx),
1810
1827
  gitBranch: runtime.git?.branch?.name ?? footerData.getGitBranch(),
1811
1828
  gitBranchDetails: runtime.git?.branch,
@@ -1820,9 +1837,6 @@ function runtimeSnapshot(ctx, footerData, runtime) {
1820
1837
  now: /* @__PURE__ */ new Date()
1821
1838
  };
1822
1839
  }
1823
- function userTurnCount(ctx) {
1824
- return ctx.sessionManager.getBranch().filter((entry) => entry.type === "message" && entry.message.role === "user").length;
1825
- }
1826
1840
  function isSubscriptionBacked(ctx) {
1827
1841
  const model = ctx.model;
1828
1842
  return model !== void 0 && (model.provider === "kimi-coding" || ctx.modelRegistry.isUsingOAuth(model));