@agntn/harnesses 0.0.1
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/LICENSE +21 -0
- package/README.md +142 -0
- package/dist/THIRD-PARTY-LICENSES.md +36 -0
- package/dist/_chunks/agents-sync.d.mts +417 -0
- package/dist/_chunks/agents-sync.d.mts.map +1 -0
- package/dist/_chunks/agents-sync.mjs +2719 -0
- package/dist/_chunks/agents-sync.mjs.map +1 -0
- package/dist/_chunks/agents.mjs +62 -0
- package/dist/_chunks/agents.mjs.map +1 -0
- package/dist/_chunks/libs/typebox.mjs +5512 -0
- package/dist/_chunks/libs/typebox.mjs.map +1 -0
- package/dist/_chunks/mcp-servers.mjs +149 -0
- package/dist/_chunks/mcp-servers.mjs.map +1 -0
- package/dist/_chunks/mcp.mjs +164 -0
- package/dist/_chunks/mcp.mjs.map +1 -0
- package/dist/_chunks/mcp2.mjs +17 -0
- package/dist/_chunks/mcp2.mjs.map +1 -0
- package/dist/_chunks/tool-operations.mjs +361 -0
- package/dist/_chunks/tool-operations.mjs.map +1 -0
- package/dist/_chunks/tool-schemas.d.mts +94 -0
- package/dist/_chunks/tool-schemas.d.mts.map +1 -0
- package/dist/_chunks/tool-schemas.mjs +112 -0
- package/dist/_chunks/tool-schemas.mjs.map +1 -0
- package/dist/_chunks/types.mjs +4 -0
- package/dist/_chunks/types.mjs.map +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +350 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.d.mts +300 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -0
- package/dist/mcp.d.mts +15 -0
- package/dist/mcp.d.mts.map +1 -0
- package/dist/mcp.mjs +2 -0
- package/dist/tool-operations.d.mts +222 -0
- package/dist/tool-operations.d.mts.map +1 -0
- package/dist/tool-operations.mjs +3 -0
- package/dist/tool-schemas.d.mts +2 -0
- package/dist/tool-schemas.mjs +2 -0
- package/package.json +102 -0
- package/packages/omp/extensions/AGENTS.md +7 -0
- package/packages/omp/extensions/harnesses.ts +253 -0
- package/packages/pi/extensions/AGENTS.md +7 -0
- package/packages/pi/extensions/harnesses.ts +265 -0
- package/packages/shared/AGENTS.md +7 -0
- package/packages/shared/tui.ts +346 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { AgentsCompanionTargetResult, AgentsConfig, AgentsSyncAction, AgentsSyncReport, AgentsTargetResult, AvailableModel, EvidenceLevel, Harness, HarnessCapabilities, HarnessConstructor, HarnessDetection, HarnessId, HarnessInvocation, HarnessInvocationModes, HarnessModelListing, InvokeOptions, InvokeResult, ListModelsOptions, ListModelsResult, McpConfigFile, McpConfigListing, McpServerConfig, PathCandidate, Platform, ResolveOptions, ResolvedPaths, StorageDescriptor, SyncReport, SyncTargetResult, addMcpServer, listMcpServers, masterMcpPath, parseJsonc, readAgentsConfig, readMasterMcpServers, removeMcpServer, syncAgentsFiles, syncMcpServers, version } from "./_chunks/agents-sync.mjs";
|
|
2
|
+
declare function registerHarness(HarnessClass: HarnessConstructor): Harness;
|
|
3
|
+
declare function getHarness(id: HarnessId): Harness;
|
|
4
|
+
declare function listHarnesses(): HarnessId[];
|
|
5
|
+
declare function isHarnessId(id: string): id is HarnessId;
|
|
6
|
+
declare function getAllHarnesses(): Harness[];
|
|
7
|
+
/**
|
|
8
|
+
* Detect the active agent from environment variables.
|
|
9
|
+
* Returns the first match since env detection is unambiguous.
|
|
10
|
+
*
|
|
11
|
+
* @returns {Harness | null} The detected harness, or null when none matches.
|
|
12
|
+
*/
|
|
13
|
+
declare function detectHarnessFromEnv(): Harness | null;
|
|
14
|
+
/**
|
|
15
|
+
* Detect which agents have project-level markers in the given directory.
|
|
16
|
+
* Returns all matches (multiple agents can be configured in the same project).
|
|
17
|
+
*
|
|
18
|
+
* @param cwd - Directory to inspect; defaults to the current working directory.
|
|
19
|
+
* @returns {Harness[]} Every harness whose project markers match.
|
|
20
|
+
*/
|
|
21
|
+
declare function detectProjectHarnesses(cwd?: string): Harness[];
|
|
22
|
+
/**
|
|
23
|
+
* Detect the most likely active agent. Priority:
|
|
24
|
+
* 1. Env vars (running inside agent = unambiguous)
|
|
25
|
+
* 2. Single project-level match
|
|
26
|
+
* 3. null if ambiguous or no match
|
|
27
|
+
*
|
|
28
|
+
* @param cwd - Directory to inspect for project markers.
|
|
29
|
+
* @returns {Harness | null} The unambiguous active harness, or null.
|
|
30
|
+
*/
|
|
31
|
+
declare function detectHarness(cwd?: string): Harness | null;
|
|
32
|
+
declare function resolvePathTemplate(template: string, options?: ResolveOptions): string;
|
|
33
|
+
interface ClaudeTextBlock {
|
|
34
|
+
type: "text";
|
|
35
|
+
text: string;
|
|
36
|
+
}
|
|
37
|
+
interface ClaudeThinkingBlock {
|
|
38
|
+
type: "thinking";
|
|
39
|
+
thinking: string;
|
|
40
|
+
signature: string;
|
|
41
|
+
}
|
|
42
|
+
interface ClaudeToolUseBlock {
|
|
43
|
+
type: "tool_use";
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
input: unknown;
|
|
47
|
+
}
|
|
48
|
+
interface ClaudeToolResultBlock {
|
|
49
|
+
type: "tool_result";
|
|
50
|
+
tool_use_id: string;
|
|
51
|
+
content: string | unknown[];
|
|
52
|
+
is_error: boolean;
|
|
53
|
+
}
|
|
54
|
+
type ClaudeContentBlock = ClaudeTextBlock | ClaudeThinkingBlock | ClaudeToolUseBlock | ClaudeToolResultBlock;
|
|
55
|
+
interface ClaudeUsage {
|
|
56
|
+
input_tokens: number;
|
|
57
|
+
cache_creation_input_tokens: number;
|
|
58
|
+
cache_read_input_tokens: number;
|
|
59
|
+
output_tokens: number;
|
|
60
|
+
}
|
|
61
|
+
interface ClaudeBaseEntry {
|
|
62
|
+
uuid: string;
|
|
63
|
+
timestamp: string;
|
|
64
|
+
sessionId: string;
|
|
65
|
+
parentUuid: string | null;
|
|
66
|
+
isSidechain: boolean;
|
|
67
|
+
userType: "external" | "ant";
|
|
68
|
+
cwd: string;
|
|
69
|
+
version: string;
|
|
70
|
+
gitBranch: string;
|
|
71
|
+
}
|
|
72
|
+
interface ClaudeUserEntry extends ClaudeBaseEntry {
|
|
73
|
+
type: "user";
|
|
74
|
+
message: {
|
|
75
|
+
role: "user";
|
|
76
|
+
content: string | ClaudeContentBlock[];
|
|
77
|
+
};
|
|
78
|
+
isMeta?: boolean;
|
|
79
|
+
toolUseResult?: {
|
|
80
|
+
stdout: string;
|
|
81
|
+
stderr: string;
|
|
82
|
+
interrupted: boolean;
|
|
83
|
+
isImage: boolean;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
interface ClaudeAssistantEntry extends ClaudeBaseEntry {
|
|
87
|
+
type: "assistant";
|
|
88
|
+
requestId: string;
|
|
89
|
+
message: {
|
|
90
|
+
id: string;
|
|
91
|
+
role: "assistant";
|
|
92
|
+
type: "message";
|
|
93
|
+
model: string;
|
|
94
|
+
content: ClaudeContentBlock[];
|
|
95
|
+
stop_reason: string | null;
|
|
96
|
+
stop_sequence: string | null;
|
|
97
|
+
usage: ClaudeUsage;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
interface ClaudeSummaryEntry {
|
|
101
|
+
type: "summary";
|
|
102
|
+
summary: string;
|
|
103
|
+
leafUuid: string;
|
|
104
|
+
}
|
|
105
|
+
type ClaudeSessionEntry = ClaudeUserEntry | ClaudeAssistantEntry | ClaudeSummaryEntry;
|
|
106
|
+
interface ClaudeHistoryEntry {
|
|
107
|
+
display: string;
|
|
108
|
+
timestamp: number;
|
|
109
|
+
project: string;
|
|
110
|
+
sessionId: string;
|
|
111
|
+
pastedContents: Record<string, {
|
|
112
|
+
id: number;
|
|
113
|
+
type: "text";
|
|
114
|
+
content: string;
|
|
115
|
+
}>;
|
|
116
|
+
}
|
|
117
|
+
interface GeminiTokensSummary {
|
|
118
|
+
input: number;
|
|
119
|
+
output: number;
|
|
120
|
+
cached: number;
|
|
121
|
+
thoughts?: number;
|
|
122
|
+
tool?: number;
|
|
123
|
+
total: number;
|
|
124
|
+
}
|
|
125
|
+
interface GeminiToolCallRecord {
|
|
126
|
+
id: string;
|
|
127
|
+
name: string;
|
|
128
|
+
args: Record<string, unknown>;
|
|
129
|
+
result?: unknown[] | null;
|
|
130
|
+
status: "success" | "error" | "running";
|
|
131
|
+
timestamp: string;
|
|
132
|
+
displayName?: string;
|
|
133
|
+
renderOutputAsMarkdown?: boolean;
|
|
134
|
+
}
|
|
135
|
+
interface GeminiThought {
|
|
136
|
+
subject: string;
|
|
137
|
+
description: string;
|
|
138
|
+
timestamp: string;
|
|
139
|
+
}
|
|
140
|
+
interface GeminiMessageRecord {
|
|
141
|
+
id: string;
|
|
142
|
+
timestamp: string;
|
|
143
|
+
type: "user" | "gemini" | "info" | "error" | "warning";
|
|
144
|
+
content: unknown[];
|
|
145
|
+
displayContent?: unknown[];
|
|
146
|
+
model?: string;
|
|
147
|
+
tokens?: GeminiTokensSummary;
|
|
148
|
+
thoughts?: GeminiThought[];
|
|
149
|
+
toolCalls?: GeminiToolCallRecord[];
|
|
150
|
+
}
|
|
151
|
+
interface GeminiConversationRecord {
|
|
152
|
+
sessionId: string;
|
|
153
|
+
projectHash: string;
|
|
154
|
+
startTime: string;
|
|
155
|
+
lastUpdated: string;
|
|
156
|
+
messages: GeminiMessageRecord[];
|
|
157
|
+
summary?: string;
|
|
158
|
+
directories?: string[];
|
|
159
|
+
kind?: "main" | "subagent";
|
|
160
|
+
}
|
|
161
|
+
interface CodexHistoryEntry {
|
|
162
|
+
session_id: string;
|
|
163
|
+
ts: number;
|
|
164
|
+
text: string;
|
|
165
|
+
}
|
|
166
|
+
interface CodexThread {
|
|
167
|
+
id: string;
|
|
168
|
+
rollout_path: string;
|
|
169
|
+
created_at: number;
|
|
170
|
+
updated_at: number;
|
|
171
|
+
source: string;
|
|
172
|
+
model_provider: string;
|
|
173
|
+
cwd: string;
|
|
174
|
+
title: string;
|
|
175
|
+
sandbox_policy: string;
|
|
176
|
+
approval_mode: string;
|
|
177
|
+
tokens_used: number;
|
|
178
|
+
archived: number;
|
|
179
|
+
git_sha: string;
|
|
180
|
+
}
|
|
181
|
+
interface CodexLogEntry {
|
|
182
|
+
id: number;
|
|
183
|
+
ts: number;
|
|
184
|
+
ts_nanos: number;
|
|
185
|
+
level: string;
|
|
186
|
+
message: string;
|
|
187
|
+
thread_id: string | null;
|
|
188
|
+
process_uuid: string;
|
|
189
|
+
}
|
|
190
|
+
interface OpenCodeSession {
|
|
191
|
+
id: string;
|
|
192
|
+
project_id: string;
|
|
193
|
+
workspace_id: string | null;
|
|
194
|
+
parent_id: string | null;
|
|
195
|
+
slug: string;
|
|
196
|
+
directory: string;
|
|
197
|
+
title: string;
|
|
198
|
+
version: string;
|
|
199
|
+
share_url: string | null;
|
|
200
|
+
summary_additions: number | null;
|
|
201
|
+
summary_deletions: number | null;
|
|
202
|
+
summary_files: number | null;
|
|
203
|
+
time_created: number;
|
|
204
|
+
time_updated: number;
|
|
205
|
+
time_compacting: number | null;
|
|
206
|
+
time_archived: number | null;
|
|
207
|
+
}
|
|
208
|
+
interface OpenCodeMessage {
|
|
209
|
+
id: string;
|
|
210
|
+
session_id: string;
|
|
211
|
+
time_created: number;
|
|
212
|
+
time_updated: number;
|
|
213
|
+
data: unknown;
|
|
214
|
+
}
|
|
215
|
+
interface OpenCodeTextPart {
|
|
216
|
+
type: "text";
|
|
217
|
+
text: string;
|
|
218
|
+
synthetic?: boolean;
|
|
219
|
+
ignored?: boolean;
|
|
220
|
+
}
|
|
221
|
+
interface OpenCodeReasoningPart {
|
|
222
|
+
type: "reasoning";
|
|
223
|
+
text: string;
|
|
224
|
+
}
|
|
225
|
+
interface OpenCodeToolPart {
|
|
226
|
+
type: "tool";
|
|
227
|
+
callID: string;
|
|
228
|
+
tool: string;
|
|
229
|
+
state: "pending" | "running" | "completed" | "error";
|
|
230
|
+
}
|
|
231
|
+
interface OpenCodeFilePart {
|
|
232
|
+
type: "file";
|
|
233
|
+
mime: string;
|
|
234
|
+
filename: string;
|
|
235
|
+
url: string;
|
|
236
|
+
source?: string;
|
|
237
|
+
}
|
|
238
|
+
interface OpenCodeSubtaskPart {
|
|
239
|
+
type: "subtask";
|
|
240
|
+
prompt: string;
|
|
241
|
+
description: string;
|
|
242
|
+
agent?: string;
|
|
243
|
+
model?: string;
|
|
244
|
+
command?: string;
|
|
245
|
+
}
|
|
246
|
+
interface OpenCodeStepStartPart {
|
|
247
|
+
type: "step-start";
|
|
248
|
+
snapshot?: string;
|
|
249
|
+
}
|
|
250
|
+
interface OpenCodeStepFinishPart {
|
|
251
|
+
type: "step-finish";
|
|
252
|
+
reason: string;
|
|
253
|
+
cost?: number;
|
|
254
|
+
tokens?: unknown;
|
|
255
|
+
snapshot?: string;
|
|
256
|
+
}
|
|
257
|
+
interface OpenCodeSnapshotPart {
|
|
258
|
+
type: "snapshot";
|
|
259
|
+
snapshot: string;
|
|
260
|
+
}
|
|
261
|
+
interface OpenCodePatchPart {
|
|
262
|
+
type: "patch";
|
|
263
|
+
hash: string;
|
|
264
|
+
files: unknown;
|
|
265
|
+
}
|
|
266
|
+
interface OpenCodeAgentPart {
|
|
267
|
+
type: "agent";
|
|
268
|
+
name: string;
|
|
269
|
+
source?: string;
|
|
270
|
+
}
|
|
271
|
+
interface OpenCodeRetryPart {
|
|
272
|
+
type: "retry";
|
|
273
|
+
attempt: number;
|
|
274
|
+
error: string;
|
|
275
|
+
time?: number;
|
|
276
|
+
}
|
|
277
|
+
interface OpenCodeCompactionPart {
|
|
278
|
+
type: "compaction";
|
|
279
|
+
auto?: boolean;
|
|
280
|
+
overflow?: boolean;
|
|
281
|
+
}
|
|
282
|
+
type OpenCodePart = OpenCodeTextPart | OpenCodeReasoningPart | OpenCodeToolPart | OpenCodeFilePart | OpenCodeSubtaskPart | OpenCodeStepStartPart | OpenCodeStepFinishPart | OpenCodeSnapshotPart | OpenCodePatchPart | OpenCodeAgentPart | OpenCodeRetryPart | OpenCodeCompactionPart;
|
|
283
|
+
interface OpenCodeTodo {
|
|
284
|
+
session_id: string;
|
|
285
|
+
content: string;
|
|
286
|
+
status: string;
|
|
287
|
+
priority: string;
|
|
288
|
+
position: number;
|
|
289
|
+
time_created: number;
|
|
290
|
+
time_updated: number;
|
|
291
|
+
}
|
|
292
|
+
interface OpenCodeProject {
|
|
293
|
+
id: string;
|
|
294
|
+
worktree: string;
|
|
295
|
+
vcs: string | null;
|
|
296
|
+
name: string | null;
|
|
297
|
+
}
|
|
298
|
+
declare const harnessIds: readonly HarnessId[];
|
|
299
|
+
export { type AgentsCompanionTargetResult, type AgentsConfig, type AgentsSyncAction, type AgentsSyncReport, type AgentsTargetResult, type AvailableModel, type ClaudeAssistantEntry, type ClaudeBaseEntry, type ClaudeContentBlock, type ClaudeHistoryEntry, type ClaudeSessionEntry, type ClaudeSummaryEntry, type ClaudeTextBlock, type ClaudeThinkingBlock, type ClaudeToolResultBlock, type ClaudeToolUseBlock, type ClaudeUsage, type ClaudeUserEntry, type CodexHistoryEntry, type CodexLogEntry, type CodexThread, type EvidenceLevel, type GeminiConversationRecord, type GeminiMessageRecord, type GeminiThought, type GeminiTokensSummary, type GeminiToolCallRecord, Harness, type HarnessCapabilities, type HarnessConstructor, type HarnessDetection, type HarnessId, type HarnessInvocation, type HarnessInvocationModes, type HarnessModelListing, type InvokeOptions, type InvokeResult, type ListModelsOptions, type ListModelsResult, type McpConfigFile, type McpConfigListing, type McpServerConfig, type OpenCodeAgentPart, type OpenCodeCompactionPart, type OpenCodeFilePart, type OpenCodeMessage, type OpenCodePart, type OpenCodePatchPart, type OpenCodeProject, type OpenCodeReasoningPart, type OpenCodeRetryPart, type OpenCodeSession, type OpenCodeSnapshotPart, type OpenCodeStepFinishPart, type OpenCodeStepStartPart, type OpenCodeSubtaskPart, type OpenCodeTextPart, type OpenCodeTodo, type OpenCodeToolPart, type PathCandidate, type Platform, type ResolveOptions, type ResolvedPaths, type StorageDescriptor, type SyncReport, type SyncTargetResult, addMcpServer, detectHarness, detectHarnessFromEnv, detectProjectHarnesses, getAllHarnesses, getHarness, harnessIds, isHarnessId, listHarnesses, listMcpServers, masterMcpPath, parseJsonc, readAgentsConfig, readMasterMcpServers, registerHarness, removeMcpServer, resolvePathTemplate, syncAgentsFiles, syncMcpServers, version };
|
|
300
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/registry.ts","../src/resolve.ts","../src/schemas/claude.ts","../src/schemas/gemini.ts","../src/schemas/codex.ts","../src/schemas/opencode.ts","../src/index.ts"],"mappings":";iBAiBgB,gBAAgB,cAAc,qBAAqB;iBAMnD,WAAW,IAAI,YAAY;iBAM3B,iBAAiB;iBAIjB,YAAY,aAAa,MAAM;iBAI/B,mBAAmB;;;;;;;iBAUnB,wBAAwB;;;;;;;;iBAcxB,uBAAuB,eAAe;;;;;;;;;;iBAatC,cAAc,eAAe;iBCtE7B,oBAAoB,kBAAkB,UAAS;UCJ9C;EACf;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;KAGU,qBACR,kBACA,sBACA,qBACA;UAEa;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe,wBAAwB;EACvC;EACA;IACE;IACA,kBAAkB;;EAEpB;EACA;IACE;IACA;IACA;IACA;;;UAIa,6BAA6B;EAC5C;EACA;EACA;IACE;IACA;IACA;IACA;IACA,SAAS;IACT;IACA;IACA,OAAO;;;UAIM;EACf;EACA;EACA;;KAGU,qBAAqB,kBAAkB,uBAAuB;UAEzD;EACf;EACA;EACA;EACA;EACA,gBAAgB;IAGZ;IACA;IACA;;;UClGW;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;EACT,WAAW;EACX,YAAY;;UAGG;EACf;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;;UC9Ce;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;UC7Be;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;;KAGU,eACR,mBACA,wBACA,mBACA,mBACA,sBACA,wBACA,yBACA,uBACA,oBACA,oBACA,oBACA;UAEa;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;cCpCW,qBAAqB"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { version } from "./_chunks/types.mjs";
|
|
2
|
+
import { Harness, addMcpServer, detectHarness, detectHarnessFromEnv, detectProjectHarnesses, getAllHarnesses, getHarness, isHarnessId, listHarnesses, listMcpServers, masterMcpPath, parseJsonc, readAgentsConfig, readMasterMcpServers, registerHarness, removeMcpServer, resolvePathTemplate, syncAgentsFiles, syncMcpServers } from "./_chunks/agents-sync.mjs";
|
|
3
|
+
const harnessIds = Object.freeze(listHarnesses());
|
|
4
|
+
export { Harness, addMcpServer, detectHarness, detectHarnessFromEnv, detectProjectHarnesses, getAllHarnesses, getHarness, harnessIds, isHarnessId, listHarnesses, listMcpServers, masterMcpPath, parseJsonc, readAgentsConfig, readMasterMcpServers, registerHarness, removeMcpServer, resolvePathTemplate, syncAgentsFiles, syncMcpServers, version };
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export { version } from \"./types.ts\";\nexport type {\n HarnessId,\n EvidenceLevel,\n Platform,\n PathCandidate,\n StorageDescriptor,\n HarnessCapabilities,\n HarnessDetection,\n HarnessInvocation,\n HarnessInvocationModes,\n HarnessModelListing,\n AvailableModel,\n ListModelsOptions,\n ListModelsResult,\n InvokeOptions,\n InvokeResult,\n McpServerConfig,\n McpConfigFile,\n ResolveOptions,\n ResolvedPaths,\n} from \"./types.ts\";\n\nexport { Harness } from \"./harness.ts\";\nexport type { HarnessConstructor } from \"./harness.ts\";\nexport {\n registerHarness,\n getHarness,\n isHarnessId,\n listHarnesses,\n getAllHarnesses,\n detectHarness,\n detectHarnessFromEnv,\n detectProjectHarnesses,\n} from \"./registry.ts\";\nexport { resolvePathTemplate } from \"./resolve.ts\";\nexport {\n listMcpServers,\n addMcpServer,\n removeMcpServer,\n syncMcpServers,\n readMasterMcpServers,\n masterMcpPath,\n parseJsonc,\n} from \"./mcp-servers.ts\";\nexport type { McpConfigListing, SyncReport, SyncTargetResult } from \"./mcp-servers.ts\";\nexport { syncAgentsFiles, readAgentsConfig } from \"./agents-sync.ts\";\nexport type {\n AgentsConfig,\n AgentsSyncAction,\n AgentsCompanionTargetResult,\n AgentsSyncReport,\n AgentsTargetResult,\n} from \"./agents-sync.ts\";\n\nexport type {\n ClaudeContentBlock,\n ClaudeTextBlock,\n ClaudeThinkingBlock,\n ClaudeToolUseBlock,\n ClaudeToolResultBlock,\n ClaudeUsage,\n ClaudeBaseEntry,\n ClaudeUserEntry,\n ClaudeAssistantEntry,\n ClaudeSummaryEntry,\n ClaudeSessionEntry,\n ClaudeHistoryEntry,\n GeminiTokensSummary,\n GeminiToolCallRecord,\n GeminiThought,\n GeminiMessageRecord,\n GeminiConversationRecord,\n CodexHistoryEntry,\n CodexThread,\n CodexLogEntry,\n OpenCodeSession,\n OpenCodeMessage,\n OpenCodeTextPart,\n OpenCodeReasoningPart,\n OpenCodeToolPart,\n OpenCodeFilePart,\n OpenCodeSubtaskPart,\n OpenCodeStepStartPart,\n OpenCodeStepFinishPart,\n OpenCodeSnapshotPart,\n OpenCodePatchPart,\n OpenCodeAgentPart,\n OpenCodeRetryPart,\n OpenCodeCompactionPart,\n OpenCodePart,\n OpenCodeTodo,\n OpenCodeProject,\n} from \"./schemas/index.ts\";\n\nimport type { HarnessId } from \"./types.ts\";\nimport { listHarnesses } from \"./registry.ts\";\n\nexport const harnessIds: readonly HarnessId[] = Object.freeze(listHarnesses());\n"],"mappings":";;AAkGA,MAAa,aAAmC,OAAO,OAAO,cAAc,CAAC"}
|
package/dist/mcp.d.mts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates an unconnected MCP server exposing the harness registry tools.
|
|
4
|
+
*
|
|
5
|
+
* Built on the low-level `Server` even though the SDK marks it `@deprecated`,
|
|
6
|
+
* because `McpServer.registerTool` accepts Standard Schema (Zod) only. TypeBox 1.x
|
|
7
|
+
* does not implement Standard Schema, and this package's tool schemas are TypeBox,
|
|
8
|
+
* shared with the Pi and OMP extensions. The high-level API would force a second
|
|
9
|
+
* definition of every parameter.
|
|
10
|
+
*
|
|
11
|
+
* @returns {Server} An unconnected MCP server.
|
|
12
|
+
*/
|
|
13
|
+
declare function createMcpServer(): Server;
|
|
14
|
+
export { createMcpServer };
|
|
15
|
+
//# sourceMappingURL=mcp.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.mts","names":[],"sources":["../src/mcp.ts"],"mappings":";;;;;;;;;;;;iBAqOgB,mBAAmB"}
|
package/dist/mcp.mjs
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { AgentsSyncReport, AvailableModel, HarnessCapabilities, HarnessDetection, HarnessId, HarnessInvocationModes, McpConfigListing, McpServerConfig, PathCandidate, ResolvedPaths, StorageDescriptor, SyncReport } from "./_chunks/agents-sync.mjs";
|
|
2
|
+
import { HARNESS_INFO_MAX_ITEMS } from "./_chunks/tool-schemas.mjs";
|
|
3
|
+
/** Text for the model plus details for the harness, shared by every tool surface. */
|
|
4
|
+
interface ToolResult<Details> {
|
|
5
|
+
content: Array<{
|
|
6
|
+
type: "text";
|
|
7
|
+
text: string;
|
|
8
|
+
}>;
|
|
9
|
+
details: Details;
|
|
10
|
+
/** Set when the tool could not answer. */
|
|
11
|
+
isError?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** Install state of one harness on this machine. */
|
|
14
|
+
interface HarnessStatus {
|
|
15
|
+
id: HarnessId;
|
|
16
|
+
name: string;
|
|
17
|
+
installed: boolean;
|
|
18
|
+
version: string | null;
|
|
19
|
+
}
|
|
20
|
+
/** Every registered harness with its install state, as scanned by {@link detectHarnesses}. */
|
|
21
|
+
interface HarnessListing {
|
|
22
|
+
harnesses: HarnessStatus[];
|
|
23
|
+
}
|
|
24
|
+
/** Full metadata for one harness, including paths resolved for this platform. */
|
|
25
|
+
interface HarnessMetadata {
|
|
26
|
+
id: HarnessId;
|
|
27
|
+
name: string;
|
|
28
|
+
binaries: string[];
|
|
29
|
+
capabilities: HarnessCapabilities;
|
|
30
|
+
invocationModes: HarnessInvocationModes;
|
|
31
|
+
modelListing: boolean;
|
|
32
|
+
modelSelection: boolean;
|
|
33
|
+
config: PathCandidate[];
|
|
34
|
+
sessions: PathCandidate[];
|
|
35
|
+
instructions: PathCandidate[];
|
|
36
|
+
skills: PathCandidate[];
|
|
37
|
+
commands: PathCandidate[];
|
|
38
|
+
hooks: PathCandidate[];
|
|
39
|
+
persistence: StorageDescriptor[];
|
|
40
|
+
detection: HarnessDetection;
|
|
41
|
+
resolved: ResolvedPaths;
|
|
42
|
+
}
|
|
43
|
+
/** Returned when the requested harness id is not registered. */
|
|
44
|
+
interface UnknownHarness {
|
|
45
|
+
error: string;
|
|
46
|
+
known: HarnessId[];
|
|
47
|
+
}
|
|
48
|
+
/** Returned when a direct batch call bypasses the tool schema limits. */
|
|
49
|
+
interface HarnessInfoInputError {
|
|
50
|
+
error: string;
|
|
51
|
+
}
|
|
52
|
+
/** One harness lookup result. */
|
|
53
|
+
type HarnessInfoResult = HarnessMetadata | UnknownHarness;
|
|
54
|
+
/** Scalar, batch, or rejected batch details from {@link harnessInfo}. */
|
|
55
|
+
type HarnessInfoDetails = HarnessInfoResult | HarnessInfoResult[] | HarnessInfoInputError;
|
|
56
|
+
/** Default wall-clock budget for one harness run, in seconds. */
|
|
57
|
+
declare const RUN_DEFAULT_TIMEOUT_SECONDS = 600;
|
|
58
|
+
/** The run tool's per-stream cap: harness output is unbounded, model context is not. */
|
|
59
|
+
declare const RUN_MAX_OUTPUT_CHARS = 8000;
|
|
60
|
+
/**
|
|
61
|
+
* Scans every registered harness for its binaries and version.
|
|
62
|
+
*
|
|
63
|
+
* @returns {ToolResult<HarnessListing>} The complete installation listing.
|
|
64
|
+
*/
|
|
65
|
+
declare function detectHarnesses(): ToolResult<HarnessListing>;
|
|
66
|
+
/** Full metadata for one harness, with paths resolved for the current platform. */
|
|
67
|
+
declare function harnessInfo(id: string): ToolResult<HarnessInfoResult>;
|
|
68
|
+
/** Full metadata for several harnesses, preserving input order and errors for each item. */
|
|
69
|
+
declare function harnessInfo(ids: readonly string[]): ToolResult<HarnessInfoResult[] | HarnessInfoInputError>;
|
|
70
|
+
declare function harnessInfo(input: string | readonly string[]): ToolResult<HarnessInfoDetails>;
|
|
71
|
+
/** Options accepted by {@link listHarnessModels}. */
|
|
72
|
+
interface ModelsOptions {
|
|
73
|
+
search?: string;
|
|
74
|
+
cwd?: string;
|
|
75
|
+
/** Wall-clock budget in seconds; defaults to {@link RUN_DEFAULT_TIMEOUT_SECONDS}. */
|
|
76
|
+
timeoutSeconds?: number;
|
|
77
|
+
}
|
|
78
|
+
/** One completed native model-listing query. */
|
|
79
|
+
interface ModelsOutcome {
|
|
80
|
+
id: HarnessId;
|
|
81
|
+
command: string;
|
|
82
|
+
args: string[];
|
|
83
|
+
search?: string;
|
|
84
|
+
models: AvailableModel[];
|
|
85
|
+
exitCode: number | null;
|
|
86
|
+
timedOut: boolean;
|
|
87
|
+
stderr: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Lists the models currently available to one harness through its native CLI.
|
|
91
|
+
*
|
|
92
|
+
* @param id - Harness id to query.
|
|
93
|
+
* @param options - Search, working-directory, and timeout options.
|
|
94
|
+
* @returns {Promise<ToolResult<ModelsOutcome | RunFailure>>} The model listing or failure.
|
|
95
|
+
*/
|
|
96
|
+
declare function listHarnessModels(id: string, options?: ModelsOptions): Promise<ToolResult<ModelsOutcome | RunFailure>>;
|
|
97
|
+
/** Options accepted by {@link runHarness}. */
|
|
98
|
+
interface RunOptions {
|
|
99
|
+
cwd?: string;
|
|
100
|
+
/** Harness-native model id or selector. */
|
|
101
|
+
model?: string;
|
|
102
|
+
/** Wall-clock budget in seconds; defaults to {@link RUN_DEFAULT_TIMEOUT_SECONDS}. */
|
|
103
|
+
timeoutSeconds?: number;
|
|
104
|
+
/** Use the harness's structured (JSON) output mode instead of plain text. */
|
|
105
|
+
structured?: boolean;
|
|
106
|
+
/** Enable tools; defaults to a native advisor without tools invocation. */
|
|
107
|
+
tools?: boolean;
|
|
108
|
+
/** Require native enforcement of read-only tool access. Implies tools. */
|
|
109
|
+
readOnly?: boolean;
|
|
110
|
+
}
|
|
111
|
+
/** One completed (or failed) harness run, with output capped for the model. */
|
|
112
|
+
interface RunOutcome {
|
|
113
|
+
id: HarnessId;
|
|
114
|
+
command: string;
|
|
115
|
+
args: string[];
|
|
116
|
+
model?: string;
|
|
117
|
+
structured: boolean;
|
|
118
|
+
tools: boolean;
|
|
119
|
+
readOnly: boolean;
|
|
120
|
+
exitCode: number | null;
|
|
121
|
+
timedOut: boolean;
|
|
122
|
+
stdout: string;
|
|
123
|
+
stderr: string;
|
|
124
|
+
}
|
|
125
|
+
/** Returned when the harness cannot be run at all. */
|
|
126
|
+
interface RunFailure {
|
|
127
|
+
error: string;
|
|
128
|
+
known?: HarnessId[];
|
|
129
|
+
/** Modes accepted by the selected harness when invocation mode caused the failure. */
|
|
130
|
+
invocationModes?: HarnessInvocationModes;
|
|
131
|
+
/** Explicit mode change that makes the same invocation shape executable. */
|
|
132
|
+
retry?: {
|
|
133
|
+
tools: boolean;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Runs one prompt through a harness's normalized non-interactive invocation.
|
|
138
|
+
*
|
|
139
|
+
* Tool use defaults to a native advisor without tools invocation. Harnesses that
|
|
140
|
+
* cannot disable tools reject that mode; setting `tools` selects their full
|
|
141
|
+
* agent invocation. `model` is translated through the harness-specific recipe.
|
|
142
|
+
* This layer also closes stdin, enforces the timeout, and
|
|
143
|
+
* caps the echoed output.
|
|
144
|
+
*
|
|
145
|
+
* @param id - Harness id to run.
|
|
146
|
+
* @param prompt - Prompt sent to the selected harness.
|
|
147
|
+
* @param options - Model, mode, working-directory, and timeout options.
|
|
148
|
+
* @returns {Promise<ToolResult<RunOutcome | RunFailure>>} The capped run outcome or failure.
|
|
149
|
+
*/
|
|
150
|
+
declare function runHarness(id: string, prompt: string, options?: RunOptions): Promise<ToolResult<RunOutcome | RunFailure>>;
|
|
151
|
+
/** MCP server listings for one harness or all of them. */
|
|
152
|
+
interface McpListing {
|
|
153
|
+
harnesses: Array<{
|
|
154
|
+
id: HarnessId;
|
|
155
|
+
configs: McpConfigListing[];
|
|
156
|
+
}>;
|
|
157
|
+
}
|
|
158
|
+
/** Result of one MCP config mutation. */
|
|
159
|
+
interface McpMutation {
|
|
160
|
+
id: HarnessId;
|
|
161
|
+
path: string;
|
|
162
|
+
action: "added" | "replaced" | "removed" | "noop";
|
|
163
|
+
}
|
|
164
|
+
/** Flat tool parameters describing one MCP server, shared by every surface. */
|
|
165
|
+
interface McpServerParams {
|
|
166
|
+
name: string;
|
|
167
|
+
transport?: McpServerConfig["transport"];
|
|
168
|
+
command?: string;
|
|
169
|
+
args?: string[];
|
|
170
|
+
env?: Record<string, string>;
|
|
171
|
+
url?: string;
|
|
172
|
+
headers?: Record<string, string>;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Builds the normalized server shape from flat tool parameters.
|
|
176
|
+
*
|
|
177
|
+
* @param params - Flat MCP server parameters.
|
|
178
|
+
* @returns {McpServerConfig} The normalized server configuration.
|
|
179
|
+
*/
|
|
180
|
+
declare function toMcpServerConfig(params: McpServerParams): McpServerConfig;
|
|
181
|
+
/**
|
|
182
|
+
* Lists configured MCP servers, normalized across harness config dialects.
|
|
183
|
+
*
|
|
184
|
+
* @param id - Optional harness id; omission lists every harness.
|
|
185
|
+
* @returns {ToolResult<McpListing | UnknownHarness>} The normalized listing or id error.
|
|
186
|
+
*/
|
|
187
|
+
declare function mcpList(id?: string): ToolResult<McpListing | UnknownHarness>;
|
|
188
|
+
/**
|
|
189
|
+
* Adds or replaces one MCP server in a harness's config.
|
|
190
|
+
*
|
|
191
|
+
* @param id - Target harness id.
|
|
192
|
+
* @param params - Server parameters to normalize and write.
|
|
193
|
+
* @param scope - User or project config scope.
|
|
194
|
+
* @returns {ToolResult<McpMutation | RunFailure>} The mutation outcome or failure.
|
|
195
|
+
*/
|
|
196
|
+
declare function mcpAdd(id: string, params: McpServerParams, scope?: "user" | "project"): ToolResult<McpMutation | RunFailure>;
|
|
197
|
+
/**
|
|
198
|
+
* Removes one MCP server from a harness's config.
|
|
199
|
+
*
|
|
200
|
+
* @param id - Target harness id.
|
|
201
|
+
* @param name - Server name to remove.
|
|
202
|
+
* @param scope - User or project config scope.
|
|
203
|
+
* @returns {ToolResult<McpMutation | RunFailure>} The mutation outcome or failure.
|
|
204
|
+
*/
|
|
205
|
+
declare function mcpRemove(id: string, name: string, scope?: "user" | "project"): ToolResult<McpMutation | RunFailure>;
|
|
206
|
+
/**
|
|
207
|
+
* Pushes the master MCP list from ~/.config/agntn/mcp.jsonc into harness configs.
|
|
208
|
+
*
|
|
209
|
+
* @param id - Optional harness id; omission targets every harness.
|
|
210
|
+
* @returns {ToolResult<SyncReport | RunFailure>} The sync report or failure.
|
|
211
|
+
*/
|
|
212
|
+
declare function mcpSync(id?: string): ToolResult<SyncReport | RunFailure>;
|
|
213
|
+
/**
|
|
214
|
+
* Links every harness's global instructions file to the master AGENTS.md.
|
|
215
|
+
*
|
|
216
|
+
* @param id - Optional harness id; omission targets every harness.
|
|
217
|
+
* @param check - Report intended changes without writing them.
|
|
218
|
+
* @returns {ToolResult<AgentsSyncReport | RunFailure>} The sync report or failure.
|
|
219
|
+
*/
|
|
220
|
+
declare function agentsSync(id?: string, check?: boolean): ToolResult<AgentsSyncReport | RunFailure>;
|
|
221
|
+
export { type AgentsSyncReport, HARNESS_INFO_MAX_ITEMS, HarnessInfoDetails, HarnessInfoInputError, HarnessInfoResult, type HarnessInvocationModes, HarnessListing, HarnessMetadata, HarnessStatus, McpListing, McpMutation, McpServerParams, ModelsOptions, ModelsOutcome, RUN_DEFAULT_TIMEOUT_SECONDS, RUN_MAX_OUTPUT_CHARS, RunFailure, RunOptions, RunOutcome, type SyncReport, ToolResult, UnknownHarness, agentsSync, detectHarnesses, harnessInfo, listHarnessModels, mcpAdd, mcpList, mcpRemove, mcpSync, runHarness, toMcpServerConfig };
|
|
222
|
+
//# sourceMappingURL=tool-operations.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-operations.d.mts","names":[],"sources":["../src/tool-operations.ts"],"mappings":";;;UAsCiB,WAAW;EAC1B,SAAS;IAAQ;IAAc;;EAC/B,SAAS;;EAET;;;UAIe;EACf,IAAI;EACJ;EACA;EACA;;;UAIe;EACf,WAAW;;;UAII;EACf,IAAI;EACJ;EACA;EACA,cAAc;EACd,iBAAiB;EACjB;EACA;EACA,QAAQ;EACR,UAAU;EACV,cAAc;EACd,QAAQ;EACR,UAAU;EACV,OAAO;EACP,aAAa;EACb,WAAW;EACX,UAAU;;;UAIK;EACf;EACA,OAAO;;;UAIQ;EACf;;;KAIU,oBAAoB,kBAAkB;;KAGtC,qBAAqB,oBAAoB,sBAAsB;;cAM9D;;cAGA;;;;;;iBA4GG,mBAAmB,WAAW;;iBAyC9B,YAAY,aAAa,WAAW;;iBAEpC,YACd,yBACC,WAAW,sBAAsB;iBACpB,YAAY,oCAAoC,WAAW;;UAuB1D;EACf;EACA;;EAEA;;;UAIe;EACf,IAAI;EACJ;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;;;;;;;;;iBAUoB,kBACpB,YACA,UAAS,gBACR,QAAQ,WAAW,gBAAgB;;UA0CrB;EACf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;UAIe;EACf,IAAI;EACJ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;UAIe;EACf;EACA,QAAQ;;EAER,kBAAkB;;EAElB;IAAU;;;;;;;;;;;;;;;;;iBAyBU,WACpB,YACA,gBACA,UAAS,aACR,QAAQ,WAAW,aAAa;;UAgClB;EACf,WAAW;IAAQ,IAAI;IAAW,SAAS;;;;UAI5B;EACf,IAAI;EACJ;EACA;;;UAIe;EACf;EACA,YAAY;EACZ;EACA;EACA,MAAM;EACN;EACA,UAAU;;;;;;;;iBASI,kBAAkB,QAAQ,kBAAkB;;;;;;;iBAmB5C,QAAQ,cAAc,WAAW,aAAa;;;;;;;;;iBAqC9C,OACd,YACA,QAAQ,iBACR,6BACC,WAAW,cAAc;;;;;;;;;iBAeZ,UACd,YACA,cACA,6BACC,WAAW,cAAc;;;;;;;iBAaZ,QAAQ,cAAc,WAAW,aAAa;;;;;;;;iBA+B9C,WAAW,aAAa,kBAAgB,WAAW,mBAAmB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { HARNESS_INFO_MAX_ITEMS } from "./_chunks/tool-schemas.mjs";
|
|
2
|
+
import { RUN_DEFAULT_TIMEOUT_SECONDS, RUN_MAX_OUTPUT_CHARS, agentsSync, detectHarnesses, harnessInfo, listHarnessModels, mcpAdd, mcpList, mcpRemove, mcpSync, runHarness, toMcpServerConfig } from "./_chunks/tool-operations.mjs";
|
|
3
|
+
export { HARNESS_INFO_MAX_ITEMS, RUN_DEFAULT_TIMEOUT_SECONDS, RUN_MAX_OUTPUT_CHARS, agentsSync, detectHarnesses, harnessInfo, listHarnessModels, mcpAdd, mcpList, mcpRemove, mcpSync, runHarness, toMcpServerConfig };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { AgentsSyncParams, HARNESS_INFO_MAX_ITEMS, InfoParams, McpAddParams, McpListParams, McpRemoveParams, McpSchemaBuilder, McpSyncParams, ModelsParams, RUN_TIMEOUT_DEFAULT_SECONDS, RunParams, harnessToolSchemas } from "./_chunks/tool-schemas.mjs";
|
|
2
|
+
export { AgentsSyncParams, HARNESS_INFO_MAX_ITEMS, InfoParams, McpAddParams, McpListParams, McpRemoveParams, McpSchemaBuilder, McpSyncParams, ModelsParams, RUN_TIMEOUT_DEFAULT_SECONDS, RunParams, harnessToolSchemas };
|