mirror of
https://github.com/KeygraphHQ/shannon.git
synced 2026-10-08 01:01:10 +02:00
feat: extract pipeline core for library consumption (#282)
* feat: extract pipeline core for library consumption * fix: chmod workspace directory for container write access * fix: resolve playwright output dir relative to deliverables parent * feat: add multi-provider LLM support via ProviderConfig * fix: resolve model overrides via options.model, remove unused model env passthrough * fix: use ANTHROPIC_AUTH_TOKEN for custom base URL and router auth * fix: skip env-based credential validation when providerConfig is present * fix: support large UID/GID values for AD/LDAP users in container
This commit is contained in:
1 parent
f6fd1edad6
commit
1f6dfd7e17
32 files changed
+616
-106
No files matched your search
@@ -11,7 +11,7 @@
|
||||
* Pure service with no Temporal dependencies.
|
||||
*/
|
||||
|
||||
import { distributeConfig, parseConfig } from '../config-parser.js';
|
||||
import { distributeConfig, parseConfig, parseConfigYAML } from '../config-parser.js';
|
||||
import type { DistributedConfig } from '../types/config.js';
|
||||
import { ErrorCode } from '../types/errors.js';
|
||||
import { err, ok, type Result } from '../types/result.js';
|
||||
@@ -60,11 +60,31 @@ export class ConfigLoaderService {
|
||||
|
||||
/**
|
||||
* Load config if path is provided, otherwise return null config.
|
||||
* If configData is provided (pre-parsed), returns it directly without file I/O.
|
||||
*
|
||||
* @param configPath - Optional path to the YAML configuration file
|
||||
* @param configData - Optional pre-parsed config (bypasses file loading)
|
||||
* @returns Result containing DistributedConfig (or null) on success, PentestError on failure
|
||||
*/
|
||||
async loadOptional(configPath: string | undefined): Promise<Result<DistributedConfig | null, PentestError>> {
|
||||
async loadOptional(
|
||||
configPath: string | undefined,
|
||||
configData?: DistributedConfig,
|
||||
configYAML?: string,
|
||||
): Promise<Result<DistributedConfig | null, PentestError>> {
|
||||
if (configData) {
|
||||
return ok(configData);
|
||||
}
|
||||
if (configYAML) {
|
||||
try {
|
||||
const config = parseConfigYAML(configYAML);
|
||||
return ok(distributeConfig(config));
|
||||
} catch (error) {
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
return err(
|
||||
new PentestError(`Failed to parse config YAML: ${errorMessage}`, 'config', false, { originalError: errorMessage }, ErrorCode.CONFIG_PARSE_ERROR),
|
||||
);
|
||||
}
|
||||
}
|
||||
if (!configPath) {
|
||||
return ok(null);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user