sidekick-shared 0.13.4 → 0.13.5

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
@@ -29,6 +29,7 @@ npm install sidekick-shared
29
29
  | **Report** | Self-contained HTML session report generation |
30
30
  | **Credentials** | Claude Max OAuth credential reading from `~/.claude/.credentials.json` |
31
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) |
32
33
 
33
34
  ## Usage Examples
34
35
 
@@ -54,6 +55,20 @@ const tasks = readTasks({ projectSlug: slug });
54
55
  console.log(`Found ${tasks.length} tasks`);
55
56
  ```
56
57
 
58
+ ### Check provider status
59
+
60
+ ```typescript
61
+ import { fetchProviderStatus } from 'sidekick-shared';
62
+
63
+ const status = await fetchProviderStatus();
64
+ if (status.indicator !== 'none') {
65
+ console.log(`Claude API: ${status.description}`);
66
+ for (const c of status.affectedComponents) {
67
+ console.log(` ${c.name}: ${c.status}`);
68
+ }
69
+ }
70
+ ```
71
+
57
72
  ### Fetch subscription quota
58
73
 
59
74
  ```typescript
package/dist/index.d.ts CHANGED
@@ -83,3 +83,5 @@ export { readClaudeMaxCredentials, readClaudeMaxAccessTokenSync } from './creden
83
83
  export type { ClaudeMaxCredentials } from './credentials';
84
84
  export { fetchQuota } from './quota';
85
85
  export type { QuotaWindow, QuotaState } from './quota';
86
+ export { fetchProviderStatus } from './providerStatus';
87
+ 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.fetchQuota = exports.readClaudeMaxAccessTokenSync = exports.readClaudeMaxCredentials = exports.openInBrowser = exports.parseTranscript = exports.generateHtmlReport = exports.PatternExtractor = void 0;
8
+ exports.fetchProviderStatus = exports.fetchQuota = exports.readClaudeMaxAccessTokenSync = exports.readClaudeMaxCredentials = 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; } });
@@ -181,3 +181,6 @@ Object.defineProperty(exports, "readClaudeMaxAccessTokenSync", { enumerable: tru
181
181
  // Quota
182
182
  var quota_1 = require("./quota");
183
183
  Object.defineProperty(exports, "fetchQuota", { enumerable: true, get: function () { return quota_1.fetchQuota; } });
184
+ // Provider Status
185
+ var providerStatus_1 = require("./providerStatus");
186
+ Object.defineProperty(exports, "fetchProviderStatus", { enumerable: true, get: function () { return providerStatus_1.fetchProviderStatus; } });
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Stateless provider status fetcher for Claude API health.
3
+ *
4
+ * Calls the Atlassian Statuspage API at status.claude.com and returns
5
+ * current status information. Polling / eventing is the caller's responsibility.
6
+ */
7
+ export interface ProviderStatusState {
8
+ indicator: 'none' | 'minor' | 'major' | 'critical';
9
+ description: string;
10
+ affectedComponents: Array<{
11
+ name: string;
12
+ status: string;
13
+ }>;
14
+ activeIncident: {
15
+ name: string;
16
+ impact: string;
17
+ shortlink: string;
18
+ updatedAt: string;
19
+ } | null;
20
+ updatedAt: string;
21
+ }
22
+ /**
23
+ * Fetch current Claude API status from status.claude.com.
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
29
+ */
30
+ export declare function fetchProviderStatus(): Promise<ProviderStatusState>;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ /**
3
+ * Stateless provider status fetcher for Claude API health.
4
+ *
5
+ * Calls the Atlassian Statuspage API at status.claude.com and returns
6
+ * current status information. Polling / eventing is the caller's responsibility.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
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';
12
+ function fallbackState() {
13
+ return {
14
+ indicator: 'none',
15
+ description: 'Status unavailable',
16
+ affectedComponents: [],
17
+ activeIncident: null,
18
+ updatedAt: new Date().toISOString(),
19
+ };
20
+ }
21
+ /**
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
28
+ */
29
+ async function fetchProviderStatus() {
30
+ try {
31
+ const statusRes = await fetch(STATUS_URL);
32
+ if (!statusRes.ok)
33
+ return fallbackState();
34
+ const statusData = await statusRes.json();
35
+ const indicator = (statusData.status?.indicator ?? 'none');
36
+ const description = statusData.status?.description ?? '';
37
+ const updatedAt = statusData.page?.updated_at ?? new Date().toISOString();
38
+ // All operational — no need to fetch summary
39
+ if (indicator === 'none') {
40
+ return { indicator, description, affectedComponents: [], activeIncident: null, updatedAt };
41
+ }
42
+ // Degraded — fetch summary for components + incidents
43
+ const summaryRes = await fetch(SUMMARY_URL);
44
+ if (!summaryRes.ok) {
45
+ return { indicator, description, affectedComponents: [], activeIncident: null, updatedAt };
46
+ }
47
+ const summaryData = await summaryRes.json();
48
+ // Filter to non-operational components only
49
+ const affectedComponents = (summaryData.components ?? [])
50
+ .filter(c => c.status && c.status !== 'operational')
51
+ .map(c => ({ name: c.name ?? 'Unknown', status: c.status ?? 'unknown' }));
52
+ // Pick first unresolved incident
53
+ const unresolvedIncident = (summaryData.incidents ?? [])
54
+ .find(i => i.status !== 'resolved' && i.status !== 'postmortem');
55
+ const activeIncident = unresolvedIncident
56
+ ? {
57
+ name: unresolvedIncident.name ?? 'Unknown incident',
58
+ impact: unresolvedIncident.impact ?? 'unknown',
59
+ shortlink: unresolvedIncident.shortlink ?? '',
60
+ updatedAt: unresolvedIncident.updated_at ?? updatedAt,
61
+ }
62
+ : null;
63
+ return { indicator, description, affectedComponents, activeIncident, updatedAt };
64
+ }
65
+ catch {
66
+ return fallbackState();
67
+ }
68
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sidekick-shared",
3
- "version": "0.13.4",
3
+ "version": "0.13.5",
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",