@wice24/tars-sdk 0.1.2 → 0.1.4

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
@@ -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 {
@@ -149,6 +149,13 @@ export declare class TarsClient {
149
149
  };
150
150
  }>;
151
151
  };
152
+ /**
153
+ * Which model providers this instance is keyed for (`anthropic`, `openai`,
154
+ * `openrouter`, `custom`). Ask before OFFERING models: a picker listing GPT
155
+ * models on an instance with no OpenAI key produces turns that all fail at
156
+ * the provider call.
157
+ */
158
+ providers(): Promise<string[]>;
152
159
  readonly usage: {
153
160
  get: (filter?: {
154
161
  from?: string | Date;
@@ -156,6 +163,7 @@ export declare class TarsClient {
156
163
  sessionId?: string;
157
164
  endUserId?: string;
158
165
  }) => Promise<UsageSummary>;
166
+ daily: (from: string | Date) => Promise<DailyUsageRow[]>;
159
167
  sessions: (from: string | Date) => Promise<SessionUsageRow[]>;
160
168
  };
161
169
  readonly files: {
package/dist/index.js CHANGED
@@ -178,6 +178,16 @@ export class TarsClient {
178
178
  ...(input.maxTokens ? { max_tokens: input.maxTokens } : {}),
179
179
  }),
180
180
  };
181
+ /**
182
+ * Which model providers this instance is keyed for (`anthropic`, `openai`,
183
+ * `openrouter`, `custom`). Ask before OFFERING models: a picker listing GPT
184
+ * models on an instance with no OpenAI key produces turns that all fail at
185
+ * the provider call.
186
+ */
187
+ async providers() {
188
+ const body = await this.request('GET', '/v1/providers');
189
+ return body.providers ?? [];
190
+ }
181
191
  usage = {
182
192
  // Aggregated token/cost usage for this tenant, with per-model, per-agent,
183
193
  // and per-end-user breakdowns. Dates are ISO 8601; sessionId narrows to one
@@ -195,6 +205,13 @@ export class TarsClient {
195
205
  const qs = params.size ? `?${params}` : '';
196
206
  return this.request('GET', `/v1/usage${qs}`);
197
207
  },
208
+ // Per-day, per-model buckets by TURN time — day/MTD dashboard views
209
+ // (per-session rollups attribute whole sessions to their creation day).
210
+ daily: async (from) => {
211
+ const qs = `?from=${encodeURIComponent(new Date(from).toISOString())}`;
212
+ const { days } = await this.request('GET', `/v1/usage/daily${qs}`);
213
+ return days;
214
+ },
198
215
  // Per-session usage snapshots for sessions created since `from` — the
199
216
  // shape usage dashboards want (one row per session, buckets + cost).
200
217
  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,7 +1,7 @@
1
1
  {
2
2
  "name": "@wice24/tars-sdk",
3
- "version": "0.1.2",
4
- "description": "Client SDK for TARS \u2014 the self-hosted managed-agents platform (sessions, streaming turns, client tools, MCP credentials, skills, files, usage)",
3
+ "version": "0.1.4",
4
+ "description": "Client SDK for TARS — the self-hosted managed-agents platform (sessions, streaming turns, client tools, MCP credentials, skills, files, usage)",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {