weacpx 0.6.0 → 0.6.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.
Files changed (48) hide show
  1. package/dist/bridge/bridge-main.js +59 -23
  2. package/dist/channels/types.d.ts +5 -0
  3. package/dist/cli.js +328 -158
  4. package/dist/commands/command-hints.d.ts +11 -0
  5. package/dist/commands/command-list.d.ts +3 -0
  6. package/dist/commands/config-clone.d.ts +2 -0
  7. package/dist/commands/handlers/agent-handler.d.ts +6 -0
  8. package/dist/commands/handlers/config-handler.d.ts +5 -0
  9. package/dist/commands/handlers/later-handler.d.ts +21 -0
  10. package/dist/commands/handlers/orchestration-handler.d.ts +16 -0
  11. package/dist/commands/handlers/permission-handler.d.ts +9 -0
  12. package/dist/commands/handlers/session-handler.d.ts +37 -0
  13. package/dist/commands/handlers/workspace-handler.d.ts +8 -0
  14. package/dist/commands/help/help-registry.d.ts +4 -0
  15. package/dist/commands/help/help-types.d.ts +12 -0
  16. package/dist/commands/parse-command.d.ts +175 -0
  17. package/dist/commands/router-types.d.ts +144 -0
  18. package/dist/commands/workspace-name.d.ts +4 -0
  19. package/dist/commands/workspace-path.d.ts +4 -0
  20. package/dist/config/agent-templates.d.ts +4 -0
  21. package/dist/config/config-store.d.ts +13 -0
  22. package/dist/config/load-config.d.ts +10 -0
  23. package/dist/config/resolve-agent-command.d.ts +2 -0
  24. package/dist/formatting/render-text.d.ts +23 -0
  25. package/dist/orchestration/async-mutex.d.ts +4 -0
  26. package/dist/orchestration/build-coordinator-prompt.d.ts +66 -0
  27. package/dist/orchestration/orchestration-service.d.ts +471 -0
  28. package/dist/orchestration/progress-line-parser.d.ts +19 -0
  29. package/dist/orchestration/render-delegate-group-result.d.ts +6 -0
  30. package/dist/orchestration/render-delegate-question-package.d.ts +21 -0
  31. package/dist/orchestration/render-delegate-result.d.ts +2 -0
  32. package/dist/orchestration/task-watch-timeouts.d.ts +5 -0
  33. package/dist/plugin-api.d.ts +1 -0
  34. package/dist/scheduled/parse-later-time.d.ts +11 -0
  35. package/dist/scheduled/scheduled-render.d.ts +7 -0
  36. package/dist/scheduled/scheduled-service.d.ts +41 -0
  37. package/dist/scheduled/scheduled-types.d.ts +29 -0
  38. package/dist/sessions/session-service.d.ts +83 -0
  39. package/dist/state/state-store.d.ts +8 -0
  40. package/dist/state/types.d.ts +44 -0
  41. package/dist/transport/tool-event-mode.d.ts +14 -0
  42. package/dist/transport/types.d.ts +129 -0
  43. package/dist/util/path.d.ts +4 -0
  44. package/dist/util/sanitize.d.ts +10 -0
  45. package/dist/util/text.d.ts +3 -0
  46. package/dist/version.d.ts +2 -0
  47. package/dist/weixin/auth/accounts.d.ts +0 -1
  48. package/package.json +1 -1
