sidekick-shared 0.14.2 → 0.15.1

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/README.md CHANGED
@@ -28,8 +28,8 @@ npm install sidekick-shared
28
28
  | **Aggregation** | Event aggregation, frequency tracking, activity heatmaps, pattern extraction |
29
29
  | **Report** | Self-contained HTML session report generation |
30
30
  | **Credentials** | Claude Max OAuth credential reading from `~/.claude/.credentials.json` |
31
- | **Quota** | Claude Max subscription quota fetching (5-hour and 7-day windows) |
32
- | **Provider Status** | Claude API health checking via status.claude.com (indicator, components, incidents) |
31
+ | **Quota** | Claude Max subscription quota fetching (5-hour and 7-day windows) and Codex rate-limit extraction from event streams |
32
+ | **Provider Status** | API health checking via status.claude.com and status.openai.com (indicator, components, incidents) |
33
33
 
34
34
  ## Usage Examples
35
35
 
package/dist/index.d.ts CHANGED
@@ -89,5 +89,5 @@ export type { QuotaWindow, QuotaState } from './quota';
89
89
  export { describeQuotaFailure } from './quotaPresentation';
90
90
  export type { QuotaFailureDescriptor } from './quotaPresentation';
91
91
  export { getModelContextWindowSize, DEFAULT_CONTEXT_WINDOW } from './modelContext';
92
- export { fetchProviderStatus } from './providerStatus';
92
+ export { fetchProviderStatus, fetchOpenAIStatus } from './providerStatus';
93
93
  export type { ProviderStatusState } from './providerStatus';
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.findActiveClaudeSession = exports.discoverSessionDirectory = exports.getClaudeSessionDirectory = exports.encodeClaudeWorkspacePath = exports.detectSessionActivity = exports.extractTaskInfo = exports.scanSubagentDir = exports.normalizeCodexToolInput = exports.normalizeCodexToolName = exports.extractPatchFilePaths = exports.CodexRolloutParser = exports.parseDbPartData = exports.parseDbMessageData = exports.convertOpenCodeMessage = exports.detectPlanModeFromText = exports.normalizeToolInput = exports.normalizeToolName = exports.TRUNCATION_PATTERNS = exports.JsonlParser = exports.CodexProvider = exports.OpenCodeProvider = exports.ClaudeCodeProvider = exports.getAllDetectedProviders = exports.detectProvider = exports.readClaudeCodePlanFiles = exports.getPlanAnalytics = exports.writePlans = exports.getLatestPlan = exports.readPlans = exports.readLatestHandoff = exports.readHistory = exports.readNotes = exports.readDecisions = exports.readTasks = exports.getProjectSlugRaw = exports.getProjectSlug = exports.encodeWorkspacePath = exports.getGlobalDataPath = exports.getProjectDataPath = exports.getConfigDir = exports.MAX_PLANS_PER_PROJECT = exports.PLAN_SCHEMA_VERSION = exports.createEmptyTokenTotals = exports.HISTORICAL_DATA_SCHEMA_VERSION = exports.STALENESS_THRESHOLDS = exports.IMPORTANCE_DECAY_FACTORS = exports.KNOWLEDGE_NOTE_SCHEMA_VERSION = exports.DECISION_LOG_SCHEMA_VERSION = exports.normalizeTaskStatus = exports.TASK_PERSISTENCE_SCHEMA_VERSION = void 0;
7
7
  exports.HeatmapTracker = exports.FrequencyTracker = exports.getSnapshotPath = exports.isSnapshotValid = exports.deleteSnapshot = exports.loadSnapshot = exports.saveSnapshot = exports.parseTodoDependencies = exports.EventAggregator = exports.getRandomPhrase = exports.ALL_PHRASES = exports.HIGHLIGHT_CSS = exports.clearHighlightCache = exports.highlightEvent = exports.formatSessionJson = exports.formatSessionMarkdown = exports.formatSessionText = exports.classifyNoise = exports.shouldMergeWithPrevious = exports.classifyFollowEvent = exports.classifyMessage = exports.getSoftNoiseReason = exports.isHardNoiseFollowEvent = exports.isHardNoise = exports.formatToolSummary = exports.toFollowEvents = exports.createWatcher = exports.parseChangelog = exports.extractProposedPlanShared = exports.parsePlanMarkdownShared = exports.PlanExtractor = exports.composeContext = exports.FilterEngine = exports.searchSessions = exports.CodexDatabase = exports.OpenCodeDatabase = exports.discoverDebugLogs = exports.collapseDuplicates = exports.filterByLevel = exports.parseDebugLog = exports.scanSubagentTraces = exports.findAllSessionsWithWorktrees = exports.discoverWorktreeSiblings = exports.resolveWorktreeMainRepo = exports.getAllClaudeProjectFolders = exports.decodeEncodedPath = exports.getMostRecentlyActiveSessionDir = exports.findSubdirectorySessionDirs = exports.findSessionsInDirectory = exports.findAllClaudeSessions = void 0;
