agent-afk 5.335.1 → 5.336.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.
Files changed (43) hide show
  1. package/dist/agent/lsp/async-mutex.d.ts +13 -0
  2. package/dist/agent/lsp/client-handlers.d.ts +58 -0
  3. package/dist/agent/lsp/client-process.d.ts +19 -0
  4. package/dist/agent/lsp/client.d.ts +54 -0
  5. package/dist/agent/lsp/diagnostics-store.d.ts +17 -0
  6. package/dist/agent/lsp/document-sync.d.ts +20 -0
  7. package/dist/agent/lsp/install.d.ts +14 -0
  8. package/dist/agent/lsp/install.footprint.d.ts +5 -0
  9. package/dist/agent/lsp/install.grants.d.ts +10 -0
  10. package/dist/agent/lsp/install.npm.d.ts +21 -0
  11. package/dist/agent/lsp/pool.d.ts +30 -0
  12. package/dist/agent/lsp/query.d.ts +18 -0
  13. package/dist/agent/lsp/registry.d.ts +12 -0
  14. package/dist/agent/lsp/server-spec.d.ts +53 -0
  15. package/dist/agent/lsp/typescript-default.d.ts +5 -0
  16. package/dist/agent/plugins/load-entrypoints.d.ts +12 -0
  17. package/dist/agent/plugins/plugin-runtime-api.d.ts +6 -0
  18. package/dist/agent/plugins/plugin-session-context.d.ts +3 -0
  19. package/dist/agent/session/manager-shutdown-config.d.ts +1 -1
  20. package/dist/agent/subagent/result.d.ts +1 -0
  21. package/dist/agent/tools/handlers/lsp-diagnostics.d.ts +2 -2
  22. package/dist/agent/tools/handlers/lsp-shared.d.ts +2 -8
  23. package/dist/agent/tools/handlers/lsp-symbols.d.ts +2 -1
  24. package/dist/agent/tools/skill-bridge.d.ts +4 -1
  25. package/dist/agent/tools/subagent/child-config.d.ts +11 -0
  26. package/dist/cli/commands/update.d.ts +1 -1
  27. package/dist/cli/health-rail.d.ts +4 -0
  28. package/dist/cli/health-rail.format.d.ts +2 -0
  29. package/dist/cli.mjs +578 -584
  30. package/dist/config/env.d.ts +8 -0
  31. package/dist/config/env.tools.d.ts +8 -0
  32. package/dist/improve/scan/detectors/tool-failure-density.d.ts +7 -0
  33. package/dist/improve/schemas.d.ts +1 -0
  34. package/dist/index.mjs +432 -438
  35. package/dist/paths.lsp.d.ts +4 -0
  36. package/dist/telegram/bg-injection.d.ts +1 -0
  37. package/dist/telegram/handlers/message.wake-idle.d.ts +3 -0
  38. package/dist/telegram.mjs +462 -468
  39. package/dist/utils/kill-process-group.d.ts +1 -0
  40. package/dist/utils/npm-cli.d.ts +1 -0
  41. package/dist/web-server/session-owner.d.ts +1 -0
  42. package/dist/web-server/session-owner.lifecycle.d.ts +1 -1
  43. package/package.json +2 -1