@@ -0,0 +1,11 @@
1
+ export interface CommandHint {
2
+ /** 输入框命令名,含前导斜杠,如 "/session"。 */
3
+ name: string;
4
+ /** 简短描述,取自对应 help topic 的 summary(平台可能截断)。 */
5
+ description: string;
6
+ }
7
+ /**
8
+ * 从 HELP_TOPICS 派生输入框命令提示(单一真源,与 /help 同源不漂移)。
9
+ * 额外置顶 /help。
10
+ */
11
+ export declare function listWeacpxCommandHints(): CommandHint[];
@@ -0,0 +1,3 @@
1
+ export declare const WEACPX_KNOWN_COMMAND_PREFIXES: readonly ["/help", "/agents", "/workspaces", "/sessions", "/tasks", "/status", "/cancel", "/stop", "/clear", "/mode", "/replymode", "/config", "/permission", "/pm", "/session", "/ss", "/ssn", "/workspace", "/ws", "/use", "/agent", "/delegate", "/dg", "/group", "/groups", "/task", "/later", "/lt"];
2
+ export declare function isKnownWeacpxCommandPrefix(prefix: string): boolean;
3
+ export declare function isKnownWeacpxCommandText(text: string): boolean;
@@ -0,0 +1,2 @@
1
+ import type { AppConfig } from "../config/types";
2
+ export declare function cloneAppConfig(config: AppConfig): AppConfig;
@@ -0,0 +1,6 @@
1
+ import type { HelpTopicMetadata } from "../help/help-types";
2
+ import type { CommandRouterContext, RouterResponse } from "../router-types";
3
+ export declare const agentHelp: HelpTopicMetadata;
4
+ export declare function handleAgents(context: CommandRouterContext): RouterResponse;
5
+ export declare function handleAgentAdd(context: CommandRouterContext, templateName: string): Promise<RouterResponse>;
6
+ export declare function handleAgentRemove(context: CommandRouterContext, agentName: string): Promise<RouterResponse>;
@@ -0,0 +1,5 @@
1
+ import type { HelpTopicMetadata } from "../help/help-types";
2
+ import type { CommandRouterContext, RouterResponse } from "../router-types";
3
+ export declare const configHelp: HelpTopicMetadata;
4
+ export declare function handleConfigShow(context: CommandRouterContext): RouterResponse;
5
+ export declare function handleConfigSet(context: CommandRouterContext, path: string, rawValue: string): Promise<RouterResponse>;
@@ -0,0 +1,21 @@
1
+ import type { RouterResponse, ScheduledRouterOps } from "../router-types";
2
+ import type { ScheduledSessionMode } from "../../scheduled/scheduled-types";
3
+ export declare const laterHelpMetadata: {
4
+ topic: string;
5
+ aliases: string[];
6
+ summary: string;
7
+ commands: {
8
+ usage: string;
9
+ description: string;
10
+ }[];
11
+ examples: string[];
12
+ notes: string[];
13
+ };
14
+ export declare function handleLaterHelp(): RouterResponse;
15
+ export declare function handleLaterCreate(tokens: string[], scheduled: ScheduledRouterOps, chatKey: string, currentSession: {
16
+ alias: string;
17
+ agent: string;
18
+ workspace: string;
19
+ } | null, defaultMode: ScheduledSessionMode, accountId?: string, replyContextToken?: string): Promise<RouterResponse>;
20
+ export declare function handleLaterList(scheduled: ScheduledRouterOps): RouterResponse;
21
+ export declare function handleLaterCancel(id: string, scheduled: ScheduledRouterOps): Promise<RouterResponse>;
@@ -0,0 +1,16 @@
1
+ import type { GroupListFilter, TaskListFilter } from "../parse-command";
2
+ import type { HelpTopicMetadata } from "../help/help-types";
3
+ import type { CommandRouterContext, RouterResponse } from "../router-types";
4
+ export declare const orchestrationHelp: HelpTopicMetadata;
5
+ export declare function handleDelegateRequest(context: CommandRouterContext, chatKey: string, targetAgent: string, task: string, role?: string, groupId?: string, replyContextToken?: string, accountId?: string): Promise<RouterResponse>;
6
+ export declare function handleGroupCreate(context: CommandRouterContext, chatKey: string, title: string): Promise<RouterResponse>;
7
+ export declare function handleGroupList(context: CommandRouterContext, chatKey: string, filter?: GroupListFilter): Promise<RouterResponse>;
8
+ export declare function handleGroupGet(context: CommandRouterContext, chatKey: string, groupId: string): Promise<RouterResponse>;
9
+ export declare function handleGroupCancel(context: CommandRouterContext, chatKey: string, groupId: string): Promise<RouterResponse>;
10
+ export declare function handleGroupDelegate(context: CommandRouterContext, chatKey: string, groupId: string, targetAgent: string, task: string, role?: string, replyContextToken?: string, accountId?: string): Promise<RouterResponse>;
11
+ export declare function handleTaskList(context: CommandRouterContext, chatKey: string, filter?: TaskListFilter): Promise<RouterResponse>;
12
+ export declare function handleTaskGet(context: CommandRouterContext, chatKey: string, taskId: string): Promise<RouterResponse>;
13
+ export declare function handleTaskApprove(context: CommandRouterContext, chatKey: string, taskId: string): Promise<RouterResponse>;
14
+ export declare function handleTaskReject(context: CommandRouterContext, chatKey: string, taskId: string): Promise<RouterResponse>;
15
+ export declare function handleTaskCancel(context: CommandRouterContext, chatKey: string, taskId: string): Promise<RouterResponse>;
16
+ export declare function handleTasksClean(context: CommandRouterContext, chatKey: string): Promise<RouterResponse>;
@@ -0,0 +1,9 @@
1
+ import type { NonInteractivePermissions, PermissionMode, AppConfig } from "../../config/types";
2
+ import type { HelpTopicMetadata } from "../help/help-types";
3
+ import type { CommandRouterContext, RouterResponse } from "../router-types";
4
+ export declare const permissionHelp: HelpTopicMetadata;
5
+ export declare function handlePermissionStatus(context: CommandRouterContext, title: string): RouterResponse;
6
+ export declare function handlePermissionModeSet(context: CommandRouterContext, mode: PermissionMode): Promise<RouterResponse>;
7
+ export declare function handlePermissionAutoStatus(context: CommandRouterContext, title: string): RouterResponse;
8
+ export declare function handlePermissionAutoSet(context: CommandRouterContext, policy: NonInteractivePermissions): Promise<RouterResponse>;
9
+ export declare function renderPermissionStatus(config: AppConfig | undefined, title: string): string;
@@ -0,0 +1,37 @@
1
+ import type { CommandRouterContext, RouterResponse, SessionInteractionOps, SessionLifecycleOps, SessionRenderRecoveryOps } from "../router-types";
2
+ import type { PromptMediaInput, ResolvedSession } from "../../transport/types";
3
+ import type { ToolUseEvent } from "../../channels/types.js";
4
+ import type { PerfSpan } from "../../perf/perf-tracer";
5
+ import type { HelpTopicMetadata } from "../help/help-types";
6
+ import type { ChatRequestMetadata } from "../../weixin/agent/interface";
7
+ export interface SessionHandlerContext extends CommandRouterContext {
8
+ lifecycle: SessionLifecycleOps;
9
+ interaction: SessionInteractionOps;
10
+ recovery: SessionRenderRecoveryOps;
11
+ }
12
+ export declare const sessionHelp: HelpTopicMetadata;
13
+ export declare const nativeSessionHelp: HelpTopicMetadata;
14
+ export declare const modeHelp: HelpTopicMetadata;
15
+ export declare const replyModeHelp: HelpTopicMetadata;
16
+ export declare const statusHelp: HelpTopicMetadata;
17
+ export declare const cancelHelp: HelpTopicMetadata;
18
+ export declare function handleSessions(context: SessionHandlerContext, chatKey: string): Promise<RouterResponse>;
19
+ export declare function handleSessionNew(context: SessionHandlerContext, chatKey: string, alias: string, agent: string, workspace: string): Promise<RouterResponse>;
20
+ export declare function handleSessionShortcut(context: SessionHandlerContext, chatKey: string, agent: string, target: {
21
+ cwd?: string;
22
+ workspace?: string;
23
+ }, createNew: boolean): Promise<RouterResponse>;
24
+ export declare function handleSessionAttach(context: SessionHandlerContext, chatKey: string, alias: string, agent: string, workspace: string, transportSession: string): Promise<RouterResponse>;
25
+ export declare function handleSessionUse(context: SessionHandlerContext, chatKey: string, alias: string): Promise<RouterResponse>;
26
+ export declare function handleModeShow(context: SessionHandlerContext, chatKey: string): Promise<RouterResponse>;
27
+ export declare function handleModeSet(context: SessionHandlerContext, chatKey: string, modeId: string): Promise<RouterResponse>;
28
+ export declare function handleReplyModeShow(context: SessionHandlerContext, chatKey: string): Promise<RouterResponse>;
29
+ export declare function handleReplyModeSet(context: SessionHandlerContext, chatKey: string, replyMode: "stream" | "final" | "verbose"): Promise<RouterResponse>;
30
+ export declare function handleReplyModeReset(context: SessionHandlerContext, chatKey: string): Promise<RouterResponse>;
31
+ export declare function handleStatus(context: SessionHandlerContext, chatKey: string): Promise<RouterResponse>;
32
+ export declare function handleCancel(context: SessionHandlerContext, chatKey: string): Promise<RouterResponse>;
33
+ export declare function handleSessionReset(context: SessionHandlerContext, chatKey: string): Promise<RouterResponse>;
34
+ export declare function handleSessionTail(context: SessionHandlerContext, chatKey: string, lines?: number): Promise<RouterResponse>;
35
+ export declare function handleSessionRemove(context: SessionHandlerContext, chatKey: string, alias: string): Promise<RouterResponse>;
36
+ export declare function handlePromptWithSession(context: SessionHandlerContext, session: ResolvedSession, chatKey: string, text: string, reply?: (text: string) => Promise<void>, replyContextToken?: string, accountId?: string, media?: PromptMediaInput, abortSignal?: AbortSignal, onToolEvent?: (event: ToolUseEvent) => void | Promise<void>, onThought?: (chunk: string) => void | Promise<void>, perfSpan?: PerfSpan, metadata?: ChatRequestMetadata): Promise<RouterResponse>;
37
+ export declare function handlePrompt(context: SessionHandlerContext, chatKey: string, text: string, reply?: (text: string) => Promise<void>, replyContextToken?: string, accountId?: string, media?: PromptMediaInput, abortSignal?: AbortSignal, onToolEvent?: (event: ToolUseEvent) => void | Promise<void>, onThought?: (chunk: string) => void | Promise<void>, perfSpan?: PerfSpan, metadata?: ChatRequestMetadata): Promise<RouterResponse>;
@@ -0,0 +1,8 @@
1
+ import type { HelpTopicMetadata } from "../help/help-types";
2
+ import type { CommandRouterContext, RouterResponse } from "../router-types";
3
+ export declare const workspaceHelp: HelpTopicMetadata;
4
+ export declare function handleWorkspaces(context: CommandRouterContext): RouterResponse;
5
+ export declare function handleWorkspaceCreate(context: CommandRouterContext, workspaceName: string, cwd: string, options?: {
6
+ raw?: boolean;
7
+ }): Promise<RouterResponse>;
8
+ export declare function handleWorkspaceRemove(context: CommandRouterContext, workspaceName: string): Promise<RouterResponse>;
@@ -0,0 +1,4 @@
1
+ import type { HelpTopicMetadata } from "./help-types";
2
+ export declare const HELP_TOPICS: HelpTopicMetadata[];
3
+ export declare function getHelpTopic(topic: string): HelpTopicMetadata | null;
4
+ export declare function listHelpTopics(): HelpTopicMetadata[];
@@ -0,0 +1,12 @@
1
+ export interface HelpCommandEntry {
2
+ usage: string;
3
+ description: string;
4
+ }
5
+ export interface HelpTopicMetadata {
6
+ topic: string;
7
+ aliases: string[];
8
+ summary: string;
9
+ commands: HelpCommandEntry[];
10
+ examples?: string[];
11
+ notes?: string[];
12
+ }
@@ -0,0 +1,175 @@
1
+ import type { OrchestrationTaskStatus } from "../orchestration/orchestration-types";
2
+ export interface TaskListFilter {
3
+ status?: OrchestrationTaskStatus;
4
+ stuck?: boolean;
5
+ sort?: "updatedAt" | "createdAt";
6
+ order?: "asc" | "desc";
7
+ }
8
+ export interface GroupListFilter {
9
+ status?: "pending" | "running" | "terminal";
10
+ stuck?: boolean;
11
+ sort?: "updatedAt" | "createdAt";
12
+ order?: "asc" | "desc";
13
+ }
14
+ export type ParsedCommand = {
15
+ kind: "help";
16
+ topic?: string;
17
+ } | {
18
+ kind: "agents";
19
+ } | {
20
+ kind: "agent.add";
21
+ template: string;
22
+ } | {
23
+ kind: "agent.rm";
24
+ name: string;
25
+ } | {
26
+ kind: "permission.status";
27
+ } | {
28
+ kind: "permission.mode.set";
29
+ mode: "approve-all" | "approve-reads" | "deny-all";
30
+ } | {
31
+ kind: "permission.auto.status";
32
+ } | {
33
+ kind: "permission.auto.set";
34
+ policy: "deny" | "fail";
35
+ } | {
36
+ kind: "config.show";
37
+ } | {
38
+ kind: "config.set";
39
+ path: string;
40
+ value: string;
41
+ } | {
42
+ kind: "workspaces";
43
+ } | {
44
+ kind: "workspace.new";
45
+ name: string;
46
+ cwd: string;
47
+ raw?: boolean;
48
+ } | {
49
+ kind: "workspace.rm";
50
+ name: string;
51
+ } | {
52
+ kind: "sessions";
53
+ } | {
54
+ kind: "status";
55
+ } | {
56
+ kind: "cancel";
57
+ } | {
58
+ kind: "session.reset";
59
+ } | {
60
+ kind: "session.tail";
61
+ lines?: number;
62
+ } | {
63
+ kind: "session.rm";
64
+ alias: string;
65
+ } | {
66
+ kind: "delegate.request";
67
+ targetAgent: string;
68
+ role?: string;
69
+ groupId?: string;
70
+ task: string;
71
+ } | {
72
+ kind: "groups";
73
+ filter?: GroupListFilter;
74
+ } | {
75
+ kind: "group.new";
76
+ title: string;
77
+ } | {
78
+ kind: "group.get";
79
+ groupId: string;
80
+ } | {
81
+ kind: "group.cancel";
82
+ groupId: string;
83
+ } | {
84
+ kind: "group.delegate";
85
+ groupId: string;
86
+ targetAgent: string;
87
+ role?: string;
88
+ task: string;
89
+ } | {
90
+ kind: "tasks";
91
+ filter?: TaskListFilter;
92
+ } | {
93
+ kind: "tasks.clean";
94
+ } | {
95
+ kind: "task.get";
96
+ taskId: string;
97
+ } | {
98
+ kind: "task.approve";
99
+ taskId: string;
100
+ } | {
101
+ kind: "task.reject";
102
+ taskId: string;
103
+ } | {
104
+ kind: "task.cancel";
105
+ taskId: string;
106
+ } | {
107
+ kind: "mode.show";
108
+ } | {
109
+ kind: "mode.set";
110
+ modeId: string;
111
+ } | {
112
+ kind: "replymode.show";
113
+ } | {
114
+ kind: "replymode.set";
115
+ replyMode: "stream" | "final" | "verbose";
116
+ } | {
117
+ kind: "replymode.reset";
118
+ } | {
119
+ kind: "session.use";
120
+ alias: string;
121
+ } | {
122
+ kind: "session.new";
123
+ alias: string;
124
+ agent: string;
125
+ workspace: string;
126
+ } | {
127
+ kind: "session.shortcut";
128
+ agent: string;
129
+ cwd?: string;
130
+ workspace?: string;
131
+ } | {
132
+ kind: "session.shortcut.new";
133
+ agent: string;
134
+ cwd?: string;
135
+ workspace?: string;
136
+ } | {
137
+ kind: "session.attach";
138
+ alias: string;
139
+ agent: string;
140
+ workspace: string;
141
+ transportSession: string;
142
+ } | {
143
+ kind: "session.native.list";
144
+ agent?: string;
145
+ cwd?: string;
146
+ workspace?: string;
147
+ all?: boolean;
148
+ cursor?: string;
149
+ } | {
150
+ kind: "session.native.select";
151
+ identifier: string;
152
+ alias?: string;
153
+ } | {
154
+ kind: "session.native.attach";
155
+ identifier: string;
156
+ alias?: string;
157
+ } | {
158
+ kind: "later.help";
159
+ } | {
160
+ kind: "later.create";
161
+ tokens: string[];
162
+ } | {
163
+ kind: "later.list";
164
+ } | {
165
+ kind: "later.cancel";
166
+ id: string;
167
+ } | {
168
+ kind: "invalid";
169
+ text: string;
170
+ recognizedCommand: string;
171
+ } | {
172
+ kind: "prompt";
173
+ text: string;
174
+ };
175
+ export declare function parseCommand(input: string): ParsedCommand;
@@ -0,0 +1,144 @@
1
+ import type { ConfigStore } from "../config/config-store";
2
+ import type { AppConfig } from "../config/types";
3
+ import type { AppLogger } from "../logging/app-logger";
4
+ import type { OrchestrationService } from "../orchestration/orchestration-service";
5
+ import type { SessionService } from "../sessions/session-service";
6
+ import type { PromptMediaInput, ReplyQuotaContext, SessionTransport } from "../transport/types";
7
+ import type { QuotaManager } from "../weixin/messaging/quota-manager.js";
8
+ import type { ToolUseEvent } from "../channels/types.js";
9
+ import type { PerfSpan } from "../perf/perf-tracer";
10
+ export interface RouterResponse {
11
+ text?: string;
12
+ }
13
+ export interface PromptRouteMetadata {
14
+ chatKey: string;
15
+ replyContextToken?: string;
16
+ accountId?: string;
17
+ }
18
+ export interface CoordinatorTaskQuestionRef {
19
+ taskId: string;
20
+ questionId: string;
21
+ }
22
+ export interface ActiveHumanQuestionPackageContext {
23
+ packageId: string;
24
+ promptText: string;
25
+ awaitingReplyMessageId?: string;
26
+ deliveredChatKey?: string;
27
+ deliveryAccountId?: string;
28
+ routeReplyContextToken?: string;
29
+ deliveredAt?: string;
30
+ openTaskIds: string[];
31
+ messageTaskQuestions?: Array<{
32
+ taskId: string;
33
+ questionId: string;
34
+ }>;
35
+ openTaskQuestions?: Array<{
36
+ taskId: string;
37
+ questionId: string;
38
+ question: string;
39
+ whyBlocked: string;
40
+ whatIsNeeded: string;
41
+ }>;
42
+ queuedCount: number;
43
+ }
44
+ export type WritableConfigStore = Pick<ConfigStore, "load" | "save" | "upsertWorkspace" | "removeWorkspace" | "upsertAgent" | "removeAgent" | "updateTransport" | "updateChannel">;
45
+ export interface CommandRouterContext {
46
+ sessions: SessionService;
47
+ transport: SessionTransport;
48
+ orchestration?: OrchestrationRouterOps;
49
+ config?: AppConfig;
50
+ configStore?: WritableConfigStore;
51
+ logger: AppLogger;
52
+ replaceConfig: (updated: AppConfig) => void;
53
+ quota?: QuotaManager;
54
+ /**
55
+ * Resolves the render format for a chat's `/ssn` native session list. Backed
56
+ * by the channel's declared capability (see MessageChannelRuntime
57
+ * `nativeSessionListFormat`); handlers default to "table" when unset.
58
+ */
59
+ resolveNativeSessionListFormat?: (chatKey: string) => "cards" | "table";
60
+ }
61
+ export interface OrchestrationRouterOps {
62
+ createGroup: OrchestrationService["createGroup"];
63
+ getGroupSummary: OrchestrationService["getGroupSummary"];
64
+ listGroupSummaries: OrchestrationService["listGroupSummaries"];
65
+ cancelGroup: OrchestrationService["cancelGroup"];
66
+ requestDelegate: OrchestrationService["requestDelegate"];
67
+ getTask: OrchestrationService["getTask"];
68
+ listTasks: OrchestrationService["listTasks"];
69
+ requestTaskCancellation: OrchestrationService["requestTaskCancellation"];
70
+ cancelTask: OrchestrationService["cancelTask"];
71
+ approveTask: OrchestrationService["approveTask"];
72
+ cleanTasks: OrchestrationService["cleanTasks"];
73
+ listSessionBlockingTasks: OrchestrationService["listSessionBlockingTasks"];
74
+ purgeSessionReferences: OrchestrationService["purgeSessionReferences"];
75
+ listPendingTaskNotices: OrchestrationService["listPendingTaskNotices"];
76
+ markTaskNoticeDelivered: OrchestrationService["markTaskNoticeDelivered"];
77
+ markTaskNoticeFailed: OrchestrationService["markTaskNoticeFailed"];
78
+ listPendingCoordinatorGroups?: OrchestrationService["listPendingCoordinatorGroups"];
79
+ markCoordinatorGroupsInjected?: OrchestrationService["markCoordinatorGroupsInjected"];
80
+ markCoordinatorGroupsInjectionFailed?: OrchestrationService["markCoordinatorGroupsInjectionFailed"];
81
+ listPendingCoordinatorResults: OrchestrationService["listPendingCoordinatorResults"];
82
+ listPendingCoordinatorBlockers?: OrchestrationService["listPendingCoordinatorBlockers"];
83
+ listContestedCoordinatorResults?: OrchestrationService["listContestedCoordinatorResults"];
84
+ markCoordinatorResultsInjected?: OrchestrationService["markCoordinatorResultsInjected"];
85
+ markTaskInjectionApplied: OrchestrationService["markTaskInjectionApplied"];
86
+ markTaskInjectionFailed: OrchestrationService["markTaskInjectionFailed"];
87
+ recordCoordinatorRouteContext?: OrchestrationService["recordCoordinatorRouteContext"];
88
+ claimActiveHumanReply?: OrchestrationService["claimActiveHumanReply"];
89
+ getActiveHumanQuestionPackage?: (coordinatorSession: string) => Promise<ActiveHumanQuestionPackageContext | null>;
90
+ reserveLogicalTransportSession?: OrchestrationService["reserveLogicalTransportSession"];
91
+ }
92
+ export interface SessionLifecycleOps {
93
+ resolveSession: (alias: string, agent: string, workspace: string, transportSession: string) => import("../transport/types").ResolvedSession;
94
+ ensureTransportSession: (session: import("../transport/types").ResolvedSession, reply?: (text: string) => Promise<void>, perfSpan?: PerfSpan) => Promise<void>;
95
+ checkTransportSession: (session: import("../transport/types").ResolvedSession) => Promise<boolean>;
96
+ markSessionReady?: (session: import("../transport/types").ResolvedSession) => void;
97
+ reserveTransportSession: (transportSession: string) => Promise<() => Promise<void>>;
98
+ handleSessionShortcut: (chatKey: string, agent: string, target: {
99
+ cwd?: string;
100
+ workspace?: string;
101
+ }, createNew: boolean, reply?: (text: string) => Promise<void>) => Promise<RouterResponse>;
102
+ resetCurrentSession: (chatKey: string, reply?: (text: string) => Promise<void>) => Promise<RouterResponse>;
103
+ refreshSessionTransportAgentCommand: (alias: string) => Promise<void>;
104
+ }
105
+ export interface SessionInteractionOps {
106
+ setModeTransportSession: (session: import("../transport/types").ResolvedSession, modeId: string) => Promise<void>;
107
+ cancelTransportSession: (session: import("../transport/types").ResolvedSession) => Promise<{
108
+ cancelled: boolean;
109
+ message: string;
110
+ }>;
111
+ promptTransportSession: (session: import("../transport/types").ResolvedSession, text: string, reply?: (text: string) => Promise<void>, replyContext?: ReplyQuotaContext, media?: PromptMediaInput, abortSignal?: AbortSignal, onToolEvent?: (event: ToolUseEvent) => void | Promise<void>, onThought?: (chunk: string) => void | Promise<void>, perfSpan?: PerfSpan) => Promise<{
112
+ text: string;
113
+ }>;
114
+ }
115
+ export interface SessionRenderRecoveryOps {
116
+ renderSessionCreationError: (session: import("../transport/types").ResolvedSession, error: unknown) => RouterResponse;
117
+ renderSessionCreationVerificationError: (session: import("../transport/types").ResolvedSession) => RouterResponse;
118
+ tryRecoverMissingSession: (session: import("../transport/types").ResolvedSession, error: unknown) => Promise<import("../transport/types").ResolvedSession | null>;
119
+ renderTransportError: (session: import("../transport/types").ResolvedSession, error: unknown) => RouterResponse;
120
+ }
121
+ export interface SessionShortcutOps {
122
+ resolveSession: (alias: string, agent: string, workspace: string, transportSession: string) => import("../transport/types").ResolvedSession;
123
+ ensureTransportSession: (session: import("../transport/types").ResolvedSession, reply?: (text: string) => Promise<void>, perfSpan?: PerfSpan) => Promise<void>;
124
+ checkTransportSession: (session: import("../transport/types").ResolvedSession) => Promise<boolean>;
125
+ reserveTransportSession: (transportSession: string) => Promise<() => Promise<void>>;
126
+ refreshSessionTransportAgentCommand: (alias: string) => Promise<void>;
127
+ }
128
+ export interface SessionRecoveryOps {
129
+ resolveSessionAgentCommand: (session: import("../transport/types").ResolvedSession) => Promise<string | undefined | null>;
130
+ setSessionTransportAgentCommand: (alias: string, command: string) => Promise<void>;
131
+ getSession: (alias: string) => Promise<import("../transport/types").ResolvedSession | null>;
132
+ }
133
+ export interface SessionResetOps {
134
+ ensureTransportSession: (session: import("../transport/types").ResolvedSession, reply?: (text: string) => Promise<void>, perfSpan?: PerfSpan) => Promise<void>;
135
+ checkTransportSession: (session: import("../transport/types").ResolvedSession) => Promise<boolean>;
136
+ reserveTransportSession: (transportSession: string) => Promise<() => Promise<void>>;
137
+ resolveSession: (alias: string, agent: string, workspace: string, transportSession: string) => import("../transport/types").ResolvedSession;
138
+ refreshSessionTransportAgentCommand: (alias: string) => Promise<void>;
139
+ now: () => number;
140
+ }
141
+ export type ScheduledRouterOps = Pick<import("../scheduled/scheduled-service").ScheduledTaskService, "createTask" | "listPending" | "cancelPending">;
142
+ export interface ScheduledDeliveryCapabilityOps {
143
+ supportsScheduledMessages(chatKey: string): boolean;
144
+ }
@@ -0,0 +1,4 @@
1
+ export declare function sanitizeWorkspaceName(input: string, fallback?: string): string;
2
+ export declare function allocateWorkspaceName(base: string, existing: Record<string, unknown>): string;
3
+ export declare function isWorkspaceNameValid(input: string): boolean;
4
+ export declare function quoteWorkspaceNameIfNeeded(input: string): string;
@@ -0,0 +1,4 @@
1
+ export declare function normalizeWorkspacePath(input: string): string;
2
+ export declare function basenameForWorkspacePath(input: string): string;
3
+ export declare function sameWorkspacePath(left: string, right: string): boolean;
4
+ export declare function pathExists(filePath: string): Promise<boolean>;
@@ -0,0 +1,4 @@
1
+ import type { AgentConfig } from "./types";
2
+ export declare function getAgentTemplate(name: string): AgentConfig | null;
3
+ export declare function listAgentTemplates(): string[];
4
+ export declare function sameAgentConfig(left: AgentConfig, right: AgentConfig): boolean;
@@ -0,0 +1,13 @@
1
+ import type { AppConfig } from "./types";
2
+ export declare class ConfigStore {
3
+ private readonly path;
4
+ constructor(path: string);
5
+ load(): Promise<AppConfig>;
6
+ save(config: AppConfig): Promise<void>;
7
+ upsertWorkspace(name: string, cwd: string, description?: string): Promise<AppConfig>;
8
+ removeWorkspace(name: string): Promise<AppConfig>;
9
+ upsertAgent(name: string, agent: AppConfig["agents"][string]): Promise<AppConfig>;
10
+ removeAgent(name: string): Promise<AppConfig>;
11
+ updateTransport(transport: Partial<AppConfig["transport"]>): Promise<AppConfig>;
12
+ updateChannel(channel: Partial<AppConfig["channel"]>): Promise<AppConfig>;
13
+ }
@@ -0,0 +1,10 @@
1
+ import type { AppConfig, LoggingLevel } from "./types";
2
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
3
+ export declare function parsePositiveOptionalNumber(value: unknown, path: string, defaultValue: number): number;
4
+ export declare function loadConfig(path: string): Promise<AppConfig>;
5
+ export declare function loadConfig(path: string, options: {
6
+ defaultLoggingLevel?: LoggingLevel;
7
+ }): Promise<AppConfig>;
8
+ export declare function parseConfig(raw: unknown, options?: {
9
+ defaultLoggingLevel?: LoggingLevel;
10
+ }): AppConfig;
@@ -0,0 +1,2 @@
1
+ export declare function resolveAgentCommand(driver: string, command: string | undefined): string | undefined;
2
+ export declare function isLegacyCodexCommand(command: string): boolean;
@@ -0,0 +1,23 @@
1
+ import type { AppConfig } from "../config/types";
2
+ import type { OrchestrationGroupRecord, OrchestrationGroupSummary, OrchestrationTaskRecord } from "../orchestration/orchestration-types";
3
+ export declare function renderAgents(config: AppConfig): string;
4
+ export declare function renderWorkspaces(config: AppConfig): string;
5
+ export declare function renderOrchestrationUnavailable(): string;
6
+ export declare function renderDelegateSuccess(taskId: string, workerSession: string): string;
7
+ export declare function renderGroupCreated(group: OrchestrationGroupRecord): string;
8
+ export declare function renderGroupList(groups: OrchestrationGroupSummary[]): string;
9
+ export declare function renderGroupSummary(summary: OrchestrationGroupSummary): string;
10
+ export declare function renderGroupCancelSuccess(input: {
11
+ summary: OrchestrationGroupSummary;
12
+ cancelledTaskIds: string[];
13
+ skippedTaskIds: string[];
14
+ }): string;
15
+ export declare function renderTaskList(tasks: OrchestrationTaskRecord[]): string;
16
+ export declare function renderTaskSummary(task: OrchestrationTaskRecord): string;
17
+ export declare function renderTaskCancelSuccess(task: OrchestrationTaskRecord): string;
18
+ export declare function renderTaskApprovalSuccess(task: OrchestrationTaskRecord): string;
19
+ export declare function renderTaskRejectSuccess(task: OrchestrationTaskRecord): string;
20
+ export declare function renderTaskConfirmationUnavailable(task: OrchestrationTaskRecord): string;
21
+ export declare function renderTasksCleanResult(removedTasks: number, removedBindings: number): string;
22
+ export declare function renderTaskProgress(task: OrchestrationTaskRecord, summary: string): string;
23
+ export declare function renderTaskHeartbeat(task: OrchestrationTaskRecord, elapsedSeconds: number): string;
@@ -0,0 +1,4 @@
1
+ export declare class AsyncMutex {
2
+ private tail;
3
+ run<T>(critical: () => Promise<T>): Promise<T>;
4
+ }
@@ -0,0 +1,66 @@
1
+ import type { OrchestrationGroupRecord, OrchestrationTaskRecord } from "./orchestration-types";
2
+ interface ActiveHumanQuestionPackageView {
3
+ packageId: string;
4
+ promptText: string;
5
+ awaitingReplyMessageId?: string;
6
+ deliveredChatKey?: string;
7
+ deliveryAccountId?: string;
8
+ routeReplyContextToken?: string;
9
+ deliveredAt?: string;
10
+ openTaskIds: string[];
11
+ messageTaskQuestions?: Array<{
12
+ taskId: string;
13
+ questionId: string;
14
+ }>;
15
+ openTaskQuestions?: Array<{
16
+ taskId: string;
17
+ questionId: string;
18
+ question: string;
19
+ whyBlocked: string;
20
+ whatIsNeeded: string;
21
+ }>;
22
+ queuedCount: number;
23
+ }
24
+ export declare function shouldBindHumanReply(input: {
25
+ chatKey?: string;
26
+ accountId?: string;
27
+ replyContextToken?: string;
28
+ activePackage?: {
29
+ awaitingReplyMessageId?: string;
30
+ deliveredChatKey?: string;
31
+ deliveryAccountId?: string;
32
+ routeReplyContextToken?: string;
33
+ messageTaskQuestions?: Array<{
34
+ taskId: string;
35
+ questionId: string;
36
+ }>;
37
+ } | null;
38
+ }): boolean;
39
+ export declare function buildCoordinatorPrompt(input: {
40
+ orchestration: {
41
+ listPendingCoordinatorGroups?: (coordinatorSession: string) => Promise<OrchestrationGroupRecord[]>;
42
+ listPendingCoordinatorResults: (coordinatorSession: string) => Promise<OrchestrationTaskRecord[]>;
43
+ listPendingCoordinatorBlockers?: (coordinatorSession: string) => Promise<OrchestrationTaskRecord[]>;
44
+ listContestedCoordinatorResults?: (coordinatorSession: string) => Promise<OrchestrationTaskRecord[]>;
45
+ getActiveHumanQuestionPackage?: (coordinatorSession: string) => Promise<ActiveHumanQuestionPackageView | null>;
46
+ };
47
+ coordinatorSession: string;
48
+ chatKey?: string;
49
+ accountId?: string;
50
+ replyContextToken?: string;
51
+ userText?: string;
52
+ maxPromptLength?: number;
53
+ }): Promise<{
54
+ promptText: string;
55
+ taskIds: string[];
56
+ groupIds: string[];
57
+ claimHumanReply?: {
58
+ coordinatorSession: string;
59
+ chatKey: string;
60
+ packageId: string;
61
+ messageId: string;
62
+ accountId?: string;
63
+ replyContextToken?: string;
64
+ };
65
+ }>;
66
+ export {};