@useconvoy/cli 0.89.3 → 0.108.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/README.md +68 -0
- package/dist/marketplace/convoy/skills/convoy/SKILL.md +15 -1
- package/dist/src/agent/app/chunk-flush-buffer.d.ts +2 -0
- package/dist/src/agent/app/chunk-flush-buffer.js +63 -16
- package/dist/src/agent/app/chunk-flush-buffer.js.map +1 -1
- package/dist/src/agent/app/runner.d.ts +8 -1
- package/dist/src/agent/app/runner.js +12 -3
- package/dist/src/agent/app/runner.js.map +1 -1
- package/dist/src/agent/app/thread-processor.js +25 -7
- package/dist/src/agent/app/thread-processor.js.map +1 -1
- package/dist/src/agent/runtimes/agent-instructions.d.ts +11 -1
- package/dist/src/agent/runtimes/agent-instructions.js +28 -0
- package/dist/src/agent/runtimes/agent-instructions.js.map +1 -1
- package/dist/src/agent/runtimes/claudeCode/detect.d.ts +3 -3
- package/dist/src/agent/runtimes/claudeCode/detect.js +5 -6
- package/dist/src/agent/runtimes/claudeCode/detect.js.map +1 -1
- package/dist/src/agent/runtimes/claudeCode/runner.d.ts +3 -0
- package/dist/src/agent/runtimes/claudeCode/runner.js +16 -7
- package/dist/src/agent/runtimes/claudeCode/runner.js.map +1 -1
- package/dist/src/agent/runtimes/claudeCode/runtime.js +1 -0
- package/dist/src/agent/runtimes/claudeCode/runtime.js.map +1 -1
- package/dist/src/agent/runtimes/claudeCode/streaming.d.ts +2 -0
- package/dist/src/agent/runtimes/claudeCode/streaming.js +41 -14
- package/dist/src/agent/runtimes/claudeCode/streaming.js.map +1 -1
- package/dist/src/agent/runtimes/codex/app-server-runner.d.ts +2 -0
- package/dist/src/agent/runtimes/codex/app-server-runner.js +48 -20
- package/dist/src/agent/runtimes/codex/app-server-runner.js.map +1 -1
- package/dist/src/agent/runtimes/codex/auth.d.ts +20 -2
- package/dist/src/agent/runtimes/codex/auth.js +79 -32
- package/dist/src/agent/runtimes/codex/auth.js.map +1 -1
- package/dist/src/agent/runtimes/codex/detect.d.ts +3 -2
- package/dist/src/agent/runtimes/codex/detect.js +4 -2
- package/dist/src/agent/runtimes/codex/detect.js.map +1 -1
- package/dist/src/agent/runtimes/codex/errors.d.ts +4 -3
- package/dist/src/agent/runtimes/codex/errors.js +24 -7
- package/dist/src/agent/runtimes/codex/errors.js.map +1 -1
- package/dist/src/agent/runtimes/codex/models.d.ts +2 -0
- package/dist/src/agent/runtimes/codex/models.js +4 -0
- package/dist/src/agent/runtimes/codex/models.js.map +1 -1
- package/dist/src/agent/runtimes/codex/runner.js +3 -1
- package/dist/src/agent/runtimes/codex/runner.js.map +1 -1
- package/dist/src/agent/runtimes/codex/runtime.js +2 -1
- package/dist/src/agent/runtimes/codex/runtime.js.map +1 -1
- package/dist/src/agent/runtimes/codex/streaming.js +24 -0
- package/dist/src/agent/runtimes/codex/streaming.js.map +1 -1
- package/dist/src/agent/runtimes/contracts.d.ts +19 -2
- package/dist/src/agent/runtimes/contracts.js.map +1 -1
- package/dist/src/agent/runtimes/cursor/streaming.js +17 -0
- package/dist/src/agent/runtimes/cursor/streaming.js.map +1 -1
- package/dist/src/agent/runtimes/opencode/runtime.js +1 -1
- package/dist/src/agent/runtimes/opencode/runtime.js.map +1 -1
- package/dist/src/agent/runtimes/opencode/streaming.js +7 -0
- package/dist/src/agent/runtimes/opencode/streaming.js.map +1 -1
- package/dist/src/agent/runtimes/registry.d.ts +2 -2
- package/dist/src/agent/runtimes/registry.js +2 -2
- package/dist/src/agent/runtimes/registry.js.map +1 -1
- package/dist/src/cli.js +5 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/connect/workflow.d.ts +6 -1
- package/dist/src/commands/connect/workflow.js +28 -7
- package/dist/src/commands/connect/workflow.js.map +1 -1
- package/dist/src/commands/environment/command.d.ts +4 -1
- package/dist/src/commands/environment/command.js +13 -9
- package/dist/src/commands/environment/command.js.map +1 -1
- package/dist/src/commands/environment/docker.d.ts +2 -0
- package/dist/src/commands/environment/docker.js +3 -3
- package/dist/src/commands/environment/docker.js.map +1 -1
- package/dist/src/commands/environment/index.d.ts +20 -2
- package/dist/src/commands/environment/index.js +19 -5
- package/dist/src/commands/environment/index.js.map +1 -1
- package/dist/src/commands/environment/paths.d.ts +2 -2
- package/dist/src/commands/environment/paths.js +7 -4
- package/dist/src/commands/environment/paths.js.map +1 -1
- package/dist/src/commands/environment/projects.d.ts +10 -0
- package/dist/src/commands/environment/projects.js +37 -1
- package/dist/src/commands/environment/projects.js.map +1 -1
- package/dist/src/commands/environment/resolution.d.ts +3 -0
- package/dist/src/commands/environment/resolution.js +29 -0
- package/dist/src/commands/environment/resolution.js.map +1 -1
- package/dist/src/commands/environment/setup-entrypoint.js +5 -2
- package/dist/src/commands/environment/setup-entrypoint.js.map +1 -1
- package/dist/src/commands/environment/validators.d.ts +36 -0
- package/dist/src/commands/environment/validators.js +4 -0
- package/dist/src/commands/environment/validators.js.map +1 -1
- package/dist/src/commands/environment/workflow.d.ts +21 -2
- package/dist/src/commands/environment/workflow.js +155 -10
- package/dist/src/commands/environment/workflow.js.map +1 -1
- package/dist/src/commands/keys/command.js +102 -43
- package/dist/src/commands/keys/command.js.map +1 -1
- package/dist/src/commands/keys/workflow.d.ts +16 -1
- package/dist/src/commands/keys/workflow.js +30 -12
- package/dist/src/commands/keys/workflow.js.map +1 -1
- package/dist/src/commands/project/command.js +5 -2
- package/dist/src/commands/project/command.js.map +1 -1
- package/dist/src/commands/project/launcher.d.ts +12 -1
- package/dist/src/commands/project/launcher.js +63 -8
- package/dist/src/commands/project/launcher.js.map +1 -1
- package/dist/src/commands/project/validators.d.ts +67 -1
- package/dist/src/commands/project/validators.js +32 -3
- package/dist/src/commands/project/validators.js.map +1 -1
- package/dist/src/commands/project/worker.js +8 -1
- package/dist/src/commands/project/worker.js.map +1 -1
- package/dist/src/commands/project/workflow.d.ts +4 -1
- package/dist/src/commands/project/workflow.js +50 -18
- package/dist/src/commands/project/workflow.js.map +1 -1
- package/dist/src/commands/remote/command.d.ts +4 -0
- package/dist/src/commands/remote/command.js +90 -0
- package/dist/src/commands/remote/command.js.map +1 -0
- package/dist/src/commands/remote/index.d.ts +3 -0
- package/dist/src/commands/remote/index.js +4 -0
- package/dist/src/commands/remote/index.js.map +1 -0
- package/dist/src/commands/remote/paths.d.ts +5 -0
- package/dist/src/commands/remote/paths.js +32 -0
- package/dist/src/commands/remote/paths.js.map +1 -0
- package/dist/src/commands/remote/ssh.d.ts +12 -0
- package/dist/src/commands/remote/ssh.js +94 -0
- package/dist/src/commands/remote/ssh.js.map +1 -0
- package/dist/src/commands/remote/validators.d.ts +18 -0
- package/dist/src/commands/remote/validators.js +11 -0
- package/dist/src/commands/remote/validators.js.map +1 -0
- package/dist/src/commands/service/attach.js +7 -2
- package/dist/src/commands/service/attach.js.map +1 -1
- package/dist/src/commands/service/bridge.js +2 -1
- package/dist/src/commands/service/bridge.js.map +1 -1
- package/dist/src/commands/service/client.d.ts +2 -1
- package/dist/src/commands/service/client.js +14 -7
- package/dist/src/commands/service/client.js.map +1 -1
- package/dist/src/commands/service/command.d.ts +1 -1
- package/dist/src/commands/service/command.js +3 -2
- package/dist/src/commands/service/command.js.map +1 -1
- package/dist/src/commands/service/errors.d.ts +9 -0
- package/dist/src/commands/service/errors.js +9 -0
- package/dist/src/commands/service/errors.js.map +1 -1
- package/dist/src/commands/service/resolution.js +6 -3
- package/dist/src/commands/service/resolution.js.map +1 -1
- package/dist/src/commands/service/runs.js +1 -1
- package/dist/src/commands/service/runs.js.map +1 -1
- package/dist/src/commands/service/server.js +1 -1
- package/dist/src/commands/service/server.js.map +1 -1
- package/dist/src/commands/service/service-entrypoint.js +1 -1
- package/dist/src/commands/service/service-entrypoint.js.map +1 -1
- package/dist/src/commands/service/validators.d.ts +75 -1
- package/dist/src/commands/service/validators.js +21 -1
- package/dist/src/commands/service/validators.js.map +1 -1
- package/dist/src/commands/service/workflow.js +11 -4
- package/dist/src/commands/service/workflow.js.map +1 -1
- package/dist/src/commands/setup/prompts.d.ts +8 -0
- package/dist/src/commands/setup/prompts.js +1 -1
- package/dist/src/commands/setup/prompts.js.map +1 -1
- package/dist/src/commands/setup/resolution.d.ts +5 -1
- package/dist/src/commands/setup/resolution.js +6 -4
- package/dist/src/commands/setup/resolution.js.map +1 -1
- package/dist/src/commands/threads/attach-task.d.ts +2 -0
- package/dist/src/commands/threads/attach-task.js +30 -0
- package/dist/src/commands/threads/attach-task.js.map +1 -0
- package/dist/src/commands/threads/attach.d.ts +3 -0
- package/dist/src/commands/threads/attach.js +32 -0
- package/dist/src/commands/threads/attach.js.map +1 -0
- package/dist/src/commands/threads/index.js +5 -1
- package/dist/src/commands/threads/index.js.map +1 -1
- package/dist/src/commands/threads/send.js +3 -10
- package/dist/src/commands/threads/send.js.map +1 -1
- package/dist/src/commands/tui/actions/app.d.ts +19 -0
- package/dist/src/commands/tui/actions/app.js +132 -0
- package/dist/src/commands/tui/actions/app.js.map +1 -0
- package/dist/src/commands/tui/actions/formatters.d.ts +2 -0
- package/dist/src/commands/tui/actions/formatters.js +48 -0
- package/dist/src/commands/tui/actions/formatters.js.map +1 -0
- package/dist/src/commands/tui/actions/index.d.ts +2 -0
- package/dist/src/commands/tui/actions/index.js +3 -0
- package/dist/src/commands/tui/actions/index.js.map +1 -0
- package/dist/src/commands/tui/actions/validators.d.ts +15 -0
- package/dist/src/commands/tui/actions/validators.js +2 -0
- package/dist/src/commands/tui/actions/validators.js.map +1 -0
- package/dist/src/commands/tui/actions/workflow.d.ts +33 -0
- package/dist/src/commands/tui/actions/workflow.js +211 -0
- package/dist/src/commands/tui/actions/workflow.js.map +1 -0
- package/dist/src/commands/tui/app.d.ts +7 -0
- package/dist/src/commands/tui/app.js +268 -0
- package/dist/src/commands/tui/app.js.map +1 -0
- package/dist/src/commands/tui/command.d.ts +2 -0
- package/dist/src/commands/tui/command.js +18 -0
- package/dist/src/commands/tui/command.js.map +1 -0
- package/dist/src/commands/tui/credentials/app.d.ts +10 -0
- package/dist/src/commands/tui/credentials/app.js +417 -0
- package/dist/src/commands/tui/credentials/app.js.map +1 -0
- package/dist/src/commands/tui/credentials/formatters.d.ts +11 -0
- package/dist/src/commands/tui/credentials/formatters.js +41 -0
- package/dist/src/commands/tui/credentials/formatters.js.map +1 -0
- package/dist/src/commands/tui/credentials/index.d.ts +1 -0
- package/dist/src/commands/tui/credentials/index.js +2 -0
- package/dist/src/commands/tui/credentials/index.js.map +1 -0
- package/dist/src/commands/tui/credentials/validators.d.ts +13 -0
- package/dist/src/commands/tui/credentials/validators.js +2 -0
- package/dist/src/commands/tui/credentials/validators.js.map +1 -0
- package/dist/src/commands/tui/credentials/workflow.d.ts +42 -0
- package/dist/src/commands/tui/credentials/workflow.js +40 -0
- package/dist/src/commands/tui/credentials/workflow.js.map +1 -0
- package/dist/src/commands/tui/dialog/app.d.ts +15 -0
- package/dist/src/commands/tui/dialog/app.js +59 -0
- package/dist/src/commands/tui/dialog/app.js.map +1 -0
- package/dist/src/commands/tui/dialog/index.d.ts +1 -0
- package/dist/src/commands/tui/dialog/index.js +2 -0
- package/dist/src/commands/tui/dialog/index.js.map +1 -0
- package/dist/src/commands/tui/environments/app.d.ts +6 -0
- package/dist/src/commands/tui/environments/app.js +176 -0
- package/dist/src/commands/tui/environments/app.js.map +1 -0
- package/dist/src/commands/tui/environments/index.d.ts +1 -0
- package/dist/src/commands/tui/environments/index.js +2 -0
- package/dist/src/commands/tui/environments/index.js.map +1 -0
- package/dist/src/commands/tui/formatters.d.ts +27 -0
- package/dist/src/commands/tui/formatters.js +94 -0
- package/dist/src/commands/tui/formatters.js.map +1 -0
- package/dist/src/commands/tui/index.d.ts +1 -0
- package/dist/src/commands/tui/index.js +2 -0
- package/dist/src/commands/tui/index.js.map +1 -0
- package/dist/src/commands/tui/logs/app.d.ts +9 -0
- package/dist/src/commands/tui/logs/app.js +181 -0
- package/dist/src/commands/tui/logs/app.js.map +1 -0
- package/dist/src/commands/tui/logs/export.d.ts +4 -0
- package/dist/src/commands/tui/logs/export.js +72 -0
- package/dist/src/commands/tui/logs/export.js.map +1 -0
- package/dist/src/commands/tui/logs/formatters.d.ts +3 -0
- package/dist/src/commands/tui/logs/formatters.js +19 -0
- package/dist/src/commands/tui/logs/formatters.js.map +1 -0
- package/dist/src/commands/tui/logs/index.d.ts +1 -0
- package/dist/src/commands/tui/logs/index.js +2 -0
- package/dist/src/commands/tui/logs/index.js.map +1 -0
- package/dist/src/commands/tui/logs/validators.d.ts +44 -0
- package/dist/src/commands/tui/logs/validators.js +14 -0
- package/dist/src/commands/tui/logs/validators.js.map +1 -0
- package/dist/src/commands/tui/logs/workflow.d.ts +25 -0
- package/dist/src/commands/tui/logs/workflow.js +133 -0
- package/dist/src/commands/tui/logs/workflow.js.map +1 -0
- package/dist/src/commands/tui/onboarding/app.d.ts +8 -0
- package/dist/src/commands/tui/onboarding/app.js +351 -0
- package/dist/src/commands/tui/onboarding/app.js.map +1 -0
- package/dist/src/commands/tui/onboarding/formatters.d.ts +2 -0
- package/dist/src/commands/tui/onboarding/formatters.js +24 -0
- package/dist/src/commands/tui/onboarding/formatters.js.map +1 -0
- package/dist/src/commands/tui/onboarding/index.d.ts +1 -0
- package/dist/src/commands/tui/onboarding/index.js +2 -0
- package/dist/src/commands/tui/onboarding/index.js.map +1 -0
- package/dist/src/commands/tui/onboarding/workflow.d.ts +18 -0
- package/dist/src/commands/tui/onboarding/workflow.js +55 -0
- package/dist/src/commands/tui/onboarding/workflow.js.map +1 -0
- package/dist/src/commands/tui/render.d.ts +2 -0
- package/dist/src/commands/tui/render.js +60 -0
- package/dist/src/commands/tui/render.js.map +1 -0
- package/dist/src/commands/tui/resolution.d.ts +37 -0
- package/dist/src/commands/tui/resolution.js +149 -0
- package/dist/src/commands/tui/resolution.js.map +1 -0
- package/dist/src/commands/tui/validators.d.ts +98 -0
- package/dist/src/commands/tui/validators.js +14 -0
- package/dist/src/commands/tui/validators.js.map +1 -0
- package/dist/src/commands/tui/workflow.d.ts +128 -0
- package/dist/src/commands/tui/workflow.js +462 -0
- package/dist/src/commands/tui/workflow.js.map +1 -0
- package/dist/src/convex/_generated/api.d.ts +10 -0
- package/dist/src/lib/config/convex-client.d.ts +10 -1
- package/dist/src/lib/config/convex-client.js +26 -4
- package/dist/src/lib/config/convex-client.js.map +1 -1
- package/dist/src/lib/config/credentials/resolution.d.ts +9 -4
- package/dist/src/lib/config/credentials/resolution.js +51 -17
- package/dist/src/lib/config/credentials/resolution.js.map +1 -1
- package/dist/src/lib/config/credentials/validators.d.ts +87 -0
- package/dist/src/lib/config/credentials/validators.js +21 -5
- package/dist/src/lib/config/credentials/validators.js.map +1 -1
- package/dist/src/lib/config/provider-keys.d.ts +10 -5
- package/dist/src/lib/config/provider-keys.js +36 -8
- package/dist/src/lib/config/provider-keys.js.map +1 -1
- package/dist/src/lib/config/toml.d.ts +8 -4
- package/dist/src/lib/config/toml.js +30 -11
- package/dist/src/lib/config/toml.js.map +1 -1
- package/dist/src/lib/config/types.d.ts +23 -2
- package/dist/src/lib/config/types.js +24 -0
- package/dist/src/lib/config/types.js.map +1 -1
- package/dist/src/lib/thread-attachments.d.ts +5 -0
- package/dist/src/lib/thread-attachments.js +11 -0
- package/dist/src/lib/thread-attachments.js.map +1 -1
- package/dist/templates/devcontainer/README.md +1 -1
- package/dist/templates/devcontainer/init-firewall.sh +1 -0
- package/dist/templates/project-isolation/README.md +5 -1
- package/dist/templates/project-isolation/__pycache__/environment.cpython-311.pyc +0 -0
- package/dist/templates/project-isolation/devcontainer.json +1 -1
- package/dist/templates/project-isolation/environment.py +19 -4
- package/dist/templates/project-isolation/environment.test.py +67 -2
- package/dist/templates/project-isolation/launcher.py +21 -9
- package/dist/templates/project-isolation/launcher.test.py +23 -0
- package/package.json +2 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { EnvironmentProposal, EnvironmentMaintenance, EnvironmentForm, EnvironmentProgress } from "../environment/validators.js";
|
|
2
|
+
import type { LogEntry } from "../service/validators.js";
|
|
3
|
+
import { ServiceClient } from "../service/client.js";
|
|
4
|
+
import { prepareEnvironment } from "../environment/workflow.js";
|
|
5
|
+
import type { ProjectAddOptions } from "../project/workflow.js";
|
|
6
|
+
import { type ProjectAddResult } from "../project/validators.js";
|
|
7
|
+
import type { ManagedCredentialStatus } from "../../lib/config/credentials/validators.js";
|
|
8
|
+
export interface Connection {
|
|
9
|
+
/** Managed runtime credential store of this environment; absent where none exists. */
|
|
10
|
+
credentials?: {
|
|
11
|
+
status(): Promise<ManagedCredentialStatus>;
|
|
12
|
+
allowDomain?(host: string): Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
maintenance?: EnvironmentMaintenance;
|
|
15
|
+
checkProject?: () => Promise<boolean>;
|
|
16
|
+
addProject?: (directory: string, options: ProjectAddOptions) => Promise<ProjectAddResult>;
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
transport: string;
|
|
20
|
+
endpoint: string;
|
|
21
|
+
shell?: (profile: string, identity?: string, signal?: AbortSignal) => Promise<void>;
|
|
22
|
+
start?: () => Promise<void>;
|
|
23
|
+
startUnavailable?: string;
|
|
24
|
+
savedLogs?: (after: number, profile?: string) => Promise<{
|
|
25
|
+
entries: LogEntry[];
|
|
26
|
+
cursor: number;
|
|
27
|
+
gap: boolean;
|
|
28
|
+
}>;
|
|
29
|
+
open(signal: AbortSignal): Promise<ServiceClient>;
|
|
30
|
+
}
|
|
31
|
+
export declare function connections(selected?: string, home?: string): {
|
|
32
|
+
targets: Connection[];
|
|
33
|
+
selected: number;
|
|
34
|
+
warnings: string[];
|
|
35
|
+
};
|
|
36
|
+
export { prepareEnvironment };
|
|
37
|
+
export declare function createConnection(form: EnvironmentForm, progress: EnvironmentProgress, proposal?: EnvironmentProposal): Promise<Connection>;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { ServiceLogs } from "../service/logs.js";
|
|
5
|
+
import { startService } from "../service/command.js";
|
|
6
|
+
import { getProfileByKey } from "../../lib/config/toml.js";
|
|
7
|
+
import { addLocalProject, projectShell, isProjectEnvironment } from "../project/launcher.js";
|
|
8
|
+
import { ServiceClient } from "../service/client.js";
|
|
9
|
+
import { servicePaths } from "../service/paths.js";
|
|
10
|
+
import { bridge, docker, helperArgs } from "../environment/docker.js";
|
|
11
|
+
import { prepareEnvironment, environmentMaintenance, provisionEnvironment, EnvironmentController } from "../environment/workflow.js";
|
|
12
|
+
import { containerName, environmentName } from "../environment/validators.js";
|
|
13
|
+
import { environmentDirectory, readEnvironment, withEnvironmentLock } from "../environment/paths.js";
|
|
14
|
+
import { targetCommands } from "../environment/index.js";
|
|
15
|
+
import { readRemotes, sshBridge } from "../remote/index.js";
|
|
16
|
+
import { supportsGuidedProject, addTargetProjectGuided } from "../environment/projects.js";
|
|
17
|
+
import { unavailableProjectResult } from "../project/validators.js";
|
|
18
|
+
import { localManagedStatus } from "../keys/workflow.js";
|
|
19
|
+
export function connections(selected, home = homedir()) {
|
|
20
|
+
const targets = [{
|
|
21
|
+
id: "local", name: "Local", transport: "unix", endpoint: join(home, ".convoy/service/control.sock"),
|
|
22
|
+
addProject: home === homedir() && isProjectEnvironment() ? addLocalProject : undefined,
|
|
23
|
+
start: home === homedir() && isProjectEnvironment() && Boolean(process.getuid?.()) ? () => startService(true, true) : undefined,
|
|
24
|
+
shell: home === homedir() && isProjectEnvironment() ? async (profile, expectedIdentity, signal) => {
|
|
25
|
+
const identity = getProfileByKey(profile)?.project_isolation?.identity;
|
|
26
|
+
if (!identity || identity !== expectedIdentity)
|
|
27
|
+
throw new Error("Project registration changed. Inspect status before opening its shell.");
|
|
28
|
+
await projectShell(identity, signal);
|
|
29
|
+
} : undefined,
|
|
30
|
+
credentials: home === homedir() && isProjectEnvironment() ? { status: localManagedStatus } : undefined,
|
|
31
|
+
startUnavailable: "Start requires the control account in a configured Linux project environment.",
|
|
32
|
+
savedLogs: async (after, profile) => new ServiceLogs(servicePaths(home, false).directory, undefined, "reader").read(after, profile),
|
|
33
|
+
open: signal => ServiceClient.open(servicePaths(home, false).socket, signal),
|
|
34
|
+
}];
|
|
35
|
+
const warnings = [];
|
|
36
|
+
const directory = join(home, ".convoy/environments");
|
|
37
|
+
let names = [];
|
|
38
|
+
try {
|
|
39
|
+
names = readdirSync(directory);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (error.code !== "ENOENT")
|
|
43
|
+
warnings.push("Cannot list managed environments. Check directory permissions.");
|
|
44
|
+
}
|
|
45
|
+
for (const name of names.sort()) {
|
|
46
|
+
if (!environmentName.safeParse(name).success || !existsSync(join(directory, name, "environment.json")))
|
|
47
|
+
continue;
|
|
48
|
+
const read = () => {
|
|
49
|
+
const environment = readEnvironment(environmentDirectory(name, home, false));
|
|
50
|
+
if (!environment || environment.name !== name)
|
|
51
|
+
throw new Error("Invalid environment identity");
|
|
52
|
+
return environment;
|
|
53
|
+
};
|
|
54
|
+
try {
|
|
55
|
+
const environment = read();
|
|
56
|
+
const running = async () => {
|
|
57
|
+
const current = read();
|
|
58
|
+
const container = await new EnvironmentController().container(current).catch(() => {
|
|
59
|
+
throw new Error("Docker host unavailable or environment identity changed. Inspect environment status.");
|
|
60
|
+
});
|
|
61
|
+
if (!container?.State.Running)
|
|
62
|
+
throw new Error("Container unavailable. Start the environment outside this TUI; the service cannot be inspected here.");
|
|
63
|
+
return current;
|
|
64
|
+
};
|
|
65
|
+
targets.push({
|
|
66
|
+
maintenance: environmentMaintenance(environment, home),
|
|
67
|
+
checkProject: async () => supportsGuidedProject(await running()),
|
|
68
|
+
id: name, name, transport: "docker", endpoint: `docker exec ${containerName(environment)} /home/node/.convoy/service/control.sock`,
|
|
69
|
+
addProject: async (directory, options) => {
|
|
70
|
+
let started = false;
|
|
71
|
+
try {
|
|
72
|
+
return await withEnvironmentLock(environmentDirectory(name, home, false), async () => {
|
|
73
|
+
const current = await running();
|
|
74
|
+
if (current.owner !== environment.owner || current.daemon !== environment.daemon)
|
|
75
|
+
throw new Error("Environment changed.");
|
|
76
|
+
started = true;
|
|
77
|
+
return addTargetProjectGuided(current, directory, options);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
if (!started)
|
|
82
|
+
return unavailableProjectResult();
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
start: () => withEnvironmentLock(environmentDirectory(name, home, false), async () => {
|
|
87
|
+
const current = await running();
|
|
88
|
+
await docker(helperArgs(current, "start"), { timeout: 180_000 }).catch(() => {
|
|
89
|
+
throw new Error("Service start failed or outcome unknown. Inspect service status before retrying.");
|
|
90
|
+
});
|
|
91
|
+
}),
|
|
92
|
+
shell: (profile, expectedIdentity, signal) => targetCommands.shell(read(), profile, { expectedIdentity, signal, home }),
|
|
93
|
+
credentials: {
|
|
94
|
+
status: async () => targetCommands.credentialStatus(await running()),
|
|
95
|
+
// Quiet, unlike `keys add`: helper progress written to stderr would tear the Ink frame.
|
|
96
|
+
allowDomain: host => withEnvironmentLock(environmentDirectory(name, home, false), async () => {
|
|
97
|
+
await docker(helperArgs(await running(), "allow-domain", host), { timeout: 180_000 });
|
|
98
|
+
}),
|
|
99
|
+
},
|
|
100
|
+
savedLogs: async (after, profile) => {
|
|
101
|
+
const current = await running();
|
|
102
|
+
const retained = await targetCommands.operationalLogs(current, profile, false).catch(() => {
|
|
103
|
+
throw new Error("Saved service logs unavailable in the running container. Check CLI compatibility and file permissions.");
|
|
104
|
+
});
|
|
105
|
+
const entries = retained.filter(entry => entry.seq > after).slice(0, 100);
|
|
106
|
+
return { entries, cursor: entries.at(-1)?.seq ?? after, gap: after > 0 && after < (retained[0]?.seq ?? 1) - 1 };
|
|
107
|
+
},
|
|
108
|
+
open: async (signal) => {
|
|
109
|
+
const controller = new EnvironmentController((args, options) => docker(args, { ...options, signal }));
|
|
110
|
+
const current = read();
|
|
111
|
+
const container = await controller.container(current);
|
|
112
|
+
if (!container?.State.Running)
|
|
113
|
+
throw new Error("Managed environment is stopped.");
|
|
114
|
+
signal.throwIfAborted();
|
|
115
|
+
return ServiceClient.open(bridge(current), signal);
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
const warning = `Cannot read managed environment ${name}. Check its private environment.json.`;
|
|
121
|
+
if (name === selected)
|
|
122
|
+
throw new Error(warning);
|
|
123
|
+
warnings.push(warning);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
for (const remote of readRemotes(home))
|
|
128
|
+
targets.push({
|
|
129
|
+
id: remote.name, name: remote.name, transport: "ssh",
|
|
130
|
+
endpoint: `ssh ${remote.host}${remote.container ? ` docker exec ${remote.container}` : ""}`,
|
|
131
|
+
startUnavailable: `Start it with convoy service start -b --remote ${remote.name}.`,
|
|
132
|
+
open: signal => ServiceClient.open(sshBridge(remote), signal),
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
warnings.push(error instanceof Error ? error.message : "Cannot read saved remotes.");
|
|
137
|
+
}
|
|
138
|
+
const index = selected ? targets.findIndex(target => target.id === selected && target.transport === "docker") : 0;
|
|
139
|
+
if (index < 0)
|
|
140
|
+
throw new Error("Unknown managed environment. Inspect convoy environment status before attaching.");
|
|
141
|
+
return { targets, selected: index, warnings };
|
|
142
|
+
}
|
|
143
|
+
export { prepareEnvironment };
|
|
144
|
+
export async function createConnection(form, progress, proposal) {
|
|
145
|
+
await provisionEnvironment(form, progress, proposal);
|
|
146
|
+
const result = connections(form.name);
|
|
147
|
+
return result.targets[result.selected];
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=resolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolution.js","sourceRoot":"","sources":["../../../../src/commands/tui/resolution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,WAAW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AC,IAAqB,EAAE,QAA6B,EAAE,QAA8B;IACzH,MAAM,oBAAoB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { ActionState } from "./actions/validators.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type { ServiceInspection, ServiceResponse, WorkerState } from "../service/validators.js";
|
|
4
|
+
declare const threadSchema: z.ZodObject<{
|
|
5
|
+
threadId: z.ZodString;
|
|
6
|
+
title: z.ZodString;
|
|
7
|
+
status: z.ZodOptional<z.ZodString>;
|
|
8
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
9
|
+
associatedTaskId: z.ZodOptional<z.ZodString>;
|
|
10
|
+
associatedTaskRef: z.ZodOptional<z.ZodString>;
|
|
11
|
+
cliType: z.ZodOptional<z.ZodString>;
|
|
12
|
+
lastActivityAt: z.ZodNumber;
|
|
13
|
+
hasPendingUserMessages: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
declare const runSchema: z.ZodObject<{
|
|
16
|
+
threadId: z.ZodString;
|
|
17
|
+
messageId: z.ZodString;
|
|
18
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
19
|
+
status: z.ZodString;
|
|
20
|
+
createdAt: z.ZodNumber;
|
|
21
|
+
updatedAt: z.ZodNumber;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export declare const threadPageSchema: z.ZodObject<{
|
|
24
|
+
page: z.ZodArray<z.ZodObject<{
|
|
25
|
+
threadId: z.ZodString;
|
|
26
|
+
title: z.ZodString;
|
|
27
|
+
status: z.ZodOptional<z.ZodString>;
|
|
28
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
29
|
+
associatedTaskId: z.ZodOptional<z.ZodString>;
|
|
30
|
+
associatedTaskRef: z.ZodOptional<z.ZodString>;
|
|
31
|
+
cliType: z.ZodOptional<z.ZodString>;
|
|
32
|
+
lastActivityAt: z.ZodNumber;
|
|
33
|
+
hasPendingUserMessages: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
}, z.core.$strip>>;
|
|
35
|
+
isDone: z.ZodBoolean;
|
|
36
|
+
continueCursor: z.ZodString;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
export declare const runPageSchema: z.ZodObject<{
|
|
39
|
+
page: z.ZodArray<z.ZodObject<{
|
|
40
|
+
threadId: z.ZodString;
|
|
41
|
+
messageId: z.ZodString;
|
|
42
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
43
|
+
status: z.ZodString;
|
|
44
|
+
createdAt: z.ZodNumber;
|
|
45
|
+
updatedAt: z.ZodNumber;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
isDone: z.ZodBoolean;
|
|
48
|
+
continueCursor: z.ZodString;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export type ThreadRow = z.infer<typeof threadSchema>;
|
|
51
|
+
export type RunRow = z.infer<typeof runSchema>;
|
|
52
|
+
export type Row = {
|
|
53
|
+
profile: string;
|
|
54
|
+
thread: ThreadRow;
|
|
55
|
+
run?: RunRow;
|
|
56
|
+
};
|
|
57
|
+
export type Health = "unknown" | "connecting" | "connected" | "reconnecting" | "incompatible";
|
|
58
|
+
export interface Observation {
|
|
59
|
+
health: Health;
|
|
60
|
+
profiles: WorkerState[];
|
|
61
|
+
version?: string;
|
|
62
|
+
snapshot?: ServiceResponse;
|
|
63
|
+
inspection?: ServiceInspection;
|
|
64
|
+
guidance?: string[];
|
|
65
|
+
environmentStatus?: Record<string, unknown>;
|
|
66
|
+
checkingEnvironment?: boolean;
|
|
67
|
+
environmentError?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface Scope {
|
|
70
|
+
connection: number;
|
|
71
|
+
profile?: string;
|
|
72
|
+
details: boolean;
|
|
73
|
+
addProject?: boolean;
|
|
74
|
+
}
|
|
75
|
+
export interface PagePosition {
|
|
76
|
+
profile: string;
|
|
77
|
+
cursor?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface BrowseState {
|
|
80
|
+
environment?: "delete" | "create" | "update" | "start" | "stop" | "restart" | "verify-codex" | "verify-claude-code";
|
|
81
|
+
onboarding?: boolean;
|
|
82
|
+
actions?: boolean;
|
|
83
|
+
/** Credentials panel; "editing" (draft, form, popup or project editor) locks navigation like a workflow. */
|
|
84
|
+
credentials?: "view" | "editing";
|
|
85
|
+
action?: ActionState;
|
|
86
|
+
scope: Scope;
|
|
87
|
+
observations: Observation[];
|
|
88
|
+
rows: Row[];
|
|
89
|
+
loading: boolean;
|
|
90
|
+
stale: boolean;
|
|
91
|
+
error?: string;
|
|
92
|
+
next?: PagePosition;
|
|
93
|
+
history?: Row;
|
|
94
|
+
detail?: Row;
|
|
95
|
+
pageNumber: number;
|
|
96
|
+
updatedAt?: number;
|
|
97
|
+
}
|
|
98
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const threadSchema = z.object({
|
|
3
|
+
threadId: z.string(), title: z.string(), status: z.string().optional(),
|
|
4
|
+
kind: z.string().optional(), associatedTaskId: z.string().optional(), associatedTaskRef: z.string().optional(),
|
|
5
|
+
cliType: z.string().optional(), lastActivityAt: z.number(),
|
|
6
|
+
hasPendingUserMessages: z.boolean().optional(),
|
|
7
|
+
});
|
|
8
|
+
const runSchema = z.object({
|
|
9
|
+
threadId: z.string(), messageId: z.string(), runId: z.string().optional(),
|
|
10
|
+
status: z.string(), createdAt: z.number(), updatedAt: z.number(),
|
|
11
|
+
});
|
|
12
|
+
export const threadPageSchema = z.object({ page: z.array(threadSchema).max(20), isDone: z.boolean(), continueCursor: z.string().max(8192) });
|
|
13
|
+
export const runPageSchema = z.object({ page: z.array(runSchema).max(20), isDone: z.boolean(), continueCursor: z.string().max(8192) });
|
|
14
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../src/commands/tui/validators.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACtE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9G,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1D,sBAAsB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAC/C,CAAC,CAAC;AACH,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IACzB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACjE,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC7I,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { EnvironmentProposal, EnvironmentForm, EnvironmentProgress } from "../environment/validators.js";
|
|
2
|
+
import type { Action } from "./actions/validators.js";
|
|
3
|
+
import type { CredentialMutation } from "../../lib/config/credentials/validators.js";
|
|
4
|
+
import { prepareEnvironment, type Connection } from "./resolution.js";
|
|
5
|
+
import type { ServiceRequest } from "../service/validators.js";
|
|
6
|
+
import { type BrowseState, type Row, type Scope } from "./validators.js";
|
|
7
|
+
/** A client owns one subscription and one visible page. Spec: docs/specs/cli-tui.md. */
|
|
8
|
+
export declare class Browser {
|
|
9
|
+
readonly targets: Connection[];
|
|
10
|
+
environmentBusy: boolean;
|
|
11
|
+
private state;
|
|
12
|
+
private actions;
|
|
13
|
+
private listeners;
|
|
14
|
+
private abort?;
|
|
15
|
+
private client?;
|
|
16
|
+
private retry?;
|
|
17
|
+
private refresh?;
|
|
18
|
+
private generation;
|
|
19
|
+
private revision;
|
|
20
|
+
private reading;
|
|
21
|
+
private position?;
|
|
22
|
+
private previous;
|
|
23
|
+
private disposed;
|
|
24
|
+
constructor(targets: Connection[], selected?: number, shell?: (operation: (signal: AbortSignal) => Promise<void>) => Promise<void>);
|
|
25
|
+
getSnapshot: () => BrowseState;
|
|
26
|
+
subscribe: (listener: () => void) => () => void;
|
|
27
|
+
private set;
|
|
28
|
+
private reconcileSelection;
|
|
29
|
+
private observe;
|
|
30
|
+
start(): void;
|
|
31
|
+
select(scope: Scope): void;
|
|
32
|
+
history(row?: Row): void;
|
|
33
|
+
logs(row?: Row): void;
|
|
34
|
+
get locked(): boolean;
|
|
35
|
+
openEnvironment(mode: NonNullable<BrowseState["environment"]>): void;
|
|
36
|
+
inspectEnvironment(): Promise<void>;
|
|
37
|
+
closeEnvironment(): void;
|
|
38
|
+
prepareEnvironment: typeof prepareEnvironment;
|
|
39
|
+
createEnvironment(form: EnvironmentForm, progress: EnvironmentProgress, proposal?: EnvironmentProposal): Promise<void>;
|
|
40
|
+
refreshEnvironment(result: Record<string, unknown>): Promise<void>;
|
|
41
|
+
openOnboarding(): void;
|
|
42
|
+
closeOnboarding(profile?: string, pending?: boolean): void;
|
|
43
|
+
showActions(value: boolean): void;
|
|
44
|
+
/** Environment tab, or a project's assignment editor opened from its Actions. */
|
|
45
|
+
showCredentials(value: boolean): void;
|
|
46
|
+
editCredentials(editing: boolean): void;
|
|
47
|
+
/** Sends one managed credential change through this connection's service; Docker AWS keys first open their endpoint. */
|
|
48
|
+
mutateCredentials(request: CredentialMutation): Promise<boolean>;
|
|
49
|
+
unavailable: (kind: Action, row?: Row) => string | undefined;
|
|
50
|
+
beginAction: (kind: Action, row?: Row) => void;
|
|
51
|
+
dismissAction: () => void;
|
|
52
|
+
confirmAction: () => void;
|
|
53
|
+
moreOperationalLogs: () => void;
|
|
54
|
+
readLogs(row: Row, args: Pick<ServiceRequest, "chunkAfter" | "chunkBefore" | "eventOrder" | "eventOffset">): Promise<{
|
|
55
|
+
v: 1;
|
|
56
|
+
id: string;
|
|
57
|
+
ok: boolean;
|
|
58
|
+
error?: string | undefined;
|
|
59
|
+
code?: string | undefined;
|
|
60
|
+
epoch?: string | undefined;
|
|
61
|
+
event?: "snapshot" | "change" | "heartbeat" | undefined;
|
|
62
|
+
result?: unknown;
|
|
63
|
+
outcome?: "unknown" | "pending" | "complete" | undefined;
|
|
64
|
+
capabilities?: string[] | undefined;
|
|
65
|
+
version?: string | undefined;
|
|
66
|
+
registered?: boolean | undefined;
|
|
67
|
+
applied?: boolean | undefined;
|
|
68
|
+
configurationError?: boolean | undefined;
|
|
69
|
+
pid?: number | undefined;
|
|
70
|
+
stopping?: boolean | undefined;
|
|
71
|
+
profiles?: {
|
|
72
|
+
profile: string;
|
|
73
|
+
status: "stopped" | "connecting" | "online" | "retrying" | "blocked" | "failed";
|
|
74
|
+
attempts: number;
|
|
75
|
+
authResult?: {
|
|
76
|
+
result: "configured" | "setup-failed" | "request-succeeded" | "authentication-failed" | "quota-or-rate-limit" | "network-failed" | "request-failed";
|
|
77
|
+
at: number;
|
|
78
|
+
} | undefined;
|
|
79
|
+
auth?: {
|
|
80
|
+
mode: "managed" | "disabled" | "native";
|
|
81
|
+
name?: string | undefined;
|
|
82
|
+
entryId?: string | undefined;
|
|
83
|
+
revision?: number | undefined;
|
|
84
|
+
claude?: {
|
|
85
|
+
mode: "managed" | "disabled" | "native";
|
|
86
|
+
name?: string | undefined;
|
|
87
|
+
entryId?: string | undefined;
|
|
88
|
+
revision?: number | undefined;
|
|
89
|
+
} | undefined;
|
|
90
|
+
} | undefined;
|
|
91
|
+
desiredAuth?: {
|
|
92
|
+
mode: "managed" | "disabled" | "native";
|
|
93
|
+
name?: string | undefined;
|
|
94
|
+
entryId?: string | undefined;
|
|
95
|
+
revision?: number | undefined;
|
|
96
|
+
claude?: {
|
|
97
|
+
mode: "managed" | "disabled" | "native";
|
|
98
|
+
name?: string | undefined;
|
|
99
|
+
entryId?: string | undefined;
|
|
100
|
+
revision?: number | undefined;
|
|
101
|
+
} | undefined;
|
|
102
|
+
} | undefined;
|
|
103
|
+
displayName?: string | undefined;
|
|
104
|
+
exitCode?: number | undefined;
|
|
105
|
+
identity?: string | undefined;
|
|
106
|
+
activeRuns?: number | undefined;
|
|
107
|
+
pending?: boolean | undefined;
|
|
108
|
+
paused?: boolean | undefined;
|
|
109
|
+
}[] | undefined;
|
|
110
|
+
entries?: {
|
|
111
|
+
seq: number;
|
|
112
|
+
ts: number;
|
|
113
|
+
profile: string;
|
|
114
|
+
message: string;
|
|
115
|
+
}[] | undefined;
|
|
116
|
+
cursor?: number | undefined;
|
|
117
|
+
gap?: boolean | undefined;
|
|
118
|
+
}>;
|
|
119
|
+
next(): void;
|
|
120
|
+
back(): void;
|
|
121
|
+
first(): void;
|
|
122
|
+
retryNow(): void;
|
|
123
|
+
dispose(): void;
|
|
124
|
+
private connect;
|
|
125
|
+
private event;
|
|
126
|
+
private schedule;
|
|
127
|
+
private read;
|
|
128
|
+
}
|