@a1hvdy/cc-openclaw 0.6.0 → 0.7.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/dist/src/engines/persistent-session.js +13 -0
- package/dist/src/engines/persistent-session.js.map +1 -1
- package/dist/src/lib/config.d.ts +2 -0
- package/dist/src/lib/config.js +19 -0
- package/dist/src/lib/config.js.map +1 -1
- package/dist/src/lib/trajectory.d.ts +1 -1
- package/dist/src/lib/trajectory.js.map +1 -1
- package/dist/src/lib/vendor-paths.d.ts +6 -4
- package/dist/src/lib/vendor-paths.js +21 -14
- package/dist/src/lib/vendor-paths.js.map +1 -1
- package/dist/src/openai-compat/openai-compat.d.ts +7 -1
- package/dist/src/openai-compat/openai-compat.js +35 -4
- package/dist/src/openai-compat/openai-compat.js.map +1 -1
- package/dist/src/openai-compat/sse-translator.d.ts +23 -3
- package/dist/src/openai-compat/sse-translator.js +45 -6
- package/dist/src/openai-compat/sse-translator.js.map +1 -1
- package/dist/src/types.d.ts +9 -0
- package/package.json +2 -3
- package/vendor/base-oneshot-session.d.ts +0 -87
- package/vendor/base-oneshot-session.js +0 -227
- package/vendor/base-oneshot-session.js.map +0 -1
- package/vendor/circuit-breaker.d.ts +0 -21
- package/vendor/circuit-breaker.js +0 -47
- package/vendor/circuit-breaker.js.map +0 -1
- package/vendor/consensus.d.ts +0 -20
- package/vendor/consensus.js +0 -52
- package/vendor/consensus.js.map +0 -1
- package/vendor/constants.d.ts +0 -130
- package/vendor/constants.js +0 -139
- package/vendor/constants.js.map +0 -1
- package/vendor/council.d.ts +0 -67
- package/vendor/council.js +0 -913
- package/vendor/council.js.map +0 -1
- package/vendor/embedded-server.d.ts +0 -25
- package/vendor/embedded-server.js +0 -373
- package/vendor/embedded-server.js.map +0 -1
- package/vendor/inbox-manager.d.ts +0 -38
- package/vendor/inbox-manager.js +0 -111
- package/vendor/inbox-manager.js.map +0 -1
- package/vendor/index.d.ts +0 -63
- package/vendor/index.js +0 -705
- package/vendor/index.js.map +0 -1
- package/vendor/logger.d.ts +0 -16
- package/vendor/logger.js +0 -44
- package/vendor/logger.js.map +0 -1
- package/vendor/models.d.ts +0 -69
- package/vendor/models.js +0 -289
- package/vendor/models.js.map +0 -1
- package/vendor/openai-compat.d.ts +0 -197
- package/vendor/openai-compat.js +0 -765
- package/vendor/openai-compat.js.map +0 -1
- package/vendor/persistent-codex-session.d.ts +0 -16
- package/vendor/persistent-codex-session.js +0 -105
- package/vendor/persistent-codex-session.js.map +0 -1
- package/vendor/persistent-cursor-session.d.ts +0 -21
- package/vendor/persistent-cursor-session.js +0 -241
- package/vendor/persistent-cursor-session.js.map +0 -1
- package/vendor/persistent-custom-session.d.ts +0 -78
- package/vendor/persistent-custom-session.js +0 -937
- package/vendor/persistent-custom-session.js.map +0 -1
- package/vendor/persistent-gemini-session.d.ts +0 -21
- package/vendor/persistent-gemini-session.js +0 -216
- package/vendor/persistent-gemini-session.js.map +0 -1
- package/vendor/persistent-session.d.ts +0 -74
- package/vendor/persistent-session.js +0 -698
- package/vendor/persistent-session.js.map +0 -1
- package/vendor/proxy/anthropic-adapter.d.ts +0 -136
- package/vendor/proxy/anthropic-adapter.js +0 -392
- package/vendor/proxy/anthropic-adapter.js.map +0 -1
- package/vendor/proxy/handler.d.ts +0 -39
- package/vendor/proxy/handler.js +0 -323
- package/vendor/proxy/handler.js.map +0 -1
- package/vendor/proxy/schema-cleaner.d.ts +0 -11
- package/vendor/proxy/schema-cleaner.js +0 -34
- package/vendor/proxy/schema-cleaner.js.map +0 -1
- package/vendor/proxy/thought-cache.d.ts +0 -19
- package/vendor/proxy/thought-cache.js +0 -53
- package/vendor/proxy/thought-cache.js.map +0 -1
- package/vendor/session-manager.d.ts +0 -211
- package/vendor/session-manager.js +0 -1345
- package/vendor/session-manager.js.map +0 -1
- package/vendor/skill-resolver.js +0 -107
- package/vendor/types.d.ts +0 -466
- package/vendor/types.js +0 -8
- package/vendor/types.js.map +0 -1
- package/vendor/validation.d.ts +0 -31
- package/vendor/validation.js +0 -104
- package/vendor/validation.js.map +0 -1
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SessionManager — manages multiple PersistentClaudeSession instances
|
|
3
|
-
*
|
|
4
|
-
* Replaces the Express server layer. Pure class with no HTTP dependency.
|
|
5
|
-
* Can be used by Plugin tools, CLI, or any other consumer.
|
|
6
|
-
*/
|
|
7
|
-
interface PersistedSession {
|
|
8
|
-
name: string;
|
|
9
|
-
claudeSessionId: string;
|
|
10
|
-
cwd: string;
|
|
11
|
-
model?: string;
|
|
12
|
-
engine?: EngineType;
|
|
13
|
-
originalCreated: string;
|
|
14
|
-
lastResumed: string;
|
|
15
|
-
lastActivity: number;
|
|
16
|
-
}
|
|
17
|
-
import { type Logger } from './logger.js';
|
|
18
|
-
import { type SessionConfig, type SessionInfo, type SendResult, type PluginConfig, type EffortLevel, type EngineType, type AgentInfo, type SkillInfo, type RuleInfo, type StreamEvent, type ISession, type CouncilConfig, type CouncilSession, type CouncilReviewResult, type CouncilAcceptResult, type CouncilRejectResult, type InboxMessage, type UltraplanResult, type UltrareviewResult } from './types.js';
|
|
19
|
-
interface SendOptions {
|
|
20
|
-
effort?: EffortLevel;
|
|
21
|
-
plan?: boolean;
|
|
22
|
-
autoResume?: boolean;
|
|
23
|
-
timeout?: number;
|
|
24
|
-
onEvent?: (event: StreamEvent) => void;
|
|
25
|
-
onChunk?: (chunk: string) => void;
|
|
26
|
-
}
|
|
27
|
-
export declare class SessionManager {
|
|
28
|
-
private sessions;
|
|
29
|
-
private _pendingSessions;
|
|
30
|
-
private cleanupTimer;
|
|
31
|
-
private pluginConfig;
|
|
32
|
-
private persistedSessions;
|
|
33
|
-
private _debouncedSave;
|
|
34
|
-
private _proxyServer;
|
|
35
|
-
private _proxyPort;
|
|
36
|
-
private _activePids;
|
|
37
|
-
private _circuitBreaker;
|
|
38
|
-
private _inbox;
|
|
39
|
-
private logger;
|
|
40
|
-
constructor(config?: Partial<PluginConfig>, logger?: Logger);
|
|
41
|
-
startSession(config: Partial<SessionConfig> & {
|
|
42
|
-
name?: string;
|
|
43
|
-
}): Promise<SessionInfo>;
|
|
44
|
-
private _doStartSession;
|
|
45
|
-
sendMessage(name: string, message: string, options?: SendOptions): Promise<SendResult>;
|
|
46
|
-
stopSession(name: string): Promise<void>;
|
|
47
|
-
listSessions(): SessionInfo[];
|
|
48
|
-
listPersistedSessions(): PersistedSession[];
|
|
49
|
-
getStatus(name: string): SessionInfo & {
|
|
50
|
-
stats: ReturnType<ISession['getStats']>;
|
|
51
|
-
};
|
|
52
|
-
grepSession(name: string, pattern: string, limit?: number): Promise<Array<{
|
|
53
|
-
time: string;
|
|
54
|
-
type: string;
|
|
55
|
-
content: string;
|
|
56
|
-
}>>;
|
|
57
|
-
compactSession(name: string, summary?: string): Promise<void>;
|
|
58
|
-
setEffort(name: string, level: EffortLevel): void;
|
|
59
|
-
/**
|
|
60
|
-
* Switch model for a session.
|
|
61
|
-
* Updates in-memory config only (takes effect on next restart/resume).
|
|
62
|
-
* For immediate effect, call restartWithConfig() explicitly.
|
|
63
|
-
*/
|
|
64
|
-
setModel(name: string, model: string): void;
|
|
65
|
-
/**
|
|
66
|
-
* Switch model immediately by restarting the session with --resume.
|
|
67
|
-
* Conversation history is preserved via the claude session ID.
|
|
68
|
-
*
|
|
69
|
-
* Guards:
|
|
70
|
-
* - Rejects if session is currently processing a message (busy guard)
|
|
71
|
-
* - Validates model string against known aliases before restarting
|
|
72
|
-
* - Rolls back to old session if startSession fails
|
|
73
|
-
*/
|
|
74
|
-
switchModel(name: string, model: string): Promise<SessionInfo>;
|
|
75
|
-
/**
|
|
76
|
-
* Update allowedTools or disallowedTools at runtime.
|
|
77
|
-
*
|
|
78
|
-
* The claude CLI does not support changing tool lists while running, so
|
|
79
|
-
* the only way to apply new constraints is to restart the process with
|
|
80
|
-
* the updated flags and --resume to replay conversation history.
|
|
81
|
-
*
|
|
82
|
-
* Guards:
|
|
83
|
-
* - Rejects if session is busy
|
|
84
|
-
* - Rolls back to old session if startSession fails
|
|
85
|
-
* - merge:true adds tools; removeTools removes specific tools from the list
|
|
86
|
-
*/
|
|
87
|
-
updateTools(name: string, opts: {
|
|
88
|
-
allowedTools?: string[];
|
|
89
|
-
disallowedTools?: string[];
|
|
90
|
-
removeTools?: string[];
|
|
91
|
-
merge?: boolean;
|
|
92
|
-
}): Promise<SessionInfo>;
|
|
93
|
-
getCost(name: string): import("./types.js").CostBreakdown;
|
|
94
|
-
listAgents(cwd?: string): AgentInfo[];
|
|
95
|
-
createAgent(name: string, cwd?: string, description?: string, prompt?: string): string;
|
|
96
|
-
listSkills(cwd?: string): SkillInfo[];
|
|
97
|
-
createSkill(name: string, cwd?: string, opts?: {
|
|
98
|
-
description?: string;
|
|
99
|
-
prompt?: string;
|
|
100
|
-
trigger?: string;
|
|
101
|
-
}): string;
|
|
102
|
-
listRules(cwd?: string): RuleInfo[];
|
|
103
|
-
createRule(name: string, cwd?: string, opts?: {
|
|
104
|
-
description?: string;
|
|
105
|
-
content?: string;
|
|
106
|
-
paths?: string;
|
|
107
|
-
condition?: string;
|
|
108
|
-
}): string;
|
|
109
|
-
teamList(name: string): Promise<string>;
|
|
110
|
-
teamSend(name: string, teammate: string, message: string): Promise<SendResult>;
|
|
111
|
-
/**
|
|
112
|
-
* Returns an overview of all active sessions — analogous to a dashboard.
|
|
113
|
-
* Unlike claude_session_status (single session), this gives the aggregate
|
|
114
|
-
* view: how many sessions are running, which are busy, total uptime, etc.
|
|
115
|
-
*/
|
|
116
|
-
health(): {
|
|
117
|
-
ok: boolean;
|
|
118
|
-
version: string;
|
|
119
|
-
sessions: number;
|
|
120
|
-
sessionNames: string[];
|
|
121
|
-
uptime: number;
|
|
122
|
-
details: Array<{
|
|
123
|
-
name: string;
|
|
124
|
-
ready: boolean;
|
|
125
|
-
busy: boolean;
|
|
126
|
-
paused: boolean;
|
|
127
|
-
turns: number;
|
|
128
|
-
costUsd: number;
|
|
129
|
-
contextPercent: number;
|
|
130
|
-
lastActivity: string | null;
|
|
131
|
-
}>;
|
|
132
|
-
circuitBreakers: Record<string, {
|
|
133
|
-
failures: number;
|
|
134
|
-
backoffUntil: string | null;
|
|
135
|
-
}>;
|
|
136
|
-
};
|
|
137
|
-
/** Return plugin version from package.json */
|
|
138
|
-
getVersion(): string;
|
|
139
|
-
/**
|
|
140
|
-
* Gracefully shut down the session manager.
|
|
141
|
-
*
|
|
142
|
-
* 1. Cancels the periodic TTL cleanup timer
|
|
143
|
-
* 2. Stops all ultrareview polling intervals
|
|
144
|
-
* 3. Sends SIGTERM to all active session child processes
|
|
145
|
-
* 4. Persists final session registry to disk
|
|
146
|
-
*
|
|
147
|
-
* After shutdown(), no new sessions can be started. Idempotent.
|
|
148
|
-
*/
|
|
149
|
-
shutdown(): Promise<void>;
|
|
150
|
-
/**
|
|
151
|
-
* Read OpenClaw gateway config from ~/.openclaw/openclaw.json.
|
|
152
|
-
* Returns { url, key } or null if not configured.
|
|
153
|
-
*/
|
|
154
|
-
private _readGatewayConfig;
|
|
155
|
-
/**
|
|
156
|
-
* Start a local proxy server (if not running) that converts Anthropic format
|
|
157
|
-
* to OpenAI format and forwards to the OpenClaw gateway.
|
|
158
|
-
* Returns the proxy port, or null if gateway is not available.
|
|
159
|
-
*/
|
|
160
|
-
private _ensureProxyServer;
|
|
161
|
-
private _persistSession;
|
|
162
|
-
private static PID_FILE;
|
|
163
|
-
private _savePids;
|
|
164
|
-
/**
|
|
165
|
-
* Verify that a PID belongs to a known coding CLI before killing it.
|
|
166
|
-
* Prevents killing unrelated processes if the OS recycled the PID.
|
|
167
|
-
*/
|
|
168
|
-
private _isKnownCliProcess;
|
|
169
|
-
private _cleanupOrphanedPids;
|
|
170
|
-
private _getSession;
|
|
171
|
-
private _toSessionInfo;
|
|
172
|
-
private _resolveModel;
|
|
173
|
-
private _listMdFiles;
|
|
174
|
-
private _createSession;
|
|
175
|
-
private councils;
|
|
176
|
-
private councilCleanupTimers;
|
|
177
|
-
councilStart(task: string, config: CouncilConfig): CouncilSession;
|
|
178
|
-
private _scheduleCouncilCleanup;
|
|
179
|
-
councilStatus(id: string): CouncilSession | undefined;
|
|
180
|
-
councilAbort(id: string): void;
|
|
181
|
-
councilInject(id: string, message: string): void;
|
|
182
|
-
councilReview(id: string): Promise<CouncilReviewResult>;
|
|
183
|
-
councilAccept(id: string): Promise<CouncilAcceptResult>;
|
|
184
|
-
councilReject(id: string, feedback: string): Promise<CouncilRejectResult>;
|
|
185
|
-
private get _sessionLookup();
|
|
186
|
-
sessionSendTo(from: string, to: string, message: string, summary?: string): Promise<{
|
|
187
|
-
delivered: boolean;
|
|
188
|
-
queued: boolean;
|
|
189
|
-
}>;
|
|
190
|
-
sessionInbox(name: string, unreadOnly?: boolean): InboxMessage[];
|
|
191
|
-
sessionDeliverInbox(name: string): Promise<number>;
|
|
192
|
-
private ultraplans;
|
|
193
|
-
ultraplanStart(task: string, opts?: {
|
|
194
|
-
model?: string;
|
|
195
|
-
cwd?: string;
|
|
196
|
-
timeout?: number;
|
|
197
|
-
}): UltraplanResult;
|
|
198
|
-
private _runUltraplan;
|
|
199
|
-
ultraplanStatus(id: string): UltraplanResult | undefined;
|
|
200
|
-
private ultrareviews;
|
|
201
|
-
private ultrareviewPollers;
|
|
202
|
-
ultrareviewStart(cwd: string, opts?: {
|
|
203
|
-
agentCount?: number;
|
|
204
|
-
maxDurationMinutes?: number;
|
|
205
|
-
model?: string;
|
|
206
|
-
focus?: string;
|
|
207
|
-
}): UltrareviewResult;
|
|
208
|
-
ultrareviewStatus(id: string): UltrareviewResult | undefined;
|
|
209
|
-
private _cleanupIdleSessions;
|
|
210
|
-
}
|
|
211
|
-
export {};
|