@@ -0,0 +1,13 @@
1
+ export declare class AsyncMutex {
2
+ private _waiters;
3
+ private _locked;
4
+ get isLocked(): boolean;
5
+ acquire(): Promise<() => void>;
6
+ private _release;
7
+ }
8
+ export declare class MutexRegistry {
9
+ private readonly _map;
10
+ get(key: string): AsyncMutex;
11
+ get size(): number;
12
+ releaseIfIdle(key: string): void;
13
+ }
@@ -0,0 +1,58 @@
1
+ import type { ServerDefinition } from './server-spec.js';
2
+ export declare function answerServerRequest(definition: ServerDefinition, method: string, params: unknown): unknown;
3
+ export declare const CLIENT_CAPABILITIES: {
4
+ readonly workspace: {
5
+ readonly applyEdit: true;
6
+ readonly workspaceEdit: {
7
+ readonly documentChanges: true;
8
+ };
9
+ readonly configuration: true;
10
+ readonly workspaceFolders: true;
11
+ readonly didChangeConfiguration: {
12
+ readonly dynamicRegistration: true;
13
+ };
14
+ readonly symbol: {
15
+ readonly dynamicRegistration: false;
16
+ };
17
+ };
18
+ readonly textDocument: {
19
+ readonly synchronization: {
20
+ readonly dynamicRegistration: false;
21
+ readonly didSave: false;
22
+ readonly willSave: false;
23
+ };
24
+ readonly definition: {
25
+ readonly dynamicRegistration: false;
26
+ readonly linkSupport: true;
27
+ };
28
+ readonly references: {
29
+ readonly dynamicRegistration: false;
30
+ };
31
+ readonly publishDiagnostics: {
32
+ readonly relatedInformation: false;
33
+ readonly versionSupport: true;
34
+ };
35
+ readonly rename: {
36
+ readonly dynamicRegistration: false;
37
+ readonly prepareSupport: true;
38
+ };
39
+ readonly codeAction: {
40
+ readonly dynamicRegistration: false;
41
+ readonly codeActionLiteralSupport: {
42
+ readonly codeActionKind: {
43
+ readonly valueSet: readonly ["", "quickfix", "refactor", "source", "source.organizeImports"];
44
+ };
45
+ };
46
+ };
47
+ readonly documentSymbol: {
48
+ readonly dynamicRegistration: false;
49
+ readonly hierarchicalDocumentSymbolSupport: true;
50
+ };
51
+ };
52
+ readonly window: {
53
+ readonly workDoneProgress: true;
54
+ };
55
+ readonly general: {
56
+ readonly positionEncodings: readonly ["utf-16"];
57
+ };
58
+ };
@@ -0,0 +1,19 @@
1
+ import { type ChildProcess } from 'node:child_process';
2
+ export interface SpawnCommand {
3
+ readonly file: string;
4
+ readonly args: readonly string[];
5
+ }
6
+ export interface SpawnCommandDeps {
7
+ readonly platform?: NodeJS.Platform;
8
+ readonly execPath?: string;
9
+ readonly readFile?: (p: string) => string;
10
+ readonly lookup?: (bin: string, platform: NodeJS.Platform) => string | undefined;
11
+ }
12
+ export declare function buildSpawnCommand(command: string, args: readonly string[], deps?: SpawnCommandDeps): SpawnCommand;
13
+ export declare function spawnServer(command: string, args: readonly string[], root: string): ChildProcess;
14
+ export declare function exitPromise(proc: ChildProcess): Promise<void>;
15
+ export declare function killServerTree(proc: ChildProcess, platform?: NodeJS.Platform): void;
16
+ export declare function killServerTreeAndWait(proc: ChildProcess, timeoutMs: number, platform?: NodeJS.Platform): Promise<void>;
17
+ export declare function killServerTreeSync(proc: ChildProcess, platform?: NodeJS.Platform): void;
18
+ export declare function forceKillRoot(proc: ChildProcess): void;
19
+ export declare function waitForExit(exited: Promise<void>, timeoutMs: number): Promise<void>;
@@ -0,0 +1,54 @@
1
+ import type { ServerSpec } from './server-spec.js';
2
+ import { type SyncResult } from './document-sync.js';
3
+ import { DiagnosticsStore } from './diagnostics-store.js';
4
+ export type LspFailureKind = 'timeout' | 'aborted' | 'exited' | 'spawn' | 'response';
5
+ export declare class LspClientError extends Error {
6
+ readonly kind: LspFailureKind;
7
+ constructor(kind: LspFailureKind, message: string);
8
+ }
9
+ export interface RequestOptions {
10
+ readonly timeoutMs?: number;
11
+ readonly signal?: AbortSignal;
12
+ }
13
+ export interface FileSync extends SyncResult {
14
+ readonly uri: string;
15
+ }
16
+ export declare const DISPOSE_EXIT_TIMEOUT_MS = 3000;
17
+ export declare class LspClient {
18
+ readonly spec: ServerSpec;
19
+ readonly root: string;
20
+ private readonly proc;
21
+ private readonly conn;
22
+ private readonly docs;
23
+ readonly diagnostics: DiagnosticsStore;
24
+ private dead;
25
+ private readonly exitListeners;
26
+ private readonly deathWaiters;
27
+ private inFlight;
28
+ private lastActivity;
29
+ private disposing;
30
+ private holds;
31
+ private initialized;
32
+ private readonly exited;
33
+ private readonly docUses;
34
+ private constructor();
35
+ hold(): () => void;
36
+ private setRef;
37
+ static start(spec: ServerSpec, root: string, opts?: RequestOptions): Promise<LspClient>;
38
+ private initialize;
39
+ get alive(): boolean;
40
+ get pendingRequests(): number;
41
+ get lastActivityAt(): number;
42
+ onExit(cb: () => void): () => void;
43
+ request<R = unknown>(method: string, params: unknown, opts?: RequestOptions): Promise<R>;
44
+ notify(method: string, params: unknown): void;
45
+ syncFile(filePath: string, content?: string): Promise<FileSync | null>;
46
+ useDocument(uri: string): () => void;
47
+ closeOthers(uri: string): void;
48
+ get openDocuments(): string[];
49
+ get pid(): number | undefined;
50
+ dispose(): Promise<void>;
51
+ private doDispose;
52
+ private touch;
53
+ private markDead;
54
+ }
@@ -0,0 +1,17 @@
1
+ export interface PublishedDiagnostics {
2
+ readonly uri: string;
3
+ readonly version?: number;
4
+ readonly diagnostics: readonly unknown[];
5
+ readonly seq: number;
6
+ }
7
+ export declare const UNVERSIONED_SETTLE_MS = 200;
8
+ export declare class DiagnosticsStore {
9
+ private readonly settleMs;
10
+ private seqCounter;
11
+ private readonly latest;
12
+ private readonly waiters;
13
+ constructor(settleMs?: number);
14
+ get seq(): number;
15
+ record(params: unknown): void;
16
+ waitFor(uri: string, version: number | undefined, afterSeq: number, timeoutMs: number, signal?: AbortSignal): Promise<PublishedDiagnostics | null>;
17
+ }
@@ -0,0 +1,20 @@
1
+ export interface SyncNotification {
2
+ readonly method: 'textDocument/didOpen' | 'textDocument/didChange';
3
+ readonly params: unknown;
4
+ }
5
+ export interface SyncResult {
6
+ readonly version: number;
7
+ readonly changed: boolean;
8
+ readonly notification: SyncNotification | null;
9
+ }
10
+ export declare class DocumentSync {
11
+ private readonly docs;
12
+ private readonly versions;
13
+ version(uri: string): number | undefined;
14
+ openUris(): string[];
15
+ closeAllExcept(keep: ReadonlySet<string>): Array<{
16
+ readonly method: 'textDocument/didClose';
17
+ readonly params: unknown;
18
+ }>;
19
+ sync(uri: string, languageId: string, text: string): SyncResult;
20
+ }
@@ -0,0 +1,14 @@
1
+ import type { EnsureInstalledResult, EnsureInstalledFn } from './server-spec.js';
2
+ import { type GrantStore } from './install.grants.js';
3
+ import { type NpmExecFn } from './install.npm.js';
4
+ export interface InstallDeps {
5
+ grantStore?: GrantStore;
6
+ execFn?: NpmExecFn;
7
+ ledgerPath?: string;
8
+ platform?: string;
9
+ locateCli?: () => string | undefined;
10
+ inFlightMap?: Map<string, Promise<EnsureInstalledResult>>;
11
+ }
12
+ export declare function inFlightKey(language: string, interactive: boolean): string;
13
+ export declare function createEnsureInstalled(deps?: InstallDeps): EnsureInstalledFn;
14
+ export declare const ensureServerInstalled: EnsureInstalledFn;
@@ -0,0 +1,5 @@
1
+ export interface LspLanguageFootprint {
2
+ readonly language: string;
3
+ readonly bytes: number;
4
+ }
5
+ export declare function getLspInstallFootprint(serversDir?: string): Promise<LspLanguageFootprint[]>;
@@ -0,0 +1,10 @@
1
+ export interface LspInstallGrant {
2
+ readonly language: string;
3
+ readonly packages: readonly string[];
4
+ readonly grantedAt: string;
5
+ }
6
+ export interface GrantStore {
7
+ hasGrant(language: string): Promise<boolean>;
8
+ persistGrant(language: string, packages: readonly string[]): Promise<void>;
9
+ }
10
+ export declare function createGrantStore(grantsPath?: string): GrantStore;
@@ -0,0 +1,21 @@
1
+ export type NpmInstallResult = {
2
+ readonly ok: true;
3
+ } | {
4
+ readonly ok: false;
5
+ readonly reason: string;
6
+ };
7
+ export type NpmExecFn = (file: string, args: readonly string[], options: {
8
+ timeout: number;
9
+ signal?: AbortSignal;
10
+ }) => Promise<{
11
+ stdout: string;
12
+ stderr: string;
13
+ }>;
14
+ export declare const MAX_FAILURE_REASON_CHARS = 500;
15
+ export declare function sanitizeFailureReason(message: string): string;
16
+ export interface NpmCommand {
17
+ readonly file: string;
18
+ readonly args: readonly string[];
19
+ }
20
+ export declare function resolveNpmCommand(platform?: string, locateCli?: () => string | undefined, execPath?: string): NpmCommand | undefined;
21
+ export declare function runNpmInstall(language: string, packages: readonly string[], signal?: AbortSignal, execFn?: NpmExecFn, platform?: string, locateCli?: () => string | undefined): Promise<NpmInstallResult>;
@@ -0,0 +1,30 @@
1
+ import { LspClient } from './client.js';
2
+ import type { ServerSpec } from './server-spec.js';
3
+ export declare const ABANDONED_START_GRACE_MS = 1000;
4
+ export declare const DEFAULT_LSP_IDLE_SHUTDOWN_MS = 300000;
5
+ export declare function getIdleShutdownMs(): number;
6
+ export interface AcquireOptions {
7
+ readonly signal?: AbortSignal;
8
+ readonly timeoutMs?: number;
9
+ }
10
+ export interface LspServerPoolOptions {
11
+ readonly idleShutdownMs?: number;
12
+ readonly abandonedStartGraceMs?: number;
13
+ readonly startClient?: (spec: ServerSpec, root: string) => Promise<LspClient>;
14
+ }
15
+ export declare function poolKey(spec: ServerSpec, root: string): string;
16
+ export declare class LspServerPool {
17
+ private readonly opts;
18
+ private readonly entries;
19
+ private spawnCount;
20
+ constructor(opts?: LspServerPoolOptions);
21
+ get spawned(): number;
22
+ get size(): number;
23
+ acquire(spec: ServerSpec, root: string, opts?: AcquireOptions): Promise<LspClient>;
24
+ private createEntry;
25
+ private waitForStart;
26
+ private scheduleIdle;
27
+ private evict;
28
+ disposeAll(): Promise<void>;
29
+ }
30
+ export declare function getLspPool(): LspServerPool;
@@ -0,0 +1,18 @@
1
+ import { LspClient, type FileSync } from './client.js';
2
+ import { type LspServerPool } from './pool.js';
3
+ import type { PublishedDiagnostics } from './diagnostics-store.js';
4
+ import type { ServerSpec } from './server-spec.js';
5
+ export interface PooledQueryOptions {
6
+ readonly root: string;
7
+ readonly timeoutMs: number;
8
+ readonly signal?: AbortSignal;
9
+ readonly pool?: LspServerPool;
10
+ }
11
+ export interface QueryContext {
12
+ readonly client: LspClient;
13
+ readonly sync: FileSync;
14
+ readonly seqBeforeSync: number;
15
+ remainingMs(): number;
16
+ }
17
+ export declare function withPooledFile<T>(spec: ServerSpec, filePath: string, content: string, opts: PooledQueryOptions, fn: (ctx: QueryContext) => Promise<T>): Promise<T>;
18
+ export declare function awaitSyncDiagnostics(ctx: QueryContext, signal?: AbortSignal): Promise<PublishedDiagnostics | null>;
@@ -0,0 +1,12 @@
1
+ import type { ResolveServerFn, ServerDefinition } from './server-spec.js';
2
+ export declare function getServerDefinitions(): readonly ServerDefinition[];
3
+ export declare function definitionForFile(filePath: string): ServerDefinition | undefined;
4
+ export declare function detectProjectLanguages(root: string): ServerDefinition[];
5
+ export interface RegistryDeps {
6
+ readonly fsStat: (p: string) => boolean;
7
+ readonly pathLookup: (binName: string) => string | undefined;
8
+ readonly definitions?: readonly ServerDefinition[];
9
+ }
10
+ export declare function resolveServerWith(deps: RegistryDeps): ResolveServerFn;
11
+ export declare function findOnPath(binName: string, platform?: NodeJS.Platform): string | undefined;
12
+ export declare const resolveServer: ResolveServerFn;
@@ -0,0 +1,53 @@
1
+ export interface NpmInstallRecipe {
2
+ readonly kind: 'npm';
3
+ readonly packages: readonly string[];
4
+ }
5
+ export type InstallRecipe = NpmInstallRecipe;
6
+ export interface ServerDefinition {
7
+ readonly language: string;
8
+ readonly languageIds: Readonly<Record<string, string>>;
9
+ readonly rootMarkers: readonly string[];
10
+ readonly binName: string;
11
+ readonly args: readonly string[];
12
+ readonly install?: InstallRecipe;
13
+ readonly initializationOptions?: unknown;
14
+ readonly settings?: Readonly<Record<string, unknown>>;
15
+ }
16
+ export interface ServerSpec {
17
+ readonly definition: ServerDefinition;
18
+ readonly command: string;
19
+ readonly args: readonly string[];
20
+ readonly source: 'afk-install' | 'path' | 'override';
21
+ }
22
+ export type ResolveResult = {
23
+ readonly kind: 'resolved';
24
+ readonly spec: ServerSpec;
25
+ readonly root: string;
26
+ } | {
27
+ readonly kind: 'missing';
28
+ readonly definition: ServerDefinition;
29
+ readonly root: string;
30
+ } | {
31
+ readonly kind: 'unsupported';
32
+ };
33
+ export type ResolveServerFn = (filePath: string, sessionRoot?: string) => Promise<ResolveResult>;
34
+ export interface InstallContext {
35
+ readonly interactive: boolean;
36
+ readonly askConsent?: (prompt: string) => Promise<boolean>;
37
+ readonly signal?: AbortSignal;
38
+ }
39
+ export type EnsureInstalledResult = {
40
+ readonly kind: 'installed';
41
+ readonly command: string;
42
+ readonly freshInstall: boolean;
43
+ } | {
44
+ readonly kind: 'declined';
45
+ } | {
46
+ readonly kind: 'refused-unattended';
47
+ } | {
48
+ readonly kind: 'no-recipe';
49
+ } | {
50
+ readonly kind: 'failed';
51
+ readonly reason: string;
52
+ };
53
+ export type EnsureInstalledFn = (definition: ServerDefinition, ctx: InstallContext) => Promise<EnsureInstalledResult>;
@@ -0,0 +1,5 @@
1
+ import type { ServerDefinition, ServerSpec } from './server-spec.js';
2
+ export declare const DEFAULT_LSP_CMD: readonly ["typescript-language-server", "--stdio"];
3
+ export declare const TYPESCRIPT_SERVER_DEFINITION: ServerDefinition;
4
+ export declare function typescriptSpecFromCommand(cmd: readonly string[]): ServerSpec;
5
+ export declare function typescriptRootFor(filePath: string): string;
@@ -1,6 +1,17 @@
1
1
  import type { SdkPluginConfig } from '../types/sdk-types.js';
2
2
  import type { HarnessHookEvent, HookHandler, HookRegistry, RegisterOptions } from '../hooks.js';
3
+ import type { StateStore } from '../state/state-store.js';
4
+ import type { SendInput, SendToSessionResult } from '../peer/send.js';
5
+ import type { PresenceRecord } from '../awareness/presence.js';
3
6
  export type PluginApi = Pick<typeof import('../../skills/skill-registry.js'), 'registerSkill' | 'listSkills' | 'getSkill'> & Pick<typeof import('../../skills/_lib/prompt-loader.js'), 'loadSkillPrompts'> & Pick<typeof import('../../config/env.js'), 'env'> & Pick<typeof import('../subagent.js'), 'SubagentManager'> & Pick<typeof import('../subagent/result.js'), 'describeFailure'> & Pick<typeof import('../tools/skill-bridge.js'), 'discoverPluginSkillBodies'> & Pick<typeof import('../facets/index.js'), 'getOrDeriveFacet' | 'listSessionIds' | 'deriveSessionFacet' | 'loadStoredSession'> & Pick<typeof import('../../paths.js'), 'getAgentFrameworkDir' | 'getSkillsDir' | 'getSessionsDir'> & {
7
+ stateGet?: (namespace: string, key: string) => ReturnType<StateStore['get']>;
8
+ statePut?: (namespace: string, key: string, value: unknown, opts?: Parameters<StateStore['put']>[3]) => ReturnType<StateStore['put']>;
9
+ stateCas?: (namespace: string, key: string, expectedVersion: number, value: unknown, opts?: Parameters<StateStore['cas']>[4]) => ReturnType<StateStore['cas']>;
10
+ stateDel?: (namespace: string, key: string) => ReturnType<StateStore['del']>;
11
+ stateInsertIfAbsent?: (namespace: string, key: string, value: unknown, opts?: Parameters<StateStore['insertIfAbsent']>[3]) => ReturnType<StateStore['insertIfAbsent']>;
12
+ stateQuery?: (namespace: string, opts?: Parameters<StateStore['query']>[1]) => ReturnType<StateStore['query']>;
13
+ listSessions?: () => Promise<PresenceRecord[]>;
14
+ sendToSession?: (input: Omit<SendInput, 'from'>) => Promise<SendToSessionResult>;
4
15
  registerHook?: (event: HarnessHookEvent, handler: HookHandler, options?: RegisterOptions) => () => void;
5
16
  };
