@ascenda-one/gemini-hooks 0.1.40 → 0.1.41

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/cli.js +76 -10
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -604,7 +604,7 @@ var require_metricKeys = __commonJS({
604
604
  family: "context",
605
605
  readBy: ["handoff"],
606
606
  unit: "tokens",
607
- note: "Codex only: the model_context_window the rollout itself recorded \u2014 the real denominator its contextWindowPeakPct was computed against. Claude Code records no window and its ratio assumes 200k; absent here means the store never said."
607
+ note: "Codex: the model_context_window the rollout itself recorded \u2014 the real denominator its contextWindowPeakPct was computed against. VS Code: the largest modelConfiguration.contextSize a Copilot request recorded. Claude Code records no window and its ratio assumes 200k; absent here means the store never said."
608
608
  },
609
609
  date: { family: "clock", readBy: ["handoff"] },
610
610
  errorCount: { family: "outcome", readBy: ["handoff"] },
@@ -720,6 +720,17 @@ var require_metricKeys = __commonJS({
720
720
  unit: "lines",
721
721
  note: "Claude Code only: user lines written by the Agent SDK or a headless run (entrypoint sdk-*). Nobody typed them, so promptCount leaves them out. Counted once per line across the store."
722
722
  },
723
+ copilotCredits: {
724
+ family: "context",
725
+ readBy: ["diagnostic"],
726
+ unit: "Copilot credits",
727
+ note: "VS Code only: the sum of each Copilot request's copilotCredits, rounded to five decimal places. Absent where no request recorded the figure, which Copilot builds before Jun 2026 don't."
728
+ },
729
+ reasoningEffort: {
730
+ family: "model",
731
+ readBy: ["diagnostic"],
732
+ note: "VS Code only: the modelConfiguration.reasoningEffort most of a Copilot session's requests ran with. Absent where no request recorded a model configuration."
733
+ },
723
734
  tokensNotCollected: {
724
735
  family: "context",
725
736
  readBy: ["diagnostic"],
@@ -733,7 +744,28 @@ var require_metricKeys = __commonJS({
733
744
  duplicateChatSessions: {
734
745
  family: "reading",
735
746
  readBy: ["diagnostic"],
736
- note: "VS Code only: chat sessions seen in more than one place (a transferred session also in a workspace). Counted once."
747
+ note: "VS Code only: chat sessions seen in more than one place (a transferred session also in a workspace). Counted once. Copilot CLI uses it for a session written both as a directory and as an older flat file."
748
+ },
749
+ clientName: {
750
+ family: "session",
751
+ readBy: ["diagnostic"],
752
+ note: "Copilot CLI only: workspace.yaml's client_name, one constant word naming what started the CLI (vscode, vscode-agent-host). Absent on sessions written before the field existed, which were the standalone CLI."
753
+ },
754
+ totalApiDurationMs: {
755
+ family: "session",
756
+ readBy: ["diagnostic"],
757
+ unit: "milliseconds",
758
+ note: "Copilot CLI only: session.shutdown.totalApiDurationMs, the time the session spent waiting on model calls. Absent where the session has no shutdown event."
759
+ },
760
+ selectedModel: {
761
+ family: "model",
762
+ readBy: ["diagnostic"],
763
+ note: "Copilot CLI only: the model the person chose at session start (session.start.selectedModel), which is auto when they let the router pick. primaryModel is the model that served the session, so the two differ exactly when the router chose."
764
+ },
765
+ selectedModelClass: {
766
+ family: "model",
767
+ readBy: ["diagnostic"],
768
+ note: "Copilot CLI only: classifyModelClass of selectedModel, so a session whose person picked auto reads router:auto beside the served model's class."
737
769
  },
738
770
  sessionsStartedFromBubble: {
739
771
  family: "reading",
@@ -1255,7 +1287,7 @@ var require_collectorVersion = __commonJS({
1255
1287
  exports.COLLECTOR_VERSION = exports.UNRELEASED_COLLECTOR_VERSION = void 0;
1256
1288
  exports.describeCollectorVersion = describeCollectorVersion;
1257
1289
  exports.UNRELEASED_COLLECTOR_VERSION = "unreleased";
1258
- exports.COLLECTOR_VERSION = "0.1.40" ? "0.1.40" : exports.UNRELEASED_COLLECTOR_VERSION;
1290
+ exports.COLLECTOR_VERSION = "0.1.41" ? "0.1.41" : exports.UNRELEASED_COLLECTOR_VERSION;
1259
1291
  function describeCollectorVersion(version = exports.COLLECTOR_VERSION) {
1260
1292
  return version === exports.UNRELEASED_COLLECTOR_VERSION ? `${version} (built from a checkout, not a release)` : version;
1261
1293
  }
@@ -3920,6 +3952,8 @@ var require_hookAdapter = __commonJS({
3920
3952
  if (!logFile)
3921
3953
  throw error;
3922
3954
  logUnsent(logFile, events, options);
3955
+ if (!(error instanceof MissingInstallationIdError))
3956
+ throw error;
3923
3957
  return;
3924
3958
  }
3925
3959
  const sender = new eventSender_1.AscendaEventSender({
@@ -4088,6 +4122,7 @@ var require_studyJoin = __commonJS({
4088
4122
  };
4089
4123
  }();
4090
4124
  Object.defineProperty(exports, "__esModule", { value: true });
4125
+ exports.gitOfferLine = gitOfferLine;
4091
4126
  exports.runStudyJoin = runStudyJoin;
4092
4127
  exports.formatWindow = formatWindow;
4093
4128
  exports.describeStudyGrant = describeStudyGrant;
@@ -4096,6 +4131,11 @@ var require_studyJoin = __commonJS({
4096
4131
  var readline = __importStar(__require("node:readline"));
4097
4132
  var confirmLinks_1 = require_confirmLinks();
4098
4133
  var http_1 = require_http();
4134
+ function gitOfferLine(optionalImportStores) {
4135
+ if (!optionalImportStores?.includes("git"))
4136
+ return void 0;
4137
+ return "The page also has an unticked box for git history: commit times, size buckets, files changed and whether each is a merge. No messages, paths, names or emails.";
4138
+ }
4099
4139
  var STUDY_JOIN_MODE = "report";
4100
4140
  var POLL_INTERVAL_MS = 3e3;
4101
4141
  var POLL_TIMEOUT_MS = 11 * 60 * 1e3;
@@ -4132,6 +4172,9 @@ var require_studyJoin = __commonJS({
4132
4172
  print("Report (30 days) grants:");
4133
4173
  for (const grant of start.grants)
4134
4174
  print(` ${describeStudyGrant(grant)}`);
4175
+ const gitOffer = gitOfferLine(start.optionalImportStores);
4176
+ if (gitOffer)
4177
+ print(gitOffer);
4135
4178
  print("");
4136
4179
  print("Study mode needs the Ascenda app. Open the app to join that way instead.");
4137
4180
  print("");
@@ -4186,7 +4229,7 @@ var require_studyJoin = __commonJS({
4186
4229
  print("");
4187
4230
  print("Each of these can be turned off separately, in the app's consent settings.");
4188
4231
  print("The organisation sees group counts, never who joined.");
4189
- report({ status: "joined", start, granted });
4232
+ report({ status: "joined", start, granted, importStores: poll.importStores ?? null });
4190
4233
  return 0;
4191
4234
  }
4192
4235
  if (poll.status === "expired") {
@@ -4208,7 +4251,7 @@ var require_studyJoin = __commonJS({
4208
4251
  print("Each of these can be turned off separately, in the app's consent settings.");
4209
4252
  }
4210
4253
  print("Run join again, or check with your organisation.");
4211
- report({ status: "refused", start, granted, refusedReason: poll.refusedReason, message: describeRefusal(poll.refusedReason) });
4254
+ report({ status: "refused", start, granted, refusedReason: poll.refusedReason, message: describeRefusal(poll.refusedReason), importStores: poll.importStores ?? null });
4212
4255
  return 1;
4213
4256
  }
4214
4257
  print("");
@@ -4389,8 +4432,10 @@ var require_pairingStudyJoin = __commonJS({
4389
4432
  const join2 = attempt.carriesJoin ? session.studyJoin : void 0;
4390
4433
  if (!join2)
4391
4434
  return (0, confirmLinks_1.pairingConfirmLines)(session.qrUrl, session.code);
4435
+ const gitOffer = (0, studyJoin_1.gitOfferLine)(join2.optionalImportStores);
4392
4436
  return [
4393
4437
  `This also joins ${join2.organisationName} (${(0, studyJoin_1.formatWindow)(join2.windowStartUtc, join2.windowEndUtc)}). The page shows what you'd share before you confirm.`,
4438
+ ...gitOffer ? [gitOffer] : [],
4394
4439
  `Open this link to confirm: ${session.qrUrl}`
4395
4440
  ];
4396
4441
  }
@@ -5960,7 +6005,7 @@ ${(0, setupDisclosure_1.renderSetupDisclosure)({ sends: spec.sends, displayName:
5960
6005
  if (options.dryRun) {
5961
6006
  row("info", "moved", `would remove the copy in ${(0, hookRunner_1.tidyHomePath)(otherFile, os2.homedir())}, so each event runs once`);
5962
6007
  } else if (removeOurHookEntries(otherFile, spec)) {
5963
- row("ok", "moved", `removed the copy in ${(0, hookRunner_1.tidyHomePath)(otherFile, os2.homedir())}, so each event runs once ${ui.dim("(backup beside it)")}`);
6008
+ row("ok", "moved", `removed the copy in ${(0, hookRunner_1.tidyHomePath)(otherFile, os2.homedir())}, so each event runs once${spec.settings.owned ? "" : ` ${ui.dim("(backup beside it)")}`}`);
5964
6009
  } else {
5965
6010
  row("warn", "note", `${(0, hookRunner_1.tidyHomePath)(otherFile, os2.homedir())} registers these hooks too, so each event runs twice.`);
5966
6011
  detail("", `Remove the ${spec.binaryName} entries from one of the two files.`);
@@ -6232,7 +6277,7 @@ Pairing ${status.status}. Run setup again.`);
6232
6277
  function writeHookSettings(settingsFile, binary, spec, dryRun) {
6233
6278
  let settings = { ...spec.settings.scaffold ?? {} };
6234
6279
  const exists = fs.existsSync(settingsFile);
6235
- if (exists) {
6280
+ if (exists && !spec.settings.owned) {
6236
6281
  const raw = fs.readFileSync(settingsFile, "utf8").trim();
6237
6282
  if (raw) {
6238
6283
  try {
@@ -6245,7 +6290,7 @@ ${settingsFile} is not valid JSON. Fix or move it, then run setup again.`);
6245
6290
  }
6246
6291
  }
6247
6292
  const command = hookCommand(binary, spec);
6248
- const hooks = { ...settings.hooks ?? {} };
6293
+ const hooks = spec.settings.owned ? {} : { ...settings.hooks ?? {} };
6249
6294
  for (const event of spec.hookEvents) {
6250
6295
  hooks[event] = placeOurEntry(hooks[event] ?? [], spec.settings.entry(command, event), spec);
6251
6296
  }
@@ -6260,6 +6305,11 @@ ${settingsFile} is not valid JSON. Fix or move it, then run setup again.`);
6260
6305
  ${serialised}`);
6261
6306
  return true;
6262
6307
  }
6308
+ if (spec.settings.owned) {
6309
+ fs.mkdirSync(path2.dirname(settingsFile), { recursive: true });
6310
+ (0, hookRunner_1.writeAtomically)(settingsFile, serialised, 420);
6311
+ return true;
6312
+ }
6263
6313
  (0, settingsFile_1.replaceSettingsFile)(settingsFile, serialised);
6264
6314
  return true;
6265
6315
  }
@@ -6514,6 +6564,15 @@ ${serialised}`);
6514
6564
  if (found.length)
6515
6565
  lines.push("", ...found);
6516
6566
  }
6567
+ if (spec.doctorExtras) {
6568
+ try {
6569
+ const extra = spec.doctorExtras(ui);
6570
+ if (extra.length)
6571
+ lines.push("", ...extra);
6572
+ } catch (error) {
6573
+ lines.push("", ` ${spec.displayName} checks could not run: ${error instanceof Error ? error.message : String(error)}`);
6574
+ }
6575
+ }
6517
6576
  lines.push("", ...accountLines(ui, spec));
6518
6577
  const localOnly = (0, credentials_1.isLocalOnlyHostInstall)(spec.host, (id) => (0, tokenStore_1.readTokenFile)((0, tokenStore_1.defaultTokenFilePath)(id)) !== void 0);
6519
6578
  lines.push("", ` ${ui.bold("Local events")} ${(0, eventLog_1.describeEventLog)((0, eventLog_1.resolveEventLog)({ localOnly }), `npx ${spec.packageName} setup`)}`);
@@ -6569,6 +6628,10 @@ ${serialised}`);
6569
6628
  function removeOurHookEntries(settingsFile, spec) {
6570
6629
  if (!fs.existsSync(settingsFile))
6571
6630
  return true;
6631
+ if (spec.settings.owned) {
6632
+ fs.rmSync(settingsFile, { force: true });
6633
+ return true;
6634
+ }
6572
6635
  try {
6573
6636
  const settings = JSON.parse(fs.readFileSync(settingsFile, "utf8"));
6574
6637
  const hooks = { ...settings.hooks ?? {} };
@@ -6596,7 +6659,7 @@ ${serialised}`);
6596
6659
  console.error(`could not parse ${settingsFile} \u2014 remove the ascenda hook entries by hand`);
6597
6660
  return 1;
6598
6661
  }
6599
- console.log(`hooks removed from ${settingsFile}`);
6662
+ console.log(spec.settings.owned ? `removed ${settingsFile}` : `hooks removed from ${settingsFile}`);
6600
6663
  }
6601
6664
  for (const file of (0, hookRunner_1.removeHookRunner)(spec.binaryName)) {
6602
6665
  if (!file.endsWith(".node") && !file.endsWith(".no-node"))
@@ -6949,7 +7012,7 @@ var require_out3 = __commonJS({
6949
7012
  exports.shouldAnnounceFailure = exports.recordSendOutcome = exports.readCollectorState = exports.defaultStateFilePath = exports.tokenExpiryFilePath = exports.readTokenFile = exports.readTokenExpiry = exports.persistEventWriteToken = exports.listPersistedToolInstallationIds = exports.defaultTokenFilePath = exports.ascendaHome = exports.EVENT_TOKEN_TTL_MS = exports.recordTurnStart = exports.readTurnPromptId = exports.consumeTurnDurationMs = exports.writeTopLevelCredentials = exports.writeMachineCredentials = exports.writeRepoKeysSetting = exports.writeEventLogSetting = exports.writeHostCredentials = exports.removeHostCredentials = exports.readMachineCredentials = exports.readHostCredentials = exports.isLocalOnlyHostInstall = exports.credentialsFilePath = exports.renderSetupDisclosure = exports.REFUSALS = exports.FREE_TEXT_KEYS = exports.FAMILY_SENTENCES = exports.ALWAYS_SENT = exports.writeHookSettings = exports.trustProblemLines = exports.runCliAgentSetup = exports.registeredHookSets = exports.ourHookPositions = exports.isCliAgentManagementCommand = exports.findStaleHookCommands = exports.cliAgentHookBinPath = exports.resolveContextHashes = exports.resolveCliAgentInstallationId = exports.withPromptId = exports.withForgeKeys = exports.loadCliAgentConfig = exports.flushHookOutbox = exports.deliverHookEvents = exports.MissingInstallationIdError = exports.DEFAULT_API_BASE_URL = exports.resolveEventLogPath = exports.resolveEventLog = exports.parseEventLogFlag = void 0;
6950
7013
  exports.saverReplayPath = exports.saverContainerDir = exports.readSaverStatuses = exports.probeSocket = exports.heldForSaver = exports.holdForSaver = exports.LIVE_BUS_BACKGROUND_TRUST_MS = exports.liveBusSocketCandidates = exports.liveBusSocketPath = exports.bucketPromptSize = exports.deliverLine = exports.emitLiveSignal = exports.repoKeysEnabled = exports.deriveForgeKeysForCwd = exports.REPO_KEYS_ENV_VAR = exports.recordForgeProjectAlias = exports.forgeFullNameFromConfig = exports.readForgeFullName = exports.parseForgeFullName = exports.forgeBranchKey = exports.forgeRepoKey = exports.forgeProjectHash = exports.workContextRegistryFilePath = exports.readWorkContextRegistry = exports.recordWorkContextAlias = exports.recordWorkContext = exports.readBranchName = exports.normalizeBranchName = exports.deriveBranchHashForCwd = exports.deriveBranchHash = exports.deriveWorkContext = exports.hashWithMachineSalt = exports.readOrCreateMachineSalt = exports.machineSaltFilePath = exports.fixedTimeProvider = exports.systemTimeProvider = exports.enforceOutboxBounds = exports.claimOutbox = exports.readOutboxSummary = exports.appendToOutbox = exports.defaultOutboxFilePath = exports.outboxDrainEnabled = exports.DEFAULT_OUTBOX_DRAIN_BATCH_SIZE = exports.DEFAULT_OUTBOX_MAX_AGE_MS = exports.DEFAULT_OUTBOX_MAX_ENTRIES = exports.OUTBOX_DRAIN_ENV_VAR = exports.recordOutboxDiscard = exports.unresolvedToolInstallationId = exports.unresolvedStateFilePath = exports.markFailureNotified = void 0;
6951
7014
  exports.isRetryableStatus = exports.parseIngestResponse = exports.postToolEventsBatch = exports.postToolEvent = exports.renewToolToken = exports.getStudyJoinStatus = exports.getPairingStatus = exports.createPairingSession = exports.AscendaApiError = exports.scriptMarkerIn = exports.psLookup = exports.psArgsLookup = exports.livePidFields = exports.findAgentProcess = exports.findAgentPid = exports.AGENT_PROCESS = exports.readViaPlugin = exports.readHookSet = exports.isHookSet = exports.hookSetOfCommand = exports.hookSetChanges = exports.hookSetArgument = exports.describeHookSetChanges = exports.UNVERSIONED_HOOK_SET = exports.HOOK_SET_FLAG = exports.liveSignalDoctorLines = exports.doctorRow = exports.DOCTOR_VALUE_COLUMN = exports.pluginBundlePaths = exports.installPluginBundle = exports.describePluginBundleOutcome = exports.replaceSettingsFile = exports.writeAtomically = exports.tidyHomePath = exports.stampLastHook = exports.resolveHookNode = exports.removeHookRunner = exports.readLastHook = exports.lastHookPath = exports.isDowngrade = exports.installHookRunner = exports.hookRunnerPaths = exports.hookRunnerCommand = exports.hookLauncherScript = exports.describeAge = exports.terminalStyle = exports.colourEnabled = exports.SAVER_REPLAY_WINDOW_MS = exports.saverSupportDir = exports.saverStatusDir = void 0;
6952
- exports.writePairingJoinOutcome = exports.settleStudyJoin = exports.pairingJoinOutcome = exports.pairingAttemptLines = exports.createPairingAttempt = exports.PAIR_ORG_JOIN_CODE_ENV = exports.PAIR_JOIN_OUTCOME_FILE_ENV = exports.studyJoinConfirmUrl = exports.pairingConfirmUrl = exports.pairingConfirmLines = exports.runStudyJoin = exports.formatWindow = exports.describeStudyGrant = exports.describeStudyKind = exports.describeStudyJoinRefusal = exports.studyNoticeStatus = exports.runStudyObjection = exports.renderStudyNotices = exports.NOTICED_PURPOSES = exports.renderInitiatives = exports.initiativesStatusLines = exports.INITIATIVE_COPY = exports.startStudyJoin = exports.setStudyObjection = exports.markStudyNoticeShown = exports.readStudyNotices = exports.readInitiatives = void 0;
7015
+ exports.writePairingJoinOutcome = exports.settleStudyJoin = exports.pairingJoinOutcome = exports.pairingAttemptLines = exports.createPairingAttempt = exports.PAIR_ORG_JOIN_CODE_ENV = exports.PAIR_JOIN_OUTCOME_FILE_ENV = exports.studyJoinConfirmUrl = exports.pairingConfirmUrl = exports.pairingConfirmLines = exports.runStudyJoin = exports.gitOfferLine = exports.formatWindow = exports.describeStudyGrant = exports.describeStudyKind = exports.describeStudyJoinRefusal = exports.studyNoticeStatus = exports.runStudyObjection = exports.renderStudyNotices = exports.NOTICED_PURPOSES = exports.renderInitiatives = exports.initiativesStatusLines = exports.INITIATIVE_COPY = exports.startStudyJoin = exports.setStudyObjection = exports.markStudyNoticeShown = exports.readStudyNotices = exports.readInitiatives = void 0;
6953
7016
  var commandClassifier_1 = require_commandClassifier();
6954
7017
  Object.defineProperty(exports, "classifyCommand", { enumerable: true, get: function() {
6955
7018
  return commandClassifier_1.classifyCommand;
@@ -7640,6 +7703,9 @@ var require_out3 = __commonJS({
7640
7703
  Object.defineProperty(exports, "formatWindow", { enumerable: true, get: function() {
7641
7704
  return studyJoin_1.formatWindow;
7642
7705
  } });
7706
+ Object.defineProperty(exports, "gitOfferLine", { enumerable: true, get: function() {
7707
+ return studyJoin_1.gitOfferLine;
7708
+ } });
7643
7709
  Object.defineProperty(exports, "runStudyJoin", { enumerable: true, get: function() {
7644
7710
  return studyJoin_1.runStudyJoin;
7645
7711
  } });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "publishConfig": { "access": "public" },
3
3
  "name": "@ascenda-one/gemini-hooks",
4
- "version": "0.1.40",
4
+ "version": "0.1.41",
5
5
  "description": "Gemini CLI hooks adapter for Ascenda AI workload telemetry",
6
6
  "repository": {
7
7
  "type": "git",