8
- exports.fetchProviderStatus = exports.DEFAULT_CONTEXT_WINDOW = exports.getModelContextWindowSize = exports.describeQuotaFailure = exports.fetchQuota = exports.isMultiAccountEnabled = exports.getActiveAccount = exports.listAccounts = exports.removeAccount = exports.switchToAccount = exports.addCurrentAccount = exports.readActiveClaudeAccount = exports.writeAccountRegistry = exports.readAccountRegistry = exports.getAccountsDir = exports.readClaudeMaxAccessTokenSync = exports.readClaudeMaxCredentials = exports.writeActiveCredentials = exports.readActiveCredentials = exports.openInBrowser = exports.parseTranscript = exports.generateHtmlReport = exports.PatternExtractor = void 0;
8
+ exports.fetchOpenAIStatus = exports.fetchProviderStatus = exports.DEFAULT_CONTEXT_WINDOW = exports.getModelContextWindowSize = exports.describeQuotaFailure = exports.fetchQuota = exports.isMultiAccountEnabled = exports.getActiveAccount = exports.listAccounts = exports.removeAccount = exports.switchToAccount = exports.addCurrentAccount = exports.readActiveClaudeAccount = exports.writeAccountRegistry = exports.readAccountRegistry = exports.getAccountsDir = exports.readClaudeMaxAccessTokenSync = exports.readClaudeMaxCredentials = exports.writeActiveCredentials = exports.readActiveCredentials = exports.openInBrowser = exports.parseTranscript = exports.generateHtmlReport = exports.PatternExtractor = void 0;
9
9
  var taskPersistence_1 = require("./types/taskPersistence");
10
10
  Object.defineProperty(exports, "TASK_PERSISTENCE_SCHEMA_VERSION", { enumerable: true, get: function () { return taskPersistence_1.TASK_PERSISTENCE_SCHEMA_VERSION; } });
11
11
  Object.defineProperty(exports, "normalizeTaskStatus", { enumerable: true, get: function () { return taskPersistence_1.normalizeTaskStatus; } });
