@wice24/tars-sdk 0.1.0 → 0.1.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/dist/index.d.ts +2 -1
- package/dist/index.js +7 -0
- package/dist/types.d.ts +16 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Agent, AgentVersion, ClientTool, CreateAgentInput, FileMeta, McpCredentialInput, McpCredentialStatus, SessionEvent, SessionInfo, SessionListItem, UpdateAgentInput, UploadFileInput, UsageSummary, McpServer, Skill, SkillVersion, ApiKeyInfo } from './types.js';
|
|
1
|
+
import type { Agent, AgentVersion, ClientTool, CreateAgentInput, FileMeta, McpCredentialInput, McpCredentialStatus, SessionEvent, SessionInfo, SessionListItem, UpdateAgentInput, UploadFileInput, UsageSummary, SessionUsageRow, McpServer, Skill, SkillVersion, ApiKeyInfo } from './types.js';
|
|
2
2
|
type ToolHandler = (input: any) => unknown | Promise<unknown>;
|
|
3
3
|
export * from './types.js';
|
|
4
4
|
export declare class TarsApiError extends Error {
|
|
@@ -150,6 +150,7 @@ export declare class TarsClient {
|
|
|
150
150
|
sessionId?: string;
|
|
151
151
|
endUserId?: string;
|
|
152
152
|
}) => Promise<UsageSummary>;
|
|
153
|
+
sessions: (from: string | Date) => Promise<SessionUsageRow[]>;
|
|
153
154
|
};
|
|
154
155
|
readonly files: {
|
|
155
156
|
upload: (input: UploadFileInput) => Promise<FileMeta>;
|
package/dist/index.js
CHANGED
|
@@ -184,6 +184,13 @@ export class TarsClient {
|
|
|
184
184
|
const qs = params.size ? `?${params}` : '';
|
|
185
185
|
return this.request('GET', `/v1/usage${qs}`);
|
|
186
186
|
},
|
|
187
|
+
// Per-session usage snapshots for sessions created since `from` — the
|
|
188
|
+
// shape usage dashboards want (one row per session, buckets + cost).
|
|
189
|
+
sessions: async (from) => {
|
|
190
|
+
const qs = `?from=${encodeURIComponent(new Date(from).toISOString())}`;
|
|
191
|
+
const { sessions } = await this.request('GET', `/v1/usage/sessions${qs}`);
|
|
192
|
+
return sessions;
|
|
193
|
+
},
|
|
187
194
|
};
|
|
188
195
|
// ── files ────────────────────────────────────────────────────
|
|
189
196
|
files = {
|
package/dist/types.d.ts
CHANGED
|
@@ -233,6 +233,22 @@ export interface UsageSummary {
|
|
|
233
233
|
end_user_id: string | null;
|
|
234
234
|
})[];
|
|
235
235
|
}
|
|
236
|
+
export interface SessionUsageRow {
|
|
237
|
+
session_id: string;
|
|
238
|
+
title: string | null;
|
|
239
|
+
model: string;
|
|
240
|
+
metadata: Record<string, string> | null;
|
|
241
|
+
end_user_id: string | null;
|
|
242
|
+
created_at: string;
|
|
243
|
+
usage: {
|
|
244
|
+
input_tokens: number;
|
|
245
|
+
output_tokens: number;
|
|
246
|
+
cache_read_tokens: number;
|
|
247
|
+
cache_write_tokens: number;
|
|
248
|
+
cost_usd: number | null;
|
|
249
|
+
turns: number;
|
|
250
|
+
};
|
|
251
|
+
}
|
|
236
252
|
export interface SessionListItem {
|
|
237
253
|
id: string;
|
|
238
254
|
status: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wice24/tars-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Client SDK for TARS \u2014 the self-hosted managed-agents platform (sessions, streaming turns, client tools, MCP credentials, skills, files, usage)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|