@tangle-network/tcloud 0.4.0 → 0.4.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/README.md CHANGED
@@ -62,6 +62,40 @@ const answer = await client.ask('What is Tangle Network?') // string
62
62
  console.log(answer)
63
63
  ```
64
64
 
65
+ ### Quick Start — direct cli-bridge (subscription-backed coding harness)
66
+
67
+ When you have your own [cli-bridge](https://github.com/drewstone/cli-bridge) running (locally or on your own VPS), point the SDK straight at it. cli-bridge is OpenAI-compatible (`/v1/chat/completions`) so chat / ask / askStream work unchanged — and your CLI subscriptions on the bridge box pay for the LLM tokens directly (no router, no per-token billing).
68
+
69
+ ```bash
70
+ # 1. clone + run cli-bridge (one terminal)
71
+ gh repo clone drewstone/cli-bridge && cd cli-bridge
72
+ echo "BRIDGE_BEARER=$(openssl rand -hex 32)" >> .env.local
73
+ echo "BRIDGE_BACKENDS=claude,passthrough" >> .env.local
74
+ export $(grep -v '^#' .env.local | xargs) && pnpm exec tsx src/server.ts
75
+
76
+ # 2. authenticate your harness CLI
77
+ claude /login # or: kimi login, codex login, opencode auth login
78
+ ```
79
+
80
+ ```ts
81
+ import { TCloudClient } from '@tangle-network/tcloud'
82
+
83
+ const client = TCloudClient.fromCliBridge({
84
+ url: 'http://127.0.0.1:3344', // or any reachable URL
85
+ bearer: process.env.CLI_BRIDGE_BEARER!, // value of BRIDGE_BEARER from .env.local
86
+ })
87
+
88
+ // model id = `<harness>/<model>` — no `bridge/` prefix in direct mode
89
+ const reply = await client.ask('reply with OK', 'claude-code/sonnet')
90
+
91
+ // streaming + full chat work the same
92
+ for await (const chunk of client.askStream('write a haiku', 'kimi-code/kimi-for-coding')) {
93
+ process.stdout.write(chunk)
94
+ }
95
+ ```
96
+
97
+ See [`examples/14-direct-cli-bridge.ts`](./examples/14-direct-cli-bridge.ts) for the full pattern. For session-resumable agentic dispatches (file edits, multi-turn coding), see [`examples/12-bridge-sessions.ts`](./examples/12-bridge-sessions.ts) which uses the router-mediated `tcloud.bridge({...})` API.
98
+
65
99
  ### Model Selection
66
100
 
67
101
  Model is set at client creation. Override per-request when needed:
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createShieldedClient,
3
3
  generateWallet
4
- } from "./chunk-MKLCBBHZ.js";
4
+ } from "./chunk-A7AEPV2G.js";
5
5
  import {
6
6
  TCloudClient
7
- } from "./chunk-AKR7CS4P.js";
7
+ } from "./chunk-B22AH4JH.js";
8
8
 
9
9
  // src/index.ts
10
10
  var TCloud = class _TCloud extends TCloudClient {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TCloudClient
3
- } from "./chunk-AKR7CS4P.js";
3
+ } from "./chunk-B22AH4JH.js";
4
4
 
5
5
  // src/shielded.ts
6
6
  import { privateKeyToAccount } from "viem/accounts";
@@ -278,6 +278,37 @@ var TCloudClient = class _TCloudClient {
278
278
  _cachedOperators = [];
279
279
  _operatorsCachedAt = 0;
280
280
  static OPERATORS_TTL_MS = 5 * 60 * 1e3;
281
+ /**
282
+ * Build a client pointed directly at a cli-bridge instance — skips the
283
+ * Tangle Router entirely. cli-bridge serves the OpenAI-compatible
284
+ * `/v1/chat/completions` endpoint natively, so chat() / ask() /
285
+ * chatStream() work as-is against any local or remote bridge.
286
+ *
287
+ * Use this when you have your own cli-bridge running (locally or on
288
+ * your own VPS) and don't need router-side gating, billing, or
289
+ * observability — your CLI subscriptions on the bridge box pay for
290
+ * the LLM tokens directly.
291
+ *
292
+ * Wire form: model id is `<harness>/<model>` (e.g. `claude-code/sonnet`,
293
+ * `kimi-code/kimi-for-coding`) — no `bridge/` prefix needed in direct
294
+ * mode; cli-bridge accepts the harness id as the first path segment.
295
+ *
296
+ * ```ts
297
+ * const client = TCloudClient.fromCliBridge({
298
+ * url: 'http://127.0.0.1:3344',
299
+ * bearer: process.env.CLI_BRIDGE_BEARER!,
300
+ * })
301
+ * const reply = await client.ask('explain X', 'claude-code/sonnet')
302
+ * ```
303
+ *
304
+ * For session-resumable agentic dispatches (file edits, multi-turn
305
+ * coding), use the router-mediated `tcloud.bridge({...})` API instead
306
+ * (or POST to cli-bridge directly with `session_id` in the body).
307
+ */
308
+ static fromCliBridge(opts) {
309
+ const baseURL = opts.url.replace(/\/+$/, "") + "/v1";
310
+ return new _TCloudClient({ ...opts.config ?? {}, apiKey: opts.bearer, baseURL });
311
+ }
281
312
  constructor(config = {}) {
282
313
  this.baseURL = (config.baseURL || DEFAULT_BASE_URL).replace(/\/$/, "");
283
314
  this.platformURL = (config.platformURL || DEFAULT_PLATFORM_URL).replace(/\/$/, "");
package/dist/cli.cjs CHANGED
@@ -306,6 +306,37 @@ var TCloudClient = class _TCloudClient {
306
306
  _cachedOperators = [];
307
307
  _operatorsCachedAt = 0;
308
308
  static OPERATORS_TTL_MS = 5 * 60 * 1e3;
309
+ /**
310
+ * Build a client pointed directly at a cli-bridge instance — skips the
311
+ * Tangle Router entirely. cli-bridge serves the OpenAI-compatible
312
+ * `/v1/chat/completions` endpoint natively, so chat() / ask() /
313
+ * chatStream() work as-is against any local or remote bridge.
314
+ *
315
+ * Use this when you have your own cli-bridge running (locally or on
316
+ * your own VPS) and don't need router-side gating, billing, or
317
+ * observability — your CLI subscriptions on the bridge box pay for
318
+ * the LLM tokens directly.
319
+ *
320
+ * Wire form: model id is `<harness>/<model>` (e.g. `claude-code/sonnet`,
321
+ * `kimi-code/kimi-for-coding`) — no `bridge/` prefix needed in direct
322
+ * mode; cli-bridge accepts the harness id as the first path segment.
323
+ *
324
+ * ```ts
325
+ * const client = TCloudClient.fromCliBridge({
326
+ * url: 'http://127.0.0.1:3344',
327
+ * bearer: process.env.CLI_BRIDGE_BEARER!,
328
+ * })
329
+ * const reply = await client.ask('explain X', 'claude-code/sonnet')
330
+ * ```
331
+ *
332
+ * For session-resumable agentic dispatches (file edits, multi-turn
333
+ * coding), use the router-mediated `tcloud.bridge({...})` API instead
334
+ * (or POST to cli-bridge directly with `session_id` in the body).
335
+ */
336
+ static fromCliBridge(opts) {
337
+ const baseURL = opts.url.replace(/\/+$/, "") + "/v1";
338
+ return new _TCloudClient({ ...opts.config ?? {}, apiKey: opts.bearer, baseURL });
339
+ }
309
340
  constructor(config = {}) {
310
341
  this.baseURL = (config.baseURL || DEFAULT_BASE_URL).replace(/\/$/, "");
311
342
  this.platformURL = (config.platformURL || DEFAULT_PLATFORM_URL).replace(/\/$/, "");
package/dist/cli.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TCloud
4
- } from "./chunk-QNIJ7KAA.js";
4
+ } from "./chunk-577KIKFA.js";
5
5
  import {
6
6
  generateWallet
7
- } from "./chunk-MKLCBBHZ.js";
8
- import "./chunk-AKR7CS4P.js";
7
+ } from "./chunk-A7AEPV2G.js";
8
+ import "./chunk-B22AH4JH.js";
9
9
 
10
10
  // src/cli.ts
11
11
  import { Command } from "commander";
@@ -640,6 +640,41 @@ declare class TCloudClient {
640
640
  private _cachedOperators;
641
641
  private _operatorsCachedAt;
642
642
  private static readonly OPERATORS_TTL_MS;
643
+ /**
644
+ * Build a client pointed directly at a cli-bridge instance — skips the
645
+ * Tangle Router entirely. cli-bridge serves the OpenAI-compatible
646
+ * `/v1/chat/completions` endpoint natively, so chat() / ask() /
647
+ * chatStream() work as-is against any local or remote bridge.
648
+ *
649
+ * Use this when you have your own cli-bridge running (locally or on
650
+ * your own VPS) and don't need router-side gating, billing, or
651
+ * observability — your CLI subscriptions on the bridge box pay for
652
+ * the LLM tokens directly.
653
+ *
654
+ * Wire form: model id is `<harness>/<model>` (e.g. `claude-code/sonnet`,
655
+ * `kimi-code/kimi-for-coding`) — no `bridge/` prefix needed in direct
656
+ * mode; cli-bridge accepts the harness id as the first path segment.
657
+ *
658
+ * ```ts
659
+ * const client = TCloudClient.fromCliBridge({
660
+ * url: 'http://127.0.0.1:3344',
661
+ * bearer: process.env.CLI_BRIDGE_BEARER!,
662
+ * })
663
+ * const reply = await client.ask('explain X', 'claude-code/sonnet')
664
+ * ```
665
+ *
666
+ * For session-resumable agentic dispatches (file edits, multi-turn
667
+ * coding), use the router-mediated `tcloud.bridge({...})` API instead
668
+ * (or POST to cli-bridge directly with `session_id` in the body).
669
+ */
670
+ static fromCliBridge(opts: {
671
+ /** cli-bridge base URL — `http://127.0.0.1:3344` for default local; can be any reachable URL. */
672
+ url: string;
673
+ /** BRIDGE_BEARER from the cli-bridge's `.env.local`. */
674
+ bearer: string;
675
+ /** Optional config passthrough (timeout, retry, etc). */
676
+ config?: Omit<TCloudConfig, 'apiKey' | 'baseURL'>;
677
+ }): TCloudClient;
643
678
  constructor(config?: TCloudConfig);
