@wice24/tars-sdk 0.1.2 → 0.1.3
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 +10 -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, SessionUsageRow, McpServer, Skill, SkillVersion, ApiKeyInfo } from './types.js';
|
|
1
|
+
import type { Agent, AgentVersion, ClientTool, CreateAgentInput, FileMeta, McpCredentialInput, McpCredentialStatus, SessionEvent, SessionInfo, SessionListItem, UpdateAgentInput, UploadFileInput, UsageSummary, SessionUsageRow, DailyUsageRow, 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 {
|
|
@@ -156,6 +156,7 @@ export declare class TarsClient {
|
|
|
156
156
|
sessionId?: string;
|
|
157
157
|
endUserId?: string;
|
|
158
158
|
}) => Promise<UsageSummary>;
|
|
159
|
+
daily: (from: string | Date) => Promise<DailyUsageRow[]>;
|
|
159
160
|
sessions: (from: string | Date) => Promise<SessionUsageRow[]>;
|
|
160
161
|
};
|
|
161
162
|
readonly files: {
|
package/dist/index.js
CHANGED
|
@@ -195,6 +195,13 @@ export class TarsClient {
|
|
|
195
195
|
const qs = params.size ? `?${params}` : '';
|
|
196
196
|
return this.request('GET', `/v1/usage${qs}`);
|
|
197
197
|
},
|
|
198
|
+
// Per-day, per-model buckets by TURN time — day/MTD dashboard views
|
|
199
|
+
// (per-session rollups attribute whole sessions to their creation day).
|
|
200
|
+
daily: async (from) => {
|
|
201
|
+
const qs = `?from=${encodeURIComponent(new Date(from).toISOString())}`;
|
|
202
|
+
const { days } = await this.request('GET', `/v1/usage/daily${qs}`);
|
|
203
|
+
return days;
|
|
204
|
+
},
|
|
198
205
|
// Per-session usage snapshots for sessions created since `from` — the
|
|
199
206
|
// shape usage dashboards want (one row per session, buckets + cost).
|
|
200
207
|
sessions: async (from) => {
|
package/dist/types.d.ts
CHANGED
|
@@ -256,6 +256,16 @@ export interface SessionUsageRow {
|
|
|
256
256
|
turns: number;
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
|
+
export interface DailyUsageRow {
|
|
260
|
+
day: string;
|
|
261
|
+
model: string;
|
|
262
|
+
input_tokens: number;
|
|
263
|
+
output_tokens: number;
|
|
264
|
+
cache_read_tokens: number;
|
|
265
|
+
cache_write_tokens: number;
|
|
266
|
+
cost_usd: number | null;
|
|
267
|
+
turns: number;
|
|
268
|
+
}
|
|
259
269
|
export interface SessionListItem {
|
|
260
270
|
id: string;
|
|
261
271
|
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.3",
|
|
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": {
|