@wice24/tars-sdk 0.1.5 → 0.1.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @wice24/tars-sdk
2
2
 
3
- TypeScript client for [TARS](https://github.com/meridian-capital/tars) — a
3
+ TypeScript client for [TARS](https://github.com/LegendariTech/tars) — a
4
4
  self-hosted managed-agents platform: server-side agent loops in sandboxes,
5
5
  an append-only session event log with SSE streaming + replay, client-executed
6
6
  tools, per-end-user MCP credentials, skills, files, and usage metering.
@@ -22,7 +22,7 @@ const tars = new TarsClient({
22
22
  const agent = await tars.agents.create({
23
23
  name: 'assistant',
24
24
  system: 'You are a helpful assistant.',
25
- model: 'anthropic/claude-sonnet-5',
25
+ model: 'openrouter/anthropic/claude-sonnet-5',
26
26
  });
27
27
 
28
28
  const session = await tars.sessions.create({ agentId: agent.id });
package/dist/index.d.ts CHANGED
@@ -121,6 +121,11 @@ export declare class TarsClient {
121
121
  version: number;
122
122
  files: number;
123
123
  }>;
124
+ /**
125
+ * Download one immutable version's zip bytes — exactly what `pushVersion`
126
+ * stored, e.g. to promote a proven version to another tenant or instance.
127
+ */
128
+ downloadVersion: (id: string, version: number) => Promise<Uint8Array>;
124
129
  };
125
130
  readonly apiKeys: {
126
131
  create: (input?: {
@@ -268,6 +273,11 @@ export declare class TarsSession {
268
273
  file: FileMeta;
269
274
  mount_path: string;
270
275
  }>;
276
+ /** Abort the in-flight turn, if any. Idempotent. */
277
+ interrupt(): Promise<{
278
+ ok: boolean;
279
+ interrupted: boolean;
280
+ }>;
271
281
  destroy(): Promise<{
272
282
  ok: boolean;
273
283
  }>;
package/dist/index.js CHANGED
@@ -144,7 +144,7 @@ export class TarsClient {
144
144
  return this.request('DELETE', `/v1/mcp-credentials?${params}`);
145
145
  },
146
146
  };
147
- // ── usage ────────────────────────────────────────────────────
147
+ // ── skills ───────────────────────────────────────────────────
148
148
  // Versioned skill bundles (zip with SKILL.md at root), pinned per agent.
149
149
  skills = {
150
150
  create: (input) => this.request('POST', '/v1/skills', { slug: input.slug, display_title: input.displayTitle }),
@@ -162,7 +162,20 @@ export class TarsClient {
162
162
  throw new TarsApiError(res.status, await res.json().catch(() => ({})));
163
163
  return res.json();
164
164
  },
165
+ /**
166
+ * Download one immutable version's zip bytes — exactly what `pushVersion`
167
+ * stored, e.g. to promote a proven version to another tenant or instance.
168
+ */
169
+ downloadVersion: async (id, version) => {
170
+ const res = await this.fetchImpl(`${this.baseUrl}/v1/skills/${id}/versions/${version}/content`, {
171
+ headers: { authorization: `Bearer ${this.apiKey}` },
172
+ });
173
+ if (!res.ok)
174
+ throw new TarsApiError(res.status, await res.json().catch(() => undefined));
175
+ return new Uint8Array(await res.arrayBuffer());
176
+ },
165
177
  };
178
+ // ── api keys / identity ──────────────────────────────────────
166
179
  apiKeys = {
167
180
  create: (input) => this.request('POST', '/v1/api-keys', { ...(input?.name ? { name: input.name } : {}) }),
168
181
  list: async () => (await this.request('GET', '/v1/api-keys')).keys,
@@ -194,6 +207,7 @@ export class TarsClient {
194
207
  },
195
208
  stats: () => this.request('GET', '/v1/admin/stats'),
196
209
  };
210
+ // ── completions / providers (any key) ────────────────────────
197
211
  // Cheap non-session completion (titles and other one-shots) — routed
198
212
  // through the same provider seam as agent turns.
199
213
  completions = {
@@ -214,6 +228,7 @@ export class TarsClient {
214
228
  const body = await this.request('GET', '/v1/providers');
215
229
  return body.providers ?? [];
216
230
  }
231
+ // ── usage ────────────────────────────────────────────────────
217
232
  usage = {
218
233
  // Aggregated token/cost usage for this tenant, with per-model, per-agent,
219
234
  // and per-end-user breakdowns. Dates are ISO 8601; sessionId narrows to one
@@ -437,6 +452,10 @@ export class TarsSession {
437
452
  const { mount_path } = await this.mountFile(file.id, input.mountPath);
438
453
  return { file, mount_path };
439
454
  }
455
+ /** Abort the in-flight turn, if any. Idempotent. */
456
+ interrupt() {
457
+ return this.client.sessions.interrupt(this.info.id);
458
+ }
440
459
  destroy() {
441
460
  return this.client.sessions.destroy(this.info.id);
442
461
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wice24/tars-sdk",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Client SDK for TARS — the self-hosted managed-agents platform (sessions, streaming turns, client tools, MCP credentials, skills, files, usage, tenant administration)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -28,7 +28,7 @@
28
28
  "license": "MIT",
29
29
  "repository": {
30
30
  "type": "git",
31
- "url": "git+https://github.com/meridian-capital/tars.git",
31
+ "url": "git+https://github.com/LegendariTech/tars.git",
32
32
  "directory": "sdk"
33
33
  },
34
34
  "publishConfig": {