agent-afk 5.335.1 → 5.337.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 (134) 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/providers/shared/tool-grant.d.ts +1 -0
  20. package/dist/agent/session/manager-shutdown-config.d.ts +1 -1
  21. package/dist/agent/session-control/index.d.ts +1 -1
  22. package/dist/agent/session-control/preferences.d.ts +7 -0
  23. package/dist/agent/subagent/result.d.ts +1 -0
  24. package/dist/agent/tools/handlers/lsp-diagnostics.d.ts +2 -2
  25. package/dist/agent/tools/handlers/lsp-shared.d.ts +2 -8
  26. package/dist/agent/tools/handlers/lsp-symbols.d.ts +2 -1
  27. package/dist/agent/tools/skill-bridge.d.ts +4 -1
  28. package/dist/agent/tools/subagent/child-config.d.ts +11 -0
  29. package/dist/agent/usage/usage-awareness-toggle.d.ts +3 -0
  30. package/dist/bundled-plugins/awa-bundled/skills/ground-state/SKILL.md +6 -6
  31. package/dist/cli/commands/interactive/shared.d.ts +1 -0
  32. package/dist/cli/commands/interactive/startup-dashboard.d.ts +6 -0
  33. package/dist/cli/commands/interactive/startup-recall.d.ts +9 -0
  34. package/dist/cli/commands/interactive.register-helpers.d.ts +1 -0
  35. package/dist/cli/commands/update.d.ts +1 -1
  36. package/dist/cli/config/types.d.ts +2 -0
  37. package/dist/cli/health-rail.d.ts +4 -0
  38. package/dist/cli/health-rail.format.d.ts +2 -0
  39. package/dist/cli/render/status-line-format.d.ts +1 -0
  40. package/dist/cli/slash/commands/usage-awareness.d.ts +2 -0
  41. package/dist/cli/slash/types.d.ts +1 -0
  42. package/dist/cli.mjs +579 -585
  43. package/dist/config/env.d.ts +8 -0
  44. package/dist/config/env.tools.d.ts +8 -0
  45. package/dist/improve/scan/detectors/tool-failure-density.d.ts +7 -0
  46. package/dist/improve/schemas.d.ts +1 -0
  47. package/dist/index.mjs +432 -438
  48. package/dist/paths.lsp.d.ts +4 -0
  49. package/dist/telegram/bg-injection.d.ts +1 -0
  50. package/dist/telegram/handlers/message.wake-idle.d.ts +3 -0
  51. package/dist/telegram.mjs +462 -468
  52. package/dist/utils/kill-process-group.d.ts +1 -0
  53. package/dist/utils/npm-cli.d.ts +1 -0
  54. package/dist/web-server/session-owner.d.ts +1 -0
  55. package/dist/web-server/session-owner.lifecycle.d.ts +1 -1
  56. package/dist/web-ui-assets/assets/{angular-html-CGby4rdN.js → angular-html-CGhXdqey.js} +1 -1
  57. package/dist/web-ui-assets/assets/{angular-ts-CWecJxeS.js → angular-ts-CvXSYqzW.js} +1 -1
  58. package/dist/web-ui-assets/assets/{apl-CQJLvokg.js → apl-CHd928O5.js} +1 -1
  59. package/dist/web-ui-assets/assets/{astro-D6P7etYm.js → astro-BoLrHJmk.js} +1 -1
  60. package/dist/web-ui-assets/assets/{blade-B_syPIo5.js → blade-DY1IktSs.js} +1 -1
  61. package/dist/web-ui-assets/assets/{c-DJnZ7D_v.js → c-DxAZbdBx.js} +1 -1
  62. package/dist/web-ui-assets/assets/{chapel-CwJiH1oz.js → chapel-DYsDnfcl.js} +1 -1
  63. package/dist/web-ui-assets/assets/{cobol-DhDMPXHb.js → cobol-DWGkS6M4.js} +1 -1
  64. package/dist/web-ui-assets/assets/{coffee-pjMGiauK.js → coffee-DlkYkLNu.js} +1 -1
  65. package/dist/web-ui-assets/assets/{cpp-DOvBr8ik.js → cpp-EPEhiLov.js} +1 -1
  66. package/dist/web-ui-assets/assets/{crystal-BoEUmsxb.js → crystal-BEErPI0z.js} +1 -1
  67. package/dist/web-ui-assets/assets/{css-B0rzsnnS.js → css-B0GwOWpN.js} +1 -1
  68. package/dist/web-ui-assets/assets/{dist-BqRGew0s.js → dist-ETE6tN-C.js} +4 -4
  69. package/dist/web-ui-assets/assets/{edge-CUnkNqS-.js → edge-DSYFnYrA.js} +1 -1
  70. package/dist/web-ui-assets/assets/{elixir-C86qk8wq.js → elixir-YnBo-E2b.js} +1 -1
  71. package/dist/web-ui-assets/assets/{elm-D5Kj35b8.js → elm-BTbb8S23.js} +1 -1
  72. package/dist/web-ui-assets/assets/{erb-CzdX9WmJ.js → erb-CmjdbA27.js} +1 -1
  73. package/dist/web-ui-assets/assets/{git-rebase-BDh-Em6U.js → git-rebase-CGODI_wc.js} +1 -1
  74. package/dist/web-ui-assets/assets/{glimmer-js-DYSGQ13V.js → glimmer-js-CH0RFAMi.js} +1 -1
  75. package/dist/web-ui-assets/assets/{glimmer-ts-BNcakseI.js → glimmer-ts-C-QtJVYf.js} +1 -1
  76. package/dist/web-ui-assets/assets/{glsl-CCikFpzO.js → glsl-B4-SloMd.js} +1 -1
  77. package/dist/web-ui-assets/assets/{graphql--BnF_OCZ.js → graphql-DgGBaJER.js} +1 -1
  78. package/dist/web-ui-assets/assets/{hack-BFlZESOv.js → hack-CiownsYp.js} +1 -1
  79. package/dist/web-ui-assets/assets/{haml-Crrd40xD.js → haml-M26UGD_a.js} +1 -1
  80. package/dist/web-ui-assets/assets/{handlebars-CNmaX2Gn.js → handlebars-gqoiXao1.js} +1 -1
  81. package/dist/web-ui-assets/assets/{html-DOqbnBCU.js → html-DbYXE9Fl.js} +1 -1
  82. package/dist/web-ui-assets/assets/{html-derivative-CETo96ct.js → html-derivative-P6gcNKB0.js} +1 -1
  83. package/dist/web-ui-assets/assets/{http-DhOdqLhY.js → http-DnPL1Yqt.js} +1 -1
  84. package/dist/web-ui-assets/assets/{hurl-DCnWwPvH.js → hurl-DcpACPE-.js} +1 -1
  85. package/dist/web-ui-assets/assets/{index-BFlteB-V.js → index-J4Gmj9de.js} +10 -10
  86. package/dist/web-ui-assets/assets/{java-CnsooHft.js → java-8dkCcwWP.js} +1 -1
  87. package/dist/web-ui-assets/assets/{javascript-CI17tW_X.js → javascript-CjgqT0hZ.js} +1 -1
  88. package/dist/web-ui-assets/assets/{jinja-DzZt4dze.js → jinja-5n1p1jzI.js} +1 -1
  89. package/dist/web-ui-assets/assets/{jison-C_wtEGZd.js → jison-BirvaJHT.js} +1 -1
  90. package/dist/web-ui-assets/assets/{json-YF-Ww_JQ.js → json-DmipamAZ.js} +1 -1
  91. package/dist/web-ui-assets/assets/{jsx-CHWO1Eyj.js → jsx-w134sGXK.js} +1 -1
  92. package/dist/web-ui-assets/assets/{julia-DwAew3DL.js → julia-CP0_Sn17.js} +1 -1
  93. package/dist/web-ui-assets/assets/{just-CZoA6aZT.js → just-C2Hxq1M-.js} +1 -1
  94. package/dist/web-ui-assets/assets/{latex-DX2xQe1n.js → latex-C2pnLSMg.js} +1 -1
  95. package/dist/web-ui-assets/assets/{liquid-AfUcFT26.js → liquid-A9v-zdj1.js} +1 -1
  96. package/dist/web-ui-assets/assets/{lua-C2cHMM8Z.js → lua-BUYvMhIp.js} +1 -1
  97. package/dist/web-ui-assets/assets/{marko-DntcaETU.js → marko-DIaJyZ2t.js} +1 -1
  98. package/dist/web-ui-assets/assets/{mdc-CKuI14uF.js → mdc-DnSkIciD.js} +1 -1
  99. package/dist/web-ui-assets/assets/{nginx-BUZc8xEQ.js → nginx-BxbUPYEw.js} +1 -1
  100. package/dist/web-ui-assets/assets/{nim-BDiC38_I.js → nim-Dxaqe1Bn.js} +1 -1
  101. package/dist/web-ui-assets/assets/{org-CWIZIDsu.js → org-Bi4gmD-8.js} +1 -1
  102. package/dist/web-ui-assets/assets/{perl-CqfKDEuA.js → perl-DrrYP5ph.js} +1 -1
  103. package/dist/web-ui-assets/assets/{php-C9t9xzO6.js → php-DqWFNwEA.js} +1 -1
  104. package/dist/web-ui-assets/assets/{pug-BXdJu9Xj.js → pug-CeN90-9K.js} +1 -1
  105. package/dist/web-ui-assets/assets/{qml-CXLc9Ley.js → qml-CKa9kb6a.js} +1 -1
  106. package/dist/web-ui-assets/assets/{r-DvmOp3Qj.js → r-CfEfxRBn.js} +1 -1
  107. package/dist/web-ui-assets/assets/{razor-CehoHds_.js → razor-BJe66PT7.js} +1 -1
  108. package/dist/web-ui-assets/assets/{regexp-2Jz6kFIo.js → regexp-C3vAdVA_.js} +1 -1
  109. package/dist/web-ui-assets/assets/{rst-li0c-OgO.js → rst-hFT2ijNs.js} +1 -1
  110. package/dist/web-ui-assets/assets/{ruby-DgjL05GQ.js → ruby-C3iLnR5f.js} +1 -1
  111. package/dist/web-ui-assets/assets/{sas-D3iTM-e_.js → sas-I2KZLci2.js} +1 -1
  112. package/dist/web-ui-assets/assets/{scss-BdXhMSvs.js → scss-Bfvb3Jj7.js} +1 -1
  113. package/dist/web-ui-assets/assets/{shellscript-DZXSq2Sa.js → shellscript-zBQss7DO.js} +1 -1
  114. package/dist/web-ui-assets/assets/{shellsession-afdkG2Th.js → shellsession-DKWG3ja3.js} +1 -1
  115. package/dist/web-ui-assets/assets/{soy-DAH22tJm.js → soy-6kJwd0PX.js} +1 -1
  116. package/dist/web-ui-assets/assets/{sql-ChChe5fx.js → sql-ZKBtdTrV.js} +1 -1
  117. package/dist/web-ui-assets/assets/{stata-K9GgWIOl.js → stata-D1HN1GWw.js} +1 -1
  118. package/dist/web-ui-assets/assets/{surrealql-DSnomrcE.js → surrealql-B89pu-_8.js} +1 -1
  119. package/dist/web-ui-assets/assets/{svelte-CvOMu-RJ.js → svelte-DdjVDQDX.js} +1 -1
  120. package/dist/web-ui-assets/assets/{templ-CZIzP5bt.js → templ-CB3fWEmc.js} +1 -1
  121. package/dist/web-ui-assets/assets/{tex-DQPFp2kX.js → tex-DSK5fycz.js} +1 -1
  122. package/dist/web-ui-assets/assets/{ts-tags-DNZa03FK.js → ts-tags-CgD9RStv.js} +1 -1
  123. package/dist/web-ui-assets/assets/{tsx-Bhiv3C2c.js → tsx-Csypjqle.js} +1 -1
  124. package/dist/web-ui-assets/assets/{twig-DM6grruK.js → twig-PQ2ijmIy.js} +1 -1
  125. package/dist/web-ui-assets/assets/{typescript-BEKhIfXq.js → typescript-B4KejusE.js} +1 -1
  126. package/dist/web-ui-assets/assets/{typst-1k2A85Zx.js → typst-DA48RLSp.js} +1 -1
  127. package/dist/web-ui-assets/assets/{vue-Dm3l12e_.js → vue-C6y4X9p-.js} +1 -1
  128. package/dist/web-ui-assets/assets/{vue-html-DXMXrdEc.js → vue-html-1Vzn6gNz.js} +1 -1
  129. package/dist/web-ui-assets/assets/{vue-vine-B28qLIyO.js → vue-vine-DRny2ZQS.js} +1 -1
  130. package/dist/web-ui-assets/assets/{xml-BhP5fEtT.js → xml-k_Mgt1sq.js} +1 -1
  131. package/dist/web-ui-assets/assets/{xsl-OsxZZhWC.js → xsl-BvSmCHX2.js} +1 -1
  132. package/dist/web-ui-assets/assets/{yaml-BtFncb8y.js → yaml-BmZoDLOb.js} +1 -1
  133. package/dist/web-ui-assets/index.html +1 -1
  134. package/package.json +4 -3
