bopodev-agent-sdk 0.1.9 → 0.1.11
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-typecheck.log +1 -1
- package/LICENSE +1 -1
- package/dist/agent-sdk/src/adapters.d.ts +12 -1
- package/dist/agent-sdk/src/registry.d.ts +4 -1
- package/dist/agent-sdk/src/runtime.d.ts +42 -1
- package/dist/agent-sdk/src/types.d.ts +81 -1
- package/dist/contracts/src/index.d.ts +140 -1
- package/package.json +2 -2
- package/src/adapters.ts +1189 -14
- package/src/registry.ts +38 -2
- package/src/runtime.ts +1254 -37
- package/src/types.ts +90 -1
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ProviderType } from "bopodev-contracts";
|
|
1
|
+
import type { ExecutionOutcome, ProviderType } from "bopodev-contracts";
|
|
2
2
|
|
|
3
3
|
export type AgentProviderType = ProviderType;
|
|
4
4
|
|
|
@@ -17,6 +17,10 @@ export interface AgentWorkItem {
|
|
|
17
17
|
export interface AgentState {
|
|
18
18
|
sessionId?: string;
|
|
19
19
|
cwd?: string;
|
|
20
|
+
cursorSession?: {
|
|
21
|
+
sessionId: string;
|
|
22
|
+
cwd?: string;
|
|
23
|
+
};
|
|
20
24
|
metadata?: Record<string, unknown>;
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -50,6 +54,7 @@ export interface AdapterExecutionResult {
|
|
|
50
54
|
tokenInput: number;
|
|
51
55
|
tokenOutput: number;
|
|
52
56
|
usdCost: number;
|
|
57
|
+
outcome?: ExecutionOutcome;
|
|
53
58
|
nextState?: AgentState;
|
|
54
59
|
trace?: AdapterTrace;
|
|
55
60
|
}
|
|
@@ -59,11 +64,45 @@ export interface AgentAdapter {
|
|
|
59
64
|
execute(context: HeartbeatContext): Promise<AdapterExecutionResult>;
|
|
60
65
|
}
|
|
61
66
|
|
|
67
|
+
export type AdapterEnvironmentCheckLevel = "info" | "warn" | "error";
|
|
68
|
+
export type AdapterEnvironmentStatus = "pass" | "warn" | "fail";
|
|
69
|
+
|
|
70
|
+
export interface AdapterEnvironmentCheck {
|
|
71
|
+
code: string;
|
|
72
|
+
level: AdapterEnvironmentCheckLevel;
|
|
73
|
+
message: string;
|
|
74
|
+
detail?: string;
|
|
75
|
+
hint?: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface AdapterEnvironmentResult {
|
|
79
|
+
providerType: AgentProviderType;
|
|
80
|
+
status: AdapterEnvironmentStatus;
|
|
81
|
+
testedAt: string;
|
|
82
|
+
checks: AdapterEnvironmentCheck[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface AdapterModelOption {
|
|
86
|
+
id: string;
|
|
87
|
+
label: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface AdapterMetadata {
|
|
91
|
+
providerType: AgentProviderType;
|
|
92
|
+
label: string;
|
|
93
|
+
supportsModelSelection: boolean;
|
|
94
|
+
supportsEnvironmentTest: boolean;
|
|
95
|
+
supportsWebSearch: boolean;
|
|
96
|
+
supportsThinkingEffort: boolean;
|
|
97
|
+
requiresRuntimeCwd: boolean;
|
|
98
|
+
}
|
|
99
|
+
|
|
62
100
|
export interface AgentRuntimeConfig {
|
|
63
101
|
command?: string;
|
|
64
102
|
args?: string[];
|
|
65
103
|
cwd?: string;
|
|
66
104
|
timeoutMs?: number;
|
|
105
|
+
abortSignal?: AbortSignal;
|
|
67
106
|
interruptGraceSec?: number;
|
|
68
107
|
retryCount?: number;
|
|
69
108
|
retryBackoffMs?: number;
|
|
@@ -79,10 +118,13 @@ export interface AgentRuntimeConfig {
|
|
|
79
118
|
|
|
80
119
|
export interface AdapterTrace {
|
|
81
120
|
command?: string;
|
|
121
|
+
args?: string[];
|
|
122
|
+
cwd?: string;
|
|
82
123
|
exitCode?: number | null;
|
|
83
124
|
elapsedMs?: number;
|
|
84
125
|
timedOut?: boolean;
|
|
85
126
|
failureType?: string;
|
|
127
|
+
timeoutSource?: "runtime" | "watchdog" | null;
|
|
86
128
|
usageSource?: "structured" | "estimated" | "none" | "unknown";
|
|
87
129
|
attemptCount?: number;
|
|
88
130
|
attempts?: Array<{
|
|
@@ -96,4 +138,51 @@ export interface AdapterTrace {
|
|
|
96
138
|
}>;
|
|
97
139
|
stdoutPreview?: string;
|
|
98
140
|
stderrPreview?: string;
|
|
141
|
+
session?: {
|
|
142
|
+
currentSessionId?: string | null;
|
|
143
|
+
resumedSessionId?: string | null;
|
|
144
|
+
resumeAttempted?: boolean;
|
|
145
|
+
resumeSkippedReason?: string | null;
|
|
146
|
+
clearedStaleSession?: boolean;
|
|
147
|
+
};
|
|
148
|
+
structuredOutputSource?: "stdout" | "stderr";
|
|
149
|
+
structuredOutputDiagnostics?: {
|
|
150
|
+
stdoutJsonObjectCount: number;
|
|
151
|
+
stderrJsonObjectCount: number;
|
|
152
|
+
stderrStructuredUsageDetected: boolean;
|
|
153
|
+
stdoutBytes: number;
|
|
154
|
+
stderrBytes: number;
|
|
155
|
+
hasAnyOutput: boolean;
|
|
156
|
+
lastStdoutLine?: string;
|
|
157
|
+
lastStderrLine?: string;
|
|
158
|
+
likelyCause:
|
|
159
|
+
| "no_output_from_runtime"
|
|
160
|
+
| "json_missing"
|
|
161
|
+
| "json_on_stderr_only"
|
|
162
|
+
| "schema_or_shape_mismatch";
|
|
163
|
+
claudeStopReason?: string;
|
|
164
|
+
claudeResultSubtype?: string;
|
|
165
|
+
claudeSessionId?: string;
|
|
166
|
+
cursorSessionId?: string;
|
|
167
|
+
cursorErrorMessage?: string;
|
|
168
|
+
claudeContract?: {
|
|
169
|
+
commandOverride: boolean;
|
|
170
|
+
commandLooksClaude: boolean;
|
|
171
|
+
commandWasProviderAlias: boolean;
|
|
172
|
+
hasPromptFlag: boolean;
|
|
173
|
+
hasOutputFormatJson: boolean;
|
|
174
|
+
outputFormat: string | null;
|
|
175
|
+
hasMaxTurnsFlag: boolean;
|
|
176
|
+
hasVerboseFlag: boolean;
|
|
177
|
+
hasDangerouslySkipPermissions: boolean;
|
|
178
|
+
hasJsonSchema: boolean;
|
|
179
|
+
missingRequiredArgs: string[];
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
transcript?: Array<{
|
|
183
|
+
kind: "system" | "assistant" | "thinking" | "tool_call" | "tool_result" | "result" | "stderr";
|
|
184
|
+
label?: string;
|
|
185
|
+
text?: string;
|
|
186
|
+
payload?: string;
|
|
187
|
+
}>;
|
|
99
188
|
}
|