@agentfield/sdk 0.1.45-rc.1 → 0.1.45-rc.2
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/dist/index.d.ts +101 -1
- package/dist/index.js +836 -14
- package/dist/index.js.map +1 -1
- package/package.json +9 -1
package/dist/index.d.ts
CHANGED
|
@@ -526,6 +526,74 @@ interface SkillOptions {
|
|
|
526
526
|
requireRealtimeValidation?: boolean;
|
|
527
527
|
}
|
|
528
528
|
|
|
529
|
+
interface HarnessConfig {
|
|
530
|
+
provider: 'claude-code' | 'codex' | 'gemini' | 'opencode';
|
|
531
|
+
model?: string;
|
|
532
|
+
maxTurns?: number;
|
|
533
|
+
maxBudgetUsd?: number;
|
|
534
|
+
maxRetries?: number;
|
|
535
|
+
initialDelay?: number;
|
|
536
|
+
maxDelay?: number;
|
|
537
|
+
backoffFactor?: number;
|
|
538
|
+
tools?: string[];
|
|
539
|
+
permissionMode?: string;
|
|
540
|
+
systemPrompt?: string;
|
|
541
|
+
env?: Record<string, string>;
|
|
542
|
+
cwd?: string;
|
|
543
|
+
codexBin?: string;
|
|
544
|
+
geminiBin?: string;
|
|
545
|
+
opencodeBin?: string;
|
|
546
|
+
}
|
|
547
|
+
interface HarnessOptions {
|
|
548
|
+
provider?: string;
|
|
549
|
+
model?: string;
|
|
550
|
+
maxTurns?: number;
|
|
551
|
+
maxBudgetUsd?: number;
|
|
552
|
+
maxRetries?: number;
|
|
553
|
+
initialDelay?: number;
|
|
554
|
+
maxDelay?: number;
|
|
555
|
+
backoffFactor?: number;
|
|
556
|
+
tools?: string[];
|
|
557
|
+
permissionMode?: string;
|
|
558
|
+
systemPrompt?: string;
|
|
559
|
+
env?: Record<string, string>;
|
|
560
|
+
cwd?: string;
|
|
561
|
+
codexBin?: string;
|
|
562
|
+
geminiBin?: string;
|
|
563
|
+
opencodeBin?: string;
|
|
564
|
+
schema?: unknown;
|
|
565
|
+
}
|
|
566
|
+
interface Metrics {
|
|
567
|
+
durationMs: number;
|
|
568
|
+
durationApiMs: number;
|
|
569
|
+
numTurns: number;
|
|
570
|
+
totalCostUsd?: number;
|
|
571
|
+
usage?: Record<string, unknown>;
|
|
572
|
+
sessionId: string;
|
|
573
|
+
}
|
|
574
|
+
interface RawResult {
|
|
575
|
+
result?: string;
|
|
576
|
+
messages: Array<Record<string, unknown>>;
|
|
577
|
+
metrics: Metrics;
|
|
578
|
+
isError: boolean;
|
|
579
|
+
errorMessage?: string;
|
|
580
|
+
}
|
|
581
|
+
interface HarnessResult {
|
|
582
|
+
result?: string;
|
|
583
|
+
parsed?: unknown;
|
|
584
|
+
isError: boolean;
|
|
585
|
+
errorMessage?: string;
|
|
586
|
+
costUsd?: number;
|
|
587
|
+
numTurns: number;
|
|
588
|
+
durationMs: number;
|
|
589
|
+
sessionId: string;
|
|
590
|
+
messages: Array<Record<string, unknown>>;
|
|
591
|
+
readonly text: string;
|
|
592
|
+
}
|
|
593
|
+
declare function createHarnessResult(partial?: Partial<Omit<HarnessResult, 'text'>>): HarnessResult;
|
|
594
|
+
declare function createMetrics(partial?: Partial<Metrics>): Metrics;
|
|
595
|
+
declare function createRawResult(partial?: Partial<RawResult>): RawResult;
|
|
596
|
+
|
|
529
597
|
type DeploymentType = 'long_running' | 'serverless';
|
|
530
598
|
interface AgentConfig {
|
|
531
599
|
nodeId: string;
|
|
@@ -536,6 +604,7 @@ interface AgentConfig {
|
|
|
536
604
|
host?: string;
|
|
537
605
|
publicUrl?: string;
|
|
538
606
|
aiConfig?: AIConfig;
|
|
607
|
+
harnessConfig?: HarnessConfig;
|
|
539
608
|
memoryConfig?: MemoryConfig;
|
|
540
609
|
didEnabled?: boolean;
|
|
541
610
|
devMode?: boolean;
|
|
@@ -734,6 +803,32 @@ declare class SkillRegistry {
|
|
|
734
803
|
all(): SkillDefinition<any, any>[];
|
|
735
804
|
}
|
|
736
805
|
|
|
806
|
+
interface HarnessProvider {
|
|
807
|
+
execute(prompt: string, options: Record<string, unknown>): Promise<RawResult>;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
type RunnerOptions = Omit<HarnessOptions, 'schema'> & {
|
|
811
|
+
maxRetries?: number;
|
|
812
|
+
initialDelay?: number;
|
|
813
|
+
maxDelay?: number;
|
|
814
|
+
backoffFactor?: number;
|
|
815
|
+
codexBin?: string;
|
|
816
|
+
geminiBin?: string;
|
|
817
|
+
opencodeBin?: string;
|
|
818
|
+
};
|
|
819
|
+
declare class HarnessRunner {
|
|
820
|
+
private readonly config?;
|
|
821
|
+
constructor(config?: HarnessConfig | undefined);
|
|
822
|
+
run(prompt: string, options?: HarnessOptions): Promise<HarnessResult>;
|
|
823
|
+
resolveOptions(config: Partial<HarnessConfig> | undefined, overrides: RunnerOptions): RunnerOptions;
|
|
824
|
+
isTransient(errorStr: string): boolean;
|
|
825
|
+
executeWithRetry(provider: HarnessProvider, prompt: string, options: RunnerOptions): Promise<RawResult>;
|
|
826
|
+
handleSchemaOutput(raw: RawResult, schema: unknown, cwd: string, startTime: number): HarnessResult;
|
|
827
|
+
private buildProvider;
|
|
828
|
+
private computeBackoffDelay;
|
|
829
|
+
private sleep;
|
|
830
|
+
}
|
|
831
|
+
|
|
737
832
|
interface MCPTool {
|
|
738
833
|
name: string;
|
|
739
834
|
description?: string;
|
|
@@ -789,6 +884,8 @@ declare class Agent {
|
|
|
789
884
|
registered: MCPToolRegistration[];
|
|
790
885
|
}>;
|
|
791
886
|
getAIClient(): AIClient;
|
|
887
|
+
getHarnessRunner(): Promise<HarnessRunner>;
|
|
888
|
+
harness(prompt: string, options?: HarnessOptions): Promise<HarnessResult>;
|
|
792
889
|
getMemoryInterface(metadata?: ExecutionMetadata): MemoryInterface;
|
|
793
890
|
getWorkflowReporter(metadata: ExecutionMetadata): WorkflowReporter;
|
|
794
891
|
getDidInterface(metadata: ExecutionMetadata, defaultInput?: any, targetName?: string): DidInterface;
|
|
@@ -982,6 +1079,9 @@ declare class StatelessRateLimiter {
|
|
|
982
1079
|
executeWithRetry<T>(fn: () => Promise<T>): Promise<T>;
|
|
983
1080
|
}
|
|
984
1081
|
|
|
1082
|
+
declare const SUPPORTED_PROVIDERS: Set<string>;
|
|
1083
|
+
declare function buildProvider(config: HarnessConfig): Promise<HarnessProvider>;
|
|
1084
|
+
|
|
985
1085
|
/**
|
|
986
1086
|
* Canonical execution status utilities for the AgentField TypeScript SDK.
|
|
987
1087
|
*
|
|
@@ -1086,4 +1186,4 @@ declare class ApprovalClient {
|
|
|
1086
1186
|
waitForApproval(executionId: string, opts?: WaitForApprovalOptions): Promise<ApprovalStatusResponse>;
|
|
1087
1187
|
}
|
|
1088
1188
|
|
|
1089
|
-
export { ACTIVE_STATUSES, AIClient, type AIConfig, type AIEmbeddingOptions, type AIRequestOptions, type AIStream, Agent, type AgentCapability, type AgentConfig, type AgentHandler, AgentRouter, type AgentRouterOptions, type AgentState, ApprovalClient, type ApprovalRequestResponse, type ApprovalStatusResponse, type AuditTrailExport, type AuditTrailFilters, type Awaitable, CANONICAL_STATUSES, type CompactCapability, type CompactDiscoveryResponse, DIDAuthenticator, type DIDIdentity, type DIDIdentityPackage, type DIDRegistrationRequest, type DIDRegistrationResponse, type DeploymentType, DidClient, DidInterface, DidManager, type DiscoveryFormat, type DiscoveryOptions, type DiscoveryPagination, type DiscoveryResponse, type DiscoveryResult, ExecutionContext, type ExecutionCredential, type ExecutionMetadata, ExecutionStatus, type ExecutionStatusValue, type GenerateCredentialOptions, type GenerateCredentialParams, HEADER_CALLER_DID, HEADER_DID_NONCE, HEADER_DID_SIGNATURE, HEADER_DID_TIMESTAMP, type HealthStatus, MCPClient, MCPClientRegistry, type MCPConfig, type MCPHealthSummary, type MCPServerConfig, type MCPTool, MCPToolRegistrar, type MCPToolRegistrarOptions, type MCPToolRegistration, type MemoryChangeEvent, MemoryClient, type MemoryConfig, MemoryEventClient, type MemoryEventHandler, MemoryInterface, type MemoryRequestMetadata, type MemoryRequestOptions, type MemoryScope, type MemoryWatchHandler, RateLimitError, type RateLimiterOptions, type ReasonerCapability, ReasonerContext, type ReasonerDefinition, type ReasonerHandler, type ReasonerOptions, type RequestApprovalPayload, type ServerlessAdapter, type ServerlessEvent, type ServerlessResponse, type SkillCapability, SkillContext, type SkillDefinition, type SkillHandler, type SkillOptions, StatelessRateLimiter, TERMINAL_STATUSES, type VectorSearchOptions, type VectorSearchResult, type WaitForApprovalOptions, type WorkflowCredential, type WorkflowMetadata, type WorkflowProgressOptions, WorkflowReporter, type ZodSchema, getCurrentContext, getCurrentSkillContext, isActive, isTerminal, normalizeStatus };
|
|
1189
|
+
export { ACTIVE_STATUSES, AIClient, type AIConfig, type AIEmbeddingOptions, type AIRequestOptions, type AIStream, Agent, type AgentCapability, type AgentConfig, type AgentHandler, AgentRouter, type AgentRouterOptions, type AgentState, ApprovalClient, type ApprovalRequestResponse, type ApprovalStatusResponse, type AuditTrailExport, type AuditTrailFilters, type Awaitable, CANONICAL_STATUSES, type CompactCapability, type CompactDiscoveryResponse, DIDAuthenticator, type DIDIdentity, type DIDIdentityPackage, type DIDRegistrationRequest, type DIDRegistrationResponse, type DeploymentType, DidClient, DidInterface, DidManager, type DiscoveryFormat, type DiscoveryOptions, type DiscoveryPagination, type DiscoveryResponse, type DiscoveryResult, ExecutionContext, type ExecutionCredential, type ExecutionMetadata, ExecutionStatus, type ExecutionStatusValue, type GenerateCredentialOptions, type GenerateCredentialParams, HEADER_CALLER_DID, HEADER_DID_NONCE, HEADER_DID_SIGNATURE, HEADER_DID_TIMESTAMP, type HarnessConfig, type HarnessOptions, type HarnessProvider, type HarnessResult, HarnessRunner, type HealthStatus, MCPClient, MCPClientRegistry, type MCPConfig, type MCPHealthSummary, type MCPServerConfig, type MCPTool, MCPToolRegistrar, type MCPToolRegistrarOptions, type MCPToolRegistration, type MemoryChangeEvent, MemoryClient, type MemoryConfig, MemoryEventClient, type MemoryEventHandler, MemoryInterface, type MemoryRequestMetadata, type MemoryRequestOptions, type MemoryScope, type MemoryWatchHandler, type Metrics, RateLimitError, type RateLimiterOptions, type RawResult, type ReasonerCapability, ReasonerContext, type ReasonerDefinition, type ReasonerHandler, type ReasonerOptions, type RequestApprovalPayload, SUPPORTED_PROVIDERS, type ServerlessAdapter, type ServerlessEvent, type ServerlessResponse, type SkillCapability, SkillContext, type SkillDefinition, type SkillHandler, type SkillOptions, StatelessRateLimiter, TERMINAL_STATUSES, type VectorSearchOptions, type VectorSearchResult, type WaitForApprovalOptions, type WorkflowCredential, type WorkflowMetadata, type WorkflowProgressOptions, WorkflowReporter, type ZodSchema, buildProvider, createHarnessResult, createMetrics, createRawResult, getCurrentContext, getCurrentSkillContext, isActive, isTerminal, normalizeStatus };
|