@@ -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;
@@ -1,3 +1,4 @@
1
1
  import { type ToolPermissionConfig } from '../../tools/permissions.js';
2
2
  export declare function providerGrantsTool(toolName: string, permissions: ToolPermissionConfig | undefined, hasWorkspaceStore: boolean): boolean;
3
3
  export declare function grantsWorkspacePrompt(grantsTool: (toolName: string) => boolean): boolean;
4
+ export declare function grantsToolStrict(grantsTool: ((toolName: string) => boolean) | undefined, toolName: string): boolean;
@@ -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'>;
@@ -1,5 +1,5 @@
1
1
  export { clearConversation } from './clear.js';
2
2
  export { compactConversation, type CompactConversationResult, type CompactProgress } from './compact.js';
3
3
  export { setSessionModel, type SetSessionModelResult } from './model.js';
4
- export { setSessionName, sessionDisplayName, type SetSessionNameResult, type SessionNameOptions, THINKING_MODES, getSessionThinking, setSessionThinking, readSessionFast, setSessionFast, } from './preferences.js';
4
+ export { setSessionName, sessionDisplayName, type SetSessionNameResult, type SessionNameOptions, THINKING_MODES, getSessionThinking, setSessionThinking, readSessionFast, setSessionFast, getUsageAwareness, setUsageAwarenessPreference, } from './preferences.js';
5
5
  export { readSubscriptionUsage, readContextUsage, readLocalTokenUsage, readTokenUsage, readMcpStatus, readMcpOauthPending, type ContextUsage, type LocalTokenUsage, type TokenUsage, } from './reads.js';
