@yitom/acp-client 0.1.3 → 0.1.5
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/client/acp-client.d.ts +8 -0
- package/dist/contracts/index.d.ts +2 -0
- package/dist/contracts/quota.d.ts +61 -0
- package/dist/index.cjs +593 -115
- package/dist/index.d.ts +2 -0
- package/dist/index.js +584 -106
- package/dist/runtimes/agy/index.d.ts +1 -16
- package/dist/runtimes/agy/quota.d.ts +5 -0
- package/dist/runtimes/claude/index.d.ts +1 -0
- package/dist/runtimes/claude/quota.d.ts +4 -0
- package/dist/runtimes/codex/index.d.ts +7 -2
- package/dist/runtimes/codex/quota.d.ts +4 -0
- package/dist/runtimes/cursor/index.d.ts +1 -0
- package/dist/runtimes/cursor/quota.d.ts +2 -0
- package/dist/runtimes/index.d.ts +6 -1
- package/dist/runtimes/opencode/index.d.ts +1 -0
- package/dist/runtimes/opencode/quota.d.ts +3 -0
- package/dist/runtimes/opencode-v2/index.d.ts +10 -0
- package/dist/session/quota.d.ts +16 -0
- package/dist/sidecar.cjs +592 -111
- package/dist/version.d.ts +1 -0
- package/package.json +4 -3
|
@@ -1,19 +1,4 @@
|
|
|
1
|
-
import type { CodexAuthPreflight } from
|
|
1
|
+
import type { CodexAuthPreflight } from '../../contracts';
|
|
2
2
|
import type { GenericRuntimeAdapter } from '../index';
|
|
3
|
-
/**
|
|
4
|
-
* agy 运行时适配器(`bunx -y @yitom/agy-acp-map`,无参 stdio 服务)。
|
|
5
|
-
*
|
|
6
|
-
* 形态照抄 codex 条目:模板直调官方桥 JS 入口(`agy-acp → dist/bin.js`,
|
|
7
|
-
* src/sdk-server.ts 构建,target node),免安装、跨平台(win/mac/linux
|
|
8
|
-
* 有 bun 即行;JS 入口无旧 exe 的 win-only 限制)。
|
|
9
|
-
*
|
|
10
|
-
* 语义(对齐同源参考实现,不拷贝架构):
|
|
11
|
-
* - initialize 跑 `agy models`/`agents`(10s 超时,进程级缓存);
|
|
12
|
-
* - 模型经 session/new 的 configOptions 到达,中途换模型走
|
|
13
|
-
* session/set_config_option(configId 含 model|effort|mode|agent|…),
|
|
14
|
-
* 即我方现有 setModel 通道直通,无需 set_model 逃生口;
|
|
15
|
-
* - authMethods 为 [](直连即可);
|
|
16
|
-
* - 历史回放刻意极简(本地 zustand 仍是显示真相源)。
|
|
17
|
-
*/
|
|
18
3
|
export declare function probeAgyAuth(): CodexAuthPreflight;
|
|
19
4
|
export declare const agyAdapter: GenericRuntimeAdapter;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
export * from './quota';
|
|
2
|
+
import type { CodexAuthPreflight, AcpAgentQuota } from "../../contracts";
|
|
3
|
+
import type { GenericRuntimeAdapter } from '../index';
|
|
2
4
|
import { type StoredAcpProvider } from './codex-provider';
|
|
3
5
|
export * from './codex-auth-preflight';
|
|
4
6
|
export * from './codex-provider';
|
|
5
7
|
export * from './codex-provider-home';
|
|
6
8
|
export declare function provisionCustomProviderCodexHome(provider: StoredAcpProvider, codexHome: string): Promise<boolean>;
|
|
7
|
-
export interface CodexRuntimeAdapter {
|
|
9
|
+
export interface CodexRuntimeAdapter extends GenericRuntimeAdapter {
|
|
10
|
+
probeQuota?: (options?: {
|
|
11
|
+
sessionId?: string;
|
|
12
|
+
}) => Promise<AcpAgentQuota | null>;
|
|
8
13
|
id: 'codex-acp';
|
|
9
14
|
probeAuth: () => CodexAuthPreflight;
|
|
10
15
|
getCustomProvider: () => Promise<{
|
package/dist/runtimes/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { AcpAuthMethod, AcpProxySettings, CodexAuthPreflight } from "../contracts";
|
|
1
|
+
import type { AcpAuthMethod, AcpProxySettings, CodexAuthPreflight, AcpAgentQuota } from "../contracts";
|
|
2
2
|
import { codexAdapter } from './codex';
|
|
3
3
|
export * from './codex';
|
|
4
4
|
export * from './claude';
|
|
5
5
|
export * from './gemini';
|
|
6
6
|
export * from './copilot';
|
|
7
7
|
export * from './opencode';
|
|
8
|
+
export * from './opencode-v2';
|
|
8
9
|
export * from './cursor';
|
|
9
10
|
export * from './deepseek';
|
|
10
11
|
export * from './agy';
|
|
@@ -14,6 +15,10 @@ export interface GenericRuntimeAdapter {
|
|
|
14
15
|
/** 仅冷启动(无温进程可用、即将 spawn)时调用一次;各 runtime 自理副作用 */
|
|
15
16
|
onColdStart?: () => Promise<void>;
|
|
16
17
|
probeAuth: () => CodexAuthPreflight;
|
|
18
|
+
/** 运行时配额探针(5h 限制、周额度、余额),与会话生命周期解耦 */
|
|
19
|
+
probeQuota?: (options?: {
|
|
20
|
+
sessionId?: string;
|
|
21
|
+
}) => Promise<AcpAgentQuota | null>;
|
|
17
22
|
/**
|
|
18
23
|
* 预 spawn 接线点(冷启动 spawn 前调用一次):
|
|
19
24
|
* 返回 `{ command, args }` 则覆盖模板的 spawn 目标(可透传绝对路径);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GenericRuntimeAdapter } from '../index';
|
|
2
|
+
/**
|
|
3
|
+
* OpenCode v2 专属运行时(独立产品线 `@opencode/cli`,与 1.x 共存)。
|
|
4
|
+
*
|
|
5
|
+
* 启动:`npx -y @opencode/cli acp`(npx 跑 postinstall 落本地二进制,
|
|
6
|
+
* 首冷慢、后热;不要用 bunx——bun 会拦 postinstall 导致无二进制可跑)。
|
|
7
|
+
* 凭证:v2 已迁 SQLite,auth.json 仅兼容残留;探针沿用 v1 同款 hint,
|
|
8
|
+
* 未命中由 gate 直连试一次兜底(tryDirectSessionFirst)。
|
|
9
|
+
*/
|
|
10
|
+
export declare const opencodeV2Adapter: GenericRuntimeAdapter;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AcpAgentQuota } from '../contracts/quota';
|
|
2
|
+
/**
|
|
3
|
+
* 从文本输出(如 Codex /status 输出、Claude /cost、OpenCode status)中提取结构化配额
|
|
4
|
+
*/
|
|
5
|
+
export declare function parseRateLimitsFromStatusText(text: string, runtimeId?: string): AcpAgentQuota | null;
|
|
6
|
+
/**
|
|
7
|
+
* 缓存每个会话和运行时的配额状态
|
|
8
|
+
*/
|
|
9
|
+
export declare class QuotaCache {
|
|
10
|
+
private bySession;
|
|
11
|
+
private byRuntime;
|
|
12
|
+
observe(params: unknown, defaultRuntimeId?: string): AcpAgentQuota | null;
|
|
13
|
+
set(quota: AcpAgentQuota, sessionId?: string): void;
|
|
14
|
+
get(sessionId?: string, runtimeId?: string): AcpAgentQuota | undefined;
|
|
15
|
+
clear(): void;
|
|
16
|
+
}
|