6
17
  export declare const registerPluginHook: NonNullable<PluginApi['registerHook']>;
@@ -10,5 +21,6 @@ export type LoadEntrypointsOptions = {
10
21
  importer?: (specifier: string) => Promise<unknown>;
11
22
  onError?: (plugin: SdkPluginConfig, error: unknown) => void;
12
23
  pluginApi?: PluginApi;
24
+ buildPluginApi?: (pluginName: string | null, plugin: SdkPluginConfig) => PluginApi | undefined;
13
25
  };
14
26
  export declare function loadPluginEntrypoints(plugins: readonly SdkPluginConfig[], opts?: LoadEntrypointsOptions): Promise<void>;
@@ -0,0 +1,6 @@
1
+ import { makeDefaultStateStore } from '../providers/shared/provider-stores.js';
2
+ import type { PluginApi } from './load-entrypoints.js';
3
+ export declare function getOrCreateDefaultStateStore(factory?: () => ReturnType<typeof makeDefaultStateStore>): ReturnType<typeof makeDefaultStateStore>;
4
+ export declare function _resetDefaultStateStore(): void;
5
+ export declare function buildStateApiClosures(pluginId?: string, factory?: () => ReturnType<typeof makeDefaultStateStore>): Pick<Required<PluginApi>, 'stateGet' | 'statePut' | 'stateCas' | 'stateDel' | 'stateInsertIfAbsent' | 'stateQuery'>;
6
+ export declare function buildPeerApiClosures(): Pick<Required<PluginApi>, 'listSessions' | 'sendToSession'>;
@@ -0,0 +1,3 @@
1
+ import { AsyncLocalStorage } from 'node:async_hooks';
2
+ export declare const pluginSessionContext: AsyncLocalStorage<string | undefined>;
3
+ export declare function runWithPluginSessionContext<T>(sessionId: string | undefined, fn: () => T): T;
@@ -4,4 +4,4 @@ export interface BillingStreamSource {
4
4
  getPendingChildBillingStreams(): readonly Promise<void>[];
5
5
  }
