Add a goosed over HTTP integration test, and test the developer tool PATH (#7178)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Jack Amadeo
2026-02-13 14:41:18 -05:00
committed by GitHub
parent 0206035dba
commit 5ba5b9899d
17 changed files with 864 additions and 354 deletions
@@ -1,7 +1,7 @@
import { describe, it, expect } from 'vitest';
import { substituteParameters } from '../providerUtils';
import { substituteParameters } from '../parameterSubstitution';
describe('providerUtils', () => {
describe('parameterSubstitution', () => {
describe('substituteParameters', () => {
it('should substitute simple parameters', () => {
const text = 'Hello {{name}}, welcome to {{app}}!';
@@ -83,12 +83,12 @@ describe('providerUtils', () => {
it('should handle complex substitution scenario', () => {
const text = `
Welcome {{user_name}}!
Your account details:
- ID: {{user_id}}
- Email: {{user_email}}
- App: {{app_name}}
Thank you for using {{app_name}}!
`;
@@ -102,12 +102,12 @@ describe('providerUtils', () => {
const result = substituteParameters(text, params);
const expected = `
Welcome John Doe!
Your account details:
- ID: 12345
- Email: john@example.com
- App: MyApp
Thank you for using MyApp!
`;
@@ -0,0 +1,11 @@
export const substituteParameters = (text: string, params: Record<string, string>): string => {
let substitutedText = text;
for (const key in params) {
// Escape special characters in the key (parameter) and match optional whitespace
const regex = new RegExp(`{{\\s*${key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s*}}`, 'g');
substitutedText = substitutedText.replace(regex, params[key]);
}
return substitutedText;
};
-77
View File
@@ -1,77 +0,0 @@
import {
initializeBundledExtensions,
syncBundledExtensions,
} from '../components/settings/extensions';
import type { ExtensionConfig, FixedExtensionEntry } from '../components/ConfigContext';
import { Recipe, updateAgentProvider, updateFromSession } from '../api';
// Helper function to substitute parameters in text
export const substituteParameters = (text: string, params: Record<string, string>): string => {
let substitutedText = text;
for (const key in params) {
// Escape special characters in the key (parameter) and match optional whitespace
const regex = new RegExp(`{{\\s*${key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s*}}`, 'g');
substitutedText = substitutedText.replace(regex, params[key]);
}
return substitutedText;
};
export const initializeSystem = async (
sessionId: string,
provider: string,
model: string,
options?: {
getExtensions?: (b: boolean) => Promise<FixedExtensionEntry[]>;
addExtension?: (name: string, config: ExtensionConfig, enabled: boolean) => Promise<void>;
recipeParameters?: Record<string, string> | null;
recipe?: Recipe;
}
) => {
try {
console.log(
'initializing agent with provider',
provider,
'model',
model,
'sessionId',
sessionId
);
await updateAgentProvider({
body: {
session_id: sessionId,
provider,
model,
},
throwOnError: true,
});
if (!sessionId) {
console.log('This will not end well');
}
await updateFromSession({
body: {
session_id: sessionId,
},
throwOnError: true,
});
if (!options?.getExtensions || !options?.addExtension) {
console.warn('Extension helpers not provided in alpha mode');
return;
}
// Initialize or sync built-in extensions into config.yaml
let refreshedExtensions = await options.getExtensions(false);
if (refreshedExtensions.length === 0) {
await initializeBundledExtensions(options.addExtension);
} else {
await syncBundledExtensions(refreshedExtensions, options.addExtension);
}
} catch (error) {
console.error('Failed to initialize agent:', error);
throw error;
}
};