@ganglion/xacpx 0.20.3 → 0.22.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/bridge/bridge-main.js +5 -1
- package/dist/channels/cli/provider.d.ts +17 -0
- package/dist/channels/plugin.d.ts +21 -0
- package/dist/channels/types.d.ts +16 -2
- package/dist/cli.js +374 -73
- package/dist/config/local-agent-bin.d.ts +6 -0
- package/dist/config/resolve-agent-command.d.ts +1 -1
- package/dist/config/types.d.ts +6 -4
- package/dist/i18n/types.d.ts +1 -0
- package/dist/plugin-api.d.ts +4 -3
- package/dist/plugin-api.js +2 -0
- package/dist/sessions/session-resource-catalog.d.ts +96 -0
- package/dist/sessions/session-service.d.ts +30 -1
- package/dist/state/state-store.d.ts +23 -4
- package/dist/state/types.d.ts +8 -0
- package/package.json +2 -1
|
@@ -4889,6 +4889,7 @@ var init_channel_cli = __esm(() => {
|
|
|
4889
4889
|
channelAdded: (type) => `Channel ${type} added`,
|
|
4890
4890
|
cannotRemoveLastEnabled: "Cannot remove the last enabled channel.",
|
|
4891
4891
|
channelRemoved: (id) => `Channel ${id} removed`,
|
|
4892
|
+
channelRetirementFailed: (id, error) => `Channel ${id} retirement cleanup failed: ${error}`,
|
|
4892
4893
|
channelCredentialsCleared: (id) => `Removed stored credentials for channel ${id}`,
|
|
4893
4894
|
channelCredentialsClearFailed: (id, error) => `Channel ${id} removed, but clearing its stored credentials failed: ${error}`,
|
|
4894
4895
|
channelCredentialsKept: (id) => `Kept stored credentials for channel ${id} (--keep-credentials)`,
|
|
@@ -6015,6 +6016,7 @@ var init_channel_cli2 = __esm(() => {
|
|
|
6015
6016
|
channelAdded: (type) => `频道 ${type} 已添加`,
|
|
6016
6017
|
cannotRemoveLastEnabled: "不能删除最后一个启用的频道。",
|
|
6017
6018
|
channelRemoved: (id) => `频道 ${id} 已删除`,
|
|
6019
|
+
channelRetirementFailed: (id, error) => `频道 ${id} 退役清理失败:${error}`,
|
|
6018
6020
|
channelCredentialsCleared: (id) => `已移除频道 ${id} 的存储凭证`,
|
|
6019
6021
|
channelCredentialsClearFailed: (id, error) => `频道 ${id} 已删除,但清除其存储凭证失败:${error}`,
|
|
6020
6022
|
channelCredentialsKept: (id) => `已保留频道 ${id} 的存储凭证(--keep-credentials)`,
|
|
@@ -7295,7 +7297,9 @@ var LOCAL_AGENT_BINS;
|
|
|
7295
7297
|
var init_local_agent_bin = __esm(() => {
|
|
7296
7298
|
LOCAL_AGENT_BINS = {
|
|
7297
7299
|
opencode: { bin: "opencode", args: ["acp"] },
|
|
7298
|
-
kilocode: { bin: "kilocode", args: ["acp"] }
|
|
7300
|
+
kilocode: { bin: "kilocode", args: ["acp"] },
|
|
7301
|
+
reasonix: { bin: "reasonix", args: ["acp"] },
|
|
7302
|
+
omp: { bin: "omp", args: ["acp"] }
|
|
7299
7303
|
};
|
|
7300
7304
|
});
|
|
7301
7305
|
|
|
@@ -22,6 +22,18 @@ export interface ChannelCliIo {
|
|
|
22
22
|
promptText: (message: string) => Promise<string>;
|
|
23
23
|
promptSecret: (message: string) => Promise<string>;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Structured doctor finding from an optional channel/plugin diagnostic hook.
|
|
27
|
+
* Core renders these verbatim and must not interpret RMUX-specific codes.
|
|
28
|
+
*/
|
|
29
|
+
export type ChannelDoctorFindingLevel = "ok" | "warn" | "error" | "skip";
|
|
30
|
+
export interface ChannelDoctorFinding {
|
|
31
|
+
level: ChannelDoctorFindingLevel;
|
|
32
|
+
code: string;
|
|
33
|
+
message: string;
|
|
34
|
+
suggestion?: string;
|
|
35
|
+
details?: Record<string, string | number | boolean | null>;
|
|
36
|
+
}
|
|
25
37
|
export interface ChannelCliProvider {
|
|
26
38
|
type: string;
|
|
27
39
|
displayName: string;
|
|
@@ -31,6 +43,11 @@ export interface ChannelCliProvider {
|
|
|
31
43
|
validateConfig(config: ChannelRuntimeConfig): ChannelCliValidationIssue[];
|
|
32
44
|
renderSummary(config: ChannelRuntimeConfig): string[];
|
|
33
45
|
promptForMissingFields(input: ChannelCliInput, io: ChannelCliIo): Promise<ChannelCliInput>;
|
|
46
|
+
/**
|
|
47
|
+
* Optional read-only health probe for `xacpx doctor` / `xacpx plugin doctor`.
|
|
48
|
+
* Must not mutate registry, credentials, or kill resources.
|
|
49
|
+
*/
|
|
50
|
+
diagnose?(config: ChannelRuntimeConfig): Promise<ChannelDoctorFinding[]> | ChannelDoctorFinding[];
|
|
34
51
|
/**
|
|
35
52
|
* Optional: declares this plugin supports the `xacpx channel ... --account <id>`
|
|
36
53
|
* multi-bot CLI surface. Plugins that opt in must also implement
|
|
@@ -1,9 +1,30 @@
|
|
|
1
1
|
import type { ChannelFactory } from "./create-channel.js";
|
|
2
2
|
import type { ChannelCliProvider } from "./cli/provider.js";
|
|
3
|
+
import type { ChannelRuntimeConfig } from "../config/types.js";
|
|
4
|
+
export type ChannelRetireDaemonState = "running" | "stopped" | "indeterminate";
|
|
5
|
+
/** Context passed to a plugin `retireChannel` hook from `channel disable|rm`. */
|
|
6
|
+
export interface ChannelRetireContext {
|
|
7
|
+
channel: ChannelRuntimeConfig;
|
|
8
|
+
reason: "disabled" | "removed";
|
|
9
|
+
print: (line: string) => void;
|
|
10
|
+
getDaemonStatus: () => Promise<{
|
|
11
|
+
state: ChannelRetireDaemonState;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
export type ChannelRetireHook = (ctx: ChannelRetireContext) => Promise<void>;
|
|
3
15
|
export interface ChannelPluginDefinition {
|
|
4
16
|
/** Stable channel type used in channels[].type and chatKey prefix. */
|
|
5
17
|
type: string;
|
|
6
18
|
factory: ChannelFactory;
|
|
7
19
|
cliProvider?: ChannelCliProvider;
|
|
20
|
+
/**
|
|
21
|
+
* Optional CLI lifecycle hook for `xacpx channel disable|rm`.
|
|
22
|
+
* Invoked after plugins are loaded, via the per-type registry — core must
|
|
23
|
+
* not import the plugin npm package to retire resources.
|
|
24
|
+
*/
|
|
25
|
+
retireChannel?: ChannelRetireHook;
|
|
8
26
|
}
|
|
9
27
|
export declare function registerChannelPlugin(plugin: ChannelPluginDefinition): void;
|
|
28
|
+
export declare function getChannelRetireHook(type: string): ChannelRetireHook | undefined;
|
|
29
|
+
/** Dispatch `channel disable|rm` retirement to the loaded plugin for this type. */
|
|
30
|
+
export declare function invokeChannelRetireHook(ctx: ChannelRetireContext): Promise<void>;
|
package/dist/channels/types.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { AppLogger } from "../logging/app-logger.js";
|
|
|
5
5
|
import type { PendingFinalChunk } from "../weixin/messaging/quota-manager.js";
|
|
6
6
|
import type { PerfTracer } from "../perf/perf-tracer.js";
|
|
7
7
|
import type { SessionService } from "../sessions/session-service.js";
|
|
8
|
+
import type { SessionResourceCatalog } from "../sessions/session-resource-catalog.js";
|
|
8
9
|
import type { ActiveTurnRegistry } from "../sessions/active-turn-registry.js";
|
|
9
10
|
import type { Locale } from "../i18n/index.js";
|
|
10
11
|
import type { ControlService } from "../control/control-service.js";
|
|
@@ -79,6 +80,12 @@ export interface ChannelStartInput {
|
|
|
79
80
|
* channels ignore it.
|
|
80
81
|
*/
|
|
81
82
|
control?: ControlService;
|
|
83
|
+
/**
|
|
84
|
+
* Generic catalog of logical-session resources: immutable logical session
|
|
85
|
+
* IDs, internal/display aliases, authoritative workspace cwd, archived flag,
|
|
86
|
+
* and a lifecycle-event subscription. Optional: text-only channels ignore it.
|
|
87
|
+
*/
|
|
88
|
+
sessionResources?: SessionResourceCatalog;
|
|
82
89
|
}
|
|
83
90
|
export interface OrchestrationDeliveryCallbacks {
|
|
84
91
|
markTaskNoticeDelivered: (taskId: string, accountId: string) => Promise<void>;
|
|
@@ -114,6 +121,7 @@ export interface ConsumerLockOptions {
|
|
|
114
121
|
lockFilePath?: string;
|
|
115
122
|
onDiagnostic?: (event: string, context: Record<string, string | number | boolean | undefined>) => void | Promise<void>;
|
|
116
123
|
}
|
|
124
|
+
export type ChannelStopReason = "shutdown" | "disabled" | "removed" | "logout";
|
|
117
125
|
export interface MessageChannelRuntime {
|
|
118
126
|
id: string;
|
|
119
127
|
isLoggedIn(): boolean;
|
|
@@ -122,15 +130,21 @@ export interface MessageChannelRuntime {
|
|
|
122
130
|
* Destructive credential removal. Reached only via the explicit
|
|
123
131
|
* `xacpx logout` CLI path — never as part of a normal shutdown.
|
|
124
132
|
*/
|
|
125
|
-
logout(): void
|
|
133
|
+
logout(): void | Promise<void>;
|
|
126
134
|
start(input: ChannelStartInput): Promise<void>;
|
|
127
135
|
/**
|
|
128
136
|
* Non-destructive shutdown: release runtime resources without touching
|
|
129
137
|
* stored credentials. Optional for compatibility with already-published
|
|
130
138
|
* plugin channels; when absent, the registry falls back to `logout()`
|
|
131
139
|
* (which for those plugins is a benign client stop).
|
|
140
|
+
*
|
|
141
|
+
* @param reason - The reason for stopping:
|
|
142
|
+
* - "shutdown": normal signal/startup-error cleanup
|
|
143
|
+
* - "disabled": channel disabled via CLI
|
|
144
|
+
* - "removed": channel removed via CLI
|
|
145
|
+
* - "logout": explicit logout command
|
|
132
146
|
*/
|
|
133
|
-
stop?(): void | Promise<void>;
|
|
147
|
+
stop?(reason?: ChannelStopReason): void | Promise<void>;
|
|
134
148
|
createConsumerLock?(options?: ConsumerLockOptions): ConsumerLock;
|
|
135
149
|
configureOrchestration?(callbacks: OrchestrationDeliveryCallbacks): void;
|
|
136
150
|
notifyTaskCompletion(task: OrchestrationTaskRecord): Promise<void>;
|