6
6
  export declare function pendingChildBillingStreams(...sources: ReadonlyArray<BillingStreamSource | undefined>): readonly Promise<void>[];
7
- export declare function managerShutdownConfig(manager: SubagentManager, composeExecutor?: BillingStreamSource): Pick<AgentConfig, 'drainSubagents' | 'getPendingChildTerminalWrites' | 'getPendingChildBillingStreams'>;
7
+ export declare function managerShutdownConfig(manager: SubagentManager, composeExecutor?: BillingStreamSource, drainTimeoutMs?: number): Pick<AgentConfig, 'drainSubagents' | 'getPendingChildTerminalWrites' | 'getPendingChildBillingStreams'>;
@@ -5,6 +5,7 @@ import { type CappedHandoff } from './capped-handoff.js';
5
5
  import { type Signal } from '../signal-block.js';
6
6
  export type SubagentStatus = 'idle' | 'running' | 'succeeded' | 'failed' | 'cancelled';
7
7
  export declare const STREAM_INCOMPLETE = "stream_incomplete";
8
+ export declare function isTerminalStopReason(s: string | undefined): boolean;
8
9
  export declare function isIncompleteStopReason(stopReason: string | undefined): boolean;
9
10
  export declare function annotateIfIncomplete(content: string, stopReason: string | undefined): string;
