@opensearch-project/agent-health 0.1.1 → 0.2.0

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/lib/dist/index.js CHANGED
@@ -1344,7 +1344,39 @@ var ClaudeCodeConnector = class extends SubprocessConnector {
1344
1344
  this.isInThinking = false;
1345
1345
  }
1346
1346
  /**
1347
- * Override execute to reset state
1347
+ * Build CLI args from ClaudeCodeConnectorConfig
1348
+ */
1349
+ buildConfigArgs(config) {
1350
+ const args = [];
1351
+ if (config.dangerouslySkipPermissions) {
1352
+ args.push("--dangerously-skip-permissions");
1353
+ }
1354
+ if (config.systemPrompt) {
1355
+ args.push("--system-prompt", config.systemPrompt);
1356
+ } else if (config.appendSystemPrompt) {
1357
+ args.push("--append-system-prompt", config.appendSystemPrompt);
1358
+ }
1359
+ if (config.allowedTools?.length) {
1360
+ args.push("--allowed-tools", ...config.allowedTools);
1361
+ }
1362
+ if (config.disallowedTools?.length) {
1363
+ args.push("--disallowed-tools", ...config.disallowedTools);
1364
+ }
1365
+ if (config.mcpConfigPath) {
1366
+ args.push("--mcp-config", config.mcpConfigPath);
1367
+ } else if (config.mcpServers && Object.keys(config.mcpServers).length > 0) {
1368
+ args.push("--mcp-config", JSON.stringify({ mcpServers: config.mcpServers }));
1369
+ }
1370
+ if (config.strictMcpConfig) {
1371
+ args.push("--strict-mcp-config");
1372
+ }
1373
+ if (config.additionalArgs) {
1374
+ args.push(...config.additionalArgs);
1375
+ }
1376
+ return args;
1377
+ }
1378
+ /**
1379
+ * Override execute to reset state and apply connectorConfig
1348
1380
  */
1349
1381
  async execute(endpoint, request, auth, onProgress, onRawEvent) {
1350
1382
  this.debug("========== execute() STARTED ==========");
@@ -1352,11 +1384,55 @@ var ClaudeCodeConnector = class extends SubprocessConnector {
1352
1384
  this.debug("Test case:", request.testCase.name);
1353
1385
  this.debug("Config:", this["config"]);
1354
1386
  this.resetState();
1355
- this.debug("State reset, calling super.execute()...");
1356
- const result = await super.execute(endpoint, request, auth, onProgress, onRawEvent);
1357
- this.debug("super.execute() returned with", result.trajectory.length, "steps");
1358
- this.debug("========== execute() COMPLETED ==========");
1359
- return result;
1387
+ const originalEnv = this.config.env ? structuredClone(this.config.env) : {};
1388
+ const originalArgs = this.config.args ? [...this.config.args] : [];
1389
+ const originalInputMode = this.config.inputMode;
1390
+ const originalTimeout = this.config.timeout;
1391
+ const originalWorkingDir = this.config.workingDir;
1392
+ const ccConfig = request.connectorConfig;
1393
+ if (ccConfig) {
1394
+ this.debug("Applying connectorConfig:", Object.keys(ccConfig));
1395
+ if (ccConfig.env) {
1396
+ this.config.env = { ...this.config.env, ...ccConfig.env };
1397
+ }
1398
+ if (ccConfig.usePromptArg) {
1399
+ this.config.inputMode = "arg";
1400
+ }
1401
+ if (ccConfig.timeout !== void 0) {
1402
+ this.config.timeout = ccConfig.timeout;
1403
+ }
1404
+ if (ccConfig.workingDir) {
1405
+ this.config.workingDir = ccConfig.workingDir;
1406
+ }
1407
+ }
1408
+ if (this.config.env?.CLAUDE_CODE_USE_BEDROCK === "1") {
1409
+ this.config.env = { ...this.config.env, ANTHROPIC_API_KEY: "" };
1410
+ this.debug("Bedrock mode: cleared ANTHROPIC_API_KEY to bypass credit check");
1411
+ }
1412
+ if (request.modelId) {
1413
+ this.config.args = [...this.config.args || [], "--model", request.modelId];
1414
+ this.debug("Model flag added:", request.modelId);
1415
+ }
1416
+ if (ccConfig) {
1417
+ const configArgs = this.buildConfigArgs(ccConfig);
1418
+ if (configArgs.length > 0) {
1419
+ this.config.args = [...this.config.args || [], ...configArgs];
1420
+ this.debug("Config args added:", configArgs);
1421
+ }
1422
+ }
1423
+ try {
1424
+ this.debug("State reset, calling super.execute()...");
1425
+ const result = await super.execute(endpoint, request, auth, onProgress, onRawEvent);
1426
+ this.debug("super.execute() returned with", result.trajectory.length, "steps");
1427
+ this.debug("========== execute() COMPLETED ==========");
1428
+ return result;
1429
+ } finally {
1430
+ this.config.env = originalEnv;
1431
+ this.config.args = originalArgs;
1432
+ this.config.inputMode = originalInputMode;
1433
+ this.config.timeout = originalTimeout;
1434
+ this.config.workingDir = originalWorkingDir;
1435
+ }
1360
1436
  }
1361
1437
  /**
1362
1438
  * Health check - verify claude command exists
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensearch-project/agent-health",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "Agent Evaluation and Observability Framework",
6
6
  "license": "Apache-2.0",
@@ -70,8 +70,9 @@
70
70
  },
71
71
  "dependencies": {
72
72
  "@ag-ui/core": "^0.0.41",
73
- "@aws-sdk/client-bedrock-runtime": "^3.936.0",
74
- "@aws-sdk/credential-providers": "^3.936.0",
73
+ "@aws-sdk/client-bedrock": "^3.1000.0",
74
+ "@aws-sdk/client-bedrock-runtime": "^3.1000.0",
75
+ "@aws-sdk/credential-providers": "^3.1000.0",
75
76
  "@opensearch-project/opensearch": "^3.5.1",
76
77
  "@opentelemetry/semantic-conventions": "^1.38.0",
77
78
  "@radix-ui/react-alert-dialog": "^1.1.15",
@@ -154,6 +155,7 @@
154
155
  "vite": "^7.3.1"
155
156
  },
156
157
  "overrides": {
157
- "minimatch": "^10.2.1"
158
+ "minimatch": "^10.2.4",
159
+ "fast-xml-parser": "5.5.10"
158
160
  }
159
161
  }