644
679
  /** Set the SpendAuth signer for private mode */
645
680
  setSpendAuthSigner(fn: () => Promise<SpendAuth>): void;
@@ -640,6 +640,41 @@ declare class TCloudClient {
640
640
  private _cachedOperators;
641
641
  private _operatorsCachedAt;
642
642
  private static readonly OPERATORS_TTL_MS;
643
+ /**
644
+ * Build a client pointed directly at a cli-bridge instance — skips the
645
+ * Tangle Router entirely. cli-bridge serves the OpenAI-compatible
646
+ * `/v1/chat/completions` endpoint natively, so chat() / ask() /
647
+ * chatStream() work as-is against any local or remote bridge.
648
+ *
649
+ * Use this when you have your own cli-bridge running (locally or on
650
+ * your own VPS) and don't need router-side gating, billing, or
651
+ * observability — your CLI subscriptions on the bridge box pay for
652
+ * the LLM tokens directly.
653
+ *
654
+ * Wire form: model id is `<harness>/<model>` (e.g. `claude-code/sonnet`,
655
+ * `kimi-code/kimi-for-coding`) — no `bridge/` prefix needed in direct
656
+ * mode; cli-bridge accepts the harness id as the first path segment.
657
+ *
658
+ * ```ts
659
+ * const client = TCloudClient.fromCliBridge({
660
+ * url: 'http://127.0.0.1:3344',
661
+ * bearer: process.env.CLI_BRIDGE_BEARER!,
662
+ * })
663
+ * const reply = await client.ask('explain X', 'claude-code/sonnet')
664
+ * ```
665
+ *
666
+ * For session-resumable agentic dispatches (file edits, multi-turn
667
+ * coding), use the router-mediated `tcloud.bridge({...})` API instead
668
+ * (or POST to cli-bridge directly with `session_id` in the body).
669
+ */
670
+ static fromCliBridge(opts: {
671
+ /** cli-bridge base URL — `http://127.0.0.1:3344` for default local; can be any reachable URL. */
672
+ url: string;
673
+ /** BRIDGE_BEARER from the cli-bridge's `.env.local`. */
674
+ bearer: string;
675
+ /** Optional config passthrough (timeout, retry, etc). */
676
+ config?: Omit<TCloudConfig, 'apiKey' | 'baseURL'>;
677
+ }): TCloudClient;
643
678
  constructor(config?: TCloudConfig);
644
679
  /** Set the SpendAuth signer for private mode */
645
680
  setSpendAuthSigner(fn: () => Promise<SpendAuth>): void;
package/dist/index.cjs CHANGED
@@ -322,6 +322,37 @@ var TCloudClient = class _TCloudClient {
322
322
  _cachedOperators = [];
323
323
  _operatorsCachedAt = 0;
324
324
  static OPERATORS_TTL_MS = 5 * 60 * 1e3;
325
+ /**
326
+ * Build a client pointed directly at a cli-bridge instance — skips the
327
+ * Tangle Router entirely. cli-bridge serves the OpenAI-compatible
328
+ * `/v1/chat/completions` endpoint natively, so chat() / ask() /
329
+ * chatStream() work as-is against any local or remote bridge.
330
+ *
331
+ * Use this when you have your own cli-bridge running (locally or on
332
+ * your own VPS) and don't need router-side gating, billing, or
333
+ * observability — your CLI subscriptions on the bridge box pay for
334
+ * the LLM tokens directly.
335
+ *
336
+ * Wire form: model id is `<harness>/<model>` (e.g. `claude-code/sonnet`,
337
+ * `kimi-code/kimi-for-coding`) — no `bridge/` prefix needed in direct
338
+ * mode; cli-bridge accepts the harness id as the first path segment.
339
+ *
340
+ * ```ts
341
+ * const client = TCloudClient.fromCliBridge({
342
+ * url: 'http://127.0.0.1:3344',
343
+ * bearer: process.env.CLI_BRIDGE_BEARER!,
344
+ * })
345
+ * const reply = await client.ask('explain X', 'claude-code/sonnet')
346
+ * ```
347
+ *
348
+ * For session-resumable agentic dispatches (file edits, multi-turn
349
+ * coding), use the router-mediated `tcloud.bridge({...})` API instead
350
+ * (or POST to cli-bridge directly with `session_id` in the body).
351
+ */
352
+ static fromCliBridge(opts) {
353
+ const baseURL = opts.url.replace(/\/+$/, "") + "/v1";
354
+ return new _TCloudClient({ ...opts.config ?? {}, apiKey: opts.bearer, baseURL });
355
+ }
325
356
  constructor(config = {}) {
326
357
  this.baseURL = (config.baseURL || DEFAULT_BASE_URL).replace(/\/$/, "");
327
358
  this.platformURL = (config.platformURL || DEFAULT_PLATFORM_URL).replace(/\/$/, "");
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ShieldedWallet, generateWallet } from './shielded.cjs';
2
2
  export { createShieldedClient, estimateCost, signSpendAuth } from './shielded.cjs';
3
- import { T as TCloudClient, a as TCloudConfig } from './client-_ghO89WM.cjs';
4
- export { A as ApiKeyInfo, b as AvatarGenerateRequest, c as AvatarGenerateResponse, d as AvatarJobStatus, e as AvatarResult, B as BatchJobResponse, f as BatchRequest, g as BridgeOptions, h as BridgeSession, C as ChatCompletion, i as ChatCompletionChunk, j as ChatMessage, k as ChatOptions, l as CompletionOptions, m as CompletionResponse, n as CreateKeyOptions, o as CreatedKey, p as CreditBalance, E as EmbeddingOptions, q as EmbeddingResponse, F as FineTuningJob, r as FineTuningJobOptions, G as GatewayOptions, I as ImageGenerateOptions, s as ImageResponse, J as JobEvent, M as Model, O as Operator, t as OperatorInfo, P as PricingTier, u as PrivacyConfig, v as PrivateRouter, w as PrivateRouterConfig, R as RerankOptions, x as RerankResponse, y as RetryConfig, z as RoutingConfig, D as RoutingStrategy, S as ShieldedConfig, H as SpendAuth, K as SpendingLimits, L as TCloudError, N as TierConfig, Q as TranscriptionResponse, U as UpdateKeyOptions, V as VideoGenerateOptions, W as VideoResponse, X as WatchJobOptions } from './client-_ghO89WM.cjs';
3
+ import { T as TCloudClient, a as TCloudConfig } from './client-C547pugt.cjs';
4
+ export { A as ApiKeyInfo, b as AvatarGenerateRequest, c as AvatarGenerateResponse, d as AvatarJobStatus, e as AvatarResult, B as BatchJobResponse, f as BatchRequest, g as BridgeOptions, h as BridgeSession, C as ChatCompletion, i as ChatCompletionChunk, j as ChatMessage, k as ChatOptions, l as CompletionOptions, m as CompletionResponse, n as CreateKeyOptions, o as CreatedKey, p as CreditBalance, E as EmbeddingOptions, q as EmbeddingResponse, F as FineTuningJob, r as FineTuningJobOptions, G as GatewayOptions, I as ImageGenerateOptions, s as ImageResponse, J as JobEvent, M as Model, O as Operator, t as OperatorInfo, P as PricingTier, u as PrivacyConfig, v as PrivateRouter, w as PrivateRouterConfig, R as RerankOptions, x as RerankResponse, y as RetryConfig, z as RoutingConfig, D as RoutingStrategy, S as ShieldedConfig, H as SpendAuth, K as SpendingLimits, L as TCloudError, N as TierConfig, Q as TranscriptionResponse, U as UpdateKeyOptions, V as VideoGenerateOptions, W as VideoResponse, X as WatchJobOptions } from './client-C547pugt.cjs';
5
5
  export { AgentProfile, AgentProfileCapabilities, AgentProfileMcpServer, AgentProfileModelHints, AgentProfilePermissionValue, AgentProfilePrompt, AgentProfileResources } from '@tangle-network/sandbox';
6
6
  import 'viem';
7
7
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ShieldedWallet, generateWallet } from './shielded.js';
2
2
  export { createShieldedClient, estimateCost, signSpendAuth } from './shielded.js';
3
- import { T as TCloudClient, a as TCloudConfig } from './client-_ghO89WM.js';
4
- export { A as ApiKeyInfo, b as AvatarGenerateRequest, c as AvatarGenerateResponse, d as AvatarJobStatus, e as AvatarResult, B as BatchJobResponse, f as BatchRequest, g as BridgeOptions, h as BridgeSession, C as ChatCompletion, i as ChatCompletionChunk, j as ChatMessage, k as ChatOptions, l as CompletionOptions, m as CompletionResponse, n as CreateKeyOptions, o as CreatedKey, p as CreditBalance, E as EmbeddingOptions, q as EmbeddingResponse, F as FineTuningJob, r as FineTuningJobOptions, G as GatewayOptions, I as ImageGenerateOptions, s as ImageResponse, J as JobEvent, M as Model, O as Operator, t as OperatorInfo, P as PricingTier, u as PrivacyConfig, v as PrivateRouter, w as PrivateRouterConfig, R as RerankOptions, x as RerankResponse, y as RetryConfig, z as RoutingConfig, D as RoutingStrategy, S as ShieldedConfig, H as SpendAuth, K as SpendingLimits, L as TCloudError, N as TierConfig, Q as TranscriptionResponse, U as UpdateKeyOptions, V as VideoGenerateOptions, W as VideoResponse, X as WatchJobOptions } from './client-_ghO89WM.js';
3
+ import { T as TCloudClient, a as TCloudConfig } from './client-C547pugt.js';
4
+ export { A as ApiKeyInfo, b as AvatarGenerateRequest, c as AvatarGenerateResponse, d as AvatarJobStatus, e as AvatarResult, B as BatchJobResponse, f as BatchRequest, g as BridgeOptions, h as BridgeSession, C as ChatCompletion, i as ChatCompletionChunk, j as ChatMessage, k as ChatOptions, l as CompletionOptions, m as CompletionResponse, n as CreateKeyOptions, o as CreatedKey, p as CreditBalance, E as EmbeddingOptions, q as EmbeddingResponse, F as FineTuningJob, r as FineTuningJobOptions, G as GatewayOptions, I as ImageGenerateOptions, s as ImageResponse, J as JobEvent, M as Model, O as Operator, t as OperatorInfo, P as PricingTier, u as PrivacyConfig, v as PrivateRouter, w as PrivateRouterConfig, R as RerankOptions, x as RerankResponse, y as RetryConfig, z as RoutingConfig, D as RoutingStrategy, S as ShieldedConfig, H as SpendAuth, K as SpendingLimits, L as TCloudError, N as TierConfig, Q as TranscriptionResponse, U as UpdateKeyOptions, V as VideoGenerateOptions, W as VideoResponse, X as WatchJobOptions } from './client-C547pugt.js';
5
5
  export { AgentProfile, AgentProfileCapabilities, AgentProfileMcpServer, AgentProfileModelHints, AgentProfilePermissionValue, AgentProfilePrompt, AgentProfileResources } from '@tangle-network/sandbox';
6
6
  import 'viem';
7
7
 
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  TCloud
3
- } from "./chunk-QNIJ7KAA.js";
3
+ } from "./chunk-577KIKFA.js";
4
4
  import {
5
5
  createShieldedClient,
6
6
  estimateCost,
7
7
  generateWallet,
8
8
  signSpendAuth
9
- } from "./chunk-MKLCBBHZ.js";
9
+ } from "./chunk-A7AEPV2G.js";
10
10
  import {
11
11
  BridgeSession,
12
12
  PrivateRouter,
13
13
  TCloudClient,
14
14
  TCloudError
15
- } from "./chunk-AKR7CS4P.js";
15
+ } from "./chunk-B22AH4JH.js";
16
16
  export {
17
17
  BridgeSession,
18
18
  PrivateRouter,
package/dist/instance.cjs CHANGED
@@ -321,6 +321,37 @@ var TCloudClient = class _TCloudClient {
321
321
  _cachedOperators = [];
322
322
  _operatorsCachedAt = 0;
323
323
  static OPERATORS_TTL_MS = 5 * 60 * 1e3;
324
+ /**
325
+ * Build a client pointed directly at a cli-bridge instance — skips the
326
+ * Tangle Router entirely. cli-bridge serves the OpenAI-compatible
327
+ * `/v1/chat/completions` endpoint natively, so chat() / ask() /
328
+ * chatStream() work as-is against any local or remote bridge.
329
+ *
330
+ * Use this when you have your own cli-bridge running (locally or on
331
+ * your own VPS) and don't need router-side gating, billing, or
332
+ * observability — your CLI subscriptions on the bridge box pay for
333
+ * the LLM tokens directly.
334
+ *
335
+ * Wire form: model id is `<harness>/<model>` (e.g. `claude-code/sonnet`,
336
+ * `kimi-code/kimi-for-coding`) — no `bridge/` prefix needed in direct
337
+ * mode; cli-bridge accepts the harness id as the first path segment.
338
+ *
339
+ * ```ts
340
+ * const client = TCloudClient.fromCliBridge({
341
+ * url: 'http://127.0.0.1:3344',
342
+ * bearer: process.env.CLI_BRIDGE_BEARER!,
343
+ * })
344
+ * const reply = await client.ask('explain X', 'claude-code/sonnet')
345
+ * ```
346
+ *
347
+ * For session-resumable agentic dispatches (file edits, multi-turn
348
+ * coding), use the router-mediated `tcloud.bridge({...})` API instead
349
+ * (or POST to cli-bridge directly with `session_id` in the body).
350
+ */
351
+ static fromCliBridge(opts) {
352
+ const baseURL = opts.url.replace(/\/+$/, "") + "/v1";
353
+ return new _TCloudClient({ ...opts.config ?? {}, apiKey: opts.bearer, baseURL });
354
+ }
324
355
  constructor(config = {}) {
325
356
  this.baseURL = (config.baseURL || DEFAULT_BASE_URL).replace(/\/$/, "");
326
357
  this.platformURL = (config.platformURL || DEFAULT_PLATFORM_URL).replace(/\/$/, "");
@@ -1,4 +1,4 @@
1
- import { a as TCloudConfig, T as TCloudClient } from './client-_ghO89WM.cjs';
1
+ import { a as TCloudConfig, T as TCloudClient } from './client-C547pugt.cjs';
2
2
 
3
3
  /**
4
4
  * Instance — programmatic harness for spinning up a local Tangle dev environment.
@@ -1,4 +1,4 @@
1
- import { a as TCloudConfig, T as TCloudClient } from './client-_ghO89WM.js';
1
+ import { a as TCloudConfig, T as TCloudClient } from './client-C547pugt.js';
2
2
 
3
3
  /**
4
4
  * Instance — programmatic harness for spinning up a local Tangle dev environment.
package/dist/instance.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TCloudClient
3
- } from "./chunk-AKR7CS4P.js";
3
+ } from "./chunk-B22AH4JH.js";
4
4
 
5
5
  // src/instance.ts
6
6
  import { spawn } from "child_process";
package/dist/shielded.cjs CHANGED
@@ -319,6 +319,37 @@ var TCloudClient = class _TCloudClient {
319
319
  _cachedOperators = [];
320
320
  _operatorsCachedAt = 0;
321
321
  static OPERATORS_TTL_MS = 5 * 60 * 1e3;
322
+ /**
323
+ * Build a client pointed directly at a cli-bridge instance — skips the
324
+ * Tangle Router entirely. cli-bridge serves the OpenAI-compatible
325
+ * `/v1/chat/completions` endpoint natively, so chat() / ask() /
326
+ * chatStream() work as-is against any local or remote bridge.
327
+ *
328
+ * Use this when you have your own cli-bridge running (locally or on
329
+ * your own VPS) and don't need router-side gating, billing, or
330
+ * observability — your CLI subscriptions on the bridge box pay for
331
+ * the LLM tokens directly.
332
+ *
333
+ * Wire form: model id is `<harness>/<model>` (e.g. `claude-code/sonnet`,
334
+ * `kimi-code/kimi-for-coding`) — no `bridge/` prefix needed in direct
335
+ * mode; cli-bridge accepts the harness id as the first path segment.
336
+ *
337
+ * ```ts
338
+ * const client = TCloudClient.fromCliBridge({
339
+ * url: 'http://127.0.0.1:3344',
340
+ * bearer: process.env.CLI_BRIDGE_BEARER!,
341
+ * })
342
+ * const reply = await client.ask('explain X', 'claude-code/sonnet')
343
+ * ```
344
+ *
345
+ * For session-resumable agentic dispatches (file edits, multi-turn
346
+ * coding), use the router-mediated `tcloud.bridge({...})` API instead
347
+ * (or POST to cli-bridge directly with `session_id` in the body).
348
+ */
349
+ static fromCliBridge(opts) {
350
+ const baseURL = opts.url.replace(/\/+$/, "") + "/v1";
351
+ return new _TCloudClient({ ...opts.config ?? {}, apiKey: opts.bearer, baseURL });
352
+ }
322
353
  constructor(config = {}) {
323
354
  this.baseURL = (config.baseURL || DEFAULT_BASE_URL).replace(/\/$/, "");
324
355
  this.platformURL = (config.platformURL || DEFAULT_PLATFORM_URL).replace(/\/$/, "");
@@ -1,5 +1,5 @@
1
1
  import { Hex } from 'viem';
2
- import { a as TCloudConfig, T as TCloudClient, H as SpendAuth } from './client-_ghO89WM.cjs';
2
+ import { a as TCloudConfig, T as TCloudClient, H as SpendAuth } from './client-C547pugt.cjs';
3
3
 
4
4
  /**
5
5
  * tcloud/shielded — Ephemeral wallet generation, SpendAuth signing, private inference.
@@ -1,5 +1,5 @@
1
1
  import { Hex } from 'viem';
2
- import { a as TCloudConfig, T as TCloudClient, H as SpendAuth } from './client-_ghO89WM.js';
2
+ import { a as TCloudConfig, T as TCloudClient, H as SpendAuth } from './client-C547pugt.js';
3
3
 
4
4
  /**
5
5
  * tcloud/shielded — Ephemeral wallet generation, SpendAuth signing, private inference.
package/dist/shielded.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  estimateCost,
4
4
  generateWallet,
5
5
  signSpendAuth
6
- } from "./chunk-MKLCBBHZ.js";
7
- import "./chunk-AKR7CS4P.js";
6
+ } from "./chunk-A7AEPV2G.js";
7
+ import "./chunk-B22AH4JH.js";
8
8
  export {
9
9
  createShieldedClient,
10
10
  estimateCost,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/tcloud",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "TypeScript SDK and CLI for Tangle AI Cloud — decentralized LLM inference",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",