@ascenda-one/agent-mcp 0.1.13 → 0.1.15

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 +164 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -381,12 +381,155 @@ var require_payload = __commonJS({
381
381
  }
382
382
  });
383
383
 
384
+ // ../packages/tool-contract/out/metricKeys.js
385
+ var require_metricKeys = __commonJS({
386
+ "../packages/tool-contract/out/metricKeys.js"(exports) {
387
+ "use strict";
388
+ Object.defineProperty(exports, "__esModule", { value: true });
389
+ exports.METRIC_KEYS = void 0;
390
+ exports.backendMetricKeys = backendMetricKeys;
391
+ var CONTEXT_WINDOW_CANONICAL_ALIASES = [
392
+ "contextWindowPeakPct",
393
+ "context_window_peak_pct",
394
+ "contextWindowPct",
395
+ "context_window_pct"
396
+ ];
397
+ var CONTEXT_WINDOW_CURSOR_PERCENT_ALIASES = ["contextUsagePercent"];
398
+ exports.METRIC_KEYS = {
399
+ // ── Read by a backend reader ────────────────────────────────────────────
400
+ contextWindowPeakPct: {
401
+ readBy: ["backend", "handoff"],
402
+ backendAliases: CONTEXT_WINDOW_CANONICAL_ALIASES,
403
+ unit: "fraction of the context window (0\u20131; uncapped for >200k contexts)",
404
+ note: "Claude Code reports a true per-session peak. Cursor reports its composer's last known occupancy under the same key \u2014 the closest its store can answer, and not the same measurement."
405
+ },
406
+ contextUsagePercent: {
407
+ readBy: ["backend", "handoff"],
408
+ backendAliases: CONTEXT_WINDOW_CURSOR_PERCENT_ALIASES,
409
+ unit: "percent (0\u2013100)",
410
+ note: "Cursor's own column name. Superseded by contextWindowPeakPct on the wire; kept because the handoff reads it and imported rows carry it. Unit-explicit on the backend: always divided by 100, never put through the fraction-or-percent heuristic."
411
+ },
412
+ promptCount: { readBy: ["backend", "handoff"], backendAliases: ["promptCount", "prompt_count"] },
413
+ sessionMinutes: { readBy: ["backend"], backendAliases: ["sessionMinutes", "session_minutes"], unit: "minutes" },
414
+ durationBucket: { readBy: ["backend", "handoff"], backendAliases: ["durationBucket", "duration_bucket"] },
415
+ afterHoursPrompts: { readBy: ["backend", "handoff"], backendAliases: ["afterHoursPrompts", "after_hours_prompts"] },
416
+ inputTokens: { readBy: ["backend"], backendAliases: ["inputTokens", "input_tokens"], unit: "tokens" },
417
+ outputTokens: { readBy: ["backend"], backendAliases: ["outputTokens", "output_tokens"], unit: "tokens" },
418
+ cacheReadTokens: { readBy: ["backend"], backendAliases: ["cacheReadTokens", "cache_read_tokens"], unit: "tokens" },
419
+ queuedPrompts: { readBy: ["backend"], backendAliases: ["queuedPrompts", "queued_prompts"] },
420
+ linesChangedBucket: { readBy: ["backend"], backendAliases: ["linesChangedBucket", "lines_changed_bucket"] },
421
+ // ── Read by the local handoff only ──────────────────────────────────────
422
+ activeMinutes: { readBy: ["handoff"], unit: "minutes" },
423
+ afterHoursRequests: { readBy: ["handoff"] },
424
+ approximateLintErrorsCount: { readBy: ["handoff"] },
425
+ canceledCount: { readBy: ["handoff"] },
426
+ chatEditCount: { readBy: ["handoff"] },
427
+ compactionCount: {
428
+ readBy: ["handoff"],
429
+ note: "The backend counts context_compression_* event rows, not this key. Both are emitted; this one is for the handoff."
430
+ },
431
+ contextWindowPeakTokens: {
432
+ readBy: ["handoff"],
433
+ unit: "tokens",
434
+ note: "The measured quantity, with no assumed denominator. Prefer this to the ratio for any within-person baseline."
435
+ },
436
+ date: { readBy: ["handoff"] },
437
+ errorCount: { readBy: ["handoff"] },
438
+ filesChangedCount: { readBy: ["handoff"] },
439
+ humanChangesCount: { readBy: ["handoff"] },
440
+ linesAdded: { readBy: ["handoff"] },
441
+ linesRemoved: { readBy: ["handoff"] },
442
+ primaryModel: { readBy: ["handoff"] },
443
+ requestCount: { readBy: ["handoff"] },
444
+ sessionStartedAt: { readBy: ["handoff"] },
445
+ subagentComposers: { readBy: ["handoff"] },
446
+ subagentToolCallCount: {
447
+ readBy: ["handoff"],
448
+ note: "Claude Code only: calls made inside subagent transcripts, kept out of toolCallCount so the main-loop count matches what the wire events carry."
449
+ },
450
+ subagentTranscripts: { readBy: ["handoff"] },
451
+ toolCallCount: {
452
+ readBy: ["handoff"],
453
+ note: "The backend counts ai_tool_call_started event rows, not this key \u2014 same split as compactionCount. Deduplicated on the tool-call id; see each extractor for what one call means in its store."
454
+ },
455
+ toolCallsUndated: {
456
+ readBy: ["handoff"],
457
+ note: "Cursor only: calls whose every record carries an empty createdAt. Counted in toolCallCount, but no event exists for them \u2014 the wire total is smaller than this session count by exactly this number."
458
+ },
459
+ toolFailureCount: { readBy: ["handoff"] },
460
+ totalEntryCount: { readBy: ["handoff"] },
461
+ userModifiedEditCount: {
462
+ readBy: ["handoff"],
463
+ note: "Null, never 0 \u2014 Claude Code never sets userModified true, so 0 would assert 'no AI edit was ever corrected by hand'."
464
+ },
465
+ // ── Diagnostic: read by nobody, on purpose ──────────────────────────────
466
+ abandonedPromptCount: { readBy: ["diagnostic"] },
467
+ // Epoch-marker metrics. The marker is local-only and never reaches the wire
468
+ // (see EXTRACTION_EPOCH_KIND), but it travels as a NormalizedHistoricalEvent
469
+ // and so is keyed by the same vocabulary.
470
+ windowOldest: { readBy: ["handoff"], note: "Oldest event the extraction saw \u2014 the marker's left edge." },
471
+ windowNewest: { readBy: ["handoff"], note: "Newest event the extraction saw \u2014 the marker's right edge." },
472
+ projectsWithNoReadableTranscript: { readBy: ["diagnostic"] },
473
+ unparsedComposerHeaders: { readBy: ["diagnostic"] },
474
+ unknownComposerHeaderTypes: { readBy: ["diagnostic"] },
475
+ orphanedBubbles: { readBy: ["diagnostic"] },
476
+ orphanedSubagentBubbles: { readBy: ["diagnostic"] },
477
+ sessionsWithoutTimeline: { readBy: ["diagnostic"] },
478
+ emptyComposers: { readBy: ["diagnostic"] },
479
+ apiErrorCount: { readBy: ["diagnostic"] },
480
+ assistantTurns: { readBy: ["diagnostic"] },
481
+ compactionAutoCount: { readBy: ["diagnostic"] },
482
+ compactionManualCount: { readBy: ["diagnostic"] },
483
+ editDayCount: { readBy: ["diagnostic"] },
484
+ emptyChatSessions: { readBy: ["diagnostic"] },
485
+ gitBranch: { readBy: ["diagnostic"] },
486
+ linesChanged: { readBy: ["diagnostic"] },
487
+ malformedChatSessionLines: { readBy: ["diagnostic"] },
488
+ malformedHistoryEntries: { readBy: ["diagnostic"] },
489
+ mode: { readBy: ["diagnostic"] },
490
+ modelCount: { readBy: ["diagnostic"] },
491
+ modelSwitchCount: { readBy: ["diagnostic"] },
492
+ rapidRepromptCount: { readBy: ["diagnostic"] },
493
+ schemaUnreadable: { readBy: ["diagnostic"] },
494
+ sessionCount: { readBy: ["diagnostic"] },
495
+ sessionsFromBubbleTimeline: { readBy: ["diagnostic"] },
496
+ sessionsFromCheckpointTimeline: { readBy: ["diagnostic"] },
497
+ sessionsFromRecencyTimeline: { readBy: ["diagnostic"] },
498
+ subagentAssistantTurns: { readBy: ["diagnostic"] },
499
+ subagentPrompts: { readBy: ["diagnostic"] },
500
+ subagentTokensTotal: { readBy: ["diagnostic"] },
501
+ toolName: {
502
+ readBy: ["diagnostic"],
503
+ note: "Set per ai_tool_call_started event by #43's extractors and shipped in wire metadata, but no reader resolves it server-side yet (the backend's ToolName column is MCP audit, not telemetry). Registered after the fact: #38 and #43 merged past each other, and the union caught it on the next compile \u2014 metaLines all over again."
504
+ },
505
+ toolResultCount: { readBy: ["diagnostic"] },
506
+ toolResultErrorCount: { readBy: ["diagnostic"] },
507
+ unknownBubbles: { readBy: ["diagnostic"] },
508
+ unknownLines: { readBy: ["diagnostic"] },
509
+ metaLines: {
510
+ readBy: ["diagnostic"],
511
+ note: 'Recognised-but-skipped transcript machinery (file-history-snapshot, queued-command, \u2026). Split out of unknownLines by #43 so that number keeps meaning "a type nobody has looked at". Registered here after the fact: #41 and #43 merged past each other, and the union caught it on the next compile \u2014 which is this module doing its job.'
512
+ },
513
+ unparsedBubbles: { readBy: ["diagnostic"] },
514
+ unparsedChatSessionFiles: { readBy: ["diagnostic"] },
515
+ unparsedHistoryFiles: { readBy: ["diagnostic"] },
516
+ unparsedLines: { readBy: ["diagnostic"] },
517
+ unreadableChatSessionFiles: { readBy: ["diagnostic"] },
518
+ unreadableHistoryFiles: { readBy: ["diagnostic"] },
519
+ unrecognisedChatSessionFiles: { readBy: ["diagnostic"] }
520
+ };
521
+ function backendMetricKeys() {
522
+ return Object.entries(exports.METRIC_KEYS).filter(([, spec]) => spec.readBy.includes("backend")).map(([key, spec]) => [key, spec.backendAliases ?? [key]]);
523
+ }
524
+ }
525
+ });
526
+
384
527
  // ../packages/tool-contract/out/index.js
