@ascenda-one/gemini-hooks 0.1.25 → 0.1.27

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 +78 -29
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -540,6 +540,10 @@ var require_metricKeys = __commonJS({
540
540
  orphanedBubbles: { readBy: ["diagnostic"] },
541
541
  orphanedSubagentBubbles: { readBy: ["diagnostic"] },
542
542
  sessionsWithoutTimeline: { readBy: ["diagnostic"] },
543
+ sessionsWithOnlyInheritedLines: {
544
+ readBy: ["diagnostic"],
545
+ note: "Claude Code transcripts holding nothing but a copy of an ancestor's history, so no line's instant is theirs and no session is emitted for them. Excluded by rule, not a read failure: the work is in the transcript that owns it."
546
+ },
543
547
  emptyComposers: { readBy: ["diagnostic"] },
544
548
  apiErrorCount: { readBy: ["diagnostic"] },
545
549
  assistantTurns: { readBy: ["diagnostic"] },
@@ -735,6 +739,16 @@ var require_out = __commonJS({
735
739
  // `ai_prompt_submitted` closes. Neutral so a marker sent once per turn
736
740
  // doesn't weigh on any workload leg.
737
741
  ai_turn_completed: "neutral",
742
+ // The agent stopped and is waiting on the person: Claude Code's
743
+ // `Notification`, Codex's `PermissionRequest`. Supervision, beside the other
744
+ // oversight overhead, because that is what it is — time the person spends
745
+ // attending to the agent rather than to the work.
746
+ //
747
+ // Deliberately NOT risk. Risk is the leg that reads as something going
748
+ // wrong, and being asked is not a failure; classifying it there is the first
749
+ // step toward an interruption count becoming a score, a streak, or something
750
+ // that fires on a miss. It must never become any of those.
751
+ supervision_interruption: "supervision",
738
752
  // Semantic (agent-observed) — see SEMANTIC_WORK_SIGNAL_EVENT_TYPES.
739
753
  approach_churn_detected: "risk",
740
754
  goal_drift_detected: "risk",
@@ -3349,16 +3363,20 @@ var require_liveBus = __commonJS({
3349
3363
  path2.join(home, "Library", "Containers", SAVER_HOST_BUNDLE_ID, "Data", "l.sock")
3350
3364
  ];
3351
3365
  }
3352
- function liveBusSocketPath() {
3366
+ function existingSocketCandidates() {
3353
3367
  const candidates = liveBusSocketCandidates();
3354
- for (const candidate of candidates) {
3368
+ if (process.env.ASCENDA_LIVE_BUS_SOCKET)
3369
+ return candidates;
3370
+ return candidates.filter((candidate) => {
3355
3371
  try {
3356
- if (fs.statSync(candidate).isSocket())
3357
- return candidate;
3372
+ return fs.statSync(candidate).isSocket();
3358
3373
  } catch {
3374
+ return false;
3359
3375
  }
3360
- }
3361
- return candidates[0];
3376
+ });
3377
+ }
3378
+ function liveBusSocketPath() {
3379
+ return existingSocketCandidates()[0] ?? liveBusSocketCandidates()[0];
3362
3380
  }
3363
3381
  function bucketPromptSize2(text) {
3364
3382
  const length = typeof text === "string" ? text.length : 0;
@@ -3370,44 +3388,75 @@ var require_liveBus = __commonJS({
3370
3388
  return "l";
3371
3389
  return "xl";
3372
3390
  }
3391
+ var NOBODY_LISTENING = /* @__PURE__ */ new Set(["ECONNREFUSED", "ENOENT"]);
3373
3392
  function emitLiveSignal2(signal) {
3374
3393
  return new Promise((resolve) => {
3394
+ const candidates = existingSocketCandidates();
3395
+ if (candidates.length === 0) {
3396
+ resolve();
3397
+ return;
3398
+ }
3375
3399
  let settled = false;
3400
+ let socket;
3401
+ const drop = () => {
3402
+ try {
3403
+ socket?.destroy();
3404
+ } catch {
3405
+ }
3406
+ socket = void 0;
3407
+ };
3376
3408
  const done = () => {
3377
3409
  if (settled)
3378
3410
  return;
3379
3411
  settled = true;
3380
- try {
3381
- socket.destroy();
3382
- } catch {
3383
- }
3412
+ clearTimeout(timer);
3413
+ drop();
3384
3414
  resolve();
3385
3415
  };
3386
- let socket;
3387
- try {
3388
- socket = net.createConnection(liveBusSocketPath());
3389
- } catch {
3390
- resolve();
3391
- return;
3392
- }
3393
3416
  const timer = setTimeout(done, WRITE_TIMEOUT_MS);
3394
3417
  if (typeof timer.unref === "function")
3395
3418
  timer.unref();
3396
- if (typeof socket.unref === "function")
3397
- socket.unref();
3398
- socket.on("error", done);
3399
- socket.on("connect", () => {
3419
+ const tryFrom = (index) => {
3420
+ if (settled)
3421
+ return;
3422
+ if (index >= candidates.length) {
3423
+ done();
3424
+ return;
3425
+ }
3426
+ let attempt;
3400
3427
  try {
3401
- socket.write(`${JSON.stringify(signal)}
3402
- `, () => {
3403
- clearTimeout(timer);
3404
- done();
3405
- });
3428
+ attempt = net.createConnection(candidates[index]);
3406
3429
  } catch {
3407
- clearTimeout(timer);
3408
- done();
3430
+ tryFrom(index + 1);
3431
+ return;
3409
3432
  }
3410
- });
3433
+ socket = attempt;
3434
+ if (typeof attempt.unref === "function")
3435
+ attempt.unref();
3436
+ let connected = false;
3437
+ attempt.on("error", (error) => {
3438
+ if (settled || socket !== attempt)
3439
+ return;
3440
+ if (!connected && error.code && NOBODY_LISTENING.has(error.code)) {
3441
+ drop();
3442
+ tryFrom(index + 1);
3443
+ return;
3444
+ }
3445
+ done();
3446
+ });
3447
+ attempt.on("connect", () => {
3448
+ if (settled || socket !== attempt)
3449
+ return;
3450
+ connected = true;
3451
+ try {
3452
+ attempt.write(`${JSON.stringify(signal)}
3453
+ `, done);
3454
+ } catch {
3455
+ done();
3456
+ }
3457
+ });
3458
+ };
3459
+ tryFrom(0);
3411
3460
  });
3412
3461
  }
3413
3462
  }
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.25",
4
+ "version": "0.1.27",
5
5
  "description": "Gemini CLI hooks adapter for Ascenda AI workload telemetry",
6
6
  "repository": {
7
7
  "type": "git",