@castari/sdk 0.0.6 → 0.0.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/dist/client.js +9 -7
- package/dist/server.js +1 -1
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -40,10 +40,8 @@ export class CastariClient {
|
|
|
40
40
|
}
|
|
41
41
|
const configHeaders = {
|
|
42
42
|
'Content-Type': 'application/json',
|
|
43
|
+
...connection.authHeaders,
|
|
43
44
|
};
|
|
44
|
-
if (connection.previewToken) {
|
|
45
|
-
configHeaders['x-daytona-preview-token'] = connection.previewToken;
|
|
46
|
-
}
|
|
47
45
|
let configResponse = null;
|
|
48
46
|
const maxConfigAttempts = 5;
|
|
49
47
|
for (let attempt = 1; attempt <= maxConfigAttempts; attempt++) {
|
|
@@ -80,8 +78,11 @@ export class CastariClient {
|
|
|
80
78
|
}
|
|
81
79
|
const wsUrlParams = new URLSearchParams();
|
|
82
80
|
wsUrlParams.set('token', connectionToken);
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
// Add any auth params from platform (for sandbox proxy auth)
|
|
82
|
+
if (connection.authParams) {
|
|
83
|
+
for (const [key, value] of Object.entries(connection.authParams)) {
|
|
84
|
+
wsUrlParams.set(key, value);
|
|
85
|
+
}
|
|
85
86
|
}
|
|
86
87
|
const wsUrlJoiner = connection.wsUrl.includes('?') ? '&' : '?';
|
|
87
88
|
const wsUrl = `${connection.wsUrl}${wsUrlJoiner}${wsUrlParams.toString()}`;
|
|
@@ -148,7 +149,7 @@ export class CastariClient {
|
|
|
148
149
|
const errorText = await response.text();
|
|
149
150
|
throw new Error(`Failed to start sandbox: ${errorText}`);
|
|
150
151
|
}
|
|
151
|
-
const { id, url,
|
|
152
|
+
const { id, url, authHeaders, authParams } = await response.json();
|
|
152
153
|
this.sandboxId = id;
|
|
153
154
|
if (this.options.debug) {
|
|
154
155
|
console.log(`✅ Sandbox started: ${id} at ${url}`);
|
|
@@ -159,7 +160,8 @@ export class CastariClient {
|
|
|
159
160
|
return {
|
|
160
161
|
configUrl,
|
|
161
162
|
wsUrl: wsUrlBase,
|
|
162
|
-
|
|
163
|
+
authHeaders,
|
|
164
|
+
authParams,
|
|
163
165
|
cleanup: async () => {
|
|
164
166
|
await this.stop({ delete: true });
|
|
165
167
|
}
|
package/dist/server.js
CHANGED
|
@@ -85,7 +85,7 @@ async function processMessages(initialOptions) {
|
|
|
85
85
|
settingSources: ['local'],
|
|
86
86
|
cwd: workspaceDirectory,
|
|
87
87
|
// Auto-approve tool usage (including file writes) inside the sandbox.
|
|
88
|
-
//
|
|
88
|
+
// Sandboxes are already isolated, so this keeps DX smooth without interactive prompts.
|
|
89
89
|
canUseTool: async (_toolName, input) => ({
|
|
90
90
|
behavior: 'allow',
|
|
91
91
|
updatedInput: input,
|