@jingyi0605/codingns4dsh 0.1.7-rc.3 → 0.2.0-beta.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 +695 -0
- package/README.en.md +23 -9
- package/README.md +23 -9
- package/data/build/dist/bootstrap/dsh-connection-adapter.d.ts +1 -1
- package/data/build/dist/bootstrap/index.d.ts +1 -1
- package/data/build/dist/client/bundle.js +1200 -170
- package/data/build/dist/client/context-breakdown-dom.d.ts +53 -0
- package/data/build/dist/client/context-breakdown-dom.js +171 -0
- package/data/build/dist/client/dsh-h5-bootstrap.js +7 -1
- package/data/build/dist/client/features/cli-adapters.js +11 -0
- package/data/build/dist/client/features/index.d.ts +1 -0
- package/data/build/dist/client/features/index.js +1 -0
- package/data/build/dist/client/features/subscription-usage-panel.d.ts +15 -0
- package/data/build/dist/client/features/subscription-usage-panel.js +117 -0
- package/data/build/dist/client/features/workspace-session-enhancement-panel.js +22 -5
- package/data/build/dist/client/features/workspace-session-enhancement.js +17 -2
- package/data/build/dist/client/git-management.js +80 -10
- package/data/build/dist/client/index.d.ts +1 -0
- package/data/build/dist/client/index.js +16 -49
- package/data/build/dist/client/locale.js +20 -2
- package/data/build/dist/client/remote-web-context.js +26 -2
- package/data/build/dist/client/settings-bridge.d.ts +20 -5
- package/data/build/dist/client/settings-bridge.js +30 -7
- package/data/build/dist/client/subscription-slot.d.ts +3 -1
- package/data/build/dist/client/subscription-slot.js +31 -6
- package/data/build/dist/client/terminal/ui.js +1 -1
- package/data/build/dist/client/terminal/xterm-view.js +1 -1
- package/data/build/dist/dsh-capabilities/client/config-forms-adapter.d.ts +10 -0
- package/data/build/dist/dsh-capabilities/client/config-forms-adapter.js +22 -0
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.d.ts +5 -2
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.js +3 -2
- package/data/build/dist/dsh-capabilities/client/settings-scope-adapter.d.ts +2 -2
- package/data/build/dist/dsh-capabilities/host/config-forms-adapter.d.ts +22 -1
- package/data/build/dist/dsh-capabilities/host/config-forms-adapter.js +29 -3
- package/data/build/dist/dsh-capabilities/host/settings-scope-adapter.d.ts +2 -2
- package/data/build/dist/dsh-capabilities/matrix.js +31 -1
- package/data/build/dist/dsh-capabilities/routes.d.ts +8 -1
- package/data/build/dist/dsh-capabilities/routes.js +173 -5
- package/data/build/dist/dsh-capabilities/types.d.ts +1 -1
- package/data/build/dist/features/registry.d.ts +7 -0
- package/data/build/dist/features/registry.js +20 -2
- package/data/build/dist/host/cli-adapters/feature.js +24 -2
- package/data/build/dist/host/cli-adapters/native-team-proxy.d.ts +36 -0
- package/data/build/dist/host/cli-adapters/native-team-proxy.js +108 -0
- package/data/build/dist/host/cli-adapters/provider-subscription.d.ts +35 -0
- package/data/build/dist/host/cli-adapters/provider-subscription.js +405 -5
- package/data/build/dist/host/cli-adapters/registry.d.ts +9 -3
- package/data/build/dist/host/cli-adapters/registry.js +30 -0
- package/data/build/dist/host/cli-adapters/session-store.d.ts +8 -2
- package/data/build/dist/host/cli-adapters/session-store.js +19 -0
- package/data/build/dist/host/features/git-management.js +41 -18
- package/data/build/dist/host/features/types.d.ts +6 -3
- package/data/build/dist/host/index-injection.d.ts +12 -5
- package/data/build/dist/host/index-injection.js +32 -11
- package/data/build/dist/host/index.js +15 -4
- package/data/build/dist/host/lan-access-dsh.d.ts +2 -2
- package/data/build/dist/host/native-session-bridge.d.ts +4 -0
- package/data/build/dist/host/native-session-bridge.js +51 -9
- package/data/build/dist/host/relay-tunnel-runtime.js +10 -1
- package/data/build/dist/host/remote-web-runtime.js +40 -17
- package/data/build/dist/host/rpc.d.ts +24 -5
- package/data/build/dist/host/rpc.js +38 -9
- package/data/build/dist/host/session-migration-repair.js +14 -0
- package/data/build/dist/host/settings.d.ts +2 -2
- package/data/build/dist/host/settings.js +11 -1
- package/data/build/dist/host/terminal/startup.d.ts +2 -2
- package/data/build/dist/shared/contracts/cli-adapter.d.ts +22 -1
- package/data/build/dist/shared/contracts/config.d.ts +21 -0
- package/data/build/dist/shared/contracts/config.js +17 -0
- package/data/build/dist/shared/contracts/errors.d.ts +2 -2
- package/data/build/dist/shared/contracts/subscription.d.ts +7 -0
- package/data/build/dist/shared/contracts/subscription.js +14 -1
- package/data/build/dist/shared/contracts/version.d.ts +4 -4
- package/data/build/dist/shared/contracts/version.js +3 -3
- package/data/build/dist/shared/index.d.ts +3 -2
- package/data/build/dist/shared/index.js +2 -1
- package/data/build/dist/transport/carrier.d.ts +11 -1
- package/data/build/dist/transport/carrier.js +77 -26
- package/data/build/dist/transport/debug.d.ts +5 -0
- package/data/build/dist/transport/debug.js +17 -2
- package/data/build/dist/transport/dsh-session.d.ts +18 -1
- package/data/build/dist/transport/dsh-session.js +48 -13
- package/data/build/dist/transport/index.d.ts +1 -1
- package/data/build/dist/transport/index.js +1 -1
- package/package.json +23 -19
- package/profile/README.md +2 -2
- package/profile/package.json +4 -3
- package/profile/version.json +3 -3
- package/version.json +3 -3
|
@@ -66,6 +66,13 @@ export declare class FeatureRegistry<S = unknown, M extends FeatureModule<S> = F
|
|
|
66
66
|
*/
|
|
67
67
|
reconcile(enabledNames: readonly string[]): Promise<void>;
|
|
68
68
|
private reconcileInternal;
|
|
69
|
+
/**
|
|
70
|
+
* 执行单个模块的启停,并把失败留给调用方汇总。
|
|
71
|
+
*
|
|
72
|
+
* 模块失败(例如必需能力缺失)只影响它自己:同一轮同步里其余模块照常启停,
|
|
73
|
+
* 失败原因通过模块状态和 trace 暴露,最后只把第一个错误抛给宿主记录。
|
|
74
|
+
*/
|
|
75
|
+
private step;
|
|
69
76
|
drain(name: string): Promise<void>;
|
|
70
77
|
dispose(name: string): Promise<void>;
|
|
71
78
|
disable(name: string): Promise<void>;
|
|
@@ -169,13 +169,31 @@ export class FeatureRegistry {
|
|
|
169
169
|
desired: [...desired],
|
|
170
170
|
states: this.list().map((item) => ({ name: item.name, state: item.state, reason: item.reason })),
|
|
171
171
|
});
|
|
172
|
+
const failures = [];
|
|
172
173
|
for (const name of this.records.keys()) {
|
|
173
174
|
if (desired.has(name))
|
|
174
|
-
await this.start(name);
|
|
175
|
+
await this.step(name, () => this.start(name), failures);
|
|
175
176
|
}
|
|
176
177
|
for (const name of this.records.keys()) {
|
|
177
178
|
if (!desired.has(name))
|
|
178
|
-
await this.disable(name);
|
|
179
|
+
await this.step(name, () => this.disable(name), failures);
|
|
180
|
+
}
|
|
181
|
+
if (failures.length > 0)
|
|
182
|
+
throw failures[0];
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* 执行单个模块的启停,并把失败留给调用方汇总。
|
|
186
|
+
*
|
|
187
|
+
* 模块失败(例如必需能力缺失)只影响它自己:同一轮同步里其余模块照常启停,
|
|
188
|
+
* 失败原因通过模块状态和 trace 暴露,最后只把第一个错误抛给宿主记录。
|
|
189
|
+
*/
|
|
190
|
+
async step(name, operation, failures) {
|
|
191
|
+
try {
|
|
192
|
+
await operation();
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
failures.push(error);
|
|
196
|
+
traceFeature('reconcile.failed', { feature: name, error: serializeError(error) });
|
|
179
197
|
}
|
|
180
198
|
}
|
|
181
199
|
async drain(name) {
|
|
@@ -11,6 +11,7 @@ import { CodingNsCliSessionStore } from './session-store.js';
|
|
|
11
11
|
import { CodingNsDshMessageProjector } from './dsh-message-projector.js';
|
|
12
12
|
import { CommandCodeSubscriptionService } from './command-code-subscription.js';
|
|
13
13
|
import { ProviderSubscriptionService } from './provider-subscription.js';
|
|
14
|
+
import { normalizeSubscriptionUsageSettings } from '../../shared/contracts/config.js';
|
|
14
15
|
export function createCliAdaptersFeature(options = {}) {
|
|
15
16
|
return {
|
|
16
17
|
descriptor: {
|
|
@@ -21,8 +22,13 @@ export function createCliAdaptersFeature(options = {}) {
|
|
|
21
22
|
runtime: 'host',
|
|
22
23
|
},
|
|
23
24
|
start(context) {
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
// 用量查询超时对所有适配器统一生效:同一个 timeoutMs 下发给全部网络读取器,
|
|
26
|
+
// 设置变更时整体重建,避免旧超时继续生效。
|
|
27
|
+
const buildSubscriptions = (settings) => {
|
|
28
|
+
const timeoutMs = normalizeSubscriptionUsageSettings(settings?.subscriptionUsage).timeoutSecs * 1000;
|
|
29
|
+
return new ProviderSubscriptionService({ commandCode: new CommandCodeSubscriptionService({ timeoutMs }), timeoutMs });
|
|
30
|
+
};
|
|
31
|
+
let subscriptions = buildSubscriptions(context.services.settings?.get());
|
|
26
32
|
const sessionStore = new CodingNsCliSessionStore(context.services.settings === undefined ? {} : { settings: context.services.settings });
|
|
27
33
|
const nativeSessions = context.services.nativeSessions;
|
|
28
34
|
if (nativeSessions !== undefined) {
|
|
@@ -89,6 +95,16 @@ export function createCliAdaptersFeature(options = {}) {
|
|
|
89
95
|
case 'session/steer': return registry.steer(readSessionId(payload), readPrompt(payload), false);
|
|
90
96
|
case 'session/follow-up': return registry.steer(readSessionId(payload), readPrompt(payload), true);
|
|
91
97
|
case 'session/interrupt': return registry.interrupt(readSessionId(payload));
|
|
98
|
+
case 'team/status': return context.services.nativeTeam?.diagnostic() ?? registry.teamDiagnostic();
|
|
99
|
+
case 'team/members': return requireTeam(context).invoke('members', payload);
|
|
100
|
+
case 'team/tasks': return requireTeam(context).invoke('tasks', payload);
|
|
101
|
+
case 'team/task': return requireTeam(context).invoke('task', payload);
|
|
102
|
+
case 'team/spawn': return requireTeam(context).invoke('spawn', payload);
|
|
103
|
+
case 'team/message': return requireTeam(context).invoke('message', payload);
|
|
104
|
+
case 'team/task/create': return requireTeam(context).invoke('task/create', payload);
|
|
105
|
+
case 'team/task/update': return requireTeam(context).invoke('task/update', payload);
|
|
106
|
+
case 'team/wait': return requireTeam(context).invoke('wait', payload);
|
|
107
|
+
case 'team/interrupt': return requireTeam(context).invoke('interrupt', payload);
|
|
92
108
|
case 'subscription': {
|
|
93
109
|
const subscription = readSubscriptionRequest(payload);
|
|
94
110
|
return subscriptions.read(subscription.adapterId, subscription.providerId);
|
|
@@ -102,6 +118,7 @@ export function createCliAdaptersFeature(options = {}) {
|
|
|
102
118
|
registry.applyEnabledSettings(next.agentAdapters);
|
|
103
119
|
registry.syncPreferences(next.agentAdapterPreferences);
|
|
104
120
|
sessionStore.sync(next.cliSessions);
|
|
121
|
+
subscriptions = buildSubscriptions(next);
|
|
105
122
|
}));
|
|
106
123
|
}
|
|
107
124
|
const events = context.services.events;
|
|
@@ -217,6 +234,11 @@ export function createCliAdaptersFeature(options = {}) {
|
|
|
217
234
|
},
|
|
218
235
|
};
|
|
219
236
|
}
|
|
237
|
+
function requireTeam(context) {
|
|
238
|
+
if (context.services.nativeTeam === undefined)
|
|
239
|
+
throw new Error('DSH_TEAM_NATIVE_UNAVAILABLE');
|
|
240
|
+
return context.services.nativeTeam;
|
|
241
|
+
}
|
|
220
242
|
/**
|
|
221
243
|
* DSH 原生 Provider 可能只返回一个 finish(stop)。不能把这个空回合当作成功,
|
|
222
244
|
* 否则 Session 会落下一条空 assistant/message,用户只能看到“一秒结束”。
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { CodingNsCliTeamDiagnostic } from '../../shared/contracts/cli-adapter.js';
|
|
2
|
+
/** DSH 0.2 原生 Agent Team 的最小结构契约。 */
|
|
3
|
+
export interface CodingNsNativeTeamProxy {
|
|
4
|
+
diagnostic(): CodingNsCliTeamDiagnostic;
|
|
5
|
+
invoke(action: string, payload: unknown, signal?: AbortSignal): unknown | Promise<unknown>;
|
|
6
|
+
}
|
|
7
|
+
export interface NativeTeamService {
|
|
8
|
+
membership?: (agent: unknown) => unknown;
|
|
9
|
+
listMembers?: (agent: unknown) => unknown;
|
|
10
|
+
listTasks?: (agent: unknown) => unknown;
|
|
11
|
+
getTask?: (agent: unknown, id: unknown) => unknown;
|
|
12
|
+
spawnTeammate?: (agent: unknown, request: Record<string, unknown>) => unknown;
|
|
13
|
+
sendMessage?: (agent: unknown, request: Record<string, unknown>) => unknown;
|
|
14
|
+
createTask?: (agent: unknown, request: Record<string, unknown>) => unknown;
|
|
15
|
+
updateTask?: (agent: unknown, request: Record<string, unknown>) => unknown;
|
|
16
|
+
waitForChange?: (agent: unknown, timeoutMs: number, signal: AbortSignal) => unknown;
|
|
17
|
+
interrupt?: (agent: unknown, targetName: string) => unknown;
|
|
18
|
+
}
|
|
19
|
+
export interface AgentRegistry {
|
|
20
|
+
get?: (id: string) => unknown;
|
|
21
|
+
list?: () => readonly unknown[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 只负责 DSH 原生 TeamService 的调用边界,不把版本判断泄漏到业务模块。
|
|
25
|
+
* 外部 CLI 没有 Agent 句柄,因此不会经过这个代理伪装成 Team 成员。
|
|
26
|
+
*/
|
|
27
|
+
export declare class DshNativeTeamProxy implements CodingNsNativeTeamProxy {
|
|
28
|
+
private readonly service;
|
|
29
|
+
private readonly agents;
|
|
30
|
+
constructor(service: NativeTeamService | undefined, agents: AgentRegistry | undefined);
|
|
31
|
+
diagnostic(): CodingNsCliTeamDiagnostic;
|
|
32
|
+
invoke(action: string, payload: unknown, signal?: AbortSignal): unknown | Promise<unknown>;
|
|
33
|
+
private findAgent;
|
|
34
|
+
private findAnyAgent;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=native-team-proxy.d.ts.map
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 只负责 DSH 原生 TeamService 的调用边界,不把版本判断泄漏到业务模块。
|
|
3
|
+
* 外部 CLI 没有 Agent 句柄,因此不会经过这个代理伪装成 Team 成员。
|
|
4
|
+
*/
|
|
5
|
+
export class DshNativeTeamProxy {
|
|
6
|
+
service;
|
|
7
|
+
agents;
|
|
8
|
+
constructor(service, agents) {
|
|
9
|
+
this.service = service;
|
|
10
|
+
this.agents = agents;
|
|
11
|
+
}
|
|
12
|
+
diagnostic() {
|
|
13
|
+
const supported = this.service !== undefined
|
|
14
|
+
&& typeof this.service.listMembers === 'function'
|
|
15
|
+
&& typeof this.service.spawnTeammate === 'function'
|
|
16
|
+
&& this.findAnyAgent() !== undefined;
|
|
17
|
+
return supported
|
|
18
|
+
? {
|
|
19
|
+
supported: true,
|
|
20
|
+
code: 'DSH_TEAM_PROXY_READY',
|
|
21
|
+
message: 'DSH 0.2 原生 Agent Team 已通过 Codingns4DSH Proxy 暴露。',
|
|
22
|
+
}
|
|
23
|
+
: {
|
|
24
|
+
supported: false,
|
|
25
|
+
code: 'DSH_TEAM_NATIVE_UNAVAILABLE',
|
|
26
|
+
message: '当前 DSH 未注入可用的原生 Agent Team 或 Agent 注册表。',
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
invoke(action, payload, signal = new AbortController().signal) {
|
|
30
|
+
const service = this.service;
|
|
31
|
+
if (service === undefined)
|
|
32
|
+
throw new Error('DSH_TEAM_NATIVE_UNAVAILABLE');
|
|
33
|
+
const input = asRecord(payload);
|
|
34
|
+
const agent = this.findAgent(readString(input, 'sessionId'));
|
|
35
|
+
if (agent === undefined)
|
|
36
|
+
throw new Error('DSH_TEAM_AGENT_NOT_FOUND');
|
|
37
|
+
switch (action) {
|
|
38
|
+
case 'status':
|
|
39
|
+
return {
|
|
40
|
+
...this.diagnostic(),
|
|
41
|
+
membership: call(service.membership, agent),
|
|
42
|
+
members: call(service.listMembers, agent),
|
|
43
|
+
};
|
|
44
|
+
case 'members': return requiredCall(service.listMembers, agent);
|
|
45
|
+
case 'tasks': return requiredCall(service.listTasks, agent);
|
|
46
|
+
case 'task': return requiredCall(service.getTask, agent, readRequired(input, 'taskId'));
|
|
47
|
+
case 'spawn': return requiredCall(service.spawnTeammate, agent, withSignal(input, signal));
|
|
48
|
+
case 'message': return requiredCall(service.sendMessage, agent, withSignal(input, signal));
|
|
49
|
+
case 'task/create': return requiredCall(service.createTask, agent, input);
|
|
50
|
+
case 'task/update': return requiredCall(service.updateTask, agent, input);
|
|
51
|
+
case 'wait': return requiredCall(service.waitForChange, agent, readNumber(input, 'timeoutMs', 30_000), signal);
|
|
52
|
+
case 'interrupt': return requiredCall(service.interrupt, agent, readRequired(input, 'targetName'));
|
|
53
|
+
default: throw new Error(`DSH_TEAM_RPC_NOT_FOUND: team/${action}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
findAgent(sessionId) {
|
|
57
|
+
if (this.agents === undefined)
|
|
58
|
+
return undefined;
|
|
59
|
+
if (sessionId !== '' && typeof this.agents.get === 'function') {
|
|
60
|
+
const direct = this.agents.get(sessionId);
|
|
61
|
+
if (direct !== undefined)
|
|
62
|
+
return direct;
|
|
63
|
+
}
|
|
64
|
+
for (const candidate of this.agents.list?.() ?? []) {
|
|
65
|
+
const session = readUnknown(candidate, 'session');
|
|
66
|
+
if (readUnknown(session, 'id') === sessionId || readUnknown(candidate, 'id') === sessionId)
|
|
67
|
+
return candidate;
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
findAnyAgent() {
|
|
72
|
+
return this.agents?.list?.()[0];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function call(fn, ...args) {
|
|
76
|
+
return typeof fn === 'function' ? fn(...args) : undefined;
|
|
77
|
+
}
|
|
78
|
+
function requiredCall(fn, ...args) {
|
|
79
|
+
if (typeof fn !== 'function')
|
|
80
|
+
throw new Error('DSH_TEAM_OPERATION_UNAVAILABLE');
|
|
81
|
+
return fn(...args);
|
|
82
|
+
}
|
|
83
|
+
function asRecord(value) {
|
|
84
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
85
|
+
return {};
|
|
86
|
+
return { ...value };
|
|
87
|
+
}
|
|
88
|
+
function readUnknown(value, key) {
|
|
89
|
+
return typeof value === 'object' && value !== null ? Reflect.get(value, key) : undefined;
|
|
90
|
+
}
|
|
91
|
+
function readString(value, key) {
|
|
92
|
+
const result = value[key];
|
|
93
|
+
return typeof result === 'string' ? result.trim() : '';
|
|
94
|
+
}
|
|
95
|
+
function readRequired(value, key) {
|
|
96
|
+
const result = readString(value, key);
|
|
97
|
+
if (result === '')
|
|
98
|
+
throw new Error(`DSH_TEAM_INVALID_${key.toUpperCase()}`);
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
function readNumber(value, key, fallback) {
|
|
102
|
+
const result = value[key];
|
|
103
|
+
return typeof result === 'number' && Number.isSafeInteger(result) && result >= 0 ? result : fallback;
|
|
104
|
+
}
|
|
105
|
+
function withSignal(value, signal) {
|
|
106
|
+
return { ...value, signal };
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=native-team-proxy.js.map
|
|
@@ -11,6 +11,8 @@ export declare class ProviderSubscriptionService {
|
|
|
11
11
|
readonly sub2api: Sub2ApiUsageService;
|
|
12
12
|
readonly deepseek: DeepseekSubscriptionService;
|
|
13
13
|
readonly official: OfficialProviderSubscriptionService;
|
|
14
|
+
readonly kimi: KimiSubscriptionService;
|
|
15
|
+
readonly grok: GrokSubscriptionService;
|
|
14
16
|
constructor(options?: ProviderSubscriptionOptions);
|
|
15
17
|
read(adapterId: string, providerId?: string): Promise<CliSubscriptionUsage | null>;
|
|
16
18
|
private readDsh;
|
|
@@ -24,6 +26,10 @@ export interface ProviderSubscriptionOptions {
|
|
|
24
26
|
readonly sub2api?: Sub2ApiUsageOptions;
|
|
25
27
|
readonly deepseek?: DeepseekSubscriptionOptions;
|
|
26
28
|
readonly official?: OfficialProviderSubscriptionOptions;
|
|
29
|
+
readonly kimi?: KimiSubscriptionOptions;
|
|
30
|
+
readonly grok?: GrokSubscriptionOptions;
|
|
31
|
+
/** 所有读取器共用的网络超时(毫秒);单项服务显式给出时优先。 */
|
|
32
|
+
readonly timeoutMs?: number;
|
|
27
33
|
}
|
|
28
34
|
export interface SubscriptionReader {
|
|
29
35
|
read(): Promise<CliSubscriptionUsage | null>;
|
|
@@ -100,5 +106,34 @@ export declare class OpenCodeSubscriptionService implements SubscriptionReader {
|
|
|
100
106
|
constructor(options?: OpenCodeSubscriptionOptions);
|
|
101
107
|
read(): Promise<CliSubscriptionUsage | null>;
|
|
102
108
|
}
|
|
109
|
+
export interface KimiSubscriptionOptions {
|
|
110
|
+
readonly fetch?: FetchLike;
|
|
111
|
+
readonly timeoutMs?: number;
|
|
112
|
+
readonly credentials?: readonly string[];
|
|
113
|
+
}
|
|
114
|
+
/** 读取 Kimi Code 官方套餐额度;本地 OAuth 凭据只在 Host 内使用,不做刷新只读访问令牌。 */
|
|
115
|
+
export declare class KimiSubscriptionService implements SubscriptionReader {
|
|
116
|
+
private readonly request;
|
|
117
|
+
private readonly timeoutMs;
|
|
118
|
+
private readonly credentialPaths;
|
|
119
|
+
constructor(options?: KimiSubscriptionOptions);
|
|
120
|
+
read(): Promise<CliSubscriptionUsage | null>;
|
|
121
|
+
private readAccessToken;
|
|
122
|
+
private readUsage;
|
|
123
|
+
}
|
|
124
|
+
export interface GrokSubscriptionOptions {
|
|
125
|
+
readonly fetch?: FetchLike;
|
|
126
|
+
readonly timeoutMs?: number;
|
|
127
|
+
readonly credentials?: readonly string[];
|
|
128
|
+
}
|
|
129
|
+
/** 读取 Grok(xAI)官方 SuperGrok 订阅额度;只读 Grok CLI 的 OAuth 凭据(~/.grok/auth.json),不做刷新,过期令牌也照常尝试以容忍时钟偏差。 */
|
|
130
|
+
export declare class GrokSubscriptionService implements SubscriptionReader {
|
|
131
|
+
private readonly request;
|
|
132
|
+
private readonly timeoutMs;
|
|
133
|
+
private readonly credentialPaths;
|
|
134
|
+
constructor(options?: GrokSubscriptionOptions);
|
|
135
|
+
read(): Promise<CliSubscriptionUsage | null>;
|
|
136
|
+
private readAccessToken;
|
|
137
|
+
}
|
|
103
138
|
export {};
|
|
104
139
|
//# sourceMappingURL=provider-subscription.d.ts.map
|