Agent extension api (#5281)

Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
Douwe Osinga
2025-10-29 11:16:06 -04:00
committed by GitHub
parent c45ce49430
commit e7ca2e3bf7
22 changed files with 435 additions and 992 deletions
@@ -11,3 +11,13 @@ export async function safeJsonParse<T>(
throw error;
}
}
export function errorMessage(err: Error | unknown, default_value?: string) {
if (err instanceof Error) {
return err.message;
} else if (typeof err === 'object' && err !== null && 'message' in err) {
return String(err.message);
} else {
return default_value || String(err);
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
// Import the proper type from ConfigContext
import { getApiUrl } from '../config';
import { safeJsonParse } from './jsonUtils';
import { safeJsonParse } from './conversionUtils';
export interface ModelCostInfo {
input_token_cost: number; // Cost per token for input (in USD)
+1 -1
View File
@@ -4,7 +4,7 @@ import * as fs from 'fs/promises';
import * as path from 'path';
import * as os from 'os';
import log from './logger';
import { safeJsonParse } from './jsonUtils';
import { safeJsonParse } from './conversionUtils';
interface GitHubRelease {
tag_name: string;