@@ -22,6 +22,13 @@ export declare function setSessionThinking(stats: Pick<SessionStats, 'thinkingUi
22
22
  } | {
23
23
  ok: false;
24
24
  };
25
+ export declare function getUsageAwareness(stats: Pick<SessionStats, 'usageAwareness'>): boolean;
26
+ export declare function setUsageAwarenessPreference(stats: Pick<SessionStats, 'usageAwareness'>, value: string): {
27
+ ok: true;
28
+ enabled: boolean;
29
+ } | {
30
+ ok: false;
31
+ };
25
32
  export declare function readSessionFast(controller: FastModeController, context: FastModeContext): FastModeStatus;
26
33
  export declare function setSessionFast(controller: FastModeController, value: string): {
27
34
  ok: true;
@@ -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;
@@ -0,0 +1,3 @@
1
+ export declare function isUsageAwarenessEnabled(): boolean;
2
+ export declare function setUsageAwareness(value: boolean): void;
3
+ export declare function resetUsageAwarenessForTests(): void;
@@ -22,13 +22,13 @@ Run the four surveys below **directly using your own tools**. Do NOT dispatch an
22
22
 
23
23
  ### State survey *(bash)*
24
24
 
25
- Issue these commands (combine into one or two bash calls):
26
- - `git symbolic-ref --short HEAD` — current branch
25
+ Issue these commands (combine into one or two bash calls; when running under `git_read` instead of `bash`, adapt accordingly — `git_read` uses an argv allowlist, so use only the long-form flags shown here):
26
+ - `git rev-parse --abbrev-ref HEAD` — current branch
27
27
  - `git rev-parse HEAD` — HEAD SHA
28
28
  - `git status -s` — uncommitted changes
29
- - `git log --oneline -5` — recent commit history
30
- - `git stash list` — stash state
31
- - `git rev-list --left-right --count HEAD...@{upstream} 2>/dev/null` — upstream divergence
29
+ - `git log --oneline --max-count=5` — recent commit history
30
+ - `git stash list` — stash state (via `git_read`: subcommand `stash` with no arguments; the tool forces `list`)
31
+ - `git rev-list --count HEAD..@{upstream}` + `git rev-list --count @{upstream}..HEAD` — upstream divergence (ahead / behind)
32
32
 
33
33
  Adapt what you surface to the domain:
34
34
 
@@ -110,7 +110,7 @@ After the snapshot is assembled, construct the **Brief Anchor** — a path-verif
110
110
 
111
111
  **Construction procedure:**
112
112
 
113
- 1. From your state survey output, extract the verified `cwd` (absolute path from `pwd`), `branch` (from `git symbolic-ref --short HEAD`), and `HEAD` SHA (from `git rev-parse HEAD`).
113
+ 1. From your state survey output, extract the verified `cwd` (absolute path from `pwd`), `branch` (from `git rev-parse --abbrev-ref HEAD`), and `HEAD` SHA (from `git rev-parse HEAD`).
114
114
  2. From your infrastructure survey output, extract the 2–4 canonical file paths most relevant to the task. For each, run `stat <path>` — include the path only if `stat` exits 0. Paths that fail `stat` are omitted; if zero paths survive, set the list to `(none verified)`.
115
115
  3. Assemble the preamble block:
116
116
 
@@ -156,6 +156,7 @@ export declare const REPL_SPINNER_OPTIONS: {
156
156
  };
157
157
  export declare function contextRatio(stats: SessionStats, sampler?: ContextSampler): number;
158
158
  export declare function formatStatusFields(stats: SessionStats, sampler?: ContextSampler, gitSampler?: GitStatusSampler, maxTurns?: number, backgroundRegistry?: BackgroundAgentRegistry, maxBudgetUsd?: number): {
159
+ usageAwarenessOff?: boolean | undefined;
159
160
  activeAgentCount?: number | undefined;
160
161
  maxBudgetUsd?: number | undefined;
161
162
  budgetUsd?: number | undefined;
@@ -0,0 +1,6 @@
1
+ export interface StartupDashboardOpts {
2
+ isTTY: boolean;
3
+ isFirstRun: boolean;
4
+ bootPruneStaleCount?: number;
5
+ }
6
+ export declare function renderStartupDashboard(opts: StartupDashboardOpts): Promise<string[]>;
@@ -0,0 +1,9 @@
1
+ export declare function formatTimeAgo(isoString: string, now?: Date): string;
2
+ export interface StartupRecallOpts {
3
+ cwd: string;
4
+ isResume: boolean;
5
+ isTTY: boolean;
6
+ isFirstRun: boolean;
7
+ currentSessionId?: string;
8
+ }
9
+ export declare function renderStartupRecall(opts: StartupRecallOpts): string | undefined;
@@ -48,6 +48,7 @@ export interface StartupBannerParams {
48
48
  };
49
49
  worktreeCwd: string | undefined;
50
50
  bootPruneNotice: string | undefined;
51
+ bootPruneRemovedCount?: number;
51
52
  }
52
53
  export declare function printStartupBanner(params: StartupBannerParams): Promise<void>;
53
54
  export interface ResumeValidationResult {
@@ -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;
@@ -11,6 +11,7 @@ export interface AutoRoutingConfig {
11
11
  export interface CliConfig {
12
12
  tools?: {
13
13
  disabled?: string[];
14
+ usageAwareness?: boolean;
14
15
  };
15
16
  apiKey?: string;
16
17
  baseUrl?: string;
@@ -84,6 +85,7 @@ export interface ConfigFileSchema {
84
85
  tools?: {
85
86
  disabled?: string[];
86
87
  disabledBySlot?: Partial<Record<string, string[]>>;
88
+ usageAwareness?: boolean;
87
89
  };
88
90
  model?: string;
89
91
  models?: {