toc-ocra 0.3.7 → 0.3.8
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/README.md +12 -5
- package/dist/cli/cli.mjs +2679 -2264
- package/dist/plugin/renderer.js.map +1 -1
- package/dist/service/agent.mjs +3838 -3423
- package/dist/src/acp/acp-dialects/acp-dialect.d.ts +38 -0
- package/dist/src/acp/acp-dialects/acp-dialect.js +3 -0
- package/dist/src/acp/acp-dialects/acp-dialect.js.map +1 -0
- package/dist/src/acp/acp-dialects/gemini-dialect.d.ts +5 -0
- package/dist/src/acp/acp-dialects/gemini-dialect.js +7 -0
- package/dist/src/acp/acp-dialects/gemini-dialect.js.map +1 -0
- package/dist/src/acp/acp-dialects/grok-dialect.d.ts +2 -0
- package/dist/src/acp/acp-dialects/grok-dialect.js +39 -0
- package/dist/src/acp/acp-dialects/grok-dialect.js.map +1 -0
- package/dist/src/acp/acp-dialects/kiro-dialect.d.ts +3 -0
- package/dist/src/acp/acp-dialects/kiro-dialect.js +20 -0
- package/dist/src/acp/acp-dialects/kiro-dialect.js.map +1 -0
- package/dist/src/acp/acp-dialects/omp-dialect.d.ts +2 -0
- package/dist/src/acp/acp-dialects/omp-dialect.js +35 -0
- package/dist/src/acp/acp-dialects/omp-dialect.js.map +1 -0
- package/dist/src/acp/acp-dialects/opencode-dialect.d.ts +2 -0
- package/dist/src/acp/acp-dialects/opencode-dialect.js +35 -0
- package/dist/src/acp/acp-dialects/opencode-dialect.js.map +1 -0
- package/dist/src/acp/acp-launch-specs.d.ts +117 -0
- package/dist/src/acp/acp-launch-specs.js +205 -0
- package/dist/src/acp/acp-launch-specs.js.map +1 -0
- package/dist/src/acp/acp-model-catalog-probe.d.ts +6 -0
- package/dist/src/acp/acp-model-catalog-probe.js +61 -0
- package/dist/src/acp/acp-model-catalog-probe.js.map +1 -0
- package/dist/src/acp/acp-options.d.ts +105 -0
- package/dist/src/acp/acp-options.js +182 -0
- package/dist/src/acp/acp-options.js.map +1 -0
- package/dist/src/acp/acp-session-setup.d.ts +30 -0
- package/dist/src/acp/acp-session-setup.js +56 -0
- package/dist/src/acp/acp-session-setup.js.map +1 -0
- package/dist/src/acp/chat-agents.d.ts +13 -20
- package/dist/src/acp/chat-agents.js +28 -126
- package/dist/src/acp/chat-agents.js.map +1 -1
- package/dist/src/acp/chat-session.d.ts +7 -11
- package/dist/src/acp/chat-session.js +46 -82
- package/dist/src/acp/chat-session.js.map +1 -1
- package/dist/src/acp/connection.d.ts +22 -30
- package/dist/src/acp/connection.js +31 -65
- package/dist/src/acp/connection.js.map +1 -1
- package/dist/src/index.js +0 -0
- package/dist/src/providers/acp/acp-driver.d.ts +25 -44
- package/dist/src/providers/acp/acp-driver.js +156 -66
- package/dist/src/providers/acp/acp-driver.js.map +1 -1
- package/dist/src/providers/chat/index.d.ts +2 -2
- package/dist/src/providers/chat/index.js +2 -2
- package/dist/src/providers/chat/index.js.map +1 -1
- package/dist/src/providers/cli-specs.d.ts +4 -2
- package/dist/src/providers/cli-specs.js +1 -0
- package/dist/src/providers/cli-specs.js.map +1 -1
- package/dist/src/providers/cli-versions.d.ts +6 -0
- package/dist/src/providers/cli-versions.js +17 -0
- package/dist/src/providers/cli-versions.js.map +1 -0
- package/dist/src/providers/detection.js +3 -0
- package/dist/src/providers/detection.js.map +1 -1
- package/dist/src/providers/kiro-auth.d.ts +6 -0
- package/dist/src/providers/kiro-auth.js +43 -0
- package/dist/src/providers/kiro-auth.js.map +1 -0
- package/dist/src/providers/kiro-quota.js +2 -0
- package/dist/src/providers/kiro-quota.js.map +1 -1
- package/dist/src/providers/model-catalog.js +2 -0
- package/dist/src/providers/model-catalog.js.map +1 -1
- package/dist/src/providers/registry.d.ts +5 -4
- package/dist/src/providers/registry.js +48 -17
- package/dist/src/providers/registry.js.map +1 -1
- package/dist/src/runtime/agent-runtime.js +3 -3
- package/dist/src/runtime/agent-runtime.js.map +1 -1
- package/package.json +1 -1
- package/dist/src/providers/acp/acp-agents.d.ts +0 -14
- package/dist/src/providers/acp/acp-agents.js +0 -55
- package/dist/src/providers/acp/acp-agents.js.map +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CliFailureRule } from '../../providers/cli-failure.js';
|
|
2
|
+
/**
|
|
3
|
+
* A CLI's departures from plain ACP, as hooks over the shared lifecycle: the
|
|
4
|
+
* counterpart of Orca's `AcpDialect` ("hooks interpret extensions; lifecycle
|
|
5
|
+
* and row identity stay shared"). Every hook is optional, and
|
|
6
|
+
* `GENERIC_ACP_DIALECT` (no hooks) runs any agent that follows the protocol.
|
|
7
|
+
*
|
|
8
|
+
* Orca's hooks for its own UI (subagents, background tasks, compaction,
|
|
9
|
+
* question cards) have no Echo counterpart and are left out; Orca's error
|
|
10
|
+
* hooks (`promptFailure`, `authenticationRequired`, `sessionLost`) are
|
|
11
|
+
* `failureRules` here, the shared failure vocabulary of cli-failure.ts.
|
|
12
|
+
*/
|
|
13
|
+
export type AcpError = {
|
|
14
|
+
code?: number;
|
|
15
|
+
message?: string;
|
|
16
|
+
data?: unknown;
|
|
17
|
+
};
|
|
18
|
+
export type AcpDialect = {
|
|
19
|
+
/** The agent's wording for sign-in, quota and missing-session errors, before the common rules. */
|
|
20
|
+
failureRules?: readonly CliFailureRule[];
|
|
21
|
+
/** The readable part of an error's `data`, when the agent nests its message there. */
|
|
22
|
+
promptErrorDetail?(error: AcpError): string | undefined;
|
|
23
|
+
/** Normalizes a tool update before it is read: shell output in `rawOutput.stdout`, exit code in `rawOutput.exitCode`. */
|
|
24
|
+
normalizeToolUpdate?(update: Record<string, unknown>): Record<string, unknown>;
|
|
25
|
+
/** The tool's name when the update's title describes the call instead. */
|
|
26
|
+
toolName?(update: Record<string, unknown>): string | undefined;
|
|
27
|
+
/** Run-log rows for a vendor notification outside `session/update`; undefined: not this dialect's. */
|
|
28
|
+
notification?(method: string, params: Record<string, unknown>): string[] | undefined;
|
|
29
|
+
/** Effort choices a listed model advertises in its `ModelInfo` (`_meta`), for the model catalog. */
|
|
30
|
+
modelEfforts?(model: Record<string, unknown>): {
|
|
31
|
+
efforts: string[];
|
|
32
|
+
defaultEffort?: string;
|
|
33
|
+
} | undefined;
|
|
34
|
+
/** stderr lines worth showing in the run log (the rest is the agent's diagnostics). */
|
|
35
|
+
stderrDisplay?(line: string): string[];
|
|
36
|
+
};
|
|
37
|
+
export declare const GENERIC_ACP_DIALECT: AcpDialect;
|
|
38
|
+
export declare const record: (value: unknown) => Record<string, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acp-dialect.js","sourceRoot":"","sources":["../../../../src/acp/acp-dialects/acp-dialect.ts"],"names":[],"mappings":"AAgCA,MAAM,CAAC,MAAM,mBAAmB,GAAe,EAAE,CAAA;AAEjD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAc,EAA2B,EAAE,CAChE,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,KAAiC,CAAC,CAAC,CAAC,EAAE,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CliFailureRule } from '../../providers/cli-failure.js';
|
|
2
|
+
import type { AcpDialect } from './acp-dialect.js';
|
|
3
|
+
export declare const GEMINI_FAILURE_RULES: readonly CliFailureRule[];
|
|
4
|
+
/** Gemini CLI `--acp`: plain ACP; only its error wording differs. */
|
|
5
|
+
export declare const GEMINI_ACP_DIALECT: AcpDialect;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const GEMINI_FAILURE_RULES = [
|
|
2
|
+
{ kind: 'sessionMissing', pattern: /session[^\n]{0,60}(?:not found|does not exist)|no session found|invalid session/i },
|
|
3
|
+
{ kind: 'notSignedIn', pattern: /api key is missing|not configured|login required|please (?:log|sign) ?in/i }
|
|
4
|
+
];
|
|
5
|
+
/** Gemini CLI `--acp`: plain ACP; only its error wording differs. */
|
|
6
|
+
export const GEMINI_ACP_DIALECT = { failureRules: GEMINI_FAILURE_RULES };
|
|
7
|
+
//# sourceMappingURL=gemini-dialect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini-dialect.js","sourceRoot":"","sources":["../../../../src/acp/acp-dialects/gemini-dialect.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,oBAAoB,GAA8B;IAC7D,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,kFAAkF,EAAE;IACvH,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,2EAA2E,EAAE;CAC9G,CAAA;AAED,qEAAqE;AACrE,MAAM,CAAC,MAAM,kBAAkB,GAAe,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { record } from './acp-dialect.js';
|
|
2
|
+
/**
|
|
3
|
+
* Grok Build `grok agent stdio` (Orca's `GROK_ACP_DIALECT`, the parts Echo
|
|
4
|
+
* shows): tool names in `_meta["x.ai/tool"]`, error text in `data.message`,
|
|
5
|
+
* each model's effort choices in its `_meta`. Its `x.ai/…` notices (queue,
|
|
6
|
+
* MCP and session bookkeeping) have nothing for the run log.
|
|
7
|
+
*/
|
|
8
|
+
function modelEfforts(model) {
|
|
9
|
+
const meta = record(model._meta);
|
|
10
|
+
if (meta.supportsReasoningEffort !== true || !Array.isArray(meta.reasoningEfforts))
|
|
11
|
+
return undefined;
|
|
12
|
+
const efforts = [];
|
|
13
|
+
let defaultEffort;
|
|
14
|
+
for (const raw of meta.reasoningEfforts) {
|
|
15
|
+
// Choices use Grok's config ids, not the underlying sampling values.
|
|
16
|
+
const entry = typeof raw === 'string' ? { value: raw } : record(raw);
|
|
17
|
+
const value = typeof entry.value === 'string' ? entry.value : undefined;
|
|
18
|
+
const id = typeof entry.id === 'string' && entry.id ? entry.id : value;
|
|
19
|
+
if (!id)
|
|
20
|
+
continue;
|
|
21
|
+
efforts.push(id);
|
|
22
|
+
if (!defaultEffort && (entry.default === true || value === meta.reasoningEffort))
|
|
23
|
+
defaultEffort = id;
|
|
24
|
+
}
|
|
25
|
+
return efforts.length ? { efforts, ...(defaultEffort ? { defaultEffort } : {}) } : undefined;
|
|
26
|
+
}
|
|
27
|
+
export const GROK_ACP_DIALECT = {
|
|
28
|
+
toolName: (update) => {
|
|
29
|
+
const name = record(record(update._meta)['x.ai/tool']).name;
|
|
30
|
+
return typeof name === 'string' && name ? name : undefined;
|
|
31
|
+
},
|
|
32
|
+
promptErrorDetail: (error) => {
|
|
33
|
+
const message = record(error.data).message;
|
|
34
|
+
return typeof message === 'string' && message ? message : undefined;
|
|
35
|
+
},
|
|
36
|
+
modelEfforts,
|
|
37
|
+
notification: (method) => (/^_?x\.ai\//.test(method) ? [] : undefined)
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=grok-dialect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grok-dialect.js","sourceRoot":"","sources":["../../../../src/acp/acp-dialects/grok-dialect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAmB,MAAM,kBAAkB,CAAA;AAE1D;;;;;GAKG;AACH,SAAS,YAAY,CAAC,KAA8B;IAClD,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAChC,IAAI,IAAI,CAAC,uBAAuB,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC;QAAE,OAAO,SAAS,CAAA;IACpG,MAAM,OAAO,GAAa,EAAE,CAAA;IAC5B,IAAI,aAAiC,CAAA;IACrC,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxC,qEAAqE;QACrE,MAAM,KAAK,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,M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AC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAA;IACrE,CAAC;IACD,YAAY;IACZ,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;CACvE,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isKiroNoise, KIRO_FAILURE_RULES } from '../../providers/cli/kiro.js';
|
|
2
|
+
import { runLog } from '../../providers/provider.js';
|
|
3
|
+
import { record } from './acp-dialect.js';
|
|
4
|
+
/** kiro-cli ACP: its failure wording, its stderr noise, `_kiro.dev/…` notices and tool names in `_meta.kiro`. */
|
|
5
|
+
export const KIRO_ACP_DIALECT = {
|
|
6
|
+
failureRules: KIRO_FAILURE_RULES,
|
|
7
|
+
stderrDisplay: (line) => (isKiroNoise(line.trim()) ? [] : [line]),
|
|
8
|
+
toolName: (update) => {
|
|
9
|
+
const name = record(record(update._meta).kiro).toolName;
|
|
10
|
+
return typeof name === 'string' && name ? name : undefined;
|
|
11
|
+
},
|
|
12
|
+
notification(method, params) {
|
|
13
|
+
if (method !== '_kiro.dev/session/update')
|
|
14
|
+
return undefined;
|
|
15
|
+
if (params.sessionUpdate === 'retry_warning' && typeof params.message === 'string')
|
|
16
|
+
return [runLog.event(`Kiro 服务重试:${params.message}`)];
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=kiro-dialect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kiro-dialect.js","sourceRoot":"","sources":["../../../../src/acp/acp-dialects/kiro-dialect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AACpD,OAAO,EAAE,MAAM,EAAmB,MAAM,kBAAkB,CAAA;AAE1D,iHAAiH;AACjH,MAAM,CAAC,MAAM,gBAAgB,GAAe;IAC1C,YAAY,EAAE,kBAAkB;IAChC,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACjE,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;QACnB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAA;QACvD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;IAC5D,CAAC;IACD,YAAY,CAAC,MAAM,EAAE,MAAM;QACzB,IAAI,MAAM,KAAK,0BAA0B;YAAE,OAAO,SAAS,CAAA;QAC3D,IAAI,MAAM,CAAC,aAAa,KAAK,eAAe,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ;YAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;QACxI,OAAO,EAAE,CAAA;IACX,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { record } from './acp-dialect.js';
|
|
2
|
+
/**
|
|
3
|
+
* OMP `omp acp` (Orca's `OMP_ACP_DIALECT`): a shell result is text blocks
|
|
4
|
+
* plus `details.exitCode` in `rawOutput`; signed-out and dropped-session
|
|
5
|
+
* errors are `-32603` with the reason in `data.details`.
|
|
6
|
+
*/
|
|
7
|
+
function normalizeToolUpdate(update) {
|
|
8
|
+
const rawOutput = record(update.rawOutput);
|
|
9
|
+
if (!Array.isArray(rawOutput.content))
|
|
10
|
+
return update;
|
|
11
|
+
if (['exitCode', 'exit_code', 'stdout', 'stderr'].some((key) => rawOutput[key] !== undefined))
|
|
12
|
+
return update;
|
|
13
|
+
const texts = rawOutput.content.map(record).flatMap((block) => (block.type === 'text' && typeof block.text === 'string' ? [block.text] : []));
|
|
14
|
+
const exitCode = record(rawOutput.details).exitCode;
|
|
15
|
+
return {
|
|
16
|
+
...update,
|
|
17
|
+
rawOutput: {
|
|
18
|
+
...rawOutput,
|
|
19
|
+
...(texts.length ? { stdout: texts.join('\n').replace(/\n\nCommand exited with code -?\d+$/, '') } : {}),
|
|
20
|
+
...(typeof exitCode === 'number' && Number.isInteger(exitCode) ? { exitCode } : {})
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export const OMP_ACP_DIALECT = {
|
|
25
|
+
normalizeToolUpdate,
|
|
26
|
+
promptErrorDetail: (error) => {
|
|
27
|
+
const details = record(error.data).details;
|
|
28
|
+
return typeof details === 'string' && details ? details : undefined;
|
|
29
|
+
},
|
|
30
|
+
failureRules: [
|
|
31
|
+
{ kind: 'notSignedIn', pattern: /No model selected\.\s+Use \/login|No API key found for / },
|
|
32
|
+
{ kind: 'sessionMissing', pattern: /Unsupported ACP session/ }
|
|
33
|
+
]
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=omp-dialect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omp-dialect.js","sourceRoot":"","sources":["../../../../src/acp/acp-dialects/omp-dialect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAmB,MAAM,kBAAkB,CAAA;AAE1D;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,MAA+B;IAC1D,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAC1C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC;QAAE,OAAO,MAAM,CAAA;IACpD,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,QA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AC;IACD,YAAY,EAAE;QACZ,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,yDAAyD,EAAE;QAC3F,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,yBAAyB,EAAE;KAC/D;CACF,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { record } from './acp-dialect.js';
|
|
2
|
+
/**
|
|
3
|
+
* OpenCode `opencode acp` (Orca's `OPENCODE_ACP_DIALECT`): shell output and
|
|
4
|
+
* exit code arrive in `rawOutput.metadata`; quota and rate-limit failures are
|
|
5
|
+
* named in the error's `data.errorName`.
|
|
6
|
+
*/
|
|
7
|
+
function normalizeToolUpdate(update) {
|
|
8
|
+
const raw = update.rawOutput;
|
|
9
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
10
|
+
return update;
|
|
11
|
+
const rawOutput = raw;
|
|
12
|
+
const metadata = record(rawOutput.metadata);
|
|
13
|
+
const output = typeof rawOutput.output === 'string' ? rawOutput.output : typeof metadata.output === 'string' ? metadata.output : undefined;
|
|
14
|
+
const exitCode = typeof metadata.exit === 'number' && Number.isInteger(metadata.exit) ? metadata.exit : undefined;
|
|
15
|
+
const hasOutput = ['stdout', 'stderr', 'output_for_prompt'].some((key) => rawOutput[key] !== undefined);
|
|
16
|
+
const hasExit = rawOutput.exitCode !== undefined || rawOutput.exit_code !== undefined;
|
|
17
|
+
if ((output === undefined || hasOutput) && (exitCode === undefined || hasExit))
|
|
18
|
+
return update;
|
|
19
|
+
return {
|
|
20
|
+
...update,
|
|
21
|
+
rawOutput: {
|
|
22
|
+
...rawOutput,
|
|
23
|
+
...(output === undefined || hasOutput ? {} : { stdout: output }),
|
|
24
|
+
...(exitCode === undefined || hasExit ? {} : { exitCode })
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export const OPENCODE_ACP_DIALECT = {
|
|
29
|
+
normalizeToolUpdate,
|
|
30
|
+
failureRules: [
|
|
31
|
+
{ kind: 'usageLimit', pattern: /"errorName"\s*:\s*"provider\.quota"/ },
|
|
32
|
+
{ kind: 'rateLimited', pattern: /"errorName"\s*:\s*"provider\.rate-limit"/ }
|
|
33
|
+
]
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=opencode-dialect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opencode-dialect.js","sourceRoot":"","sources":["../../../../src/acp/acp-dialects/opencode-dialect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAmB,MAAM,kBAAkB,CAAA;AAE1D;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,MAA+B;IAC1D,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAA;IAC5B,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,MAAM,CAAA;IACxE,MAAM,SAAS,GAAG,GAA8B,CAAA;IAChD,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IAC3C,MAAM,MAAM,GAAG,OAAO,SAAS,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;IAC1I,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;IACjH,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAA;IACvG,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,KAAK,SAAS,IAAI,SAAS,CAAC,SAAS,KAAK,SAAS,CAAA;IACrF,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,SAAS,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC;QAAE,OAAO,MAAM,CAAA;IAC7F,OAAO;QACL,GAAG,MAAM;QACT,SAAS,EAAE;YACT,GAAG,SAAS;YACZ,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;YAChE,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;SAC3D;KACF,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAe;IAC9C,mBAAmB;IACnB,YAAY,EAAE;QACZ,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,qCAAqC,EAAE;QACtE,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,0CAA0C,EAAE;KAC7E;CACF,CAAA"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { type ModelSource } from '../providers/model-catalog.js';
|
|
2
|
+
import { type AgentAccess, type RunSettingsSupport } from '../providers/provider.js';
|
|
3
|
+
import type { AgentLaunch } from './agent-process.js';
|
|
4
|
+
import type { AcpDialect } from './acp-dialects/acp-dialect.js';
|
|
5
|
+
import type { AcpAuthMethodPicker } from './acp-session-setup.js';
|
|
6
|
+
import type { TurnAccess } from './chat-agents.js';
|
|
7
|
+
/**
|
|
8
|
+
* Every CLI this device runs over the Agent Client Protocol, one row each:
|
|
9
|
+
* the counterpart of Orca's `ACP_LAUNCH_SPECS`. A row is data plus a
|
|
10
|
+
* dialect; everything else is shared and follows from it:
|
|
11
|
+
*
|
|
12
|
+
* - task runs: one ACP process per turn (providers/acp/acp-driver.ts);
|
|
13
|
+
* - live chat: one long-lived ACP process per Echo session (chat-session.ts);
|
|
14
|
+
* - session open / resume, sign-in retry (acp-session-setup.ts);
|
|
15
|
+
* - mode, model, effort and fast mode (acp-options.ts);
|
|
16
|
+
* - permission answers by tool kind and access level;
|
|
17
|
+
* - the model catalog (`modelDiscovery`), run settings for the heartbeat,
|
|
18
|
+
* and the registry entry (providers/registry.ts maps this table).
|
|
19
|
+
*
|
|
20
|
+
* Adding an ACP CLI: its detection row in cli-specs.ts plus one row here;
|
|
21
|
+
* a dialect only when it extends or bends the protocol.
|
|
22
|
+
*/
|
|
23
|
+
export type AcpLaunchInput = {
|
|
24
|
+
/** The turn's level: the owner's restricted cap, 每次询问 (`default`) or a session level. */
|
|
25
|
+
access: TurnAccess;
|
|
26
|
+
model: string;
|
|
27
|
+
reasoningEffort: string;
|
|
28
|
+
};
|
|
29
|
+
export type AcpServerLaunch = {
|
|
30
|
+
launch: AgentLaunch;
|
|
31
|
+
fingerprint: string;
|
|
32
|
+
};
|
|
33
|
+
/** Where the model picker's list comes from (Orca's `AcpModelDiscovery`). */
|
|
34
|
+
export type AcpModelDiscovery =
|
|
35
|
+
/** A reader of the CLI's own files or list command (providers/model-catalog.ts). */
|
|
36
|
+
{
|
|
37
|
+
kind: 'reader';
|
|
38
|
+
source: ModelSource;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A disposable session's options. Needs `session/delete`, or a
|
|
42
|
+
* `sessionFolderArgs` that puts the session's storage in a folder removed
|
|
43
|
+
* afterwards; otherwise every listing would leave a conversation behind.
|
|
44
|
+
*/
|
|
45
|
+
| {
|
|
46
|
+
kind: 'session';
|
|
47
|
+
sessionFolderArgs?(folder: string): string[];
|
|
48
|
+
} | {
|
|
49
|
+
kind: 'unavailable';
|
|
50
|
+
reason: string;
|
|
51
|
+
};
|
|
52
|
+
export type AcpLaunchSpec = {
|
|
53
|
+
/** The CLI's id in cli-specs.ts. */
|
|
54
|
+
agent: string;
|
|
55
|
+
/**
|
|
56
|
+
* Task runs: `acp` runs them over this server; `native` keeps the CLI's own
|
|
57
|
+
* headless driver (Claude Code, Codex) and uses ACP for live chat only.
|
|
58
|
+
*/
|
|
59
|
+
headless: 'acp' | 'native';
|
|
60
|
+
/** ACP server arguments for the installed CLI. */
|
|
61
|
+
args(input: AcpLaunchInput): string[];
|
|
62
|
+
/** An adapter that serves ACP over the installed CLI (Lody's Claude / Codex adapters) instead of the CLI itself. */
|
|
63
|
+
adapter?(input: AcpLaunchInput & {
|
|
64
|
+
workdir: string;
|
|
65
|
+
dataDir: string;
|
|
66
|
+
}): Promise<AcpServerLaunch>;
|
|
67
|
+
/** Applied after the user's environment. */
|
|
68
|
+
env?: Readonly<Record<string, string>>;
|
|
69
|
+
dialect: AcpDialect;
|
|
70
|
+
/** The advertised method to `authenticate` with after `auth_required`; undefined leaves the CLI signed out. */
|
|
71
|
+
authMethod?: AcpAuthMethodPicker;
|
|
72
|
+
/** Ascending release-line minimums for the ACP server; older releases use the CLI's previous driver. */
|
|
73
|
+
minimumVersions?: readonly string[];
|
|
74
|
+
/** Settings the launch arguments already apply; they are not set again over ACP. */
|
|
75
|
+
launchApplies?: {
|
|
76
|
+
model?: true;
|
|
77
|
+
reasoningEffort?: true;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Agent-enforced modes: the mode set for each level (`ask` for the others),
|
|
81
|
+
* with `session/set_mode` or the `mode` config option. Without it the
|
|
82
|
+
* driver enforces the level by answering permission requests.
|
|
83
|
+
*/
|
|
84
|
+
permissionModeConfig?: {
|
|
85
|
+
values: {
|
|
86
|
+
ask: string;
|
|
87
|
+
} & Partial<Record<AgentAccess | 'plan', string>>;
|
|
88
|
+
};
|
|
89
|
+
/** Whether a saved session id can be reopened; others start fresh. */
|
|
90
|
+
resumable?(sessionId: string): boolean;
|
|
91
|
+
/** Prefer `session/resume` even when loading is supported (loading replays the conversation). */
|
|
92
|
+
resumePreference?: 'resume';
|
|
93
|
+
modelDiscovery: AcpModelDiscovery;
|
|
94
|
+
/** What the shared driver enforces for task runs; absent: `ACP_RUN_SETTINGS`. */
|
|
95
|
+
runSettings?: RunSettingsSupport;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Run settings of an ACP task run: every level, enforced by answering the
|
|
99
|
+
* agent's permission requests by tool kind; plan mode as a read-only turn
|
|
100
|
+
* with the plan prompt. (Orca's `ACP_CHAT_PERMISSION_MODES` for every ACP row.)
|
|
101
|
+
*/
|
|
102
|
+
export declare const ACP_RUN_SETTINGS: RunSettingsSupport;
|
|
103
|
+
export declare const ACP_LAUNCH_SPECS: readonly AcpLaunchSpec[];
|
|
104
|
+
export declare function acpLaunchSpecFor(agent: string): AcpLaunchSpec | undefined;
|
|
105
|
+
/** The agent's mode for this turn (plan first), for rows with agent-enforced modes. */
|
|
106
|
+
export declare function acpModeFor(spec: Pick<AcpLaunchSpec, 'permissionModeConfig'>, access: TurnAccess, plan: boolean): string | undefined;
|
|
107
|
+
/** The release-line minimum that applies to `version` (Orca's `agentCliMinimumVersion`). */
|
|
108
|
+
export declare function acpMinimumVersion(version: string, minimumVersions: readonly string[]): string | undefined;
|
|
109
|
+
/** `a` compared with `b` as dotted numbers (`1.18.31` < `1.20`). */
|
|
110
|
+
export declare function compareVersions(a: string, b: string): number;
|
|
111
|
+
/** The dotted version in a `--version` line (`opencode 1.18.31`, `v17.0.5 (abc)`). */
|
|
112
|
+
export declare function versionNumber(text: string | undefined): string | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* Whether this release serves the row's ACP server: true without minimums
|
|
115
|
+
* or a known version (the launch then reports what fails).
|
|
116
|
+
*/
|
|
117
|
+
export declare function acpVersionSupported(spec: Pick<AcpLaunchSpec, 'minimumVersions'>, detectedVersion: string | undefined): boolean;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { realpathSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { cliCommand, requireCliSpec } from '../providers/cli-specs.js';
|
|
4
|
+
import { codexCatalogOverlay, prepareCodexCatalog } from '../providers/cli/codex-catalog.js';
|
|
5
|
+
import { MODEL_SOURCES } from '../providers/model-catalog.js';
|
|
6
|
+
import { providerEnvironment } from '../providers/provider.js';
|
|
7
|
+
import { findCliCommand } from '../shared/node-cli-command-resolution.js';
|
|
8
|
+
import { GEMINI_ACP_DIALECT } from './acp-dialects/gemini-dialect.js';
|
|
9
|
+
import { GROK_ACP_DIALECT } from './acp-dialects/grok-dialect.js';
|
|
10
|
+
import { KIRO_ACP_DIALECT } from './acp-dialects/kiro-dialect.js';
|
|
11
|
+
import { OMP_ACP_DIALECT } from './acp-dialects/omp-dialect.js';
|
|
12
|
+
import { OPENCODE_ACP_DIALECT } from './acp-dialects/opencode-dialect.js';
|
|
13
|
+
import { AcpRuntimeUnavailable, ensureClaudeRuntime, vendoredAdapter } from './vendor.js';
|
|
14
|
+
/**
|
|
15
|
+
* Run settings of an ACP task run: every level, enforced by answering the
|
|
16
|
+
* agent's permission requests by tool kind; plan mode as a read-only turn
|
|
17
|
+
* with the plan prompt. (Orca's `ACP_CHAT_PERMISSION_MODES` for every ACP row.)
|
|
18
|
+
*/
|
|
19
|
+
export const ACP_RUN_SETTINGS = { permissionModes: ['read-only', 'acceptEdits', 'bypassPermissions'], plan: 'prompt' };
|
|
20
|
+
/** Below full access only Echo's callback is trusted up front; the driver answers the rest. */
|
|
21
|
+
const KIRO_TRUSTED_CALLBACK = '--trust-tools=@doer/echo_report_task_progress';
|
|
22
|
+
const KIRO_LAUNCH_SPEC = {
|
|
23
|
+
agent: 'kiro',
|
|
24
|
+
headless: 'acp',
|
|
25
|
+
args: ({ access, reasoningEffort }) => [
|
|
26
|
+
'acp',
|
|
27
|
+
access === 'bypassPermissions' ? '--trust-all-tools' : KIRO_TRUSTED_CALLBACK,
|
|
28
|
+
...(reasoningEffort ? ['--effort', reasoningEffort] : [])
|
|
29
|
+
],
|
|
30
|
+
// The model goes over ACP (`session/set_model`), for new and reopened sessions alike.
|
|
31
|
+
launchApplies: { reasoningEffort: true },
|
|
32
|
+
dialect: KIRO_ACP_DIALECT,
|
|
33
|
+
// `sess_…` ids are Kiro IDE (v3 engine) chats: never write into someone's IDE chat.
|
|
34
|
+
resumable: (sessionId) => !sessionId.startsWith('sess_'),
|
|
35
|
+
modelDiscovery: { kind: 'reader', source: MODEL_SOURCES.kiro }
|
|
36
|
+
};
|
|
37
|
+
const GEMINI_LAUNCH_SPEC = {
|
|
38
|
+
agent: 'gemini',
|
|
39
|
+
headless: 'acp',
|
|
40
|
+
// Below full access Gemini asks before editing or running anything.
|
|
41
|
+
args: ({ access, model }) => ['--acp', ...(access === 'bypassPermissions' ? ['--yolo'] : ['--approval-mode', 'default']), ...(model ? ['--model', model] : [])],
|
|
42
|
+
launchApplies: { model: true },
|
|
43
|
+
dialect: GEMINI_ACP_DIALECT,
|
|
44
|
+
modelDiscovery: { kind: 'reader', source: MODEL_SOURCES.gemini }
|
|
45
|
+
};
|
|
46
|
+
/** Orca's `GROK_LAUNCH_SPEC`. */
|
|
47
|
+
const GROK_LAUNCH_SPEC = {
|
|
48
|
+
agent: 'grok',
|
|
49
|
+
headless: 'acp',
|
|
50
|
+
args: ({ access }) => ['agent', ...(access === 'bypassPermissions' ? ['--always-approve'] : []), 'stdio'],
|
|
51
|
+
dialect: GROK_ACP_DIALECT,
|
|
52
|
+
// The launch environment's API key, then a cached sign-in; never an interactive one.
|
|
53
|
+
authMethod: ({ advertised, env }) => env.XAI_API_KEY?.trim() && advertised.includes('xai.api_key') ? 'xai.api_key' : advertised.includes('cached_token') ? 'cached_token' : undefined,
|
|
54
|
+
modelDiscovery: { kind: 'reader', source: MODEL_SOURCES.grok }
|
|
55
|
+
};
|
|
56
|
+
/** Orca's `OPENCODE_LAUNCH_SPEC`: verified release lines 1.18.31 and 2.0.14. */
|
|
57
|
+
const OPENCODE_LAUNCH_SPEC = {
|
|
58
|
+
agent: 'opencode',
|
|
59
|
+
headless: 'acp',
|
|
60
|
+
// No bypass flag; full access approves permission requests one by one.
|
|
61
|
+
args: () => ['acp'],
|
|
62
|
+
// Question forms are unsupported: 1.x waits forever, 2.x drops them.
|
|
63
|
+
env: { OPENCODE_CLIENT: 'acp', OPENCODE_ENABLE_QUESTION_TOOL: 'false' },
|
|
64
|
+
minimumVersions: ['1.18.31', '2.0.14'],
|
|
65
|
+
dialect: OPENCODE_ACP_DIALECT,
|
|
66
|
+
modelDiscovery: { kind: 'reader', source: MODEL_SOURCES.opencode }
|
|
67
|
+
};
|
|
68
|
+
/** Orca's `OMP_LAUNCH_SPEC`: 17.0.5 is the first release that serves ACP. */
|
|
69
|
+
const OMP_LAUNCH_SPEC = {
|
|
70
|
+
agent: 'omp',
|
|
71
|
+
headless: 'acp',
|
|
72
|
+
args: () => ['acp'],
|
|
73
|
+
minimumVersions: ['17.0.5'],
|
|
74
|
+
dialect: OMP_ACP_DIALECT,
|
|
75
|
+
// Its CLI listing includes disabled models, and it cannot delete sessions: list in a disposable session folder.
|
|
76
|
+
modelDiscovery: { kind: 'session', sessionFolderArgs: (folder) => ['--session-dir', folder] }
|
|
77
|
+
};
|
|
78
|
+
/** The installed CLI's executable, for adapters that drive it. */
|
|
79
|
+
function installedCli(spec) {
|
|
80
|
+
const override = process.env[spec.overrideEnv]?.trim();
|
|
81
|
+
const found = override || findCliCommand(cliCommand(spec), { pathEnv: providerEnvironment().PATH ?? null });
|
|
82
|
+
if (!found)
|
|
83
|
+
throw new AcpRuntimeUnavailable(`本机找不到 ${spec.label}`);
|
|
84
|
+
try {
|
|
85
|
+
return realpathSync(found);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return found;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function nodeMajor() {
|
|
92
|
+
return Number(process.versions.node.split('.')[0]) || 0;
|
|
93
|
+
}
|
|
94
|
+
/** Lody's acp-extension-claude over the Claude Code installed on this computer. */
|
|
95
|
+
const CLAUDE_LAUNCH_SPEC = {
|
|
96
|
+
agent: 'claude',
|
|
97
|
+
headless: 'native',
|
|
98
|
+
args: () => [],
|
|
99
|
+
async adapter({ workdir, dataDir }) {
|
|
100
|
+
if (nodeMajor() < 22)
|
|
101
|
+
throw new AcpRuntimeUnavailable('Claude ACP 适配器需要 Node.js 22 或更新版本');
|
|
102
|
+
const claude = requireCliSpec('claude');
|
|
103
|
+
const executable = installedCli(claude);
|
|
104
|
+
const runtime = await ensureClaudeRuntime(dataDir);
|
|
105
|
+
return {
|
|
106
|
+
launch: { executable: process.execPath, args: [join(runtime, 'index.mjs')], env: { ...providerEnvironment(), CLAUDE_CODE_EXECUTABLE: executable }, cwd: workdir },
|
|
107
|
+
fingerprint: `claude:${runtime}:${executable}`
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
// Manual mode asks for every edit and command; the user or the level's policy answers.
|
|
111
|
+
permissionModeConfig: { values: { ask: 'default', acceptEdits: 'acceptEdits', bypassPermissions: 'bypassPermissions', plan: 'plan' } },
|
|
112
|
+
resumePreference: 'resume',
|
|
113
|
+
dialect: { failureRules: [{ kind: 'sessionMissing', pattern: /No conversation found with session ID|session[^\n]{0,40}not found/i }] },
|
|
114
|
+
modelDiscovery: { kind: 'reader', source: MODEL_SOURCES.claude }
|
|
115
|
+
};
|
|
116
|
+
/** Lody's acp-extension-codex over the Codex installed on this computer. */
|
|
117
|
+
const CODEX_LAUNCH_SPEC = {
|
|
118
|
+
agent: 'codex',
|
|
119
|
+
headless: 'native',
|
|
120
|
+
args: () => [],
|
|
121
|
+
async adapter({ workdir }) {
|
|
122
|
+
const entry = vendoredAdapter('codex');
|
|
123
|
+
if (!entry)
|
|
124
|
+
throw new AcpRuntimeUnavailable('这个版本的设备代理没有附带 Codex ACP 适配器');
|
|
125
|
+
const executable = installedCli(requireCliSpec('codex'));
|
|
126
|
+
// A relay's catalog with the speed tiers filled in (providers/cli/codex-catalog.ts):
|
|
127
|
+
// the adapter starts its `codex app-server` with these `-c` overrides, so
|
|
128
|
+
// the models report fast mode and the session offers its Fast mode switch.
|
|
129
|
+
await prepareCodexCatalog();
|
|
130
|
+
const catalog = codexCatalogOverlay();
|
|
131
|
+
return {
|
|
132
|
+
launch: {
|
|
133
|
+
executable: process.execPath,
|
|
134
|
+
args: [entry, '-c', 'shell_environment_policy.ignore_default_excludes=true'],
|
|
135
|
+
env: {
|
|
136
|
+
...providerEnvironment(),
|
|
137
|
+
CODEX_PATH: executable,
|
|
138
|
+
...(catalog ? { LODY_CODEX_PROFILE_CONFIG: JSON.stringify({ model_catalog_json: catalog.path }) } : {})
|
|
139
|
+
},
|
|
140
|
+
cwd: workdir
|
|
141
|
+
},
|
|
142
|
+
fingerprint: `codex:${entry}:${executable}${catalog ? `:${catalog.path}@${catalog.stamp}` : ''}`
|
|
143
|
+
};
|
|
144
|
+
},
|
|
145
|
+
// Lody's Codex modes: `read-only` asks before every edit and command (每次询问),
|
|
146
|
+
// `agent` edits the workspace itself and asks only to leave the sandbox,
|
|
147
|
+
// `agent-full-access` never asks.
|
|
148
|
+
permissionModeConfig: { values: { ask: 'read-only', acceptEdits: 'agent', bypassPermissions: 'agent-full-access' } },
|
|
149
|
+
resumePreference: 'resume',
|
|
150
|
+
dialect: { failureRules: [{ kind: 'sessionMissing', pattern: /no rollout found for thread id|thread not found|session[^\n]{0,40}not found/i }] },
|
|
151
|
+
modelDiscovery: { kind: 'reader', source: MODEL_SOURCES.codex }
|
|
152
|
+
};
|
|
153
|
+
export const ACP_LAUNCH_SPECS = [
|
|
154
|
+
KIRO_LAUNCH_SPEC,
|
|
155
|
+
GEMINI_LAUNCH_SPEC,
|
|
156
|
+
GROK_LAUNCH_SPEC,
|
|
157
|
+
OPENCODE_LAUNCH_SPEC,
|
|
158
|
+
OMP_LAUNCH_SPEC,
|
|
159
|
+
CLAUDE_LAUNCH_SPEC,
|
|
160
|
+
CODEX_LAUNCH_SPEC
|
|
161
|
+
];
|
|
162
|
+
export function acpLaunchSpecFor(agent) {
|
|
163
|
+
return ACP_LAUNCH_SPECS.find((spec) => spec.agent === agent);
|
|
164
|
+
}
|
|
165
|
+
/** The agent's mode for this turn (plan first), for rows with agent-enforced modes. */
|
|
166
|
+
export function acpModeFor(spec, access, plan) {
|
|
167
|
+
const values = spec.permissionModeConfig?.values;
|
|
168
|
+
if (!values)
|
|
169
|
+
return undefined;
|
|
170
|
+
const level = access === 'restricted' || access === 'default' ? undefined : values[access];
|
|
171
|
+
return (plan ? values.plan : undefined) ?? level ?? values.ask;
|
|
172
|
+
}
|
|
173
|
+
/** The release-line minimum that applies to `version` (Orca's `agentCliMinimumVersion`). */
|
|
174
|
+
export function acpMinimumVersion(version, minimumVersions) {
|
|
175
|
+
const major = (value) => Number(value.split('.')[0]);
|
|
176
|
+
return [...minimumVersions].reverse().find((minimum) => major(minimum) <= major(version)) ?? minimumVersions[0];
|
|
177
|
+
}
|
|
178
|
+
/** `a` compared with `b` as dotted numbers (`1.18.31` < `1.20`). */
|
|
179
|
+
export function compareVersions(a, b) {
|
|
180
|
+
const parts = (value) => value.split('.').map((part) => Number.parseInt(part, 10) || 0);
|
|
181
|
+
const left = parts(a);
|
|
182
|
+
const right = parts(b);
|
|
183
|
+
for (let index = 0; index < Math.max(left.length, right.length); index++) {
|
|
184
|
+
const diff = (left[index] ?? 0) - (right[index] ?? 0);
|
|
185
|
+
if (diff)
|
|
186
|
+
return diff;
|
|
187
|
+
}
|
|
188
|
+
return 0;
|
|
189
|
+
}
|
|
190
|
+
/** The dotted version in a `--version` line (`opencode 1.18.31`, `v17.0.5 (abc)`). */
|
|
191
|
+
export function versionNumber(text) {
|
|
192
|
+
return text ? /\d+(?:\.\d+)+/.exec(text)?.[0] : undefined;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Whether this release serves the row's ACP server: true without minimums
|
|
196
|
+
* or a known version (the launch then reports what fails).
|
|
197
|
+
*/
|
|
198
|
+
export function acpVersionSupported(spec, detectedVersion) {
|
|
199
|
+
const version = versionNumber(detectedVersion);
|
|
200
|
+
if (!spec.minimumVersions?.length || !version)
|
|
201
|
+
return true;
|
|
202
|
+
const minimum = acpMinimumVersion(version, spec.minimumVersions);
|
|
203
|
+
return !minimum || compareVersions(version, minimum) >= 0;
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=acp-launch-specs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acp-launch-specs.js","sourceRoot":"","sources":["../../../src/acp/acp-launch-specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAgB,MAAM,2BAA2B,CAAA;AACpF,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AAC5F,OAAO,EAAE,aAAa,EAAoB,MAAM,+BAA+B,CAAA;AAC/E,OAAO,EAAE,mBAAmB,EAA6C,MAAM,0BAA0B,CAAA;AACzG,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AAGzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAA;AAGzE,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AA4EzF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAuB,EAAE,eAAe,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,mBAAmB,CAAC,EAAE,IAAI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C,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;AAC3D,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ModelSource } from '../providers/model-catalog.js';
|
|
2
|
+
import type { AgentCliModelCatalog } from '../types/protocol.js';
|
|
3
|
+
import type { AcpLaunchSpec } from './acp-launch-specs.js';
|
|
4
|
+
export declare function acpModelSource(row: AcpLaunchSpec): ModelSource | undefined;
|
|
5
|
+
/** Starts the ACP server, opens a session in a scratch folder, reads its options and removes it all. */
|
|
6
|
+
export declare function readSessionModels(row: AcpLaunchSpec, clientVersion?: string): Promise<AgentCliModelCatalog>;
|