@@ -206,3 +206,4 @@ Object.defineProperty(exports, "DEFAULT_CONTEXT_WINDOW", { enumerable: true, get
206
206
  // Provider Status
207
207
  var providerStatus_1 = require("./providerStatus");
208
208
  Object.defineProperty(exports, "fetchProviderStatus", { enumerable: true, get: function () { return providerStatus_1.fetchProviderStatus; } });
209
+ Object.defineProperty(exports, "fetchOpenAIStatus", { enumerable: true, get: function () { return providerStatus_1.fetchOpenAIStatus; } });
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Stateless provider status fetcher for Claude API health.
2
+ * Stateless provider status fetchers for Atlassian Statuspage APIs.
3
3
  *
4
- * Calls the Atlassian Statuspage API at status.claude.com and returns
5
- * current status information. Polling / eventing is the caller's responsibility.
4
+ * Supports both status.claude.com and status.openai.com (same API format).
5
+ * Polling / eventing is the caller's responsibility.
6
6
  */
7
7
  export interface ProviderStatusState {
8
8
  indicator: 'none' | 'minor' | 'major' | 'critical';
@@ -22,9 +22,12 @@ export interface ProviderStatusState {
22
22
  /**
23
23
  * Fetch current Claude API status from status.claude.com.
24
24
  *
25
- * This is a **single-shot** function — it does not poll. The caller wraps
26
- * it in a polling loop, VS Code EventEmitter, or CLI interval as needed.
27
- *
28
- * @returns ProviderStatusState with indicator, affected components, and active incident
25
+ * Single-shot — caller wraps in polling loop, EventEmitter, or interval.
29
26
  */
30
27
  export declare function fetchProviderStatus(): Promise<ProviderStatusState>;
28
+ /**
29
+ * Fetch current OpenAI API status from status.openai.com.
30
+ *
31
+ * Single-shot — caller wraps in polling loop, EventEmitter, or interval.
32
+ */
33
+ export declare function fetchOpenAIStatus(): Promise<ProviderStatusState>;
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  /**
3
- * Stateless provider status fetcher for Claude API health.
3
+ * Stateless provider status fetchers for Atlassian Statuspage APIs.
4
4
  *
5
- * Calls the Atlassian Statuspage API at status.claude.com and returns
6
- * current status information. Polling / eventing is the caller's responsibility.
5
+ * Supports both status.claude.com and status.openai.com (same API format).
6
+ * Polling / eventing is the caller's responsibility.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.fetchProviderStatus = fetchProviderStatus;
10
- const STATUS_URL = 'https://status.claude.com/api/v2/status.json';
11
- const SUMMARY_URL = 'https://status.claude.com/api/v2/summary.json';
10
+ exports.fetchOpenAIStatus = fetchOpenAIStatus;
11
+ const CLAUDE_BASE = 'https://status.claude.com';
12
+ const OPENAI_BASE = 'https://status.openai.com';
12
13
  function fallbackState() {
13
14
  return {
14
15
  indicator: 'none',
@@ -19,16 +20,11 @@ function fallbackState() {
19
20
  };
20
21
  }
21
22
  /**
22
- * Fetch current Claude API status from status.claude.com.
23
- *
24
- * This is a **single-shot** function — it does not poll. The caller wraps
25
- * it in a polling loop, VS Code EventEmitter, or CLI interval as needed.
26
- *
27
- * @returns ProviderStatusState with indicator, affected components, and active incident
23
+ * Generic fetcher for any Atlassian Statuspage-compatible endpoint.
28
24
  */
29
- async function fetchProviderStatus() {
25
+ async function fetchStatusPage(baseUrl) {
30
26
  try {
31
- const statusRes = await fetch(STATUS_URL);
27
+ const statusRes = await fetch(`${baseUrl}/api/v2/status.json`);
32
28
  if (!statusRes.ok)
33
29
  return fallbackState();
34
30
  const statusData = await statusRes.json();
@@ -40,7 +36,7 @@ async function fetchProviderStatus() {
40
36
  return { indicator, description, affectedComponents: [], activeIncident: null, updatedAt };
41
37
  }
42
38
  // Degraded — fetch summary for components + incidents
43
- const summaryRes = await fetch(SUMMARY_URL);
39
+ const summaryRes = await fetch(`${baseUrl}/api/v2/summary.json`);
44
40
  if (!summaryRes.ok) {
45
41
  return { indicator, description, affectedComponents: [], activeIncident: null, updatedAt };
46
42
  }
@@ -66,3 +62,19 @@ async function fetchProviderStatus() {
66
62
  return fallbackState();
67
63
  }
68
64
  }
65
+ /**
66
+ * Fetch current Claude API status from status.claude.com.
67
+ *
68
+ * Single-shot — caller wraps in polling loop, EventEmitter, or interval.
69
+ */
70
+ async function fetchProviderStatus() {
71
+ return fetchStatusPage(CLAUDE_BASE);
72
+ }
73
+ /**
74
+ * Fetch current OpenAI API status from status.openai.com.
75
+ *
76
+ * Single-shot — caller wraps in polling loop, EventEmitter, or interval.
77
+ */
78
+ async function fetchOpenAIStatus() {
79
+ return fetchStatusPage(OPENAI_BASE);
80
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sidekick-shared",
3
- "version": "0.14.2",
3
+ "version": "0.15.1",
4
4
  "description": "Shared data access layer for Sidekick — readers, types, providers, credentials, quota",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",