@agentconnect/sdk 0.2.5 → 0.2.7

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/dist/index.d.ts CHANGED
@@ -32,6 +32,20 @@ export type ModelInfo = {
32
32
  reasoningEfforts?: ReasoningEffortOption[];
33
33
  defaultReasoningEffort?: string;
34
34
  };
35
+ export type TokenUsage = {
36
+ input_tokens?: number;
37
+ output_tokens?: number;
38
+ total_tokens?: number;
39
+ cached_input_tokens?: number;
40
+ reasoning_tokens?: number;
41
+ };
42
+ export type ContextUsage = {
43
+ context_window?: number;
44
+ context_tokens?: number;
45
+ context_cached_tokens?: number;
46
+ context_remaining_tokens?: number;
47
+ context_truncated?: boolean;
48
+ };
35
49
  export type ProviderDetailLevel = 'minimal' | 'raw';
36
50
  export type ProviderDetail = {
37
51
  eventType: string;
@@ -52,7 +66,7 @@ export type SessionEvent = {
52
66
  } | {
53
67
  type: 'summary';
54
68
  summary: string;
55
- source?: 'prompt' | 'claude-log';
69
+ source?: 'prompt';
56
70
  provider?: ProviderId;
57
71
  model?: string | null;
58
72
  createdAt?: string;
@@ -60,7 +74,12 @@ export type SessionEvent = {
60
74
  providerDetail?: ProviderDetail;
61
75
  } | {
62
76
  type: 'usage';
63
- usage: Record<string, number>;
77
+ usage: TokenUsage;
78
+ providerSessionId?: string | null;
79
+ providerDetail?: ProviderDetail;
80
+ } | {
81
+ type: 'context_usage';
82
+ contextUsage: ContextUsage;
64
83
  providerSessionId?: string | null;
65
84
  providerDetail?: ProviderDetail;
66
85
  } | {
@@ -120,6 +139,10 @@ export type ProviderLoginOptions = {
120
139
  loginMethod?: 'claudeai' | 'console';
121
140
  loginExperience?: 'embedded' | 'terminal';
122
141
  };
142
+ export type SummaryOptions = {
143
+ mode?: 'auto' | 'off' | 'force';
144
+ prompt?: string;
145
+ };
123
146
  export type AgentConnectConnectOptions = {
124
147
  host?: string;
125
148
  preferInjected?: boolean;
@@ -138,12 +161,14 @@ export type SessionCreateOptions = {
138
161
  maxTokens?: number;
139
162
  topP?: number;
140
163
  providerDetailLevel?: ProviderDetailLevel;
164
+ summary?: SummaryOptions;
141
165
  };
142
166
  export type SessionSendOptions = {
143
167
  metadata?: Record<string, unknown>;
144
168
  cwd?: string;
145
169
  repoRoot?: string;
146
170
  providerDetailLevel?: ProviderDetailLevel;
171
+ summary?: SummaryOptions;
147
172
  };
148
173
  export type SessionResumeOptions = {
149
174
  model?: string;
@@ -153,6 +178,7 @@ export type SessionResumeOptions = {
153
178
  cwd?: string;
154
179
  repoRoot?: string;
155
180
  providerDetailLevel?: ProviderDetailLevel;
181
+ summary?: SummaryOptions;
156
182
  };
157
183
  export interface AgentConnectSession {
158
184
  id: string;
package/dist/index.js CHANGED
@@ -201,7 +201,8 @@ class AgentConnectSessionImpl {
201
201
  if ('metadata' in candidate ||
202
202
  'cwd' in candidate ||
203
203
  'repoRoot' in candidate ||
204
- 'providerDetailLevel' in candidate) {
204
+ 'providerDetailLevel' in candidate ||
205
+ 'summary' in candidate) {
205
206
  return candidate;
206
207
  }
207
208
  return { metadata: options };
@@ -278,7 +279,7 @@ class AgentConnectClientImpl {
278
279
  if (!summary)
279
280
  return null;
280
281
  const provider = typeof data?.provider === 'string' ? data.provider : undefined;
281
- const source = data?.source === 'prompt' || data?.source === 'claude-log' ? data.source : undefined;
282
+ const source = data?.source === 'prompt' ? data.source : undefined;
282
283
  const model = typeof data?.model === 'string' ? data.model : undefined;
283
284
  const createdAt = typeof data?.createdAt === 'string' ? data.createdAt : undefined;
284
285
  return {
@@ -300,6 +301,14 @@ class AgentConnectClientImpl {
300
301
  ...(providerDetail && { providerDetail }),
301
302
  };
302
303
  }
304
+ if (type === 'context_usage') {
305
+ return {
306
+ type: 'context_usage',
307
+ contextUsage: data?.contextUsage ?? {},
308
+ providerSessionId,
309
+ ...(providerDetail && { providerDetail }),
310
+ };
311
+ }
303
312
  if (type === 'status') {
304
313
  const status = String(data?.status ?? 'idle');
305
314
  const error = typeof data?.error === 'string' ? data.error : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentconnect/sdk",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/rayzhudev/agent-connect",