sidekick-shared 0.24.4 → 0.25.0

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 (98) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +200 -52
  3. package/dist/accountChangeSignal.d.ts +3 -0
  4. package/dist/accountChangeSignal.js +19 -0
  5. package/dist/accountChanges.d.ts +21 -0
  6. package/dist/accountChanges.js +151 -0
  7. package/dist/accountManager.d.ts +13 -0
  8. package/dist/accountManager.js +60 -32
  9. package/dist/accountRegistry.d.ts +3 -1
  10. package/dist/accountRegistry.js +64 -41
  11. package/dist/accounts.js +40 -19
  12. package/dist/autoSwitch.d.ts +2 -1
  13. package/dist/autoSwitch.js +32 -7
  14. package/dist/browser.d.ts +10 -3
  15. package/dist/browser.js +17 -1
  16. package/dist/codexProfiles.d.ts +14 -0
  17. package/dist/codexProfiles.js +268 -116
  18. package/dist/codexQuotaWatcher.d.ts +6 -0
  19. package/dist/codexQuotaWatcher.js +101 -47
  20. package/dist/context/sessionContext.js +2 -4
  21. package/dist/ensureDefaultAccounts.js +4 -4
  22. package/dist/index.d.ts +32 -15
  23. package/dist/index.js +54 -9
  24. package/dist/modelAliases.d.ts +13 -0
  25. package/dist/modelAliases.js +58 -0
  26. package/dist/modelCatalog.d.ts +32 -0
  27. package/dist/modelCatalog.js +145 -0
  28. package/dist/modelContext.d.ts +36 -3
  29. package/dist/modelContext.js +109 -34
  30. package/dist/modelInfo.d.ts +30 -1
  31. package/dist/modelInfo.js +116 -26
  32. package/dist/multiProviderQuotaService.d.ts +8 -0
  33. package/dist/multiProviderQuotaService.js +64 -3
  34. package/dist/node.d.ts +8 -2
  35. package/dist/node.js +11 -1
  36. package/dist/observedContextWindows.d.ts +13 -0
  37. package/dist/observedContextWindows.js +13 -0
  38. package/dist/observedSessionCollector.d.ts +75 -4
  39. package/dist/observedSessionCollector.js +452 -42
  40. package/dist/parsers/codexHistory.d.ts +32 -0
  41. package/dist/parsers/codexHistory.js +125 -0
  42. package/dist/parsers/mcpToolName.d.ts +26 -0
  43. package/dist/parsers/mcpToolName.js +31 -0
  44. package/dist/parsers/sessionActivityDetector.d.ts +6 -0
  45. package/dist/parsers/sessionActivityDetector.js +17 -0
  46. package/dist/parsers/sessionPathResolver.d.ts +11 -4
  47. package/dist/parsers/sessionPathResolver.js +11 -4
  48. package/dist/paths.d.ts +7 -3
  49. package/dist/paths.js +7 -3
  50. package/dist/providerIds.d.ts +11 -0
  51. package/dist/providerIds.js +9 -0
  52. package/dist/providerQuota.d.ts +3 -1
  53. package/dist/providerQuota.js +3 -0
  54. package/dist/providers/claudeCode.d.ts +11 -1
  55. package/dist/providers/claudeCode.js +222 -39
  56. package/dist/providers/codex.d.ts +39 -1
  57. package/dist/providers/codex.js +326 -39
  58. package/dist/providers/codexDatabase.d.ts +9 -0
  59. package/dist/providers/codexDatabase.js +107 -2
  60. package/dist/providers/diagnostics.d.ts +13 -0
  61. package/dist/providers/diagnostics.js +88 -0
  62. package/dist/providers/factory.d.ts +14 -0
  63. package/dist/providers/factory.js +57 -0
  64. package/dist/providers/openCode.d.ts +20 -1
  65. package/dist/providers/openCode.js +361 -11
  66. package/dist/providers/openCodeDatabase.d.ts +10 -0
  67. package/dist/providers/openCodeDatabase.js +69 -0
  68. package/dist/providers/types.d.ts +57 -2
  69. package/dist/providers/types.js +4 -0
  70. package/dist/quota.d.ts +4 -1
  71. package/dist/quota.js +3 -7
  72. package/dist/quotaHistory.d.ts +3 -2
  73. package/dist/quotaHistory.js +2 -2
  74. package/dist/quotaPoller.d.ts +13 -1
  75. package/dist/quotaPoller.js +65 -3
  76. package/dist/quotaSnapshots.js +8 -77
  77. package/dist/schemas/accountManager.d.ts +2 -2
  78. package/dist/schemas/accountManager.js +2 -4
  79. package/dist/schemas/accountStatus.d.ts +3 -0
  80. package/dist/schemas/accountStatus.js +1 -0
  81. package/dist/schemas/index.d.ts +1 -0
  82. package/dist/schemas/index.js +7 -2
  83. package/dist/schemas/observedSessionV1.d.ts +27 -26
  84. package/dist/schemas/observedSessionV1.js +6 -4
  85. package/dist/schemas/quota.d.ts +2 -2
  86. package/dist/schemas/quota.js +3 -6
  87. package/dist/schemas/quotaHistory.d.ts +2 -2
  88. package/dist/schemas/tokenEstimation.d.ts +1 -1
  89. package/dist/sessionMonitor.d.ts +15 -0
  90. package/dist/sessionMonitor.js +142 -0
  91. package/dist/sessionPreviews.d.ts +85 -0
  92. package/dist/sessionPreviews.js +549 -0
  93. package/dist/sessionTranscripts.js +10 -4
  94. package/dist/types/observedSessionV1.d.ts +6 -2
  95. package/dist/types/observedSessionV1.js +14 -8
  96. package/dist/writers/atomic.d.ts +20 -0
  97. package/dist/writers/atomic.js +190 -19
  98. package/package.json +22 -1
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ /**
3
+ * Reader for Codex's append-only `~/.codex/history.jsonl` (Node-only).
4
+ *
5
+ * Each line is `{"session_id","ts","text"}` — one entry per user prompt. The
6
+ * file grows without bound, so this reader takes a bounded tail instead of the
7
+ * whole file, drops the leading partial line, and parses tolerantly. Pair an
8
+ * entry with {@link findCodexRolloutFile} (providers/codex) to jump from a
9
+ * history row to its full rollout transcript.
10
+ *
11
+ * @module codexHistory
12
+ */
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.readCodexHistory = readCodexHistory;
48
+ const fs = __importStar(require("fs"));
49
+ const path = __importStar(require("path"));
50
+ const codexProfiles_1 = require("../codexProfiles");
51
+ const DEFAULT_LIMIT = 100;
52
+ const DEFAULT_TAIL_BYTES = 512 * 1024;
53
+ /**
54
+ * Returns the newest history entries, newest first. A missing or unreadable
55
+ * file yields `[]`; malformed lines are skipped. Never throws.
56
+ */
57
+ function readCodexHistory(options = {}) {
58
+ const limit = Math.max(0, options.limit ?? DEFAULT_LIMIT);
59
+ if (limit === 0)
60
+ return [];
61
+ const maxTailBytes = Math.max(1, options.maxTailBytes ?? Math.max(DEFAULT_TAIL_BYTES, limit * 4096));
62
+ const historyPath = path.join(options.codexHome ?? (0, codexProfiles_1.getSystemCodexHome)(), 'history.jsonl');
63
+ let descriptor;
64
+ try {
65
+ descriptor = fs.openSync(historyPath, 'r');
66
+ }
67
+ catch {
68
+ return [];
69
+ }
70
+ try {
71
+ const size = fs.fstatSync(descriptor).size;
72
+ const readBytes = Math.min(size, maxTailBytes);
73
+ const buffer = Buffer.alloc(readBytes);
74
+ fs.readSync(descriptor, buffer, 0, readBytes, size - readBytes);
75
+ let content = buffer.toString('utf8');
76
+ if (readBytes < size) {
77
+ // The tail almost certainly starts mid-line; a multibyte character
78
+ // straddling the boundary decodes as replacement garbage inside that
79
+ // same partial line, so dropping through the first newline handles both.
80
+ const firstNewline = content.indexOf('\n');
81
+ content = firstNewline === -1 ? '' : content.slice(firstNewline + 1);
82
+ }
83
+ const entries = [];
84
+ for (const line of content.split('\n')) {
85
+ const trimmed = line.trim();
86
+ if (!trimmed)
87
+ continue;
88
+ let parsed;
89
+ try {
90
+ parsed = JSON.parse(trimmed);
91
+ }
92
+ catch {
93
+ continue;
94
+ }
95
+ if (typeof parsed.session_id !== 'string' ||
96
+ typeof parsed.ts !== 'number' ||
97
+ // JSON.parse('1e400') yields Infinity, which would later RangeError
98
+ // out of Date serialization in consumers.
99
+ !Number.isFinite(parsed.ts) ||
100
+ typeof parsed.text !== 'string') {
101
+ continue;
102
+ }
103
+ entries.push({
104
+ sessionId: parsed.session_id,
105
+ ts: parsed.ts,
106
+ tsMs: parsed.ts * 1000,
107
+ text: parsed.text,
108
+ });
109
+ }
110
+ // The file is append-only, so on-disk order is oldest first.
111
+ entries.reverse();
112
+ return entries.slice(0, limit);
113
+ }
114
+ catch {
115
+ return [];
116
+ }
117
+ finally {
118
+ try {
119
+ fs.closeSync(descriptor);
120
+ }
121
+ catch {
122
+ // Already closed or invalid; nothing to release.
123
+ }
124
+ }
125
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Claude Code exposes MCP tools under composite identifiers of the form
3
+ * `mcp__<server>__<tool>`. Splitting them correctly is subtle enough that
4
+ * consumers keep re-implementing it by hand (usually with a plain
5
+ * `split('__')`, which mangles server names containing single underscores).
6
+ * This module is the canonical splitter. Browser-safe: no Node imports.
7
+ *
8
+ * @module mcpToolName
9
+ */
10
+ export interface McpToolNameParts {
11
+ serverName: string;
12
+ toolName: string;
13
+ }
14
+ /**
15
+ * Splits a Claude Code MCP tool identifier `mcp__<server>__<tool>` into parts.
16
+ *
17
+ * The server name ends at the first double underscore after the prefix, so
18
+ * single underscores stay inside it (`mcp__plugin_context7_context7__query-docs`
19
+ * → server `plugin_context7_context7`) and the tool keeps any further double
20
+ * underscores (`mcp__a__b__c` → tool `b__c`).
21
+ *
22
+ * Returns `null` for anything that is not a well-formed MCP tool id: a
23
+ * non-`mcp__` name, a missing or empty server or tool part, or a
24
+ * case-mismatched prefix. No trimming is applied.
25
+ */
26
+ export declare function parseMcpToolName(name: string): McpToolNameParts | null;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ /**
3
+ * Claude Code exposes MCP tools under composite identifiers of the form
4
+ * `mcp__<server>__<tool>`. Splitting them correctly is subtle enough that
5
+ * consumers keep re-implementing it by hand (usually with a plain
6
+ * `split('__')`, which mangles server names containing single underscores).
7
+ * This module is the canonical splitter. Browser-safe: no Node imports.
8
+ *
9
+ * @module mcpToolName
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.parseMcpToolName = parseMcpToolName;
13
+ const MCP_TOOL_NAME_PATTERN = /^mcp__([^_]+(?:_[^_]+)*)__(.+)$/;
14
+ /**
15
+ * Splits a Claude Code MCP tool identifier `mcp__<server>__<tool>` into parts.
16
+ *
17
+ * The server name ends at the first double underscore after the prefix, so
18
+ * single underscores stay inside it (`mcp__plugin_context7_context7__query-docs`
19
+ * → server `plugin_context7_context7`) and the tool keeps any further double
20
+ * underscores (`mcp__a__b__c` → tool `b__c`).
21
+ *
22
+ * Returns `null` for anything that is not a well-formed MCP tool id: a
23
+ * non-`mcp__` name, a missing or empty server or tool part, or a
24
+ * case-mismatched prefix. No trimming is applied.
25
+ */
26
+ function parseMcpToolName(name) {
27
+ const match = MCP_TOOL_NAME_PATTERN.exec(name);
28
+ if (!match)
29
+ return null;
30
+ return { serverName: match[1], toolName: match[2] };
31
+ }
@@ -29,3 +29,9 @@ export interface SessionActivityResult {
29
29
  * @returns Activity state with classification reason
30
30
  */
31
31
  export declare function detectSessionActivity(sessionPath: string): SessionActivityResult;
32
+ /**
33
+ * Refresh a cached classification from its unchanged fingerprint without
34
+ * re-reading the transcript. An active file remains active until it crosses
35
+ * the same five-minute staleness boundary used by detectSessionActivity.
36
+ */
37
+ export declare function refreshSessionActivityState(previous: 'active' | 'idle' | 'ended' | 'unknown', mtimeMs: number, nowMs?: number): 'active' | 'idle' | 'ended' | 'unknown';
@@ -45,6 +45,7 @@ var __importStar = (this && this.__importStar) || (function () {
45
45
  })();
46
46
  Object.defineProperty(exports, "__esModule", { value: true });
47
47
  exports.detectSessionActivity = detectSessionActivity;
48
+ exports.refreshSessionActivityState = refreshSessionActivityState;
48
49
  const fs = __importStar(require("fs"));
49
50
  // ── Constants ──
50
51
  /** How many bytes to read from the end of the file for analysis */
@@ -161,6 +162,22 @@ function detectSessionActivity(sessionPath) {
161
162
  }
162
163
  return { state: 'ended', lastActivityTime: new Date(stat.mtimeMs), reason: 'no-activity-signal' };
163
164
  }
165
+ /**
166
+ * Refresh a cached classification from its unchanged fingerprint without
167
+ * re-reading the transcript. An active file remains active until it crosses
168
+ * the same five-minute staleness boundary used by detectSessionActivity.
169
+ */
170
+ function refreshSessionActivityState(previous, mtimeMs, nowMs = Date.now()) {
171
+ if (!Number.isFinite(mtimeMs))
172
+ return previous;
173
+ if (nowMs - mtimeMs > STALENESS_THRESHOLD_MS)
174
+ return 'idle';
175
+ if (previous === 'ended')
176
+ return 'ended';
177
+ if (previous === 'idle')
178
+ return 'idle';
179
+ return previous === 'unknown' ? 'unknown' : 'active';
180
+ }
164
181
  // ── Helpers ──
165
182
  function readTail(filePath, fileSize) {
166
183
  const bytesToRead = Math.min(TAIL_BYTES, fileSize);
@@ -11,10 +11,17 @@
11
11
  */
12
12
  import type { ProjectFolderInfo } from '../providers/types';
13
13
  /**
14
- * Encodes a workspace path to Claude Code's directory naming scheme.
15
- *
16
- * Claude Code replaces path separators, colons, and underscores with hyphens
17
- * to create a flat directory structure.
14
+ * Encodes a workspace path to Claude Code's on-disk directory naming scheme
15
+ * under `~/.claude/projects/` — every non-ASCII-alphanumeric character
16
+ * (separators, colons, underscores, dots, spaces) becomes a hyphen, and case
17
+ * is preserved. Exported from the package root as `encodeClaudeWorkspacePath`.
18
+ *
19
+ * Not to be confused with the top-level `encodeWorkspacePath` export from
20
+ * `paths.ts`: that one is Sidekick's own config-store slug (it keeps dots) and
21
+ * does NOT match Claude Code's scheme — using it to build a
22
+ * `~/.claude/projects/` path silently misses for any workspace containing a
23
+ * dot or space. For lookups, prefer `getClaudeSessionDirectory` or the
24
+ * mismatch-tolerant `discoverSessionDirectory` over raw string encoding.
18
25
  *
19
26
  * @param workspacePath - Absolute path to workspace directory
20
27
  * @returns Encoded path string (e.g., "-home-user-code-project")
@@ -61,10 +61,17 @@ const fs = __importStar(require("fs"));
61
61
  const path = __importStar(require("path"));
62
62
  const os = __importStar(require("os"));
63
63
  /**
64
- * Encodes a workspace path to Claude Code's directory naming scheme.
65
- *
66
- * Claude Code replaces path separators, colons, and underscores with hyphens
67
- * to create a flat directory structure.
64
+ * Encodes a workspace path to Claude Code's on-disk directory naming scheme
65
+ * under `~/.claude/projects/` — every non-ASCII-alphanumeric character
66
+ * (separators, colons, underscores, dots, spaces) becomes a hyphen, and case
67
+ * is preserved. Exported from the package root as `encodeClaudeWorkspacePath`.
68
+ *
69
+ * Not to be confused with the top-level `encodeWorkspacePath` export from
70
+ * `paths.ts`: that one is Sidekick's own config-store slug (it keeps dots) and
71
+ * does NOT match Claude Code's scheme — using it to build a
72
+ * `~/.claude/projects/` path silently misses for any workspace containing a
73
+ * dot or space. For lookups, prefer `getClaudeSessionDirectory` or the
74
+ * mismatch-tolerant `discoverSessionDirectory` over raw string encoding.
68
75
  *
69
76
  * @param workspacePath - Absolute path to workspace directory
70
77
  * @returns Encoded path string (e.g., "-home-user-code-project")
package/dist/paths.d.ts CHANGED
@@ -54,10 +54,14 @@ export declare function getProjectDataPath(slug: string, subdomain: string): str
54
54
  */
55
55
  export declare function getGlobalDataPath(filename: string): string;
56
56
  /**
57
- * Encodes a workspace path to Claude Code's directory naming scheme.
58
- * Replaces path separators, colons, and underscores with hyphens.
57
+ * Encodes a workspace path into Sidekick's own config-store slug — path
58
+ * separators, colons, and underscores become hyphens, dots are kept.
59
59
  *
60
- * From: sidekick-vscode/src/services/SessionPathResolver.ts:35-43
60
+ * This is NOT Claude Code's `~/.claude/projects/` naming scheme, despite the
61
+ * shared name: Claude Code also replaces dots, spaces, and every other
62
+ * non-alphanumeric character. To locate Claude Code session directories use
63
+ * `encodeClaudeWorkspacePath` / `getClaudeSessionDirectory` from
64
+ * `parsers/sessionPathResolver` instead.
61
65
  */
62
66
  export declare function encodeWorkspacePath(workspacePath: string): string;
63
67
  /**
package/dist/paths.js CHANGED
@@ -129,10 +129,14 @@ function getGlobalDataPath(filename) {
129
129
  return path.join(getConfigDir(), filename);
130
130
  }
131
131
  /**
132
- * Encodes a workspace path to Claude Code's directory naming scheme.
133
- * Replaces path separators, colons, and underscores with hyphens.
132
+ * Encodes a workspace path into Sidekick's own config-store slug — path
133
+ * separators, colons, and underscores become hyphens, dots are kept.
134
134
  *
135
- * From: sidekick-vscode/src/services/SessionPathResolver.ts:35-43
135
+ * This is NOT Claude Code's `~/.claude/projects/` naming scheme, despite the
136
+ * shared name: Claude Code also replaces dots, spaces, and every other
137
+ * non-alphanumeric character. To locate Claude Code session directories use
138
+ * `encodeClaudeWorkspacePath` / `getClaudeSessionDirectory` from
139
+ * `parsers/sessionPathResolver` instead.
136
140
  */
137
141
  function encodeWorkspacePath(workspacePath) {
138
142
  const normalized = workspacePath.replace(/\\/g, '/');
@@ -0,0 +1,11 @@
1
+ /** Browser-safe provider ID catalogs. Types are derived from these values. */
2
+ export declare const SESSION_PROVIDER_IDS: readonly ["claude-code", "opencode", "codex"];
3
+ export type SessionProviderId = (typeof SESSION_PROVIDER_IDS)[number];
4
+ export declare const ACCOUNT_PROVIDER_IDS: readonly ["claude-code", "codex"];
5
+ export type AccountProviderId = (typeof ACCOUNT_PROVIDER_IDS)[number];
6
+ export declare const QUOTA_PROVIDER_IDS: readonly ["claude-code", "codex", "zai"];
7
+ export type QuotaProviderId = (typeof QUOTA_PROVIDER_IDS)[number];
8
+ export declare const RUNTIME_QUOTA_PROVIDER_IDS: readonly ["claude", "codex", "zai"];
9
+ export type RuntimeQuotaProviderId = (typeof RUNTIME_QUOTA_PROVIDER_IDS)[number];
10
+ export declare const MODEL_PROVIDER_IDS: readonly ["anthropic", "openai", "google", "unknown"];
11
+ export type ModelProviderId = (typeof MODEL_PROVIDER_IDS)[number];
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MODEL_PROVIDER_IDS = exports.RUNTIME_QUOTA_PROVIDER_IDS = exports.QUOTA_PROVIDER_IDS = exports.ACCOUNT_PROVIDER_IDS = exports.SESSION_PROVIDER_IDS = void 0;
4
+ /** Browser-safe provider ID catalogs. Types are derived from these values. */
5
+ exports.SESSION_PROVIDER_IDS = ['claude-code', 'opencode', 'codex'];
6
+ exports.ACCOUNT_PROVIDER_IDS = ['claude-code', 'codex'];
7
+ exports.QUOTA_PROVIDER_IDS = ['claude-code', 'codex', 'zai'];
8
+ exports.RUNTIME_QUOTA_PROVIDER_IDS = ['claude', 'codex', 'zai'];
9
+ exports.MODEL_PROVIDER_IDS = ['anthropic', 'openai', 'google', 'unknown'];
@@ -1,7 +1,9 @@
1
1
  import type { PeakHoursState } from './peakHours';
2
2
  import type { QuotaState } from './quota';
3
3
  import type { QuotaFailureDescriptor } from './quotaPresentation';
4
- export type RuntimeQuotaProvider = 'claude' | 'codex' | 'zai';
4
+ import type { RuntimeQuotaProviderId } from './providerIds';
5
+ export { RUNTIME_QUOTA_PROVIDER_IDS } from './providerIds';
6
+ export type RuntimeQuotaProvider = RuntimeQuotaProviderId;
5
7
  export interface ProviderQuotaState<TProvider extends RuntimeQuotaProvider = RuntimeQuotaProvider> extends QuotaState {
6
8
  runtimeProvider: TProvider;
7
9
  accountLabel?: string;
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RUNTIME_QUOTA_PROVIDER_IDS = void 0;
4
+ var providerIds_1 = require("./providerIds");
5
+ Object.defineProperty(exports, "RUNTIME_QUOTA_PROVIDER_IDS", { enumerable: true, get: function () { return providerIds_1.RUNTIME_QUOTA_PROVIDER_IDS; } });
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import type { ReadSessionContextSnapshotOptions, SessionContextSnapshot } from '../context/sessionContext';
11
11
  import type { SubagentStats, TokenUsage } from '../types/sessionEvent';
12
- import type { SessionProviderBase, SessionReader, SessionFileStats, SearchHit, ProjectFolderInfo, ProviderId } from './types';
12
+ import type { SessionProviderBase, SessionReader, SessionFileInfo, SessionFileStats, SearchHit, ProjectFolderInfo, ProviderId, ProviderOperationStatus, ProviderRuntimeStatus, SessionProviderOptions } from './types';
13
13
  /**
14
14
  * Session provider for Claude Code CLI.
15
15
  *
@@ -20,26 +20,35 @@ import type { SessionProviderBase, SessionReader, SessionFileStats, SearchHit, P
20
20
  export declare class ClaudeCodeProvider implements SessionProviderBase {
21
21
  readonly id: ProviderId;
22
22
  readonly displayName = "Claude Code";
23
+ private readonly diagnostics;
23
24
  /** Runtime-reported context window limit (overrides static map when set). */
24
25
  private dynamicContextWindowLimit;
26
+ constructor(options?: SessionProviderOptions);
25
27
  getSessionDirectory(workspacePath: string): string;
26
28
  discoverSessionDirectory(workspacePath: string): string | null;
27
29
  findActiveSession(workspacePath: string): string | null;
28
30
  findAllSessions(workspacePath: string): string[];
31
+ findSessionById(workspacePath: string, sessionId: string): string | null;
29
32
  /** Backward-compatible alias for findAllSessions. */
30
33
  findSessionFiles(workspacePath: string): string[];
31
34
  findSessionsInDirectory(dir: string): string[];
32
35
  getAllProjectFolders(workspacePath?: string): ProjectFolderInfo[];
36
+ listAllSessionFiles(): SessionFileInfo[];
37
+ listSessionFilesAsync(workspacePath?: string): Promise<SessionFileInfo[]>;
33
38
  isSessionFile(filename: string): boolean;
34
39
  getSessionId(sessionPath: string): string;
35
40
  encodeWorkspacePath(workspacePath: string): string;
36
41
  extractSessionLabel(sessionPath: string): string | null;
42
+ extractSessionLabelsAsync(sessionPaths: readonly string[]): Promise<Map<string, string | null>>;
37
43
  createReader(sessionPath: string): SessionReader;
38
44
  scanSubagents(sessionDir: string, sessionId: string): SubagentStats[];
39
45
  searchInSession(sessionPath: string, query: string, maxResults: number): SearchHit[];
40
46
  getProjectsBaseDir(): string;
47
+ getWatchRoots(): string[];
41
48
  readSessionStats(sessionPath: string): SessionFileStats;
42
49
  readSessionContextSnapshot(sessionPath: string, options?: ReadSessionContextSnapshotOptions): SessionContextSnapshot;
50
+ getRuntimeStatus(): ProviderRuntimeStatus;
51
+ getLastOperationStatus(): ProviderOperationStatus;
43
52
  getContextWindowLimit(modelId?: string): number;
44
53
  /** Set a runtime-reported context window limit (overrides static map). */
45
54
  setDynamicContextWindowLimit(limit: number): void;
@@ -51,4 +60,5 @@ export declare class ClaudeCodeProvider implements SessionProviderBase {
51
60
  */
52
61
  getCurrentUsageSnapshot(sessionPath: string): TokenUsage | null;
53
62
  dispose(): void;
63
+ private recordHomeStatus;
54
64
  }