@castari/sdk 0.1.0 → 0.1.2

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
@@ -77,7 +77,9 @@ import { CastariClient } from '@castari/sdk/client'
77
77
 
78
78
  const client = new CastariClient({
79
79
  snapshot: 'my-agent',
80
- platformUrl: process.env.CASTARI_PLATFORM_URL
80
+ clientId: process.env.CASTARI_CLIENT_ID,
81
+ platformApiKey: process.env.CASTARI_API_KEY,
82
+ anthropicApiKey: process.env.ANTHROPIC_API_KEY,
81
83
  })
82
84
 
83
85
  await client.start()
@@ -99,11 +101,14 @@ await client.stop()
99
101
 
100
102
  | Property | Type | Description |
101
103
  |----------|------|-------------|
102
- | `platformUrl` | `string` | URL of the Castari Platform |
103
104
  | `snapshot` | `string` | Name of the snapshot to use |
105
+ | `clientId` | `string` | Your Castari client ID |
106
+ | `platformApiKey` | `string` | Your Castari API key |
107
+ | `anthropicApiKey` | `string` | Your Anthropic API key |
104
108
  | `volume` | `string` | (Optional) Volume name for persistent storage |
105
- | `connectionUrl` | `string` | (Optional) Direct URL for local development |
106
109
  | `labels` | `Record<string, string>` | (Optional) Labels for sandbox reuse |
110
+ | `connectionUrl` | `string` | (Optional) Direct URL for local development |
111
+ | `platformUrl` | `string` | (Optional) Override the platform URL (advanced) |
107
112
 
108
113
  #### Methods
109
114
 
@@ -139,8 +144,8 @@ await client.stop({ delete: false })
139
144
  | Variable | Description |
140
145
  |----------|-------------|
141
146
  | `ANTHROPIC_API_KEY` | Your Anthropic API key |
142
- | `CASTARI_PLATFORM_URL` | URL of the Castari Platform |
143
147
  | `CASTARI_CLIENT_ID` | Your Castari client ID |
148
+ | `CASTARI_API_KEY` | Your Castari API key |
144
149
 
145
150
  ## License
146
151
 
package/dist/client.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './types';
2
2
  const DEFAULT_LOCAL_URL = 'http://localhost:3000';
3
+ const DEFAULT_PLATFORM_URL = 'https://castari-api-12511-04c55b73-g4p2s9om.onporter.run';
3
4
  export class CastariClient {
4
5
  ws;
5
6
  options;
@@ -126,7 +127,7 @@ export class CastariClient {
126
127
  if (!this.resolvedClientId) {
127
128
  throw new Error('CASTARI_CLIENT_ID is required when connecting via the Castari Platform');
128
129
  }
129
- const platformUrl = this.options.platformUrl || process.env.CASTARI_PLATFORM_URL || 'http://localhost:3000';
130
+ const platformUrl = (this.options.platformUrl || process.env.CASTARI_PLATFORM_URL || DEFAULT_PLATFORM_URL).replace(/\/$/, '');
130
131
  if (this.options.debug) {
131
132
  console.log(`🚀 Requesting sandbox from ${platformUrl}...`);
132
133
  }
@@ -190,7 +191,7 @@ export class CastariClient {
190
191
  this.ws.close();
191
192
  }
192
193
  if (this.sandboxId) {
193
- const platformUrl = this.options.platformUrl || process.env.CASTARI_PLATFORM_URL || 'http://localhost:3000';
194
+ const platformUrl = (this.options.platformUrl || process.env.CASTARI_PLATFORM_URL || DEFAULT_PLATFORM_URL).replace(/\/$/, '');
194
195
  try {
195
196
  const clientId = this.resolvedClientId || this.options.clientId || process.env.CASTARI_CLIENT_ID;
196
197
  const apiKey = this.resolvedPlatformApiKey || this.options.platformApiKey || process.env.CASTARI_API_KEY;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@castari/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",