modelstat 0.1.2 → 0.1.3

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.
package/dist/cli.mjs CHANGED
@@ -4624,16 +4624,22 @@ function redact(text, repoRootAbs) {
4624
4624
  });
4625
4625
  }
4626
4626
  out = out.replace(TOKEN_CANDIDATE, (match) => {
4627
- if (/^[a-f0-9]+$/i.test(match)) return match;
4628
- if (/^[A-Z]+$/.test(match)) return match;
4629
- const hasLetter = /[A-Za-z]/.test(match);
4627
+ if (/^[a-fA-F0-9]{32,}$/.test(match)) {
4628
+ counts.secrets_found += 1;
4629
+ return "[REDACTED:hash]";
4630
+ }
4631
+ if (/^[A-Z0-9_]+$/.test(match)) return match;
4632
+ if (/=$|\+/.test(match) && entropy(match) >= 3.5) {
4633
+ counts.secrets_found += 1;
4634
+ return "[REDACTED:base64]";
4635
+ }
4630
4636
  const hasDigit = /\d/.test(match);
4631
4637
  const hasUpper = /[A-Z]/.test(match);
4632
4638
  const hasLower = /[a-z]/.test(match);
4633
- if (!(hasLetter && hasDigit && hasUpper && hasLower)) return match;
4639
+ if (!(hasDigit && hasUpper && hasLower)) return match;
4634
4640
  if (entropy(match) < 3.6) return match;
4635
4641
  counts.secrets_found += 1;
4636
- return `[REDACTED:hi-entropy]`;
4642
+ return "[REDACTED:hi-entropy]";
4637
4643
  });
