Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Create constant for keepalive header
Tomas Valenta81d349cb0b86
diff --git a/packages/js-sdk/src/connectionConfig.ts b/packages/js-sdk/src/connectionConfig.tsindex e325008d0..42f8e591e 100644--- a/packages/js-sdk/src/connectionConfig.ts+++ b/packages/js-sdk/src/connectionConfig.ts@@ -4,6 +4,8 @@ import { getEnvVar } from './api/metadata'const REQUEST_TIMEOUT_MS = 30_000 // 30sexport const KEEPALIVE_PING_INTERVAL_SEC = 50 // 50s+export const KEEPALIVE_PING_HEADER = 'Keepalive-Ping-Interval'+export interface ConnectionOpts {apiKey?: stringaccessToken?: stringdiff --git a/packages/js-sdk/src/sandbox/filesystem/index.ts b/packages/js-sdk/src/sandbox/filesystem/index.tsindex cb9bdea1f..a9f3ef838 100644--- a/packages/js-sdk/src/sandbox/filesystem/index.ts+++ b/packages/js-sdk/src/sandbox/filesystem/index.ts@@ -11,6 +11,7 @@ import {Username,ConnectionOpts,KEEPALIVE_PING_INTERVAL_SEC,+ KEEPALIVE_PING_HEADER,} from '../../connectionConfig'import { handleEnvdApiError, handleWatchDirStartEvent } from '../../envd/api'@@ -247,7 +248,7 @@ export class Filesystem {const events = this.rpc.watchDir({ path }, {headers: {...authenticationHeader(opts?.user),- 'Keepalive-Ping-Interval': KEEPALIVE_PING_INTERVAL_SEC.toString(),+ [KEEPALIVE_PING_HEADER]: KEEPALIVE_PING_INTERVAL_SEC.toString(),},signal: controller.signal,timeoutMs: opts?.timeout ?? this.defaultWatchTimeout,diff --git a/packages/js-sdk/src/sandbox/process/index.ts b/packages/js-sdk/src/sandbox/process/index.tsindex f26a3fe0c..e21f571eb 100644--- a/packages/js-sdk/src/sandbox/process/index.ts+++ b/packages/js-sdk/src/sandbox/process/index.ts@@ -12,7 +12,7 @@ import {Signal,ProcessConfig,} from '../../envd/process/process_pb'-import { ConnectionConfig, Username, ConnectionOpts, KEEPALIVE_PING_INTERVAL_SEC } from '../../connectionConfig'+import { ConnectionConfig, Username, ConnectionOpts, KEEPALIVE_PING_INTERVAL_SEC, KEEPALIVE_PING_HEADER } from '../../connectionConfig'import { authenticationHeader, handleRpcError } from '../../envd/rpc'import { ProcessHandle, ProcessResult } from './processHandle'import { handleProcessStartEvent } from '../../envd/api'@@ -137,7 +137,7 @@ export class Process {}, {signal: controller.signal,headers: {- 'Keepalive-Ping-Interval': KEEPALIVE_PING_INTERVAL_SEC.toString(),+ [KEEPALIVE_PING_HEADER]: KEEPALIVE_PING_INTERVAL_SEC.toString(),},timeoutMs: opts?.timeoutMs ?? this.defaultProcessConnectionTimeout,})@@ -192,7 +192,7 @@ export class Process {}, {headers: {...authenticationHeader(opts?.user),- 'Keepalive-Ping-Interval': KEEPALIVE_PING_INTERVAL_SEC.toString(),+ [KEEPALIVE_PING_HEADER]: KEEPALIVE_PING_INTERVAL_SEC.toString(),},signal: controller.signal,timeoutMs: opts?.timeoutMs ?? this.defaultProcessConnectionTimeout,