385
528
  var require_out = __commonJS({
386
529
  "../packages/tool-contract/out/index.js"(exports) {
387
530
  "use strict";
388
531
  Object.defineProperty(exports, "__esModule", { value: true });
389
- exports.ASCENDA_SEMANTIC_PROVENANCE = exports.ASCENDA_HISTORICAL_CONSENT_SCOPE = exports.ASCENDA_COLLABORATION_CONSENT_SCOPE = exports.ASCENDA_SEMANTIC_CONSENT_SCOPE = exports.ASCENDA_PROVENANCE = exports.ASCENDA_CONSENT_SCOPE = exports.EVENT_WORKLOAD_CATEGORY = exports.COLLABORATION_EVENT_TYPES = exports.SEMANTIC_WORK_SIGNAL_EVENT_TYPES = void 0;
532
+ exports.backendMetricKeys = exports.METRIC_KEYS = exports.ASCENDA_SEMANTIC_PROVENANCE = exports.ASCENDA_HISTORICAL_CONSENT_SCOPE = exports.ASCENDA_COLLABORATION_CONSENT_SCOPE = exports.ASCENDA_SEMANTIC_CONSENT_SCOPE = exports.ASCENDA_PROVENANCE = exports.ASCENDA_CONSENT_SCOPE = exports.EVENT_WORKLOAD_CATEGORY = exports.COLLABORATION_EVENT_TYPES = exports.SEMANTIC_WORK_SIGNAL_EVENT_TYPES = void 0;
390
533
  exports.SEMANTIC_WORK_SIGNAL_EVENT_TYPES = [
391
534
  "approach_churn_detected",
392
535
  "goal_drift_detected",
@@ -445,6 +588,13 @@ var require_out = __commonJS({
445
588
  exports.ASCENDA_COLLABORATION_CONSENT_SCOPE = "workflow_telemetry";
446
589
  exports.ASCENDA_HISTORICAL_CONSENT_SCOPE = "historical_import";
447
590
  exports.ASCENDA_SEMANTIC_PROVENANCE = "semantic_work_signals";
591
+ var metricKeys_1 = require_metricKeys();
592
+ Object.defineProperty(exports, "METRIC_KEYS", { enumerable: true, get: function() {
593
+ return metricKeys_1.METRIC_KEYS;
594
+ } });
595
+ Object.defineProperty(exports, "backendMetricKeys", { enumerable: true, get: function() {
596
+ return metricKeys_1.backendMetricKeys;
597
+ } });
448
598
  }
449
599
  });
450
600
 
@@ -679,6 +829,7 @@ var require_tokenStore = __commonJS({
679
829
  };
680
830
  }();
681
831
  Object.defineProperty(exports, "__esModule", { value: true });
832
+ exports.ascendaHome = ascendaHome;
682
833
  exports.defaultTokenFilePath = defaultTokenFilePath2;
683
834
  exports.persistEventWriteToken = persistEventWriteToken2;
684
835
  exports.readTokenFile = readTokenFile2;
@@ -686,8 +837,11 @@ var require_tokenStore = __commonJS({
686
837
  var fs = __importStar(__require("fs"));
687
838
  var os = __importStar(__require("os"));
688
839
  var path = __importStar(__require("path"));
840
+ function ascendaHome() {
841
+ return process.env.ASCENDA_HOME ?? path.join(os.homedir(), ".ascenda");
842
+ }
689
843
  function defaultTokenFilePath2(toolInstallationId) {
690
- return path.join(os.homedir(), ".ascenda", "tokens", sanitizeFilePart(toolInstallationId));
844
+ return path.join(ascendaHome(), "tokens", sanitizeFilePart(toolInstallationId));
691
845
  }
692
846
  function persistEventWriteToken2(tokenFilePath, token) {
693
847
  const dir = path.dirname(tokenFilePath);
@@ -1646,6 +1800,7 @@ var require_liveBus = __commonJS({
1646
1800
  var path = __importStar(__require("path"));
1647
1801
  var WRITE_TIMEOUT_MS = 50;
1648
1802
  var APP_BUNDLE_ID = "one.ascenda.ascendaMissionControl";
1803
+ var SAVER_HOST_BUNDLE_ID = "com.apple.ScreenSaver.Engine.legacyScreenSaver";
1649
1804
  function liveBusSocketCandidates() {
1650
1805
  const override = process.env.ASCENDA_LIVE_BUS_SOCKET;
1651
1806
  if (override)
@@ -1653,7 +1808,8 @@ var require_liveBus = __commonJS({
1653
1808
  const home = os.homedir();
1654
1809
  return [
1655
1810
  path.join(home, ".ascenda", "live.sock"),
1656
- path.join(home, "Library", "Containers", APP_BUNDLE_ID, "Data", ".ascenda", "live.sock")
1811
+ path.join(home, "Library", "Containers", APP_BUNDLE_ID, "Data", ".ascenda", "live.sock"),
1812
+ path.join(home, "Library", "Containers", SAVER_HOST_BUNDLE_ID, "Data", "l.sock")
1657
1813
  ];
1658
1814
  }
1659
1815
  function liveBusSocketPath() {
@@ -1725,8 +1881,8 @@ var require_out2 = __commonJS({
1725
1881
  "../packages/tool-kit/out/index.js"(exports) {
1726
1882
  "use strict";
1727
1883
  Object.defineProperty(exports, "__esModule", { value: true });
1728
- exports.workContextRegistryFilePath = exports.readWorkContextRegistry = exports.recordWorkContextAlias = exports.recordWorkContext = exports.deriveWorkContext = exports.hashWithMachineSalt = exports.readOrCreateMachineSalt = exports.machineSaltFilePath = exports.markFailureNotified = exports.shouldAnnounceFailure = exports.recordSendOutcome = exports.readCollectorState = exports.defaultStateFilePath = exports.readTokenFile = exports.persistEventWriteToken = exports.defaultTokenFilePath = exports.recordTurnStart = exports.consumeTurnDurationMs = exports.resolveContextHashes = exports.loadCliAgentConfig = exports.deliverHookEvents = exports.DEFAULT_API_BASE_URL = exports.resolveEventLogPath = exports.expandUserPath = exports.appendEventLog = exports.EVENT_LOG_ENV_VAR = exports.buildEventPayload = exports.AscendaSemanticEventError = exports.AscendaEventSender = exports.looksLikeCorrection = exports.outcomeForHook = exports.inferOutcome = exports.getNestedNumber = exports.getNestedString = exports.getNested = exports.getNumber = exports.getString = exports.localHourAt = exports.utcOffsetMinutesAt = exports.BUSINESS_DAY = exports.isOutsideBusinessHours = exports.isAfterHours = exports.bucketDurationMs = exports.bucketLinesChanged = exports.invitesDebrief = exports.classifyWorkMilestone = exports.isReworkGitAction = exports.classifyGitAction = exports.isVerificationCommand = exports.classifyCommand = void 0;
1729
- exports.isRetryableStatus = exports.parseIngestResponse = exports.postToolEventsBatch = exports.postToolEvent = exports.renewToolToken = exports.getPairingStatus = exports.createPairingSession = exports.AscendaApiError = exports.liveBusSocketCandidates = exports.liveBusSocketPath = exports.bucketPromptSize = exports.emitLiveSignal = void 0;
1884
+ exports.readWorkContextRegistry = exports.recordWorkContextAlias = exports.recordWorkContext = exports.deriveWorkContext = exports.hashWithMachineSalt = exports.readOrCreateMachineSalt = exports.machineSaltFilePath = exports.markFailureNotified = exports.shouldAnnounceFailure = exports.recordSendOutcome = exports.readCollectorState = exports.defaultStateFilePath = exports.readTokenFile = exports.persistEventWriteToken = exports.defaultTokenFilePath = exports.ascendaHome = exports.recordTurnStart = exports.consumeTurnDurationMs = exports.resolveContextHashes = exports.loadCliAgentConfig = exports.deliverHookEvents = exports.DEFAULT_API_BASE_URL = exports.resolveEventLogPath = exports.expandUserPath = exports.appendEventLog = exports.EVENT_LOG_ENV_VAR = exports.buildEventPayload = exports.AscendaSemanticEventError = exports.AscendaEventSender = exports.looksLikeCorrection = exports.outcomeForHook = exports.inferOutcome = exports.getNestedNumber = exports.getNestedString = exports.getNested = exports.getNumber = exports.getString = exports.localHourAt = exports.utcOffsetMinutesAt = exports.BUSINESS_DAY = exports.isOutsideBusinessHours = exports.isAfterHours = exports.bucketDurationMs = exports.bucketLinesChanged = exports.invitesDebrief = exports.classifyWorkMilestone = exports.isReworkGitAction = exports.classifyGitAction = exports.isVerificationCommand = exports.classifyCommand = void 0;
1885
+ exports.isRetryableStatus = exports.parseIngestResponse = exports.postToolEventsBatch = exports.postToolEvent = exports.renewToolToken = exports.getPairingStatus = exports.createPairingSession = exports.AscendaApiError = exports.liveBusSocketCandidates = exports.liveBusSocketPath = exports.bucketPromptSize = exports.emitLiveSignal = exports.workContextRegistryFilePath = void 0;
1730
1886
  var commandClassifier_1 = require_commandClassifier();
1731
1887
  Object.defineProperty(exports, "classifyCommand", { enumerable: true, get: function() {
1732
1888
  return commandClassifier_1.classifyCommand;
@@ -1840,6 +1996,9 @@ var require_out2 = __commonJS({
1840
1996
  return turnState_1.recordTurnStart;
1841
1997
  } });
1842
1998
  var tokenStore_1 = require_tokenStore();
1999
+ Object.defineProperty(exports, "ascendaHome", { enumerable: true, get: function() {
2000
+ return tokenStore_1.ascendaHome;
2001
+ } });
1843
2002
  Object.defineProperty(exports, "defaultTokenFilePath", { enumerable: true, get: function() {
1844
2003
  return tokenStore_1.defaultTokenFilePath;
1845
2004
  } });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "publishConfig": { "access": "public" },
3
3
  "name": "@ascenda-one/agent-mcp",
4
- "version": "0.1.13",
4
+ "version": "0.1.15",
5
5
  "description": "MCP server exposing ascenda_emit_work_signal — the one submission interface for agent-observed (semantic) work-friction signals.",
6
6
  "repository": {
7
7
  "type": "git",