@n1creator/openacp-cli 2026.712.9 → 2026.712.10
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/README.md +18 -0
- package/dist/cli.js +2715 -990
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +95 -6
- package/dist/index.js +1555 -481
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -305,6 +305,17 @@ type CommandResponse = {
|
|
|
305
305
|
question: string;
|
|
306
306
|
onYes: string;
|
|
307
307
|
onNo: string;
|
|
308
|
+
} | {
|
|
309
|
+
/** Request one follow-up text value from the same authenticated conversation. */
|
|
310
|
+
type: 'input';
|
|
311
|
+
prompt: string;
|
|
312
|
+
/** Command invoked with the captured value in CommandArgs.interaction.capturedInput. */
|
|
313
|
+
command: string;
|
|
314
|
+
/** Sensitive values must be removed by the adapter before command dispatch. */
|
|
315
|
+
sensitive?: boolean;
|
|
316
|
+
/** Shown when an adapter cannot provide the requested input guarantees. */
|
|
317
|
+
fallback: string;
|
|
318
|
+
expiresInMs?: number;
|
|
308
319
|
} | {
|
|
309
320
|
type: 'error';
|
|
310
321
|
message: string;
|
|
@@ -354,6 +365,18 @@ interface CommandArgs {
|
|
|
354
365
|
channelId: string;
|
|
355
366
|
/** User ID who invoked the command */
|
|
356
367
|
userId: string;
|
|
368
|
+
/** Stable adapter conversation/topic identifier used to bind short-lived interactions. */
|
|
369
|
+
conversationId?: string;
|
|
370
|
+
/** Input guarantees offered by the invoking adapter. */
|
|
371
|
+
interaction?: {
|
|
372
|
+
textInput: boolean;
|
|
373
|
+
secureInput: 'private' | 'delete-after-capture' | 'none';
|
|
374
|
+
/** One-shot adapter-captured input. Never serialize this into a command string. */
|
|
375
|
+
capturedInput?: {
|
|
376
|
+
value: string;
|
|
377
|
+
sensitive: boolean;
|
|
378
|
+
};
|
|
379
|
+
};
|
|
357
380
|
/** Reply helper — sends message to the topic where command was invoked */
|
|
358
381
|
reply(content: string | CommandResponse | OutgoingMessage): Promise<void>;
|
|
359
382
|
/** Direct access to OpenACPCore instance. Available when 'kernel:access' permission is granted. */
|
|
@@ -1493,11 +1516,15 @@ type ProxyRoute = 'direct' | 'inherit' | `profile:${string}`;
|
|
|
1493
1516
|
interface ProxyProfileInput {
|
|
1494
1517
|
id: string;
|
|
1495
1518
|
name?: string;
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1519
|
+
/** Write-only shorthand; mutually exclusive with endpoint/credential fields. */
|
|
1520
|
+
proxyUrl?: string;
|
|
1521
|
+
protocol?: ProxyProtocol;
|
|
1522
|
+
host?: string;
|
|
1523
|
+
port?: number;
|
|
1499
1524
|
username?: string;
|
|
1500
1525
|
password?: string;
|
|
1526
|
+
/** Explicitly remove an existing credential record. */
|
|
1527
|
+
clearCredentials?: boolean;
|
|
1501
1528
|
noProxy?: string[];
|
|
1502
1529
|
failClosed?: boolean;
|
|
1503
1530
|
}
|
|
@@ -1582,12 +1609,22 @@ declare class ProxyService {
|
|
|
1582
1609
|
getProfile(id: string): ProxyProfile | undefined;
|
|
1583
1610
|
saveProfile(input: ProxyProfileInput): ProxyProfile;
|
|
1584
1611
|
private buildProfile;
|
|
1612
|
+
/** Parse a write-only proxy URL into canonical components without retaining it. */
|
|
1613
|
+
parseProxyUrlInput(proxyUrl: string): Pick<ProxyProfileInput, 'protocol' | 'host' | 'port' | 'username' | 'password' | 'clearCredentials'>;
|
|
1614
|
+
private normalizeProfileInput;
|
|
1585
1615
|
saveProfileSafely(input: ProxyProfileInput, expectedRevision?: number): Promise<ProxyProfile>;
|
|
1616
|
+
createProfileSafely(input: ProxyProfileInput, expectedRevision?: number): Promise<ProxyProfile>;
|
|
1617
|
+
updateProfileSafely(input: ProxyProfileInput, expectedRevision?: number): Promise<ProxyProfile>;
|
|
1618
|
+
private mutateProfileSafely;
|
|
1586
1619
|
/** Import a conventional proxy env file without ever returning or logging its credential URL. */
|
|
1587
1620
|
importEnvFile(id: string, envFile: string, name?: string): ProxyProfile;
|
|
1588
1621
|
private parseEnvFile;
|
|
1589
1622
|
importEnvFileSafely(id: string, envFile: string, name?: string, expectedRevision?: number): Promise<ProxyProfile>;
|
|
1590
1623
|
deleteProfile(id: string, expectedRevision?: number): Promise<void>;
|
|
1624
|
+
/** Delete a profile, optionally reassigning every direct reference in one tested CAS transaction. */
|
|
1625
|
+
deleteProfileSafely(id: string, reassign?: ProxyRoute, expectedRevision?: number): Promise<{
|
|
1626
|
+
reassignedScopes: string[];
|
|
1627
|
+
}>;
|
|
1591
1628
|
resolve(scope: string, routeOverride?: ProxyRoute): ProxyRouteResolution;
|
|
1592
1629
|
private resolveFromConfig;
|
|
1593
1630
|
setRoute(scope: string, route: ProxyRoute, expectedRevision?: number): Promise<ProxyRouteChangeResult>;
|
|
@@ -1608,6 +1645,12 @@ declare class ProxyService {
|
|
|
1608
1645
|
status?: number;
|
|
1609
1646
|
error?: string;
|
|
1610
1647
|
}>;
|
|
1648
|
+
/** Test an unsaved profile candidate entirely in memory. Credentials never reach persistence. */
|
|
1649
|
+
testProfileCandidate(input: ProxyProfileInput, targetUrl?: string): Promise<{
|
|
1650
|
+
ok: boolean;
|
|
1651
|
+
status?: number;
|
|
1652
|
+
error?: string;
|
|
1653
|
+
}>;
|
|
1611
1654
|
status(): ProxyStatus;
|
|
1612
1655
|
private validateRoute;
|
|
1613
1656
|
private testCandidateRoutes;
|
|
@@ -1973,6 +2016,9 @@ declare class Session extends TypedEmitter<SessionEvents> {
|
|
|
1973
2016
|
private _abortedTurnIds;
|
|
1974
2017
|
/** Last completed turnId — used by abortPrompt() to retroactively mark a just-finished turn as interrupted */
|
|
1975
2018
|
private _lastCompletedTurnId;
|
|
2019
|
+
/** Idempotent teardown checkpoints allow cleanup retry after a partial failure. */
|
|
2020
|
+
private _destroyedAgent;
|
|
2021
|
+
private _closedLogger;
|
|
1976
2022
|
private _autoApprovedCommands;
|
|
1977
2023
|
get autoApprovedCommands(): string[];
|
|
1978
2024
|
constructor(opts: {
|
|
@@ -2002,7 +2048,7 @@ declare class Session extends TypedEmitter<SessionEvents> {
|
|
|
2002
2048
|
fail(reason: string): void;
|
|
2003
2049
|
/** Transition to finished — from active only. Emits session_end for backward compat. */
|
|
2004
2050
|
finish(reason?: string): void;
|
|
2005
|
-
/** Transition to cancelled — from active or error
|
|
2051
|
+
/** Transition to cancelled — from initializing, active, or error. */
|
|
2006
2052
|
markCancelled(): void;
|
|
2007
2053
|
private transition;
|
|
2008
2054
|
/** Number of prompts waiting in queue */
|
|
@@ -2408,6 +2454,16 @@ interface SessionSummary {
|
|
|
2408
2454
|
capabilities: AgentCapabilities | null;
|
|
2409
2455
|
isLive: boolean;
|
|
2410
2456
|
}
|
|
2457
|
+
interface CancelSessionResult {
|
|
2458
|
+
sessionId: string;
|
|
2459
|
+
cancelled: boolean;
|
|
2460
|
+
previousStatus: SessionStatus;
|
|
2461
|
+
status: 'cancelled' | 'finished';
|
|
2462
|
+
alreadyTerminal: boolean;
|
|
2463
|
+
/** Terminal state is durable, but process/logger cleanup needs another cancel retry. */
|
|
2464
|
+
cleanupPending: boolean;
|
|
2465
|
+
warning?: string;
|
|
2466
|
+
}
|
|
2411
2467
|
/**
|
|
2412
2468
|
* Registry for live Session instances. Provides lookup by session ID, channel+thread,
|
|
2413
2469
|
* or agent session ID. Coordinates session lifecycle: creation, cancellation, persistence,
|
|
@@ -2422,6 +2478,7 @@ declare class SessionManager {
|
|
|
2422
2478
|
private eventBus?;
|
|
2423
2479
|
middlewareChain?: MiddlewareChain;
|
|
2424
2480
|
private _shutdownComplete;
|
|
2481
|
+
private cancellationOps;
|
|
2425
2482
|
/**
|
|
2426
2483
|
* Inject the EventBus after construction. Deferred because EventBus is created
|
|
2427
2484
|
* after SessionManager during bootstrap, so it cannot be passed to the constructor.
|
|
@@ -2454,8 +2511,12 @@ declare class SessionManager {
|
|
|
2454
2511
|
}): Promise<void>;
|
|
2455
2512
|
/** Retrieve the persisted SessionRecord for a given session ID. Returns undefined if no store or record not found. */
|
|
2456
2513
|
getSessionRecord(sessionId: string): SessionRecord | undefined;
|
|
2457
|
-
/**
|
|
2458
|
-
|
|
2514
|
+
/**
|
|
2515
|
+
* Cancel a session exactly once. Concurrent callers share one operation;
|
|
2516
|
+
* terminal sessions return an idempotent result instead of throwing.
|
|
2517
|
+
*/
|
|
2518
|
+
cancelSession(sessionId: string): Promise<CancelSessionResult>;
|
|
2519
|
+
private performCancelSession;
|
|
2459
2520
|
/** List live (in-memory) sessions, optionally filtered by channel. Excludes assistant sessions. */
|
|
2460
2521
|
listSessions(channelId?: string): Session[];
|
|
2461
2522
|
/**
|
|
@@ -5161,6 +5222,7 @@ declare class TelegramAdapter extends MessagingAdapter {
|
|
|
5161
5222
|
private sessionTrackers;
|
|
5162
5223
|
private callbackCache;
|
|
5163
5224
|
private callbackCounter;
|
|
5225
|
+
private pendingCommandInputs;
|
|
5164
5226
|
/** Pending skill commands queued when session.threadId was not yet set */
|
|
5165
5227
|
private _pendingSkillCommands;
|
|
5166
5228
|
/** Control message IDs per session (for updating status text/buttons) */
|
|
@@ -5185,6 +5247,23 @@ declare class TelegramAdapter extends MessagingAdapter {
|
|
|
5185
5247
|
/** Set during normal shutdown so bot.stop() does not trigger a self-restart. */
|
|
5186
5248
|
private _stopping;
|
|
5187
5249
|
private unregisterProxyTester?;
|
|
5250
|
+
/** Serializes command-list reconciliations triggered by startup and plugin hot reloads. */
|
|
5251
|
+
private _commandSyncChain;
|
|
5252
|
+
private _pendingCommandSnapshot?;
|
|
5253
|
+
private _commandSyncWorkerRunning;
|
|
5254
|
+
private _commandSyncGeneration;
|
|
5255
|
+
private _commandSyncAbort?;
|
|
5256
|
+
private _commandSnapshotVersion;
|
|
5257
|
+
private _commandsReadyHandler?;
|
|
5258
|
+
private _latestCommandSnapshot?;
|
|
5259
|
+
private _commandApiReady;
|
|
5260
|
+
private _initialCommandSyncScheduled;
|
|
5261
|
+
private readonly commandOwnershipStore;
|
|
5262
|
+
private readonly commandOwnerIdentity;
|
|
5263
|
+
private readonly commandOwnerBotId;
|
|
5264
|
+
private readonly commandOwnerTakeoverRequested;
|
|
5265
|
+
private _commandOwnerClaimed;
|
|
5266
|
+
private _commandOwnerHeartbeat?;
|
|
5188
5267
|
private telegramFetch;
|
|
5189
5268
|
/** Returns the configured Telegram supergroup chat ID. */
|
|
5190
5269
|
getChatId(): number;
|
|
@@ -5202,6 +5281,15 @@ declare class TelegramAdapter extends MessagingAdapter {
|
|
|
5202
5281
|
notificationTopicId?: number;
|
|
5203
5282
|
assistantTopicId?: number;
|
|
5204
5283
|
}) => Promise<void>);
|
|
5284
|
+
/**
|
|
5285
|
+
* Capture command snapshots once startup begins. The normal boot path emits
|
|
5286
|
+
* SYSTEM_COMMANDS_READY before core.start(), so initial reconciliation reads the
|
|
5287
|
+
* authoritative registry state instead of relying on replay of that event. Once
|
|
5288
|
+
* the API is ready, later snapshots drive hot reloads.
|
|
5289
|
+
*/
|
|
5290
|
+
private subscribeToCommandSnapshots;
|
|
5291
|
+
/** Schedule one authoritative initial reconciliation after grammY is available. */
|
|
5292
|
+
private scheduleInitialCommandSync;
|
|
5205
5293
|
/**
|
|
5206
5294
|
* Set up the grammY bot, register all callback and message handlers, then perform
|
|
5207
5295
|
* two-phase startup: Phase 1 starts polling immediately; Phase 2 checks group
|
|
@@ -5220,6 +5308,7 @@ declare class TelegramAdapter extends MessagingAdapter {
|
|
|
5220
5308
|
* from the registry, deduplicating by command name. Non-critical.
|
|
5221
5309
|
*/
|
|
5222
5310
|
private syncCommandsWithRetry;
|
|
5311
|
+
private startCommandOwnerHeartbeat;
|
|
5223
5312
|
private initTopicDependentFeatures;
|
|
5224
5313
|
/**
|
|
5225
5314
|
* Handle the /retry command — re-runs prerequisite checks immediately.
|