@sunasteriskrnd/takumi 1.0.0-dev.40 → 1.0.0-dev.42

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/index.js +24 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -19815,7 +19815,7 @@ var package_default;
19815
19815
  var init_package = __esm(() => {
19816
19816
  package_default = {
19817
19817
  name: "@sunasteriskrnd/takumi",
19818
- version: "1.0.0-dev.40",
19818
+ version: "1.0.0-dev.42",
19819
19819
  description: "CLI tool for bootstrapping and managing Takumi projects",
19820
19820
  type: "module",
19821
19821
  repository: {
@@ -70515,14 +70515,20 @@ function compactionBoundary(records) {
70515
70515
  }
70516
70516
 
70517
70517
  // src/domains/hooks/telemetry/lib/transcript-metrics.ts
70518
+ function isInterruptRecord(record) {
70519
+ if (record.promptSource != null)
70520
+ return false;
70521
+ return isInterruptText(peekText(record.message?.content));
70522
+ }
70518
70523
  function deriveTranscriptMetrics(records) {
70519
70524
  let turnCount = 0;
70520
70525
  let apiErrorCount = 0;
70521
70526
  for (const record of records) {
70522
70527
  if (record.isApiErrorMessage === true)
70523
70528
  apiErrorCount += 1;
70524
- if (record.type === "system" && record.subtype === "turn_duration")
70529
+ if (record.type === "user" && record.toolUseResult === undefined && !record.isMeta && !record.isSidechain && !record.isCompactSummary && !isInterruptRecord(record)) {
70525
70530
  turnCount += 1;
70531
+ }
70526
70532
  }
70527
70533
  return { turnCount, apiErrorCount };
70528
70534
  }
@@ -70550,7 +70556,7 @@ function foldRecordsIntoSummary(summary, records, nextOffset, newFingerprint, co
70550
70556
  const { mainLoopDelta, subagentDeltas, tokenUsageDeltas } = bucketTokens(records);
70551
70557
  const metrics = deriveTranscriptMetrics(records);
70552
70558
  const merged = mergeSummary(summary, {
70553
- turn_count: metrics.turnCount,
70559
+ ...metrics.turnCount > 0 ? { turn_count: metrics.turnCount } : {},
70554
70560
  api_error_count: metrics.apiErrorCount
70555
70561
  });
70556
70562
  merged.main_loop_tokens = addTokens3(summary.main_loop_tokens, mainLoopDelta);
@@ -70635,19 +70641,30 @@ function sessionDebugLogPath(sessionDir) {
70635
70641
  return join98(sessionDir, DETACH_DEBUG_LOG_NAME);
70636
70642
  }
70637
70643
  var BUNFS_PREFIX = "/$bunfs/";
70644
+ var REENTRY_VERBS = ["hooks", "hook-exec"];
70645
+ function findReentryVerbIndex(argv) {
70646
+ for (let i = 1;i < argv.length; i++) {
70647
+ if (REENTRY_VERBS.includes(argv[i]))
70648
+ return i;
70649
+ }
70650
+ return -1;
70651
+ }
70638
70652
  function resolveInvocationPrefix() {
70639
70653
  const argv = process.argv;
70640
70654
  const command = process.execPath;
70641
70655
  const entry = argv[1];
70642
70656
  const isCompiledBunBinary = typeof entry === "string" && entry.startsWith(BUNFS_PREFIX);
70643
- const hooksIdx = argv.indexOf("hooks");
70644
- if (hooksIdx <= 0) {
70645
- return { command, prefixArgs: [] };
70657
+ const verbIdx = findReentryVerbIndex(argv);
70658
+ if (verbIdx === -1) {
70659
+ if (isCompiledBunBinary)
70660
+ return { command, prefixArgs: [] };
70661
+ const isScriptEntry = typeof entry === "string" && (entry.endsWith(".ts") || entry.endsWith(".js"));
70662
+ return { command, prefixArgs: isScriptEntry ? [entry] : [] };
70646
70663
  }
70647
70664
  if (isCompiledBunBinary) {
70648
70665
  return { command, prefixArgs: [] };
70649
70666
  }
70650
- const rest = argv.slice(1, hooksIdx);
70667
+ const rest = argv.slice(1, verbIdx);
70651
70668
  const isSourceMode = typeof entry === "string" && (entry.endsWith(".ts") || entry.endsWith(".js"));
70652
70669
  const overrideConfig = process.env.TKM_CONFIG_OVERRIDE;
70653
70670
  if (isSourceMode && overrideConfig) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunasteriskrnd/takumi",
3
- "version": "1.0.0-dev.40",
3
+ "version": "1.0.0-dev.42",
4
4
  "description": "CLI tool for bootstrapping and managing Takumi projects",
5
5
  "type": "module",
6
6
  "repository": {