opencode-copilot-account-switcher 0.14.10 → 0.14.11
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/plugin-hooks.d.ts +1 -0
- package/dist/plugin-hooks.js +14 -7
- package/package.json +1 -1
package/dist/plugin-hooks.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ export declare function buildPluginHooks(input: {
|
|
|
88
88
|
};
|
|
89
89
|
directory?: CopilotRetryContext["directory"];
|
|
90
90
|
serverUrl?: CopilotRetryContext["serverUrl"];
|
|
91
|
+
ensureWechatBrokerStarted?: () => Promise<unknown>;
|
|
91
92
|
createWechatBridgeLifecycleImpl?: (input: WechatBridgeLifecycleInput) => Promise<{
|
|
92
93
|
close: () => Promise<void>;
|
|
93
94
|
}>;
|
package/dist/plugin-hooks.js
CHANGED
|
@@ -20,6 +20,7 @@ import { handleCodexStatusCommand } from "./codex-status-command.js";
|
|
|
20
20
|
import { handleCompactCommand, handleStopToolCommand, } from "./session-control-command.js";
|
|
21
21
|
import { appendRoutingEvent, appendRouteDecisionEvent, appendSessionTouchEvent, buildCandidateAccountLoads, isAccountRateLimitCooledDown, readRoutingState, routingStatePath, } from "./routing-state.js";
|
|
22
22
|
import { createWechatBridgeLifecycle, } from "./wechat/bridge.js";
|
|
23
|
+
import { connectOrSpawnBroker } from "./wechat/broker-launcher.js";
|
|
23
24
|
const SESSION_BINDING_IDLE_TTL_MS = 30 * 60 * 1000;
|
|
24
25
|
const RATE_LIMIT_WINDOW_MS = 5 * 60 * 1000;
|
|
25
26
|
const RATE_LIMIT_HIT_THRESHOLD = 3;
|
|
@@ -583,6 +584,7 @@ export function buildPluginHooks(input) {
|
|
|
583
584
|
const appendRouteDecisionEventImpl = input.appendRouteDecisionEventImpl ?? appendRouteDecisionEvent;
|
|
584
585
|
const readRoutingStateImpl = input.readRoutingStateImpl ?? readRoutingState;
|
|
585
586
|
const triggerBillingCompensation = input.triggerBillingCompensation ?? (async () => { });
|
|
587
|
+
const ensureWechatBrokerStarted = input.ensureWechatBrokerStarted ?? (async () => connectOrSpawnBroker());
|
|
586
588
|
const createWechatBridgeLifecycleImpl = input.createWechatBridgeLifecycleImpl ?? createWechatBridgeLifecycle;
|
|
587
589
|
if (input.serverUrl && hasWechatBridgeClientShape(input.client)) {
|
|
588
590
|
const wechatBridgeClient = input.client;
|
|
@@ -594,13 +596,18 @@ export function buildPluginHooks(input) {
|
|
|
594
596
|
attachWechatBridgeAutoClose();
|
|
595
597
|
void ensureWechatBridgeLifecycle({
|
|
596
598
|
key: lifecycleKey,
|
|
597
|
-
create: () =>
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
599
|
+
create: async () => {
|
|
600
|
+
void Promise.resolve()
|
|
601
|
+
.then(() => ensureWechatBrokerStarted())
|
|
602
|
+
.catch(() => { });
|
|
603
|
+
return createWechatBridgeLifecycleImpl({
|
|
604
|
+
client: wechatBridgeClient,
|
|
605
|
+
project: input.project,
|
|
606
|
+
directory: input.directory,
|
|
607
|
+
serverUrl: input.serverUrl,
|
|
608
|
+
statusCollectionEnabled: true,
|
|
609
|
+
});
|
|
610
|
+
},
|
|
604
611
|
}).catch(() => { });
|
|
605
612
|
}
|
|
606
613
|
const loadCandidateAccountLoads = input.loadCandidateAccountLoads ?? (async (ctx) => {
|