10
11
  export declare function incompleteToolResultFields(stopReason: string | undefined): {
@@ -5,6 +5,6 @@ export interface LspDiagnostic {
5
5
  col: number;
6
6
  }
7
7
  export declare function isLspDiagnosticsEnabled(): boolean;
8
- export declare function queryLspDiagnostics(filePath: string, serverCmd?: readonly string[]): Promise<LspDiagnostic[]>;
8
+ export declare function queryLspDiagnostics(filePath: string, serverCmd?: readonly string[], signal?: AbortSignal): Promise<LspDiagnostic[]>;
9
9
  export declare function formatDiagnostics(filePath: string, diags: LspDiagnostic[]): string;
10
- export declare function appendLspDiagnostics(filePath: string, serverCmd?: readonly string[]): Promise<string>;
10
+ export declare function appendLspDiagnostics(filePath: string, serverCmd?: readonly string[], signal?: AbortSignal): Promise<string>;
@@ -1,10 +1,4 @@
1
- import type { ChildProcess } from 'node:child_process';
2
- export declare function encodeMessage(obj: unknown): Buffer;
3
- export declare function killProc(proc: ChildProcess): void;
4
- export declare function parseMessages(buf: Buffer): {
5
- messages: unknown[];
6
- remaining: Buffer;
7
- };
8
- export declare function languageIdForExt(ext: string): string | undefined;
1
+ export declare function lspFailureMessage(err: unknown, timeoutMessage: string): string;
2
+ export declare function readLspSource(filePath: string, timeoutMs: number, signal?: AbortSignal): Promise<string>;
9
3
  export declare function getTimeoutMs(): number;
10
4
  export declare function getSymbolsTimeoutMs(): number;
@@ -1,4 +1,5 @@
1
1
  import type { ToolHandlerContext } from '../types.js';
2
+ import { DEFAULT_LSP_CMD } from '../../lsp/typescript-default.js';
2
3
  export interface LspLocation {
3
4
  filePath: string;
4
5
  line: number;
@@ -9,7 +10,7 @@ export interface LspSymbolResult {
9
10
  error?: string;
10
11
  }
11
12
  export type SymbolSubcommand = 'definition' | 'references';
12
- export declare const DEFAULT_LSP_CMD: readonly ["typescript-language-server", "--stdio"];
13
+ export { DEFAULT_LSP_CMD };
13
14
  export declare function parseLocation(raw: unknown): LspLocation | null;
14
15
  export declare function isLspSymbolsEnabled(): boolean;
15
16
  export declare function queryLspSymbol(filePath: string, subcommand: SymbolSubcommand, line: number, col: number, rootDir?: string, serverCmd?: readonly string[], signal?: AbortSignal): Promise<LspSymbolResult>;
@@ -32,4 +32,7 @@ export interface PluginSkillBody {
32
32
  export declare function discoverPluginSkillBodies(pluginConfigs?: SdkPluginConfig[], opts?: CollectSkillEntriesOptions): Map<string, PluginSkillBody>;
33
33
  export declare function discoverPluginAgents(pluginConfigs?: SdkPluginConfig[], warn?: (message: string) => void): RegisteredAgent[];
34
34
  export declare function scanAllPluginRoots(opts?: CollectSkillEntriesOptions): SdkPluginConfig[];
35
- export declare function ensurePluginEntrypointsLoaded(): Promise<void>;
35
+ export interface EnsurePluginEntrypointsOptions {
36
+ stateStore?: import('../state/state-store.js').StateStore;
37
+ }
38
+ export declare function ensurePluginEntrypointsLoaded(opts?: EnsurePluginEntrypointsOptions): Promise<void>;
@@ -58,4 +58,15 @@ export interface BuildChildConfigResult {
58
58
  childModelSource: ChildModelSource;
59
59
  modelFallback: ForkSubagentOptions['modelFallback'];
60
60
  }
61
+ export declare function buildChildConfigWithoutNesting(args: BuildChildConfigArgs): {
62
+ childConfig: AgentConfig;
63
+ childModel: string;
64
+ childWriteCapable: boolean;
65
+ childSideEffectFree: boolean;
66
+ resolvedAccess: import("../../agents/types.js").ResolvedAgentToolAccess | undefined;
67
+ effectiveAllowedTools: string[] | undefined;
68
+ effectiveReadOnlyBash: boolean;
69
+ childModelSource: ChildModelSource;
70
+ };
71
+ export declare function completeChildConfigNesting(args: BuildChildConfigArgs, pre: ReturnType<typeof buildChildConfigWithoutNesting>, nestingCwd: string | undefined): BuildChildConfigResult;
61
72
  export declare function buildChildConfig(args: BuildChildConfigArgs): BuildChildConfigResult;
@@ -1,3 +1,3 @@
1
1
  import { Command } from 'commander';
2
- export declare function resolveNpmCli(execPath?: string, existsFn?: (p: string) => boolean, realpathFn?: (p: string) => string): string | undefined;
2
+ export { resolveNpmCli } from '../../utils/npm-cli.js';
3
3
  export declare function registerUpdateCommand(program: Command): void;
@@ -1,8 +1,10 @@
1
1
  import type { BackgroundAgentRegistry } from '../agent/background-registry.js';
2
+ import type { ProcessJobRegistry } from '../agent/shell-jobs/process-jobs.js';
2
3
  import type { SessionStats } from './slash/types.js';
3
4
  export interface HealthRailOptions {
4
5
  stream?: NodeJS.WriteStream;
5
6
  backgroundRegistry?: BackgroundAgentRegistry;
7
+ processJobs?: ProcessJobRegistry;
6
8
  getExtraRows: () => number;
7
9
  getForegroundAgentCounts?: () => {
8
10
  active: number;
@@ -12,6 +14,7 @@ export interface HealthRailOptions {
12
14
  export declare class HealthRail {
13
15
  private readonly stream;
14
16
  private readonly registry;
17
+ private readonly processJobs;
15
18
  private readonly getExtraRows;
16
19
  private readonly getForegroundAgentCounts;
17
20
  private started;
@@ -24,6 +27,7 @@ export declare class HealthRail {
24
27
  private preResizePaintedRow;
25
28
  private totalBgSubsEver;
26
29
  private totalFgSubsEver;
30
+ private totalProcsEver;
27
31
  constructor(opts: HealthRailOptions);
28
32
  setRowCountChangeHandler(handler: (rows: number) => void): void;
29
33
  start(): void;
@@ -4,6 +4,8 @@ export interface HealthRailFields {
4
4
  toolCalls: number;
5
5
  activeSubs: number;
6
6
  totalSubs: number;
7
+ activeProcs: number;
8
+ totalProcs: number;
7
9
  contextRatio: number;
8
10
  }
9
11
  export declare function formatHealthRail(fields: HealthRailFields, maxWidth: number): string;