@flashbacktech/tsclient 0.4.66 → 0.4.68

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.cjs CHANGED
@@ -321,6 +321,20 @@ var OrganizationClient = class {
321
321
  });
322
322
  return unwrapData(res);
323
323
  }
324
+ /**
325
+ * Platform-admin only: one page of the service-wide org summary — per-org
326
+ * user/project/sandbox counts, trailing 7d/30d metered usage, billed-to-
327
+ * balance, lifetime purchases and current credit balance — searchable by
328
+ * name and pageable. Backs the admin Summary screen. Returns 403 unless the
329
+ * caller's home org is the configured ADMIN_ORGANIZATION.
330
+ */
331
+ async adminOrgSummary(query = {}) {
332
+ const res = await this.http.get(
333
+ "/admin/orgs/summary",
334
+ { query }
335
+ );
336
+ return unwrapData(res);
337
+ }
324
338
  /**
325
339
  * Platform-admin only: provision a new organization + founding owner and
326
340
  * email the owner an invite link. The invite-only counterpart to public
@@ -550,6 +564,49 @@ function normalizeGatewayToken(wire) {
550
564
  createdAt: wire.createdAt
551
565
  };
552
566
  }
567
+ function normalizeAgentToken(wire) {
568
+ return {
569
+ id: wire.id,
570
+ sandboxId: wire.sandboxId ?? wire.repoId ?? "",
571
+ label: wire.label,
572
+ tokenPrefix: wire.tokenPrefix,
573
+ lastUsedAt: wire.lastUsedAt ?? void 0,
574
+ createdAt: wire.createdAt
575
+ };
576
+ }
577
+
578
+ // src/modules/credentials/AgentTokensClient.ts
579
+ var AgentTokensClient = class {
580
+ constructor(http) {
581
+ this.http = http;
582
+ }
583
+ async list(sandboxId) {
584
+ const res = await this.http.get(
585
+ `/sandbox/${sandboxId}/agent-token`
586
+ );
587
+ const list = res.tokens ?? res.data ?? [];
588
+ return list.map(normalizeAgentToken);
589
+ }
590
+ /**
591
+ * create returns both the persisted token row and the plaintext bearer
592
+ * (`secret`). The bearer is shown only here; surface it to the user
593
+ * immediately. If they navigate away without copying, they must delete the
594
+ * token and create a new one.
595
+ */
596
+ async create(sandboxId, body) {
597
+ const res = await this.http.post(`/sandbox/${sandboxId}/agent-token`, { body });
598
+ if (!res.token || !res.secret) {
599
+ throw new Error("createAgentToken response missing token or secret.");
600
+ }
601
+ return {
602
+ token: normalizeAgentToken(res.token),
603
+ secret: res.secret
604
+ };
605
+ }
606
+ delete(sandboxId, tokenId) {
607
+ return this.http.delete(`/sandbox/${sandboxId}/agent-token/${tokenId}`);
608
+ }
609
+ };
553
610
 
554
611
  // src/modules/credentials/GatewayTokensClient.ts
555
612
  var GatewayTokensClient = class {
@@ -610,6 +667,7 @@ var CredentialsClient = class {
610
667
  this.http = http;
611
668
  this.sandbox = new SandboxCredentialScope(http);
612
669
  this.gatewayTokens = new GatewayTokensClient(http);
670
+ this.agentTokens = new AgentTokensClient(http);
613
671
  }
614
672
  async list(query) {
615
673
  const res = await this.http.get(