coding-agent-adapters 0.12.0 → 0.14.0
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.cjs +66 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +65 -14
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseCLIAdapter, SpawnConfig, AutoResponseRule, LoginDetection, BlockingPromptDetection, ToolRunningInfo, ParsedOutput } from '
|
|
1
|
+
import { BaseCLIAdapter, SpawnConfig, AutoResponseRule, LoginDetection, BlockingPromptDetection, ToolRunningInfo, ParsedOutput } from 'adapter-types';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Approval Presets
|
|
@@ -397,6 +397,8 @@ declare class GeminiAdapter extends BaseCodingAdapter {
|
|
|
397
397
|
getHookTelemetryProtocol(options?: {
|
|
398
398
|
scriptPath?: string;
|
|
399
399
|
markerPrefix?: string;
|
|
400
|
+
httpUrl?: string;
|
|
401
|
+
sessionId?: string;
|
|
400
402
|
}): {
|
|
401
403
|
markerPrefix: string;
|
|
402
404
|
scriptPath: string;
|
|
@@ -612,7 +614,7 @@ declare class HermesAdapter extends BaseCodingAdapter {
|
|
|
612
614
|
/**
|
|
613
615
|
* Dynamic Pattern Loader
|
|
614
616
|
*
|
|
615
|
-
* Loads adapter patterns from @
|
|
617
|
+
* Loads adapter patterns from @parallaxai/adapter-monitor snapshots when available,
|
|
616
618
|
* with fallback to hardcoded baseline patterns.
|
|
617
619
|
*/
|
|
618
620
|
|
|
@@ -642,7 +644,7 @@ interface AdapterPatterns {
|
|
|
642
644
|
/**
|
|
643
645
|
* Load patterns for an adapter
|
|
644
646
|
*
|
|
645
|
-
* Tries to load from @
|
|
647
|
+
* Tries to load from @parallaxai/adapter-monitor snapshots first,
|
|
646
648
|
* falls back to hardcoded baseline patterns.
|
|
647
649
|
*
|
|
648
650
|
* @param adapter - Adapter type
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseCLIAdapter, SpawnConfig, AutoResponseRule, LoginDetection, BlockingPromptDetection, ToolRunningInfo, ParsedOutput } from '
|
|
1
|
+
import { BaseCLIAdapter, SpawnConfig, AutoResponseRule, LoginDetection, BlockingPromptDetection, ToolRunningInfo, ParsedOutput } from 'adapter-types';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Approval Presets
|
|
@@ -397,6 +397,8 @@ declare class GeminiAdapter extends BaseCodingAdapter {
|
|
|
397
397
|
getHookTelemetryProtocol(options?: {
|
|
398
398
|
scriptPath?: string;
|
|
399
399
|
markerPrefix?: string;
|
|
400
|
+
httpUrl?: string;
|
|
401
|
+
sessionId?: string;
|
|
400
402
|
}): {
|
|
401
403
|
markerPrefix: string;
|
|
402
404
|
scriptPath: string;
|
|
@@ -612,7 +614,7 @@ declare class HermesAdapter extends BaseCodingAdapter {
|
|
|
612
614
|
/**
|
|
613
615
|
* Dynamic Pattern Loader
|
|
614
616
|
*
|
|
615
|
-
* Loads adapter patterns from @
|
|
617
|
+
* Loads adapter patterns from @parallaxai/adapter-monitor snapshots when available,
|
|
616
618
|
* with fallback to hardcoded baseline patterns.
|
|
617
619
|
*/
|
|
618
620
|
|
|
@@ -642,7 +644,7 @@ interface AdapterPatterns {
|
|
|
642
644
|
/**
|
|
643
645
|
* Load patterns for an adapter
|
|
644
646
|
*
|
|
645
|
-
* Tries to load from @
|
|
647
|
+
* Tries to load from @parallaxai/adapter-monitor snapshots first,
|
|
646
648
|
* falls back to hardcoded baseline patterns.
|
|
647
649
|
*
|
|
648
650
|
* @param adapter - Adapter type
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mkdir, writeFile, appendFile } from 'fs/promises';
|
|
2
2
|
import { join, dirname } from 'path';
|
|
3
|
-
import { BaseCLIAdapter } from '
|
|
3
|
+
import { BaseCLIAdapter } from 'adapter-types';
|
|
4
4
|
|
|
5
5
|
// src/base-coding-adapter.ts
|
|
6
6
|
|
|
@@ -587,6 +587,16 @@ var ClaudeAdapter = class extends BaseCodingAdapter {
|
|
|
587
587
|
* Explicit responseType: 'text' prevents the usesTuiMenus default from kicking in.
|
|
588
588
|
*/
|
|
589
589
|
autoResponseRules = [
|
|
590
|
+
{
|
|
591
|
+
pattern: /choose\s+the\s+text\s+style\s+that\s+looks\s+best\s+with\s+your\s+terminal|syntax\s+theme:/i,
|
|
592
|
+
type: "config",
|
|
593
|
+
response: "",
|
|
594
|
+
responseType: "keys",
|
|
595
|
+
keys: ["enter"],
|
|
596
|
+
description: "Accept Claude first-run theme/style prompt",
|
|
597
|
+
safe: true,
|
|
598
|
+
once: true
|
|
599
|
+
},
|
|
590
600
|
{
|
|
591
601
|
pattern: /trust.*(?:folder|directory)|safety.?check|project.you.created|(?:Yes|Allow).*(?:No|Deny).*(?:Enter|Return)/i,
|
|
592
602
|
type: "permission",
|
|
@@ -1093,7 +1103,8 @@ jq -nc --arg event "${"$"}EVENT" --arg notification_type "${"$"}NOTIFICATION
|
|
|
1093
1103
|
const hasConversationalReadyText = stripped.includes("How can I help") || stripped.includes("What would you like");
|
|
1094
1104
|
const hasLegacyPrompt = /claude>/i.test(tail);
|
|
1095
1105
|
const hasShortcutsHint = stripped.includes("for shortcuts");
|
|
1096
|
-
|
|
1106
|
+
const hasInteractivePromptBar = /❯\s+\S/.test(tail) && (/\/effort/i.test(stripped) || /Welcome back/i.test(stripped) || /Recent activity/i.test(stripped) || /What's new/i.test(stripped));
|
|
1107
|
+
return hasConversationalReadyText || hasLegacyPrompt || hasShortcutsHint || hasInteractivePromptBar;
|
|
1097
1108
|
}
|
|
1098
1109
|
parseOutput(output) {
|
|
1099
1110
|
const withoutHookMarkers = this.stripHookMarkers(output);
|
|
@@ -1249,6 +1260,25 @@ var GeminiAdapter = class extends BaseCodingAdapter {
|
|
|
1249
1260
|
return env;
|
|
1250
1261
|
}
|
|
1251
1262
|
getHookTelemetryProtocol(options) {
|
|
1263
|
+
if (options?.httpUrl) {
|
|
1264
|
+
const sessionHeader = options.sessionId ? ` -H 'X-Parallax-Session-Id: ${options.sessionId}'` : "";
|
|
1265
|
+
const curlCommand = `bash -c 'curl -sf -X POST "${options.httpUrl}" -H "Content-Type: application/json"${sessionHeader} -d @- --max-time 4 2>/dev/null || echo "{\\"continue\\":true}"'`;
|
|
1266
|
+
const hookEntry2 = [{ matcher: "", hooks: [{ type: "command", command: curlCommand, timeout: 5e3 }] }];
|
|
1267
|
+
const hookEntryNoMatcher = [{ hooks: [{ type: "command", command: curlCommand, timeout: 5e3 }] }];
|
|
1268
|
+
const settingsHooks2 = {
|
|
1269
|
+
BeforeTool: hookEntry2,
|
|
1270
|
+
AfterTool: hookEntry2,
|
|
1271
|
+
AfterAgent: hookEntryNoMatcher,
|
|
1272
|
+
SessionEnd: hookEntryNoMatcher,
|
|
1273
|
+
Notification: hookEntry2
|
|
1274
|
+
};
|
|
1275
|
+
return {
|
|
1276
|
+
markerPrefix: "",
|
|
1277
|
+
scriptPath: "",
|
|
1278
|
+
scriptContent: "",
|
|
1279
|
+
settingsHooks: settingsHooks2
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1252
1282
|
const markerPrefix = options?.markerPrefix || GEMINI_HOOK_MARKER_PREFIX;
|
|
1253
1283
|
const scriptPath = options?.scriptPath || ".gemini/hooks/parallax-hook-telemetry.sh";
|
|
1254
1284
|
const scriptCommand = `"${"$"}GEMINI_PROJECT_ROOT"/${scriptPath}`;
|
|
@@ -1926,12 +1956,20 @@ var CodexAdapter = class extends BaseCodingAdapter {
|
|
|
1926
1956
|
return false;
|
|
1927
1957
|
}
|
|
1928
1958
|
detectReady(output) {
|
|
1959
|
+
const rawTail = output.slice(-2e3);
|
|
1960
|
+
const hasRawComposerSignals = /OpenAI\s+Codex/i.test(rawTail) && (/Explain\s+this\s+codebase/i.test(rawTail) || /Summarize\s+recent\s+commits/i.test(rawTail) || /Ask\s+Codex\s+to\s+do\s+anything/i.test(rawTail) || /\?\s+for\s+shortcuts/i.test(rawTail) || /context\s+left/i.test(rawTail));
|
|
1961
|
+
if (hasRawComposerSignals) {
|
|
1962
|
+
return true;
|
|
1963
|
+
}
|
|
1929
1964
|
const stripped = this.stripAnsi(output);
|
|
1930
1965
|
if (!stripped.trim()) return false;
|
|
1931
1966
|
const tail = stripped.slice(-1200);
|
|
1932
1967
|
const hasComposerPrompt = /^\s*›\s*(?!\d+\.)\S.*$/m.test(tail) || /›\s+Ask\s+Codex\s+to\s+do\s+anything/.test(tail);
|
|
1933
1968
|
const hasComposerFooter = /\?\s+for\s+shortcuts/i.test(tail) || /context\s+left/i.test(tail) || /tab\s+to\s+queue\s+message/i.test(tail) || /shift\s*\+\s*enter\s+for\s+newline/i.test(tail);
|
|
1934
|
-
|
|
1969
|
+
const hasStartupComposerHints = /Summarize\s+recent\s+commits/i.test(tail) || /Explain\s+this\s+codebase/i.test(tail) || /Ask\s+Codex\s+to\s+do\s+anything/i.test(tail);
|
|
1970
|
+
const hasCodexHeader = /OpenAI\s+Codex/i.test(tail) && /directory:\s+~?\/?.+/i.test(tail);
|
|
1971
|
+
const hasInteractiveStatusBar = /gpt-[\w.-]+\s+(?:high|medium|low)/i.test(tail) && /left\b/i.test(tail);
|
|
1972
|
+
if (hasComposerPrompt || hasComposerFooter || hasStartupComposerHints || hasCodexHeader && hasInteractiveStatusBar) {
|
|
1935
1973
|
return true;
|
|
1936
1974
|
}
|
|
1937
1975
|
if (/do.?you.?trust.?the.?contents/i.test(stripped) || /sign.?in.?with.?chatgpt/i.test(stripped) || /update.?available/i.test(stripped) || /enable.?full.?access/i.test(stripped) || /choose.?working.?directory/i.test(stripped)) {
|
|
@@ -2040,6 +2078,14 @@ var AiderAdapter = class extends BaseCodingAdapter {
|
|
|
2040
2078
|
description: "Decline automatic bug report",
|
|
2041
2079
|
safe: true
|
|
2042
2080
|
},
|
|
2081
|
+
{
|
|
2082
|
+
pattern: /open documentation url for more info\?/i,
|
|
2083
|
+
type: "config",
|
|
2084
|
+
response: "n",
|
|
2085
|
+
responseType: "text",
|
|
2086
|
+
description: "Decline opening Aider documentation for model warnings",
|
|
2087
|
+
safe: true
|
|
2088
|
+
},
|
|
2043
2089
|
// ── File / edit operations ──────────────────────────────────────────
|
|
2044
2090
|
{
|
|
2045
2091
|
pattern: /add .+ to the chat\?/i,
|
|
@@ -2213,8 +2259,9 @@ var AiderAdapter = class extends BaseCodingAdapter {
|
|
|
2213
2259
|
}
|
|
2214
2260
|
getArgs(config) {
|
|
2215
2261
|
const args = [];
|
|
2216
|
-
|
|
2217
|
-
if (!
|
|
2262
|
+
const interactive = this.isInteractive(config);
|
|
2263
|
+
if (!interactive) {
|
|
2264
|
+
args.push("--auto-commits");
|
|
2218
2265
|
args.push("--no-pretty");
|
|
2219
2266
|
args.push("--no-show-diffs");
|
|
2220
2267
|
}
|
|
@@ -2222,22 +2269,26 @@ var AiderAdapter = class extends BaseCodingAdapter {
|
|
|
2222
2269
|
const credentials = this.getCredentials(config);
|
|
2223
2270
|
if (config.env?.AIDER_MODEL) {
|
|
2224
2271
|
args.push("--model", config.env.AIDER_MODEL);
|
|
2225
|
-
} else if (
|
|
2272
|
+
} else if (interactive && (credentials.googleKey || process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY)) {
|
|
2273
|
+
args.push("--model", "gemini");
|
|
2274
|
+
} else if (!interactive && provider === "anthropic") {
|
|
2226
2275
|
args.push("--model", "sonnet");
|
|
2227
|
-
} else if (provider === "openai") {
|
|
2276
|
+
} else if (!interactive && provider === "openai") {
|
|
2228
2277
|
args.push("--model", "4o");
|
|
2229
|
-
} else if (provider === "google") {
|
|
2278
|
+
} else if (!interactive && provider === "google") {
|
|
2230
2279
|
args.push("--model", "gemini");
|
|
2231
|
-
} else if (credentials.anthropicKey) {
|
|
2280
|
+
} else if (!interactive && credentials.anthropicKey) {
|
|
2232
2281
|
args.push("--model", "sonnet");
|
|
2233
|
-
} else if (credentials.openaiKey) {
|
|
2282
|
+
} else if (!interactive && credentials.openaiKey) {
|
|
2234
2283
|
args.push("--model", "4o");
|
|
2235
|
-
} else if (credentials.googleKey) {
|
|
2284
|
+
} else if (!interactive && credentials.googleKey) {
|
|
2236
2285
|
args.push("--model", "gemini");
|
|
2237
2286
|
}
|
|
2238
|
-
if (
|
|
2239
|
-
|
|
2240
|
-
|
|
2287
|
+
if (!interactive) {
|
|
2288
|
+
if (credentials.anthropicKey) args.push("--api-key", `anthropic=${credentials.anthropicKey}`);
|
|
2289
|
+
if (credentials.openaiKey) args.push("--api-key", `openai=${credentials.openaiKey}`);
|
|
2290
|
+
if (credentials.googleKey) args.push("--api-key", `gemini=${credentials.googleKey}`);
|
|
2291
|
+
}
|
|
2241
2292
|
const approvalConfig = this.getApprovalConfig(config);
|
|
2242
2293
|
if (approvalConfig) {
|
|
2243
2294
|
args.push(...approvalConfig.cliFlags);
|