4638
4644
  out = out.replace(EMAIL_PATTERN, () => {
4639
4645
  counts.emails_redacted += 1;
@@ -5107,8 +5113,10 @@ var init_schemas = __esm({
5107
5113
  object: external_exports.string().max(60).nullable().default(null),
5108
5114
  /** Governed safe flags (`destructive`, `remote`, …). (tier 0) */
5109
5115
  qualifiers: external_exports.array(external_exports.string().max(40)).max(8).default([]),
5110
- /** Value-masked argument skeleton (every value → `§`). (tier 1) */
5111
- param_shape: external_exports.string().max(200).nullable().default(null),
5116
+ /** Value-masked argument skeleton (every value → `§`). Carried in full up
5117
+ * to a malicious-size guard (mirrors backend `MAX_TOOL_ACTION_PARAM_SHAPE_CHARS`);
5118
+ * the companion clamps rather than truncating semantically. (tier 1) */
5119
+ param_shape: external_exports.string().max(16384).nullable().default(null),
5112
5120
  /** Relevant non-sensitive keywords (e.g. ["rollout","restart","prod"]),
5113
5121
  * OpenAI-redacted on-device. (tier 0) */
5114
5122
  keywords: external_exports.array(external_exports.string().max(40)).max(12).default([]),
@@ -5118,7 +5126,7 @@ var init_schemas = __esm({
5118
5126
  /** The compliance-redacted command text — PII/secrets stripped on-device
5119
5127
  * (SOC2/GDPR), org-internal infra intact; the server derives semantics from
5120
5128
  * it. Un-redacted raw never ships. (tier 0, post-redaction) */
5121
- command_redacted: external_exports.string().max(1e3).nullable().default(null),
5129
+ command_redacted: external_exports.string().max(16384).nullable().default(null),
5122
5130
  /** Per-script content abstracts for any script/bash FILES the command runs
5123
5131
  * — summarized on-device by the local model, then redacted. Ordered by
5124
5132
  * appearance; `token` is the script's token exactly as it appears in
@@ -5377,6 +5385,10 @@ var init_scripts = __esm({
5377
5385
  });
5378
5386
 
5379
5387
  // ../../packages/parsers/src/tool-action/index.ts
5388
+ function clampChars(s, max) {
5389
+ const cps = [...s];
5390
+ return cps.length > max ? cps.slice(0, max).join("") : s;
5391
+ }
5380
5392
  function extractToolAction(call) {
5381
5393
  const isMcp = call.server.startsWith("mcp:");
5382
5394
  const command = isMcp ? null : shellCommandOf(call.input);
@@ -5387,8 +5399,8 @@ function extractToolAction(call) {
5387
5399
  if (command != null) {
5388
5400
  const [head = "", ...rest] = command.trim().split(/\s+/);
5389
5401
  executable = basename(head) || null;
5390
- param_shape = paramShape(rest.join(" ")) || null;
5391
- command_redacted = redact(command, call.cwd ?? void 0).text.slice(0, MAX_COMMAND_REDACTED) || null;
5402
+ param_shape = clampChars(paramShape(rest.join(" ")), MAX_FIELD_CHARS) || null;
5403
+ command_redacted = clampChars(redact(command, call.cwd ?? void 0).text, MAX_FIELD_CHARS) || null;
5392
5404
  }
5393
5405
  return {
5394
5406
  surface,
@@ -5426,13 +5438,13 @@ function shellCommandOf(input) {
5426
5438
  function basename(token) {
5427
5439
  return token.split("/").pop() ?? token;
5428
5440
  }
5429
- var MAX_COMMAND_REDACTED;
5441
+ var MAX_FIELD_CHARS;
5430
5442
  var init_tool_action = __esm({
5431
5443
  "../../packages/parsers/src/tool-action/index.ts"() {
5432
5444
  "use strict";
5433
5445
  init_src();
5434
5446
  init_scripts();
5435
- MAX_COMMAND_REDACTED = 1e3;
5447
+ MAX_FIELD_CHARS = 16384;
5436
5448
  }
5437
5449
  });
5438
5450
 
@@ -8538,6 +8550,33 @@ async function probeIdentities(os2) {
8538
8550
  } catch {
8539
8551
  }
8540
8552
  }
8553
+ const claudeConfigs = [`${homedir()}/.claude.json`];
8554
+ if (process.env.CLAUDE_CONFIG_DIR) {
8555
+ claudeConfigs.unshift(`${process.env.CLAUDE_CONFIG_DIR}/.claude.json`);
8556
+ }
8557
+ for (const candidate of claudeConfigs) {
8558
+ if (!existsSync3(candidate)) continue;
8559
+ try {
8560
+ const data = await fs4.promises.readFile(candidate, "utf8");
8561
+ const obj = JSON.parse(data);
8562
+ const acct = obj.oauthAccount;
8563
+ const stableId = acct?.accountUuid ?? acct?.organizationUuid;
8564
+ if (acct && stableId) {
8565
+ ids.push({
8566
+ provider: "anthropic",
8567
+ provider_account_id: stableId,
8568
+ provider_account_label: acct.emailAddress ?? acct.organizationName ?? acct.displayName ?? "Claude account",
8569
+ account_email: acct.emailAddress ?? null,
8570
+ account_org: acct.organizationName ?? acct.billingType ?? null,
8571
+ display_name: acct.displayName ?? null,
8572
+ owner_scope: "unassigned",
8573
+ detection_source: "claude_json_oauth"
8574
+ });
8575
+ break;
8576
+ }
8577
+ } catch {
8578
+ }
8579
+ }
8541
8580
  for (const candidate of [
8542
8581
  `${homedir()}/.codex/auth.json`,
8543
8582
  `${homedir()}/.config/codex/auth.json`
@@ -47440,7 +47479,7 @@ var init_scan = __esm({
47440
47479
  init_api();
47441
47480
  init_config2();
47442
47481
  init_pipeline2();
47443
- AGENT_VERSION = true ? "agent-0.1.2" : "agent-dev";
47482
+ AGENT_VERSION = true ? "agent-0.1.3" : "agent-dev";
47444
47483
  BATCH_MAX_EVENTS = INGEST_BATCH_MAX_EVENTS;
47445
47484
  BATCH_MAX_TOOL_CALLS = 2e4;
47446
47485
  BATCH_BUFFER_HARD_CAP = BATCH_MAX_EVENTS * 2;
@@ -49950,7 +49989,7 @@ var init_daemon = __esm({
49950
49989
  init_machine_key();
49951
49990
  init_scan();
49952
49991
  init_single_flight();
49953
- AGENT_VERSION2 = true ? "agent-0.1.2" : "agent-dev";
49992
+ AGENT_VERSION2 = true ? "agent-0.1.3" : "agent-dev";
49954
49993
  HEARTBEAT_INTERVAL_MS = 1e4;
49955
49994
  SCAN_INTERVAL_MS = 5 * 60 * 1e3;
49956
49995
  DISCOVERY_INTERVAL_MS = 6e4;
@@ -50082,6 +50121,7 @@ import { createInterface as createInterface3 } from "readline";
50082
50121
  // src/service.ts
50083
50122
  import { spawn, spawnSync as spawnSync2 } from "child_process";
50084
50123
  import {
50124
+ chmodSync as chmodSync3,
50085
50125
  copyFileSync,
50086
50126
  existsSync as existsSync9,
50087
50127
  mkdirSync as mkdirSync3,
@@ -50396,6 +50436,7 @@ function installTrayApp(sourceAppPath) {
50396
50436
  if (r.status !== 0) {
50397
50437
  throw new Error(`cp ModelstatTray.app failed: ${r.stderr?.trim() || `exit ${r.status}`}`);
50398
50438
  }
50439
+ chmodSync3(join7(dest, "Contents", "MacOS", "modelstat-tray"), 493);
50399
50440
  return { installedAt: dest };
50400
50441
  }
50401
50442
  async function bundledTrayAppPath(progress) {
@@ -50550,7 +50591,7 @@ function tryOpenBrowser(url) {
50550
50591
  return false;
50551
50592
  }
50552
50593
  }
50553
- var AGENT_VERSION3 = true ? "agent-0.1.2" : "agent-dev";
50594
+ var AGENT_VERSION3 = true ? "agent-0.1.3" : "agent-dev";
50554
50595
  function osFamily() {
50555
50596
  const p = platform5();
50556
50597
  if (p === "darwin") return "macos";